From nobody Mon Feb 9 07:23:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1589872914; cv=none; d=zohomail.com; s=zohoarc; b=fMfVSAte9KdVMqhDt4+NQ8S3Pd/MarBDtg6CdTY+OJJlnraAxVIcc1DChpTZHqZyqR/mvUPlQlo/IG39+QFrellDId/aPsOXJXHB3tuudQC/GerTtUzHzqZ3NhglBV3usYCsNi4log9FJeHQHWJDFDjnit5Zm6dJbbrWHg5nx8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589872914; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m6B3N+lA0JE3R9S0hfyjX7pKxfFCkOmXhOIHCk880b0=; b=HgXgD6hJ0ChPA3Sn0uiqlLDW4SJxvJKJYVQ6D0zKE2g+dBudGvVrtqEu9hX8q/bhMnxO6KQ9QXSPYFP+0w6hChKglTUPv8gaOKwEQDVPCxO6Nx9Wcnssm7uHj5wg5shWT3upi9hGG8RRC9Xqx64nmeP27S3PkGm82jDreWpDfRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1589872914735197.90470356604612; Tue, 19 May 2020 00:21:54 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jawYq-0004mA-Ea; Tue, 19 May 2020 07:21:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jawYp-0004m5-Hj for xen-devel@lists.xenproject.org; Tue, 19 May 2020 07:21:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 50122fc4-99a1-11ea-b9cf-bc764e2007e4; Tue, 19 May 2020 07:21:10 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D84F5B1FC; Tue, 19 May 2020 07:21:11 +0000 (UTC) X-Inumbo-ID: 50122fc4-99a1-11ea-b9cf-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Subject: [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting Date: Tue, 19 May 2020 09:20:55 +0200 Message-Id: <20200519072106.26894-2-jgross@suse.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200519072106.26894-1-jgross@suse.com> References: <20200519072106.26894-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Kevin Tian , Jun Nakajima , Wei Liu , Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" In case opt_ept_ad has not been set explicitly by the user via command line or runtime parameter, it is treated as "no" on Avoton cpus. Change that handling by setting opt_ept_ad to 0 for this cpu type explicitly if no user value has been set. By putting this into the (renamed) boot time initialization of vmcs.c _vmx_cpu_up() can be made static. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- xen/arch/x86/hvm/vmx/vmcs.c | 22 +++++++++++++++------- xen/arch/x86/hvm/vmx/vmx.c | 4 +--- xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 4c23645454..221af9737a 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -315,10 +315,6 @@ static int vmx_init_vmcs_config(void) =20 if ( !opt_ept_ad ) _vmx_ept_vpid_cap &=3D ~VMX_EPT_AD_BIT; - else if ( /* Work around Erratum AVR41 on Avoton processors. */ - boot_cpu_data.x86 =3D=3D 6 && boot_cpu_data.x86_model = =3D=3D 0x4d && - opt_ept_ad < 0 ) - _vmx_ept_vpid_cap &=3D ~VMX_EPT_AD_BIT; =20 /* * Additional sanity checking before using EPT: @@ -652,7 +648,7 @@ void vmx_cpu_dead(unsigned int cpu) vmx_pi_desc_fixup(cpu); } =20 -int _vmx_cpu_up(bool bsp) +static int _vmx_cpu_up(bool bsp) { u32 eax, edx; int rc, bios_locked, cpu =3D smp_processor_id(); @@ -2108,9 +2104,21 @@ static void vmcs_dump(unsigned char ch) printk("**************************************\n"); } =20 -void __init setup_vmcs_dump(void) +int __init vmx_vmcs_init(void) { - register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1); + int ret; + + if ( opt_ept_ad < 0 ) + /* Work around Erratum AVR41 on Avoton processors. */ + opt_ept_ad =3D !(boot_cpu_data.x86 =3D=3D 6 && + boot_cpu_data.x86_model =3D=3D 0x4d); + + ret =3D _vmx_cpu_up(true); + + if ( !ret ) + register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1); + + return ret; } =20 static void __init __maybe_unused build_assertions(void) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 6efa80e422..11a4dd94cf 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2482,7 +2482,7 @@ const struct hvm_function_table * __init start_vmx(vo= id) { set_in_cr4(X86_CR4_VMXE); =20 - if ( _vmx_cpu_up(true) ) + if ( vmx_vmcs_init() ) { printk("VMX: failed to initialise.\n"); return NULL; @@ -2553,8 +2553,6 @@ const struct hvm_function_table * __init start_vmx(vo= id) vmx_function_table.get_guest_bndcfgs =3D vmx_get_guest_bndcfgs; } =20 - setup_vmcs_dump(); - lbr_tsx_fixup_check(); bdf93_fixup_check(); =20 diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/v= mx/vmcs.h index 95c1dea7b8..906810592f 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -21,11 +21,10 @@ #include =20 extern void vmcs_dump_vcpu(struct vcpu *v); -extern void setup_vmcs_dump(void); +extern int vmx_vmcs_init(void); extern int vmx_cpu_up_prepare(unsigned int cpu); extern void vmx_cpu_dead(unsigned int cpu); extern int vmx_cpu_up(void); -extern int _vmx_cpu_up(bool bsp); extern void vmx_cpu_down(void); =20 struct vmcs_struct { --=20 2.26.1