From patchwork Fri Dec 1 09:33:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 749873 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fairphone.com header.i=@fairphone.com header.b="EeD95u3m" Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 406E0327F for ; Fri, 1 Dec 2023 01:33:46 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-54af1daf6a9so3173681a12.1 for ; Fri, 01 Dec 2023 01:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; t=1701423224; x=1702028024; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=niGbj670flkgPie6QF876KkLwnZEAB/QBU6SIajf+Qs=; b=EeD95u3mVtGo/1uuMTq9lGsHSm2JbpAUkH2nRPe0QRKZhr/XIkqRvlwp+Y3yNHdx1r moVhNc3PvJd9S2sX3BcjuSEnZenCKg3c0Ggb2JX7XRInjkpzw9nLZSWUn5AcxHSTeJI8 BzXb1vhQY7e8IxTgs/4Yu/6xeZkNEb2ms/kwqSNUVlensm3Fj6IOjpGPORL5DJU4fN5j GrB2JQQwWJw4u0mmI2q+I3zLbwdisBSuXcOnNVs5eD72pq4C3qESmrxxIfC5A2I33DeY YXWNyKdC91Ph+3dGjlPpLCczoN1adoIwBZTNI5w8C4MySJAD9ps5jKRwhSmxZ99JG+aH PKFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701423224; x=1702028024; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=niGbj670flkgPie6QF876KkLwnZEAB/QBU6SIajf+Qs=; b=DuIoW4pTOmJMzNrU1B4YBillk+1gwjELnLAk08LHuUSBj/5Dg2u6ay9yogyK+AM29X Pqmhm9ePZxkWRSKNKDMxeh6osZD++ZgyfZ2xFoC6X+6dTRALa573Zlhnvo3Zxarg8vfK gLfQKb8pZaiKfRZMbMy/JXEWAs9RRehlsPwnuqF+EAq+KDZlXBx0TNXfT0dGU5lLJIdM 2EZCA5DkvJ42ZixRcqWxkdv0xVWvSMKIxOKbNHaHqhzeG6lZdwDSwOEk+FVFdbaC/W82 Q4oZc6S04u5XBKK3rVAtQ6+O9ihJrUJVKGzSO3Q+Eeyp6KWA9i2Kn5knGRsSAeHs/Bx6 7R1g== X-Gm-Message-State: AOJu0YwaNlink47D9tPsH9602BL+Z5fVFd6ZNMtn6EinXE29PJSwBzOh vr2EfBu22El+P9+n2XZjaS4meg== X-Google-Smtp-Source: AGHT+IFJZAiqLGITBB9Yi0hCcn8yRnUqkmyP8eOY/RIfQMB3OI8uDZT1rn/dXA6QXyfX1QB/Ha0Z1A== X-Received: by 2002:a50:8d52:0:b0:54c:48aa:cd0e with SMTP id t18-20020a508d52000000b0054c48aacd0emr1134309edt.30.1701423224409; Fri, 01 Dec 2023 01:33:44 -0800 (PST) Received: from otso.luca.vpn.lucaweiss.eu (dhcp-089-099-055-216.chello.nl. [89.99.55.216]) by smtp.gmail.com with ESMTPSA id b16-20020a05640202d000b0054bbc6b6580sm1423708edx.31.2023.12.01.01.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:33:44 -0800 (PST) From: Luca Weiss Date: Fri, 01 Dec 2023 10:33:18 +0100 Subject: [PATCH v3 1/3] media: venus: core: Set up secure memory ranges for SC7280 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231201-sc7280-venus-pas-v3-1-bc132dc5fc30@fairphone.com> References: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> In-Reply-To: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , cros-qcom-dts-watchers@chromium.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.4 Not all SC7280 devices ship with ChromeOS firmware. Other devices need PAS for image authentication. That requires the predefined virtual address ranges to be passed via scm calls. Define them to enable Venus on non-CrOS SC7280 devices. Reviewed-by: Konrad Dybcio Reviewed-by: Bryan O'Donoghue Reviewed-by: Vikash Garodia Signed-off-by: Luca Weiss --- drivers/media/platform/qcom/venus/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 9cffe975581b..a712dd4f02a5 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -881,6 +881,10 @@ static const struct venus_resources sc7280_res = { .vmem_size = 0, .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, + .cp_start = 0, + .cp_size = 0x25800000, + .cp_nonpixel_start = 0x1000000, + .cp_nonpixel_size = 0x24800000, .fwname = "qcom/vpu-2.0/venus.mbn", }; From patchwork Fri Dec 1 09:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 749065 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fairphone.com header.i=@fairphone.com header.b="3/USKZBT" Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2B6719BF for ; Fri, 1 Dec 2023 01:33:46 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-54bb9024378so2185776a12.3 for ; Fri, 01 Dec 2023 01:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; t=1701423225; x=1702028025; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oZnkqmBniHnZdrQ3H0Htq6tTPHmc+KBhKFIvMd2nGfo=; b=3/USKZBT9U5r3ON8z0C/0FP2StuPZ1WOGuqLuXknWK7ZRXXycnvwSRR05xuyomNL6x 1DekGSE/GKymCfwW/ZuzO6cYgq5En2Lq/9VBgm7OS60rUyqO28oy9etmS86EQuSPlAgw hTQoBR5nFNgKwD+HtlGOryGSgAdTkXdN568R4pTbt+PfudPgRErJ1lboNvwrmyxHNLcp GBjM1hjCPq9XiKyoKw0slZWrsvDa4CGrphUghhFRdJnL6b4/2mk29pjjeutobT9kIFEG 3jUfoTMSLr5teHPJ9eVotvPQnULCt0U/ub6/oYyBwnmLiDyNQjoSTzAgQZRonVTg41OD OemQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701423225; x=1702028025; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oZnkqmBniHnZdrQ3H0Htq6tTPHmc+KBhKFIvMd2nGfo=; b=kP1eY+o1+JzrYRq4aFFwKtH6KCYJAyFmWWOef3yo1+fIFz5JgnCsKvEHgTMqUJrn95 oPVqJpXSEmJxZ0b2lfXFsGM4REGm1mY2wwJwmMYXWGMAJsQFxQUQAB/tvKymq1Iy8bik SMYhF/OASrSX8QUOd8HWQ7ykqdXzsF7C586vDrJI/N5/dkMACYXG/nOX1mc9hAsE/WKI marGmP1EMtDXWlw7ZMLuhdd2VtNeQ1yP/l2Xx/Wh2Qd3g50q51Hhle7HY7l/NHVngufT nL0YTlBYNmJT9YZgdhL/0v2+KkRCftprnlFgEuTv9MA0TdjjFDCRXUo/Ljc2LrGdu0tc +4Sg== X-Gm-Message-State: AOJu0Yz9J/pIJgWtdr3YYtFWC5K0XrYKjG1y+MT1gv0kQu0mW7a2YxRu pxOcdXUDVcJcqGr07KMT1FspQA== X-Google-Smtp-Source: AGHT+IEx7bQWlk5Sk9+GArc/75DMVD8pdS1erYGGQPg6u7WQZOoG9DtK6vetGtm9IzaAPWFLj7T3Kg== X-Received: by 2002:a50:d756:0:b0:54b:7e11:c1 with SMTP id i22-20020a50d756000000b0054b7e1100c1mr584027edj.10.1701423225346; Fri, 01 Dec 2023 01:33:45 -0800 (PST) Received: from otso.luca.vpn.lucaweiss.eu (dhcp-089-099-055-216.chello.nl. [89.99.55.216]) by smtp.gmail.com with ESMTPSA id b16-20020a05640202d000b0054bbc6b6580sm1423708edx.31.2023.12.01.01.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:33:44 -0800 (PST) From: Luca Weiss Date: Fri, 01 Dec 2023 10:33:19 +0100 Subject: [PATCH v3 2/3] arm64: dts: qcom: sc7280: Move video-firmware to chrome-common Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231201-sc7280-venus-pas-v3-2-bc132dc5fc30@fairphone.com> References: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> In-Reply-To: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , cros-qcom-dts-watchers@chromium.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.4 If the video-firmware node is present, the venus driver assumes we're on a system that doesn't use TZ for starting venus, like on ChromeOS devices. Move the video-firmware node to chrome-common.dtsi so we can use venus on a non-ChromeOS devices. We also need to move the secure SID 0x2184 for iommu since (on some boards) we cannot touch that. At the same time also disable the venus node by default in the dtsi, like it's done on other SoCs. Reviewed-by: Bryan O'Donoghue Signed-off-by: Luca Weiss --- arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 11 +++++++++++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 9 +++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi index 5d462ae14ba1..459ff877df54 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi @@ -104,6 +104,17 @@ &scm { dma-coherent; }; +&venus { + iommus = <&apps_smmu 0x2180 0x20>, + <&apps_smmu 0x2184 0x20>; + + status = "okay"; + + video-firmware { + iommus = <&apps_smmu 0x21a2 0x0>; + }; +}; + &watchdog { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 326897af117a..0ff9a2484096 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -3836,10 +3836,11 @@ venus: video-codec@aa00000 { <&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>; interconnect-names = "cpu-cfg", "video-mem"; - iommus = <&apps_smmu 0x2180 0x20>, - <&apps_smmu 0x2184 0x20>; + iommus = <&apps_smmu 0x2180 0x20>; memory-region = <&video_mem>; + status = "disabled"; + video-decoder { compatible = "venus-decoder"; }; @@ -3848,10 +3849,6 @@ video-encoder { compatible = "venus-encoder"; }; - video-firmware { - iommus = <&apps_smmu 0x21a2 0x0>; - }; - venus_opp_table: opp-table { compatible = "operating-points-v2"; From patchwork Fri Dec 1 09:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 749872 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fairphone.com header.i=@fairphone.com header.b="FHU+4D2j" Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8701FFC for ; Fri, 1 Dec 2023 01:33:48 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-54c6896a689so86644a12.2 for ; Fri, 01 Dec 2023 01:33:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; t=1701423226; x=1702028026; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QTbESXzcXZ37/AxtizRE/kwCz5vVYNKpF/F7wAyS+CQ=; b=FHU+4D2jfOed21rv2GRbIh5eCFWePtkFS4/1YT1fFDfLl6PM5vuIzNJ6VtzjVcrByC KZQzEBAZGglRUyDL77gtZ6XDcVe2UAFTQgsKRc5Mq/iCf0nYlf0j1lIe3JRQZiR/QLn0 tOpdOscWM7Ows1ddqtYYqmoknObhETrAhzb+M5a6aiyEN6Sy4TAvm7V+iuCcblqqZRMS l71ht+NOOuHJwdEYZX868VUkzNn83sMqqooFyYF6ztCesc7Fb8ZSXQU5RmdEwCpU+cQ1 VjmpcWmPYPtHNFBhPli6fth+H693c6y8zStpKMM6S9QqTMvTTiR2yAlAvsXa0eoYZ0Co 6jHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701423226; x=1702028026; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QTbESXzcXZ37/AxtizRE/kwCz5vVYNKpF/F7wAyS+CQ=; b=Gh3qO6eLUGyL/EB6KDLP/Y/9yZrpGxur7HQrVdaXYMRa22dDoc7RNMDWwGkjqtuk73 ORNNA4izM5q1zwguBNbm6XQiuk1a3mBRVdU42QfVvXXWR/joAHl+4FWOPjnMCheu6Jrz 2eP1endK5PtcZCQt2zGQjILMWRxkj2PhQhg9B0D8TLFRNCXwqTiKmxG44EgXs44afhoo myXNfaOF2fHEe0Sy/fOCiRKigOx/xrxHscvkMO1Sk+FZR+N5f/R2cWsVu4wtyDRcq4W1 DdXfi2JKvFPfqtMv6xc93+6hpr6P3+prg37//JYGOLEidgHClfWYZWKp5RjhsIg2DMSB UTJg== X-Gm-Message-State: AOJu0YwNSr+xkeeeCDZeuvhHaJVw8xlrI1PsU89tZwdrPScclpTaD5Dp jdbCjepu3dfZmkq2JhNxDG17Cw== X-Google-Smtp-Source: AGHT+IEzLImOfl+SUEo6jVo606UYx0ucUdZyTVpCROkXcLzAMFsH7RPCUeL8vivDWmRZ7rZQP1JLUA== X-Received: by 2002:a50:d4d2:0:b0:54c:4837:a663 with SMTP id e18-20020a50d4d2000000b0054c4837a663mr468061edj.80.1701423226576; Fri, 01 Dec 2023 01:33:46 -0800 (PST) Received: from otso.luca.vpn.lucaweiss.eu (dhcp-089-099-055-216.chello.nl. [89.99.55.216]) by smtp.gmail.com with ESMTPSA id b16-20020a05640202d000b0054bbc6b6580sm1423708edx.31.2023.12.01.01.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:33:45 -0800 (PST) From: Luca Weiss Date: Fri, 01 Dec 2023 10:33:20 +0100 Subject: [PATCH v3 3/3] arm64: dts: qcom: qcm6490-fairphone-fp5: Enable venus node Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231201-sc7280-venus-pas-v3-3-bc132dc5fc30@fairphone.com> References: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> In-Reply-To: <20231201-sc7280-venus-pas-v3-0-bc132dc5fc30@fairphone.com> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , cros-qcom-dts-watchers@chromium.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.4 Enable the venus node so that the video encoder/decoder will start working. Reviewed-by: Konrad Dybcio Reviewed-by: Bryan O'Donoghue Reviewed-by: Vikash Garodia Signed-off-by: Luca Weiss --- arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index 762c5db29520..cc092735ce17 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts @@ -688,3 +688,8 @@ &usb_1_qmpphy { status = "okay"; }; + +&venus { + firmware-name = "qcom/qcm6490/fairphone5/venus.mbn"; + status = "okay"; +};