diff options
author | Keith Busch <keith.busch@intel.com> | 2016-09-13 11:05:40 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-09-23 09:41:08 -0400 |
commit | 3161832d58c7f3bf8b190a2887086be0932d8dd3 (patch) | |
tree | 2d310a553c2c47d16dd32d275324f669168a4836 | |
parent | 576243b3f9eaa47ab568ac49574b3a095c2365f1 (diff) |
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: Kapil Karkra <kapil.karkra@intel.com>
Tested-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | arch/x86/include/asm/pci.h | 14 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 7 | ||||
-rw-r--r-- | arch/x86/pci/vmd.c | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 9ab7507ca1c2..1411dbed5e5e 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -23,6 +23,9 @@ struct pci_sysdata { | |||
23 | #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN | 23 | #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN |
24 | void *fwnode; /* IRQ domain for MSI assignment */ | 24 | void *fwnode; /* IRQ domain for MSI assignment */ |
25 | #endif | 25 | #endif |
26 | #if IS_ENABLED(CONFIG_VMD) | ||
27 | bool vmd_domain; /* True if in Intel VMD domain */ | ||
28 | #endif | ||
26 | }; | 29 | }; |
27 | 30 | ||
28 | extern int pci_routeirq; | 31 | extern int pci_routeirq; |
@@ -56,6 +59,17 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus) | |||
56 | #define pci_root_bus_fwnode _pci_root_bus_fwnode | 59 | #define pci_root_bus_fwnode _pci_root_bus_fwnode |
57 | #endif | 60 | #endif |
58 | 61 | ||
62 | static inline bool is_vmd(struct pci_bus *bus) | ||
63 | { | ||
64 | #if IS_ENABLED(CONFIG_VMD) | ||
65 | struct pci_sysdata *sd = bus->sysdata; | ||
66 | |||
67 | return sd->vmd_domain; | ||
68 | #else | ||
69 | return false; | ||
70 | #endif | ||
71 | } | ||
72 | |||
59 | /* Can be used to override the logic in pci_scan_bus for skipping | 73 | /* Can be used to override the logic in pci_scan_bus for skipping |
60 | already-configured bus numbers - to be used for buggy BIOSes | 74 | already-configured bus numbers - to be used for buggy BIOSes |
61 | or architectures with incomplete PCI setup by the loader */ | 75 | or architectures with incomplete PCI setup by the loader */ |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 7b6a9d14c8c0..a4fdfa7dcc1b 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -677,6 +677,12 @@ static void set_dma_domain_ops(struct pci_dev *pdev) | |||
677 | static void set_dma_domain_ops(struct pci_dev *pdev) {} | 677 | static void set_dma_domain_ops(struct pci_dev *pdev) {} |
678 | #endif | 678 | #endif |
679 | 679 | ||
680 | static void set_dev_domain_options(struct pci_dev *pdev) | ||
681 | { | ||
682 | if (is_vmd(pdev->bus)) | ||
683 | pdev->hotplug_user_indicators = 1; | ||
684 | } | ||
685 | |||
680 | int pcibios_add_device(struct pci_dev *dev) | 686 | int pcibios_add_device(struct pci_dev *dev) |
681 | { | 687 | { |
682 | struct setup_data *data; | 688 | struct setup_data *data; |
@@ -707,6 +713,7 @@ int pcibios_add_device(struct pci_dev *dev) | |||
707 | iounmap(data); | 713 | iounmap(data); |
708 | } | 714 | } |
709 | set_dma_domain_ops(dev); | 715 | set_dma_domain_ops(dev); |
716 | set_dev_domain_options(dev); | ||
710 | return 0; | 717 | return 0; |
711 | } | 718 | } |
712 | 719 | ||
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c index b814ca675131..a021b7b0eb69 100644 --- a/arch/x86/pci/vmd.c +++ b/arch/x86/pci/vmd.c | |||
@@ -596,6 +596,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd) | |||
596 | .parent = res, | 596 | .parent = res, |
597 | }; | 597 | }; |
598 | 598 | ||
599 | sd->vmd_domain = true; | ||
599 | sd->domain = vmd_find_free_domain(); | 600 | sd->domain = vmd_find_free_domain(); |
600 | if (sd->domain < 0) | 601 | if (sd->domain < 0) |
601 | return sd->domain; | 602 | return sd->domain; |