Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp627329lqp; Wed, 12 Jun 2024 11:09:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6ocRGK2Z8vYM/fE/N+DS+DMMtqrmNTxOGzFCcUV+tglQSCDKQoer2oxbggTArH/ZMzIj6BEgR5Ud8FN9z15m4bfwhGQMs3Wtp20wb8g== X-Google-Smtp-Source: AGHT+IHiqaFIy4AXTwF9eN2TurzbQd1ZmpKs7jLJyavGnh0ERSUImKvJQ5/VMFpQAFe6KOyP+bSH X-Received: by 2002:a17:906:1ccf:b0:a6f:27e6:8892 with SMTP id a640c23a62f3a-a6f4800b43amr147331866b.60.1718215775225; Wed, 12 Jun 2024 11:09:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718215775; cv=pass; d=google.com; s=arc-20160816; b=el+MM3YzZ1bE0jzlmJqd3QxFM8Hz/TLq/PwW7rqKNpgO5nTQXcMuooK4jk59CWUvj6 FMwwFXuByLVcLcdqSt7xAO/+VIoNbcn1Kun8l02MEUSaJwWACUsEUEr/T+xZX43Wn384 jIw/aAOf6z7AjHNFD8fFbuAvIFd5KaedAwr4ARuXg58bue5gc/FE7zlNZK8r/V1Xn31S pR+OUoqQ20CIbauG/3AFnlADQSbSSlRT7QF6Vmk0Yk0wRo9fQMyyH84SiFx2C09Aos5a JvAbOhHFGS6f7tUHQUo8JiLXuFXg4KntbKklza/60vkjhHhd0gVOq1o2+K79oEo0fdXp FOfQ== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=50osSd8KtCLW3CwZH1N1SXvDuWtzQ/zMXKPLnmLiv4c=; fh=9LMvG+4Kp8MM9+DSYjJVZVBzatORRenL90PeedLQDnY=; b=to44Bxm+RergUEycnGm+BoJ5OpdoQd0zOUFQzDMkKQUrRZCkcIegCl5TQ2KhWZu2lI knATZFZvr0vhN/viCRMyLHLnztz/DHxwIu76euX9VcM4nc/pLlWrqhmnHSbEIoxAzU+W uHyJ0Dk79H46Jmtb05MMvbgTvipR8NC0WTl4jyMVWdhQW/Fn9/RwVl4uW2sRqSq6fUCx tDeS+G24n4zMfbZpH/lnvp+RIO/ysxws9g0v/CB8c0WwS8ZYEdtAIsOL9rQYBjNJXhqK lCvrk+sQ3l1eM5nUjJgLZAdEDBjdGW6djrXga0T7v2ZMu+DiCuDVDTs+4Uz83k24OsQj ZFuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-212041-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212041-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f1005c2acsi428828066b.86.2024.06.12.11.09.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 11:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212041-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; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-212041-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212041-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de 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 EE00D1F22676 for ; Wed, 12 Jun 2024 18:09:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5AF81836C6; Wed, 12 Jun 2024 18:09:11 +0000 (UTC) Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71922180A99; Wed, 12 Jun 2024 18:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.11.138.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718215751; cv=none; b=kXCpjTucJ42aII5eYk7uKD7582o7sGogmUMt4itPLKDwQ79Dmhw6k1H1p5p/Krl0eB0LR1/VphjxnPUohv4yEtSN8+G7sHPt6MXmEYopILtk2co8D0GtP47BLmhW3tmYCvsBNxNZS3AVm7zoyzi0lPtDDIW3lB2TrN4XVzOuAv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718215751; c=relaxed/simple; bh=RJNEvCAGIRZVQUyhqg15HbW6QCiKD5U3VFi2YuLgGgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rGsWa9eY0D22A8IRDSt212F64uVxu+ws4cl6BsVeZQJavT62p8A2xCcc8N+mA0YMLS3pRbmIXavpHAUBKnbWWPsmimaWuyyqRMOD16AnVPi4wa+SJw54AUQfmRke0HTpPZNK8H/3CqZtlRGqtALNN7SrEuioBF/DcltsSwYZGNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de; spf=pass smtp.mailfrom=sntech.de; arc=none smtp.client-ip=185.11.138.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sntech.de Received: from i53875be5.versanet.de ([83.135.91.229] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHSOy-00025Y-8s; Wed, 12 Jun 2024 20:08:52 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Ezequiel Garcia , Philipp Zabel , Nicolas Frattaroli , Sebastian Reichel Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jianfeng Liu , Emmanuel Gil Peyrot , Nicolas Dufresne , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: Re: [PATCH v5 3/5] media: hantro: Add RK3588 VEPU121 support Date: Wed, 12 Jun 2024 20:08:51 +0200 Message-ID: <1739853.izSxrag8PF@diego> In-Reply-To: <20240612173213.42827-4-sebastian.reichel@collabora.com> References: <20240612173213.42827-1-sebastian.reichel@collabora.com> <20240612173213.42827-4-sebastian.reichel@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Am Mittwoch, 12. Juni 2024, 19:15:43 CEST schrieb Sebastian Reichel: > Avoid exposing each of the 4 Hantro H1 cores separately to userspace. > For now just expose the first one. > > Signed-off-by: Sebastian Reichel > --- > .../media/platform/verisilicon/hantro_drv.c | 38 +++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c > index 34b123dafd89..b722a20c5fe3 100644 > --- a/drivers/media/platform/verisilicon/hantro_drv.c > +++ b/drivers/media/platform/verisilicon/hantro_drv.c > @@ -722,6 +722,7 @@ static const struct of_device_id of_hantro_match[] = { > { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, > { .compatible = "rockchip,rk3568-vepu", .data = &rk3568_vepu_variant, }, > { .compatible = "rockchip,rk3568-vpu", .data = &rk3568_vpu_variant, }, > + { .compatible = "rockchip,rk3588-vepu121", .data = &rk3568_vpu_variant, }, > { .compatible = "rockchip,rk3588-av1-vpu", .data = &rk3588_vpu981_variant, }, > #endif > #ifdef CONFIG_VIDEO_HANTRO_IMX8M > @@ -992,6 +993,39 @@ static const struct media_device_ops hantro_m2m_media_ops = { > .req_queue = v4l2_m2m_request_queue, > }; > > +/* > + * Some SoCs, like RK3588 have multiple identical Hantro cores, but the > + * kernel is currently missing support for multi-core handling. Exposing > + * separate devices for each core to userspace is bad, since that does > + * not allow scheduling tasks properly (and creates ABI). With this workaround > + * the driver will only probe for the first core and early exit for the other > + * cores. Once the driver gains multi-core support, the same technique > + * for detecting the main core can be used to cluster all cores together. > + */ > +static int hantro_disable_multicore(struct hantro_dev *vpu) > +{ > + const char *compatible; > + struct device_node *node; > + int ret; > + > + /* Intentionally ignores the fallback strings */ > + ret = of_property_read_string(vpu->dev->of_node, "compatible", &compatible); > + if (ret) > + return ret; > + > + /* first compatible node found from the root node is considered the main core */ > + node = of_find_compatible_node(NULL, NULL, compatible); > + if (!node) > + return -EINVAL; /* broken DT? */ > + > + if (vpu->dev->of_node != node) { > + dev_info(vpu->dev, "missing multi-core support, ignoring this instance\n"); > + return -ENODEV; > + } > + > + return 0; > +} > + > static int hantro_probe(struct platform_device *pdev) > { > const struct of_device_id *match; > @@ -1011,6 +1045,10 @@ static int hantro_probe(struct platform_device *pdev) > match = of_match_node(of_hantro_match, pdev->dev.of_node); > vpu->variant = match->data; > > + ret = hantro_disable_multicore(vpu); > + if (ret) > + return ret; > + I think this might be better as two patches? As this patch stands, the disable-multicore handling is done for _all_ hantro variants, so part of me wants this to be labeled as such. The whole reasoning is completely ok, but somehow having this under the "add rk3588" umbrella feels strange ;-) Heiko