mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
	linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, maz@kernel.org,
	linux-kernel@vger.kernel.org, aneesh.kumar@kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH] arm64: realm: Fix PTE_NS_SHARED for 52bit PA support
Date: Wed, 18 Mar 2026 11:36:50 +0000	[thread overview]
Message-ID: <ea827ef4-3a40-4242-adcd-790a11659493@arm.com> (raw)
In-Reply-To: <20260316161901.2410354-1-suzuki.poulose@arm.com>

On 16/03/2026 16:19, Suzuki K Poulose wrote:
> With LPA/LPA2, the top bits of the PFN (Bits[51:48]) end up in the lower bits
> of the PTE. So, simply creating a mask of the "top IPA bit" doesn't work well
> for these configurations to set the "top" bit at the output of Stage1
> translation.
> 
> Fix this by using the __phys_to_pte_val() to do the right thing for all
> configurations.
> 
> Tested using, kvmtool, placing the memory at a higher address (-m <size>@<Addr>).
> 
>  e.g:
>  # lkvm run --realm -c 4 -m 512M@@128T -k Image --console serial
> 
>  sh-5.0# dmesg | grep "LPA2\|RSI"
> [    0.000000] RME: Using RSI version 1.0
> [    0.000000] CPU features: detected: 52-bit Virtual Addressing (LPA2)
> [    0.777354] CPU features: detected: 52-bit Virtual Addressing for KVM (LPA2)
> 
> Fixes: 399306954996 ("arm64: realm: Query IPA size from the RMM")
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Steven Price <steven.price@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  arch/arm64/kernel/rsi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c
> index c64a06f58c0b..9e846ce4ef9c 100644
> --- a/arch/arm64/kernel/rsi.c
> +++ b/arch/arm64/kernel/rsi.c
> @@ -12,6 +12,7 @@
>  
>  #include <asm/io.h>
>  #include <asm/mem_encrypt.h>
> +#include <asm/pgtable.h>
>  #include <asm/rsi.h>
>  
>  static struct realm_config config;
> @@ -146,7 +147,7 @@ void __init arm64_rsi_init(void)
>  		return;
>  	if (WARN_ON(rsi_get_realm_config(&config)))
>  		return;
> -	prot_ns_shared = BIT(config.ipa_bits - 1);
> +	prot_ns_shared = __phys_to_pte_val(BIT(config.ipa_bits - 1));
>  
>  	if (arm64_ioremap_prot_hook_register(realm_ioremap_hook))
>  		return;


  parent reply	other threads:[~2026-03-18 11:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 16:19 Suzuki K Poulose
2026-03-16 17:54 ` Catalin Marinas
2026-03-18 11:36 ` Steven Price [this message]
2026-03-19 13:48 ` Will Deacon

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=ea827ef4-3a40-4242-adcd-790a11659493@arm.com \
    --to=steven.price@arm.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®