Re: [RFC 0/1] tag IOMMU-protected devices in Dom0 fdt

2021-10-12 Thread Roman Skakun
Understood. Thank you! вт, 12 окт. 2021 г. в 17:20, Julien Grall : > > > > On 12/10/2021 15:11, Roman Skakun wrote: > > Hi, > > Hi Roman, > > > Would you be so kind to look at my patches, it would help me to > > know exactly whether I'm moving correctly and

Re: [RFC 0/1] tag IOMMU-protected devices in Dom0 fdt

2021-10-12 Thread Roman Skakun
Hi, Would you be so kind to look at my patches, it would help me to know exactly whether I'm moving correctly and whether I've chosen the right path? Thanks! Best regards, Roman пн, 4 окт. 2021 г. в 12:54, Roman Skakun : > > From: Roman Skakun > > At the moment, Dom0 can't disti

Re: [RFC 1/1] xen/arm: set iommu property for IOMMU-protected devices

2021-10-07 Thread Roman Skakun
Hi Oleksandr, >> From: Roman Skakun >> >> Xen is not exposing any IOMMU properties to Dom0. >> So Dom0 assumes that all it's devices are not protected by IOMMU. >> >> To make Dom0 aware of IOMMU-protected devices, we need to mark >> them somehow. With th

[RFC PATCH] dma-mapping: don't set swiotlb-xen fops for IOMMU-protected devices

2021-10-04 Thread Roman Skakun
IOMMU-protected device. Signed-off-by: Roman Skakun --- arch/arm/mm/dma-mapping.c | 2 +- arch/arm/xen/enlighten.c| 4 arch/arm64/mm/dma-mapping.c | 2 +- include/xen/xen.h | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm

[RFC 1/1] xen/arm: set iommu property for IOMMU-protected devices

2021-10-04 Thread Roman Skakun
From: Roman Skakun Xen is not exposing any IOMMU properties to Dom0. So Dom0 assumes that all it's devices are not protected by IOMMU. To make Dom0 aware of IOMMU-protected devices, we need to mark them somehow. With this approach Dom0 Linux kernel will be able to selectively disable swiotlb

[RFC 0/1] tag IOMMU-protected devices in Dom0 fdt

