From patchwork Fri Jan 6 18:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13091702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 641C9C61DB3 for ; Fri, 6 Jan 2023 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235724AbjAFS53 (ORCPT ); Fri, 6 Jan 2023 13:57:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbjAFS5M (ORCPT ); Fri, 6 Jan 2023 13:57:12 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CE497D9D8 for ; Fri, 6 Jan 2023 10:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=db34eAN5UFbrFPRpLXP1lihLm1fD5BwEafbOr+UoTuCXIBjFFm7triTiz8cLttJBogk3BgRV2aJ9MrhZpeoEESn0hRyFZ0378trrA+btB4RZz1J7knL2zkqYRJPnK5jwCHDhuFyfV28F2BphpSUqULhwxx+sAY2I0yzsEGPRUgdnlh55mnCV/0LwWhLYAbTljWlJB2/6lyrvUrw9e6lS8WQB7BmIYO5AVqYuZHtvoTG35NqLmnvUBnVQterLSme8XgyK+6yXGEhKaYv8sIh933ZocGLKYcTDFyNHNBaQnnyV97uSBxihx+so7Bytay51ROPcaF1oXnfN934hbmliXA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4ur3FFyfsQEPn/1e4O6xwMeJ1yuD7QTpNZd2OV/nmaE=; b=V6HF4PGbPDKt4mxhPHhur1Bbu2wMIMWqB+/Ydj7tGD9m9M6nW/1lS1zMggKdbqq8ONCMhrN3qxXe7Ctsx17kOHFuBVryBScskQXD9EYJVYiUCWA2rKJ3VwYSMiRbRmX4+J1f1ofBL8CIo4fYglriJ6ELGmyAsH8xbA+BEQPJILdlXXzy7aFk2UFx8o1o0WMOXZs1FXRqMzzcp1W6MBkrsU2wganR1Kok5QQDjVpHK0TjaMFcwZQj0sryX3W4ByuKeocFkuM0M2TM4dDCziwvLMkc1vTTCU/7Gva7Q5O2y3v8SHMaZ3Y18B14GqU/8qkI+e9wm8DGEUAaFJfJflhDJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4ur3FFyfsQEPn/1e4O6xwMeJ1yuD7QTpNZd2OV/nmaE=; b=vYXaD4qGHx1rFovyIqdONyTIDoeeJxUNmsG5W5dXtRDWcKzFI9ItB6ueEChvlyDgCbYl7Dq28pz3CcGesspxdDeZZu1edrh2+NSWdvlholZUWOoE87mHtXJOXd0q/BHTwyyw8ZyOUco5I7FndiMOnvDMQpC0PGgTDCZDGw5OBLM= Received: from MN2PR08CA0017.namprd08.prod.outlook.com (2603:10b6:208:239::22) by PH0PR12MB5497.namprd12.prod.outlook.com (2603:10b6:510:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 18:57:09 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:239:cafe::3c) by MN2PR08CA0017.outlook.office365.com (2603:10b6:208:239::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:08 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 6 Jan 2023 12:57:07 -0600 From: Babu Moger To: CC: , , , , , , , , , , Subject: [PATCH v2 1/5] target/i386: allow versioned CPUs to specify new cache_info Date: Fri, 6 Jan 2023 12:56:56 -0600 Message-ID: <20230106185700.28744-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106185700.28744-1-babu.moger@amd.com> References: <20230106185700.28744-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|PH0PR12MB5497:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f167f98-f90a-438d-53e2-08daf017cfef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qUN2gi9yPciAbkWcosyLVZ7V2eD+RkrF2Vp9ZJY4K8s59RVWkpuJ6rPQrzau7mLf1+ihTUtORbQTrnIST8Ksvy3BoN+Muqf02qQcA3cbKZedimmQ/5ES9q899dCVQ4k+ryWkLivrFQKSOCAs8LyBQKRhewL77wuSyRkt/Pj5Tqbf8SVeG1mEHQA2FiBx+wvfWHjNKv2YW0gOpP4AOiZijNqb8obL55207erUc9QO/VbkolG3dRpRiqBkqkD7lcRqoFJje6cfBeVSHFvgh8WX5daqJ3N+ib9WMzQIDd7K+Pj11CV6l9UTLlksfFFGdXG3pAz2hAc8EsL2NOTGmFxXadXFcbcbjsXCMJ96FG5U58QwWP5+wVo0HMIBy2/mSB+lQazDWwYUpZTa5c+FwSncmoXf8L7wj9l3dO3Ofh2utIjxuVZQhAMpd+U4lOU2vTPItH29g0T43yJaBrgIcaYGGSnUn+zghBAtFnmjeA+QT4xroP81vO3QBavWxFF0N+QceTe7sKcZS3gcKUyOjBPzY9vPbVCrOzfL4XmiqlMF0Q6bEi+4J8jp9sjr5jiggHKo8urlT6lF14NPo0OT5t1SD1NgQiGHSuehofnKw7XQ4xSW0BxwnGeNZn09CwVUOS4LXw2PrVMO4eVxBxEqkQhW5WQfhg9sPWLeiBqO5MipPDnI8+1qChW+bnPvfgpznyjAO+1iRpZD4As7NDSVyNjFFX+cxtXeklRtrw/kX5ngbiU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(5660300002)(2906002)(44832011)(8676002)(4326008)(8936002)(7416002)(41300700001)(316002)(70586007)(54906003)(70206006)(6916009)(478600001)(26005)(6666004)(186003)(336012)(16526019)(40480700001)(7696005)(83380400001)(426003)(47076005)(1076003)(82740400003)(81166007)(2616005)(40460700003)(86362001)(356005)(82310400005)(36756003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 18:57:08.9360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f167f98-f90a-438d-53e2-08daf017cfef X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5497 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Michael Roth New EPYC CPUs versions require small changes to their cache_info's. Because current QEMU x86 CPU definition does not support cache versions, we would have to declare a new CPU type for each such case. To avoid this duplication, the patch allows new cache_info pointers to be specified for a new CPU version. Co-developed-by: Wei Huang Signed-off-by: Wei Huang Signed-off-by: Michael Roth Signed-off-by: Babu Moger --- target/i386/cpu.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 3410e5e470..ab1b49f08f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1596,6 +1596,7 @@ typedef struct X86CPUVersionDefinition { const char *alias; const char *note; PropValue *props; + const CPUCaches *const cache_info; } X86CPUVersionDefinition; /* Base definition for a CPU model */ @@ -5057,6 +5058,32 @@ static void x86_cpu_apply_version_props(X86CPU *cpu, X86CPUModel *model) assert(vdef->version == version); } +/* Apply properties for the CPU model version specified in model */ +static const CPUCaches *x86_cpu_get_version_cache_info(X86CPU *cpu, + X86CPUModel *model) +{ + const X86CPUVersionDefinition *vdef; + X86CPUVersion version = x86_cpu_model_resolve_version(model); + const CPUCaches *cache_info = model->cpudef->cache_info; + + if (version == CPU_VERSION_LEGACY) { + return cache_info; + } + + for (vdef = x86_cpu_def_get_versions(model->cpudef); vdef->version; vdef++) { + if (vdef->cache_info) { + cache_info = vdef->cache_info; + } + + if (vdef->version == version) { + break; + } + } + + assert(vdef->version == version); + return cache_info; +} + /* * Load data from X86CPUDefinition into a X86CPU object. * Only for builtin_x86_defs models initialized with x86_register_cpudef_types. @@ -5089,7 +5116,7 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model) } /* legacy-cache defaults to 'off' if CPU model provides cache info */ - cpu->legacy_cache = !def->cache_info; + cpu->legacy_cache = !x86_cpu_get_version_cache_info(cpu, model); env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR; @@ -6563,14 +6590,17 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) /* Cache information initialization */ if (!cpu->legacy_cache) { - if (!xcc->model || !xcc->model->cpudef->cache_info) { + const CPUCaches *cache_info = + x86_cpu_get_version_cache_info(cpu, xcc->model); + + if (!xcc->model || !cache_info) { g_autofree char *name = x86_cpu_class_get_model_name(xcc); error_setg(errp, "CPU model '%s' doesn't support legacy-cache=off", name); return; } env->cache_info_cpuid2 = env->cache_info_cpuid4 = env->cache_info_amd = - *xcc->model->cpudef->cache_info; + *cache_info; } else { /* Build legacy cache information */ env->cache_info_cpuid2.l1d_cache = &legacy_l1d_cache; From patchwork Fri Jan 6 18:56:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13091705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9D53C63797 for ; Fri, 6 Jan 2023 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235873AbjAFS5f (ORCPT ); Fri, 6 Jan 2023 13:57:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235947AbjAFS5N (ORCPT ); Fri, 6 Jan 2023 13:57:13 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2075.outbound.protection.outlook.com [40.107.94.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6507C7DE38 for ; Fri, 6 Jan 2023 10:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VT1wGvnuk+SIbtbeoPjVpMQppgMtzfeyIfWFo4IQroKlui+2DXm24p8sggX+vs/N0p1lmfpfSKSCpqN6MhQYDOQVxr8JYM4mnkUe288jIWY1523x12DloReL4P4DQHgQ5o3UFi6a+EMaN7ZSkFa8WXWeGWlhdGO02E6MI5SRqV0SH+lBlhoQVojma8FhjhnWcuL6mFgLhGCP+Uy/fYuBnAVQlZfmtFVjfL4KvGQyz/BsiGgqMu2tQPBqFKn9wvrIqDJa79PpwQth2hp24EP2dGz/OLhN2vwBhbSYGM6mHswwVgI0jUdQ5orVye53Qf0/UzERdEPr3e7duW04kGn60g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3yaRK8we4lg/TWohnvK5tbBrCA+FSO/4p/X35E0J6+Y=; b=jRnY8O9pHoHNJlakXrUIXCsqOBUfa4+/hc0M1caxks052m8YjHRnThoND/rlWcdvMtCe+BevATHwqJKfPM2baYpx8NawjPQm1McXEXQQFfnVtRYMC6A3D5kZJaPtLzcjfCwKU016L1shTPOZRZTf/AUcM11xVdDJZ15XnlKZFcLsttJ+18ZDr4fGIbkRouR+wK2AVE4PjTN6UcdRzeYL7U5W2pzBLGLrHnHTAiiol3//4YD7Pfto5RaExcHHNYe0Rqw0oJePySBtemMt1b0502LfMIMwomsSJIJhSgu3dSuJHJX8RcRMhPKfXcB4JTJj77DUZ7PTDi13zhT6qTSSBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3yaRK8we4lg/TWohnvK5tbBrCA+FSO/4p/X35E0J6+Y=; b=xZk/y78OyOKTVoyWAimW7VhqVb3wOPzkBGUmS06JQOwe34arnd/rmxv1B0JjKwipig24aq+oHCvdzA8QhB/Hc8iu2o++bOaS4gSCRnbpXV/WK0rmpH8HuN3Vgra9DBFJbQfrxNSQXyeKxwl5z6LDiA6NBbRLH+lmInjgd+5lc+w= Received: from MN2PR08CA0014.namprd08.prod.outlook.com (2603:10b6:208:239::19) by BN9PR12MB5147.namprd12.prod.outlook.com (2603:10b6:408:118::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 18:57:09 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:239:cafe::f1) by MN2PR08CA0014.outlook.office365.com (2603:10b6:208:239::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:09 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 6 Jan 2023 12:57:08 -0600 From: Babu Moger To: CC: , , , , , , , , , , Subject: [PATCH v2 2/5] target/i386: Add new EPYC CPU versions with updated cache_info Date: Fri, 6 Jan 2023 12:56:57 -0600 Message-ID: <20230106185700.28744-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106185700.28744-1-babu.moger@amd.com> References: <20230106185700.28744-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|BN9PR12MB5147:EE_ X-MS-Office365-Filtering-Correlation-Id: 654b8dcb-c9c6-43cb-b0ed-08daf017d06d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nKpw1B6wfCGNgTn5X/mMFHlnT/ZeoI4kSz2QJXexIHocS3s/SBaKwt+9o4GX9wfgx5ZlZhK9mBrwehS6bknoB17QB36il8OB60swe9m0FLZi9NUOA7bo4uqyfqbpHh+o5Sh9t4hILZZo8//vhXUpYHWzuFeXxw9ZVnNGOpYe9MoBrexFAHoKof9RXf7oiyGsUsa/wCqpTIeGbTU44FUX23U12p2PtyrYQIbLRb95XFXbb+d6WVgmawNy36D2DKv33CutlQ9QzdLtys9NtRsrFh609n8z9yoUoPIWbs4zbqWbVFI6bazCgRfx1fbliwp6gYPTzqGbNdrWz+fVbszs/C2MrjsMgYvVGu2qglZqeErmDvxQAhBjleQzTeve2E6mJowXXVrEoODdtgY3qP4pdTeg7VUgR0iiC9enxMauT1iGRMUdSEm3KCUTwBlBTUvBe3Jo7OhsHHqjfu8KkGL0Aohk7XlOdbuwk6L5OWih+c1CWn4wilYhr82SIq1ugrdrcerYDNAj4GW/VJW1BRF5yEXGi9xJxvJ920Me49YyXLb19mHJyVP5K81A7V8u6XHBNGoDLhAkX18szuy+ZpZMsw1nakuZxgs/s+mjvYYbYY4gACTCICy3EsKE+g2JXvKHaBu8HKXf1Cz84IzQ7/yaQvxEKLsiMuZkiPRu76DpWo42p5VpdnWl3t+u3gjIGO8gkR0WMDFWgEWL6Q63VyoAsPgJqDfCORUGpiIyQI41tlc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(36860700001)(82740400003)(70206006)(8676002)(15650500001)(81166007)(4326008)(7416002)(6916009)(70586007)(2906002)(2616005)(82310400005)(41300700001)(47076005)(186003)(26005)(40480700001)(16526019)(7696005)(6666004)(1076003)(426003)(8936002)(86362001)(40460700003)(54906003)(336012)(316002)(478600001)(356005)(44832011)(5660300002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 18:57:09.7485 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 654b8dcb-c9c6-43cb-b0ed-08daf017d06d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5147 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Michael Roth Introduce new EPYC cpu versions: EPYC-v4 and EPYC-Rome-v3. The only difference vs. older models is an updated cache_info with the 'complex_indexing' bit unset, since this bit is not currently defined for AMD and may cause problems should it be used for something else in the future. Setting this bit will also cause CPUID validation failures when running SEV-SNP guests. Signed-off-by: Michael Roth Signed-off-by: Babu Moger --- target/i386/cpu.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ab1b49f08f..2dffd12081 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1705,6 +1705,56 @@ static const CPUCaches epyc_cache_info = { }, }; +static CPUCaches epyc_v4_cache_info = { + .l1d_cache = &(CPUCacheInfo) { + .type = DATA_CACHE, + .level = 1, + .size = 32 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 64, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l1i_cache = &(CPUCacheInfo) { + .type = INSTRUCTION_CACHE, + .level = 1, + .size = 64 * KiB, + .line_size = 64, + .associativity = 4, + .partitions = 1, + .sets = 256, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l2_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 2, + .size = 512 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 1024, + .lines_per_tag = 1, + }, + .l3_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 3, + .size = 8 * MiB, + .line_size = 64, + .associativity = 16, + .partitions = 1, + .sets = 8192, + .lines_per_tag = 1, + .self_init = true, + .inclusive = true, + .complex_indexing = false, + }, +}; + static const CPUCaches epyc_rome_cache_info = { .l1d_cache = &(CPUCacheInfo) { .type = DATA_CACHE, @@ -1755,6 +1805,56 @@ static const CPUCaches epyc_rome_cache_info = { }, }; +static const CPUCaches epyc_rome_v3_cache_info = { + .l1d_cache = &(CPUCacheInfo) { + .type = DATA_CACHE, + .level = 1, + .size = 32 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 64, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l1i_cache = &(CPUCacheInfo) { + .type = INSTRUCTION_CACHE, + .level = 1, + .size = 32 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 64, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l2_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 2, + .size = 512 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 1024, + .lines_per_tag = 1, + }, + .l3_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 3, + .size = 16 * MiB, + .line_size = 64, + .associativity = 16, + .partitions = 1, + .sets = 16384, + .lines_per_tag = 1, + .self_init = true, + .inclusive = true, + .complex_indexing = false, + }, +}; + static const CPUCaches epyc_milan_cache_info = { .l1d_cache = &(CPUCacheInfo) { .type = DATA_CACHE, @@ -3960,6 +4060,15 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ } } }, + { + .version = 4, + .props = (PropValue[]) { + { "model-id", + "AMD EPYC-v4 Processor" }, + { /* end of list */ } + }, + .cache_info = &epyc_v4_cache_info + }, { /* end of list */ } } }, @@ -4079,6 +4188,15 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ } } }, + { + .version = 3, + .props = (PropValue[]) { + { "model-id", + "AMD EPYC-Rome-v3 Processor" }, + { /* end of list */ } + }, + .cache_info = &epyc_rome_v3_cache_info + }, { /* end of list */ } } }, From patchwork Fri Jan 6 18:56:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13091704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97A36C63707 for ; Fri, 6 Jan 2023 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235841AbjAFS5d (ORCPT ); Fri, 6 Jan 2023 13:57:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235957AbjAFS5N (ORCPT ); Fri, 6 Jan 2023 13:57:13 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9A07DE39 for ; Fri, 6 Jan 2023 10:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nzuKoBgBo4dJblCQBCXgoHHfQpOjC9tLE5FkenNBC2B7FDSjPrbAUlcI2eUBzpOcRiom81ZJTcZ+AfNdxVtDg5If6YHBtE5HAaQvYs9odJJWEF5HfgTDpv4zCfV7YdQBvUY4cnm2uEJuhIRvV+MeNb+y0gf4TRvgyrUOCJXEAb1F87MM8SmSHKNu38ywUeab69G8DLFAq3iYv4Dusq5MTY9aXBzwd7M20x39/G/GsptnkighUfOEmRoC1HiOwY42gjqx1Xdw3UesMp9h1dcb3O+5a4tzcxwdgD/sHB2aW+RAXkr857f7+S7y4LORc/8E0cQr/rmtoyh0M6GSMy2u0A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1EkFN6NgGmvojwEQnf8lIZH0TAlg3fYCbFnhalmKizI=; b=CCANlQp8RuAFylX/y0Lx6AJK8vWagtayKtbY2KK6IzqRwtAJEiGbou9gApqtmKuCHp2qfdL729Y4yoihHlgxX15dQ17ePoima6BcKddNWSJdtFlhY6oKWh+zFi7AdZ9sqceYlgxq6dbUflKUEogYpkO78EMbGhaMhu1NRRvt3WB1lZO2FVCVMNJIu1ezCE3xrZHJzDZ92tRfT9TdFXCd4+FEeVdfzXqJI+/99p94p5CLFGPz6juxTUJKQxR3SEW+5DB4lVdq4D45DWnTCfPJVVuqCJeeQ3NMkRaZ+qJdkGaJGNMcYYqkfJLqLCblb7yDOm8qU2gnM5Z1Wk3/BDfutA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1EkFN6NgGmvojwEQnf8lIZH0TAlg3fYCbFnhalmKizI=; b=AZipt3sw1OHcx0eb7wwlUbjHpUkk0KvVTMjC8yu7Cp86iFMfBzD8Q85A8Lewf5C0FSrGb81Bqz1D+tRWfLVJOr6ciFOf6jSfvet7mJg7XFf0MYJm+tnxzuZiQzx6djh5mzvbNMIrh7apUuXYav7fhd7Td0G+mFpPufM108pv6dU= Received: from MN2PR20CA0019.namprd20.prod.outlook.com (2603:10b6:208:e8::32) by CY5PR12MB6106.namprd12.prod.outlook.com (2603:10b6:930:29::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 18:57:10 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:e8:cafe::43) by MN2PR20CA0019.outlook.office365.com (2603:10b6:208:e8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:10 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 6 Jan 2023 12:57:09 -0600 From: Babu Moger To: CC: , , , , , , , , , , Subject: [PATCH v2 3/5] target/i386: Add a couple of feature bits in 8000_0008_EBX Date: Fri, 6 Jan 2023 12:56:58 -0600 Message-ID: <20230106185700.28744-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106185700.28744-1-babu.moger@amd.com> References: <20230106185700.28744-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|CY5PR12MB6106:EE_ X-MS-Office365-Filtering-Correlation-Id: 96919ed3-6268-439e-afa0-08daf017d0dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Upm4HY+gfeUBS+fZPPj7sfDb3gOrZaqIEwQTK3t1wQxFzrXY+GUNil4u6DKFXJD5mXfgEkLl7GLEK0HXDal6WOBov+MyOvGm5YILUUKV5ifwW/P7a6PHE+JQSE8ptERmrr4BHL1tp4Tlgu9FXY58roJu1ZQcwZDkfJ5ICOIFKfKgjbYFJ7ewYlC1+fGMYHc/kC39cUxTDnNCG6D4MOCicFGebfQvu2kGD33IdMFLd0HnTYPVuy+YZoRW6MisEgEPUtxaLmOYMx4xonFDY8OQStIsXHvdd7+V6n4f0K6oCwkLvoVo1jR2MN4v3rLuzDmek5WnfmqAUzqJe79mAlyNH4hgZnWlVIxZVgzgDBMkm5Qp+m6e5YkL8RDq2aQPxkh0TIqFb3YnBZcMwJJyHPIueVMBwlSpD43VVfmBXi5EwCSGTdbwmvC1W/CQlqYDSMB5f7dbjKg+wII54RvqpeeeqbmEHj0R0NIzXdQzctUg5m/3ouJxeIajZu+kM1QrGFshJIliTJu6WhXdDFfo/ioqStmXThK3RuygQi6RBtObtBShNDoOalat5okKPkOeXqKzLI+qIAfeAcad3Gql61oAvNNxp8BgbBQKGx3w0o87QY9sT4GpFSLUq8wSGs7gjCpDWtNHZYOetqiZZ5TYulJBcF5j0/5Ln0TiWTtTScDE76SUkxF3S85JgUPR44F5b+X+PvSqpnWE8y5zLQiAdbFMA0iK4OD6C0KeeTdOmeBUC1DJzJGIwxt+6ba7LVofnYJ7OlTbYZZLHDzLGSKMBYGJu1dT1VxTjti+mqdE4fTG89oPTNqhXFuM/0IpEdmdfks5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(136003)(396003)(39860400002)(376002)(346002)(451199015)(36840700001)(46966006)(40470700004)(2906002)(40480700001)(40460700003)(36756003)(2616005)(86362001)(4326008)(336012)(966005)(70206006)(426003)(1076003)(47076005)(5660300002)(83380400001)(41300700001)(26005)(8936002)(44832011)(186003)(6666004)(478600001)(7696005)(7416002)(6916009)(16526019)(8676002)(70586007)(316002)(54906003)(81166007)(356005)(82310400005)(82740400003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 18:57:10.4915 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96919ed3-6268-439e-afa0-08daf017d0dc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6106 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the following feature bits. amd-psfd : Predictive Store Forwarding Disable: PSF is a hardware-based micro-architectural optimization designed to improve the performance of code execution by predicting address dependencies between loads and stores. While SSBD (Speculative Store Bypass Disable) disables both PSF and speculative store bypass, PSFD only disables PSF. PSFD may be desirable for the software which is concerned with the speculative behavior of PSF but desires a smaller performance impact than setting SSBD. Depends on the following kernel commit: b73a54321ad8 ("KVM: x86: Expose Predictive Store Forwarding Disable") stibp-always-on : Single Thread Indirect Branch Prediction mode has enhanced performance and may be left always on. The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. SECURITY ANALYSIS OF AMD PREDICTIVE STORE FORWARDING Link: https://www.amd.com/system/files/documents/security-analysis-predictive-store-forwarding.pdf Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Signed-off-by: Babu Moger --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2dffd12081..117130fba1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -909,10 +909,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, "wbnoinvd", NULL, NULL, "ibpb", NULL, "ibrs", "amd-stibp", - NULL, NULL, NULL, NULL, + NULL, "stibp-always-on", NULL, NULL, NULL, NULL, NULL, NULL, "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, - NULL, NULL, NULL, NULL, + "amd-psfd", NULL, NULL, NULL, }, .cpuid = { .eax = 0x80000008, .reg = R_EBX, }, .tcg_features = 0, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index d4bc19577a..8c65c92131 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -918,8 +918,12 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, #define CPUID_8000_0008_EBX_IBRS (1U << 14) /* Single Thread Indirect Branch Predictors */ #define CPUID_8000_0008_EBX_STIBP (1U << 15) +/* STIBP mode has enhanced performance and may be left always on */ +#define CPUID_8000_0008_EBX_STIBP_ALWAYS_ON (1U << 17) /* Speculative Store Bypass Disable */ #define CPUID_8000_0008_EBX_AMD_SSBD (1U << 24) +/* Predictive Store Forwarding Disable */ +#define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28) #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) From patchwork Fri Jan 6 18:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13091706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C80B0C54EBD for ; Fri, 6 Jan 2023 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235960AbjAFS5i (ORCPT ); Fri, 6 Jan 2023 13:57:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235969AbjAFS5R (ORCPT ); Fri, 6 Jan 2023 13:57:17 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2059.outbound.protection.outlook.com [40.107.220.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F263277D0B for ; Fri, 6 Jan 2023 10:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CIDYKfhMT5ohtbZpCz3BbYM57kOHIaYzcFv/IF10dpWL9I74VCKp/4p+kjoeIUaUuqtqDNS44ggzToxYWHUsv6FocNqA3jrlxWD+seXX71+Ndgys4yXV4h5Fgct356ZPkOBbchHsP/H0tOdpbQ/LBTUk2z5GJkxTnZxZpnyihm0i2HjbRaO9xzgiie8KbRZfTC4OCCjMtxZdGDW2pXngWi0du4HjqYMbudoIYR/4sg8o+YuVGCOgaC1GEnFiLijH/hSedkWTly4u1VmQA2J55adNoTJY9Y/j63c7IlcnWU0t+I9Pe2DUFXzwwLTQR/H8bHRjI6JsoPuNDEyjJhRNGA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5pJh7ODxvxdX+W3oZbhk4DWgy8Ysj0AN92bMByXrSzE=; b=GauukCWQxW5VFqGYONak1uWcv3U85daB0120t5tyI/KRsuoY1q0XKl+dFnNIGQbZ17Q3vSQK8Sx/Ap3NqBzsh7YMxVvpDnVqOkaXeJ9n1hcMMBRDH5WE+JlOk6PN7UcgTscHfp02vWF+AeGko612P64MAKBh/dN/UDEAdyzKwCZWuDYRTGesyAjuqEAbjrvzd2e6NBIXksJxNx85OGh3R6p/lPIiiP3DODt4WoChvbTRi+A/js9MjBIruPWBS2TWVOoJa2XBUUouyz4tT4MYHvK07oVm+xSq1ITFeoEP/ii/30v7xzEfqEM+MnvTMUvyY4mSyy9RdJxpdO4co1VEKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5pJh7ODxvxdX+W3oZbhk4DWgy8Ysj0AN92bMByXrSzE=; b=GFMba8JwVoYcwTkEjcg2nfIz3I4yCO+qqYLUWwrcw7DBac4QnzBZBv+tDf35y39BHHVMcUJhS/TFeHY9aEUbRPx9TKZzLaLrcx6d1LWXnVCe5XOfyD33qccUvCdOu1H3ngc0Wx8vdEllGVfb31/s5UW9vQvwUJGsGIMlp5AHnN0= Received: from MN2PR08CA0007.namprd08.prod.outlook.com (2603:10b6:208:239::12) by DS0PR12MB8413.namprd12.prod.outlook.com (2603:10b6:8:f9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 18:57:11 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:239:cafe::61) by MN2PR08CA0007.outlook.office365.com (2603:10b6:208:239::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:11 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 6 Jan 2023 12:57:10 -0600 From: Babu Moger To: CC: , , , , , , , , , , Subject: [PATCH v2 4/5] target/i386: Add feature bits for CPUID_Fn80000021_EAX Date: Fri, 6 Jan 2023 12:56:59 -0600 Message-ID: <20230106185700.28744-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106185700.28744-1-babu.moger@amd.com> References: <20230106185700.28744-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|DS0PR12MB8413:EE_ X-MS-Office365-Filtering-Correlation-Id: 2dfb5045-1f42-4faf-b5b3-08daf017d14b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9FE3mrBC5C5zC2ZNs3qxDtZ+3oITBDa1bOeJYGYryPHNK+fDA5LwbB2cSHKD4n87gDuQNvs5EGmAB52++jjKhHwumxsyu2OWMDuSfHxDRCvk5JvMauCvxBmS0lc4ltmkZ4t6oCgYEgpSzCNY6q8Vjj+J+QQH6V38Cb5JXnLCK17jgb8VYvYW3xiVVHmfRmyRaqacgJQEWWgJBqDYxxTbfaoaE0/rv0q/pkfna91PddZ5IYVugdcbYFpIgsDuvyl81cwvXBDT+vB6q425yh9SJqNTW4fInWARjIcKsDRbHKSuJD8bZbcXSn8y5ClHFDZ5AYybvRdGPOH3RA/5XgZVb9Na4EG64Wyqmat0RMpoI0JMDBUNzaEOkD3ivO42wxwDsXUZ2dkHnybace2R+SESpdMN7Tfi3ggX34TV3+8ju4fhP+7LIbS4AeOjluGHz55acTng+YwKODXjETTJ1qFQc/xc2wBSCJZZ6Rsqe7SJgFxw0HWEDJAeHfuicfFTT4vlYjeD0FHN/O/UFPzZXjhmxgH7z9bipg50VA1w4wUxOapIbVsiwIv55ltDi8uJvuKKBFAePDoAXunaMi493B/W/J7WZQZ2H9yceygBOYlZbn1hFgS3P6ZvFNw39vQUlR7gTLJl39ZfKOObDSqV8eSUgRBVNqW3rhT0rYQlZiujA83Sl6NJQbeTwRgzibmAlPKzq6OmfEJfKikVhvxf4dAogjbwpDFSIz/4nokAKxZDc1EouVckELGCNjRq2k6ueytVWW2f1yXxJkvLFXe9moGcnz/gNAN660xcNb4BP1hZ4xFEyEWUSrmThKktgUUUz+4D X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(346002)(136003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(7416002)(5660300002)(41300700001)(8936002)(4326008)(70206006)(8676002)(70586007)(54906003)(2906002)(6916009)(316002)(7696005)(966005)(6666004)(186003)(26005)(478600001)(44832011)(16526019)(40480700001)(36756003)(86362001)(2616005)(336012)(36860700001)(1076003)(426003)(47076005)(81166007)(82740400003)(356005)(40460700003)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 18:57:11.2172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2dfb5045-1f42-4faf-b5b3-08daf017d14b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8413 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the following feature bits. no-nested-data-bp : Processor ignores nested data breakpoints. lfence-always-serializing : LFENCE instruction is always serializing. null-sel-cls-base : Null Selector Clears Base. When this bit is set, a null segment load clears the segment base. The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. AMD64 Architecture Programmer’s Manual Volumes 1–5 Publication No. Revision 40332 4.05 Date October 2022 Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf Signed-off-by: Babu Moger --- target/i386/cpu.c | 24 ++++++++++++++++++++++++ target/i386/cpu.h | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 117130fba1..63c4675569 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -918,6 +918,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .tcg_features = 0, .unmigratable_flags = 0, }, + [FEAT_8000_0021_EAX] = { + .type = CPUID_FEATURE_WORD, + .feat_names = { + "no-nested-data-bp", NULL, "lfence-always-serializing", NULL, + NULL, NULL, "null-sel-clr-base", NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + }, + .cpuid = { .eax = 0x80000021, .reg = R_EAX, }, + .tcg_features = 0, + .unmigratable_flags = 0, + }, [FEAT_XSAVE] = { .type = CPUID_FEATURE_WORD, .feat_names = { @@ -6001,6 +6017,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ebx |= sev_get_reduced_phys_bits() << 6; } break; + case 0x80000021: + *eax = env->features[FEAT_8000_0021_EAX]; + *ebx = *ecx = *edx = 0; + break; default: /* reserved values: zero */ *eax = 0; @@ -6430,6 +6450,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F); } + if (env->features[FEAT_8000_0021_EAX]) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x80000021); + } + /* SGX requires CPUID[0x12] for EPC enumeration */ if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_SGX) { x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x12); diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 8c65c92131..519dcdc23d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -597,6 +597,7 @@ typedef enum FeatureWord { FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */ FEAT_8000_0007_EDX, /* CPUID[8000_0007].EDX */ FEAT_8000_0008_EBX, /* CPUID[8000_0008].EBX */ + FEAT_8000_0021_EAX, /* CPUID[8000_0021].EAX */ FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */ FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */ FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */ @@ -925,6 +926,13 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, /* Predictive Store Forwarding Disable */ #define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28) +/* Processor ignores nested data breakpoints */ +#define CPUID_8000_0021_EAX_No_NESTED_DATA_BP (1U << 0) +/* LFENCE is always serializing */ +#define CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING (1U << 2) +/* Null Selector Clears Base */ +#define CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE (1U << 6) + #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) #define CPUID_XSAVE_XGETBV1 (1U << 2) From patchwork Fri Jan 6 18:57:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13091707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8ECFC677F0 for ; Fri, 6 Jan 2023 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236018AbjAFS5j (ORCPT ); Fri, 6 Jan 2023 13:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235968AbjAFS5R (ORCPT ); Fri, 6 Jan 2023 13:57:17 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCEBA78A45 for ; Fri, 6 Jan 2023 10:57:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OUjGlPX5cVvxxkeWd5BZvFCo2OpVTxszsMt4XT2JK8CDC2p6bHgh7DyJW1y3vdVbShoJ8NDEo+ryvtWkiyK1uOQD793CC9ThGOkDLQRUDJnULYgat9Fdbtp7bDM/ZKZiiSusedkBQ4y/5CwTcFQxUIfRaVdDJWASI5g0RXIP+PB2R7t8Em72VtURODnrBEEYAeDLr1FmBWrJ/zOa7IVRiFcmSLb/UMomRh5Gz9wPeWtIU/vMYKwBAFU5eLRJiZGnLKrIiXp3NQcOLcJ9kuD3WVnWyKdEvhhQ0AvLUL7ByIOzbnp+rGWJCUiX8Vfjii6s0BjcQ69Rexqqcj+pIlHUUA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=70lMAHVbr0duwXfIU+6M5mZ7yO5m7RpMtV5+D5vMDAE=; b=kFMsm/fLV6wGTtVcGfjyKii225TDOBFNu7/tGUkN04yFNx1hRhkfNcu14KMGjk+CR/VVVGSYD9nR07sLYA1kMtkMOaMyw5/s2T3GKAGCcoK5kdNk7LW2XostL22cPMEbI+S6ysv4553OysDWt9F+jpvjkfdx2g14r0gjODsW4OD03LT1utPlEgsK00m3deeTXsgFa5uFbkG6RMVlcIEUdOHYNDpRRpUgVeKGyIL7fjNsV3B7lXWmf17icuMCj6SKz334BbnClNVeDaYA2X3NpapjoKiTLDV851EQucnumG9L0GcZhzC8imXmTmggGo9KtglwQuyMJZ1vqq0TjMW5/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=70lMAHVbr0duwXfIU+6M5mZ7yO5m7RpMtV5+D5vMDAE=; b=HmHUigS0ln4psAOO681QIyAW/7HkhzJPzhdwcIMAD2Rl+m/I3GiqrQY7w7kRW+BjC1F8QIaxKhL1LX+hKc3uHjf7tqE3dSg62ASCYYbqiJgxSx7U9tXp6yyfij8cw4QTIATJA2vzk9J8TsXfnmptV5FdjNjmfjZhphyd0UNbkjI= Received: from MN2PR08CA0025.namprd08.prod.outlook.com (2603:10b6:208:239::30) by DS0PR12MB7779.namprd12.prod.outlook.com (2603:10b6:8:150::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 18:57:12 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:239:cafe::d9) by MN2PR08CA0025.outlook.office365.com (2603:10b6:208:239::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Fri, 6 Jan 2023 18:57:12 +0000 Received: from bmoger-ubuntu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 6 Jan 2023 12:57:10 -0600 From: Babu Moger To: CC: , , , , , , , , , , Subject: [PATCH v2 5/5] target/i386: Add missing feature bits in EPYC-Milan model Date: Fri, 6 Jan 2023 12:57:00 -0600 Message-ID: <20230106185700.28744-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106185700.28744-1-babu.moger@amd.com> References: <20230106185700.28744-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|DS0PR12MB7779:EE_ X-MS-Office365-Filtering-Correlation-Id: c7d4d18e-8d8f-494b-9e07-08daf017d21f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pO/I8ig6XcmYzFo4scjaSM5QU/qvtvY1odWrg534ioHDStkJI2PwwUscfPS5e+fH0FvVWRx2HU2SGaWEj8T20y6uEwrmdit8Yg8JfbrY7xChc516fwHyDb9EdKhltTuTS0s4qwDWdPK/nEIcLx0tzgkACXV+mjI+1cNyMQsWMHAPp5Rgd5rflXbL75ubM8KNJ49Fm9YbkdAXqTKtuRtS4Up68Sno3JGPC/HTWFnoZ2TTS4LVbEKPPVMyCMEQ9UHM4M8aJFPy0HOG0mz/UmAMS+e1bUMMUx2WAh6cxLryMd2Fq8Xmeo7i/i55WNSNVsAn+2yeN3eLxVsdtFxkA2R+VwH5stPGzQQssA8eNbOtyVvt4icu4cZOdamqnsqlgFDfseZZ7wD2QfLTuqR3hncA/2XJSWDvtX/7tIZ7NL9Nw+mJE754nhgtaELHIY1B/SRy1ZOGZjKp+q6ZC2P8ZefGpCF2noa9K1OFEFaXA+dRIenF3GQYE9Cw71B49APbZOyT7nGAsxap9cNV41l8DKKmnbgPC+WwIWNG7pHXHYGYHA4sDuTHnQTXeGU/xASAQh2fLbVyg/Esz0vOOvys8T+XLdPCWDQB1ZK0vJHb/lLh20BfRPMmcr84xSkAQ6WtWDf5fbjf3ipi8dj9hD9/770HvIuRts/k0otgxwNk8FfMrmAvQ/f8eyhMQ5HgJBCruzmTv1Ci9GNhd14gmtoT66Rwy6W1gSJZtav+Djgbt5/UwwmRKzJP9Mq4GNx7eU2SH+K/8N6M24a+h7HnsUfxRVnKrUadTv1B+VacmIas7+tTa4kSG/S6nohP2DcaWxYS6Oi+ X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(16526019)(54906003)(6666004)(6916009)(316002)(26005)(186003)(7696005)(70586007)(1076003)(4326008)(70206006)(336012)(2616005)(8676002)(966005)(478600001)(82740400003)(41300700001)(44832011)(426003)(47076005)(7416002)(8936002)(5660300002)(83380400001)(2906002)(36756003)(36860700001)(356005)(40460700003)(86362001)(40480700001)(81166007)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 18:57:12.6079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7d4d18e-8d8f-494b-9e07-08daf017d21f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7779 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org And the following feature bits for EPYC-Milan model and bump the version. vaes : Vector VAES(ENC|DEC), VAES(ENC|DEC)LAST instruction support vpclmulqdq : Vector VPCLMULQDQ instruction support stibp-always-on : Single Thread Indirect Branch Prediction Mode has enhanced performance and may be left Always on amd-psfd : Predictive Store Forward Disable no-nested-data-bp : Processor ignores nested data breakpoints lfence-always-serializing : LFENCE instruction is always serializing null-sel-clr-base : Null Selector Clears Base. When this bit is set, a null segment load clears the segment base These new features will be added in EPYC-Milan-v2. The -cpu help output after the change. x86 EPYC-Milan (alias configured by machine type) x86 EPYC-Milan-v1 AMD EPYC-Milan Processor x86 EPYC-Milan-v2 AMD EPYC-Milan Processor The documentation for the features are available in the links below. a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h, Revision B1 Processors b. SECURITY ANALYSIS OF AMD PREDICTIVE STORE FORWARDING c. AMD64 Architecture Programmer’s Manual Volumes 1–5 Publication No. Revision 40332 4.05 Date October 2022 Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip Link: https://www.amd.com/system/files/documents/security-analysis-predictive-store-forwarding.pdf Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf Signed-off-by: Babu Moger --- target/i386/cpu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 63c4675569..c2bb11b82a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1921,6 +1921,56 @@ static const CPUCaches epyc_milan_cache_info = { }, }; +static const CPUCaches epyc_milan_v2_cache_info = { + .l1d_cache = &(CPUCacheInfo) { + .type = DATA_CACHE, + .level = 1, + .size = 32 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 64, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l1i_cache = &(CPUCacheInfo) { + .type = INSTRUCTION_CACHE, + .level = 1, + .size = 32 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 64, + .lines_per_tag = 1, + .self_init = 1, + .no_invd_sharing = true, + }, + .l2_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 2, + .size = 512 * KiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 1024, + .lines_per_tag = 1, + }, + .l3_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .level = 3, + .size = 32 * MiB, + .line_size = 64, + .associativity = 16, + .partitions = 1, + .sets = 32768, + .lines_per_tag = 1, + .self_init = true, + .inclusive = true, + .complex_indexing = false, + }, +}; + /* The following VMX features are not supported by KVM and are left out in the * CPU definitions: * @@ -4270,6 +4320,26 @@ static const X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000001E, .model_id = "AMD EPYC-Milan Processor", .cache_info = &epyc_milan_cache_info, + .versions = (X86CPUVersionDefinition[]) { + { .version = 1 }, + { + .version = 2, + .props = (PropValue[]) { + { "model-id", + "AMD EPYC-Milan-v2 Processor" }, + { "vaes", "on" }, + { "vpclmulqdq", "on" }, + { "stibp-always-on", "on" }, + { "amd-psfd", "on" }, + { "no-nested-data-bp", "on" }, + { "lfence-always-serializing", "on" }, + { "null-sel-clr-base", "on" }, + { /* end of list */ } + }, + .cache_info = &epyc_milan_v2_cache_info + }, + { /* end of list */ } + } }, };