On Mon, 24 Nov 2025 09:39:58 +0800 liulongfang <[email protected]> wrote:
> On 2025/11/8 1:41, Jason Gunthorpe wrote: > > Change the function signature of hisi_acc_vfio_pci_ioctl() > > and re-indent it. > > > > Reviewed-by: Kevin Tian <[email protected]> > > Acked-by: Pranjal Shrivastava <[email protected]> > > Signed-off-by: Jason Gunthorpe <[email protected]> > > --- > > .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 57 +++++++++---------- > > 1 file changed, 27 insertions(+), 30 deletions(-) > > > > diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > > b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > > index fde33f54e99ec5..899db4d742a010 100644 > > --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > > +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > > @@ -1324,43 +1324,39 @@ static ssize_t hisi_acc_vfio_pci_read(struct > > vfio_device *core_vdev, > > return vfio_pci_core_read(core_vdev, buf, new_count, ppos); > > } > > > > -static long hisi_acc_vfio_pci_ioctl(struct vfio_device *core_vdev, > > unsigned int cmd, > > - unsigned long arg) > > +static int hisi_acc_vfio_ioctl_get_region(struct vfio_device *core_vdev, > > + struct vfio_region_info __user *arg) > > { > > - if (cmd == VFIO_DEVICE_GET_REGION_INFO) { > > - struct vfio_pci_core_device *vdev = > > - container_of(core_vdev, struct vfio_pci_core_device, > > vdev); > > - struct pci_dev *pdev = vdev->pdev; > > - struct vfio_region_info info; > > - unsigned long minsz; > > + struct vfio_pci_core_device *vdev = > > + container_of(core_vdev, struct vfio_pci_core_device, vdev); > > + struct pci_dev *pdev = vdev->pdev; > > + struct vfio_region_info info; > > + unsigned long minsz; > > > > - minsz = offsetofend(struct vfio_region_info, offset); > > + minsz = offsetofend(struct vfio_region_info, offset); > > > > - if (copy_from_user(&info, (void __user *)arg, minsz)) > > - return -EFAULT; > > + if (copy_from_user(&info, arg, minsz)) > > + return -EFAULT; > > > > - if (info.argsz < minsz) > > - return -EINVAL; > > + if (info.argsz < minsz) > > + return -EINVAL; > > > > - if (info.index == VFIO_PCI_BAR2_REGION_INDEX) { > > - info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index); > > + if (info.index != VFIO_PCI_BAR2_REGION_INDEX) > > + return vfio_pci_ioctl_get_region_info(core_vdev, arg); > > > > - /* > > - * ACC VF dev BAR2 region consists of both functional > > - * register space and migration control register space. > > - * Report only the functional region to Guest. > > - */ > > - info.size = pci_resource_len(pdev, info.index) / 2; > > + info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index); > > > > Please adapt based on the latest code in the Next branch. > Code updates have already been made here. I resolved this on commit, please verify in the vfio next branch. Thanks, Alex
