From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 003B913A265; Mon, 23 Jun 2025 13:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750684553; cv=none; b=ZoAuC7b5vFuHxbsI/Jnaccv9ciB7YHi9PZsNgfU96VVfzxdOBP/sK2PZkqpfWEJSNUo5WQeDKl/Gf72zmkidMTT9gS6uJU6aMBVhJEWt+caVuxnJIKCIHxOn6NirU2m02wQhb3jWdPKZKkA81p7oR6C1gInZnz4H1sLqVvMoW0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750684553; c=relaxed/simple; bh=sNe6/m3WFMBNoHQXnFv+Bk6ebbDk/V6uY9Y1irXZGvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EoG6iBO84ksYRLQLC3jpSHRvqYTSHtnLw88T8O4vki8affv9XLaZ9cKpYLaF8GErnTN69aSIygQw507+13HXlcYYaxQUI5SaCvfANCYYXjIk6lENzwrlCaRWYaaSVjwkzDoQ5pOh33fgCR+IxPHDOKdJF40nb4KL7PonbD2OE1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fHvGMdHU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fHvGMdHU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8666AC4CEF0; Mon, 23 Jun 2025 13:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750684552; bh=sNe6/m3WFMBNoHQXnFv+Bk6ebbDk/V6uY9Y1irXZGvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHvGMdHU9LyciMLPv6a8FQAIHJIHiQjAvvmxGvEZ26DtjGwQNkw8oHrVRH/P1qCCf uLZFEnPhLEXyGqL4G+cTqHp89MYYiChSe+a3S/glXmtz4YBADJjOdnrInVPqGku0nC M9FQd125LKm8FrhDOg8+0WL2uuwDOIU4hBtK3dNU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ioana Ciornei , Christophe Leroy Subject: [PATCH 6.15 110/592] bus: fsl-mc: do not add a device-link for the UAPI used DPMCP device Date: Mon, 23 Jun 2025 15:01:08 +0200 Message-ID: <20250623130702.895723773@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ioana Ciornei commit dd7d8e012b23de158ca0188239c7a1f2a83b4484 upstream. The fsl-mc bus associated to the root DPRC in a DPAA2 system exports a device file for userspace access to the MC firmware. In case the DPRC's local MC portal (DPMCP) is currently in use, a new DPMCP device is allocated through the fsl_mc_portal_allocate() function. In this case, the call to fsl_mc_portal_allocate() will fail with -EINVAL when trying to add a device link between the root DPRC (consumer) and the newly allocated DPMCP device (supplier). This is because the DPMCP is a dependent of the DPRC device (the bus). Fix this by not adding a device link in case the DPMCP is allocated for the root DPRC's usage. Fixes: afb77422819f ("bus: fsl-mc: automatically add a device_link on fsl_mc_[portal,object]_allocate") Signed-off-by: Ioana Ciornei Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250408105814.2837951-3-ioana.ciornei@nxp.com Signed-off-by: Christophe Leroy Signed-off-by: Greg Kroah-Hartman --- drivers/bus/fsl-mc/mc-io.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- a/drivers/bus/fsl-mc/mc-io.c +++ b/drivers/bus/fsl-mc/mc-io.c @@ -214,12 +214,19 @@ int __must_check fsl_mc_portal_allocate( if (error < 0) goto error_cleanup_resource; - dpmcp_dev->consumer_link = device_link_add(&mc_dev->dev, - &dpmcp_dev->dev, - DL_FLAG_AUTOREMOVE_CONSUMER); - if (!dpmcp_dev->consumer_link) { - error = -EINVAL; - goto error_cleanup_mc_io; + /* If the DPRC device itself tries to allocate a portal (usually for + * UAPI interaction), don't add a device link between them since the + * DPMCP device is an actual child device of the DPRC and a reverse + * dependency is not allowed. + */ + if (mc_dev != mc_bus_dev) { + dpmcp_dev->consumer_link = device_link_add(&mc_dev->dev, + &dpmcp_dev->dev, + DL_FLAG_AUTOREMOVE_CONSUMER); + if (!dpmcp_dev->consumer_link) { + error = -EINVAL; + goto error_cleanup_mc_io; + } } *new_mc_io = mc_io;