From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E03A323F360 for ; Wed, 12 Mar 2025 11:43:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741779797; cv=none; b=YMgUnunPrsb1sScyQjvBx5DtC+m5EotH0P+B2ZRMzyysDI0jgc6UVCuqwKtNph5iV5U6XMO+Z8XIYTksLyxLGkbywIiI11LYNL9T+ZNG4kbjckuqlcrDvhUI618MuhiDhXhgPzn346Lv5jKpcthEcilOK75F5+ykeOEvgDrMP7A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741779797; c=relaxed/simple; bh=+MNq83J0FvOykak8Ryzy9D5d1zvEqohQjMDrlpBZzM8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NDQSiCc4HdRLpHDinaQNu0tFXJY9d5xwAMtq69qEZZ/hsAUTrGQqio0bN2CzwQ+5t8qbxlgWuk47/TJc6XWDcy19fBWxuLRD5nD51sexVHcpBBpVPMJ1XXfy1qK6BO6Vdd2TczdsAFkZ7CiwwVnVX0pD/o0B4Kad/l/yGcQPVd0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TQwsur7W; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TQwsur7W" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-438d9c391fcso40665e9.0 for ; Wed, 12 Mar 2025 04:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1741779792; x=1742384592; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/DRboL7iXAangnAe10zAw/fnPXaxzgNmenGuCjK+wlo=; b=TQwsur7WIWsaXm7xoXHv5M4pWGeWjtVFeUCw3pMgJmvpY2uEwsqrKu9MlUWPCvvVes EoG6ZZvOv/U64KxdJFR2YdsryahOngIB1IXpBwmAUPqqLDBaYiY4XaPQVOI0J2N4Xkht e+726J0x93FTY5D+DQLGyMpBwOieXNwrzJmtb43Vd7WC7cf9zfay+0ehbijJyfwk866K 4StwIyDqyAGJgeOMceHizy6FA948tBlZqZIYBYHA/dflC1DdwrbkocOpu1M+RXHEhHJE AByk6GooIrf0o4+vTQheEBvZvHJoTUU+zba6kyoqwdX3I2tk0edYJiU0Wx1cjHrVMMZU /VuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741779792; x=1742384592; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/DRboL7iXAangnAe10zAw/fnPXaxzgNmenGuCjK+wlo=; b=UXxF1LKQbdlwyzyn2XeDQz1yhj8LbyD9cyufiBfn+CJFlGvIpcrIqElCdKoPmk2VPH ZFv0sJBpOyOb3b/hHjrHMmnGpiEhg5G7JTHeY1f2emxdzn8cHvT5k4V90by/AEZ4IUNP Cdkt5RPGNnWpfvK5mI186033dYRp0Guk63I+JOS9VwxeuntV63CqWJmzPKlSfIZPifEn keuWfa1zwasSs5niPXXLCq0C0KaV56P+xhuk2lRJLymNvbsR88JphHR/lsVnXWfcf2wv HfuufHCjItwxOgTCZK1IhQhD5ZOG6Xvzct4nFCX535zlL3qmu/+FakW26jHpOSDOwC+8 50wg== X-Forwarded-Encrypted: i=1; AJvYcCW4mThj0QTW0fDv38FxEh5VlX3D2UNzjTVI6nj9/ewg9mmeSWnwLoQJd/Z1xMsLOvQodDnQ3w==@lists.linux.dev X-Gm-Message-State: AOJu0YzKlWRoh82vhkUCQTqVpRK2w3NJwg5uaVPmeCTui1DspnU3SzmD VbMp9TK9Z8x7KbG3pbS++F5HN84rzov2r2vvUOueApcl8DlLk5h5MWgFqyWBzA== X-Gm-Gg: ASbGncu/RLQcuhtUhMdRnHhCydj6Lvp1ijEIJ+3gDZWSZHH1aqMZkdfF++h+3ZHXFV/ 72YeDAH8pEQW77imkkLJEdRn3xRPBOmpxUr8zdfUPxI5TQInMZL1tz5D1nBPuoq2BQZPoWFEwNO bktOqAXpbDkI18ogBFSPxza0FLwVQFNU5yvOgFspQLMkz1dL1GzeZ5PkGOndBgEy7c6pZb5PiLM 7S1w4CmwXq7TbhAI6Jx86W+Vdd2helIy+ngkQmqIE/SrJg2LUkkU9PcqdUW579QSpErr4GRzd3D 1iVhpnYreMYI+hG4S8oKHS3bkOhZQAxydF8qcdfRttsy6DVhjXZ5uSMq/buM7qaHmKwb2EJ1GKY iZnJ4 X-Google-Smtp-Source: AGHT+IGAlRZ9FGEpVbzn9/E/l/2Ksb4Pgfv6rI6D7I3wU6Ogl1uoOZwLKHkEYMZpOjmtLPXmOnf3OA== X-Received: by 2002:a7b:c8d1:0:b0:439:8d84:32ff with SMTP id 5b1f17b1804b1-43d0a5e40ccmr994365e9.3.1741779792013; Wed, 12 Mar 2025 04:43:12 -0700 (PDT) Received: from google.com (88.140.78.34.bc.googleusercontent.com. [34.78.140.88]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d0a72ea88sm18970735e9.7.2025.03.12.04.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 04:43:11 -0700 (PDT) Date: Wed, 12 Mar 2025 11:43:07 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Alim Akhtar , Alyssa Rosenzweig , Albert Ou , asahi@lists.linux.dev, Lu Baolu , David Woodhouse , Heiko Stuebner , iommu@lists.linux.dev, Jernej Skrabec , Jonathan Hunter , Joerg Roedel , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, Marek Szyprowski , Hector Martin , Palmer Dabbelt , Paul Walmsley , Robin Murphy , Samuel Holland , Suravee Suthikulpanit , Sven Peter , Thierry Reding , Tomasz Jeznach , Krishna Reddy , Chen-Yu Tsai , Will Deacon , Bagas Sanjaya , Joerg Roedel , Pasha Tatashin , patches@lists.linux.dev, David Rientjes , Matthew Wilcox Subject: Re: [PATCH v3 03/23] iommu/pages: Remove __iommu_alloc_pages()/__iommu_free_pages() Message-ID: References: <0-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> <3-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> On Tue, Feb 25, 2025 at 03:39:20PM -0400, Jason Gunthorpe wrote: > These were only used by tegra-smmu and leaked the struct page out of the > API. Delete them since tega-smmu has been converted to the other APIs. > > In the process flatten the call tree so we have fewer one line functions > calling other one line functions.. iommu_alloc_pages_node() is the real > allocator and everything else can just call it directly. > > Signed-off-by: Jason Gunthorpe Reviewed-by: Mostafa Saleh > --- > drivers/iommu/iommu-pages.h | 49 ++++++------------------------------- > 1 file changed, 7 insertions(+), 42 deletions(-) > > diff --git a/drivers/iommu/iommu-pages.h b/drivers/iommu/iommu-pages.h > index 82ebf00330811c..0ca2437989a0e1 100644 > --- a/drivers/iommu/iommu-pages.h > +++ b/drivers/iommu/iommu-pages.h > @@ -46,40 +46,6 @@ static inline void __iommu_free_account(struct page *page, int order) > mod_lruvec_page_state(page, NR_SECONDARY_PAGETABLE, -pgcnt); > } > > -/** > - * __iommu_alloc_pages - allocate a zeroed page of a given order. > - * @gfp: buddy allocator flags > - * @order: page order > - * > - * returns the head struct page of the allocated page. > - */ > -static inline struct page *__iommu_alloc_pages(gfp_t gfp, int order) > -{ > - struct page *page; > - > - page = alloc_pages(gfp | __GFP_ZERO, order); > - if (unlikely(!page)) > - return NULL; > - > - __iommu_alloc_account(page, order); > - > - return page; > -} > - > -/** > - * __iommu_free_pages - free page of a given order > - * @page: head struct page of the page > - * @order: page order > - */ > -static inline void __iommu_free_pages(struct page *page, int order) > -{ > - if (!page) > - return; > - > - __iommu_free_account(page, order); > - __free_pages(page, order); > -} > - > /** > * iommu_alloc_pages_node - allocate a zeroed page of a given order from > * specific NUMA node. > @@ -110,12 +76,7 @@ static inline void *iommu_alloc_pages_node(int nid, gfp_t gfp, int order) > */ > static inline void *iommu_alloc_pages(gfp_t gfp, int order) > { > - struct page *page = __iommu_alloc_pages(gfp, order); > - > - if (unlikely(!page)) > - return NULL; > - > - return page_address(page); > + return iommu_alloc_pages_node(numa_node_id(), gfp, order); > } > > /** > @@ -138,7 +99,7 @@ static inline void *iommu_alloc_page_node(int nid, gfp_t gfp) > */ > static inline void *iommu_alloc_page(gfp_t gfp) > { > - return iommu_alloc_pages(gfp, 0); > + return iommu_alloc_pages_node(numa_node_id(), gfp, 0); > } > > /** > @@ -148,10 +109,14 @@ static inline void *iommu_alloc_page(gfp_t gfp) > */ > static inline void iommu_free_pages(void *virt, int order) > { > + struct page *page; > + > if (!virt) > return; > > - __iommu_free_pages(virt_to_page(virt), order); > + page = virt_to_page(virt); > + __iommu_free_account(page, order); > + __free_pages(page, order); > } > > /** > -- > 2.43.0 >