LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v10 0/5] set VSESR_EL2 by user space and support NOTIFY_SEI notification
@ 2018-03-03 16:09 Dongjiu Geng
  2018-03-03 16:09 ` [PATCH v10 1/5] arm64: KVM: Prepare set virtual SEI syndrome value Dongjiu Geng
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Dongjiu Geng @ 2018-03-03 16:09 UTC (permalink / raw)
  To: rkrcmar, corbet, christoffer.dall, marc.zyngier, james.morse,
	linux, catalin.marinas, rjw, bp, lenb, kvm, linux-doc,
	linux-kernel, linux-arm-kernel, kvmarm, linux-acpi, devel
  Cc: gengdongjiu, huangshaoyu

1. Detect whether KVM can set set guest SError syndrome
2. Support to Set VSESR_EL2 and inject SError by user space.
3. Support live migration to keep SError pending state and VSESR_EL2 value.
4. ACPI 6.1 adds support for NOTIFY_SEI as a GHES notification mechanism, so support this
   notification in software, KVM or kernel ARCH code call handle_guest_sei() to let ACP driver
   to handle this notification.

Dongjiu Geng (5):
  arm64: KVM: Prepare set virtual SEI syndrome value
  arm64: KVM: export the capability to set guest SError syndrome
  arm/arm64: KVM: Introduce set and get per-vcpu event
  ACPI / APEI: Add SEI notification type support for ARMv8
  arm64: handle NOTIFY_SEI notification by the APEI driver

 Documentation/virtual/kvm/api.txt    | 37 +++++++++++++++++++++++--
 arch/arm/include/asm/kvm_host.h      |  6 ++++
 arch/arm/kvm/guest.c                 | 12 ++++++++
 arch/arm64/include/asm/kvm_emulate.h |  5 ++++
 arch/arm64/include/asm/kvm_host.h    |  7 +++++
 arch/arm64/include/asm/system_misc.h |  1 +
 arch/arm64/include/uapi/asm/kvm.h    | 10 +++++++
 arch/arm64/kernel/traps.c            |  4 +++
 arch/arm64/kvm/guest.c               | 26 ++++++++++++++++++
 arch/arm64/kvm/inject_fault.c        |  5 ++++
 arch/arm64/kvm/reset.c               |  4 +++
 arch/arm64/mm/fault.c                | 10 +++++++
 drivers/acpi/apei/Kconfig            | 15 ++++++++++
 drivers/acpi/apei/ghes.c             | 53 ++++++++++++++++++++++++++++++++++++
 include/acpi/ghes.h                  |  1 +
 include/uapi/linux/kvm.h             |  1 +
 virt/kvm/arm/arm.c                   | 18 ++++++++++++
 17 files changed, 213 insertions(+), 2 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome
@ 2018-03-18  7:33 gengdongjiu
  0 siblings, 0 replies; 11+ messages in thread
From: gengdongjiu @ 2018-03-18  7:33 UTC (permalink / raw)
  To: James Morse
  Cc: rkrcmar, corbet, christoffer.dall, marc.zyngier, linux,
	catalin.marinas, rjw, bp, lenb, kvm, linux-doc, linux-kernel,
	linux-arm-kernel, kvmarm, linux-acpi, devel, Huangshaoyu (Shawn),
	Wuquanming

Hi James,
   Thanks for your time to review and give comments.

[...]
> > +
> > +8.14 KVM_CAP_ARM_SET_SERROR_ESR
> > +
> > +Architectures: arm, arm64
> > +
> > +This capability indicates that userspace can specify syndrome value
> > +reported to guest OS when guest takes a virtual SError interrupt exception.
> 
> "when userspace triggers a virtual SError"... how?

In the user space(QEMU), it will call kvm_arch_put_registers() or kvm_arch_get_registers() to set or get KVM registers through KVM_SET_ONE_REG/ KVM_GET_ONE_REG IOCTL, at the same time the two functions will separately call kvm_arm_vcpu_get_events() and kvm_arm_vcpu_set_events() to get/set vcpu events. If user space want to trigger a virtual SError with specified ESR, it only need to setup the kvm_vcpu_events struct(exception.serror_pending = 1; exception.serror_has_esr=1; serror_esr=xxxxx), then KVM will trigger this virtual SError.

userspace can trigger it at any time, for example, for debug purpose.  Or simulate a SError after recording a CPER for guest. But before triggering a virtual SError, it needs to know whether KVM has such capability, so KVM needs to export this capability to user space. If has this capability, User space will call kvm_arm_vcpu_set_events() to trigger a virtual SError.

> 
> 
> > +If KVM has this capability, userspace can only specify the ISS field
> > +for the ESR syndrome, can not specify the EC field which is not under control by KVM.
> 
> Where do I put the ESR?
> If you re-order this after the patch that adds the API, you can describe how this can be used.

Ok, thank a lot for your suggestion.

> 
> 
> Thanks,
> 
> James
> 
> 
> 
> > +If this virtual SError is taken to EL1 using AArch64, this value will
> > +be reported into ISS filed of ESR_EL1.
> > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index
> > 3256b92..38c8a64 100644
> > --- a/arch/arm64/kvm/reset.c
> > +++ b/arch/arm64/kvm/reset.c
> > @@ -77,6 +77,9 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext)
> >  	case KVM_CAP_ARM_PMU_V3:
> >  		r = kvm_arm_support_pmu_v3();
> >  		break;
> > +	case KVM_CAP_ARM_INJECT_SERROR_ESR:
> > +		r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
> > +		break;
> >  	case KVM_CAP_SET_GUEST_DEBUG:
> >  	case KVM_CAP_VCPU_ATTRIBUTES:
> >  		r = 1;
> > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index
> > 8fb90a0..3587b33 100644
> > --- a/include/uapi/linux/kvm.h
> > +++ b/include/uapi/linux/kvm.h
> > @@ -934,6 +934,7 @@ struct kvm_ppc_resize_hpt {  #define
> > KVM_CAP_S390_AIS_MIGRATION 150  #define KVM_CAP_PPC_GET_CPU_CHAR 151
> > #define KVM_CAP_S390_BPB 152
> > +#define KVM_CAP_ARM_INJECT_SERROR_ESR 153
> >
> >  #ifdef KVM_CAP_IRQ_ROUTING
> >
> >

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-18  7:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-03 16:09 [PATCH v10 0/5] set VSESR_EL2 by user space and support NOTIFY_SEI notification Dongjiu Geng
2018-03-03 16:09 ` [PATCH v10 1/5] arm64: KVM: Prepare set virtual SEI syndrome value Dongjiu Geng
2018-03-15 20:37   ` James Morse
2018-03-16  7:58     ` gengdongjiu
2018-03-03 16:09 ` [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome Dongjiu Geng
2018-03-15 20:39   ` James Morse
2018-03-03 16:09 ` [PATCH v10 3/5] arm/arm64: KVM: Introduce set and get per-vcpu event Dongjiu Geng
2018-03-15 20:38   ` James Morse
2018-03-03 16:09 ` [PATCH v10 4/5] ACPI / APEI: Add SEI notification type support for ARMv8 Dongjiu Geng
2018-03-03 16:09 ` [PATCH v10 5/5] arm64: handle NOTIFY_SEI notification by the APEI driver Dongjiu Geng
2018-03-18  7:33 [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome gengdongjiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).