From nobody Mon Feb 9 18:18:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748602; cv=none; d=zohomail.com; s=zohoarc; b=HMW+1yFomSjqgH6yyEO6X1nC1/T4WEdA3FpOt1R2seDE4f6ymkoKsv0vjdTlplawCxrixqZEo302GJTwIgqaANiGNJ71hDi8mx2OnyMc70Kz4TbXET3V2AkgJaE8EtkIDAy2UXRArzHaAb42ZdIkSJJek9OP+1ilUbS5oD9u1SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748602; h=Content-Type: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=u9Ic3SlVjmZv/grQy5ZDSiOyVlhH83X1STkOt+Pc7EA=; b=Q+fgmaa9mle2w/pD3JxR5BRBtzuTNTTEGjHTk8VbCaNjRxUAoa6GSB4bNhQycGqE0O+A25FluQHET5ftdpN9OXLu3yjTpeHUbyzA/aJvDE5nTMrPt6AsUIGbN830D5On6JHxh16F8QQiEbKpwJYvnz1O6oHa7G8zlNwiJMGhcEs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748602366794.0750418308405; Wed, 26 Feb 2020 12:23:22 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Cj-0003rc-10; Wed, 26 Feb 2020 20:22:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Ci-0003rA-0M for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:48 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b554081a-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b554081a-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gh7zvT2QF4Vx8o2fLYvtD5CfhlnyOcj3YGLCny2yNI8=; b=JKvLq0rpHH2tDwxjqjAk5A58Wtt1Uwe31LFWJ09Tf2Y9su8bnSpolhCt x3y3Mm1RHOVLui2Nw4JlEA5kvnzdk4L+5yO7WR5taxEuE8SYzLHnvNyEa oKLJgxxKio7YPzcdW5WyTjJIr2YrKZVLLao73xFd+lttOvjquIvz/vWmZ w=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: dZXbkmdwAMbW4Wf01LZHbVu9Kh+kI8sy9YcBytPH3uQGEs5KGSrpDTrlkKEfWCErhwC1XnYh8I FQmRdS8OCmLgwfOiVrTDLTVXa/ONoGUI21gkpqX6VvNTg512iFtrYLIpb21AcvUrdCgpSadcoZ RE6g+OZRTl8l9aqb+Kv6paO0iKgjEuvvJBqULKR1b6meNGhUC9uC3JYrlkWwnJ+Z2V5uTUp8jC Bmie3c4iXyKyhlOsMS1dKU+hghqIGpidvepkVS7GemqQkpQaUFoPACB69V2s6Si9u8hPzYFc86 b20= X-SBRS: 2.7 X-MesageID: 13496573 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,489,1574139600"; d="scan'208";a="13496573" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:17 +0000 Message-ID: <20200226202221.6555-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 06/10] x86/msr: Introduce and use default MSR policies X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For now, the default and max policies remain identical, but this will change in the future. Update XEN_SYSCTL_get_cpu_policy and init_domain_msr_policy() to use the default policies. Take the opportunity sort PV ahead of HVM, as is the prevailing style elsewhere. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/msr.c | 32 +++++++++++++++++++++++++++----- xen/arch/x86/sysctl.c | 4 ++-- xen/include/asm-x86/msr.h | 4 +++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 738d7123f9..519222a2b8 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -34,9 +34,11 @@ struct msr_policy __read_mostly raw_msr_policy, __read_mostly host_msr_policy; #ifdef CONFIG_PV struct msr_policy __read_mostly pv_max_msr_policy; +struct msr_policy __read_mostly pv_def_msr_policy; #endif #ifdef CONFIG_HVM struct msr_policy __read_mostly hvm_max_msr_policy; +struct msr_policy __read_mostly hvm_def_msr_policy; #endif =20 static void __init calculate_raw_policy(void) @@ -56,6 +58,20 @@ static void __init calculate_host_policy(void) mp->platform_info.cpuid_faulting =3D cpu_has_cpuid_faulting; } =20 +static void __init calculate_pv_max_policy(void) +{ + struct msr_policy *mp =3D &pv_max_msr_policy; + + *mp =3D host_msr_policy; +} + +static void __init calculate_pv_def_policy(void) +{ + struct msr_policy *mp =3D &pv_def_msr_policy; + + *mp =3D pv_max_msr_policy; +} + static void __init calculate_hvm_max_policy(void) { struct msr_policy *mp =3D &hvm_max_msr_policy; @@ -66,11 +82,11 @@ static void __init calculate_hvm_max_policy(void) mp->platform_info.cpuid_faulting =3D true; } =20 -static void __init calculate_pv_max_policy(void) +static void __init calculate_hvm_def_policy(void) { - struct msr_policy *mp =3D &pv_max_msr_policy; + struct msr_policy *mp =3D &hvm_def_msr_policy; =20 - *mp =3D host_msr_policy; + *mp =3D hvm_max_msr_policy; } =20 void __init init_guest_msr_policy(void) @@ -79,17 +95,23 @@ void __init init_guest_msr_policy(void) calculate_host_policy(); =20 if ( IS_ENABLED(CONFIG_PV) ) + { calculate_pv_max_policy(); + calculate_pv_def_policy(); + } =20 if ( hvm_enabled ) + { calculate_hvm_max_policy(); + calculate_hvm_def_policy(); + } } =20 int init_domain_msr_policy(struct domain *d) { struct msr_policy *mp =3D is_pv_domain(d) - ? (IS_ENABLED(CONFIG_PV) ? &pv_max_msr_policy : NULL) - : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_msr_policy : NULL); + ? (IS_ENABLED(CONFIG_PV) ? &pv_def_msr_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_def_msr_policy : NULL); =20 if ( !mp ) { diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 7ea8c38797..cad7534373 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -49,7 +49,7 @@ const struct cpu_policy system_policies[6] =3D { }, [ XEN_SYSCTL_cpu_policy_pv_default ] =3D { &pv_max_cpuid_policy, - &pv_max_msr_policy, + &pv_def_msr_policy, }, #endif #ifdef CONFIG_HVM @@ -59,7 +59,7 @@ const struct cpu_policy system_policies[6] =3D { }, [ XEN_SYSCTL_cpu_policy_hvm_default ] =3D { &hvm_max_cpuid_policy, - &hvm_max_msr_policy, + &hvm_def_msr_policy, }, #endif }; diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index bca41a3670..41397e19cf 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -269,8 +269,10 @@ static inline void wrmsr_tsc_aux(uint32_t val) =20 extern struct msr_policy raw_msr_policy, host_msr_policy, + pv_max_msr_policy, + pv_def_msr_policy, hvm_max_msr_policy, - pv_max_msr_policy; + hvm_def_msr_policy; =20 /* Container object for per-vCPU MSRs */ struct vcpu_msrs --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel