Skip to contentSkip to conversation

VMD support for 8086:9A0B

PATCH Superseded Jon Derrick 2 participants 5 messages Nov 11, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover VMD support for 8086:9A0B

This set adds VMD support for device 8086:9A0B. The first patch adds another bus range restriction and the second adds the device id.

Jon Derrick (2):
PCI: vmd: Add bus 224-255 restriction decode
PCI: vmd: Add device id for VMD device 8086:9A0B

 drivers/pci/controller/vmd.c | 32 ++++++++++++++++++++++++--------
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 PCI: vmd: Add bus 224-255 restriction decode

VMD bus restrictions are required when IO fabric is multiplexed such that VMD cannot use the entire bus range. This patch adds another bus restriction decode bit that can be set by firmware to restrict the VMD bus range from 224-255.

---
 drivers/pci/controller/vmd.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/pci/controller/vmd.c +22 -8
index a35d3f3..db00a71 100644
@@ -602,16 +602,30 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 
 	/*
 	 * Certain VMD devices may have a root port configuration option which
-	 * limits the bus range to between 0-127 or 128-255
+	 * limits the bus range to between 0-127, 128-255, or 224-255
 	 */
 	if (features & VMD_FEAT_HAS_BUS_RESTRICTIONS) {
-		u32 vmcap, vmconfig;
-
-		pci_read_config_dword(vmd->dev, PCI_REG_VMCAP, &vmcap);
-		pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig);
-		if (BUS_RESTRICT_CAP(vmcap) &&
-		    (BUS_RESTRICT_CFG(vmconfig) == 0x1))
-			vmd->busn_start = 128;
+		u16 reg16;
+
+		pci_read_config_word(vmd->dev, PCI_REG_VMCAP, &reg16);
+		if (BUS_RESTRICT_CAP(reg16)) {
+			pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG,
+					     &reg16);
+
+			switch (BUS_RESTRICT_CFG(reg16)) {
+			case(1):
+				vmd->busn_start = 128;
+				break;
+			case(2):
+				vmd->busn_start = 224;
+				break;
+			case(3):
+				pci_err(vmd->dev, "Unknown Bus Offset Setting\n");
+				return -ENODEV;
+			default:
+				break;
+			}
+		}
 	}
 
 	res = &vmd->dev->resource[VMD_CFGBAR];
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [PATCH 1/2] PCI: vmd: Add bus 224-255 restriction decode

Quoted 4 lines · Jon Derrick

VMD bus restrictions are required when IO fabric is multiplexed such that VMD cannot use the entire bus range. This patch adds another bus restriction decode bit that can be set by firmware to restrict the VMD bus range from 224-255.

The code suggests that such a device is restricted *to* that range, not from it.

drivers/pci/controller/vmd.c static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) · line 627

Quoted 13 lines
drivers/pci/controller/vmd.c +13 -0
+			switch (BUS_RESTRICT_CFG(reg16)) {
+			case(1):
+				vmd->busn_start = 128;
+				break;
+			case(2):
+				vmd->busn_start = 224;
+				break;
+			case(3):
+				pci_err(vmd->dev, "Unknown Bus Offset Setting\n");
+				return -ENODEV;
+			default:
+				break;
+			}

Just a nit for consistent sytle, every other switch case looks like:

	case 1:
		...
	case 2:
		...
	case 3:
		...
#3 lore raw

PATCH 2/2 PCI: vmd: Add device id for VMD device 8086:9A0B

In reply to Jon Derrick

This patch adds support for this VMD device which supports the bus restriction mode.

---
 drivers/pci/controller/vmd.c | 2 ++
 include/linux/pci_ids.h      | 1 +
 2 files changed, 3 insertions(+)
drivers/pci/controller/vmd.c +2 -0
index db00a71..cec7872 100644
@@ -868,6 +868,8 @@ static int vmd_resume(struct device *dev)
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_28C0),
 		.driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW |
 				VMD_FEAT_HAS_BUS_RESTRICTIONS,},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_9A0B),
+		.driver_data = VMD_FEAT_HAS_BUS_RESTRICTIONS,},
 	{0,}
 };
 MODULE_DEVICE_TABLE(pci, vmd_ids);
include/linux/pci_ids.h +1 -0
index 21a5724..3ad3d52 100644
@@ -3006,6 +3006,7 @@
 #define PCI_DEVICE_ID_INTEL_84460GX	0x84ea
 #define PCI_DEVICE_ID_INTEL_IXP4XX	0x8500
 #define PCI_DEVICE_ID_INTEL_IXP2800	0x9004
+#define PCI_DEVICE_ID_INTEL_VMD_9A0B	0x9A0B
 #define PCI_DEVICE_ID_INTEL_S21152BB	0xb152
 
 #define PCI_VENDOR_ID_SCALEMP		0x8686
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Jon Derrick

+Keith
https://patchwork.kernel.org/project/linux-pci/list/?series=201147

Quoted 11 lines · Jon Derrick

This set adds VMD support for device 8086:9A0B. The first patch adds another bus range restriction and the second adds the device id.

Jon Derrick (2):
PCI: vmd: Add bus 224-255 restriction decode
PCI: vmd: Add device id for VMD device 8086:9A0B

 drivers/pci/controller/vmd.c | 32 ++++++++++++++++++++++++--------
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 8 deletions(-)