All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset
@ 2017-04-26  8:09 Alexey Kardashevskiy
  2017-04-28 11:19 ` Burakov, Anatoly
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kardashevskiy @ 2017-04-26  8:09 UTC (permalink / raw)
  To: dev; +Cc: Alexey Kardashevskiy

VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
just created DMA window. It happens to start from zero because the default
window is removed (leaving no windows) and new window starts from zero.
However this is not guaranteed and a new window may start from another
address, this adds a check and an error message.


Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* this just prints warning and fails instead of incorrectly changing
IOVA addresses
---
 lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 46f951f4d..530815790 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -702,6 +702,13 @@ vfio_spapr_dma_map(int vfio_container_fd)
 		return -1;
 	}
 
+	if (create.start_addr) {
+		RTE_LOG(ERR, EAL,
+			"  DMA offsets other than zero is not supported, "
+			"new window is created at %lx\n", create.start_addr);
+		return -1;
+	}
+
 	/* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */
 	for (i = 0; i < RTE_MAX_MEMSEG; i++) {
 		struct vfio_iommu_type1_dma_map dma_map;
@@ -734,7 +741,6 @@ vfio_spapr_dma_map(int vfio_container_fd)
 				"error %i (%s)\n", errno, strerror(errno));
 			return -1;
 		}
-
 	}
 
 	return 0;
-- 
2.11.0

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

* Re: [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset
  2017-04-26  8:09 [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset Alexey Kardashevskiy
@ 2017-04-28 11:19 ` Burakov, Anatoly
  2017-10-17 16:13   ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Burakov, Anatoly @ 2017-04-28 11:19 UTC (permalink / raw)
  To: Alexey Kardashevskiy, dev

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Alexey
> Kardashevskiy
> Sent: Wednesday, April 26, 2017 9:09 AM
> To: dev@dpdk.org
> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> Subject: [dpdk-dev] [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA
> window was created at unexpected offset
> 
> VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
> just created DMA window. It happens to start from zero because the default
> window is removed (leaving no windows) and new window starts from zero.
> However this is not guaranteed and a new window may start from another
> address, this adds a check and an error message.
> 
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v2:
> * this just prints warning and fails instead of incorrectly changing IOVA
> addresses
> ---
>  lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> index 46f951f4d..530815790 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> @@ -702,6 +702,13 @@ vfio_spapr_dma_map(int vfio_container_fd)
>  		return -1;
>  	}
> 
> +	if (create.start_addr) {
> +		RTE_LOG(ERR, EAL,
> +			"  DMA offsets other than zero is not supported, "
> +			"new window is created at %lx\n",
> create.start_addr);
> +		return -1;
> +	}
> +
>  	/* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */
>  	for (i = 0; i < RTE_MAX_MEMSEG; i++) {
>  		struct vfio_iommu_type1_dma_map dma_map; @@ -734,7
> +741,6 @@ vfio_spapr_dma_map(int vfio_container_fd)
>  				"error %i (%s)\n", errno, strerror(errno));
>  			return -1;
>  		}
> -
>  	}
> 
>  	return 0;
> --
> 2.11.0

Hi Alexey,

There are some compile failures with this patch. You'll probably want to replace %lx with PRIx64 or similar :)

I would argue that just saying "DMA offsets other than zero are not supported" will be sufficient and will make error message less confusing. Up to you though.

Thanks,
Anatoly

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

* Re: [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset
  2017-04-28 11:19 ` Burakov, Anatoly
@ 2017-10-17 16:13   ` Thomas Monjalon
  2017-10-18  5:11     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2017-10-17 16:13 UTC (permalink / raw)
  To: Burakov, Anatoly, Alexey Kardashevskiy; +Cc: dev

28/04/2017 13:19, Burakov, Anatoly:
> From: Alexey Kardashevskiy
> > VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
> > just created DMA window. It happens to start from zero because the default
> > window is removed (leaving no windows) and new window starts from zero.
> > However this is not guaranteed and a new window may start from another
> > address, this adds a check and an error message.
> > 
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> > Changes:
> > v2:
> > * this just prints warning and fails instead of incorrectly changing IOVA
> > addresses
> > ---
> 
> Hi Alexey,
> 
> There are some compile failures with this patch. You'll probably want to replace %lx with PRIx64 or similar :)
> 
> I would argue that just saying "DMA offsets other than zero are not supported" will be sufficient and will make error message less confusing. Up to you though.

Please, can we progress on this patch?
Is it still a relevant patch?
If yes, someone to make a v3, please?

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

* Re: [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset
  2017-10-17 16:13   ` Thomas Monjalon
@ 2017-10-18  5:11     ` Alexey Kardashevskiy
  2017-10-18  6:24       ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18  5:11 UTC (permalink / raw)
  To: Thomas Monjalon, Burakov, Anatoly; +Cc: dev

On 18/10/17 03:13, Thomas Monjalon wrote:
> 28/04/2017 13:19, Burakov, Anatoly:
>> From: Alexey Kardashevskiy
>>> VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
>>> just created DMA window. It happens to start from zero because the default
>>> window is removed (leaving no windows) and new window starts from zero.
>>> However this is not guaranteed and a new window may start from another
>>> address, this adds a check and an error message.
>>>
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>> Changes:
>>> v2:
>>> * this just prints warning and fails instead of incorrectly changing IOVA
>>> addresses
>>> ---
>>
>> Hi Alexey,
>>
>> There are some compile failures with this patch. You'll probably want to replace %lx with PRIx64 or similar :)
>>
>> I would argue that just saying "DMA offsets other than zero are not supported" will be sufficient and will make error message less confusing. Up to you though.
> 
> Please, can we progress on this patch?
> Is it still a relevant patch?

Nope, http://dpdk.org/browse/dpdk/commit/?id=ed1e7e576be219e1e has the
warning, this is enough really.


> If yes, someone to make a v3, please?
> 


-- 
Alexey

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

* Re: [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset
  2017-10-18  5:11     ` Alexey Kardashevskiy
@ 2017-10-18  6:24       ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-10-18  6:24 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: Burakov, Anatoly, dev

18/10/2017 07:11, Alexey Kardashevskiy:
> On 18/10/17 03:13, Thomas Monjalon wrote:
> > 28/04/2017 13:19, Burakov, Anatoly:
> >> From: Alexey Kardashevskiy
> >>> VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
> >>> just created DMA window. It happens to start from zero because the default
> >>> window is removed (leaving no windows) and new window starts from zero.
> >>> However this is not guaranteed and a new window may start from another
> >>> address, this adds a check and an error message.
> >>>
> >>>
> >>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> >>> ---
> >>> Changes:
> >>> v2:
> >>> * this just prints warning and fails instead of incorrectly changing IOVA
> >>> addresses
> >>> ---
> >>
> >> Hi Alexey,
> >>
> >> There are some compile failures with this patch. You'll probably want to replace %lx with PRIx64 or similar :)
> >>
> >> I would argue that just saying "DMA offsets other than zero are not supported" will be sufficient and will make error message less confusing. Up to you though.
> > 
> > Please, can we progress on this patch?
> > Is it still a relevant patch?
> 
> Nope, http://dpdk.org/browse/dpdk/commit/?id=ed1e7e576be219e1e has the
> warning, this is enough really.

OK, I've marked it as superseded in patchwork.
Thanks

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

end of thread, other threads:[~2017-10-18  6:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26  8:09 [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset Alexey Kardashevskiy
2017-04-28 11:19 ` Burakov, Anatoly
2017-10-17 16:13   ` Thomas Monjalon
2017-10-18  5:11     ` Alexey Kardashevskiy
2017-10-18  6:24       ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.