DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/6] Some drivers logging cleanups
@ 2024-06-25 12:24 David Marchand
  2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev

This series removes the last direct calls to some RTE_LOGTYPE_ coming
from libraries (EAL and CRYPTODEV) and replaces them with dedicated
macros coming from the drivers.


-- 
David Marchand

David Marchand (6):
  vdpa/sfc: remove dead code
  drivers: use dedicated log macros instead of EAL logtype
  net/sfc: remove use of EAL logtype
  vdpa/sfc: remove use of EAL logtype
  bus/pci: use a dynamic logtype
  crypto/ccp: use a dynamic logtype

 drivers/bus/auxiliary/auxiliary_common.c |   4 +-
 drivers/bus/dpaa/dpaa_bus.c              |   4 +-
 drivers/bus/fslmc/fslmc_vfio.c           |   2 +-
 drivers/bus/pci/bsd/pci.c                |  44 +++---
 drivers/bus/pci/linux/pci.c              |  52 +++----
 drivers/bus/pci/linux/pci_uio.c          |  75 ++++------
 drivers/bus/pci/linux/pci_vfio.c         | 173 ++++++++++-------------
 drivers/bus/pci/pci_common.c             |  85 +++++------
 drivers/bus/pci/pci_common_uio.c         |  15 +-
 drivers/bus/pci/pci_params.c             |   9 +-
 drivers/bus/pci/private.h                |   6 +
 drivers/bus/pci/windows/pci.c            |  13 +-
 drivers/bus/pci/windows/pci_netuio.c     |   7 +-
 drivers/common/qat/qat_device.c          |   4 +-
 drivers/crypto/ccp/ccp_crypto.c          |   4 +-
 drivers/crypto/ccp/ccp_pmd_private.h     |  15 +-
 drivers/crypto/ccp/rte_ccp_pmd.c         |   2 +
 drivers/net/cnxk/cnxk_rep_msg.c          |   2 +-
 drivers/net/cpfl/cpfl_ethdev.c           |   2 +-
 drivers/net/mlx4/mlx4.c                  |   2 +-
 drivers/net/sfc/sfc_ethdev.c             |  12 +-
 drivers/net/sfc/sfc_log.h                |   2 +-
 drivers/vdpa/sfc/sfc_vdpa.c              |   6 +-
 drivers/vdpa/sfc/sfc_vdpa_hw.c           |   2 -
 24 files changed, 226 insertions(+), 316 deletions(-)

-- 
2.45.2


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

* [PATCH 1/6] vdpa/sfc: remove dead code
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-25 14:25   ` Andrew Rybchenko
  2024-06-25 12:24 ` [PATCH 2/6] drivers: use dedicated log macros instead of EAL logtype David Marchand
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev; +Cc: stable, Vijay Kumar Srivastava, Maxime Coquelin, Andrew Rybchenko

This is probably a copy/paste from the net/sfc driver.
sfc_logtype_driver is not a logtype variable from the sfc vDPA driver.
Remove it.

Fixes: 6dad9a7353d4 ("vdpa/sfc: support device initialization")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/vdpa/sfc/sfc_vdpa_hw.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
index edb7e35c2c..7e43719f53 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
@@ -13,8 +13,6 @@
 #include "sfc_vdpa.h"
 #include "sfc_vdpa_ops.h"
 
-extern uint32_t sfc_logtype_driver;
-
 #ifndef PAGE_SIZE
 #define PAGE_SIZE   (sysconf(_SC_PAGESIZE))
 #endif
-- 
2.45.2


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

* [PATCH 2/6] drivers: use dedicated log macros instead of EAL logtype
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
  2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-25 12:24 ` [PATCH 3/6] net/sfc: remove use " David Marchand
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena, Kai Ji,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Harman Kalra, Matan Azrad, Viacheslav Ovsiienko

Those drivers already have their own logtype and set of logging macros.
Use them instead of logging as EAL.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c | 4 ++--
 drivers/bus/dpaa/dpaa_bus.c              | 4 ++--
 drivers/bus/fslmc/fslmc_vfio.c           | 2 +-
 drivers/common/qat/qat_device.c          | 4 ++--
 drivers/net/cnxk/cnxk_rep_msg.c          | 2 +-
 drivers/net/cpfl/cpfl_ethdev.c           | 2 +-
 drivers/net/mlx4/mlx4.c                  | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 29f99342a7..e6cbc4d356 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -106,10 +106,10 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,
 	}
 
 	if (dev->device.numa_node < 0 && rte_socket_count() > 1)
-		RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
+		AUXILIARY_LOG(INFO, "Device %s is not NUMA-aware", dev->name);
 
 	if (rte_dev_is_probed(&dev->device)) {
-		RTE_LOG(DEBUG, EAL, "Device %s is already probed on auxiliary bus\n",
+		AUXILIARY_LOG(DEBUG, "Device %s is already probed on auxiliary bus",
 			dev->device.name);
 		return -EEXIST;
 	}
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5d4352bb3c..bb27daef38 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -499,7 +499,7 @@ rte_dpaa_bus_scan(void)
 
 	if ((access(DPAA_DEV_PATH1, F_OK) != 0) &&
 	    (access(DPAA_DEV_PATH2, F_OK) != 0)) {
-		RTE_LOG(DEBUG, EAL, "DPAA Bus not present. Skipping.\n");
+		DPAA_BUS_LOG(DEBUG, "DPAA Bus not present. Skipping.");
 		return 0;
 	}
 
@@ -578,7 +578,7 @@ rte_dpaa_bus_dev_build(void)
 		return -EINVAL;
 	}
 
-	RTE_LOG(NOTICE, EAL, "DPAA Bus Detected\n");
+	DPAA_BUS_LOG(NOTICE, "DPAA Bus Detected");
 
 	if (!dpaa_netcfg->num_ethports) {
 		DPAA_BUS_LOG(INFO, "NO DPDK mapped net interfaces available");
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..43f6a630ea 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -464,7 +464,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	 * isn't managed by VFIO
 	 */
 	if (vfio_group_fd == -ENOENT) {
-		RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n",
+		DPAA2_BUS_WARN(" %s not managed by VFIO driver, skipping",
 				dev_addr);
 		return 1;
 	}
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index c6ac7a0015..4a972a83bd 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -372,8 +372,8 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev)
 		"QAT internal error! Read slice function not set, gen : %d",
 		qat_dev_gen);
 	if (ops_hw->qat_dev_get_slice_map(&qat_dev->options.slice_map, pci_dev) < 0) {
-		RTE_LOG(ERR, EAL,
-			"Cannot read slice configuration\n");
+		QAT_LOG(ERR,
+			"Cannot read slice configuration");
 		goto error;
 	}
 	rte_spinlock_init(&qat_dev->arb_csr_lock);
diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c
index f3a62a805e..324ac219d0 100644
--- a/drivers/net/cnxk/cnxk_rep_msg.c
+++ b/drivers/net/cnxk/cnxk_rep_msg.c
@@ -116,7 +116,7 @@ open_socket_ctrl_channel(void)
 
 	sock_fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (sock_fd < 0) {
-		RTE_LOG(ERR, EAL, "failed to create unix socket\n");
+		plt_err("Failed to create unix socket");
 		return -1;
 	}
 
diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 7e718e9e19..d5ded338d4 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1579,7 +1579,7 @@ parse_repr(const char *key __rte_unused, const char *value, void *args)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL) {
-		RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str);
+		PMD_DRV_LOG(ERR, "wrong representor format: %s", str);
 		return -1;
 	}
 
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a1a7e93288..c19db5c0eb 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -1058,7 +1058,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		priv->intr_handle =
 			rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED);
 		if (priv->intr_handle == NULL) {
-			RTE_LOG(ERR, EAL, "Fail to allocate intr_handle\n");
+			ERROR("can not allocate intr_handle");
 			goto port_error;
 		}
 
-- 
2.45.2


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

* [PATCH 3/6] net/sfc: remove use of EAL logtype
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
  2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
  2024-06-25 12:24 ` [PATCH 2/6] drivers: use dedicated log macros instead of EAL logtype David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-25 14:26   ` Andrew Rybchenko
  2024-06-25 12:24 ` [PATCH 4/6] vdpa/sfc: " David Marchand
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko

When registering a common logtype for this driver, instead of
explicitly fall back to EAL, rely on the log registration macro to
achieve the same.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/sfc/sfc_ethdev.c | 12 +-----------
 drivers/net/sfc/sfc_log.h    |  2 +-
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 92ca5e7a60..24686a1eaf 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -37,8 +37,6 @@
 #define SFC_XSTAT_ID_INVALID_VAL  UINT64_MAX
 #define SFC_XSTAT_ID_INVALID_NAME '\0'
 
-uint32_t sfc_logtype_driver;
-
 static struct sfc_dp_list sfc_dp_head =
 	TAILQ_HEAD_INITIALIZER(sfc_dp_head);
 
@@ -3618,12 +3616,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx,
 	SFC_KVARG_FW_VARIANT "=" SFC_KVARG_VALUES_FW_VARIANT " "
 	SFC_KVARG_RXD_WAIT_TIMEOUT_NS "=<long> "
 	SFC_KVARG_STATS_UPDATE_PERIOD_MS "=<long>");
-
-RTE_INIT(sfc_driver_register_logtype)
-{
-	int ret;
-
-	ret = rte_log_register_type_and_pick_level(SFC_LOGTYPE_PREFIX "driver",
-						   RTE_LOG_NOTICE);
-	sfc_logtype_driver = (ret < 0) ? RTE_LOGTYPE_EAL : ret;
-}
+RTE_LOG_REGISTER_SUFFIX(sfc_logtype_driver, "driver", NOTICE);
diff --git a/drivers/net/sfc/sfc_log.h b/drivers/net/sfc/sfc_log.h
index d54277cb7a..10a9ce6ced 100644
--- a/drivers/net/sfc/sfc_log.h
+++ b/drivers/net/sfc/sfc_log.h
@@ -11,7 +11,7 @@
 #define _SFC_LOG_H_
 
 /** Generic driver log type */
-extern uint32_t sfc_logtype_driver;
+extern int sfc_logtype_driver;
 
 /** Common log type name prefix */
 #define SFC_LOGTYPE_PREFIX	"pmd.net.sfc."
