From nobody Mon Feb 9 16:32:51 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 70C8F31770B for ; Mon, 10 Nov 2025 16:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762792790; cv=none; b=hc9hf68PBDqx2piHY9qu+4CDwflEyW0YGyuY4UQriufe/MG4CVf30vuU4zevcayhN5R2XNWuOsG/+V8nEmSWz3Yjz28s1tuOCCgtWX/m059ycON3cLm/WmUvSizmnVexe1iLV9BS9GjXAkzBBZaGEr4gjTgQ+XvIEktRDCyvRGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762792790; c=relaxed/simple; bh=fzcOZoDy4nq3d1scAOabdvRSkEECFucdbBehDf9L/KI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DnYhgerE0/Lq4JgE+7jHfHi8HPeNHj+PO/FfSCbyonPx1cAGIq6AuCz0LlYutr8xk17L1GYjiGErQ0f9xId6hafRp4I6pqgGg/Q7pMh/n5fGsIEt5KbXwzDXP4b/OtY0Pfbl3yf/XnXDhfGk2L1Gx4DoueFkBJqaKJIW9xbE1Hs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=SyeuIyz6; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Lkl2h6V7; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="SyeuIyz6"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Lkl2h6V7" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AAFiVuG3987183 for ; Mon, 10 Nov 2025 16:39:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= jVLv/uuU3JLI+2HIhCPmdUPs+Ebzue4D+35QDRwfYvo=; b=SyeuIyz6FatLdy85 2+R2RrYS/LZQlPTNKhjelJkKMXoqwAE+ll8dntF4uoosoiZYfd0yzzIXRdHNd42h H0o1CV0SeN7So+TAQfEufvTlaX2BqQHhdT7MJXAGhXuV/Q76jkXTkQWcWiw0qdIl jlhDw0lEANwP02sulVTYTJOkQdTwcp9sHOJlz2Hrg5vEivBArOZhBjAw0eCQRHHV svzQ2FQfZENUbur/QwDwRHnhhWcB+5vcteZn+DQm+VsJRTExcuxfk86qvkoV+jLk 2CcvL48hUC7rwW48X5VRokkli5psjR4iAj0UXdRrQ8WLMuB+apK+TFegXrz6GRlB fkrelw== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4abjxqg6ug-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 10 Nov 2025 16:39:47 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-341aec498fdso5191826a91.2 for ; Mon, 10 Nov 2025 08:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1762792786; x=1763397586; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jVLv/uuU3JLI+2HIhCPmdUPs+Ebzue4D+35QDRwfYvo=; b=Lkl2h6V7cpuGY+7upzwQY8Sv9eMxWRjn6+W/r3r5Ok2WmD6XFwJ+O47ThPcmiOqAHp W303BQ8D77cQYoorA29JL+y7gSrs541kcVGo94oQWA1jI/7IZGB9eEiTQ/ygKqlzocyy a1vEMXrxnod48nZxvcBmd1bANBWVlnRHlfZHQa2PRWyCAaiDdr6Ju2Bgz3j2vr5d+EvF GlC3G+XLAjBCHlLxDzCW8zKQHIgBNjZXBHt3+FS/fh19dVOMCPa6O89OKhPUwGveTKV1 UEzKiZm8kd4qp3ngTP0JJdL5pwefwNgjyQrrSBVoVCjcHXbz+ZpVENpXcFV1Uo+KynID cbhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762792786; x=1763397586; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=jVLv/uuU3JLI+2HIhCPmdUPs+Ebzue4D+35QDRwfYvo=; b=b9mTuTt0LkLurG+1M4st3sZkfcKwDIy8ncEQCP+26481rD2E7Q7fFsbmx6sP3N7Pn5 lukfDsC27qibkiSnHg8kKoTRzHd7IvRUYQ9dnl11N269fM0eDlEhTMluaYP8VT986BPb RdzGXBNu39ep6phSmhpoAtW4fOK2WdFLaW+oEsMEO4OnZAQCYvVLIMm8ShvGLzERZ/rT pcpJ8pnRKknkaXZV1o85cK3/ebuJatIPFpkIDDl/fbvTLBzvzrkPAsQapfZzFqkVdkTe Lmy5MQp33At45ViOEUsA1iz40OaXIR+rDT79BmkNJ4JBAZX1NbKeKl7QlZg9qqFbNjZ1 cHQw== X-Forwarded-Encrypted: i=1; AJvYcCXMEBBAPxLDh5GmfQFwQDsV7bJyvjY+YXZtii3TgY5upSQffHe9WNBEuTqLnxRvShatYcDYegFWk8M7D9Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxEbV7nbORgZpfJ2dlAjAEawy5QUzvmhSwzVZSe6QyhszujqG+2 DUrUW2OvLJHE1i1lVdIjaRUKbBUjK/uuIlZbaeJRg7POHHebbXx8ry9Vu39iZBPZgBtZNZbpHx7 dImXuSRI+vZhVVleslpqdpikcUUC+MxgbGUW2kVYWc3p1NkLoBSWZm72YDSFgC8rLlR8= X-Gm-Gg: ASbGncvV/RDi0rInLMPicklJXpKlJ/XZ12mzUhdYbY2wUuDySg3jdxTwl22o09iTt52 uHWXBdwkWckK07c3r115qTk5iNStS3rezXXASbcqXFMshRG2xKhktcqSNCSlrlnPvvVM0x0DLXx fBRNH/P+SvfKoMlFSL0OOLAaaOcn8bDqrnJdmF3esRTPAYOqhp39BBfholHjkowM0IRur8XWjsH w6GRUG+vh6mbEQpfJoM4WWwQ+Txm465aNIoQ8M/ApimlsHZA8vfq5SPFBi+cIH94EiQ95RM9jFW f2p4NOYD42dhWHAL5lwO2DRqmhugSmSox1h2LeRbsVsoXURcaoA2DHBbGLK9rSdWc4g95Rn0cq0 HlUJxxkadFIHFihd4vemTFWE= X-Received: by 2002:a17:90b:4a4d:b0:340:dd2c:a3d9 with SMTP id 98e67ed59e1d1-3436cb29cafmr13753889a91.12.1762792786297; Mon, 10 Nov 2025 08:39:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIvIbTFe8vuD1Bz6N5pB1xeotjvWHsTfTNEQm7fcGL0bvPFEvHnVFmeK5opyNFF8Eu0di/Wg== X-Received: by 2002:a17:90b:4a4d:b0:340:dd2c:a3d9 with SMTP id 98e67ed59e1d1-3436cb29cafmr13753847a91.12.1762792785680; Mon, 10 Nov 2025 08:39:45 -0800 (PST) Received: from hu-akhilpo-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3434c337b20sm11468922a91.13.2025.11.10.08.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Nov 2025 08:39:45 -0800 (PST) From: Akhil P Oommen Date: Mon, 10 Nov 2025 22:07:18 +0530 Subject: [PATCH v2 12/21] drm/msm/a6xx: Share dependency vote table with GMU 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: <20251110-kaana-gpu-support-v2-12-bef18acd5e94@oss.qualcomm.com> References: <20251110-kaana-gpu-support-v2-0-bef18acd5e94@oss.qualcomm.com> In-Reply-To: <20251110-kaana-gpu-support-v2-0-bef18acd5e94@oss.qualcomm.com> To: Rob Clark , Bjorn Andersson , Konrad Dybcio , Sean Paul , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , Jonathan Marek , Jordan Crouse , Will Deacon , Robin Murphy , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Connor Abbott Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, devicetree@vger.kernel.org, Akhil P Oommen X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1762792679; l=6454; i=akhilpo@oss.qualcomm.com; s=20240726; h=from:subject:message-id; bh=fzcOZoDy4nq3d1scAOabdvRSkEECFucdbBehDf9L/KI=; b=VcSuVp5pUILjkNbbAkvSmqBrk4aayo/fsTUBVzwaNTz3CHX2AlKGXQ5LaBwdFwJi1nzrR73j/ q9575BU+fqzCv6CY6sZocpNExlHPL3t9jvx/n4wB/kI2MbotaH6lCK9 X-Developer-Key: i=akhilpo@oss.qualcomm.com; a=ed25519; pk=lmVtttSHmAUYFnJsQHX80IIRmYmXA4+CzpGcWOOsfKA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTEwMDE0MCBTYWx0ZWRfX5pokAxdD8ywH C4Nakmorq41Pd4x7KTPlcXgigszyV74k0u0ICgDzeelp8/UHDsmIjMxgjUPhW86sxoyYx1WzbxD xHy3f7LauVYH28hK7y36Tt5Xg6G9sRYpQk5QmHobNEGzPmEgHAf2KXed9LoiFJh0wIcLbj7d3xh dPGzVxCb5DoOzgMf+OT/OZNGWcxlFRCO3nuhPZZx5yrWurxJU/xhju09b1VJSey+qv1//U3vI/e khDDrDvPhKhgYy9UjFEnlZ15ApWaBynJpnQZdx24x2YHwAsqyDksQ4n0iIgUxIIM32OY5NwDpQF 2/lA64xXFnr3IekJo57/T6dw97di2McgmRM/FR8WDOLCslwlkpTkB8rUbcj3DM1MABf446n/I2f KpLH+dEhCvQ8A8q0JwDDps/ugyWoIA== X-Authority-Analysis: v=2.4 cv=CsKys34D c=1 sm=1 tr=0 ts=69121553 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=jvJuTtenM57zLa_9FEIA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-ORIG-GUID: QSynN0tsgiRMqcGIu5y7mNmBNstktgVD X-Proofpoint-GUID: QSynN0tsgiRMqcGIu5y7mNmBNstktgVD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-10_06,2025-11-10_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511100140 A8x GMU firmwares expect a separate vote table which describes the relationship between the Gx rail and MxA rail (and possibly Cx rail). Create this new vote table and implement the new HFI message which allows passing vote tables to send this data to GMU. Signed-off-by: Akhil P Oommen --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 54 +++++++++++++++++++++++++++++++= ++++ drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 1 + drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 53 +++++++++++++++++++++++++++++++= +++ drivers/gpu/drm/msm/adreno/a6xx_hfi.h | 17 +++++++++++ 4 files changed, 125 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/ad= reno/a6xx_gmu.c index 8597d7adf2f7..396da035cbe8 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1591,6 +1591,57 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct devic= e *dev, u32 *votes, return 0; } =20 +static int a6xx_gmu_rpmh_dep_votes_init(struct device *dev, u32 *votes, + unsigned long *freqs, int freqs_count) +{ + const u16 *mx; + size_t count; + + mx =3D cmd_db_read_aux_data("mx.lvl", &count); + if (IS_ERR(mx)) + return PTR_ERR(mx); + /* + * The data comes back as an array of unsigned shorts so adjust the + * count accordingly + */ + count >>=3D 1; + if (!count) + return -EINVAL; + + /* Fix the vote for zero frequency */ + votes[0] =3D 0xffffffff; + + /* Construct a vote for rest of the corners */ + for (int i =3D 1; i < freqs_count; i++) { + u8 j, index =3D 0; + unsigned int level =3D a6xx_gmu_get_arc_level(dev, freqs[i]); + + /* Get the primary index that matches the arc level */ + for (j =3D 0; j < count; j++) { + if (mx[j] >=3D level) { + index =3D j; + break; + } + } + + if (j =3D=3D count) { + DRM_DEV_ERROR(dev, + "Mx Level %u not found in the RPMh list\n", + level); + DRM_DEV_ERROR(dev, "Available levels:\n"); + for (j =3D 0; j < count; j++) + DRM_DEV_ERROR(dev, " %u\n", mx[j]); + + return -EINVAL; + } + + /* Construct the vote */ + votes[i] =3D (0x3fff << 14) | (index << 8) | (0xff); + } + + return 0; +} + /* * The GMU votes with the RPMh for itself and on behalf of the GPU but we = need * to construct the list of votes on the CPU and send it over. Query the R= PMh @@ -1624,6 +1675,9 @@ static int a6xx_gmu_rpmh_votes_init(struct a6xx_gmu *= gmu) ret |=3D a6xx_gmu_rpmh_arc_votes_init(gmu->dev, gmu->cx_arc_votes, gmu->gmu_freqs, gmu->nr_gmu_freqs, "cx.lvl", "mx.lvl"); =20 + ret |=3D a6xx_gmu_rpmh_dep_votes_init(gmu->dev, gmu->dep_arc_votes, + gmu->gpu_freqs, gmu->nr_gpu_freqs); + /* Build the interconnect votes */ if (info->bcms && gmu->nr_gpu_bws > 1) ret |=3D a6xx_gmu_rpmh_bw_votes_init(adreno_gpu, info, gmu); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/ad= reno/a6xx_gmu.h index edf6c282cd76..2af074c8e8cf 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h @@ -97,6 +97,7 @@ struct a6xx_gmu { int nr_gpu_freqs; unsigned long gpu_freqs[GMU_MAX_GX_FREQS]; u32 gx_arc_votes[GMU_MAX_GX_FREQS]; + u32 dep_arc_votes[GMU_MAX_GX_FREQS]; struct a6xx_hfi_acd_table acd_table; =20 int nr_gpu_bws; diff --git a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c b/drivers/gpu/drm/msm/ad= reno/a6xx_hfi.c index 550de6ad68ef..64618fd69305 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c @@ -23,6 +23,7 @@ static const char * const a6xx_hfi_msg_id[] =3D { HFI_MSG_ID(HFI_H2F_MSG_START), HFI_MSG_ID(HFI_H2F_FEATURE_CTRL), HFI_MSG_ID(HFI_H2F_MSG_CORE_FW_START), + HFI_MSG_ID(HFI_H2F_MSG_TABLE), HFI_MSG_ID(HFI_H2F_MSG_GX_BW_PERF_VOTE), HFI_MSG_ID(HFI_H2F_MSG_PREPARE_SLUMBER), }; @@ -255,11 +256,63 @@ static int a6xx_hfi_send_perf_table_v1(struct a6xx_gm= u *gmu) NULL, 0); } =20 +static int a8xx_hfi_send_perf_table(struct a6xx_gmu *gmu) +{ + unsigned int num_gx_votes =3D 3, num_cx_votes =3D 2; + struct a6xx_hfi_table_entry *entry; + struct a6xx_hfi_table *tbl; + int ret, i; + u32 size; + + size =3D sizeof(*tbl) + (2 * sizeof(tbl->entry[0])) + + (gmu->nr_gpu_freqs * num_gx_votes * sizeof(gmu->gx_arc_votes[0])) + + (gmu->nr_gmu_freqs * num_cx_votes * sizeof(gmu->cx_arc_votes[0])); + tbl =3D devm_kzalloc(gmu->dev, size, GFP_KERNEL); + tbl->type =3D HFI_TABLE_GPU_PERF; + + /* First fill GX votes */ + entry =3D &tbl->entry[0]; + entry->count =3D gmu->nr_gpu_freqs; + entry->stride =3D num_gx_votes; + + for (i =3D 0; i < gmu->nr_gpu_freqs; i++) { + unsigned int base =3D i * entry->stride; + + entry->data[base+0] =3D gmu->gx_arc_votes[i]; + entry->data[base+1] =3D gmu->dep_arc_votes[i]; + entry->data[base+2] =3D gmu->gpu_freqs[i] / 1000; + } + + /* Then fill CX votes */ + entry =3D (struct a6xx_hfi_table_entry *) + &tbl->entry[0].data[gmu->nr_gpu_freqs * num_gx_votes]; + + entry->count =3D gmu->nr_gmu_freqs; + entry->stride =3D num_cx_votes; + + for (i =3D 0; i < gmu->nr_gmu_freqs; i++) { + unsigned int base =3D i * entry->stride; + + entry->data[base] =3D gmu->cx_arc_votes[i]; + entry->data[base+1] =3D gmu->gmu_freqs[i] / 1000; + } + + ret =3D a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_TABLE, tbl, size, NULL, 0); + + devm_kfree(gmu->dev, tbl); + return ret; +} + static int a6xx_hfi_send_perf_table(struct a6xx_gmu *gmu) { + struct a6xx_gpu *a6xx_gpu =3D container_of(gmu, struct a6xx_gpu, gmu); + struct adreno_gpu *adreno_gpu =3D &a6xx_gpu->base; struct a6xx_hfi_msg_perf_table msg =3D { 0 }; int i; =20 + if (adreno_is_a8xx(adreno_gpu)) + return a8xx_hfi_send_perf_table(gmu); + msg.num_gpu_levels =3D gmu->nr_gpu_freqs; msg.num_gmu_levels =3D gmu->nr_gmu_freqs; =20 diff --git a/drivers/gpu/drm/msm/adreno/a6xx_hfi.h b/drivers/gpu/drm/msm/ad= reno/a6xx_hfi.h index 653ef720e2da..e12866110cb8 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.h @@ -185,6 +185,23 @@ struct a6xx_hfi_msg_core_fw_start { u32 handle; }; =20 +#define HFI_H2F_MSG_TABLE 15 + +struct a6xx_hfi_table_entry { + u32 count; + u32 stride; + u32 data[]; +}; + +struct a6xx_hfi_table { + u32 header; + u32 version; +#define HFI_TABLE_BW_VOTE 0 +#define HFI_TABLE_GPU_PERF 1 + u32 type; + struct a6xx_hfi_table_entry entry[]; +}; + #define HFI_H2F_MSG_GX_BW_PERF_VOTE 30 =20 struct a6xx_hfi_gx_bw_perf_vote_cmd { --=20 2.51.0