Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Akhil P Oommen <akhilpo@oss.qualcomm.com>,
	Rob Clark <robin.clark@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Sean Paul <sean@poorly.run>, Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Jonathan Marek <jonathan@marek.ca>,
	Jordan Crouse <jordan@cosmicpenguin.net>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Connor Abbott <cwabbott0@gmail.com>
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
Subject: Re: [PATCH v2 12/21] drm/msm/a6xx: Share dependency vote table with GMU
Date: Thu, 13 Nov 2025 10:42:53 +0100	[thread overview]
Message-ID: <fee56a54-5da0-47a4-b8e3-7ec01e2a1559@oss.qualcomm.com> (raw)
In-Reply-To: <20251110-kaana-gpu-support-v2-12-bef18acd5e94@oss.qualcomm.com>

On 11/10/25 5:37 PM, Akhil P Oommen wrote:
> 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 <akhilpo@oss.qualcomm.com>
> ---

[...]

>  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/adreno/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 device *dev, u32 *votes,
>  	return 0;
>  }
>  
> +static int a6xx_gmu_rpmh_dep_votes_init(struct device *dev, u32 *votes,
> +		unsigned long *freqs, int freqs_count)

Checkpatch should be grumpy about indentation here

[...]

> +	/* Construct a vote for rest of the corners */
> +	for (int i = 1; i < freqs_count; i++) {
> +		u8 j, index = 0;
> +		unsigned int level = a6xx_gmu_get_arc_level(dev, freqs[i]);

nit: reverse-Christmas-tree would be nice here

> +
> +		/* Get the primary index that matches the arc level */
> +		for (j = 0; j < count; j++) {
> +			if (mx[j] >= level) {
> +				index = j;
> +				break;
> +			}
> +		}
> +
> +		if (j == 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 = 0; j < count; j++)
> +				DRM_DEV_ERROR(dev, "  %u\n", mx[j]);
> +
> +			return -EINVAL;
> +		}
> +
> +		/* Construct the vote */
> +		votes[i] = (0x3fff << 14) | (index << 8) | (0xff);

FIELD_PREP() + GENMASK, please

[...]

