Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp130684ybz; Fri, 24 Apr 2020 13:04:59 -0700 (PDT) X-Google-Smtp-Source: APiQypIbDIOQ+yq1VZHj6mup2PtbvOOBIpuTTYHh/OFAr0DtdKTGp10vxkU5KzzjBqjaz5BZ0/Fk X-Received: by 2002:a50:d596:: with SMTP id v22mr8793489edi.91.1587758699575; Fri, 24 Apr 2020 13:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587758699; cv=none; d=google.com; s=arc-20160816; b=We/fQealHbdtdaCYukvmBE3rPppLY0lUyVg29b6MnqxCYDuLWdkV/iv1qDYTML8+DG tknoEdXLCO8KAbaA8cShJqetiLlHlCYknjJTk3Kd2IZmoTVaGVUJ3bfpOwLCAiFFajUS plE1Nom9ztvVlLbGLAYK7MIc6rfLaaPS300VSJIq+zF22TcccosIF6MsD/ZHmFQEdx8Y DJFYoCvDjP4nvlTUFhbxuuqcfo9IWgyCO2hO/t/OfaTwP+Py8pCqhhK+9AKY/OBh5dze tVY0EkYfS8DhFrbHR4itlZ+cwSv/9Cd/14RC5omkkjUmxn92Q2zKpwJ0KfIOG2MiaTMe ujHg== 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=UgVYOEmLZR8T9VFdpsNRc2Uupq9jBoUolgKHoUHryRE=; b=mBLVRObLSd0YJ+HrzcgOrgI+PaohF1pgCDM2UV2Mvtv8YDtCqYkG5JURP+WvSPTE5M wDU1ZLyFbhAWE8ght1tZOmE6rp85jpoWdkMWSjug6STqieHWnHsdgifS9OF3jiDgy2al 3lH/bdLL2bCd8Qt3jaQ9TWCgHO59WaXkljuVbBjLBUOLXDOaasnhNJbTFcbRl9vkhAkh lbKwpivqbgeCkISwSVMKH8V630H0Ow27E9J8VQG0kygKa6ZLikkyi9t7f+hSmG1spfMj 7DrZsAC6bgWfQUJX6x66Rb7+bKpehGI7K6TEpjT/XzTSsP6UNMlv4fep+5cegzwtjIoO J1NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h89uziQx; 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 h5si3851834edn.236.2020.04.24.13.04.32; Fri, 24 Apr 2020 13:04:59 -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=h89uziQx; 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 S1729434AbgDXUCa (ORCPT + 99 others); Fri, 24 Apr 2020 16:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729441AbgDXUBr (ORCPT ); Fri, 24 Apr 2020 16:01:47 -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 EE198C09B050 for ; Fri, 24 Apr 2020 13:01:45 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id f8so4136782plt.2 for ; Fri, 24 Apr 2020 13:01:45 -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=UgVYOEmLZR8T9VFdpsNRc2Uupq9jBoUolgKHoUHryRE=; b=h89uziQxnhqYDcmCgJtLSGdwCmHn0rC3Bu6mCDpOZ1qvYGWQlY3Z/6z+q6XrQXUluw nBTa+n77E8ofbTHybs+f9luqWuEGK2sawnmbePJGXfy0Oc0mXGNd4b8etpYU09LVnKpa MTlPo9c+GaghCNR8InPWnE9jvvacc0i224AGTD5P+PxgUr1eaHcNoYS4mSvrOgKyMmAl 3na+xIhktKRyb3SSIQVjk1ypUZxjl0/3pGUtbgGKS8NWqEW0twKZzV1lRfw2OuRBYGZq +moyE4C56HRvW/psOtJRhtJCti2DhCRmKO8k55+XHzf0FvEMYgBsdZDUX0eV3AxvaRPz N7Ag== 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=UgVYOEmLZR8T9VFdpsNRc2Uupq9jBoUolgKHoUHryRE=; b=ZF/rZ34n1ImHCnMF66YHVatNi+vkbGsFCwFnmxFjXSg0DmJnoj/rhWLCta1vYvqXCe DdR4GMb55aVC8C6YsWwvQKCbUdIThoUq9hfVFN9GkBtXd673m+u5T8HYFBWGR2nLbNcA /QMZYJWaPStm7xeqCLl9GEWQeP8QKra0Jr0CDyXwjj9VGIaSnx6788MeUJcu6ILBZgDB wf/+x7jvZ9wOZxkNpNRdfHr+ZE6ZuV4h0NCiiCVv1q4I+i4b2xCKP5bEpk3KAUGKWZDg 5K0FfgWEfEvcnigYqnrfhSfPzspE5fMff6jfAjRW53oyUCrNYUkgTtMfj1UQ1Vy9QDda 5FOA== X-Gm-Message-State: AGi0PuaW03KyQhm9Pe9yH9liNeh2dfav4hk329XbdmIK+0i5Rrib+Mbv kjmUXc6AqgT9lKRL2rvZbXYzrQ== X-Received: by 2002:a17:90a:e608:: with SMTP id j8mr8415911pjy.44.1587758505366; Fri, 24 Apr 2020 13:01:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o11sm5532224pgd.58.2020.04.24.13.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 13:01:44 -0700 (PDT) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: loic.pallardy@st.com, arnaud.pouliquen@st.com, s-anna@ti.com, linux-remoteproc@vger.kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 06/14] remoteproc: Refactor function rproc_trigger_auto_boot() Date: Fri, 24 Apr 2020 14:01:27 -0600 Message-Id: <20200424200135.28825-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424200135.28825-1-mathieu.poirier@linaro.org> References: <20200424200135.28825-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() so that it can deal with scenarios where the remote processor is already running. As such give it a new name to better represent the capabilities and add a call to rproc_boot() if instructed by the platform code to synchronise with the remote processor rather than boot it from scratch. Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index e90a21de9de1..9de0e2b7ca2b 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1457,10 +1457,17 @@ static void rproc_auto_boot_callback(const struct firmware *fw, void *context) release_firmware(fw); } -static int rproc_trigger_auto_boot(struct rproc *rproc) +static int rproc_trigger_auto_initiate(struct rproc *rproc) { int ret; + /* + * If the remote processor is already booted, all we need to do is + * synchronise it it. No point in dealing with a firmware image. + */ + if (rproc_needs_syncing(rproc)) + return rproc_boot(rproc); + /* * We're initiating an asynchronous firmware loading, so we can * be built-in kernel code, without hanging the boot process. @@ -1971,9 +1978,12 @@ int rproc_add(struct rproc *rproc) /* create debugfs entries */ rproc_create_debug_dir(rproc); - /* if rproc is marked always-on, request it to boot */ + /* + * If the auto boot flag is set, request to boot the remote + * processor or synchronise with it. + */ if (rproc->auto_boot) { - ret = rproc_trigger_auto_boot(rproc); + ret = rproc_trigger_auto_initiate(rproc); if (ret < 0) return ret; } -- 2.20.1