From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 44C95A04F5 for ; Wed, 11 Dec 2019 22:28:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C7A834EF; Wed, 11 Dec 2019 22:28:24 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 682AD34EF for ; Wed, 11 Dec 2019 22:28:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576099701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JpQkTr2MamekvBfy1UlHMXf2Q3FJZT3sbLKRRWELHxo=; b=KNJOVZbWD7HQmp5xi/7fRQj2esZxbxCWUo/Ctt+QJEbKvIGGPxdXxd6Lim/AV/7TWlDJE/ Gai2/3PQqHGrsev4UE+d2DM9VysaqjRfu3DNK8Rs19GiEVdcp9+MHl2evtZHj+ddUs4qG8 W5lhj5LEYG48mxx6FGJANVdW6CVEQEI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-204-JhxEOgqWPd-tAThTZz-bCA-1; Wed, 11 Dec 2019 16:28:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBD9F107ACC5; Wed, 11 Dec 2019 21:28:16 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1471C10013A1; Wed, 11 Dec 2019 21:28:14 +0000 (UTC) From: Kevin Traynor To: "Wangyu (Eric)" Cc: Xiaofeng Deng , Wei Hu , Min Hu , Anatoly Burakov , Gavin Hu , dpdk stable Date: Wed, 11 Dec 2019 21:26:16 +0000 Message-Id: <20191211212702.27851-24-ktraynor@redhat.com> In-Reply-To: <20191211212702.27851-1-ktraynor@redhat.com> References: <20191211212702.27851-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: JhxEOgqWPd-tAThTZz-bCA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'bus/pci: align next mapping address on page boundary' has been queued to LTS release 18.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 rebasi= ng (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/db07de20e0cc19a34f= 7621c0282ecaa78b2d164b Thanks. Kevin. --- >From db07de20e0cc19a34f7621c0282ecaa78b2d164b Mon Sep 17 00:00:00 2001 From: "Wangyu (Eric)" 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 Signed-off-by: Wangyu (Eric) Acked-by: Wei Hu (Xavier) Acked-by: Min Hu (Connor) Acked-by: Anatoly Burakov Acked-by: Gavin Hu --- 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_ui= o.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 *de= v, int res_idx, =09=09=09(size_t)dev->mem_resource[res_idx].len); =20 +=09pci_map_addr =3D RTE_PTR_ALIGN(pci_map_addr, sysconf(_SC_PAGE_SIZE)); + =09maps[map_idx].phaddr =3D dev->mem_resource[res_idx].phys_addr; =09maps[map_idx].size =3D dev->mem_resource[res_idx].len; diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_v= fio.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 *de= v) =09=09pci_map_addr =3D RTE_PTR_ADD(bar_addr, (size_t) reg->size); =20 +=09=09pci_map_addr =3D RTE_PTR_ALIGN(pci_map_addr, +=09=09=09=09=09sysconf(_SC_PAGE_SIZE)); + =09=09maps[i].addr =3D bar_addr; =09=09maps[i].offset =3D reg->offset; --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-11 21:24:14.628877991 +0000 +++ 0024-bus-pci-align-next-mapping-address-on-page-boundary.patch=092019-1= 2-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@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 *d= ev) +@@ -734,4 +734,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *d= ev)