Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1887041pxv; Fri, 2 Jul 2021 15:11:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN4EAgSofSuWHiHSdCXTNEk3nRFGjhlNJ2zzRBgHkclqkuKiK3zSPSQsSRzY4TSsPvCU7p X-Received: by 2002:a17:906:2642:: with SMTP id i2mr1899874ejc.323.1625263883594; Fri, 02 Jul 2021 15:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625263883; cv=none; d=google.com; s=arc-20160816; b=NKiHIIpjRMQZLE756szvy2zoeDDoKnkiSfRiP161hsy7p3chuRmek6m6aikh4dNQKk jQ/I61i0y/WW5kJyshm/rCTIdFO7t3G35oAZKvC0eno/xz+RNaPwn38P21N22mKYD/3r oYrsD3qxRiFuUJZlaLq4jw2OjqKlGIosifgmgTf3N94HtAzPosvDNUaKl98f3Xjtcpfv gBla+VXNfLgxMHLAaV4PT4dM06qtXF/yba1wvvWmQL32XVRRlK47f2sDA1T4QTvi5sSZ hWHZPp4wCRQ8aD/TChlwFXXTZ+w5rC8YMnLzDHQ5lHmL0e+8LJYF3gcKZT2yCM9eXTXd Fs1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Pge3Waw5lPE24/PgBSSRhJErPkomhG6CRdLYh7ybyqQ=; b=bxaubW35VcoPx0eIPySscbGu+bSZnymfK5ylV3uNEFGaI6KXrXljdgUr+Ybbba3Lok 9Hr7T5FMUPfeB5cDjw5w6yDl4qmYB6mwmPVrXUwd1UMurLtkYHaKtRxjN68LzRcf1pbI kn4MU0vT+HiXYXnSfPn5/HachMMd949XBjKzbDjAHMBYPKDYqZurW6wp07qeBIuAo4S/ PuIkCV56IjU/gf+V4S2CtRCcVGQQP7WE/Yh9VL8rAIg1kt70E4NQhJeV+fl8yR2TRiYU SoPyw5Qww/glmbHjXbrebwvZW841asTZhJpL1UgRSyaSt531mHSsoCyTqhEHGorKaJoi y1YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs30si4951891ejc.14.2021.07.02.15.11.01; Fri, 02 Jul 2021 15:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbhGBWKQ (ORCPT + 99 others); Fri, 2 Jul 2021 18:10:16 -0400 Received: from mga17.intel.com ([192.55.52.151]:15304 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbhGBWIn (ORCPT ); Fri, 2 Jul 2021 18:08:43 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10033"; a="189168409" X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="189168409" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:31 -0700 X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="642814887" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:31 -0700 From: isaku.yamahata@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Sean Christopherson Subject: [RFC PATCH v2 62/69] KVM: VMX: MOVE GDT and IDT accessors to common code Date: Fri, 2 Jul 2021 15:05:08 -0700 Message-Id: <461baaa98c6b8c324ee297b76717d623d92bc510.1625186503.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/main.c | 6 ++++-- arch/x86/kvm/vmx/vmx.c | 12 ------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index b619615f77de..8e03cb72b910 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -311,7 +311,8 @@ static int vt_set_efer(struct kvm_vcpu *vcpu, u64 efer) static void vt_get_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) { - vmx_get_idt(vcpu, dt); + dt->size = vmread32(vcpu, GUEST_IDTR_LIMIT); + dt->address = vmreadl(vcpu, GUEST_IDTR_BASE); } static void vt_set_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) @@ -321,7 +322,8 @@ static void vt_set_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) static void vt_get_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) { - vmx_get_gdt(vcpu, dt); + dt->size = vmread32(vcpu, GUEST_GDTR_LIMIT); + dt->address = vmreadl(vcpu, GUEST_GDTR_BASE); } static void vt_set_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 40843ca2fb33..d69d4dc7c071 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3302,24 +3302,12 @@ static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) *l = (ar >> 13) & 1; } -static void vmx_get_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) -{ - dt->size = vmcs_read32(GUEST_IDTR_LIMIT); - dt->address = vmcs_readl(GUEST_IDTR_BASE); -} - static void vmx_set_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) { vmcs_write32(GUEST_IDTR_LIMIT, dt->size); vmcs_writel(GUEST_IDTR_BASE, dt->address); } -static void vmx_get_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) -{ - dt->size = vmcs_read32(GUEST_GDTR_LIMIT); - dt->address = vmcs_readl(GUEST_GDTR_BASE); -} - static void vmx_set_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) { vmcs_write32(GUEST_GDTR_LIMIT, dt->size); -- 2.25.1