Re: [PATCH Part2 v6 12/49] crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 19, 2022 at 01:48:48PM -0500, Kalra, Ashish wrote:
> Another follow up:
> 
> > > >   int sev_platform_init(int *error);
> > > > +/**
> > > > + * sev_snp_init - perform SEV SNP_INIT command
> > > > + *
> > > > + * @error: SEV command return code
> > > > + *
> > > > + * Returns:
> > > > + * 0 if the SEV successfully processed the command
> > > > + * -%ENODEV    if the SEV device is not available
> > > > + * -%ENOTSUPP  if the SEV does not support SEV
> > > > + * -%ETIMEDOUT if the SEV command timed out
> > > > + * -%EIO       if the SEV returned a non-zero return code
> > > 
> > > Something's weird with those args. I think it should be
> > > 
> > >     %-ENODEV
> > > 
> > > and so on...
> > > 
> > 
> > Yes, off course %-<errno>
> > 
> 
> I see that other drivers are also using the same convention:
> 
> include/linux/regset.h:
> ..
> /**
>  * user_regset_set_fn - type of @set function in &struct user_regset
>  * @target:     thread being examined
>  * @regset:     regset being examined
>  * @pos:        offset into the regset data to access, in bytes
>  * @count:      amount of data to copy, in bytes
>  * @kbuf:       if not %NULL, a kernel-space pointer to copy from
>  * @ubuf:       if @kbuf is %NULL, a user-space pointer to copy from
>  *
>  * Store register values.  Return %0 on success; -%EIO or -%ENODEV
>  * are usual failure returns.  The @pos and @count values are in
> ...
> 
> include/linux/psp-tee.h:
> ..
> /**
>  * psp_tee_process_cmd() - Process command in Trusted Execution Environment
>  * @cmd_id:     TEE command ID (&enum tee_cmd_id)
>  * @buf:        Command buffer for TEE processing. On success, is updated
>  *              with the response
>  * @len:        Length of command buffer in bytes
>  * @status:     On success, holds the TEE command execution status
>  *
>  * This function submits a command to the Trusted OS for processing in the
>  * TEE environment and waits for a response or until the command times out.
>  *
>  * Returns:
>  * 0 if TEE successfully processed the command
>  * -%ENODEV    if PSP device not available
>  * -%EINVAL    if invalid input
>  * -%ETIMEDOUT if TEE command timed out
>  * -%EBUSY     if PSP device is not responsive
>  */
> ...
> 
> Thanks,
> Ashis

In SGX driver the convention is:

* Return:
* - -ENODEV  ...
* - -EINVAL  ...

"Return:" because this is what kernel-nanodoc-HOWTO.txt suggests.

The dashes are recognized by Sphinx as list so each return code
gets a newline when processed through "make htmldocs". Otherwise,
you get a mess because newlines will be removed.

I don't actually have idea of '%' and neither see it in the kernel
documenation.

BR, Jarkko




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux