Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3033500pxj; Mon, 17 May 2021 16:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypcc9rJslTA8Iydd0KeLKK9ADY0Nju7t1ruwERuOMQ66Vi6GIU5N+w2WCOQK7ePbUFnWZP X-Received: by 2002:a17:906:f996:: with SMTP id li22mr2420818ejb.255.1621292690223; Mon, 17 May 2021 16:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621292690; cv=none; d=google.com; s=arc-20160816; b=aBXpwLFI+CtXzrueOL/Tvf3Rnh8Vas1/a0zjwjaTBV7WXGn5e/VOkV7rZ22/6o+L/L A0mzbuVdwud1yCutKYWNi1aKcXqGlrTknZT6sPO+UUc1RCYY5q9nDPmxyNif+3Yr5tuI tXVPC8UOuOkDJWoULEjioRM9TJHRoe/KBQLXfbq05+dt257rTJ9PgKGM7LQRfCokYMmy YP+mjsqnpue8Fr4qJ2rIT5PWQ37Ck+d+orEnOHrMkxEXLF2CLkYOw3FQZDg1DVaed89r 7qChU5MW4UMgrxtTzrYEKiX/apG/2fjHCL7GkAsxnYJ1i8/gCTg1SA5UdZGVTyd4P6Ut TTew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZiTDA2SXWKcW/wBHVKeyGbP2VGYrOBa8bmt8nQbVkUY=; b=SSlZe+gDxFIDQRJzIJ2c0VYfAnp6CgX/21dc5/U+iEZCt/MuFfXpZUtZr7oWaqIg3e dHRJSUVeSkXjDbAHb+wEXaNrUQ78EIA8zXqXi3zZAQu6mdlSSjZ+54WxRFLpoDil16KB 2hecFH9sIhyueOSWHXCISrQQcmRob8buX6OIRXdqvfFI/6KLW6E1nCrQKdklGZYus8u+ gJMLouye0qRky8yIda9xb088NVDZjDDQOoTZeyUtv5rHM1u/DwsLy5qzDlQAvQ/DIVoi Fr9jnIUTGoGFPscPOq2My53NK4o8kDsRU1kLYU62/3Mx2xcEp+LjALHJ41V6++tYiIun MT9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z2COh825; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id en20si4492902ejc.311.2021.05.17.16.04.26; Mon, 17 May 2021 16:04:50 -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=@linuxfoundation.org header.s=korg header.b=Z2COh825; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239228AbhEQOTP (ORCPT + 99 others); Mon, 17 May 2021 10:19:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:46782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238886AbhEQOQs (ORCPT ); Mon, 17 May 2021 10:16:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5ECF16112F; Mon, 17 May 2021 14:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260598; bh=tFNyq10aFjLKxkdQfvVDMHcpsWrHdWyO27jFvNNyyKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2COh825GHA+i/nWm74uDFzAAbfJU6pwtmE6j7JNd6eIubLRUJlaPxR3TPSSF9qkQ uY89qDy6QB+KDnWERk4JwIpfivlYn/vgF59yQ7ZtrLzs1y3lp+4+4xEFu09+veQAJ8 9zlxWMAwTjo00MInFR9nNO4QzZskSFDOG9+7934A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suman Anna , Mathieu Poirier , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.12 155/363] remoteproc: pru: Fixup interrupt-parent logic for fw events Date: Mon, 17 May 2021 16:00:21 +0200 Message-Id: <20210517140307.854231463@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna [ Upstream commit 6d1f2803cb6b414c2e45fa64d1fdad6b581e1e88 ] 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 current 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 Reviewed-by: Mathieu Poirier Link: https://lore.kernel.org/r/20210407155641.5501-2-s-anna@ti.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- 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 dcb380e868df..9226b8f3fe14 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); + 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); return ret; } -- 2.30.2