Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3825563pxf; Mon, 29 Mar 2021 12:32:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh6ERy2STDo7PuhcyZ8UXavg2IzTbZk1W07k+/yFuX6mlPPtiTst5maLWdLVWtgiQ470W8 X-Received: by 2002:a17:907:248b:: with SMTP id zg11mr29509913ejb.364.1617046375435; Mon, 29 Mar 2021 12:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617046375; cv=none; d=google.com; s=arc-20160816; b=RrhjsbxtoqP+S/RcpO6tnxef4BsWA7KIrthOCmZzj2jGkgmrhxAxFainhREREJK2QU 2UpqergDbani9mc3dofU5N5XzPy7/XhEN5tKIUt/d+G8q2Z3DlIC7t5b0a+rYb6HD43C ONCCFKZZAYokSdMhtRdTB3a+jWu2C0Gi4Q4S0lfF2oM30Ku/87OvFbTGHLW7FjU9qG7A 4ozq0cOaJV8WLK4kNtdjZRwVbsGcGaTNf+bCiLiZ+GRm455Q7GivHj9DDKkPbOBv5YAj fMd2n5ksb/NTvuKiTK1eFnKZvJ+cCNmRqMqH8u8FVJWQluSGIUWezSIMgdevqQmVvP2n BEOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=obZ+GpJjqBDtqxvYFyMbZyPSIXXyagLFH5qtJ8HsExQ=; b=y5JNinbcumgbGW2RiImUSiwLNx96PxS8CkSWZ2yBmwXhF8C2ydpUsnh2ocFR+xn6ES USFw+Ifzs8KiaHzQ42B0IzYPskPp2qloPrLGzGWpBqffvOpSUoJmM5keoTQZImXNBP7t ZhSzknIDkueFHgE890pcPSz6/rtIVjcQ9QhZzAXL29z+48sDWcIUMZPH87H7oZNt+0OR WXj7vz42kKDqMK+HLuJzKXGWfWJTxSNRCXjrmZ0xyBWvAeUA1XrJPvjWN+Nn7TubiWPJ evt6YBan4Xvg9jNspfwU6Oxz2t/ENS926bchqxo+wu6cIQdePfsLjvSVANRvoF/pEImZ MEMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HHhQPWAK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si13138335ejj.661.2021.03.29.12.32.33; Mon, 29 Mar 2021 12:32:55 -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=@gmail.com header.s=20161025 header.b=HHhQPWAK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231682AbhC2TbH (ORCPT + 99 others); Mon, 29 Mar 2021 15:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbhC2Tas (ORCPT ); Mon, 29 Mar 2021 15:30:48 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3787C061574 for ; Mon, 29 Mar 2021 12:30:48 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id e14so4899159plj.2 for ; Mon, 29 Mar 2021 12:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=obZ+GpJjqBDtqxvYFyMbZyPSIXXyagLFH5qtJ8HsExQ=; b=HHhQPWAK96gQvI6JJPOnIFVc/FznBCpCUgJanyhV1/94rYU1ByXo2ua2XSsY0qQgmp KIaZTSyo5SuA6seJ5a/O7TcMaCc8Ha00PbefwymFFN6Bh4SozydEAVhqPLhRmlGm00ka lScMH+FJN19u14o2jaisyvXsm3zBEVeZY+xULE8uu7a5h6oH+HAG77+RU3KPPteH9R6B WYiKhCcxB/ecADLL2AoxhTy/NQbZ1fI6E7lpLVdSZ9SlfLS0OYYmiVb21b6R9Bvt3FBZ 41HDs14NdrUmwSNuMRWHhJisDMdHRjsyzIaX26cb0dW7YCSZj0e5a/nwIBZO9C/Xvcjp DOkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=obZ+GpJjqBDtqxvYFyMbZyPSIXXyagLFH5qtJ8HsExQ=; b=SvahDJZeZmqos8Ab1ilm/o8AxkkY2PRgXEzT62NxIHeXc9BcBrP2JAfZjEVcDCTRr+ J9+QoAfPS7/L8X291UM8WNyYPFXJTBMiVbDWuJydwo5A4c3e1mTSPnX+iBLZ2TuCd/CT QE+kU+C6+72hw9hRvBO90oWUcAWqxqdXio6eBKs5NFr3EXxTR3mg8/KqGj+bilI4KExm P8qqci3JpeBq5UVP1H6IHzRsBYU0hCKYqHsX0BOVnJaUnnRpWAzJwFYsyRP+YX8+FHHu 8nudM1KG5JttbyxxOrRRdurRVd3U/BhrWf5JRH6BZwhFpILGdFS0sU9wg5amgUB8/WJa jx9g== X-Gm-Message-State: AOAM530d332JGiewfMrMStFCTE3hsoiqXfr3NJ55r5UmIQ+7awOnkIQn xBGtNuXL/g/bmUh7QKo4RRF3OV3VeWI= X-Received: by 2002:a17:90b:10a:: with SMTP id p10mr668776pjz.148.1617046248127; Mon, 29 Mar 2021 12:30:48 -0700 (PDT) Received: from [10.67.49.104] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id t19sm18375620pfg.38.2021.03.29.12.30.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Mar 2021 12:30:47 -0700 (PDT) Subject: Re: [PATCH] ARM: Qualify enabling of swiotlb_init() To: Stefano Stabellini , Konrad Rzeszutek Wilk Cc: Christoph Hellwig , xen-devel@lists.xensource.com, 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 References: <20210319040333.183827-1-f.fainelli@gmail.com> <20210319130731.GB2624@lst.de> <20210319195929.GA1346384@konrad-char-us-oracle-com.allregionaliads.osdevelopmeniad.oraclevcn.com> From: Florian Fainelli Message-ID: <3db926f4-6047-cc62-8654-a965b8570e75@gmail.com> Date: Mon, 29 Mar 2021 12:30:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/19/21 5:22 PM, Stefano Stabellini wrote: > 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. > Should I toss this in Russell's patch tracker or do you need me to make some changes to the patch? -- Florian