From: Steffen Eiden <seiden@linux.ibm.com>
To: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
Fuad Tabba <fuad.tabba@linux.dev>,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Andreas Grapentin <gra@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
David Hildenbrand <david@kernel.org>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Friedrich Welter <fritz@linux.ibm.com>,
Gautam Gala <ggala@linux.ibm.com>,
Hariharan Mari <hari55@linux.ibm.com>,
Hendrik Brueckner <brueckner@linux.ibm.com>,
Nico Boehr <nrb@linux.ibm.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
Arnd Bergmann <arnd@arndb.de>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
linux-s390@vger.kernel.org, Steffen Eiden <seiden@linux.ibm.com>
Subject: [PATCH 02/12] arm64: Share timer and smccc functionality with s390
Date: Wed, 02 Dec 2026 15:11:40 +0100 [thread overview]
Message-ID: <20261202-smccc-v1-2-48340e2737b6@linux.ibm.com> (raw)
In-Reply-To: <20261202-smccc-v1-0-48340e2737b6@linux.ibm.com>
Share functions and definitions required to implement guest timers and
smccc.
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
---
arch/arm64/include/asm/kvm_emulate.h | 4 ++--
arch/arm64/include/asm/kvm_host.h | 36 ++++++++++++++++++++----------------
arch/arm64/include/asm/kvm_mmu.h | 2 ++
arch/arm64/include/asm/pvclock-abi.h | 1 +
4 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 9e75db26929c..71e4024825eb 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -546,13 +546,13 @@ static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu)
return esr_abt_is_write_fault(kvm_vcpu_get_esr(vcpu));
}
-#endif /* ARM64_S390_COMMON == 1 */
-
static inline unsigned long kvm_vcpu_get_mpidr_aff(struct kvm_vcpu *vcpu)
{
return __vcpu_sys_reg(vcpu, MPIDR_EL1) & MPIDR_HWID_BITMASK;
}
+#endif /* ARM64_S390_COMMON == 1 */
+
/* In nVHE hyp code, registers are always in memory: use the raw accessors. */
#if defined(__KVM_NVHE_HYPERVISOR__)
#define vcpu_read_sys_reg(v, r) __vcpu_sys_reg(v, r)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 5072de2ac8ce..4ed8c2bd2101 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -124,6 +124,20 @@ struct kvm_vm_id_regs {
u64 ctr_el0;
};
+/**
+ * struct kvm_smccc_features: Descriptor of the hypercall services exposed to the guests
+ *
+ * @std_bmap: Bitmap of standard secure service calls
+ * @std_hyp_bmap: Bitmap of standard hypervisor service calls
+ * @vendor_hyp_bmap: Bitmap of vendor specific hypervisor service calls
+ */
+struct kvm_smccc_features {
+ unsigned long std_bmap;
+ unsigned long std_hyp_bmap;
+ unsigned long vendor_hyp_bmap; /* Function numbers 0-63 */
+ unsigned long vendor_hyp_bmap_2; /* Function numbers 64-127 */
+};
+
#endif /* ARM64_S390_COMMON == 1 */
#define KVM_DIRTY_LOG_MANUAL_CAPS (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | \
@@ -354,20 +368,6 @@ struct kvm_s2_mmu {
struct kvm_arch_memory_slot {
};
-/**
- * struct kvm_smccc_features: Descriptor of the hypercall services exposed to the guests
- *
- * @std_bmap: Bitmap of standard secure service calls
- * @std_hyp_bmap: Bitmap of standard hypervisor service calls
- * @vendor_hyp_bmap: Bitmap of vendor specific hypervisor service calls
- */
-struct kvm_smccc_features {
- unsigned long std_bmap;
- unsigned long std_hyp_bmap;
- unsigned long vendor_hyp_bmap; /* Function numbers 0-63 */
- unsigned long vendor_hyp_bmap_2; /* Function numbers 64-127 */
-};
-
struct kvm_protected_vm {
pkvm_handle_t handle;
struct kvm_hyp_memcache stage2_teardown_mc;
@@ -381,6 +381,8 @@ struct kvm_protected_vm {
bool is_dying;
};
+#if ARM64_S390_COMMON == 1
+
struct kvm_mpidr_data {
u64 mpidr_mask;
DECLARE_FLEX_ARRAY(u16, cmpidr_to_idx);
@@ -398,6 +400,8 @@ static inline u16 kvm_mpidr_index(struct kvm_mpidr_data *data, u64 mpidr)
struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
+#endif /* ARM64_S390_COMMON == 1 */
+
struct kvm_sysreg_masks;
enum fgt_group_id {
@@ -1406,8 +1410,6 @@ unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len);
int kvm_handle_mmio_return(struct kvm_vcpu *vcpu);
int io_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa);
-#endif /* ARM64_S390_COMMON == 1 */
-
/*
* Returns true if a Performance Monitoring Interrupt (PMI), a.k.a. perf event,
* arrived in guest context. For arm64, any event that arrives while a vCPU is
@@ -1430,6 +1432,8 @@ int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
int kvm_arm_pvtime_has_attr(struct kvm_vcpu *vcpu,
struct kvm_device_attr *attr);
+#endif /* ARM64_S390_COMMON == 1 */
+
extern unsigned int __ro_after_init kvm_arm_vmid_bits;
int __init kvm_arm_vmid_alloc_init(void);
void __init kvm_arm_vmid_alloc_free(void);
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 32392abf2e21..7f11b7d76c82 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -297,6 +297,7 @@ static inline int kvm_read_guest_lock(struct kvm *kvm,
return ret;
}
+#if ARM64_S390_COMMON == 1
static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
const void *data, unsigned long len)
{
@@ -307,6 +308,7 @@ static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
return ret;
}
+#endif /* ARM64_S390_COMMON == 1 */
#define kvm_phys_to_vttbr(addr) phys_to_ttbr(addr)
diff --git a/arch/arm64/include/asm/pvclock-abi.h b/arch/arm64/include/asm/pvclock-abi.h
index c4f1c0a0789c..0e38e38fc804 100644
--- a/arch/arm64/include/asm/pvclock-abi.h
+++ b/arch/arm64/include/asm/pvclock-abi.h
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2019 Arm Ltd. */
+/* Whole file is shared with s390 */
#ifndef __ASM_PVCLOCK_ABI_H
#define __ASM_PVCLOCK_ABI_H
--
2.56.1
next prev parent reply other threads:[~2026-12-02 14:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 14:11 [PATCH 00/12] KVM: s390: arm64: SMCCC, timers and IRQ line Steffen Eiden
2026-12-02 14:11 ` [PATCH 01/12] arm64: Prepare for sharing with s390 Steffen Eiden
2026-12-02 14:11 ` Steffen Eiden [this message]
2026-12-02 14:11 ` [PATCH 03/12] KVM: arm64: Share timer and smccc code " Steffen Eiden
2026-12-02 14:11 ` [PATCH 04/12] KVM: s390: arm64: Use register shadow helper Steffen Eiden
2026-12-02 14:11 ` [PATCH 05/12] KVM: s390: arm64: Shadow the guest timer CVAL registers Steffen Eiden
2026-12-02 14:11 ` [PATCH 06/12] KVM: s390: arm64: Use mpstate for guests Steffen Eiden
2026-12-02 14:11 ` [PATCH 07/12] KVM: s390: arm64: Enable full smccc support Steffen Eiden
2026-12-02 14:11 ` [PATCH 08/12] KVM: s390: arm64: Report fwregs to userspace Steffen Eiden
2026-12-02 14:11 ` [PATCH 09/12] KVM: s390: arm64: Provide timer infrastructure Steffen Eiden
2026-12-02 14:11 ` [PATCH 10/12] KVM: s390: arm64: Integrate guest timer Steffen Eiden
2026-12-02 14:11 ` [PATCH 11/12] KVM: s390: arm64: Trap WFx Steffen Eiden
2026-12-02 14:11 ` [PATCH 12/12] KVM: s390: arm64: Add IRQ line Steffen Eiden
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=20261202-smccc-v1-2-48340e2737b6@linux.ibm.com \
--to=seiden@linux.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=brueckner@linux.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=frankja@linux.ibm.com \
--cc=fritz@linux.ibm.com \
--cc=fuad.tabba@linux.dev \
--cc=ggala@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gra@linux.ibm.com \
--cc=hari55@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=nrb@linux.ibm.com \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=svens@linux.ibm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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