Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470907 > unrolled thread

[PATCHv2 0/2] VMD PCIe specific LED control

Started byKeith Busch <keith.busch@intel.com>
First post2016-08-26 19:30 +0200
Last post2016-08-26 19:30 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCHv2 0/2] VMD PCIe specific LED control Keith Busch <keith.busch@intel.com> - 2016-08-26 19:30 +0200
    [PATCHv2 2/2] x86/vmd: Add PCI domain specific LED option Keith Busch <keith.busch@intel.com> - 2016-08-26 19:30 +0200

#1470907 — [PATCHv2 0/2] VMD PCIe specific LED control

FromKeith Busch <keith.busch@intel.com>
Date2016-08-26 19:30 +0200
Subject[PATCHv2 0/2] VMD PCIe specific LED control
Message-ID<sat74-1Ar-13@gated-at.bofh.it>
Here is the second version for handling non-standard LED status in VMD
domains. There are significant differences this time around:

First, after discussing the original proposal, we decided that we
can't support allowing user space have direct write access to config
space. This potentially breaks the PCIe Slot Control command sequence,
so patch 1/2 provides an alternate sysfs attention setter/getter in
addition to ignoring the indicators for standard usage.

Second, I've since learned that there is no such VID/DID list I can use
in order to flag this quirk. The exact same devices with the quirk behave
differently when used outside a VMD domain. Since this quirk behavior
is specific to the VMD PCIe domain, the new approach is to set options
specific to domains as pci_dev's are being added.

Since patch 2/2 requires changes to x86 common code, I've added the
x86 maintainers in addition to PCI, and I'll re-summarize what this
feature/quirk is about:

This came from wanting a simple SGPIO-like LED management solution for
PCIe SSDs. The Intel group who made this hardware, not considering the
more broad impact on standarization, chose to reuse the hot plug serial
SMBus in the Intel CPUs (aka VPP) that already carried the Slot Control
register bits out of the CPU.

This hardware implementation therefore re-purposes the Slot Control's
Attention Indicator Control and Power Indicator Control of the PCI
Express Capabilities structure. Rather than using the PCIe standard
interpretation, this hardware uses IBPI (International Blinking Pattern
Interpretation).

One side affect is that the Attention and Power indicator presence bits
in the Slot Capabilities structures must remain enabled due to how
the hardware is wired. This would confuse the pciehp driver since it
would incorrectly (albeit understandably) assume how to control these
capabilities. So this patch series has to tell pciehp to keep away from
controlling these indicators and provide a way for the user to set
them instead.

This quirky behavior consideration is only required for the current
generation of this hardware. Future generations will use standards
compliance as being pursued within the PCI-SIG and NVMe-MI standards
bodies.

Keith Busch (2):
  pciehp: Let user control LED status
  x86/vmd: Add PCI domain specific LED option

 arch/x86/include/asm/pci.h        | 14 ++++++++++++++
 arch/x86/pci/common.c             |  7 +++++++
 arch/x86/pci/vmd.c                |  1 +
 drivers/pci/hotplug/pciehp.h      |  1 +
 drivers/pci/hotplug/pciehp_core.c | 26 ++++++++++++++++++++++++++
 drivers/pci/hotplug/pciehp_hpc.c  |  6 +++++-
 include/linux/pci.h               |  1 +
 7 files changed, 55 insertions(+), 1 deletion(-)

-- 
2.7.2

[toc] | [next] | [standalone]


#1470908 — [PATCHv2 2/2] x86/vmd: Add PCI domain specific LED option

FromKeith Busch <keith.busch@intel.com>
Date2016-08-26 19:30 +0200
Subject[PATCHv2 2/2] x86/vmd: Add PCI domain specific LED option
Message-ID<sat74-1Ar-23@gated-at.bofh.it>
In reply to#1470907
This patch adds a new function to set PCI domain specific options as
devices are added. The usage included in this patch is for LED indicator
control in VMD domains, but may be extended in the future as new domain
specific options are required.

PCIe LED Slot Control in a VMD domain is repurposed to a non-standard
implementation. As such, all devices in a VMD domain will be flagged so
that pciehp does not attempt to use LED indicators. This user_led flag
has pciehp provide a different sysfs entry for user exclusive control
over the domain's slot indicators.

In order to determine if a bus is within a PCI domain, the patch appends
a bool to the pci_sysdata structure that the VMD driver sets during
initialization.

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>
---
 arch/x86/include/asm/pci.h | 14 ++++++++++++++
 arch/x86/pci/common.c      |  7 +++++++
 arch/x86/pci/vmd.c         |  1 +
 3 files changed, 22 insertions(+)

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 9ab7507..1411dbe 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -23,6 +23,9 @@ struct pci_sysdata {
 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
 	void		*fwnode;	/* IRQ domain for MSI assignment */
 #endif
+#if IS_ENABLED(CONFIG_VMD)
+	bool vmd_domain;		/* True if in Intel VMD domain */
+#endif
 };
 
 extern int pci_routeirq;
@@ -56,6 +59,17 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
 #define pci_root_bus_fwnode	_pci_root_bus_fwnode
 #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
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b6a9d1..ccf696c 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)
 static void set_dma_domain_ops(struct pci_dev *pdev) {}
 #endif
 
+static void set_dev_domain_options(struct pci_dev *pdev)
+{
+	if (is_vmd(pdev->bus))
+		pdev->user_leds = 1;
+}
+
 int pcibios_add_device(struct pci_dev *dev)
 {
 	struct setup_data *data;
@@ -707,6 +713,7 @@ int pcibios_add_device(struct pci_dev *dev)
 		iounmap(data);
 	}
 	set_dma_domain_ops(dev);
+	set_dev_domain_options(dev);
 	return 0;
 }
 
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index b73da50..3014f8e 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -604,6 +604,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
 		.parent = res,
 	};
 
+	sd->vmd_domain = true;
 	sd->domain = vmd_find_free_domain();
 	if (sd->domain < 0)
 		return sd->domain;
-- 
2.7.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web