From patchwork Mon Oct 28 07:04:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853087 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.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 1354F18E374 for ; Mon, 28 Oct 2024 07:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099114; cv=fail; b=ecoHOUVXt7Eql7AqR1+IlAvMdXp0kuEehkpfehmb9XpUsndRAD0b59UqnVuiJd2tfQqUdRyxkeeJF/25AUJjiA9EEzGVwQEc7IVW/rSPTaLXPkuyhPv2h43lr8A4QBWZiJDLR/5CCUpxn4mpGqEabArB3mqMElMbx4fdBuGJkcs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099114; c=relaxed/simple; bh=eQZ42rWF6OcBZJOgyvpJn984jj3MYzJAXOAc93uNDH0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VJHVLebDcv78osMmNqKvHflMOH8NCZiT1J3fP4d8oj/SRwd83/V7PdKdkXfszsEKxaDuShHrqXjg1Az9XTMVqFTwmuBsLYUYmM+XDB3nxZA4Y16dHYqGf+b8p+T18yvvl24PBHcrl1Szoh8A4Dd7UxldVzQR5fxJOYxZAf/6tHs= 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=vjrw7o2l; arc=fail smtp.client-ip=40.107.237.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="vjrw7o2l" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u7FW4rVvCTCYCkA/SnlMidMceWQcQUn1UA0M7ZVzCYVizSmDYlxvKIbu8t++4hd6G61AsU91Jlyx9XmZOsUGKH/0BJYSsVBfAFO02WgRhx+J9rb0c7x3LseCzG884JGgd/QwcVFWv+tNKb920CZ1Anfp8LeaHpaMCqiA1DpQlq2Pv/mQVoHNDJ8omi/tyujf9na956r3CUSjgW4Kj1wTTnHJmQ8LoQXVyZv+0Mc30SuM1DrHgzU5LezBGh+BP3HgA6gq1ZgHZ9KgnovnzXQXWLODO1L81/Y+t/sD6cMNyHUFCbY5SMCDddYt0qTmg0MqmPTKMFaE8sLtymuMX/qW2g== 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=+/gPCmVVY+sBXOAvvkV7T0Qkjna3kW7+ONKlg9CJDaY=; b=zPFJUVvgQlUOS4wnsSjVNKHbH8hIOQUrSfXXeboZrbn5jyjUpnm3PWVwnJyOjGOgZKWOqhLiL6suHZpsB9rzoJTrLw4VoLytuM2r8i1/osUCTz4SSxBAl3j0tIP/jOYE0BnVfozkqa2wo0mM+TkVNy/ZspC3EE/mNXhxy1SxGDfAnZo1hYjfPheyWK7iyqLWitYfM57xGqFOKV45jLk3Cm7wyY3WaKKEGfhvLtCBB6zoOHhbjyTQMAjRv1WH6kMCx6peHeCEQNiswmiUvmiBpy//pwnqatF0c3lrr2+4ltpb4R/uf0DoL0fD0V2APRHP2HT8PpXU7ChVEdKpk/LAAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=+/gPCmVVY+sBXOAvvkV7T0Qkjna3kW7+ONKlg9CJDaY=; b=vjrw7o2lInwi0y2bt0SuFVgcjTJ4ZUtYc43qJWLaRF4ahdHtyX2eg0LWYaCbcEK7CtUXIvQ8dc0hen7ty9upZ2bxd/s+RhZZU9i5oL+4g0tFCH4YnIHCWfmlGzejbgF3hhDzHE/AWYEJ4f9CXH4eBUA5pW04RW3iiw7/bBbf6pc= Received: from SJ0PR03CA0126.namprd03.prod.outlook.com (2603:10b6:a03:33c::11) by BY5PR12MB4291.namprd12.prod.outlook.com (2603:10b6:a03:20c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 07:05:05 +0000 Received: from CO1PEPF000075F1.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::3a) by SJ0PR03CA0126.outlook.office365.com (2603:10b6:a03:33c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 07:05:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075F1.mail.protection.outlook.com (10.167.249.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 07:05:05 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:02 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 1/8] platform/x86/amd/pmc: Move STB functionality to a new file for better code organization Date: Mon, 28 Oct 2024 12:34:31 +0530 Message-ID: <20241028070438.1548737-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075F1:EE_|BY5PR12MB4291:EE_ X-MS-Office365-Filtering-Correlation-Id: 29107d80-2294-45fe-b7c8-08dcf71ed9b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: novUboPVsxuVUEu0m6bBIiRVRCC5FBBvuEJDp+hCzFNZvyWNhRrr5oEHUtfuxNf1NlCXgl4sY5Z1ED4/o+Yes/LBp7mh7uS//4xUdW+b1bX3TTN3Yg2VYX+VTJTfcsZy/ki0ye4kvU6/mcxm3IPDbpunNyCeaKC/R7ZiK9XhC8F4sutrKduwd51ePcpLaWUy/5v/Ivh6QCflhOQnBY8XzYYShbkGqtJY5Af00vGYb7MKm/HWH+HfPRaimUvEGTukZYELgRmLVqzYH1kScF6fRFGCM0QzB8YaNqEvIh/4PrvR5R5MuJIb4qdrM2yTqDNb7sgKfbOsBYUP9f1jGtWOjkIeTImpYMusArREeBGueRf2h16Lp0hH6fq9tvmkrbUQqtjFRK2JL5CV1WQHcwDQFse8AgPyo0TnE63jpnjSzFfYwHLSM5aUpyXoS61aASX/IRBSkWUYYTsMCi7Igbtpr7LNKMfcizub0Lq7evmpa8IvKF69AImzJs9gJkHMsrKUHg4t7W2qEzjW64gNd0HGVbrWiLW4YycXURBbn9htkdKXBHvKUmOUcNlG0ci9exRXX3cUchtg+8RFWUQ1Hz3Zx8eD2U0zc9CewR6XfWvfdaUQu1FDzUwJ9ny0kUhs/GEinH0uIGb9JlLlMgV5YwfzxlY+SIqW+fNFqoFesK4/rc+zm8lVWJDlJ1FDZzVcf4jfwbDYIsZ//kKckPuTJl9N5JlgB59SfYrngNpqba/cYY3iMn5OpluElzjV43f5nUo6dILLw4uhHeC8lyqlgTDrFi+Av2XN6wJNdRNb2mnZoLqdCgSMlS8u+5NetWOhIon3dR0M47+BYq9qK2PqBedzdcuxMEfbJEquYbi5KC2Krpp+cO0SX1wpGkDJa96LJP1hwPZOrpxv8l78QMasJK5Zgl/cZMpm5r74fV2e6wCSs29gBkvXza6dq77zDz7XVnB/Pb3Mb0FYb462bh8wa0800/E4aMacd75D+O1jIC78MYcE1zXd2YcOyLo2/8L1wk6aZXTE1D9SMzzq8uECnZ1uMrXBKp3vZNpNJyAYS4hEX+A6BHDT4KUbmlWosQQmsTPwaBQIfWInDAhG4xUiXoXrBfwomrWMzzBHt/PxPjAzP4ffb+wbawjhdUyAv7vh+BT3Qv/5qNBzMjl+AqhyuZ31H31VW/YTNAO7eGPhGwDOq58zUvo7PXFuReIccs/dZIPVAGX29kPEdTQTDu+JMfUpo6KMnb1hYjqcaX71M92NI+mn/3fg7qTlcv7EndZAAApl8Zt95EwEScQkNUJd478rqF3esafSrg5p010/jcnyJB1S7NHrhQIIk5qlu+hdZB48XOUH1CgtBCkZv9NY10cpzFTvkwvauIigdC5bBVtXQldSv+CBxSxA8Bylwas4kdwhmYAFikuBV1338y+XTPm0zg== 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)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:05.1849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29107d80-2294-45fe-b7c8-08dcf71ed9b5 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: CO1PEPF000075F1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4291 As the SoC evolves with each generation, the dynamics between the PMC and STB layers within the PMC driver are becoming increasingly complex, making it challenging to manage both in a single file and maintain code readability. Additionally, during silicon bringup, the PMC functionality is often enabled first, with STB functionality added later. This can lead to missed updates in the driver, potentially causing issues. To address these challenges, it's beneficial to move all STB-related changes to a separate file. This approach will better accommodate newer SoCs, provide improved flexibility for desktop variants, and facilitate the collection of additional debug information through STB mechanisms. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/Makefile | 2 +- drivers/platform/x86/amd/pmc/mp1_stb.c | 295 +++++++++++++++++++++++++ drivers/platform/x86/amd/pmc/pmc.c | 289 +----------------------- drivers/platform/x86/amd/pmc/pmc.h | 9 + 4 files changed, 310 insertions(+), 285 deletions(-) create mode 100644 drivers/platform/x86/amd/pmc/mp1_stb.c diff --git a/drivers/platform/x86/amd/pmc/Makefile b/drivers/platform/x86/amd/pmc/Makefile index f1d9ab19d24c..255d94ddf999 100644 --- a/drivers/platform/x86/amd/pmc/Makefile +++ b/drivers/platform/x86/amd/pmc/Makefile @@ -4,6 +4,6 @@ # AMD Power Management Controller Driver # -amd-pmc-objs := pmc.o pmc-quirks.o +amd-pmc-objs := pmc.o pmc-quirks.o mp1_stb.o obj-$(CONFIG_AMD_PMC) += amd-pmc.o amd-pmc-$(CONFIG_AMD_MP2_STB) += mp2_stb.o diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c new file mode 100644 index 000000000000..9a34dd94982c --- /dev/null +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -0,0 +1,295 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD MP1 Smart Trace Buffer (STB) Layer + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Authors: Shyam Sundar S K + * Sanket Goswami + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include + +#include "pmc.h" + +/* STB Spill to DRAM Parameters */ +#define S2D_TELEMETRY_BYTES_MAX 0x100000U +#define S2D_RSVD_RAM_SPACE 0x100000 +#define S2D_TELEMETRY_DRAMBYTES_MAX 0x1000000 + +/* STB Registers */ +#define AMD_PMC_STB_PMI_0 0x03E30600 +#define AMD_PMC_STB_DUMMY_PC 0xC6000007 + +/* STB Spill to DRAM Message Definition */ +#define STB_FORCE_FLUSH_DATA 0xCF +#define FIFO_SIZE 4096 + +static bool enable_stb; +module_param(enable_stb, bool, 0644); +MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism"); + +static bool dump_custom_stb; +module_param(dump_custom_stb, bool, 0644); +MODULE_PARM_DESC(dump_custom_stb, "Enable to dump full STB buffer"); + +enum s2d_arg { + S2D_TELEMETRY_SIZE = 0x01, + S2D_PHYS_ADDR_LOW, + S2D_PHYS_ADDR_HIGH, + S2D_NUM_SAMPLES, + S2D_DRAM_SIZE, +}; + +struct amd_pmc_stb_v2_data { + size_t size; + u8 data[] __counted_by(size); +}; + +int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) +{ + int err; + + err = amd_smn_write(0, AMD_PMC_STB_PMI_0, data); + if (err) { + dev_err(dev->dev, "failed to write data in stb: 0x%X\n", AMD_PMC_STB_PMI_0); + return pcibios_err_to_errno(err); + } + + return 0; +} + +static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) +{ + int i, err; + + for (i = 0; i < FIFO_SIZE; i++) { + err = amd_smn_read(0, AMD_PMC_STB_PMI_0, buf++); + if (err) { + dev_err(dev->dev, "error reading data from stb: 0x%X\n", + AMD_PMC_STB_PMI_0); + return pcibios_err_to_errno(err); + } + } + + return 0; +} + +static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) +{ + struct amd_pmc_dev *dev = filp->f_inode->i_private; + u32 size = FIFO_SIZE * sizeof(u32); + u32 *buf; + int rc; + + buf = kzalloc(size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + rc = amd_pmc_read_stb(dev, buf); + if (rc) { + kfree(buf); + return rc; + } + + filp->private_data = buf; + return rc; +} + +static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, size_t size, + loff_t *pos) +{ + if (!filp->private_data) + return -EINVAL; + + return simple_read_from_buffer(buf, size, pos, filp->private_data, + FIFO_SIZE * sizeof(u32)); +} + +static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) +{ + kfree(filp->private_data); + return 0; +} + +static const struct file_operations amd_pmc_stb_debugfs_fops = { + .owner = THIS_MODULE, + .open = amd_pmc_stb_debugfs_open, + .read = amd_pmc_stb_debugfs_read, + .release = amd_pmc_stb_debugfs_release, +}; + +/* Enhanced STB Firmware Reporting Mechanism */ +static int amd_pmc_stb_handle_efr(struct file *filp) +{ + struct amd_pmc_dev *dev = filp->f_inode->i_private; + struct amd_pmc_stb_v2_data *stb_data_arr; + u32 fsize; + + fsize = dev->dram_size - S2D_RSVD_RAM_SPACE; + stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); + if (!stb_data_arr) + return -ENOMEM; + + stb_data_arr->size = fsize; + memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr, fsize); + filp->private_data = stb_data_arr; + + return 0; +} + +static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp) +{ + struct amd_pmc_dev *dev = filp->f_inode->i_private; + u32 fsize, num_samples, val, stb_rdptr_offset = 0; + struct amd_pmc_stb_v2_data *stb_data_arr; + int ret; + + /* Write dummy postcode while reading the STB buffer */ + ret = amd_pmc_write_stb(dev, AMD_PMC_STB_DUMMY_PC); + if (ret) + dev_err(dev->dev, "error writing to STB: %d\n", ret); + + /* Spill to DRAM num_samples uses separate SMU message port */ + dev->msg_port = 1; + + ret = amd_pmc_send_cmd(dev, 0, &val, STB_FORCE_FLUSH_DATA, 1); + if (ret) + dev_dbg_once(dev->dev, "S2D force flush not supported: %d\n", ret); + + /* + * We have a custom stb size and the PMFW is supposed to give + * the enhanced dram size. Note that we land here only for the + * platforms that support enhanced dram size reporting. + */ + if (dump_custom_stb) + return amd_pmc_stb_handle_efr(filp); + + /* Get the num_samples to calculate the last push location */ + ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true); + /* Clear msg_port for other SMU operation */ + dev->msg_port = 0; + if (ret) { + dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret); + return ret; + } + + fsize = min(num_samples, S2D_TELEMETRY_BYTES_MAX); + stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); + if (!stb_data_arr) + return -ENOMEM; + + stb_data_arr->size = fsize; + + /* + * Start capturing data from the last push location. + * This is for general cases, where the stb limits + * are meant for standard usage. + */ + if (num_samples > S2D_TELEMETRY_BYTES_MAX) { + /* First read oldest data starting 1 behind last write till end of ringbuffer */ + stb_rdptr_offset = num_samples % S2D_TELEMETRY_BYTES_MAX; + fsize = S2D_TELEMETRY_BYTES_MAX - stb_rdptr_offset; + + memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr + stb_rdptr_offset, fsize); + /* Second copy the newer samples from offset 0 - last write */ + memcpy_fromio(stb_data_arr->data + fsize, dev->stb_virt_addr, stb_rdptr_offset); + } else { + memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr, fsize); + } + + filp->private_data = stb_data_arr; + + return 0; +} + +static ssize_t amd_pmc_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size, + loff_t *pos) +{ + struct amd_pmc_stb_v2_data *data = filp->private_data; + + return simple_read_from_buffer(buf, size, pos, data->data, data->size); +} + +static int amd_pmc_stb_debugfs_release_v2(struct inode *inode, struct file *filp) +{ + kfree(filp->private_data); + return 0; +} + +static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { + .owner = THIS_MODULE, + .open = amd_pmc_stb_debugfs_open_v2, + .read = amd_pmc_stb_debugfs_read_v2, + .release = amd_pmc_stb_debugfs_release_v2, +}; + +static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev) +{ + switch (dev->cpu_id) { + case AMD_CPU_ID_YC: + case AMD_CPU_ID_CB: + dev->s2d_msg_id = 0xBE; + return true; + case AMD_CPU_ID_PS: + dev->s2d_msg_id = 0x85; + return true; + case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: + case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: + dev->s2d_msg_id = 0xDE; + return true; + default: + return false; + } +} + +int amd_pmc_s2d_init(struct amd_pmc_dev *dev) +{ + u32 phys_addr_low, phys_addr_hi; + u64 stb_phys_addr; + u32 size = 0; + int ret; + + if (!enable_stb) + return 0; + + if (amd_pmc_is_stb_supported(dev)) + debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, + &amd_pmc_stb_debugfs_fops_v2); + else + debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, + &amd_pmc_stb_debugfs_fops); + + /* Spill to DRAM feature uses separate SMU message port */ + dev->msg_port = 1; + + amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true); + if (size != S2D_TELEMETRY_BYTES_MAX) + return -EIO; + + /* Get DRAM size */ + ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true); + if (ret || !dev->dram_size) + dev->dram_size = S2D_TELEMETRY_DRAMBYTES_MAX; + + /* Get STB DRAM address */ + amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, dev->s2d_msg_id, true); + amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, dev->s2d_msg_id, true); + + stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); + + /* Clear msg_port for other SMU operation */ + dev->msg_port = 0; + + dev->stb_virt_addr = devm_ioremap(dev->dev, stb_phys_addr, dev->dram_size); + if (!dev->stb_virt_addr) + return -ENOMEM; + + return 0; +} diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index bbb8edb62e00..a977ff1e52b5 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -44,20 +44,6 @@ #define AMD_PMC_STB_S2IDLE_PREPARE 0xC6000001 #define AMD_PMC_STB_S2IDLE_RESTORE 0xC6000002 #define AMD_PMC_STB_S2IDLE_CHECK 0xC6000003 -#define AMD_PMC_STB_DUMMY_PC 0xC6000007 - -/* STB S2D(Spill to DRAM) has different message port offset */ -#define AMD_S2D_REGISTER_MESSAGE 0xA20 -#define AMD_S2D_REGISTER_RESPONSE 0xA80 -#define AMD_S2D_REGISTER_ARGUMENT 0xA88 - -/* STB Spill to DRAM Parameters */ -#define S2D_TELEMETRY_BYTES_MAX 0x100000U -#define S2D_RSVD_RAM_SPACE 0x100000 -#define S2D_TELEMETRY_DRAMBYTES_MAX 0x1000000 - -/* STB Spill to DRAM Message Definition */ -#define STB_FORCE_FLUSH_DATA 0xCF /* Base address of SMU for mapping physical address to virtual address */ #define AMD_PMC_MAPPING_SIZE 0x01000 @@ -97,7 +83,6 @@ #define DELAY_MIN_US 2000 #define DELAY_MAX_US 3000 -#define FIFO_SIZE 4096 enum amd_pmc_def { MSG_TEST = 0x01, @@ -105,19 +90,6 @@ enum amd_pmc_def { MSG_OS_HINT_RN, }; -enum s2d_arg { - S2D_TELEMETRY_SIZE = 0x01, - S2D_PHYS_ADDR_LOW, - S2D_PHYS_ADDR_HIGH, - S2D_NUM_SAMPLES, - S2D_DRAM_SIZE, -}; - -struct amd_pmc_stb_v2_data { - size_t size; - u8 data[] __counted_by(size); -}; - struct amd_pmc_bit_map { const char *name; u32 bit_mask; @@ -149,22 +121,11 @@ static const struct amd_pmc_bit_map soc15_ip_blk[] = { {} }; -static bool enable_stb; -module_param(enable_stb, bool, 0644); -MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism"); - static bool disable_workarounds; module_param(disable_workarounds, bool, 0644); MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bugs"); -static bool dump_custom_stb; -module_param(dump_custom_stb, bool, 0644); -MODULE_PARM_DESC(dump_custom_stb, "Enable to dump full STB buffer"); - static struct amd_pmc_dev pmc; -static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret); -static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf); -static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) { @@ -193,155 +154,6 @@ struct smu_metrics { u64 timecondition_notmet_totaltime[32]; } __packed; -static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) -{ - struct amd_pmc_dev *dev = filp->f_inode->i_private; - u32 size = FIFO_SIZE * sizeof(u32); - u32 *buf; - int rc; - - buf = kzalloc(size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - rc = amd_pmc_read_stb(dev, buf); - if (rc) { - kfree(buf); - return rc; - } - - filp->private_data = buf; - return rc; -} - -static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, size_t size, - loff_t *pos) -{ - if (!filp->private_data) - return -EINVAL; - - return simple_read_from_buffer(buf, size, pos, filp->private_data, - FIFO_SIZE * sizeof(u32)); -} - -static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) -{ - kfree(filp->private_data); - return 0; -} - -static const struct file_operations amd_pmc_stb_debugfs_fops = { - .owner = THIS_MODULE, - .open = amd_pmc_stb_debugfs_open, - .read = amd_pmc_stb_debugfs_read, - .release = amd_pmc_stb_debugfs_release, -}; - -/* Enhanced STB Firmware Reporting Mechanism */ -static int amd_pmc_stb_handle_efr(struct file *filp) -{ - struct amd_pmc_dev *dev = filp->f_inode->i_private; - struct amd_pmc_stb_v2_data *stb_data_arr; - u32 fsize; - - fsize = dev->dram_size - S2D_RSVD_RAM_SPACE; - stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); - if (!stb_data_arr) - return -ENOMEM; - - stb_data_arr->size = fsize; - memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr, fsize); - filp->private_data = stb_data_arr; - - return 0; -} - -static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp) -{ - struct amd_pmc_dev *dev = filp->f_inode->i_private; - u32 fsize, num_samples, val, stb_rdptr_offset = 0; - struct amd_pmc_stb_v2_data *stb_data_arr; - int ret; - - /* Write dummy postcode while reading the STB buffer */ - ret = amd_pmc_write_stb(dev, AMD_PMC_STB_DUMMY_PC); - if (ret) - dev_err(dev->dev, "error writing to STB: %d\n", ret); - - /* Spill to DRAM num_samples uses separate SMU message port */ - dev->msg_port = 1; - - ret = amd_pmc_send_cmd(dev, 0, &val, STB_FORCE_FLUSH_DATA, 1); - if (ret) - dev_dbg_once(dev->dev, "S2D force flush not supported: %d\n", ret); - - /* - * We have a custom stb size and the PMFW is supposed to give - * the enhanced dram size. Note that we land here only for the - * platforms that support enhanced dram size reporting. - */ - if (dump_custom_stb) - return amd_pmc_stb_handle_efr(filp); - - /* Get the num_samples to calculate the last push location */ - ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true); - /* Clear msg_port for other SMU operation */ - dev->msg_port = 0; - if (ret) { - dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret); - return ret; - } - - fsize = min(num_samples, S2D_TELEMETRY_BYTES_MAX); - stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); - if (!stb_data_arr) - return -ENOMEM; - - stb_data_arr->size = fsize; - - /* - * Start capturing data from the last push location. - * This is for general cases, where the stb limits - * are meant for standard usage. - */ - if (num_samples > S2D_TELEMETRY_BYTES_MAX) { - /* First read oldest data starting 1 behind last write till end of ringbuffer */ - stb_rdptr_offset = num_samples % S2D_TELEMETRY_BYTES_MAX; - fsize = S2D_TELEMETRY_BYTES_MAX - stb_rdptr_offset; - - memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr + stb_rdptr_offset, fsize); - /* Second copy the newer samples from offset 0 - last write */ - memcpy_fromio(stb_data_arr->data + fsize, dev->stb_virt_addr, stb_rdptr_offset); - } else { - memcpy_fromio(stb_data_arr->data, dev->stb_virt_addr, fsize); - } - - filp->private_data = stb_data_arr; - - return 0; -} - -static ssize_t amd_pmc_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size, - loff_t *pos) -{ - struct amd_pmc_stb_v2_data *data = filp->private_data; - - return simple_read_from_buffer(buf, size, pos, data->data, data->size); -} - -static int amd_pmc_stb_debugfs_release_v2(struct inode *inode, struct file *filp) -{ - kfree(filp->private_data); - return 0; -} - -static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { - .owner = THIS_MODULE, - .open = amd_pmc_stb_debugfs_open_v2, - .read = amd_pmc_stb_debugfs_read_v2, - .release = amd_pmc_stb_debugfs_release_v2, -}; - static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev) { switch (dev->cpu_id) { @@ -350,18 +162,15 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev) case AMD_CPU_ID_YC: case AMD_CPU_ID_CB: dev->num_ips = 12; - dev->s2d_msg_id = 0xBE; dev->smu_msg = 0x538; break; case AMD_CPU_ID_PS: dev->num_ips = 21; - dev->s2d_msg_id = 0x85; dev->smu_msg = 0x538; break; case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: dev->num_ips = 22; - dev->s2d_msg_id = 0xDE; dev->smu_msg = 0x938; break; } @@ -625,20 +434,6 @@ static void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) debugfs_remove_recursive(dev->dbgfs_dir); } -static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev) -{ - switch (dev->cpu_id) { - case AMD_CPU_ID_YC: - case AMD_CPU_ID_CB: - case AMD_CPU_ID_PS: - case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: - case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: - return true; - default: - return false; - } -} - static void amd_pmc_dbgfs_register(struct amd_pmc_dev *dev) { dev->dbgfs_dir = debugfs_create_dir("amd_pmc", NULL); @@ -648,15 +443,6 @@ static void amd_pmc_dbgfs_register(struct amd_pmc_dev *dev) &s0ix_stats_fops); debugfs_create_file("amd_pmc_idlemask", 0644, dev->dbgfs_dir, dev, &amd_pmc_idlemask_fops); - /* Enable STB only when the module_param is set */ - if (enable_stb) { - if (amd_pmc_is_stb_supported(dev)) - debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, - &amd_pmc_stb_debugfs_fops_v2); - else - debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, - &amd_pmc_stb_debugfs_fops); - } } static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) @@ -683,7 +469,7 @@ static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) dev_dbg(dev->dev, "AMD_%s_REGISTER_MESSAGE:%x\n", dev->msg_port ? "S2D" : "PMC", value); } -static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret) +int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret) { int rc; u32 val, message, argument, response; @@ -975,69 +761,6 @@ static const struct pci_device_id pmc_pci_ids[] = { { } }; -static int amd_pmc_s2d_init(struct amd_pmc_dev *dev) -{ - u32 phys_addr_low, phys_addr_hi; - u64 stb_phys_addr; - u32 size = 0; - int ret; - - /* Spill to DRAM feature uses separate SMU message port */ - dev->msg_port = 1; - - amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true); - if (size != S2D_TELEMETRY_BYTES_MAX) - return -EIO; - - /* Get DRAM size */ - ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true); - if (ret || !dev->dram_size) - dev->dram_size = S2D_TELEMETRY_DRAMBYTES_MAX; - - /* Get STB DRAM address */ - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, dev->s2d_msg_id, true); - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, dev->s2d_msg_id, true); - - stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); - - /* Clear msg_port for other SMU operation */ - dev->msg_port = 0; - - dev->stb_virt_addr = devm_ioremap(dev->dev, stb_phys_addr, dev->dram_size); - if (!dev->stb_virt_addr) - return -ENOMEM; - - return 0; -} - -static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) -{ - int err; - - err = amd_smn_write(0, AMD_PMC_STB_PMI_0, data); - if (err) { - dev_err(dev->dev, "failed to write data in stb: 0x%X\n", AMD_PMC_STB_PMI_0); - return pcibios_err_to_errno(err); - } - - return 0; -} - -static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) -{ - int i, err; - - for (i = 0; i < FIFO_SIZE; i++) { - err = amd_smn_read(0, AMD_PMC_STB_PMI_0, buf++); - if (err) { - dev_err(dev->dev, "error reading data from stb: 0x%X\n", AMD_PMC_STB_PMI_0); - return pcibios_err_to_errno(err); - } - } - - return 0; -} - static int amd_pmc_probe(struct platform_device *pdev) { struct amd_pmc_dev *dev = &pmc; @@ -1095,12 +818,6 @@ static int amd_pmc_probe(struct platform_device *pdev) /* Get num of IP blocks within the SoC */ amd_pmc_get_ip_info(dev); - if (enable_stb && amd_pmc_is_stb_supported(dev)) { - err = amd_pmc_s2d_init(dev); - if (err) - goto err_pci_dev_put; - } - platform_set_drvdata(pdev, dev); if (IS_ENABLED(CONFIG_SUSPEND)) { err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops); @@ -1111,6 +828,10 @@ static int amd_pmc_probe(struct platform_device *pdev) } amd_pmc_dbgfs_register(dev); + err = amd_pmc_s2d_init(dev); + if (err) + goto err_pci_dev_put; + if (IS_ENABLED(CONFIG_AMD_MP2_STB)) amd_mp2_stb_init(dev); pm_report_max_hw_sleep(U64_MAX); diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h index f1166d15c856..07fcb13a4136 100644 --- a/drivers/platform/x86/amd/pmc/pmc.h +++ b/drivers/platform/x86/amd/pmc/pmc.h @@ -70,4 +70,13 @@ void amd_mp2_stb_deinit(struct amd_pmc_dev *dev); #define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122 #define PCI_DEVICE_ID_AMD_MP2_STB 0x172c +/* STB S2D(Spill to DRAM) has different message port offset */ +#define AMD_S2D_REGISTER_MESSAGE 0xA20 +#define AMD_S2D_REGISTER_RESPONSE 0xA80 +#define AMD_S2D_REGISTER_ARGUMENT 0xA88 + +int amd_pmc_s2d_init(struct amd_pmc_dev *dev); +int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); +int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret); + #endif /* PMC_H */ From patchwork Mon Oct 28 07:04:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853088 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2063.outbound.protection.outlook.com [40.107.237.63]) (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 7EF4616C684 for ; Mon, 28 Oct 2024 07:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099116; cv=fail; b=LxQ/2/cOE2TgXWBHDZOeeASBierhtBKJhO7m5/psDyKfwO9yB9GN5EOQ1UM1YA13gAjf/vPOSRaS07mlRz5l0YxkOFvb4BDTcvJBWw2ou1m4b+sX5hbs4oc1hVEqZjjf1vkzSh/cBS2mEyKPLshKCGHnNeH188PxcaaloJFbyI8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099116; c=relaxed/simple; bh=3Dq2YdLouN7R/wW8GlPTlxC+WLVrDJvTltPxwwKUJbM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hPpGcB26brChzYlbSOcWrGLmTZysKORvfwNJbopxq0jC8jkWg0+TnDcHbzO8my/wW48TfzIqxHknPC/2qoxJdw+kpRTVuV7YZAJElISPBgjwRyIrFtehRejb14bQLchaGO1qA2GBD9kZEPpGUBRKwOO7jN1mDT7M2km+cZYsVQQ= 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=K5Fr4i4N; arc=fail smtp.client-ip=40.107.237.63 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="K5Fr4i4N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cUw+I3t4yh/zfk9t6sMKJtecaQo7o7vIIWXvuXdZUGk6CWkmJ0HrrGKW2xIEqjQJPTRJ3qufsFotx9s/agCIJoDwy129QdZtnjSJ1iKqtdajDqkH9KcMdTkTB0JZQeGb3BbHzjGXCF1fz988QPVCRkj2oJdFEgUm2ZHSXz49q2dD7YvjZhRq3fci+39bhCOA/JjmBGScYmdXQD2m7c2BWKU31zQsBlPSTFfKsH9AuAvpWNXta9SKffFCX+mnMJO75tMUYkLwBw//AlGXbrSePV8Qdu39aqIU/0LRcOZH16Da2JvtXMoHcnFwcdjOpczm8UAbfdPZKEIbsewYn20omQ== 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=JTBV++Fg6ajMCxcHx2JhQ+ZdXlihJAEHacoGovkwTf4=; b=tQ9vqyzxLHeQTqNLx7OqMoxGVxDsrEx090aXgKJlqhvDtFzg+G6vxwA36+8GMn9upXox2mu4+ejdcjeGVpXxf9/941SrxLLUtY3LlKLx2ZuTtuIIfBPZxHRgbVglfDP1OuFJmhi1t0YoFvjf76D6Wxh5G7ZQD0+Kv0Ju40nwzcaThMF3c5doWeyn5lsiStvlumuydsw4dzmmZ9u0bMt3CP/NlcjyH7uxZn7IO5Ck6d5REhoLnN9+qgqsaQ4Rj+QTW8NtqXPRJqHKFFDPnK28hR/m7azyDn5SLy8TvRCqwyVD9MelF88CiiZAzaXz+kIzhYeBf8WMO5Eir62Dnn5x9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=JTBV++Fg6ajMCxcHx2JhQ+ZdXlihJAEHacoGovkwTf4=; b=K5Fr4i4N98KbKE1FN/4hp+s7HGBO8QS10d+GKmSFjqAr83dFodgPjBStHw6L3DaCRO4sL9Lbvjmx1MKHlnDnlKHGy1LZ2ldcHEA/+IIu/eXm11OrVvZ+H9OLKRGzk9w6qRTx+ffPO7gMwV61LRGsTHcJXr5ykkZGoqEuHYuYuj0= Received: from MW4P223CA0020.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::25) by LV8PR12MB9208.namprd12.prod.outlook.com (2603:10b6:408:182::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Mon, 28 Oct 2024 07:05:07 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:303:80:cafe::1a) by MW4P223CA0020.outlook.office365.com (2603:10b6:303:80::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.26 via Frontend Transport; Mon, 28 Oct 2024 07:05:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:07 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:04 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 2/8] platform/x86/amd/pmc: Update function names to align with new STB file Date: Mon, 28 Oct 2024 12:34:32 +0530 Message-ID: <20241028070438.1548737-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|LV8PR12MB9208:EE_ X-MS-Office365-Filtering-Correlation-Id: ce73bcdf-efb2-43e8-c25e-08dcf71edadd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: 5yWALSgnR70TC+dVXD4BouKi2T+73gru+PyCg2/FZEtN0NfmdictN7nN/esvn6gD7OKmeW1TgR9UhPkxaZekYjsVYQM8O/Vps03RTzTXJ79OhFxAYnncvbKJlxovbegbtyFxPSxYIRXBOsa7uPxmjoaZ2yDcxjkZd/yWX8aXDHA7tVllbd3jAVPN3iVKlvgQUXiPbxJhBtSyQdRQ9YxkeKPYk1ttsFh5US2tKkgzqpCLg6P0T0SQWGvA7VlLv04LAN5IEGupd2y63j0HcXlfcjHWCdHwoC4m2h/OgERLQoYK0JXzD/uQyhggzGghPQSk/JIT/fPh/CVhECU3BZFrvWeJnIfPU78x8DkSFEgOU2DDPvQP/cNhUMDrtT/Ejfp48vMvyFdqRnQUq86hTsRj6s5OSUCrZ9fBJExQA5GaFz+ivYCck6ssbovMIe6VfkzLbvCf9X7PkPjpBqs946DqtChq7RQ9pDK6jiSzYk/zDe5lPkV+r3/3oeWX15MttjN06WsogThiADXDi7m5s4lgqesXYuk7I1eqqvkH/P+eTe5ZhF+4t6RSKPbIh+F7Bry+MSpsqw5HPy4shAiFarERzqr4zg7zQVO781B/AHYhC9GWfEGpOC1JT3Ge8NMWlgME8KAT1HdPRhTGrexnryaHLrJGfZXOj+fRQ3Z2QPM9r6qPwoad0I70qHzrG9508b72HqRDYIKkL8KcevQVOlZZpoCCz0/kFxwwnWLGTCSQGasdtlaulZliyJcwTOY2F5G0np2wejWtqKx3CdfvIPXz+Drs+J1myyAAfuLclbqFtZB/5CfgpWGd22AR/JNKDiF7BCLxMCNQIvc1tThhopbR8YWe0APDLQQTwsWZMmoYib6rbAZZZvHiVC52ZUDLX7WFD3wQZcr4nT/XuA5nJwcvA80y+Z6eZe/cH0tdv8lBIa+Xm8FTPsLzw0Mh9qsHCII9+GNUmrx1Az+U+BMbUTKsV/nNXfMgjOTvwSs/00RZuuNcLdcb0+pPb1KGa3S05CuFIFIuhJhyHgFXcGz9sRTGbvCzebzgZS5c5j67g6YNFZzqfYjf9iefSt/RXmBzDoqOenprJ0g9I/jjia+H/M64/zzU7/R/oAf2adt/6nrZtoeq0GUMhig5zCsrhukwBfVq1RDCzQhTzc8cFReD0Ysnp9o2eMNx267SKZAKBBxawn2DrfjvJarjkniDacgrsxNskr6plk+FuO1MzDNYu6y2ev8Bv5lZlp3nRBLP4cotCMe2uwI9VxApjhmtAjZ7YEy/KJQgAdcKbJ4ZZO7IOnXdIruUuMyJ8usLMHBJaS0XWk/Oa9g1bQku0lhAbpt6q3jr40u0OyLCI0TLjivsuM0x5N/bXdkj1raFne+IHFSFGuh0GX0VwsEiY4DSRye+BhoARyD7Rs75MF2mohM6e7lM1Q== 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)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:07.1251 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce73bcdf-efb2-43e8-c25e-08dcf71edadd 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9208 With STB now in a separate file, update the function names to match the correct naming schema by removing the _pmc_ prefix where needed. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/mp1_stb.c | 61 +++++++++++++------------- drivers/platform/x86/amd/pmc/pmc.c | 8 ++-- drivers/platform/x86/amd/pmc/pmc.h | 4 +- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 9a34dd94982c..5efec020ecac 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -47,12 +47,12 @@ enum s2d_arg { S2D_DRAM_SIZE, }; -struct amd_pmc_stb_v2_data { +struct amd_stb_v2_data { size_t size; u8 data[] __counted_by(size); }; -int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) +int amd_write_stb(struct amd_pmc_dev *dev, u32 data) { int err; @@ -65,7 +65,7 @@ int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) return 0; } -static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) +static int amd_read_stb(struct amd_pmc_dev *dev, u32 *buf) { int i, err; @@ -81,7 +81,7 @@ static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) return 0; } -static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) +static int amd_stb_debugfs_open(struct inode *inode, struct file *filp) { struct amd_pmc_dev *dev = filp->f_inode->i_private; u32 size = FIFO_SIZE * sizeof(u32); @@ -92,7 +92,7 @@ static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) if (!buf) return -ENOMEM; - rc = amd_pmc_read_stb(dev, buf); + rc = amd_read_stb(dev, buf); if (rc) { kfree(buf); return rc; @@ -102,8 +102,7 @@ static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) return rc; } -static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, size_t size, - loff_t *pos) +static ssize_t amd_stb_debugfs_read(struct file *filp, char __user *buf, size_t size, loff_t *pos) { if (!filp->private_data) return -EINVAL; @@ -112,24 +111,24 @@ static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, siz FIFO_SIZE * sizeof(u32)); } -static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) +static int amd_stb_debugfs_release(struct inode *inode, struct file *filp) { kfree(filp->private_data); return 0; } -static const struct file_operations amd_pmc_stb_debugfs_fops = { +static const struct file_operations amd_stb_debugfs_fops = { .owner = THIS_MODULE, - .open = amd_pmc_stb_debugfs_open, - .read = amd_pmc_stb_debugfs_read, - .release = amd_pmc_stb_debugfs_release, + .open = amd_stb_debugfs_open, + .read = amd_stb_debugfs_read, + .release = amd_stb_debugfs_release, }; /* Enhanced STB Firmware Reporting Mechanism */ -static int amd_pmc_stb_handle_efr(struct file *filp) +static int amd_stb_handle_efr(struct file *filp) { struct amd_pmc_dev *dev = filp->f_inode->i_private; - struct amd_pmc_stb_v2_data *stb_data_arr; + struct amd_stb_v2_data *stb_data_arr; u32 fsize; fsize = dev->dram_size - S2D_RSVD_RAM_SPACE; @@ -144,15 +143,15 @@ static int amd_pmc_stb_handle_efr(struct file *filp) return 0; } -static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp) +static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp) { struct amd_pmc_dev *dev = filp->f_inode->i_private; u32 fsize, num_samples, val, stb_rdptr_offset = 0; - struct amd_pmc_stb_v2_data *stb_data_arr; + struct amd_stb_v2_data *stb_data_arr; int ret; /* Write dummy postcode while reading the STB buffer */ - ret = amd_pmc_write_stb(dev, AMD_PMC_STB_DUMMY_PC); + ret = amd_write_stb(dev, AMD_PMC_STB_DUMMY_PC); if (ret) dev_err(dev->dev, "error writing to STB: %d\n", ret); @@ -169,7 +168,7 @@ static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp) * platforms that support enhanced dram size reporting. */ if (dump_custom_stb) - return amd_pmc_stb_handle_efr(filp); + return amd_stb_handle_efr(filp); /* Get the num_samples to calculate the last push location */ ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true); @@ -209,28 +208,28 @@ static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp) return 0; } -static ssize_t amd_pmc_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size, - loff_t *pos) +static ssize_t amd_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size, + loff_t *pos) { - struct amd_pmc_stb_v2_data *data = filp->private_data; + struct amd_stb_v2_data *data = filp->private_data; return simple_read_from_buffer(buf, size, pos, data->data, data->size); } -static int amd_pmc_stb_debugfs_release_v2(struct inode *inode, struct file *filp) +static int amd_stb_debugfs_release_v2(struct inode *inode, struct file *filp) { kfree(filp->private_data); return 0; } -static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { +static const struct file_operations amd_stb_debugfs_fops_v2 = { .owner = THIS_MODULE, - .open = amd_pmc_stb_debugfs_open_v2, - .read = amd_pmc_stb_debugfs_read_v2, - .release = amd_pmc_stb_debugfs_release_v2, + .open = amd_stb_debugfs_open_v2, + .read = amd_stb_debugfs_read_v2, + .release = amd_stb_debugfs_release_v2, }; -static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev) +static bool amd_is_stb_supported(struct amd_pmc_dev *dev) { switch (dev->cpu_id) { case AMD_CPU_ID_YC: @@ -249,7 +248,7 @@ static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev) } } -int amd_pmc_s2d_init(struct amd_pmc_dev *dev) +int amd_s2d_init(struct amd_pmc_dev *dev) { u32 phys_addr_low, phys_addr_hi; u64 stb_phys_addr; @@ -259,12 +258,12 @@ int amd_pmc_s2d_init(struct amd_pmc_dev *dev) if (!enable_stb) return 0; - if (amd_pmc_is_stb_supported(dev)) + if (amd_is_stb_supported(dev)) debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, - &amd_pmc_stb_debugfs_fops_v2); + &amd_stb_debugfs_fops_v2); else debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev, - &amd_pmc_stb_debugfs_fops); + &amd_stb_debugfs_fops); /* Spill to DRAM feature uses separate SMU message port */ dev->msg_port = 1; diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index a977ff1e52b5..8e7c87505327 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -667,7 +667,7 @@ static void amd_pmc_s2idle_prepare(void) return; } - rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_PREPARE); + rc = amd_write_stb(pdev, AMD_PMC_STB_S2IDLE_PREPARE); if (rc) dev_err(pdev->dev, "error writing to STB: %d\n", rc); } @@ -686,7 +686,7 @@ static void amd_pmc_s2idle_check(void) /* Dump the IdleMask before we add to the STB */ amd_pmc_idlemask_read(pdev, pdev->dev, NULL); - rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_CHECK); + rc = amd_write_stb(pdev, AMD_PMC_STB_S2IDLE_CHECK); if (rc) dev_err(pdev->dev, "error writing to STB: %d\n", rc); } @@ -713,7 +713,7 @@ static void amd_pmc_s2idle_restore(void) /* Let SMU know that we are looking for stats */ amd_pmc_dump_data(pdev); - rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_RESTORE); + rc = amd_write_stb(pdev, AMD_PMC_STB_S2IDLE_RESTORE); if (rc) dev_err(pdev->dev, "error writing to STB: %d\n", rc); @@ -828,7 +828,7 @@ static int amd_pmc_probe(struct platform_device *pdev) } amd_pmc_dbgfs_register(dev); - err = amd_pmc_s2d_init(dev); + err = amd_s2d_init(dev); if (err) goto err_pci_dev_put; diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h index 07fcb13a4136..7e7f9170124c 100644 --- a/drivers/platform/x86/amd/pmc/pmc.h +++ b/drivers/platform/x86/amd/pmc/pmc.h @@ -75,8 +75,8 @@ void amd_mp2_stb_deinit(struct amd_pmc_dev *dev); #define AMD_S2D_REGISTER_RESPONSE 0xA80 #define AMD_S2D_REGISTER_ARGUMENT 0xA88 -int amd_pmc_s2d_init(struct amd_pmc_dev *dev); -int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); +int amd_s2d_init(struct amd_pmc_dev *dev); +int amd_write_stb(struct amd_pmc_dev *dev, u32 data); int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret); #endif /* PMC_H */ From patchwork Mon Oct 28 07:04:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853089 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.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 EC60518FC8C for ; Mon, 28 Oct 2024 07:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099116; cv=fail; b=ibL8enyES1MAi+JznQnmJ8YuQHwDhMXUD6bqQAKpv/Q88ATabOOvF6Y8uo4l2nP0Ps0wILHSt+a+K6UNfz5VG0osDckXLK9b2yse5cKDcACAVfwsRfAmH4AQJ+UNP4UfLDpiQWehNUQ34CVMTYbLxMfigwdTiHR0KNIHlU13J9w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099116; c=relaxed/simple; bh=Jm6ZCB/sX4tmFnbmu3P8M5KvM6G60SfcB5N6BPdVLzU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B/QED7Ti2539IGWN0sVVnXXZYiikHDEBH2I16cx5Bs3E5HvTe1rLnyK+qzTT8/9zR7px/U6unYkklv8+619Cpavh3mE0D5Ii7YKCVL2tbtJIjYYZNnERmtefsZSkDhjixABmJwBdJeD2lDn93x5JRGhtxKxlwFZZ4ljbNNO4WNA= 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=KBN5DgAf; arc=fail smtp.client-ip=40.107.244.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="KBN5DgAf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bYkI6+kTHccOb+53scIby0VkbnMvHiKnpplzTu6WltHMhTgWDZmLNUkKx/ffYru8TG7tEzIJwAZMZgxHLxQaWjq+WIzMHjSY5oCxK78UEb1WmFqMTXNloS2vKmviMfBWGZ/GIB/4ncUT7A0Ba8Tm+Dm6qiWxirlbYDZI+EgZuH8qffbysuwHT7tnpH1guggoXgN7aLTeZxUXARzZHMGx5kEWff1VgeUl53yN8VMIoXM0BH6dnlh1I6WQqu4KFfLm0Sgb5DRgHw3sPyqiQrL7ZC/cnhwzrRR7AlbmgM5RWM+9DqIlO3fuvijldQE5fCD44hjgiLbcuoZWxWAXAlsLbw== 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=RiJDdqrr58YH2pNIgZga7qSfrthhGg1oqPUZVX8vdiw=; b=q3p9E9XxcxpzFIexHQvaWutR19eXx272BFtL5dJ7ttRPYGnDarJcxk5mw7QGjKDtrnOtNzjw7BITteCOTlWxnQU0QTzaPp6vcsnTHHDi/5lWFT/mcCSk77jCIcyPUBPHTtqgR81UTwhSe2nbDA8PzcAm9eUpt/uvGNEVNje7yThUfzuNKgyHFRk3e0PP/Rbx/htp/8zD13cmcQ/HLcsoPhtLVFZmOo0R11PpxqILX+97dny3hUDapCJGkLi0G2G6BMFKLUVC/9cTE7XirwJsUyAcjVtfMHSTnRPBPc+2K7Xd2StGuywf2npHknLlGtmHZN3zVHUcaC/kS0k/3/xNbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=RiJDdqrr58YH2pNIgZga7qSfrthhGg1oqPUZVX8vdiw=; b=KBN5DgAfg9aKkUF+4FCNVQSbcbPYfRMNYcoe6HWZBdKVSzdD8nr6VDrjtZtkHeER4XWySpsaeDufilqymDoXpPFhSJQjTKv+CtnawSeEkNH91jLvMgGZ5C/huG1HaZSuDzgeWa9GCvxiTivDUOyWMLI4IKLpBX48zcaJ3LeDr1M= Received: from SJ0PR03CA0122.namprd03.prod.outlook.com (2603:10b6:a03:33c::7) by MW4PR12MB5604.namprd12.prod.outlook.com (2603:10b6:303:18d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 07:05:11 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::8) by SJ0PR03CA0122.outlook.office365.com (2603:10b6:a03:33c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 07:05:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:11 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:06 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 3/8] platform/x86/amd/pmc: Define enum for S2D/PMC msg_port Date: Mon, 28 Oct 2024 12:34:33 +0530 Message-ID: <20241028070438.1548737-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|MW4PR12MB5604:EE_ X-MS-Office365-Filtering-Correlation-Id: 40338d48-ef3c-4db8-cdd7-08dcf71edd31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: WjX6kC1U5qxcIO9BxanwWcJTO1oT3s73vboX8+nVPMruoU5jW5q+zvpT4DA5tsEPkGB1wd5sGoNZjgdBHZEK8kB/q6mUFs2/i5geI+rU2djTBe5bJw/rtaeWB6W1205UFBqeIo9hgVTefEPFeLT0Aed0Y4lRoSAT+xG4Uw5rFkzO45cMNPbB+Oh1w9yT8WbEmcfYV+OfcTOi0UJxIwzeiLkda1HgvJOrgXnoIaa7t5Hif7ZFa42e26npH/PUEjdoCeMTA44KdKVENoICgVttyBMCEHhMAFCbNa7zCu8qQFVMo9yWPUJfKm5oibUz1zqQCEdLuH9Nca1qqZVKhv9++LADBY8dowlvB3vD1wWkqAodqgLogqGKqe5K8JawZO3Kzo+uOv7STRXz0Ys81+QcO1ZiYMm0zC5KpsBauA+OUbPBJO7BHFcP8NyVjAsHClT6K9JEpoZmrNXWfKC6liwxs1J9Aagqo0Gnt5OM0bVunieAGv+yrE8AMP3QPrpoC4eeDjQyymC6B0qME1p4uzJsho7lGVQCAtWMsBiShRh1tJHhEF39eRYyvyLIlo/JxaaQ3XfDR4IhmcXBlmr7Mw9TCjKs/eGrCf/a640+XwVJZ54uRd0tlSJrI0ctOsa2pzq0IlF4W1dV113TvmzJYBKHk7m1JGBFrCShlZ3MwUpeH3sl5khPYmsNUbs/cIGe+DnHVrQkWgSZ78CkP7zEJeECGJxav+jpLsIaZnHJxl0mWqiHtKjhunVxOpE0Vra4qqvdAbCT++NqPR6dPM1wyHxithvGmmT1Lw65HxTnaY8G00ZFfXA1BXUGF1pt0650eEApD+RVp5LD2sbvJXG+EeArjpFhJ7umMnCsx6/QHCpfha1SZBoAG/fxonWrasLJIaYzag3vTWCqiv86NNRzgzkEZ0t64bTU1CbUiaIqe6COwXLHTgTkJlk5YQpmLLy0DTxdzXZgUSSFGrACtUhWuG/7mRzArbFditoLir9Qtqn3XQ2+PeTClPd1nEiAIBfjH/uzgp7+LJGiHtAASMkhQjK2AkrAmSn+gfYjqzFsjDkHcaZ36CMveMy6L4/jRhD0dZmmeFZQs0dtufYc7yEIkYBRMCSaX2ExczGOtaiYzAYiaBM4xDCToOKMQWv11VRL2L+pCMs61Mz7xUMBWvJ/f8IvqKACOtnZvShBaD0gfqjz5eFdu0xbVTyU60WQ+8vBOHQllVmo1SwsDSOnOgKioNSFGtc8HgnToyaYXS1fBOC5qfTg78af5tLJWjpl892EuiB+nezKpiGj6bGi2rs0KjDYtjgO6NzPnsrPWPxDZMStOQ0cQnNvGsjM+QmZ/3RoQA48RGCPYghxBfqa23dqKy/LPMchPRd2BbLqKU4WMHIiO3AyqbBPSCIYJw8FhyaWEMJ/d+yKnzUx4spyF5qvoczYDQ== 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)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:11.0313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40338d48-ef3c-4db8-cdd7-08dcf71edd31 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5604 To distinguish between the PMC message port and the S2D (Spill to DRAM) message port, replace the use of 0 and 1 with an enum. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/mp1_stb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 5efec020ecac..2b06861c479b 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -47,6 +47,11 @@ enum s2d_arg { S2D_DRAM_SIZE, }; +enum s2d_msg_port { + MSG_PORT_PMC, + MSG_PORT_S2D, +}; + struct amd_stb_v2_data { size_t size; u8 data[] __counted_by(size); @@ -156,7 +161,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp) dev_err(dev->dev, "error writing to STB: %d\n", ret); /* Spill to DRAM num_samples uses separate SMU message port */ - dev->msg_port = 1; + dev->msg_port = MSG_PORT_S2D; ret = amd_pmc_send_cmd(dev, 0, &val, STB_FORCE_FLUSH_DATA, 1); if (ret) @@ -173,7 +178,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp) /* Get the num_samples to calculate the last push location */ ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true); /* Clear msg_port for other SMU operation */ - dev->msg_port = 0; + dev->msg_port = MSG_PORT_PMC; if (ret) { dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret); return ret; @@ -266,7 +271,7 @@ int amd_s2d_init(struct amd_pmc_dev *dev) &amd_stb_debugfs_fops); /* Spill to DRAM feature uses separate SMU message port */ - dev->msg_port = 1; + dev->msg_port = MSG_PORT_S2D; amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true); if (size != S2D_TELEMETRY_BYTES_MAX) @@ -284,7 +289,7 @@ int amd_s2d_init(struct amd_pmc_dev *dev) stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); /* Clear msg_port for other SMU operation */ - dev->msg_port = 0; + dev->msg_port = MSG_PORT_PMC; dev->stb_virt_addr = devm_ioremap(dev->dev, stb_phys_addr, dev->dram_size); if (!dev->stb_virt_addr) From patchwork Mon Oct 28 07:04:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853090 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) (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 D48A018E047 for ; Mon, 28 Oct 2024 07:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099117; cv=fail; b=A9tO8dTP/LkQxEiZzdwEq0pqGPeU6J6RhZVDURgsB9KXU4p+2EG9PC+0nOw0Zf8iYAHDZCC2644sWxk/5hHhXLb4Eu+B5U0jtsrF2SibJ/DLO9Mw0ZRDb+cg1krNOyYvmgkAYR3ND55EbnlVBMcZGM+qUnM7PIUPOrZs1JDo3zM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099117; c=relaxed/simple; bh=G4LcT2tQX5DF0ur2VNPWmfsfU8PsSWOJSxEnnzoN/Ro=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZXTEGTLU3IsfXQ5V1dCya1e8MS3wuClwhUDMLrd57HHlnduqQ1kcjRnSmnq39AUunF0WfX7/a7slsG4E63VmJD18QRramGPHC6l+GLeLbcF+v7Ph7nk7pJQHqggqT1dSRu2YLteyFTpfLhmB71ho2icp4+pCdFW9wJivwezfqdk= 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=zJFcRcjp; arc=fail smtp.client-ip=40.107.220.67 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="zJFcRcjp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x+ckVIJP6qO/yiqz1/Te8UTkNpK+z3GhrwcAhmp84ab53FJPCPpeER/POgSiRc/NbTozOUkpfyYayFhDtKq/VFY61BtCF/Q+fTdHKWGM887UEy1Yc5W+jbBy6awuyqxzXkv82GM+uJaFra4yI5C1xOc8QGuE57BfgpZP1QzB8pt6PuAKST532uYRoXB/pPD7pv/a9EcgzAgZQJywVs3N1cmUJrk+x9e8TtJYcXBCHnHGwT+qJLuZiiaUYbof8FppgLAuBkhaeS/KhmWKgtd+S5pG1qysXGFuxE7xsMaZL1u8Gi47gMwxsD7XKxghLG9+0lMfuGpjuIB8c09v/p/fqw== 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=iDgoRkwlU8VQJMwAOkUbdHafnhGo2SlZg/zP2plwvWs=; b=hfcvTxmXKMLKyojrOva1wGMs5HRhJ/AS+3X148n5ZBZ2qpzNAii2VWspQWX0RzmY0pJO9b7uJKozEswiOmiAzRqjxc/2LXrpHwg1Aa0mhyLiHFP4Fi+0rbeW1nawOKuDOi46iXFPEe1FrL+x/NMw7+xRAXBut5rbWOiH4wlhp1u4lp9669lEWAsP7+DGsqigo5SFNBjrH7JilE2BhGqWwg+1WkiHQD1Tcpt76nZC9FirguMhU7ppr/1Da3cJjw3LjQYPcWVTlKARqY+CC0+VyWQ0hpZDVlqBn5nuBSThV6L08p4Ee0ZjuUdvlu5zVQ2n+yU7GY+/D0tIEEuzFaRyDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=iDgoRkwlU8VQJMwAOkUbdHafnhGo2SlZg/zP2plwvWs=; b=zJFcRcjp48gzwKpfgYl8TY4nxvj9MHBrjuW8qBRQwRMTWYcuSLlvxCuKUsLe0qT520hbo7tD2c9CtXXGf8UoaTP504VBr3Rf4KaKf+sv86ykMB+hhofRy564f24sJodAF6VL568R9nAelmyeCxbODXhMPGfsCXUXyJ15e9M/Rmk= Received: from SJ0PR03CA0125.namprd03.prod.outlook.com (2603:10b6:a03:33c::10) by MW6PR12MB8835.namprd12.prod.outlook.com (2603:10b6:303:240::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Mon, 28 Oct 2024 07:05:12 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::b2) by SJ0PR03CA0125.outlook.office365.com (2603:10b6:a03:33c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Mon, 28 Oct 2024 07:05:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:11 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:08 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 4/8] platform/x86/amd/pmc: Isolate STB code changes to a new file Date: Mon, 28 Oct 2024 12:34:34 +0530 Message-ID: <20241028070438.1548737-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|MW6PR12MB8835:EE_ X-MS-Office365-Filtering-Correlation-Id: cec908c2-45ee-4acf-b3d5-08dcf71eddb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: 4ARQEB9Nb7GKYPpFEB9Q6k2gHbaM9quyBg6oYuSz9U+qyINXQ0XYp5U6KE8fhnOlaI+65Fyodij8iifZIOCf2i4nbosKWsU7USp2go4lADYz3Ac99jhZgMakjSmcDAsyFH57CB+nYutCIBx75vnMI5efESQ5Qi00+hBJH/THKqefXAONxQI18alnZ+xZcwZwmKHEJE7Spn9MHouZ/W30On0F3wBsp8bu2C/NL7rzjuaw66STUS9WpY+KcDYJa2R0G09522uGGAKMR9E5kjgTbLCsJTnpRwTDP2Da/28IOCtmi/mm37fTzokG1/rc6AGhIf8v1YIGk6jlSXU0R2pN149p4tjK002hqbAktbbQQ+IVwErRKG+dhvWRtMj3BdYlWNY6B8qt11l++uHzfxO0UZx4T5CcgzV73RxzduUurPlTwatcjJrJ+7q1lYIR54Q+zguRIGm/F25VxUZD70E5iI//Gd/QiWT7PtuCaMt5fqM5qI93JKVXbU8K5mFcntFQlDVENouYbvoZSpXkCi305QFZrxX/A2ScGfPXJXAsHigHkCPyQTWT2gYMMxyTXBP2yakki7wGp6+sS/czOFfJqoD3KwKHMLE4ZhRMAKQB2rrZANXg9R8gWGfp8Cc5jXczppvGqGsbgOiAe7NXHsAYnqEeA5NVrp0TybSMilqx4UMwMY5tCXIaE+ZWEdCoYuTNTEfTimp3Sfyf3EWpZgoP3axQ4i/eExSyEhgBe7mME9nxVkNL5Bio2OJOronyZmXkBi5wt+9s0PC4x98mkyX0Ex369lU9pYL4MOiyxxtHPu4UQPwfuVpexES7P5s3P7Q7bPx5dz3EWuG1M9AMZoxZc40/lUY2zLMp/PQFo6jN++DBbCMBHAJNkPJ453JUfcuVORlip/pHwYPvIJGXd3ximvlYbPXipE1tZCymO9+7Yz7FX5kNZQrLNGPNyUPm7TQcC9gwgFW+SL1jX0wHATPoXNv9iafek+GZ3VjyeM7i5G7z5w4jJDMjofGQwMKYW7Vnoiy/VgnQXcnz+ajSINxD4f/ZuTwv+XoORhc+k3zmxqa21ARexVxg/+9GaIVEOtMlbThttcXkr86SOKQTY8A7EH0sdxh6GlQL/DSt8yP6J7dN1+56+a6/+lHdpqO3qzTrg7UZNxM1/Ivb8WVeVRkOcOzoenn22XIU7Y0e5k0G7zTzJO0vOlk4vlDVp0Mqru16xyGAcxzgc0H+twaKHRvgk5ym9WzZJet0zfhoO2Gq4mGiLaDeFAl34X44Bm5GguZGvN0HPzpaW/3IdrGCWKf+S63oPYDBxs0jx8DNubPHJ36Jc/ot4DcN7PBvsZrNjPcW6zS3DNeVJTubO1WoNEYiQx3ZUX3dutcc5oS/rBfidBLonK9Xl7jqq9pBmrRfa+s5557GYlkJ7tEOefk4HA7W9Q== 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)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:11.9219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cec908c2-45ee-4acf-b3d5-08dcf71eddb9 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8835 Since S2D (Spill to DRAM) uses different message port offsets compared to PMC message offsets for communication with PMFW, relocate the S2D macros from pmc.c to a new file, mp1_stb.c, for better code organization. Following this change, it is logical to introduce a new structure, "struct stb_arg," to pass the message, argument, and response offset details to PMFW via the amd_pmc_send_cmd() call. Additionally, move the s2d_msg_id member from amd_pmc_dev into the new structure. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/mp1_stb.c | 33 +++++++++++++++++--------- drivers/platform/x86/amd/pmc/pmc.c | 12 +++++----- drivers/platform/x86/amd/pmc/pmc.h | 14 ++++++----- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 2b06861c479b..1501793b9281 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -31,6 +31,11 @@ #define STB_FORCE_FLUSH_DATA 0xCF #define FIFO_SIZE 4096 +/* STB S2D(Spill to DRAM) has different message port offset */ +#define AMD_S2D_REGISTER_MESSAGE 0xA20 +#define AMD_S2D_REGISTER_RESPONSE 0xA80 +#define AMD_S2D_REGISTER_ARGUMENT 0xA88 + static bool enable_stb; module_param(enable_stb, bool, 0644); MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism"); @@ -176,7 +181,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp) return amd_stb_handle_efr(filp); /* Get the num_samples to calculate the last push location */ - ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true); + ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->stb_arg.s2d_msg_id, true); /* Clear msg_port for other SMU operation */ dev->msg_port = MSG_PORT_PMC; if (ret) { @@ -239,18 +244,24 @@ static bool amd_is_stb_supported(struct amd_pmc_dev *dev) switch (dev->cpu_id) { case AMD_CPU_ID_YC: case AMD_CPU_ID_CB: - dev->s2d_msg_id = 0xBE; - return true; + dev->stb_arg.s2d_msg_id = 0xBE; + break; case AMD_CPU_ID_PS: - dev->s2d_msg_id = 0x85; - return true; + dev->stb_arg.s2d_msg_id = 0x85; + break; case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: - dev->s2d_msg_id = 0xDE; - return true; + dev->stb_arg.s2d_msg_id = 0xDE; + break; default: return false; } + + dev->stb_arg.msg = AMD_S2D_REGISTER_MESSAGE; + dev->stb_arg.arg = AMD_S2D_REGISTER_ARGUMENT; + dev->stb_arg.resp = AMD_S2D_REGISTER_RESPONSE; + + return true; } int amd_s2d_init(struct amd_pmc_dev *dev) @@ -273,18 +284,18 @@ int amd_s2d_init(struct amd_pmc_dev *dev) /* Spill to DRAM feature uses separate SMU message port */ dev->msg_port = MSG_PORT_S2D; - amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true); + amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->stb_arg.s2d_msg_id, true); if (size != S2D_TELEMETRY_BYTES_MAX) return -EIO; /* Get DRAM size */ - ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true); + ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->stb_arg.s2d_msg_id, true); if (ret || !dev->dram_size) dev->dram_size = S2D_TELEMETRY_DRAMBYTES_MAX; /* Get STB DRAM address */ - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, dev->s2d_msg_id, true); - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, dev->s2d_msg_id, true); + amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, dev->stb_arg.s2d_msg_id, true); + amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, dev->stb_arg.s2d_msg_id, true); stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index 8e7c87505327..f9900a03391a 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -450,9 +450,9 @@ static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) u32 value, message, argument, response; if (dev->msg_port) { - message = AMD_S2D_REGISTER_MESSAGE; - argument = AMD_S2D_REGISTER_ARGUMENT; - response = AMD_S2D_REGISTER_RESPONSE; + message = dev->stb_arg.msg; + argument = dev->stb_arg.arg; + response = dev->stb_arg.resp; } else { message = dev->smu_msg; argument = AMD_PMC_REGISTER_ARGUMENT; @@ -477,9 +477,9 @@ int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool r mutex_lock(&dev->lock); if (dev->msg_port) { - message = AMD_S2D_REGISTER_MESSAGE; - argument = AMD_S2D_REGISTER_ARGUMENT; - response = AMD_S2D_REGISTER_RESPONSE; + message = dev->stb_arg.msg; + argument = dev->stb_arg.arg; + response = dev->stb_arg.resp; } else { message = dev->smu_msg; argument = AMD_PMC_REGISTER_ARGUMENT; diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h index 7e7f9170124c..d3c6730ebcd7 100644 --- a/drivers/platform/x86/amd/pmc/pmc.h +++ b/drivers/platform/x86/amd/pmc/pmc.h @@ -25,6 +25,13 @@ struct amd_mp2_dev { bool is_stb_data; }; +struct stb_arg { + u32 s2d_msg_id; + u32 msg; + u32 arg; + u32 resp; +}; + struct amd_pmc_dev { void __iomem *regbase; void __iomem *smu_virt_addr; @@ -36,7 +43,6 @@ struct amd_pmc_dev { u32 active_ips; u32 dram_size; u32 num_ips; - u32 s2d_msg_id; u32 smu_msg; /* SMU version information */ u8 smu_program; @@ -50,6 +56,7 @@ struct amd_pmc_dev { struct quirk_entry *quirks; bool disable_8042_wakeup; struct amd_mp2_dev *mp2; + struct stb_arg stb_arg; }; void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev); @@ -70,11 +77,6 @@ void amd_mp2_stb_deinit(struct amd_pmc_dev *dev); #define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122 #define PCI_DEVICE_ID_AMD_MP2_STB 0x172c -/* STB S2D(Spill to DRAM) has different message port offset */ -#define AMD_S2D_REGISTER_MESSAGE 0xA20 -#define AMD_S2D_REGISTER_RESPONSE 0xA80 -#define AMD_S2D_REGISTER_ARGUMENT 0xA88 - int amd_s2d_init(struct amd_pmc_dev *dev); int amd_write_stb(struct amd_pmc_dev *dev, u32 data); int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret); From patchwork Mon Oct 28 07:04:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853091 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) (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 4401C18FDA9 for ; Mon, 28 Oct 2024 07:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099118; cv=fail; b=P4e8komjMhS7kYSKjWeyGGprO2LWDUY1imCbdFmGh8np5jR7lJOVqlLFQwxSYJ0YH4f1+gM+5hr1VATQSeVP3rs2Wkt7AaZhOgNc9sdR6g3NIUNKNjDZMVf5BjSftuTIJlPaH0hDRM95/LMuXjzVyEmANj/DM3KZGW+72AItmk0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099118; c=relaxed/simple; bh=CSBAXidFgMOCvEEUtdfATHeu2eGvy8A4XS0DZ1Hw4Io=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IdLIGYJxA8m5/IJQ+PuOMO1YejFBtNZNblTGi5YmeWsahvkJpdTaro5KVCEx0YsyyPhPInIa84QfN3e2f9oIbJb31BXIJwdrqE9HEXAxOJ7I2UIroFfUbZTrK4V0iqAlHlM9GFmpmoQ2zIQb/DAey3Kfrpr/6nNi32RVFbzin3A= 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=1Pgrc79B; arc=fail smtp.client-ip=40.107.223.62 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="1Pgrc79B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DHfDAawU4NOlq5n4S7hT/baqmEmDxQ9U4Xjt8EJJ8nQJh1qrjsq8X3iI3R3phAbjeoLCCBP5cPDWKMn8a3+3lYizNBAkMQnmfsBiraCLVB7ix54/tAnHdMtmFCC0SwfWoJw5twdMe5r+etNg3m8zTZmidpVrOInmgAX4bmyL04/RJof+ysllQQxwwb4JYMUsNGYUaq85rPqgpr2kdbB4JlRGOjAGSwvOSyKH3zLOLp48/OiDi8sncSCmESTkw04u007YnAfhJPy8L+qK+mcmx3dnUWMih3kfQY+Oqtatq7TDdarxi/PnwM3+r0eMJcDCQFcmUd91VWVa+PHmyA0Jrw== 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=F2VVgrnDR/J+lx+trSxoDgKMPvQ7821oEf1GiG/5vUQ=; b=lbJ0Jfc8shZ5pui1uiXVlTVjPRpLTPxdd0D1ByC8yfCL7dwDV5+gKiet9HH07j6ZC2YAvtLgabn/ztx4XrHrJdts1kuVuzqTNfo/fdTZU56WWhZpVlRXEBFtZIAHyn3Nk98UQwlpvngoZIPHD8HSXin/5I6F7qXkgiE3pcj6t0RuAwGsjDVc+bcfZ78OR4M8OPJlgqbp0t7sMwpyurdCXJiiNxxtz9gBhlom8xbWBbW2IWzl1TG5D4TcLyJg5O4IJE18VP4VElKNqk4CkgYauuH6iZhogMeOp4vjj0NNEI9Vlgsbn+hBs3ajxOPApxwi/vkYC9D75ykrJWj/batmgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=F2VVgrnDR/J+lx+trSxoDgKMPvQ7821oEf1GiG/5vUQ=; b=1Pgrc79By/vgs8HEOd4eOcaVH+gs3hx7bI0/gL3AA0I/0T2FefHkMrBKphbQtqBPNPO+60a3VgTYtINRRBbvwapaiFQrW/xG1l8cawC+3xWXjbo1eWCtm3cm1J8gb0LIZ4Ol2GHKgCDdJLUV++Ekc2leCkneyAOpOh5zcxpeHww= Received: from SJ0PR03CA0132.namprd03.prod.outlook.com (2603:10b6:a03:33c::17) by CH2PR12MB4214.namprd12.prod.outlook.com (2603:10b6:610:aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 07:05:13 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::9d) by SJ0PR03CA0132.outlook.office365.com (2603:10b6:a03:33c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 07:05:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:12 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:10 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 5/8] platform/x86/amd/pmc: Update IP information structure for newer SoCs Date: Mon, 28 Oct 2024 12:34:35 +0530 Message-ID: <20241028070438.1548737-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|CH2PR12MB4214:EE_ X-MS-Office365-Filtering-Correlation-Id: 77d6b0b1-95b2-4ff7-4a25-08dcf71ede52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: imNYkDumhJm+RfC2t7EBWNXORMKFtQpHMQJTsIXRc3oGnd59r0ETALnChwOkNekuac8vwf8Yy0dgEqG9EHacQm5IdCj6pDX1SaUkSfb9iEI7pLZLPrDQNNmrcZzTw0jSY9bBiTbeHv9TfRPnr189GrfVgneeGnlFL8E16PKTp3OClI68VLZOqOo9E0+Op7VdLMnY8ummQmjOLHNFqtlt0b6tUlmYXVoAe6aCb09l6fDMZjXBYO5nOfIjX8cFekNXbL2NSFjSnsoKJERzwLpIyOkBvJi3MakHTPn89pD/1a4RqSsmYbbLZU/tvojvXWK9Xkdyxn8bOOVAqE+XofZ7+U6mVPngm99bmSpd5pWRs7etPXOC9Rk6th3ZmUnZXY8fpYpM2JHxTWKCk3JFVsroTNe2HQI1LMFkQxb5fW/jnUa7Hid6+w5QjD4SLb+mm6aoEXMEgpZK87q5jHcNeCcao//4UAb+kt5eRpudpH1rnHUvhyRJMQ7bTHs9BIEqTp1Vi7o9WUIfEyXxsGlgy4FradASBVcyO7i/aN4yzAk0uJqkwXNaR4g7ocRpKXDrssX8xs7R2vPjl7ecah1feHbQPuzJt8h1Rm12eScYFShaSjE7SnbIufsmsJc5lLA7zyowsCTOdg60RYlPM8/Z8J409+e4iRwkx7Br+HqMnBWsSeMXFlkFCLDSGDAwcLgLi7cMOLJ/6bikJjO6LfnQuAYZWE9ESWVGvhgS8XqgteQX41nPiVNIEQP5awR0FcVOPNe5IxjJeYY+aSjsJgRFs0QSFbWEVZvSSrGkTw2KmsBTgFpzZFAV7s2RlQoG1fFqgr7CEdvzU3iqRJWAvez/TEyblK+Wjp1KJKXxnEjd047M9APt0ne4j5yEnakp376kAs6DjVXvrqreqxnpMHpLpSEMsKzEh1uM3VZsy8qKLxgvgdfhWQq56T6x9GqavsJqDBxtwhil5lJDor2tV7OCm1NPX8dk5l+RZcW8BSpV+INHs693icfxbxPYvmta01LPPVNdpW747jnkpbrfU8rHqUvUhvyCUDiSMEh+bNPOHfrTTNjDGhY5nIdyjbjsKF2X+KqGjxfmz9jHDdh0hZdOezd+KB8qP95Wjsm7hb/yTYzYIGjxjsXgF6hLlIo6un9L9l7vQMI1mP9ZwBXGkZA87UuMp/ldtILn1d5qtSdPpzHN4G7KI9Y0y462uhMhPCh4Pyhm1xyvVuL5EWqc7moqfIFzx77WNmt2cD5PZRAPreKkglUW5hgPnroR0+kAqUix86KCh15QzF+JqBScCtTi5KkXvgH8vLoer0LGcFE3GIwn/nSpd2HCM1CcFn3ShjfLLqLnTI0PDZlcBkNDL3LWviU2NDx9VTDPd6BWejYnjuQHQPXCQKVDTZT+OOgwovlSJIVH/zSXXJC7zSAfFGWhCzGU6Q== 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)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:12.9844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77d6b0b1-95b2-4ff7-4a25-08dcf71ede52 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4214 The latest AMD processors include additional IP blocks that must be turned off before transitioning to low power. PMFW provides an interface to retrieve debug information from each IP block, which is useful for diagnosing issues if the system fails to enter or exit low power states, or for profiling which IP block takes more time. Add support for using this information within the driver. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmc/pmc.c | 42 ++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index f9900a03391a..0bf4065153da 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -95,6 +95,35 @@ struct amd_pmc_bit_map { u32 bit_mask; }; +static const struct amd_pmc_bit_map soc15_ip_blk_v2[] = { + {"DISPLAY", BIT(0)}, + {"CPU", BIT(1)}, + {"GFX", BIT(2)}, + {"VDD", BIT(3)}, + {"VDD_CCX", BIT(4)}, + {"ACP", BIT(5)}, + {"VCN_0", BIT(6)}, + {"VCN_1", BIT(7)}, + {"ISP", BIT(8)}, + {"NBIO", BIT(9)}, + {"DF", BIT(10)}, + {"USB3_0", BIT(11)}, + {"USB3_1", BIT(12)}, + {"LAPIC", BIT(13)}, + {"USB3_2", BIT(14)}, + {"USB4_RT0", BIT(15)}, + {"USB4_RT1", BIT(16)}, + {"USB4_0", BIT(17)}, + {"USB4_1", BIT(18)}, + {"MPM", BIT(19)}, + {"JPEG_0", BIT(20)}, + {"JPEG_1", BIT(21)}, + {"IPU", BIT(22)}, + {"UMSCH", BIT(23)}, + {"VPE", BIT(24)}, + {} +}; + static const struct amd_pmc_bit_map soc15_ip_blk[] = { {"DISPLAY", BIT(0)}, {"CPU", BIT(1)}, @@ -170,7 +199,10 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev) break; case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: - dev->num_ips = 22; + if (boot_cpu_data.x86_model == 0x70) + dev->num_ips = 25; + else + dev->num_ips = 22; dev->smu_msg = 0x938; break; } @@ -338,9 +370,15 @@ static int smu_fw_info_show(struct seq_file *s, void *unused) seq_puts(s, "\n=== Active time (in us) ===\n"); for (idx = 0 ; idx < dev->num_ips ; idx++) { - if (soc15_ip_blk[idx].bit_mask & dev->active_ips) + if (dev->cpu_id == PCI_DEVICE_ID_AMD_1AH_M20H_ROOT && + boot_cpu_data.x86_model == 0x70) { + if (soc15_ip_blk_v2[idx].bit_mask & dev->active_ips) + seq_printf(s, "%-8s : %lld\n", soc15_ip_blk_v2[idx].name, + table.timecondition_notmet_lastcapture[idx]); + } else if (soc15_ip_blk[idx].bit_mask & dev->active_ips) { seq_printf(s, "%-8s : %lld\n", soc15_ip_blk[idx].name, table.timecondition_notmet_lastcapture[idx]); + } } return 0; From patchwork Mon Oct 28 07:04:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853092 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2046.outbound.protection.outlook.com [40.107.101.46]) (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 B31F218FDB2 for ; Mon, 28 Oct 2024 07:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099119; cv=fail; b=RclF497hcMzNiRqJFiqG1TD4n8tgLI1O7TlNvemhCd3j7St+DXGURKn4uasgmHuWE104nGkZFOlIt55pOnEI50DhamXTc1DLEWXrKXN/eBz7hywAoiIQv1UPf6/QSL27f6XUO4dhzDU4xNUoc66+Z7QdKI6Wv4GDUW66ubQawx8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099119; c=relaxed/simple; bh=ZZS4W9VoewGLxhSCaManuN/LEzpURITPpL9uJj26748=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LdDZRNdDqHMoPPYH7fZbUpgMj/2qI+m2AkF2VoTNowYKeG0bTzoiDZtdqerKYvFDFmSGwRFH2D+K6LcZl9fZLjQ9hc96bp1CxleXoFLt4PSXcHx9HRFa1WBOiO2dEoNWv0yGxFXYIKREkFwVnon5/v6plHjuql1c2o3J60WwijY= 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=KkOy6uFl; arc=fail smtp.client-ip=40.107.101.46 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="KkOy6uFl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ilQhVHyb/DIcmAOW5q6xK3tE5nEEH7Yoploh/XUTuug8rOp9zTSyV2isWv0RdSMT+uUms4kCzQ4tS5OD2l9l20y2nZwbHs0nNxbbJC5Gh4t5XnNIghd3XeX29HbW0HGyFELOzlSLe2nQemK9A2MootuXpnO5twY5P5OGtEThBaRtw3xwMDmR8A+WU1q9wEaRR8qXF/ui5Zzcoyt12BhQYEts+8ZPtVjHCmgyFAehco4PqXulhQcEFeIfpBSXa2gBJLhPD+8HxBaF+PT2PXGfsHImvh4OA30CHvYlXysVF2sstSKP7SCrIG8nPAZT38cEy+GfYLYToAO5uo6+2Ig4+Q== 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=CJaVMVdC8F71A7WWJI4SOLxVtSQgx/gr8r4gD/2gXPc=; b=QQDEamvhDBnKTrSD2rN9Vda1z9kwRfNjs1ctWD2KmtB//mh9QCO+JS9Wz75AOM/LTZIi0GjwMZVyj/8Yn1Ky9hmKsgkI9MxiqylOJZhZr4VGsyW7ge27bOjWwSsQ/IMq1eemZsTnBDjT+AmiQO60U0zXbPbbdsrXL2cEcSDJR8WrIRwnaO9EgT6ax3rBJM1O65xyHcf917XX5AfCrRBmsJd6A0K6SgxfmmLCJ0TMCL7MdbIw8owLcmMkgwrKXL4fsNUl76ZhC2grvSrHRDtAXXwrg9sQc/f4fLs0wyvaaqs4xVAHof39sEV0L81NhaL+mARxvLnfKvOxcTA6mk02Fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=CJaVMVdC8F71A7WWJI4SOLxVtSQgx/gr8r4gD/2gXPc=; b=KkOy6uFlldq959Zv6zsB3nKEpsVIuX9SUCymfnRDn1w7hxjyEyZ42O7jhdxBeBL2Hk0cRg9LSB7ZBROSNDpyan+OSyc/QALrgRu1nJYDsVsYfUGUFMrlkcyj/aWh0e6kFmBKgkiHuMHhJrU3R9ylbD/Ia6Fy8mxqqCBe51kO3tg= Received: from SJ0PR03CA0123.namprd03.prod.outlook.com (2603:10b6:a03:33c::8) by DM3PR12MB9326.namprd12.prod.outlook.com (2603:10b6:0:3d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 07:05:14 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::38) by SJ0PR03CA0123.outlook.office365.com (2603:10b6:a03:33c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.26 via Frontend Transport; Mon, 28 Oct 2024 07:05:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:14 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:12 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 6/8] platform/x86/amd/pmc: Update S2D message id for 1Ah Family 70h model Date: Mon, 28 Oct 2024 12:34:36 +0530 Message-ID: <20241028070438.1548737-7-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|DM3PR12MB9326:EE_ X-MS-Office365-Filtering-Correlation-Id: 11276d91-3cf0-4d15-17a2-08dcf71edf43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: cvpR7vllcPgHVOx8A2ZIK3Er/NAjoWP55SX58REj43XSGl+LG2tJ2Tu6FEONpxvD6yolG16A/7kWlq8hlwZSVL7OvCx9o3INQXx7899cto6ImA9WDHM3GTcqFxVD1C3dTDabuqsJmhp4Qt2qBz/LjPKsKyVLwl93Zh9wUxQ0OA80xhdQH/CF+0rCFtHt0NOPKbwmV5ZYGv4SnqZsQrzstTun921B8jCGKhXL140vUSh5CZy2fLCSSeoMdlSlBOukEyTV50e+salkPDrzSczveZmJK4MZgMk1Lxo2nwep8cWZ1WJD2DWVhdwIaoUK+ZtYyG5cZ+WAXi3RpCgDoppsSkrWoEbRw8Q5LcrQ3hQXcmxc28X8dLYpcAdaPr6gIcOjNNsWxRg2/PSZU/IQ0V49/X6PORhWqBmhQbqvddBxJReMNGuD3Sx6HGjaDYVJX30Oa4QK+gRlD2hqE7vUDQsHn+789dGRd1PlT7YYycTypXchI0dug1dlu9alwmT0tgugtC+javu5S63w/m6UxbneauSYXx7PWd8EMBSmL7pM/9y0mkgZ3t5rbY+T0lcwviAHWjvMW71193yk/EseMvsIRgA+mrmrQGgWyvEX7XrsG7wQ4HfDtNh5Yimv7tdYbLObFNwZ7OZ5ndIlkA2qAegE439SkL+f5qlBvwh9u+DkTLXWoP6IbS24Cm1rMSGeDC+7mGlues//3lSJk8YarG6qmT1K0/Cr4sSfFhaZrkS3QhkZzRiwmrcqH/i5UU0nK+HjWTCoEe+M9uZuoE8rQgSaDWo92TZJbE2R7otXehsDSOgOdiX7kuXgN6j/7DIEZ/P775jgYchAEQ9MzXZ3hZnGL0r9QL0Zzzqt/EsWN8h/RsrKR+DWpqdEDNNKk10DlfFWJg0zKu16mOdSzldMWAuT6YLgEcfLtLb27GFwyHfRsSBFoff0UVHU78imyNTAcOwRRuMirwW97K6hQKBVP8rAC1il/yb/ovyKMFRotuOoWlxqEHuszMZLqF3xLGhGWTl/nB9fiel88gbbKHBk935EkcbHlbFzsAT02/KYStZJ7aGJZ2+tk3YLZFKluM5YdP02cEqnxbbOrYonOJD8HaUOSP48aVC0wKg9RKXD/+aEGW2EwXxZDnZwJ79XXuaNZoJugF97yISszsuz1QBoCj+xIrxNDOBM5h+VdKoPJiSciyCZ/G5Tq+YLh6eMidVI0hUPKdDT1+N5+fSFlT3q1xNVvAScTE58lPAOtKv/YVd9ScPALHaA4QIZAf4pF6AyxOA3OlSEPg90x91kMnTEkTfLkEpoSoyfYf2MEjgSa2snNkXWCcFUsnOP53oBXH0zPJhwU+3cTOl5cs6m6E4Ds/p51lrxPgCcLgp5tVXiC7nTSlO2GNO68oEZ81sUA5Qzl0c8OVB7w1HHjfi/XB6nF+fYCA== 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)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:14.5626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11276d91-3cf0-4d15-17a2-08dcf71edf43 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9326 AMD's 1Ah family 70h model uses a different S2D (Spill to DRAM) message ID. Update the driver with this information. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmc/mp1_stb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 1501793b9281..917c111b31c9 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -251,7 +251,10 @@ static bool amd_is_stb_supported(struct amd_pmc_dev *dev) break; case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: - dev->stb_arg.s2d_msg_id = 0xDE; + if (boot_cpu_data.x86_model == 0x70) + dev->stb_arg.s2d_msg_id = 0xF1; + else + dev->stb_arg.s2d_msg_id = 0xDE; break; default: return false; From patchwork Mon Oct 28 07:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853093 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2047.outbound.protection.outlook.com [40.107.92.47]) (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 36905190057 for ; Mon, 28 Oct 2024 07:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099123; cv=fail; b=erwc/novHl69dH/2fSa+plqi+9GhXvGVlwXFWe8Z7ykDUeI3E0sLCHUEHjT41hWR80WVF7CJIbESnWy+xQ7nj/YfvOjvhJ7on0MnysikFZRw2OBVH2vb6A9GQ8VjB3JnaS0PcvHRJKfFP8tpP+ao8c+AAaS9M6rXP5gHygQ5oY0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099123; c=relaxed/simple; bh=fLnIMAbcUd1Hw1EjuUHh8aKVveKCBUbXO0xe72S1Sso=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fiGSTs/ss8ZrBz4LK6Q+epHcO2Ftkt8m5Xd/ljNFcpmZrCpMrkWUb8WetUsHctHWaUUB+AMLtcj7QRAinKBAIjisgkJ/1z3KMuIBjg8uFwSrI/XNkUcledz7BNvHxOgWRMEzH2Zcln+Xd11GVlbfPkkVzTYNtD81a222isWDebA= 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=CtXYsdRu; arc=fail smtp.client-ip=40.107.92.47 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="CtXYsdRu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ax2K0rr7p9259bMfm6O+spZ5hRAd6JvwnkshuOqZB6yI5FOci2zkUJcOHCDaZzF81rF24JpgXuWEby+VPq+mcjmaqs0sr69kMob00qJijyJVHPBUqOZParPanKcCKsBp3xYwVMvdhxjEHO/mK+coASqKhk1rELEXk8S+Yz2z3iEK1J5Qef2ZzktvN/g7hJxkssv5sH+kFhFHr/Dvbh6abvLbGH8WJQbDJjgDkxS8IxHj5Od2JVmvQifQ+groUgGyCxYa7Ov7/dwh+cDVMUQ2KjvA1XwAHW0ZUPRf9SXHYBkXDGtbAd2um2Zp29Gi5hBT4i6+ZqtsUUa6ezLvzlAgCw== 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=WcHHFz65/QoGJq5c4vlWHMrSc+XpxWUoTdYf+CLfDb4=; b=ucd8p1cHqodnAWysG3mLjrXGBJU5pBsdDq08FiMwFF5mLs6Rc/hS2DEW7IJ0AP8bywlp/UMAndCM5Xmib4B77WtgbbtvINYQYybworPrdaC8SCEa0kSvLLhCYKP+ziF0vKOXKsfYdnFKNR1m5vceKfHvS50QojhOgjyBc94qph01j9QCPANNG3Nguen6PaT09vBn6ZzJVJGsFmnrrV+ri/C78zb43RxxUWxSvEByu0Y3N2gRXNShuTFQsyoq3WTN5cUAYLPGWIWQYmfPlHrd6mKo0ugvccyka0rjFEBkVQ/Gbm4OXXJkwrzV/ApyLlLHkJhhvFVWJwWmCs/VaJZOnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=WcHHFz65/QoGJq5c4vlWHMrSc+XpxWUoTdYf+CLfDb4=; b=CtXYsdRuxlOmhoPaDvm+7hXIHq8r8drly+RAz6g2QudRWrgyFW5l3j2AlWJiKT6VYxTeSRX7cPEQtalaOjt3LMOfHkRPEBrmjhKTPpv3Vh1DV2wpCy+bTiAejGuIsYzWBmgQvKgHrzAjN/oZG4y4Q+DOIHuintlgrFhj3IRYZ5E= Received: from SJ0PR03CA0139.namprd03.prod.outlook.com (2603:10b6:a03:33c::24) by CYYPR12MB8924.namprd12.prod.outlook.com (2603:10b6:930:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Mon, 28 Oct 2024 07:05:17 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::1f) by SJ0PR03CA0139.outlook.office365.com (2603:10b6:a03:33c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.19 via Frontend Transport; Mon, 28 Oct 2024 07:05:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:17 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:14 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 7/8] platform/x86/amd/pmc: Add STB support for AMD Desktop variants Date: Mon, 28 Oct 2024 12:34:37 +0530 Message-ID: <20241028070438.1548737-8-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|CYYPR12MB8924:EE_ X-MS-Office365-Filtering-Correlation-Id: 91606e18-0f3f-41ed-17c4-08dcf71ee0e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: YtpBYJtpvX1fhzKiLHhOKgnHvG6DMdgo1fTwxr99Hdw7xfaUBLJPJqhZdd+JMVXwvsWKkiCigvboEQ16CDxVBEXN6B8b91JBWobHVfgi3Vihvmi1HSww6lBD5NcE89zB44y/heUlBGPF3UxM4ZM2LLaesjHBWJq4G9wcOcqMFlaqzFitblRWpvpDZ2bOC5e1zymLRsJA/BEUvK3k+8R+PJzLe2gmYuEDMvRBpMo7JpouaH3A7SnWfBx8OnFD743D7ywuHJesHAeedXDOIQ/VjScT3RgpbHL2EdGeFWSY1hZLpG30MoWkJHv+ty15gJEkynSALMf9Pg0rfxEks96oFfRyyCFgBsqcl3gcHt7F4sk/EI3suookOieJX7+xXW6tdkjz/fiMUBXEofO0aR4mVoIVzGyPL49I/85vn1A95vkcTcejd02PesBF7dD2wN4EHCfDMxUEn4XKEd7cTFqdveSCRj5HwrgCUViaq0Zre9iYFeR8tDLA/sU8TBmNNMt5z6AZla2P3JYcZytyoahKoqoYd45v+it7dB4vM6v7IINhs5nvF17Dz0UTePbFootlV27o1ic2Es3pLRM4bcte2Gw13Ez/vK3i1h8KfwDKMorHTQ4AOyZv1dlOUC/mkiwQR2rQ3g7LDtHKysxhmwSrtdvB7whrPid81xLHT1Ybi9i80GnRAbpWuF83G9RpK08TynabwhruR3NrqIbreTzPY9PrL0CC2G9LbQ1hUUulJ3NIXTh8p0ygs7+xZI+uqADwJz90NR1aLz081xgDfaHE3vu7q13COa01Q+zxlwtfix1wuDRpRSixF/qFWImeJ/WgLdtaTzRdtS9NWzsfOiGZHbE2HxOg5SWmUgmgeCXY++SYtvMf3+98vyex3B06KTvc6rVjIoffW8Xwitro6h9MATxgSSxXwr/NCd8YbTVUsdN7nJdEWKgJqRxhts+Ld4NUEc3J+plNWKzWgfwCMc1XgXEnZ0Z+B+veDcpWXKK6apD9LFxK7Dsrs4y/Z+O3wH+G3pyJpK7vAuOR7MJgs+pBXos83Db1TDlEpf1HJWlecj1a8SabGFgkjeu2llSKLKopj36AlTQQVwoZsjiR0LUi66WoM6UDB5mnZclN6zhIrVvRtBMk0SGdN2TIMj8RJ6nsUDL++5Aik2JY8iqgNjwoSsWrOQfdF7JA7pHl1/MlpPSDOInNSMZqOfaacNZB/tGDLDPgZjprZoJjuL+gP9P5HhSRoYJkhcwNLfOrdduHSXq0jwSSXbfql0OUJLXU5am6JzmMy5kB2zOcN9k2YP/tOelA7IEy2JXmqZXEZegY4/pkSN4isrHeY8D0u5spKh6MxjE0OtoAwu2eZf18N4oPxaTE/zwwvMxpZ7Lzuro8/nKYZ+sNbymroOfAU5uK1TlqHxQaujVCd5q2bH2srOI1BQ== 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)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:17.2500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91606e18-0f3f-41ed-17c4-08dcf71ee0e9 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8924 Previously, AMD's Ryzen Desktop SoCs did not include support for STB. However, to accommodate this recent change, PMFW has implemented a new message port pair mechanism for handling messages, arguments, and responses, specifically designed for distinguishing from Mobile SoCs. Therefore, it is necessary to update the driver to properly handle this incoming change. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmc/mp1_stb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 917c111b31c9..bafc07556283 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -36,6 +36,11 @@ #define AMD_S2D_REGISTER_RESPONSE 0xA80 #define AMD_S2D_REGISTER_ARGUMENT 0xA88 +/* STB S2D(Spill to DRAM) message port offset for 44h model */ +#define AMD_GNR_REGISTER_MESSAGE 0x524 +#define AMD_GNR_REGISTER_RESPONSE 0x570 +#define AMD_GNR_REGISTER_ARGUMENT 0xA40 + static bool enable_stb; module_param(enable_stb, bool, 0644); MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism"); @@ -244,6 +249,13 @@ static bool amd_is_stb_supported(struct amd_pmc_dev *dev) switch (dev->cpu_id) { case AMD_CPU_ID_YC: case AMD_CPU_ID_CB: + if (boot_cpu_data.x86_model == 0x44) { + dev->stb_arg.s2d_msg_id = 0x9B; + dev->stb_arg.msg = AMD_GNR_REGISTER_MESSAGE; + dev->stb_arg.arg = AMD_GNR_REGISTER_ARGUMENT; + dev->stb_arg.resp = AMD_GNR_REGISTER_RESPONSE; + return true; + } dev->stb_arg.s2d_msg_id = 0xBE; break; case AMD_CPU_ID_PS: From patchwork Mon Oct 28 07:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13853094 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2042.outbound.protection.outlook.com [40.107.237.42]) (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 D8AA5156960 for ; Mon, 28 Oct 2024 07:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099123; cv=fail; b=hx5Ms1Ikz8zDme/X75tKJpR1jI3/G14c6+gtoI2aLXhkSwRAbqJq6TdzIfz4oU8Dt6gBbct7dVhomG+WEOA/QYCUO1bkc3OaTF7I5lV0GVhXLeRG8l/JNVO42CPYh1OJxudPVLLNSS6V0hYFdBgpcEyNTRAKhO3dalcm7x4kIus= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730099123; c=relaxed/simple; bh=RBasAwcO7KYIBnStDh/HzqeEmib0tQ9p4gjURaOuNX4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HJtoyf0Z4ecHPjwjZ1bO9YGJA5W4qTNCIroz87nb6ieAddD7g8lyFEXUkjCbM0a52kjZC9mcFKz3PN/RMViKWnzWilNOR2emwPG4fyGOv64OmRcLTgXFHd3ETN5pzyuBJIJzcH/T7c59o4LFFjwggyQxd0yUzJC1wVSRzZ+KPO0= 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=KMx9GHP+; arc=fail smtp.client-ip=40.107.237.42 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="KMx9GHP+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AopUs68Zg45NSQk/vda8YgHWnwOXWCfIxvMtU2u/6ta0zIWQDyIDwUpSOBmSrRIHRCNRmh5AsXbcJp7jrvIv0ZocXWp/ePOC1Lyv4X//ha9RspTuGB+Nu6MPl9TrL16oMX0yLlSK/o0NpOq90VVQut4fLiwWb/eno238EAUbhySf0+pSt7dSvGSDfRXNfYXNzGRHyFfNJf/Ruep1rALjEY/zn6k4jnsvcw9aXNdXBxiFYj3NyjNLl7k9JAVJi3X6a0VHFHx/ekeY34+47jr4S+mfdbkKWgilavCTZN3KwyEMuPsMhNdhS6WIUNfX/91W/Wg+FdjFAvEtInnp+C+O/w== 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=e55zHM3rTtHub8poD34n+yZQppYUVRXg65PSv0saZrg=; b=ICwM3/G5MtIVRtHWkJva2vaFHBVYgJ2ocJWbC0kBvFU6uKXqoM0AN4rvOw13POTfCn89rA4MwhhqATtjik1+xEsT2BVFLifv7z8OdojjmozDNMn7+Zi/HYmirF52ngarJI+uQbo2jeJIpxKzReJ5QHuxgXrX8+yo30zkl6QwtOMWE4kWZzrE+W19L5sK7pWfyXc6J5Lr2Abn94M/pOvJ3CqBGlh+692pXt7tw+XpSbjiWH5iATm8Kt8YUIIQ9wZg98uEu7IddfhZk8OI96iM5ZgNjR9C/J80OqtUcvE6TunU7tnVlMjaWkGUnd0ye8ARBaNKFjO7Kk4chudp761fww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (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=e55zHM3rTtHub8poD34n+yZQppYUVRXg65PSv0saZrg=; b=KMx9GHP+nMXOGRJJfefayHxwZ4YWaOQDJrzQyl0/C8hxhdGxsq4fRyS9zc+H5hY5xx4Bj475roTlv0AQVXcYPjLG9yRJfhXQQiUG0Mj8GMI53imNckSF/XxQyVcYO3APHtHX6+2tJdl04PwGJReqMEApqqXdlpY5ihN0aroBKKI= Received: from SJ0PR03CA0145.namprd03.prod.outlook.com (2603:10b6:a03:33c::30) by SJ1PR12MB6364.namprd12.prod.outlook.com (2603:10b6:a03:452::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 07:05:18 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::1e) by SJ0PR03CA0145.outlook.office365.com (2603:10b6:a03:33c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20 via Frontend Transport; Mon, 28 Oct 2024 07:05:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 07:05:18 +0000 Received: from airavat.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; Mon, 28 Oct 2024 02:05:16 -0500 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH 8/8] MAINTAINERS: Change AMD PMF driver status to "Supported" Date: Mon, 28 Oct 2024 12:34:38 +0530 Message-ID: <20241028070438.1548737-9-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> References: <20241028070438.1548737-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|SJ1PR12MB6364:EE_ X-MS-Office365-Filtering-Correlation-Id: 9aaf2f7a-1496-40b4-ae19-08dcf71ee181 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: x2QScQZ1hzSBbfjFJKq7DWzRgX0uAWZSaO+pesCweW59hPcF/2qebUBu4ZAQTlsnZpXlGO/MTfYec0bvC+LNir3N0Luj326Kw3F6ihFPg7RbY7o4brbOa5rW7OGqVTT/TABTPFHkckXJkp2I3jCF6WMveHT4+V7oQa2/kfEk6zJjCWxAbLzSxyFwOsIQsN6tCO2pgy2tir2T4WILZZoBtxKdTHwxxe5ibIms3dUEx/i0J8C8tCjVhf3KsLg+fHz4vbXIMYM3Cu3tQvjKmD3lfcMEsx7RlFwFFsp0W4ccejmGO8szTHSfApB6b/6XTGMxYyMjWBN9V79ctjT8DpfIEGnWlQlyMQZaRxOvl8RDy8DOGs3xy742jDbTTFoVqoYwmqt5duu9B2dfBLwn8nUtpTQTRoQ9uyet7eznwl/NEVFwkXz00y0Vk1KWFbmLZR8YsLeNkZtQwUKxiTEL2DwEgHYtZkUCLLPVdiZU5yfBzL7AXynJNqHoEXS/9KIgQzSU6PtfNXb7ZfBu6ZHtOQ9FAU6dfzlovGm37Oc+bOh04pbh3V6gRe1/1W/9rwWdk3YpDORgIcBDmbN7sAMOHGOpGfMY1v+RkK4Q2yqd5rngiP2XkSJYC3pCv7lMSZhcqd8e7xDJZEyHmxtEMNrHokB0wFsHrFCqDSJqtjRwmMuIZ/ZlhNf0ZsS9N1BFNfEMIEsarXCKbioNk+7N3f1dTrsmTADIEiX6SU25pjNjbV8vlQjTnc4pqzG34v3oq+OAHxuZ1ERaQKL4dz5Qmnl1tXmPdLikePo1LZqPm2x+4g2QGv5y+i4FAnsPH/19L7DdlHme9KgcMYcdYk2oKWI+CCDmAIycsum7J0gorNfRj3FfNoxVxp7wInrQjqG7IiEbLUd/cppBe8V3i1BXjLfUKmFScMYLjYRjfnUuSTJrHtJoqEkzKwNOkCW89zNerHri8NF7A6T/DPTtoYGZDGBVLrq9kzAciStd7/XXXC2zANTEiFtCsydA6hzKS/jUnd6QnLXOwxNRkIu7Ws8vJ0On+b4ZtAQXzQ2eZKjzsAbMXHuEFObqsVMfRBC4VR0BaWfcxTaAkKJSYRtl8wbX5+Y5BjAXtByvHzlja/LIvjLzNj/XQXEbrEp65KEDaq8EIRuDsRZVcJ+BuXtuMkQ92b3FXuArmGN8pFYQH3BsjoHybTdmUiiuPKuq8QdJd8prOqcnoPKh4Y/0UwbuJEafTj2vLeiNiipgE+M2NtzU4zqLshpt/y2EArmOyAuNu/HmeCzBMSE0k/7VVU4kO6q3WRqFqRdDN1oFXhVZLgW4RX9fSHBcBJ+t8Kd8jjd9Hvbg70RpdH9jdmCRa3T6nU1HSK3bRutJjI5G8ZFoNFmNmjaoQUZId1+tJ2E4HIO4nRM6TP3PfA7BWszxvmLJggP5WUeiMnnbWw== 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)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 07:05:18.3125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9aaf2f7a-1496-40b4-ae19-08dcf71ee181 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: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6364 The AMD PMC driver is actively being developed, so the MAINTAINERS record should reflect "Supported" instead of "Maintained." Update the MAINTAINERS database to reflect this change. Signed-off-by: Shyam Sundar S K Reviewed-by: Mario Limonciello --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a27407950242..6594a74b3d11 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1118,7 +1118,7 @@ F: include/linux/pds/ AMD PMC DRIVER M: Shyam Sundar S K L: platform-driver-x86@vger.kernel.org -S: Maintained +S: Supported F: drivers/platform/x86/amd/pmc/ AMD PMF DRIVER