From nobody Tue Dec 2 00:02:44 2025 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012065.outbound.protection.outlook.com [52.101.48.65]) (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 B7F9A31A061; Wed, 26 Nov 2025 09:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.48.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764147947; cv=fail; b=LhLv7Nh0Dy/quW7yWjiE24hULtIvSV80LuDDw3+nkKHyhhTmaenr4d9SKtLDjwl2bnVYXP8bOvjgYQ1m1AJqeYqQV+muOuggFI8p1LeFOMvZFJrscJb3OJyLIwM7wvP6cvvksAzKNBeqI3T+Qyyrlpv+aaIfClr0EYow05xe6EA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764147947; c=relaxed/simple; bh=V8u52wZ6Mp0FNPHYdv6t7FNbsPfj8ysfx3nTyxWGhcQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=lfJ2g2WtzpEiMD1nvEJKhQC8SDNapW5gyRg1TU9BYZCxnDEMGWVN6l3GfXReBlanLVFhlO3kZzyreGsMC3vNvAGRbodAo+YG82HwzHmMJv7N8tERvt9Wm7nrKj+xThTzjcAzSdaEeA4JXE98/AQilzt9fAtPTdP+Kou6zLeUlEM= 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=SvBaJB70; arc=fail smtp.client-ip=52.101.48.65 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="SvBaJB70" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GwszVpN1MCur5vvKSXEVDKebg0fwXCOII01cAzzjZHrplfIuzjRY3OqSbx2ugtTmxgRIBcwnKXgtuntSTRGZ+PL3Aikr+teKdm3NuCsAsfKeagS5ajsvyj94XVpURYK5O1UbKzb1wbw5eMnmT7t8dwkGkW31uero46z4OYi2yaDl3FhsXsB7eCCYIOWF23kJrjChkicXwvUbzeerrv6fmX8p1iv0EcoK774rnpbDPHbwBXmOpg7/iJtxGjcG7vF1CjB6xkfyYlAUcqhks6dK4bYwM3athGHP7kG2lmcGOtka4PmX/5uNqQpGkAd3RoF+Gif423Y5d3FJ1l0vXeB5RQ== 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=pYtFJZCA5t5THqbXyGxJ5dfcR8e4HcChKym9syxE6aY=; b=ojK1gKCkBZI/G9Yc2yafzCgnHynUaIC/TQzMKgoOO7MWU7/7Qnd90XgBZ8sLAzMnFnUaL/ellg9R7mHqR0as1YN6VC3SSuueqEGVaUqe8XvZ76W1HuFBvFfu1gEwevt/iYgur3fo7CTKgHa37p0YEFJNhyLZanLD35cCLXTm3qGwzuPg5fKdjR/gFyiUHKgFshI0zh4bHeRqWsISUW09WS2NsvW3qXDs7tMkqN5Zpn2kOczhq+xfa8zMntWSkCB6q4dMhQ2Denj2SuHdutP3zXKn1repm9TQHdA+EqGu8IziLW4/0BWhTsTeFJj6RnEGj6Nv/Qc3Z+70oCCooPuXKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pYtFJZCA5t5THqbXyGxJ5dfcR8e4HcChKym9syxE6aY=; b=SvBaJB70vMruvEmIrwV3nPzahKBooNFMXEFO1SmNQOQvEphcTylDz62q2ga4lpL5qYSu6EO/tUQfA8IaXs2U9HtVe1T5lSlRUXZr2v/MPYxlLdQzNY+1ym7CZSPdVJ5VHT0nsoSb7MGQ9tJdv9ldDHUxlYVgM2LV8itpAMITZ7M= Received: from CH0PR03CA0222.namprd03.prod.outlook.com (2603:10b6:610:e7::17) by DS0PR12MB9039.namprd12.prod.outlook.com (2603:10b6:8:de::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.11; Wed, 26 Nov 2025 09:05:42 +0000 Received: from DS3PEPF000099D6.namprd04.prod.outlook.com (2603:10b6:610:e7:cafe::79) by CH0PR03CA0222.outlook.office365.com (2603:10b6:610:e7::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9366.12 via Frontend Transport; Wed, 26 Nov 2025 09:05:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF000099D6.mail.protection.outlook.com (10.167.17.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.7 via Frontend Transport; Wed, 26 Nov 2025 09:05:41 +0000 Received: from [127.0.1.1] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 26 Nov 2025 03:05:37 -0600 From: "Yo-Jung Leo Lin (AMD)" Date: Wed, 26 Nov 2025 17:05:14 +0800 Subject: [PATCH v3 3/5] drm/amdgpu: add UMA allocation setting helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20251126-vram-carveout-tuning-for-upstream-v3-3-cf1729c4cb3c@amd.com> References: <20251126-vram-carveout-tuning-for-upstream-v3-0-cf1729c4cb3c@amd.com> In-Reply-To: <20251126-vram-carveout-tuning-for-upstream-v3-0-cf1729c4cb3c@amd.com> To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jonathan Corbet CC: , , , , "Tsao, Anson" , "Mario Limonciello (AMD) (kernel.org)" , "Yo-Jung Leo Lin (AMD)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6465; i=Leo.Lin@amd.com; h=from:subject:message-id; bh=V8u52wZ6Mp0FNPHYdv6t7FNbsPfj8ysfx3nTyxWGhcQ=; b=owEBbQKS/ZANAwAKAV8XsZZKKe6GAcsmYgBpJsLVwQ7X28lYhQzNXuAEYXlzvlwmWbCSX58SS 1HL6K4LzMiJAjMEAAEKAB0WIQQzqV4kW+yguuqHrw5fF7GWSinuhgUCaSbC1QAKCRBfF7GWSinu hjUXD/9e62bA68Rv7+fk4J2mEG5SFxgKDr+vQFhbpVVuil7yeChlfRkkVnnJhRWLXjz5enCE0zW PRxlSpRe2sjCwRqxFfvs4DYUj7ksD637HtEG791AL9jS+ZhxETOV3UyNA/1B7i9yMuyvGiS19V9 nj6kSSxDUQRmEWksmIDFbug9VE5//xHdhCu+DDohICIEQjhKCC/+mIV86Suj41GFgIebaJSXyI4 St3+kgJPPJ8cNmjnGvpOAL3Mc9X4sywMEhVyG4+jlgDQPfxgn9+6NwyFRpk3v8nwi8vyOG2jOuZ mnhWsbaPbzYftRYIV8fFVTPtarr+U+o2pzselAkxEumdAe/pJuEuuu1p0dx1WeUOe4UnpElL6Hn GTkSak8/8wSR2Kc6/Co+VbtX3SmT4AMr+DwvIjlbc69qvoAKaZxoHoGQggIK/rgxvFeldbottwf FR8MES5QPC/0MKw1ACDrqmhu8WyKKp0SGqgh7QKYGhR7pLGdDWpM7FmrO86QQ3nWYSXzv/WMr8T kLfSsI1u5XPC52yR/6hZqa04rCimpyaIXE66chdUD1t8lgcEe3+fu4xuUbB3OoEJEe2ltbDxfDT lhNPifKrcNq/FjDhZftoTwYRlWhqGp7yq31UraD9bWTq/0lzVE6xS7XzOa0S8uz50QDhi7obiIV xOZSMf4euwmBE+Q== X-Developer-Key: i=Leo.Lin@amd.com; a=openpgp; fpr=33A95E245BECA0BAEA87AF0E5F17B1964A29EE86 X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D6:EE_|DS0PR12MB9039:EE_ X-MS-Office365-Filtering-Correlation-Id: 27355ba0-18d8-468e-2bd7-08de2ccaf9b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aXVIS2JwaXZWNWtaMUdHSjhvbXpUY01ZYmtwZkVZSjlLRnB6eUpUcHp0aElv?= =?utf-8?B?M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ThpNDhuMDhmeDdCVXVV?= =?utf-8?B?clZJQ1ZUMGYyZjFUQktSMkkzNFhzYlRMTktKSlBFeG5WdUF6MGpUWENXSFQ0?= =?utf-8?B?RWZPektzak5lSldYclo2MGNzSnE4SkE5Y1NSM2g3cGRhMml2bG8yT01Hc1ly?= =?utf-8?B?dnNkSEdIcy9rZjgwOXJMRW1WdGRvdG9rcjFCMXJTcWtxVUk0cW1nWnp2bXNX?= =?utf-8?B?aklzZmhsZEg4UTZ1cHNpTEFkMko2Mkx1eW94L2ovM1JUZEd2aXlYN0d3UWxx?= =?utf-8?Q?pAo0=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2025 09:05:41.6570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27355ba0-18d8-468e-2bd7-08de2ccaf9b2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D6.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9039 On some platforms, UMA allocation size can be set using the ATCS methods. Add helper functions to interact with this functionality. Co-developed-by: Mario Limonciello (AMD) Signed-off-by: Mario Limonciello (AMD) Reviewed-by: Alex Deucher Signed-off-by: Yo-Jung Leo Lin (AMD) --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 43 ++++++++++++++++++++++++++++= ++++ drivers/gpu/drm/amd/include/amd_acpi.h | 30 ++++++++++++++++++++++ 3 files changed, 80 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdg= pu/amdgpu.h index 6873c020b923..613da788c9ee 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1718,12 +1718,14 @@ int amdgpu_acpi_init(struct amdgpu_device *adev); void amdgpu_acpi_fini(struct amdgpu_device *adev); bool amdgpu_acpi_is_pcie_performance_request_supported(struct amdgpu_devic= e *adev); bool amdgpu_acpi_is_power_shift_control_supported(void); +bool amdgpu_acpi_is_set_uma_allocation_size_supported(void); int amdgpu_acpi_pcie_performance_request(struct amdgpu_device *adev, u8 perf_req, bool advertise); int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev, u8 dev_state, bool drv_state); int amdgpu_acpi_smart_shift_update(struct amdgpu_device *adev, enum amdgpu_ss ss_state); +int amdgpu_acpi_set_uma_allocation_size(struct amdgpu_device *adev, u8 ind= ex, u8 type); int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev); int amdgpu_acpi_get_tmr_info(struct amdgpu_device *adev, u64 *tmr_offset, u64 *tmr_size); @@ -1752,6 +1754,7 @@ static inline bool amdgpu_acpi_should_gpu_reset(struc= t amdgpu_device *adev) { re static inline void amdgpu_acpi_detect(void) { } static inline void amdgpu_acpi_release(void) { } static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { re= turn false; } +static inline bool amdgpu_acpi_is_set_uma_allocation_size_supported(void) = { return false; } static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *ad= ev, u8 dev_state, bool drv_state) { return 0; } static inline int amdgpu_acpi_smart_shift_update(struct amdgpu_device *ade= v, @@ -1759,6 +1762,10 @@ static inline int amdgpu_acpi_smart_shift_update(str= uct amdgpu_device *adev, { return 0; } +static inline int amdgpu_acpi_set_uma_allocation_size(struct amdgpu_device= *adev, u8 index, u8 type) +{ + return -EINVAL; +} static inline void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlig= ht_caps *caps) { } #endif =20 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd= /amdgpu/amdgpu_acpi.c index 92070738bd42..bce9027fa241 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -670,6 +670,11 @@ bool amdgpu_acpi_is_power_shift_control_supported(void) return amdgpu_acpi_priv.atcs.functions.power_shift_control; } =20 +bool amdgpu_acpi_is_set_uma_allocation_size_supported(void) +{ + return amdgpu_acpi_priv.atcs.functions.set_uma_allocation_size; +} + /** * amdgpu_acpi_pcie_notify_device_ready * @@ -910,6 +915,44 @@ static struct amdgpu_numa_info *amdgpu_acpi_get_numa_i= nfo(uint32_t pxm) } #endif =20 +/** + * amdgpu_acpi_set_uma_allocation_size - Set Unified Memory Architecture a= llocation size via ACPI + * @adev: Pointer to the amdgpu_device structure + * @index: Index specifying the UMA allocation + * @type: Type of UMA allocation + * + * This function configures the UMA allocation size for the specified devi= ce + * using ACPI methods. The allocation is determined by the provided index = and type. + * Returns 0 on success or a negative error code on failure. + */ +int amdgpu_acpi_set_uma_allocation_size(struct amdgpu_device *adev, u8 ind= ex, u8 type) +{ + struct atcs_set_uma_allocation_size_input atcs_input; + struct amdgpu_atcs *atcs =3D &amdgpu_acpi_priv.atcs; + struct acpi_buffer params; + union acpi_object *info; + + if (!amdgpu_acpi_is_set_uma_allocation_size_supported()) + return -EINVAL; + + atcs_input.size =3D sizeof(struct atcs_set_uma_allocation_size_input); + atcs_input.uma_size_index =3D index; + atcs_input.uma_size_type =3D type; + + params.length =3D sizeof(struct atcs_set_uma_allocation_size_input); + params.pointer =3D &atcs_input; + + info =3D amdgpu_atcs_call(atcs, ATCS_FUNCTION_SET_UMA_ALLOCATION_SIZE, &p= arams); + if (!info) { + drm_err(adev_to_drm(adev), "ATCS UMA allocation size update failed\n"); + return -EIO; + } + + kfree(info); + + return 0; +} + /** * amdgpu_acpi_get_node_id - obtain the NUMA node id for corresponding amd= gpu * acpi device handle diff --git a/drivers/gpu/drm/amd/include/amd_acpi.h b/drivers/gpu/drm/amd/i= nclude/amd_acpi.h index e582339e8e8e..84933c07f720 100644 --- a/drivers/gpu/drm/amd/include/amd_acpi.h +++ b/drivers/gpu/drm/amd/include/amd_acpi.h @@ -24,6 +24,8 @@ #ifndef AMD_ACPI_H #define AMD_ACPI_H =20 +#include + #define ACPI_AC_CLASS "ac_adapter" =20 struct atif_verify_interface { @@ -112,6 +114,17 @@ struct atcs_pwr_shift_input { u8 drv_state; /* 0 =3D operational, 1 =3D not operational */ } __packed; =20 +struct atcs_get_uma_size_output { + u16 size; /* structure size in bytes (includes size field) */ + u32 uma_size_mb; /* allocated UMA size in MB */ +} __packed; + +struct atcs_set_uma_allocation_size_input { + u16 size; /* structure size in bytes (includes size field) */ + u8 uma_size_index; /* UMA size index */ + u8 uma_size_type; /* UMA size type */ +} __packed; + /* AMD hw uses four ACPI control methods: * 1. ATIF * ARG0: (ACPI_INTEGER) function code @@ -494,4 +507,21 @@ struct atcs_pwr_shift_input { * OUTPUT: none */ =20 +#define ATCS_FUNCTION_GET_UMA_SIZE 0x6 +/* ARG0: ATCS_FUNCTION_GET_UMA_SIZE + * ARG1: none + * OUTPUT: + * WORD - structure size in bytes (includes size field) + * DWORD - allocated UMA size in MB + */ + +#define ATCS_FUNCTION_SET_UMA_ALLOCATION_SIZE 0xA +/* ARG0: ATCS_FUNCTION_SET_UMA_ALLOCATION_SIZE + * ARG1: + * WORD - structure size in bytes (includes size field) + * BYTE - UMA size index + * BYTE - UMA size type + * OUTPUT: none + */ + #endif --=20 2.43.0