From: "Cédric Le Goater" <clegoate@redhat.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Cc: jjherne@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com,
mjrosato@linux.ibm.com, alex.williamson@redhat.com,
borntraeger@linux.ibm.com
Subject: Re: [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl
Date: Wed, 31 May 2023 14:54:51 +0200 [thread overview]
Message-ID: <ee46966a-920a-37f6-9554-b2b10565cd58@redhat.com> (raw)
In-Reply-To: <20230530223538.279198-2-akrowiak@linux.ibm.com>
On 5/31/23 00:35, Tony Krowiak wrote:
> Realize the VFIO_DEVICE_GET_IRQ_INFO ioctl to retrieve the information for
> the VFIO device request IRQ.
>
> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> drivers/s390/crypto/vfio_ap_ops.c | 30 +++++++++++++++++++++++++++++-
> include/uapi/linux/vfio.h | 9 +++++++++
> 2 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index cfbcb864ab63..35cd90eee937 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -1750,7 +1750,32 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
>
> info.flags = VFIO_DEVICE_FLAGS_AP | VFIO_DEVICE_FLAGS_RESET;
> info.num_regions = 0;
> - info.num_irqs = 0;
> + info.num_irqs = VFIO_AP_NUM_IRQS;
> +
> + return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
> +}
> +
> +static ssize_t vfio_ap_get_irq_info(unsigned long arg)
> +{
> + unsigned long minsz;
> + struct vfio_irq_info info;
> +
> + minsz = offsetofend(struct vfio_irq_info, count);
> +
> + if (copy_from_user(&info, (void __user *)arg, minsz))
> + return -EFAULT;
> +
> + if (info.argsz < minsz || info.index >= VFIO_AP_NUM_IRQS)
> + return -EINVAL;
> +
> + switch (info.index) {
> + case VFIO_AP_REQ_IRQ_INDEX:
> + info.count = 1;
> + info.flags = VFIO_IRQ_INFO_EVENTFD;
> + break;
> + default:
> + return -EINVAL;
> + }
>
> return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
> }
> @@ -1770,6 +1795,9 @@ static ssize_t vfio_ap_mdev_ioctl(struct vfio_device *vdev,
> case VFIO_DEVICE_RESET:
> ret = vfio_ap_mdev_reset_queues(&matrix_mdev->qtable);
> break;
> + case VFIO_DEVICE_GET_IRQ_INFO:
> + ret = vfio_ap_get_irq_info(arg);
> + break;
> default:
> ret = -EOPNOTSUPP;
> break;
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index 0552e8dcf0cb..b71276bd7f91 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -646,6 +646,15 @@ enum {
> VFIO_CCW_NUM_IRQS
> };
>
> +/*
> + * The vfio-ap bus driver makes use of the following IRQ index mapping.
> + * Unimplemented IRQ types return a count of zero.
> + */
> +enum {
> + VFIO_AP_REQ_IRQ_INDEX,
> + VFIO_AP_NUM_IRQS
> +};
> +
> /**
> * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
> * struct vfio_pci_hot_reset_info)
next prev parent reply other threads:[~2023-05-31 12:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 22:35 [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Tony Krowiak
2023-05-30 22:35 ` [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl Tony Krowiak
2023-05-31 12:54 ` Cédric Le Goater [this message]
2023-05-31 13:05 ` Anthony Krowiak
2023-05-31 13:20 ` Cédric Le Goater
2023-06-01 20:46 ` Alex Williamson
2023-05-30 22:35 ` [PATCH 2/3] vfio: ap: realize the VFIO_DEVICE_SET_IRQS ioctl Tony Krowiak
2023-05-31 13:00 ` Cédric Le Goater
2023-05-30 22:35 ` [PATCH 3/3] s390/vfio-ap: Wire in the vfio_device_ops request callback Tony Krowiak
2023-05-31 13:01 ` Cédric Le Goater
2023-05-31 14:48 ` [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Matthew Rosato
2023-06-01 12:15 ` Anthony Krowiak
2023-06-01 12:57 ` Matthew Rosato
2023-05-31 14:51 ` Matthew Rosato
2023-06-01 20:47 ` Alex Williamson
2023-06-02 12:46 ` Alexander Gordeev
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=ee46966a-920a-37f6-9554-b2b10565cd58@redhat.com \
--to=clegoate@redhat.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@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