From patchwork Thu Feb 6 08:32:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Penny, Zheng" X-Patchwork-Id: 13962601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08A12C02196 for ; Thu, 6 Feb 2025 08:33:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.882554.1292659 (Exim 4.92) (envelope-from ) id 1tfxKD-0000h8-0y; Thu, 06 Feb 2025 08:33:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 882554.1292659; Thu, 06 Feb 2025 08:33:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tfxKC-0000h1-Uf; Thu, 06 Feb 2025 08:33:28 +0000 Received: by outflank-mailman (input) for mailman id 882554; Thu, 06 Feb 2025 08:33:27 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tfxKB-0000gq-Lj for xen-devel@lists.xenproject.org; Thu, 06 Feb 2025 08:33:27 +0000 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on20602.outbound.protection.outlook.com [2a01:111:f403:2407::602]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 07b5d558-e465-11ef-b3ef-695165c68f79; Thu, 06 Feb 2025 09:33:24 +0100 (CET) Received: from BN0PR04CA0136.namprd04.prod.outlook.com (2603:10b6:408:ed::21) by MN2PR12MB4424.namprd12.prod.outlook.com (2603:10b6:208:26a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.25; Thu, 6 Feb 2025 08:33:21 +0000 Received: from BN1PEPF0000468C.namprd05.prod.outlook.com (2603:10b6:408:ed:cafe::3b) by BN0PR04CA0136.outlook.office365.com (2603:10b6:408:ed::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.28 via Frontend Transport; Thu, 6 Feb 2025 08:33:20 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF0000468C.mail.protection.outlook.com (10.167.243.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8398.14 via Frontend Transport; Thu, 6 Feb 2025 08:33:20 +0000 Received: from penny-System-Product-Name.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.2507.39; Thu, 6 Feb 2025 02:33:18 -0600 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 07b5d558-e465-11ef-b3ef-695165c68f79 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wx/jreXkk7dC5sXQUM0Y2IYpzUOxOEWgWG6VXE0+32ltIRglNW7LhD2y07XLVG+CBqLC3Eba9ek5mvjQw4ftqKcA/PYksfPX/2g6nk61Nq6QT1DCgPjHp1p2HfNws7qoRlRB9uXtbqNPh5MY0yt/vBDnwFXEn6b7303bVGaohaz6+DdirfXSvSvlOp09kHumNrBk7WV28KxVIq08kuz84SeeZPvIftli6Fw+DZbVjPo9JxdUQCqR0skI2mN5rnCPhYhjNLHaQ0pnPb8n06bXFcpOEDOz5RsPzRLgzVwZ9bqJjw3TbXeF4BWzKTSrKTn/rp1PuQyYgoeF1EKin8C7Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=41y8sec6nqUyzgRa9rWZO3TQWkVErDGbU7dAJLNct/4=; b=wzn2mQw9VVzGe97WJuBI/EzoL1MjAsxePrBTkHpqvzA1sNUvL2gVUkQXnXf2+14VOltUMzwWwbK1J5YTi0OwcbMLEsTZuDZ7ZtQ0+7hgYaUwpRnydJcICJvSaPAUP0Z1pyeYa5WFUKooM2XTFJPdDclFu+bjNtutrUWG8LfY5gPKed5rWKSH/H8FtDG3dG6CVrkF6du0dyX9vvhGAvUY9oXXLg3jijIl4OlH9l8v1H0u2q5PpOE14xSUTIZiiSXxdNuUuWZ0HN8qOLBDgWmKsklyeqA3u5uegKxq6oFBw8VPIgzxCk3n75MHMbxSUkqoI9lUsykqYxl7z3ygEjIrCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.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 (0) 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=41y8sec6nqUyzgRa9rWZO3TQWkVErDGbU7dAJLNct/4=; b=p99r19jLxwJSiOKLCYplV8oKHElRDVJAXHmW/vxo5s1g1ZecBPECcbLZLTrOOQ9uRdiEcjIkrdz/DYug7WKzvlWMwoT7ApD6ECZ5A/R0cfh0o78LP24CJvhK8dBBKnpm7zH2L+kjFy+u1QuhOAL/3JkUCnBcuw15hmHFFNdBaN0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH v2 01/11] xen/x86: add CPPC feature flag for AMD processors Date: Thu, 6 Feb 2025 16:32:45 +0800 Message-ID: <20250206083255.1296363-2-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206083255.1296363-1-Penny.Zheng@amd.com> References: <20250206083255.1296363-1-Penny.Zheng@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468C:EE_|MN2PR12MB4424:EE_ X-MS-Office365-Filtering-Correlation-Id: ad0c470a-aec4-4232-fee4-08dd4688e9d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: BlUfm2mr0hKcldLYMJfbcH0qWBOVD+WHiBN7pK6V6gVqJ27+71ecsmLp6MDgisKG9PJmZ5jtcfWjHlhRWadjXmHXhK5zrV3PTmW47je7aJf/75p9v/8kaHYmrkx7M+2N+l7hn2bsGAk1mqT7Q2fzQOeJsKz/TNDYlDMEip7v9ydjSTC1H3kKdQ9JBZgogeAYXqVZ/tx1tF4VFxd0mY+RXu+nCww05QxOUPSl90LVTjV/VJx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K35yC8alNhxCTDYbmg9guAAnSE40MdamHmb3wWOo0m5vScHm0C5T/w81inuaO4acf+f7skImI+LHDUakFl9bgHdBkwlw9qSnJ7akS/SSxIkKoai/tJJKOpyQTzPTBy29/VQlTG0X253GZkGMUwLjJ7fa0xu5C9eKG+Fy+iaC0o3XZDShWrgOg= 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:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2025 08:33:20.8531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad0c470a-aec4-4232-fee4-08dd4688e9d6 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: BN1PEPF0000468C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4424 Add Collaborative Processor Performance Control feature flag for AMD processors. amd-cppc is the AMD CPU performance scaling driver that introduces a new CPU frequency control mechanism on modern AMD APU and CPU series. There are two types of hardware implementations: "Full MSR Support" and "Shared Memory Support". Right now, xen will only implement "Full MSR Support", and this new feature flag indicates whether processor has this feature or not. Signed-off-by: Penny Zheng Reviewed-by: Jan Beulich --- v1 -> v2: - Remove A flag, as the feature is Xen-only --- xen/arch/x86/include/asm/cpufeature.h | 1 + xen/include/public/arch-x86/cpufeatureset.h | 1 + 2 files changed, 2 insertions(+) diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h index 3a06b6f297..6935703e71 100644 --- a/xen/arch/x86/include/asm/cpufeature.h +++ b/xen/arch/x86/include/asm/cpufeature.h @@ -170,6 +170,7 @@ static inline bool boot_cpu_has(unsigned int feat) #define cpu_has_amd_ssbd boot_cpu_has(X86_FEATURE_AMD_SSBD) #define cpu_has_virt_ssbd boot_cpu_has(X86_FEATURE_VIRT_SSBD) #define cpu_has_ssb_no boot_cpu_has(X86_FEATURE_SSB_NO) +#define cpu_has_cppc boot_cpu_has(X86_FEATURE_CPPC) #define cpu_has_auto_ibrs boot_cpu_has(X86_FEATURE_AUTO_IBRS) /* CPUID level 0x00000007:0.edx */ diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index 16207e3817..cc6e984a88 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -265,6 +265,7 @@ XEN_CPUFEATURE(AMD_PPIN, 8*32+23) /* Protected Processor Inventory Number XEN_CPUFEATURE(AMD_SSBD, 8*32+24) /*S MSR_SPEC_CTRL.SSBD available */ XEN_CPUFEATURE(VIRT_SSBD, 8*32+25) /*! MSR_VIRT_SPEC_CTRL.SSBD */ XEN_CPUFEATURE(SSB_NO, 8*32+26) /*A Hardware not vulnerable to SSB */ +XEN_CPUFEATURE(CPPC, 8*32+27) /* Collaborative Processor Performance Control */ XEN_CPUFEATURE(PSFD, 8*32+28) /*S MSR_SPEC_CTRL.PSFD */ XEN_CPUFEATURE(BTC_NO, 8*32+29) /*A Hardware not vulnerable to Branch Type Confusion */ XEN_CPUFEATURE(IBPB_RET, 8*32+30) /*A IBPB clears RSB/RAS too. */