Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1797315pxy; Fri, 23 Apr 2021 17:59:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLUouCiSaPLGIDLenmwQ3AA8KuuCG4T+t1j170OTbcU8x+KPVXGBkQ/32QS3/Cw6htdse8 X-Received: by 2002:aa7:cfd8:: with SMTP id r24mr7534050edy.346.1619225948777; Fri, 23 Apr 2021 17:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619225948; cv=none; d=google.com; s=arc-20160816; b=GXaC7HJUFRsROTQq1ygt6pdq2cjZVTxhv/2kfGFA3/4Ws4gR484kZj8oDin9UG2IQb aR4X5xSM1Q/u4q3C1OA26dleWU+cwqiOGJU/HmpscPppP7Tq1TorfmY6jqqc3nFoB8fv O9+MjM1YiYGxrf4T1+6VXtDQL0n0hH1JDYUrqtplkR1ihMHekOEDaNKIk83j52PPbHIz 2e0//QwwXAtiuZaWi5k9jOtBhQmhCRPqKcSlppmbdaAjiFZf5/FCidttZW37wfwZq1aw LDh6lb22Wf8veiryGs5EljutiQBnYbnoF6kfpo/RMenLIvk0C4lT7TY651Y8tTvzf6ny VylA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=RNPvYWQZyWoudwJX+eiT9Tudy0ylNLdSxXPRHk/Dbl0=; b=wzCVybl6VWPk39f0wG6ILbqtOFz9hOmQ/Clsz5cLqN0jVGkX6q8W8j1IqIgSqcBrQA vpI39g6bXcQh6kqcjjDpy86RBAmWH/SHq61gNnIebRbO70bP3bqCSpdidRpCdqLF1Gc2 cd0oBX8tnV85j+p1SJZQCBtjS5eYq4kU+IVQRYVj/1VbCuWhUsD7CDoWw4SAU/rgvfP9 245TW42UZfl6RWmXOEqRg2RwjWo/TEKovyneP+8iIQUk0sj17Qq+ea52TSc0gulpmcd7 anovuwJuaGzdrZeCK+rpP9pL8ahzZnYcbzN8dLiVp6qjzChLNWz81anj/OXqHcFAD4ok 7P0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gvCmi5O1; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp39si6205552ejc.182.2021.04.23.17.58.45; Fri, 23 Apr 2021 17:59:08 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=gvCmi5O1; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244374AbhDXA4J (ORCPT + 99 others); Fri, 23 Apr 2021 20:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244714AbhDXAy1 (ORCPT ); Fri, 23 Apr 2021 20:54:27 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60EFCC0612B2 for ; Fri, 23 Apr 2021 17:48:34 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id e65-20020a25e7440000b02904ecfeff1ed8so14911282ybh.19 for ; Fri, 23 Apr 2021 17:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=RNPvYWQZyWoudwJX+eiT9Tudy0ylNLdSxXPRHk/Dbl0=; b=gvCmi5O1ZkvTuWybFhyFe2JFoeB2S3lx+dxD9bnbYmI4BtiRAXulvIvRLIb/qhztor XYM3ah8EuggNJMBqkEnOL8z5JU/JkV2e/WvUsByF8YMjiUXz5S8gnKAXCrW/d80N83TJ 0BP/p3Mj205ml68DMUpifOGSSzKtHocxUkiCu9CEMeDxpI9BuX7UDxqCM0GZ2GNzt8e/ P6EzLZVEZo/hKCEiygpszaZOUJ09Irn1sK9cGRfSqlPPka0isWhzrjORHmp/9fCBgpFU Jve999MtScRsD+38Bw7QbC9XSNrL5P45NGUxOAGgy7bc4Q0JFgXkDgNcCWjNPSTkzJDQ VMbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=RNPvYWQZyWoudwJX+eiT9Tudy0ylNLdSxXPRHk/Dbl0=; b=FxgMDXCtjjthA7xiE8A7FKUeW2Ty7AwNYNCn96l9TwPZORUlBJmg2RwFE0h3Uc0whK 6B58CWMfHWRjWxBzZpI0fJcMbkM5Z5wby5javRi5mMy5xAf8gNVq67G7JfBxOsfo6JeZ GCd9bOUJsYCooGRWdWDOexLcq7xpTA/1tozIYXR579IrdOGFN7r46JUby4huzgvnKJy7 WKvD7le30Urzc8Yl8T/L6pCOlOhM+Wu2H40/QIMyJx7+wxEDmBV/raqr73dOeaUWywNc rbDundhZJeG3AfioanUqoxg2KNVHf5g36OVJ0udAkF7HU5j662hOb4Mo0DHIVnJ72rBU 3bvQ== X-Gm-Message-State: AOAM533z2EMKyoLFVO+S7kvaQL9YTjiZZhyul6dAZMcfvGJhJ9xjeJCU scjK3vc5Uw8Ak9NmXaDHUGxT+gAEekU= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:ad52:3246:e190:f070]) (user=seanjc job=sendgmr) by 2002:a25:cfca:: with SMTP id f193mr9202657ybg.44.1619225313306; Fri, 23 Apr 2021 17:48:33 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 23 Apr 2021 17:46:44 -0700 In-Reply-To: <20210424004645.3950558-1-seanjc@google.com> Message-Id: <20210424004645.3950558-43-seanjc@google.com> Mime-Version: 1.0 References: <20210424004645.3950558-1-seanjc@google.com> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog Subject: [PATCH 42/43] KVM: VMX: Drop VMWRITEs to zero fields at vCPU RESET From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't waste time writing zeros via VMWRITE during vCPU RESET, the VMCS is zero allocated. No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/vmx.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 78d17adce7e6..74258ba4832a 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4427,13 +4427,6 @@ static void init_vmcs(struct vcpu_vmx *vmx) } if (kvm_vcpu_apicv_active(&vmx->vcpu)) { - vmcs_write64(EOI_EXIT_BITMAP0, 0); - vmcs_write64(EOI_EXIT_BITMAP1, 0); - vmcs_write64(EOI_EXIT_BITMAP2, 0); - vmcs_write64(EOI_EXIT_BITMAP3, 0); - - vmcs_write16(GUEST_INTR_STATUS, 0); - vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR); vmcs_write64(POSTED_INTR_DESC_ADDR, __pa((&vmx->pi_desc))); } @@ -4444,23 +4437,9 @@ static void init_vmcs(struct vcpu_vmx *vmx) vmx->ple_window_dirty = true; } - vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); - vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, 0); - vmcs_write32(CR3_TARGET_COUNT, 0); /* 22.2.1 */ - - vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */ - vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */ vmx_set_constant_host_state(vmx); - vmcs_writel(HOST_FS_BASE, 0); /* 22.2.4 */ - vmcs_writel(HOST_GS_BASE, 0); /* 22.2.4 */ - if (cpu_has_vmx_vmfunc()) - vmcs_write64(VM_FUNCTION_CONTROL, 0); - - vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0); - vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, 0); vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host.val)); - vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, 0); vmcs_write64(VM_ENTRY_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.guest.val)); if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) @@ -4493,7 +4472,6 @@ static void init_vmcs(struct vcpu_vmx *vmx) memset(&vmx->pt_desc, 0, sizeof(vmx->pt_desc)); /* Bit[6~0] are forced to 1, writes are ignored. */ vmx->pt_desc.guest.output_mask = 0x7F; - vmcs_write64(GUEST_IA32_RTIT_CTL, 0); } vmx_setup_uret_msrs(vmx); @@ -4536,13 +4514,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) vmcs_write32(GUEST_LDTR_LIMIT, 0xffff); vmcs_write32(GUEST_LDTR_AR_BYTES, 0x00082); - if (!init_event) { - vmcs_write32(GUEST_SYSENTER_CS, 0); - vmcs_writel(GUEST_SYSENTER_ESP, 0); - vmcs_writel(GUEST_SYSENTER_EIP, 0); - vmcs_write64(GUEST_IA32_DEBUGCTL, 0); - } - vmcs_writel(GUEST_GDTR_BASE, 0); vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); -- 2.31.1.498.g6c1eba8ee3d-goog