Skip to contentSkip to conversation

bus/pci: fix missing MMIO APIs in Windows

PATCH Applied Chenbo Xia 3 participants 4 messages Jun 8, 2023

lore
Share & tools
lore

Chenbo Xia

author
#0 lore raw

PATCH 1/1 bus/pci: fix missing MMIO APIs in Windows

MMIO read and write APIs were defined in PCI bus. But the corresponding implementations are not done in windows. This patch fixes this.

Bugzilla ID: 1245

Fixes 095cf6e68b28 ("bus/pci: introduce MMIO read/write")
---
 drivers/bus/pci/windows/pci.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/bus/pci/windows/pci.c +24 -0
index df5221d913..45a12bcb52 100644
@@ -88,6 +88,30 @@ rte_pci_write_config(const struct rte_pci_device *dev __rte_unused,
 	return 0;
 }
 
+/* Read PCI MMIO space. */
+int
+rte_pci_mmio_read(const struct rte_pci_device *dev, int bar,
+		      void *buf, size_t len, off_t offset)
+{
+	if (bar >= PCI_MAX_RESOURCE || dev->mem_resource[bar].addr == NULL ||
+			(uint64_t)offset + len > dev->mem_resource[bar].len)
+		return -1;
+	memcpy(buf, (uint8_t *)dev->mem_resource[bar].addr + offset, len);
+	return len;
+}
+
+/* Write PCI MMIO space. */
+int
+rte_pci_mmio_write(const struct rte_pci_device *dev, int bar,
+		       const void *buf, size_t len, off_t offset)
+{
+	if (bar >= PCI_MAX_RESOURCE || dev->mem_resource[bar].addr == NULL ||
+			(uint64_t)offset + len > dev->mem_resource[bar].len)
+		return -1;
+	memcpy((uint8_t *)dev->mem_resource[bar].addr + offset, buf, len);
+	return len;
+}
+
 enum rte_iova_mode
 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		const struct rte_pci_device *pdev __rte_unused)
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines

-----Original Message-----
From: Chenbo Xia <[email protected]>
Sent: Thursday, June 8, 2023 10:43 AM
To: [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Ali Alnubani <[email protected]>; [email protected]; [email protected]; [email protected]; Yahui Cao <[email protected]>; Sunil Kumar Kori <[email protected]>
Subject: [PATCH] bus/pci: fix missing MMIO APIs in Windows

MMIO read and write APIs were defined in PCI bus. But the corresponding implementations are not done in windows. This patch fixes this.

Quoted 6 lines

Bugzilla ID: 1245

Fixes 095cf6e68b28 ("bus/pci: introduce MMIO read/write")

---

Resolves the build failure for me, thanks Chenbo.

#2 lore raw
Quoted 23 lines

-----Original Message-----
From: Ali Alnubani <[email protected]>
Sent: Thursday, June 8, 2023 4:55 PM
To: Xia, Chenbo <[email protected]>; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; [email protected]; Li, Miao <[email protected]>; [email protected]; Cao, Yahui <[email protected]>; Sunil Kumar Kori <[email protected]>
Subject: RE: [PATCH] bus/pci: fix missing MMIO APIs in Windows

Quoted 13 lines

-----Original Message-----
From: Chenbo Xia <[email protected]>
Sent: Thursday, June 8, 2023 10:43 AM
To: [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Ali Alnubani <[email protected]>; [email protected]; [email protected]; [email protected]; Yahui Cao <[email protected]>; Sunil Kumar Kori <[email protected]>
Subject: [PATCH] bus/pci: fix missing MMIO APIs in Windows

MMIO read and write APIs were defined in PCI bus. But the corresponding implementations are not done in windows. This patch fixes this.

Quoted 8 lines
Quoted 6 lines

Bugzilla ID: 1245

Fixes 095cf6e68b28 ("bus/pci: introduce MMIO read/write")

---

Resolves the build failure for me, thanks Chenbo.

Great to know! Thanks for reporting this and test the fix with quick action :)

Cheers,
Chenbo

Quoted 2 lines
#3 lore raw

08/06/2023 10:58, Xia, Chenbo:

Quoted 13 lines

From: Ali Alnubani <[email protected]>

Quoted 12 lines

From: Chenbo Xia <[email protected]>

Quoted 10 lines

MMIO read and write APIs were defined in PCI bus. But the corresponding implementations are not done in windows. This patch fixes this.

Bugzilla ID: 1245

Fixes 095cf6e68b28 ("bus/pci: introduce MMIO read/write")

---

Quoted 10 lines
Quoted 1 line

Resolves the build failure for me, thanks Chenbo.

Great to know! Thanks for reporting this and test the fix with quick action :)

Cheers,
Chenbo

Quoted 2 lines

Adding Reported-by: Ali Alnubani <[email protected]>

Applied, thanks.