-- 
2.45.2


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

* [PATCH 4/6] vdpa/sfc: remove use of EAL logtype
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
                   ` (2 preceding siblings ...)
  2024-06-25 12:24 ` [PATCH 3/6] net/sfc: remove use " David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-25 12:24 ` [PATCH 5/6] bus/pci: use a dynamic logtype David Marchand
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev; +Cc: Vijay Kumar Srivastava

If registering a dynamic logtype fails at runtime, fall back to a
common logtype.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/vdpa/sfc/sfc_vdpa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa.c b/drivers/vdpa/sfc/sfc_vdpa.c
index 9db87fcb7d..eda111954f 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.c
+++ b/drivers/vdpa/sfc/sfc_vdpa.c
@@ -181,12 +181,12 @@ sfc_vdpa_register_logtype(const struct rte_pci_addr *pci_addr,
 		++lt_prefix_str_size; /* Reserve space for prefix separator */
 		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
 	} else {
-		return RTE_LOGTYPE_EAL;
+		return sfc_vdpa_logtype_driver;
 	}
 
 	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
 	if (lt_str == NULL)
-		return RTE_LOGTYPE_EAL;
+		return sfc_vdpa_logtype_driver;
 
 	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
 	lt_str[lt_prefix_str_size - 1] = '.';
@@ -197,7 +197,7 @@ sfc_vdpa_register_logtype(const struct rte_pci_addr *pci_addr,
 	ret = rte_log_register_type_and_pick_level(lt_str, ll_default);
 	rte_free(lt_str);
 
-	return ret < 0 ? RTE_LOGTYPE_EAL : ret;
+	return ret < 0 ? sfc_vdpa_logtype_driver : ret;
 }
 
 static int
-- 
2.45.2


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

* [PATCH 5/6] bus/pci: use a dynamic logtype
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
                   ` (3 preceding siblings ...)
  2024-06-25 12:24 ` [PATCH 4/6] vdpa/sfc: " David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-26  2:05   ` Chenbo Xia
  2024-06-25 12:24 ` [PATCH 6/6] crypto/ccp: " David Marchand
  2024-07-03 14:55 ` [PATCH 0/6] Some drivers logging cleanups David Marchand
  6 siblings, 1 reply; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev; +Cc: Chenbo Xia, Nipun Gupta, Anatoly Burakov

Register a logtype for this bus driver and stop logging as EAL.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/bsd/pci.c            |  44 +++----
 drivers/bus/pci/linux/pci.c          |  52 ++++----
 drivers/bus/pci/linux/pci_uio.c      |  75 +++++-------
 drivers/bus/pci/linux/pci_vfio.c     | 173 +++++++++++----------------
 drivers/bus/pci/pci_common.c         |  85 ++++++-------
 drivers/bus/pci/pci_common_uio.c     |  15 +--
 drivers/bus/pci/pci_params.c         |   9 +-
 drivers/bus/pci/private.h            |   6 +
 drivers/bus/pci/windows/pci.c        |  13 +-
 drivers/bus/pci/windows/pci_netuio.c |   7 +-
 10 files changed, 202 insertions(+), 277 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..2f88252418 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -60,8 +60,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 		ret = pci_uio_map_resource(dev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL,
-			"  Not managed by a supported kernel driver, skipped\n");
+		PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, skipped");
 		ret = 1;
 		break;
 	}
@@ -80,8 +79,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 		pci_uio_unmap_resource(dev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL,
-			"  Not managed by a supported kernel driver, skipped\n");
+		PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, skipped");
 		break;
 	}
 }
@@ -112,20 +110,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 			dev->addr.bus, dev->addr.devid, dev->addr.function);
 
 	if (access(devname, O_RDWR) < 0) {
-		RTE_LOG(WARNING, EAL, "  "PCI_PRI_FMT" not managed by UIO driver, "
-				"skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
+		PCI_LOG(WARNING, "  "PCI_PRI_FMT" not managed by UIO driver, skipping",
+			loc->domain, loc->bus, loc->devid, loc->function);
 		return 1;
 	}
 
 	/* save fd if in primary process */
 	if (rte_intr_fd_set(dev->intr_handle, open(devname, O_RDWR))) {
-		RTE_LOG(WARNING, EAL, "Failed to save fd");
+		PCI_LOG(WARNING, "Failed to save fd");
 		goto error;
 	}
 
 	if (rte_intr_fd_get(dev->intr_handle) < 0) {
-		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
 		goto error;
 	}
 
@@ -135,8 +132,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	/* allocate the mapping details for secondary processes*/
 	*uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0);
 	if (*uio_res == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot store uio mmap details\n", __func__);
+		PCI_LOG(ERR, "%s(): cannot store uio mmap details", __func__);
 		goto error;
 	}
 
@@ -168,8 +164,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	/* allocate memory to keep path */
 	maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
 	if (maps[map_idx].path == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+		PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno));
 		return -1;
 	}
 
@@ -178,8 +173,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	 */
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
 		goto error;
 	}
 
@@ -215,7 +209,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 
 	pdev = malloc(sizeof(*pdev));
 	if (pdev == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n");
+		PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
 		return -1;
 	}
 
@@ -345,15 +339,15 @@ rte_pci_scan(void)
 
 	fd = open("/dev/pci", O_RDONLY);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+		PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
 		goto error;
 	}
 
 	do {
 		unsigned i;
 		if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
-			RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
-					__func__, strerror(errno));
+			PCI_LOG(ERR, "%s(): error with ioctl on /dev/pci: %s",
+				__func__, strerror(errno));
 			goto error;
 		}
 
@@ -375,7 +369,7 @@ rte_pci_scan(void)
 
 	close(fd);
 
-	RTE_LOG(DEBUG, EAL, "PCI scan found %u devices\n", dev_count);
+	PCI_LOG(DEBUG, "PCI scan found %u devices", dev_count);
 	return 0;
 
 error:
@@ -395,7 +389,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		     const struct rte_pci_device *pdev)
 {
 	if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
-		RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n");
+		PCI_LOG(DEBUG, "Unsupported kernel driver? Defaulting to IOVA as 'PA'");
 
 	return RTE_IOVA_PA;
 }
@@ -420,7 +414,7 @@ int rte_pci_read_config(const struct rte_pci_device *dev,
 
 	fd = open("/dev/pci", O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+		PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
 		goto error;
 	}
 
@@ -465,7 +459,7 @@ int rte_pci_write_config(const struct rte_pci_device *dev,
 	};
 
 	if (len == 3 || len > sizeof(pi.pi_data)) {
-		RTE_LOG(ERR, EAL, "%s(): invalid pci read length\n", __func__);
+		PCI_LOG(ERR, "%s(): invalid pci read length", __func__);
 		goto error;
 	}
 
@@ -473,7 +467,7 @@ int rte_pci_write_config(const struct rte_pci_device *dev,
 
 	fd = open("/dev/pci", O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+		PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
 		goto error;
 	}
 
@@ -521,7 +515,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 #if defined(RTE_ARCH_X86)
 	case RTE_PCI_KDRV_NIC_UIO:
 		if (rte_eal_iopl_init() != 0) {
-			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
+			PCI_LOG(ERR, "%s(): insufficient ioport permissions for PCI device %s",
 				__func__, dev->name);
 			return -1;
 		}
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 3d237398d9..9056035b33 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -75,8 +75,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 		}
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL,
-			"  Not managed by a supported kernel driver, skipped\n");
+		PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, skipped");
 		ret = 1;
 		break;
 	}
@@ -102,8 +101,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 		pci_uio_unmap_resource(dev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL,
-			"  Not managed by a supported kernel driver, skipped\n");
+		PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, skipped");
 		break;
 	}
 }
@@ -147,8 +145,7 @@ pci_parse_one_sysfs_resource(char *line, size_t len, uint64_t *phys_addr,
 	} res_info;
 
 	if (rte_strsplit(line, len, res_info.ptrs, 3, ' ') != 3) {
-		RTE_LOG(ERR, EAL,
-			"%s(): bad resource format\n", __func__);
+		PCI_LOG(ERR, "%s(): bad resource format", __func__);
 		return -1;
 	}
 	errno = 0;
@@ -156,8 +153,7 @@ pci_parse_one_sysfs_resource(char *line, size_t len, uint64_t *phys_addr,
 	*end_addr = strtoull(res_info.end_addr, NULL, 16);
 	*flags = strtoull(res_info.flags, NULL, 16);
 	if (errno != 0) {
-		RTE_LOG(ERR, EAL,
-			"%s(): bad resource format\n", __func__);
+		PCI_LOG(ERR, "%s(): bad resource format", __func__);
 		return -1;
 	}
 
@@ -175,15 +171,14 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
 
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot open sysfs resource\n");
+		PCI_LOG(ERR, "Cannot open sysfs resource");
 		return -1;
 	}
 
 	for (i = 0; i<PCI_MAX_RESOURCE; i++) {
 
 		if (fgets(buf, sizeof(buf), f) == NULL) {
-			RTE_LOG(ERR, EAL,
-				"%s(): cannot read resource\n", __func__);
+			PCI_LOG(ERR, "%s(): cannot read resource", __func__);
 			goto error;
 		}
 		if (pci_parse_one_sysfs_resource(buf, sizeof(buf), &phys_addr,
@@ -218,7 +213,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 
 	pdev = malloc(sizeof(*pdev));
 	if (pdev == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n");
+		PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
 		return -1;
 	}
 
@@ -300,7 +295,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	/* parse resources */
 	snprintf(filename, sizeof(filename), "%s/resource", dirname);
 	if (pci_parse_sysfs_resource(filename, dev) < 0) {
-		RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
+		PCI_LOG(ERR, "%s(): cannot parse resource", __func__);
 		pci_free(pdev);
 		return -1;
 	}
@@ -309,7 +304,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 	snprintf(filename, sizeof(filename), "%s/driver", dirname);
 	ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
+		PCI_LOG(ERR, "Fail to get kernel driver");
 		pci_free(pdev);
 		return -1;
 	}
@@ -371,7 +366,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 						 * So we just print out the
 						 * error as an alarm.
 						 */
-						RTE_LOG(ERR, EAL, "Unexpected device scan at %s!\n",
+						PCI_LOG(ERR, "Unexpected device scan at %s!",
 							filename);
 					else if (dev2->device.devargs !=
 						 dev->device.devargs) {
@@ -454,8 +449,7 @@ rte_pci_scan(void)
 
 	dir = opendir(rte_pci_get_sysfs_path());
 	if (dir == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
-			__func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, strerror(errno));
 		return -1;
 	}
 
@@ -505,14 +499,14 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
 		if (errno == ENOENT)
 			return true;
 
-		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+		PCI_LOG(ERR, "%s(): can't open %s: %s",
 			__func__, filename, strerror(errno));
 		return false;
 	}
 
 	/* We have an Intel IOMMU */
 	if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) != 1) {
-		RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, filename);
+		PCI_LOG(ERR, "%s(): can't read %s", __func__, filename);
 		fclose(fp);
 		return false;
 	}
