Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4160461ybg; Mon, 8 Jun 2020 00:06:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOJMBQUoUklmfjVH8rxKzvzKmg/wAG97T2LliJBCVBRliLj0e4zz8Sf/5Rz9DbkWgWkbI8 X-Received: by 2002:a17:906:bcf3:: with SMTP id op19mr19214723ejb.208.1591599988780; Mon, 08 Jun 2020 00:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591599988; cv=none; d=google.com; s=arc-20160816; b=AoyibXpkPd45pUB0hBQRXr3kNgwS3G1qzSMauPSDbqycXKEHikNlxEDG3L5ufUszdO iVznzaY31v8xpuwNmsI0XJQBR+v4Yog4xkK3x3Qss1TzoKtZlncudKpaGnlW6b0vCO6a cSWwuA18Nx3sZbUA2LJFiqwzflF8DzArRyZuHzYBFucJswgD+sTZ58me4WzxCF4CS2u0 g7xCgxE1MuwTRcUDHUWwH+PYmhIQGIicxnz40Fkc5F1eQqBJDw8jziMCr0j76Tn2PGt4 7V/WdvV25b+TBSK9YX5w9uYv0BhU44ZZUp+ybu56GbaEt+Fkdjb5BbI1t7E6TzuX3lh/ OyMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kOgcUHX0zNsLgrzKIZZVZ5HbxzYUV6u6MWDbb+56ot4=; b=Y34vBAlFXwMJGjnbmIEcT1XlEkL8bOw2nKrEOfD0ah01BU02ICbkWHoQjJquz7yhZ6 k859XFi5NLOSCuHTaf1iM4XhkNfhIeamQcwc65lLYC6SYXCrvoZpw2sD12f4VsJ2bevH XiMDVuyADv8KAJt/4GWYYj0slmJsiCh+kWPG9ie3sEt352KIpOF2wvTepf/J3yzx2lpK q5g7tgO0UZWOSE8WPSk3qA4f5w19/5k7+7KjEPWcIn+fGWFPdyhuyimPV6W4fAi3LuMx SNc4plWdVxxPHxQW6/BjeOsmZ6ZPIN9wVqIorGxlQAdTj4BsHRtqeiJMfxcyi9Kem6XP zD+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="K6P/0nS7"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si4815942ejx.174.2020.06.08.00.06.04; Mon, 08 Jun 2020 00:06:28 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="K6P/0nS7"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728906AbgFHHEU (ORCPT + 99 others); Mon, 8 Jun 2020 03:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbgFHHET (ORCPT ); Mon, 8 Jun 2020 03:04:19 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93DE9C08C5C3 for ; Mon, 8 Jun 2020 00:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=kOgcUHX0zNsLgrzKIZZVZ5HbxzYUV6u6MWDbb+56ot4=; b=K6P/0nS7ZwAPQ6b6LI1ZuIGzyy ZsIOCpn8sIKiwGcRm/viCmJMlJo1qAUGgZGwQiu6PxEL0xZYhDh1APKzKZmtiFiyds86D/Jy++Q2J obCYjtQP8fFufQa0NW/FUBuBr3eplMnoM1YyDMB+VqppJJ1pxfKZDFUc9V0Ma4EfL2d64Ok5cSzLv ymfhxvD2A20eHhIay4/PnULLqqE3bh19DaICVqjssKuxl4nIN0T2TBnA9p+u+TRd1jQoNtzOmbmOD o2F1k1ZEvu/MlL9t7pjju9m0J/YJoZBe5fIonIAs2eTO+qHFoWilwSzMI/oWm6SCU77ywPLyTbth7 +jNXKQNg==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiBpL-0000kv-Rr; Mon, 08 Jun 2020 07:04:11 +0000 Date: Mon, 8 Jun 2020 00:04:11 -0700 From: Christoph Hellwig To: Stefano Stabellini Cc: jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, tamas@tklengyel.com, roman@zededa.com, Stefano Stabellini Subject: Re: [PATCH v2 01/11] swiotlb-xen: use vmalloc_to_page on vmalloc virt addresses Message-ID: <20200608070411.GA15742@infradead.org> References: <20200603222247.11681-1-sstabellini@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200603222247.11681-1-sstabellini@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Well, this isn't just RPi4, but basically any ARM or ARM64 system with non-coherent DMA (which is most of them). > + struct page *pg; Please spell out page. > > if (hwdev && hwdev->coherent_dma_mask) > dma_mask = hwdev->coherent_dma_mask; > @@ -346,9 +347,11 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, > /* Convert the size to actually allocated. */ > size = 1UL << (order + XEN_PAGE_SHIFT); > > + pg = is_vmalloc_addr(vaddr) ? vmalloc_to_page(vaddr) : > + virt_to_page(vaddr); Please use plain old if/else to make this more readable.