bus/pci: fix mapping of PCI resources

Message ID 20200928063429.14148-1-alvinx.zhang@intel.com (mailing list archive)
State Rejected, archived
Delegated to: David Marchand
Headers
Series bus/pci: fix mapping of PCI resources |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Alvin Zhang Sept. 28, 2020, 6:34 a.m. UTC
  From: Alvin Zhang <alvinx.zhang@intel.com>

When mapping PCI bar resources around the MSI-X table, if the size
of the first part is 0, the second part should also be mapped if
its size is not 0.

Fixes: e200535c1ca3 ("mem: drop mapping API workaround")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/bus/pci/linux/pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Burakov, Anatoly Sept. 28, 2020, 9:10 a.m. UTC | #1
On 28-Sep-20 7:34 AM, alvinx.zhang@intel.com wrote:
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> When mapping PCI bar resources around the MSI-X table, if the size
> of the first part is 0, the second part should also be mapped if
> its size is not 0.
> 
> Fixes: e200535c1ca3 ("mem: drop mapping API workaround")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>   drivers/bus/pci/linux/pci_vfio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
> index 34b5da8..37bfda8 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -565,7 +565,7 @@
>   		}
>   
>   		/* if there's a second part, try to map it */
> -		if (map_addr != NULL
> +		if ((map_addr != NULL || memreg[0].size == 0)
>   			&& memreg[1].offset && memreg[1].size) {
>   			void *second_addr = RTE_PTR_ADD(bar_addr,
>   						(uintptr_t)(memreg[1].offset -
> 

Dupe of http://patches.dpdk.org/patch/78768/ ?
  
David Marchand Sept. 28, 2020, 9:43 a.m. UTC | #2
On Mon, Sep 28, 2020 at 11:11 AM Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
> Dupe of http://patches.dpdk.org/patch/78768/ ?

Yes.
  
Ling, WeiX Sept. 28, 2020, 9:55 a.m. UTC | #3
Tested-by: Ling, Wei <weix.ling@intel.com>

Regards,
Ling Wei

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of alvinx.zhang@intel.com
> Sent: Monday, September 28, 2020 02:34 PM
> To: david.marchand@redhat.com; arybchenko@solarflare.com
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] bus/pci: fix mapping of PCI resources
>
  

Patch

diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 34b5da8..37bfda8 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -565,7 +565,7 @@ 
 		}
 
 		/* if there's a second part, try to map it */
-		if (map_addr != NULL
+		if ((map_addr != NULL || memreg[0].size == 0)
 			&& memreg[1].offset && memreg[1].size) {
 			void *second_addr = RTE_PTR_ADD(bar_addr,
 						(uintptr_t)(memreg[1].offset -