From: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
linux-coco@lists.linux.dev
Cc: Catalin Marinas <catalin.marinas@arm.com>,
will@kernel.org, maz@kernel.org, tglx@linutronix.de,
robin.murphy@arm.com, suzuki.poulose@arm.com,
akpm@linux-foundation.org, jgg@ziepe.ca, steven.price@arm.com,
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
Subject: [PATCH v2 3/4] coco: host: arm64: Handle hostconf RHI calls in kernel
Date: Sun, 21 Dec 2025 21:39:19 +0530 [thread overview]
Message-ID: <20251221160920.297689-4-aneesh.kumar@kernel.org> (raw)
In-Reply-To: <20251221160920.297689-1-aneesh.kumar@kernel.org>
- Mark hostconf RHI SMC IDs as handled in the SMCCC filter.
- Return version/features plus PAGE_SIZE alignment for guest queries.
- Drop the 4K page-size guard in RMI init now that realm can query IPA
change alignment size via the hostconf RHI
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
---
arch/arm64/kvm/hypercalls.c | 23 ++++++++++++++++++++++-
arch/arm64/kvm/rmi.c | 4 ----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
index 70ac7971416c..2861ca9063dd 100644
--- a/arch/arm64/kvm/hypercalls.c
+++ b/arch/arm64/kvm/hypercalls.c
@@ -8,6 +8,7 @@
#include <kvm/arm_hypercalls.h>
#include <kvm/arm_psci.h>
+#include <asm/rhi.h>
#define KVM_ARM_SMCCC_STD_FEATURES \
GENMASK(KVM_REG_ARM_STD_BMAP_BIT_COUNT - 1, 0)
@@ -77,6 +78,9 @@ static bool kvm_smccc_default_allowed(u32 func_id)
*/
case ARM_SMCCC_VERSION_FUNC_ID:
case ARM_SMCCC_ARCH_FEATURES_FUNC_ID:
+ case RHI_HOSTCONF_VERSION:
+ case RHI_HOSTCONF_FEATURES:
+ case RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT:
return true;
default:
/* PSCI 0.2 and up is in the 0:0x1f range */
@@ -157,7 +161,15 @@ static int kvm_smccc_filter_insert_reserved(struct kvm *kvm)
GFP_KERNEL_ACCOUNT);
if (r)
goto out_destroy;
-
+ /*
+ * Don't forward RHI_HOST_CONF related RHI calls
+ */
+ r = mtree_insert_range(&kvm->arch.smccc_filter,
+ RHI_HOSTCONF_VERSION, RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT,
+ xa_mk_value(KVM_SMCCC_FILTER_HANDLE),
+ GFP_KERNEL_ACCOUNT);
+ if (r)
+ goto out_destroy;
return 0;
out_destroy:
mtree_destroy(&kvm->arch.smccc_filter);
@@ -376,6 +388,15 @@ int kvm_smccc_call_handler(struct kvm_vcpu *vcpu)
case ARM_SMCCC_TRNG_RND32:
case ARM_SMCCC_TRNG_RND64:
return kvm_trng_call(vcpu);
+ case RHI_HOSTCONF_VERSION:
+ val[0] = RHI_HOSTCONF_VER_1_0;
+ break;
+ case RHI_HOSTCONF_FEATURES:
+ val[0] = __RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT;
+ break;
+ case RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT:
+ val[0] = PAGE_SIZE;
+ break;
default:
return kvm_psci_call(vcpu);
}
diff --git a/arch/arm64/kvm/rmi.c b/arch/arm64/kvm/rmi.c
index 9957a71d21b1..bd345e051a24 100644
--- a/arch/arm64/kvm/rmi.c
+++ b/arch/arm64/kvm/rmi.c
@@ -1935,10 +1935,6 @@ EXPORT_SYMBOL_GPL(kvm_has_da_feature);
void kvm_init_rmi(void)
{
- /* Only 4k page size on the host is supported */
- if (PAGE_SIZE != SZ_4K)
- return;
-
/* Continue without realm support if we can't agree on a version */
if (rmi_check_version())
return;
--
2.43.0
next prev parent reply other threads:[~2025-12-21 16:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-21 16:09 [PATCH v2 0/4] Enforce host page-size alignment for shared buffers Aneesh Kumar K.V (Arm)
2025-12-21 16:09 ` [PATCH v2 1/4] swiotlb: dma: its: " Aneesh Kumar K.V (Arm)
2025-12-22 14:49 ` Steven Price
2025-12-22 15:42 ` Aneesh Kumar K.V
2026-01-06 1:16 ` Jason Gunthorpe
2026-01-06 6:37 ` Aneesh Kumar K.V
2025-12-21 16:09 ` [PATCH v2 2/4] coco: guest: arm64: Fetch host IPA change alignment via RHI hostconf Aneesh Kumar K.V (Arm)
2025-12-21 16:09 ` Aneesh Kumar K.V (Arm) [this message]
2025-12-21 20:10 ` [PATCH v2 3/4] coco: host: arm64: Handle hostconf RHI calls in kernel Suzuki K Poulose
2025-12-22 14:37 ` Aneesh Kumar K.V
2025-12-23 19:56 ` Suzuki K Poulose
2025-12-21 16:09 ` [PATCH v2 4/4] dma: direct: set decrypted flag for remapped dma allocations Aneesh Kumar K.V (Arm)
2025-12-22 15:05 ` Suzuki K Poulose
2025-12-23 8:18 ` Aneesh Kumar K.V
2025-12-26 8:59 ` Aneesh Kumar K.V
2026-03-11 12:24 ` Mostafa Saleh
2026-01-06 1:11 ` [PATCH v2 0/4] Enforce host page-size alignment for shared buffers Jason Gunthorpe
2026-01-06 6:39 ` Aneesh Kumar K.V
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=20251221160920.297689-4-aneesh.kumar@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=robin.murphy@arm.com \
--cc=steven.price@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--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 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.