DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC] eal: remove support for I/O port
@ 2025-04-08 18:30 Stephen Hemminger
  2025-04-08 19:04 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2025-04-08 18:30 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Chenbo Xia, Nipun Gupta, Maxime Coquelin,
	Tyler Retzlaff

In early days of virtio, the x86 I/O instructions were used
to ring the doorbell for host access. To support these DPDK
needed to enable IO access. This is no longer necessary and
the vestiage can be marked deprecated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 doc/guides/rel_notes/deprecation.rst   |  4 ++++
 drivers/bus/pci/linux/pci_uio.c        | 15 ++-------------
 drivers/net/virtio/virtio_pci_ethdev.c |  1 -
 lib/eal/include/rte_eal.h              |  9 ++++-----
 lib/eal/linux/eal.c                    |  7 -------
 5 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 36489f6e68..473148b5c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -142,3 +142,7 @@ Deprecation Notices
 * bus/vmbus: Starting DPDK 25.11, all the vmbus API defined in
   ``drivers/bus/vmbus/rte_bus_vmbus.h`` will become internal to DPDK.
   Those API functions are used internally by DPDK core and netvsc PMD.
+
+* eal: No devices in DPDK currently use I/O port access (inb, outb)
+  and therefore the function to enable I/O port access rte_eal_iopl_init()
+  is deprecated and will be removed in 25.11 release.
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 4c1d3327a9..1914ecd34e 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -412,19 +412,8 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		goto error;
 
 	if (flags & IORESOURCE_IO) {
-		if (rte_eal_iopl_init()) {
-			PCI_LOG(ERR, "%s(): insufficient ioport permissions for PCI device %s",
-				__func__, dev->name);
-			goto error;
-		}
-
-		base = (unsigned long)phys_addr;
-		if (base > PIO_MAX) {
-			PCI_LOG(ERR, "%s(): %08lx too large PIO resource", __func__, base);
-			goto error;
-		}
-
-		PCI_LOG(DEBUG, "%s(): PIO BAR %08lx detected", __func__, base);
+		PCI_LOG(DEBUG, "%s(): PIO BAR %" PRIx64" ignored", __func__, phys_addr);
+		goto error;
 	} else if (flags & IORESOURCE_MEM) {
 		base = (unsigned long)dev->mem_resource[bar].addr;
 		PCI_LOG(DEBUG, "%s(): MMIO BAR %08lx detected", __func__, base);
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 9b4b846f8a..abb04abba1 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -233,7 +233,6 @@ static struct rte_pci_driver rte_virtio_net_pci_pmd = {
 
 RTE_INIT(rte_virtio_net_pci_pmd_init)
 {
-	rte_eal_iopl_init();
 	rte_pci_register(&rte_virtio_net_pci_pmd);
 }
 
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index c826e143f1..8d28e9f914 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -15,6 +15,7 @@
 #include <time.h>
 
 #include <rte_config.h>
+#include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_per_lcore.h>
 #include <rte_uuid.h>
@@ -49,12 +50,10 @@ enum rte_proc_type_t rte_eal_process_type(void);
 /**
  * Request iopl privilege for all RPL.
  *
- * This function should be called by pmds which need access to ioports.
-
- * @return
- *   - On success, returns 0.
- *   - On failure, returns -1.
+ * This function was used by pmds which need access to ioports.
+ * No longer used.
  */
+__rte_deprecated
 int rte_eal_iopl_init(void);
 
 /**
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 20f777b8b0..2f1523ffdb 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -20,9 +20,6 @@
 #include <limits.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#if defined(RTE_ARCH_X86)
-#include <sys/io.h>
-#endif
 #include <linux/version.h>
 
 #include <rte_common.h>
@@ -825,10 +822,6 @@ RTE_EXPORT_SYMBOL(rte_eal_iopl_init)
 int
 rte_eal_iopl_init(void)
 {
-#if defined(RTE_ARCH_X86)
-	if (iopl(3) != 0)
-		return -1;
-#endif
 	return 0;
 }
 
-- 
2.47.2


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

* Re: [RFC] eal: remove support for I/O port
  2025-04-08 18:30 [RFC] eal: remove support for I/O port Stephen Hemminger
@ 2025-04-08 19:04 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2025-04-08 19:04 UTC (permalink / raw)
  To: dev; +Cc: Chenbo Xia, Nipun Gupta, Maxime Coquelin, Tyler Retzlaff

On Tue,  8 Apr 2025 11:30:32 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> In early days of virtio, the x86 I/O instructions were used
> to ring the doorbell for host access. To support these DPDK
> needed to enable IO access. This is no longer necessary and
> the vestiage can be marked deprecated.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Not yet, FreeBSD still uses it and the virtio support still needs it.
Really needs to go since many kernels fully block userspace to I/O
because it allows unrestricted access to hardware.


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

end of thread, other threads:[~2025-04-08 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08 18:30 [RFC] eal: remove support for I/O port Stephen Hemminger
2025-04-08 19:04 ` Stephen Hemminger

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