From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5AC4C11F66 for ; Tue, 29 Jun 2021 11:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABBD861DAC for ; Tue, 29 Jun 2021 11:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233471AbhF2L2b (ORCPT ); Tue, 29 Jun 2021 07:28:31 -0400 Received: from regular1.263xmail.com ([211.150.70.198]:59232 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbhF2L2a (ORCPT ); Tue, 29 Jun 2021 07:28:30 -0400 X-Greylist: delayed 446 seconds by postgrey-1.27 at vger.kernel.org; Tue, 29 Jun 2021 07:28:29 EDT Received: from localhost (unknown [192.168.167.105]) by regular1.263xmail.com (Postfix) with ESMTP id A4493F12; Tue, 29 Jun 2021 19:18:33 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from [172.16.12.10] (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P13110T140560568407808S1624965510067257_; Tue, 29 Jun 2021 19:18:33 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3fcf2cd44b3224a230bc17c7e69a24d8> X-RL-SENDER: andy.yan@rock-chips.com X-SENDER: yxj@rock-chips.com X-LOGIN-NAME: andy.yan@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-RCPT-COUNT: 7 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 Subject: Re: [PATCH] drm/rockchip: Check iommu itself instead of it's parent for device_is_available To: Robin Murphy , hjc@rock-chips.com, heiko@sntech.de, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210627084737.309163-1-andy.yan@rock-chips.com> <66fb4977-4e6f-f7ed-0dac-18710ebd782a@arm.com> From: Andy Yan Message-ID: Date: Tue, 29 Jun 2021 19:18:29 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <66fb4977-4e6f-f7ed-0dac-18710ebd782a@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robin: On 6/28/21 5:54 PM, Robin Murphy wrote: > On 2021-06-27 09:47, Andy Yan wrote: >> When iommu itself is disabled in dts, we should >> fallback to non-iommu buffer, check iommu parent >> is meanless here. >> >> Signed-off-by: Andy Yan >> --- >> >>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c >> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c >> index 212bd87c0c4a..0d20c8cc1ffa 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c >> @@ -366,7 +366,7 @@ static int rockchip_drm_platform_of_probe(struct >> device *dev) >>           } >>             iommu = of_parse_phandle(port->parent, "iommus", 0); >> -        if (!iommu || !of_device_is_available(iommu->parent)) { >> +        if (!iommu || !of_device_is_available(iommu)) { > > Just wondering, could you use device_iommu_mapped() to avoid poking at > the DT at all here, or is it that you need to check remote graph > endpoints whose struct device may not be ready yet? device_iommu_mapped(dev)  can't be called from rockchip_drm_init_iommu, as there is no  iommu dev(vop) in these function. > > Robin. > >>               DRM_DEV_DEBUG(dev, >>                         "no iommu attached for %pOF, using non-iommu >> buffers\n", >>                         port->parent); >> > > >