RE: [PATCH v3] vfio/cdx: add support for CDX bus

From: Gupta, Nipun
Date: Tue Apr 18 2023 - 00:20:07 EST


[AMD Official Use Only - General]



> -----Original Message-----
> From: Alex Williamson <alex.williamson@xxxxxxxxxx>
> Sent: Monday, April 17, 2023 7:51 PM
> To: Gupta, Nipun <Nipun.Gupta@xxxxxxx>
> Cc: jgg@xxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx;
> masahiroy@xxxxxxxxxx; nathan@xxxxxxxxxx; ndesaulniers@xxxxxxxxxx;
> nicolas@xxxxxxxxx; git (AMD-Xilinx) <git@xxxxxxx>; Anand, Harpreet
> <harpreet.anand@xxxxxxx>; Jansen Van Vuuren, Pieter <pieter.jansen-
> van-vuuren@xxxxxxx>; Agarwal, Nikhil <nikhil.agarwal@xxxxxxx>; Simek,
> Michal <michal.simek@xxxxxxx>
> Subject: Re: [PATCH v3] vfio/cdx: add support for CDX bus
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On Mon, 17 Apr 2023 14:07:25 +0530
> Nipun Gupta <nipun.gupta@xxxxxxx> wrote:
>
> > +static long vfio_cdx_ioctl(struct vfio_device *core_vdev,
> > + unsigned int cmd, unsigned long arg)
> > +{
> > + struct vfio_cdx_device *vdev =
> > + container_of(core_vdev, struct vfio_cdx_device, vdev);
> > + struct cdx_device *cdx_dev = to_cdx_device(core_vdev->dev);
> > + unsigned long minsz;
> > +
> > + switch (cmd) {
> > + case VFIO_DEVICE_GET_INFO:
> > + {
> > + struct vfio_device_info info;
> > +
> > + minsz = offsetofend(struct vfio_device_info, num_irqs);
> > +
> > + if (copy_from_user(&info, (void __user *)arg, minsz))
> > + return -EFAULT;
> > +
> > + if (info.argsz < minsz)
> > + return -EINVAL;
> > +
> > + info.flags = VFIO_DEVICE_FLAGS_CDX;
> > + info.flags = VFIO_DEVICE_FLAGS_RESET;
>
> Whoops, I think you mean |= for the latter one. Thanks,

Oh!! Will send a quick v4 fixing this.

Thanks,
Nipun

>
> Alex