> +static int a8xx_hfi_send_perf_table(struct a6xx_gmu *gmu)
> +{
> +	unsigned int num_gx_votes = 3, num_cx_votes = 2;
> +	struct a6xx_hfi_table_entry *entry;
> +	struct a6xx_hfi_table *tbl;
> +	int ret, i;
> +	u32 size;
> +
> +	size = 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 = devm_kzalloc(gmu->dev, size, GFP_KERNEL);

devm_ only adds overhead here, there's not even an error-return path,
go with regular kzalloc/kfree

> +	tbl->type = HFI_TABLE_GPU_PERF;
> +
> +	/* First fill GX votes */
> +	entry = &tbl->entry[0];
> +	entry->count = gmu->nr_gpu_freqs;
> +	entry->stride = num_gx_votes;
> +
> +	for (i = 0; i < gmu->nr_gpu_freqs; i++) {
> +		unsigned int base = i * entry->stride;
> +
> +		entry->data[base+0] = gmu->gx_arc_votes[i];
> +		entry->data[base+1] = gmu->dep_arc_votes[i];
> +		entry->data[base+2] = gmu->gpu_freqs[i] / 1000;

This is essentially struct perf_gx_level with the ACD field recycled

> +	}
> +
> +	/* Then fill CX votes */
> +	entry = (struct a6xx_hfi_table_entry *)
> +		&tbl->entry[0].data[gmu->nr_gpu_freqs * num_gx_votes];
> +
> +	entry->count = gmu->nr_gmu_freqs;
> +	entry->stride = num_cx_votes;
> +
> +	for (i = 0; i < gmu->nr_gmu_freqs; i++) {
> +		unsigned int base = i * entry->stride;
> +
> +		entry->data[base] = gmu->cx_arc_votes[i];
> +		entry->data[base+1] = gmu->gmu_freqs[i] / 1000;

And this is struct perf_level

[...]

> +#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

Such defines usually go below the field definition, not above

Konrad
> +	u32 type;
> +	struct a6xx_hfi_table_entry entry[];
> +};
> +
>  #define HFI_H2F_MSG_GX_BW_PERF_VOTE 30
>  
>  struct a6xx_hfi_gx_bw_perf_vote_cmd {
> 


  reply	other threads:[~2025-11-13  9:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 16:37 [PATCH v2 00/21] drm/msm/adreno: Introduce Adreno 8xx family support Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 01/21] drm/msm/a6xx: Flush LRZ cache before PT switch Akhil P Oommen
2025-11-12 10:07   ` Konrad Dybcio
2025-11-10 16:37 ` [PATCH v2 02/21] drm/msm/a6xx: Fix the gemnoc workaround Akhil P Oommen
2025-11-12 10:18   ` Konrad Dybcio
2025-11-12 22:09     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 04/21] drm/msm/adreno: Create adreno_func->submit_flush() Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 05/21] drm/msm/adreno: Move adreno_gpu_func to catalogue Akhil P Oommen
2025-11-12 10:22   ` Konrad Dybcio
2025-11-12 22:02     ` Akhil P Oommen
2025-11-13  3:38       ` Dmitry Baryshkov
2025-11-13  9:27         ` Konrad Dybcio
2025-11-13 12:22           ` Dmitry Baryshkov
2025-11-13 13:10             ` Konrad Dybcio
2025-11-10 16:37 ` [PATCH v2 06/21] drm/msm/adreno: Move gbif_halt() to adreno_gpu_func Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 07/21] drm/msm/adreno: Add MMU fault handler " Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 09/21] drm/msm/a6xx: Rebase GMU register offsets Akhil P Oommen
2025-11-12 10:56   ` Konrad Dybcio
2025-11-10 16:37 ` [PATCH v2 10/21] drm/msm/a8xx: Add support for A8x GMU Akhil P Oommen
2025-11-13 13:10   ` Konrad Dybcio
2025-11-13 20:00     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 11/21] drm/msm/a6xx: Improve MX rail fallback in RPMH vote init Akhil P Oommen
2025-11-12 10:59   ` Konrad Dybcio
2025-11-14 11:26     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 12/21] drm/msm/a6xx: Share dependency vote table with GMU Akhil P Oommen
2025-11-13  9:42   ` Konrad Dybcio [this message]
2025-11-10 16:37 ` [PATCH v2 13/21] drm/msm/adreno: Introduce A8x GPU Support Akhil P Oommen
2025-11-13 10:15   ` Konrad Dybcio
2025-11-13 20:09     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 14/21] drm/msm/adreno: Support AQE engine Akhil P Oommen
2025-11-12 11:07   ` Konrad Dybcio
2025-11-12 21:16     ` Akhil P Oommen
2025-11-13  9:29       ` Konrad Dybcio
2025-11-10 16:37 ` [PATCH v2 15/21] drm/msm/a8xx: Add support for Adreno 840 GPU Akhil P Oommen
2025-11-13 10:58   ` Konrad Dybcio
2025-11-10 16:37 ` [PATCH v2 16/21] drm/msm/adreno: Do CX GBIF config before GMU start Akhil P Oommen
2025-11-12 10:37   ` Konrad Dybcio
2025-11-12 21:34     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 17/21] drm/msm/a8xx: Add support for Adreno X2-85 GPU Akhil P Oommen
2025-11-12 14:41   ` Konrad Dybcio
2025-11-12 21:07     ` Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 18/21] dt-bindings: arm-smmu: Add Kaanapali GPU SMMU Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 19/21] dt-bindings: display/msm/gmu: Add Adreno 840 GMU Akhil P Oommen
2025-11-10 16:37 ` [PATCH v2 20/21] dt-bindings: display/msm/gmu: Add Adreno X2-85 GMU Akhil P Oommen
2025-11-11  7:49   ` Krzysztof Kozlowski
2025-11-11 14:25     ` Akhil P Oommen
2025-11-13  8:14       ` Krzysztof Kozlowski
2025-11-13  8:21         ` Krzysztof Kozlowski
2025-11-10 16:37 ` [PATCH v2 21/21] dt-bindings: arm-smmu: Add Glymur GPU SMMU Akhil P Oommen
2025-11-11  7:50   ` Krzysztof Kozlowski
2025-11-11 14:27     ` Akhil P Oommen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fee56a54-5da0-47a4-b8e3-7ec01e2a1559@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=akhilpo@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cwabbott0@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=iommu@lists.linux.dev \
    --cc=jesszhan0024@gmail.com \
    --cc=jonathan@marek.ca \
    --cc=jordan@cosmicpenguin.net \
    --cc=joro@8bytes.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=robin.murphy@arm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox