From patchwork Wed Jan 10 15:37:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 186934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp871826dyi; Wed, 10 Jan 2024 07:38:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQcmfJsI2h83W1A+2t7+zbKms0JClf3PN+EAf97cEOz+UwT2t4vZoBVILVNN9W8iEfikM1 X-Received: by 2002:a05:6808:1590:b0:3bd:40ed:497b with SMTP id t16-20020a056808159000b003bd40ed497bmr1414020oiw.90.1704901107526; Wed, 10 Jan 2024 07:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704901107; cv=none; d=google.com; s=arc-20160816; b=cxORghNXZzpztsYjsiiyy5uRjf+hPeXl76J65nHNuFe4dcEVzT0XKSD2IpeR6u/smz WdhAZAou8DpuCK8RumcH0936Cxjz9gJqLhxLLrLaAHLc8FIXqbK3RIG2KHauMPdrH9XR 5mMJkBeVmvzsh5GL0Ms3Nuy8mOeyhpDE4MoU3nKxy5Wc1Xn7HCoS2a/4MQmjr9rVctbl I91NN0DiHLABxumQScjjNzTSpAEIfsPh6mNNMr698BqiUFSdp5pYeImhGlwPE4sfUPw5 8i/+jgZlZiQyiNys3ZbWKfPYUt7Jgg3FXlLFcHvEV5bWTSVA/gcVczEwyto0r+QkiOkB zauA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=iiaboqLo4Zo3cNfowQ5RMAqS5wTqzDwqvkE5PMko/Ac=; fh=gEAShe3Hk4nyNu51w4RXxJfvpXL1VGREx7WHRKorqoE=; b=Kr527JEylwBkYopce6kRoKVAQMAW54FJ1ucND48ivqbKndL41mAuSHeW0KFVwvNxF/ jzkxhFWWpnwKEKDsp5Q5BcyFCMev5CJfz0YohwcRrVv+wfPNT6zOy4dJWmZBUrWdaNQg e6B5hHA7APLMgwR77SbUZoHcLygeeBn6o136yW3qlYVa29meSdeIANPUbj6f6Zagy/h0 vC0YW+YVSxySE6gawDM1Yanj2MZrqWcVrLTP6pYHsi/CJ09nHgYVeZvIKoZoVxKAJXsd A2+UMKXst1k0jISvPcFpFIEPpqOKAuf5RpQudF5UUIPXuMIh+8mRadZZ2Pi3iqqmMdAE x3TQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-22429-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22429-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r1-20020a0c8d01000000b00680e42dddfdsi4573080qvb.478.2024.01.10.07.38.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:38:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22429-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-22429-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22429-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3F51A1C2247F for ; Wed, 10 Jan 2024 15:38:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EB0A4C626; Wed, 10 Jan 2024 15:38:02 +0000 (UTC) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EB6B4C3A8 for ; Wed, 10 Jan 2024 15:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tomeuvizoso.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5582796b85bso1522089a12.2 for ; Wed, 10 Jan 2024 07:37:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704901076; x=1705505876; 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=iiaboqLo4Zo3cNfowQ5RMAqS5wTqzDwqvkE5PMko/Ac=; b=fmOVADv/VuJjU77STTWRJ9jC9a8aKYZV+3LFR5lqGZBf3UyqR33wkxXNPhEttbZasg tPPlPLhPdtvxNe3+Pe1corNjjtl/4byyR8ErMQ4FM9HLZqFdgn63z/LiJ4BA6ZuM0fb8 VE12GgmijWUKXWRlqrpN8TnFgwcw/o76MFvMGxPFbA4E16aYY2ZW4HAl/b3xq47eHAn+ HDHIM3XY6izs2l4XB2NcgDG5O6qZB89Y9t4pLYyFzR9aGJCLmywfbgA+XA5y1U/lNDUr TnVE1GuiCxlRtevNlpkmrEA4Gn25jrXSFWJPpeCoa4XEJ+osFpKzM14CeNhY+pogHGFT vhsw== X-Gm-Message-State: AOJu0YzUIxOC6Ip6Jp5GW5oY5RSMGFpMjXoda/kqSeWIQNn64b/uK8Jz QSPoTqj5V695XBYQO6T6b1w= X-Received: by 2002:a50:8a96:0:b0:558:2110:5aeb with SMTP id j22-20020a508a96000000b0055821105aebmr596143edj.39.1704901076355; Wed, 10 Jan 2024 07:37:56 -0800 (PST) Received: from ramallet.home (cst-prg-39-31.cust.vodafone.cz. [46.135.39.31]) by smtp.gmail.com with ESMTPSA id da11-20020a056402176b00b0055668ccd9a3sm2113105edb.17.2024.01.10.07.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:37:55 -0800 (PST) From: Tomeu Vizoso To: Cc: Tomeu Vizoso , Christian Gmeiner , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , etnaviv@lists.freedesktop.org (moderated list:DRM DRIVERS FOR VIVANTE GPU IP), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR VIVANTE GPU IP), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] drm/etnaviv: Expose a few more chipspecs to userspace Date: Wed, 10 Jan 2024 16:37:00 +0100 Message-ID: <20240110153704.1364073-1-tomeu@tomeuvizoso.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787718383815221271 X-GMAIL-MSGID: 1787718383815221271 These ones will be needed to make use fo the NN and TP units in the NPUs based on Vivante IP. Signed-off-by: Tomeu Vizoso Acked-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 20 ++++++++++++++++++++ drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 12 ++++++++++++ drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 24 ++++++++++++++++++++++++ include/uapi/drm/etnaviv_drm.h | 5 +++++ 4 files changed, 61 insertions(+) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 9276756e1397..9055ed08cd7b 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 197e0037732e..7d5e9158e13c 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -54,6 +54,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 67201242438b..003e5faa1f4c 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, @@ -80,6 +84,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, @@ -112,6 +120,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, @@ -175,6 +187,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, @@ -207,6 +223,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .thread_count = 256, .shader_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, @@ -239,6 +259,10 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { .thread_count = 256, .shader_core_count = 1, .nn_core_count = 6, + .nn_mad_per_core = 64, + .tp_core_count = 3, + .on_chip_sram_size = 262144, + .axi_sram_size = 0, .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