linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Enable io space 1k granularity for intel cpu root port
@ 2024-06-21  2:06 Zhou Shengqing
  2024-06-21 21:02 ` Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Zhou Shengqing @ 2024-06-21  2:06 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: zhoushengqing

This patch add 1k granularity for intel root port bridge.Intel latest
server CPU support 1K granularity,And there is an BIOS setup item named
"EN1K",but linux doesn't support it. if an IIO has 5 IOU (SPR has 5 IOUs)
all are bifurcated 2x8.In a 2P server system,There are 20 P2P bridges
present.if keep 4K granularity allocation,it need 20*4=80k io space,
exceeding 64k.I test it in a 16*nvidia 4090s system under intel eaglestrem
platform.There are six 4090s that cannot be allocated I/O resources.
So I applied this patch.And I found a similar implementation in quirks.c,
but it only targets the Intel P64H2 platform.

Signed-off-by: Zhou Shengqing <zhoushengqing@ttyinfo.com>
---
 drivers/pci/probe.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5fbabb4e3425..3f0c901c6653 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -461,6 +461,8 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
 	u32 buses;
 	u16 io;
 	u32 pmem, tmp;
+	u16 ven_id, dev_id;
+	u16 en1k = 0;
 	struct resource res;
 
 	pci_read_config_dword(bridge, PCI_PRIMARY_BUS, &buses);
@@ -478,6 +480,26 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
 	}
 	if (io) {
 		bridge->io_window = 1;
+		if (pci_is_root_bus(bridge->bus)) {
+			list_for_each_entry(dev, &bridge->bus->devices, bus_list) {
+				pci_read_config_word(dev, PCI_VENDOR_ID, &ven_id);
+				pci_read_config_word(dev, PCI_DEVICE_ID, &dev_id);
+				if (ven_id == PCI_VENDOR_ID_INTEL && dev_id == 0x09a2) {
+					/*IIO MISC Control offset 0x1c0*/
+					pci_read_config_word(dev, 0x1c0, &en1k);
+				}
+			}
+		/*
+		 *Intel ICX SPR EMR GNR
+		 *IIO MISC Control (IIOMISCCTRL_1_5_0_CFG) — Offset 1C0h
+		 *bit 2:Enable 1K (EN1K)
+		 *This bit when set, enables 1K granularity for I/O space decode
+		 *in each of the virtual P2P bridges
+		 *corresponding to root ports, and DMI ports.
+		 */
+		if (en1k & 0x4)
+			bridge->io_window_1k = 1;
+		}
 		pci_read_bridge_io(bridge, &res, true);
 	}
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-07-26  2:27 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21  2:06 [PATCH] PCI: Enable io space 1k granularity for intel cpu root port Zhou Shengqing
2024-06-21 21:02 ` Bjorn Helgaas
2024-06-22 15:06   ` zhoushengqing
2024-06-22 17:52     ` Bjorn Helgaas
2024-06-23  2:26       ` Zhou Shengqing
2024-06-24  8:01         ` Zhou Shengqing
2024-06-26  8:27 ` kernel test robot
2024-06-26 10:09 ` kernel test robot
2024-06-26 11:19   ` [PATCH v2] [PATCH v2] " Zhou Shengqing
2024-06-26 15:26     ` Bjorn Helgaas
2024-06-27  0:58       ` [PATCH v3] " Zhou Shengqing
2024-06-29 21:34         ` Bjorn Helgaas
2024-06-30  2:52           ` Re: [PATCH] " Zhou Shengqing
2024-07-01 21:06             ` Bjorn Helgaas
2024-07-02  3:56               ` [PATCH v4] Subject: " Zhou Shengqing
2024-07-12 18:48                 ` Bjorn Helgaas
2024-07-23  8:04                   ` Zhou Shengqing
2024-07-24  2:34                     ` Ethan Zhao
2024-07-24  3:38                       ` Zhou Shengqing
2024-07-24  5:39                         ` Ethan Zhao
2024-07-24  6:35                           ` [PATCH v4] " Zhou Shengqing
2024-07-24  7:51                             ` Ethan Zhao
2024-07-25  7:44                               ` Zhou Shengqing
2024-07-26  2:27                                 ` Ethan Zhao
2024-07-02  5:49               ` Re: Re: [PATCH] PCI: Enable io space 1k granularity for Zhou Shengqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).