Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp723535ybh; Wed, 18 Mar 2020 08:01:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vukwQYpuPi+9rjZnSibKVjPm7GDAJDMzD7/eQ1EvriPMD18+B/o6rQ8kVsCFEulaVDx2Wjw X-Received: by 2002:a05:6830:210d:: with SMTP id i13mr4401875otc.104.1584543698373; Wed, 18 Mar 2020 08:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584543698; cv=none; d=google.com; s=arc-20160816; b=kqfJ45xnFluUR14A+akjfhXOd71yKHH5BXp2T8cPvrFmJGjsZ2MVA83zd91r3UITy8 +3eS47Kldgy4GLsymjfyRVq/nnkbD0LWfvxQXHJm30lQ/fTR2fRgq8x1kRl3NjVcvKwY UyEioE+qPFIIL6LqyHwJNZ21TJfqKHknne0x0gVM4XUWS46KFGTTUOZR359l8GLLWz05 UI1S8qen0r57OMztPSBcmLIinavYRN7Oac5INJH+ZCRz8QwHFpOFBKAMvZT06qBEUPjM oV7owV5kHJhyq08fgRzdJk49XAvnO/xhwpiD7KXm7gH4vhgbUPbL9rB7HAipTBk4bxIW L8/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4hsSjsqTg006Xi7d9l/z1juDZrjWW/WtTHhxxRdkAAU=; b=Um9bT7eNeJH4bdH+fk8uaK0KVpR/Zv2SxtTJfiUKaZGhrU8K4bLDhKuhzWG2BxtvVp 8GulJL7J9bfrC1DMz433693IYbQ0PVDMqse/Ik1pNAAIu54i/0tstQaZkE3TL/iPNBdK NFDu6aCNFW6tzk6OR1F7hcNU9rhLtQk4jGOed48mP3zxy5/M8rT3nXSTEbBtqwpx9Iye XvisA+3epjnMc8ajT1LTqs//jFb2xYJyYbe4aEGTgQyHJQ3ZuezsCG1d8M7IR554rLVD JSV91LRiT7N1PqtANnb4xEjz4in5ENsCzWyeR+Z1fT+5OT5bai+ehwHda0eHhaqhkRKE hzDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MvL35sHe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si3625245oig.212.2020.03.18.08.01.18; Wed, 18 Mar 2020 08:01:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MvL35sHe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726893AbgCRPAz (ORCPT + 99 others); Wed, 18 Mar 2020 11:00:55 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:60758 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbgCRPAz (ORCPT ); Wed, 18 Mar 2020 11:00:55 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02IF0oXs100065; Wed, 18 Mar 2020 10:00:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1584543650; bh=4hsSjsqTg006Xi7d9l/z1juDZrjWW/WtTHhxxRdkAAU=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=MvL35sHeun/xhaqUjJ2DzelnFWg7GMdahFHl1WVuqKKepeePmmB8i93XE/6ThICpL HElEzJNx/4WgUFCta5c3ocCpSI4Qib0z8CBx7bpVBwvCcbAgkBTjuKPcjwV3deTE8C 84Tjij5GfTPtkqhAsLoO0Jl822hG6/OIk+qf5xg8= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02IF0oGj026548 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Mar 2020 10:00:50 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 18 Mar 2020 10:00:50 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Wed, 18 Mar 2020 10:00:50 -0500 Received: from [10.250.35.147] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 02IF0os8119880; Wed, 18 Mar 2020 10:00:50 -0500 Subject: Re: [PATCH 2/2] remoteproc: Fix and restore the parenting hierarchy for vdev To: Mathieu Poirier CC: Bjorn Andersson , Loic Pallardy , Arnaud Pouliquen , Tero Kristo , , References: <20200305224108.21351-1-s-anna@ti.com> <20200305224108.21351-3-s-anna@ti.com> <20200317180530.GA1801@xps15> From: Suman Anna Message-ID: <17204b55-2d58-d8cf-e504-6b6969afa987@ti.com> Date: Wed, 18 Mar 2020 10:00:50 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200317180530.GA1801@xps15> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, On 3/17/20 1:05 PM, Mathieu Poirier wrote: > Hi Suman, > > On Thu, Mar 05, 2020 at 04:41:08PM -0600, Suman Anna wrote: >> The commit 086d08725d34 ("remoteproc: create vdev subdevice with specific >> dma memory pool") has introduced a new vdev subdevice for each vdev >> declared in the firmware resource table and made it as the parent for the >> created virtio rpmsg devices instead of the previous remoteproc device. >> This changed the overall parenting hierarchy for the rpmsg devices, which >> were children of virtio devices, and does not allow the corresponding >> rpmsg drivers to retrieve the parent rproc device through the >> rproc_get_by_child() API. >> >> Fix this by restoring the remoteproc device as the parent. The new vdev >> subdevice can continue to inherit the DMA attributes from the remoteproc's >> parent device (actual platform device). >> >> Fixes: 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") >> Signed-off-by: Suman Anna >> --- >> drivers/remoteproc/remoteproc_core.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c >> index 097f33e4f1f3..ba18f32bd0c4 100644 >> --- a/drivers/remoteproc/remoteproc_core.c >> +++ b/drivers/remoteproc/remoteproc_core.c >> @@ -510,7 +510,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, >> >> /* Initialise vdev subdevice */ >> snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index); >> - rvdev->dev.parent = rproc->dev.parent; >> + rvdev->dev.parent = &rproc->dev; > > I can see how it would not be possible to retrieve the parent rproc device since > rvdev->dev.parent was set to be platform device... > > I wonder how the original change didn't blow up sysmon_probe() and potentially > other out-of-tree users of rproc_get_by_child(). QCOM code uses SMD transport, and not virtio_rpmsg transport, and the parent-child relationship is direct rproc subdevices which are added in their platform drivers directly. This affects only virtio-rpmsg clients. Please see qcom_add_smd_subdev(). It would be nice to have > someone from the QCOM team test your patch. > >> rvdev->dev.dma_pfn_offset = rproc->dev.parent->dma_pfn_offset; >> rvdev->dev.release = rproc_rvdev_release; >> dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name); > > Be mindful there might be fallouts from applying this patch since it does change > the location of the vdev under /sys/device/platform/ . > > Reviewed-by: Mathieu Poirier Thanks for the review. regards Suman