linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
       [not found] <alpine.DEB.2.21.2105121313060.5018@sstabellini-ThinkPad-T480s>
@ 2021-05-12 20:18 ` Stefano Stabellini
  2021-05-14 10:00   ` Juergen Gross
  2021-05-14 10:29   ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Stefano Stabellini @ 2021-05-12 20:18 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, boris.ostrovsky, jgross, hch, catalin.marinas, will,
	linux-arm-kernel, Stefano Stabellini

From: Christoph Hellwig <hch@lst.de>

Although SWIOTLB_NO_FORCE is meant to allow later calls to swiotlb_init,
today dma_direct_map_page returns error if SWIOTLB_NO_FORCE.

For now, without a larger overhaul of SWIOTLB_NO_FORCE, the best we can
do is to avoid setting SWIOTLB_NO_FORCE in mem_init when we know that it
is going to be required later (e.g. Xen requires it).

CC: boris.ostrovsky@oracle.com
CC: jgross@suse.com
CC: catalin.marinas@arm.com
CC: will@kernel.org
CC: linux-arm-kernel@lists.infradead.org
Fixes: 2726bf3ff252 ("swiotlb: Make SWIOTLB_NO_FORCE perform no allocation")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>

---
Changes in v2:
- patch split
---
 arch/arm64/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 16a2b2b1c54d..e55409caaee3 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -43,6 +43,7 @@
 #include <linux/sizes.h>
 #include <asm/tlb.h>
 #include <asm/alternative.h>
+#include <asm/xen/swiotlb-xen.h>
 
 /*
  * We need to be able to catch inadvertent references to memstart_addr
@@ -482,7 +483,7 @@ void __init mem_init(void)
 	if (swiotlb_force == SWIOTLB_FORCE ||
 	    max_pfn > PFN_DOWN(arm64_dma_phys_limit))
 		swiotlb_init(1);
-	else
+	else if (!xen_swiotlb_detect())
 		swiotlb_force = SWIOTLB_NO_FORCE;
 
 	set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
  2021-05-12 20:18 ` [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required Stefano Stabellini
@ 2021-05-14 10:00   ` Juergen Gross
  2021-05-14 10:29   ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2021-05-14 10:00 UTC (permalink / raw)
  To: Stefano Stabellini, xen-devel
  Cc: boris.ostrovsky, hch, catalin.marinas, will, linux-arm-kernel,
	Stefano Stabellini


[-- Attachment #1.1.1.1: Type: text/plain, Size: 860 bytes --]

On 12.05.21 22:18, Stefano Stabellini wrote:
> From: Christoph Hellwig <hch@lst.de>
> 
> Although SWIOTLB_NO_FORCE is meant to allow later calls to swiotlb_init,
> today dma_direct_map_page returns error if SWIOTLB_NO_FORCE.
> 
> For now, without a larger overhaul of SWIOTLB_NO_FORCE, the best we can
> do is to avoid setting SWIOTLB_NO_FORCE in mem_init when we know that it
> is going to be required later (e.g. Xen requires it).
> 
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> CC: catalin.marinas@arm.com
> CC: will@kernel.org
> CC: linux-arm-kernel@lists.infradead.org
> Fixes: 2726bf3ff252 ("swiotlb: Make SWIOTLB_NO_FORCE perform no allocation")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.1.2: OpenPGP_0xB0DE9DD628BF132F.asc --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
  2021-05-12 20:18 ` [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required Stefano Stabellini
  2021-05-14 10:00   ` Juergen Gross
@ 2021-05-14 10:29   ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2021-05-14 10:29 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: xen-devel, boris.ostrovsky, jgross, hch, will, linux-arm-kernel,
	Stefano Stabellini

On Wed, May 12, 2021 at 01:18:22PM -0700, Stefano Stabellini wrote:
> From: Christoph Hellwig <hch@lst.de>
> 
> Although SWIOTLB_NO_FORCE is meant to allow later calls to swiotlb_init,
> today dma_direct_map_page returns error if SWIOTLB_NO_FORCE.
> 
> For now, without a larger overhaul of SWIOTLB_NO_FORCE, the best we can
> do is to avoid setting SWIOTLB_NO_FORCE in mem_init when we know that it
> is going to be required later (e.g. Xen requires it).
> 
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> CC: catalin.marinas@arm.com
> CC: will@kernel.org
> CC: linux-arm-kernel@lists.infradead.org
> Fixes: 2726bf3ff252 ("swiotlb: Make SWIOTLB_NO_FORCE perform no allocation")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-05-14 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <alpine.DEB.2.21.2105121313060.5018@sstabellini-ThinkPad-T480s>
2021-05-12 20:18 ` [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required Stefano Stabellini
2021-05-14 10:00   ` Juergen Gross
2021-05-14 10:29   ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).