2021-10-04 Thread Roman Skakun
From: Roman Skakun At the moment, Dom0 can't distinguish which devices are protected by IOMMU and which are not. In some cases, this can cause swiotlb bounce buffer use for DMA addresses above 32 bits, which in turn can lead to poor performance. I started a conversation at [1], where we

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-21 Thread Roman Skakun
large buffer which is greater than 256 KB (128(CURRENT_IO_TLB_SEGMENT * 2048) and need to adjust this parameter during boot time, not compilation time. In order to this point, this patch was created. Thanks, Roman пт, 17 сент. 2021 г. в 12:44, Robin Murphy : > > On 2021-09-17 10:36, Roman Skak

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Roman Skakun
acement, nor would a test build (with both patches in > place). It's reasonable. I will change the original IO_TLB_SEGSIZE to IO_TLB_DEFAULT_SEGSIZE in the next patch series. Thanks. ср, 15 сент. 2021 г. в 16:50, Jan Beulich : > > On 15.09.2021 15:37, Roman Skakun wrote:

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Roman Skakun
Hi, Christoph I use Xen PV display. In my case, PV display backend(Dom0) allocates contiguous buffer via DMA-API to to implement zero-copy between Dom0 and DomU. When I start Weston under DomU, I got the next log in Dom0: ``` [ 112.554471] CPU: 0 PID: 367 Comm: weston Tainted: G O

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-16 Thread Roman Skakun
Hi Stefano, > Also, Option 1 listed in the webpage seems to be a lot better. Any > reason you can't do that? Because that option both solves the problem > and increases performance. Yes, Option 1 is probably more efficient. But I use another platform under Xen without DMA adjustment

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-15 Thread Roman Skakun
Hi Jan, Thanks for the answer. >> From: Roman Skakun >> >> It is possible when default IO TLB size is not >> enough to fit a long buffers as described here [1]. >> >> This patch makes a way to set this parameter >> using cmdline instead of recompiling

[PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-14 Thread Roman Skakun
From: Roman Skakun It is possible when default IO TLB size is not enough to fit a long buffers as described here [1]. This patch makes a way to set this parameter using cmdline instead of recompiling a kernel. [1] https://www.xilinx.com/support/answers/72694.html Signed-off-by: Roman Skakun

Re: Disable IOMMU in Dom0

2021-09-09 Thread Roman Skakun
? Cheers, Roman From: Julien Grall Sent: Wednesday, September 1, 2021 1:22 PM To: Roman Skakun ; Stefano Stabellini Cc: xen-devel@lists.xenproject.org ; Bertrand Marquis ; Andrii Anisov ; Roman Skakun ; Oleksandr Tyshchenko Subject: Re: Disable IOMMU in Dom0 Hi

Re: Disable IOMMU in Dom0

2021-09-01 Thread Roman Skakun
i Sent: Wednesday, September 1, 2021 12:50 AM To: Roman Skakun Cc: Stefano Stabellini ; Julien Grall ; xen-devel@lists.xenproject.org ; Bertrand Marquis ; Andrii Anisov ; Roman Skakun Subject: Re: Disable IOMMU in Dom0 On Tue, 31 Aug 2021, Roman Skakun wrote: > Hi, Stefano! > > I

Disable IOMMU in Dom0

2021-08-31 Thread Roman Skakun
Hi, Stefano! I have seen your negotiation of disabling xen-swiotlb for devices which are controlled by IOMMU in Dom0: https://patchwork.kernel.org/project/xen-devel/patch/alpine.DEB.2.21.2102161333090.3234@sstabellini-ThinkPad-T480s/ As I was thinking to create a common implementation because I

Re: Disable swiotlb for Dom0

2021-08-13 Thread Roman Skakun
und the article https://www.xilinx.com/support/answers/72694.html, where I believe the same issue was mentioned. Thank you so much for your time and help! From: Julien Grall Sent: Friday, August 13, 2021 1:51 PM To: Roman Skakun ; sstabell...@kernel.org Cc:

Re: Disable swiotlb for Dom0

2021-08-13 Thread Roman Skakun
708 nslots. Continue... [ 260.053533] swiotlb_tbl_map_single() io_tlb_list[31870]=2 slots < 708 nslots. Continue... [ 260.062606] swiotlb_tbl_map_single() io_tlb_list[31872]=80 slots < 708 nslots. Continue... Swiotlb did not fit requested slots because the maximum slot size equals IO

Re: Disable swiotlb for Dom0

2021-08-11 Thread Roman Skakun
hy we got a normal dom0 DMA address (b600) and why 64b1d when using swiotlb. From: Julien Grall Sent: Wednesday, August 11, 2021 1:30 PM To: Roman Skakun ; sstabell...@kernel.org Cc: Bertrand Marquis ; Andrii Anisov ; Volodymyr Babchuk ; Oleksandr Ty

Re: Disable swiotlb for Dom0

2021-08-11 Thread Roman Skakun
Therefore, I think we should first find out why Linux wants to bounce > the DMA buffer. We retrieved dev_addr(64b1d) + size > 32bit mask, but fcp driver wants to use only 32 bit boundary address, but that's consequence. I think, the main reason of using bounce buffer is MFN address, not DM

Disable swiotlb for Dom0

2021-08-10 Thread Roman Skakun
Hi, Stefano! I have observed your patch here: https://patchwork.kernel.org/project/xen-devel/patch/alpine.DEB.2.21.2102161333090.3234@sstabellini-ThinkPad-T480s/ And I collided with the same issue, when Dom0 device trying to use swiotlb fops for devices which are controlled by IOMMU.

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-21 Thread Roman Skakun
> Fine with. I've queued up the modified patch. Good. Thanks! > > On Sat, Jul 17, 2021 at 11:39:21AM +0300, Roman Skakun wrote: > > > We can merge this patch and create a new one for > > > xen_swiotlb_free_coherent() later. > > > Yeah, no

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-17 Thread Roman Skakun
. в 18:29, Stefano Stabellini : > > On Fri, 16 Jul 2021, Roman Skakun wrote: > > > Technically this looks good. But given that exposing a helper > > > that does either vmalloc_to_page or virt_to_page is one of the > > > never ending MM discussions I don't want to ge

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-16 Thread Roman Skakun
e applying this version? > > --- > From 40ac971eab89330d6153e7721e88acd2d98833f9 Mon Sep 17 00:00:00 2001 > From: Roman Skakun > Date: Fri, 16 Jul 2021 11:39:34 +0300 > Subject: dma-mapping: handle vmalloc addresses in > dma_common_{mmap,get_sgtable} > > xen-swiotlb can us

[PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-16 Thread Roman Skakun
From: Roman Skakun This commit is dedicated to fix incorrect conversion from cpu_addr to page address in cases when we get virtual address which allocated in the vmalloc range. As the result, virt_to_page() cannot convert this address properly and return incorrect page address. Need to detect

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-15 Thread Roman Skakun
> This looks like it wasn't picked up? Should it go in rc1? Hi, Konrad! This looks like an unambiguous bug, and should be in rc1. Cheers! ср, 14 июл. 2021 г. в 03:15, Konrad Rzeszutek Wilk : > > On Tue, Jun 22, 2021 at 04:34:14PM +0300, Roman Skakun wrote: > > This commit is d

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-15 Thread Roman Skakun
ode block in xen_swiotlb_free_coherent() need to make cpu_addr_to_page() as global and add a new declaration for this helper in include/linux/dma-map-ops.h. What do you think? Cheers! ср, 14 июл. 2021 г. в 04:23, Stefano Stabellini : > > On Tue, 22 Jun 2021, Roman Skakun wrote: > > This commit is dedic

[PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-06-22 Thread Roman Skakun
the page address using vmalloc_to_page() instead. Signed-off-by: Roman Skakun Reviewed-by: Andrii Anisov --- Hey! Thanks for suggestions, Christoph! I updated the patch according to your advice. But, I'm so surprised because nobody catches this problem in the common code before. It looks a bit

Re: [PATCH] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Roman Skakun
> We make sure that we allocate contiguous memory in > xen_swiotlb_alloc_coherent(). I understood. Thanks! -- Best Regards, Roman.

[PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Roman Skakun
there was added a new dma_cpu_addr_to_page() helper. Signed-off-by: Roman Skakun Reviewed-by: Andrii Anisov --- drivers/xen/swiotlb-xen.c | 42 +++ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index

[PATCH 1/2] Revert "swiotlb-xen: remove xen_swiotlb_dma_mmap and xen_swiotlb_dma_get_sgtable"

2021-06-16 Thread Roman Skakun
This reverts commit 922659ea771b3fd728149262c5ea15608fab9719. Signed-off-by: Roman Skakun --- drivers/xen/swiotlb-xen.c | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 2b385c1b4a99

Re: [PATCH] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-14 Thread Roman Skakun
, 11 июн. 2021 г. в 18:20, Boris Ostrovsky : > > > On 6/11/21 5:55 AM, Roman Skakun wrote: > > > > +static int > > +xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma, > > + void *cpu_addr, dma_addr_t dma_addr, size_t size, >

[PATCH] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-11 Thread Roman Skakun
incorrect page address. Need to detect such cases and obtains the page address using vmalloc_to_page() instead. The reference code was copied from kernel/dma/ops_helpers.c and modified to provide additional detections as described above. Signed-off-by: Roman Skakun Reviewed-by: Andrii Anisov

[PATCH v1] arm/optee: Use only least 32 bits for SMC type arg according to SMCCC

2021-01-06 Thread Roman Skakun
This patch added additional sanity and increases an understanding for getting proper value from the first argument for SMC call on aarch64 according to SMCC Convention. [0] ARM DEN0028B, page 12 Signed-off-by: Roman Skakun --- xen/arch/arm/tee/optee.c | 3 ++- 1 file changed, 2 insertions