Re: [PATCH v3 1/8] vfio/pci: Invalidate mmaps and block the access in D3hot power state

Bjorn Helgaas
2022-04-26T14:14:10Z

On Tue, Apr 26, 2022 at 09:42:45AM +0800, kernel test robot wrote:
> ...

> sparse warnings: (new ones prefixed by >>)
> >> drivers/vfio/pci/vfio_pci_config.c:703:13: sparse: sparse: restricted pci_power_t degrades to integer
> drivers/vfio/pci/vfio_pci_config.c:703:22: sparse: sparse: restricted pci_power_t degrades to integer

I dunno what Alex thinks, but we have several of these warnings in
drivers/pci/. I'd like to get rid of them, but we haven't figured out
a good way yet. So this might be something we just live with for now.

> vim +703 drivers/vfio/pci/vfio_pci_config.c
>
> 694
> 695 /*
> 696 * It takes all the required locks to protect the access of power related
> 697 * variables and then invokes vfio_pci_set_power_state().
> 698 */
> 699 static void
> 700 vfio_lock_and_set_power_state(struct vfio_pci_core_device *vdev,
> 701 pci_power_t state)
> 702 {
> > 703 if (state >= PCI_D3hot)
> 704 vfio_pci_zap_and_down_write_memory_lock(vdev);
> 705 else
> 706 down_write(&vdev->memory_lock);
> 707
> 708 vfio_pci_set_power_state(vdev, state);
> 709 up_write(&vdev->memory_lock);
> 710 }
> 711
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp