On 19 July 2018 at 15:15, James Morse <james.morse@xxxxxxx> wrote: > Hi guys, > > On 19/07/18 10:29, gengdongjiu wrote: >> On 2018/7/19 17:10, Peter Maydell wrote: >>>> The user space will firstly check the KVM_CAP_VCPU_EVENTS through kvm_has_vcpu_events() to know whether KVM can support get/set vcpu events, >>>> If KVM supports get/set vcpu events, it will check KVM_CAP_ARM_SET_SERROR_ESR to know whether can set guest SError ESR, as shown the user space code in [1]. >>> OK, so this capability affects the behaviour of >>> KVM_SET_VCPU_EVENTS. Can you make sure the documentation >>> of KVM_SET_VCPU_EVENTS clearly explains what happens >>> and the effect of whether this capability is present, >>> please? People trying to understand the behaviour of >>> that ioctl are not going to know that they need to >>> look here as well. > >> sure, I will. Thanks peter's reminder and comments. > > I've collected these changes, this description currently reads: > ------------------%<------------------ > This capability indicates that userspace can specify the syndrome value reported > to the guest when it takes a virtual SError interrupt exception. Perhaps "specify (via the KVM_SET_VCPU_EVENTS ioctl)" ? > If KVM advertises this capability, userspace can only specify the ISS field for > the ESR syndrome. Other parts of the ESR, such as the EC are generated by the > CPU when the exception is taken. If this virtual SError is taken to EL1 using > AArch64, this value will be reported in the ISS field of ESR_ELx. > > See KVM_CAP_VCPU_EVENTS for more details. > ------------------%<------------------ > > and this patch adds to the GET/SET API section with: > ------------------%<------------------ > SError exceptions always have an ESR value. Some CPUs have the ability to > specify what the virtual SError's ESR value should be. These systems will > advertise KVM_CAP_ARM_SET_SERROR_ESR. In this case exception.has_esr will > always have a non-zero value when read, and the agent making an SError > pending should specify the ISS field in the lower 24 bits of > exception.serror_esr. If the system supports KVM_CAP_ARM_SET_SERROR_ESR, but > user-space sets the events with exception.has_esr as zero, KVM will choose an ESR. > > Specifying exception.has_esr on a system that does not support it will return an > error. Settings anything other than the lower 24bits of exception.serror_esr "Setting" > will return an error. I think you should state which error (presumably EINVAL?) > ------------------%<------------------ > > because as Peter points out, this is where people will expect to find this. thanks -- PMM