DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] bus/pci: fix missing MMIO APIs in Windows
@ 2023-06-08  7:43 Chenbo Xia
  2023-06-08  8:54 ` Ali Alnubani
  0 siblings, 1 reply; 4+ messages in thread
From: Chenbo Xia @ 2023-06-08  7:43 UTC (permalink / raw)
  To: dev
  Cc: david.marchand, thomas, alialnu, probb, miao.li, stable,
	Yahui Cao, Sunil Kumar Kori

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")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/bus/pci/windows/pci.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index df5221d913..45a12bcb52 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -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)
-- 
2.17.1


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

* RE: [PATCH] bus/pci: fix missing MMIO APIs in Windows
  2023-06-08  7:43 [PATCH] bus/pci: fix missing MMIO APIs in Windows Chenbo Xia
@ 2023-06-08  8:54 ` Ali Alnubani
  2023-06-08  8:58   ` Xia, Chenbo
  0 siblings, 1 reply; 4+ messages in thread
From: Ali Alnubani @ 2023-06-08  8:54 UTC (permalink / raw)
  To: Chenbo Xia, dev
  Cc: david.marchand, NBU-Contact-Thomas Monjalon (EXTERNAL),
	probb, miao.li, stable, Yahui Cao, Sunil Kumar Kori

> -----Original Message-----
> From: Chenbo Xia <chenbo.xia@intel.com>
> Sent: Thursday, June 8, 2023 10:43 AM
> To: dev@dpdk.org
> Cc: david.marchand@redhat.com; NBU-Contact-Thomas Monjalon
> (EXTERNAL) <thomas@monjalon.net>; Ali Alnubani <alialnu@nvidia.com>;
> probb@iol.unh.edu; miao.li@intel.com; stable@dpdk.org; Yahui Cao
> <yahui.cao@intel.com>; Sunil Kumar Kori <skori@marvell.com>
> 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.
> 
> Bugzilla ID: 1245
> Fixes: 095cf6e68b28 ("bus/pci: introduce MMIO read/write")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---

Resolves the build failure for me, thanks Chenbo.

Tested-by: Ali Alnubani <alialnu@nvidia.com>

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

* RE: [PATCH] bus/pci: fix missing MMIO APIs in Windows
  2023-06-08  8:54 ` Ali Alnubani
@ 2023-06-08  8:58   ` Xia, Chenbo
  2023-06-08 10:04     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Xia, Chenbo @ 2023-06-08  8:58 UTC (permalink / raw)
  To: Ali Alnubani, dev
  Cc: david.marchand, NBU-Contact-Thomas Monjalon (EXTERNAL),
	probb, Li, Miao, stable, Cao, Yahui, Sunil Kumar Kori

> -----Original Message-----
> From: Ali Alnubani <alialnu@nvidia.com>
> Sent: Thursday, June 8, 2023 4:55 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; dev@dpdk.org
> Cc: david.marchand@redhat.com; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; probb@iol.unh.edu; Li, Miao <miao.li@intel.com>;
> stable@dpdk.org; Cao, Yahui <yahui.cao@intel.com>; Sunil Kumar Kori
> <skori@marvell.com>
> Subject: RE: [PATCH] bus/pci: fix missing MMIO APIs in Windows
> 
> > -----Original Message-----
> > From: Chenbo Xia <chenbo.xia@intel.com>
> > Sent: Thursday, June 8, 2023 10:43 AM
> > To: dev@dpdk.org
> > Cc: david.marchand@redhat.com; NBU-Contact-Thomas Monjalon
> > (EXTERNAL) <thomas@monjalon.net>; Ali Alnubani <alialnu@nvidia.com>;
> > probb@iol.unh.edu; miao.li@intel.com; stable@dpdk.org; Yahui Cao
> > <yahui.cao@intel.com>; Sunil Kumar Kori <skori@marvell.com>
> > 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.
> >
> > Bugzilla ID: 1245
> > Fixes: 095cf6e68b28 ("bus/pci: introduce MMIO read/write")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> > ---
> 
> Resolves the build failure for me, thanks Chenbo.

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

Cheers,
Chenbo

> 
> Tested-by: Ali Alnubani <alialnu@nvidia.com>

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

* Re: [PATCH] bus/pci: fix missing MMIO APIs in Windows
  2023-06-08  8:58   ` Xia, Chenbo
@ 2023-06-08 10:04     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2023-06-08 10:04 UTC (permalink / raw)
  To: Ali Alnubani, Xia, Chenbo
  Cc: dev, david.marchand, probb, Li, Miao, stable, Cao, Yahui,
	Sunil Kumar Kori

08/06/2023 10:58, Xia, Chenbo:
> From: Ali Alnubani <alialnu@nvidia.com>
> > From: Chenbo Xia <chenbo.xia@intel.com>
> > >
> > > 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")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> > > ---
> > 
> > Resolves the build failure for me, thanks Chenbo.
> 
> Great to know! Thanks for reporting this and test the fix
> with quick action :)
> 
> Cheers,
> Chenbo
> 
> > 
> > Tested-by: Ali Alnubani <alialnu@nvidia.com>

Adding Reported-by: Ali Alnubani <alialnu@nvidia.com>

Applied, thanks.



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

end of thread, other threads:[~2023-06-08 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08  7:43 [PATCH] bus/pci: fix missing MMIO APIs in Windows Chenbo Xia
2023-06-08  8:54 ` Ali Alnubani
2023-06-08  8:58   ` Xia, Chenbo
2023-06-08 10:04     ` Thomas Monjalon

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).