From patchwork Wed May 12 20:18:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 12254627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C9AEC433ED for ; Wed, 12 May 2021 20:21:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA56160E09 for ; Wed, 12 May 2021 20:21:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA56160E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2syE+fyhrCtNNCNz1anuUXShLmBwVu2vP3yYfqsBJd8=; b=PDZOMvnxeu+yxVgMLsfSerecxR s2wmh/yXqTnhOKPSrdQlr2KtX6U5ob8bID07wytbsbHv+1vEEpMtl6f2SMJemzDkPqif/e0W5mSqP sGIwCCVWiDnKDO56oLS3LvoL6cN+5GTWN0057/JwfHa9Ycfm/7bRMeP9cKeRGIhqOMTW7mjOVxA7K Pl0ArV/f77RyexjA+85NW1jwydc68FpvXLLGrj1RXVAxtx5G+FIRJotyUgbU4ddh0EoIY1YRnOcq1 ZffWTNUfkqyGQvWMpyoYhdEEfRCCOK24s1bXUibjowUSRMwVY6T7BTXfDdK7R9SlnSJOyTLltKeVn 5LrXbATQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgvK1-003uHh-DZ; Wed, 12 May 2021 20:19:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgvJP-003u8L-LA for linux-arm-kernel@desiato.infradead.org; Wed, 12 May 2021 20:18:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GS4VpO1/fkjmGpSI9nTGZE/tAhz4lG4ulA39ei9EZhQ=; b=KJP4sEFK4NUITxSVJE8NPlj11P q6qsTDPzoPVduO9LH9ASc4+Sppv3x5n9WY3ACtzjAsQPd7VUvd8waNXOLQ0UiG6ztmRGczHCrU7jl y8EB1cMTY2y3a9M/2QX2VUfjVQPhgB+QQZFx4+dhVZrwQbJXwVjBoHDkgCjFtsAX6PPz8TbvrAWfp mxCDGDHMXgOuEYgrHDBK1t3m2WpVlfzpfAZxBi+7yzrBoITq8R2Q4a7415rDTSF5ZJnTt+GGthzDO HgF0KEcDyyoUZBeLoWuyoT8P4YtuaEVRfZgTwPmovZCJ3pkrBSqt1AFg+EEGbhaicWe9aYsxL9CQZ ovszCdSw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgvJM-00AnU2-VR for linux-arm-kernel@lists.infradead.org; Wed, 12 May 2021 20:18:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6BFC61421; Wed, 12 May 2021 20:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620850708; bh=ikG741femM1u5L3PYlYRG1oNEZycqnQin0LDEK63UdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RShGZVhkT1+Cv9URRAR9hvRdm2lnVpZ/vDKhwwndQErexmq58V6abEelgnec4DX+x Iq/powaDhH+V5WHSLB3ryZogB1b2sgnkPU7EiP0/MRRG/nwzIzV/Q5Srxs0gqbB+cH 14MZp+GtgTMFCs0Ih8T5Uvn9iByb8FozTPHOAcZHiN5n9RknvNAxd+0RQUcHqLXTeM jofPjb49sy0g5sdVuYrjnmuG6NNqjf0n9H6kCmi+4WL9vnyH3UOIud8DubTi7dXVH/ FrXkN9yBf13D6H+TzEtt8Qy8V5lcj65NtVqeobNFzPY2KnlgJ0bWtvyv2fiu58p57T I20jFea37G0/w== From: Stefano Stabellini 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 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 Message-Id: <20210512201823.1963-2-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210512_131829_068984_CAA163CC X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Christoph Hellwig 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 Signed-off-by: Stefano Stabellini Reviewed-by: Juergen Gross Acked-by: Catalin Marinas --- 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 #include #include +#include /* * 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);