From patchwork Mon Nov 4 05:48:27 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: 13860923 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2079.outbound.protection.outlook.com [40.107.95.79]) (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 A7E7118787C for ; Mon, 4 Nov 2024 06:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700210; cv=fail; b=cuoH7UnGk2RiwpFloPEIJNszT6MILsv+oLcCujQRyYab4oG/k0IsJW0aA87IyBbiuKUZBOCBloItNpsdRUXHWoXPHjFeb/L1uIk55hCIK+4qjbP+eM+DszFD7Jd3qrfNBbNpBYlJoJJIcJd+zqxmmYzkrhG0epUx+YDKaOwKZ04= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700210; c=relaxed/simple; bh=bsnL10YwYDNvES3D7rX1Y/8PSO7o3i1QKDkiorHH7uY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NvP+cCJm9tOB4bqIGHGIFmrKwakux5RSBv3myDOMajEcEne3pMtMH9tVrpz6zaxkZZAPuv4MfkPrORSBDLHse/sRVilhNJ+kh7kyFUS88FQNkFlYt4es7UIrC2qmq6fyzxinRxx/XnvCisWEG3ef391yui8wOK04xbFmmUw7wOg= 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=5P4jCrVh; arc=fail smtp.client-ip=40.107.95.79 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="5P4jCrVh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iJALMKZIvt5LaKqd5q03ErAtMOulDMoziK9MSrEcx8GiO6AXPlAH1ULZ30O9JCI1EHyUUosWI/P98EPrjtGA8MZDcFBHwQYN+++Gsa2ncXFFRoQ58tkcU51lot8Qwdid9FHEOVk2VNbQWLSDifWKbUAKoNt8MQLxRVYTME2xlAc5kky7CKLxhwylXQgeu0PT2eHnbSaLzTLpMh04hogDtal7JlSLyttBtBW54VM6whQUfdGIYZXI4eQoEH13Vsf7BbRKRCwpV+z8q5jc8RcU7xFXuJqjEtwpc9ODyWTJm08TlNXubNZ8/e45ZGkRrHbZPe9poQqoNNBLkjQB1MEd2g== 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=QuLTDxRjwjExsA/nYxGb4601v/fDMgFIH3KNzURVFxk=; b=xJELmsUOT6JE+9FIeLY6EaIEbnPlS52Ts6vkbuI24ERAJh7k+De0P2pJ+8Ru3kHunjF56S74bri3v1k8SYPWI8cCHZYEjfC5H4GkCwj0YFJSFgOznZ6aDrjsnisbJBAKLdwne/Lz8uMmTG9KmAo48GZe47xmvY6H9oB07vu/WGo/Gk5bzWD/VidpgDzUg2u46bjpworiOHM8woKC13xALNjUQlgLcUIDty61whvBzyX/0VGZim8nk1DOLN2BGvXlKmJe8ECgf1QYQ2rpm3H20Qb4E4V8nAVtg00o9W7+R/8UwBYAyS+Hi8uMcRBFnQ7QRT66z/y7iQetQxwDsaP7yg== 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=QuLTDxRjwjExsA/nYxGb4601v/fDMgFIH3KNzURVFxk=; b=5P4jCrVhrzsT8OdlnJHtxMArMzF6kMSRBfXQyDFvFxD+vVh5O9wwkEyy817R0yOMVCQQ+Oqydn7OKUAcvwkPqeVxr/tzAdK+p9fp2yiu9ftczXADy9QY/vv7hupmuS0wa9xdX3pK2dvQyfwF/L5epXXnBomBXI0LHaGtiCdbR+w= Received: from MW2PR2101CA0006.namprd21.prod.outlook.com (2603:10b6:302:1::19) by SJ2PR12MB7847.namprd12.prod.outlook.com (2603:10b6:a03:4d2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 06:03:24 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::e7) by MW2PR2101CA0006.outlook.office365.com (2603:10b6:302:1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.16 via Frontend Transport; Mon, 4 Nov 2024 06:03:23 +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 CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.0 via Frontend Transport; Mon, 4 Nov 2024 06:03:23 +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, 4 Nov 2024 00:03:20 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Mario Limonciello Subject: [PATCH v4 1/3] platform/x86/amd/pmf: Use dev_err_probe() to simplify error handling Date: Mon, 4 Nov 2024 11:18:27 +0530 Message-ID: <20241104054829.620858-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104054829.620858-1-Shyam-sundar.S-k@amd.com> References: <20241104054829.620858-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FB:EE_|SJ2PR12MB7847:EE_ X-MS-Office365-Filtering-Correlation-Id: b50cb026-c09d-4615-99ec-08dcfc966460 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: vpqxotv/vDoALsgCwFUpqyTs4LM93VDqWqTHHY3rwH/sQqcdh2R3LTBLfXNK38/7ghVocWJtd+Kl0PLCh3c4KcMYjVcYLUQjfHfzCs9NSVDBeUS6pI1fxslWhXolPKedkirAKwnVm9dnwbTkvpRNeeaa/EIGdvP7wHmQndG91DH3MhNUOlYFbczIzKYxZkX7MVhaO9XtHhbImJKoQNsYNg6p6OXA/c0GYYjIryOoc+/mKI6qvXJkEjSlp/sEwzgiPoUzsmG7dAsXq+u/sABtLPCAFoedlKqlYQdo/9U4JpGemep+ag85nbx2Q1NGsCMsFAKJWZK7q/8UgjdKI9DyD6XigCAaCvr0lqI6cZ+cp/L5XQP4DsYDMkrRmOdftVs17ZMyEUb3dbJ3H5I86/x9pzRO1k3g57vLPADjG8GXjLoig9GnE2iv8smReTaJM9mIdo6YBxZhPpp7k187jfyqIqemwjv+lCJOGOHcjDW7scRZMpqS5T8TPdvx3FQ/Ntv51UBmv0VYBbODufrBSgTnTSDJcL6ycQXhXRX9jxP3PWWHhNq7NNvjYM47P1ykoqOo9YxB8gri2TdSMAXFNOedmvFDEejFqoFKOTs01S94zYzoOA1H/CruJWcnYqfUlMPSN+W3KSS9gJzMGDvZjfmPdTsapMwvsYE4CcBpiuZYThY7dL7Xk0UhEBL22E0Wij23DfXCoBFkD7PS2PnmlWOsHgF/90TzVevHIR3UL1fK93omqlFzE7urkF0N9YaCCpmlXqtEZTgdgBa6SWT/5lHM4Ul1D3d0Cx5YhyZSJufVJSwXb9uPOJ3Jml+V6oHtMFM6LsIJn1nlu7RUfp3kejh5mLHlG71XSCDI3AkGQ8rZv+r3bJIsnWRsDSzIlqA1v9pjPP8k2LurgD9uUhzocdZLxGJr0PbOUVy5S5qfSrfzsNBQUMP62QO//bWot6SzCJsrBPO1PVAWUFJQabHb+QUyZrBS7OipwINKNZRht5twOTqh6jwwvUNE7eklyVrBGv7gY/hOG5x1+n55Kmes793HQ7aMIk72Y60HiafW+lcLTlbnFCEJQljWR1K26IUPmwL56rCZiapwKbHdipTpF8RGa//FJ1ueqqBA45X7w2xhKvvOcyVknnupWdacqMPPFFqDZLIoFLcqnFDOKT0dvdZnMANr87HNPVI0dsSRYeCV0BXTScKB2II+uAEQfKtZO8VRbsS44UlCUhiWs+gdJx7PhmghAC98FStENe1SQWkg5voximHAPTyy/M7xXHJoA8fxKVBEUeN7qw087kD3YQUBnryalpwBTUYvJpm7t5CcF5NQr7RTrLojHG8nFzqDCDqEzfF1YbmpaogiLeDq3KwNXXcgs8TSit/WXJXeTSUCbcgZlqjr7Rr8HZaHgkGQlN+6zysgQn47kOasNCUYTCBlWg== 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)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 06:03:23.7551 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b50cb026-c09d-4615-99ec-08dcfc966460 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: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7847 To simplify error handling in the amd_pmf probe function and reduce code size, dev_err() is replaced with dev_err_probe(). Reviewed-by: Mario Limonciello Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index d6af0ca036f1..7ab8b7f74629 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -429,18 +429,18 @@ static int amd_pmf_probe(struct platform_device *pdev) err = amd_smn_read(0, AMD_PMF_BASE_ADDR_LO, &val); if (err) { - dev_err(dev->dev, "error in reading from 0x%x\n", AMD_PMF_BASE_ADDR_LO); pci_dev_put(rdev); - return pcibios_err_to_errno(err); + return dev_err_probe(dev->dev, pcibios_err_to_errno(err), + "error in reading from 0x%x\n", AMD_PMF_BASE_ADDR_LO); } base_addr_lo = val & AMD_PMF_BASE_ADDR_HI_MASK; err = amd_smn_read(0, AMD_PMF_BASE_ADDR_HI, &val); if (err) { - dev_err(dev->dev, "error in reading from 0x%x\n", AMD_PMF_BASE_ADDR_HI); pci_dev_put(rdev); - return pcibios_err_to_errno(err); + return dev_err_probe(dev->dev, pcibios_err_to_errno(err), + "error in reading from 0x%x\n", AMD_PMF_BASE_ADDR_HI); } base_addr_hi = val & AMD_PMF_BASE_ADDR_LO_MASK; From patchwork Mon Nov 4 05:48:28 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: 13860924 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) (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 F14F118787C for ; Mon, 4 Nov 2024 06:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700213; cv=fail; b=cakTMsKHKXTOtDun4/tCBHmLGiF2XyAfdLCJbF3CU3hs6Xw4Y2i9nULK2cvureHHgIWkfzNxhaEH6jNfCMTpIBJ8G0DuSw5osVd6wuQ95pqjXd/qSYkisY/zM43cYkgAKGxKgleMt3Dfh220nC4Qk0JcDOEr3VMSD6BjJxFX6ek= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700213; c=relaxed/simple; bh=ItW5utDUGv/PCLdFfctDRvtrA9potxJI/S0dgPBaZ4g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q/AzUbL6k0G8PiuR+5myL67v0wZz+CPfEHVUrBCL2BHrfC2UyqSbzcdzgFJdSXM5XlfIaEct4RxR5d1uCurIi0bc4znFbxFRsH9PlSGBfx1kH12SZPjWnQ0T1GvGf7lbbAGB1KIiwI8F/p7cz6XA7Q984t5Uh36CfDs1JEjc1eU= 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=QEgYPN7a; arc=fail smtp.client-ip=40.107.94.89 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="QEgYPN7a" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cNjzwdS2rZKq60xlil58qGiBCnZAyijtodnsED4Shvt4BTViOmB0SKj45Uc/hHsHAweoQkchdP9aVyIsovcE1CYgBFZbPnikOx7j/ojAnraxprFXkU/ahCjfhOzJ4izpO5/nSw0M7ddaDmlMZ/6Xj+FtSKoJqyiGczXfCNu9tB4LQPs1K+eohB9LK0wRV7viO1m00c6YN9rpYPHFqAiGi3oeHvBtMWq2TxhtwlL3Ufvw7VFPHtwGIl+cJ9WheosSoI6uoDIwc9JDnwjc14HPg02xKvFqbTpD6EqumYXtn3TpFGdHvKJ6AEX00Wq6nboOv4CVstu6FiKcg4VofA5yjg== 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=CmZFCE2fbom1Ithev7IUDq1fhChqMuJCyI+0iix+qTA=; b=DNS8aHL53DYhLLno41VayJCabz38bIpOqnPfgHY8TjfawWucs/8xwcx1tO8QwMXPJyYWINGag05pMTB8f1yaIPjhIxswJ7uBgpk5WR9M8fuqDe7N8Ij1fKlqJ5YcHAq0zMWcwrUUWiLPHGo2qIG/oOtejLrNR/BbAZd2qgvZc1bovfAC6135Ot9CoS9ZrJbK0a7/Qa0vgM3adlxR8cKSBIGs+HeatmhW3bxO7RLsEoyYD3ZMAkYKt2a1nAZwsvhwfkGk7QBp4kZIg44wtux69JZW8IJZ4hCulQhqbMN1zfUKkpjJjI7iXG7GAM0paIsUqHdrhvfpeprMh3A6Yuyu3g== 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=CmZFCE2fbom1Ithev7IUDq1fhChqMuJCyI+0iix+qTA=; b=QEgYPN7aKCvP+8jNIY7ROwx5SklFInPEWLsFiK0fio0ccI8hTuihCBcxx3ll6tzjSPciYu1d0dtoMRAc+F2yg4HunTmoHX+AvxYA3ThDzp4Izg6XktTSIduxMt0r2lHgSrdvheTKWtEUiQRvL8V4H07fmtzcvRUSvhZSjSoKaJs= Received: from MW4P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::8) by MW4PR12MB6921.namprd12.prod.outlook.com (2603:10b6:303:208::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 06:03:29 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:114:cafe::ed) by MW4P222CA0003.outlook.office365.com (2603:10b6:303:114::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29 via Frontend Transport; Mon, 4 Nov 2024 06:03:29 +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 CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.0 via Frontend Transport; Mon, 4 Nov 2024 06:03:29 +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, 4 Nov 2024 00:03:26 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Mario Limonciello Subject: [PATCH v4 2/3] MAINTAINERS: Change AMD PMF driver status to "Supported" Date: Mon, 4 Nov 2024 11:18:28 +0530 Message-ID: <20241104054829.620858-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104054829.620858-1-Shyam-sundar.S-k@amd.com> References: <20241104054829.620858-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FC:EE_|MW4PR12MB6921:EE_ X-MS-Office365-Filtering-Correlation-Id: 7915826c-96f7-459e-a824-08dcfc9667df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: mxxCBpcEjHOgUzlC9HoZ1nIofOqIH64Qohe/eDsvp1MhaIhu5RWTKudNHkjgVsvtLJItkqT4XiOqqxmoaB9qyAbdcc7mFy68ayRP1mv+yRJNpQJ1AYYy/BZxTK6behYoeeHuNfLS8AS/We8FLHNhVCPmA2AeJLZKTg1bHAa6LJDTGBMd/3ASfr/XVPXuGFCQ0VtGLX5y820IHBSpVO71xcpBupg2R9v2yS96Uu0fCa1qr8qUQM+7ekbRiqx21zw5XHyrD4L5C2MCktkTg8cAI3XUXTLp81fLVykHxUoQqHmV56JKf0PqDO7Co7HvdeVqqPpf/jzFRIZ78xv+JPuyECxTaTLYowdLhqJiT+0UQRX/WwBEXiyEoi6uMuORhI/gFZBP1eMjWMtyhxWor4bKrPJpDFogLVId3cweYma7r/rKmX1qQnNbm4c+j54MZz5nkWow2+pHL9bGIMz1aU3roNYlhrWd6bTm+YGJ7eYgr1/re8eZOoTyACcnjrlzQa7SUmojA29NH98kj9NiAN+VkTXHvVLd4OnqZvye8rMk27UKStYY260BVdqodmyGdqfMBWPat6G97jo16hQStFNauetW+b5kfVNVwkS4vCKRGgpZqzH9WDuVQCCKLHq/H5ZWKeYftJ9VZ2c0ztTsM/mjlx2TAMmWExbnIbYo7zm1BCHK4T+bzhv6OJCz/YJZZgVAHZUZLpMdHITl+pwK7HhOYILBhIvQXp7/bFzcYe6ImlwWSeo0NJYOssiZLw6pRauFsIGIj27YdftnKqLjoqicSCtPjIOky7NUHXnrM+IUdlnm9SIZSYQN2EXaFbJs/JV9KF5OPlaYwBag5Pp1rrslkfRlOeR/qwaN+/8FUsOqi9htDuf7/vBQkDNa8kHc+B9wni32B3FFSeZgoFYKQloJjokS4hW0MXLTw7IX3B2eRO8RMMvv886eKWGpBTbTI/d8bQ4v7S/MTp7gYE7xMghQ1t9tnncVDm8SiKry24yaBCxzgC/ozithXgUSPbzQNrXN/8zK73PcWre5fC8WQo/Rr4gIeLmOMcBcSBIlm3+v6WBqmwVQMrXTgh6bitbXEbxIw/mO32Ma4ddFuZ32cBQkWTSTRdxj5y0y4ULnNvPVL149SE1lDJ0PSLKxjhqDexBoN8EdIZRAA4LJDG5fNaaO8nYFLJmc3wkqKaeCQarwF3XVf5oBdE73OCPy7vGIWaKfOqhU+FspFnt6NuCyi1ElK0cGy4jtBxPJLzINCdyiucVCYnIaXMbURkx90gfmoRtMKNS1Hcz/5zriBQTY1qg/NRDY8Wv499BQKjemOyvKX1ph64KLqC7mTAjphwN+TZIb94fcxpA00S8UeJhBF9EaNasBxdCBz/mYCfbUInstEA4xTiwdEhH/jEfav91N77XN6AdYmt6whS0wCC0jsJZTPg== 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)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 06:03:29.6210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7915826c-96f7-459e-a824-08dcfc9667df 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: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6921 The AMD PMF driver is actively being developed, so the MAINTAINERS record should reflect "Supported" instead of "Maintained." Update the MAINTAINERS database to reflect this change. Reviewed-by: Mario Limonciello Signed-off-by: Shyam Sundar S K --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a27407950242..87f67c52d68c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1124,7 +1124,7 @@ F: drivers/platform/x86/amd/pmc/ AMD PMF DRIVER M: Shyam Sundar S K L: platform-driver-x86@vger.kernel.org -S: Maintained +S: Supported F: Documentation/ABI/testing/sysfs-amd-pmf F: drivers/platform/x86/amd/pmf/ From patchwork Mon Nov 4 05:48:29 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: 13860925 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2047.outbound.protection.outlook.com [40.107.223.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 39A5318BC37 for ; Mon, 4 Nov 2024 06:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700217; cv=fail; b=FdMnP8QOihEqDMBHS+cYrIIP2QRsRaL4s0fnrbi63gzTm73+ejSimrE9kc9z4mWhyKNZlpaAoEwFC9CCWnhbv7Q8Q0doHZ04ClA8zEfBLC0eCclxNa4QYifLdch1fIfIjeg+y7ehBCoEj/ivpnN0hsLKyAiCtheLWiJNM+N0lyw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730700217; c=relaxed/simple; bh=NR29/IG6QBvj02wGoouOS813XAfvp6Rh3yz4AWsvT9U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c9rAN8pXlPa4aTp7nxxaWwBEDwLHMV/H4Axj0gHbhu59ltPNoMWlz8e8HOT0/FyWXLAS1xFlWOf4qqdYKZiM8oTLel3L2Do2GbdBZI4xkzRSBfUIWkTaILLOA1aLi/bdQZos9weX/mt0K8ewvO0UjI0BQ5U28auIP/s5v7hJgkc= 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=4XLJQeOp; arc=fail smtp.client-ip=40.107.223.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="4XLJQeOp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=niOSL3S02i1cCAqQAIugaAMpxM+FXpdPeIJKeqGsK6dWrKpaMPnlScs+btSns4iKU2DeBYeMYI69BVWcJHbEZ4S+53EQk4/5Fc1nNX1MPuh9ccCVEH0LB8j1KhKb/8MuDRTAMKF7ORUviPrAWoymHjWkeTlWOd78+JtDJ+hhRQpbXb9s5cBC9zAhYE4RAAWH6QMtPQWkMCCGbAK0qX86Y8yM3vhigO3dDK7D+pGQ4QY+zdNKX54TXI5vbII8YaN0HyOB/vI4Eq8P55XAGqljxFaRTrCVELZ2LpFl0a+x8gKXpBaJ6usVrmttJxcnIsvJ0zJqjj42xByRDFXGlnUqsg== 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=etZKmHpqXImONfNDoclQ/8XpABVb7Afu+DJ4/jSVCko=; b=wVyae9Y2HHJL7ZMPcUjB3oqLNyq7kmKe61XtRmOBBydzM+oYGjoOatMkCnv5mN+YTX/4UBrUiXiWdCGdjufXRPvmsh/Twaw616tRawhOtwbG092n4ThlwbuE/2gczk96HR2uZqV3bvE7R1aqPeRznpTlF5YabRzbDtLFr15XV2KNcvwo0zLb66+dFD/Lqwd8h7zCSxi7ddZF1ZJPFaGCnEEyP6t8Ztjurovj1XIGxw9YFB5L3X8dU4A8+wfCtdC7O9roT9qaNPUJkwZbg/gJVbqgu7+2prYYVPFIWtrEVUtQo1ENqR73zqj0wV+EGPYeaWIw4527GF4PR63YhPA2Ug== 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=etZKmHpqXImONfNDoclQ/8XpABVb7Afu+DJ4/jSVCko=; b=4XLJQeOpE1zXAU6M0pwErxjsPIWztP3DBmpH6OzqPJ+yB5+Ez4Kt2IQwQMoJT/XVeYQpOb9Swi8xvl5pewG6w+uk7ReYtmntHYiOULF8T4SdhFcqWR/dqGQqHwqsjr7UvicoiZkU126xcyLZd/dE2cMlce9u5jjymIiZd9jrWKI= Received: from BYAPR02CA0057.namprd02.prod.outlook.com (2603:10b6:a03:54::34) by DS0PR12MB9421.namprd12.prod.outlook.com (2603:10b6:8:1a1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 06:03:32 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:a03:54:cafe::d0) by BYAPR02CA0057.outlook.office365.com (2603:10b6:a03:54::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 06:03:31 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.0 via Frontend Transport; Mon, 4 Nov 2024 06:03:31 +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, 4 Nov 2024 00:03:29 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v4 3/3] platform/x86/amd/pmf: Switch to platform_get_resource() and devm_ioremap_resource() Date: Mon, 4 Nov 2024 11:18:29 +0530 Message-ID: <20241104054829.620858-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104054829.620858-1-Shyam-sundar.S-k@amd.com> References: <20241104054829.620858-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|DS0PR12MB9421:EE_ X-MS-Office365-Filtering-Correlation-Id: b115e0a7-4146-4336-cdfb-08dcfc96690f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: BEBQDmlEwi7VIrqp6dTW4vSYeHm04tbqMsFX8p6iBOXHsiHn7dukVmllcI2c8U3l1Houdj+C3x5e8poUrmYWitbOvi/XkkmHMZYWLu66RYtAug+SNM9xbA6QKkfTbzGUObRn7TeGscIsQ4yItbGN1Ubazlqq5TVVJuhmj0G8weZO5jUfy/uJSCSu6GLMDyKX5eAmlmzFVU5Js6fUD4NfRrgJHhFEpQ/IeoUKnpoFvhaN80LCOOXub6dy55o0Xx8gemqjy8tlW4r6Y25QZ4hFoBeR+0yF//MAryCrT92Ej8ilwzOIOKbPDlKB9rB8C3cZD7ax4d7e8fZY9GfUGoi6dEPgOs/7972QAWDSvxeTrXV7nNcCv6O3ehUJ3Jb6chB1WwqiUkqDNl3tcalhDUXl/83q5Ej1lXR0AIKyxyIeMOhwUhmBNHemh7GvjGLEy13aSr9PhwsJygdw9Ej8tLxeSeTGfxCfu/88VXxC6DmOhNhJ9r2h/oT3O1eL4/V53Vg8BPr0+K+2rOuiPSRL9hZJzUux1jnBEWyfg3JjjjlqlAbkOTBjFgbAs+minLfh0KJv1E+CPyguAx0VMqTaZG4vKk3HkhAKk+oMMTOLwG7ueFLvxJ1l5f6ZsdYN9mDJs4xeRRRqxc0eqk3fxmJB7UklO04bRMqC0b9gGz4Et8N0KCoP/6PGDjOGBRz5N580uSmV6qjvf4CeirUeyxFbEt8fppfXjtEFs5Qq+TRa4wQG9QXUVd9WknmqdHHL+0rT75uiw13BWER9b6rdHfhuzqp0p0nOGeP1Np+W2mRmjJSWae2wGCppgvuo5ZJUX22gUNSyiYQpzkohlXZ+yPC8gIpd/cQ7F7Q/wkYXqp/uWXn3leQN2BZ80IFi496D5bCg+7vsRvFoX1BhKE5/iznaTM54jbtUbsi9w3H1JxS9KZv6GoM7Y3vh+MT0IZ3dWb9Dh+bw6rGABjHTbP80ABnwES+6sk5g8OSAEKXH51HblYnmjSMY0v8XIFEvcXMljGrQx4mJyiocLN4r4ZqBl93YV8jJHPIHMWHA5iY7F2YutlYrtT4XI49x9GIXJ44GdVIx2feELvUq2ywPfPsg76ZOv7ztxu45HtxhwHMBzUNK/C2QcAMb4LjyX9YPKOrbhSlqR+t0lSSLWnkiGDz2io/IuLGPQtwc2SKsroN2n8GAvS1xbtysErwqM6P6FEU7eDH2OLV7eLC6FQ14PcKoG3In7uPKZou1Ud3dMPg7rP5618ezjRE4YKhVYkwHr7MGSMnojzVhy8/pCyB+6V6ipiM09mMp0RymHTA4npTTawU3ygDX3AuJIOPTcZ1EBIDhm/1CSgb+nazh5kVRJG7KVurkiwS6SFWHNwlCeU0hksFUe+q/2IqtpPoykRnZ6H+NrO72DbTPDRXjZxweQVvhNwq/DCyg1g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 06:03:31.5986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b115e0a7-4146-4336-cdfb-08dcfc96690f 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9421 Use platform_get_resource() to fetch the memory resource instead of acpi_walk_resources() and devm_ioremap_resource() for mapping the resources. PS: We cannot use resource_size() here because it adds an extra byte to round off the size. In the case of PMF ResourceTemplate(), this rounding is already handled within the _CRS. Using resource_size() would increase the resource size by 1, causing a mismatch with the length field and leading to issues. Therefore, simply use end-start of the ACPI resource to obtain the actual length. Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/Kconfig | 1 + drivers/platform/x86/amd/pmf/acpi.c | 46 +++++++++++---------------- drivers/platform/x86/amd/pmf/pmf.h | 6 ++-- drivers/platform/x86/amd/pmf/tee-if.c | 8 ++--- 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/Kconfig b/drivers/platform/x86/amd/pmf/Kconfig index f4fa8bd8bda8..99d67cdbd91e 100644 --- a/drivers/platform/x86/amd/pmf/Kconfig +++ b/drivers/platform/x86/amd/pmf/Kconfig @@ -11,6 +11,7 @@ config AMD_PMF select ACPI_PLATFORM_PROFILE depends on TEE && AMDTEE depends on AMD_SFH_HID + depends on HAS_IOMEM help This driver provides support for the AMD Platform Management Framework. The goal is to enhance end user experience by making AMD PCs smarter, diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index d5b496433d69..1b9c7acf0ddf 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -433,37 +433,29 @@ int apmf_install_handler(struct amd_pmf_dev *pmf_dev) return 0; } -static acpi_status apmf_walk_resources(struct acpi_resource *res, void *data) +int apmf_check_smart_pc(struct amd_pmf_dev *pmf_dev) { - struct amd_pmf_dev *dev = data; + struct platform_device *pdev = to_platform_device(pmf_dev->dev); - switch (res->type) { - case ACPI_RESOURCE_TYPE_ADDRESS64: - dev->policy_addr = res->data.address64.address.minimum; - dev->policy_sz = res->data.address64.address.address_length; - break; - case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: - dev->policy_addr = res->data.fixed_memory32.address; - dev->policy_sz = res->data.fixed_memory32.address_length; - break; - } - - if (!dev->policy_addr || dev->policy_sz > POLICY_BUF_MAX_SZ || dev->policy_sz == 0) { - pr_err("Incorrect Policy params, possibly a SBIOS bug\n"); - return AE_ERROR; + pmf_dev->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!pmf_dev->res) { + dev_dbg(pmf_dev->dev, "Failed to get I/O memory resource\n"); + return -EINVAL; } - return AE_OK; -} - -int apmf_check_smart_pc(struct amd_pmf_dev *pmf_dev) -{ - acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev); - acpi_status status; - - status = acpi_walk_resources(ahandle, METHOD_NAME__CRS, apmf_walk_resources, pmf_dev); - if (ACPI_FAILURE(status)) { - dev_dbg(pmf_dev->dev, "acpi_walk_resources failed :%d\n", status); + pmf_dev->policy_addr = pmf_dev->res->start; + /* + * We cannot use resource_size() here because it adds an extra byte to round off the size. + * In the case of PMF ResourceTemplate(), this rounding is already handled within the _CRS. + * Using resource_size() would increase the resource size by 1, causing a mismatch with the + * length field and leading to issues. Therefore, simply use end-start of the ACPI resource + * to obtain the actual length. + */ + pmf_dev->policy_sz = pmf_dev->res->end - pmf_dev->res->start; + + if (!pmf_dev->policy_addr || pmf_dev->policy_sz > POLICY_BUF_MAX_SZ || + pmf_dev->policy_sz == 0) { + dev_err(pmf_dev->dev, "Incorrect policy params, possibly a SBIOS bug\n"); return -EINVAL; } diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 8ce8816da9c1..a79808fda1d8 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -13,6 +13,7 @@ #include #include +#include #include #define POLICY_BUF_MAX_SZ 0x4b000 @@ -355,19 +356,20 @@ struct amd_pmf_dev { /* Smart PC solution builder */ struct dentry *esbin; unsigned char *policy_buf; - u32 policy_sz; + resource_size_t policy_sz; struct tee_context *tee_ctx; struct tee_shm *fw_shm_pool; u32 session_id; void *shbuf; struct delayed_work pb_work; struct pmf_action_table *prev_data; - u64 policy_addr; + resource_size_t policy_addr; void __iomem *policy_base; bool smart_pc_enabled; u16 pmf_if_version; struct input_dev *pmf_idev; size_t mtable_size; + struct resource *res; }; struct apmf_sps_prop_granular_v2 { diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c index 19c27b6e4666..555b8d6314e0 100644 --- a/drivers/platform/x86/amd/pmf/tee-if.c +++ b/drivers/platform/x86/amd/pmf/tee-if.c @@ -257,7 +257,7 @@ static int amd_pmf_invoke_cmd_init(struct amd_pmf_dev *dev) return -ENODEV; } - dev_dbg(dev->dev, "Policy Binary size: %u bytes\n", dev->policy_sz); + dev_dbg(dev->dev, "Policy Binary size: %llu bytes\n", dev->policy_sz); memset(dev->shbuf, 0, dev->policy_sz); ta_sm = dev->shbuf; in = &ta_sm->pmf_input.init_table; @@ -512,9 +512,9 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev) if (ret) goto error; - dev->policy_base = devm_ioremap(dev->dev, dev->policy_addr, dev->policy_sz); - if (!dev->policy_base) { - ret = -ENOMEM; + dev->policy_base = devm_ioremap_resource(dev->dev, dev->res); + if (IS_ERR(dev->policy_base)) { + ret = PTR_ERR(dev->policy_base); goto error; }