Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754671AbbHNKLj (ORCPT ); Fri, 14 Aug 2015 06:11:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42165 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754494AbbHNKLg (ORCPT ); Fri, 14 Aug 2015 06:11:36 -0400 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, Paolo Bonzini , Christian Borntraeger Subject: [PATCH v3 1/5] KVM: add kvm_has_request wrapper Date: Fri, 14 Aug 2015 12:08:33 +0200 Message-Id: <1439546917-17391-2-git-send-email-rkrcmar@redhat.com> In-Reply-To: <1439546917-17391-1-git-send-email-rkrcmar@redhat.com> References: <1439546917-17391-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1705 Lines: 52 We want to have requests abstracted from bit operations. Acked-by: Christian Borntraeger Signed-off-by: Radim Krčmář --- v3: acked by Christian arch/x86/kvm/vmx.c | 2 +- include/linux/kvm_host.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 4cf25b90dbe0..40c6180a0ecb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -5809,7 +5809,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) if (intr_window_requested && vmx_interrupt_allowed(vcpu)) return handle_interrupt_window(&vmx->vcpu); - if (test_bit(KVM_REQ_EVENT, &vcpu->requests)) + if (kvm_has_request(KVM_REQ_EVENT, vcpu)) return 1; err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 27ccdf91a465..52e388367a26 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1089,9 +1089,14 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) set_bit(req, &vcpu->requests); } +static inline bool kvm_has_request(int req, struct kvm_vcpu *vcpu) +{ + return test_bit(req, &vcpu->requests); +} + static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) { - if (test_bit(req, &vcpu->requests)) { + if (kvm_has_request(req, vcpu)) { clear_bit(req, &vcpu->requests); return true; } else { -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/