From nobody Sat Nov 30 03:50:12 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=1dmarc=pass fromdomain=citrix.com); dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=2; a=rsa-sha256; t=1618322618; cv=pass; d=zohomail.com; s=zohoarc; b=IlELxbzBCYCKpHFDxzvXRWTEbklRmru/i56zlXZlxjrfee5+IMT3VjA3bh6Qaci+BxGNDvQepAR+DFLlVjcAp0jkbBLBsfp7lvWdPkCDG2OIkkUf/iNZy7RXNsHmkC55NbTsBvH6DcU6Lqj0dJzWq8nWUAA/x1yS/ew87OadPSA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618322618; 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=qDZhAJDB/rsUQo+Z4e8pQdhxsoyKmVpWA1PSI58wKuU=; b=YY9RJs8Ab9tb6rDpZjO9lpwfRfavbnvgqUYrXocsF4YrVcxMaNo8mU09b7URbXmQKq3R07eJs7HG7Mxx/JoUmZ+Qo0K+X6fd19ENqEjXkFFzE64nK2x27T4tI8f5EpGEiyFy7Oq2QX3cFhdAEzwxkykGLG013nJe4ylv1kMXcPA= 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=1dmarc=pass fromdomain=citrix.com); dmarc=pass header.from= (p=reject 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 1618322618404443.1891940535771; Tue, 13 Apr 2021 07:03:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.109813.209661 (Exim 4.92) (envelope-from ) id 1lWJdT-00063X-DX; Tue, 13 Apr 2021 14:03:23 +0000 Received: by outflank-mailman (output) from mailman id 109813.209661; Tue, 13 Apr 2021 14:03:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lWJdT-00063O-91; Tue, 13 Apr 2021 14:03:23 +0000 Received: by outflank-mailman (input) for mailman id 109813; Tue, 13 Apr 2021 14:03:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lWJdS-0005sc-8T for xen-devel@lists.xenproject.org; Tue, 13 Apr 2021 14:03:22 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 51725715-d4ea-43f4-8528-1a696ba6d6ea; Tue, 13 Apr 2021 14:03:18 +0000 (UTC) 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: 51725715-d4ea-43f4-8528-1a696ba6d6ea DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1618322597; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=XX1SugVBrNifC3XmPT1UGL6ovBU2ay/gnB824DeP1Ik=; b=Cc39JWoKjqLiS8RspJv8a4hSpqHiTdGaoxgC9B3Do/IKBfPwydKX8hj3 QmRZcxy31VqLsv1tNL77eiF2t12i/DavLPIkq8W8d9sU6zLqo+yc1542w Z7W5AxKSNBMFGx2tPeYqP8B6ieYi7YI2Q+2dgTo5K5VWmq85X8n+eLWYi w=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: 3nWJMVmsW6HjXl3TYRVxnjG9n3P6b5QN3X9n711F0k7EzNNIPs08FxI4yGd+Vq4ZEdd9tEYyS9 tx7/zvVk8ozmKcYOx1Bo2K4mTquEYaIhq/lKcH1rqdDuRZzzr5FlVozYvOT95t8tFyQ9R05hwM SdD0Tu5oRSMePyhFjsUAnR4QX9mSQIdXwzl0Wveo8nc8RyrY5cStaEFioHL54nd4BE4DhduNnD gsdY420euYuCh8652VYSRShBm6eBkURjJScd/RfYAXUZLmGEiTEUOFgNnjI3gDgSauuMF/AS1R r8U= X-SBRS: 5.2 X-MesageID: 41476562 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:3XEvuqnR0tnhCZODHbm0AmYu1cbpDfOpj2dD5ilNYBxZY6Wkvu iUtrAyyQL0hDENWHsphNCHP+26TWnB8INuiLN/AZ6LZyOjnGezNolt4c/ZwzPmEzDj7eI178 tdWoBEIpnLAVB+5PyW3CCRD8sgzN6b8KqhmOfZyDNXQRt3brx7hj0ZNi+wOCRNNW17LLA+E4 eR4dcCmiGpfm4ZYt/+Kn4OWeXCoNOjruObXTctARk75A6SyQ658bKSKWnk4j4ycRNqhY0j/2 /MjhDj6syY3c2T5xfA2wbonvJrsfT7zN8rPr3vtuE0LXHWhh+sdMBdXdS5zUsIicWOzHpvr9 XWuRcnOK1ImgPsV0W4uwHk1QWl8BtG0Q6a9XaijXHuodP0SVsBYqIr7+IpEWqq12MasN5xy6 5N1W6C3qAndy/opyjh+8POEyhji0vcmwtSrccok3ddXYECAYUhyrA3wUU9KuZkIAvKrKojEO VoEfjG4udXfV6wfx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sx Zh+tmN28uabTDx1gyVnTx1JMt1giuaaPL3JAKHAuhT9dOmfXyKn6ux+ca2yA7NdgHTUTVQua R1MWoKbspCjTE+jIo4lgiKI5aH3X4Noh95+jFollnkx468xnzUdHs2aDHkvg== X-IronPort-AV: E=Sophos;i="5.82,219,1613451600"; d="scan'208";a="41476562" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PP3ZwZ0VgTXT92mijYjp5LG19kcwVniCezFwajGVbGphd3PlLSP4v3MuRfIFaV8ySYIyYQxldv5U3iV9eU3rhJcLGFCgls4s4GcYN2EUp54/F6Qa4zqIRh1JXppB/cLGOY0P5kVNrzubtrQ2uvk8vBH1YSvm5H/F/DobhDbtnOE1ob+X3vz1RsfmSn0EUvhR9g3ncseqQgBpzAz7S6Vwh8R00+kj0v/VSPYIYpEuflnf0j9J9IehHiQeKGeRfsLifNPtyEBa1beX9GCnO7ptchp2w+XJHoykaOOTIBGWMpLTJUgumHpK9Y6up54RSTCEwLZKR2MStrjPuBaQfNdSpQ== 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-SenderADCheck; bh=qDZhAJDB/rsUQo+Z4e8pQdhxsoyKmVpWA1PSI58wKuU=; b=h19POVAQunWfkCqXZGZn3OCtC00PQCc1Em8SuDn2A4Xia5cNNovmHEY9oebZFPEHTqBXyHewwOEeLeZNlAUALfgQBmJ45Mw/HtZCPeeOfgA1dvuquBgMZfagNpp2jTBUVbcr78l/8NNxV0/OiHoh/g4w+B8kBF4g5TdVKxMSkyJRfo2Mp/VtlmTh1/eKdIZm8VwXsjJrYnyuXcHh+sTwzGJRhsRDHDAMqp+9ZC+kHNfSTG2ycg+xLtJtMCq8+mtYpI0IAQKdjhs1wK4nk5XExJeYduuJOAHkGW8HJrGtWgP44R58G3kVun6++bZs4pPx/iNf86+JkyoSga4tvXk5Jg== 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=qDZhAJDB/rsUQo+Z4e8pQdhxsoyKmVpWA1PSI58wKuU=; b=cFxUb1fIRubkaC1putWAOfaK/NMLjcrZg3d5UyZ0wcVTgE+Sk7cUjf2xSOFmimilNkJAeOO9IeqAqbbq4KdDYtT/2IMN7bxUdzDdUq8KTG6SKOCA+wOa9pWI8W9peOSbB5h167Hs/H1rjlzQjjshwpe3o9W8+Xp0GeoavMlFHQ8= From: Roger Pau Monne To: CC: Andrew Cooper , Roger Pau Monne , Ian Jackson , Wei Liu Subject: [PATCH v2 14/21] libs/guest: introduce helper to check cpu policy compatibility Date: Tue, 13 Apr 2021 16:01:32 +0200 Message-ID: <20210413140140.73690-15-roger.pau@citrix.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210413140140.73690-1-roger.pau@citrix.com> References: <20210413140140.73690-1-roger.pau@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MR1P264CA0022.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:2f::9) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efdc4159-a63a-4dcf-9dda-08d8fe84e186 X-MS-TrafficTypeDiagnostic: DM5PR03MB2553: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a2oAP/yFTX6/8n6x/Hh76oJ9N2vaZXSPu44dvv1a+w8su5/0bzthNQFWZZkSLzQAXlHDDY/v2QPrB/eXP9uRaHROKHaFpQR7HDTLKx3lKAlPDIyk0xls8jmXa7I3hyXD5vhykpl/hjfbSeoGMLqlfinQC1XfIEsbhtiyi8FEGUq9NGyYq6X8oFUALNpOwC1VmZFtWO/f8x6EjxEoqoPBT2l2TcTk37kscKcf65b5rwamIjEZ55jhaXowySkvuBkvqgZTOkL04jrSNjMvGVBhG1p2ddMZVbZM6GmWt067TqcXiK3O9gQGED0Vypa35hd79bcRn4+vE5l5Fo1ayQFu/fT/hnSKUcEOGJkANifB5cBMCcVcJMywv4pELPcHgo9YETOIEAbuw2ADLL2zp7vWiMIXcjXj6Lc9EYO5Qu+RYensgsJBJJbaG3TcUnvY3jPpn8XDKe50WS+Fdl8aMv8+n4+Tia992VqkIb4/iei6Dtelo0V2iaImx2aX9fNoUJsPMuma9nRTCQPpZGXapKszCBuI6ZGIdmAGABA0InkYx/R2m/2UggD+mfCJfwtoIMgWe2dHBjgVMV41qa+P2z8LzgvDkZfIUG8o7TVwZbJXAKI= 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)(376002)(136003)(396003)(346002)(39850400004)(8936002)(6496006)(186003)(83380400001)(38100700002)(2906002)(66476007)(86362001)(956004)(2616005)(8676002)(478600001)(66556008)(66946007)(6666004)(6486002)(16526019)(316002)(6916009)(36756003)(54906003)(1076003)(5660300002)(4326008)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?dmRpWHNJdGR2VEZ0dXdLbWRRdGIwUWZVQ0paWlViY3Y1ZTFOZGxQWVNlM0R0?= =?utf-8?B?UWRzYmU1R0dSdGNVV2w1UDVPeWNoZjdVazByS21M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ckc4Q1h1YkxMc0lyajZrc1l0aEhKcXEvVTFjUDY4c09xOXpj?= =?utf-8?B?UjloYTlaT29mN1Fxem1SZjNUTUhsNUJoRFY3czBhcUtLT1Z2bXMrNHNhRUVw?= =?utf-8?B?M1Nld2srWmhXaWhRQ2JpZ3FZOVJGYlA2aDBJQkpSS29odGVhWEhRRHZvQVhW?= =?utf-8?B?cm93MUZpYi9TenR6d1lUdWlxRHc0NXFMZTdBNlpvRVhtcUZkMEZORk1JWEJy?= =?utf-8?B?REtvVzJwZUNHejdMcTN0bXF5RkNXTXFTS2NuRWpsZDVnZTgrbUxaeUowUTFo?= =?utf-8?B?MzFZM29zdmNpeDVrazRGRkI5azRrdzQyUHNZZ0d3NnY1b09Raldybm9FVUFN?= =?utf-8?B?dWZzaXdHaTdUVjFvNEFkZk51WUY2N1hlVjM4YytsYnRHeFBTandnNWF2cFor?= =?utf-8?B?OC9KSzByZ1IzZHh1ME1uc3ROQ1ZwSStVQXVuQndXL3Z3NmhWWlJYMXhCdVM2?= =?utf-8?B?blAyMWNuODVlWlVUOXZnaGI1SWUyWElzc0p5a0x1UDdUblFZaGtKZ1FtRWZJ?= =?utf-8?B?WEtYRTBFSjg5bUJMUWVNVE9xZUw5WXdOYzVtRUVjekRXYXg0Wnh5UXNTY29W?= =?utf-8?B?M2VqZU1leWpEMDk3bjlpWDhRTGYyL1pjWEVOcTliNUlGanUyZU9GclRhdUFN?= =?utf-8?B?eTQ3eFRPMEpZSDV5NjVnL3cxTHJXMnBvSDl3ZVZsdndXVlFrb0lVTTZQejIy?= =?utf-8?B?WFBUcHJtYktSMDJEY0FNRmM5eEVDUnQ4Q3F3MW5UdGVSNGRqT2l2eENTZXVL?= =?utf-8?Q?bP6KInMj/McpyWCo6huqyllhxu1rNm0+oljgXCg?= X-MS-Exchange-CrossTenant-Network-Message-Id: efdc4159-a63a-4dcf-9dda-08d8fe84e186 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 14:03:14.7785 (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: 7hIOav2WbjNwSbrWFaROLkZYL4jnSDbZCBwqwAACZYCosVX65fF9DEWOdExlwvzzGtOYZ6MJPGK+1zWGwZmYbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2553 X-OriginatorOrg: citrix.com X-ZohoMail-DKIM: pass (identity @citrix.com) Such helpers is just a wrapper to the existing x86_cpu_policies_are_compatible function. This requires building policy.c from libx86 on user land also. No user of the interface introduced. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v1: - Initialize err. - Explicitly name parameters as host and guest. --- tools/include/xenctrl.h | 4 ++++ tools/libs/guest/Makefile | 2 +- tools/libs/guest/xg_cpuid_x86.c | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 9a6d1b126d8..5f699c09509 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -2619,6 +2619,10 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc= _cpu_policy_t policy, int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy, const xen_msr_entry_t *msrs, uint32_t nr); =20 +/* Compatibility calculations. */ +bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t = host, + const xc_cpu_policy_t guest); + int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps); int xc_get_cpu_featureset(xc_interface *xch, uint32_t index, uint32_t *nr_features, uint32_t *featureset); diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile index 604e1695d6a..6d2a1d5bbc0 100644 --- a/tools/libs/guest/Makefile +++ b/tools/libs/guest/Makefile @@ -40,7 +40,7 @@ $(patsubst %.c,%.opic,$(ELF_SRCS-y)): CFLAGS +=3D -Wno-po= inter-sign ifeq ($(CONFIG_X86),y) # Add libx86 to the build vpath %.c ../../../xen/lib/x86 =20 -SRCS-y +=3D cpuid.c msr.c +SRCS-y +=3D cpuid.c msr.c policy.c endif =20 # new domain builder diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x8= 6.c index 26b09322dfa..bd2f31dd87f 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -925,3 +925,22 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cp= u_policy_t policy, =20 return rc; } + +bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t = host, + const xc_cpu_policy_t guest) +{ + struct cpu_policy_errors err =3D INIT_CPU_POLICY_ERRORS; + struct cpu_policy h =3D { &host->cpuid, &host->msr }; + struct cpu_policy g =3D { &guest->cpuid, &guest->msr }; + int rc =3D x86_cpu_policies_are_compatible(&h, &g, &err); + + if ( !rc ) + return true; + + if ( err.leaf !=3D -1 ) + ERROR("Leaf %#x subleaf %#x is not compatible", err.leaf, err.subl= eaf); + if ( err.msr !=3D -1 ) + ERROR("MSR index %#x is not compatible", err.msr); + + return false; +} --=20 2.30.1