From nobody Mon Feb 9 18:00:07 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=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=UBiJnlGtiWzEaqtSdW/52OCmh+b3HemZg1CQL/F5HxH8kEwFg2Hp+z9tuAY2IOdJUHYlV90hExPmw9NZByyMXjtofYZu01Iu3Ehi1wuGFwYzrD547OnIJs/RtNxw56rsQw561qu1jyCW5slPSA/jvt1qmQLV4eDWul/ehIviG0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; 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=5L3PeOjzVYabWkeItnbWt8ZqntcDrsbaD/Y2SMW1KWo=; b=BuRzoXforbREZKHG7yz1nDw8P7VdRk11VMN2/pcpgW5l3bxPNAHCX714Sb381XRrcgjrPPamU4uDxQLZ+q17bgqDXh8LL6bY7bSBAMf/XHzoeaYpdUJ0T9o24Vh1oT/tWGzGQeou+LbXSBMUasuHws+/op9G4Vk5jr69/KVoioY= 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 1582748600683729.1881029553703; Wed, 26 Feb 2020 12:23:20 -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 1j73CY-0003kn-Sc; Wed, 26 Feb 2020 20:22:38 +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 1j73CY-0003kH-00 for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:38 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b4212d12-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b4212d12-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yGMVzI6Kc0BempO1OOlS8e4RhhWkq+Lao6Js498e0JE=; b=UnRlzKeHqzdx271q3LkTy5SIPExkpW7UoON5+S2+Vu0YuxAftHsl3+4z jhSPUUrBrKaJcnYow+HkO6j89OJAOQGymJ8Zju1AHYtAqsXQL3tvM77c1 dEtycsJ/5mLS5Zb9QnFFdsMSgfG67IoB2eUjdvjeRPIujT4K6EMJrV21w I=; 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: 2DLAPFKL6rlBuGWIECs/44VMD8+yFW79E7c+AwEIQjWYZfRoE6HrqjT2HQ2oenAt77D9KwiXIu NYmozwMg+wH+W84qEJLx57DgfeG9c3ZKuqbdmEp422gJ0NPgYCKRoOUMTGpECL9serg1gO5Hwi v4CfV/whrPLZQymUVjEtmH/0BDUbSN0fJUYnastajOPLuEf+K7iZQjmW+Ggfazh6DypuC7e11F tPIF8u6jLn0Pa/o2gApqhAu+fPAcW2bZVTGl/ONQO9u55HDuiiPMOTKLetQlwYivVnKrjgktp2 wN8= X-SBRS: 2.7 X-MesageID: 13496569 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="13496569" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:16 +0000 Message-ID: <20200226202221.6555-6-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 05/10] x86/msr: Compile out unused logic/objects 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) Arrange to compile out the PV or HVM logic and objects as applicable. This involves a bit of complexity in init_domain_msr_policy() as is_pv_domain() can't be evaulated at compile time. 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 | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index e39bb6dce4..738d7123f9 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -31,9 +31,13 @@ DEFINE_PER_CPU(uint32_t, tsc_aux); =20 struct msr_policy __read_mostly raw_msr_policy, - __read_mostly host_msr_policy, - __read_mostly hvm_max_msr_policy, - __read_mostly pv_max_msr_policy; + __read_mostly host_msr_policy; +#ifdef CONFIG_PV +struct msr_policy __read_mostly pv_max_msr_policy; +#endif +#ifdef CONFIG_HVM +struct msr_policy __read_mostly hvm_max_msr_policy; +#endif =20 static void __init calculate_raw_policy(void) { @@ -56,9 +60,6 @@ static void __init calculate_hvm_max_policy(void) { struct msr_policy *mp =3D &hvm_max_msr_policy; =20 - if ( !hvm_enabled ) - return; - *mp =3D host_msr_policy; =20 /* It's always possible to emulate CPUID faulting for HVM guests */ @@ -76,16 +77,27 @@ void __init init_guest_msr_policy(void) { calculate_raw_policy(); calculate_host_policy(); - calculate_hvm_max_policy(); - calculate_pv_max_policy(); + + if ( IS_ENABLED(CONFIG_PV) ) + calculate_pv_max_policy(); + + if ( hvm_enabled ) + calculate_hvm_max_policy(); } =20 int init_domain_msr_policy(struct domain *d) { - struct msr_policy *mp =3D - xmemdup(is_pv_domain(d) ? &pv_max_msr_policy - : &hvm_max_msr_policy); + 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); + + if ( !mp ) + { + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; + } =20 + mp =3D xmemdup(mp); if ( !mp ) return -ENOMEM; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel