From nobody Sat Sep 26 13:47:22 2026 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010032.outbound.protection.outlook.com [52.101.201.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92AEF379C36; Tue, 1 Sep 2026 04:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238324; cv=fail; b=IZJjgFZ1fM1Rml6Ea7usyeiyvG5+qPz+gAONWXF2GPWTffSIg0JqL8W1b/Q7hXj3yXsRj/btUzbQhKMqTz9QuwMo4TsSCwMl2Mz4TLGDKa1noMG1TX/6VzfM8APMGziM1Hn9z2ft0Kc21NMY5VTe0FM1HHFytwkpJHS80D8HAvg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238324; c=relaxed/simple; bh=4kmeK3NNrMaUa8Y8P4jZ9mRMYeMWwZr7j+EF2uPMREA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=atHvRlGilaJgB0KpAALQFV+Jpe7ZCKnv2DhAblEaZlH09U4Yv5PgmcB4sjNAHvREA6dYSIBQaNl70sv8gLvOd4zy5MiUXfBiNNCuAGh+u/nKwzb85CcwzlxT8uww3ihQ0JdpCICYM9Z7M8VYMFJW9W2+sEBsqNtWfpyFfCVqYzQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=mg2yE4+D; arc=fail smtp.client-ip=52.101.201.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="mg2yE4+D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XK7QqZpT3ANZIdsccQF3VIKFSIcm1Z3qXcwa4+avNV4LaqHTpGi3BrPXPhvRk58wi+TXx5NmOU9eMqHxOhQQaiQuWweyDE+R7ifFcg2HbJMvVTW1Bidq6QIe4M8tDYsNatxG+Owim5eC3n+t+vnq/4cHTeu40S7/CZkDEOMBKOz8tJj5KMSf3kCHLyZVssCkiqnY9wLpRzCXAP20DCnERk0JbXPYr+Wkaoh7PHyMip+ft9ix6iu7Ckh2DGb5i/NabLOSdA5XfcyBD/ENUVvoEiMB6jHZa09nubMSO2cLJ1Id0gyqRpBdL9VRDz0hB0RAD+Wo9WfITelgGMuCsWxwag== 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=R1Pxem7C94LRA8EklmX7LFmY2iHEZVDi8b3LRYFMBbA=; b=V4iEri+xkEToC4VM/+U/eysrtRKGU/UWNee9ekvSNtOIFhVPD6Dq+EJP4z6w3sFK9TiRAVxKukgwOsb2AIHf5JTGxkEwbu8Ozs6/sG8Phj9T+XxMhecuSm7/hvb2N/F/kFfnyQdrSZDH3OT/Y0MjxZeAtJ5FUP6KYyKIcEcBR2RS12lZJmlXi/mxW6AlKReEceU8b4lI+QPdlLlsUSCx4TBzWXe8IdKKUh4EXT+CPkwNdAMak3cqxAkR0nypdh1Hq+hAu7mCNqNWkjQrro95GigdDPV6CTkJLXyluPM3cQrOHrSUaxGsedDNA/o5M5Bdgv1zlOtrp2FDfWKhoorU0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 (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=R1Pxem7C94LRA8EklmX7LFmY2iHEZVDi8b3LRYFMBbA=; b=mg2yE4+DXflLPvgHempcv+XNy+qmSdEeeQcFT1wkANdf/Jx486AhOBroxJEc4Z++T/R4SnpqDCcPigVChdFIKX9lmsKLQj63VSu4Dpn8GvYVMcj+Kd9m/fIsCg/WtX39mcR6CDSZVdswLOxs0FS/zhQabUFL3ckiM94D1VOk/2c= Received: from SA0PR13CA0010.namprd13.prod.outlook.com (2603:10b6:806:130::15) by SA1PR12MB6800.namprd12.prod.outlook.com (2603:10b6:806:25c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.10; Tue, 1 Sep 2026 04:51:53 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:130:cafe::67) by SA0PR13CA0010.outlook.office365.com (2603:10b6:806:130::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.10 via Frontend Transport; Tue, 1 Sep 2026 04:51:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.8 via Frontend Transport; Tue, 1 Sep 2026 04:51:52 +0000 Received: from dcsm-trdripper1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 31 Aug 2026 23:51:50 -0500 From: Muralidhara M K To: , CC: , , Muralidhara M K , Mario Limonciello Subject: [PATCH v5 1/4] platform/x86/amd/hsmp: Add HSMP client support for Family 1Ah Date: Tue, 1 Sep 2026 10:21:31 +0530 Message-ID: <20260901045134.2833282-2-muralidhara.mk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260901045134.2833282-1-muralidhara.mk@amd.com> References: <20260901045134.2833282-1-muralidhara.mk@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|SA1PR12MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: c6081aeb-3793-4a1b-c8df-08df07e4bdd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|376014|1800799024|82310400026|23010399003|6133799003|3023799007|10067099003|56012099006|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: uW0ec7n+3d2d/J4REytsdqLHb0UFds9DKQBNzgyFuLDDyvpQeCst2/WIfkPr5KabTvmkGMz+xws08otK9YzmsQ9DgTBdtA/pP/jQfJqTKA95WeEhLWPABQ66TY8HgyjveuRnCa3E2cnxcEPgmWRsnr2Lht0JLAl44Vq9EaKNR4DjW8p4KXVhhlk7nuDDEl4/RL3BUUs+Ibwx+E5pGsvDx6UoHtvlpYwafgryN5Znb99Z8UwhvWWPJRvI6pz29TFk3M04mRN6VQHrpqXefdQSP+hrU+lA69TAHCh4Mq91dYMHBXArwBYA4o5/dUEmks7vXrkf/S9W1SNzomeTaKVelj2of9LoxEBlYbFElCjZ7FOEkNDze3cOo8/KEaL9LyIbyCzva6SsgxaReRTpt9lvwqsIbD0cT2Z80d1Tx5Va/AmoeIOE3LFjB+kmK8t+eRafWf2o/kU5xqVEXwU1kTUeEDtoYjrZhLebUV5DhZ7WP4dskkXvoNbDadEv4FhGxonn4/LJO/nxO2ig20Q1sdyyYAvKDit0GMWsq29WUHozYXBSh9q4oJWnngQ9+ZjXUjPeWvn3vWfRasxGgtostvTJ5OlK2KWRPpsueYjFsIZcKr7HTXFmKQ8EwPh0jUwXWGHkIC3t4niJTfuktKlRAJOs4Jm+xSzr5ndRJAaABcv42412Nex3GsZJ2AbLKiDymqqywgtoy75F/Phow7b6qazrnw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(376014)(1800799024)(82310400026)(23010399003)(6133799003)(3023799007)(10067099003)(56012099006)(11063799006)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EnPy+hfC/GaeIVCGwmI1fUZWRBE8xarIapz8GLRQxUEJ2wTOrDAzwFZ/0/vLooAB2ywkmAAl8PBaY7nYDnXoH69Xp9sHp6lHXvfgDmI0yXkCXM2q0olHN0Se7RQLkYID0ScOUDMzUrRuxOYqeIEI+S3TBU++BH/ATuE9swee/frJ1iOv90olwf5M4iidVl43pvjgjRDxovCfs7OT0/wOFkZQ0QbzYuM1+oBD5H3PRWjo6elCxy2asdYObIcqwycNSOm2yCaFvJBua9wmuPA1MhrpEO1mUls4SdemoeqYOpCAyTrIToLmTgdgN12+kFHkQ5MJ0a+BMOFkys6sJtBW9MxEdOkGAfQHUC986jEYU24KhgAa5ChiUGIrPLUx+hd+vS8D4+IAbz0Jr6gJ121RKKBYOixDNVAfjitmjzurJheCe986NSrb3JEElrsNVzQR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2026 04:51:52.7937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6081aeb-3793-4a1b-c8df-08df07e4bdd3 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6800 Content-Type: text/plain; charset="utf-8" Enable the HSMP driver on the Family 1Ah client platforms, Models 80h-8Fh and E0h-E3h. These parts speak the Ryzen Master SMC (RMSMC) message set instead of the server HSMP messages, but describe their mailbox via ACPI _CRS/_DSD the same way a server socket does, so only the ACPI driver needs to probe them. Add the client message set to the UAPI header and its descriptor table to the driver. struct hsmp_plat_desc picks the right table and driver-issued message IDs once per boot based on the ACPI-reported PM profile, which tells client and server apart without pinning the driver to a fixed set of family/model ranges. Document the client models in amd_hsmp.rst. Signed-off-by: Muralidhara M K Reviewed-by: Mario Limonciello (AMD) --- Documentation/arch/x86/amd_hsmp.rst | 10 +- arch/x86/include/uapi/asm/amd_hsmp.h | 135 ++++++++++++++ drivers/platform/x86/amd/hsmp/hsmp.c | 255 ++++++++++++++++++++++++--- drivers/platform/x86/amd/hsmp/hsmp.h | 27 +++ 4 files changed, 398 insertions(+), 29 deletions(-) diff --git a/Documentation/arch/x86/amd_hsmp.rst b/Documentation/arch/x86/a= md_hsmp.rst index fa1fc240e212..b95f09945193 100644 --- a/Documentation/arch/x86/amd_hsmp.rst +++ b/Documentation/arch/x86/amd_hsmp.rst @@ -8,6 +8,13 @@ Newer Fam19h(model 0x00-0x1f, 0x30-0x3f, 0x90-0x9f, 0xa0-0= xaf), Fam1Ah(model 0x00-0x1f) EPYC server line of processors from AMD support system management functionality via HSMP (Host System Management Port). =20 +The Fam1Ah(model 0x80-0x8f, 0xe0-0xe3) client line of processors is +supported as well. Those models share one mailbox and speak the Ryzen +Master SMC message set instead of the server HSMP message set, so the +message IDs accepted on them are the HSMP_CLIENT_* ones listed in +arch/x86/include/uapi/asm/amd_hsmp.h. The character device and ioctl +interface described below are the same. + The Host System Management Port (HSMP) is an interface to provide OS-level software with access to system management functions via a set of mailbox registers. @@ -17,7 +24,8 @@ More details on the interface can be found in chapter Eg: https://docs.amd.com/v/u/en-US/55898_B1_pub_0_50 =20 =20 -HSMP interface is supported on EPYC line of server CPUs and MI300A (APU). +HSMP interface is supported on EPYC line of server CPUs, MI300A (APU) and +the Fam1Ah client models listed above. =20 =20 HSMP device diff --git a/arch/x86/include/uapi/asm/amd_hsmp.h b/arch/x86/include/uapi/a= sm/amd_hsmp.h index eda336bfd3e9..00ca7855ca00 100644 --- a/arch/x86/include/uapi/asm/amd_hsmp.h +++ b/arch/x86/include/uapi/asm/amd_hsmp.h @@ -664,4 +664,139 @@ struct hsmp_telemetry_data { #define HSMP_IOCTL_GET_TELEMETRY_DATA \ _IOW(HSMP_BASE_IOCTL_NR, 1, struct hsmp_telemetry_data) =20 +/** + * enum hsmp_client_message_ids - Ryzen Master SMC (RMSMC) message IDs + * @HSMP_CLIENT_TEST: 01h. Test message. input: args[0] =3D xx. output: + * args[0] =3D xx + 1. + * @HSMP_CLIENT_GET_SMU_VER: 02h. Get MP1 firmware version. output: + * args[0] =3D MP1 firmware version. + * @HSMP_CLIENT_GET_INTERFACE_VER: 03h. Get interface version. output: + * args[0] =3D interface version. + * @HSMP_CLIENT_GET_METRICS_TABLE_VER: 04h. Get metrics table version. + * output: args[0] =3D metrics table version. + * @HSMP_CLIENT_GET_METRICS_TABLE: 05h. Get metrics table. No arguments. + * Success means firmware has written the metrics table to the DRAM + * address reported by @HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR. + * @HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR: 06h. Get metrics table DRAM + * address. output: args[0] =3D address[31:0], args[1] =3D address[63:32], + * args[2] =3D table size in bytes. + * @HSMP_CLIENT_SET_CORE_PSM_MARGIN: 07h. Set core voltage margin. input: + * args[0] =3D ApicId[31:16] + margin in mV[15:0]. + * @HSMP_CLIENT_SET_ALL_CORE_PSM_MARGIN: 08h. Set voltage margin for all + * cores. input: args[0] =3D margin in mV[15:0]. + * @HSMP_CLIENT_SET_FAST_PPT_LIMIT: 09h. Set APU fast PPT limit. input: + * args[0] =3D limit in mW. + * @HSMP_CLIENT_SET_VRM_VDD_CURRENT_LIMIT: 0Ah. Set VDDCR_VDD TDC. input: + * args[0] =3D limit in mA. + * @HSMP_CLIENT_SET_VRM_VDD_MAX_CURRENT_LIMIT: 0Bh. Set VDDCR_VDD EDC. + * input: args[0] =3D limit in mA. + * @HSMP_CLIENT_SET_TJ_MAX: 0Ch. Set maximum junction temperature. input: + * args[0] =3D temperature in degrees C. + * @HSMP_CLIENT_SET_FIT_LIMIT_SCALAR: 0Dh. Set failures-in-time limit + * scalar. input: args[0] =3D scalar (0 to 100). + * @HSMP_CLIENT_ENABLE_OVERCLOCKING: 0Eh. Enable overclocking. No + * arguments. + * @HSMP_CLIENT_DISABLE_OVERCLOCKING: 0Fh. Disable overclocking. No + * arguments. + * @HSMP_CLIENT_SET_OVERCLOCK_FREQ_ALL_CORES: 10h. Set all-core overclock + * frequency. input: args[0] =3D frequency in MHz[15:0]. + * @HSMP_CLIENT_SET_OVERCLOCK_FREQ_PER_CORE: 11h. Set per-core overclock + * frequency. input: args[0] =3D ApicId[31:16] + frequency in MHz[15:0]. + * @HSMP_CLIENT_SET_OVERCLOCK_VID: 12h. Set overclock VID. input: + * args[0] =3D voltage in mV[15:0]. + * @HSMP_CLIENT_SET_FCLK_OVERCLOCK_ON_THE_FLY: 13h. Set FCLK overclock on + * the fly. input: args[0] =3D FCLK in MHz[15:0]. + * @HSMP_CLIENT_GET_CORE_PERF_ORDER: 14h. Get core performance order. + * input: args[0] =3D ApicId[15:0]. output: args[0] =3D frequency in + * MHz[15:0]. + * @HSMP_CLIENT_SET_SUSTAINED_POWER_LIMIT: 15h. Set SOC sustained power + * limit. input: args[0] =3D limit in mW. + * @HSMP_CLIENT_SET_SLOW_PPT_LIMIT: 16h. Set APU slow PPT limit. input: + * args[0] =3D limit in mW. + * @HSMP_CLIENT_SET_VRM_GFX_MAX_CURRENT_LIMIT: 17h. Set VDDCR_GFX EDC. + * input: args[0] =3D limit in mA. + * @HSMP_CLIENT_SET_VRM_SOC_CURRENT_LIMIT: 18h. Set VDDCR_SOC TDC. input: + * args[0] =3D limit in mA. + * @HSMP_CLIENT_SET_FAST_SPM_LIMIT: 19h. Set fast SPM limit. input: + * args[0] =3D limit in mW. + * @HSMP_CLIENT_SET_SLOW_SPM_LIMIT: 1Ah. Set slow SPM limit. input: + * args[0] =3D limit in mW. + * @HSMP_CLIENT_GET_CORE_PSM_MARGIN: 1Bh. Get core voltage margin. input: + * args[0] =3D ApicId[15:0]. output: args[0] =3D margin in mV[15:0]. + * @HSMP_CLIENT_GET_GFX_PSM_MARGIN: 1Ch. Get graphics voltage margin. + * output: args[0] =3D margin in mV[15:0]. + * @HSMP_CLIENT_SPARE_0X1D: 1Dh. Reserved. + * @HSMP_CLIENT_SPARE_0X1E: 1Eh. Reserved. + * @HSMP_CLIENT_SPARE_0X1F: 1Fh. Reserved. + * @HSMP_CLIENT_SPARE_0X20: 20h. Reserved. + * @HSMP_CLIENT_SET_GFXCLK_OVERDRIVE_BY_FREQ_VID: 21h. Set GfxClk + * overdrive by frequency/VID. input: args[0] =3D frequency in + * MHz[31:16] + voltage in mV[15:0]. + * @HSMP_CLIENT_DISABLE_GFXCLK_OVERDRIVE: 22h. Disable GfxClk overdrive. + * No arguments. + * @HSMP_CLIENT_SET_GFX_PSM_MARGIN: 23h. Set graphics voltage margin. + * input: args[0] =3D margin in mV[15:0]. + * @HSMP_CLIENT_SET_CCLK_FMAX_OFFSET: 24h. Set CCLK Fmax offset. input: + * args[0] =3D maximum frequency in MHz[15:0]. + * @HSMP_CLIENT_SET_CORE_POWER_LIMIT_OFFSET: 25h. Set core power limit + * offset. input: args[0] =3D limit in mW. + * @HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND: 26h. Add extra core PSM + * guardband. input: args[0] =3D voltage in mV[15:0]. + * @HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND_GFX: 27h. Add extra graphics PSM + * guardband. input: args[0] =3D voltage in mV[15:0]. + * @HSMP_CLIENT_SET_GFXCLK_FMAX: 28h. Set GfxClk Fmax. input: args[0] =3D + * maximum frequency in MHz[15:0]. + * @HSMP_CLIENT_MSG_ID_MAX: Number of message IDs, not a valid ID itself. + * + * Message IDs accepted on the Family 1Ah client platforms, Models 80h-8Fh + * and E0h-E3h. These parts drive one mailbox and speak the Ryzen Master + * SMC message set instead of the server HSMP message set enumerated in + * &enum hsmp_message_ids. Not all platforms support all messages; consult + * the supported list of messages in the HSMP chapter of the respective + * family/model PPR. Unsupported messages return -ENOMSG. + */ +enum hsmp_client_message_ids { + HSMP_CLIENT_TEST =3D 1, + HSMP_CLIENT_GET_SMU_VER, + HSMP_CLIENT_GET_INTERFACE_VER, + HSMP_CLIENT_GET_METRICS_TABLE_VER, + HSMP_CLIENT_GET_METRICS_TABLE, + HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR, + HSMP_CLIENT_SET_CORE_PSM_MARGIN, + HSMP_CLIENT_SET_ALL_CORE_PSM_MARGIN, + HSMP_CLIENT_SET_FAST_PPT_LIMIT, + HSMP_CLIENT_SET_VRM_VDD_CURRENT_LIMIT, + HSMP_CLIENT_SET_VRM_VDD_MAX_CURRENT_LIMIT, + HSMP_CLIENT_SET_TJ_MAX, + HSMP_CLIENT_SET_FIT_LIMIT_SCALAR, + HSMP_CLIENT_ENABLE_OVERCLOCKING, + HSMP_CLIENT_DISABLE_OVERCLOCKING, + HSMP_CLIENT_SET_OVERCLOCK_FREQ_ALL_CORES, + HSMP_CLIENT_SET_OVERCLOCK_FREQ_PER_CORE, + HSMP_CLIENT_SET_OVERCLOCK_VID, + HSMP_CLIENT_SET_FCLK_OVERCLOCK_ON_THE_FLY, + HSMP_CLIENT_GET_CORE_PERF_ORDER, + HSMP_CLIENT_SET_SUSTAINED_POWER_LIMIT, + HSMP_CLIENT_SET_SLOW_PPT_LIMIT, + HSMP_CLIENT_SET_VRM_GFX_MAX_CURRENT_LIMIT, + HSMP_CLIENT_SET_VRM_SOC_CURRENT_LIMIT, + HSMP_CLIENT_SET_FAST_SPM_LIMIT, + HSMP_CLIENT_SET_SLOW_SPM_LIMIT, + HSMP_CLIENT_GET_CORE_PSM_MARGIN, + HSMP_CLIENT_GET_GFX_PSM_MARGIN, + HSMP_CLIENT_SPARE_0X1D, + HSMP_CLIENT_SPARE_0X1E, + HSMP_CLIENT_SPARE_0X1F, + HSMP_CLIENT_SPARE_0X20, + HSMP_CLIENT_SET_GFXCLK_OVERDRIVE_BY_FREQ_VID, + HSMP_CLIENT_DISABLE_GFXCLK_OVERDRIVE, + HSMP_CLIENT_SET_GFX_PSM_MARGIN, + HSMP_CLIENT_SET_CCLK_FMAX_OFFSET, + HSMP_CLIENT_SET_CORE_POWER_LIMIT_OFFSET, + HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND, + HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND_GFX, + HSMP_CLIENT_SET_GFXCLK_FMAX, + HSMP_CLIENT_MSG_ID_MAX, +}; + #endif /*_ASM_X86_AMD_HSMP_H_*/ diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/am= d/hsmp/hsmp.c index 5e123a4ecea9..e8fac2d299f3 100644 --- a/drivers/platform/x86/amd/hsmp/hsmp.c +++ b/drivers/platform/x86/amd/hsmp/hsmp.c @@ -10,6 +10,8 @@ #include =20 #include +#include +#include #include #include #include @@ -45,8 +47,197 @@ */ #define CHECK_GET_BIT BIT(31) =20 +/* Indexed by enum hsmp_client_message_ids; see there for per-message deta= ils */ +static const struct hsmp_msg_desc hsmp_client_msg_desc_table[] =3D { + /* RESERVED */ + {0, 0, HSMP_RSVD}, + + /* HSMP_CLIENT_TEST */ + {1, 1, HSMP_GET}, + + /* HSMP_CLIENT_GET_SMU_VER */ + {0, 1, HSMP_GET}, + + /* HSMP_CLIENT_GET_INTERFACE_VER */ + {0, 1, HSMP_GET}, + + /* HSMP_CLIENT_GET_METRICS_TABLE_VER */ + {0, 1, HSMP_GET}, + + /* HSMP_CLIENT_GET_METRICS_TABLE */ + {0, 0, HSMP_GET}, + + /* HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR */ + {0, 3, HSMP_GET}, + + /* HSMP_CLIENT_SET_CORE_PSM_MARGIN */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_ALL_CORE_PSM_MARGIN */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_FAST_PPT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_VRM_VDD_CURRENT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_VRM_VDD_MAX_CURRENT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_TJ_MAX */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_FIT_LIMIT_SCALAR */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_ENABLE_OVERCLOCKING */ + {0, 0, HSMP_SET}, + + /* HSMP_CLIENT_DISABLE_OVERCLOCKING */ + {0, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_OVERCLOCK_FREQ_ALL_CORES */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_OVERCLOCK_FREQ_PER_CORE */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_OVERCLOCK_VID */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_FCLK_OVERCLOCK_ON_THE_FLY */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_GET_CORE_PERF_ORDER */ + {1, 1, HSMP_GET}, + + /* HSMP_CLIENT_SET_SUSTAINED_POWER_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_SLOW_PPT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_VRM_GFX_MAX_CURRENT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_VRM_SOC_CURRENT_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_FAST_SPM_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_SLOW_SPM_LIMIT */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_GET_CORE_PSM_MARGIN */ + {1, 1, HSMP_GET}, + + /* HSMP_CLIENT_GET_GFX_PSM_MARGIN */ + {0, 1, HSMP_GET}, + + /* HSMP_CLIENT_SPARE_0X1D */ + {0, 0, HSMP_RSVD}, + + /* HSMP_CLIENT_SPARE_0X1E */ + {0, 0, HSMP_RSVD}, + + /* HSMP_CLIENT_SPARE_0X1F */ + {0, 0, HSMP_RSVD}, + + /* HSMP_CLIENT_SPARE_0X20 */ + {0, 0, HSMP_RSVD}, + + /* HSMP_CLIENT_SET_GFXCLK_OVERDRIVE_BY_FREQ_VID */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_DISABLE_GFXCLK_OVERDRIVE */ + {0, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_GFX_PSM_MARGIN */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_CCLK_FMAX_OFFSET */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_CORE_POWER_LIMIT_OFFSET */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_ADD_EXTRA_PSM_GUARDBAND_GFX */ + {1, 0, HSMP_SET}, + + /* HSMP_CLIENT_SET_GFXCLK_FMAX */ + {1, 0, HSMP_SET}, +}; + +/* Catch a table left out of sync with its enum at build time */ +static_assert(ARRAY_SIZE(hsmp_msg_desc_table) =3D=3D HSMP_MSG_ID_MAX); +static_assert(ARRAY_SIZE(hsmp_client_msg_desc_table) =3D=3D HSMP_CLIENT_MS= G_ID_MAX); + +/* Per-platform message set: which table to use, and driver-issued msg IDs= */ +struct hsmp_plat_desc { + const struct hsmp_msg_desc *msg_desc; + u32 num_msgs; + u32 test_msg; + u32 proto_ver_msg; +}; + +static const struct hsmp_plat_desc hsmp_desc_server =3D { + .msg_desc =3D hsmp_msg_desc_table, + .num_msgs =3D HSMP_MSG_ID_MAX, + .test_msg =3D HSMP_TEST, + .proto_ver_msg =3D HSMP_GET_PROTO_VER, +}; + +/* The client drives a different mailbox with the Ryzen Master SMC message= set */ +static const struct hsmp_plat_desc hsmp_desc_client =3D { + .msg_desc =3D hsmp_client_msg_desc_table, + .num_msgs =3D HSMP_CLIENT_MSG_ID_MAX, + .test_msg =3D HSMP_CLIENT_TEST, + .proto_ver_msg =3D HSMP_CLIENT_GET_INTERFACE_VER, +}; + static struct hsmp_plat_device hsmp_pdev; =20 +/* + * Resolved on first use and cached, since is_client_platform() always + * settles on the same descriptor once booted. Concurrent first callers are + * benign: every one of them computes and stores that same pointer, so + * READ_ONCE()/WRITE_ONCE() only need to keep the access from being torn or + * reordered by the compiler, not order it against anything else. + */ +static const struct hsmp_plat_desc *hsmp_desc_cache; + +static inline const struct hsmp_plat_desc *hsmp_desc(void) +{ + const struct hsmp_plat_desc *desc =3D READ_ONCE(hsmp_desc_cache); + + if (likely(desc)) + return desc; + + desc =3D is_client_platform() ? &hsmp_desc_client : &hsmp_desc_server; + WRITE_ONCE(hsmp_desc_cache, desc); + + return desc; +} + +/* Returns NULL if msg_id is out of range or reserved for this platform */ +static inline const struct hsmp_msg_desc *get_msg_desc(u32 msg_id) +{ + const struct hsmp_plat_desc *desc =3D hsmp_desc(); + + if (msg_id >=3D desc->num_msgs) + return NULL; + + if (desc->msg_desc[msg_id].type =3D=3D HSMP_RSVD) + return NULL; + + return &desc->msg_desc[msg_id]; +} + /* * Gates the AMD HSMP data plane against socket bring-up and teardown. * @@ -184,30 +375,29 @@ static int __hsmp_send_message(struct hsmp_socket *so= ck, struct hsmp_message *ms =20 static int validate_message(struct hsmp_message *msg) { - /* msg_id against valid range of message IDs */ - if (msg->msg_id < HSMP_TEST || msg->msg_id >=3D HSMP_MSG_ID_MAX) - return -ENOMSG; + const struct hsmp_msg_desc *desc; =20 - /* msg_id is a reserved message ID */ - if (hsmp_msg_desc_table[msg->msg_id].type =3D=3D HSMP_RSVD) + /* Unknown or reserved message ID for this platform */ + desc =3D get_msg_desc(msg->msg_id); + if (!desc) return -ENOMSG; =20 /* * num_args passed by user should match the num_args specified in * message description table. */ - if (msg->num_args !=3D hsmp_msg_desc_table[msg->msg_id].num_args) + if (msg->num_args !=3D desc->num_args) return -EINVAL; =20 /* * As the HSMP protocol evolves, newer platforms may define more * response arguments for existing messages. Use an upper-bound * check so that older userspace callers requesting fewer response - * words than what the current hsmp_msg_desc_table[] defines are - * still accepted, while rejecting requests that exceed the - * hardware capability. + * words than what the current descriptor table defines are still + * accepted, while rejecting requests that exceed the hardware + * capability. */ - if (msg->response_sz > hsmp_msg_desc_table[msg->msg_id].response_sz) + if (msg->response_sz > desc->response_sz) return -EINVAL; =20 return 0; @@ -316,7 +506,7 @@ int hsmp_test(u16 sock_ind, u32 value) * Test the hsmp port by performing TEST command. The test message * takes one argument and returns the value of that argument + 1. */ - msg.msg_id =3D HSMP_TEST; + msg.msg_id =3D hsmp_desc()->test_msg; msg.num_args =3D 1; msg.response_sz =3D 1; msg.args[0] =3D value; @@ -338,12 +528,12 @@ int hsmp_test(u16 sock_ind, u32 value) } EXPORT_SYMBOL_NS_GPL(hsmp_test, "AMD_HSMP"); =20 -static bool is_get_msg(struct hsmp_message *msg) +static bool is_get_msg(const struct hsmp_msg_desc *desc, struct hsmp_messa= ge *msg) { - if (hsmp_msg_desc_table[msg->msg_id].type =3D=3D HSMP_GET) + if (desc->type =3D=3D HSMP_GET) return true; =20 - if (hsmp_msg_desc_table[msg->msg_id].type =3D=3D HSMP_SET_GET && + if (desc->type =3D=3D HSMP_SET_GET && (msg->args[0] & CHECK_GET_BIT)) return true; =20 @@ -354,6 +544,8 @@ static long hsmp_ioctl_msg(struct file *fp, unsigned lo= ng arg) { int __user *arguser =3D (int __user *)arg; struct hsmp_message msg =3D { 0 }; + const struct hsmp_plat_desc *plat_desc =3D hsmp_desc(); + const struct hsmp_msg_desc *desc; int ret; =20 if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_= message))) @@ -361,23 +553,25 @@ static long hsmp_ioctl_msg(struct file *fp, unsigned = long arg) =20 /* * Check msg_id is within the range of supported msg ids - * i.e within the array bounds of hsmp_msg_desc_table + * i.e within the array bounds of the platform's descriptor table */ - if (msg.msg_id < HSMP_TEST || msg.msg_id >=3D HSMP_MSG_ID_MAX) + if (msg.msg_id < plat_desc->test_msg || msg.msg_id >=3D plat_desc->num_ms= gs) return -ENOMSG; =20 /* * Sanitize the user-controlled msg_id against speculative * execution. The bounds check above retires the out-of-range * case with -ENOMSG, but a mispredicted branch can still let the - * CPU speculatively use msg_id as an index into - * hsmp_msg_desc_table[] (here and in validate_message() / - * is_get_msg() called downstream via hsmp_send_message()), and - * pull arbitrary kernel memory into the cache (Spectre v1, - * CVE-2017-5753). Clamp once into msg.msg_id so every downstream - * dereference sees the sanitized value. + * CPU speculatively use msg_id as an index into the message + * descriptor table, here and again in validate_message() called + * downstream via hsmp_send_message(). */ - msg.msg_id =3D array_index_nospec(msg.msg_id, HSMP_MSG_ID_MAX); + msg.msg_id =3D array_index_nospec(msg.msg_id, plat_desc->num_msgs); + + /* Rejects the reserved IDs the table describes as such */ + desc =3D get_msg_desc(msg.msg_id); + if (!desc) + return -ENOMSG; =20 switch (fp->f_mode & (FMODE_WRITE | FMODE_READ)) { case FMODE_WRITE: @@ -385,7 +579,7 @@ static long hsmp_ioctl_msg(struct file *fp, unsigned lo= ng arg) * Device is opened in O_WRONLY mode * Execute only set/configure commands */ - if (is_get_msg(&msg)) + if (is_get_msg(desc, &msg)) return -EPERM; break; case FMODE_READ: @@ -393,7 +587,7 @@ static long hsmp_ioctl_msg(struct file *fp, unsigned lo= ng arg) * Device is opened in O_RDONLY mode * Execute only get/monitor commands */ - if (!is_get_msg(&msg)) + if (!is_get_msg(desc, &msg)) return -EPERM; break; case FMODE_READ | FMODE_WRITE: @@ -410,7 +604,7 @@ static long hsmp_ioctl_msg(struct file *fp, unsigned lo= ng arg) if (ret) return ret; =20 - if (hsmp_msg_desc_table[msg.msg_id].response_sz > 0) { + if (desc->response_sz > 0) { /* Copy results back to user for get/monitor commands */ if (copy_to_user(arguser, &msg, sizeof(struct hsmp_message))) return -EFAULT; @@ -685,11 +879,16 @@ EXPORT_SYMBOL_NS_GPL(hsmp_get_tbl_dram_base, "AMD_HSM= P"); int hsmp_cache_proto_ver(u16 sock_ind) { struct hsmp_message msg =3D { 0 }; + const struct hsmp_msg_desc *desc; int ret; =20 - msg.msg_id =3D HSMP_GET_PROTO_VER; + msg.msg_id =3D hsmp_desc()->proto_ver_msg; + desc =3D get_msg_desc(msg.msg_id); + if (WARN_ON(!desc)) + return -ENOMSG; + msg.sock_ind =3D sock_ind; - msg.response_sz =3D hsmp_msg_desc_table[HSMP_GET_PROTO_VER].response_sz; + msg.response_sz =3D desc->response_sz; =20 ret =3D hsmp_send_message_locked(&msg); if (!ret) diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/x86/am= d/hsmp/hsmp.h index 8dbff16a87b1..890cfb664829 100644 --- a/drivers/platform/x86/amd/hsmp/hsmp.h +++ b/drivers/platform/x86/amd/hsmp/hsmp.h @@ -10,6 +10,9 @@ #ifndef HSMP_H #define HSMP_H =20 +#include + +#include #include #include #include @@ -17,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +36,29 @@ =20 #define DRIVER_VERSION "2.6" =20 +/* + * Family/model ranges need a driver update every generation and miss new + * client parts until then. The ACPI-reported PM profile does not: it says + * what kind of system this is regardless of which CPU is in it. + */ +static inline bool is_client_platform(void) +{ + if (!IS_ENABLED(CONFIG_ACPI)) + return false; + + if (boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD) + return false; + + switch (acpi_gbl_FADT.preferred_profile) { + case PM_DESKTOP: + case PM_MOBILE: + case PM_TABLET: + return true; + default: + return false; + } +} + struct hsmp_mbaddr_info { u32 base_addr; u32 msg_id_off; --=20 2.34.1 From nobody Sat Sep 26 13:47:22 2026 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013040.outbound.protection.outlook.com [40.107.201.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ED24379C55; Tue, 1 Sep 2026 04:52:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.201.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238322; cv=fail; b=HR6s0P1+9BPQxruhURXAIgsEy/eN9rDNG2Q5jMOeDiQxYV6GyA7giXAUGKhCEjleRg0iynlAEyc3iXgqH0LTFnraD0JM2oLg3F/6N1zbISuoYkCtNKBjBSybn837lxEDQKyIRlROfGDRBfKGUKzVMScKtxcn3B1uUBVU0oW5dcY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238322; c=relaxed/simple; bh=xzxbCwciAV4rzb+ZTsf5yCReQy459lQp4KfNLDcxomE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afqUZE/gA2EOdFqberuTNpoqFakZJv73B2xhc6zkOzxE+zvmGZgzmP5CA9fuhZnRfzCBQ9HkPddfIUr73Er9E3n+jxqo3SPTzB9+/6si4U52gG7ZxBJWbI5JohpbXYrLhlsC8IE0z4ocJJdOquzAB1E9EWXjCMkK1jueJY4vlZA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=tXLZgLfp; arc=fail smtp.client-ip=40.107.201.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tXLZgLfp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZKxhbnYJIGcowvmLO3lnrwj/m9rayxUUeWgICHS38nuIsmpe/ZJ4Q9o9quW+4wBmtnYO3EuaoKs+VwrLFzjA1hLxZKk9z6h/7CPBpr32FtFObaPgyNvOe5zKDsl3IKIevXdFnzG+GubAYrvqDDTK3RvqfVV2R00lMO6+n2CvxCYpb5uBNjmSx6E3FxqrItRrNUIMGoQrjWX3gaBmEZGMrLRREQRP+kxMnSo5wQbT8nOfA84YBX8+6xVUbhnJc1cZAbLitiSeHN/u0Rx9Mg+/YR92yK0Vv8nCw7cW53S5HGAl0E8pA0a6T8FypzR4LbO+nmPWXmBMhfGjltsuGmmLDg== 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=4ktlIKXD/Pv6lP6r28XB9T5jXqr1yKyO+uJ1PboY1AA=; b=yPTUjj5bIwM0gyXubYrpZyoRA/xqWOVWq692hzMDczj3bq41tpz+u5hHtGWC4dwm2E55ZYoKmu/hY89QYhvmSMUva/RjYSXL6DmPUkfyDSck7RRlXqOTA4UaNdfmANTESViVyXPsXl0egFzwe0mu7IoV0XrGnHqG/p1iTaB0BCR9OgKoiKSPQLB4AFRyB0PD3QY5QM1IkgA0iwAbKU9Hq7fkfjuEHE3g9SiE1v9tLt4nnOvemP+0ht0Pxa+zo5AX0dK19wn4N027A9fjs9b4Kgx0H+9McIl2kfTgESTyd1Tv/sRWrmld0VyaecR5Dda1c60F+GG+VnuIKIDY4Vl8Dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 (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=4ktlIKXD/Pv6lP6r28XB9T5jXqr1yKyO+uJ1PboY1AA=; b=tXLZgLfpr7j3qP7NYt5Al63SN8v6bFkwTQRrZtpg3L4bbBbMp18udjC05OgYwi1wTmIrPiWUJGbaaQ+YE13RYm8J0lvsz6H/GaWebLSCQ4GxFPTGdKMFqPiddDYw2XqPo1uV79RMyL8BTYWbeb3w0UshQ3pbqDzQHnsmek3n5rc= Received: from SA0PR13CA0016.namprd13.prod.outlook.com (2603:10b6:806:130::21) by MW6PR12MB8997.namprd12.prod.outlook.com (2603:10b6:303:23e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Tue, 1 Sep 2026 04:51:55 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:130:cafe::98) by SA0PR13CA0016.outlook.office365.com (2603:10b6:806:130::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.10 via Frontend Transport; Tue, 1 Sep 2026 04:51:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.8 via Frontend Transport; Tue, 1 Sep 2026 04:51:55 +0000 Received: from dcsm-trdripper1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 31 Aug 2026 23:51:52 -0500 From: Muralidhara M K To: , CC: , , Muralidhara M K , Mario Limonciello Subject: [PATCH v5 2/4] platform/x86/amd/hsmp: Route metric table through the client messages Date: Tue, 1 Sep 2026 10:21:32 +0530 Message-ID: <20260901045134.2833282-3-muralidhara.mk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260901045134.2833282-1-muralidhara.mk@amd.com> References: <20260901045134.2833282-1-muralidhara.mk@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|MW6PR12MB8997:EE_ X-MS-Office365-Filtering-Correlation-Id: 709dd68d-1592-4a47-e600-08df07e4bf32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|82310400026|1800799024|376014|18002099003|22082099003|56012099006|11063799006|10067099003; X-Microsoft-Antispam-Message-Info: XaZFdhi6vS66dYtHSJdUa7GC7LPyikpJ2ytd5AafXKXVrdC723MOZG50S3r42JTzIqeeotOYh6N1NanfWhHWYKSKx3bEoyzfaMNz6ZXD5A52F8C6R9a8MBAHGyPUQydbNJJOZ49vhutqV776wwbsiRLpCOS/V7k8kYdN4NZkPojjYbxFarzo0iNDvopdHG/SR3aXefLvfrg/ZTcTnXDBKurkjO8wZW6+cATiCi9Wz9Nf2Iw826qXw40sNzzdXTtFsMYGIl8q7GM25wHkTRarOPbLcgQF/bRa18EFxe5d1L9q2zj8S6YoFYI8e8X0kq2Dg1eY/0Y2RzYaBc/58CxDFtdf6Hd80UlreyoXwOwlUVylQybYnAcgycPztGobGJyKn+uFOHzxejoIsT/TyKwv0ERmlay+TxALLx7k95y3FkKSW7KP4Dz/nbb39HCN54IJ+1rreZu4sof2SHiTEfUJDSBAFpta1TEQ6PfgnzvCkm9ujElrJahAJT7OSb17cDcrJiGjjv+KS86OMOvcmPqyt5nRzX3dh50FsbuZ87F+vFMzVDjUxC+VfTvkhLlM2yVLnYPVtgQvHHL4dfsq3P1uVJ8Z04ON+fWDv3vb6q9bZL2pTNil+AQWpidyRuT+xBPwNS5BqVD7zUBl8NLSTqQU9rqFCWFo35ypCZTykeyBw8mQ41z9mD60b5QhV3+KP3CBQI0xZzQFCVqh/66+madZuA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(23010399003)(82310400026)(1800799024)(376014)(18002099003)(22082099003)(56012099006)(11063799006)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jj5orIALVM6OiI+f5Ifea5GyjeIW1EYkU6G2URDqidYlCau0DLxb+UHdiywcUYmxVjRSeighSnBVt03ds5+kV2vBVgKtpY9iNvCqCgQrYW8ogGoxlMk1TspMsx5zi0anH00+zVoK0AyrBl+VMPwlLafowciOySs+oZUjZZ4nKjertnjq51Xeza8ssChBOSmQIuz08wg+Q5WvfigjnuybXLZ18dtPiOviPwL3RdiGSErxoP5KabUO56cAqQNrGSLN3jkzRg3vRLoLnZggv32iisPZ9jhtFf/nKj6rd2Oe/D2fPBLLe0jHMgIjd4REhNKuaO7qC6aXYeeBtFEG0E6z6NinfouTrnU6+FWG26MbTx0vXdU0Dud7fVMwGPQos2FO4827MUIXbWKORfh7+FE4jgnY92PSAIgV9mkPOSef9K16Q1EQRjnu4KPFpMe1+o/M X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2026 04:51:55.0958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 709dd68d-1592-4a47-e600-08df07e4bf32 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8997 Content-Type: text/plain; charset="utf-8" Wire the client metric table and metrics DRAM address messages into the metric table read path for the Family 1Ah client platforms. The client reaches its metric table through the Ryzen Master SMC message set, so add the two message IDs to struct hsmp_plat_desc and have hsmp_metric_tbl_read_locked() and hsmp_get_tbl_dram_base() take them from there. Unlike the test and version queries, these two are numbered differently in the two sets (24h/25h server vs 05h/06h client), so they must come from the descriptor rather than a shared constant. Signed-off-by: Muralidhara M K Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/hsmp/hsmp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/am= d/hsmp/hsmp.c index e8fac2d299f3..60889c1b1099 100644 --- a/drivers/platform/x86/amd/hsmp/hsmp.c +++ b/drivers/platform/x86/amd/hsmp/hsmp.c @@ -183,6 +183,8 @@ struct hsmp_plat_desc { u32 num_msgs; u32 test_msg; u32 proto_ver_msg; + u32 metric_tbl_msg; + u32 metric_dram_msg; }; =20 static const struct hsmp_plat_desc hsmp_desc_server =3D { @@ -190,6 +192,8 @@ static const struct hsmp_plat_desc hsmp_desc_server =3D= { .num_msgs =3D HSMP_MSG_ID_MAX, .test_msg =3D HSMP_TEST, .proto_ver_msg =3D HSMP_GET_PROTO_VER, + .metric_tbl_msg =3D HSMP_GET_METRIC_TABLE, + .metric_dram_msg =3D HSMP_GET_METRIC_TABLE_DRAM_ADDR, }; =20 /* The client drives a different mailbox with the Ryzen Master SMC message= set */ @@ -198,6 +202,8 @@ static const struct hsmp_plat_desc hsmp_desc_client =3D= { .num_msgs =3D HSMP_CLIENT_MSG_ID_MAX, .test_msg =3D HSMP_CLIENT_TEST, .proto_ver_msg =3D HSMP_CLIENT_GET_INTERFACE_VER, + .metric_tbl_msg =3D HSMP_CLIENT_GET_METRICS_TABLE, + .metric_dram_msg =3D HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR, }; =20 static struct hsmp_plat_device hsmp_pdev; @@ -759,11 +765,11 @@ static ssize_t hsmp_metric_tbl_read_locked(struct hsm= p_socket *sock, char *buf, return -EINVAL; } =20 - msg.msg_id =3D HSMP_GET_METRIC_TABLE; + msg.msg_id =3D hsmp_desc()->metric_tbl_msg; msg.sock_ind =3D sock->sock_ind; =20 /* - * HSMP_GET_METRIC_TABLE makes firmware refill this socket's shared + * The metric table message makes firmware refill this socket's shared * metric DRAM region, which is then copied out below. Hold the * per-socket lock across the fill-and-copy so concurrent readers of the * same socket cannot return a torn snapshot. @@ -829,8 +835,8 @@ int hsmp_get_tbl_dram_base(u16 sock_ind) int ret; =20 msg.sock_ind =3D sock_ind; - msg.response_sz =3D hsmp_msg_desc_table[HSMP_GET_METRIC_TABLE_DRAM_ADDR].= response_sz; - msg.msg_id =3D HSMP_GET_METRIC_TABLE_DRAM_ADDR; + msg.msg_id =3D hsmp_desc()->metric_dram_msg; + msg.response_sz =3D get_msg_desc(msg.msg_id)->response_sz; =20 ret =3D hsmp_send_message_locked(&msg); if (ret) --=20 2.34.1 From nobody Sat Sep 26 13:47:22 2026 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013011.outbound.protection.outlook.com [40.93.201.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AD86379C39; Tue, 1 Sep 2026 04:52:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.201.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238321; cv=fail; b=lb5qBGJ3hydER3R/O80kx7oAH3K80dGdbedVCEjKqRPvvoAkG6hz/5TxXP0Gymk1yOj+Ium87Qdk6Qe+xpXEeHMPQdixNXAZ1CiZs65YPiwWjLy74PhvXwH0MMK9SLTjDu84WYS3x959kQQZbob8LbJ4fcAUDq2BZ6XmpBKDilk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238321; c=relaxed/simple; bh=CQPgNRRqbbMGU70Lv3a3tXOliWSoN2S7TowoPGrmJ0o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ng4SGtvEf1s45J53i4wDDPIHy6UQHcPFH01dpTl9JBchLNiVmNzEfLyLK/7Q/jtJjAz4zfSbwLmYICg8kR5bQDGxPaboxkEZHmAvMlMGp8f/3N+1YouzPNfgJS4oxGV3242gCRgnneCW1phkokOStdTsgy5dGVSoHW+a5kxK06I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=qZtDmloU; arc=fail smtp.client-ip=40.93.201.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qZtDmloU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bwaAn91EuKQVSeqaDIcAe9zcXmi3PZZrThWuVFtmkwEyjvXENUPmAk3XLRmH/rpF89uENgXL20U9y+M4yyZtB+Iu3S3J2XjUu90MOqVeKit1kyZnP7YWnge828vgcJqALNtdV264sGilUqgb+d3S7I8DsFutxIvbpTMZUK6i0fYoe+v8s44idhdfcLUQ1tbL+sT5JL0HFhil5/QBWwaEPhZqILXUMx1e0fKzZlhorY0fEBpV8+nrLPimdo5iHdIUV2VteZdRggVa5B03Abi48Cm/tIhsB49n8LA5+/6jxVK4/Lqr8rdvGvMp+y1GyH7n7Lr/Zl8EV9FPHnA3dO31aQ== 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=7qIB1s/xsd1GAQNg9yXyyHHUmRC7/rhc8gSURABP+2w=; b=x7pIVBVMpdXGsr9H4V4e+zzHJ6u7ahGC7G9ZOG2rxjLZGFi6OrYlZd32LhvWhGnI1fltmbTVUnNdCeHhFYgGXf2cYGqkVW9LbnMiXUmH4z0V2Gyb8fD4rKUkP/gk+G6hyzrB8W4+P9iCWlo6UwRmWzvIT6AqcgbVxfCFCUmpOnPy6MiuYdj9e9KYVSFOcsnet213QZvNqQQZW+XZlCNDRjILa/1Rr8PV2Avr1g3XJI+aAFibuiTsCmd5CW93ZHCw28bvQZmqe2og7sv3WcEFS/E72AB928ojez3SXUeh64jL7igroL8dN+nthnKemiQ8M6l8hak5xGjuO1v/TZojHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 (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=7qIB1s/xsd1GAQNg9yXyyHHUmRC7/rhc8gSURABP+2w=; b=qZtDmloUZNSWOopmJJuwzxaR1F86Vdaa20cVlKw5sPSetGV2hhBLpyjU3ovyuE8aODMUsU6742nwH8sN4ENrFtCq3PFH6e5T7ut+zUobmp/nVZ9jtsqOpbFqOwiptKcna5ot0NSVPVv2B3hPMNQsA37kL5U0716wG+zQLUGOtnA= Received: from SA0PR13CA0020.namprd13.prod.outlook.com (2603:10b6:806:130::25) by DM4PR12MB7768.namprd12.prod.outlook.com (2603:10b6:8:102::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Tue, 1 Sep 2026 04:51:57 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:130:cafe::34) by SA0PR13CA0020.outlook.office365.com (2603:10b6:806:130::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.10 via Frontend Transport; Tue, 1 Sep 2026 04:51:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.8 via Frontend Transport; Tue, 1 Sep 2026 04:51:57 +0000 Received: from dcsm-trdripper1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 31 Aug 2026 23:51:54 -0500 From: Muralidhara M K To: , CC: , , Muralidhara M K , Mario Limonciello Subject: [PATCH v5 3/4] platform/x86/amd/hsmp: Add ACPI client support for Family 1Ah Date: Tue, 1 Sep 2026 10:21:33 +0530 Message-ID: <20260901045134.2833282-4-muralidhara.mk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260901045134.2833282-1-muralidhara.mk@amd.com> References: <20260901045134.2833282-1-muralidhara.mk@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|DM4PR12MB7768:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ddb8cd3-7ea8-4985-993a-08df07e4c0a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|1800799024|23010399003|376014|10067099003|3023799007|11063799006|56012099006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: r3IMvR7d5aEQeSml5gshajyri7lBFkwWiJLy3nDvg8UVW/HuCj/EMqG7G/F4+iEmKDlbfQri9x1QyWhRi+vOCEp1EIgYhPbdQZj2j8U+4ZPd2d1ejXlbofjtcRzqP9jJTt/ag1ys2Ep22m6EtMogW5uljpO83yFmHHNW5FI77iZk6AIIKi2yB6WjMQIfzSUSdhN1nlmaYUArhrjAav8NZJdja09bsf9UINcXu07Eu6LDkEPQCcFUSTyFd2oR4P6no20nLQpxp6n3c0JWdn0DRcnNsj0DePNOlx596THA0FCz8MZAw4UuVV/mS7M/pOIuk1fXka4ot7gRtwQ/fUZFDuoKSM2f5/XTUbbFihkrSL5Nwh2tRQA5UBG4UBIWWPIE1GGTuYHP0lFqxqSszgn+j5uWeSCufgkHzlQhZfQVipD8xLc30O/ljnXY5NYAqTtZwMKIaOc5cTGCMdI0NhmXEAbAwYIUkG1k1Rmj0vVHF8UvWvF3jtuqvpAjVeULv5TyPxOFuIZCY3oQLUPqBsqYWQUtgs/YPilXujB818al7Ex4FakWVVvQDsLGrMNyjmq0YDTZAl4c6QbotFWWJeyP2JoP4khZBwddC7RjujX+uxIc+iB3928VOrbaYN2hQgJQAE2pXh848L0WjSKNJIJevY/tfLAZf7NVU95TAOf/3qaBGiIoW+NVdhXHvWMZfn+cClsT71kxVS769TR0sAw+5w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(1800799024)(23010399003)(376014)(10067099003)(3023799007)(11063799006)(56012099006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VgQ88m/unJ0e5f+/nCtc6FuIN+EDLWqsL9iw4zB5aFknk108WBW54edXmTea8vLuzC1QyI8ntviOQCz/9/lAn9QVVVfsJtmYJG/QX9KH3Vlge8+pWHCpoHqhzc3qoCjl6pNR3pM67f/ELTD6Xa+ZGhhOD492Tsxk8825wlOF15lsKGtlkXbtfufvOzqfgT6wJevR5ZAFCK/AhWrKSe5qmCBTxNDpUJhKIb+Ij9VtKG2jF4rfF/wG0Zu0APapM7n29IFXAP7L75d4LGcm1/qEsWqiIxuP8k07wpEcjZN69MPfBHMApkquxQudpWcuOv5RBcIlS32bpQpS8zN2ZE9f41iFpjiVZRVechEGxO7pa5Xw7zysb0gkvIrCz8c1+XMRpa8lpVBh0WLXl+WsxvwIlfhvGu40umks61qL7jnfxXBTirMw6CJnBNVCIVKXpLWu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2026 04:51:57.4921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ddb8cd3-7ea8-4985-993a-08df07e4c0a0 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7768 Content-Type: text/plain; charset="utf-8" The ACPI HSMP device (HID AMDI0097) on the Family 1Ah client platforms (Models 80h-8Fh and E0h-E3h) describes its mailbox the same way server platforms already do, via _CRS/_DSD, so hsmp_parse_acpi_table() and hsmp_get_uid() need no client-specific handling. Client platforms don't report a server protocol version, so also gate the metric table DRAM base lookup on is_client_platform() alongside the existing proto_ver check, so client platforms get their metric table base initialized too. hsmp_pdev->proto_ver holds the Ryzen Master SMC interface version on client platforms, a separate numbering space from the server protocol versions in enum hsmp_proto_versions, so gate on it using its own RYZEN_MASTER_PROTO_VER1 rather than assuming every client platform is ready for the metric table lookup regardless of interface version. Signed-off-by: Muralidhara M K Reviewed-by: Mario Limonciello (AMD) --- arch/x86/include/uapi/asm/amd_hsmp.h | 9 +++++++++ drivers/platform/x86/amd/hsmp/acpi.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/uapi/asm/amd_hsmp.h b/arch/x86/include/uapi/a= sm/amd_hsmp.h index 00ca7855ca00..3e1b7cbe0f04 100644 --- a/arch/x86/include/uapi/asm/amd_hsmp.h +++ b/arch/x86/include/uapi/asm/amd_hsmp.h @@ -95,6 +95,15 @@ enum hsmp_proto_versions { HSMP_PROTO_VER7 }; =20 +/* + * The Ryzen Master SMC interface versions its own way, reported by + * HSMP_CLIENT_GET_INTERFACE_VER. It is a separate numbering space from + * enum hsmp_proto_versions above, which only applies to the server set. + */ +enum ryzen_master_proto_versions { + RYZEN_MASTER_PROTO_VER1 =3D 1, +}; + struct hsmp_msg_desc { int num_args; int response_sz; diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/am= d/hsmp/acpi.c index 8257cd1da48e..43d746546536 100644 --- a/drivers/platform/x86/amd/hsmp/acpi.c +++ b/drivers/platform/x86/amd/hsmp/acpi.c @@ -557,7 +557,8 @@ static int init_acpi(struct device *dev) return ret; } =20 - if (hsmp_pdev->proto_ver >=3D HSMP_PROTO_VER6) { + if ((is_client_platform() && hsmp_pdev->proto_ver >=3D RYZEN_MASTER_PROTO= _VER1) || + hsmp_pdev->proto_ver >=3D HSMP_PROTO_VER6) { ret =3D hsmp_get_tbl_dram_base(sock_ind); if (ret) dev_info(dev, "Failed to init metric table\n"); --=20 2.34.1 From nobody Sat Sep 26 13:47:22 2026 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010056.outbound.protection.outlook.com [52.101.201.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12A35261388; Tue, 1 Sep 2026 04:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238326; cv=fail; b=V8GVCAoogvTRtMGPjZ/6IIW0NiSXygaJ1xoWXm19P/SnO5JEAxNT56kIgh/qbqhejuEmuIZWWuuze3nXwHLhM6uIUgzfWFqlb7XK5PPdi0W0ed4Yye1eGTYrWQUKWEPoZhliDkqV48GoBeE/hdLKWIFBa6c7rYupX4n+TT0JOTU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788238326; c=relaxed/simple; bh=FR5qw+FGZ0ofM+7J/W/yiXPyFYP+XMdu/61eSqX53UU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TkJW+e6Rmb0ycoAwsEZV2a1UiFYeJKY2DO1fnR/dF5KXSJ4y+DpgK10rj6EeHXielA9F+JchhSfMYSLLJdau41TkxwGP+44lrQq9WMbEG3hVaH6OzlhZsVZA8GHlKKY85nRdofIG9dYI1OpotJk5L82m7/zrgnwbJP9CcBFL5+U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=TbR/Dvhr; arc=fail smtp.client-ip=52.101.201.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TbR/Dvhr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HzDoA6UN34pxWWF/Tu9mwmyIxGzuF/BDS0zpohFzsm8rm3j/6FC+v8LYfV7MuoChPZGzCKVQGTL5eyf08b/VBSYkdmRbvq/F5G+Asu6jBpMWFiLTyLGS+yvud1RcsvGszzhcG9OhfIL0JIDgb/8/UDMrgiHen9kz4iGx7/8HTaFFgtyi5mcLG1asFaYhIfdOaQfAQZB9M0hpiLyQsTzrnUgM+HQ+RnnPfKFu5AdSPeYNGANJCgxGjJmB2xn+xEDoCm4zpl4/qnKRyeiBalopMgXCUVqGYUYKN0SajneUz75vNo/VCRFptkMvORHtnuy1O1V1m6A6GC/G15bxHso3HQ== 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=GxweoJit0yHM6QcRlfVm76n5tg6ZghJv0BBuVoSjUNk=; b=HL9OhDuw6vz7XbeShkf/Gjy5Rgz9xt6nPpXwB2yNVRRy0bNBxU7z516Y7NK12eSLDBO/0k04GTocKHFVgEIvAxaEJ3H5XmcI6r4tlDC5UeA4RjgLfM4OY3YNym9SuP/foocEjpCa1oNjYjHn71EvCQcXW4fnTa3gTwfOII0C3zCBS+AhcPmF8bseps+OzNJoocGNc+jlVl6aq+VfPpO9NA197ymxDdabL0+9n8wUy0Adcm92rIPjo8z+Qx7GzOv3l+ZXhh2E2b1nqskL6lRK3iKbsWVYc+PdRpsBuRM8J5JH2JPUXGN0O3DF4GavcriqyLDvlYd4/d8gv0BgW9hJQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 (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=GxweoJit0yHM6QcRlfVm76n5tg6ZghJv0BBuVoSjUNk=; b=TbR/Dvhrlc5lcclqaflPrpgL3fc1u9VvdnxbcWetfvN9rFuXVbWvGO6LU5T0kNIgLCNfvumCGhwvzG/TJ2beq+u7Kh8O/ZI0ibM27/VS9/PmsyBLyMbxBZU+uQkLg1uvr3GNuyWK8eppfsolNwrvTHDDhwwFKfLX5+soG4iDQDI= Received: from SA0PR13CA0019.namprd13.prod.outlook.com (2603:10b6:806:130::24) by SA0PR12MB7479.namprd12.prod.outlook.com (2603:10b6:806:24b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Tue, 1 Sep 2026 04:51:59 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:130:cafe::a6) by SA0PR13CA0019.outlook.office365.com (2603:10b6:806:130::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.10 via Frontend Transport; Tue, 1 Sep 2026 04:51:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.8 via Frontend Transport; Tue, 1 Sep 2026 04:51:59 +0000 Received: from dcsm-trdripper1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 31 Aug 2026 23:51:57 -0500 From: Muralidhara M K To: , CC: , , Muralidhara M K , Mario Limonciello Subject: [PATCH v5 4/4] platform/x86/amd/hsmp: Document and expose client telemetry table in UAPI Date: Tue, 1 Sep 2026 10:21:34 +0530 Message-ID: <20260901045134.2833282-5-muralidhara.mk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260901045134.2833282-1-muralidhara.mk@amd.com> References: <20260901045134.2833282-1-muralidhara.mk@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|SA0PR12MB7479:EE_ X-MS-Office365-Filtering-Correlation-Id: b0688e4f-8539-4dc4-9743-08df07e4c1d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|1800799024|23010399003|376014|10067099003|6133799003|18002099003|5023799004|11063799006|56012099006|22082099003|13003099007; X-Microsoft-Antispam-Message-Info: AU+vf3OEPWiMixiMoOXlPYL6NpWMpTJfwIkM4vbpd7yf6W1YmKJ6WLcSONa01WN9Bhue4fapRWDB0FmMxAvPsxZnKfzSgDUv6l9JIR+aYBxi6ML/NBHZMjrk6Wjtr3Z4f3WTvfrZR8joqFfYxWX8jPVBJK2h5m7qvjh3o9WNLxDoHntUuru1UtqBbTMrzcwRLUl2c3YPiFkDfx8B03GOzJB9ltZeqA65ucZLA00o0lAzEng8m56x12dNpuXCpRwmwvHqS7OcAQuxlgxNBjocJqRc82kNjI74SrfShm+BchbHcnLh/eg1jbb6jnKmT/JATAovrhvKN74I/zc2pPku9zSIE1e8I2/N/V1WBfxmuepeiOlxo61iZoYDl9soU+DxyldtSy/AQdG6eZ8xf+fwXxxw64RyhvxruhRqW+/XmuVSc7VpxVSB8P/EF2NxcLG3BwL0mz1wC5JpJ5XNILZxEG2WWQ8bXsdyE6AfBRQ9hVOLhS5OwhxQbRdokNOMiZwmikcL4jI+wVu2Ul5O6QoM3MQpDp42KULRcMu9JbvOl65Z4EktaZBWK971zI+k2xqmkYNgB45uRNZrHmos6ZsYmIPnh6/i+bV8vEIvBxtoXNiqhQxC7z5mcuHxsDSy8Ae32uZ7Xo23Wg7q/aMbh7TUB3otViH0s4lsWkxaJRj7Na+w1Gxh2yERY7MZJQb4Elv76sx0+g7EvAzmzjVZdGoGvg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(1800799024)(23010399003)(376014)(10067099003)(6133799003)(18002099003)(5023799004)(11063799006)(56012099006)(22082099003)(13003099007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wHzxWTTEirb1YVsulAjDf4jBmtUoFMEPcInTjkcm24697JUqhOmy4MC3AmUqmcjNlG2ngneWuE5z7Wo+NnRm0jFA30fRgzL1Cetn//fJWIOb2Sh5mvnBRGcJWJGRtmIA8gr3UZKDBSXLQR29zSABTSEl2JTqLGtukmAVX5AEM0j6fCvO8unR9pfhclLwzEtzwJ/qn8cR+ecS8Ktx50G9oHeuxwQgFMwL4YRN5wV+5Heb+DVfhDxDPxOU9SPq8nI7PslPYB8+oFSwjr9EVC22EiXzqI1e/dt4sEbWcnLr/U3dt0VkI5V2+87BxsDGhLKWqh0+ApPhksY0uk1MfYEfcHU4KzvB28DMsBcFkP9yGl+ItgzkTrUsFv8/oupdbEGvJVa9QQ7Pptvi4ExSud6fnPjYpv+fYyqYtuh3cz0PgZPBK/UR/Coh1NGr3cxtjLKZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2026 04:51:59.4985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0688e4f-8539-4dc4-9743-08df07e4c1d2 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7479 Content-Type: text/plain; charset="utf-8" The client models return the Ryzen Master SMC telemetry table, which the driver copies out without interpreting. Add the Telemetry Table RM layout, reported as table version 5 by HSMP_CLIENT_GET_METRICS_TABLE_VER, as struct declarations in the UAPI header, so userspace has one authoritative, kernel-doc'd definition of the byte layout instead of decoding it by hand. Point amd_hsmp.rst at struct hsmp_telemetry_table_rm rather than duplicating the layout in prose. The Public PPR for the model in use remains the reference for units and encodings, which are firmware defined. Signed-off-by: Muralidhara M K Reviewed-by: Mario Limonciello (AMD) --- Documentation/arch/x86/amd_hsmp.rst | 14 ++ arch/x86/include/uapi/asm/amd_hsmp.h | 263 +++++++++++++++++++++++++++ 2 files changed, 277 insertions(+) diff --git a/Documentation/arch/x86/amd_hsmp.rst b/Documentation/arch/x86/a= md_hsmp.rst index b95f09945193..c483c68dcfad 100644 --- a/Documentation/arch/x86/amd_hsmp.rst +++ b/Documentation/arch/x86/amd_hsmp.rst @@ -221,9 +221,23 @@ The following IOCTLs are defined: ``sizeof(struct hsmp_metric_table)``. Later version metrics table layout is documented in the Public PPR. =20 + The Family 1Ah client models carry their own telemetry table instead, + described in `Family 1Ah client telemetry table`_ below. + The ioctl would return a non-zero on failure; you can read errno to see what happened. The transaction returns 0 on success. =20 +Family 1Ah client telemetry table +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D +On the Family 1Ah client models, ``HSMP_CLIENT_GET_METRICS_TABLE`` (05h) +returns the Ryzen Master SMC telemetry table, table version 5 as +reported by ``HSMP_CLIENT_GET_METRICS_TABLE_VER`` (04h). This is the +Telemetry Table RM layout, defined as ``struct hsmp_telemetry_table_rm`` +in amd_hsmp.h. The driver copies the table out without interpreting it. + +See the telemetry table chapter of the AMD Public PPR for the model in +use for the units and encodings of its fields. + More details on the interface and message definitions can be found in chap= ter "7 Host System Management Port (HSMP)" of the respective family/model PPR eg: https://docs.amd.com/v/u/en-US/55898_B1_pub_0_50 diff --git a/arch/x86/include/uapi/asm/amd_hsmp.h b/arch/x86/include/uapi/a= sm/amd_hsmp.h index 3e1b7cbe0f04..907acb93c456 100644 --- a/arch/x86/include/uapi/asm/amd_hsmp.h +++ b/arch/x86/include/uapi/asm/amd_hsmp.h @@ -808,4 +808,267 @@ enum hsmp_client_message_ids { HSMP_CLIENT_MSG_ID_MAX, }; =20 +#define HSMP_TELEMETRY_RM_MAX_CCX 4 +#define HSMP_TELEMETRY_RM_CORES_PER_CCX 12 +#define HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE 8 +#define HSMP_TELEMETRY_RM_NPU_BUSY_DOMAINS 3 +#define HSMP_TELEMETRY_RM_OC_DOMAINS 5 +#define HSMP_TELEMETRY_RM_OC_SUBDOMAINS 5 +#define HSMP_TELEMETRY_RM_OC_GUARDBANDS 3 + +/* + * Firmware lays out this table packed to a 4-byte boundary, so __u64 + * members here only need 4-byte alignment rather than the usual 8. Without + * this, the compiler's natural 8-byte alignment would insert padding + * firmware never put there, shifting every field after the first + * misaligned __u64 off its real offset. + */ +#pragma pack(push, 4) + +/* + * struct hsmp_telemetry_table_rm_iod - I/O die counters for RM telemetry. + * + * Accumulator (*_acc) fields are monotonic counters; consumers derive + * deltas across two snapshots and normalise by accumulation_counter. + */ +struct hsmp_telemetry_table_rm_iod { + __u32 accumulation_counter; + + /* SET VOLTAGES */ + __u64 vddcr_set_voltage; + __u64 vddcr_soc_set_voltage; + __u64 vddcr_npu_set_voltage; + __u64 vddcr_lp_set_voltage; + __u64 vddcr_gfx_set_voltage; + __u64 vdd_misc_set_voltage; + + /* TELEMETRY VOLTAGES */ + __u64 vddcr_telemetry_voltage; + __u64 vddcr_soc_telemetry_voltage; + __u64 vddcr_npu_telemetry_voltage; + __u64 vddcr_lp_telemetry_voltage; + __u64 vddcr_gfx_telemetry_voltage; + __u64 vdd_misc_telemetry_voltage; + + /* TELEMETRY POWERS */ + __u64 vddcr_telemetry_power; + __u64 vddcr_soc_telemetry_power; + __u64 vddcr_npu_telemetry_power; + __u64 vddcr_lp_telemetry_power; + __u64 vddcr_gfx_telemetry_power; + __u64 vdd_misc_telemetry_power; + + /* THROTTLERS - FAST PPT */ + __u32 fppt_fused_limit; + __u32 fppt_max_irm_limit; + __u32 fppt_max_pbo_limit; + __u32 fppt_limit; + __u64 fppt_value_acc; + __u32 fppt_residency_acc; + + /* THROTTLERS - SLOW PPT */ + __u32 sppt_fused_limit; + __u32 sppt_max_irm_limit; + __u32 sppt_max_pbo_limit; + __u32 sppt_limit; + __u64 sppt_value_acc; + __u32 sppt_residency_acc; + + /* THROTTLERS - SPL */ + __u32 spl_fused_limit; + __u32 spl_max_irm_limit; + __u32 spl_max_pbo_limit; + __u32 spl_limit; + __u64 spl_value_acc; + __u32 spl_residency_acc; + + /* THROTTLERS - TDC VDDCR */ + __u32 tdc_vddcr_fused_limit; + __u32 tdc_vddcr_max_irm_limit; + __u32 tdc_vddcr_max_pbo_limit; + __u32 tdc_vddcr_limit; + __u64 tdc_vddcr_value_acc; + __u32 tdc_vddcr_residency_acc; + + /* THROTTLERS - TDC VDDCR SOC */ + __u32 tdc_vddcr_soc_fused_limit; + __u32 tdc_vddcr_soc_max_irm_limit; + __u32 tdc_vddcr_soc_max_pbo_limit; + __u32 tdc_vddcr_soc_limit; + __u64 tdc_vddcr_soc_value_acc; + __u32 tdc_vddcr_soc_residency_acc; + + /* THROTTLERS - TDC VDDCR NPU */ + __u32 tdc_vddcr_npu_fused_limit; + __u32 tdc_vddcr_npu_max_irm_limit; + __u32 tdc_vddcr_npu_max_pbo_limit; + __u32 tdc_vddcr_npu_limit; + __u64 tdc_vddcr_npu_value_acc; + __u32 tdc_vddcr_npu_residency_acc; + + /* THROTTLERS - TDC VDDCR LP */ + __u32 tdc_vddcr_lp_fused_limit; + __u32 tdc_vddcr_lp_max_irm_limit; + __u32 tdc_vddcr_lp_max_pbo_limit; + __u32 tdc_vddcr_lp_limit; + __u64 tdc_vddcr_lp_value_acc; + __u32 tdc_vddcr_lp_residency_acc; + + /* THROTTLERS - TDC VDDCR GFX */ + __u32 tdc_vddcr_gfx_fused_limit; + __u32 tdc_vddcr_gfx_max_irm_limit; + __u32 tdc_vddcr_gfx_max_pbo_limit; + __u32 tdc_vddcr_gfx_limit; + __u64 tdc_vddcr_gfx_value_acc; + __u32 tdc_vddcr_gfx_residency_acc; + + /* THROTTLERS - EDC VDDCR */ + __u32 edc_vddcr_fused_limit; + __u32 edc_vddcr_max_irm_limit; + __u32 edc_vddcr_max_pbo_limit; + __u32 edc_vddcr_limit; + + /* THROTTLERS - THERMAL */ + __u32 thm_fused_limit; + __u32 thm_limit; + __u64 thm_value_acc; + __u32 thm_residency_acc; + __u32 prochot_residency_acc; + __u64 gfx_temp_acc; + __u64 soc_temp_acc; + __u32 p3t_fused_limit; + __u64 p3t_value_acc; + + /* POWER */ + __u64 system_power_acc; + __u64 apu_power_acc; + __u64 dgpu_power_acc; + __u64 npu_power_acc; + + /* FREQUENCIES */ + __u64 fclk_freq_eff_acc; + __u64 memclk_freq_eff_acc; + __u64 lclk_freq_eff_acc; + __u64 gfxclk_freq_eff_acc; + __u64 socclk_freq_eff_acc; + __u64 vclk_freq_eff_acc; + __u64 vpeclk_freq_eff_acc; + __u64 aieclk_freq_eff_acc; + __u64 npuhclk_freq_eff_acc; + + /* BANDWIDTH */ + __u64 dram_read_bandwidth; + __u64 dram_write_bandwidth; + + /* ACTIVITY MONITORS */ + __u64 gfx_busy_acc; + __u64 vcn_busy_acc; + __u64 npu_busy_acc[HSMP_TELEMETRY_RM_NPU_BUSY_DOMAINS]; + + /* STT (Skin Temperature Tracking) */ + __u32 stt_min_limit; + __u64 stt_apu_hot_spot_temp_acc; + __u64 stt_hs2_hot_spot_temp_acc; + __u32 stt_apu_temp_limit; + __u64 stt_apu_skin_temp_acc; + + /* RESIDENCIES - per-CCX CPU off */ + __u64 cpu_off_residency[HSMP_TELEMETRY_RM_MAX_CCX]; + + /* DF P-STATES */ + __u32 fclk_freq_table[HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE]; + __u32 uclk_freq_table[HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE]; + __u32 ddr_rate_table[HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE]; + __u8 df_pstate_source[HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE]; + + /* SYSTEM */ + __u8 gfx_disabled; + __u8 spare2[3]; + __u32 gfxclk_fmax; + __u8 cclk_core_fuse_enable[HSMP_TELEMETRY_RM_MAX_CCX][HSMP_TELEMETRY_RM_= CORES_PER_CCX]; + __u8 cclk_core_enabled[HSMP_TELEMETRY_RM_MAX_CCX][HSMP_TELEMETRY_RM_CORE= S_PER_CCX]; + __u32 cclk_fmax[HSMP_TELEMETRY_RM_MAX_CCX][HSMP_TELEMETRY_RM_CORES_PER_CC= X]; + + /* OVERCLOCK CAPABLE */ + __u8 cpu_precise_and_direct_oc_capable; + __u8 gfx_precise_and_direct_oc_capable; + __u8 pbo_basic_oc_capable; + __u8 pbo_advanced_oc_capable; + __u8 pbo_nitro_oc_capable; + __u8 memory_and_fabric_oc_capable; + __u8 misc_oc_capable; + __u8 extreme_cold_oc_capable; + __u8 down_config_control_capable; + __u8 spare0[3]; + + /* OVERCLOCK STATUS */ + __u32 fit_limit_scalar; + __u8 ln2_enabled; + __u8 cpu_precise_and_direct_oc_enabled; + __u8 gfx_precise_and_direct_oc_enabled; + __u8 spare1[2]; + __s8 psm_guardband[HSMP_TELEMETRY_RM_OC_DOMAINS] + [HSMP_TELEMETRY_RM_OC_SUBDOMAINS] + [HSMP_TELEMETRY_RM_OC_GUARDBANDS]; + __s32 core_power_limit_offset; + __u32 max_freq_offset[HSMP_TELEMETRY_RM_OC_DOMAINS]; + + __u64 npu_temp_acc; + __u64 df_pstate_residency_acc[HSMP_TELEMETRY_RM_FREQ_TABLE_SIZE]; + __u32 cclk_fboost; + + /* PMF */ + __u32 pmf_fast_apu_ppt_limit; + __u64 pmf_fast_apu_ppt_value_acc; + __u32 pmf_fast_apu_ppt_residency_acc; + + __u32 pmf_slow_apu_ppt_limit; + __u64 pmf_slow_apu_ppt_value_acc; + __u32 pmf_slow_apu_ppt_residency_acc; + + __u32 pmf_fast_spm_limit; + __u64 pmf_fast_spm_value_acc; + __u32 pmf_fast_spm_residency_acc; + + __u32 pmf_slow_spm_limit; + __u64 pmf_slow_spm_value_acc; + __u32 pmf_slow_spm_residency_acc; + + __u32 spare3[5]; +}; + +/* + * struct hsmp_telemetry_table_rm_ccx - Per-CCX core counters for RM telem= etry. + * + * Arrays are sized for the maximum cores per CCX; use the + * cclk_core_enabled[] mask in struct hsmp_telemetry_table_rm_iod to tell + * which entries are valid. + */ +struct hsmp_telemetry_table_rm_ccx { + __u64 core_c0[HSMP_TELEMETRY_RM_CORES_PER_CCX]; + __u64 core_cc6[HSMP_TELEMETRY_RM_CORES_PER_CCX]; + __u64 core_freq[HSMP_TELEMETRY_RM_CORES_PER_CCX]; + __u64 core_freq_eff[HSMP_TELEMETRY_RM_CORES_PER_CCX]; + __u64 core_temp[HSMP_TELEMETRY_RM_CORES_PER_CCX]; + __u64 core_power[HSMP_TELEMETRY_RM_CORES_PER_CCX]; +}; + +/** + * struct hsmp_telemetry_table_rm - Top-level RM telemetry table. + * @iod: I/O die counters and per-rail/per-throttler/SYSTEM telemetry. + * @ccx: Per-CCX core counters, one entry per CCX. + * + * Layout of the table returned by HSMP_CLIENT_GET_METRICS_TABLE on the + * Family 1Ah client (Models 80h-8Fh and E0h-E3h), reported as table + * version 5 by HSMP_CLIENT_GET_METRICS_TABLE_VER. Units are + * firmware-defined; see the AMD HSMP/Ryzen Master SMC spec. Spare + * fields are firmware padding and must be preserved. + */ +struct hsmp_telemetry_table_rm { + struct hsmp_telemetry_table_rm_iod iod; + struct hsmp_telemetry_table_rm_ccx ccx[HSMP_TELEMETRY_RM_MAX_CCX]; +}; + +#pragma pack(pop) + #endif /*_ASM_X86_AMD_HSMP_H_*/ --=20 2.34.1