Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1817753pxf; Fri, 19 Mar 2021 17:25:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEgUC36TUuV/e5zTaFGa1KKmQAsKbgukD9AfRwkbtE60oQzNEt4lz1mlOqK1xLFhIpMEOo X-Received: by 2002:a17:906:1c41:: with SMTP id l1mr7219599ejg.299.1616199914849; Fri, 19 Mar 2021 17:25:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616199914; cv=none; d=google.com; s=arc-20160816; b=yIv/y5Ek/mWmsrV8Dpp8iaJU8GzbbhhJeVhZP1aIVMX4dHyS3x31kvG0X4Ed7ykvsU oBgiLnxs33dCw3nU0l6S6UnynN07WuSar2ZAnfnK18NALMWcFye6FMofTIbZ3nYpuemA v1XcZ2/b+vXVUuyiQbkTVS2+ccdcGF+Xp3c1wWSYtc3d1AjXPLXZo0KcnN7VXk7SeB03 GmgTdgKZqQItx7nxZpr2C3gxmE39nBrQJ1syZOryHzTqfpqjCe26TbIL3vtdlI+ek0YU KNyJLayIOQ08Ap5cIr5KF5XHxgLJ4Ooiqh5sp8eJPCM6S+j/pB1NUjPrSZlvkWlq9+L1 W3gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=EzdBFx+6yAGlq7wdheut564d1mEr/PTLDrEwN8xlfQI=; b=XKRdqFxF8aqplA35K972INiGckAnzgAe0tuphBDDqBg/RYpZel3BoaqJU05cU/HQ8l 5Cmkx7bpvm9uuSWbKY1axGzWzRgqUBH94e5KL8vFGRJ4dgFMUepSYJKVS8it6FY9XTIp /urmid3lU8cS2Zw81Oe7gkHNjhWQ5Z3ZgczgBoxlpRzd7/+SLSylrMHNuL3VLDve4Dox 7YF68eS05ObwtV8cQGbvFAG9dQ5c4ZsajEIjHSzJd4gLGdw0iEgAMDDBhA6IiafbgHWn sRSjmElRrlVLGs5SP2ysYYVLoBHSHDJev/Clp8qfcfdTmlZZ+5iLHWeJccUKc5MdgfvI 9/HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TI+APkqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si3207216ejq.139.2021.03.19.17.24.50; Fri, 19 Mar 2021 17:25:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TI+APkqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbhCTAWr (ORCPT + 99 others); Fri, 19 Mar 2021 20:22:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:53194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbhCTAWa (ORCPT ); Fri, 19 Mar 2021 20:22:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFCFE61982; Sat, 20 Mar 2021 00:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616199750; bh=yfhC9N4yx6xT3rJ9D4E/XRJxPV8sGJTgzQeYH+mdemI=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=TI+APkqWcQfgwonCim+iFmS8c7zEVsrTV2NeAO10POk0eFNuHfwTZ3PS6oUiPfrDE dR2bOmbF0/WMJw33/HII0nnoGcMewvvTYXsp+8aiSY4T3UuM62Jdwyj2hN+X5TFTJ7 0FQv0joGMfB56GV8oao8C42zcWOH8+vO3O3dTf9UpM3/bCHi0kiIe6POaRi2Q66nHp hq8n0luM/DiBzMDpdUNsctNmuZHsS97tTwI0jL/an8H/fe4rQmhhn2pBxog4NCQnxt Izik/bGIY4VCG20TbjzJ5z9y34gH3OzZ7UjcoXn6lDksBIGlRWAyXj//jBbnwRb52t 8bDOtP4ZxWtEQ== Date: Fri, 19 Mar 2021 17:22:28 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Konrad Rzeszutek Wilk cc: Christoph Hellwig , xen-devel@lists.xensource.com, sstabellini@kernel.org, Florian Fainelli , linux-arm-kernel@lists.infradead.org, Marek Szyprowski , Robin Murphy , "open list:SWIOTLB SUBSYSTEM" , open list , Russell King , Mike Rapoport , Andrew Morton , Ard Biesheuvel , Max Filippov , Catalin Marinas , opendmb@gmail.com Subject: Re: [PATCH] ARM: Qualify enabling of swiotlb_init() In-Reply-To: <20210319195929.GA1346384@konrad-char-us-oracle-com.allregionaliads.osdevelopmeniad.oraclevcn.com> Message-ID: References: <20210319040333.183827-1-f.fainelli@gmail.com> <20210319130731.GB2624@lst.de> <20210319195929.GA1346384@konrad-char-us-oracle-com.allregionaliads.osdevelopmeniad.oraclevcn.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Mar 2021, Konrad Rzeszutek Wilk wrote: > On Fri, Mar 19, 2021 at 02:07:31PM +0100, Christoph Hellwig wrote: > > On Thu, Mar 18, 2021 at 09:03:33PM -0700, Florian Fainelli wrote: > > > #ifdef CONFIG_ARM_LPAE > > > + if (swiotlb_force == SWIOTLB_FORCE || > > > + max_pfn > arm_dma_pfn_limit) > > > > Does arm_dma_pfn_limit do the right thing even with the weirdest > > remapping ranges? Maybe a commen here would be useful. > > > > > + swiotlb_init(1); > > > + else > > > + swiotlb_force = SWIOTLB_NO_FORCE; > > > > Konrad: what do you think of setting swiotlb_force to SWIOTLB_NO_FORCE > > and only switching it to SWIOTLB_NORMAL when swiotlb_init* is called? > > That kind makes more sense than forcing the callers to do it. > > > > While we're at it, I think swiotlb_force should probably be renamed to > > swiotlb_mode or somethng like that. > > swiotlb_mode sounds good. > > Also it got me thinking - ARM on Xen at some point was a bit strange, so not sure how > the logic works here, Stefano? There is nothing strange in regards to swiotlb_force. swiotlb_force is only used in swiotlb-xen map_page to figure out whether: - we actually have to use the swiotlb bounce buffer (this is the swiotlb_xen == SWIOTLB_FORCE case) - or we can use the provided page directly for dma if other conditions are met (dma_capable, !range_straddles_page_boundary, ...) I don't think that switching to "swiotlb_mode" would cause any issues.