Skip to content

Commit be26b3a

Browse files
gengdongjiu1Marc Zyngier
authored andcommitted
arm64: KVM: export the capability to set guest SError syndrome
For the arm64 RAS Extension, user space can inject a virtual-SError with specified ESR. So user space needs to know whether KVM support to inject such SError, this interface adds this query for this capability. KVM will check whether system support RAS Extension, if supported, KVM returns true to user space, otherwise returns false. Signed-off-by: Dongjiu Geng <[email protected]> Reviewed-by: James Morse <[email protected]> [expanded documentation wording] Signed-off-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent b7b27fa commit be26b3a

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Documentation/virtual/kvm/api.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,18 @@ SError is pending, the architecture's 'Multiple SError interrupts' rules should
907907
be followed. (2.5.3 of DDI0587.a "ARM Reliability, Availability, and
908908
Serviceability (RAS) Specification").
909909

910+
SError exceptions always have an ESR value. Some CPUs have the ability to
911+
specify what the virtual SError's ESR value should be. These systems will
912+
advertise KVM_CAP_ARM_SET_SERROR_ESR. In this case exception.has_esr will
913+
always have a non-zero value when read, and the agent making an SError pending
914+
should specify the ISS field in the lower 24 bits of exception.serror_esr. If
915+
the system supports KVM_CAP_ARM_SET_SERROR_ESR, but user-space sets the events
916+
with exception.has_esr as zero, KVM will choose an ESR.
917+
918+
Specifying exception.has_esr on a system that does not support it will return
919+
-EINVAL. Setting anything other than the lower 24bits of exception.serror_esr
920+
will return -EINVAL.
921+
910922
struct kvm_vcpu_events {
911923
struct {
912924
__u8 serror_pending;
@@ -4664,3 +4676,17 @@ This capability indicates that KVM supports paravirtualized Hyper-V TLB Flush
46644676
hypercalls:
46654677
HvFlushVirtualAddressSpace, HvFlushVirtualAddressSpaceEx,
46664678
HvFlushVirtualAddressList, HvFlushVirtualAddressListEx.
4679+
4680+
8.19 KVM_CAP_ARM_SET_SERROR_ESR
4681+
4682+
Architectures: arm, arm64
4683+
4684+
This capability indicates that userspace can specify (via the
4685+
KVM_SET_VCPU_EVENTS ioctl) the syndrome value reported to the guest when it
4686+
takes a virtual SError interrupt exception.
4687+
If KVM advertises this capability, userspace can only specify the ISS field for
4688+
the ESR syndrome. Other parts of the ESR, such as the EC are generated by the
4689+
CPU when the exception is taken. If this virtual SError is taken to EL1 using
4690+
AArch64, this value will be reported in the ISS field of ESR_ELx.
4691+
4692+
See KVM_CAP_VCPU_EVENTS for more details.

arch/arm64/kvm/reset.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext)
7777
case KVM_CAP_ARM_PMU_V3:
7878
r = kvm_arm_support_pmu_v3();
7979
break;
80+
case KVM_CAP_ARM_INJECT_SERROR_ESR:
81+
r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
82+
break;
8083
case KVM_CAP_SET_GUEST_DEBUG:
8184
case KVM_CAP_VCPU_ATTRIBUTES:
8285
case KVM_CAP_VCPU_EVENTS:

include/uapi/linux/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ struct kvm_ppc_resize_hpt {
949949
#define KVM_CAP_GET_MSR_FEATURES 153
950950
#define KVM_CAP_HYPERV_EVENTFD 154
951951
#define KVM_CAP_HYPERV_TLBFLUSH 155
952+
#define KVM_CAP_ARM_INJECT_SERROR_ESR 156
952953

953954
#ifdef KVM_CAP_IRQ_ROUTING
954955

0 commit comments

Comments
 (0)