From nobody Tue Feb 10 03:39:37 2026 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650893334; cv=none; d=zohomail.com; s=zohoarc; b=eXYvD3J+u5yzoxK641kexfbNTvoUj4CMC/oZL++Fj9ErYM3qQnQ6BYkybjpjHjyc+IHSB2IQ32flXwQ02km5sygDIW/RGKzTerjTTNmtLHTrx9hoPuBi0zr1r59orTgjQFUJGYLPN8wH5pe1Wqum77bR9UyjtDZUW6ykLgUhYQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650893334; 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=40dXmvaMNySJvGWmrRYfTyfy4VR/XKtm+J5gsoa0OKc=; b=nsD0IIiEPyBmnGV3lsnh4OYu9K6l6KPcODiYqWLh75+Rs8rENmQpWRqtsjGvmsx0X8IvmGIKO+OwS3xV1HdMs02ltAR3swK8z/AW3K2mvm+cmPwkwpIGEw7WcOUU1ivgiAzDyqVQbjBmKMZvg+TQ0cHms+u6x2mpH+LakqTx7aI= 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=pass header.from= (p=none dis=none) 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 1650893334062935.1856644341843; Mon, 25 Apr 2022 06:28:54 -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-252-X_XY1AkLNzWxuhLlf6wsOw-1; Mon, 25 Apr 2022 09:28:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA1563C025AF; Mon, 25 Apr 2022 13:28:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C42AEC44AE4; Mon, 25 Apr 2022 13:28:42 +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 9278D1940346; Mon, 25 Apr 2022 13:28:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AD3FE1947BBF for ; Mon, 25 Apr 2022 13:28:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A04C154C74B; Mon, 25 Apr 2022 13:28:39 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 295C454CAEC for ; Mon, 25 Apr 2022 13:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650893333; 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=40dXmvaMNySJvGWmrRYfTyfy4VR/XKtm+J5gsoa0OKc=; b=gLg6CVpny+mnMTOy9F2vSbsDA+VPfk37KUziTnE3StTfzLSAP82xGl8Ayv2CLobLvSZF8v opKyxs2HB/gVkRbtYs+dstWYEc/6c9ebCdOmSw+4QY6mLHjc6yb8kXIe2boUYJqoR4yVkl zu9ZfrVU55DoYUAPVtRsRyKroBNN6/k= X-MC-Unique: X_XY1AkLNzWxuhLlf6wsOw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/7] virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD Date: Mon, 25 Apr 2022 15:28:31 +0200 Message-Id: <0b6a198b83e5aad4137a0126b0d6393f8f642a9b.1650893125.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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.85 on 10.11.54.8 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: 1650893336030100001 Content-Type: text/plain; charset="utf-8" AMD cpus report Core (compute unit) identifiers of the cpu running the instruction under leaf 0x8000001e. This data is not needed for libvirt and actually breaks caching of the qemu capabilities where we check that all of the CPU flags to be identical. Mask out all of leaf 0x8000001e. Signed-off-by: Peter Krempa --- src/util/virhostcpu.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 9a9fcf11c0..e3f2d6d4b7 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1324,11 +1324,13 @@ virHostCPUGetMSR(unsigned long index, * * Currently filtered fields: * - local APIC ID + * - topology ids and information on AMD cpus */ static void virHostCPUGetCPUIDFilterVolatile(struct kvm_cpuid2 *kvm_cpuid) { size_t i; + bool isAMD =3D false; for (i =3D 0; i < kvm_cpuid->nent; ++i) { struct kvm_cpuid_entry2 *entry =3D &kvm_cpuid->entries[i]; @@ -1338,6 +1340,47 @@ virHostCPUGetCPUIDFilterVolatile(struct kvm_cpuid2 *= kvm_cpuid) entry->ebx &=3D 0x00ffffff; if (entry->function =3D=3D 0x0b) entry->edx &=3D 0xffffff00; + + /* Match AMD hosts */ + if (entry->function =3D=3D 0x00 && entry->index =3D=3D 0x00 && + entry->ebx =3D=3D 0x68747541 && /* Auth */ + entry->edx =3D=3D 0x69746e65 && /* enti */ + entry->ecx =3D=3D 0x444d4163) /* cAMD */ + isAMD =3D true; + + /* AMD APIC ID and topology information: + * + * Leaf 0x8000001e + * + * CPUID Fn8000_001E_EAX Extended APIC ID + * 31:0 ExtendedApicId: extended APIC ID. + * + * CPUID Fn8000_001E_EBX Compute Unit Identifiers + * 31:10 Reserved. + * 9:8 CoresPerComputeUnit: cores per compute unit. + * The number of cores per compute unit is CoresPerComputeU= nit+1. + * 7:0 ComputeUnitId: compute unit ID. Identifies the processor= compute unit ID. + * + * CPUID Fn8000_001E_ECX Node Identifiers + * 31:11 Reserved. + * 10:8 NodesPerProcessor. Specifies the number of nodes per pro= cessor. + * 000b 1 node per processor + * 001b 2 nodes per processor + * 111b-010b Reserved + * 7:0 NodeId. Specifies the node ID. + * + * CPUID Fn8000_001E_EDX Reserved + * 31:0 Reserved. + * + * For libvirt none of this information seems to be interesting, t= hus + * we clear all of it including reserved bits for future-proofing. + */ + if (isAMD && entry->function =3D=3D 0x8000001e) { + entry->eax =3D 0x00; + entry->ebx =3D 0x00; + entry->ecx =3D 0x00; + entry->edx =3D 0x00; + } } } --=20 2.35.1