From nobody Sun Apr 28 05:06:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1659123297; cv=none; d=zohomail.com; s=zohoarc; b=Xjs86dPCakid8rVIbqo9XD/f8i5DrOueAjP3ZFUY6ralu/0pwlS6PjF8ky/Bzoswl2LwKlipKWDJsW65JJQEP4EkiVmN2hp3JqSuMnwSaBd9rCI8my7sg5dTZIqwWwg2dRS4SuG39bunqDJxq5f9ZIAjrFSs3v63/CvtBHgOWaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659123297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Nctmn30ex3/VU6D4KECSFDmOOY9vKpIC+cakpOlvodU=; b=CphI95f39dbs6eqkLecrGDR+jWf5avhTBCxjdxBv2slrzvCuFt3Hf/VZ6vt3EtETYrx3QHIq5q0SsY/cxAEIXKSvwA4rhQ0CQjN7UEiZ8Li+yWtv5lbhrES6cfVIq8A4zf+StOaNMmTo8PsGlG1fihIWNycadCjH6EYc5Fsmkew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1659123297902421.4886133062979; Fri, 29 Jul 2022 12:34:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-DaToD2jHNSCGdXXDusiKmA-1; Fri, 29 Jul 2022 15:34:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 60F992812C30; Fri, 29 Jul 2022 19:34:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A90A40CFD0A; Fri, 29 Jul 2022 19:34:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0C53E194D6D6; Fri, 29 Jul 2022 19:34:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0E126194D6CD for ; Fri, 29 Jul 2022 19:34:49 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 018E31415121; Fri, 29 Jul 2022 19:34:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F14A01415118 for ; Fri, 29 Jul 2022 19:34:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D45802812C46 for ; Fri, 29 Jul 2022 19:34:48 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-35-v13P51j0OASMvCEDlmeR6A-1; Fri, 29 Jul 2022 15:34:44 -0400 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM6PR04MB5654.eurprd04.prod.outlook.com (2603:10a6:20b:a3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Fri, 29 Jul 2022 19:34:42 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0%6]) with mapi id 15.20.5458.025; Fri, 29 Jul 2022 19:34:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659123296; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Nctmn30ex3/VU6D4KECSFDmOOY9vKpIC+cakpOlvodU=; b=Om1EpRqpILU+p81bA1naOlPfktMfyVVvNP4W1v0URnlDMqCOKALt8uaMBJ+veG7vbsqNCT 24QWuu2zBQkrGf3GMCCYxSyJNKtIJMbthJqW7UiC3WIpemjFGA8Qao4f9291Wcn6i+j5ht OOD+QMDXOD31oMv41IYlcToy1auyOH0= X-MC-Unique: DaToD2jHNSCGdXXDusiKmA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: v13P51j0OASMvCEDlmeR6A-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH V2 1/4] conf: Add support for specifying CPU max physical address size Date: Fri, 29 Jul 2022 13:34:33 -0600 Message-ID: <20220729193436.15575-2-jfehlig@suse.com> In-Reply-To: <20220729193436.15575-1-jfehlig@suse.com> References: <20220729193436.15575-1-jfehlig@suse.com> X-ClientProxiedBy: FR3P281CA0113.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::12) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a64b328-08c5-44c7-a0a7-08da71996272 X-MS-TrafficTypeDiagnostic: AM6PR04MB5654:EE_ X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: FEGjIGfwNRFgyGHiiMIMJOlfcVwR7hWAkazgHiRKXLaPdig22FJ2LKhjRtqCXlQ9R6nB889yhptI1b63OFnXxcXTty7rvgta8IUa9Uak3pgs1hW/1UKEezPNruwAx9sdMS7QDzrIfBd6qZdQvnT+iIDXAJblNhmGNS6nwj2xo6zxiHB2hSNu1X4xAQGgYBrgDQagcmOPeNiR678wk6bNWKlpGnedxHu4AhDF+5Zk78wLpl9WgOeAG+VdVj+3zeB0c1JMK1k7kjmp7WujdpmWiephYxg5KYXvs5f8HA6H6Ct21CYqQ3c9u9a3jZSh+nfqlD+snmmWVq/XVU2OfzxxeLFrUJXrGZryvyfdbkf2PweX9QBU4BiG1Pzh981T7my266P5s4u2FUfGSZJFbogd7/wY9qkgcRA9tX5sD+K7l8ovnCcogyY0gKwu2I0y0QtEavwugzoWtlq7phxPZl4UZYMrVnOm08SPNuyEn8QbfbrJV9Te2h1QvhBlvA1rwXzs1Jjr/tn65z5RyYzM3IAlsdpbDYmniRw4NwiP7JZtHzMGhmD+om+xPxtFZxDmAIFX4XWILZIqBsKxxKf5CCIbmDKyKQFTbZq9wdkNoad7vNZypKs6WsZatKvLtLIMnRdvCLwq8qoDy2TJYWhqopdjdnH6o9xAwjGs+TITlTWqF5ssUtVkQAlIa4jVstVlqe8dSrps3oe8L1nrVoYDOMnPBPLVYOQ4aDDtp9g9P33e6w58PdrwZq/pJFGe1JRaleMT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(396003)(346002)(39860400002)(376002)(366004)(86362001)(6916009)(66556008)(316002)(8676002)(66476007)(4326008)(2906002)(8936002)(5660300002)(83380400001)(6666004)(6506007)(1076003)(478600001)(38100700002)(36756003)(6486002)(2616005)(186003)(107886003)(6512007)(41300700001)(66946007)(26005); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?v/kXY2OZxhlcluoUyPloTwYrcQcdjrQ2ptdRLBScobdRboNGa/GEZnNA4Daw?= =?us-ascii?Q?icGEdNEd+4Q49EQKrP3jQxn/JvayNV/sD4hkCRvH62GyR5bwiBo/lBC+7MYC?= =?us-ascii?Q?Z2IX3IHbgD8Kw1s1UoR7QCPugqbYKjyI+/5UkN0KijY5Qs5hn4qZyJb+kpGb?= =?us-ascii?Q?YBkDPZ2MjGFT2Z2cXKr7Ao/sIPoQOD2ISxiB4GUy75XdfCpOCVBIDcDbLxaO?= =?us-ascii?Q?xIR60IbocoE9X6dQFvN2oorTLwRVgtpKbuiRwdgJkfM44IN6RoOsYPpE7b1z?= =?us-ascii?Q?KKHKZjWrTfgvaJmQ3bLzExjA2EBe+28u5Y8SNu4lBmWkxBaQSjx3aDNxdKpU?= =?us-ascii?Q?2az/p8B06VE5qo2xzr+T7z+WgOgBwi6q5bLvzwq7ZbaE0z6WYvBQlvpkinrz?= =?us-ascii?Q?5JML+m5NVbfkkeyWewmdjeWGNzl67Ip7kaR1o0sTxksaH6nwT0Xa4bR7QADi?= =?us-ascii?Q?B/QI2ZMuim23X64RvwKOK3M4HOkB3/FrW+FwLoG8nMjrDWSwGyWxLySXDmGI?= =?us-ascii?Q?BI++/h/qJHvogjaRo1zssjDseSwAuoWWAUhKgR4jgJmmcS8Hv7iBjft2uBCO?= =?us-ascii?Q?3RLdaWPMimvqerczGdgc6Wxrgav/MBNgMrXCDbBAjUoGY4/oN+eAXonynU2o?= =?us-ascii?Q?6hMjau2LWrg/cLONHFE02G2L7b52xHZU5U50zawfWDz89NIol1+cBtFAq0t/?= =?us-ascii?Q?VQHlb0qsKztKCnaXN5VLNwIj77+GBCT/YqEjDnE7YBREG3l+TStVGnaAuavV?= =?us-ascii?Q?UG5xxXFSW/CI+iiD1MX55UpE9XoOUnWqszugAOM8C+U+m97hQ7HGB/Pdgf0M?= =?us-ascii?Q?9NN0gLXFODrnqAFTFkVUXPUfV+5Telcr6Q7M0Y5IHYjMO3l+wOTrIaCk1NGw?= =?us-ascii?Q?bDl8Tp+EdDto3YpLPdYhOBlQq13MYWB7lJDFmShugsv8ZjIx0147sE+dV465?= =?us-ascii?Q?q/0Y/veShzuuNoPeMNCYH3FdKbiaEn/HX+UjMq6/0/V3hqsb8BaoIiP94L6F?= =?us-ascii?Q?exP7ebtZeUkjTEU6L8e7Qjutx2y2ctEgKhuJQ8A6P0vQ16/4Jj5sNon33bH3?= =?us-ascii?Q?qYfq2nTv96ymQWFdgP4s1jxvHnIHxwV09dzklLVTBZFyWNqb595tIZIwZh/+?= =?us-ascii?Q?bdqxzJJCJIpOFrhKWgEkyAo4NoKyBl1eVL/XHwVgHKsWJVH+xLrUFqfWfYVo?= =?us-ascii?Q?GQZVKgkUutcodP/XWa+yK/632fwUDXGtPNepYwIWDINjiwYA0+CUMmr4G70O?= =?us-ascii?Q?wzGiBc8Km5r1lC9qbKoAFcS4Pn/rLsa00+xG4OMSJGDhNhnlA2GRJr0049xs?= =?us-ascii?Q?vJE7zwKFbGIFGGO7+05oI1Fgl7miIafpc2EI0P5LSxKx3VLslKnuj2vqMab+?= =?us-ascii?Q?V7m/ep6Ns5yL95mOCBhWrX/blIXECcapCsr5KCDBUrA97qcZQs2fQ8120iIL?= =?us-ascii?Q?wmc2iuXVIBgMbJQEGXnQN8Tf9jfubNg0zqDI9RHnQnPOc3o1jVhwdNyw9pG7?= =?us-ascii?Q?v95tiDZe7uPtMwN6RCLvBf0+st0Qv83mrLG3qDA5g+eSfMdbsTlg7PxJBccR?= =?us-ascii?Q?yd65U4PHQ6Meq4Fv+2mwCA7IXp/iB7CqT6Iwm3H0?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a64b328-08c5-44c7-a0a7-08da71996272 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:34:42.5085 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S1Yh8ubv5EqcJmWQP3PBhbwiml2WG+PT+NVtOqSuZlJ5RHOBRca4MA7EkSQsLNjkfB2fBbRPwQejmvhgU57yug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5654 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dario Faggioli Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659123299437100003 Content-Type: text/plain; charset="utf-8" From: Dario Faggioli This patch introduces the sub element of /domain/cpu, which allows specifying the guest virtual CPU address size. This can be useful if the guest needs to have a large amount of memory. If mode=3D'passthrough', the virtual CPU will have the same number of addre= ss bits as the host. If mode=3D'emulate', the mandatory bits attribute specifi= es the number of address bits. Signed-off-by: Dario Faggioli Signed-off-by: Jim Fehlig --- docs/formatdomain.rst | 23 ++++++++ src/conf/cpu_conf.c | 54 +++++++++++++++++++ src/conf/cpu_conf.h | 17 ++++++ src/conf/schemas/cputypes.rng | 19 +++++++ src/libvirt_private.syms | 2 + .../cpu-phys-bits-emulate.xml | 20 +++++++ .../cpu-phys-bits-passthrough.xml | 20 +++++++ tests/genericxml2xmltest.c | 3 ++ 8 files changed, 158 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 1ed969ac3e..adfdd7b7a5 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1336,6 +1336,7 @@ following collection of elements. :since:`Since 0.7.5` Intel + ... @@ -1352,6 +1353,7 @@ following collection of elements. :since:`Since 0.7.5` =20 + ... =20 @@ -1600,6 +1602,27 @@ In case no restrictions need to be put on CPU model = and its features, a simpler The virtual CPU will report no CPU cache of the specified level (= or no cache at all if the ``level`` attribute is missing). =20 +``maxphysaddr`` + :since:`Since 8.7.0` the ``maxphysaddr`` element describes the virtual = CPU + address size in bits. The hypervisor default is used if the element is = missing. + + ``mode`` + This mandatory attribute specifies how the address size is presented= . The + follow modes are supported: + + ``passthrough`` + The number of physical address bits reported by the host CPU will= be + passed through to the virtual CPUs + ``emulate`` + The hypervisor will define a specific value for the number of bits + of physical addresses via the ``bits`` attribute, which is mandat= ory. + The number of bits cannot exceed the number of physical address bits + supported by the hypervisor. + + ``bits`` + The ``bits`` attribute is mandatory if the ``mode`` attribute is set= to + ``emulate`` and specifies the virtual CPU address size in bits. + Guest NUMA topology can be specified using the ``numa`` element. :since:`S= ince 0.9.8` =20 diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 8d80bbd842..e31c4ab467 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -82,6 +82,12 @@ VIR_ENUM_IMPL(virCPUCacheMode, "disable", ); =20 +VIR_ENUM_IMPL(virCPUMaxPhysAddrMode, + VIR_CPU_MAX_PHYS_ADDR_MODE_LAST, + "emulate", + "passthrough", +); + =20 virCPUDef *virCPUDefNew(void) { @@ -127,6 +133,7 @@ virCPUDefFree(virCPUDef *def) if (g_atomic_int_dec_and_test(&def->refs)) { virCPUDefFreeModel(def); g_free(def->cache); + g_free(def->addr); g_free(def->tsc); g_free(def); } @@ -252,6 +259,11 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) *copy->cache =3D *cpu->cache; } =20 + if (cpu->addr) { + copy->addr =3D g_new0(virCPUMaxPhysAddrDef, 1); + *copy->addr =3D *cpu->addr; + } + if (cpu->tsc) { copy->tsc =3D g_new0(virHostCPUTscInfo, 1); *copy->tsc =3D *cpu->tsc; @@ -644,6 +656,39 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, def->cache->mode =3D mode; } =20 + if (virXPathInt("count(./maxphysaddr)", ctxt, &n) < 0) { + return -1; + } else if (n > 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("at most one CPU maximum physical address bits " + "element may be specified")); + return -1; + } else if (n =3D=3D 1) { + g_autofree char *strmode =3D NULL; + int mode; + int bits =3D -1; + + if (!(strmode =3D virXPathString("string(./maxphysaddr[1]/@mode)",= ctxt)) || + (mode =3D virCPUMaxPhysAddrModeTypeFromString(strmode)) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing or invalid CPU maximum physical " + "address bits mode")); + return -1; + } + + if (virXPathBoolean("boolean(./maxphysaddr[1]/@bits)", ctxt) =3D= =3D 1 && + (virXPathInt("string(./maxphysaddr[1]/@bits)", ctxt, &bits) < = 0 || + bits < 0)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("CPU maximum physical address bits < 0")); + return -1; + } + + def->addr =3D g_new0(virCPUMaxPhysAddrDef, 1); + def->addr->bits =3D bits; + def->addr->mode =3D mode; + } + *cpu =3D g_steal_pointer(&def); return 0; } @@ -811,6 +856,15 @@ virCPUDefFormatBuf(virBuffer *buf, virBufferAddLit(buf, "/>\n"); } =20 + if (def->addr) { + virBufferAddLit(buf, "addr->mod= e)); + if (def->addr->bits !=3D -1) + virBufferAsprintf(buf, " bits=3D'%d'", def->addr->bits); + virBufferAddLit(buf, "/>\n"); + } + for (i =3D 0; i < def->nfeatures; i++) { virCPUFeatureDef *feature =3D def->features + i; =20 diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 5d2980edbd..113d349708 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -116,6 +116,22 @@ struct _virCPUCacheDef { }; =20 =20 +typedef enum { + VIR_CPU_MAX_PHYS_ADDR_MODE_EMULATE, + VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH, + + VIR_CPU_MAX_PHYS_ADDR_MODE_LAST +} virCPUMaxPhysAddrMode; + +VIR_ENUM_DECL(virCPUMaxPhysAddrMode); + +typedef struct _virCPUMaxPhysAddrDef virCPUMaxPhysAddrDef; +struct _virCPUMaxPhysAddrDef { + int bits; /* -1 for unspecified */ + virCPUMaxPhysAddrMode mode; +}; + + typedef struct _virCPUDef virCPUDef; struct _virCPUDef { int refs; @@ -140,6 +156,7 @@ struct _virCPUDef { size_t nfeatures_max; virCPUFeatureDef *features; virCPUCacheDef *cache; + virCPUMaxPhysAddrDef *addr; virHostCPUTscInfo *tsc; virTristateSwitch migratable; /* for host-passthrough mode */ }; diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index 122880fb2e..4ae386c3c0 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -305,6 +305,22 @@ =20 + + + + + emulate + passthrough + + + + + + + + + + @@ -432,6 +448,9 @@ + + + diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6a5c5600df..774a594983 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -120,6 +120,8 @@ virCPUDefParseXMLString; virCPUDefRef; virCPUDefStealModel; virCPUDefUpdateFeature; +virCPUMaxPhysAddrModeTypeFromString; +virCPUMaxPhysAddrModeTypeToString; virCPUModeTypeToString; =20 =20 diff --git a/tests/genericxml2xmlindata/cpu-phys-bits-emulate.xml b/tests/g= enericxml2xmlindata/cpu-phys-bits-emulate.xml new file mode 100644 index 0000000000..e463e0b3e0 --- /dev/null +++ b/tests/genericxml2xmlindata/cpu-phys-bits-emulate.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/genericxml2xmlindata/cpu-phys-bits-passthrough.xml b/tes= ts/genericxml2xmlindata/cpu-phys-bits-passthrough.xml new file mode 100644 index 0000000000..cce676eaa6 --- /dev/null +++ b/tests/genericxml2xmlindata/cpu-phys-bits-passthrough.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index b83367cb4b..bbe0d02226 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -246,6 +246,9 @@ mymain(void) =20 DO_TEST_BACKUP_FULL("backup-pull-internal-invalid", true); =20 + DO_TEST("cpu-phys-bits-emulate"); + DO_TEST("cpu-phys-bits-passthrough"); + =20 virObjectUnref(caps); virObjectUnref(xmlopt); --=20 2.36.1 From nobody Sun Apr 28 05:06:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1659123298; cv=none; d=zohomail.com; s=zohoarc; b=iF0HNyOu3/qGp3c+e5hAQZnvbc5F+TPKGaWsGCzAr+D50RMAum43eHt6CU2yjg6IDGpyT5SJY1y3V4QhgXDiMGXnffHgrp1oVprROoc6CtmCRBx2mUDneQld5Q4SCyi8dmieaLyG/c8Q/JGLCy4GY+ioQXPDkqKUEbo0ebGoDhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659123298; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fu9zr5mnr8udxCuOOfpdjv/hPzGB+Yr/AKGJkFWfJXs=; b=G2oibFErB2o2nyplDTGbqgcO3KjPeWx9G/tNgGwi8bILwxe4iONcUNv5JNbRB9O5MKZIV3mrdZhcNCLnAH3pv5l4vneWzfFH5oQ5SikQ6Gj1CkW+AtxJfD5xe4SGFwCFDUO1JTBSfeKvcCXH8rCnGeUtpY+7eimKAc8Yc7KPDBA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1659123298829521.1629124761926; Fri, 29 Jul 2022 12:34:58 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-170--ZHnxa5CNpyvadWKQ3BnhQ-1; Fri, 29 Jul 2022 15:34:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9D268032F0; Fri, 29 Jul 2022 19:34:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3B6940C128A; Fri, 29 Jul 2022 19:34:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 91E86194D6D2; Fri, 29 Jul 2022 19:34:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C8EEB194D6C7 for ; Fri, 29 Jul 2022 19:34:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B539A2166B2C; Fri, 29 Jul 2022 19:34:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B03E02166B26 for ; Fri, 29 Jul 2022 19:34:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E1EC1C06EE3 for ; Fri, 29 Jul 2022 19:34:51 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-35-qq9MhahdOxattcyzulZlTw-2; Fri, 29 Jul 2022 15:34:48 -0400 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM6PR04MB5654.eurprd04.prod.outlook.com (2603:10a6:20b:a3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Fri, 29 Jul 2022 19:34:45 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0%6]) with mapi id 15.20.5458.025; Fri, 29 Jul 2022 19:34:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659123297; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Fu9zr5mnr8udxCuOOfpdjv/hPzGB+Yr/AKGJkFWfJXs=; b=BTCMQxn6CRVOWS4Iymdl/Tlwms99sfDOuToAvhOPIviXcp9OLDaTFZ1iA+gS9J1PVIzRG2 wx/WHnUR/UqCQEoj8kQ+MLOzIw5gSdimHGm2Lzh2kvbhCqQq/LNBk3uMHzcYOK03/5wLAH OWDxIEJlX9m/9VN6SPZVl8vRyXhjLmM= X-MC-Unique: -ZHnxa5CNpyvadWKQ3BnhQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: qq9MhahdOxattcyzulZlTw-2 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH V2 2/4] capabilities: Report number of host CPU physical address bits Date: Fri, 29 Jul 2022 13:34:34 -0600 Message-ID: <20220729193436.15575-3-jfehlig@suse.com> In-Reply-To: <20220729193436.15575-1-jfehlig@suse.com> References: <20220729193436.15575-1-jfehlig@suse.com> X-ClientProxiedBy: FR3P281CA0113.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::12) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0599addf-943a-4651-a94e-08da7199644a X-MS-TrafficTypeDiagnostic: AM6PR04MB5654:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: UzbqqHwAfve1tzmYvJKGTmUKtO244hbF2dBCZsn4cCDTtxkp3hfcRTCqkEmlRXUJMHQ1/Qw9MIKMgz5hWdPRLMdnhpuKmF4jFZLgfWsEEAmUzeCvn3w76SnxQSMgvAUDoGk4yB37qPfsa6tYSKNvgYyYDcO8oBpqLhsxYMM5I5Y8PlwMSDEvKj3K9Ids87Kc0x39QdvftufXYajdoja78k8IbaWs3GzcW0kTEqhYSOw8ob3kCllawRV8iAkkMtkri1r0GoEQutkKH90gGCqFK803hfukOfqPvV0a89suq7uhloNCQp5JUecbiqUFCGskB1gLs3ZW15n26i+d1MTHwSOIYLGTqNcql/xhEGWeODheDBBxnR286rCwafdq7k8kUXlVmxaWA/0hfErXpt5aojy60ozdptw8VjQ8JIE4AW5oDLcbtiMiFdJKSZNUfQI0/EWa23KIBVE3nrswbnuPr0YED9TyEKuet4dRDIU1uZaz29ulXgcIunoepD0boxrGEhmqTJg/CfcRDWXR9HNzZQ6HfM+3FPA5xlTzRs1mjd6bB4EAjvCxjk0dRcpXcFfD+owFglbKvDzcdio5RvI+LX8RdwJbnTBlv4w4wis9uOjmH9O8ZMSn5mZqmaOVK400jZiWdJCXTlJN3O04ZNebtiWDfpNdzDQsq9FzftLmTe70x8GbTah23sosvW4GP1rQ/Y4cC8GlTzClT5QgKHSL18WaTF/SzaQlclDS4Xq8DapEswG9DWg1+cePyMqZOzsV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(396003)(346002)(39860400002)(376002)(366004)(86362001)(6916009)(66556008)(316002)(8676002)(66476007)(2906002)(8936002)(5660300002)(6666004)(6506007)(1076003)(478600001)(38100700002)(36756003)(6486002)(2616005)(186003)(6512007)(41300700001)(66946007)(26005); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?53QLoZnTvCeGETndeNVfpn7qpGqC8p37WKEh19XbwtyJ3EdLWZvN7IAjiYmI?= =?us-ascii?Q?e6jv7/nd94rg/HFgSATnhw/TrNxVyMj+RcQe5+6VZbSwjr0znryBw0Mhh/fc?= =?us-ascii?Q?m3beQMozK6pCwiq4D2Smam3eIJfKzHdPVvrEKMybgLiozf6LPH0pu78S6Chk?= =?us-ascii?Q?1F5I+W45KWQjv/0CMd9QtEK8ywM43AoW4z96gat70UpE3fJI9VqXPyzdbmYT?= =?us-ascii?Q?maHKq3Dqza2+H3sAW8vKPnc6BEhv1PsAknekm8tm3tl7QUhdF/02WOU1x+Ds?= =?us-ascii?Q?Pw511WR6alSWTi3P+QhD+4vSEQKSQ3g5nIdtr3VKfEye1UkIcSz50nMtwb7q?= =?us-ascii?Q?OcVK8szHbjqDJwGq6rNmQOYnLbgw5/FABZ85h7E85oQOOq8LyDN8PI1Z7x3K?= =?us-ascii?Q?fgfvXPtpg97FsxlDhjxxnRVks9VaI/BgReSEaVHG6YSEqrl9Jk8Tj2+l8GXl?= =?us-ascii?Q?+iUo16rekDWtnOtCOJfsz+yXpi793m7H923dgPmSHDsDc6tmEUmjItvDByj5?= =?us-ascii?Q?t45hMfValSdpUnJh2Io2tMu2XKhweFZCJ4y8RFjTKy1Y7jtE7noCmMnTYQBQ?= =?us-ascii?Q?KGmo7WBc0647JyPW/iPbWXESiFbs9ffx8+kxVMcYQmB3a3Em3HQT9JL8Sj5A?= =?us-ascii?Q?n1WJtad9jUcRGwcIxhQEV/hS+32a8kdG9Mie+PaROM6OhqNPRR4QcHaru6m4?= =?us-ascii?Q?gFxm7IWQ1hHTPpSkr317c4PQZpIyotE8PQ8pB3abqFm8S1WTZLD9kZqg43R4?= =?us-ascii?Q?I5u5D16cxGOrsZ4mVIFaSn5m/2gcS5rwMJUyB0vbIF1St23Cel4s6jvlUO2b?= =?us-ascii?Q?jopSJA32BMl3gRa8tcug8szkBN1BjHoxSam5CO0OUiz6lFsmUzyH+YhB8kNq?= =?us-ascii?Q?DuMYR5+CmwrOI2gmDPE7JRr8eK64PGZaLEO+HcfFH1imIJmkfwoE5ndWmo++?= =?us-ascii?Q?HvdjfSlzdzUglUJ5Maug1It+HPMS2f+wzsJx5PSDM01qFXPL1Vy21GsW5bSC?= =?us-ascii?Q?+2cbvyw1fkP4fyE+MQEgCGA7523Jx5iPyAVnvmXbDCSKz2YFuY/ExJoB9G0E?= =?us-ascii?Q?ezt4H1fYArrjEam5idux2OEszry2XiGjiyZnpINuF4QOv+f7DBFcI7mfpCyQ?= =?us-ascii?Q?zaefTB5/JGgyYeB8Bunwj4u7CccDpdQFfw3X4sL7MnzZcdJaEaFxnetptvHI?= =?us-ascii?Q?6LMdgbiRzWpOo4ujqfXFOBBPk0Dz0oOga5a/u3FpbCxxnRVWwmodHVvQ51CD?= =?us-ascii?Q?Q9wt+1rIvwW5dAjm0asQgdRUhDcP7Atuvjj22nYwdib5N1oC6+863PBtKYcc?= =?us-ascii?Q?xmJhUs8Fe3tggl0e012Ev/JU9lv4IbIkn1jBedABaBB6LmNm3LSatqbsVvpp?= =?us-ascii?Q?JhrqCVUPd4lZnr2Xune1qv+20by+01Dg8hIwkj7BfJX5EFWeVXnNsMNTdRdA?= =?us-ascii?Q?HJFOjSPt9GpJyZY9WmaDAUXiZDHM+s7DwKLVlZPiguwIyAL/ExHaJ2yt6zPF?= =?us-ascii?Q?H6C0qnJauc2QSkLzoEtQgIH6sH6UY2C6vOsY7H1h1XpPVG9NpnAdNjs8cX9C?= =?us-ascii?Q?PF6z8+y0Bd5wS86e+w0PBDFk89GK4iBAAWKy2Zha?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0599addf-943a-4651-a94e-08da7199644a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:34:45.5864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /wgl9rI4s8xZJBbX1T9ZJqg/ocRo6vZwmbVJUbtigmrSvtzYrLGvC0GoYE/HOuWWMgwTi08Cku2TgK2xD+5hug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5654 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659123299051100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jim Fehlig --- src/cpu/cpu_x86.c | 8 +++++++ src/util/virhostcpu.c | 55 +++++++++++++++++++++++++++++++++++++++++++ src/util/virhostcpu.h | 3 +++ 3 files changed, 66 insertions(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4bb2ea4bae..9fcd6b8add 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2738,6 +2738,7 @@ virCPUx86GetHost(virCPUDef *cpu, virDomainCapsCPUModels *models) { g_autoptr(virCPUData) cpuData =3D NULL; + unsigned int addrsz; int ret; =20 if (virCPUx86DriverInitialize() < 0) @@ -2784,6 +2785,13 @@ virCPUx86GetHost(virCPUDef *cpu, VIR_DEBUG("Host CPU does not support invariant TSC"); } =20 + if (virHostCPUGetPhysAddrSize(&addrsz) =3D=3D 0) { + virCPUMaxPhysAddrDef *addr =3D g_new0(virCPUMaxPhysAddrDef, 1); + + addr->bits =3D addrsz; + cpu->addr =3D addr; + } + return ret; } #endif diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 639dd9b51e..668e468f2a 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -570,6 +570,41 @@ virHostCPUParseFrequency(FILE *cpuinfo, } =20 =20 +static int +virHostCPUParsePhysAddrSize(FILE *cpuinfo, unsigned int *addrsz) +{ + char line[1024]; + + while (fgets(line, sizeof(line), cpuinfo) !=3D NULL) { + char *str; + char *endptr; + + if (!STRPREFIX(line, "address sizes")) + continue; + + str =3D line; + str +=3D strlen("address sizes"); + + /* Skip the colon. */ + if ((str =3D strstr(str, ":")) =3D=3D NULL) + goto error; + str++; + + /* Parse the number of physical address bits */ + if (virStrToLong_ui(str, &endptr, 10, addrsz) < 0) + goto error; + + return 0; + } + + error: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing or invalid CPU address size in %s"), + CPUINFO_PATH); + return -1; +} + + int virHostCPUGetInfoPopulateLinux(FILE *cpuinfo, virArch arch, @@ -1616,6 +1651,20 @@ virHostCPUGetSignature(char **signature) return virHostCPUReadSignature(virArchFromHost(), cpuinfo, signature); } =20 +int +virHostCPUGetPhysAddrSize(unsigned int *size) +{ + g_autoptr(FILE) cpuinfo =3D NULL; + + if (!(cpuinfo =3D fopen(CPUINFO_PATH, "r"))) { + virReportSystemError(errno, _("Failed to open cpuinfo file '%s'"), + CPUINFO_PATH); + return -1; + } + + return virHostCPUParsePhysAddrSize(cpuinfo, size); +} + #else =20 int @@ -1625,6 +1674,12 @@ virHostCPUGetSignature(char **signature) return 0; } =20 +int +virHostCPUGetPhysAddrSize(unsigned int *size) +{ + return 0; +} + #endif /* __linux__ */ =20 int diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h index b8ea7aafad..5232fee36d 100644 --- a/src/util/virhostcpu.h +++ b/src/util/virhostcpu.h @@ -58,6 +58,7 @@ int virHostCPUGetInfo(virArch hostarch, unsigned int *cores, unsigned int *threads); =20 + int virHostCPUGetKVMMaxVCPUs(void) G_NO_INLINE; =20 int virHostCPUStatsAssign(virNodeCPUStatsPtr param, @@ -86,6 +87,8 @@ virHostCPUTscInfo *virHostCPUGetTscInfo(void); =20 int virHostCPUGetSignature(char **signature); =20 +int virHostCPUGetPhysAddrSize(unsigned int *size); + int virHostCPUGetHaltPollTime(pid_t pid, unsigned long long *haltPollSuccess, unsigned long long *haltPollFail); --=20 2.36.1 From nobody Sun Apr 28 05:06:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1659123301; cv=none; d=zohomail.com; s=zohoarc; b=kKHrN41cqDYMJnVJU3GuaKt2FaqU6Rt1k1/E28dnJCBcLWH0jWjltU3u29jb9oJ1AWPOZ74n9Khp0iTUd1tivTQxC7J+eOTdl06CQV4qKrJPkOKrbly3wGVcnTsImFUe0Ig/vAn9NaiBmWAYIQVwr50LOqNXvp/Nw0QalooXGxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659123301; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5Qcw0jnJu0LN2nrjvKHAa/xcqQto0BdeKHG9WZWpLRs=; b=T72vCkfxh17xJQIupJjVKTSiZEwUKTT3WFdH+UUeEogImA0WNsHhljxLp87/yenl6IuPokzPHXzyBSqdVONQFhB0z/avClG39WgJc6yho+d2ks8chhn+20Rjzoo2iyAFYVlXgXS03ZvFPUeA8htLu2mvg+gehPYKk23U/iD1vnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1659123301358658.7687560270576; Fri, 29 Jul 2022 12:35:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-144-KjSAxS0bMlK994kZXo7R3w-1; Fri, 29 Jul 2022 15:34:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7057C1C06EE3; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A2BA40CFD0B; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 201E4194D6D3; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3CA67194D6D2 for ; Fri, 29 Jul 2022 19:34:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2CE701121314; Fri, 29 Jul 2022 19:34:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 277FD112132C for ; Fri, 29 Jul 2022 19:34:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 088D6803918 for ; Fri, 29 Jul 2022 19:34:54 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-35-K5mxDeuWOHm6WVV5kTrdqg-3; Fri, 29 Jul 2022 15:34:50 -0400 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM6PR04MB5654.eurprd04.prod.outlook.com (2603:10a6:20b:a3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Fri, 29 Jul 2022 19:34:48 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0%6]) with mapi id 15.20.5458.025; Fri, 29 Jul 2022 19:34:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659123299; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5Qcw0jnJu0LN2nrjvKHAa/xcqQto0BdeKHG9WZWpLRs=; b=bbcGobtiPOvCFCuf95TUrWqT6OjnprlP+n14QWiy0AlXhyzPfWwzBjFUHHAVWuaCYkEKBz 0hRALR4G3k3zc8MjZQshnIIuu4hxXS7jw8BlETX7Euy/sqBlA56w+ADk4bGdmzQrcXjXQS A58Y481uYJpv9PVIgyGE3mYiFFlCULo= X-MC-Unique: KjSAxS0bMlK994kZXo7R3w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: K5mxDeuWOHm6WVV5kTrdqg-3 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH V2 3/4] qemu: Add support for max physical address size Date: Fri, 29 Jul 2022 13:34:35 -0600 Message-ID: <20220729193436.15575-4-jfehlig@suse.com> In-Reply-To: <20220729193436.15575-1-jfehlig@suse.com> References: <20220729193436.15575-1-jfehlig@suse.com> X-ClientProxiedBy: FR3P281CA0117.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::8) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0cc2a3d5-2e2c-498d-76aa-08da71996627 X-MS-TrafficTypeDiagnostic: AM6PR04MB5654:EE_ X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: QwZuvD2sLBOBON40cco0sYK0aB8M+CzpbTJ3gUCuaXbhp51Rqod8XA6mfj7LDkuu+86iFyiwtWAJ0OT66CrNkVEgiqJRuvI558zQuPqXOW2k5nT0gjagQRFP/7dm9CNrCotIewhubVxfc0GNeXZjDOzLobsCT34SXTayjRym4G8CHWSCvQ5baoSAPl685eCkj8Zjdtb4aFPsbIdkdodKHYr57O8W3A+cUD4Eb1MIiE1ndlo7KBHEb8mMH1I9NFMYCT3gOa0+LlmBWpb6XiAPu+JhEPjt1u3Pbn7lz84GJStdG7akhOavTb/BTFAKqzjfkm4PpbHQt5HUN87ni4sTINgr5zUNkCS3nvHC2brVHJjrOIzt+jqlYUMXj2J9uYmwQLvxstr3Fbph9NQjeuQRmplfXTCWNvc9pge/dIY1zajxGz2keE6rnF8GjZ6j0GjQmIgeuA8CxOa7W0d20KKQFC7ZVAIrJ7TMvq4hS24XDpdMUnElFkHC8nd4Fn/5z4/r44vk9dYzuJrbZ1g80IGy+dWZL4WC6XptKrQzsIa0HNfGER4qykSBsWy53VvNrpeG8omeReFM+ARpFASyyd4SO/ya6irwJmkiUvAUGYPgfD2aOrhiLRIpxIKEz09q8B5bIRwpe2MW/kzUgwTgei565r7sD0TbDF5TYtgPQJL9mN5YHQeRPuZ+5u/cN9O1A4sTJEjHAS0eJoIK7mB5NOLq8PtQ/eAoqKSL8GBSVDv/5U2jrWPqWgkVTLvxE/ixwpPk X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(396003)(346002)(39860400002)(376002)(366004)(86362001)(6916009)(66556008)(316002)(8676002)(66476007)(4326008)(2906002)(8936002)(5660300002)(83380400001)(30864003)(6666004)(6506007)(1076003)(478600001)(38100700002)(36756003)(6486002)(2616005)(186003)(107886003)(6512007)(41300700001)(66946007)(26005); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?h1gALaCJBD3fu19JF3ouPccLSYDSifRC+sX/SK9yvmIoEAK1V/ZLJMjOpYm6?= =?us-ascii?Q?JPLgKpY+uGfCdgy1GO3xTXNXuImkXeVFSXThVTbDMLcS7JTn9Dsaqa22/hGu?= =?us-ascii?Q?XDaGTp2zNuhtH6+i90/9PVNWCN064YzPZM9Yp4I/snIPjsKTrCFi6pLkaoXV?= =?us-ascii?Q?sTMhthraIRwLmjMN02ielX28j9xXHjwV2Psd7UAxWJnAP6ZA+bm4JB6Uo1DD?= =?us-ascii?Q?sTiAfwElq7loVv+aw6/+i7tFZVjxpeQDcViR49qM3pJAObX+qVoyJD6Tt2Oi?= =?us-ascii?Q?0V5XShf4W9CE1xuvtNrliXmEtGVyoZzySP5Bfr7XoAUGjQcUPXmC173BSHjB?= =?us-ascii?Q?3y2KeKCjnfR1M3EOjMunsMI0IVM5jIo/KDo2OH0EZapwRbdUO54zKXmCnh2K?= =?us-ascii?Q?CkhnLd6AwMBri+gugTU7fNtmYR56y5U3DMdJk10wOenlNA2z7ZxcoF78ba1P?= =?us-ascii?Q?eK7b1dDjCmJH24n3yPc7nm8kgsUqdfSFQkO4/YAFjMGW/km7ozYRmIlnW/X8?= =?us-ascii?Q?uW3B4yswT9esYacRHQ1y4JQH8xH/Mh2viHpkCgWkSkxWJxLgUPMGyP+iPkEV?= =?us-ascii?Q?FLqwDrfbiKoWhBrYZdDs/uEWdUosn34DN5cGAmRV3+ZYZ0ezGyzX1uoIMzAh?= =?us-ascii?Q?xLyKBtB28CNfYJQlHpFbpGTbvN0Ykqg1N2iuX7kVCz+m7Y6sSFnPyeHk+tL/?= =?us-ascii?Q?9wwRFUXPnySYV7yXt0BZRzLAxfWwVVvb92AWv5AaH2CNl9oe6kKqKHjMCor0?= =?us-ascii?Q?XXT2njJOYRaBJIoPR22aDNwin44Vbpx+wL0alezlaq6t0T/AXGjE7Zq8PzP9?= =?us-ascii?Q?IBbH80sIwYuK9niOmrJDHdRSwjwUexOJ3Z/VRFWHSnf+SAf8n2agIFWuDuQa?= =?us-ascii?Q?dNvlLFinp7gCr6HGkQMytq+gB7pySv5cC5baBzyUUEs+mn4C6C7qKxp5InXK?= =?us-ascii?Q?6w2GnSlAGDm6XRP9Ru+KZ1HqUxCs4WN/p8GyaiKN8f/Gfqai4IjaNyBvRdIv?= =?us-ascii?Q?zzfkYcnIjFjO1qrLX/JjxKvJb/70rh7rNHiuVRu0jxFLSs70Yd4wbmTtl2St?= =?us-ascii?Q?JwXOtXGbxf3Bk8Qxsi1tYoknhjXs47qNDLMh5G1NFcXMdtJkQC9CYKl2E7ea?= =?us-ascii?Q?b1G4EFZVe+8paZNmYHqDucc/VLCnBSqi32Ti2H7QuNzYR0gOMn2ogmzbi1EV?= =?us-ascii?Q?pbsgAzpIyyGAfKDnd/cZie+buunYPH3lClt5KiTnIEh4CVGCr/+Z4f7AlisW?= =?us-ascii?Q?jdd7wxpIJeLz7ubPvW5y22K7/9eMqkuBLnxmp5EtYPl+REnvkcyG59KHj+wh?= =?us-ascii?Q?ehkUZGLpSwA92OjnCPo2kR5+hWnI1hkisaLG33vWwgjaGM2ZvZiVYdT64a7o?= =?us-ascii?Q?z70XG7RJP1sC1xIzSo7WRJV9+zRJArGYf9uzZLWcPLfqQmQRZqKKrfo5tf68?= =?us-ascii?Q?qZDc7oGtaXDDa/VrrPelNx90K2hA9e7VctmYyI7X2dC2ImSbxLdW3DvgWCvF?= =?us-ascii?Q?IyXe2geCjWaI5Nv2QiuzJX1G+j2hs+biQ1LtbeoB6/ujhEAIrtpl9NTX0ote?= =?us-ascii?Q?gjRiJaAV6A+ZBfMj8ZWHUG7AfO0yEDbJN7tkIp5f?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0cc2a3d5-2e2c-498d-76aa-08da71996627 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:34:48.7268 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v0Vxg/QcalhFTZ1b4Tk2vWOYwfqJy1IXJfIWZ7c6108OlhHuZwxZlU3XYTSkLUfAVfbw5ZdMN1M05+bb1UTcEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5654 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dario Faggioli Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659123303300100001 Content-Type: text/plain; charset="utf-8" From: Dario Faggioli This patch maps /domain/cpu/maxphysaddr into -cpu parameters: - becomes host-phys-bits=3Don - becomes phys-bits=3D42 Passthrough mode can only be used if the chosen CPU model is 'host-passthrough'. Also validate that an explicitly specified bits value does not exceed the physical address bits on the host. The feature is available since QEMU 2.7.0. Signed-off-by: Dario Faggioli Signed-off-by: Jim Fehlig --- src/qemu/qemu_command.c | 21 +++++++++ src/qemu/qemu_domain.c | 46 +++++++++++++++++++ src/qemu/qemu_validate.c | 12 +++++ .../cpu-phys-bits-emulate.args | 32 +++++++++++++ .../cpu-phys-bits-emulate.xml | 20 ++++++++ .../cpu-phys-bits-emulate2.args | 32 +++++++++++++ .../cpu-phys-bits-emulate2.xml | 20 ++++++++ .../cpu-phys-bits-emulate3.err | 1 + .../cpu-phys-bits-emulate3.xml | 20 ++++++++ .../cpu-phys-bits-passthrough.args | 32 +++++++++++++ .../cpu-phys-bits-passthrough.xml | 20 ++++++++ .../cpu-phys-bits-passthrough2.err | 1 + .../cpu-phys-bits-passthrough2.xml | 20 ++++++++ .../cpu-phys-bits-passthrough3.err | 1 + .../cpu-phys-bits-passthrough3.xml | 20 ++++++++ tests/qemuxml2argvtest.c | 7 +++ 16 files changed, 305 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 30c9bbbf2e..acf214be00 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6847,6 +6847,27 @@ qemuBuildCpuCommandLine(virCommand *cmd, virBufferAddLit(&buf, ",l3-cache=3Doff"); } =20 + if (def->cpu && def->cpu->addr) { + virCPUMaxPhysAddrDef *addr =3D def->cpu->addr; + + switch (addr->mode) { + case VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH: + virBufferAddLit(&buf, ",host-phys-bits=3Don"); + break; + + case VIR_CPU_MAX_PHYS_ADDR_MODE_EMULATE: + if (addr->bits !=3D -1) + virBufferAsprintf(&buf, ",phys-bits=3D%d", addr->bits); + else + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Physical address bits unspecified")); + break; + + case VIR_CPU_MAX_PHYS_ADDR_MODE_LAST: + break; + } + } + cpu =3D virBufferContentAndReset(&cpu_buf); cpu_flags =3D virBufferContentAndReset(&buf); =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b02ffc9a2e..0c97744b72 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4429,6 +4429,52 @@ qemuDomainDefCPUPostParse(virDomainDef *def, } } =20 + if (def->cpu->addr) { + virCPUMaxPhysAddrDef *addr =3D def->cpu->addr; + + if (!ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU maximum physical address bits specificat= ion " + "is not supported for '%s' architecture"), + virArchToString(def->os.arch)); + return -1; + } + + switch (addr->mode) { + case VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH: + if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU maximum physical address bits mode '= %s' " + "can only be used with '%s' CPUs"), + virCPUMaxPhysAddrModeTypeToString(addr->mod= e), + virCPUModeTypeToString(VIR_CPU_MODE_HOST_PA= SSTHROUGH)); + return -1; + } + if (addr->bits !=3D -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU maximum physical address bits number= " + "specification cannot be used with " + "mode=3D'%s'"), + virCPUMaxPhysAddrModeTypeToString(VIR_CPU_M= AX_PHYS_ADDR_MODE_PASSTHROUGH)); + return -1; + } + break; + + case VIR_CPU_MAX_PHYS_ADDR_MODE_EMULATE: + if (addr->bits =3D=3D -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("if using CPU maximum physical address " + "mode=3D'%s', bits=3D must be specified t= oo"), + virCPUMaxPhysAddrModeTypeToString(VIR_CPU_M= AX_PHYS_ADDR_MODE_EMULATE)); + return -1; + } + break; + + case VIR_CPU_MAX_PHYS_ADDR_MODE_LAST: + break; + } + } + for (i =3D 0; i < def->cpu->nfeatures; i++) { virCPUFeatureDef *feature =3D &def->cpu->features[i]; =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 764d5b029e..b6c7d3b06a 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -380,6 +380,18 @@ qemuValidateDomainDefCpu(virQEMUDriver *driver, break; } =20 + if (cpu->addr && + cpu->addr->mode =3D=3D VIR_CPU_MAX_PHYS_ADDR_MODE_EMULATE && + driver->hostcpu && + driver->hostcpu->addr) { + if (cpu->addr->bits > driver->hostcpu->addr->bits) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The number of virtual CPU address bits canno= t " + "exceed the number supported by the host CPU"= )); + return -1; + } + } + return 0; } =20 diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate.args b/tests/qemu= xml2argvdata/cpu-phys-bits-emulate.args new file mode 100644 index 0000000000..f612f6889b --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-foo \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-foo/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-foo/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-foo/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfoo,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-foo/= master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel kvm \ +-cpu host,phys-bits=3D42 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate.xml b/tests/qemux= ml2argvdata/cpu-phys-bits-emulate.xml new file mode 100644 index 0000000000..f8bd63bc68 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate2.args b/tests/qem= uxml2argvdata/cpu-phys-bits-emulate2.args new file mode 100644 index 0000000000..3489f44ded --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate2.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-foo \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-foo/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-foo/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-foo/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfoo,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-foo/= master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel kvm \ +-cpu core2duo,ds=3Don,acpi=3Don,ss=3Don,ht=3Don,tm=3Don,pbe=3Don,ds-cpl=3D= on,vmx=3Don,est=3Don,tm2=3Don,cx16=3Don,xtpr=3Don,lahf-lm=3Don,phys-bits=3D= 42 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate2.xml b/tests/qemu= xml2argvdata/cpu-phys-bits-emulate2.xml new file mode 100644 index 0000000000..188b3066ed --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate2.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate3.err b/tests/qemu= xml2argvdata/cpu-phys-bits-emulate3.err new file mode 100644 index 0000000000..5e21998259 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate3.err @@ -0,0 +1 @@ +unsupported configuration: if using CPU maximum physical address mode=3D'e= mulate', bits=3D must be specified too diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate3.xml b/tests/qemu= xml2argvdata/cpu-phys-bits-emulate3.xml new file mode 100644 index 0000000000..30a14894dd --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough.args b/tests/= qemuxml2argvdata/cpu-phys-bits-passthrough.args new file mode 100644 index 0000000000..df04195d1e --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-foo \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-foo/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-foo/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-foo/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfoo,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-foo/= master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel kvm \ +-cpu host,host-phys-bits=3Don \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough.xml b/tests/q= emuxml2argvdata/cpu-phys-bits-passthrough.xml new file mode 100644 index 0000000000..db570beb8d --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough2.err b/tests/= qemuxml2argvdata/cpu-phys-bits-passthrough2.err new file mode 100644 index 0000000000..22009cc6e6 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough2.err @@ -0,0 +1 @@ +unsupported configuration: CPU maximum physical address bits mode 'passthr= ough' can only be used with 'host-passthrough' CPUs diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough2.xml b/tests/= qemuxml2argvdata/cpu-phys-bits-passthrough2.xml new file mode 100644 index 0000000000..511bbf9949 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough2.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough3.err b/tests/= qemuxml2argvdata/cpu-phys-bits-passthrough3.err new file mode 100644 index 0000000000..28f2e43432 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough3.err @@ -0,0 +1 @@ +unsupported configuration: CPU maximum physical address bits number specif= ication cannot be used with mode=3D'passthrough' diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-passthrough3.xml b/tests/= qemuxml2argvdata/cpu-phys-bits-passthrough3.xml new file mode 100644 index 0000000000..a94e567dcb --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-passthrough3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b72d61c3bc..4fd5120b70 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3470,6 +3470,13 @@ mymain(void) /* HVF guests should not work on Linux with KVM */ DO_TEST_CAPS_LATEST_PARSE_ERROR("hvf-x86_64-q35-headless"); =20 + DO_TEST("cpu-phys-bits-passthrough", QEMU_CAPS_KVM); + DO_TEST("cpu-phys-bits-emulate", QEMU_CAPS_KVM); + DO_TEST("cpu-phys-bits-emulate2", QEMU_CAPS_KVM); + DO_TEST_PARSE_ERROR("cpu-phys-bits-emulate3", QEMU_CAPS_KVM); + DO_TEST_PARSE_ERROR("cpu-phys-bits-passthrough2", QEMU_CAPS_KVM); + DO_TEST_PARSE_ERROR("cpu-phys-bits-passthrough3", QEMU_CAPS_KVM); + if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 --=20 2.36.1 From nobody Sun Apr 28 05:06:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1659123309; cv=none; d=zohomail.com; s=zohoarc; b=Spi2lQzbMDuo03xcK+csTAhgYJxqEJK2PWIN3INkN8AWOuC/3zELv2PyriYhkg/l4JUrdT5GM5sa/RpzSASMZ8fiAPCmbd33lfgwjvZdw+JGolHcvtyzaJyzB/WWvY33+4BS2CF15JVWm2Cu4HeZ+nGtJ9EiFgR7Jt7xhOJ8DFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659123309; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WmYWOHcCn9ByznWhiwbsVtApNw1mi0NoBDuE2ZucC8M=; b=Xd5X3jWS07WdsX8+EDGSSGs2kHX4AuHR5CpXIElhBgySsNTSAt1i8/aXj9leETkI1y8/sk/JfxTdCVds2fzhnXJ2HzY2CY10zAm1yLJuyNMQHoE0bBA/R26lI5KkmpL5UATex4rkKZ9ypFh56K1jmflpRzwr+9NBfXbF13coNoo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1659123309797921.6342015002002; Fri, 29 Jul 2022 12:35:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-OCMzEo0cPuS9EfRCjUA4EQ-1; Fri, 29 Jul 2022 15:35:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CAC162812C35; Fri, 29 Jul 2022 19:34:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B702640C1288; Fri, 29 Jul 2022 19:34:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 772F9194D6D6; Fri, 29 Jul 2022 19:34:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D8B1C194D6C7 for ; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BC7792166B2C; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B688E2166B2B for ; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9853A382ECCA for ; Fri, 29 Jul 2022 19:34:55 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-bz5SkOTeMJGz_yic0p_5pA-1; Fri, 29 Jul 2022 15:34:53 -0400 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM6PR04MB5654.eurprd04.prod.outlook.com (2603:10a6:20b:a3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.23; Fri, 29 Jul 2022 19:34:51 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::6de4:cdb8:bebb:ac0%6]) with mapi id 15.20.5458.025; Fri, 29 Jul 2022 19:34:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659123308; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WmYWOHcCn9ByznWhiwbsVtApNw1mi0NoBDuE2ZucC8M=; b=ee6dDNMOcvLmvYhg1uO/+ZTxXS9FeDtAHWsn9y9tL70+ZGSjhyfXMQl1jMOClT5oZ5euVE D5HTRKopY4vh7rBJ7iOEVnbShgb4fA1E/L5TYcdZOlHuFiVVBk0KwyOQSS136ZbHC/xW0Q oxylFs9HGs5qJg9Kw4f1/mHpNBvyDpA= X-MC-Unique: OCMzEo0cPuS9EfRCjUA4EQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: bz5SkOTeMJGz_yic0p_5pA-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH V2 4/4] cpu conf: Check ABI stability of CPU maxphysaddr config Date: Fri, 29 Jul 2022 13:34:36 -0600 Message-ID: <20220729193436.15575-5-jfehlig@suse.com> In-Reply-To: <20220729193436.15575-1-jfehlig@suse.com> References: <20220729193436.15575-1-jfehlig@suse.com> X-ClientProxiedBy: FR3P281CA0118.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::13) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b2c9bcf-a077-43da-6ae1-08da7199680b X-MS-TrafficTypeDiagnostic: AM6PR04MB5654:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: S89+sLPCw06tX3n+Lf+gmffQxo7/EZP7aAhUn0tO6FopAtlOHmIDScV3LXhcLjnUdabQMRpeBD2c14Hs9KsbGyLWcFz1TgHW793rlxVR9GC5nTFt3rk49gi/pnNpEGKfmiDXa+qP3NicTwJtM91IgMeai2BZMu0uTe+sJBGAh93musyzwuvXmQPYCBZbf3Wsev+6eyerupPm6c5Y6DpcW4R+R/dZv84RhINJpStsDbwDAxY+KwFvjvSE1YUJtpnGultvV3N8gSi6KsfznnLc/yQMiN6Je2QHuzJPgxMyhiDcvqGde5RwfG5ysmcRR1yjvflz/dPAF3zWKO58o45ZG1VVsymg06qW9eB3D8+PRfeMBp42ElWkdSK5XuBJ7cgSG8tiz8hmGJcMIx8/v9P6PiSFQwyO8etBaGSH0WnBcl2+jJgWxhq5aWwmLULhWXb9BLmQSuj+hqx1PV2rgMYjCR7QveAyE07N1/bH9bLx1ESzqNxi82PqOMJ3P1bV89MW+j7ojG+h8+IbVme8LjjOaxtEQNr7hC2/ySTmBa9amK7ASsZocc5VpJ+Ags9IDYjqc888YScFE+LhrkuUJ6FOeaibwWis0dJBHxrtvSsuKsvhxDOg6LZRyYLpp3hlsOlS+rgheW7N7uJVjIdhqwy8jzqGdxgYidlqrVsCwcHrGezExCUm4Xr2Kn1xPvW9qKaH+I1IpvGZNkOYv9mpKohRMewN+AuylSjJ5jbalPCrbSODJKONT7xgqjStNN4uIbt2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(396003)(346002)(39860400002)(376002)(366004)(4744005)(86362001)(6916009)(66556008)(316002)(8676002)(66476007)(2906002)(8936002)(5660300002)(6666004)(6506007)(1076003)(478600001)(38100700002)(36756003)(6486002)(2616005)(186003)(6512007)(41300700001)(66946007)(26005); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eJS4/Fu6cMeJ+pFNQsdP8/TVZhkLJRxxZvaMB6tPZoRFHLNOro4oz/JsFBQ/?= =?us-ascii?Q?2w2j68G2BR6aJOpd/hwKNFZDGZhwdA4Y14Q7ms0fgU+umSKtOkDFS9gzclrB?= =?us-ascii?Q?BTWnhDdFuCGjhMdy5X7dXnt6g6xcIScqbyuQ2mAfTZIsA+8JOTuytrj5or1z?= =?us-ascii?Q?l2kXC1Q60kLYZvoBuFi66W42uNT23eoOG8+8PFft2JGKHuc/+c1Nakwm6gkZ?= =?us-ascii?Q?21zf8jwrwR4BKgGoGT8H82eW52lKcRnHainyr5zKfEde4OHVL4rbWuy8Og2C?= =?us-ascii?Q?u62xw/9LIYWS/JkYwpti+AMJ5gIdD86wj2S0OJlX4r0C6baKSqsmD2Ko1jTM?= =?us-ascii?Q?KkSYBfPq2QFbZsBj3QJBbUPH0G9l0P9SBiIgGID89v6Zc343qJ8SSE/DajYx?= =?us-ascii?Q?TIuLc4oj+rtG1UfphXX5bkvbn4Rgpeec4sXRXwG+1eieSnHWEdP0vBKC3VP1?= =?us-ascii?Q?IooQX3VEx9sWDXRD95snKRmzulME5Sqirg4JHn2u4w213aD9TnYe2ozzmZQw?= =?us-ascii?Q?Ti75BdPxv6VBRk1iY/kgWzD9aM/zle0Ea6U5vBZ6h50ds20MnBXhsZ7U6Y14?= =?us-ascii?Q?OpvhqYlB2kctn+LJZS+WeizEB0Ux7veBEpiy8X0T7R4VET/s2GMi8TSGCg8U?= =?us-ascii?Q?0/vFV1t2f210KUYWvdwca7mMUqY4Y9wtv/UVPnB81MnWPeVEAEy+pf3JolFt?= =?us-ascii?Q?zJOoTUr8GN2T1gSTkOJBA4THj08k3EvaH5mxt0vy4wX2+PYpVskOtyus9OZf?= =?us-ascii?Q?bMjqQVElj9ILa5oPM9GB98lmubcN/gVCujB03ebpDVwRVrVRSkZIG5cpoOD/?= =?us-ascii?Q?JJBUzWvEYtrj323eEWj3Z8by+WzhjlOUixHp/19FPiLIXHjnHZTkIcTy6lkl?= =?us-ascii?Q?Qlfowz3v8P/GL7wF6JDE+MhcjBKR08sUVWfC1YiH11o5TlvjDfWz+65/tCXp?= =?us-ascii?Q?eOsO7lbqAbaSELv9IpM9q5mCNTHD2LpH+hIp0OGcGpUccU1oXe1tpIdBMzVo?= =?us-ascii?Q?cf2FS90dHgSoiYEP8XGtf0CDptEBkMNIyu4Oabg5FXz+IzP7vBHih+yiU2Tg?= =?us-ascii?Q?jkub1mNmeSbhOJAT+j46I1nL1NUAlCQ+1xW7SKHCVqaQSJ4ZAdFHQPScebW5?= =?us-ascii?Q?tU+PsqdWVB0zcrZQ9sdXIAPQZCGVQORjclf28w4eCa8RAAcI2C2y3UsMimmR?= =?us-ascii?Q?hc3XfQdbqlQseRhRRznHcTb5J7jk7mthQato/pmb4vjuDxJF507kkA/HENbv?= =?us-ascii?Q?8ZWVVFmsMt97zzZEDWr0KOf+LLG6n+foR7by4wFj5fqF4qcRclqo9tsMJ8h9?= =?us-ascii?Q?cH3XyQx1ZHILLtQwva92kjev7sATVLhIcpEKEqquYlsPmDHFxSpqpsLEgBLL?= =?us-ascii?Q?6ulL01bp1Ii5k5A9KMngzxGCbQ0Kdy6HV8pObfACwYWRN/lcMoCqXg5kJsSj?= =?us-ascii?Q?0cMyw9wIzKRj+N4rIvn+K/7Z3Ejzx/1s3mwKZGDNxUZDXlp8khE70Q6Z88cW?= =?us-ascii?Q?A94s/H7sTt8uylVYu6FtES8nOzF7L1/JMPJU3SM7EEyx7QzdH81ifYH8Y9kY?= =?us-ascii?Q?2VKt0mJEPWlHSU4oZkA29ZNMBJ4x1aWCisyW8fK2?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b2c9bcf-a077-43da-6ae1-08da7199680b X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:34:51.8203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZmFGXFg0piy23F7TTbSrCgCSFapwd0H+FGah14j0/fkqzcICNRP9elNWnrxCnIuvDzIVX0KkIIuAPA3WKlyAyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5654 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659123311175100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jim Fehlig --- src/conf/cpu_conf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index e31c4ab467..8e75cdbb4f 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -1127,6 +1127,15 @@ virCPUDefIsEqual(virCPUDef *src, return false; } =20 + if ((src->addr && !dst->addr) || + (!src->addr && dst->addr) || + (src->addr && dst->addr && + (src->addr->mode !=3D dst->addr->mode || + src->addr->bits !=3D dst->addr->bits))) { + MISMATCH("%s", _("Target CPU maxphysaddr does not match source")); + return false; + } + if (src->nfeatures !=3D dst->nfeatures) { MISMATCH(_("Target CPU feature count %zu does not match source %zu= "), dst->nfeatures, src->nfeatures); --=20 2.36.1