Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2507661rdb; Mon, 20 Nov 2023 12:51:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/PWZU7Koq4GaM71e367+fJVXakXKyrOsCQaavV72wGLQHhv1uAj9fa+oqB788iV+g7fTU X-Received: by 2002:a05:6a00:4286:b0:6cb:835a:8606 with SMTP id bx6-20020a056a00428600b006cb835a8606mr5319087pfb.4.1700513464196; Mon, 20 Nov 2023 12:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700513464; cv=none; d=google.com; s=arc-20160816; b=Pkmd6EN3tdr0EkZZxj5nUBft51DeCrKWGEc6Zk2c3ip7GIjVdPWRRp7u6LoBsssFdD 8eEuwLOGxOOEKRVFDsswCVSIAuP61jDRtcgM7z4uqfDJzn7hsNljHmQUI5eM58Mx16or 2aZkbR63+d4yYHWaMD8sAxygXbLO4eGDxl6/2QIEiV9EQgxrunYIGxJtcYbWRQqY8Xvd L9VayvDYoUoMgHHam/Sg8UdOJUtjisuZABR+VlnAgAJP49vYkK7yXqZXDdmhPXVC+BGF xx+XRXe0rzpXenKDGhpm94QjmsgZbg3B55zSdHRRZDZa9xmVFK+o74/drZpMGp6JVx/s tu1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NCdqcULXYaAlWiWs9GD5NBT5ezqfDctqKAHvvwYWuQA=; fh=tYUFeVQVvS9QU2StQNImNkNGb5MRTMDSKJCbjIFWMK0=; b=jmStpngacu8NurANkPP0JZLKuVxtEZqC5N7t35c8P2w5OfO6v9aSI3OznQ5bHp2RFx lRJm/lc7M/dTjNor8rnbUmLEIdEYvlm00v7aX0aLeOEh+epkcyVRWsU37GRRmNSRQLqb dFe2ngfmeA9ltbBQuKqNlbXbKbb22ziS1HXK3hZGAbOJ2ssEGodUtyDf2tQXmW3a+Szs Q+Y+iznPmRAp9pqZed6C1gcF4h7fRYUeEmCuS5RhnvBF96FP8kV5KykdlYhN9qsRbWaE P7tm+riMl9KGUk1e9srjlybGx1xCchXyS3tG3UUHDGGxdFMCPmRgv+1vMenOEHwrA52A F6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QRxbQnrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a2-20020a63d402000000b005b92edaa151si9036037pgh.739.2023.11.20.12.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 12:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QRxbQnrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C2F618026DD9; Mon, 20 Nov 2023 12:51:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjKTUvC (ORCPT + 99 others); Mon, 20 Nov 2023 15:51:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbjKTUvB (ORCPT ); Mon, 20 Nov 2023 15:51:01 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F83ECD for ; Mon, 20 Nov 2023 12:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700513456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NCdqcULXYaAlWiWs9GD5NBT5ezqfDctqKAHvvwYWuQA=; b=QRxbQnrb1fye3B/V1NYWpThizWxDQiiF19V2uAnN5yQx6j2GNP5jjYEktQxNlmSBcVcef1 BIbxIFN7ydWvszsSjhspBMJvJFrJYYCV8MQ+TOnSNvvECx4YkB4LxGTBLAMuS7OHg1QX8R /7jTSnFgWRBEHW5OF9SVef2M0bl65Fs= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-LjFX2YxaNtycWcJMebAL8Q-1; Mon, 20 Nov 2023 15:50:55 -0500 X-MC-Unique: LjFX2YxaNtycWcJMebAL8Q-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-670b675b2c5so32482116d6.0 for ; Mon, 20 Nov 2023 12:50:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700513455; x=1701118255; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NCdqcULXYaAlWiWs9GD5NBT5ezqfDctqKAHvvwYWuQA=; b=B2pkd1Ukl4mfH7F/4tPFgvKv4ALBseIk6XdIR8bfuII3mZ76QsMyCX3elZwRfFGiL2 MVxYssaUfJSjiEshZxYtmqEwHDwA3QY+2ulmEbNBzNTzKKjhmOdb4eXeZTuI5iNRjlVL 163X1dCS2aSUdzj1Dg+Cx3QD9pUCEVvqQ9+ZhTGsUtqwU+MmBl2o7Jo4g1j4FNZk0+u2 Gh2YvUQQpHSf4MOqiFY5MK7frQDXoCdSTC/ULgBKNzfYskYBNDjq0XD8BnZgUC/HjpsT tYohFxKpvTjDoL3Z5EOrzhxbIGe1FcVIfAB7LV8ZsMp35l03iV9Hyfk8aa0Gm/DA8QRO THvg== X-Gm-Message-State: AOJu0YyYtSpahqRJI6FCxAx5osk+kz9TpfupZO96SpUIXlJizURtX43Q uDxzM0xcIgA3a8z4d3JkY4l6H24FilMDVyEGJkF50Sm9EPbZUxtZHSNs+Q1g1f+9J6F4gMJE+3g 9VfJ/DcohnSV0Alqlv/E4yWlo X-Received: by 2002:a05:6214:4113:b0:677:987e:87d with SMTP id kc19-20020a056214411300b00677987e087dmr11471420qvb.2.1700513455010; Mon, 20 Nov 2023 12:50:55 -0800 (PST) X-Received: by 2002:a05:6214:4113:b0:677:987e:87d with SMTP id kc19-20020a056214411300b00677987e087dmr11471400qvb.2.1700513454735; Mon, 20 Nov 2023 12:50:54 -0800 (PST) Received: from fedora ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id rv13-20020a05620a688d00b0077a7d02cffbsm2951878qkn.24.2023.11.20.12.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 12:50:54 -0800 (PST) Date: Mon, 20 Nov 2023 14:50:52 -0600 From: Andrew Halaney To: Johan Hovold Cc: Greg Kroah-Hartman , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thinh Nguyen , Wesley Cheng , Krishna Kurapati PSSNV , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 2/3] USB: dwc3: qcom: fix wakeup after probe deferral Message-ID: <3ff65t36p6n3k7faw2z75t2vfi6rb5p64x7wqosetsksbhhwli@5xaxnm7zz4tu> References: <20231120161607.7405-1-johan+linaro@kernel.org> <20231120161607.7405-3-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 12:51:02 -0800 (PST) On Mon, Nov 20, 2023 at 11:39:07AM -0600, Andrew Halaney wrote: > On Mon, Nov 20, 2023 at 05:16:06PM +0100, Johan Hovold wrote: > > The Qualcomm glue driver is overriding the interrupt trigger types > > defined by firmware when requesting the wakeup interrupts during probe. > > > > This can lead to a failure to map the DP/DM wakeup interrupts after a > > probe deferral as the firmware defined trigger types do not match the > > type used for the initial mapping: > > > > irq: type mismatch, failed to map hwirq-14 for interrupt-controller@b220000! > > irq: type mismatch, failed to map hwirq-15 for interrupt-controller@b220000! > > > > Fix this by not overriding the firmware provided trigger types when > > requesting the wakeup interrupts. > > This series looks good to me and makes sense except for one point that > I'm struggling to understand. What exactly is the relationship with this > failure and probe deferral? Eric Chanudet pointed out to me (thanks!) offlist that if you: 1. Probe 2. Grab the IRQ 3. Request it (and muck with the trigger from the firmware default) 4. Defer out 5. Reprobe 6. Grab the IRQ again You get that error, which I played with some this afternoon... and can confirm. It really seems like maybe we should consider reworking messing with the trigger type at all (which is done later for runtime/system suspend) in a follow-up series? As far as I can tell if you were to remove the driver and reprobe after a suspend you'd hit similar. I've been sitting here scratching my head a bit trying to reason out why keeping it as IRQ_TYPE_EDGE_BOTH isn't acceptable in dwc3_qcom_enable_interrupts()... Correct me if you think that playing with the trigger there is really ok, but it seems like you run the same risks if you do that and then modprobe -r dwc3-qcom. I get that dwc3_qcom_enable_interrupts() limits the scope of what wakes us up to what we expect given the current device (or lack thereof), but it doesn't seem like you're really meant to play with the IRQ triggers, or at least the warning you shared makes me think it is not a great idea if you plan to probe the device ever again in the future. I'll post the current comment in dwc3_qcom_enable_interrupts() to explain the "limits the scope of what wakes us up" a bit more clearly: /* * Configure DP/DM line interrupts based on the USB2 device attached to * the root hub port. When HS/FS device is connected, configure the DP line * as falling edge to detect both disconnect and remote wakeup scenarios. When * LS device is connected, configure DM line as falling edge to detect both * disconnect and remote wakeup. When no device is connected, configure both * DP and DM lines as rising edge to detect HS/HS/LS device connect scenario. */ > > Thanks, > Andrew > > > > > Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") > > Cc: stable@vger.kernel.org # 4.18 > > Signed-off-by: Johan Hovold > > --- > > drivers/usb/dwc3/dwc3-qcom.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > > index 10fb481d943b..82544374110b 100644 > > --- a/drivers/usb/dwc3/dwc3-qcom.c > > +++ b/drivers/usb/dwc3/dwc3-qcom.c > > @@ -549,7 +549,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > > irq_set_status_flags(irq, IRQ_NOAUTOEN); > > ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > > qcom_dwc3_resume_irq, > > - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > > + IRQF_ONESHOT, > > "qcom_dwc3 HS", qcom); > > if (ret) { > > dev_err(qcom->dev, "hs_phy_irq failed: %d\n", ret); > > @@ -564,7 +564,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > > irq_set_status_flags(irq, IRQ_NOAUTOEN); > > ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > > qcom_dwc3_resume_irq, > > - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > > + IRQF_ONESHOT, > > "qcom_dwc3 DP_HS", qcom); > > if (ret) { > > dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); > > @@ -579,7 +579,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > > irq_set_status_flags(irq, IRQ_NOAUTOEN); > > ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > > qcom_dwc3_resume_irq, > > - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > > + IRQF_ONESHOT, > > "qcom_dwc3 DM_HS", qcom); > > if (ret) { > > dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); > > @@ -594,7 +594,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > > irq_set_status_flags(irq, IRQ_NOAUTOEN); > > ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > > qcom_dwc3_resume_irq, > > - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > > + IRQF_ONESHOT, > > "qcom_dwc3 SS", qcom); > > if (ret) { > > dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); > > -- > > 2.41.0 > > > >