Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2541633ybt; Mon, 22 Jun 2020 00:34:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJMfZMdRNMZ4uDo1PEZ5EaiVnRdPTOyTIQdDBd4E1czR/ZOGSfjCDuPupZfmz5iM6PrOs2 X-Received: by 2002:aa7:c496:: with SMTP id m22mr16032568edq.187.1592811257936; Mon, 22 Jun 2020 00:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592811257; cv=none; d=google.com; s=arc-20160816; b=zfswQanQPotcMprMj1JdQyiPp7RuRBzAN1C+tuYJjC62jJcSTqNz0TLGzxOVIrhLXR k/PcU9G76nGL8hBsMx+9uDJLpXRKpZSLPtfM6sLMh80XGblYX/xztCH+aSudBorKQK6f PMtM2WH4ydDenP7jiZ2aL30IDg7OmUPL48PJ18RRp0eYMK2EZ9nAu/09qY03mYeq83W5 BAblgQYL+Fg6bPIA2llxfdYJEv3TUPNISCfIVWmGlou2yRCD10kkFhtPDxJ2WHQBuC7X 8xqohErolrvkTaJC+WYSloIEJ+fHk7fadHebbsZ2lqS26LsPpURITC4rxSpNpCej9UlH LiZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ygaQRZsiHWxwQyMfFbHB0BV1hg9adFSrkxnAXBNM/Xo=; b=qEEQLbWwVmzBPJZotNKqI5dQg1L5PMMEtf53usZZ5Jj6egJtvU38c8wO7wsHAc53up LWzd8bUyprdrJhEwQzzL0rC7IE0b6cCr4LN4bR1VYy9HpcTwJBhtOz3f/6EaLiK8VX4p AwtaaOqa03cLR1LqOd0MHmnBAM1H1jyqA2xllMSY+oN/UNoscSxBy2b4WSPn9gv8JBIU L3RPqaLKlqyBLdE6tcM0fVO5Cr/k7mf6Rc0oUkmAeqfId7rdtWBnMeZwXQF6oYNva6X3 xVPKGuZ7pUbam4wQInldMNYIwMl6kz8LE/J+tEH8tnKFdD6wCdd7uY32AeQ+WUTeqCBl CU4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fg7emq7u; 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 a11si9120214eds.271.2020.06.22.00.33.54; Mon, 22 Jun 2020 00:34:17 -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=Fg7emq7u; 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 S1731372AbgFVHaT (ORCPT + 99 others); Mon, 22 Jun 2020 03:30:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731344AbgFVHaS (ORCPT ); Mon, 22 Jun 2020 03:30:18 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E47C061794 for ; Mon, 22 Jun 2020 00:30:18 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id t25so14758971oij.7 for ; Mon, 22 Jun 2020 00:30:18 -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=ygaQRZsiHWxwQyMfFbHB0BV1hg9adFSrkxnAXBNM/Xo=; b=Fg7emq7u6AxvbahIlxX2OEGFyhdrP70UBnBknmSN2foEef4qnd2y/lgST91lNQWiGF XsgUC8J+w0VYhGHm4oZdzLaaB6GDupvwYBbeWJTB3ISR2N9mnx+FKi5NIerlVFaDJof6 fFXMzbIcbcTph+esVMxxu/6flV+irY9rU5+hyJ0uWLzAaceHSnJ2J9ygJnhXqXLB5jyd bTFYNGUvWJa8q5fOUnvUGTyT19qv/wFGTGBDOJjs6WvdUIQE91PsObySKFR3yxlr5H5/ +lUBozy9lwLLrSxjAqJ6SehdmX+9wXbQxRP17LZ/9TlUNtx/tH2Ik/zOGbJ6UaedmMYX WATA== 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=ygaQRZsiHWxwQyMfFbHB0BV1hg9adFSrkxnAXBNM/Xo=; b=FhCJ94XK07lEGrNnM/g+5+LPhZ558ECaSOGQEfUDCbwkov3TJDdSSFIL/VJOQ+CLaL vLRMoHTgpMrEaEeC9U+u/ESsAnq6iAIxBw6Fhk5e7zqkEdNGGHeNrKBM0gUja3M+NWFE Gq7vgr2MoFZ3Zzd+YRJ/zii0OxG84BSdpmFAhccHaAwhNUAuqJZ756Dym4RIyy4AOjzG Gx4IQiqkTHNmGQNuai1r09VZggv2oNTa2rbFaQKZT493S8LBrMderBwCx1E7yZj+kHKZ wtuTxAN8YfTNyo0ihUFG7gpawuRK3Itzh8dEv39143Tqo6SV3rainrLMwUxX0HlOwu1O zXYQ== X-Gm-Message-State: AOAM530XneYAh7/B6le5SQIP9nwYcxstkhP2z4WBFRFpRfofLVVBAQcD 7oms3Lj9cXarHMAXIc3c4B/hGQ== X-Received: by 2002:aca:5049:: with SMTP id e70mr11817176oib.72.1592811017862; Mon, 22 Jun 2020 00:30:17 -0700 (PDT) Received: from builder.lan (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id 190sm3246689oon.2.2020.06.22.00.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 00:30:17 -0700 (PDT) Date: Mon, 22 Jun 2020 00:27:32 -0700 From: Bjorn Andersson To: Mathieu Poirier Cc: ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, loic.pallardy@st.com, arnaud.pouliquen@st.com, s-anna@ti.com Subject: Re: [PATCH v4 8/9] remoteproc: Refactor function rproc_free_vring() Message-ID: <20200622072732.GJ149351@builder.lan> References: <20200601175139.22097-1-mathieu.poirier@linaro.org> <20200601175139.22097-9-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200601175139.22097-9-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 01 Jun 10:51 PDT 2020, Mathieu Poirier wrote: > When function rproc_free_vring() clears the virtio device section > it does so on the cached resource table rather than the one > installed in the remote processor memory. When a remote processor > has been booted by another entity there is no need to use a cached > table and as such, no need to clear the virtio device section in > it. > > Signed-off-by: Mathieu Poirier Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/remoteproc/remoteproc_core.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index d32ac8f0c872..0e23284fbd25 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -411,10 +411,22 @@ void rproc_free_vring(struct rproc_vring *rvring) > > idr_remove(&rproc->notifyids, rvring->notifyid); > > - /* reset resource entry info */ > - rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset; > - rsc->vring[idx].da = 0; > - rsc->vring[idx].notifyid = -1; > + /* > + * At this point rproc_stop() has been called and the installed resource > + * table in the remote processor memory may no longer be accessible. As > + * such and as per rproc_stop(), rproc->table_ptr points to the cached > + * resource table (rproc->cached_table). The cached resource table is > + * only available when a remote processor has been booted by the > + * remoteproc core, otherwise it is NULL. > + * > + * Based on the above, reset the virtio device section in the cached > + * resource table only if there is one to work with. > + */ > + if (rproc->table_ptr) { > + rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset; > + rsc->vring[idx].da = 0; > + rsc->vring[idx].notifyid = -1; > + } > } > > static int rproc_vdev_do_start(struct rproc_subdev *subdev) > -- > 2.20.1 >