From patchwork Mon Apr 24 16:33:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13222402 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 85849C7618E for ; Mon, 24 Apr 2023 16:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232192AbjDXQeh (ORCPT ); Mon, 24 Apr 2023 12:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbjDXQeW (ORCPT ); Mon, 24 Apr 2023 12:34:22 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2079.outbound.protection.outlook.com [40.107.94.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 723E2EB for ; Mon, 24 Apr 2023 09:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XqrjEAjM2ZmPGNdAMRmhXr04M0pWCxX/8smUtvA8LrQ/MtrWrqsBxWFa2IP3R6sFRcY6ojvUv7x2NHUKoVGLsQgM9CDj4JvM/whu/iSHj9k5DbtWOzTm0Uf3jkUmBp1+zjbSLquAwIlvpnhaVtr+uv5k/NSfZQzaPlkhP6WtF7GWQUjDffjUV0C1RMc4PwUyjcbTQCk0zhWSrxF83jSTmLLu+yKZYqk7D7j6kEr5plUDQQKV9vazgr+nqQbCZ+KFg6KanLOwQpTw9Kl4Vff4Z+3Y854wONlcxyGjvnD0wboHMIazQ0Hgo6XttPXXch8YIID+l3Y0N3vJ0nn/w3GrXQ== 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=QkAJPHob69UfWgAF1kievQ2sXP28NUdJmOxfPVwIC2Q=; b=CUQXYblpRCuyAU6sQL1dUe0g7WIAhTReSQOcbMs657dSQH4krU3JJdFYwchbjDbq+slyyeKAO3WxO/PxJU+zWMmaC+qccy63MESpKSq3C2376n7wiPRVZlH4Gta0Y5E+XajdEVKOCR7qTSUabxB8l0+VvlSXIHUBvopFjzJuq19NVGHRgRQd9XUWqwOnq/G4fzQuHWDMfajstDXIp1JCs8N3Zl0RQvU5C2NbKtBRpsLtwFh6K6x8bPQuYvp0dhY4eDF+GXVmKmnob/qZCR3ZhY3EOlD03EjLF2s0Qj3YMlJ0uow7g1WENLG8Y2XgWgD6QDWF+rqkq5AXUEvkYkOGzg== 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=QkAJPHob69UfWgAF1kievQ2sXP28NUdJmOxfPVwIC2Q=; b=0OLCfrp6EXvws0bAiVVk7+SmBJkOzsl5pswXv0faFjT5tDeZATbgyjIIgSMrHaYGqeQed4k+5KH/kRH+WcrDVmqALwPKdE7dn+1scpQYCHAOLyfkceqBedAkCDPmo1FPgBq3VPCDkjAJctSJD3Trt6cIhlj03d4Q3Zl9RbpT4JU= Received: from DM6PR10CA0028.namprd10.prod.outlook.com (2603:10b6:5:60::41) by BL0PR12MB5009.namprd12.prod.outlook.com (2603:10b6:208:1c2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:18 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::a9) by DM6PR10CA0028.outlook.office365.com (2603:10b6:5:60::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:18 +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 DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:18 +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; Mon, 24 Apr 2023 11:34:16 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 1/7] target/i386: allow versioned CPUs to specify new cache_info Date: Mon, 24 Apr 2023 11:33:55 -0500 Message-ID: <20230424163401.23018-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT048:EE_|BL0PR12MB5009:EE_ X-MS-Office365-Filtering-Correlation-Id: 3952cf40-85fd-4493-78f3-08db44e1c01b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WYmmTxtgEge1D8Bi9qe+xZe0sKkbCOQyu8peL+m8d5dAdg0+lCwMg2yGDI1t8+j5abh6yUBBGsjjwAXqdEzen8SXThXMdthqvcRr3rlcdrm0r7PgWemfwsKEakT2V4YZ9HsYzcE6oMKBRiazqRJzi4qvb0mNHgX3AwFNdZlMyOKtslLIqAA79wMVPxOgrb3TIhVttkoQsqccrLgrjUgJhnn+k1Yk0t54gHAyP8Za53XrLJerTq4u14sDMhBjtDWEW3TTDAYtqW6k6Un6FA1KG48exbZzkfDxsD/8l2+/XKa3uK7sKcyOXk5GDydt/wofem1hJonfOyQPgx/zepfuKif0VU5rCtTV3RGgNokV4ONnxm2vyZaeTZXRH85TYVSqhUto0nGp6DDiAfCwbKa9pBuuJ/NMtBPsGT61JanP1QQR8i7qFQZLFjFRU5L9EE7uWi6pvhORe/abkpGfcczWGVZkdfNv1DwHDMkTDgu86z8H+5jFq7VBaGoENgmWXm6EYQhCf3fDE8sCHqvMSnYOhUNojo5/7ApTsEY+noX2+JYpzO1MRt4p0rggdEZURkOfeY+VR6+ZJ2Pn3UirN0KKckvT7hEbAGuidLEmiQZOshc6mUc8SH/RZDM5SvsqesgGYkEOuGDSRAbjF7hhDU/g02O9hFB2nJh3eXQ0YifK4wxQV8VUctpAa1s50zircg+SF2LPJl00ZZBC4DbDPpVAE9S2biehJZgJRdPIjkzcnBg= 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:(13230028)(4636009)(346002)(136003)(39860400002)(376002)(396003)(451199021)(36840700001)(40470700004)(46966006)(82740400003)(44832011)(7696005)(70586007)(70206006)(2906002)(6666004)(1076003)(8936002)(40480700001)(336012)(83380400001)(426003)(186003)(16526019)(8676002)(2616005)(41300700001)(26005)(36860700001)(5660300002)(40460700003)(316002)(7416002)(47076005)(86362001)(110136005)(54906003)(36756003)(4326008)(81166007)(356005)(82310400005)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:18.3632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3952cf40-85fd-4493-78f3-08db44e1c01b 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: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5009 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 Acked-by: Michael S. Tsirkin --- 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 6576287e5b..e3d9eaa307 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1598,6 +1598,7 @@ typedef struct X86CPUVersionDefinition { const char *alias; const char *note; PropValue *props; + const CPUCaches *const cache_info; } X86CPUVersionDefinition; /* Base definition for a CPU model */ @@ -5192,6 +5193,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. @@ -5224,7 +5251,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; @@ -6703,14 +6730,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 Mon Apr 24 16:33: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: 13222403 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 DAACCC77B73 for ; Mon, 24 Apr 2023 16:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232200AbjDXQej (ORCPT ); Mon, 24 Apr 2023 12:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjDXQeY (ORCPT ); Mon, 24 Apr 2023 12:34:24 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F802D8 for ; Mon, 24 Apr 2023 09:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OpkuO8ZkRjEwa/jTLcOFhu3PwW9jtt6dxC1x1Odx66a3S4kWA7vB5bSpPnZsCcUaTus5Tpfs3AsKKr3oJtq8TvlgAWyQUIXBxhYYfZ7nsaUK//RBOazYJIGHBHQI5QsA3s3ql8NZ3764SgiW+N5RE6UihPm02JSx1WEcHgnMJFp5IrpyK2V96n81qrHqH3ib5jDqjBT/1t6eQCdAlM1CmMEknrHmstgq45dnyF4ivxME3nVglhSfUMIcPmjxkO4IsZTutttWNDDb1urdJzmg0iLOaJpjayfs5fj2xRkEmlEv3/md/th3skSZN08McnTC+kk02Ez+hGeLwtP0KpaG0g== 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=7qqUhbOTDOsipRhUkT8jAqemJJDaZTCblBrK8bF7E34=; b=Fpa8Y5MD9kXn+AlFmM5YGyIQRjQecCoUwCczHBNV98b3IR0iOXGUjt85csUyk5y8aKoaLZA+0v2XCVTAcERerPFYoiOLPBICmipIv5LC+U4SqVpwIHs3Ev/VtRMuleKqCYgW+WD1Y0eK/mdYCXO9d2f24+04+pNg/iyVMFnopFXs8pw9RaLlp3vM7iy+fuQa6VTbtQKiPE+UtdEE18OCM52od7i3ExfgKLryliRwYpGHPtBLeAzyqjsW93RLba4bDc09WeggOKXwhRfeSN1nl75S4oQn9IVmi2lHhZoIRMRiAkdvJZ87/xbg97xI+QBFAznZ9eoZihEb4U3ZuC7yew== 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=7qqUhbOTDOsipRhUkT8jAqemJJDaZTCblBrK8bF7E34=; b=aZSTMIo8Sfg8oD9RgBC72TE5Q5Pq+zg+H3TWxkCFxlN1BgoQhuMARmj2rsvNAnHgR3iasc+cPq9R3pem07hffxZI79Z4ltcCYgAK25dVqYLNQDoXIcaNRo3uZKYAmCWYKnK6LD8A3rvubYfMwHXtvb1USePnxRi75ZvWT+WDozc= Received: from DM6PR03CA0027.namprd03.prod.outlook.com (2603:10b6:5:40::40) by CY8PR12MB7564.namprd12.prod.outlook.com (2603:10b6:930:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:20 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::3c) by DM6PR03CA0027.outlook.office365.com (2603:10b6:5:40::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:20 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:19 +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; Mon, 24 Apr 2023 11:34:18 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 2/7] target/i386: Add new EPYC CPU versions with updated cache_info Date: Mon, 24 Apr 2023 11:33:56 -0500 Message-ID: <20230424163401.23018-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT064:EE_|CY8PR12MB7564:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bfd7633-ee3d-46e9-c491-08db44e1c110 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fkg6fyCzJONd04avIZLXJww9A5sPwRvM5KU9nId5mqLJGUkR6O8l1AhFI+KPTiHju1wo+OJyssW8i0UnvMQrDCZeuEcTZHxUqZLrKsNTV8fz1kzVLgl3nYGEJhwiwYoboyhOoOHfkWVc4r2Ug0V3Ms/3R7eZc6bfGOd7MS1i2SLZAjexM81++hfG2F/2JbT5kNtBPXUb/Qu5YSbU+bKVun9bLm2OTOQRcq568Zv+Eo5AttGDngemqHpicbguoBhKcQiBR4Lm0IdMe7XKgo8RSIIjg152l6v6jU9fpECBh3uZ8LJAIBWFkfqe9sdrf1vwhL0GpbhYar73/ssk7Ob3DZYEgfj4i0NV7DCtIMlKdEJw6Y0cPBjr9jty9v9YocOoldNVNyRCB+H0QdfADnEImVCqARjV/KDieDZGtcNNkQLDBGT/FMNnHBcox62n0WrQMrHRe+ewuaSsN/xNFV/FJkDKl+cNCl6MbfhVgY5yUW56ZV3WlGSctlBXBMZXlEn4KkA5AD38RtZElV2B4z7VfM8zi0P5tT7YUSuW0sh6qEnDtXwE0NwhM6FihQQad8UcuKy0Co9EDN69M3hdTSGvqfo2i8/c9kew0CeqegDT6gs5ya6KPAmFzSi/RGqnOp7M188eIlTos9An9lS7n59Zw+7pTzL8hrE2fNloVJIhRobS5rZ9FVN4dqJZlC2Xk5hYM11OvDQ04NV7dsr+ndSzWxEgCycGLHOgymv9k3cCZqE= 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:(13230028)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(2906002)(7696005)(15650500001)(2616005)(6666004)(16526019)(1076003)(26005)(186003)(40480700001)(70586007)(70206006)(8676002)(8936002)(316002)(41300700001)(4326008)(478600001)(44832011)(5660300002)(7416002)(54906003)(110136005)(82740400003)(356005)(81166007)(82310400005)(36756003)(86362001)(40460700003)(36860700001)(47076005)(426003)(336012)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:19.9707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bfd7633-ee3d-46e9-c491-08db44e1c110 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7564 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 Acked-by: Michael S. Tsirkin --- target/i386/cpu.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e3d9eaa307..c1bc47661d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1707,6 +1707,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, @@ -1757,6 +1807,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, @@ -4091,6 +4191,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 */ } } }, @@ -4210,6 +4319,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 Mon Apr 24 16:33: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: 13222404 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 78C39C7618E for ; Mon, 24 Apr 2023 16:34:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232215AbjDXQek (ORCPT ); Mon, 24 Apr 2023 12:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232204AbjDXQeZ (ORCPT ); Mon, 24 Apr 2023 12:34:25 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2059.outbound.protection.outlook.com [40.107.244.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567CBEB for ; Mon, 24 Apr 2023 09:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hMeCnPEjUEUuoab9ucLxpBdde/Ec4Q7iyyqfXJnBVv18lN0si5GS50vHd28WpzM/i941uSOYuASPQBn6Vh9/DJ08cj+5ihcWjUbJhN8LeLx9TkAHtq8QECm/HEFeKYcTiq7KcH81U8EqUs4xYARWFTh/fd2TLKv50EsWAe+SZVAU+yjhrZDfa+20tpXcm2ewylfY5eGdh5QkSgILdcweTeteZGnY/y+bBYWhk7R4HVFAt7U/VjzDJksCs0ck3dG8ahlk+30GjY5G+wem4Y9j0jty7V5dBm1UDxZRTdu7t/YKPZ21Qn7uZyNVEUMxkb8x4rXDsIjsaMA+jEJvGSB+5Q== 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=OAvaZEU087p2jIqr/yOJjk5Kq/4c3c/rLnmdy7WIlw8=; b=g/MjuZ9WNggr/79W9usxQDjmQlaxc1jKnXv85F1EwxlCLZFnRrvQA1rRphoWrvtGjECEl18RI7DoIqKZZUmuGzrKGFq9a5PUllGPeOewlEO5s53+Vhq7xVmJJRqGdYxXO8NNlaOxtS4ailTBjjxBnLdvdPQSkQhKN0Us4ADJAhwX3wGTncHK+fmK0Ppk/dgFOeCfKuNu/OocR28Ser4lhh5YKmVWyFo8cmtXGXkIP6n9UFuTPCSjSKcuFPQdUKphaUt7YXGBTvZGZPLBx9Bgi03IJa4jepfKhZVO/2wisFspYnxF6iR2mLkQQIM5xn0pT+OvUoWW+40lQxHngard1g== 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=OAvaZEU087p2jIqr/yOJjk5Kq/4c3c/rLnmdy7WIlw8=; b=CuIYhK2Dwue2Cm/xHOgCiXvK80285b4oVHluCecBDNbObO0ou5F1/HDMBvCMJO+c883vxhe1i8YVbN4Z2Z27MK123En2cFZaMblwiHpC7eoZgXTFFQoEWcPO43b7zh9URmCzAH7g54W379S8uXenAElTwVVyn3b8ucpdKRHUEbM= Received: from DS7PR05CA0017.namprd05.prod.outlook.com (2603:10b6:5:3b9::22) by IA0PR12MB8279.namprd12.prod.outlook.com (2603:10b6:208:40c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:22 +0000 Received: from DM6NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::48) by DS7PR05CA0017.outlook.office365.com (2603:10b6:5:3b9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:21 +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 DM6NAM11FT079.mail.protection.outlook.com (10.13.173.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:21 +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; Mon, 24 Apr 2023 11:34:19 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 3/7] target/i386: Add a couple of feature bits in 8000_0008_EBX Date: Mon, 24 Apr 2023 11:33:57 -0500 Message-ID: <20230424163401.23018-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT079:EE_|IA0PR12MB8279:EE_ X-MS-Office365-Filtering-Correlation-Id: a72d0617-b81e-41bb-7b94-08db44e1c22d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B86UmuKuhPTA7p7eCLftXN4a0Rw9iO/vTyjgNGcEfgwhc0cn4FqxM8WG8UDK1ukiD/YXvxGkrXt/zvI0BwVPzkdbd8FDlJFiRkyrjvzTlnx1LoBBbqaTSLVJVSvuJAFSfxk3sBr653pzhu1ZQpzQrv1vcdJs35pjf+6gHwoBLZvcSiL5ijOI5HiKV1vvTkovOzJrYSs5OsLANAn+6Z6JOzk3qUWcgODkuT0S4gKFvjTBYlBi6kDPhgaJUjKLib1WCmR9Aef0weitsGuqpAEoyQXughQHo3Mfx/qV7CqsS1i7kIIi1cLbPZBFMfRjzFgWZ3tOreUCMVsaJczChp1RgsO4QbkGL6VF0xQKX52x2zR+kfH3yVzePjA6MMqVo0QLkJlBe0j5bH2xMTjy4D0CJ5HGLnjdWKMRZ6Ykg/Ldg0viEVrHXUI4pxA2s7dzVdz1WvtjKy+cprYvD8b5JptRkVoNqKw1unBtoL6ZP537ZDr9ATmSEpit4R3PX5OGnve5v/7mvvruFZ0strRxS7ps8PEOnbHCOAA6hin87JZ8pRly5E9jp8DlBJrXIKzuEZJZp5VB5sFtfbT1L+f89pEMAn9W/nWMOaIo9lkZhNa14bZCXw1yfKDQxzvkXIgpL7obHsqy1eNy0DujBqKhTvLfsxHs3d1Fhr3k7It112sj/bV2X7tGh+r0UwDBuH0FeNMs6Q6Zty/KBi/3wuXnzd7mkfOukcq5m24jjJmAu4UlOacrzcsV9Mzoo3keWsojFoniIZVoWIwb2z3xP06aob/bZQ== 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:(13230028)(4636009)(376002)(346002)(39860400002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(478600001)(40460700003)(16526019)(110136005)(54906003)(86362001)(966005)(36756003)(186003)(7696005)(26005)(82310400005)(1076003)(40480700001)(6666004)(4326008)(316002)(82740400003)(44832011)(83380400001)(70206006)(70586007)(36860700001)(2906002)(336012)(356005)(426003)(41300700001)(81166007)(8676002)(8936002)(5660300002)(47076005)(7416002)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:21.8366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a72d0617-b81e-41bb-7b94-08db44e1c22d 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: DM6NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8279 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 Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin 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 --- 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 c1bc47661d..64a1fdd6ca 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -911,10 +911,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 d243e290d3..14645e3cb8 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -932,8 +932,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 Mon Apr 24 16:33:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13222408 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 8AC26C7618E for ; Mon, 24 Apr 2023 16:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjDXQep (ORCPT ); Mon, 24 Apr 2023 12:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbjDXQeb (ORCPT ); Mon, 24 Apr 2023 12:34:31 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2070.outbound.protection.outlook.com [40.107.212.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D594EB for ; Mon, 24 Apr 2023 09:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQdeXJSj3HSm2FouDF481bZ8hczpuzGU+E+0WlqHX7Lf2tqhAF468JrciVuj4Sn2KsSmXybOmdYh+oa6M9dO1tmvHtwVXgdSakZk4lK4VogDVYarakdsXOcDhQcDyxAYdMsNPLwjYfx0R4yoyHHjYe6Wu8Zv17mojOcVYt9UZWwnIZF1b0BdgHjFSlA27AxQKDiw38sPCgLN7s5wWMQcBgqJziQpbBvCSoOl6q5p2eehWfyOV85AE6YHArcp5SYh/swQVBAZKtPCbgZx+DnmC5+glxkJ9pzhU37ucOrD8BLOr3RqVOVDG2BlFrmBDjzKhiXaNzoyQynnySIRN2ZCzQ== 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=VoEkdo/a+Z9HKProYBCe60hENHdZBmvrwHTv9S1GF0A=; b=Tw9Qx4LSCeGgbAa6ttSjrDMOf8gmIA2Ye6J29DyLif5phJ/wxajZ84gqmBFRvOOLS25ZfveGJLmezb5iYq3cacOusqZatv/wpEyCkOKY0MR2ZiC4gjNEohm8tkwHdzIq98jJqlbvwncys15RLdV4+2VCTjeOIHzvjA6ZqfXaYk2atJCIl+Ngq+7IstDegneGcV894QYG/8MWirrLD1SPexfNua+VZhHjUmuTN2Z3oA49DcpMohvHWd0fPrQY1CTfmoV1mTQ5qPyYWBXsVgNvcXUCf3KsIBVbEB0xwGGDiITTukK7LH4dlbQLEnlDxtnRz7rob6+z1p2ZJKhlkhlFug== 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=VoEkdo/a+Z9HKProYBCe60hENHdZBmvrwHTv9S1GF0A=; b=IKrsF+H4pb6OaLE3VIJDzttNIwMnkg6gnla/xwz8kbfCaaOBrTd/HKe4HZ93TIgiQoeSeiyjM6ZvXZ3s7cBdYrZ/y3CVbN2Olp72mhAMAqnxlEVeK2/PpJm8B4kiuChrfGPiI9RX4lJM/8w8tLLa/Gxut2Xxz+ytSA5ZegqA2d8= Received: from DM6PR11CA0055.namprd11.prod.outlook.com (2603:10b6:5:14c::32) by PH0PR12MB7078.namprd12.prod.outlook.com (2603:10b6:510:21d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:24 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::90) by DM6PR11CA0055.outlook.office365.com (2603:10b6:5:14c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:24 +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 DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:23 +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; Mon, 24 Apr 2023 11:34:21 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 4/7] target/i386: Add feature bits for CPUID_Fn80000021_EAX Date: Mon, 24 Apr 2023 11:33:58 -0500 Message-ID: <20230424163401.23018-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|PH0PR12MB7078:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a3b7c4e-fe86-4625-b931-08db44e1c331 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 781jX+wDmQUhH/n8KOEUGgCaPoxeo8X2djHohDQbNn24QxypgUwLGW+75/QM5fJSvf49uSYyqR4p54ca4XXrE8v2WcxZ3OuoBxE4jpLTua7DczqJlv6XE208WVsgVoc4AxDPRsdLKUdYscqj9Q9RQdKJuu04HZdAeNfA7rNn7rzBlfz9v7zRy+bUNBUr+SFn+u+fWYLjnLwa0aDMOaX/ee+/5zVs8UH2yuIa6gpS1iB/kKmj/TOAs9DekwNrnlwwvCbl7GWYt/1G+18O5MX1u4KeD35QNyhtKK1h475X3M2R5HltlgcQKdLO1RysKUeORhS8jl3M+K2gpnECS7lk1o+LlOf0mhrzvJ2g7VygXuZrvDP3Qq+QAMB+03Q80PDh52KNzz8LlcHhORoqCxgWHdzf30OrHQx/OdiK2DOIJGltpH0goy574uxvP4bm6kqQx58+2cbH2AaoS6aMcF6XlFhiuZryfxgJehtH5dFcDD+Q5NPmYWIQUVmDwpDpF9hYrxt3X+8jYkPpWgJ38H22H4QJm43f+GwQvAr56iINeMJcaChW4t2b+1u9PqXTZvBrLvlQPK+b8T5D3FeipT2NfFfbKXBxkVWebT/XZP7ZirDl6uj381J20EAZbQ3SRO76JGn024nQsJZ4ZriJ1Y1MboANbfRGBt2UfL9zApowwSWporRhS6N/e7olQp1+9LFQSaagf22IyHJKtEq1Hie159SY5vbNyCPj4DNZ6Z2XbhotNQivDy6k2D7MCZGaBA8EMTm6CfkwTJj4Gu5D80B5Zw== 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:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199021)(46966006)(36840700001)(40470700004)(40460700003)(2906002)(70206006)(70586007)(316002)(4326008)(44832011)(7416002)(8676002)(8936002)(5660300002)(41300700001)(82310400005)(36756003)(86362001)(40480700001)(356005)(16526019)(26005)(186003)(1076003)(81166007)(478600001)(6666004)(966005)(7696005)(36860700001)(47076005)(2616005)(336012)(426003)(110136005)(82740400003)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:23.5422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a3b7c4e-fe86-4625-b931-08db44e1c331 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: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7078 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 Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin 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 --- 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 64a1fdd6ca..d584a9488b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -920,6 +920,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 = { @@ -6136,6 +6152,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; @@ -6565,6 +6585,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 14645e3cb8..7cf811d8fe 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -600,6 +600,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 */ @@ -939,6 +940,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 Mon Apr 24 16:33: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: 13222405 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 CA213C77B61 for ; Mon, 24 Apr 2023 16:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbjDXQem (ORCPT ); Mon, 24 Apr 2023 12:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbjDXQea (ORCPT ); Mon, 24 Apr 2023 12:34:30 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FDF271D for ; Mon, 24 Apr 2023 09:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bg1cTDN1/O8bffrW3M8KU/p46eLJEAyRsAaR2cmy0itExYcZXGpCGbFn97aDhNC0BPiHFl9tFQX1xJCcHnrOyyFkyTEmjWRyYU8QG5MvMk6gF5X+OpGjc1eFEevh071DflSoXIeN43r1yM6wPuNFurFmBYlc/0E95SMjVKn0sowLLDMyT15M1QbzdVhdg4zC5QtgcwhKxcssJhvCHnBklfVoTK4n30beiNVpJFeeAm5nSv/NkQ30EN0KKwiBtj2sCQGAPFqfPJTLJd91/p3csmEYQ23A3+S96076WrIfPj4Zzf4qVQMhw/kHFShfiq0sLqQG9brnyINKMoEVnxcdQA== 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=kqsR4ZQEVVGqOdSyAkJvwzSCea5fZ/kfXZURQvTieKM=; b=SLfT3c8hqIXqLMNLYNGNtz14ajG5han2Ary7aOsf1yDNIW6R8pULngmJ6/JvNLNqQ3Sa0FpRsegch6Lq4/iOyYQHr0t8fuztOfGETVB5pK+pOR4gODMvhNcfLDA1tsWw45q3GjO0absF1y+eEBKv7ExIVqf96Os4i+o6XiG4ZeJ5jc5nmlA/n7pc396eH6P5RFcIXJQynPpFsVGRx+Bc4gieI3ikfsvBiPNjhOqAXOi9dbxwDSkiCO8oCG3aJhS8g5uI1rTFFqVvH1UKpawT/20vis761xtFmuJQ5n2wkLypDrbAaz2qUHPdu2Uj+CXTPlAQN+9SBRwnfcHy5LTglw== 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=kqsR4ZQEVVGqOdSyAkJvwzSCea5fZ/kfXZURQvTieKM=; b=kUK7vIgOvpTOAvQk/0z6IIWrxx93tlU5cUagJxrlWKpkky333I+euCd+DgLKSleDUctY9qGKcTwO5iOK+5lQ0kqlGYB1pDdRXJlR2DNEOG62Ka4gXBIRo2/9l+CM5cL3ag34k8esns7pxV4Y9RN9Vr4dvpKTi98pz280htcZUBE= Received: from DM6PR11CA0070.namprd11.prod.outlook.com (2603:10b6:5:14c::47) by SN7PR12MB6957.namprd12.prod.outlook.com (2603:10b6:806:263::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.28; Mon, 24 Apr 2023 16:34:25 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::70) by DM6PR11CA0070.outlook.office365.com (2603:10b6:5:14c::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:25 +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 DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:25 +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; Mon, 24 Apr 2023 11:34:23 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 5/7] target/i386: Add missing feature bits in EPYC-Milan model Date: Mon, 24 Apr 2023 11:33:59 -0500 Message-ID: <20230424163401.23018-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|SN7PR12MB6957:EE_ X-MS-Office365-Filtering-Correlation-Id: d6d93a77-b3ad-4dae-6757-08db44e1c48b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B5vSVzGP4QPih/13JoofKpx5gBXWXpE61YqeEKPnl6ch9EmKVcyo5/qf9kiSfhgbvtgd3cTAWqyatc1QJyfc1tlUmo3jPurthq7psS/woM/wDMIVOWmI1ppFgp2EvEhH1XLFplRAL1pQrPcGsbKsFAfEEOfdep9EJ2nBgyDVJGMM44ohrKUXx4qDmq01pVuNXsXjx3rg7fk+2K9ljU4oYUr/eE2dcRcrGFH8eTTiHWWDSHbbp2LvbsIPPh8FxTxN1WmheKBTraZts6vQW185GTZ5FgmRyzCCVuVfzSFzk+4lF/ikhEuhxgrV4ppahs78rJPyi0XhR9QOTrAuCHlgymvOEmc7LBbJicqmbVSwLRz4JFP7I1/mre3pUqgyTGtj7DH5VlDW0y+g3PcBjElV7g9WvgBZMu41EIs81kF3vjDNgGyYMDD28yy64Kx1yUraqE08RXxgWw5g6TGYg7SojkWmfZwourrp6sEVmmB/VFuPmPO6VVz97o1pGE9TDUicC2bGJx4JNGp1Jz37FBIVw3eNLdiFMgk3LCxnbz5c+2lxqvH7ol70Rju2DK2B56gBXGgJAg+e4MiNG0mQY9Pmm0YnZsDo7ItqTPDzAlN+xmCERyl8rSi8Co1td2+xf/I6OBVDMQINdwZBhqic6qLoNPiAeJPr8QcvNuDDam3dUOd4lgt1BYLgEy6UQe2KNFJ8wKkU3lt4i3NJbdkZX9g1a1OY6f0BdHcJrP5KcSS/J5JyV7FswQGejMdn0djc/IUafLgQYUIsUJA7cvctY+XQnw== 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:(13230028)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199021)(40470700004)(46966006)(36840700001)(86362001)(44832011)(7416002)(2906002)(5660300002)(316002)(82310400005)(356005)(81166007)(8676002)(8936002)(41300700001)(82740400003)(70206006)(4326008)(70586007)(36756003)(54906003)(36860700001)(110136005)(478600001)(40480700001)(26005)(83380400001)(6666004)(186003)(16526019)(1076003)(47076005)(7696005)(40460700003)(2616005)(336012)(966005)(426003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:25.8076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6d93a77-b3ad-4dae-6757-08db44e1c48b 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: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6957 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 Signed-off-by: Babu Moger Acked-by: Michael S. Tsirkin 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 --- target/i386/cpu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d584a9488b..7fcdd33467 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1923,6 +1923,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: * @@ -4401,6 +4451,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 */ } + } }, }; From patchwork Mon Apr 24 16:34: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: 13222406 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 7AC07C77B73 for ; Mon, 24 Apr 2023 16:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232228AbjDXQeo (ORCPT ); Mon, 24 Apr 2023 12:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbjDXQeb (ORCPT ); Mon, 24 Apr 2023 12:34:31 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2045.outbound.protection.outlook.com [40.107.95.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271F93A8C for ; Mon, 24 Apr 2023 09:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z28Z7vrNdMjaJ31ulPYGa3QvgnCxROgon4JBJCzVZrCpj1IA1CUOugW0aEWBohpTUrA796J0OJMY4HlY7rO8DLFwq8AZ3irsGTeNRBG4BIs9VRqvhDJ7IGHbFA8MOzMEwWPuAgrZr4lqSiJpzfVkWGKJYsZAVdYwk2Bc41n7FVgKeRFFqpflYp+C+s0jlV7RmE2DqSh9bR4MN7i8Rb9ZGzrJTByox1jIBN6XcugcZBkZqLUFRK9kP0DkrtT7maaUiU9Aes4C3QN2hnBAUh1NcCRk8jE7n9sN6OJ90ruaBmYKAxbxuOtK8xfaH2s+Ky9Z6aJZEzTB8JYChMhSvzjk+g== 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=s2RXZq6xnqXUjVEI0SKciH5tnYXyjK6P96Y9biP5E4U=; b=Ph/5+mPXu2Q4EksnzZSYaY5blC9z4JQH5JJ0wLUqowMIL1d6rwbAYtWZLRwOgxuH8CXcc5FflHYowLZUv+fd5AbpNsMbCO9JFrF3T0i1kby5KkAFLwS3aZIfmsbA5L+ZxjMIdXIunNp87U3TKKMChAjF/g18cDJhb5TRNfs//PfuRjybiBZupKyRwqZHvKDNMJiRau3E103Et1SCSR0xYDdeGmGTvG3LZCcHfCmvUrwHheWvyT7/KDqN7jpfxOiy01LDINnbGX/MBSLVzbjpYzhq10YxEEAgRVWwchpTwDfoSRvZhwDpmJMcHhca3pSyNR55gJ90WDKb9BF53ab73Q== 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=s2RXZq6xnqXUjVEI0SKciH5tnYXyjK6P96Y9biP5E4U=; b=OJUvkZ5GHIrWcXRJJvfgSmjCsL4gd7H7xKmf/ZIWYrsFpbCaZsuybR+s7UY2JdEhcTzhBrgrgp/x83QtNkXwdHkhDQB4BvfldjbKWIZMVM7+V8xVVOnlkeYaVpa63ScJU/qc5howvz3uPUN4v1miz5ykzPCMhzp78XCGflepC/I= Received: from DM6PR11CA0049.namprd11.prod.outlook.com (2603:10b6:5:14c::26) by SN7PR12MB8818.namprd12.prod.outlook.com (2603:10b6:806:34b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:27 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::f3) by DM6PR11CA0049.outlook.office365.com (2603:10b6:5:14c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:26 +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 DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:26 +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; Mon, 24 Apr 2023 11:34:24 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 6/7] target/i386: Add VNMI and automatic IBRS feature bits Date: Mon, 24 Apr 2023 11:34:00 -0500 Message-ID: <20230424163401.23018-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|SN7PR12MB8818:EE_ X-MS-Office365-Filtering-Correlation-Id: 653af9b5-fbea-4dcc-48a8-08db44e1c532 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9GA1mvYE7hPd+P4MmJJ+iBlNKznxET4EnfVf4eF9Naa4zKGWbG+FnkYOhNQ+DMWjjF537lDmyiL6d0fERkDE8mR5o2hPR2vs/5KJCOMdMu1HtWyBOc0aVOF2n8PwRdoXyZRNvQ+cGIgG/bR7bIK1Own8TKMr1A6Ak3WVhSosiH0vD2dmj50qt17OryiH2hvdsyKz8sXn4WfOeUlvGFIk1iucHtX0uPC3yOWLbTdxihiLKoZ3yXW67mvimFBkpljK8aiiDFy7AUi/5zdpl2JXDjbC58flAQ8VF3LBtBzDbsKsQuXJgTVLHI5ZPAZvdZCccFyIPInRQHm13NIPI3wNPmKPYSgM41JzYIc0ExPwZpNhVus8DExuGyCkHJZq+0MB2VAtD0HfwP5pD2cEMqlqIX+K0SKvMfqwHU2yy/T3ojhTa+1/5vzKKGmdM1aKH8dHCuF8csJbAyww3bIIM6yjxirqJKr6YRJM5XiD7bLwXaLTu9ImnqxHo/XQCXgLyQJcJQwR2yworVPbF6CEySN5udHnbsO1v4Jd9WT7DvwvXoX5bD4RpcPbuRQzzhs4AFoak+OiOl+QE1fEMffyFlpc+nuYrIqx2zTP8gr8hcwWXFqoD+eGPW9nl4CH5DYTH+9pxn4opFb9BEzTV53Vi3CwLMJ+4egsaO5OGJa2UL6jZMA2560Hqf1+JaKfglR36sAB157xfkdq6gtVQPGtK9+FYonlWWPhTQwbjxgeH8Z4HiMEuF1jFqqIeKn1QFGp9dUot/T2N2U54ZXRnp3xXy1MiA== 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:(13230028)(4636009)(396003)(39860400002)(346002)(376002)(136003)(451199021)(40470700004)(46966006)(36840700001)(36756003)(8676002)(8936002)(110136005)(54906003)(40460700003)(478600001)(4326008)(70206006)(70586007)(7416002)(40480700001)(356005)(44832011)(81166007)(316002)(41300700001)(82740400003)(2906002)(5660300002)(2616005)(86362001)(186003)(36860700001)(16526019)(966005)(336012)(426003)(26005)(1076003)(7696005)(6666004)(47076005)(83380400001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:26.9013 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 653af9b5-fbea-4dcc-48a8-08db44e1c532 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: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8818 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the following featute bits. vnmi: Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest without using Event Injection mechanism meaning not required to track the guest NMI and intercepting the IRET. The presence of this feature is indicated via the CPUID function 0x8000000A_EDX[25]. automatic-ibrs : The AMD Zen4 core supports a new feature called Automatic IBRS. It is a "set-and-forget" feature that means that, unlike e.g., s/w-toggled SPEC_CTRL.IBRS, h/w manages its IBRS mitigation resources automatically across CPL transitions. The presence of this feature is indicated via the CPUID function 0x80000021_EAX[8]. The documention 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 Signed-off-by: Santosh Shukla Signed-off-by: Kim Phillips Signed-off-by: Babu Moger 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 --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7fcdd33467..ce26e955d8 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -806,7 +806,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "pfthreshold", "avic", NULL, "v-vmsave-vmload", "vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, "vnmi", NULL, NULL, "svme-addr-chk", NULL, NULL, NULL, }, .cpuid = { .eax = 0x8000000A, .reg = R_EDX, }, @@ -925,7 +925,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .feat_names = { "no-nested-data-bp", NULL, "lfence-always-serializing", NULL, NULL, NULL, "null-sel-clr-base", NULL, - NULL, NULL, NULL, NULL, + "auto-ibrs", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 7cf811d8fe..f6575f1f01 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -773,6 +773,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, #define CPUID_SVM_AVIC (1U << 13) #define CPUID_SVM_V_VMSAVE_VMLOAD (1U << 15) #define CPUID_SVM_VGIF (1U << 16) +#define CPUID_SVM_VNMI (1U << 25) #define CPUID_SVM_SVME_ADDR_CHK (1U << 28) /* Support RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */ @@ -946,6 +947,8 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, #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) +/* Automatic IBRS */ +#define CPUID_8000_0021_EAX_AUTO_IBRS (1U << 8) #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) From patchwork Mon Apr 24 16:34:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 13222407 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 9A78FC77B7F for ; Mon, 24 Apr 2023 16:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbjDXQeq (ORCPT ); Mon, 24 Apr 2023 12:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjDXQec (ORCPT ); Mon, 24 Apr 2023 12:34:32 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB031D8 for ; Mon, 24 Apr 2023 09:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yz4ZIJcGpPwdT9nJMDPZaZtF9h5B1tEncoQwA6Ero1mFOrhaL1ltAvD9g2gyEKkEILGi5V30TpKaI5eaa25XOkqVMWYeGKTS+6+hpI75FsyUPjhDKH1v2CTQE8RQRWWo9+oEY6CiYodIhpZTTPKQltySSviYNWAFSYHOrIgER+6/8ypa261azvRPJkdIwxxbv6O1By/kkYA3vf6dYV3iOxXqIF+ZgbVcK45QTS1hARtnLr9qR5HTW6Pof9xdqKhxjV4ObAAjbRhh2/pHVRzVDsLBy9UUOIh0ebBEJvGrtj14YMEy9jSPRbSG7YAmce6GUhlTo96Af29ByWjr/C5dJg== 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=P5Epj38ZKzbUzQkCpLvxqBkF21nGDkFZD5EP0hJq634=; b=ihITkfQeWJqKu3CiHkiCUPuYYxnR0Bgp3Sa4bQ7jlHGE/tJrarqFyG/xNznqtitzx4+RoGMe2G/5ZvCBqUs0c0e31RGT324+FJyJpfzRIy5IxqwCdGYDdeT+335ibHa6dbtxMv7R+YEsg+Q+v3Oc9RMrB+lsuSToMetT2Fs8n9Zdgx/w73YDmaRX4D4SLD+dfU8VW0aYKorVG18Lu1EwGUwN+lwoLp1OZWtjdNksug4a34qRqC2MiZdnOECLFNiZmA/NknirBEB7klcDLfU8KBxFvNB7GMRe0c6DQkZ4uc5t8hLfAJiuE3bx/3oETJxeBq+Zojs4KFjvNk317yRpPg== 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=P5Epj38ZKzbUzQkCpLvxqBkF21nGDkFZD5EP0hJq634=; b=vEoUMf58XJUKsEWBI+HG/Ov/9aa0lfgzl+C2Svl2wQrEObkktzzms0CfBXxmFOogmTI7/R0weEiXnBueMzDa2IGk3x4/qVQNiCURkdTJfiAbiBzbGtYUX5OPoz+W77inepQzApI5qBZFA9nmOtZA8pcG5OrpmafzHPfcdIMQAjM= Received: from DM6PR11CA0041.namprd11.prod.outlook.com (2603:10b6:5:14c::18) by CYYPR12MB9016.namprd12.prod.outlook.com (2603:10b6:930:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 16:34:28 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::ea) by DM6PR11CA0041.outlook.office365.com (2603:10b6:5:14c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Mon, 24 Apr 2023 16:34:28 +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 DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.19 via Frontend Transport; Mon, 24 Apr 2023 16:34:28 +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; Mon, 24 Apr 2023 11:34:26 -0500 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , Subject: [PATCH v3 7/7] target/i386: Add EPYC-Genoa model to support Zen 4 processor series Date: Mon, 24 Apr 2023 11:34:01 -0500 Message-ID: <20230424163401.23018-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424163401.23018-1-babu.moger@amd.com> References: <20230424163401.23018-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|CYYPR12MB9016:EE_ X-MS-Office365-Filtering-Correlation-Id: c43449e9-212d-4f2f-fefc-08db44e1c60f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +S4VQikh3mZGesRdqn8hr8UHgsTlcAHoCbALOWUo1XfoBpUf/AKmt/IfHbW3TD6S57OE4XPk1t4ko+JjxGdPjr1TCNr3r1jK88d2H6eQQpzx5FCOvBCqbccmjK4r4q1iDIr+IQtuRtNWf84HZWkO9Bf0/ABswJHcY0nR24qlrjnN6lrUiCdCPt38i/f5c6FBsvWS8nSknLGS9FlY0FIBKKWihONKmkknYdJR1eeNySPNENEfzEGt3wHr7iBDb+klYY6EeyhYlBsE1S9A9/Io+50HHo7UkcVkICCpuowAkjKB7RHIxQrrNyeq9kG26Kxk8eyW6bW/ok997Ws11NbTONg5uV/ks1CEH5ppW6ecmC++vt0FMC44lN3Gplk5C9u7rJkHad7k2N9YmJ7AzoEOqLgy0J8BQJ0eecUE5h2Li8bMRy3R7Fn3gspdx0O8JPao2VuN4xyvz7jhmjKc4LeBXmyXwGdhoZchef3Ukj1pGX3mcZDlVrTfr1WJUKIV7OJA2HiEecg1KHi1t+pmfG3aEpklVLsom5RGQ+TioAWx6+a+0KKvtofuzyUonPU1m5dQCeJdZASPwvTKdEoYX7tmj0hdbFd0QSj9SLEqksdNUt+NzOdPHgMKMNjeu1daS2OoImfAb3uPaCzxpGS2gYO3YcRJ0m/9BysmtnUkUEoP3GEUGItvXWu7wjF9KnGryX4pKQ4NhRnYTpLdECrMW0paXnlkZY9lQpf1ZnbOHUYJpH8= 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:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(2906002)(7696005)(2616005)(6666004)(16526019)(1076003)(26005)(186003)(40480700001)(70586007)(70206006)(8676002)(8936002)(316002)(41300700001)(4326008)(478600001)(44832011)(5660300002)(7416002)(54906003)(110136005)(82740400003)(356005)(81166007)(82310400005)(36756003)(86362001)(40460700003)(36860700001)(47076005)(426003)(336012)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2023 16:34:28.3699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c43449e9-212d-4f2f-fefc-08db44e1c60f 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: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB9016 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adds the support for AMD EPYC Genoa generation processors. The model display for the new processor will be EPYC-Genoa. Adds the following new feature bits on top of the feature bits from the previous generation EPYC models. avx512f : AVX-512 Foundation instruction avx512dq : AVX-512 Doubleword & Quadword Instruction avx512ifma : AVX-512 Integer Fused Multiply Add instruction avx512cd : AVX-512 Conflict Detection instruction avx512bw : AVX-512 Byte and Word Instructions avx512vl : AVX-512 Vector Length Extension Instructions avx512vbmi : AVX-512 Vector Byte Manipulation Instruction avx512_vbmi2 : AVX-512 Additional Vector Byte Manipulation Instruction gfni : AVX-512 Galois Field New Instructions avx512_vnni : AVX-512 Vector Neural Network Instructions avx512_bitalg : AVX-512 Bit Algorithms, add bit algorithms Instructions avx512_vpopcntdq: AVX-512 AVX-512 Vector Population Count Doubleword and Quadword Instructions avx512_bf16 : AVX-512 BFLOAT16 instructions la57 : 57-bit virtual address support (5-level Page Tables) vnmi : Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest without using Event Injection mechanism meaning not required to track the guest NMI and intercepting the IRET. auto-ibrs : The AMD Zen4 core supports a new feature called Automatic IBRS. It is a "set-and-forget" feature that means that, unlike e.g., s/w-toggled SPEC_CTRL.IBRS, h/w manages its IBRS mitigation resources automatically across CPL transitions. Signed-off-by: Babu Moger --- target/i386/cpu.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ce26e955d8..0b0ff4a0c0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1973,6 +1973,56 @@ static const CPUCaches epyc_milan_v2_cache_info = { }, }; +static const CPUCaches epyc_genoa_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 = 1 * MiB, + .line_size = 64, + .associativity = 8, + .partitions = 1, + .sets = 2048, + .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: * @@ -4472,6 +4522,78 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ } } }, + { + .name = "EPYC-Genoa", + .level = 0xd, + .vendor = CPUID_VENDOR_AMD, + .family = 25, + .model = 17, + .stepping = 0, + .features[FEAT_1_EDX] = + CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUSH | + 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] = + 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_PCID | CPUID_EXT_CX16 | CPUID_EXT_FMA | + CPUID_EXT_SSSE3 | CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | + CPUID_EXT_SSE3, + .features[FEAT_8000_0001_EDX] = + 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] = + 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] = + CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | + CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB | + CPUID_8000_0008_EBX_IBRS | CPUID_8000_0008_EBX_STIBP | + CPUID_8000_0008_EBX_STIBP_ALWAYS_ON | + CPUID_8000_0008_EBX_AMD_SSBD | CPUID_8000_0008_EBX_AMD_PSFD, + .features[FEAT_8000_0021_EAX] = + CPUID_8000_0021_EAX_No_NESTED_DATA_BP | + CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING | + CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE | + CPUID_8000_0021_EAX_AUTO_IBRS, + .features[FEAT_7_0_EBX] = + CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 | + CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | + CPUID_7_0_EBX_INVPCID | CPUID_7_0_EBX_AVX512F | + CPUID_7_0_EBX_AVX512DQ | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | + CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_AVX512IFMA | + CPUID_7_0_EBX_CLFLUSHOPT | CPUID_7_0_EBX_CLWB | + CPUID_7_0_EBX_AVX512CD | CPUID_7_0_EBX_SHA_NI | + CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512VL, + .features[FEAT_7_0_ECX] = + CPUID_7_0_ECX_AVX512_VBMI | CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | + CPUID_7_0_ECX_AVX512_VBMI2 | CPUID_7_0_ECX_GFNI | + CPUID_7_0_ECX_VAES | CPUID_7_0_ECX_VPCLMULQDQ | + CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG | + CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57 | + CPUID_7_0_ECX_RDPID, + .features[FEAT_7_0_EDX] = + CPUID_7_0_EDX_FSRM, + .features[FEAT_7_1_EAX] = + CPUID_7_1_EAX_AVX512_BF16, + .features[FEAT_XSAVE] = + CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, + .features[FEAT_6_EAX] = + CPUID_6_EAX_ARAT, + .features[FEAT_SVM] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE | CPUID_SVM_VNMI | + CPUID_SVM_SVME_ADDR_CHK, + .xlevel = 0x80000022, + .model_id = "AMD EPYC-Genoa Processor", + .cache_info = &epyc_genoa_cache_info, + }, }; /*