public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Steffen Eiden <seiden@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Viktor Mihajlovski <mihajlov@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Nico Boehr <nrb@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Hendrik Brueckner <brueckner@linux.ibm.com>
Subject: Re: [PATCH v2 1/6] s390/uvdevice: Add info IOCTL
Date: Mon, 5 Jun 2023 14:39:26 +0200	[thread overview]
Message-ID: <ddb1e8bf-fb4d-0899-3884-15be2d34c852@linux.ibm.com> (raw)
In-Reply-To: <20230519093708.810957-2-seiden@linux.ibm.com>

On 5/19/23 11:37, Steffen Eiden wrote:
> Add an IOCTL that allows userspace to find out which IOCTLs the uvdevice
> supports without trial and error.
> 
> Explicitly expose the IOCTL nr for the request types.
> 
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
[...]
>   #endif /* __S390_ASM_UVDEVICE_H */
> diff --git a/drivers/s390/char/uvdevice.c b/drivers/s390/char/uvdevice.c
> index 1d40457c7b10..61c7f284c5c5 100644
> --- a/drivers/s390/char/uvdevice.c
> +++ b/drivers/s390/char/uvdevice.c
> @@ -20,6 +20,7 @@
>    *  channel for userspace to the Ultravisor.
>    */
>   
> +#include "asm-generic/ioctl.h"
>   #include <linux/module.h>
>   #include <linux/kernel.h>
>   #include <linux/miscdevice.h>
> @@ -32,6 +33,51 @@
>   #include <asm/uvdevice.h>
>   #include <asm/uv.h>
>   
> +/* Mapping from IOCTL-nr to UVC-bit */
> +static const u64 ioctl_nr_to_uvc_bit[] __initconst = {

This can be u32 since cmds are u16.

> +	[UVIO_IOCTL_UVDEV_INFO_NR] = -1UL,

#define BIT_UVIO_INTERNAL U32_MAX

> +	[UVIO_IOCTL_ATT_NR] = BIT_UVC_CMD_RETR_ATTEST,
> +};
> +
> +static_assert(ARRAY_SIZE(ioctl_nr_to_uvc_bit) == UVIO_IOCTL_NUM_IOCTLS);
> +
> +static struct uvio_uvdev_info uvdev_info = {
> +	.supp_uvio_cmds = GENMASK_ULL(UVIO_IOCTL_NUM_IOCTLS - 1, 0),
> +};
> +
> +static void __init set_supp_uv_cmds(struct uvio_uvdev_info *info)
> +{
> +	int i;
> +
> +	for (i = 0; i < UVIO_IOCTL_NUM_IOCTLS; i++) {
> +		if (ioctl_nr_to_uvc_bit[i] == -1UL)

BIT_UVIO_INTERNAL

> +			continue;
> +		if (!test_bit_inv(ioctl_nr_to_uvc_bit[i], uv_info.inst_calls_list))
> +			continue;
> +		__set_bit(i, (unsigned long *)&info->supp_uv_cmds);

Move the cast to the caller and make this function take a "unsigned long 
*)" argument.

> +	}
> +}
> +
> +/**
> + * uvio_uvdev_info() - get information about the uvdevice
> + *
> + * @uv_ioctl: ioctl control block
> + *
> + * Lists all supported IOCTLs by this uvdevice

Lists all IOCTLs that are supported by this uvdevice

[...]

Rest seems fine to me.

  reply	other threads:[~2023-06-05 12:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  9:37 [PATCH v2 0/6] s390/uvdevice: Expose secret UVCs Steffen Eiden
2023-05-19  9:37 ` [PATCH v2 1/6] s390/uvdevice: Add info IOCTL Steffen Eiden
2023-06-05 12:39   ` Janosch Frank [this message]
2023-05-19  9:37 ` [PATCH v2 2/6] s390/uvdevice: Add 'Add Secret' UVC Steffen Eiden
2023-06-05 13:19   ` Janosch Frank
2023-05-19  9:37 ` [PATCH v2 3/6] s390/uvdevice: Add 'List Secrets' UVC Steffen Eiden
2023-06-05 13:29   ` Janosch Frank
2023-05-19  9:37 ` [PATCH v2 4/6] s390/uvdevice: Add 'Lock Secret Store' UVC Steffen Eiden
2023-06-05 13:34   ` Janosch Frank
2023-05-19  9:37 ` [PATCH v2 5/6] s390/uv: replace scnprintf with sysfs_emit Steffen Eiden
2023-06-05 13:55   ` Janosch Frank
2023-05-19  9:37 ` [PATCH v2 6/6] s390/uv: Update query for secret-UVCs Steffen Eiden
2023-06-05 14:03   ` Janosch Frank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddb1e8bf-fb4d-0899-3884-15be2d34c852@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mihajlov@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox