On 2/20/25 11:48 PM, Alex Williamson wrote:
> This is now redundant to PCIDevice.pm_cap.
>
> Cc: Cédric Le Goater <c...@redhat.com>
> Signed-off-by: Alex Williamson <alex.william...@redhat.com>
Reviewed-by: Eric Auger <eric.au...@redhat.com>
Eric
> ---
> hw/vfio/pci.c | 9 ++++-----
> hw/vfio/pci.h | 1 -
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 6903f831e45f..ba4ef65b16fa 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2215,7 +2215,6 @@ static bool vfio_add_std_cap(VFIOPCIDevice *vdev,
> uint8_t pos, Error **errp)
> break;
> case PCI_CAP_ID_PM:
> vfio_check_pm_reset(vdev, pos);
> - vdev->pm_cap = pos;
> ret = pci_pm_init(pdev, pos, errp) >= 0;
> break;
> case PCI_CAP_ID_AF:
> @@ -2407,17 +2406,17 @@ void vfio_pci_pre_reset(VFIOPCIDevice *vdev)
> vfio_disable_interrupts(vdev);
>
> /* Make sure the device is in D0 */
> - if (vdev->pm_cap) {
> + if (pdev->pm_cap) {
> uint16_t pmcsr;
> uint8_t state;
>
> - pmcsr = vfio_pci_read_config(pdev, vdev->pm_cap + PCI_PM_CTRL, 2);
> + pmcsr = vfio_pci_read_config(pdev, pdev->pm_cap + PCI_PM_CTRL, 2);
> state = pmcsr & PCI_PM_CTRL_STATE_MASK;
> if (state) {
> pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
> - vfio_pci_write_config(pdev, vdev->pm_cap + PCI_PM_CTRL, pmcsr,
> 2);
> + vfio_pci_write_config(pdev, pdev->pm_cap + PCI_PM_CTRL, pmcsr,
> 2);
> /* vfio handles the necessary delay here */
> - pmcsr = vfio_pci_read_config(pdev, vdev->pm_cap + PCI_PM_CTRL,
> 2);
> + pmcsr = vfio_pci_read_config(pdev, pdev->pm_cap + PCI_PM_CTRL,
> 2);
> state = pmcsr & PCI_PM_CTRL_STATE_MASK;
> if (state) {
> error_report("vfio: Unable to power on device, stuck in D%d",
> diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
> index 43c166680abb..d638c781f6f1 100644
> --- a/hw/vfio/pci.h
> +++ b/hw/vfio/pci.h
> @@ -160,7 +160,6 @@ struct VFIOPCIDevice {
> int32_t bootindex;
> uint32_t igd_gms;
> OffAutoPCIBAR msix_relo;
> - uint8_t pm_cap;
> uint8_t nv_gpudirect_clique;
> bool pci_aer;
> bool req_enabled;