Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1063069rdd; Wed, 10 Jan 2024 07:38:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKOuWoU1ZgXxGrYCDYyTFAwo9z0zwei+zd9o5VanlXtQ6HG54aHu3ueXtJIHcWvHfdxqqy X-Received: by 2002:a50:c09a:0:b0:558:823c:f337 with SMTP id k26-20020a50c09a000000b00558823cf337mr32307edf.22.1704901089556; Wed, 10 Jan 2024 07:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704901089; cv=none; d=google.com; s=arc-20160816; b=XZhfXMx5b6lYEZgj4JBMAQl2oCYcRRhAr5STXYSFURTNpa9Qt7ZT5h0L0Z19/K+BK0 N5SYiE2XsbZakEDZKRpM2v1iALhQX6isUcJj52Oi63CyxpoW783PC/rQFPw3ydC3S3TG nyXtbDpaRq8BcFjj55jmAu6KxP53zkrJmfjT31p2T0T4kva4ieH5KiDRij8JlSRIqJjg 3Exv/fyd5HHnfJfppNqysJdr8k9EvQ+Hcaj3uqo/HR4d+sYhay6FBX5NcE8/Yklh/EBP h5GFUmiLsiMUIl6jKjEJoPBc6xgnLcElk7w0Jm/DCyWR8YThVDrGaFiOMVLN0cazT0rx hlAg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22429-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bx18-20020a0564020b5200b005583e677090si795882edb.12.2024.01.10.07.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-22429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22429-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 04CF71F2701C for ; Wed, 10 Jan 2024 15:38:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAF614C3B6; Wed, 10 Jan 2024 15:38:00 +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 Content-Transfer-Encoding: 8bit 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 -- 2.43.0