From nobody Sat Apr 27 05:59:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=amd.com) ARC-Seal: i=2; a=rsa-sha256; t=1572990911; cv=pass; d=zoho.com; s=zohoarc; b=Pc/kJ6ieIWJZV4gRviwvu62UhEKoYxQAVHH6p9yL3o8CWKJdJJKZWxgHdr3rReQE48t9QdQGMd07qA9rj/uBc9oxjyccWLAE+exPGuNErnP1AYKoG+9A2YpuQMIHe+XIMJ3MVzuWKKpoo2BgDbg0WBud17PVmYEn3JyRN2uMkyQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572990911; h=Content-ID: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=m/6V9e69wwS3YRHpyTsTLECGsF04XPio6t7FqHfy6m8=; b=k+e0Lq5Ww1d45U8woYhWVw4a9Ga3TmJkGFY1ZqXRO0RGXm2PuCa8VD9kEy/U5OLNNsTkp2oV/aofeOuV7TcFw/6UE3+w8o/YbCw+0dG1ZRAmcGADL2x0RtTVROP7Rh1hq0POSqvoolTpbF6UGqAU4AUjhsVhQGDRQ/Z9NYLZepY= ARC-Authentication-Results: i=2; mx.zoho.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=amd.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572990911583854.348945035708; Tue, 5 Nov 2019 13:55:11 -0800 (PST) Received: from localhost ([::1]:50726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS6n8-0000kC-Dr for importer@patchew.org; Tue, 05 Nov 2019 16:55:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37143) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS6Cj-0005v3-Eq for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS6Ci-0006Dw-Bh for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:33 -0500 Received: from mail-eopbgr720060.outbound.protection.outlook.com ([40.107.72.60]:6464 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS6Ci-0006DO-43 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:32 -0500 Received: from DM5PR12MB2471.namprd12.prod.outlook.com (52.132.141.138) by DM5PR12MB1323.namprd12.prod.outlook.com (10.168.237.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Tue, 5 Nov 2019 21:17:30 +0000 Received: from DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::c5a3:6a2e:8699:1999]) by DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::c5a3:6a2e:8699:1999%6]) with mapi id 15.20.2408.024; Tue, 5 Nov 2019 21:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVzG9xyLkE+JScwUaXHvhefH61DyzokeQUOyT/lXsTBMdybnSqTHa8enVUMYAJ7cy+i05bqscdCAYvb2A/U+/A73TxrC6cwbL8vQCuXMXrey3T9CkoODyL0l1h+VZ6QJTLdiipPQsrQ/g1nw4BGtBMAPvii0ZVHJhpmKbDtZckEcw2ERT2CyhZuaU+VrY6rzDfGAvsfCSR6sm68ren0BrhrmilGJOabm9BEdbiSUWCyvGqyrwL84XGFohMOrQPEt3wpAQSDkCcghtrlEctFim8mmKUFwO4UKUUssIQTvqVrIbk6iIKboszs6lN1L1eGhpH14nBvAhPQp9LF11IowaQ== 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=m/6V9e69wwS3YRHpyTsTLECGsF04XPio6t7FqHfy6m8=; b=XvTUe10jyHSiqN0VfWXGtM4aD5MG5SaHENjOB5XVI2Rfe8uMP3+BFZglIRX4CHn2aDZCHLLvY5ypq0lS5OBN5Sl+47aKNTl9MuQEMME+wX6iXjt1crmfgSyFnEiJqanRrpNcL/ZntLeCH0DTiyIb2YO4ivD5EG4AvGajndKbYDD5FGAl+Z2FSzzHmPr8Uh1zoVwsWWL00Kf4eLbPTI8HDUMkpoqt0CKr+pXM5HbUD7+H2WI7R3E62kP+j2ZqWKt7ySdZoe9qtfamRAHeeXbVacAxoYF5KV1hJs7KaMRshUGdKzW5OTqWmCLKJeHmeRIaelWcNXvJQvx18J4X5XN4YA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m/6V9e69wwS3YRHpyTsTLECGsF04XPio6t7FqHfy6m8=; b=McARwzEE3uFgjep6GtMvsE83VB+8P81HP0teL1iwHZnlecoi0o1fhoVdJukmkj+QWJNOosIiV61mW+ywvqasmSHn+szWS2A902D6khl+Y0UpsaWvpO/HxTujiAFa2ojjFLkeKGRJQUJZZ/XclvhoWa+gZ1pnXu8umzdMzWDMUmI= From: "Moger, Babu" To: "mst@redhat.com" , "marcel.apfelbaum@gmail.com" , "pbonzini@redhat.com" , "rth@twiddle.net" , "ehabkost@redhat.com" Subject: [PATCH 1/2] i386: Add missing cpu feature bits in EPYC model Thread-Topic: [PATCH 1/2] i386: Add missing cpu feature bits in EPYC model Thread-Index: AQHVlB5u/QshhXRmbESG6YL51EBKfQ== Date: Tue, 5 Nov 2019 21:17:30 +0000 Message-ID: <157298864859.17394.12763030347823834590.stgit@naples-babu.amd.com> References: <157298859935.17394.17194072829278152009.stgit@naples-babu.amd.com> In-Reply-To: <157298859935.17394.17194072829278152009.stgit@naples-babu.amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0401CA0020.namprd04.prod.outlook.com (2603:10b6:803:21::30) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 515f1f5b-09be-45cd-185a-08d7623590d7 x-ms-traffictypediagnostic: DM5PR12MB1323: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0212BDE3BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(199004)(189003)(5660300002)(6116002)(2501003)(8936002)(486006)(71190400001)(71200400001)(6512007)(52116002)(76176011)(86362001)(14454004)(6436002)(186003)(103116003)(26005)(3846002)(6486002)(2906002)(6506007)(102836004)(11346002)(446003)(256004)(386003)(66556008)(14444005)(64756008)(4326008)(316002)(99286004)(305945005)(7736002)(66946007)(478600001)(66066001)(66446008)(8676002)(66476007)(476003)(81166006)(110136005)(81156014)(25786009)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1323; H:DM5PR12MB2471.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; 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; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Fj9F87a4R8u0lQ/D6OVPPKs6bxrwdiYu+VaU7DSCTzYHL2RqADw602RgA82fw5Ah0YX5SidL1nk2b5jF/mplO1kBettfNZSw/p5onXJajjeHwMabfK7N5Ua1NyQjsoWFtaMroAgeoIi6N9DqDalRHooctLvrbShCHIHuItXOcDoDkdnU9nMnYuYOHSTHTrTWCOxKcV4Nlo6/uOyOMYfg2mTLojW3Wp+LU3PU74ys0zbiL0rD/7sZph9hpfxcVHet68BZXNKy30lUDeuzg17gExvXdVeNCnFfJl05HJSzVY5+2+n/mVnUjSM/oYLcOSOetqqWlh+SALo5ZjB8PAZK1BJUGpZTtT5Q8HmTtpNApVOnWAxvisT6/x+JVrF6PqWOs7tU5zSE2vn7BdCwZsxLeysj591hroThx+stJDEYpmmHv14MGhcoQZW9v74W4Rsy Content-Type: text/plain; charset="utf-8" Content-ID: <7E4E8DB7E0B1884891F2F2A66EA69617@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 515f1f5b-09be-45cd-185a-08d7623590d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2019 21:17:30.0637 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sbQGt1LV8xre1RurXNfKS9vluC4WyK99GqXu8vqJz+ZJaP0hL+KLXh4WHYakG4o9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1323 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.72.60 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: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @amdcloud.onmicrosoft.com) Adds the following missing CPUID bits: perfctr-core : core performance counter extensions support. Enables the VM to use extended performance counter support. It enables six programmable counters instead of 4 counters. clzero : instruction zeroes out the 64 byte cache line specified in R= AX. xsaveerptr : XSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error pointers and FXRSTOR, XRSTOR, XRSTORS always restore error pointers. ibpb : Indirect Branch Prediction Barrie. xsaves : XSAVES, XRSTORS and IA32_XSS supported. Depends on: 40bc47b08b6e ("kvm: x86: Enumerate support for CLZERO instruction") 504ce1954fba ("KVM: x86: Expose XSAVEERPTR to the guest") 52297436199d ("kvm: svm: Update svm_xsaves_supported") Signed-off-by: Babu Moger --- hw/i386/pc.c | 8 +++++++- target/i386/cpu.c | 11 +++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 51b72439b4..a72fe1db31 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -105,7 +105,13 @@ struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_M= AX}; /* Physical Address of PVH entry point read from kernel ELF NOTE */ static size_t pvh_start_addr; =20 -GlobalProperty pc_compat_4_1[] =3D {}; +GlobalProperty pc_compat_4_1[] =3D { + { "EPYC" "-" TYPE_X86_CPU, "perfctr-core", "off" }, + { "EPYC" "-" TYPE_X86_CPU, "clzero", "off" }, + { "EPYC" "-" TYPE_X86_CPU, "xsaveerptr", "off" }, + { "EPYC" "-" TYPE_X86_CPU, "ibpb", "off" }, + { "EPYC" "-" TYPE_X86_CPU, "xsaves", "off" }, +}; const size_t pc_compat_4_1_len =3D G_N_ELEMENTS(pc_compat_4_1); =20 GlobalProperty pc_compat_4_0[] =3D {}; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 07cf562d89..71233e6310 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3110,19 +3110,18 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | - CPUID_EXT3_TOPOEXT, + CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE, + .features[FEAT_8000_0008_EBX] =3D + CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | + CPUID_8000_0008_EBX_IBPB, .features[FEAT_7_0_EBX] =3D CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AV= X2 | CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED= | CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSH= OPT | CPUID_7_0_EBX_SHA_NI, - /* Missing: XSAVES (not supported by some Linux versions, - * including v4.1 to v4.12). - * KVM doesn't yet expose any XSAVES state save component. - */ .features[FEAT_XSAVE] =3D CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | - CPUID_XSAVE_XGETBV1, + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, .features[FEAT_6_EAX] =3D CPUID_6_EAX_ARAT, .features[FEAT_SVM] =3D From nobody Sat Apr 27 05:59:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=amd.com) ARC-Seal: i=2; a=rsa-sha256; t=1572991813; cv=pass; d=zoho.com; s=zohoarc; b=GFzfbC8jUMTRnCgnPKE0wGckSEWw19M/x4VC7FIYIqq+S6B9xSJC0KE5ySQ3w7n5Xn9xhv77Q0O3TgaKvYggL8Q/UUKZ7aH93Ybhnbxe16GWxGl2yh9BMj1pqdvl8L/bsgGYAEV7C61v6Lge1Zrj4shhVrz7kkNw/bpRg9WJLZ0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572991813; h=Content-ID: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=LsGay8pqIdolXJh3b/Chggk8oHuxG7M3z1hyGd++/yU=; b=mQLWPY4RymLghISPJDEu+tw8fNOSA4u8Rz2YsBMkBH14nbFxmrPwDJsPMWQh4ZX+lhBvI8bxUNCHUaaIabuP0GkenaF9ou5CkyQh5/2/6XGMSFw/7Mq9mb+Oy2XO5gJ7uUOTZy8CaMcVoP1fXucfMUnor5tFpF5Xi09Nx4Tt09c= ARC-Authentication-Results: i=2; mx.zoho.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=amd.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157299181361420.446708187312765; Tue, 5 Nov 2019 14:10:13 -0800 (PST) Received: from localhost ([::1]:50904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS71f-0007Ny-Tz for importer@patchew.org; Tue, 05 Nov 2019 17:10:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37261) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS6Cq-00065S-Rs for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS6Cp-0006Hg-3V for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:40 -0500 Received: from mail-eopbgr720040.outbound.protection.outlook.com ([40.107.72.40]:29947 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS6Co-0006HF-RC for qemu-devel@nongnu.org; Tue, 05 Nov 2019 16:17:39 -0500 Received: from DM5PR12MB2471.namprd12.prod.outlook.com (52.132.141.138) by DM5PR12MB1323.namprd12.prod.outlook.com (10.168.237.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Tue, 5 Nov 2019 21:17:36 +0000 Received: from DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::c5a3:6a2e:8699:1999]) by DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::c5a3:6a2e:8699:1999%6]) with mapi id 15.20.2408.024; Tue, 5 Nov 2019 21:17:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XshL8ltndkBd0udb2BYYt7Otsmg+I24PQCXOpaUeryW/+UfHulv2Q16KgSl7Q4KXZ4e0UVResCyPo5Ll2bPfcaJxg4pknG0lD5crpT/8byUUob0boMhQZBIcBl7FmJIGPIYx7BxQYiZ7KNyzj5CL8Szqj+69vFUaYwuH5y16sgp32aNZE7wQhT2c7n1BUT58q4NPuP6Ti7+KbbcX9M4TKNPVu15ciBP4/e2gRWHQ95OW11AbXh+2HmVabAtzRhQ8u6uWptffEu1DuILMtK8kSaOY4VMvOSR0uIV6NyHz59/bwtkT/qz3VTD4AwkoPlK1TvGdSIak8i2vHt1uZxXNQg== 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=LsGay8pqIdolXJh3b/Chggk8oHuxG7M3z1hyGd++/yU=; b=OUTMBWLx0Dz/FlwB9mTx6yBAucVzAkQx+PGl2QClTb7Eyl+myhhVjOlIFHQJ6/Tlatvv04AIEC3eZ2dwflZoYBeiz4qmzjbFMLAvaS55H/F1vVxdfRp95djoKMSsXA4UaNAReh72oZLZ9QxhqnFPB1mGjqbFoFGFdeEbQzEgeCl8KU70X2MM9GnNs1v7mNFIeuk9Ydh5VJ1+NzBUaGMITfVA9aLJhCmSBAH12Il5DKpfJ0hLDtnx4lNjWjqWRUOqXinMAgDrjo7FUV9QQH4cuPCmAN1RuZWfpmkx4WKo+iZMbqfudraOPEOvbWizLvFnq6vLowWmleucDXTUwvCoYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LsGay8pqIdolXJh3b/Chggk8oHuxG7M3z1hyGd++/yU=; b=SDt8dmNl+qfSn6CxDk/oCP6wruDs0f9e45RYyt6f2hZXrWt48T14YEJQtb2X66teqH95vbKIXX7lhCBSZS/oighf5MRuAPLpmUNf6I35Babve2rRA2/RILO/bZJ33jPspN7D5JRmU1yWoRPezIGfIxhBpvQOElmg512BOwxnYeY= From: "Moger, Babu" To: "mst@redhat.com" , "marcel.apfelbaum@gmail.com" , "pbonzini@redhat.com" , "rth@twiddle.net" , "ehabkost@redhat.com" Subject: [PATCH 2/2] i386: Add 2nd Generation AMD EPYC processors Thread-Topic: [PATCH 2/2] i386: Add 2nd Generation AMD EPYC processors Thread-Index: AQHVlB5yc0nNicCCwkuAj6TmNt+GoA== Date: Tue, 5 Nov 2019 21:17:36 +0000 Message-ID: <157298865524.17394.7352138593715588462.stgit@naples-babu.amd.com> References: <157298859935.17394.17194072829278152009.stgit@naples-babu.amd.com> In-Reply-To: <157298859935.17394.17194072829278152009.stgit@naples-babu.amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN6PR08CA0018.namprd08.prod.outlook.com (2603:10b6:805:66::31) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 4dca394c-eb97-4dc6-95cc-08d7623594c3 x-ms-traffictypediagnostic: DM5PR12MB1323: x-ms-exchange-purlcount: 2 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0212BDE3BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(199004)(189003)(5660300002)(6116002)(2501003)(8936002)(486006)(71190400001)(71200400001)(6512007)(52116002)(76176011)(86362001)(6306002)(14454004)(6436002)(186003)(103116003)(26005)(3846002)(6486002)(2906002)(6506007)(102836004)(11346002)(446003)(256004)(386003)(66556008)(14444005)(64756008)(4326008)(316002)(99286004)(305945005)(7736002)(66946007)(478600001)(66066001)(66446008)(8676002)(66476007)(476003)(81166006)(110136005)(81156014)(25786009)(966005)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1323; H:DM5PR12MB2471.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; 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; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZIpCnG+eF6e4v+aB0BU4rEkJzS3GDKIy9HSLP6vgDhdZuynZzXYh5bHvhKTBwONCSuyv9WdzhdHAwPzh28PXziGHFKJOoDTN4gkjTpGPylcdS5/QWwn+CbfyKoNDDHXuZrdbyZo4PY6V+O2tFJavc4DnpAVlyvsiR5SYYPkjZLp0P0jOnyfDS5E0tApXivjoFdH0gqAd8xJ0QxmhutE9H4mWZkYvmaY1iAhiV1MsgOJJA5G/31CD1ssZquNWRtYII7FsWjFXGjRpnp0pTKLs1x5RaQuWjqVG/pIvFkDvItqN2S48azX8gKRZ+bgRdOJeYy4J0MG8e2Fun8IFoOQ+16QrsPUjmx7sKYVGmNSRw9MG3YdbyqCXvfduA5rMg+OOD2zqCYSijIoFUFL/vFDpe2VdfAAaPVF+DG0uJ9P7DYoyG3clfY8MJEUn3bU3m1/lynlriBGiemSo//SXhHJyKmsDQmXHmDFdk5PGoc2lCQA= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dca394c-eb97-4dc6-95cc-08d7623594c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2019 21:17:36.6658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TDyWQUxeRgW5a+g3KZfSKVntCX9YboKMswP2NK/loMhYDw1yVkFIGzQ/NnAbQf2q X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1323 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.72.40 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: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @amdcloud.onmicrosoft.com) Adds the support for 2nd Gen AMD EPYC Processors. The model display name will be EPYC-Rome. Adds the following new feature bits on top of the feature bits from the first generation EPYC models. perfctr-core : core performance counter extensions support. Enables the VM = to use extended performance counter support. It enables six programmable counters instead of four counters. clzero : instruction zeroes out the 64 byte cache line specified in R= AX. xsaveerptr : XSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error pointers and FXRSTOR, XRSTOR, XRSTORS always restore error pointers. wbnoinvd : Write back and do not invalidate cache ibpb : Indirect Branch Prediction Barrier amd-stibp : Single Thread Indirect Branch Predictor clwb : Cache Line Write Back and Retain xsaves : XSAVES, XRSTORS and IA32_XSS support rdpid : Read Processor ID instruction support umip : User-Mode Instruction Prevention support The Reference documents are available at https://developer.amd.com/wp-content/resources/55803_0.54-PUB.pdf https://www.amd.com/system/files/TechDocs/24594.pdf Depends on following kernel commits: 40bc47b08b6e ("kvm: x86: Enumerate support for CLZERO instruction") 504ce1954fba ("KVM: x86: Expose XSAVEERPTR to the guest") 6d61e3c32248 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID") 52297436199d ("kvm: svm: Update svm_xsaves_supported") Signed-off-by: Babu Moger --- target/i386/cpu.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++= +++- target/i386/cpu.h | 2 + 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 71233e6310..846662c879 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1133,7 +1133,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORD= S] =3D { "clzero", NULL, "xsaveerptr", NULL, NULL, NULL, NULL, NULL, NULL, "wbnoinvd", NULL, NULL, - "ibpb", NULL, NULL, NULL, + "ibpb", NULL, NULL, "amd-stibp", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, @@ -1796,6 +1796,56 @@ static CPUCaches epyc_cache_info =3D { }, }; =20 +static CPUCaches epyc_rome_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 16 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 16384, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D true, + }, +}; + static X86CPUDefinition builtin_x86_defs[] =3D { { .name =3D "qemu64", @@ -3194,6 +3244,56 @@ static X86CPUDefinition builtin_x86_defs[] =3D { .model_id =3D "Hygon Dhyana Processor", .cache_info =3D &epyc_cache_info, }, + { + .name =3D "EPYC-Rome", + .level =3D 0xd, + .vendor =3D CPUID_VENDOR_AMD, + .family =3D 23, + .model =3D 49, + .stepping =3D 0, + .features[FEAT_1_EDX] =3D + CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUS= H | + CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE | + CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE | + CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE | + CPUID_VME | CPUID_FP87, + .features[FEAT_1_ECX] =3D + CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX | + CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT | + CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | + CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 | + CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3, + .features[FEAT_8000_0001_EDX] =3D + CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB | + CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX | + CPUID_EXT2_SYSCALL, + .features[FEAT_8000_0001_ECX] =3D + CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | + CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | + CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | + CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE, + .features[FEAT_8000_0008_EBX] =3D + CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | + CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB | + CPUID_8000_0008_EBX_STIBP, + .features[FEAT_7_0_EBX] =3D + CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AV= X2 | + CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED= | + CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSH= OPT | + CPUID_7_0_EBX_SHA_NI | CPUID_7_0_EBX_CLWB, + .features[FEAT_7_0_ECX] =3D + CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_RDPID, + .features[FEAT_XSAVE] =3D + CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, + .features[FEAT_6_EAX] =3D + CPUID_6_EAX_ARAT, + .features[FEAT_SVM] =3D + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE, + .xlevel =3D 0x8000001E, + .model_id =3D "AMD EPYC-Rome Processor", + .cache_info =3D &epyc_rome_cache_info, + }, }; =20 /* KVM-specific features that are automatically added/removed diff --git a/target/i386/cpu.h b/target/i386/cpu.h index af57fda8e5..24cdca5d3f 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -781,6 +781,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS]; #define CPUID_8000_0008_EBX_WBNOINVD (1U << 9) /* Indirect Branch Prediction Barrier */ #define CPUID_8000_0008_EBX_IBPB (1U << 12) +/* Single Thread Indirect Branch Predictors */ +#define CPUID_8000_0008_EBX_STIBP (1U << 15) =20 #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1)