@@ -556,7 +550,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 	bool ret = false;
 
 	if (fp == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+		PCI_LOG(ERR, "%s(): can't open %s: %s",
 			__func__, filename, strerror(errno));
 		return ret;
 	}
@@ -565,15 +559,15 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 	while (getline(&line, &len, fp) != -1) {
 		if (strstr(line, "platform") != NULL) {
 			if (strstr(line, "PowerNV") != NULL) {
-				RTE_LOG(DEBUG, EAL, "Running on a PowerNV platform\n");
+				PCI_LOG(DEBUG, "Running on a PowerNV platform");
 				powernv = true;
 			} else if (strstr(line, "pSeries") != NULL) {
-				RTE_LOG(DEBUG, EAL, "Running on a pSeries platform\n");
+				PCI_LOG(DEBUG, "Running on a pSeries platform");
 				pseries = true;
 			}
 		} else if (strstr(line, "model") != NULL) {
 			if (strstr(line, "qemu") != NULL) {
-				RTE_LOG(DEBUG, EAL, "Found qemu emulation\n");
+				PCI_LOG(DEBUG, "Found qemu emulation");
 				qemu = true;
 			}
 		}
@@ -650,8 +644,7 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 	default:
 		rte_pci_device_name(&device->addr, devname,
 				    RTE_DEV_NAME_MAX_LEN);
-		RTE_LOG(ERR, EAL,
-			"Unknown driver type for %s\n", devname);
+		PCI_LOG(ERR, "Unknown driver type for %s", devname);
 		return -1;
 	}
 }
@@ -674,8 +667,7 @@ int rte_pci_write_config(const struct rte_pci_device *device,
 	default:
 		rte_pci_device_name(&device->addr, devname,
 				    RTE_DEV_NAME_MAX_LEN);
-		RTE_LOG(ERR, EAL,
-			"Unknown driver type for %s\n", devname);
+		PCI_LOG(ERR, "Unknown driver type for %s", devname);
 		return -1;
 	}
 }
@@ -697,8 +689,7 @@ int rte_pci_mmio_read(const struct rte_pci_device *device, int bar,
 	default:
 		rte_pci_device_name(&device->addr, devname,
 				    RTE_DEV_NAME_MAX_LEN);
-		RTE_LOG(ERR, EAL,
-			"Unknown driver type for %s\n", devname);
+		PCI_LOG(ERR, "Unknown driver type for %s", devname);
 		return -1;
 	}
 }
@@ -720,8 +711,7 @@ int rte_pci_mmio_write(const struct rte_pci_device *device, int bar,
 	default:
 		rte_pci_device_name(&device->addr, devname,
 				    RTE_DEV_NAME_MAX_LEN);
-		RTE_LOG(ERR, EAL,
-			"Unknown driver type for %s\n", devname);
+		PCI_LOG(ERR, "Unknown driver type for %s", devname);
 		return -1;
 	}
 }
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 97d740dfe5..f7d990d33f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -91,15 +91,13 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): cannot open sysfs to get major:minor\n",
-			__func__);
+		PCI_LOG(ERR, "%s(): cannot open sysfs to get major:minor", __func__);
 		return -1;
 	}
 
 	ret = fscanf(f, "%u:%u", &major, &minor);
 	if (ret != 2) {
-		RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs to get major:minor\n",
-			__func__);
+		PCI_LOG(ERR, "%s(): cannot parse sysfs to get major:minor", __func__);
 		fclose(f);
 		return -1;
 	}
@@ -110,8 +108,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 	dev = makedev(major, minor);
 	ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
 	if (ret != 0) {
-		RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n",
-			__func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, strerror(errno));
 		return -1;
 	}
 
@@ -150,7 +147,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
 		dir = opendir(dirname);
 
 		if (dir == NULL) {
-			RTE_LOG(ERR, EAL, "Cannot opendir %s\n", dirname);
+			PCI_LOG(ERR, "Cannot opendir %s", dirname);
 			return -1;
 		}
 	}
@@ -191,7 +188,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
 	/* create uio device if we've been asked to */
 	if (rte_eal_create_uio_dev() && create &&
 			pci_mknod_uio_dev(dstbuf, uio_num) < 0)
-		RTE_LOG(WARNING, EAL, "Cannot create /dev/uio%u\n", uio_num);
+		PCI_LOG(WARNING, "Cannot create /dev/uio%u", uio_num);
 
 	return uio_num;
 }
@@ -231,8 +228,8 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	/* find uio resource */
 	uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 1);
 	if (uio_num < 0) {
-		RTE_LOG(WARNING, EAL, "  "PCI_PRI_FMT" not managed by UIO driver, "
-				"skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
+		PCI_LOG(WARNING, "  "PCI_PRI_FMT" not managed by UIO driver, skipping",
+			loc->domain, loc->bus, loc->devid, loc->function);
 		return 1;
 	}
 	snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num);
@@ -240,8 +237,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	/* save fd if in primary process */
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
 		goto error;
 	}
 
@@ -253,8 +249,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 	uio_cfg_fd = open(cfgname, O_RDWR);
 	if (uio_cfg_fd < 0) {
-		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			cfgname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", cfgname, strerror(errno));
 		goto error;
 	}
 
@@ -270,7 +265,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 		/* set bus master that is not done by uio_pci_generic */
 		if (rte_pci_set_bus_master(dev, true)) {
-			RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
+			PCI_LOG(ERR, "Cannot set up bus mastering!");
 			goto error;
 		}
 	}
@@ -278,8 +273,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	/* allocate the mapping details for secondary processes*/
 	*uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0);
 	if (*uio_res == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot store uio mmap details\n", __func__);
+		PCI_LOG(ERR, "%s(): cannot store uio mmap details", __func__);
 		goto error;
 	}
 
@@ -313,8 +307,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	/* allocate memory to keep path */
 	maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
 	if (maps[map_idx].path == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+		PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno));
 		return -1;
 	}
 
@@ -331,8 +324,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 
 		fd = open(devname, O_RDWR);
 		if (fd < 0 && errno != ENOENT) {
-			RTE_LOG(INFO, EAL, "%s cannot be mapped. "
-				"Fall-back to non prefetchable mode.\n",
+			PCI_LOG(INFO, "%s cannot be mapped. Fall-back to non prefetchable mode.",
 				devname);
 		}
 	}
@@ -347,8 +339,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 		/* then try to map resource file */
 		fd = open(devname, O_RDWR);
 		if (fd < 0) {
-			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+			PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
 			goto error;
 		}
 	}
@@ -403,14 +394,13 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		dev->addr.devid, dev->addr.function);
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n",
-			__func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, strerror(errno));
 		return -1;
 	}
 
 	for (i = 0; i < bar + 1; i++) {
 		if (fgets(buf, sizeof(buf), f) == NULL) {
-			RTE_LOG(ERR, EAL, "%s(): Cannot read sysfs resource\n", __func__);
+			PCI_LOG(ERR, "%s(): Cannot read sysfs resource", __func__);
 			goto error;
 		}
 	}
@@ -420,23 +410,23 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 
 	if (flags & IORESOURCE_IO) {
 		if (rte_eal_iopl_init()) {
-			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
+			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) {
-			RTE_LOG(ERR, EAL, "%s(): %08lx too large PIO resource\n", __func__, base);
+			PCI_LOG(ERR, "%s(): %08lx too large PIO resource", __func__, base);
 			goto error;
 		}
 
-		RTE_LOG(DEBUG, EAL, "%s(): PIO BAR %08lx detected\n", __func__, base);
+		PCI_LOG(DEBUG, "%s(): PIO BAR %08lx detected", __func__, base);
 	} else if (flags & IORESOURCE_MEM) {
 		base = (unsigned long)dev->mem_resource[bar].addr;
-		RTE_LOG(DEBUG, EAL, "%s(): MMIO BAR %08lx detected\n", __func__, base);
+		PCI_LOG(DEBUG, "%s(): MMIO BAR %08lx detected", __func__, base);
 	} else {
-		RTE_LOG(ERR, EAL, "%s(): unknown BAR type\n", __func__);
+		PCI_LOG(ERR, "%s(): unknown BAR type", __func__);
 		goto error;
 	}
 
@@ -445,16 +435,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 					RTE_INTR_HANDLE_UNKNOWN) {
 		int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
 		if (uio_num < 0) {
-			RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
-				dirname, strerror(errno));
+			PCI_LOG(ERR, "cannot open %s: %s", dirname, strerror(errno));
 			goto error;
 		}
 
 		snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num);
 		fd = open(filename, O_RDWR);
 		if (fd < 0) {
-			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				filename, strerror(errno));
+			PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno));
 			goto error;
 		}
 		if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -464,7 +452,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 			goto error;
 	}
 
-	RTE_LOG(DEBUG, EAL, "PCI Port IO found start=0x%lx\n", base);
+	PCI_LOG(DEBUG, "PCI Port IO found start=0x%lx", base);
 
 	p->base = base;
 	p->len = 0;
@@ -493,13 +481,12 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		dev->addr.devid, dev->addr.function);
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n",
-			strerror(errno));
+		PCI_LOG(ERR, "Cannot open sysfs resource: %s", strerror(errno));
 		return -1;
 	}
 	for (i = 0; i < bar + 1; i++) {
 		if (fgets(buf, sizeof(buf), f) == NULL) {
-			RTE_LOG(ERR, EAL, "Cannot read sysfs resource\n");
+			PCI_LOG(ERR, "Cannot read sysfs resource");
 			goto error;
 		}
 	}
@@ -507,7 +494,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 			&end_addr, &flags) < 0)
 		goto error;
 	if ((flags & IORESOURCE_IO) == 0) {
-		RTE_LOG(ERR, EAL, "BAR %d is not an IO resource\n", bar);
+		PCI_LOG(ERR, "BAR %d is not an IO resource", bar);
 		goto error;
 	}
 	snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT "/resource%d",
@@ -517,23 +504,21 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	/* mmap the pci resource */
 	fd = open(filename, O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
-			strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno));
 		goto error;
 	}
 	addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
 		MAP_SHARED, fd, 0);
 	close(fd);
 	if (addr == MAP_FAILED) {
-		RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n",
-			strerror(errno));
+		PCI_LOG(ERR, "Cannot mmap IO port resource: %s", strerror(errno));
 		goto error;
 	}
 
 	/* strangely, the base address is mmap addr + phys_addr */
 	p->base = (uintptr_t)addr + phys_addr;
 	p->len = end_addr + 1;
-	RTE_LOG(DEBUG, EAL, "PCI Port IO found start=0x%"PRIx64"\n", p->base);
+	PCI_LOG(DEBUG, "PCI Port IO found start=0x%"PRIx64, p->base);
 	fclose(f);
 
 	return 0;
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 05b03a9667..adc34a5c51 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -121,15 +121,13 @@ pci_vfio_get_msix_bar(const struct rte_pci_device *dev,
 
 		if (rte_pci_read_config(dev, &reg, sizeof(reg), cap_offset +
 				RTE_PCI_MSIX_TABLE) < 0) {
-			RTE_LOG(ERR, EAL,
-				"Cannot read MSIX table from PCI config space!\n");
+			PCI_LOG(ERR, "Cannot read MSIX table from PCI config space!");
 			return -1;
 		}
 
 		if (rte_pci_read_config(dev, &flags, sizeof(flags), cap_offset +
 				RTE_PCI_MSIX_FLAGS) < 0) {
-			RTE_LOG(ERR, EAL,
-				"Cannot read MSIX flags from PCI config space!\n");
+			PCI_LOG(ERR, "Cannot read MSIX flags from PCI config space!");
 			return -1;
 		}
 
@@ -151,14 +149,14 @@ pci_vfio_enable_bus_memory(struct rte_pci_device *dev, int dev_fd)
 
 	if (pci_vfio_get_region(dev, VFIO_PCI_CONFIG_REGION_INDEX,
 		&size, &offset) != 0) {
-		RTE_LOG(ERR, EAL, "Cannot get offset of CONFIG region.\n");
+		PCI_LOG(ERR, "Cannot get offset of CONFIG region.");
 		return -1;
 	}
 
 	ret = pread(dev_fd, &cmd, sizeof(cmd), offset + RTE_PCI_COMMAND);
 
 	if (ret != sizeof(cmd)) {
-		RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
+		PCI_LOG(ERR, "Cannot read command from PCI config space!");
 		return -1;
 	}
 
@@ -169,7 +167,7 @@ pci_vfio_enable_bus_memory(struct rte_pci_device *dev, int dev_fd)
 	ret = pwrite(dev_fd, &cmd, sizeof(cmd), offset + RTE_PCI_COMMAND);
 
 	if (ret != sizeof(cmd)) {
-		RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
+		PCI_LOG(ERR, "Cannot write command to PCI config space!");
 		return -1;
 	}
 
@@ -206,7 +204,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 	case RTE_INTR_MODE_NONE:
 		break;
 	default:
-		RTE_LOG(ERR, EAL, "Unknown default interrupt type!\n");
+		PCI_LOG(ERR, "Unknown default interrupt type!");
 		return -1;
 	}
 
@@ -224,8 +222,8 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
-			RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error "
-					"%i (%s)\n", errno, strerror(errno));
+			PCI_LOG(ERR, "Cannot get VFIO IRQ info, error %i (%s)",
+				errno, strerror(errno));
 			return -1;
 		}
 
@@ -233,8 +231,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		 * specified interrupt type, otherwise continue */
 		if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) {
 			if (intr_mode != RTE_INTR_MODE_NONE) {
-				RTE_LOG(ERR, EAL,
-					"Interrupt vector does not support eventfd!\n");
+				PCI_LOG(ERR, "Interrupt vector does not support eventfd!");
 				return -1;
 			} else
 				continue;
@@ -251,8 +248,8 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		/* set up an eventfd for interrupts */
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
-			RTE_LOG(ERR, EAL, "Cannot set up eventfd, error "
-					"%i (%s)\n", errno, strerror(errno));
+			PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
+				errno, strerror(errno));
 			return -1;
 		}
 
@@ -276,7 +273,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 						 RTE_INTR_HANDLE_VFIO_LEGACY);
 			break;
 		default:
-			RTE_LOG(ERR, EAL, "Unknown interrupt type!\n");
+			PCI_LOG(ERR, "Unknown interrupt type!");
 			return -1;
 		}
 
@@ -306,8 +303,7 @@ pci_vfio_req_handler(void *param)
 	rte_spinlock_lock(&failure_handle_lock);
 	bus = rte_bus_find_by_device(device);
 	if (bus == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot find bus for device (%s)\n",
-			device->name);
+		PCI_LOG(ERR, "Cannot find bus for device (%s)", device->name);
 		goto handle_end;
 	}
 
@@ -318,9 +314,7 @@ pci_vfio_req_handler(void *param)
 	 */
 	ret = bus->hot_unplug_handler(device);
 	if (ret)
-		RTE_LOG(ERR, EAL,
-			"Can not handle hot-unplug for device (%s)\n",
-			device->name);
+		PCI_LOG(ERR, "Can not handle hot-unplug for device (%s)", device->name);
 handle_end:
 	rte_spinlock_unlock(&failure_handle_lock);
 }
@@ -335,7 +329,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 	/* set up an eventfd for req notifier */
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
-		RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n",
+		PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
 			errno, strerror(errno));
 		return -1;
 	}
@@ -353,19 +347,18 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 					 pci_vfio_req_handler,
 					 (void *)&dev->device);
 	if (ret) {
-		RTE_LOG(ERR, EAL, "Fail to register req notifier handler.\n");
+		PCI_LOG(ERR, "Fail to register req notifier handler.");
 		goto error;
 	}
 
 	ret = rte_intr_enable(dev->vfio_req_intr_handle);
 	if (ret) {
-		RTE_LOG(ERR, EAL, "Fail to enable req notifier.\n");
+		PCI_LOG(ERR, "Fail to enable req notifier.");
 		ret = rte_intr_callback_unregister(dev->vfio_req_intr_handle,
 						 pci_vfio_req_handler,
 						 (void *)&dev->device);
 		if (ret < 0)
-			RTE_LOG(ERR, EAL,
-				"Fail to unregister req notifier handler.\n");
+			PCI_LOG(ERR, "Fail to unregister req notifier handler.");
 		goto error;
 	}
 
@@ -388,7 +381,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 
 	ret = rte_intr_disable(dev->vfio_req_intr_handle);
 	if (ret) {
-		RTE_LOG(ERR, EAL, "fail to disable req notifier.\n");
+		PCI_LOG(ERR, "fail to disable req notifier.");
 		return -1;
 	}
 
@@ -396,8 +389,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 					   pci_vfio_req_handler,
 					   (void *)&dev->device);
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL,
-			 "fail to unregister req notifier handler.\n");
+		PCI_LOG(ERR, "fail to unregister req notifier handler.");
 		return -1;
 	}
 
@@ -421,14 +413,14 @@ pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, int vfio_dev_fd,
 
 	if (pci_vfio_get_region(dev, VFIO_PCI_CONFIG_REGION_INDEX,
 		&size, &offset) != 0) {
-		RTE_LOG(ERR, EAL, "Cannot get offset of CONFIG region.\n");
+		PCI_LOG(ERR, "Cannot get offset of CONFIG region.");
 		return -1;
 	}
 
 	ret = pread(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar),
 			  offset + RTE_PCI_BASE_ADDRESS_0 + bar_index * 4);
 	if (ret != sizeof(ioport_bar)) {
-		RTE_LOG(ERR, EAL, "Cannot read command (%x) from config space!\n",
+		PCI_LOG(ERR, "Cannot read command (%x) from config space!",
 			RTE_PCI_BASE_ADDRESS_0 + bar_index*4);
 		return -1;
 	}
@@ -440,17 +432,17 @@ static int
 pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 {
 	if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
-		RTE_LOG(ERR, EAL, "Error setting up interrupts!\n");
+		PCI_LOG(ERR, "Error setting up interrupts!");
 		return -1;
 	}
 
 	if (pci_vfio_enable_bus_memory(dev, vfio_dev_fd)) {
-		RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
+		PCI_LOG(ERR, "Cannot enable bus memory!");
 		return -1;
 	}
 
 	if (rte_pci_set_bus_master(dev, true)) {
-		RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
+		PCI_LOG(ERR, "Cannot set up bus mastering!");
 		return -1;
 	}
 
@@ -459,8 +451,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 	 * then it updates errno as EINVAL.
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
-		RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
-				errno, strerror(errno));
+		PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, strerror(errno));
 		return -1;
 	}
 
@@ -480,7 +471,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 	struct pci_map *bar = &vfio_res->maps[bar_index];
 
 	if (bar->size == 0) {
-		RTE_LOG(DEBUG, EAL, "Bar size is 0, skip BAR%d\n", bar_index);
+		PCI_LOG(DEBUG, "Bar size is 0, skip BAR%d", bar_index);
 		return 0;
 	}
 
@@ -503,7 +494,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 
 		if (table_start == 0 && table_end >= bar->size) {
 			/* Cannot map this BAR */
-			RTE_LOG(DEBUG, EAL, "Skipping BAR%d\n", bar_index);
+			PCI_LOG(DEBUG, "Skipping BAR%d", bar_index);
 			bar->size = 0;
 			bar->addr = 0;
 			return 0;
@@ -523,10 +514,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 			memreg[1].size = bar->size - table_end;
 		}
 
