From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Baptiste Le Duc <baptiste.le-duc@vates.tech>,
xen-devel@lists.xenproject.org
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Julien Grall" <julien@xen.org>,
"Roger Pau Monné" <roger@xenproject.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>
Subject: Re: [PATCH v3 2/6] xen/riscv: rename PTE "permissions" to "pte_flags"
Date: Wed, 30 Sep 2026 15:42:03 +0200 [thread overview]
Message-ID: <9f94af4b-f122-46e0-bbc4-7fecd51d4348@gmail.com> (raw)
In-Reply-To: <1790699585.8631fc262581453bbf619ec5b2062170.1a0ee033eb9000b504@vates.tech>
On 9/29/26 6:32 PM, Baptiste Le Duc wrote:
> paddr_to_pte()'s "permissions" parameter, the matching local in
Nit: s/the matching local/the matching local variable?
> setup_initial_mapping() and p2m_set_permission() don't only deal with
> permission bits: they also handle PTE_VALID, PTE_USER, PTE_ACCESSED and
> PTE_DIRTY.
>
> Rename them to "pte_flags" and p2m_set_pte_flags() respectively.
>
> No functional change.
>
> Requested-by: Jan Beulich <jbeulich@suse.com>
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Baptiste Le Duc <baptiste.le-duc@vates.tech>
> ---
> Changes since v2:
> - new patch
> ---
> xen/arch/riscv/include/asm/mm.h | 5 +++--
> xen/arch/riscv/mm.c | 8 ++++----
> xen/arch/riscv/p2m.c | 4 ++--
> 3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
> index 9e28c24954..1ac66283ec 100644
> --- a/xen/arch/riscv/include/asm/mm.h
> +++ b/xen/arch/riscv/include/asm/mm.h
> @@ -22,9 +22,10 @@ extern vaddr_t directmap_virt_start;
> #define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT))
>
> static inline pte_t paddr_to_pte(paddr_t paddr,
> - unsigned int permissions)
> + unsigned int pte_flags)
> {
> - return (pte_t) { .pte = (paddr_to_pfn(paddr) << PTE_PPN_SHIFT) | permissions };
> + return (pte_t) { .pte = (paddr_to_pfn(paddr) << PTE_PPN_SHIFT) |
> + pte_flags };
Nit: it could be one line.
> }
>
> static inline paddr_t pte_to_paddr(pte_t pte)
> diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
> index 610d111945..0e26c5751f 100644
> --- a/xen/arch/riscv/mm.c
> +++ b/xen/arch/riscv/mm.c
> @@ -140,7 +140,7 @@ static void __init setup_initial_mapping(struct mmu_desc *mmu_desc,
> case 1: /* Level 0 */
> {
> unsigned long paddr = (page_addr - map_start) + pa_start;
> - unsigned int permissions = PTE_LEAF_DEFAULT;
> + unsigned int pte_flags = PTE_LEAF_DEFAULT;
> unsigned long addr = is_identity_mapping
> ? page_addr : virt_to_maddr(page_addr);
> pte_t pte_to_be_written;
> @@ -149,13 +149,13 @@ static void __init setup_initial_mapping(struct mmu_desc *mmu_desc,
>
> if ( is_kernel_text(addr) ||
> is_kernel_inittext(addr) )
> - permissions =
> + pte_flags =
> PTE_EXECUTABLE | PTE_READABLE | PTE_VALID;
Nit: it could be one line now.
>
> if ( is_kernel_rodata(addr) )
> - permissions = PTE_READABLE | PTE_VALID;
> + pte_flags = PTE_READABLE | PTE_VALID;
>
> - pte_to_be_written = paddr_to_pte(paddr, permissions);
> + pte_to_be_written = paddr_to_pte(paddr, pte_flags);
>
> if ( !pte_is_valid(pgtbl[index]) )
> pgtbl[index] = pte_to_be_written;
> diff --git a/xen/arch/riscv/p2m.c b/xen/arch/riscv/p2m.c
> index 1cea86512c..f7b380b90a 100644
> --- a/xen/arch/riscv/p2m.c
> +++ b/xen/arch/riscv/p2m.c
> @@ -584,7 +584,7 @@ static inline void p2m_clean_pte(pte_t *p, bool clean_cache)
> p2m_write_pte(p, pte, clean_cache);
> }
>
> -static void p2m_set_permission(pte_t *e, p2m_type_t t)
> +static void p2m_set_pte_flags(pte_t *e, p2m_type_t t)
> {
> e->pte &= ~PTE_ACCESS_MASK;
>
> @@ -676,7 +676,7 @@ static pte_t p2m_pte_from_mfn(mfn_t mfn, p2m_type_t t,
> break;
> }
>
> - p2m_set_permission(&e, t);
> + p2m_set_pte_flags(&e, t);
> p2m_set_type(&e, t, ctx);
> }
> else
>
I am okay to go without last two Nit(s):
Reveiwed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Thanks.
~ Oleksii
next prev parent reply other threads:[~2026-09-30 13:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 16:29 [PATCH v3 0/6] xen/riscv: fix boot on missing extensions and MMU setup bugs Baptiste Le Duc
2026-09-29 16:32 ` [PATCH v3 1/6] docs/riscv: sync required ISA extensions with required_extensions[] Baptiste Le Duc
2026-09-30 6:18 ` Jan Beulich
2026-09-30 10:32 ` Oleksii Kurochko
2026-09-29 16:32 ` [PATCH v3 2/6] xen/riscv: rename PTE "permissions" to "pte_flags" Baptiste Le Duc
2026-09-30 12:07 ` Jan Beulich
2026-09-30 12:42 ` Baptiste Le Duc
2026-09-30 12:50 ` Jan Beulich
2026-09-30 12:46 ` [PATCH v3.1 " Baptiste Le Duc
2026-09-30 12:51 ` Baptiste Le Duc
2026-09-30 13:34 ` [PATCH v3 " Oleksii Kurochko
2026-09-30 13:04 ` [PATCH RESEND " Anthony PERARD
2026-09-30 13:42 ` Oleksii Kurochko [this message]
2026-09-30 13:54 ` [PATCH " Jan Beulich
2026-09-30 13:56 ` Oleksii Kurochko
2026-10-01 7:41 ` Jan Beulich
2026-09-29 16:32 ` [PATCH v3 3/6] xen/riscv: fix A/D bit handling in G-stage mappings Baptiste Le Duc
2026-09-30 12:20 ` Jan Beulich
2026-09-30 13:53 ` Oleksii Kurochko
2026-09-30 13:58 ` Jan Beulich
2026-09-30 14:03 ` Oleksii Kurochko
2026-09-29 16:32 ` [PATCH v3 4/6] xen/riscv: fix A/D bits in Xen's page-table mappings Baptiste Le Duc
2026-09-30 12:23 ` Jan Beulich
2026-09-30 14:37 ` Oleksii Kurochko
2026-09-29 16:32 ` [PATCH v3 5/6] xen/riscv: use pte_is_valid() in pte_is_mapping() Baptiste Le Duc
2026-09-30 10:45 ` Oleksii Kurochko
2026-09-29 16:32 ` [PATCH v3 6/6] xen/riscv: make Zihintpause no longer a required extension Baptiste Le Duc
2026-09-30 10:43 ` Oleksii Kurochko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f94af4b-f122-46e0-bbc4-7fecd51d4348@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=baptiste.le-duc@vates.tech \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.