Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp655626ybg; Mon, 1 Jun 2020 10:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi9ELYcx4vLT3A/YR4rSfaVoK4TzqtNoH/MDVc7TiRfjd/ymfrhf8dPa69HD7p5r0LJqLd X-Received: by 2002:a05:6402:16d6:: with SMTP id r22mr21968971edx.289.1591034071031; Mon, 01 Jun 2020 10:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591034071; cv=none; d=google.com; s=arc-20160816; b=ZZoiG5nWDkKatU6xO9qrv35cCP75oAfz4afuj3HcYDlDKDdtpzxRjomgbF0I+l5+Uj TXPtq8B0xSG7WoKwAclWKaKa1zfx9zV9APXGddkEOMdp5QTciTM0shwD1p7unEvUW2Wf OBTOIn8eawPGUrhsBW3Ma51QSoeJSFUMibAG3gcJLyF41ctkTo4DhAWnZb+7t1zmtB1/ B2z0mubXJe0UJHwEl5oLKBSbc/xy9bK+TDER7GsfxwiqXUStCh/v+oMmg6D3CrHVJb/x a3ka0t/lQvFThZ77pj2R/D+od0GfqRE5jqQ5zn6U1hyUOfKkJn+vrdgEy34x3BzdbAa/ IjnA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HuK+8lYq2MurWahP0YDt+ZKf6I/9GaLpDEv4/D3a90U=; b=pJeR5tXf2HgW/y4rRzEARCYGCa/lrR1r1hj4fFqHSUGv7d/3Owz4S8rBmGAY4GwSmM veykabyE/bG8OCQdTNDSW4jfwrIZ8kEHq58lyJGwJ2ziiZBbFpksbBSpgarVJXklKpcq plgtdiirMd0Q5vZZ20CYnWq/awUQTvBUPxzh7piPNW+gkjtixAz3IuCpQYW3Y6YNkVGz UI14gDWM6iHZPAev6tR/eCwt0kAkO3Pnt8F+uNfi6A6yp2lSADyW8ad6BBWV7akb9sn3 mJB/ZJX6T8guDsHd/exxKazc0S5S48FAiXOSZJukyyWcVdMhPG/ezNu8i47dqKSu/AXo xgww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=koUUxIAJ; 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 d17si135245eje.142.2020.06.01.10.54.07; Mon, 01 Jun 2020 10:54:31 -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=koUUxIAJ; 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 S1728118AbgFARwI (ORCPT + 99 others); Mon, 1 Jun 2020 13:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728103AbgFARvt (ORCPT ); Mon, 1 Jun 2020 13:51:49 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A02C08C5C0 for ; Mon, 1 Jun 2020 10:51:49 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id x11so240948plv.9 for ; Mon, 01 Jun 2020 10:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HuK+8lYq2MurWahP0YDt+ZKf6I/9GaLpDEv4/D3a90U=; b=koUUxIAJB8sNAZ/BIgVmeJjrfw7ai/Y7R0/F0CDKaSTqluC4KHJERTw83l37owKl+u si/lOnIB8HfwzIwKrA6mx7oczePRijGsawk6uHFwdZMfExTe/TZktA75HEebMZq2gDHw wRZKNZYs9qxyuQ10Wv63hELl91OhPnSx95HrCMZ+Tcr2HFVLdjJZjO1WNY7m1D7NSxaM OFkO2i8aVsD6AnnQQGQ1AODa2PKcHJo9LWMRALOdj0+GWZ4MRqMP7TMsf3jOqkewVH5F 4QFMCBQSCmTIy9sEUjxTzHqMBNKk9Vd7dORwFGUWDh4k9WjKeYTIS4EprHV7oToG0ceP B+qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HuK+8lYq2MurWahP0YDt+ZKf6I/9GaLpDEv4/D3a90U=; b=cgBPary2PsX7oF8SYbkGL0xBN8AFawdceFuXEy4aW7hajYQdo5hZcXsekD3IuebIxd BIhhx4MSpXr6dYeQQbfTQzDkoKB72ep6/drGxt87snBTd9CYjxa3yWPTz2vt1VXKzgVk rXp3lC+z3G//3fEspKOegzW3EyShRQ642mUlt6dwzyIfSDf8/HhZMyFkhMmbk2Fn0nRY ZKi2aLMh1F2P6EYyTa5tCQ1VXiYO0euzLU5Nunzld4OsbgUfW68lxdJpUw60/r7d4WI/ ZlNhXY5yoHCszDmIs/RHWLd6ZbVvTBX0rtPG5ru8CCavQc7pzy8F5p+4eCumtycUATvg vVlQ== X-Gm-Message-State: AOAM531CP6MmVZ7u2Ov+nZogbS00uQFfNA5+/rDnravTxN1CRYBHAVKn lCBt6YnG8igFLwpWQhUQTqCTEg== X-Received: by 2002:a17:90a:d3d6:: with SMTP id d22mr585255pjw.184.1591033908665; Mon, 01 Jun 2020 10:51:48 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k12sm58219pfg.177.2020.06.01.10.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:51:48 -0700 (PDT) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, loic.pallardy@st.com, arnaud.pouliquen@st.com, s-anna@ti.com Subject: [PATCH v4 7/9] remoteproc: Refactor function rproc_trigger_auto_boot() Date: Mon, 1 Jun 2020 11:51:37 -0600 Message-Id: <20200601175139.22097-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601175139.22097-1-mathieu.poirier@linaro.org> References: <20200601175139.22097-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor function rproc_trigger_auto_boot() to properly deal with scenarios where the remoteproc core needs to attach with a remote processor that has already been booted by an external entity. Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 48ddc29814be..d32ac8f0c872 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1586,6 +1586,15 @@ static int rproc_trigger_auto_boot(struct rproc *rproc) { int ret; + /* + * Since the remote processor is in a detached state, it has already + * been booted by another entity. As such there is no point in waiting + * for a firmware image to be loaded, we can simply initiate the process + * of attaching to it immediately. + */ + if (rproc->state == RPROC_DETACHED) + return rproc_boot(rproc); + /* * We're initiating an asynchronous firmware loading, so we can * be built-in kernel code, without hanging the boot process. -- 2.20.1