Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4192992rdh; Tue, 28 Nov 2023 14:47:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAHAJ7r1CcVVJlBY6hIrxWwf1KCxuD/VLzrhCmpDYXrDP9N4Z00PDnyu4+YGrGucBzTQ4t X-Received: by 2002:a17:902:9882:b0:1cf:b14a:257e with SMTP id s2-20020a170902988200b001cfb14a257emr11950135plp.50.1701211642156; Tue, 28 Nov 2023 14:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701211642; cv=none; d=google.com; s=arc-20160816; b=UA2xVM90WQvXRRRDDCAEcNuf5OuUzw6yn8WRchBYH3T7II9uXqVcFd04A2dm+r0NJx U3rHqb14QatSM70thoIvAAKNkToLS5kz4g5t8seCS4SnxRl0ZqWmYHQzFkGb7UcX2b7W HCxMitGGsK/8U4TX30ER3OOf1JzzCznLwHAgxUUvWXHF0TgdmR8/KtqE/L/XhS3e7yyy Y+juX7y9y8rJMzftB1MElDqL9UYie2yBr79BUeyEwcEfpgCjhIVtmwf+0nYZHVT5oIaP lMsk/LTwjhOZP/m90raJQvdPldBS8BmJPNqSrZDrVGZx6FfVPjmVSMMnYEczCyh8a9XA HD/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=eTpQXSW2ryc7CXYUjXrPoyAieOOxmLQ1VwKzCDULe7M=; fh=JhH8qmlLmIRuoHxvxnNPs57gQG85foZWfXtCPHbVvj4=; b=KXyH22t1OhCbqpryV3Gc4Fk0UrIruKDF9Uq6/BHE3DT+3a1yflyarr5gtp5vMri88u ABxDYRRzIvxJEouDdEVFOLIwtPqyHMBcv3pvRST3G1+69D5ZidE26lmGprKSD4ufOZzh v713i06wMbXZ3P0KMdFC997HteXqqw34Nq68S1X7FmWcRx5V9/cXAnmdgsog1KwuRnvk BkCJSw1yoTS0pTt/e5UoNFQhMDd+CFD92bfg0NAp6TT6PgWqnfeDPbjJwUk62YYCIRzL HYzJlcq5HeCmP5AoB9kQBEMJHDT5Z1wBanE8rtQBrF53lE7Tm9IzAjhZRWGiYoIlDtvb tx7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id jg18-20020a17090326d200b001cfc4d3f32dsi6316271plb.477.2023.11.28.14.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 14:47:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9AA72804C1BC; Tue, 28 Nov 2023 14:47:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbjK1WrF (ORCPT + 99 others); Tue, 28 Nov 2023 17:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjK1WrE (ORCPT ); Tue, 28 Nov 2023 17:47:04 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5330819B0; Tue, 28 Nov 2023 14:47:09 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C1F11FB; Tue, 28 Nov 2023 14:47:56 -0800 (PST) Received: from [10.57.71.132] (unknown [10.57.71.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C40BF3F6C4; Tue, 28 Nov 2023 14:47:00 -0800 (PST) Message-ID: <8e1961c9-0359-4450-82d8-2b2fcb2c5557@arm.com> Date: Tue, 28 Nov 2023 22:46:59 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/16] iommu/io-pgtable-arm-v7s: use page allocation function provided by iommu-pages.h Content-Language: en-GB To: Pasha Tatashin , akpm@linux-foundation.org, alex.williamson@redhat.com, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jasowang@redhat.com, jernej.skrabec@gmail.com, jgg@ziepe.ca, jonathanh@nvidia.com, joro@8bytes.org, kevin.tian@intel.com, krzysztof.kozlowski@linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, mst@redhat.com, m.szyprowski@samsung.com, netdev@vger.kernel.org, paulmck@kernel.org, rdunlap@infradead.org, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, virtualization@lists.linux.dev, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> <20231128204938.1453583-6-pasha.tatashin@soleen.com> From: Robin Murphy In-Reply-To: <20231128204938.1453583-6-pasha.tatashin@soleen.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 14:47:19 -0800 (PST) On 2023-11-28 8:49 pm, Pasha Tatashin wrote: > Convert iommu/io-pgtable-arm-v7s.c to use the new page allocation functions > provided in iommu-pages.h. > > Signed-off-by: Pasha Tatashin > --- > drivers/iommu/io-pgtable-arm-v7s.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c > index 75f244a3e12d..3d494ca1f671 100644 > --- a/drivers/iommu/io-pgtable-arm-v7s.c > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > @@ -34,6 +34,7 @@ > #include > > #include > +#include "iommu-pages.h" > > /* Struct accessors */ > #define io_pgtable_to_data(x) \ > @@ -255,7 +256,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, > GFP_KERNEL : ARM_V7S_TABLE_GFP_DMA; > > if (lvl == 1) > - table = (void *)__get_free_pages(gfp_l1 | __GFP_ZERO, get_order(size)); > + table = iommu_alloc_pages(gfp_l1, get_order(size)); > else if (lvl == 2) > table = kmem_cache_zalloc(data->l2_tables, gfp); Is it really meaningful to account the L1 table which is always allocated upon initial creation, yet not the L2 tables which are allocated in use? Thanks, Robin. > @@ -283,6 +284,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, > } > if (lvl == 2) > kmemleak_ignore(table); > + > return table; > > out_unmap: > @@ -290,7 +292,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, > dma_unmap_single(dev, dma, size, DMA_TO_DEVICE); > out_free: > if (lvl == 1) > - free_pages((unsigned long)table, get_order(size)); > + iommu_free_pages(table, get_order(size)); > else > kmem_cache_free(data->l2_tables, table); > return NULL; > @@ -306,8 +308,9 @@ static void __arm_v7s_free_table(void *table, int lvl, > if (!cfg->coherent_walk) > dma_unmap_single(dev, __arm_v7s_dma_addr(table), size, > DMA_TO_DEVICE); > + > if (lvl == 1) > - free_pages((unsigned long)table, get_order(size)); > + iommu_free_pages(table, get_order(size)); > else > kmem_cache_free(data->l2_tables, table); > }