hisi_acc_vfio_pci: Restrict access to VF dev BAR2 migration region
authorShameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Tue, 8 Mar 2022 18:48:58 +0000 (18:48 +0000)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 15 Mar 2022 17:34:08 +0000 (11:34 -0600)
commit6abdce51af1a21b11d325756e654c50a1fa53afe
tree8c27f7c9f5f808459a7146766f1139a7adf85878
parentee3a5b2359e0e5bf6198ffb3b330a12deacebf0f
hisi_acc_vfio_pci: Restrict access to VF dev BAR2 migration region

HiSilicon ACC VF device BAR2 region consists of both functional register
space and migration control register space. Unnecessarily exposing the
migration BAR region to the Guest has the potential to prevent/corrupt
the Guest migration.

Hence, introduce a separate struct vfio_device_ops for migration support
which will override the ioctl/read/write/mmap methods to hide the
migration region and limit the Guest access only to the functional
register space.

This will be used in subsequent patches when we add migration support
to the driver.

Please note that it is OK to export the entire VF BAR if migration is
not supported or required as this cannot affect the PF configurations.

Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20220308184902.2242-6-shameerali.kolothum.thodi@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c