Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp605913lqp; Wed, 12 Jun 2024 10:33:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwJRZyG7I2VAhmMSG7atbHfWc4xwKtEMynuL/Sf82jQGN/r8yYrcDCsXGF0eYB9cH0dbwywAvRgEoTWDYS2lU0XV+OlxLNgrZY/2Y6AA== X-Google-Smtp-Source: AGHT+IF/RdLNR3VdexEeRI+K7zzw1qqwjwlHx+lOoaezWI8G/iX7uJratiFbqAMtKopQCM80RWyl X-Received: by 2002:a17:907:6d1f:b0:a6f:4971:7d0d with SMTP id a640c23a62f3a-a6f49717e05mr172442066b.55.1718213589652; Wed, 12 Jun 2024 10:33:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718213589; cv=pass; d=google.com; s=arc-20160816; b=ZSJ+XNIOAZcekSv0Xry9j4JWxPLsLHrwsHdz+PYewM9fo7Cmmbr8w8KykL//l1JtzY EYrwEidEeUPcFpU4xqfikSZvKdqTjeEjwNiZwwSllfk8ZLm5ibb+4Zx0dkFNpnnyAe2T P8Y8DKBUsdqLve9pOTahtTFiPtbcB7u7e3FHMTCBgeWC0KG5ajctz+urfReUQk2j+scu Y14Rn9UHfIcA8kDkHO0nCOOqlSrCqE1ulOGHNVx2ZDdLRZk1mx+cov9k1JvnnioE9SXv QRWXM5tU/7FYiLHDMU1n+IXQUErvT7CS3dX2mD/qCYwtoIW6YnO7Pesa9xvMnCJsqn/u Y42g== 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:dkim-signature; bh=oCy72BEbNjpliKyYfTzpUfhgCxKYubO+dR+U0wS1c54=; fh=cLtOPLoOdgOVDuxiM/Zc07VLHGrh7PtlVdCxs0OyfDA=; b=M3WUEEH4tLdQUEVSL1nGXPayOcUUkD7f9AIGLyNwBg7p96Msi+wbNx94I68ZOf/SES 3FyJq9s3j87p3EMBnyN5WWM56Qhjr3jX5InLgaBTKg3FuI1jUbnY3quwYx3a8DWPDCHx eAiFWgzWheFqppqaU+e+LgpCLjluCuak+xsU64sZYDD6utnxo2hI2BJTEepxXulAvZoY WvC9KHaRLasvrkRgEF9TpMcT6EJxl9YLEd0bbQvSv3EjJaTl5fIa7EXjxczCFg40wFXj c8K3DDF6+Q9g7mewOWCebw6xmjjUf9KT+AhN74JcLDl5Yy4RWdnFekWem6eaWgBNe0kA sLVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=L00ouhxp; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-212013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f463fa37asi99998366b.735.2024.06.12.10.33.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 10:33:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=L00ouhxp; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-212013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 B165F1F22C6B for ; Wed, 12 Jun 2024 17:32:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40E18181D1D; Wed, 12 Jun 2024 17:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="L00ouhxp" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 B2DC3181CE7; Wed, 12 Jun 2024 17:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718213545; cv=none; b=qQljsRqSk4hlqC+eEO1dKWH/NQyWGP0SSR1oCgNnA21W4FeCBwFAXL9FYpezEWI7zwv8i/S1Bqw49/3FrQB5rdfUcJ09SBX+OyQAXG+LVUW/Q5kZLMedLYoua5HbLCL/CWPbK2gcy0IGK6svokBYfExKoMSQ2gbUPxDdhqOyVlg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718213545; c=relaxed/simple; bh=KKnehwnapMDXEYhFKS5XsfL67lPPoRVBA2nN+Yi9Q24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ELvaB9QH4vozRXWf1tUW0/fHhKt6euVNDkDEILdMeWVceJsF+O0pgGXinzEEw9YvS9YaK/byMhfbL2UP9PRQjzJlzV/rJkWQBvRgMR9/9nfRub1UgsVco73yjZ/278jBNweNLYOd+AX1LBG2NkeUjFyVaq2nuTj1NyhVCOVsN1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=L00ouhxp; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718213541; bh=KKnehwnapMDXEYhFKS5XsfL67lPPoRVBA2nN+Yi9Q24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L00ouhxpqR5XhuMSWrJNBvj0w+0dSXrylM2KwH60f5E1Nean4momD3IEMV5YxXwi4 KhokKYcNRRvzpKckrZcWxWMRO7Fao9nD+Z/YNAq/vY8R3NQ2uY0wBUeHjQ6P6W2/+I ZBrik0KeuZJ764dk5+1g1Fsjv0wqXTLBXbvX+RgAC2DfBheHvBjpHUSMYSi6EIyrNe a/rGvJAFXu+fMhQInJ0axuxw9+hkBUwAVm6GvW9wH7YJO2llTZrCIRsmYWHbhnPOdE ddOAX1Ke72O+u0U6vHoQ7Lynf9B1bCciqQ4JgGUeEw00I9ZVzwrfer4uN5JOkK+DOE VpGZP+JrB9ZrA== Received: from jupiter.universe (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: sre) by madrid.collaboradmins.com (Postfix) with ESMTPSA id C2916378219B; Wed, 12 Jun 2024 17:32:21 +0000 (UTC) Received: by jupiter.universe (Postfix, from userid 1000) id 5E8E44800CE; Wed, 12 Jun 2024 19:32:21 +0200 (CEST) From: Sebastian Reichel To: Ezequiel Garcia , Philipp Zabel , Nicolas Frattaroli , Heiko Stuebner 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: [PATCH v5 3/5] media: hantro: Add RK3588 VEPU121 support Date: Wed, 12 Jun 2024 19:15:43 +0200 Message-ID: <20240612173213.42827-4-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240612173213.42827-1-sebastian.reichel@collabora.com> References: <20240612173213.42827-1-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: 8bit 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; + /* * Support for nxp,imx8mq-vpu is kept for backwards compatibility * but it's deprecated. Please update your DTS file to use -- 2.43.0