From nobody Fri Nov 29 14:36:34 2024 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; dkim=pass; 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=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=2; a=rsa-sha256; t=1638200247; cv=pass; d=zohomail.com; s=zohoarc; b=ToN55e4HEpy80QJetG6k1FW7NL4Y7CeexSTjYJOkhui0sF4CNdERT/Ky3QnAhr3j02Q5Fkq7EogzOQz80VNTagWM5E4rxcKFf0jZGCryeGu7Nle6aqWtTtfsPueCuV0pPieTRClScxluAqAfXpXzFOJDXktcaL3YiKL/ZTxkBIo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638200247; 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=va2yTS9NdywE+zexh1fxAUbpTOFx27IrcCDyw7x9azc=; b=E7M/s5yBCXy6iQxrLhtVRsHfAUpV8J8Xw9cHpK/1zBU8TQqLddZyYJ5/MZ9/zqcsNGn3SGH/m+dxV2p190cVgQpgFqCih/8OnTbQEBOjufYjLqyOpLTKN2nv2Aa9qo4I+aYdLqMNpYgdjUfN8nCC11nuY9GyaWcsijPklTOOUyY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638200247012916.5495387827247; Mon, 29 Nov 2021 07:37:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.234673.407276 (Exim 4.92) (envelope-from ) id 1mriiC-0000da-AZ; Mon, 29 Nov 2021 15:37:00 +0000 Received: by outflank-mailman (output) from mailman id 234673.407276; Mon, 29 Nov 2021 15:37:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mriiC-0000dP-48; Mon, 29 Nov 2021 15:37:00 +0000 Received: by outflank-mailman (input) for mailman id 234673; Mon, 29 Nov 2021 15:36:58 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mrihK-0003uH-U5 for xen-devel@lists.xenproject.org; Mon, 29 Nov 2021 15:36:07 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0e61b719-512a-11ec-b941-1df2895da90e; Mon, 29 Nov 2021 16:36:02 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0e61b719-512a-11ec-b941-1df2895da90e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638200162; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=oCwcWmwz0BMSkk8m68nr1rFFDTEUeQkIP2DOHyaSqqY=; b=UOPK/amGI4bl6TigtKe2Wc82+s6K6sdCukzZtlxEdgqHnOAfJPu+efk8 XTYfdTpMAKypIoutoa7dqt80P76+7KQfVMiMjo0mJHq4DCWSdkKQ0R2DE eiGIjcAcD34La6QnC8LxOQ/XNGoBXD/H6F7X7+9K0b+H/Yog/LWXk/CkV A=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: Nc6pV2ozzeJq9sLgupWxfTlxJN3B5L5GZH4JcJWV9PwBdluG4h906HYx9lA+OpjZjVItMTSrEs EI3gCLfrPSE9tYnjttdbDTJSSg0FHMx0ab34LTcAQgmfozp2BRVf3ErzYScjzRy8N2UPpLz3uA CsskYQ7YOMSMZtjzUpEE1tWklGBZ2fPeUTT6j5L9SJYkpp9onH8LdI/Pt8d/w4qYxNC1Aznz91 Ozm+rlP6+8DlFH6o80mSi9w0H3JWp8KXDtaOupDBq5lO8valL+RGwoF9fURO9NVyO3XHdQPHWb HhJP/BCJzp8t2n2afTR2/g5G X-SBRS: 5.1 X-MesageID: 58773293 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KHAd26gDP79O6m0F4P8QqT+iX161ghcKZh0ujC45NGQN5FlHY01je htvCmnTa/6OYGrzfo13bY7k/BsB65LWzYUxHgQ4/ChnES0b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29cy0IDga++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1C762+TyAXD5Tjv95efxBkH3kvB4p/reqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9t1p8RRq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KZxTc2jZAKLZVMZ8+x bZzscEb3AWzlx42P4vUlStT7WmNciQNXqhPWkv222M3Zt7HEm1/XKE= IronPort-HdrOrdr: A9a23:JulUNayK5kmym6oIJ+R+KrPxsOskLtp133Aq2lEZdPULSKKlfp GV88jziyWZtN9wYhEdcdDpAtjmfZq6z+8L3WBxB8bfYOCCggqVxe5ZnPLfKlHbakjDH6tmpN 1dmstFea3N5DpB/L7HCWCDer5KqrT3k9HL9JTjJjVWPHxXgslbnnZE422gYytLrWd9dP4E/M 323Ls4m9PsQwVbUu2LQl0+G8TTrdzCk5zrJTYAGh4c8QGLyRel8qTzHRS01goXF2on+8ZszU H11yjCoomzufCyzRHRk0fV8pRtgdPkjv9OHtaFhMQ5IijlziyoeINicbufuy1dmpDi1H8a1P 335zswNcV67H3cOkmzvBvWwgHllA0j7nfzoGXoyUfLkIjcfnYXGsBBjYVWfl/y8Ew7puxx16 pNwiawq4dXJQmoplW82/H4EzVR0makq3srluAey1ZFV5EFVbNXpYsDuGtIDZY7Gj7g4oxPKp guMCjl3ocVTbqmVQGdgoE2q+bcGkjbXy32DHTqg/blkAS/xxtCvgwlLM92pAZIyHtycegD2w 3+CNUcqFh5dL5hUUtMPpZyfSKJMB24ffu1ChPoHb3GLtBNB5ufke+83F0KjNvaD6DgiqFCwa j8bA== X-IronPort-AV: E=Sophos;i="5.87,273,1631592000"; d="scan'208";a="58773293" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+LWsFvLrUk9aNpWquLFO8l29KeecLikiaA/maBuFVJ4FsCWTLlIEnZvcUSVFYgWpSFf4dGw7bWyM60S3gZ6f8j93tDFcdnV0AMNqSQzNVoXu5lDJBopG24+tUjIGW8GBcw592DkEKWKMScnthp3Cx20XLdXGSnpnhGHHM7++bGXroCi3sqzGi14KqcowRSclzkYJk0CBKnCKBC5+IAtWW2iD72GPjWcLyM7bSurtBmR73nkmdoOKuwBFJInjgjM8O50QjXxuDY8OMxEo7g9fdC5ebPkS6R+1Hj1Fq64NiH6CPYerrIJLFxymsUEh+JMp5TZ7Bkf3n1G78/tGFU+Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=va2yTS9NdywE+zexh1fxAUbpTOFx27IrcCDyw7x9azc=; b=mTmB7GXP8Z1rbKhhdgSK9VgGmDzWbLVglXcbtXfrPVqi+bpLDSjqyu3H0s4p5WqI1pjOOFEAb79uwpKtwliuElBcYTTxH1X4sLmOVuIBtcgaQ+9F5hwdBKUDMVzaiVvww1Rgz6wYCwxLUiIAR6kZuMzDM7Abj5j1CpYkVWZ4dRyFTXpDwq+57YgAPQm/oFfCbwaUeKBu/UC49OB9PiUt4jyhZa6cjOE0VvSNnFAMAXhSWQKlKFEcueboG2jfS2MHlfFp1fqItyWEr3/wUVkAtGmk8ZXQKxP3wQCCnUaLXCNPk652hJmaX5/s8E9Zj2wyQLWbbJOVaGyiYXVKZ0IRIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=va2yTS9NdywE+zexh1fxAUbpTOFx27IrcCDyw7x9azc=; b=L0595hOgURK8N5x1evwrLImUyOg5QfRuMhFCPv2jUMEKxjr5WXtJqHttnRcN4Sq/5dW5wLFJbCheYZe03oD19g1nLpx36e2ChrfiEZYhVduggGz5x/4wa0TwxRPjpDufIjtAB0AfTUEppfTlIU2HL5fiUOCTdztPi5hsFfdnxiE= From: Roger Pau Monne To: CC: Roger Pau Monne , Ian Jackson , Wei Liu , Juergen Gross , Anthony PERARD Subject: [PATCH v5 10/12] libs/{light,guest}: implement xc_cpuid_apply_policy in libxl Date: Mon, 29 Nov 2021 16:33:53 +0100 Message-ID: <20211129153355.60338-11-roger.pau@citrix.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211129153355.60338-1-roger.pau@citrix.com> References: <20211129153355.60338-1-roger.pau@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MRXP264CA0030.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::18) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6d453ff-5b7f-4066-32d2-08d9b34defd7 X-MS-TrafficTypeDiagnostic: DM6PR03MB5340: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:177; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uC3OciuAXZ10rxT3FJNQ5cFSlSZ01P7QceDw1T5tMqDCFMLRiNCboFjH5V57S1eL6PmcOOswwjupPwQMxhrvrGnz6GfrlIeoYZ4IKQFF0Z3tsu765ApRbNbPgnWkF9oRjZLUtkE5xYeZzIaeZAM78R+5m6wQqKnlDDidNKECui103wJyKRSH5nCVRFdyW6fMz9OiGi8x8V2jZEZsER0icP7dHkMKdSCKy7iusmzPuaxDAPUNiseMuuR8HkYFztcoiml3OoxLsELISqk31T+RIz/QnwkME77j2MlcDR2XhksgwflPwZLJB3F5+M9+JRdfUtA06GnOmAw7+BAnHmuw9Aj/c85/Mcw3BqULpMRTxJV4pMhmqBG4fbkQz8/U5orNaOrWYlm+X4JqUEdc4PkdZoGmFT8nuEoK7N4FEfGx91qCnYgzDChczF1WS4r+0H0YqGyzDBSw8exgkgVLedartH9y0G6n2uZQ+R7unEDViaSY0JMnZUuUbEWokiFS10z4ZZNTt8z8uarft/9KnNfx/W0WYYntgjwU5GAzoMmkkp8zrT4R69uoumXiUZa5UaiGPAmVOVEgFjCJEUL8EAMPwo3JyjoPvvX8AjMJEErK16XFdcM57dhWTKHxS4YZvGOptETfsxo40OWR/KKJuQOHbw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6666004)(82960400001)(66946007)(86362001)(1076003)(508600001)(5660300002)(8676002)(107886003)(6486002)(316002)(38100700002)(6496006)(26005)(83380400001)(6916009)(66476007)(2906002)(66556008)(2616005)(956004)(8936002)(54906003)(186003)(36756003)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dTFaazNpbktQVk9vdkt1a3VNYVlJczAwOWhHVnlDV25xYmpMT0Zyam10bWs3?= =?utf-8?B?SnRpNTdtMUlzdW5PR2VtRUM1TEdKbjNEV1ZoK2lhblI3akJPZDRmMEp2NDdj?= =?utf-8?B?aVhOckl3eEs3NjRKNXQvcGh4QVlMMGlBT1dPUnZ5YnBxalVPV25Nall6YW9v?= =?utf-8?B?NGpGY3dCdExSdzlWRWF3RVhIV0tQRGFBSS9wUi9CYzJMVlA4SEFnV1N4eDhr?= =?utf-8?B?ZW1CMDVncmd4amQ5QlFIZmRxNlIzNU84MjZJMmRKUUg5SHBtY0dqazlkV1FE?= =?utf-8?B?ZEdsV2NtZ2F6MlRGRzRyRnJmSUlYejBTV3h6UzJCR1MrcFBoWUYvdDVEanBR?= =?utf-8?B?QmVCQ3FVeXZRMitXb2hUdlhMV1dScHVvbFBlZUF0ZFJKdk9CTmdUdUJzZ1Ex?= =?utf-8?B?STQwckkranJBU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Exchange-CrossTenant-Network-Message-Id: b6d453ff-5b7f-4066-32d2-08d9b34defd7 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 15:35:56.8402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LHo1R7uJIa1uDLufds5/VfFUj/0FDRHGxJs00XJaARB1UwzNmV4Dzgeuv3pxBHYsb9kEc4Tf0/cp1r4eBZ6Yww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB5340 X-OriginatorOrg: citrix.com X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1638200249244100001 With the addition of the xc_cpu_policy_* now libxl can have better control over the cpu policy, this allows removing the xc_cpuid_apply_policy function and instead coding the required bits by libxl in libxl__cpuid_legacy directly. Remove xc_cpuid_apply_policy. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Anthony PERARD --- Changes since v4: - Correctly account for PVH guests being HVM in libxl__cpuid_legacy. - PAE option is only available to HVM guests (_not_ including PVH). Changes since v2: - Use 'r' for libxc return values. - Fix comment about making a cpu policy compatible. - Use LOG*D macros. --- tools/include/xenctrl.h | 18 ----- tools/libs/guest/xg_cpuid_x86.c | 122 -------------------------------- tools/libs/light/libxl_cpuid.c | 92 ++++++++++++++++++++++-- 3 files changed, 86 insertions(+), 146 deletions(-) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 95bd5eca67..745d67c970 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -1829,24 +1829,6 @@ struct xc_xend_cpuid { char *policy[4]; }; =20 -/* - * Make adjustments to the CPUID settings for a domain. - * - * This path is used in two cases. First, for fresh boots of the domain, = and - * secondly for migrate-in/restore of pre-4.14 guests (where CPUID data was - * missing from the stream). The @restore parameter distinguishes these - * cases, and the generated policy must be compatible with a 4.13. - * - * Either pass a full new @featureset (and @nr_features), or adjust indivi= dual - * features (@pae, @itsc, @nested_virt). - * - * Then (optionally) apply legacy XEND overrides (@xend) to the result. - */ -int xc_cpuid_apply_policy(xc_interface *xch, - uint32_t domid, bool restore, - const uint32_t *featureset, - unsigned int nr_features, bool pae, bool itsc, - bool nested_virt, const struct xc_xend_cpuid *xe= nd); int xc_mca_op(xc_interface *xch, struct xen_mc *mc); int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags, xc_cpumap_t cpumap, unsigned int nr_cpus); diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x8= 6.c index 41c6e66b6f..f4ed632d60 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -379,128 +379,6 @@ int xc_cpu_policy_apply_cpuid(xc_interface *xch, xc_c= pu_policy_t *policy, return rc; } =20 -int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore, - const uint32_t *featureset, unsigned int nr_feat= ures, - bool pae, bool itsc, bool nested_virt, - const struct xc_xend_cpuid *cpuid) -{ - int rc; - xc_dominfo_t di; - unsigned int nr_leaves, nr_msrs; - xen_cpuid_leaf_t *leaves =3D NULL; - struct cpuid_policy *p =3D NULL; - struct xc_cpu_policy policy =3D { }; - uint32_t err_leaf =3D -1, err_subleaf =3D -1, err_msr =3D -1; - - if ( xc_domain_getinfo(xch, domid, 1, &di) !=3D 1 || - di.domid !=3D domid ) - { - ERROR("Failed to obtain d%d info", domid); - rc =3D -ESRCH; - goto out; - } - - rc =3D xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs); - if ( rc ) - { - PERROR("Failed to obtain policy info size"); - rc =3D -errno; - goto out; - } - - rc =3D -ENOMEM; - if ( (leaves =3D calloc(nr_leaves, sizeof(*leaves))) =3D=3D NULL || - (p =3D calloc(1, sizeof(*p))) =3D=3D NULL ) - goto out; - - /* Get the domain's default policy. */ - nr_msrs =3D 0; - rc =3D get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_d= efault - : XEN_SYSCTL_cpu_policy_pv_defa= ult, - &nr_leaves, leaves, &nr_msrs, NULL); - if ( rc ) - { - PERROR("Failed to obtain %s default policy", di.hvm ? "hvm" : "pv"= ); - rc =3D -errno; - goto out; - } - - rc =3D x86_cpuid_copy_from_buffer(p, leaves, nr_leaves, - &err_leaf, &err_subleaf); - if ( rc ) - { - ERROR("Failed to deserialise CPUID (err leaf %#x, subleaf %#x) (%d= =3D %s)", - err_leaf, err_subleaf, -rc, strerror(-rc)); - goto out; - } - - if ( restore ) - { - policy.cpuid =3D *p; - xc_cpu_policy_make_compat_4_12(xch, &policy, di.hvm); - *p =3D policy.cpuid; - } - - if ( featureset ) - { - policy.cpuid =3D *p; - rc =3D xc_cpu_policy_apply_featureset(xch, &policy, featureset, - nr_features); - if ( rc ) - { - ERROR("Failed to apply featureset to policy"); - goto out; - } - *p =3D policy.cpuid; - } - else - { - p->extd.itsc =3D itsc; - - if ( di.hvm ) - { - p->basic.pae =3D pae; - p->basic.vmx =3D nested_virt; - p->extd.svm =3D nested_virt; - } - } - - policy.cpuid =3D *p; - rc =3D xc_cpu_policy_legacy_topology(xch, &policy, di.hvm); - if ( rc ) - goto out; - *p =3D policy.cpuid; - - rc =3D xc_cpu_policy_apply_cpuid(xch, &policy, cpuid, di.hvm); - if ( rc ) - goto out; - - rc =3D x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves); - if ( rc ) - { - ERROR("Failed to serialise CPUID (%d =3D %s)", -rc, strerror(-rc)); - goto out; - } - - rc =3D xc_set_domain_cpu_policy(xch, domid, nr_leaves, leaves, 0, NULL, - &err_leaf, &err_subleaf, &err_msr); - if ( rc ) - { - PERROR("Failed to set d%d's policy (err leaf %#x, subleaf %#x, msr= %#x)", - domid, err_leaf, err_subleaf, err_msr); - rc =3D -errno; - goto out; - } - - rc =3D 0; - -out: - free(p); - free(leaves); - - return rc; -} - xc_cpu_policy_t *xc_cpu_policy_init(void) { return calloc(1, sizeof(struct xc_cpu_policy)); diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c index 815498d4f3..07d445d9f9 100644 --- a/tools/libs/light/libxl_cpuid.c +++ b/tools/libs/light/libxl_cpuid.c @@ -441,9 +441,11 @@ int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid= , bool restore, libxl_domain_build_info *info) { GC_INIT(ctx); + xc_cpu_policy_t *policy =3D NULL; + bool hvm =3D info->type !=3D LIBXL_DOMAIN_TYPE_PV; bool pae =3D true; bool itsc; - int r; + int r, rc =3D 0; =20 /* * Gross hack. Using libxl_defbool_val() here causes libvirt to crash= in @@ -454,6 +456,41 @@ int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid= , bool restore, */ bool nested_virt =3D info->nested_hvm.val > 0; =20 + policy =3D xc_cpu_policy_init(); + if (!policy) { + LOGED(ERROR, domid, "Failed to init CPU policy"); + rc =3D ERROR_FAIL; + goto out; + } + + r =3D xc_cpu_policy_get_domain(ctx->xch, domid, policy); + if (r) { + LOGED(ERROR, domid, "Failed to fetch domain CPU policy"); + rc =3D ERROR_FAIL; + goto out; + } + + if (restore) { + /* + * Make sure the policy is compatible with pre Xen 4.13. Note that + * newer Xen versions will pass policy data on the restore stream,= so + * any adjustments done here will be superseded. + */ + r =3D xc_cpu_policy_make_compat_4_12(ctx->xch, policy, hvm); + if (r) { + LOGED(ERROR, domid, "Failed to setup compatible CPU policy"); + rc =3D ERROR_FAIL; + goto out; + } + } + + r =3D xc_cpu_policy_legacy_topology(ctx->xch, policy, hvm); + if (r) { + LOGED(ERROR, domid, "Failed to setup CPU policy topology"); + rc =3D ERROR_FAIL; + goto out; + } + /* * For PV guests, PAE is Xen-controlled (it is the 'p' that differenti= ates * the xen-3.0-x86_32 and xen-3.0-x86_32p ABIs). It is mandatory as X= en @@ -466,6 +503,13 @@ int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid= , bool restore, */ if (info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM) pae =3D libxl_defbool_val(info->u.hvm.pae); + rc =3D libxl_cpuid_parse_config(&info->cpuid, GCSPRINTF("pae=3D%d", pa= e)); + if (rc) { + LOGD(ERROR, domid, "Failed to set PAE CPUID flag"); + rc =3D ERROR_FAIL; + goto out; + } + =20 /* * Advertising Invariant TSC to a guest means that the TSC frequency w= on't @@ -481,14 +525,50 @@ int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domi= d, bool restore, */ itsc =3D (libxl_defbool_val(info->disable_migrate) || info->tsc_mode =3D=3D LIBXL_TSC_MODE_ALWAYS_EMULATE); + rc =3D libxl_cpuid_parse_config(&info->cpuid, GCSPRINTF("invtsc=3D%d",= itsc)); + if (rc) { + LOGD(ERROR, domid, "Failed to set Invariant TSC CPUID flag"); + rc =3D ERROR_FAIL; + goto out; + } =20 - r =3D xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0, - pae, itsc, nested_virt, info->cpuid); - if (r) - LOGEVD(ERROR, -r, domid, "Failed to apply CPUID policy"); + /* Set Nested virt CPUID bits for HVM. */ + if (hvm) { + rc =3D libxl_cpuid_parse_config(&info->cpuid, GCSPRINTF("vmx=3D%d", + nested_virt)= ); + if (rc) { + LOGD(ERROR, domid, "Failed to set VMX CPUID flag"); + rc =3D ERROR_FAIL; + goto out; + } + + rc =3D libxl_cpuid_parse_config(&info->cpuid, GCSPRINTF("svm=3D%d", + nested_virt)= ); + if (rc) { + LOGD(ERROR, domid, "Failed to set SVM CPUID flag"); + rc =3D ERROR_FAIL; + goto out; + } + } + + /* Apply the bits from info->cpuid if any. */ + r =3D xc_cpu_policy_apply_cpuid(ctx->xch, policy, info->cpuid, hvm); + if (r) { + LOGEVD(ERROR, domid, -r, "Failed to apply CPUID changes"); + rc =3D ERROR_FAIL; + goto out; + } + + r =3D xc_cpu_policy_set_domain(ctx->xch, domid, policy); + if (r) { + LOGED(ERROR, domid, "Failed to set domain CPUID policy"); + rc =3D ERROR_FAIL; + } =20 + out: + xc_cpu_policy_destroy(policy); GC_FREE; - return r ? ERROR_FAIL : 0; + return rc; } =20 static const char *input_names[2] =3D { "leaf", "subleaf" }; --=20 2.33.0