xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, boris.ostrovsky@oracle.com,
	jgross@suse.com, hch@lst.de, catalin.marinas@arm.com,
	will@kernel.org, linux-arm-kernel@lists.infradead.org,
	Stefano Stabellini <stefano.stabellini@xilinx.com>
Subject: [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
Date: Wed, 12 May 2021 13:18:22 -0700	[thread overview]
Message-ID: <20210512201823.1963-2-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2105121313060.5018@sstabellini-ThinkPad-T480s>

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))
-	else
+	else if (!xen_swiotlb_detect())
 		swiotlb_force = SWIOTLB_NO_FORCE;
 	set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);

  parent reply	other threads:[~2021-05-12 20:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 20:18 [PATCH v2 0/3] swiotlb-xen init fixes Stefano Stabellini
2021-05-12 20:18 ` [PATCH v2 1/3] xen/arm: move xen_swiotlb_detect to arm/swiotlb-xen.h Stefano Stabellini
2021-05-13  6:10   ` Christoph Hellwig
2021-05-14  9:59   ` Juergen Gross
2021-05-12 20:18 ` Stefano Stabellini [this message]
2021-05-14 10:00   ` [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required Juergen Gross
2021-05-14 10:29   ` Catalin Marinas
2021-05-12 20:18 ` [PATCH v2 3/3] xen/swiotlb: check if the swiotlb has already been initialized Stefano Stabellini
2021-05-13  6:11   ` Christoph Hellwig
2021-05-14 13:56 ` [PATCH v2 0/3] swiotlb-xen init fixes Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210512201823.1963-2-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=catalin.marinas@arm.com \
    --cc=hch@lst.de \
    --cc=jgross@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=will@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH v2 2/3] arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).