Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3301773rdb; Thu, 16 Nov 2023 06:09:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkrVrmLmDstLvvGMzMtLqALG21UiUdu1OxrFFLV0yctdvysJ3GGEWPPn0kbXQ7qRBkTF9W X-Received: by 2002:a17:903:11d0:b0:1cc:70ed:1d68 with SMTP id q16-20020a17090311d000b001cc70ed1d68mr9049194plh.67.1700143786426; Thu, 16 Nov 2023 06:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700143786; cv=none; d=google.com; s=arc-20160816; b=hR0LTWAUrEBUfh+J+QzxH0NCV8qenlb4iq0CATTykt2SpPilkWp/0bD5ZOasR6+DVv ojbI0Cd975VEmhCAeCkHTIPsJcfP2mPYC05DnfMnW9THY6VzEXU8qR2X5hQcPiM73+B1 rzLIU/skHh0pVpR4sgGyOf1DXnSVeD1nKHJkC/8mlFPV3wWlVqPnVaGbZ7WaJXUeMFqM 8QNcvD2sAIoTsSLvV+PKs3/ZQ24hntmVz8CkQmzM95fnf93AUIx/B2zSoTllvxw7/zX6 QpcA5SDVx2oG3tKrXlaLr2OVnOR+bGNh0Q1i3jc4wvYPIuLYsXitNd9FV5I9tpQPQ5+v oY4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=o5kzymm4w15fT9h/X6FV1rQ8roz2ERsjL4xXI9ZSR/o=; fh=6Ci+6mQkeBmsRznUtH+HCKFPSnKcpGSfZ4ewg0N6VXE=; b=scRI2BUOD93CzX7BI+3qvgRoU1Z20MQ6WZcnXSEvwQ9YJp2zZZofzmr9kZGEnTbznF aIHkjTogh8978yJQKnaKnkGefcIRY036qnTy/6eOyZJvDfh1EhdWlPv1QuPuVZfuh8Nc lwRXWoCGA1LooO20dnp01IMseOHdI5ySTSp8y86q+o+tNajPspQPxfntKFeHQs2jgdaZ k62UbouCi8sFWf7vDOIn01BU1Bd8hRApfkgkGZZRkMZK6sa3jEpwaiaDhhbFzH06TGXO Jo9UnyA3GibHycK90+tM19wlGSc34iLYacw324mRUSfUdy32g6euHguVfKLBFA6H8N8Q vCKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ij27-20020a170902ab5b00b001c5de4a5b4esi12292960plb.597.2023.11.16.06.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:09:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4C7DE82164CF; Thu, 16 Nov 2023 06:09:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345248AbjKPOJh (ORCPT + 99 others); Thu, 16 Nov 2023 09:09:37 -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-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: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 06:09:43 -0800 (PST) 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/etnaviv/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 = gpu->identity.eco_id; break; + case ETNAVIV_PARAM_GPU_NN_CORE_COUNT: + *value = gpu->identity.nn_core_count; + break; + + case ETNAVIV_PARAM_GPU_NN_MAD_PER_CORE: + *value = gpu->identity.nn_mad_per_core; + break; + + case ETNAVIV_PARAM_GPU_TP_CORE_COUNT: + *value = gpu->identity.tp_core_count; + break; + + case ETNAVIV_PARAM_GPU_ON_CHIP_SRAM_SIZE: + *value = gpu->identity.on_chip_sram_size; + break; + + case ETNAVIV_PARAM_GPU_AXI_SRAM_SIZE: + *value = 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/etnaviv/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; + /* 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; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/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_identities[] = { .thread_count = 128, .shader_core_count = 1, .nn_core_count = 0, + .nn_mad_per_core = 0, + .tp_core_count = 0, + .on_chip_sram_size = 0, + .axi_sram_size = 0, .vertex_cache_size = 8, .vertex_output_buffer_size = 1024, .pixel_pipes = 1, @@ -49,6 +53,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .thread_count = 512, .shader_core_count = 2, .nn_core_count = 0, + .nn_mad_per_core = 0, + .tp_core_count = 0, + .on_chip_sram_size = 0, + .axi_sram_size = 0, .vertex_cache_size = 16, .vertex_output_buffer_size = 1024, .pixel_pipes = 1, @@ -81,6 +89,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .thread_count = 512, .shader_core_count = 2, .nn_core_count = 0, + .nn_mad_per_core = 0, + .tp_core_count = 0, + .on_chip_sram_size = 0, + .axi_sram_size = 0, .vertex_cache_size = 16, .vertex_output_buffer_size = 1024, .pixel_pipes = 1, @@ -113,6 +125,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .thread_count = 1024, .shader_core_count = 4, .nn_core_count = 0, + .nn_mad_per_core = 0, + .tp_core_count = 0, + .on_chip_sram_size = 0, + .axi_sram_size = 0, .vertex_cache_size = 16, .vertex_output_buffer_size = 1024, .pixel_pipes = 2, @@ -144,7 +160,11 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .register_max = 64, .thread_count = 256, .shader_core_count = 1, - .nn_core_count = 1, + .nn_core_count = 8, + .nn_mad_per_core = 64, + .tp_core_count = 4, + .on_chip_sram_size = 524288, + .axi_sram_size = 1048576, .vertex_cache_size = 16, .vertex_output_buffer_size = 1024, .pixel_pipes = 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 #define ETNA_MAX_PIPES 4 -- 2.41.0