From nobody Thu Sep 18 20:24:27 2025 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=1670010523; cv=pass; d=zohomail.com; s=zohoarc; b=WQ7bxqDuT147kqXwi88LIW1lj7G9AbcV7RHuL3qdy1/7/qfHLitVa9GYw1jyiYjfnvbT04PE0d06GymD8gSeq9PAsJCWMPSry8L5sdObEqSCw7J3WSqfHQhUiMEAwB89G3TzhzFmNQmsIKQPmuuYEKyhVfLl/B4BIWLlEGLtCFM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670010523; 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=ra76mJdJvlqF6BtyOSVF08uSks0mwrHq+/j4roEpHck=; b=Pr9yVU54VBHjCjMYIw7wx7YOF8FcFxtfJoAhOOI0O9JNLFFR3LxKBFqdZfqNYMgTJQjXLGHDc//JWb5H574xEAK8doXQbYiudiqEzCTPkSlXitHS26+Vd2Cpzl8gSmQ8duQiLm4ZjBBl/GLfjcpAvM+m45WUKiWzke9Ks++pGyc= 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 1670010523092442.6526865116123; Fri, 2 Dec 2022 11:48:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1C0Z-0002YC-Hw; Fri, 02 Dec 2022 14:47:39 -0500 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 1p1C0X-0002Xq-6M for qemu-devel@nongnu.org; Fri, 02 Dec 2022 14:47:37 -0500 Received: from mail-dm3nam02on2060b.outbound.protection.outlook.com ([2a01:111:f400:7e83::60b] helo=NAM02-DM3-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 1p1C0U-0004eV-WA for qemu-devel@nongnu.org; Fri, 02 Dec 2022 14:47:36 -0500 Received: from DM6PR03CA0080.namprd03.prod.outlook.com (2603:10b6:5:333::13) by PH7PR12MB7163.namprd12.prod.outlook.com (2603:10b6:510:202::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Fri, 2 Dec 2022 19:47:27 +0000 Received: from CY4PEPF0000B8EA.namprd05.prod.outlook.com (2603:10b6:5:333:cafe::c0) by DM6PR03CA0080.outlook.office365.com (2603:10b6:5:333::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10 via Frontend Transport; Fri, 2 Dec 2022 19:47:27 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000B8EA.mail.protection.outlook.com (10.167.241.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5813.11 via Frontend Transport; Fri, 2 Dec 2022 19:47:27 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 2 Dec 2022 13:47:25 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=alOQLQB3NPznu27QMrmOcyPgVVXrCWmsyCZ6y9fgbVGhPZNIiNMwmiZazC9cEwK/TGZxEmUQdrIn3t/tNT+d1JEejYgSlp+7gw2XECNW+Wib2EHPTuXqXChkLpDgt4rhF70+V+o5ePMcjExnJVHd5TGd/hKX0N9dnSF11D+fjtPI5gu1cMdRMTf/WtSgHk71GPed2CH3e6NSiMs3eaj4cawNDY1ayA32ytaYSQLiyzgwZR8K8JpgYq48GHYJ2oadC4+lNRVJ23uap1eqUmuVmVP3hFJXXNjiZC5BXZKGNRiret12pd612Ow4EeCXg16JYe+Zgm4iIzHll/2UljWyFw== 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=ra76mJdJvlqF6BtyOSVF08uSks0mwrHq+/j4roEpHck=; b=IM3vOvx56B3xZZYTMX5UBR6zmcrrFJomyK3j7xP/Enj/SAZ3BvpyNqPFaL68v5zL84AOKrbpt1WBHYDwDVzvS24MMxYQ5wHsLGQZZYanHA4OmzO3+2XN/QbEZAIPPuH8bHbNANIWtdsM6PjIEoSV8D6WIRYXsWsIoniQQEmL8PGpnZRPBD2oGl/U8TAXKgJopYbbwMxXoS3S5DRUtaWdfl4d1qdO0KQmo3dIMx8MqPQ+A6y/Yd9FYOjal2sIky7gG0m646bI9JBuy+D0jNWlDto9KhsUSlMLv8pBcKmxKc6ZfAlI/S6dfwypfrr1br9VkfNc/kn7nu1C1hBnyIUdtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=ra76mJdJvlqF6BtyOSVF08uSks0mwrHq+/j4roEpHck=; b=3YlzLbZwD8QhC/I4bC4fWrWAo8hQl0GF84R1IuPhtMylxv2ZHSW01qx9OTQOBexvCSgINIoEm5IQVq6GIdpzXdv3ojxuvQeq8mmQcLjgtYjKvGtsgw46gF3FTStIAXWvtWUi1wEHvhp4vXUe4qjH2zTsV5/OWkt200CDtXbm6zQ= 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 Subject: [PATCH 3/5] target/i386: Add a couple of feature bits in 8000_0008_EBX From: Babu Moger To: CC: , , , , , , , , , , BCC: , Date: Fri, 2 Dec 2022 13:47:24 -0600 Message-ID: <167001044478.62456.9456560184804378623.stgit@bmoger-ubuntu> In-Reply-To: <167001034454.62456.7111414518087569436.stgit@bmoger-ubuntu> References: <167001034454.62456.7111414518087569436.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c 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: CY4PEPF0000B8EA:EE_|PH7PR12MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a6a4a5c-cd51-487d-7a35-08dad49e0aa7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EiQZjdLwJLIOPtpCe/s76gSkMzh4JOlUaRHMgjqaU+Pqi6LYes6HP+4he4hu9oX36fSK47aGJhnjtxZkOZjI+ji+grYXdRSPWGh+KK88l0P4ymTZQyyDLqxTT1GKDAsjKnSdChCbOZLZ+z8mufqt+N8kEfLHvwZ4q+d1fF0B8jvCroNpve10nb7NYIdgAz1I6E9fvkfc5e0T9Rt6QHi3aZ7Q3sPGdR49tSX8e0UrSWNWJXhKX9tiuSjuwampp4HV2jScrBD5P4irXbuxhpV3jbgoB8b8TBz2sWIDML3nPcm7LOKpbAoaMH+8ygJmqrVU976/epMF809LqTU42lJEx2PzW8079Z8YslofWAeMnqaNCIOB5OpgsecRVWRaJyia1+nmJufYPNO6qgyDHRjWm2ey49pkmzsHwu8Z/N+hSSxvsqa2CkP6oSggI+ASkFBE6sZq95rTm3k9F0zAwX0VVXU429/vaSqwJHnCYbLzinqEa3viKEAUSWBOpT47D32NobYjJFu3N7QSgMHRM79lCkGE3R6Ul0abAeeBelSoxtvaCibyyn+VcUSTsuptjoMTgw/z2631WUKlxlnuv6PUExZNSf4YukRSfD7Uljl+Q8uO2G1uz9V3uPcVIp7bv975++BUC/HIslXd68rI9gksPJOJ0YG+t91YtyyEcyeZlR1xtTtpuH8qaAb8ZBRA5whf3d2x36Z8lnoKaPD+3pXHyPLVdEMdLQa3eVOOlJ2Mpttl+QBPSdg7FG8EBopNwe/PIfB14nC0MyBSfHldtRuufyHSyEG3aepoGh8jL4J+vOYApj3NukuE4Egm+vMZ7iWRTw0URbryRYdIJ3eFFhm2Jw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(7916004)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199015)(40470700004)(46966006)(36840700001)(2906002)(16576012)(478600001)(70586007)(70206006)(316002)(81166007)(356005)(103116003)(40460700003)(54906003)(47076005)(426003)(26005)(82310400005)(33716001)(336012)(36860700001)(82740400003)(9686003)(7416002)(16526019)(186003)(40480700001)(86362001)(83380400001)(966005)(44832011)(5660300002)(41300700001)(8676002)(6916009)(8936002)(4326008)(71626007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 19:47:27.3921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a6a4a5c-cd51-487d-7a35-08dad49e0aa7 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: CY4PEPF0000B8EA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7163 Received-SPF: softfail client-ip=2a01:111:f400:7e83::60b; envelope-from=Babu.Moger@amd.com; helo=NAM02-DM3-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 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: 1670010525205100003 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 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 Signed-off-by: Babu Moger --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 81918e10ba..b20e422b2e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -909,10 +909,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 d4bc19577a..8c65c92131 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -918,8 +918,12 @@ uint64_t x86_cpu_get_supported_feature_word(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)