From patchwork Tue May 6 00:40:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 4118431 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 14A749F1E1 for ; Tue, 6 May 2014 00:41:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B1972017E for ; Tue, 6 May 2014 00:41:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AC032017D for ; Tue, 6 May 2014 00:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933511AbaEFAlQ (ORCPT ); Mon, 5 May 2014 20:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21673 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933005AbaEFAlO (ORCPT ); Mon, 5 May 2014 20:41:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s460fCNU019104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 5 May 2014 20:41:12 -0400 Received: from nelium.bos.redhat.com ([10.18.25.173]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s460f8xd013853; Mon, 5 May 2014 20:41:12 -0400 From: Bandan Das To: kvm@vger.kernel.org Cc: Paolo Bonzini , Marcelo Tosatti , Gleb Natapov , linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/3] KVM: x86: pass ctxt to fetch helper function Date: Mon, 5 May 2014 20:40:57 -0400 Message-Id: <1399336859-7227-2-git-send-email-bsd@redhat.com> In-Reply-To: <1399336859-7227-1-git-send-email-bsd@redhat.com> References: <1399336859-7227-1-git-send-email-bsd@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the following patches, our adress caching struct that's embedded within struct x86_emulate_ctxt will need to be accessed Signed-off-by: Bandan Das --- arch/x86/kvm/x86.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 122410d..17e3d661 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4061,10 +4061,11 @@ gpa_t kvm_mmu_gva_to_gpa_system(struct kvm_vcpu *vcpu, gva_t gva, } static int kvm_read_guest_virt_helper(gva_t addr, void *val, unsigned int bytes, - struct kvm_vcpu *vcpu, u32 access, + struct x86_emulate_ctxt *ctxt, u32 access, struct x86_exception *exception) { void *data = val; + struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); int r = X86EMUL_CONTINUE; while (bytes) { @@ -4098,7 +4099,7 @@ static int kvm_fetch_guest_virt(struct x86_emulate_ctxt *ctxt, struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; - return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, + return kvm_read_guest_virt_helper(addr, val, bytes, ctxt, access | PFERR_FETCH_MASK, exception); } @@ -4110,7 +4111,7 @@ int kvm_read_guest_virt(struct x86_emulate_ctxt *ctxt, struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; - return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, + return kvm_read_guest_virt_helper(addr, val, bytes, ctxt, access, exception); } EXPORT_SYMBOL_GPL(kvm_read_guest_virt); @@ -4119,8 +4120,7 @@ static int kvm_read_guest_virt_system(struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes, struct x86_exception *exception) { - struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); - return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, 0, exception); + return kvm_read_guest_virt_helper(addr, val, bytes, ctxt, 0, exception); } int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,