From: Joerg Roedel <[email protected]> The bitfield layout is shared with the global vcpu->common->requests field. A new flag will indicate in which bitmap the request will be set.
Signed-off-by: Joerg Roedel <[email protected]> --- include/linux/kvm_host.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 7704820986da..3c72a462ccfa 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -159,6 +159,7 @@ static inline bool kvm_is_error_gpa(gpa_t gpa) #define KVM_REQUEST_NO_WAKEUP BIT(8) #define KVM_REQUEST_WAIT BIT(9) #define KVM_REQUEST_NO_ACTION BIT(10) +#define KVM_REQUEST_PER_PLANE BIT(11) /* * Architecture-independent vcpu->requests bit members * Bits 3-7 are reserved for more arch-independent bits. @@ -184,6 +185,7 @@ static inline bool kvm_is_error_gpa(gpa_t gpa) (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ }) #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) +#define KVM_ARCH_PLANE_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, KVM_REQUEST_PER_PLANE) bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, unsigned long *vcpu_bitmap); @@ -371,6 +373,10 @@ struct kvm_vcpu { int sigset_active; sigset_t sigset; unsigned int halt_poll_ns; + + u64 plane_requests; + + /* S390 only */ bool valid_wakeup; #ifdef CONFIG_HAS_IOMEM @@ -2356,7 +2362,10 @@ static inline void __kvm_make_request(int req, struct kvm_vcpu *vcpu) * caller. Paired with the smp_mb__after_atomic in kvm_check_request. */ smp_wmb(); - set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); + if (req & KVM_REQUEST_PER_PLANE) + set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->plane_requests); + else + set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); } static __always_inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) @@ -2382,17 +2391,23 @@ static inline void kvm_make_request_and_kick(int req, struct kvm_vcpu *vcpu) static inline bool kvm_request_pending(struct kvm_vcpu *vcpu) { - return READ_ONCE(vcpu->common->requests); + return READ_ONCE(vcpu->common->requests) || READ_ONCE(vcpu->plane_requests); } static inline bool kvm_test_request(int req, struct kvm_vcpu *vcpu) { - return test_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); + if (req & KVM_REQUEST_PER_PLANE) + return test_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->plane_requests); + else + return test_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); } static inline void kvm_clear_request(int req, struct kvm_vcpu *vcpu) { - clear_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); + if (req & KVM_REQUEST_PER_PLANE) + clear_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->plane_requests); + else + clear_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->common->requests); } static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) -- 2.53.0
