Skip to content

Commit

Permalink
arm64: realm: Query IPA size from the RMM
Browse files Browse the repository at this point in the history
The top bit of the configured IPA size is used as an attribute to
control whether the address is protected or shared. Query the
configuration from the RMM to assertain which bit this is.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Co-developed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://lore.kernel.org/r/20241017131434.40935-4-steven.price@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Steven Price authored and Catalin Marinas committed Oct 23, 2024
1 parent c077711 commit 3993069
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm64/include/asm/pgtable-prot.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@

#include <asm/cpufeature.h>
#include <asm/pgtable-types.h>
#include <asm/rsi.h>

extern bool arm64_use_ng_mappings;
extern unsigned long prot_ns_shared;

#define PROT_NS_SHARED (is_realm_world() ? prot_ns_shared : 0)

#define PTE_MAYBE_NG (arm64_use_ng_mappings ? PTE_NG : 0)
#define PMD_MAYBE_NG (arm64_use_ng_mappings ? PMD_SECT_NG : 0)
Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/kernel/rsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include <linux/psci.h>
#include <asm/rsi.h>

static struct realm_config config;

unsigned long prot_ns_shared;
EXPORT_SYMBOL(prot_ns_shared);

DEFINE_STATIC_KEY_FALSE_RO(rsi_present);
EXPORT_SYMBOL(rsi_present);

Expand Down Expand Up @@ -68,6 +73,9 @@ void __init arm64_rsi_init(void)
return;
if (!rsi_version_matches())
return;
if (WARN_ON(rsi_get_realm_config(&config)))
return;
prot_ns_shared = BIT(config.ipa_bits - 1);

arm64_rsi_setup_memory();

Expand Down

0 comments on commit 3993069

Please sign in to comment.