Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3632931imm; Mon, 4 Jun 2018 06:57:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJFFQvIKk7xNCAyGP0xB/jf0JEMeDGIPhFY5ykyDSAqnmAz088tsAQ0Xq17XkCu3suuCer3 X-Received: by 2002:a65:4081:: with SMTP id t1-v6mr17749666pgp.32.1528120641394; Mon, 04 Jun 2018 06:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528120641; cv=none; d=google.com; s=arc-20160816; b=symUPXBvQZHwfOQdu4+0CuJYezt53xNxwrAF7hSFFg+cvBh+4Tnlbx51gWpx754E80 3+f9dIb0dUJ9K9nGk+vDDf8VIukAtcUvq1zZGZdjg6pTd68ttURTP+GZF0sO3yzYFqb9 9s9chV2bOtP29SIg5ZE2PdWukjaH3vWe3tcCGjkXwVr1GBMJEiev5xw7DK1peVnwMmHB T4U2uvkkALdXNoIO/JQFIHdmntY1z/LQSOATbrHbC6N09CDEk2lSRGMX2aT+Gy/4cDe3 FERuCxLPLvo8kGcRL8WmNLMNGZK0cGl3jJOZTzWI6h5/5Hzns/vLwNxXBYOWcGj2Az9B VBBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=C2J3+2RjTxXMOXi6ewREDfI2iPYTjnzjMxMzUY7hHBU=; b=IJt/fETuZ2ZinJP1j3Wc0UDtT8CTQjLNmxERsCz4vrOlUyVu3GlEQUWtxkBF7K4C1w uSQfMtlGMurIaRaZoXaN6EIDo1gwWxSTX4FapxdK/LQO1ymjZglkTmsm3zrdUyISs4Eh onmFQQ0cuHZeGZE+bBW2eka6DlBwpu8gI2HFxcsagS6t/xwAJ5GuQ6Wf9u9OhBov6J7h lXFxKbPt0yHGKGFX9aZKGcF11kMyOpk5JVR1F51NO8E4f/z0L4ipqwdzRzJket0oe8Oy SpzaUnLGPQFaOlKBsf6OmQFRrFd0g/oejaXWGcnFWmBtMRbV+IA2zH9voXArIibISELM EWVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sik3OV93; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1-v6si30725127ply.425.2018.06.04.06.57.05; Mon, 04 Jun 2018 06:57:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sik3OV93; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753353AbeFDN4n (ORCPT + 99 others); Mon, 4 Jun 2018 09:56:43 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39135 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753197AbeFDN4k (ORCPT ); Mon, 4 Jun 2018 09:56:40 -0400 Received: by mail-wr0-f193.google.com with SMTP id w7-v6so31809227wrn.6 for ; Mon, 04 Jun 2018 06:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=C2J3+2RjTxXMOXi6ewREDfI2iPYTjnzjMxMzUY7hHBU=; b=Sik3OV93lIR5kIlb8Ij2v0PGtqvl5d8z4qlpE69cIfw236XeCDvPhQ8ilGSZBunjp3 4cRC7EhgK/S6HXz37tZkceHCNAl7IpQwACvyt4l+oa4lttQ5FsZqY56tjLrdUnjGD5X5 svPHjKm6y75jV9dSO6mq+pg+GcEIOn9/4vFRk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=C2J3+2RjTxXMOXi6ewREDfI2iPYTjnzjMxMzUY7hHBU=; b=k7FW11ibtiENHcdYNUCVSD8gBXkkV+S3e07sX39G2X1w6PDikLv7c+sKupZIqjJFeW z+ltqANMSovDXA3UX/ONTDA8k8kwSNprfk0fe4UoEoIn+47vK9tV/HQAJ1+xZ3S+0aS2 u1wf9bMczXjtIf948sWQk2qLu72CQU2/VUluVOQiPSxt1ZRBV7pa3fz6WlWU13bl1ths olAn4RkPFckMXlNRtkAcqAUrfn+9P16tMZJidHUhfsWcOaqAbUedrT/OLmlW22caQ9uF Fiiao2bOol0hsIJS0bE8WJNHGcwtnEtE6ZTW44aVO6Tgcuw+LXke97znMQPF3HrpH03P YA+A== X-Gm-Message-State: ALKqPwdRd/2t4k8ayMWH67mJd8TyM0I9s17Dfzcism8Uo91x/CsK2Xhh nmGTnC6UZ4s6hs1nfEGyd/TE1w== X-Received: by 2002:adf:88ca:: with SMTP id g10-v6mr14918879wrg.62.1528120598972; Mon, 04 Jun 2018 06:56:38 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id m64-v6sm379460wmb.12.2018.06.04.06.56.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 06:56:38 -0700 (PDT) Subject: Re: [PATCH v2 5/5] venus: register separate driver for firmware device To: Tomasz Figa , vgarodia@codeaurora.org Cc: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , andy.gross@linaro.org, bjorn.andersson@linaro.org, Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , linux-soc@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Courbot References: <1527884768-22392-1-git-send-email-vgarodia@codeaurora.org> <1527884768-22392-6-git-send-email-vgarodia@codeaurora.org> From: Stanimir Varbanov Message-ID: <2cf4f7e8-f9e6-d62b-45a8-2c348af4aafe@linaro.org> Date: Mon, 4 Jun 2018 16:56:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tomasz, On 06/04/2018 04:18 PM, Tomasz Figa wrote: > Hi Vikash, > > On Sat, Jun 2, 2018 at 5:27 AM Vikash Garodia wrote: >> >> A separate child device is added for video firmware. >> This is needed to >> [1] configure the firmware context bank with the desired SID. >> [2] ensure that the iova for firmware region is from 0x0. >> >> Signed-off-by: Vikash Garodia >> --- >> .../devicetree/bindings/media/qcom,venus.txt | 8 +++- >> drivers/media/platform/qcom/venus/core.c | 48 +++++++++++++++++++--- >> drivers/media/platform/qcom/venus/firmware.c | 20 ++++++++- >> drivers/media/platform/qcom/venus/firmware.h | 2 + >> 4 files changed, 71 insertions(+), 7 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt >> index 00d0d1b..701cbe8 100644 >> --- a/Documentation/devicetree/bindings/media/qcom,venus.txt >> +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt >> @@ -53,7 +53,7 @@ >> >> * Subnodes >> The Venus video-codec node must contain two subnodes representing >> -video-decoder and video-encoder. >> +video-decoder and video-encoder, one optional firmware subnode. >> >> Every of video-encoder or video-decoder subnode should have: >> >> @@ -79,6 +79,8 @@ Every of video-encoder or video-decoder subnode should have: >> power domain which is responsible for collapsing >> and restoring power to the subcore. >> >> +The firmware sub node must contain the iommus specifiers for ARM9. > > Please document the compatible string here as well. > >> + >> * An Example >> video-codec@1d00000 { >> compatible = "qcom,msm8916-venus"; >> @@ -105,4 +107,8 @@ Every of video-encoder or video-decoder subnode should have: >> clock-names = "core"; >> power-domains = <&mmcc VENUS_CORE1_GDSC>; >> }; >> + venus-firmware { >> + compatible = "qcom,venus-firmware-no-tz"; > > I don't think "-no-tz" should be mentioned here in DT, since it's a > firmware/software detail. I have to agree with Tomasz, non-tz or tz is a software detail and it shouldn't be reflected in compatible string. Also I'm not sure but what will happen if this video-firmware subnode is not added, do you expect that backward compatibility is satisfied for older venus versions? > >> + iommus = <&apps_smmu 0x10b2 0x0>; >> + } >> }; >> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c >> index 101612b..5cfb3c2 100644 >> --- a/drivers/media/platform/qcom/venus/core.c >> +++ b/drivers/media/platform/qcom/venus/core.c >> @@ -179,6 +179,19 @@ static u32 to_v4l2_codec_type(u32 codec) >> } >> } >> >> +static int store_firmware_dev(struct device *dev, void *data) >> +{ >> + struct venus_core *core = data; >> + >> + if (!core) >> + return -EINVAL; >> + > > No need to check this AFAICT.> >> + if (of_device_is_compatible(dev->of_node, "qcom,venus-firmware-no-tz")) >> + core->fw.dev = dev; >> + >> + return 0; >> +} >> + >> static int venus_enumerate_codecs(struct venus_core *core, u32 type) >> { >> const struct hfi_inst_ops dummy_ops = {}; >> @@ -279,6 +292,13 @@ static int venus_probe(struct platform_device *pdev) >> if (ret < 0) >> goto err_runtime_disable; >> >> + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); >> + if (ret) >> + goto err_runtime_disable; >> + >> + /* Attempt to store firmware device */ >> + device_for_each_child(dev, core, store_firmware_dev); >> + >> ret = venus_boot(core); >> if (ret) >> goto err_runtime_disable; >> @@ -303,10 +323,6 @@ static int venus_probe(struct platform_device *pdev) >> if (ret) >> goto err_core_deinit; >> >> - ret = of_platform_populate(dev->of_node, NULL, NULL, dev); >> - if (ret) >> - goto err_dev_unregister; >> - >> ret = pm_runtime_put_sync(dev); >> if (ret) >> goto err_dev_unregister; >> @@ -483,7 +499,29 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) >> .pm = &venus_pm_ops, >> }, >> }; >> -module_platform_driver(qcom_venus_driver); >> + >> +static int __init venus_init(void) >> +{ >> + int ret; >> + >> + ret = platform_driver_register(&qcom_video_firmware_driver); >> + if (ret) >> + return ret; > > Do we really need this firmware driver? As far as I can see, the > approach used here should work even without any driver bound to the > firmware device. We need device/driver bind because we need to call dma_configure() which internally doing iommus sID parsing. -- regards, Stan