From nobody Tue Dec 30 09:52:52 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33D14C197A0 for ; Thu, 16 Nov 2023 14:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345274AbjKPOJi (ORCPT ); Thu, 16 Nov 2023 09:09:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345270AbjKPOJh (ORCPT ); Thu, 16 Nov 2023 09:09:37 -0500 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 872C4D4B for ; Thu, 16 Nov 2023 06:09:32 -0800 (PST) Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-9dd3f4a0f5aso120135666b.1 for ; Thu, 16 Nov 2023 06:09:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700143771; x=1700748571; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o5kzymm4w15fT9h/X6FV1rQ8roz2ERsjL4xXI9ZSR/o=; b=SiS2vXZXKn8oRFKd/ajqZN/mIya+gTCbSdw2KB5Ygu+8YC5Pi8kqGTQ9O6+LLFqlvN 4+58XVfqA4c7ofbCxsw7+7Kpc+lXTgTG61CnUWnrjk/2UeCGO1nw+vJKu5Q1VzYW8TcX nHpvxpynG/19SFcpbKA234gTPADbB9SG4e9bvHPj5/VvLv404l3ub/rCdaZJKChlxk1G /nRQ8aw+gHxT8MSpNNFvHKq1kTcpLJ2DafFolO+0F0oTPLQcinPo9mCY3LSSA3LLLkx/ mHbSq+N9aUoiwGud7hkl00MY/NHuB4YopsMDESFdrPjZyo6rUyP7lnIKimCyi+JUomj7 U9Gg== X-Gm-Message-State: AOJu0YwElGtT6V0JsXeVU5QrWjMoVtrFDTGFojrnr0c7pR2hggWOPBdJ XwHjHl6yl6HZWvRGEb+qzgs= X-Google-Smtp-Source: AGHT+IGRWoFnBFUiWPYA9FbvARFcOKys4+ta9wagYCFe7EhBbKQSmcyNKTgtPPdyw/t26xJZFnLa7A== X-Received: by 2002:a17:906:f190:b0:9c7:59d1:b2c2 with SMTP id gs16-20020a170906f19000b009c759d1b2c2mr12339402ejb.27.1700143770734; Thu, 16 Nov 2023 06:09:30 -0800 (PST) Received: from ramallet.home (cst-prg-38-127.cust.vodafone.cz. [46.135.38.127]) by smtp.gmail.com with ESMTPSA id a11-20020a170906190b00b0098d2d219649sm8603682eje.174.2023.11.16.06.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:09:30 -0800 (PST) From: Tomeu Vizoso To: Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter Cc: Tomeu Vizoso , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/etnaviv: Expose a few more chipspecs to userspace Date: Thu, 16 Nov 2023 15:09:09 +0100 Message-ID: <20231116140910.1613508-1-tomeu@tomeuvizoso.net> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" These ones will be needed to make use fo the NN and TP units in the NPUs based on Vivante IP. Also fix the number of NN cores in the VIPNano-qi. Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 20 ++++++++++++++++++++ drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 12 ++++++++++++ drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 22 +++++++++++++++++++++- include/uapi/drm/etnaviv_drm.h | 5 +++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnavi= v/etnaviv_gpu.c index 5f96e7b1a9ec..9a18b5431975 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -164,6 +164,26 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32= param, u64 *value) *value =3D gpu->identity.eco_id; break; =20 + case ETNAVIV_PARAM_GPU_NN_CORE_COUNT: + *value =3D gpu->identity.nn_core_count; + break; + + case ETNAVIV_PARAM_GPU_NN_MAD_PER_CORE: + *value =3D gpu->identity.nn_mad_per_core; + break; + + case ETNAVIV_PARAM_GPU_TP_CORE_COUNT: + *value =3D gpu->identity.tp_core_count; + break; + + case ETNAVIV_PARAM_GPU_ON_CHIP_SRAM_SIZE: + *value =3D gpu->identity.on_chip_sram_size; + break; + + case ETNAVIV_PARAM_GPU_AXI_SRAM_SIZE: + *value =3D gpu->identity.axi_sram_size; + break; + default: DBG("%s: invalid param: %u", dev_name(gpu->dev), param); return -EINVAL; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnavi= v/etnaviv_gpu.h index c8f3ad2031ce..83ef3c06da5d 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -53,6 +53,18 @@ struct etnaviv_chip_identity { /* Number of Neural Network cores. */ u32 nn_core_count; =20 + /* Number of MAD units per Neural Network core. */ + u32 nn_mad_per_core; + + /* Number of Tensor Processing cores. */ + u32 tp_core_count; + + /* Size in bytes of the SRAM inside the NPU. */ + u32 on_chip_sram_size; + + /* Size in bytes of the SRAM across the AXI bus. */ + u32 axi_sram_size; + /* Size of the vertex cache. */ u32 vertex_cache_size; =20 diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnav= iv/etnaviv_hwdb.c index 0cb5aacaf384..93f15cce6d22 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c @@ -17,6 +17,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_i= dentities[] =3D { .thread_count =3D 128, .shader_core_count =3D 1, .nn_core_count =3D 0, + .nn_mad_per_core =3D 0, + .tp_core_count =3D 0, + .on_chip_sram_size =3D 0, + .axi_sram_size =3D 0, .vertex_cache_size =3D 8, .vertex_output_buffer_size =3D 1024, .pixel_pipes =3D 1, @@ -49,6 +53,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_i= dentities[] =3D { .thread_count =3D 512, .shader_core_count =3D 2, .nn_core_count =3D 0, + .nn_mad_per_core =3D 0, + .tp_core_count =3D 0, + .on_chip_sram_size =3D 0, + .axi_sram_size =3D 0, .vertex_cache_size =3D 16, .vertex_output_buffer_size =3D 1024, .pixel_pipes =3D 1, @@ -81,6 +89,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_i= dentities[] =3D { .thread_count =3D 512, .shader_core_count =3D 2, .nn_core_count =3D 0, + .nn_mad_per_core =3D 0, + .tp_core_count =3D 0, + .on_chip_sram_size =3D 0, + .axi_sram_size =3D 0, .vertex_cache_size =3D 16, .vertex_output_buffer_size =3D 1024, .pixel_pipes =3D 1, @@ -113,6 +125,10 @@ static const struct etnaviv_chip_identity etnaviv_chip= _identities[] =3D { .thread_count =3D 1024, .shader_core_count =3D 4, .nn_core_count =3D 0, + .nn_mad_per_core =3D 0, + .tp_core_count =3D 0, + .on_chip_sram_size =3D 0, + .axi_sram_size =3D 0, .vertex_cache_size =3D 16, .vertex_output_buffer_size =3D 1024, .pixel_pipes =3D 2, @@ -144,7 +160,11 @@ static const struct etnaviv_chip_identity etnaviv_chip= _identities[] =3D { .register_max =3D 64, .thread_count =3D 256, .shader_core_count =3D 1, - .nn_core_count =3D 1, + .nn_core_count =3D 8, + .nn_mad_per_core =3D 64, + .tp_core_count =3D 4, + .on_chip_sram_size =3D 524288, + .axi_sram_size =3D 1048576, .vertex_cache_size =3D 16, .vertex_output_buffer_size =3D 1024, .pixel_pipes =3D 1, diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h index af024d90453d..d87410a8443a 100644 --- a/include/uapi/drm/etnaviv_drm.h +++ b/include/uapi/drm/etnaviv_drm.h @@ -77,6 +77,11 @@ struct drm_etnaviv_timespec { #define ETNAVIV_PARAM_GPU_PRODUCT_ID 0x1c #define ETNAVIV_PARAM_GPU_CUSTOMER_ID 0x1d #define ETNAVIV_PARAM_GPU_ECO_ID 0x1e +#define ETNAVIV_PARAM_GPU_NN_CORE_COUNT 0x1f +#define ETNAVIV_PARAM_GPU_NN_MAD_PER_CORE 0x20 +#define ETNAVIV_PARAM_GPU_TP_CORE_COUNT 0x21 +#define ETNAVIV_PARAM_GPU_ON_CHIP_SRAM_SIZE 0x22 +#define ETNAVIV_PARAM_GPU_AXI_SRAM_SIZE 0x23 =20 #define ETNA_MAX_PIPES 4 =20 --=20 2.41.0