-		RTE_LOG(DEBUG, EAL,
-			"Trying to map BAR%d that contains the MSI-X "
-			"table. Trying offsets: "
-			"0x%04" PRIx64 ":0x%04zx, 0x%04" PRIx64 ":0x%04zx\n",
+		PCI_LOG(DEBUG, "Trying to map BAR%d that contains the MSI-X table. "
+			"Trying offsets: 0x%04" PRIx64 ":0x%04zx, 0x%04" PRIx64 ":0x%04zx",
 			bar_index,
 			memreg[0].offset, memreg[0].size,
 			memreg[1].offset, memreg[1].size);
@@ -576,14 +565,11 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 		if (map_addr == NULL) {
 			munmap(bar_addr, bar->size);
 			bar_addr = MAP_FAILED;
-			RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
-					bar_index);
+			PCI_LOG(ERR, "Failed to map pci BAR%d", bar_index);
 			return -1;
 		}
 	} else {
-		RTE_LOG(ERR, EAL,
-				"Failed to create inaccessible mapping for BAR%d\n",
-				bar_index);
+		PCI_LOG(ERR, "Failed to create inaccessible mapping for BAR%d", bar_index);
 		return -1;
 	}
 
@@ -601,7 +587,7 @@ pci_vfio_sparse_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 	uint32_t i;
 
 	if (bar->size == 0) {
-		RTE_LOG(DEBUG, EAL, "Bar size is 0, skip BAR%d\n", bar_index);
+		PCI_LOG(DEBUG, "Bar size is 0, skip BAR%d", bar_index);
 		return 0;
 	}
 
@@ -619,15 +605,13 @@ pci_vfio_sparse_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 					RTE_MAP_FORCE_ADDRESS);
 				if (map_addr == NULL) {
 					munmap(bar_addr, bar->size);
-					RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
-						bar_index);
+					PCI_LOG(ERR, "Failed to map pci BAR%d", bar_index);
 					goto err_map;
 				}
 			}
 		}
 	} else {
-		RTE_LOG(ERR, EAL, "Failed to create inaccessible mapping for BAR%d\n",
-			bar_index);
+		PCI_LOG(ERR, "Failed to create inaccessible mapping for BAR%d", bar_index);
 		goto err_map;
 	}
 
@@ -653,8 +637,7 @@ pci_vfio_get_region_info(int vfio_dev_fd, struct vfio_region_info **info,
 
 	ri = malloc(sizeof(*ri));
 	if (ri == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Cannot allocate memory for VFIO region info\n");
+		PCI_LOG(ERR, "Cannot allocate memory for VFIO region info");
 		return -1;
 	}
 again:
@@ -676,8 +659,7 @@ pci_vfio_get_region_info(int vfio_dev_fd, struct vfio_region_info **info,
 		if (tmp == NULL) {
 			/* realloc failed but the ri is still there */
 			free(ri);
-			RTE_LOG(ERR, EAL,
-				"Cannot reallocate memory for VFIO region info\n");
+			PCI_LOG(ERR, "Cannot reallocate memory for VFIO region info");
 			return -1;
 		}
 		ri = tmp;
@@ -741,7 +723,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,
 	for (i = 0; i < nb_maps; i++) {
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
-			RTE_LOG(DEBUG, EAL, "%s cannot get device region info error %i (%s)\n",
+			PCI_LOG(DEBUG, "%s cannot get device region info error %i (%s)",
 				dev->name, errno, strerror(errno));
 			return -1;
 		}
@@ -794,8 +776,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 	/* allocate vfio_res and get region info */
 	vfio_res = rte_zmalloc("VFIO_RES", sizeof(*vfio_res), 0);
 	if (vfio_res == NULL) {
-		RTE_LOG(ERR, EAL,
-			"Cannot store VFIO mmap details\n");
+		PCI_LOG(ERR, "Cannot store VFIO mmap details");
 		goto err_vfio_dev_fd;
 	}
 	memcpy(&vfio_res->pci_addr, &dev->addr, sizeof(vfio_res->pci_addr));
@@ -810,7 +791,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 	ret = pci_vfio_get_region_info(vfio_dev_fd, &reg,
 		VFIO_PCI_CONFIG_REGION_INDEX);
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "%s cannot get device region info error %i (%s)\n",
+		PCI_LOG(ERR, "%s cannot get device region info error %i (%s)",
 			dev->name, errno, strerror(errno));
 		goto err_vfio_res;
 	}
@@ -824,8 +805,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 	 */
 	ret = pci_vfio_get_msix_bar(dev, &vfio_res->msix_table);
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "%s cannot get MSI-X BAR number!\n",
-				pci_addr);
+		PCI_LOG(ERR, "%s cannot get MSI-X BAR number!", pci_addr);
 		goto err_vfio_res;
 	}
 	/* if we found our MSI-X BAR region, check if we can mmap it */
@@ -833,11 +813,11 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		int ret = pci_vfio_msix_is_mappable(vfio_dev_fd,
 				vfio_res->msix_table.bar_index);
 		if (ret < 0) {
-			RTE_LOG(ERR, EAL, "Couldn't check if MSI-X BAR is mappable\n");
+			PCI_LOG(ERR, "Couldn't check if MSI-X BAR is mappable");
 			goto err_vfio_res;
 		} else if (ret != 0) {
 			/* we can map it, so we don't care where it is */
-			RTE_LOG(DEBUG, EAL, "VFIO reports MSI-X BAR as mappable\n");
+			PCI_LOG(DEBUG, "VFIO reports MSI-X BAR as mappable");
 			vfio_res->msix_table.bar_index = -1;
 		}
 	}
@@ -849,9 +829,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
-			RTE_LOG(ERR, EAL,
-				"%s cannot get device region info error "
-				"%i (%s)\n", pci_addr, errno, strerror(errno));
+			PCI_LOG(ERR, "%s cannot get device region info error %i (%s)",
+				pci_addr, errno, strerror(errno));
 			goto err_map;
 		}
 
@@ -864,8 +843,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			free(reg);
 			goto err_map;
 		} else if (ret) {
-			RTE_LOG(INFO, EAL, "Ignore mapping IO port bar(%d)\n",
-					i);
+			PCI_LOG(INFO, "Ignore mapping IO port bar(%d)", i);
 			free(reg);
 			continue;
 		}
@@ -901,8 +879,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 				maps[i].areas = rte_zmalloc(NULL,
 					sizeof(*maps[i].areas) * maps[i].nr_areas, 0);
 				if (maps[i].areas == NULL) {
-					RTE_LOG(ERR, EAL,
-						"Cannot alloc memory for sparse map areas\n");
+					PCI_LOG(ERR, "Cannot alloc memory for sparse map areas");
 					goto err_map;
 				}
 				memcpy(maps[i].areas, sparse->areas,
@@ -913,16 +890,16 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		if (maps[i].nr_areas > 0) {
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
-				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+				PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s",
+					pci_addr, i, strerror(errno));
 				free(reg);
 				goto err_map;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
-				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+				PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
+					pci_addr, i, strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -934,13 +911,13 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 	}
 
 	if (pci_rte_vfio_setup_device(dev, vfio_dev_fd) < 0) {
-		RTE_LOG(ERR, EAL, "%s setup device failed\n", pci_addr);
+		PCI_LOG(ERR, "%s setup device failed", pci_addr);
 		goto err_map;
 	}
 
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	if (pci_vfio_enable_notifier(dev, vfio_dev_fd) != 0) {
-		RTE_LOG(ERR, EAL, "Error setting up notifier!\n");
+		PCI_LOG(ERR, "Error setting up notifier!");
 		goto err_map;
 	}
 
@@ -997,8 +974,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 	}
 	/* if we haven't found our tailq entry, something's wrong */
 	if (vfio_res == NULL) {
-		RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI device!\n",
-				pci_addr);
+		PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", pci_addr);
 		return -1;
 	}
 
@@ -1018,15 +994,15 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 		if (maps[i].nr_areas > 0) {
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
-				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+				PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s",
+					pci_addr, i, strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
-				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+				PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
+					pci_addr, i, strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		}
@@ -1085,8 +1061,7 @@ find_and_unmap_vfio_resource(struct mapped_pci_res_list *vfio_res_list,
 	if (vfio_res == NULL)
 		return vfio_res;
 
-	RTE_LOG(INFO, EAL, "Releasing PCI mapped resource for %s\n",
-		pci_addr);
+	PCI_LOG(INFO, "Releasing PCI mapped resource for %s", pci_addr);
 
 	maps = vfio_res->maps;
 	for (i = 0; i < vfio_res->nb_maps; i++) {
@@ -1096,7 +1071,7 @@ find_and_unmap_vfio_resource(struct mapped_pci_res_list *vfio_res_list,
 		 * when mapping. Just using current maps array is enough
 		 */
 		if (maps[i].addr) {
-			RTE_LOG(INFO, EAL, "Calling pci_unmap_resource for %s at %p\n",
+			PCI_LOG(INFO, "Calling pci_unmap_resource for %s at %p",
 				pci_addr, maps[i].addr);
 			pci_unmap_resource(maps[i].addr, maps[i].size);
 		}
@@ -1124,7 +1099,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	ret = pci_vfio_disable_notifier(dev);
 	if (ret) {
-		RTE_LOG(ERR, EAL, "fail to disable req notifier.\n");
+		PCI_LOG(ERR, "fail to disable req notifier.");
 		return -1;
 	}
 
@@ -1133,8 +1108,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
 		return -1;
 
 	if (close(rte_intr_fd_get(dev->intr_handle)) < 0) {
-		RTE_LOG(INFO, EAL, "Error when closing eventfd file descriptor for %s\n",
-			pci_addr);
+		PCI_LOG(INFO, "Error when closing eventfd file descriptor for %s", pci_addr);
 		return -1;
 	}
 
@@ -1143,15 +1117,14 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
 		return -1;
 
 	if (rte_pci_set_bus_master(dev, false)) {
-		RTE_LOG(ERR, EAL, "%s cannot unset bus mastering for PCI device!\n",
-				pci_addr);
+		PCI_LOG(ERR, "%s cannot unset bus mastering for PCI device!", pci_addr);
 		return -1;
 	}
 
 	ret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,
 				      vfio_dev_fd);
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Cannot release VFIO device\n");
+		PCI_LOG(ERR, "Cannot release VFIO device");
 		return ret;
 	}
 
@@ -1161,8 +1134,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
 
 	/* if we haven't found our tailq entry, something's wrong */
 	if (vfio_res == NULL) {
-		RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI device!\n",
-				pci_addr);
+		PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", pci_addr);
 		return -1;
 	}
 
@@ -1191,7 +1163,7 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device *dev)
 	ret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,
 				      vfio_dev_fd);
 	if (ret < 0) {
-		RTE_LOG(ERR, EAL, "Cannot release VFIO device\n");
+		PCI_LOG(ERR, "Cannot release VFIO device");
 		return ret;
 	}
 
