Commit 3161832d authored by Keith Busch's avatar Keith Busch Committed by Bjorn Helgaas

x86/PCI: VMD: Request userspace control of PCIe hotplug indicators

Add set_dev_domain_options() to set PCI domain-specific options as devices
are added.  The first usage is to request exclusive userspace control of
PCIe hotplug indicators in VMD domains.

Devices in a VMD domain use PCIe hotplug Attention and Power Indicators in
a non-standard way; tell pciehp to ignore the indicators so userspace can
control them via the sysfs "attention" file.

To determine whether a bus is within a VMD domain, add a bool to the
pci_sysdata structure that the VMD driver sets during initialization.

[bhelgaas: changelog]
Requested-by: default avatarKapil Karkra <kapil.karkra@intel.com>
Tested-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 576243b3
...@@ -23,6 +23,9 @@ struct pci_sysdata { ...@@ -23,6 +23,9 @@ struct pci_sysdata {
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
void *fwnode; /* IRQ domain for MSI assignment */ void *fwnode; /* IRQ domain for MSI assignment */
#endif #endif
#if IS_ENABLED(CONFIG_VMD)
bool vmd_domain; /* True if in Intel VMD domain */
#endif
}; };
extern int pci_routeirq; extern int pci_routeirq;
...@@ -56,6 +59,17 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus) ...@@ -56,6 +59,17 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
#define pci_root_bus_fwnode _pci_root_bus_fwnode #define pci_root_bus_fwnode _pci_root_bus_fwnode
#endif #endif
static inline bool is_vmd(struct pci_bus *bus)
{
#if IS_ENABLED(CONFIG_VMD)
struct pci_sysdata *sd = bus->sysdata;
return sd->vmd_domain;
#else
return false;
#endif
}
/* Can be used to override the logic in pci_scan_bus for skipping /* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */ or architectures with incomplete PCI setup by the loader */
......
...@@ -677,6 +677,12 @@ static void set_dma_domain_ops(struct pci_dev *pdev) ...@@ -677,6 +677,12 @@ static void set_dma_domain_ops(struct pci_dev *pdev)
static void set_dma_domain_ops(struct pci_dev *pdev) {} static void set_dma_domain_ops(struct pci_dev *pdev) {}
#endif #endif
static void set_dev_domain_options(struct pci_dev *pdev)
{
if (is_vmd(pdev->bus))
pdev->hotplug_user_indicators = 1;
}
int pcibios_add_device(struct pci_dev *dev) int pcibios_add_device(struct pci_dev *dev)
{ {
struct setup_data *data; struct setup_data *data;
...@@ -707,6 +713,7 @@ int pcibios_add_device(struct pci_dev *dev) ...@@ -707,6 +713,7 @@ int pcibios_add_device(struct pci_dev *dev)
iounmap(data); iounmap(data);
} }
set_dma_domain_ops(dev); set_dma_domain_ops(dev);
set_dev_domain_options(dev);
return 0; return 0;
} }
......
...@@ -596,6 +596,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd) ...@@ -596,6 +596,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
.parent = res, .parent = res,
}; };
sd->vmd_domain = true;
sd->domain = vmd_find_free_domain(); sd->domain = vmd_find_free_domain();
if (sd->domain < 0) if (sd->domain < 0)
return sd->domain; return sd->domain;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment