[dpdk-stable] patch 'bus/pci: align next mapping address on page boundary' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Wed Dec 11 22:26:16 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/17/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/db07de20e0cc19a34f7621c0282ecaa78b2d164b

Thanks.

Kevin.

---
>From db07de20e0cc19a34f7621c0282ecaa78b2d164b Mon Sep 17 00:00:00 2001
From: "Wangyu (Eric)" <seven.wangyu at huawei.com>
Date: Wed, 13 Nov 2019 07:17:30 +0000
Subject: [PATCH] bus/pci: align next mapping address on page boundary

[ upstream commit d25ab4b7f128610cb5310b424c1f608686173f13 ]

Currently, the next address picked by PCI mapping infrastructure
may be page-unaligned due to BAR length being smaller than page size.
This leads to a situation where the requested map address is invalid,
resulting in mmap() call returning an arbitrary address,
which will later interfere with device BAR mapping in secondary processes.

Fix it by always aligning the next requested address on page boundary.

Fixes: c752998b5e2e ("pci: introduce library and driver")

Signed-off-by: Xiaofeng Deng <dengxiaofeng at huawei.com>
Signed-off-by: Wangyu (Eric) <seven.wangyu at huawei.com>
Acked-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
Acked-by: Min Hu (Connor) <humin29 at huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Gavin Hu <gavin.hu at arm.com>
---
 drivers/bus/pci/linux/pci_uio.c  | 2 ++
 drivers/bus/pci/linux/pci_vfio.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 0d1b9aa34..eb3941e43 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -352,4 +352,6 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 			(size_t)dev->mem_resource[res_idx].len);
 
+	pci_map_addr = RTE_PTR_ALIGN(pci_map_addr, sysconf(_SC_PAGE_SIZE));
+
 	maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
 	maps[map_idx].size = dev->mem_resource[res_idx].len;
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index a3635cfe1..366d2ab2f 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -734,4 +734,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		pci_map_addr = RTE_PTR_ADD(bar_addr, (size_t) reg->size);
 
+		pci_map_addr = RTE_PTR_ALIGN(pci_map_addr,
+					sysconf(_SC_PAGE_SIZE));
+
 		maps[i].addr = bar_addr;
 		maps[i].offset = reg->offset;
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-11 21:24:14.628877991 +0000
+++ 0024-bus-pci-align-next-mapping-address-on-page-boundary.patch	2019-12-11 21:24:12.626652065 +0000
@@ -1 +1 @@
-From d25ab4b7f128610cb5310b424c1f608686173f13 Mon Sep 17 00:00:00 2001
+From db07de20e0cc19a34f7621c0282ecaa78b2d164b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d25ab4b7f128610cb5310b424c1f608686173f13 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
-index 6dca05a98..097dc1922 100644
+index 0d1b9aa34..eb3941e43 100644
@@ -40 +41 @@
-index b8faa23f8..64cd84a68 100644
+index a3635cfe1..366d2ab2f 100644
@@ -43 +44 @@
-@@ -751,4 +751,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
+@@ -734,4 +734,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)



More information about the stable mailing list