From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233650; cv=pass; d=zohomail.com; s=zohoarc; b=Tk7OnoC276lXLNzV1n6O0QuR8xQRbWFqyODTnrC5yaiuN0rL8Z9fCsWi+LfBGoqss4ibI6UIUM1QuFFdBHDzb4DLnQ65bIlwhZZgX0vFERiXXcu+Vt4gl8KdFK+MFPlWfxLdW1TbOHJdyJ6CpK05crbej7zC3OmOUY+PYaPhH2s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QYcnc4H9ARvb3HyRAdSp8NVzqXsbscxUazPWWvlYKzo=; b=h/fptFMgTiNoqoLrahTTaeovYuP3w4Hzse+MD3YYV7eZclFFgv7El6ycCrh+weBG2JYmw2gRm8fmJEuJ9zpk8rLfkRXpndTg1CENc9b6giCtkY/dcWJA1TuOjA7+ac9iTc822zZig+CKAfMP5Qc+nDC1jcXs5yVsLg8aNsF/lqU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233650967606.4092024565455; Thu, 4 May 2023 13:54:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxL-0001ns-He; Thu, 04 May 2023 16:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxK-0001nO-AQ for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:38 -0400 Received: from mail-bn8nam04on2061a.outbound.protection.outlook.com ([2a01:111:f400:7e8d::61a] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006A5-6A for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:37 -0400 Received: from MW4PR04CA0192.namprd04.prod.outlook.com (2603:10b6:303:86::17) by DS7PR12MB8204.namprd12.prod.outlook.com (2603:10b6:8:e1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:30 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::48) by MW4PR04CA0192.outlook.office365.com (2603:10b6:303:86::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:30 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.27 via Frontend Transport; Thu, 4 May 2023 20:53:30 +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; Thu, 4 May 2023 15:53:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ErqjifAuANbJsZEVJ6QoqzkxjKYDvihSnkuMt8FIi0H/GA1szp62hDvioevQhdRcv3lsFLhLBe7bZnG/1uyp7vtvWb5T3PrJemliWwq3IDuOaZihOZQB7dJyt1hwNQ8veqzx6zThSw+TY5qw9sSul7JEnnk+YfhGuVkQM8PVaWMc7wlRVUK2lm9Hw9gKLI7N4AL4rCNsouWhzjCb+AhdHzVtkdQ7wP/103EAoXtnBJrbkRQXhrHYwIj5TpAJ6/YFj5yGN2Z+W8ICIB33ecF3lm3xhUWfjZ4GVtnJB2JKswhpjpc9lH2ucuDI42JjoUnUftadh8hFXj8xWkLFdN1pMw== 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=QYcnc4H9ARvb3HyRAdSp8NVzqXsbscxUazPWWvlYKzo=; b=Wa1MGN1eo8DtB0YKAVcejkptc/JBU1dogPAAtBzI9QZJtpp+GO0lLvWzZVJsoR6q0ffmcDgnNKuIKuoC/0L4ouwA9/6IqxJUh5qn6czOVzJtR2F8FssZDUgzMw+UPOg3RjIMTPwgLiya/DCpp6jLzip2JqNfNoVXL+CL51GwJmCYSOKtg/a60IQ9OamiWJq7TsuIOKgx1TaEiN28xlrxJBsqVxKH92mQh4to5Z69OTyTAa1HzjxqPVkgk4r+3nfN6G+cVCXNSoq3oAg+S0BW9bNLCBXKbL3TtaDipzVeXAhV+Wpa0oxu1L8ve43Ii3Lh9oq+OVPS4uZgjqk+LCPVhg== 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=QYcnc4H9ARvb3HyRAdSp8NVzqXsbscxUazPWWvlYKzo=; b=3OO7Z1f6DOBUMGM36b02j8WmCrXHwgwsii5yC0djtaooGuigGkr8tN3TWkF/kf8CjCPyGx0WsAomPHFenoDH8F23XwgKN4r1KKTwPi3aebDGiS9A9D0oQrWpMyWR3WwyRD6W43Yb16HKByq25mxVif2orX+c27/ksJSWOdnI1D4= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 1/7] target/i386: allow versioned CPUs to specify new cache_info Date: Thu, 4 May 2023 15:53:06 -0500 Message-ID: <20230504205313.225073-2-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT046:EE_|DS7PR12MB8204:EE_ X-MS-Office365-Filtering-Correlation-Id: ac4a66cc-2100-4f0b-60dc-08db4ce19e05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F6GG0c9rqeXrA2n9ltWtHpWenRMvOfIQmAae5Y05yCdh3QTADOjbG/dc/Rt55TJ5p11Wj7ZIw17a9/WCImoesVNhMjMphM1b4lglQ34abte0XusaiVi0FwxJixw04f9qPF+AGD5BjWnLAAly96EVgC9FoHfgADKY2WUIaamaj7hViXVak5+h6aSVGgcAzIZOHEkW9pgNONzY2TgOlbH7+9j8S7cGYnJHd2mzPtnq0qinGtGJL0mv4SWD/jP8rkfoPH61DFIdSrNGkz88rju2upWJRbhHZpOrgPKHc8rtx4xgxpDd5Z1XaoofffQbkxsbdJZA8cCYEDotzAHQ2yS6wvzbuzGrXzOQTWu7VVY5QR+o4vXD6Kgx5h7oZrUlS5OmKsn1ZhSx2/l1JcVhOexA2NITJ+O0tnk8igDLjLZsPsxybrdb3o81nDtAiH609JGllCX6DiKWHrjxPg2IZoHZWzI+qrjNDvGjtKbdmFZln33S0c3VdYArAT2bGpa0PQ/Gh93zZpbSm7lkTL4BaLCw4KoKNz0medSNrb73Jkry7tR7MtiMnATFdwBtzeYpejFQTbeUhNf4xXuPq/hM1FamrvSsPx4+E4feVrPT7aW6PBB+JkEdeE0S9uZIgi0+53wP0woM9Dbunff7i5wTqmImc1Mh6vyR7IAavTWtxpY4jNgYCksmb3dPm7WXobo1QqKg6nhrtijJLGPFz1Va6fvmIgGCnf3hMpVyTmxLZEo3Tkc= 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)(136003)(346002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(478600001)(4326008)(70206006)(7696005)(70586007)(6666004)(54906003)(316002)(110136005)(86362001)(36756003)(426003)(47076005)(336012)(26005)(36860700001)(1076003)(8676002)(8936002)(7416002)(5660300002)(44832011)(41300700001)(2906002)(82310400005)(40480700001)(356005)(81166007)(16526019)(186003)(83380400001)(2616005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:30.3843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac4a66cc-2100-4f0b-60dc-08db4ce19e05 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8204 Received-SPF: softfail client-ip=2a01:111:f400:7e8d::61a; envelope-from=Babu.Moger@amd.com; helo=NAM04-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233653812100007 Content-Type: text/plain; charset="utf-8" From: Michael Roth New EPYC CPUs versions require small changes to their cache_info's. Because current QEMU x86 CPU definition does not support versioned cach_info, we would have to declare a new CPU type for each such case. To avoid the dup work, add "cache_info" in X86CPUVersionDefinition", to allow 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 | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6576287e5b..6e5d2779c9 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; =20 /* Base definition for a CPU model */ @@ -5192,6 +5193,31 @@ static void x86_cpu_apply_version_props(X86CPU *cpu,= X86CPUModel *model) assert(vdef->version =3D=3D version); } =20 +static const CPUCaches *x86_cpu_get_versioned_cache_info(X86CPU *cpu, + X86CPUModel *mode= l) +{ + const X86CPUVersionDefinition *vdef; + X86CPUVersion version =3D x86_cpu_model_resolve_version(model); + const CPUCaches *cache_info =3D model->cpudef->cache_info; + + if (version =3D=3D CPU_VERSION_LEGACY) { + return cache_info; + } + + for (vdef =3D x86_cpu_def_get_versions(model->cpudef); vdef->version; = vdef++) { + if (vdef->cache_info) { + cache_info =3D vdef->cache_info; + } + + if (vdef->version =3D=3D version) { + break; + } + } + + assert(vdef->version =3D=3D version); + return cache_info; +} + /* * Load data from X86CPUDefinition into a X86CPU object. * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. @@ -5224,7 +5250,7 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUMod= el *model) } =20 /* legacy-cache defaults to 'off' if CPU model provides cache info */ - cpu->legacy_cache =3D !def->cache_info; + cpu->legacy_cache =3D !x86_cpu_get_versioned_cache_info(cpu, model); =20 env->features[FEAT_1_ECX] |=3D CPUID_EXT_HYPERVISOR; =20 @@ -6703,14 +6729,17 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) =20 /* Cache information initialization */ if (!cpu->legacy_cache) { - if (!xcc->model || !xcc->model->cpudef->cache_info) { + const CPUCaches *cache_info =3D + x86_cpu_get_versioned_cache_info(cpu, xcc->model); + + if (!xcc->model || !cache_info) { g_autofree char *name =3D x86_cpu_class_get_model_name(xcc); error_setg(errp, "CPU model '%s' doesn't support legacy-cache=3Doff"= , name); return; } env->cache_info_cpuid2 =3D env->cache_info_cpuid4 =3D env->cache_i= nfo_amd =3D - *xcc->model->cpudef->cache_info; + *cache_info; } else { /* Build legacy cache information */ env->cache_info_cpuid2.l1d_cache =3D &legacy_l1d_cache; --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233712; cv=pass; d=zohomail.com; s=zohoarc; b=Qo2XhZhtRzl4N584YqiLyf+W/VCVxZN5UTutKq/Nd78pdphZH5N9x8EWUKJrTWnpOX2DkF4Ey7yioEqF2lLcWS4ZuE4toGZkz+oM/Sxh9p5NI22/Nqi4aM/RUZ5aWFh2POoKs5cHfA2o6PrXMM3lCrkKfHdnt6nCScGRk+wh8CI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233712; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kVKaQfSRr/cnJ8adibRf57IBypTIAIUZWNHemCMo5Qs=; b=Isb7SboBBXoaf9eJt00Ex39I4eB2SopMGNtXfcTIKaDpGd90Jj5PBkUcVQU+Cxd7Sogk1LNmmMAJyRQq86b4DUNbnKR+wLBJ6vYFqhc3NfMJpQkAKi1ndEJIDcvn1AVnq0u4cTRo/zhuxyCXmK41N5nAAxGl6252k4apjZg76uU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233712662421.47383214280114; Thu, 4 May 2023 13:55:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxM-0001o6-Lf; Thu, 04 May 2023 16:53:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxK-0001nY-Vt for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:38 -0400 Received: from mail-bn7nam10on2062b.outbound.protection.outlook.com ([2a01:111:f400:7e8a::62b] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006A2-4O for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:38 -0400 Received: from MW4P222CA0028.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::33) by BL1PR12MB5729.namprd12.prod.outlook.com (2603:10b6:208:384::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:29 +0000 Received: from CO1NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::22) by MW4P222CA0028.outlook.office365.com (2603:10b6:303:114::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:28 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT098.mail.protection.outlook.com (10.13.174.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53: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; Thu, 4 May 2023 15:53:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jw7duSI1ksf2PS8CvH7lXPwmhKFUd5oT2WuKm42XHF9YQ6c0WcZTLG7kuKMQcWGY3n64oOq3XqM1y3BaR+RqWp2PxXpN89F/zMH3+8HM8VE/rs9WHQ/cc3o5dnwK1no36/AFVuFTcbbTJI6Iw4mpxNcYdSa94S2C7JprTTzQHZhp7OxPopFNNYa4FNCK6hgE3rnyJD0DuSrz7huMI67fzQFcipfbS8N0kfNyM/BfIxjIRSpK8YaOtiPjKKhEEi0F38VwZ7JF1JxNvORribpZwS3KbxkBBc+BW2ix3UltUmTi14Dq0DX9ULOELymBGXETdH9vFR9JtKQ1UHQiwkdjtA== 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=kVKaQfSRr/cnJ8adibRf57IBypTIAIUZWNHemCMo5Qs=; b=aCNW0CeDdqlBbHrCgKbL90+Phjm5MkJyggK9YskHYb5QtDZqwGuNRIwWrB+SEUV68EDFd2HZ9+bpf91hGXSYUPF4b6LGexM971p3GRO/6oTgOPzdeQvtYg5Fwsut4ldUFu/DAY4n82TnrPJDJkHba0uF7IPnUH17K8NX314NBDxWr0aoadFJYkRuin4LPeE2Ss4rR7t3uzVVWOXEF1WVNgrQ8pauKAr+RZkmeB2qvco/J6GLu7XuL4Nxvp4TL3M5j7/jjN+O/i9lYiqUO2KZUEVhWLw9XsJCuKS/zmzq3JkdMLxJjhlH7IGCbMo/pY94ILF41SObhaVJt+EOPPwf6g== 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=kVKaQfSRr/cnJ8adibRf57IBypTIAIUZWNHemCMo5Qs=; b=lJhoJW1QTNykjnX75orUl8i2mm45+ViBYMiQf2NglSLvMPCRQd8XBfeBZIf9lkUZyBGivKHgBrc+nfxhm3R6MyLfE0YNo80Tu1WTxFDz148RqfDVfHpPNNTRI8mrRL/LjL/JcadzRTCy9oorV8ksjzQ37cPRtpsn9ZAnqwlrpQ8= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 2/7] target/i386: Add new EPYC CPU versions with updated cache_info Date: Thu, 4 May 2023 15:53:07 -0500 Message-ID: <20230504205313.225073-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT098:EE_|BL1PR12MB5729:EE_ X-MS-Office365-Filtering-Correlation-Id: 15a7d20b-f5b3-42c3-de76-08db4ce19d15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zWT4KbQiojcR2l+Sl1w/EHfb3r4u6qoorZRQPWZDJxUeawx8OndMHKN6+AGCUoUZyHzvCRq++P/MIX0ccAbfbewl/5Mw8EuBrFSqW9OBBkzAT4u0/CZiMFhqN/6dYHqGb5y3opw8Xb8VFwj4R5XR9/TVUd0JsGjpBaf2zGPnKigSi5OXYyqSJXGmaWe10OPL+I0SF9BFHZR/6FEvUMZBTrPpNBr68Iq/D+e4hCFUCwVBzXmuPE4CUEsWv3q5f4lPIqoGeEgsaA6jhCMVnMfS5A/cu1v2/QqkLDgKHcCeWflcGAkXpqDSrFMKm2cRJrVVYu2h7Nw9azWD83lt7G/cD2Cxn6RGGzI2syIuteia+WfNDN65oEVGl/scri1Th42odVsviaVVQFO4HP6SLoQGs600vtY+fTrBXWaLhjjPg36tGc0KQtBDcC+ZQwQ0QtYR2wbdBZguZFreV5oI8nFkHcRzl1ZCd5Y1aPDolULjbC5+4QghD9kTmlQ4kjCGKfGvx3FXzYBykzS3gJJfIjm953UhqJXPtMNgUvjevu0g0vq0nh4ANmGhtvg9Is4k7uUfcDtUYTFer+9pOjsk0qc0jVbmCzsfGeg83mSDYiEUO1gI5UmUnekgxQvUJsvrZbAmES8TC/kD/XgZ3Bq/uO7UuKkFnV+51WIkkjy7sm5WWmX1SVdjf+wnMrtuZsD8wKAhAnh+xqCCOxn8NVvyOCFIFQ1REvnCGxv9piBLpN22Nhs= 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)(346002)(136003)(376002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(8676002)(8936002)(36860700001)(40480700001)(36756003)(356005)(41300700001)(82310400005)(82740400003)(6666004)(70206006)(81166007)(70586007)(4326008)(316002)(86362001)(478600001)(110136005)(54906003)(40460700003)(7696005)(2906002)(2616005)(5660300002)(336012)(15650500001)(426003)(1076003)(16526019)(26005)(186003)(7416002)(47076005)(83380400001)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:28.7522 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15a7d20b-f5b3-42c3-de76-08db4ce19d15 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: CO1NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5729 Received-SPF: softfail client-ip=2a01:111:f400:7e8a::62b; envelope-from=Babu.Moger@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233713265100001 Content-Type: text/plain; charset="utf-8" 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 6e5d2779c9..6c20ce86d1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1707,6 +1707,56 @@ static const CPUCaches epyc_cache_info =3D { }, }; =20 +static CPUCaches epyc_v4_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 64 * KiB, + .line_size =3D 64, + .associativity =3D 4, + .partitions =3D 1, + .sets =3D 256, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 8 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 8192, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + static const CPUCaches epyc_rome_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { .type =3D DATA_CACHE, @@ -1757,6 +1807,56 @@ static const CPUCaches epyc_rome_cache_info =3D { }, }; =20 +static const CPUCaches epyc_rome_v3_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 16 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 16384, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + }, +}; + static const CPUCaches epyc_milan_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { .type =3D DATA_CACHE, @@ -4091,6 +4191,15 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .version =3D 4, + .props =3D (PropValue[]) { + { "model-id", + "AMD EPYC-v4 Processor" }, + { /* end of list */ } + }, + .cache_info =3D &epyc_v4_cache_info + }, { /* end of list */ } } }, @@ -4210,6 +4319,15 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .version =3D 3, + .props =3D (PropValue[]) { + { "model-id", + "AMD EPYC-Rome-v3 Processor" }, + { /* end of list */ } + }, + .cache_info =3D &epyc_rome_v3_cache_info + }, { /* end of list */ } } }, --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233713; cv=pass; d=zohomail.com; s=zohoarc; b=O7jlOBagXpsW4PsWKYDxsl4B2CTm9cJb8n8Jgg3xzVQ/cY0L2yyLXKpYCC2EZEQksy5HZKRIC44gZA77ouWuaEU0ALyejMjT7hoAQA4I4eG/iI9mLSgbAZ1dp4xVdm0skxVQfopd5CWG0jFFTz/blN8lMgAk6WbGTgakR3K1ILU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BDSW8af148/ffO20p+wYRn7eBomWU7Qujvr+JkFP0Uc=; b=Liht4G3PHfsPVCbNSpuDhEhpBfDPUDnwsUg050hGYaMhsHyDmv26XjM6FPiRFq0NBRVPTKg94wsuHiLiRZC/CEK0BO96MwRA8haUVInRTpd5/ZGkDMoHu8FWgC+rwOnGFE5pujF4QqLoKWoYIjUVk3IFwIY2b+EPyERhlRqTaTk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233713928916.4511582551854; Thu, 4 May 2023 13:55:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxM-0001o5-FE; Thu, 04 May 2023 16:53:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxL-0001nZ-2S for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:39 -0400 Received: from mail-mw2nam12on20603.outbound.protection.outlook.com ([2a01:111:f400:fe5a::603] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006A6-9B for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:38 -0400 Received: from MW4P222CA0014.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::19) by BL0PR12MB4963.namprd12.prod.outlook.com (2603:10b6:208:17d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:30 +0000 Received: from CO1NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::da) by MW4P222CA0014.outlook.office365.com (2603:10b6:303:114::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:30 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT098.mail.protection.outlook.com (10.13.174.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:29 +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; Thu, 4 May 2023 15:53:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2PHR816A81/dNtyT5gY+LhSfdySIQjG76wak+HrX1PPrgZ+CwGVqzENP0LO4gdZiM0wJToKWqYfjupMkz4SCs7XGOURI071nMy7dtF3SBkjTLSljWaJV+PLTLxpDVpVFEVQ7oTcrY/6RLbGPDDJ48bkX6fVj1HGLJzhr6VgFmxSVbuEZGPu8JiAccCHviwaj5lyMT5TjAMABxUnLMmFd4ZezxhTrAeChL8/KvATgBwLg1bFL8R3sm+zhICDur11Ya3I5h/X6Hr4PT5P0aH6HIDAcSZ5iuZLDusxhkkpI6miKBBOdSE1SzHRtQ/UeZSV6OBeIMIWk/WECHomUBDKKg== 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=BDSW8af148/ffO20p+wYRn7eBomWU7Qujvr+JkFP0Uc=; b=boFU1hJCGQdn2WE+dizRzUOUJUbVgcQtiiaAHji7LIOyUccWwRfEWuacJbl2ynuYwP8PNlLooe9gWGV32HUKAb9h73fGqoTQw4fTxd+3nmZU4QFJ9TnGmNMzSn3txGq2iLkJAH9F6xSaQEW3su373JzvagGJe76d95gJUftux7pr0ed6iW2j47lnLCioBMQ4SpbTLM8TsOronRACC+rXxTNRaYMdLhfelFxeVgCGEW9SyuhXUtA2yjrpM06z5tIG5vM/RI9C/D9q6wI9vCdnp6gTIBXNMQ0w2Wzy+7RLk/vxRjAw0pif/PW/pXKfdGN5iyvjFIZg49kyNYB2BjkFcQ== 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=BDSW8af148/ffO20p+wYRn7eBomWU7Qujvr+JkFP0Uc=; b=iek9BOfM3Uzgv2ReOOWAfH2BjAmdyCr5pQrPHs8m97u55RctcOp4zvHE/VOYPB5Pko7lzfN7l3aruYZLZ4hkhhvQZdLsfpjeQI4XiN5y6YV04kSGa8gHfy993iB7w8Ri6mMEBkVlnGnE9Ilv/J01M7vHcVERoVEg3KCaosQjOo4= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 3/7] target/i386: Add a couple of feature bits in 8000_0008_EBX Date: Thu, 4 May 2023 15:53:08 -0500 Message-ID: <20230504205313.225073-4-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT098:EE_|BL0PR12MB4963:EE_ X-MS-Office365-Filtering-Correlation-Id: cbcee338-9d71-4370-bff2-08db4ce19dbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w3uWVqA8w0ImeiIf3uI60WdSP19Zagi+Y2T17R0cyT2+hkMsXy2i0rtnt4YgG/YfgUT+TVfdr5KTW9RnGTLILoaoYGBhyRoUNatQhxo4yMUEGX7laak4JcRK0qfvsV7/aYmoE+BGa4pMV96BvmgQc2oPBmQdHnmLC9SdFe2eJlwKrzAEHpc21CThYoIoudZoDvIc80ZgGuiOUbN7hDnbS61+3Ao3XfCnKRjbvGfmoGcRhJjpYiJ7/w/6CW9KVjL1JAft32vyO4ouw+HTg4mZcItJ0yNNn+BJ/90oDJjCXVLT9luH0wDMUqhGxJ9JGRmwCqCcW+AIOtdd/aGUjFLW42KqMhBZKSPRSj2B9iIIPdRJ/lDZiRls2QNTNXpEv0ui4kU8Uq+IfcT80fMBDssIZfGmjz/j2qfUY4jxdHMzuICahcUGo9xKXNe/9ArRZHZGk3SzX4tZtVs9RneLn3SqazN+TbpnyRiA/gxu4BPN4JMbJZt2mPmiuhFeeZWyuHEFJYTkGeNTC+ciWJHQL6vmWW4CNsOoDWyPeuVFHeCeITHU7eyJVbrTyVi4135ZSJkSA/D+vKMDu5DNPmdYNzkDdt3sGH4YtFpDVW8Jm2ZsHNNRtbA+K4U3DvFaDE4ZEL96BBDQwX5c7cAHzeGWhpte6UvfTxteKsRR0jBIudaww2GKuF680NOug7oWL3AN3mG5APYekDw8NhyX6H7d+IZq/8etq2NV7Kwpu7gWZ1O7ePEtX3xTrI6lhHblPevLM5/xPXVVxxRSuZIim6mKQt1T6g== 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)(136003)(346002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(478600001)(4326008)(70206006)(7696005)(70586007)(6666004)(966005)(54906003)(316002)(110136005)(86362001)(36756003)(426003)(47076005)(336012)(26005)(36860700001)(1076003)(8676002)(8936002)(7416002)(5660300002)(44832011)(41300700001)(2906002)(82310400005)(40480700001)(356005)(81166007)(16526019)(186003)(83380400001)(2616005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:29.8927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbcee338-9d71-4370-bff2-08db4ce19dbc 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: CO1NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4963 Received-SPF: softfail client-ip=2a01:111:f400:fe5a::603; envelope-from=Babu.Moger@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233714656100005 Content-Type: text/plain; charset="utf-8" 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 Disa= ble") 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-predicti= ve-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 6c20ce86d1..1a79d224da 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -911,10 +911,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { 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 =3D { .eax =3D 0x80000008, .reg =3D R_EBX, }, .tcg_features =3D 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(FeatureWor= d 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) =20 #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233713; cv=pass; d=zohomail.com; s=zohoarc; b=DRplw8jgFEeKd+xvxJZuPa81oN63sK7pezfZFITelpQLCVaPQ45kxHw3xQm/9/54X593C4NNseMHyT/f8dRF4r0RTkwGFSfe7KN1OM2EmKM3j5BkUbp4D8PZVu/feR3Bmurc7gQP/LAKalFEch4yZjuVUdmG5X9clkVBEPBhPYE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rnZEhJAISTg6ODYqVysWyZFD73jAhHNQFTEEwqWkkII=; b=khyUL6pP0YjfqEcR6wxChxYOlq9aaiEBxShIsHj6EHx0AxjImFBDtXuzLz+p2d64qABQ0cMQSnrFKaWrcd4uOngaaBFnfngOTmyqK/MHjXsFnhMBnU5FAu1vufWN7TRd9lMlhA+/RPCW1pDbdf+87wghGIix15tlEyMF9Yc+pbs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233713663310.0787026028364; Thu, 4 May 2023 13:55:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxP-0001pf-0k; Thu, 04 May 2023 16:53:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxO-0001pA-8G for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:42 -0400 Received: from mail-sn1nam02on2061c.outbound.protection.outlook.com ([2a01:111:f400:7ea9::61c] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006AC-6n for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:41 -0400 Received: from MW4PR04CA0207.namprd04.prod.outlook.com (2603:10b6:303:86::32) by MN0PR12MB6368.namprd12.prod.outlook.com (2603:10b6:208:3d2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:31 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::5d) by MW4PR04CA0207.outlook.office365.com (2603:10b6:303:86::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:31 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.27 via Frontend Transport; Thu, 4 May 2023 20:53:30 +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; Thu, 4 May 2023 15:53:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EIoeZ0D6il5AURmWl1JhinW7X9Gl8bth6k6aaa/6m0hHRL7SDJGr/Du6g1Czw7Ie0//a61LvTfNrWex7C1luOFK/D/kto184EZyi+UtdLgM9ELUwatsPJ5Rtf8ePkTgEPseng3irhJkxsKvTzYDNSgwh/gCac/xRyjtIMgs6dcCpXLmn2yNYc7mbnFw68ex/EESXtGI4b/XMBaKJfHShzxHn1eTbIETxO7jkn7xwVEcS56zag5BIiNO4jjWAoZLHyD+yDGpyGe2D7VkhKcPJ6Y9OUT7yA5vqXuTfIjl0wzapXUCt/tG5VxD30X08AVrWEmVVex1+oF8ZE+49gGV7Wg== 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=rnZEhJAISTg6ODYqVysWyZFD73jAhHNQFTEEwqWkkII=; b=nVleNvxQOaIscG4Qj07PdkOMcIS5bHL5Rs5tz37NsV0JLD32WtjeXGWhPDG0+JbNaAUt1wG+8KSVf1wYcxG6NGb9IBlZbMKo0Z8pEwunL6gRXIyCy0Q+8igkYpxt8eZBIfjxi1NY3V1PShUaIZPHkHYFBWO4jt+VGMDBlAMnD7THVirL23r/NDX4ChLIPGECJTcMeBT6jZo7uzUFQ4gHBlJDlP5Hhw4It1ICgAJSQgaGYgBXzYHsKsBbO9RlusRKRufxfZppj8kAkLDaZWgKP8qj1Qe4W4XdeCzlzaLgBO4Qz+FInx7NV3Y36Rm+AMQlXAUa8IOg83B25E11NtJYyg== 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=rnZEhJAISTg6ODYqVysWyZFD73jAhHNQFTEEwqWkkII=; b=v98CJRGTVbV7JckIWgLxpOkcFuGVcxQe2VjgRorFnCrbH3v/JwekhiaxKV1Hf+adUfYvGoaSXVpsMfiU8WJ6NjX97S/9hS2jjdFxMIuyte4wLgNgouNI68lwMV6vPVqePYYpze/Pa3HoJMEB/m6oM0ZfnQI8Z0z7VdIGYk1Z6W0= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 4/7] target/i386: Add feature bits for CPUID_Fn80000021_EAX Date: Thu, 4 May 2023 15:53:09 -0500 Message-ID: <20230504205313.225073-5-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT046:EE_|MN0PR12MB6368:EE_ X-MS-Office365-Filtering-Correlation-Id: c0352203-2189-45d0-33fa-08db4ce19e5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yPNj5+hsiVTZMVhyJrv0GGKOTkUpPnFXt0Y+2neRtnxzLohIqJSaYZtvUJCUhsOaROWOChRpZY6OjSJOFh+0w0F/SSCxM7QCCa3hMnh66I/uX7f8PegyY4GSwMAokSAu+ebkIfoBg3lxcDOx+cwhbHkph42d5x3Lg5xwp6R7c3mZmrAEHrYdZOQPKJfQqygK/8qjMdAmrQEdcGMdj2ptCRnGlqvtY0/Eg5jsETvmzXyLCEBZxLUKaGlFYZ1cDIrApaiLxtnIuyXpeDXAshEwd1LoCP38tucbaqYjKIqnRWii56U9rj6/Q0ghfbUSHl9wVtFX9+Lzhsb4OVuS+IYxP7dBcSZ9ZcJAoU+I6XcFT5zXco/lMox4oalPsSn8UoLg9NN+BpQ/xuB1ZQtJQR8I5QZAbYIXquLeXj75HaSk1Ancq0//rMB7ud97lYxYm05UaAuTlBdnoLaxKYmeSktBy8Cqqfdl9LFZAbepeRfhwwOZRfCP7vyJJ2TDqZ8YhXjusZtrpxsbSFJCFk6iItjPNkIs+A1CJfD7vnF9O6WAe4EPZAoDrygRu+9EdGABHfUCJiZpbe9bfsiYsEIHYmlL6vo/FNDh6cRzjNHp1NUSBiVKId20P9f+pPr+jVOnnEgNiQ0faBeihQjcgOHFpN7xm4E6tf0zKiYdn5mQHBM+g6sCAtBnqZ6v7xEYJ4ik1IQc1Ap9Q3ZwSIpOUPz/DrGo41GPz7FX8m91CeJKIOFkV80G6u/MNgI5FLezFq8k8CrzqhOrmYWITlYWHq6yd3BDdg== 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)(39860400002)(136003)(376002)(396003)(346002)(451199021)(40470700004)(36840700001)(46966006)(41300700001)(36860700001)(336012)(47076005)(426003)(316002)(8936002)(8676002)(5660300002)(2616005)(70206006)(4326008)(70586007)(7416002)(44832011)(2906002)(186003)(16526019)(82740400003)(356005)(40460700003)(26005)(1076003)(81166007)(7696005)(82310400005)(40480700001)(6666004)(54906003)(966005)(36756003)(86362001)(478600001)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:30.9468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0352203-2189-45d0-33fa-08db4ce19e5b 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6368 Received-SPF: softfail client-ip=2a01:111:f400:7ea9::61c; envelope-from=Babu.Moger@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233716258100013 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=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation 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 1a79d224da..5c93c230e6 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -920,6 +920,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .tcg_features =3D 0, .unmigratable_flags =3D 0, }, + [FEAT_8000_0021_EAX] =3D { + .type =3D CPUID_FEATURE_WORD, + .feat_names =3D { + "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 =3D { .eax =3D 0x80000021, .reg =3D R_EAX, }, + .tcg_features =3D 0, + .unmigratable_flags =3D 0, + }, [FEAT_XSAVE] =3D { .type =3D CPUID_FEATURE_WORD, .feat_names =3D { @@ -6135,6 +6151,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, *ebx |=3D sev_get_reduced_phys_bits() << 6; } break; + case 0x80000021: + *eax =3D env->features[FEAT_8000_0021_EAX]; + *ebx =3D *ecx =3D *edx =3D 0; + break; default: /* reserved values: zero */ *eax =3D 0; @@ -6564,6 +6584,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **er= rp) x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F); } =20 + 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(FeatureWor= d w, /* Predictive Store Forwarding Disable */ #define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28) =20 +/* 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) --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233713; cv=pass; d=zohomail.com; s=zohoarc; b=bfbDq2/71u4VJWUiNdpDEp9+mXvCCsWaZ4tRY3//XXL1LBE/n59GQThaGrMBUX4xSvRcMitaUviHQnd19ErH293CmoG7FaiAoOCImkp1wfkjc4Zar/PfqqHVOo2CreFT5ZULJTx2VwTniw9ryjGffmKZJ+ARZ7oIg6Tp0dT/WhQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rbWhGaDsfZ7f4Rtw53TegEa8G45rHiyejRm38z1ZK3E=; b=eul+7ckEevnxkA9jXCzgE+ZxwrV74iVCc3HaOLLjeXa9tja9JVmnI/FiDGqR3bq83M+GGYkxaUiY5cUJECV/tsIgPN21UDL5iygGxp+B41bdXq/JxZAZtGu1Hi+IP2cJerUPT5sz+GpxJLpVGWEot76Py6e7StNfTSE7EpGp71A= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233713299139.2070414935455; Thu, 4 May 2023 13:55:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxL-0001nX-1B; Thu, 04 May 2023 16:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxJ-0001nG-C5 for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:37 -0400 Received: from mail-bn8nam11on20600.outbound.protection.outlook.com ([2a01:111:f400:7eae::600] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006AH-5U for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:37 -0400 Received: from MW4P222CA0011.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::16) by PH0PR12MB7470.namprd12.prod.outlook.com (2603:10b6:510:1e9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:31 +0000 Received: from CO1NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::6c) by MW4P222CA0011.outlook.office365.com (2603:10b6:303:114::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:31 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT098.mail.protection.outlook.com (10.13.174.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:30 +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; Thu, 4 May 2023 15:53:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTEqDiaLUP6L93wX/udf/mLgozjTl/xZ4otcVjWbiPZhr90KA9n6AyDgq93Ii122SwDP2w+9Wpa6dXUwygmokIL+J+9ieehiBBQgcMK34nxTFR/5g7sOVc2Yq6nvnFN45m+p9jfp1CgHWwHvatDy+5Qq2kibfGL/oqcro4MZC9s3vtSuMdDgsB+G3tTYBtHafVbipz68OqV1Wsk9g7kIuUHvn3oEL71LzMVmNgJt2Roa1m0vUQFZHVQeeHlbyFfVBPxpTnN2G7ZNd/J40DqejFkKISyirHxDrIjvRG6xlKn0BY18OrVN43qUbvzi4tBXoW0NDiMMK4n/+0oflvaq2A== 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=rbWhGaDsfZ7f4Rtw53TegEa8G45rHiyejRm38z1ZK3E=; b=JgFsGOiNLMCLokoCqqkDdPwmoyXrWGAQPl2/WXFUPrqxDQ0WY5wGWF4Y3ysuViYXOnNtPpj0GmXVaP/ZLsFGcUKV7JsQk5rGJ6HrJu30zUKK9Qqbf2m5WhuXxGuBGPUlzgEAzbh0RoGKPuHLSuEAOAqcJNsXqyQM7YALMw9cNaQBELd+EvBzLNvrNXsRBaaPs4diSgqYGDGxSfkptKMtJ7CbP9t3AAOP/iTtA7f5NimWvqCUrRp88MQObtqJ7arm/3+EQZv5ydT8JTWz4ZT3t7pZgvwG4G0ya64zxiNOuGwwC1PJUkihwUCXema4ul+CRfeS+91RFIVbdXxW5P5wkw== 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=rbWhGaDsfZ7f4Rtw53TegEa8G45rHiyejRm38z1ZK3E=; b=pK0ZFFc5qn3z7wW4pLkfUWro4JsvRpC4V+8u0D0aR2/1ZB50t6g1bfDexCV/COO64GINlBo/E0atCrmxvhXGPsVjFNVVQa640uWZemSl25TbDj+Pu8M5e81nlRRiGKBj4YQD+hlId/7Jw7YUlO3B+vgRnX5Bwuaw8yt7UQHuV7U= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 5/7] target/i386: Add missing feature bits in EPYC-Milan model Date: Thu, 4 May 2023 15:53:10 -0500 Message-ID: <20230504205313.225073-6-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT098:EE_|PH0PR12MB7470:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c58fd64-e597-497c-a17b-08db4ce19e63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mM3B3IS/dYHTkEQwWQ40sFer8tudBGO1mo7IlLKgIwcAGVp2VeeA1oEvgR2RQTZbjVbrtM+SZCCwJOmNMWtpxOOxjTk9e5I8xZBAPV5QYT0nhPFfB6zAJM93RKMHpIawYojUhDgTr9XnD81wo4Jrf8B7ezVMwaOwyHK2zZLb9PawF1osmAtasHyI3lmJaKeTAlR7J5oF2XjmvvWAB8CQzUSPwn27WMfShEuvXOCLu4ttJGWW3D9xohaKCN9M71GCAHPPJiWzsCPbhZC/Er+XGZ7Cn04alTiPgHnzifLBkwIPM4rFOpEhvm8O21heRtVNfdtkNvY+PA3vDqju/qMGuWsi0uWyf+6N+GOoEXwgnRc/VeXj1juWBBjLLr4KxKGxV6hiypKeIQu6jPU8HP+I3jZlET4V9NuUJhnS1Pv+1GequwekL7ycMoc8+CZqrpocY8BKwbGmSTKkCuJ16Ap274pFSU7SKu1c7Y7J6/RXq6KMFSoLRQJUxgXe0pyhMre/epDzviHG+BQNspHlWlv0C+1dEt8vgjQ4Fq7axhxsYi89EW5VW0FpQ3SSmQ/nECjd1CSMBpgZN9wzSIKmLS0ajOkowRJ+z5uUTvvPkmSzwvxbRuzfPSX9fc5r/h+7HhMffHat6hERAYEaTZ3BVXXpTTdyHKANFpeYrqjcyrhcajrXFOxCz4ersH5ggZ/B8v2aj6Ut437EnNuoSmml+1Zz27jqCE6Pj7qM3VwA6v2CfigxnRGwvw+u4fbbJN4U2RllFDhToCIyG9ZB1xyvwSFMaA== 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)(136003)(346002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(478600001)(4326008)(70206006)(7696005)(70586007)(6666004)(966005)(54906003)(316002)(110136005)(86362001)(36756003)(426003)(47076005)(336012)(26005)(36860700001)(1076003)(8676002)(8936002)(7416002)(5660300002)(44832011)(41300700001)(2906002)(82310400005)(40480700001)(356005)(81166007)(16526019)(186003)(83380400001)(2616005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:30.9864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c58fd64-e597-497c-a17b-08db4ce19e63 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: CO1NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7470 Received-SPF: softfail client-ip=2a01:111:f400:7eae::600; envelope-from=Babu.Moger@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233716258100014 Add the following feature bits for EPYC-Milan model and bump the version. vaes : Vector VAES(ENC|DEC), VAES(ENC|DEC)LAST instruction suppo= rt 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 will be. 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=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation 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-predicti= ve-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 5c93c230e6..0a6fb2fc82 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1923,6 +1923,56 @@ static const CPUCaches epyc_milan_cache_info =3D { }, }; =20 +static const CPUCaches epyc_milan_v2_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 512 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 1024, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 32 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 32768, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D 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[] =3D= { .xlevel =3D 0x8000001E, .model_id =3D "AMD EPYC-Milan Processor", .cache_info =3D &epyc_milan_cache_info, + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + .props =3D (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 =3D &epyc_milan_v2_cache_info + }, + { /* end of list */ } + } }, }; =20 --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233650; cv=pass; d=zohomail.com; s=zohoarc; b=h+irTU6xVF2oLxJN10OdSimAMI2ugZFnI4t4pJTEaXSwDWLrdQCbb2HtXZKqlB1AUozOCMFKADek7UxNv1WYDi01Y3plNYA30ozI4mM8k1gPNcG3oUWpA4Ze7zpZQ8kRnBtivqPuTsS5HmSbc/XTNfAMpdA7/iEgHs9dYpICHVs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9hp2/tJWr7a7IUBgGdrJraven/9x9JRPhj+y1L5oiqI=; b=CL4tyVMsYumrY6mjRf5HOmV40zY9xVgkwPlsE24QoLJb5j0rB5rT7+MRP+GoJHnANc+l3/zAzbP6p4Xrghj62TC9KnMagDvVAVFJs23nSL4aH9Z/TPUEQTUL8cDvmMa1rrE2B3Sdmfciopl1Ko0PbuEnaJLJjuoKeBFtuBrdgA8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233650975244.78919832500117; Thu, 4 May 2023 13:54:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxQ-0001q0-NT; Thu, 04 May 2023 16:53:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxO-0001pB-8N for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:42 -0400 Received: from mail-bn8nam12on2062f.outbound.protection.outlook.com ([2a01:111:f400:fe5b::62f] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxH-0006AN-6I for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:41 -0400 Received: from MW4P222CA0014.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::19) by PH7PR12MB7306.namprd12.prod.outlook.com (2603:10b6:510:20a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.20; Thu, 4 May 2023 20:53:31 +0000 Received: from CO1NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::da) by MW4P222CA0014.outlook.office365.com (2603:10b6:303:114::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:31 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT098.mail.protection.outlook.com (10.13.174.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:31 +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; Thu, 4 May 2023 15:53:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j74N8s2BARecRM4Z/EGTkbImoJvGa654hAPxT8hvz1BS2S6dKtcgAyDnRAYq4oCVv4JQJ3lAxqIS0r06ihp9F+PvmxXRgAHwpK2iAc5DUFE0RYMTBx5TKcX1JUCAOuTT7uZrJt7AzWOqtplDBRuYyn9C2FJubR7DIYszpdspvNOLpReMgEtdaaqke9YOACXYJTU18dkezL0JI+xutrU5zC/H31zUB/nOly/tTbtVMs6OflR9NkW/vGTWIEWR/TS9L7VBMC3WpLBirvDMA0MpYMCXi+PzS18Flcx0sDIVxevNydKugjb6rcWA+n1qvCfUerdgZ19ItG2bDxBG7ZgrLw== 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=9hp2/tJWr7a7IUBgGdrJraven/9x9JRPhj+y1L5oiqI=; b=Y6FEKHhekwrB606kNXId3fUU+GTtvJzbGcpIXd/MpjDSJ+AA8DfflyrXnvgjfUsc0jpDimIeKbIGDF/MiDoXpE5CILm/mxiwj9xkO10UOK8iQfkyAm7m/QMy3Gtw6J1e9V/fc/u4hMpVB90IXKkxCiGvI+R3tnx8XGPxQ+dgdBZU7Pqdg//okksMVeL76DiEmAl8CJMKqyja1kU/bER7xH6w+FPWU2ZUGd/RGM1DHgg8HKV8i3GPYIM5NJy9bIdDPb2cND9VVSyz91/1e3wiy9NK+fH6iOnqlJX7J2TbnUAsiJStVewyqYFZui2qB1yrE3M6ZtRtEYOHvbF44c5W9g== 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=9hp2/tJWr7a7IUBgGdrJraven/9x9JRPhj+y1L5oiqI=; b=374MoYwbRXh/9Yk0EgfBt7OhAJ6gPxaSTD8ZVMye5GoPNTTLOkFp43qjxj0RhWwiBYEATfh1OXUWyf0A3f9bFGn1kRXLATkgcPaCrL8qRC1Qg5+OLg5D/mnebiDBaNQSiSMK1mvbSyoyvQmotZSumB1MyWlSiKNYuhMkPpwyXAk= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 6/7] target/i386: Add VNMI and automatic IBRS feature bits Date: Thu, 4 May 2023 15:53:11 -0500 Message-ID: <20230504205313.225073-7-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT098:EE_|PH7PR12MB7306:EE_ X-MS-Office365-Filtering-Correlation-Id: c27fdc1b-c059-48e2-9b88-08db4ce19ec0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KpLsU8Pj741D7pfdOPAASpLZ21iU94ttyjGdczuNgIygA/l/iUzacjjca8JvSJ9m7LAiAPz6gKlTAik4o749bOu3QGSMzfGfSf2e4ZE1rMZu/DL7KSAx0OOxeKAkxpcSDCLLaEfUDeANXTUfbrLa7lBCABARjJPOTD+45Xjww5tgl3lCjGpQvXzLVBVl8RUKD/Q1/teEcr4BjVcboslcgHzkjtLOpQGOFKxXfwZdZylh3Sj1eA6EBy+wDG/Gw3TFDnKCoRovAoot9HLUhrGXgr4dD3kwAGOHpYg8XH76tGF/27ejQIZtJI2WUjnVJAtPb6R9b7+tnC3FVN3pGR+uLE9zU/ZzOrbo5NkQElgo1jAPQqtdpz5AR8txCRgdzYHQntc/sHhFrAj+qFu8nwMLvopHXMi1m2ymSkQ0eAj1lFh6Nl9p2F45WV1TEkip1NQ5pFfQYz7NKx+NIOrE4jAc3DZoh6IsZGZ5sU1upM4bLI0PRGDcMp9cTKlRJVYC8vgUtn1MNH80+W5HMX7BjNxsZ92VLf2B5TNeUPXt25a0lt4V37WdjEUu0nPFC5DhaJYkvUwrhCrUqKtuRkVxsv/p4QzTAfUlY6euN7Zr7S0eelQ/vLqn6t9SRidYWKPJpI/6ZwPiK3DirYu1vLFGMZRFY/6LCbZvJUb4TTG5ML5m9Ij002MHrldscL0PB7olTX2jcUPgQXysnF7lVGfYYiKF5BHUrZuf+YmLfnxuo0sQiQ4xmXCKBCAkv1Fk3tA1960gXJsMc/OB5zPKAW5CRWX05A== 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)(39860400002)(346002)(396003)(136003)(451199021)(46966006)(40470700004)(36840700001)(478600001)(186003)(36756003)(16526019)(54906003)(2616005)(82310400005)(7696005)(966005)(4326008)(36860700001)(47076005)(6666004)(316002)(110136005)(1076003)(26005)(336012)(70586007)(83380400001)(426003)(70206006)(8936002)(41300700001)(2906002)(5660300002)(8676002)(356005)(82740400003)(7416002)(44832011)(40460700003)(40480700001)(86362001)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:31.6113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c27fdc1b-c059-48e2-9b88-08db4ce19ec0 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: CO1NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7306 Received-SPF: softfail client-ip=2a01:111:f400:fe5b::62f; envelope-from=Babu.Moger@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233653142100004 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=E2=80=99s Manual Volumes 1=E2=80=935 Publi= cation 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 0a6fb2fc82..d50ace84bf 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -806,7 +806,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { "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 =3D { .eax =3D 0x8000000A, .reg =3D R_EDX, }, @@ -925,7 +925,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .feat_names =3D { "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) =20 /* 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) =20 #define CPUID_XSAVE_XSAVEOPT (1U << 0) #define CPUID_XSAVE_XSAVEC (1U << 1) --=20 2.34.1 From nobody Sat May 18 05:53:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1683233715; cv=pass; d=zohomail.com; s=zohoarc; b=ZPGkELbuflV60A/G6UxFDoTMmVbzK//b+zeF8AZ8Zx93N+eHpzZEiIpVvaft1CADfXjedrp1y4dDerqkIzgO2n7O75fuSFGupy1AkbcGutR+JOpF2Ec7WPN15Ox3umtXMy/JOc2bdboOzhptqLWzXno7YSJP7TtdYDS/NmpgB44= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683233715; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YlHpPkuppVHlDMATPAqeYcJ2Kr09C0OxfBnDZdoE/ew=; b=QZYZcVR0dmnw1GKCVbLkQxddPI930lW1w44TbUXpzE9w40pqP9wYDp6EFwYzlU1b4J03hPeX+Ejg7IKO8425EdqwV2GiDSrBWhGre24wBxGkqfzd6k66rT/srfcw3FMOSc5P63Q1fl3fGyYB2UzhUErUhJ0WhayXlMej9locJ1U= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683233715810824.8521658606937; Thu, 4 May 2023 13:55:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pufxO-0001p9-6j; Thu, 04 May 2023 16:53:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxM-0001oD-Sx for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:40 -0400 Received: from mail-mw2nam10on20621.outbound.protection.outlook.com ([2a01:111:f400:7e89::621] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pufxI-0006Ao-Sb for qemu-devel@nongnu.org; Thu, 04 May 2023 16:53:40 -0400 Received: from MW4PR04CA0198.namprd04.prod.outlook.com (2603:10b6:303:86::23) by MN2PR12MB4423.namprd12.prod.outlook.com (2603:10b6:208:24f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Thu, 4 May 2023 20:53:32 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::7a) by MW4PR04CA0198.outlook.office365.com (2603:10b6:303:86::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.26 via Frontend Transport; Thu, 4 May 2023 20:53:31 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6363.27 via Frontend Transport; Thu, 4 May 2023 20:53:31 +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; Thu, 4 May 2023 15:53:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLDyMtfSC09kGEieg1uRm9VYIOphjR923sXkpLRGPUuM0Lw0ZYhCaVixeNMARjTaeyKY8Yzwvtd/xDsHywk3lvSwEcjU5ZM7n2W5jLwV3JnZBaZLBJhQS4B8k9hvUBjZQSJLhNdTY6aqcjwmqC3sAEEPU44D+pm3fA4q4azIsOaw4wwyG4OHb4DP4LyWOZhFEpEi99z2N0TsY9zo4apDbr1xRovNfKrUTD9yPsy9Psh8sGQ4rqZ8C5BRsdbmpC0DWdVYA/9NDc2KCk62U7aakhjWnIpogSPHk0rXjhhcDceEX7Bikf4RMX8G5Z7Pckh7YBe3wH8slEpVZx6B4qiVfQ== 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=YlHpPkuppVHlDMATPAqeYcJ2Kr09C0OxfBnDZdoE/ew=; b=f6soLSczfvcFRZpIg8gSdoJkYOadMs2M5OhytuXEcuwtvavhz9pjILzMRy0h5EYM287AD6N9fJ1ikJkm94u8X97CwaW2Ho5lIWzRNUAFXQv7eZIlzw8OOHlrisMMpRI3oEqTR/LCC+6wcoOWfhneYe/XaC2BrSUkOmf1hOxuV0dRs8TeSdnuhoA9U5o7L8hP6ULGS3znbVxCZ2vGSwhTtZ4W+k2o4PiUnGTO+bHt+Lu/V3jNOWaqzfbiTiSZ/tQsPLjZeAHtC024MaVIQc8JkjtHaIvP7t6D33kez11OD5K1moQL/d3TADwm/FgbBtmoxpGunD/bssvzlQ0oWxEnHg== 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=YlHpPkuppVHlDMATPAqeYcJ2Kr09C0OxfBnDZdoE/ew=; b=SwWC9RE65gPxuXsxMxx5Kwtd8tyqYkTQpKjbdyyokPLeLEUrkJaCbNYI8Ak5fU1F9vCbYf3vumSMFxAFVFobVI0Y9+bwkcslLr7G7UdGRiqKLCzuLxbWw3rkJIEwN9FmJOtnhAujDRJef64cJVFsS+WRyTyedUW8vfIpUp5WWVA= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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 From: Babu Moger To: , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 7/7] target/i386: Add EPYC-Genoa model to support Zen 4 processor series Date: Thu, 4 May 2023 15:53:12 -0500 Message-ID: <20230504205313.225073-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com> References: <20230504205313.225073-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: CO1NAM11FT046:EE_|MN2PR12MB4423:EE_ X-MS-Office365-Filtering-Correlation-Id: 24e24c36-ed0c-4fbd-c9b9-08db4ce19ed4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GJ/4yIdlH21nkrVVDVEF/+gh/krLJzajldqimztiLDagtamb5A9dgboh4vM4Oqbtt2fH6J55j+v7qNkiDoI1MUVXcJt3n/Pj4oq+cHcfRcWUUL3ROJ+/lsuIS/GmtYdhMGxqwcVkfMkJXfcOOYDeWMgTRT7aQcg6oi6bHYLOl89qvVNnBGV2S8njh5G9XClju67QEB06caE8RgWdhGhn6VpIRlWTgQ3I3RJhYPwleHhM1CbgC9y9MUS1BLcPPuqAjEPZNqAzzSeO9NRNbUvj84Ex0jH0rXXKwrX/so9yJFWo4eFuKSOTxOImoBDB/6DySgk7xR7lpcgxAPQeTuht1tw6KnqQlHVTsosV/PIOE7QM1Dhinl+zxx1/WDC60rdevD8e55Ord6Za4r4P8a9BiqJpHF4xmufsyLIXmGU3y56uVkMbLlyyedDEFmz7vlQgVcFZ6sEdVT1WRKWZQ/RnpKJNiEFydahR9pve1+bNMwlwa6QttUHPvJU8dYQbsYY1IoOeJI5CLmMazeq5xs4pL2oXDe6JS8UBMJc9cdnO11z18dLuJSk5khT+37IJ47sexVodN+IL08URK0TfKBAKJ9JdKuJ89Hj0IRkXkHu5DaxmDW5k0pZyburHde8EvkyZq9xIW0vThExjJrdAMBOMUFJy374zKIxm9vO5kZqoTsmMqJ9zsA6jvHWfV6pRAb+SJxHuJWew4bgpivTCujfSXrkrenInjepNAJfJxayxysg= 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)(39860400002)(346002)(396003)(136003)(376002)(451199021)(40470700004)(46966006)(36840700001)(36756003)(47076005)(86362001)(70586007)(54906003)(7696005)(70206006)(6666004)(110136005)(4326008)(478600001)(316002)(82310400005)(40480700001)(5660300002)(2906002)(44832011)(8936002)(7416002)(16526019)(82740400003)(8676002)(356005)(81166007)(186003)(2616005)(1076003)(26005)(41300700001)(36860700001)(426003)(336012)(83380400001)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2023 20:53:31.7436 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24e24c36-ed0c-4fbd-c9b9-08db4ce19ed4 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4423 Received-SPF: softfail client-ip=2a01:111:f400:7e89::621; envelope-from=Babu.Moger@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1683233716402100017 Content-Type: text/plain; charset="utf-8" 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 intercept= ing 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 mitigati= on 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 d50ace84bf..71fe1e02ee 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1973,6 +1973,56 @@ static const CPUCaches epyc_milan_v2_cache_info =3D { }, }; =20 +static const CPUCaches epyc_genoa_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .size =3D 32 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 64, + .lines_per_tag =3D 1, + .self_init =3D 1, + .no_invd_sharing =3D true, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 2, + .size =3D 1 * MiB, + .line_size =3D 64, + .associativity =3D 8, + .partitions =3D 1, + .sets =3D 2048, + .lines_per_tag =3D 1, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .level =3D 3, + .size =3D 32 * MiB, + .line_size =3D 64, + .associativity =3D 16, + .partitions =3D 1, + .sets =3D 32768, + .lines_per_tag =3D 1, + .self_init =3D true, + .inclusive =3D true, + .complex_indexing =3D 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[] =3D= { { /* end of list */ } } }, + { + .name =3D "EPYC-Genoa", + .level =3D 0xd, + .vendor =3D CPUID_VENDOR_AMD, + .family =3D 25, + .model =3D 17, + .stepping =3D 0, + .features[FEAT_1_EDX] =3D + CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUS= H | + CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE | + CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE | + CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE | + CPUID_VME | CPUID_FP87, + .features[FEAT_1_ECX] =3D + CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX | + CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT | + CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | + CPUID_EXT_PCID | CPUID_EXT_CX16 | CPUID_EXT_FMA | + CPUID_EXT_SSSE3 | CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | + CPUID_EXT_SSE3, + .features[FEAT_8000_0001_EDX] =3D + CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB | + CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX | + CPUID_EXT2_SYSCALL, + .features[FEAT_8000_0001_ECX] =3D + CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | + CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | + CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | + CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE, + .features[FEAT_8000_0008_EBX] =3D + CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | + CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB | + CPUID_8000_0008_EBX_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] =3D + 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] =3D + CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AV= X2 | + CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_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] =3D + 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] =3D + CPUID_7_0_EDX_FSRM, + .features[FEAT_7_1_EAX] =3D + CPUID_7_1_EAX_AVX512_BF16, + .features[FEAT_XSAVE] =3D + CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, + .features[FEAT_6_EAX] =3D + CPUID_6_EAX_ARAT, + .features[FEAT_SVM] =3D + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE | CPUID_SVM_VNMI | + CPUID_SVM_SVME_ADDR_CHK, + .xlevel =3D 0x80000022, + .model_id =3D "AMD EPYC-Genoa Processor", + .cache_info =3D &epyc_genoa_cache_info, + }, }; =20 /* --=20 2.34.1