From patchwork Tue May 30 12:30:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13259932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 363E6C7EE23 for ; Tue, 30 May 2023 12:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231882AbjE3Mbu (ORCPT ); Tue, 30 May 2023 08:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbjE3Mba (ORCPT ); Tue, 30 May 2023 08:31:30 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FACD1B5 for ; Tue, 30 May 2023 05:31:07 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2af29b37bd7so46711321fa.1 for ; Tue, 30 May 2023 05:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685449846; x=1688041846; 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=5gG/GQ4bkNLXJnem7GziPpF9ACnuRetCT8nUsDWFQHk=; b=FPcrWx+S0QqRRp9vjxeUGVcIokY4/Nke+Ff+Q0JzM8PKBO4+rvXhn1bgO7zpzFOTNP 6BMA/Vey0ohHZ8ULcjp+Qc0nvj/j4EgCpMhld9J2LXcxMeccAmPQzHJSdpTFxWuhcFMb VAsjQA+LYAOsKhdpXM9W3TCxM+ZGRe/+424JuDbGMQpx3yjx4zcaVITqg8gXFN/14UY2 BHHIIHUDMbKMnqNdMRzeUY6rbZbmMTbqpg2v0zIauOVF4kUL8oBiOFuIn/EP6kwDR3af HP9P2GnOSLsIcLYJA/LojzJ4hQDut4jD93IsVYebz0b+1Rs7Z+2DBjEqg13q7bu0uRiQ Tr6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685449846; x=1688041846; 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=5gG/GQ4bkNLXJnem7GziPpF9ACnuRetCT8nUsDWFQHk=; b=MFtyXidxSyrp+g03xO67uq+b7O/zddkpqeaHRshOzVFLobXcsh5r+aPO51mUczvZdQ ZLrrFUPg9WtF3ZV5E0ElwVcYxFdD8U1pZ46YrlB2pmVexMqCAXhVWs3P0sQy6/qC/Qp/ Acq3APOR4G5COBIITfZ9SigSEnKz9n9wsApqb4a8nmHwTYiieBIxXUW6p0OgPtyaULpV qlOywbLf5l1GZE0NB0uS3tvljmcN9gCx3mXhcCbBaschRgXd0+gnEmEWd+apTSwyXsy6 l3neiNOdXXVlS65kwzevsZsn5SNxcVwLBYgOFG/WCZizd5Lw5iMutXuakGgUlFzF6KNt yBwA== X-Gm-Message-State: AC+VfDxB+nYLp8dxnfk0YTqUwY9nlmHqVx8vd6zej52nNd7nwOqPhOWh BR0y+3qzWI8n1LuqwmM5Pe/fqQ== X-Google-Smtp-Source: ACHHUZ6425G16ZBREi/VznF6+jFFaaARjmy2zcNhdH6MNDBtZkLRadv/FvnFM8Rpluskkffqo1AaMg== X-Received: by 2002:a2e:97ca:0:b0:2ae:da46:7f62 with SMTP id m10-20020a2e97ca000000b002aeda467f62mr782022ljj.29.1685449846149; Tue, 30 May 2023 05:30:46 -0700 (PDT) Received: from [192.168.1.101] (abyj77.neoplus.adsl.tpnet.pl. [83.9.29.77]) by smtp.gmail.com with ESMTPSA id u18-20020a2e91d2000000b002a8b8baf542sm2854814ljg.126.2023.05.30.05.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 05:30:45 -0700 (PDT) From: Konrad Dybcio Date: Tue, 30 May 2023 14:30:39 +0200 Subject: [PATCH v4 05/17] media: venus: firmware: Leave a clue about obtaining CP VARs MIME-Version: 1.0 Message-Id: <20230228-topic-venus-v4-5-feebb2f6e9b8@linaro.org> References: <20230228-topic-venus-v4-0-feebb2f6e9b8@linaro.org> In-Reply-To: <20230228-topic-venus-v4-0-feebb2f6e9b8@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Bryan O'Donoghue , Mansur Alisha Shaik , Jonathan Marek , Hans Verkuil , Dikshita Agarwal Cc: Mauro Carvalho Chehab , Stanimir Varbanov , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Marijn Suijten , Konrad Dybcio , Vikash Garodia X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685449837; l=1589; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=v9h9rG/TP42x17XwYSGnOJ0sfKKqjUawup8lEKzjmAc=; b=J7JzvBaATX4OCVY/zIqqe/aOUY/Ubry8yNokzE+j+EO1Y/vbLIyY1ZtEZo9hQK9FF0fPaY9FB uVJ+94MKZQZAw9fX+nNMzg4Ke59YMQPbMOfbWN/jOFeIbOUw5BDoF6w X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The qcom_scm_mem_protect_video_var accepts two sets of pairs as arguments. They describe the virtual address ranges of the CP (Content Protection) and CP_NONPIXEL regions. It is however not immediately obvious how to obtain these values. Leave a comment explaining how one can translate the vendor device tree properties for use with the mainline driver. Reviewed-by: Dikshita Agarwal Reviewed-by: Vikash Garodia Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/firmware.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index cfb11c551167..572b649c56f3 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -241,6 +241,16 @@ int venus_boot(struct venus_core *core) return ret; if (core->use_tz && res->cp_size) { + /* + * Clues for porting using downstream data: + * cp_start = 0 + * cp_size = venus_ns/virtual-addr-pool[0] - yes, address and not size! + * This works, as the non-secure context bank is placed + * contiguously right after the Content Protection region. + * + * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0] + * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1] + */ ret = qcom_scm_mem_protect_video_var(res->cp_start, res->cp_size, res->cp_nonpixel_start,