Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp400275imm; Tue, 5 Jun 2018 22:42:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKbRVHI+sIXrC9rS1zZ17U4XP1URwAc7TpDk6ABsIz3hTvZb1ZSSb+OvCy/tDlJ8/ez7sTl X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr1753071plb.297.1528263756112; Tue, 05 Jun 2018 22:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528263756; cv=none; d=google.com; s=arc-20160816; b=uvFYryqh8d0XhoOFZCpEi1cgMwamK9tPBUQtPrZPRSzd91WjpqPo9CPgHlWY/LaKWu GbGTJ0CRgGoqOuXJ6gZX+i9yu+eD52/03CL499HNXCt/48knNqtkuN3JNxoRHBnImXVM QXSiTB8Qd0jytO3OhNp/n9b0mF8YpgiS0BPakQFEScgZyR7iMO16hcvW/BUqSixFoawo NMtMKP+46GVN67E7GXnNoTvIelGidIZgGBeI7KYbxiCE7l25WR+n7NXx0CxSo9JIRUBd rZAmHgWi11SGvu7wb3ISh8TdnY4/JJaOIniQgxQ8uhiSkoNlYs8l5oQkYzCED6GwXGL2 pxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=nNmfKVlxzQsNn9XG2HI2NE+VWqK61FSAN4EQfgyqjIc=; b=Iz0xxopyhF7mSz+WG4B5oVu/pUDqoffsJUUkWiS/xoyr0eFI0GW0KMX1KokFzONX53 tvr/WO4FhszPhsWwO99yP/vS0QvOMgfvl8x54Gg2+23SOOG576NZK5Gv5SjdEXI8Fwvt Zu1eo4Buy6mNBRkmkBrjt14n7ZE/2vnczDpEToe4h4GYY+BMK9Bgp8fLRZwRJJq3mgrE aul3GOGc0Fw+eZa4i3urg/zFAwmR4ivg7DQFMSRit9QY8Sg/RuAIpRXoR5EEMoDhcvhm sYqZmnSXLZIqpmfanFsVluFa/C4kQMRvlK+v43JBya30jL6YSRtM03Z7m8YgMcVhIKr/ ouuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BIxbYL1O; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l68-v6si10709393pgl.84.2018.06.05.22.42.21; Tue, 05 Jun 2018 22:42:36 -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=@chromium.org header.s=google header.b=BIxbYL1O; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbeFFFl4 (ORCPT + 99 others); Wed, 6 Jun 2018 01:41:56 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:41262 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbeFFFlw (ORCPT ); Wed, 6 Jun 2018 01:41:52 -0400 Received: by mail-vk0-f67.google.com with SMTP id 128-v6so2933412vkf.8 for ; Tue, 05 Jun 2018 22:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nNmfKVlxzQsNn9XG2HI2NE+VWqK61FSAN4EQfgyqjIc=; b=BIxbYL1Oft/ZABT05OnEn/oF6uDnDcAkTUG8xlW+eznoNfegbjI382/LsL5mlsjeW1 rj9IsZRiR0g4zOSNRNVprj/UkXMQhXeHR9umad5bINpUejAg4Yl2zegj5e+nlJEwx1dN Fd5ONgGRJOq14IuxB6PTJePJn0tKoT82Yjl4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nNmfKVlxzQsNn9XG2HI2NE+VWqK61FSAN4EQfgyqjIc=; b=EY3yxCht0g7P/IU8n3FCI1A658Y6V+MZdAszd/xto83dAL9h9TZnmGl4SxhEK40m4k W/Sl4DVc52lQbQahJVFtlXuwbEP7QvlJOx75tZUZWrPVjJ3lZoBkWjei70bMq/jEPmbh v/BQAUJkaW2aFYkac3KoJhBVViOZn4xSIX0/ok+Y31JXQHD+7KwhJwJ3Iru25AXGRBtc RuGfgI201gqg7PI06tTmiU7ycWdruf7GUC3dJaCusxSzLn+e6IlMFZK0U+M/YhgsmUl1 XqbMz6NhaTdcUeANYcMeJ+Y29f2Peq991Zyc0r5E7IsyGOZLgGLaTuAa5+iJw6JzMe4w BNuQ== X-Gm-Message-State: APt69E0bEZvw9LSFThMBMc4+iOLJONoGTJSwUxGMWCNRe1QIhmCBNiNf NLiMeqGVpcwrYjIMZ1mAZ8E2m8Ifa1o= X-Received: by 2002:a1f:a00d:: with SMTP id j13-v6mr151628vke.23.1528263711693; Tue, 05 Jun 2018 22:41:51 -0700 (PDT) Received: from mail-ua0-f181.google.com (mail-ua0-f181.google.com. [209.85.217.181]) by smtp.gmail.com with ESMTPSA id y18-v6sm5947329uay.44.2018.06.05.22.41.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 22:41:50 -0700 (PDT) Received: by mail-ua0-f181.google.com with SMTP id a2-v6so3291582uak.2 for ; Tue, 05 Jun 2018 22:41:50 -0700 (PDT) X-Received: by 2002:ab0:134d:: with SMTP id h13-v6mr1075833uae.73.1528263709712; Tue, 05 Jun 2018 22:41:49 -0700 (PDT) MIME-Version: 1.0 References: <1527884768-22392-1-git-send-email-vgarodia@codeaurora.org> <1527884768-22392-6-git-send-email-vgarodia@codeaurora.org> <2cf4f7e8-f9e6-d62b-45a8-2c348af4aafe@linaro.org> In-Reply-To: From: Tomasz Figa Date: Wed, 6 Jun 2018 14:41:38 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/5] venus: register separate driver for firmware device To: Stanimir Varbanov Cc: vgarodia@codeaurora.org, Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Andy Gross , 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 , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 5, 2018 at 5:45 PM Stanimir Varbanov wrote: > > Cc: Arnd > > On 06/05/2018 07:08 AM, Tomasz Figa wrote: > > On Mon, Jun 4, 2018 at 10:56 PM Stanimir Varbanov > > wrote: > >> > >> 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: > >>>> +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. > > > > I can see some drivers calling of_dma_configure() directly: > > https://elixir.bootlin.com/linux/latest/ident/of_dma_configure > > > > I'm not sure if it's more elegant, but should at least require less code. > > I think that in this case of non-TZ where we do iommu mapping by hand we > can use shared-dma-pool reserved memory see how venus_boot has been > implemented in the beginning [1]. I might have misunderstood something, but wasn't the shared-dma-pool about reserving physical memory, while the venus firmware problem is about reserving certain range of IOVA? > > Arnd what do you think? > > Some background, we have a use-case where the memory for firmware needs > to be mapped by the venus driver by hand instead of TZ firmware calls. > I.e. we want to support both, iommu mapping from the driver and mapping > done by TZ firmware. How we will differentiate what mapping (TZ or > non-TZ) will be used is a separate issue. > > > > > By the way, can we really assume that probe of firmware platform > > device really completes before we call venus_boot()? > > I'd say we cannot. Looking at current implementation in driver core, of_platform_populate() would actually trigger a synchronous probe, so I guess it could work. However, I'm not sure if this is a general guarantee here or it's an implementation detail that shouldn't be relied on. If we end up really need to have this platform_driver, I guess we could call platform_driver_probe() after of_platform_populate(), rather than pre-registering the driver. That seems to be the way to ensure that the probe is synchronous and we can also check that a matching device was found by the return value. Best regards, Tomasz