Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp816971ybh; Wed, 18 Mar 2020 09:38:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtgHkksOKOKOmEyQLTml8sHWK7Evb5enloM4fBRXl5LiJ/SwObuofRBItTFx+STZBsHWzKn X-Received: by 2002:a9d:5a09:: with SMTP id v9mr4463800oth.214.1584549519451; Wed, 18 Mar 2020 09:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584549519; cv=none; d=google.com; s=arc-20160816; b=y7QltmDjex6STHL62JZ9PyTnHDxCnz8a/XSgH7B3feYN6r4G0fAFg7I6NGF5O53GSi oJP9hrvcL7aqNLfeIM5tuHy6DVqm9h7ohGPERnOdQrEZpHI7GxmxjcC5HgvpOAmYZe04 LdzGIzP3upAgwYMzThzmPaaPZEGXdpd451d3dABvaxxW4BNzWHSfOtxGTRP57PQ+kZd0 vkEaeWR3S7wBYn2r5vIiGwybOi92ZHzwEBoquiJNApxSTB3T3C45uyvtCJoqfVPMeNJ1 fkkvbnHAgy9uOCHzo9LFcK9WuK4S0czCDQO2/S4HK2pPt0tYIVlNBTuhQ5Y+9t915vtO 3EHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bHvF/ZlLZRPJNXeX7IQP/GnB5t47oAv5GS/6FYJ6Q04=; b=ec8+s/WHjZWhhtjsHElKzBhRHvpWlFr2ChLDhfUTiTS6hnimg5+uYRv850AuyPIjK9 cLsk+3ZaJqnJkbAcdmctXbQURhhhpZ/3X+iO79XJricpPbkS1CU4HweZrN5LJfW3SP19 AEP9K6LGWJ7Zbjj+MmnVYkhOBmFbuSnoQKRVFgLHvqoBV3vH8jkLENva51XZRv30a8JZ O1mohQQb9DfKn80oao7NvOVT+2KXqsakD7cJAuiwKdPcdAppIgPHWxOfz6in/1dzNtpc l1q/TczUUdQYvqj7II/pRynmQTvzw5iyo7kACXDuslniYYonYaoWZnSLdnxB935W7UYV rgDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pnMs6pDb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si3767973otf.33.2020.03.18.09.38.27; Wed, 18 Mar 2020 09:38:39 -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=@linaro.org header.s=google header.b=pnMs6pDb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727224AbgCRQh5 (ORCPT + 99 others); Wed, 18 Mar 2020 12:37:57 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:34292 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbgCRQhz (ORCPT ); Wed, 18 Mar 2020 12:37:55 -0400 Received: by mail-io1-f67.google.com with SMTP id h131so25683400iof.1 for ; Wed, 18 Mar 2020 09:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bHvF/ZlLZRPJNXeX7IQP/GnB5t47oAv5GS/6FYJ6Q04=; b=pnMs6pDb+zpIjQXq19TmUvFaBoN8y/Ut/zX3ynNA5og7jG4tPoyENRWF/qx1nsQrub mDsN/tHH3PWCs70q/+NkM+GC+pdsuRlPrrjKzGPDQjnoM/XKE6Wsa2WZ9c2lL1wSSdm6 l6XiL42Wuds0sbVtH3v5N+OKe+AN0bNE94u2BX0nf9T1+f+iQlSFhrmhDkg4rcTidDRp YMxnwRu13jDPOl9YPIO1pI+lcbTWvwq3DMO+fY9qviEIjpRzw/P2ZqOuDmkTSUZrTXH2 WEichE5El5mfqpWFU90dLNW9IJIeZAvAmqylWSuIex/TTiOBpNhEq+TQKHp53LAkJvsW qgKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bHvF/ZlLZRPJNXeX7IQP/GnB5t47oAv5GS/6FYJ6Q04=; b=gXgdwS7NmKUZLLHdRu2a2tQ59uUmVUTTPnLLoE5lLegKYkAk0oPtPVFhzUzM2rwg/P BWChZY9pqZ54ZTUtaejHrDOfIT42XcL2GerH01TTiCNGJX5ABILXjIRz2u+zaaT87FqC nuWyZ3eRCRH+o08RwSS68tk6c8AACAoHQHQcTzTArtQYdvuOp/tbEDyi6HSQY+dXUuo/ GUiVbon2AftVKgxbVdvN/sFdixWDaY/LGpSrJiOsrn8Rf63UiYWzXOikGE8VQDPX3oz6 rXRGWoUh3TNcuHLVNDY76gB/9uGi6jAWHNYd74TcztZKnHOwZCV+pXeEpQgiLbgFg1GX qPYg== X-Gm-Message-State: ANhLgQ2A+EOWfU6jSXK9zetL3WSL5T4XHLTZSwfqCZObLIPapINBHfrd L/uZMroo+BJrTOdBWkhEARGa5XIEpTYqSxXsgJAEpg== X-Received: by 2002:a05:6602:2ace:: with SMTP id m14mr4603134iov.131.1584549474362; Wed, 18 Mar 2020 09:37:54 -0700 (PDT) MIME-Version: 1.0 References: <20200305224108.21351-1-s-anna@ti.com> <20200305224108.21351-3-s-anna@ti.com> <20200317180530.GA1801@xps15> <17204b55-2d58-d8cf-e504-6b6969afa987@ti.com> In-Reply-To: <17204b55-2d58-d8cf-e504-6b6969afa987@ti.com> From: Mathieu Poirier Date: Wed, 18 Mar 2020 10:37:43 -0600 Message-ID: Subject: Re: [PATCH 2/2] remoteproc: Fix and restore the parenting hierarchy for vdev To: Suman Anna Cc: Bjorn Andersson , Loic Pallardy , Arnaud Pouliquen , Tero Kristo , linux-remoteproc , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Mar 2020 at 09:00, Suman Anna wrote: > > 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(). Thanks for the clarification, I didn't go that far in my investigation. > > 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