Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp555059pxf; Wed, 7 Apr 2021 06:20:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUfwOl47BHRR7/tpbuVk35bWLbe8XHUzA0dSBYHhjtfcbB5AYcxeDyaV0tj1SG/JXFo13q X-Received: by 2002:aa7:de8b:: with SMTP id j11mr4394636edv.363.1617801612141; Wed, 07 Apr 2021 06:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617801612; cv=none; d=google.com; s=arc-20160816; b=0f0zXFXfGgigjcrYyP++OZ6oX8b71MRM6b3B0Mx9thKuVKBQfO9T4AhA4qoxqka2MI YPDkNaNEtYtyh/sf9cPKsvDTa3PfRkmrn6pRYpxuO0YF5HbWMLLyncEBEvlLXRMZio3W eH7v15j6XAcBPmiESyN9UpdGRihaQP5S5wJdUquBuxHCl3VO6JPg7K1v022qEk1k9Kg0 ILnYHNgxCdLhNXWHxPCaxnoHy0Ut2GAg5M+jGwQQOLMGXUGq+ZDWWY6HCzR0j15LPcsH 3zHGCFWX4zPxdlzXDvAJ1pLmjDGoHjfgNUOWBpltiXtBFgxsJUz3a7APfB1i9p05V1ZM VwRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RGNhW1SeCdXrMq4z6mrbdFRDIylhAsC1seorfL6HTAM=; b=hnSuMX324kI3L3SvmHl55K+d2JZqB/+04EVRnYubyqo++NILxVm0Y7gyllrZLI9p7g 2c06f9jFi4OPVEPHxJCEng0DkbEka0vjSeVAjRPUafyoH8oCxj7HV7CDCakS6sj/pAJz jhFs2LoXpDqSFdkxnmovpRkTD5KrhTyqvfF7RbglpTM4Tpm65Z623NBHmc1UxfUN334l hq4PAhbRsXzM3agVTqehfaAsv/uyXX1+FDbidghUiqXy+z+2r2Fr6eVPpOUMET7tlMAm HP7a73UZ4VSoOzxOIQMoXkYJ6ZJQlAeyX3E/0xRWeOGP/2Md2+Q0ydu/m208oc5wmBGf 93nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rpNRun9/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kf14si1389323ejc.693.2021.04.07.06.19.47; Wed, 07 Apr 2021 06:20:12 -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; dkim=pass header.i=@linaro.org header.s=google header.b="rpNRun9/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239162AbhDFX2w (ORCPT + 99 others); Tue, 6 Apr 2021 19:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhDFX2v (ORCPT ); Tue, 6 Apr 2021 19:28:51 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C285BC061756 for ; Tue, 6 Apr 2021 16:28:41 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id k8so11604710pgf.4 for ; Tue, 06 Apr 2021 16:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RGNhW1SeCdXrMq4z6mrbdFRDIylhAsC1seorfL6HTAM=; b=rpNRun9/6wtnfL2CPb/ElToTlTr/MBgUJSi1HaaTdIjFLJ7NW6EesGp29IN/KMoscW m+uRBzeLMM5hqXsUG3zTVi0PyJgeraCxz6BaOPjV8pxQeAZG1xGRWNB3aJbCRYnV7czB ZyhF02592EHIhj3tSaET9sXEyyi/ChMhraptbYj57PuyV9gV/ZRRmALEl8ocMuhzf4P4 +WJl23P2ObKObCZDRg1lKGYrwZ+dF0q3RhXWA+xwTcRJsuy9IzAi2sujuMr0jPxA9AtP 16TYdP4orK+eF9R/pTH9+ST9Vd6RV3oGdCxfBTEa/UBITVVLSiaHInF9X4BQxgMxqtNs pWXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RGNhW1SeCdXrMq4z6mrbdFRDIylhAsC1seorfL6HTAM=; b=DrL25YdI7jxjpDVsDIrSk5lAf0xNkXSqYSK7d+ktVwEKdZ+lrYHHU6FH80FsNt73M2 VvaCeLpVhNYdUs9Nz2EAlN5HJYUZp6fVJghCU1KJofTVIwBx8MSYpKyvIGQN2ybFd2Dd owxE7k/1tG4+ehepxUUIQ8rSyx+0xiz4SisxLQSBZ3b8RbAJqCseoSczWdS9+A4O/YGR Mzr4eudZNjoWphnCmWHiJ7QYO5iAiSXjFswKE+KitUEW88IqTfrilhWrx+oIX/gG6Uje oGv50t7kQcTJqTSUk78ogo7aP6nVlCxcqXAw0mAQOei2n62uKSH4MpXEl3DEVesIx0lL QV4g== X-Gm-Message-State: AOAM531Cr7ez0HcxZmzV6v9Tz3OCb4xc8xoWiIar1hYwG8wk8vHVYdrQ opdkbbwa42kXrUHmgBLVfMrJ1w== X-Received: by 2002:a65:68d3:: with SMTP id k19mr580276pgt.44.1617751721163; Tue, 06 Apr 2021 16:28:41 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id j16sm19188529pfa.213.2021.04.06.16.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 16:28:40 -0700 (PDT) Date: Tue, 6 Apr 2021 17:28:37 -0600 From: Mathieu Poirier To: Suman Anna Cc: Bjorn Andersson , Grzegorz Jaszczyk , Jan Kiszka , Vignesh Raghavendra , Lokesh Vutla , linux-remoteproc@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] remoteproc: pru: Fixup interrupt-parent logic for fw events Message-ID: <20210406232837.GA330882@xps15> References: <20210323223839.17464-1-s-anna@ti.com> <20210323223839.17464-2-s-anna@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323223839.17464-2-s-anna@ti.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 05:38:37PM -0500, Suman Anna wrote: > The PRU firmware interrupt mapping logic in pru_handle_intrmap() uses > of_irq_find_parent() with PRU device node to get a handle to the PRUSS > Interrupt Controller at present. This logic however requires that the > PRU nodes always define a interrupt-parent property. This property is > neither a required/defined property as per the PRU remoteproc binding, > nor is relevant from a DT node point of view without any associated > interrupts. The curret logic finds a wrong interrupt controller and > fails to perform proper mapping without any interrupt-parent property > in the PRU nodes. > > Fix this logic to always find and use the sibling interrupt controller. > Also, while at this, fix the acquired interrupt controller device node > reference properly. > > Fixes: c75c9fdac66e ("remoteproc: pru: Add support for PRU specific interrupt configuration") > Signed-off-by: Suman Anna > --- > drivers/remoteproc/pru_rproc.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c > index 16979c1cd2f4..a9d07c0751be 100644 > --- a/drivers/remoteproc/pru_rproc.c > +++ b/drivers/remoteproc/pru_rproc.c > @@ -284,7 +284,7 @@ static int pru_handle_intrmap(struct rproc *rproc) > struct pru_rproc *pru = rproc->priv; > struct pru_irq_rsc *rsc = pru->pru_interrupt_map; > struct irq_fwspec fwspec; > - struct device_node *irq_parent; > + struct device_node *parent, *irq_parent; > int i, ret = 0; > > /* not having pru_interrupt_map is not an error */ > @@ -312,9 +312,16 @@ static int pru_handle_intrmap(struct rproc *rproc) > > /* > * parse and fill in system event to interrupt channel and > - * channel-to-host mapping > + * channel-to-host mapping. The interrupt controller to be used > + * for these mappings for a given PRU remoteproc is always its > + * corresponding sibling PRUSS INTC node. > */ > - irq_parent = of_irq_find_parent(pru->dev->of_node); If I understand correctly when an interrupt controller node wasn't speficied in the parent this was unwinding until it found one... > + parent = of_get_parent(dev_of_node(pru->dev)); > + if (!parent) > + return -ENODEV; > + > + irq_parent = of_get_child_by_name(parent, "interrupt-controller"); > + of_node_put(parent); > if (!irq_parent) { > kfree(pru->mapped_irq); > return -ENODEV; > @@ -337,11 +344,13 @@ static int pru_handle_intrmap(struct rproc *rproc) > goto map_fail; > } > } > + of_node_put(irq_parent); > > return ret; > > map_fail: > pru_dispose_irq_mapping(pru); > + of_node_put(irq_parent); Reviewed-by: Mathieu Poirier > > return ret; > } > -- > 2.30.1 >