From nobody Sat Feb 7 07:25:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682525; cv=none; d=zoho.com; s=zohoarc; b=S3zRpNTEbKJ5jWqilPI27ScYcG74oHINJkbFwtySR8FjPBCPz3h6nCzj8jUHnKuDiaAd8aiHnPVqeMhxvZZWHktaVxTd4a2KshwQuRiW+5udmthuyZRolapNALDAFtpYdJkSz/adg9DZjTabRRX67tZgsy3lUS4gWMJjj2uUipY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682525; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DTBSRY5OtUyF5huourTB9rgioGe6GWvVQEwdmggXJCI=; b=dqEQu9sFhdx8jZ39mbsSZAZiIhI9ZvhzakZCo2gMn7Y+SG9P0EPQOfURR5mF0YxmAYHkrYegPQvrxMlPmimb20nZI66gE41yi5uoo/sfsAEC+eJFjuGeJTa3cBzGFG7sgsWYqQsNFZdairhghw/5IisP7T/tQNLjsRkh1hB2K+c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682525702657.9950850487514; Thu, 27 Jun 2019 17:42:05 -0700 (PDT) Received: from localhost ([::1]:55457 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgexi-0002zo-Lr for importer@patchew.org; Thu, 27 Jun 2019 20:41:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36352) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelN-0000dw-Ik for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgelM-0006xF-5Y for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgelL-0006wo-Tn for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3064B3084288; Fri, 28 Jun 2019 00:29:11 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5828600CC; Fri, 28 Jun 2019 00:29:10 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:44 -0300 Message-Id: <20190628002844.24894-10-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 28 Jun 2019 00:29:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 9/9] i386: Add Cascadelake-Server-v2 CPU model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , jingqi.liu@intel.com, Tao Xu , "Dr. David Alan Gilbert" , "Hu, Robert" , Igor Mammedov , Jiri Denemark , "Lai, Paul C" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add new version of Cascadelake-Server CPU model, setting stepping=3D5 and enabling the IA32_ARCH_CAPABILITIES MSR with some flags. The new feature will introduce a new host software requirement, breaking our CPU model runnability promises. This means we can't enable the new CPU model version by default in QEMU 4.1, because management software isn't ready yet to resolve CPU model aliases. This is why "pc-*-4.1" will keep returning Cascadelake-Server-v1 if "-cpu Cascadelake-Server" is specified. Includes a test case to ensure the right combinations of machine-type + CPU model + command-line feature flags will work as expected. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * Enable rdctl-no, ibrs-all, skip-l1dfl-vmentry (Suggested by Tao Xu) Cc: "Hu, Robert" Cc: Tao Xu Cc: jingqi.liu@intel.com, Cc: "Lai, Paul C" --- target/i386/cpu.c | 14 +++++ tests/acceptance/x86_cpu_model_versions.py | 73 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 10a09c971a..570890a7dd 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2343,6 +2343,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon Processor (Cascadelake)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { .version =3D 2, + .props =3D (PropValue[]) { + { "stepping", "5" }, + { "arch-capabilities", "on" }, + { "rdctl-no", "on" }, + { "ibrs-all", "on" }, + { "skip-l1dfl-vmentry", "on" }, + { /* end of list */ } + }, + }, + { /* end of list */ } + } }, { .name =3D "Icelake-Client", diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py index 165c0c7601..1c9fd6a56e 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -25,6 +25,10 @@ import avocado_qemu import re =20 +def get_cpu_prop(vm, prop): + cpu_path =3D vm.command('query-cpus')[0].get('qom_path') + return vm.command('qom-get', path=3Dcpu_path, property=3Dprop) + class X86CPUModelAliases(avocado_qemu.Test): """ Validation of PC CPU model versions and CPU model aliases @@ -229,3 +233,72 @@ class X86CPUModelAliases(avocado_qemu.Test): 'qemu64-v1 must not be an alias') =20 self.validate_aliases(cpus) + + def test_Cascadelake_arch_capabilities_result(self): + # machine-type only: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server should not ha= ve arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server should not ha= ve arch-capabilities') + + # command line must override machine-type if CPU model is not vers= ioned: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,+arch-capabilities') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabili= ties should have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,-arch-capabilities') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabil= ities should not have arch-capabilities') + + # versioned CPU model overrides machine-type: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v1 should not= have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v1 should hav= e arch-capabilities') + + # command line must override machine-type and versioned CPU model: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,+arch-capabilities') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capa= bilities should have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff,-arch-capabilities') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capa= bilities should not have arch-capabilities') --=20 2.18.0.rc1.1.g3f1ff2140