From patchwork Fri Nov 18 09:08:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13047894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD5FEC4167D for ; Fri, 18 Nov 2022 09:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241772AbiKRJMD (ORCPT ); Fri, 18 Nov 2022 04:12:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241768AbiKRJL5 (ORCPT ); Fri, 18 Nov 2022 04:11:57 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6039C140D7 for ; Fri, 18 Nov 2022 01:11:55 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id f7so6262942edc.6 for ; Fri, 18 Nov 2022 01:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jRa/PoxgqDRwmd3eIz//88s67gtNdYgRfX+YpZPu+BM=; b=pGDB+b0kZ/sQIJwkZVnS6mJ7ZHtv/wyTZg8nv9lMsZgqMRY3qSg3K4iYahUKU1UPMy 6oxTtEbLtTIgMekKU6EGmV8xG8HOBX/eBx+zPYrgtTyt4MexT81gGPMcpve6KrHdllvi cAcT6AIjTv8pDRpLwf+HUKK/70BCiuZnkcpOm1e3f8Z+KVwdAD/dCjajmZ+YRdlPbnPQ gws48p64W7rF9njDLmrxgIoy8e+puJXk/Mu0Xg9vsi/JGcFXXOJI2nfrAPA1dnNWUR0P 7VRGUTU3T2yg/LEmo20Tw7wpQv7cLZ6SSctEkUQXLss2NLsRH1POhLQBisnIX/fuxy7C yQZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jRa/PoxgqDRwmd3eIz//88s67gtNdYgRfX+YpZPu+BM=; b=Qvu52iE4nZDQ6XfEBg6r3BGLf5svE+gCwnFLheKwe1CkJAkcA8GmcbsHBMO8lQuijO 2AntYl5ccy4jd8nwNNzN2QvDUrHIuewqWMbVmHteq+ajDTxeFt3/TmZn3rOvOQNzj8CC +b7sY8bkNN6DuES4zi0lL/NFLRQ/jIK6ZXkwJeuXMeXIT9yTI4WHgeA9+dj/jMDxlIxF MCnDvadMIdmnlsubV/Mo504PEnEZq7slRJAhlemf5j2i6xKf7nlTqM9rI2oCbhBD7plN baHGK6BX82zmosHeb5FDCGDPIVU2jeRDQxysQsDKCjYWhQswBbdOLXuZf2vfQI5c14FL LPfw== X-Gm-Message-State: ANoB5pkhVzbnUWC6hzLhgqwnn8En4+e7oC738JtdIwFSrsFPAhgqGSPt 7eGW1h6byVdWeInOZio4Pd9QjQ== X-Google-Smtp-Source: AA0mqf60UCoSoZCOMJgwUY56vTLWRzaG7YSp6S3dpTy4oD84LYoA1zTvMRFEHxf21XoMxzZMW30VRQ== X-Received: by 2002:aa7:d593:0:b0:461:de5e:ba52 with SMTP id r19-20020aa7d593000000b00461de5eba52mr5304051edq.177.1668762713858; Fri, 18 Nov 2022 01:11:53 -0800 (PST) Received: from otso.arnhem.chello.nl (k10064.upc-k.chello.nl. [62.108.10.64]) by smtp.gmail.com with ESMTPSA id v15-20020aa7dbcf000000b0046182b3ad46sm1535647edt.20.2022.11.18.01.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 01:11:53 -0800 (PST) From: Luca Weiss To: linux-arm-msm@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Luca Weiss , Mukesh Ojha , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Rishabh Bhatnagar , Siddharth Gupta , Sibi Sankar , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] remoteproc: qcom_q6v5_pas: disable wakeup on probe fail or remove Date: Fri, 18 Nov 2022 10:08:15 +0100 Message-Id: <20221118090816.100012-1-luca.weiss@fairphone.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Leaving wakeup enabled during probe fail (-EPROBE_DEFER) or remove makes the subsequent probe fail. [ 3.749454] remoteproc remoteproc0: releasing 3000000.remoteproc [ 3.752949] qcom_q6v5_pas: probe of 3000000.remoteproc failed with error -17 [ 3.878935] remoteproc remoteproc0: releasing 4080000.remoteproc [ 3.887602] qcom_q6v5_pas: probe of 4080000.remoteproc failed with error -17 [ 4.319552] remoteproc remoteproc0: releasing 8300000.remoteproc [ 4.332716] qcom_q6v5_pas: probe of 8300000.remoteproc failed with error -17 Fix this by disabling wakeup in both cases so the driver can properly probe on the next try. Fixes: a781e5aa5911 ("remoteproc: core: Prevent system suspend during remoteproc recovery") Fixes: dc86c129b4fb ("remoteproc: qcom: pas: Mark devices as wakeup capable") Reviewed-by: Mukesh Ojha Signed-off-by: Luca Weiss Reviewed-by: Sibi Sankar Reviewed-by: Caleb Connolly --- Changes in v2: * move new line before rproc_free which frees 'adsp' as well * pick up tags drivers/remoteproc/qcom_q6v5_pas.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 6afd0941e552..67f5152e2398 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -556,6 +556,7 @@ static int adsp_probe(struct platform_device *pdev) detach_proxy_pds: adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); free_rproc: + device_init_wakeup(adsp->dev, false); rproc_free(rproc); return ret; @@ -572,6 +573,7 @@ static int adsp_remove(struct platform_device *pdev) qcom_remove_sysmon_subdev(adsp->sysmon); qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev); qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev); + device_init_wakeup(adsp->dev, false); rproc_free(adsp->rproc); return 0; From patchwork Fri Nov 18 09:08:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13047893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F811C433FE for ; Fri, 18 Nov 2022 09:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241622AbiKRJMD (ORCPT ); Fri, 18 Nov 2022 04:12:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241788AbiKRJMA (ORCPT ); Fri, 18 Nov 2022 04:12:00 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D56B82BE9 for ; Fri, 18 Nov 2022 01:11:56 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id n12so11438258eja.11 for ; Fri, 18 Nov 2022 01:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kkFb1u/bvHgUN39MgLh4iioExuZRwxW/sCGAVXGpD1w=; b=IMnvVf87a7Lzj0PVzl0gYKSZgaRzxdyMizeIXc3qsaD96qJl5aUWbc95xrL1pG34aB Gouzh4wes8Wtn31PpcB8hJpHPGGHVPhGX4QVmk8v/SLa2vDTEFZUTBAT+DpuMLHN1ErS UbETbxJc69f0JSViyXF5GHa9MElblvPOok/mhI3iommcdV53vBDBHs3CUu7AS+FFd97v NVt3e8whlz++DfvmP+9Sg6jzEj9Og0ikVGxU86h+dFsrFl1pvunrdCAh+YbJi/71Ge6u SHz/HHaPH+XqxyhZuV46YtayBV9wMOJMZXMNU8hJ4a02CvWv0d+MX7N5UdVW5oooJQjv veLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kkFb1u/bvHgUN39MgLh4iioExuZRwxW/sCGAVXGpD1w=; b=Qgj6r9TXEG+KfY9cd5T0pAgPXc/MjTVhhpLN3CBAhIuQa8JdXOCj8tjUkcpgUeAZTd rgYLt+UaYWZ7Kb+XrCIHV0Tc7+FKmYaLAfGcgfaFPJUoEkofi0XBTx7ikQyc/Wb/5Ih4 jbQ8F/MM5rH12KFuFBrGa9fT8LZHcFtePyHxlOjeGfHhTvaUttHkL6VjdDae7Uyb/CJe jW/f3ypXZesjVSZFlau5fEI5ifYoL784u6nQnw2Je5Hau2eGhF7UR71NxsNAXe6aANVP dmlE7iGLy2rFaEctjhLu5ucYkAd358dAyJ2M+6/f+cdjs9/HT0OIs7K5i9Fz5sqmC3n6 xYog== X-Gm-Message-State: ANoB5pmmc4OitXHIFo/nea0nUIaBtIQoJ5rlQ5tDHlBh/7GKzBvEwvQf bHqzkoqnlEnKLH+kOMq38spmlA== X-Google-Smtp-Source: AA0mqf4aAjjbKrj3iuHMCimr/ApJDyn6Vg8BInvOBiqu2HMfXdy3GMLLe/pmt+iVHQKI85FNWKdRjg== X-Received: by 2002:a17:906:1614:b0:78d:4e5b:ffaa with SMTP id m20-20020a170906161400b0078d4e5bffaamr5082112ejd.455.1668762714878; Fri, 18 Nov 2022 01:11:54 -0800 (PST) Received: from otso.arnhem.chello.nl (k10064.upc-k.chello.nl. [62.108.10.64]) by smtp.gmail.com with ESMTPSA id v15-20020aa7dbcf000000b0046182b3ad46sm1535647edt.20.2022.11.18.01.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 01:11:54 -0800 (PST) From: Luca Weiss To: linux-arm-msm@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Luca Weiss , Sibi Sankar , Mukesh Ojha , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sibi Sankar , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] remoteproc: qcom_q6v5_pas: detach power domains on remove Date: Fri, 18 Nov 2022 10:08:16 +0100 Message-Id: <20221118090816.100012-2-luca.weiss@fairphone.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118090816.100012-1-luca.weiss@fairphone.com> References: <20221118090816.100012-1-luca.weiss@fairphone.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org We need to detach from the power domains also on remove, not just on probe fail so a subsequent probe works as expected. Otherwise the following error appears on re-probe: [ 29.452005] sysfs: cannot create duplicate filename '/devices/genpd:0:3000000.remoteproc' [ 29.477121] CPU: 1 PID: 483 Comm: sh Tainted: G W 6.1.0-rc4-00075-g71a113770bda #78 [ 29.510319] Hardware name: Fairphone 4 (DT) [ 29.538335] Call trace: [ 29.564470] dump_backtrace.part.0+0xe0/0xf0 [ 29.592602] show_stack+0x18/0x30 [ 29.619616] dump_stack_lvl+0x64/0x80 [ 29.646834] dump_stack+0x18/0x34 [ 29.673541] sysfs_warn_dup+0x60/0x7c [ 29.700592] sysfs_create_dir_ns+0xec/0x110 [ 29.728057] kobject_add_internal+0xb8/0x374 [ 29.755530] kobject_add+0x9c/0x104 [ 29.782072] device_add+0xbc/0x8a0 [ 29.808445] device_register+0x20/0x30 [ 29.835175] genpd_dev_pm_attach_by_id+0xa4/0x190 [ 29.862851] genpd_dev_pm_attach_by_name+0x3c/0xb0 [ 29.890472] dev_pm_domain_attach_by_name+0x20/0x30 [ 29.918212] adsp_probe+0x278/0x580 [ 29.944384] platform_probe+0x68/0xc0 [ 29.970603] really_probe+0xbc/0x2dc [ 29.996662] __driver_probe_device+0x78/0xe0 [ 30.023491] device_driver_attach+0x48/0xac [ 30.050215] bind_store+0xb8/0x114 [ 30.075957] drv_attr_store+0x24/0x3c [ 30.101874] sysfs_kf_write+0x44/0x54 [ 30.127751] kernfs_fop_write_iter+0x120/0x1f0 [ 30.154448] vfs_write+0x1ac/0x380 [ 30.179937] ksys_write+0x70/0x104 [ 30.205274] __arm64_sys_write+0x1c/0x2c [ 30.231060] invoke_syscall+0x48/0x114 [ 30.256594] el0_svc_common.constprop.0+0x44/0xec [ 30.283183] do_el0_svc+0x2c/0xd0 [ 30.308320] el0_svc+0x2c/0x84 [ 30.333059] el0t_64_sync_handler+0xf4/0x120 [ 30.359001] el0t_64_sync+0x18c/0x190 [ 30.384385] kobject_add_internal failed for genpd:0:3000000.remoteproc with -EEXIST, don't try to register things with the same name in the same directory. [ 30.406029] remoteproc remoteproc0: releasing 3000000.remoteproc [ 30.416064] qcom_q6v5_pas: probe of 3000000.remoteproc failed with error -17 Fixes: 17ee2fb4e856 ("remoteproc: qcom: pas: Vote for active/proxy power domains") Reviewed-by: Sibi Sankar Reviewed-by: Mukesh Ojha Signed-off-by: Luca Weiss --- Changes in v2: * pick up tags drivers/remoteproc/qcom_q6v5_pas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 67f5152e2398..a14ff1142e76 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -573,6 +573,7 @@ static int adsp_remove(struct platform_device *pdev) qcom_remove_sysmon_subdev(adsp->sysmon); qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev); qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev); + adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); device_init_wakeup(adsp->dev, false); rproc_free(adsp->rproc);