x86/PCI: Expose VMD's pci_dev in struct pci_sysdata
authorJon Derrick <jonathan.derrick@intel.com>
Tue, 21 Jan 2020 13:37:46 +0000 (06:37 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 24 Jan 2020 20:54:50 +0000 (14:54 -0600)
Expose VMD's pci_dev pointer in struct pci_sysdata.  This will be used
indirectly by intel-iommu.c to find the correct domain.

Link: https://lore.kernel.org/r/1579613871-301529-3-git-send-email-jonathan.derrick@intel.com
[bhelgaas: commit log]
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Christoph Hellwig <hch@lst.de>
arch/x86/include/asm/pci.h
drivers/pci/controller/vmd.c

index a4e09db60f528f0f9acbc1a6abce07a040f2a716..6512c5469bbbd879973f5a6d82432f443e795bc3 100644 (file)
@@ -25,7 +25,7 @@ struct pci_sysdata {
        void            *fwnode;        /* IRQ domain for MSI assignment */
 #endif
 #if IS_ENABLED(CONFIG_VMD)
-       bool vmd_domain;                /* True if in Intel VMD domain */
+       struct pci_dev  *vmd_dev;       /* VMD Device if in Intel VMD domain */
 #endif
 };
 
@@ -64,7 +64,7 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
 #if IS_ENABLED(CONFIG_VMD)
 static inline bool is_vmd(struct pci_bus *bus)
 {
-       return to_pci_sysdata(bus)->vmd_domain;
+       return to_pci_sysdata(bus)->vmd_dev != NULL;
 }
 #else
 #define is_vmd(bus)            false
index 212842263f55b8fbc7e1b6e491eb03fcbac7ce96..d67ad568af658788f08b2836c380d04b4b498f29 100644 (file)
@@ -679,7 +679,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
                .parent = res,
        };
 
-       sd->vmd_domain = true;
+       sd->vmd_dev = vmd->dev;
        sd->domain = vmd_find_free_domain();
        if (sd->domain < 0)
                return sd->domain;