From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 410B741A57E; Thu, 6 Aug 2026 08:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005608; cv=none; b=RKDCs71mHJWAa1bE38MFxWnbrcHqB/dJGml+0HzM/x6nfNUz6RCC/TaRPAwgkBOKdiQOV7syI5DyiK9ZMVA/6dujD3Q2Lov0RBAmmQJCk8IwicoKXA1yjTkJMENas66erJ3vtPy++ARDg6PTSHDMNu1hHPYMlhwBZ6GtUX4xsZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005608; c=relaxed/simple; bh=iynuOAJCPNuRyHhHF6oGom9ZpKtzcvQOC1dJwzRcJvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EKPdBo/ACTibSumJLLtaGLDKk+dPXGuu6s+fYXCUlRPvDjd0xIJZcZ5wiOTaOwYLOWld/61hoj1lqiDTW2jn1ZrIOdGga5Z0cQe7We0W8Nin0Y70egH0cyR9Dz38TJoYK7AcAqdP5UVsosSTD8So8PwpFyrVbnhQgF4DfaCuGlE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=PZG9EdTY; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="PZG9EdTY" 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 8F349176C; Thu, 6 Aug 2026 01:39:57 -0700 (PDT) Received: from e142334-100.cambridge.arm.com (e142334-100.cambridge.arm.com [10.2.198.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D66C63F632; Thu, 6 Aug 2026 01:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1786005601; bh=iynuOAJCPNuRyHhHF6oGom9ZpKtzcvQOC1dJwzRcJvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZG9EdTY1k5yypy3196H+wqk2/KNoPtVM/b9UYaFI6ZI3d24qfuLCJzRICQkyCkLc sFKziULNcmx7SYfTqR1bq57rbn7/KNqG7/Xk/gSlWU94DTBYVqXEPKUndhrDA8EsJE 22M3TfK+4A1Hh9u1/kuRYdSEUGb4ZkLFgLd50Kg4= From: Muhammad Usama Anjum To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Dimitri Sivanich , Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , Juergen Gross , Stefano Stabellini , Muchun Song , Oscar Salvador , Andrew Morton , "Liam R. Howlett" , Lorenzo Stoakes , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Andrey Ryabinin , David Hildenbrand , Pasha Tatashin , Chris Li , Kairui Song , Uladzislau Rezki , Steven Rostedt , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , SJ Park , "Matthew Wilcox (Oracle)" , Jan Kara , Jason Gunthorpe , Leon Romanovsky , Miaohe Lin , Dennis Zhou , Tejun Heo , Christoph Lameter , Mike Rapoport , Johannes Weiner , ziy@nvidia.com, pfalcato@suse.de, agordeev@linux.ibm.com, ryan.roberts@arm.com Cc: Muhammad Usama Anjum , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, kasan-dev@googlegroups.com, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, damon@lists.linux.dev Subject: [PATCH 1/9] mm: introduce hw_pte_t for PTE table storage Date: Thu, 6 Aug 2026 09:38:39 +0100 Message-ID: <20260806083926.1807279-2-usama.anjum@arm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806083926.1807279-1-usama.anjum@arm.com> References: <20260806083926.1807279-1-usama.anjum@arm.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit pte_t is used both for logical PTE values and for entries stored in a PTE table, so pte_t * does not distinguish a pointer to a copied value from a pointer to table storage. Introduce hw_pte_t as the generic name for a PTE table element. Define it as a macro alias of pte_t by default. When an architecture selects ARCH_HAS_HW_PTE_T, define it as a structure containing a pte_t instead. This preserves the representation while allowing converted architectures to enforce the distinction at compile time. Keep the C type definitions behind an __ASSEMBLY__ check because architecture assembly sources can include this header indirectly. Include asm/page.h so consumers such as linux/vmalloc.h retain the page definitions they previously obtained from that header. Signed-off-by: Muhammad Usama Anjum --- Changes since RFC v1: - Add the ARCH_HAS_HW_PTE_T opt-in and generic wrapper definition. - Exclude the C type definitions from assembly sources. - Update the description for the new opt-in model. --- MAINTAINERS | 1 + include/linux/pgtable_types.h | 17 +++++++++++++++++ mm/Kconfig | 3 +++ 3 files changed, 21 insertions(+) create mode 100644 include/linux/pgtable_types.h diff --git a/MAINTAINERS b/MAINTAINERS index e9c8567308a75..7169bea968cf5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16982,6 +16982,7 @@ F: include/linux/mmu_notifier.h F: include/linux/pagewalk.h F: include/linux/pgalloc.h F: include/linux/pgtable.h +F: include/linux/pgtable_types.h F: include/linux/ptdump.h F: include/linux/vmpressure.h F: include/linux/vmstat.h diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h new file mode 100644 index 0000000000000..70c3edd00a01b --- /dev/null +++ b/include/linux/pgtable_types.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_PGTABLE_TYPES_H +#define _LINUX_PGTABLE_TYPES_H + +#include + +#ifndef __ASSEMBLY__ + +#ifdef CONFIG_ARCH_HAS_HW_PTE_T +typedef struct { pte_t __pte; } hw_pte_t; +#else +#define hw_pte_t pte_t +#endif + +#endif /* !__ASSEMBLY__ */ + +#endif /* _LINUX_PGTABLE_TYPES_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 331daf7fcfab5..31ba9ebf4aafd 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1316,6 +1316,9 @@ comment "GUP_TEST needs to have DEBUG_FS enabled" config GUP_GET_PXX_LOW_HIGH bool +config ARCH_HAS_HW_PTE_T + bool + config DMAPOOL_TEST tristate "Enable a module to run time tests on dma_pool" depends on HAS_DMA -- 2.47.3