* [PATCH v5 0/3] xen/mm: Introduce pte_attr_t
@ 2025-04-25 11:24 Andrew Cooper
2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Andrew Cooper @ 2025-04-25 11:24 UTC (permalink / raw)
To: Xen-devel
Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné,
Stefano Stabellini, Julien Grall, Volodymyr Babchuk,
Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio
This is in order to support PPC needing wider flags, but I've also written it
as a showcase of the new __has_include().
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/1786141700
Andrew Cooper (1):
xen/mm: Introduce mm-types.h
Shawn Anastasio (2):
xen/mm: Switch some APIs over to pte_attr_t
ppc/mm: Introduce mm-types.h
xen/arch/arm/mmu/pt.c | 4 ++--
xen/arch/ppc/include/asm/mm-types.h | 7 +++++++
xen/arch/ppc/mm-radix.c | 2 +-
xen/arch/riscv/pt.c | 2 +-
xen/arch/x86/mm.c | 6 +++---
xen/common/efi/boot.c | 4 ++--
xen/common/vmap.c | 2 +-
xen/include/xen/mm-types.h | 19 +++++++++++++++++++
xen/include/xen/mm.h | 7 ++++---
xen/include/xen/vmap.h | 3 ++-
10 files changed, 42 insertions(+), 14 deletions(-)
create mode 100644 xen/arch/ppc/include/asm/mm-types.h
create mode 100644 xen/include/xen/mm-types.h
base-commit: 6dc1b711ded0e477c501d4017ccb0da83d6d56a1
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 11:24 [PATCH v5 0/3] xen/mm: Introduce pte_attr_t Andrew Cooper @ 2025-04-25 11:24 ` Andrew Cooper 2025-04-25 11:29 ` Oleksii Kurochko ` (2 more replies) 2025-04-25 11:24 ` [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t Andrew Cooper 2025-04-25 11:24 ` [PATCH v5 3/3] ppc/mm: Introduce mm-types.h Andrew Cooper 2 siblings, 3 replies; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 11:24 UTC (permalink / raw) To: Xen-devel Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio The type used for pagetable attributes/permissions is currently unsigned int, but needs to become architecture dependent as PPC needs unsigned long. Introduce mm-types.h to house pte_attr_t. Given the new toolchain baseline, we can use __has_include() now to remove the need for boilerplate on most architectures. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Julien Grall <julien@xen.org> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> CC: Bertrand Marquis <bertrand.marquis@arm.com> CC: Michal Orzel <michal.orzel@amd.com> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> CC: Shawn Anastasio <sanastasio@raptorengineering.com> __has_include() was one of the justifications for the new toolchain baseline, and is included in https://gitlab.com/xen-project/xen/-/issues/201 --- xen/include/xen/mm-types.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 xen/include/xen/mm-types.h diff --git a/xen/include/xen/mm-types.h b/xen/include/xen/mm-types.h new file mode 100644 index 000000000000..19f692e9aaa4 --- /dev/null +++ b/xen/include/xen/mm-types.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef XEN_MM_TYPES_H +#define XEN_MM_TYPES_H + +/* + * Types used to abstract away architecture-specific details in the memory + * management code. + * + * Architectures need only provide their own asm/mm-types.h if they want to + * override the defaults given here. + */ +#if __has_include(<asm/mm-types.h>) +# include <asm/mm-types.h> +#else /* !__has_include(<asm/mm-types.h>) */ + +typedef unsigned int pte_attr_t; + +#endif /* !__has_include(<asm/mm-types.h>) */ +#endif /* XEN_MM_TYPES_H */ -- 2.39.5 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper @ 2025-04-25 11:29 ` Oleksii Kurochko 2025-04-25 12:45 ` Jan Beulich 2025-04-25 12:48 ` Jan Beulich 2025-05-01 19:42 ` Stefano Stabellini 2 siblings, 1 reply; 17+ messages in thread From: Oleksii Kurochko @ 2025-04-25 11:29 UTC (permalink / raw) To: Andrew Cooper, Xen-devel Cc: Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Shawn Anastasio [-- Attachment #1: Type: text/plain, Size: 2097 bytes --] On 4/25/25 1:24 PM, Andrew Cooper wrote: > The type used for pagetable attributes/permissions is currently unsigned int, > but needs to become architecture dependent as PPC needs unsigned long. Not only PPC, RISC-V needs it too. > > Introduce mm-types.h to house pte_attr_t. Do we really want a separate mm-types.h? If yes then: Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> ~ Oleksii > > Given the new toolchain baseline, we can use __has_include() now to remove the > need for boilerplate on most architectures. > > Signed-off-by: Andrew Cooper<andrew.cooper3@citrix.com> > --- > CC: Jan Beulich<JBeulich@suse.com> > CC: Roger Pau Monné<roger.pau@citrix.com> > CC: Stefano Stabellini<sstabellini@kernel.org> > CC: Julien Grall<julien@xen.org> > CC: Volodymyr Babchuk<Volodymyr_Babchuk@epam.com> > CC: Bertrand Marquis<bertrand.marquis@arm.com> > CC: Michal Orzel<michal.orzel@amd.com> > CC: Oleksii Kurochko<oleksii.kurochko@gmail.com> > CC: Shawn Anastasio<sanastasio@raptorengineering.com> > > __has_include() was one of the justifications for the new toolchain baseline, > and is included inhttps://gitlab.com/xen-project/xen/-/issues/201 > --- > xen/include/xen/mm-types.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > create mode 100644 xen/include/xen/mm-types.h > > diff --git a/xen/include/xen/mm-types.h b/xen/include/xen/mm-types.h > new file mode 100644 > index 000000000000..19f692e9aaa4 > --- /dev/null > +++ b/xen/include/xen/mm-types.h > @@ -0,0 +1,19 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef XEN_MM_TYPES_H > +#define XEN_MM_TYPES_H > + > +/* > + * Types used to abstract away architecture-specific details in the memory > + * management code. > + * > + * Architectures need only provide their own asm/mm-types.h if they want to > + * override the defaults given here. > + */ > +#if __has_include(<asm/mm-types.h>) > +# include <asm/mm-types.h> > +#else /* !__has_include(<asm/mm-types.h>) */ > + > +typedef unsigned int pte_attr_t; > + > +#endif /* !__has_include(<asm/mm-types.h>) */ > +#endif /* XEN_MM_TYPES_H */ [-- Attachment #2: Type: text/html, Size: 3743 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 11:29 ` Oleksii Kurochko @ 2025-04-25 12:45 ` Jan Beulich 2025-04-25 12:49 ` Andrew Cooper 0 siblings, 1 reply; 17+ messages in thread From: Jan Beulich @ 2025-04-25 12:45 UTC (permalink / raw) To: Oleksii Kurochko, Andrew Cooper, Xen-devel Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Shawn Anastasio On 25.04.2025 13:29, Oleksii Kurochko wrote: > > On 4/25/25 1:24 PM, Andrew Cooper wrote: >> The type used for pagetable attributes/permissions is currently unsigned int, >> but needs to become architecture dependent as PPC needs unsigned long. > > Not only PPC, RISC-V needs it too. > >> >> Introduce mm-types.h to house pte_attr_t. > > Do we really want a separate mm-types.h? I think so, yes. It'll (hopefully) allow to avoid including xen/mm.h in a few places, in the longer run. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 12:45 ` Jan Beulich @ 2025-04-25 12:49 ` Andrew Cooper 0 siblings, 0 replies; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 12:49 UTC (permalink / raw) To: Jan Beulich, Oleksii Kurochko, Xen-devel Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Shawn Anastasio On 25/04/2025 1:45 pm, Jan Beulich wrote: > On 25.04.2025 13:29, Oleksii Kurochko wrote: >> On 4/25/25 1:24 PM, Andrew Cooper wrote: >>> The type used for pagetable attributes/permissions is currently unsigned int, >>> but needs to become architecture dependent as PPC needs unsigned long. >> Not only PPC, RISC-V needs it too. >> >>> Introduce mm-types.h to house pte_attr_t. >> Do we really want a separate mm-types.h? > I think so, yes. It'll (hopefully) allow to avoid including xen/mm.h in a few > places, in the longer run. Yes, that's the intention. We need to use this pattern here and elsewhere (especially sched.h) to avoid having most TUs pull in most of the world. ~Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper 2025-04-25 11:29 ` Oleksii Kurochko @ 2025-04-25 12:48 ` Jan Beulich 2025-04-25 13:05 ` Andrew Cooper 2025-05-01 19:42 ` Stefano Stabellini 2 siblings, 1 reply; 17+ messages in thread From: Jan Beulich @ 2025-04-25 12:48 UTC (permalink / raw) To: Andrew Cooper Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio, Xen-devel On 25.04.2025 13:24, Andrew Cooper wrote: > The type used for pagetable attributes/permissions is currently unsigned int, > but needs to become architecture dependent as PPC needs unsigned long. > > Introduce mm-types.h to house pte_attr_t. > > Given the new toolchain baseline, we can use __has_include() now to remove the > need for boilerplate on most architectures. That's true now, when it's just pte_attr_t that's there. Memory management, however, is pretty different between architectures, so I wonder if in the longer run any one will remain that actually can use the common header. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 12:48 ` Jan Beulich @ 2025-04-25 13:05 ` Andrew Cooper 2025-04-25 13:13 ` Jan Beulich 0 siblings, 1 reply; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 13:05 UTC (permalink / raw) To: Jan Beulich Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio, Xen-devel On 25/04/2025 1:48 pm, Jan Beulich wrote: > On 25.04.2025 13:24, Andrew Cooper wrote: >> The type used for pagetable attributes/permissions is currently unsigned int, >> but needs to become architecture dependent as PPC needs unsigned long. >> >> Introduce mm-types.h to house pte_attr_t. >> >> Given the new toolchain baseline, we can use __has_include() now to remove the >> need for boilerplate on most architectures. > That's true now, when it's just pte_attr_t that's there. Memory management, > however, is pretty different between architectures, so I wonder if in the > longer run any one will remain that actually can use the common header. Anything in xen/mm.h is common and needs architectures to provide (or use the defaults) the bits required. asm/mm{,-types.h} still exist (when necessary) to provide the arch-specific extensions. ~Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 13:05 ` Andrew Cooper @ 2025-04-25 13:13 ` Jan Beulich 2025-04-25 13:48 ` Andrew Cooper 0 siblings, 1 reply; 17+ messages in thread From: Jan Beulich @ 2025-04-25 13:13 UTC (permalink / raw) To: Andrew Cooper Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio, Xen-devel On 25.04.2025 15:05, Andrew Cooper wrote: > On 25/04/2025 1:48 pm, Jan Beulich wrote: >> On 25.04.2025 13:24, Andrew Cooper wrote: >>> The type used for pagetable attributes/permissions is currently unsigned int, >>> but needs to become architecture dependent as PPC needs unsigned long. >>> >>> Introduce mm-types.h to house pte_attr_t. >>> >>> Given the new toolchain baseline, we can use __has_include() now to remove the >>> need for boilerplate on most architectures. >> That's true now, when it's just pte_attr_t that's there. Memory management, >> however, is pretty different between architectures, so I wonder if in the >> longer run any one will remain that actually can use the common header. > > Anything in xen/mm.h is common and needs architectures to provide (or > use the defaults) the bits required. > > asm/mm{,-types.h} still exist (when necessary) to provide the > arch-specific extensions. Sure, but you kind of avoid my question: Are you reasonably certain more than one arch will still be able to use the defaults, once a few more things appear in this header? (IOW: Won't we be better off having each arch have its asm/mm-types.h right away?) Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 13:13 ` Jan Beulich @ 2025-04-25 13:48 ` Andrew Cooper 2025-04-25 14:42 ` Jan Beulich 0 siblings, 1 reply; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 13:48 UTC (permalink / raw) To: Jan Beulich Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio, Xen-devel On 25/04/2025 2:13 pm, Jan Beulich wrote: > On 25.04.2025 15:05, Andrew Cooper wrote: >> On 25/04/2025 1:48 pm, Jan Beulich wrote: >>> On 25.04.2025 13:24, Andrew Cooper wrote: >>>> The type used for pagetable attributes/permissions is currently unsigned int, >>>> but needs to become architecture dependent as PPC needs unsigned long. >>>> >>>> Introduce mm-types.h to house pte_attr_t. >>>> >>>> Given the new toolchain baseline, we can use __has_include() now to remove the >>>> need for boilerplate on most architectures. >>> That's true now, when it's just pte_attr_t that's there. Memory management, >>> however, is pretty different between architectures, so I wonder if in the >>> longer run any one will remain that actually can use the common header. >> Anything in xen/mm.h is common and needs architectures to provide (or >> use the defaults) the bits required. >> >> asm/mm{,-types.h} still exist (when necessary) to provide the >> arch-specific extensions. > Sure, but you kind of avoid my question: Are you reasonably certain more than > one arch will still be able to use the defaults, once a few more things appear > in this header? (IOW: Won't we be better off having each arch have its > asm/mm-types.h right away?) I can't predict the future, but my gut feeling is that it's not going to diverge very much. If needs be, we can go to conditional override for specific bits. Or, if I'm wrong, I'm wrong. It's not hard to change. ~Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 13:48 ` Andrew Cooper @ 2025-04-25 14:42 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-04-25 14:42 UTC (permalink / raw) To: Andrew Cooper Cc: Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio, Xen-devel On 25.04.2025 15:48, Andrew Cooper wrote: > On 25/04/2025 2:13 pm, Jan Beulich wrote: >> On 25.04.2025 15:05, Andrew Cooper wrote: >>> On 25/04/2025 1:48 pm, Jan Beulich wrote: >>>> On 25.04.2025 13:24, Andrew Cooper wrote: >>>>> The type used for pagetable attributes/permissions is currently unsigned int, >>>>> but needs to become architecture dependent as PPC needs unsigned long. >>>>> >>>>> Introduce mm-types.h to house pte_attr_t. >>>>> >>>>> Given the new toolchain baseline, we can use __has_include() now to remove the >>>>> need for boilerplate on most architectures. >>>> That's true now, when it's just pte_attr_t that's there. Memory management, >>>> however, is pretty different between architectures, so I wonder if in the >>>> longer run any one will remain that actually can use the common header. >>> Anything in xen/mm.h is common and needs architectures to provide (or >>> use the defaults) the bits required. >>> >>> asm/mm{,-types.h} still exist (when necessary) to provide the >>> arch-specific extensions. >> Sure, but you kind of avoid my question: Are you reasonably certain more than >> one arch will still be able to use the defaults, once a few more things appear >> in this header? (IOW: Won't we be better off having each arch have its >> asm/mm-types.h right away?) > > I can't predict the future, but my gut feeling is that it's not going to > diverge very much. > > If needs be, we can go to conditional override for specific bits. Or, > if I'm wrong, I'm wrong. It's not hard to change. Well, feel free then to put in with Oleksii's R-b. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 1/3] xen/mm: Introduce mm-types.h 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper 2025-04-25 11:29 ` Oleksii Kurochko 2025-04-25 12:48 ` Jan Beulich @ 2025-05-01 19:42 ` Stefano Stabellini 2 siblings, 0 replies; 17+ messages in thread From: Stefano Stabellini @ 2025-05-01 19:42 UTC (permalink / raw) To: Andrew Cooper Cc: Xen-devel, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko, Shawn Anastasio [-- Attachment #1: Type: text/plain, Size: 2024 bytes --] On Fri, 25 Apr 2025, Andrew Cooper wrote: > The type used for pagetable attributes/permissions is currently unsigned int, > but needs to become architecture dependent as PPC needs unsigned long. > > Introduce mm-types.h to house pte_attr_t. > > Given the new toolchain baseline, we can use __has_include() now to remove the > need for boilerplate on most architectures. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > CC: Jan Beulich <JBeulich@suse.com> > CC: Roger Pau Monné <roger.pau@citrix.com> > CC: Stefano Stabellini <sstabellini@kernel.org> > CC: Julien Grall <julien@xen.org> > CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> > CC: Bertrand Marquis <bertrand.marquis@arm.com> > CC: Michal Orzel <michal.orzel@amd.com> > CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> > CC: Shawn Anastasio <sanastasio@raptorengineering.com> > > __has_include() was one of the justifications for the new toolchain baseline, > and is included in https://gitlab.com/xen-project/xen/-/issues/201 > --- > xen/include/xen/mm-types.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > create mode 100644 xen/include/xen/mm-types.h > > diff --git a/xen/include/xen/mm-types.h b/xen/include/xen/mm-types.h > new file mode 100644 > index 000000000000..19f692e9aaa4 > --- /dev/null > +++ b/xen/include/xen/mm-types.h > @@ -0,0 +1,19 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef XEN_MM_TYPES_H > +#define XEN_MM_TYPES_H > + > +/* > + * Types used to abstract away architecture-specific details in the memory > + * management code. > + * > + * Architectures need only provide their own asm/mm-types.h if they want to > + * override the defaults given here. > + */ > +#if __has_include(<asm/mm-types.h>) > +# include <asm/mm-types.h> > +#else /* !__has_include(<asm/mm-types.h>) */ > + > +typedef unsigned int pte_attr_t; > + > +#endif /* !__has_include(<asm/mm-types.h>) */ > +#endif /* XEN_MM_TYPES_H */ > -- > 2.39.5 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t 2025-04-25 11:24 [PATCH v5 0/3] xen/mm: Introduce pte_attr_t Andrew Cooper 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper @ 2025-04-25 11:24 ` Andrew Cooper 2025-04-25 11:33 ` Oleksii Kurochko 2025-05-01 19:42 ` Stefano Stabellini 2025-04-25 11:24 ` [PATCH v5 3/3] ppc/mm: Introduce mm-types.h Andrew Cooper 2 siblings, 2 replies; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 11:24 UTC (permalink / raw) To: Xen-devel Cc: Shawn Anastasio, Andrew Cooper, Oleksii Kurochko, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel From: Shawn Anastasio <sanastasio@raptorengineering.com> Several APIs take an architecture-dependent set of flags in an unsigned int, but this needs to be a wider type to support PPC. The new type pte_attr_t has been introduced for this purpose, so switch to it in map_pages_to_xen(), __vmap() and modify_xen_mappings{,_lite}(). No functional change. Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Julien Grall <julien@xen.org> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> CC: Bertrand Marquis <bertrand.marquis@arm.com> CC: Michal Orzel <michal.orzel@amd.com> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> CC: Shawn Anastasio <sanastasio@raptorengineering.com> --- xen/arch/arm/mmu/pt.c | 4 ++-- xen/arch/ppc/mm-radix.c | 2 +- xen/arch/riscv/pt.c | 2 +- xen/arch/x86/mm.c | 6 +++--- xen/common/efi/boot.c | 4 ++-- xen/common/vmap.c | 2 +- xen/include/xen/mm.h | 7 ++++--- xen/include/xen/vmap.h | 3 ++- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c index 11cb1c66dac8..4726e713efd3 100644 --- a/xen/arch/arm/mmu/pt.c +++ b/xen/arch/arm/mmu/pt.c @@ -696,7 +696,7 @@ static int xen_pt_update(unsigned long virt, int map_pages_to_xen(unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int flags) + pte_attr_t flags) { return xen_pt_update(virt, mfn, nr_mfns, flags); } @@ -714,7 +714,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, 0); } -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) { ASSERT(IS_ALIGNED(s, PAGE_SIZE)); ASSERT(IS_ALIGNED(e, PAGE_SIZE)); diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c index 9a00ae416af0..d5385ec9dd4b 100644 --- a/xen/arch/ppc/mm-radix.c +++ b/xen/arch/ppc/mm-radix.c @@ -265,7 +265,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) int map_pages_to_xen(unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int flags) + pte_attr_t flags) { BUG_ON("unimplemented"); } diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c index 857619d48df1..918b1b91abde 100644 --- a/xen/arch/riscv/pt.c +++ b/xen/arch/riscv/pt.c @@ -504,7 +504,7 @@ static int pt_update(vaddr_t virt, mfn_t mfn, int map_pages_to_xen(unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int flags) + pte_attr_t flags) { /* * Ensure that flags has PTE_VALID bit as map_pages_to_xen() is supposed diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 1cf236516789..0e6c766be4aa 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5442,7 +5442,7 @@ int map_pages_to_xen( unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int flags) + pte_attr_t flags) { bool locking = system_state > SYS_STATE_boot; l3_pgentry_t *pl3e = NULL, ol3e; @@ -5860,7 +5860,7 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) * * It is an error to call with present flags over an unpopulated range. */ -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) { bool locking = system_state > SYS_STATE_boot; l3_pgentry_t *pl3e = NULL; @@ -6156,7 +6156,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) * the non-inclusive boundary will be updated. */ void init_or_livepatch modify_xen_mappings_lite( - unsigned long s, unsigned long e, unsigned int nf) + unsigned long s, unsigned long e, pte_attr_t nf) { unsigned long v = s, fm, flags; diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 143b5681ba92..e39fbc3529c4 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1676,7 +1676,7 @@ void __init efi_init_memory(void) struct rt_extra { struct rt_extra *next; unsigned long smfn, emfn; - unsigned int prot; + pte_attr_t prot; } *extra, *extra_head = NULL; free_ebmalloc_unused_mem(); @@ -1691,7 +1691,7 @@ void __init efi_init_memory(void) EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; unsigned long smfn, emfn; - unsigned int prot = PAGE_HYPERVISOR_RWX; + pte_attr_t prot = PAGE_HYPERVISOR_RWX; paddr_t mem_base; unsigned long mem_npages; diff --git a/xen/common/vmap.c b/xen/common/vmap.c index 47225fecc067..d6991421f3f7 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -222,7 +222,7 @@ static void vm_free(const void *va) } void *__vmap(const mfn_t *mfn, unsigned int granularity, - unsigned int nr, unsigned int align, unsigned int flags, + unsigned int nr, unsigned int align, pte_attr_t flags, enum vmap_region type) { void *va = vm_alloc(nr * granularity, align, type); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index ae1c48a61545..e89942b87d1e 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -64,6 +64,7 @@ #include <xen/bug.h> #include <xen/compiler.h> #include <xen/mm-frame.h> +#include <xen/mm-types.h> #include <xen/types.h> #include <xen/list.h> #include <xen/spinlock.h> @@ -113,11 +114,11 @@ int map_pages_to_xen( unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int flags); + pte_attr_t flags); /* Alter the permissions of a range of Xen virtual address space. */ -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf); +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf); void modify_xen_mappings_lite(unsigned long s, unsigned long e, - unsigned int nf); + pte_attr_t nf); int destroy_xen_mappings(unsigned long s, unsigned long e); /* Retrieve the MFN mapped by VA in Xen virtual address space. */ mfn_t xen_map_to_mfn(unsigned long va); diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h index 26c831757a11..327a2597826d 100644 --- a/xen/include/xen/vmap.h +++ b/xen/include/xen/vmap.h @@ -9,6 +9,7 @@ #define __XEN_VMAP_H__ #include <xen/mm-frame.h> +#include <xen/mm-types.h> #include <xen/page-size.h> /* Identifiers for the linear ranges tracked by vmap */ @@ -57,7 +58,7 @@ void vm_init_type(enum vmap_region type, void *start, void *end); * @return Pointer to the mapped area on success; NULL otherwise. */ void *__vmap(const mfn_t *mfn, unsigned int granularity, unsigned int nr, - unsigned int align, unsigned int flags, enum vmap_region type); + unsigned int align, pte_attr_t flags, enum vmap_region type); /* * Map an array of pages contiguously into the VMAP_DEFAULT vmap region -- 2.39.5 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t 2025-04-25 11:24 ` [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t Andrew Cooper @ 2025-04-25 11:33 ` Oleksii Kurochko 2025-05-01 19:42 ` Stefano Stabellini 1 sibling, 0 replies; 17+ messages in thread From: Oleksii Kurochko @ 2025-04-25 11:33 UTC (permalink / raw) To: Andrew Cooper, Xen-devel Cc: Shawn Anastasio, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel [-- Attachment #1: Type: text/plain, Size: 8479 bytes --] On 4/25/25 1:24 PM, Andrew Cooper wrote: > From: Shawn Anastasio<sanastasio@raptorengineering.com> > > Several APIs take an architecture-dependent set of flags in an unsigned int, > but this needs to be a wider type to support PPC. > > The new type pte_attr_t has been introduced for this purpose, so switch to it > in map_pages_to_xen(), __vmap() and modify_xen_mappings{,_lite}(). > > No functional change. > > Suggested-by: Andrew Cooper<andrew.cooper3@citrix.com> > Signed-off-by: Shawn Anastasio<sanastasio@raptorengineering.com> > Signed-off-by: Andrew Cooper<andrew.cooper3@citrix.com> > Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> > --- > CC: Jan Beulich<JBeulich@suse.com> > CC: Roger Pau Monné<roger.pau@citrix.com> > CC: Stefano Stabellini<sstabellini@kernel.org> > CC: Julien Grall<julien@xen.org> > CC: Volodymyr Babchuk<Volodymyr_Babchuk@epam.com> > CC: Bertrand Marquis<bertrand.marquis@arm.com> > CC: Michal Orzel<michal.orzel@amd.com> > CC: Oleksii Kurochko<oleksii.kurochko@gmail.com> > CC: Shawn Anastasio<sanastasio@raptorengineering.com> > --- > xen/arch/arm/mmu/pt.c | 4 ++-- > xen/arch/ppc/mm-radix.c | 2 +- > xen/arch/riscv/pt.c | 2 +- As I wrote here, probably, as a part of this patch we also wants to do the following changes: https://lore.kernel.org/xen-devel/192683d3-8777-45c2-b8a8-546bf171a7aa@gmail.com/T/#u I'm okay with sending the mentioned changes in the link as a separate patch when I will introduce Svpmbt extension which uses 61 and 62 bits. Let me know if you are okay with that? If you think that these changes should be part of this patch then something similar for Arm should be done too now. ~ Oleksii > xen/arch/x86/mm.c | 6 +++--- > xen/common/efi/boot.c | 4 ++-- > xen/common/vmap.c | 2 +- > xen/include/xen/mm.h | 7 ++++--- > xen/include/xen/vmap.h | 3 ++- > 8 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c > index 11cb1c66dac8..4726e713efd3 100644 > --- a/xen/arch/arm/mmu/pt.c > +++ b/xen/arch/arm/mmu/pt.c > @@ -696,7 +696,7 @@ static int xen_pt_update(unsigned long virt, > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > return xen_pt_update(virt, mfn, nr_mfns, flags); > } > @@ -714,7 +714,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, 0); > } > > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) > { > ASSERT(IS_ALIGNED(s, PAGE_SIZE)); > ASSERT(IS_ALIGNED(e, PAGE_SIZE)); > diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c > index 9a00ae416af0..d5385ec9dd4b 100644 > --- a/xen/arch/ppc/mm-radix.c > +++ b/xen/arch/ppc/mm-radix.c > @@ -265,7 +265,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > BUG_ON("unimplemented"); > } > diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c > index 857619d48df1..918b1b91abde 100644 > --- a/xen/arch/riscv/pt.c > +++ b/xen/arch/riscv/pt.c > @@ -504,7 +504,7 @@ static int pt_update(vaddr_t virt, mfn_t mfn, > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > /* > * Ensure that flags has PTE_VALID bit as map_pages_to_xen() is supposed > diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c > index 1cf236516789..0e6c766be4aa 100644 > --- a/xen/arch/x86/mm.c > +++ b/xen/arch/x86/mm.c > @@ -5442,7 +5442,7 @@ int map_pages_to_xen( > unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > bool locking = system_state > SYS_STATE_boot; > l3_pgentry_t *pl3e = NULL, ol3e; > @@ -5860,7 +5860,7 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) > * > * It is an error to call with present flags over an unpopulated range. > */ > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) > { > bool locking = system_state > SYS_STATE_boot; > l3_pgentry_t *pl3e = NULL; > @@ -6156,7 +6156,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > * the non-inclusive boundary will be updated. > */ > void init_or_livepatch modify_xen_mappings_lite( > - unsigned long s, unsigned long e, unsigned int nf) > + unsigned long s, unsigned long e, pte_attr_t nf) > { > unsigned long v = s, fm, flags; > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 143b5681ba92..e39fbc3529c4 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -1676,7 +1676,7 @@ void __init efi_init_memory(void) > struct rt_extra { > struct rt_extra *next; > unsigned long smfn, emfn; > - unsigned int prot; > + pte_attr_t prot; > } *extra, *extra_head = NULL; > > free_ebmalloc_unused_mem(); > @@ -1691,7 +1691,7 @@ void __init efi_init_memory(void) > EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; > u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; > unsigned long smfn, emfn; > - unsigned int prot = PAGE_HYPERVISOR_RWX; > + pte_attr_t prot = PAGE_HYPERVISOR_RWX; > paddr_t mem_base; > unsigned long mem_npages; > > diff --git a/xen/common/vmap.c b/xen/common/vmap.c > index 47225fecc067..d6991421f3f7 100644 > --- a/xen/common/vmap.c > +++ b/xen/common/vmap.c > @@ -222,7 +222,7 @@ static void vm_free(const void *va) > } > > void *__vmap(const mfn_t *mfn, unsigned int granularity, > - unsigned int nr, unsigned int align, unsigned int flags, > + unsigned int nr, unsigned int align, pte_attr_t flags, > enum vmap_region type) > { > void *va = vm_alloc(nr * granularity, align, type); > diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h > index ae1c48a61545..e89942b87d1e 100644 > --- a/xen/include/xen/mm.h > +++ b/xen/include/xen/mm.h > @@ -64,6 +64,7 @@ > #include <xen/bug.h> > #include <xen/compiler.h> > #include <xen/mm-frame.h> > +#include <xen/mm-types.h> > #include <xen/types.h> > #include <xen/list.h> > #include <xen/spinlock.h> > @@ -113,11 +114,11 @@ int map_pages_to_xen( > unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags); > + pte_attr_t flags); > /* Alter the permissions of a range of Xen virtual address space. */ > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf); > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf); > void modify_xen_mappings_lite(unsigned long s, unsigned long e, > - unsigned int nf); > + pte_attr_t nf); > int destroy_xen_mappings(unsigned long s, unsigned long e); > /* Retrieve the MFN mapped by VA in Xen virtual address space. */ > mfn_t xen_map_to_mfn(unsigned long va); > diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h > index 26c831757a11..327a2597826d 100644 > --- a/xen/include/xen/vmap.h > +++ b/xen/include/xen/vmap.h > @@ -9,6 +9,7 @@ > #define __XEN_VMAP_H__ > > #include <xen/mm-frame.h> > +#include <xen/mm-types.h> > #include <xen/page-size.h> > > /* Identifiers for the linear ranges tracked by vmap */ > @@ -57,7 +58,7 @@ void vm_init_type(enum vmap_region type, void *start, void *end); > * @return Pointer to the mapped area on success; NULL otherwise. > */ > void *__vmap(const mfn_t *mfn, unsigned int granularity, unsigned int nr, > - unsigned int align, unsigned int flags, enum vmap_region type); > + unsigned int align, pte_attr_t flags, enum vmap_region type); > > /* > * Map an array of pages contiguously into the VMAP_DEFAULT vmap region [-- Attachment #2: Type: text/html, Size: 9926 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t 2025-04-25 11:24 ` [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t Andrew Cooper 2025-04-25 11:33 ` Oleksii Kurochko @ 2025-05-01 19:42 ` Stefano Stabellini 1 sibling, 0 replies; 17+ messages in thread From: Stefano Stabellini @ 2025-05-01 19:42 UTC (permalink / raw) To: Andrew Cooper Cc: Xen-devel, Shawn Anastasio, Oleksii Kurochko, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel [-- Attachment #1: Type: text/plain, Size: 7986 bytes --] On Fri, 25 Apr 2025, Andrew Cooper wrote: > From: Shawn Anastasio <sanastasio@raptorengineering.com> > > Several APIs take an architecture-dependent set of flags in an unsigned int, > but this needs to be a wider type to support PPC. > > The new type pte_attr_t has been introduced for this purpose, so switch to it > in map_pages_to_xen(), __vmap() and modify_xen_mappings{,_lite}(). > > No functional change. > > Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> > Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > CC: Jan Beulich <JBeulich@suse.com> > CC: Roger Pau Monné <roger.pau@citrix.com> > CC: Stefano Stabellini <sstabellini@kernel.org> > CC: Julien Grall <julien@xen.org> > CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> > CC: Bertrand Marquis <bertrand.marquis@arm.com> > CC: Michal Orzel <michal.orzel@amd.com> > CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> > CC: Shawn Anastasio <sanastasio@raptorengineering.com> > --- > xen/arch/arm/mmu/pt.c | 4 ++-- > xen/arch/ppc/mm-radix.c | 2 +- > xen/arch/riscv/pt.c | 2 +- > xen/arch/x86/mm.c | 6 +++--- > xen/common/efi/boot.c | 4 ++-- > xen/common/vmap.c | 2 +- > xen/include/xen/mm.h | 7 ++++--- > xen/include/xen/vmap.h | 3 ++- > 8 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c > index 11cb1c66dac8..4726e713efd3 100644 > --- a/xen/arch/arm/mmu/pt.c > +++ b/xen/arch/arm/mmu/pt.c > @@ -696,7 +696,7 @@ static int xen_pt_update(unsigned long virt, > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > return xen_pt_update(virt, mfn, nr_mfns, flags); > } > @@ -714,7 +714,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, 0); > } > > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) > { > ASSERT(IS_ALIGNED(s, PAGE_SIZE)); > ASSERT(IS_ALIGNED(e, PAGE_SIZE)); > diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c > index 9a00ae416af0..d5385ec9dd4b 100644 > --- a/xen/arch/ppc/mm-radix.c > +++ b/xen/arch/ppc/mm-radix.c > @@ -265,7 +265,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > BUG_ON("unimplemented"); > } > diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c > index 857619d48df1..918b1b91abde 100644 > --- a/xen/arch/riscv/pt.c > +++ b/xen/arch/riscv/pt.c > @@ -504,7 +504,7 @@ static int pt_update(vaddr_t virt, mfn_t mfn, > int map_pages_to_xen(unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > /* > * Ensure that flags has PTE_VALID bit as map_pages_to_xen() is supposed > diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c > index 1cf236516789..0e6c766be4aa 100644 > --- a/xen/arch/x86/mm.c > +++ b/xen/arch/x86/mm.c > @@ -5442,7 +5442,7 @@ int map_pages_to_xen( > unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags) > + pte_attr_t flags) > { > bool locking = system_state > SYS_STATE_boot; > l3_pgentry_t *pl3e = NULL, ol3e; > @@ -5860,7 +5860,7 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) > * > * It is an error to call with present flags over an unpopulated range. > */ > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf) > { > bool locking = system_state > SYS_STATE_boot; > l3_pgentry_t *pl3e = NULL; > @@ -6156,7 +6156,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e) > * the non-inclusive boundary will be updated. > */ > void init_or_livepatch modify_xen_mappings_lite( > - unsigned long s, unsigned long e, unsigned int nf) > + unsigned long s, unsigned long e, pte_attr_t nf) > { > unsigned long v = s, fm, flags; > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 143b5681ba92..e39fbc3529c4 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -1676,7 +1676,7 @@ void __init efi_init_memory(void) > struct rt_extra { > struct rt_extra *next; > unsigned long smfn, emfn; > - unsigned int prot; > + pte_attr_t prot; > } *extra, *extra_head = NULL; > > free_ebmalloc_unused_mem(); > @@ -1691,7 +1691,7 @@ void __init efi_init_memory(void) > EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; > u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT; > unsigned long smfn, emfn; > - unsigned int prot = PAGE_HYPERVISOR_RWX; > + pte_attr_t prot = PAGE_HYPERVISOR_RWX; > paddr_t mem_base; > unsigned long mem_npages; > > diff --git a/xen/common/vmap.c b/xen/common/vmap.c > index 47225fecc067..d6991421f3f7 100644 > --- a/xen/common/vmap.c > +++ b/xen/common/vmap.c > @@ -222,7 +222,7 @@ static void vm_free(const void *va) > } > > void *__vmap(const mfn_t *mfn, unsigned int granularity, > - unsigned int nr, unsigned int align, unsigned int flags, > + unsigned int nr, unsigned int align, pte_attr_t flags, > enum vmap_region type) > { > void *va = vm_alloc(nr * granularity, align, type); > diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h > index ae1c48a61545..e89942b87d1e 100644 > --- a/xen/include/xen/mm.h > +++ b/xen/include/xen/mm.h > @@ -64,6 +64,7 @@ > #include <xen/bug.h> > #include <xen/compiler.h> > #include <xen/mm-frame.h> > +#include <xen/mm-types.h> > #include <xen/types.h> > #include <xen/list.h> > #include <xen/spinlock.h> > @@ -113,11 +114,11 @@ int map_pages_to_xen( > unsigned long virt, > mfn_t mfn, > unsigned long nr_mfns, > - unsigned int flags); > + pte_attr_t flags); > /* Alter the permissions of a range of Xen virtual address space. */ > -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf); > +int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf); > void modify_xen_mappings_lite(unsigned long s, unsigned long e, > - unsigned int nf); > + pte_attr_t nf); > int destroy_xen_mappings(unsigned long s, unsigned long e); > /* Retrieve the MFN mapped by VA in Xen virtual address space. */ > mfn_t xen_map_to_mfn(unsigned long va); > diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h > index 26c831757a11..327a2597826d 100644 > --- a/xen/include/xen/vmap.h > +++ b/xen/include/xen/vmap.h > @@ -9,6 +9,7 @@ > #define __XEN_VMAP_H__ > > #include <xen/mm-frame.h> > +#include <xen/mm-types.h> > #include <xen/page-size.h> > > /* Identifiers for the linear ranges tracked by vmap */ > @@ -57,7 +58,7 @@ void vm_init_type(enum vmap_region type, void *start, void *end); > * @return Pointer to the mapped area on success; NULL otherwise. > */ > void *__vmap(const mfn_t *mfn, unsigned int granularity, unsigned int nr, > - unsigned int align, unsigned int flags, enum vmap_region type); > + unsigned int align, pte_attr_t flags, enum vmap_region type); > > /* > * Map an array of pages contiguously into the VMAP_DEFAULT vmap region > -- > 2.39.5 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v5 3/3] ppc/mm: Introduce mm-types.h 2025-04-25 11:24 [PATCH v5 0/3] xen/mm: Introduce pte_attr_t Andrew Cooper 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper 2025-04-25 11:24 ` [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t Andrew Cooper @ 2025-04-25 11:24 ` Andrew Cooper 2025-04-25 11:37 ` Oleksii Kurochko 2 siblings, 1 reply; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 11:24 UTC (permalink / raw) To: Xen-devel Cc: Shawn Anastasio, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel, Oleksii Kurochko From: Shawn Anastasio <sanastasio@raptorengineering.com> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Julien Grall <julien@xen.org> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> CC: Bertrand Marquis <bertrand.marquis@arm.com> CC: Michal Orzel <michal.orzel@amd.com> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> CC: Shawn Anastasio <sanastasio@raptorengineering.com> Possibly not for taking on it's own (might be better with the PPC implemenation of map_pages_to_xen()). Nevertheless, this patch alone now does trip: diff --git a/xen/common/vmap.c b/xen/common/vmap.c index d6991421f3f7..9552806dba39 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -228,6 +228,8 @@ void *__vmap(const mfn_t *mfn, unsigned int granularity, void *va = vm_alloc(nr * granularity, align, type); unsigned long cur = (unsigned long)va; + BUILD_BUG_ON(sizeof(pte_attr_t) != 4); + for ( ; va && nr--; ++mfn, cur += PAGE_SIZE * granularity ) { if ( map_pages_to_xen(cur, *mfn, granularity, flags) ) in PPC builds only. --- xen/arch/ppc/include/asm/mm-types.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 xen/arch/ppc/include/asm/mm-types.h diff --git a/xen/arch/ppc/include/asm/mm-types.h b/xen/arch/ppc/include/asm/mm-types.h new file mode 100644 index 000000000000..06a3af1c6eda --- /dev/null +++ b/xen/arch/ppc/include/asm/mm-types.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef PPC_MM_TYPES_H +#define PPC_MM_TYPES_H + +typedef unsigned long pte_attr_t; + +#endif /* PPC_MM_TYPES_H */ -- 2.39.5 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v5 3/3] ppc/mm: Introduce mm-types.h 2025-04-25 11:24 ` [PATCH v5 3/3] ppc/mm: Introduce mm-types.h Andrew Cooper @ 2025-04-25 11:37 ` Oleksii Kurochko 2025-04-25 11:39 ` Andrew Cooper 0 siblings, 1 reply; 17+ messages in thread From: Oleksii Kurochko @ 2025-04-25 11:37 UTC (permalink / raw) To: Andrew Cooper, Xen-devel Cc: Shawn Anastasio, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel [-- Attachment #1: Type: text/plain, Size: 2018 bytes --] On 4/25/25 1:24 PM, Andrew Cooper wrote: > From: Shawn Anastasio<sanastasio@raptorengineering.com> > > Signed-off-by: Shawn Anastasio<sanastasio@raptorengineering.com> > --- > CC: Jan Beulich<JBeulich@suse.com> > CC: Roger Pau Monné<roger.pau@citrix.com> > CC: Stefano Stabellini<sstabellini@kernel.org> > CC: Julien Grall<julien@xen.org> > CC: Volodymyr Babchuk<Volodymyr_Babchuk@epam.com> > CC: Bertrand Marquis<bertrand.marquis@arm.com> > CC: Michal Orzel<michal.orzel@amd.com> > CC: Oleksii Kurochko<oleksii.kurochko@gmail.com> > CC: Shawn Anastasio<sanastasio@raptorengineering.com> > > Possibly not for taking on it's own (might be better with the PPC > implemenation of map_pages_to_xen()). > > Nevertheless, this patch alone now does trip: > > diff --git a/xen/common/vmap.c b/xen/common/vmap.c > index d6991421f3f7..9552806dba39 100644 > --- a/xen/common/vmap.c > +++ b/xen/common/vmap.c > @@ -228,6 +228,8 @@ void *__vmap(const mfn_t *mfn, unsigned int granularity, > void *va = vm_alloc(nr * granularity, align, type); > unsigned long cur = (unsigned long)va; > > + BUILD_BUG_ON(sizeof(pte_attr_t) != 4); > + Could you please clarify what kind of changes should done in the case if sizeof(pte_attr_t) == 8 (unsigned long)? ~ Oleksii > for ( ; va && nr--; ++mfn, cur += PAGE_SIZE * granularity ) > { > if ( map_pages_to_xen(cur, *mfn, granularity, flags) ) > > in PPC builds only. > --- > xen/arch/ppc/include/asm/mm-types.h | 7 +++++++ > 1 file changed, 7 insertions(+) > create mode 100644 xen/arch/ppc/include/asm/mm-types.h > > diff --git a/xen/arch/ppc/include/asm/mm-types.h b/xen/arch/ppc/include/asm/mm-types.h > new file mode 100644 > index 000000000000..06a3af1c6eda > --- /dev/null > +++ b/xen/arch/ppc/include/asm/mm-types.h > @@ -0,0 +1,7 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef PPC_MM_TYPES_H > +#define PPC_MM_TYPES_H > + > +typedef unsigned long pte_attr_t; > + > +#endif /* PPC_MM_TYPES_H */ [-- Attachment #2: Type: text/html, Size: 3383 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v5 3/3] ppc/mm: Introduce mm-types.h 2025-04-25 11:37 ` Oleksii Kurochko @ 2025-04-25 11:39 ` Andrew Cooper 0 siblings, 0 replies; 17+ messages in thread From: Andrew Cooper @ 2025-04-25 11:39 UTC (permalink / raw) To: Oleksii Kurochko, Xen-devel Cc: Shawn Anastasio, Jan Beulich, Roger Pau Monné, Stefano Stabellini, Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Michal Orzel On 25/04/2025 12:37 pm, Oleksii Kurochko wrote: > > > On 4/25/25 1:24 PM, Andrew Cooper wrote: >> From: Shawn Anastasio <sanastasio@raptorengineering.com> >> >> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> >> --- >> CC: Jan Beulich <JBeulich@suse.com> >> CC: Roger Pau Monné <roger.pau@citrix.com> >> CC: Stefano Stabellini <sstabellini@kernel.org> >> CC: Julien Grall <julien@xen.org> >> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> >> CC: Bertrand Marquis <bertrand.marquis@arm.com> >> CC: Michal Orzel <michal.orzel@amd.com> >> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com> >> CC: Shawn Anastasio <sanastasio@raptorengineering.com> >> >> Possibly not for taking on it's own (might be better with the PPC >> implemenation of map_pages_to_xen()). >> >> Nevertheless, this patch alone now does trip: >> >> diff --git a/xen/common/vmap.c b/xen/common/vmap.c >> index d6991421f3f7..9552806dba39 100644 >> --- a/xen/common/vmap.c >> +++ b/xen/common/vmap.c >> @@ -228,6 +228,8 @@ void *__vmap(const mfn_t *mfn, unsigned int granularity, >> void *va = vm_alloc(nr * granularity, align, type); >> unsigned long cur = (unsigned long)va; >> >> + BUILD_BUG_ON(sizeof(pte_attr_t) != 4); >> + > Could you please clarify what kind of changes should done in the case if > sizeof(pte_attr_t) == 8 (unsigned long)? Nothing. This is simply to demonstrate that __has_include() is working, and is making PPC different to all the other architectures. ~Andrew. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-05-01 19:43 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-25 11:24 [PATCH v5 0/3] xen/mm: Introduce pte_attr_t Andrew Cooper 2025-04-25 11:24 ` [PATCH v5 1/3] xen/mm: Introduce mm-types.h Andrew Cooper 2025-04-25 11:29 ` Oleksii Kurochko 2025-04-25 12:45 ` Jan Beulich 2025-04-25 12:49 ` Andrew Cooper 2025-04-25 12:48 ` Jan Beulich 2025-04-25 13:05 ` Andrew Cooper 2025-04-25 13:13 ` Jan Beulich 2025-04-25 13:48 ` Andrew Cooper 2025-04-25 14:42 ` Jan Beulich 2025-05-01 19:42 ` Stefano Stabellini 2025-04-25 11:24 ` [PATCH v5 2/3] xen/mm: Switch some APIs over to pte_attr_t Andrew Cooper 2025-04-25 11:33 ` Oleksii Kurochko 2025-05-01 19:42 ` Stefano Stabellini 2025-04-25 11:24 ` [PATCH v5 3/3] ppc/mm: Introduce mm-types.h Andrew Cooper 2025-04-25 11:37 ` Oleksii Kurochko 2025-04-25 11:39 ` Andrew Cooper
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.