Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp160121pxb; Wed, 25 Aug 2021 23:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEfC5Hjiwj6ExpBSHYdq1LmxC+ITwTEe9WuExaU5vIWtVxFBdn/lZB4pzfTaW3R/lAEmJV X-Received: by 2002:a05:6e02:1bac:: with SMTP id n12mr1594650ili.151.1629959131977; Wed, 25 Aug 2021 23:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629959131; cv=none; d=google.com; s=arc-20160816; b=ssa4Jmmfpj7izfHzDtFE2dnY1uboziM1lpV4fs2B/RXwxeYJ0hR4V6Um+X5kMCrugz +03e/kLMf0xrxtNLCk97s5GAQs1PADXk4mkZtVqHiR0/LQlTSck7DE9lr1qX+kwITpdw mk6IHmzReDEMiFYEN42NhJTeeGp7ZNkGfYzweYkmCkSQacljqn6sfsKkifzP4mujb0I8 ENaIgVi/PF7Otey5K3m6txMUE+ePr42/Q+wjtaTDJCqY95q7Epft2hG0+V9H2tZZFv/P DYHMkbAUt2J9WEkaVTc896JWYRmWnH1qevw1hSvasjuMdjIPaxuYc9woJnQomZyYOy7z C0Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AQG5XEerWcG5JdLpqnOSmUbHrnBws2ASLAsEu1SuWS0=; b=l2da8POuyi0W2+7HgwHZdddv2y58m4ABAQz2zbOHbPPaoKUJIgvu8ew+mfvq2jz7wO 1qktP8wqi0gdqD/UnEoX8Zu2CTYbeewVnrnP2VPphaOHvQEYh7cca9EHYyFvPUIIiDNg qc+8z1u/LYokme5LIZbJuyvufhL4yV3iXJz6nPFci2HhWBrSayHbiD2u/iwEIo5KMBEs qRGtO9U+gCFWSmvhdnFYeoLO58b0uKAJ1Py1e2WDxHclW/fExvsEicBQBl25XnoOZSqG iknxbyDf1bIKq2ZRL1h3iYPUEqCjfam1WER4vU5MFzg/cO7jQVpHHJ3xbadXflwiexwm YwuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si1828269ioh.72.2021.08.25.23.25.19; Wed, 25 Aug 2021 23:25:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239184AbhHZGXP (ORCPT + 99 others); Thu, 26 Aug 2021 02:23:15 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:14421 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239133AbhHZGXO (ORCPT ); Thu, 26 Aug 2021 02:23:14 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GwCMr27LMzbdKT; Thu, 26 Aug 2021 14:18:32 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 26 Aug 2021 14:22:22 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 26 Aug 2021 14:22:21 +0800 Subject: Re: [PATCH 3/3] amba: Properly handle device probe without IRQ domain To: Saravana Kannan CC: Rob Herring , "linux-kernel@vger.kernel.org" , Frank Rowand , , Russell King , "Linus Walleij" , linux-arm-kernel , Ruizhe Lin References: <20210816074619.177383-1-wangkefeng.wang@huawei.com> <20210816074619.177383-4-wangkefeng.wang@huawei.com> From: Kefeng Wang Message-ID: <245f3ce5-1d8b-79c2-31af-4dc13536505d@huawei.com> Date: Thu, 26 Aug 2021 14:22:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/26 12:45, Saravana Kannan wrote: > On Wed, Aug 25, 2021 at 7:45 PM Kefeng Wang wrote: >> >> On 2021/8/25 16:04, Saravana Kannan wrote: >>> On Tue, Aug 24, 2021 at 9:05 PM Kefeng Wang wrote: >>>> On 2021/8/25 4:08, Saravana Kannan wrote: >>>>> On Tue, Aug 24, 2021 at 1:05 PM Rob Herring wrote: >>>>>> +Saravana >>>>>> >>>>>> Saravana mentioned to me there may be some issues with this one... >>>>>> >>>>>> >>>>>> On Mon, Aug 16, 2021 at 2:43 AM Kefeng Wang wrote: >>>>>>> of_amba_device_create() uses irq_of_parse_and_map() to translate >>>>>>> a DT interrupt specification into a Linux virtual interrupt number. >>>>>>> >>>>>>> But it doesn't properly handle the case where the interrupt controller >>>>>>> is not yet available, eg, when pl011 interrupt is connected to MBIGEN >>>>>>> interrupt controller, because the mbigen initialization is too late, >>>>>>> which will lead to no IRQ due to no IRQ domain found, log is shown below, >>>>>>> "irq: no irq domain found for uart0 !" >>>>>>> >>>>>>> use of_irq_get() to return -EPROBE_DEFER as above, and in the function >>>>>>> amba_device_try_add()/amba_device_add(), it will properly handle in such >>>>>>> case, also return 0 in other fail cases to be consistent as before. >>>>>>> >>>>>>> Cc: Russell King >>>>>>> Cc: Rob Herring >>>>>>> Cc: Frank Rowand >>>>>>> Reported-by: Ruizhe Lin >>>>>>> Signed-off-by: Kefeng Wang >>>>>>> --- ... >>>>> Similar to other resources the AMBA bus "gets" for the device, I think >>>>> this should be moved into amba_probe() and not here. There's no reason >>>>> to delay the addition of the device (and loading its module) because >>>>> the IRQ isn't ready yet. >>>> The following code in the amba_device_try_add() will be called, it uses irq[0] >>>> and irq[1], so I put of_amba_device_decode_irq() into amba_device_try_add(). >>>> >>>> 470 if (dev->irq[0]) >>>> 471 ret = device_create_file(&dev->dev, &dev_attr_irq0); >>>> 472 if (ret == 0 && dev->irq[1]) >>>> 473 ret = device_create_file(&dev->dev, &dev_attr_irq1); >>>> 474 if (ret == 0) >>>> 475 return ret; >>>> >>>> of_amba_device_decode_irq() in amba_device_try_add() won't lead to issue, >>>> only delay the device add, right? >>> But delaying the device add is the issue. For example, adding a device >>> could trigger the loading of the corresponding module using uevents. >>> But now this change would delay that step. That can have other >>> unintended consequences -- slowing down boot, what if the driver was >>> working fine without the IRQ, etc. >>> >>>> If make it into amba_probe(), the above code should be moved too, could we >>>> make a new patch to move both of them, or don't move them? >>> I'd say move them both. If Russell hasn't already picked this up, then >>> I'd say redo your Patch 3/3. >> I will resend with put it into amba_probe. >>> Btw, I've been working on [1] cleaning up the one-off deferred probe >>> solution that we have for amba devices. That causes a bunch of other >>> headaches. Your patch 3/3 takes us further in the wrong direction by >>> adding more reasons for delaying the addition of the device. >> Got it, and I could resend all combine your patch(due to context conflict >> >> when changing same function) if you no object. > If you want to resolve the conflict with my patch and resend it while > keeping me as the author, I would definitely appreciate it. Yes, I will keep it, and rebase my patch based on it. > > -Saravana >> >>> -Saravana >>> >>> [1] - https://lore.kernel.org/lkml/CAGETcx8b228nDUho3cX9AAQ-pXOfZTMv8cj2vhdx9yc_pk8q+A@mail.gmail.com/ >>> . >>> > . >