@@ -1201,8 +1173,7 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device *dev)
 
 	/* if we haven't found our tailq entry, something's wrong */
 	if (vfio_res == NULL) {
-		RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI device!\n",
-				pci_addr);
+		PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", pci_addr);
 		return -1;
 	}
 
@@ -1226,7 +1197,7 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,
 
 	if (bar < VFIO_PCI_BAR0_REGION_INDEX ||
 	    bar > VFIO_PCI_BAR5_REGION_INDEX) {
-		RTE_LOG(ERR, EAL, "invalid bar (%d)!\n", bar);
+		PCI_LOG(ERR, "invalid bar (%d)!", bar);
 		return -1;
 	}
 
@@ -1257,7 +1228,7 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,
 	}
 
 	if (pci_vfio_get_region(dev, bar, &size, &offset) != 0) {
-		RTE_LOG(ERR, EAL, "Cannot get offset of region %d.\n", bar);
+		PCI_LOG(ERR, "Cannot get offset of region %d.", bar);
 		return -1;
 	}
 
@@ -1278,8 +1249,7 @@ pci_vfio_ioport_read(struct rte_pci_ioport *p,
 
 	if (pread(vfio_dev_fd, data,
 		    len, p->base + offset) <= 0)
-		RTE_LOG(ERR, EAL,
-			"Can't read from PCI bar (%" PRIu64 ") : offset (%x)\n",
+		PCI_LOG(ERR, "Can't read from PCI bar (%" PRIu64 ") : offset (%x)",
 			VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
@@ -1295,8 +1265,7 @@ pci_vfio_ioport_write(struct rte_pci_ioport *p,
 
 	if (pwrite(vfio_dev_fd, data,
 		     len, p->base + offset) <= 0)
-		RTE_LOG(ERR, EAL,
-			"Can't write to PCI bar (%" PRIu64 ") : offset (%x)\n",
+		PCI_LOG(ERR, "Can't write to PCI bar (%" PRIu64 ") : offset (%x)",
 			VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 889a48d2af..1173f0887c 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -141,13 +141,12 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 		RTE_PROT_READ | RTE_PROT_WRITE,
 		RTE_MAP_SHARED | additional_flags, fd, offset);
 	if (mapaddr == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
+		PCI_LOG(ERR, "%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)",
 			__func__, fd, requested_addr, size,
 			(unsigned long long)offset,
 			rte_strerror(rte_errno), mapaddr);
 	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+		PCI_LOG(DEBUG, "  PCI memory mapped at %p", mapaddr);
 
 	return mapaddr;
 }
@@ -161,12 +160,11 @@ pci_unmap_resource(void *requested_addr, size_t size)
 
 	/* Unmap the PCI memory resource of device */
 	if (rte_mem_unmap(requested_addr, size)) {
-		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
+		PCI_LOG(ERR, "%s(): cannot mem unmap(%p, %#zx): %s",
 			__func__, requested_addr, size,
 			rte_strerror(rte_errno));
 	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
-				requested_addr);
+		PCI_LOG(DEBUG, "  PCI memory unmapped at %p", requested_addr);
 }
 /*
  * Match the PCI Driver and Device using the ID Table
@@ -226,28 +224,27 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		/* Match of device and driver failed */
 		return 1;
 
-	RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
-			loc->domain, loc->bus, loc->devid, loc->function,
-			dev->device.numa_node);
+	PCI_LOG(DEBUG, "PCI device "PCI_PRI_FMT" on NUMA socket %i",
+		loc->domain, loc->bus, loc->devid, loc->function,
+		dev->device.numa_node);
 
 	/* no initialization when marked as blocked, return without error */
 	if (dev->device.devargs != NULL &&
 		dev->device.devargs->policy == RTE_DEV_BLOCKED) {
-		RTE_LOG(INFO, EAL, "  Device is blocked, not initializing\n");
+		PCI_LOG(INFO, "  Device is blocked, not initializing");
 		return 1;
 	}
 
 	if (dev->device.numa_node < 0 && rte_socket_count() > 1)
-		RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
+		PCI_LOG(INFO, "Device %s is not NUMA-aware", dev->name);
 
 	already_probed = rte_dev_is_probed(&dev->device);
 	if (already_probed && !(dr->drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
-		RTE_LOG(DEBUG, EAL, "Device %s is already probed\n",
-				dev->device.name);
+		PCI_LOG(DEBUG, "Device %s is already probed", dev->device.name);
 		return -EEXIST;
 	}
 
-	RTE_LOG(DEBUG, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
+	PCI_LOG(DEBUG, "  probe driver: %x:%x %s", dev->id.vendor_id,
 		dev->id.device_id, dr->driver.name);
 
 	if (!already_probed) {
@@ -258,7 +255,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		iova_mode = rte_eal_iova_mode();
 		if (dev_iova_mode != RTE_IOVA_DC &&
 		    dev_iova_mode != iova_mode) {
-			RTE_LOG(ERR, EAL, "  Expecting '%s' IOVA mode but current mode is '%s', not initializing\n",
+			PCI_LOG(ERR, "  Expecting '%s' IOVA mode but current mode is '%s', not initializing",
 				dev_iova_mode == RTE_IOVA_PA ? "PA" : "VA",
 				iova_mode == RTE_IOVA_PA ? "PA" : "VA");
 			return -EINVAL;
@@ -268,8 +265,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		dev->intr_handle =
 			rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
 		if (dev->intr_handle == NULL) {
-			RTE_LOG(ERR, EAL,
-				"Failed to create interrupt instance for %s\n",
+			PCI_LOG(ERR, "Failed to create interrupt instance for %s",
 				dev->device.name);
 			return -ENOMEM;
 		}
@@ -279,8 +275,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		if (dev->vfio_req_intr_handle == NULL) {
 			rte_intr_instance_free(dev->intr_handle);
 			dev->intr_handle = NULL;
-			RTE_LOG(ERR, EAL,
-				"Failed to create vfio req interrupt instance for %s\n",
+			PCI_LOG(ERR, "Failed to create vfio req interrupt instance for %s",
 				dev->device.name);
 			return -ENOMEM;
 		}
@@ -304,10 +299,10 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		}
 	}
 
-	RTE_LOG(INFO, EAL, "Probe PCI driver: %s (%x:%04x) device: "PCI_PRI_FMT" (socket %i)\n",
-			dr->driver.name, dev->id.vendor_id, dev->id.device_id,
-			loc->domain, loc->bus, loc->devid, loc->function,
-			dev->device.numa_node);
+	PCI_LOG(INFO, "Probe PCI driver: %s (%x:%04x) device: "PCI_PRI_FMT" (socket %i)",
+		dr->driver.name, dev->id.vendor_id, dev->id.device_id,
+		loc->domain, loc->bus, loc->devid, loc->function,
+		dev->device.numa_node);
 	/* call the driver probe() function */
 	ret = dr->probe(dr, dev);
 	if (already_probed)
@@ -349,12 +344,12 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
 	dr = dev->driver;
 	loc = &dev->addr;
 
-	RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
-			loc->domain, loc->bus, loc->devid,
-			loc->function, dev->device.numa_node);
+	PCI_LOG(DEBUG, "PCI device "PCI_PRI_FMT" on NUMA socket %i",
+		loc->domain, loc->bus, loc->devid,
+		loc->function, dev->device.numa_node);
 
-	RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
-			dev->id.device_id, dr->driver.name);
+	PCI_LOG(DEBUG, "  remove driver: %x:%x %s", dev->id.vendor_id,
+		dev->id.device_id, dr->driver.name);
 
 	if (dr->remove) {
 		ret = dr->remove(dev);
@@ -423,8 +418,7 @@ pci_probe(void)
 		ret = pci_probe_all_drivers(dev);
 		if (ret < 0) {
 			if (ret != -EEXIST) {
-				RTE_LOG(ERR, EAL, "Requested device "
-					PCI_PRI_FMT " cannot be used\n",
+				PCI_LOG(ERR, "Requested device " PCI_PRI_FMT " cannot be used",
 					dev->addr.domain, dev->addr.bus,
 					dev->addr.devid, dev->addr.function);
 				rte_errno = errno;
@@ -592,8 +586,8 @@ pci_find_device_by_addr(const void *failure_addr)
 			len = pdev->mem_resource[i].len;
 			end = start + len;
 			if (check_point >= start && check_point < end) {
-				RTE_LOG(DEBUG, EAL, "Failure address %16.16"
-					PRIx64" belongs to device %s!\n",
+				PCI_LOG(DEBUG, "Failure address %16.16"
+					PRIx64" belongs to device %s!",
 					check_point, pdev->device.name);
 				return pdev;
 			}
@@ -632,8 +626,7 @@ pci_hot_unplug_handler(struct rte_device *dev)
 		ret = pci_uio_remap_resource(pdev);
 		break;
 	default:
-		RTE_LOG(DEBUG, EAL,
-			"Not managed by a supported kernel driver, skipped\n");
+		PCI_LOG(DEBUG, "Not managed by a supported kernel driver, skipped");
 		ret = -1;
 		break;
 	}
@@ -655,8 +648,7 @@ pci_sigbus_handler(const void *failure_addr)
 		/* The sigbus error is caused of hot-unplug. */
 		ret = pci_hot_unplug_handler(&pdev->device);
 		if (ret) {
-			RTE_LOG(ERR, EAL,
-				"Failed to handle hot-unplug for device %s",
+			PCI_LOG(ERR, "Failed to handle hot-unplug for device %s",
 				pdev->name);
 			ret = -1;
 		}
@@ -780,8 +772,7 @@ rte_pci_get_iommu_class(void)
 				continue;
 
 			dev_iova_mode = pci_device_iova_mode(drv, dev);
-			RTE_LOG(DEBUG, EAL, "PCI driver %s for device "
-				PCI_PRI_FMT " wants IOVA as '%s'\n",
+			PCI_LOG(DEBUG, "PCI driver %s for device "PCI_PRI_FMT" wants IOVA as '%s'",
 				drv->driver.name,
 				dev->addr.domain, dev->addr.bus,
 				dev->addr.devid, dev->addr.function,
@@ -796,8 +787,8 @@ rte_pci_get_iommu_class(void)
 	if (iommu_no_va == 1) {
 		iova_mode = RTE_IOVA_PA;
 		if (devices_want_va) {
-			RTE_LOG(WARNING, EAL, "Some devices want 'VA' but IOMMU does not support 'VA'.\n");
-			RTE_LOG(WARNING, EAL, "The devices that want 'VA' won't initialize.\n");
+			PCI_LOG(WARNING, "Some devices want 'VA' but IOMMU does not support 'VA'.");
+			PCI_LOG(WARNING, "The devices that want 'VA' won't initialize.");
 		}
 	} else if (devices_want_va && !devices_want_pa) {
 		iova_mode = RTE_IOVA_VA;
@@ -806,8 +797,8 @@ rte_pci_get_iommu_class(void)
 	} else {
 		iova_mode = RTE_IOVA_DC;
 		if (devices_want_va) {
-			RTE_LOG(WARNING, EAL, "Some devices want 'VA' but forcing 'DC' because other devices want 'PA'.\n");
-			RTE_LOG(WARNING, EAL, "Depending on the final decision by the EAL, not all devices may be able to initialize.\n");
+			PCI_LOG(WARNING, "Some devices want 'VA' but forcing 'DC' because other devices want 'PA'.");
+			PCI_LOG(WARNING, "Depending on the final decision by the EAL, not all devices may be able to initialize.");
 		}
 	}
 	return iova_mode;
@@ -878,7 +869,7 @@ rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t cap)
 	ttl = (RTE_PCI_CFG_SPACE_EXP_SIZE - RTE_PCI_CFG_SPACE_SIZE) / 8;
 
 	if (rte_pci_read_config(dev, &header, 4, offset) < 0) {
-		RTE_LOG(ERR, EAL, "error in reading extended capabilities\n");
+		PCI_LOG(ERR, "error in reading extended capabilities");
 		return -1;
 	}
 
@@ -899,8 +890,7 @@ rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t cap)
 			break;
 
 		if (rte_pci_read_config(dev, &header, 4, offset) < 0) {
-			RTE_LOG(ERR, EAL,
-				"error in reading extended capabilities\n");
+			PCI_LOG(ERR, "error in reading extended capabilities");
 			return -1;
 		}
 
@@ -917,7 +907,7 @@ rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable)
 
 	if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd),
 				RTE_PCI_COMMAND) < 0) {
-		RTE_LOG(ERR, EAL, "error in reading PCI command register\n");
+		PCI_LOG(ERR, "error in reading PCI command register");
 		return -1;
 	}
 
@@ -931,7 +921,7 @@ rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable)
 
 	if (rte_pci_write_config(dev, &cmd, sizeof(cmd),
 				 RTE_PCI_COMMAND) < 0) {
-		RTE_LOG(ERR, EAL, "error in writing PCI command register\n");
+		PCI_LOG(ERR, "error in writing PCI command register");
 		return -1;
 	}
 
@@ -969,3 +959,4 @@ struct rte_pci_bus rte_pci_bus = {
 };
 
 RTE_REGISTER_BUS(pci, rte_pci_bus.bus);
+RTE_LOG_REGISTER_DEFAULT(pci_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 76c661f054..ff1b02b6bd 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -43,7 +43,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			 */
 			fd = open(uio_res->maps[i].path, O_RDWR);
 			if (fd < 0) {
-				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
+				PCI_LOG(ERR, "Cannot open %s: %s",
 					uio_res->maps[i].path, strerror(errno));
 				return -1;
 			}
@@ -55,8 +55,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			/* fd is not needed in secondary process, close it */
 			close(fd);
 			if (mapaddr != uio_res->maps[i].addr) {
-				RTE_LOG(ERR, EAL,
-					"Cannot mmap device resource file %s to address: %p\n",
+				PCI_LOG(ERR, "Cannot mmap device resource file %s to address: %p",
 					uio_res->maps[i].path,
 					uio_res->maps[i].addr);
 				if (mapaddr != NULL) {
@@ -76,7 +75,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 		return 0;
 	}
 
-	RTE_LOG(ERR, EAL, "Cannot find resource for device\n");
+	PCI_LOG(ERR, "Cannot find resource for device");
 	return 1;
 }
 
@@ -171,14 +170,10 @@ pci_uio_remap_resource(struct rte_pci_device *dev)
 				PROT_READ | PROT_WRITE,
 				MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
 		if (map_address == MAP_FAILED) {
-			RTE_LOG(ERR, EAL,
-				"Cannot remap resource for device %s\n",
-				dev->name);
+			PCI_LOG(ERR, "Cannot remap resource for device %s", dev->name);
 			return -1;
 		}
-		RTE_LOG(INFO, EAL,
-			"Successful remap resource for device %s\n",
-			dev->name);
+		PCI_LOG(INFO, "Successful remap resource for device %s", dev->name);
 	}
 
 	return 0;
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index d24cc201b8..087ec38bb9 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -70,7 +70,7 @@ rte_pci_dev_iterate(const void *start,
 	if (str != NULL) {
 		kvargs = rte_kvargs_parse(str, pci_params_keys);
 		if (kvargs == NULL) {
-			RTE_LOG(ERR, EAL, "cannot parse argument list\n");
+			PCI_LOG(ERR, "cannot parse argument list");
 			rte_errno = EINVAL;
 			return NULL;
 		}
@@ -94,22 +94,21 @@ rte_pci_devargs_parse(struct rte_devargs *da)
 
 	kvargs = rte_kvargs_parse(da->bus_str, NULL);
 	if (kvargs == NULL) {
-		RTE_LOG(ERR, EAL, "cannot parse argument list: %s\n",
-			da->bus_str);
+		PCI_LOG(ERR, "cannot parse argument list: %s", da->bus_str);
 		ret = -ENODEV;
 		goto out;
 	}
 
 	addr_str = rte_kvargs_get(kvargs, pci_params_keys[RTE_PCI_PARAM_ADDR]);
 	if (addr_str == NULL) {
-		RTE_LOG(DEBUG, EAL, "No PCI address specified using '%s=<id>' in: %s\n",
+		PCI_LOG(DEBUG, "No PCI address specified using '%s=<id>' in: %s",
 			pci_params_keys[RTE_PCI_PARAM_ADDR], da->bus_str);
 		goto out;
 	}
 
 	ret = rte_pci_addr_parse(addr_str, &addr);
 	if (ret != 0) {
-		RTE_LOG(ERR, EAL, "PCI address invalid: %s\n", da->bus_str);
+		PCI_LOG(ERR, "PCI address invalid: %s", da->bus_str);
 		ret = -EINVAL;
 		goto out;
 	}
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 8b0ce73533..38109844b9 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -10,9 +10,15 @@
 
 #include <bus_driver.h>
 #include <bus_pci_driver.h>
+#include <rte_log.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+extern int pci_bus_logtype;
+#define RTE_LOGTYPE_PCI_BUS pci_bus_logtype
+#define PCI_LOG(level, ...) \
+	RTE_LOG_LINE(level, PCI_BUS, "" __VA_ARGS__)
+
 #define RTE_MAX_PCI_REGIONS    9
 
 /*
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 45a12bcb52..36e6f89093 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -246,8 +246,7 @@ get_device_resource_info(HDEVINFO dev_info,
 		/* get device info from NetUIO kernel driver */
 		ret = get_netuio_device_info(dev_info, dev_info_data, dev);
 		if (ret != 0) {
-			RTE_LOG(DEBUG, EAL,
-				"Could not retrieve device info for PCI device "
+			PCI_LOG(DEBUG, "Could not retrieve device info for PCI device "
 				PCI_PRI_FMT,
 				dev->addr.domain, dev->addr.bus,
 				dev->addr.devid, dev->addr.function);
@@ -256,9 +255,7 @@ get_device_resource_info(HDEVINFO dev_info,
 		break;
 	default:
 		/* kernel driver type is unsupported */
-		RTE_LOG(DEBUG, EAL,
-			"Kernel driver type for PCI device " PCI_PRI_FMT ","
-			" is unsupported",
+		PCI_LOG(DEBUG, "Kernel driver type for PCI device " PCI_PRI_FMT ", is unsupported",
 			dev->addr.domain, dev->addr.bus,
 			dev->addr.devid, dev->addr.function);
 		return -1;
@@ -397,7 +394,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 
 	pdev = malloc(sizeof(*pdev));
 	if (pdev == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n");
+		PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
 		goto end;
 	}
 
@@ -470,7 +467,7 @@ rte_pci_scan(void)
 		DIGCF_PRESENT | DIGCF_ALLCLASSES);
 	if (dev_info == INVALID_HANDLE_VALUE) {
 		RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)");
-		RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
+		PCI_LOG(ERR, "Unable to enumerate PCI devices.");
 		goto end;
 	}
 
@@ -495,7 +492,7 @@ rte_pci_scan(void)
 		device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
 	}
 
-	RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
+	PCI_LOG(DEBUG, "PCI scan found %lu devices", found_device);
 	ret = 0;
 end:
 	if (dev_info != INVALID_HANDLE_VALUE)
diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c
index 314bbcf547..346b2f4c0a 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -96,7 +96,7 @@ get_netuio_device_interface_detail(HDEVINFO di_set)
 
 	dev_ifx_detail = malloc(required_size);
 	if (!dev_ifx_detail) {
-		RTE_LOG(ERR, EAL, "Could not allocate memory for dev interface.\n");
+		PCI_LOG(ERR, "Could not allocate memory for dev interface.");
 		goto end;
 	}
 	dev_ifx_detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
@@ -148,15 +148,14 @@ get_netuio_device_info(HDEVINFO dev_info, PSP_DEVINFO_DATA dev_info_data,
 		NULL);
 	if (netuio == INVALID_HANDLE_VALUE) {
 		RTE_LOG_WIN32_ERR("CreateFile");
-		RTE_LOG(ERR, EAL, "Unable to open driver file \"%s\".\n",
-			dev_ifx_detail->DevicePath);
+		PCI_LOG(ERR, "Unable to open driver file \"%s\".", dev_ifx_detail->DevicePath);
 		goto end;
 	}
 
 	/* send ioctl to retrieve device information */
 	if (send_ioctl(netuio, IOCTL_NETUIO_MAP_HW_INTO_USERSPACE, NULL, 0,
 		&hw_info, sizeof(hw_info)) != ERROR_SUCCESS) {
-		RTE_LOG(ERR, EAL, "Unable to send ioctl to driver.\n");
+		PCI_LOG(ERR, "Unable to send ioctl to driver.");
 		goto end;
 	}
 
-- 
2.45.2


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

* [PATCH 6/6] crypto/ccp: use a dynamic logtype
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
                   ` (4 preceding siblings ...)
  2024-06-25 12:24 ` [PATCH 5/6] bus/pci: use a dynamic logtype David Marchand
@ 2024-06-25 12:24 ` David Marchand
  2024-06-28 11:57   ` David Marchand
  2024-07-03 14:55 ` [PATCH 0/6] Some drivers logging cleanups David Marchand
  6 siblings, 1 reply; 12+ messages in thread
From: David Marchand @ 2024-06-25 12:24 UTC (permalink / raw)
  To: dev; +Cc: Sunil Uttarwar

Register a logtype for this bus driver and stop logging as CRYPTODEV.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/crypto/ccp/ccp_crypto.c      |  4 ++--
 drivers/crypto/ccp/ccp_pmd_private.h | 15 +++++----------
 drivers/crypto/ccp/rte_ccp_pmd.c     |  2 ++
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4b84b3303e..5899d83bae 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1829,7 +1829,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
 	append_ptr = (uint8_t *)rte_pktmbuf_append(op->sym->m_src,
 						session->auth.ctx_len);
 	if (!append_ptr) {
-		CCP_LOG_ERR("CCP MBUF append failed\n");
+		CCP_LOG_ERR("CCP MBUF append failed");
 		return -1;
 	}
 	dest_addr = (phys_addr_t)rte_mem_virt2iova((void *)append_ptr);
@@ -1966,7 +1966,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
 	append_ptr = (uint8_t *)rte_pktmbuf_append(op->sym->m_src,
 						session->auth.ctx_len);
 	if (!append_ptr) {
-		CCP_LOG_ERR("CCP MBUF append failed\n");
+		CCP_LOG_ERR("CCP MBUF append failed");
 		return -1;
 	}
 	dest_addr = (phys_addr_t)rte_mem_virt2iova((void *)append_ptr);
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 390442ff19..94c8fec46d 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -8,23 +8,18 @@
 #include <rte_cryptodev.h>
 #include "ccp_crypto.h"
 
-#define CRYPTODEV_NAME_CCP_PMD crypto_ccp
+extern int crypto_ccp_logtype;
+#define RTE_LOGTYPE_CRYPTO_CCP crypto_ccp_logtype
 
 #define CCP_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n",  \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(ERR, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 
 #ifdef RTE_LIBRTE_CCP_DEBUG
 #define CCP_LOG_INFO(fmt, args...) \
-	RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(INFO, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 
 #define CCP_LOG_DBG(fmt, args...) \
-	RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(DEBUG, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 #else
 #define CCP_LOG_INFO(fmt, args...)
 #define CCP_LOG_DBG(fmt, args...)
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 869399597e..022c1df182 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -22,6 +22,7 @@
 static unsigned int ccp_pmd_init_done;
 uint8_t ccp_cryptodev_driver_id;
 uint8_t cryptodev_cnt;
+int crypto_ccp_logtype;
 
 struct ccp_pmd_init_params {
 	struct rte_cryptodev_pmd_init_params def_p;
@@ -320,3 +321,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,
 	"ccp_auth_opt=<int>");
 RTE_PMD_REGISTER_CRYPTO_DRIVER(ccp_crypto_drv, cryptodev_ccp_pmd_drv.driver,
 			       ccp_cryptodev_driver_id);
+RTE_LOG_REGISTER_DEFAULT(crypto_ccp_logtype, NOTICE);
-- 
2.45.2


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

* Re: [PATCH 1/6] vdpa/sfc: remove dead code
  2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
@ 2024-06-25 14:25   ` Andrew Rybchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Rybchenko @ 2024-06-25 14:25 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: stable, Vijay Kumar Srivastava, Maxime Coquelin

On 6/25/24 15:24, David Marchand wrote:
> This is probably a copy/paste from the net/sfc driver.
> sfc_logtype_driver is not a logtype variable from the sfc vDPA driver.
> Remove it.
> 
> Fixes: 6dad9a7353d4 ("vdpa/sfc: support device initialization")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>


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

* Re: [PATCH 3/6] net/sfc: remove use of EAL logtype
  2024-06-25 12:24 ` [PATCH 3/6] net/sfc: remove use " David Marchand
@ 2024-06-25 14:26   ` Andrew Rybchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Rybchenko @ 2024-06-25 14:26 UTC (permalink / raw)
  To: David Marchand, dev

On 6/25/24 15:24, David Marchand wrote:
> When registering a common logtype for this driver, instead of
> explicitly fall back to EAL, rely on the log registration macro to
> achieve the same.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Thanks


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

* Re: [PATCH 5/6] bus/pci: use a dynamic logtype
  2024-06-25 12:24 ` [PATCH 5/6] bus/pci: use a dynamic logtype David Marchand
@ 2024-06-26  2:05   ` Chenbo Xia
  0 siblings, 0 replies; 12+ messages in thread
From: Chenbo Xia @ 2024-06-26  2:05 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Nipun Gupta, Anatoly Burakov

On Jun 25, 2024, at 20:24, David Marchand <david.marchand@redhat.com> wrote:
> 
> External email: Use caution opening links or attachments
> 
> 
> Register a logtype for this bus driver and stop logging as EAL.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/bus/pci/bsd/pci.c            |  44 +++----
> drivers/bus/pci/linux/pci.c          |  52 ++++----
> drivers/bus/pci/linux/pci_uio.c      |  75 +++++-------
> drivers/bus/pci/linux/pci_vfio.c     | 173 +++++++++++----------------
> drivers/bus/pci/pci_common.c         |  85 ++++++-------
> drivers/bus/pci/pci_common_uio.c     |  15 +--
> drivers/bus/pci/pci_params.c         |   9 +-
> drivers/bus/pci/private.h            |   6 +
> drivers/bus/pci/windows/pci.c        |  13 +-
> drivers/bus/pci/windows/pci_netuio.c |   7 +-
> 10 files changed, 202 insertions(+), 277 deletions(-)

Reviewed-by: Chenbo Xia <chenbox@nvidia.com>

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

* Re: [PATCH 6/6] crypto/ccp: use a dynamic logtype
  2024-06-25 12:24 ` [PATCH 6/6] crypto/ccp: " David Marchand
@ 2024-06-28 11:57   ` David Marchand
  0 siblings, 0 replies; 12+ messages in thread
From: David Marchand @ 2024-06-28 11:57 UTC (permalink / raw)
  To: dev; +Cc: Sunil Uttarwar

On Tue, Jun 25, 2024 at 2:25 PM David Marchand
<david.marchand@redhat.com> wrote:
> diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
> index 869399597e..022c1df182 100644
> --- a/drivers/crypto/ccp/rte_ccp_pmd.c
> +++ b/drivers/crypto/ccp/rte_ccp_pmd.c
> @@ -22,6 +22,7 @@
>  static unsigned int ccp_pmd_init_done;
>  uint8_t ccp_cryptodev_driver_id;
>  uint8_t cryptodev_cnt;
> +int crypto_ccp_logtype;

This declaration is unneeded as RTE_LOG_REGISTER_DEFAULT declares the
logtype var.
I will fix in a new revision if one is needed, otherwise, I will fix
when applying.

>
>  struct ccp_pmd_init_params {
>         struct rte_cryptodev_pmd_init_params def_p;


-- 
David Marchand


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

* Re: [PATCH 0/6] Some drivers logging cleanups
  2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
                   ` (5 preceding siblings ...)
  2024-06-25 12:24 ` [PATCH 6/6] crypto/ccp: " David Marchand
@ 2024-07-03 14:55 ` David Marchand
  6 siblings, 0 replies; 12+ messages in thread
From: David Marchand @ 2024-07-03 14:55 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Tue, Jun 25, 2024 at 2:24 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> This series removes the last direct calls to some RTE_LOGTYPE_ coming
> from libraries (EAL and CRYPTODEV) and replaces them with dedicated
> macros coming from the drivers.
>

Series applied.


-- 
David Marchand


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

end of thread, other threads:[~2024-07-03 14:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
2024-06-25 14:25   ` Andrew Rybchenko
2024-06-25 12:24 ` [PATCH 2/6] drivers: use dedicated log macros instead of EAL logtype David Marchand
2024-06-25 12:24 ` [PATCH 3/6] net/sfc: remove use " David Marchand
2024-06-25 14:26   ` Andrew Rybchenko
2024-06-25 12:24 ` [PATCH 4/6] vdpa/sfc: " David Marchand
2024-06-25 12:24 ` [PATCH 5/6] bus/pci: use a dynamic logtype David Marchand
2024-06-26  2:05   ` Chenbo Xia
2024-06-25 12:24 ` [PATCH 6/6] crypto/ccp: " David Marchand
2024-06-28 11:57   ` David Marchand
2024-07-03 14:55 ` [PATCH 0/6] Some drivers logging cleanups David Marchand

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