Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp895163lqj; Mon, 3 Jun 2024 04:26:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWC/XOBhL/oXXZQyFU0x0ZenZ+UCQTzJ8VTDwUfHA5mc5OF+8D8C+5In3XD0kGLMyxaBKBzrlExPqLX3BpvVHt+BksTcr6uj7cD+pmrow== X-Google-Smtp-Source: AGHT+IHIC4ZWWi/s/AuOqztwHxNQzx3qKjlAoC8D3SSezcAjs2WfMt8KyioAqYK3Wqi5ojX8DhWB X-Received: by 2002:a17:906:f58e:b0:a68:cb91:1b91 with SMTP id a640c23a62f3a-a68cb911c78mr349896966b.36.1717413997955; Mon, 03 Jun 2024 04:26:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717413997; cv=pass; d=google.com; s=arc-20160816; b=YVbBcxJqOHwC3/u7QdHDkiHVp8a0SECb9G89D8hFHdYDW+vWTPXQ3lBUMTwdPDBdRt oO1lK3gRHw302OmhZWzkHbPa8r7ICic7d27+39fUDFtnf3UO1CnZlV1bf25lu0qwfnJv 0zrFDx1/Uxglb3NGCFHaZ3R90q5aQGSruAQ8w5dtKARJ8ifDrXvN4U/dw367woWr+QW9 YaUA3wOd+w6KO26unkDEdLhoRFbXm3R6hRAtd/g03MtmrbjTQe8+0r8CuZ0tNyVVrFtT Gz5ZAC2jyk8oUvTMbDtpwX2mCPeva3uv7mpPEvrM3FghG/PvjLOP9qqjRj8y/Oh1Mx01 DusQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=uGeGHHqz121rrXHWFK61TxUFbMVFwXlVQrif0nBUi7E=; fh=J6C8yy7ZhakcAnjcnCHiCed1//M7VipXg9ULfHo1vbQ=; b=PrkMnIM00iMsp9UufRIZbesjWs7g53lbrA3kNHznK8RVWsazhaxWzTOsDCBJiWhKtb xrkI9VhZqd2VSA1+sWWM+BwwMV26gKhOSIZK6jwxqdVZnM8z20ok/SVZsbYiP5aBuGdM uMSH7PWpFo9hLT0oqWkqesZT29ZULvvJtEXnUwPfxYN2mvQ2DGykXjpht4Ht3nDaEK/D zmF+dr6O0SnmkkPeijIybyzGWaup1nzkQkHsKlVUKgFg217Kap9NwUjoQD+xdize2Wad 3gTUzjO3MeOeVKIlCHoFi1kBOM0mf0Qfmgu37pX8IMOyI9Uj6hq29XASjiYOeLsAoeyf tt3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-199044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199044-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68cd99f47esi201025666b.641.2024.06.03.04.26.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 04:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-199044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199044-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A9A9B1F24718 for ; Mon, 3 Jun 2024 11:26:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0370C84A40; Mon, 3 Jun 2024 11:26:29 +0000 (UTC) Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC3191366; Mon, 3 Jun 2024 11:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.11.138.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717413988; cv=none; b=K0KTRa2v6IdxXxMjS6swomhbComDf+PHODWScimIvHE9bZN25vhCtdGHT1o49EqUcC2DDtPmab/b61wxbzSmX/sXvUNg+WFYZ07vZU4iSp9+MfBEAN9+l7QUDuv+UB4NdlXvaxZ8zU0Z+4ecRHqCY9ovqCgck5dANlgNCKoESNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717413988; c=relaxed/simple; bh=U5nhK6N3AY+7D8Nic9cgW9P7u0jQsPlGNJPN6Yco6fI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n9AxcZJRp3XK6H9U+n+wRalhgyfbvfYfx+n4jR+NPLMYx8IqKDFkODfcZlXBpKJllAyj6HY4+4mDxsSwElto8MsgjpsH8uBmJ6ekJNj/2XpGcMkt8c+KkO1rx1vhINtsY9Y+fP2BumQK3encOek48427PJng+vm2Pj7gUEZZYyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de; spf=pass smtp.mailfrom=sntech.de; arc=none smtp.client-ip=185.11.138.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sntech.de Received: from i53875b65.versanet.de ([83.135.91.101] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sE5pU-0006rj-BG; Mon, 03 Jun 2024 13:26:20 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: ulf.hansson@linaro.org, Adrian Hunter Cc: serghox@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, quentin.schulz@cherry.de, Heiko Stuebner Subject: Re: [PATCH] mmc: sdhci-of-dwcmshc: don't enable CQE without a suitable irq handler Date: Mon, 03 Jun 2024 13:26:19 +0200 Message-ID: <4015176.ZaRXLXkqSa@diego> In-Reply-To: <55cea03b-e685-4f7b-a93b-cb464417d364@intel.com> References: <20240530215532.2192423-1-heiko@sntech.de> <55cea03b-e685-4f7b-a93b-cb464417d364@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Am Montag, 3. Juni 2024, 10:01:23 CEST schrieb Adrian Hunter: > On 31/05/24 00:55, Heiko Stuebner wrote: > > From: Heiko Stuebner > > > > supports-cqe is an established dt property so can appear in devicetrees > > at any time. CQE support in the sdhci-of-dwcmshc driver does require a > > special irq handler in the platform-specific ops, to handle the CQE > > interrupt. > > > > Without this special handler we end up with a spew of unhandled interrupt > > messages on devices with supports-cqe property but without irq handler: > > > > [ 11.624143] mmc0: Unexpected interrupt 0x00004000. > > [ 11.629504] mmc0: sdhci: ============ SDHCI REGISTER DUMP =========== > > [ 11.636711] mmc0: sdhci: Sys addr: 0x00000008 | Version: 0x00000005 > > [ 11.643919] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000000 > > [ 11.651128] mmc0: sdhci: Argument: 0x00018000 | Trn mode: 0x00000033 > > [ 11.658336] mmc0: sdhci: Present: 0x13f700f0 | Host ctl: 0x00000034 > > [ 11.665545] mmc0: sdhci: Power: 0x00000001 | Blk gap: 0x00000000 > > [ 11.672753] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x00000407 > > [ 11.679961] mmc0: sdhci: Timeout: 0x0000000e | Int stat: 0x00004000 > > [ 11.687169] mmc0: sdhci: Int enab: 0x02ff4000 | Sig enab: 0x02ff4000 > > [ 11.694378] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000 > > [ 11.701586] mmc0: sdhci: Caps: 0x226dc881 | Caps_1: 0x08000007 > > [ 11.708794] mmc0: sdhci: Cmd: 0x00000d1e | Max curr: 0x00000000 > > [ 11.716003] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0x00000000 > > [ 11.723211] mmc0: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x000007cd > > [ 11.730419] mmc0: sdhci: Host ctl2: 0x0000000f > > [ 11.735392] mmc0: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0xee28f008 > > [ 11.742600] mmc0: sdhci: ============================================ > > > > So don't enable CQE if a usable interrupt handler is not defined and warn > > instead about this fact. > > > > Fixes: 53ab7f7fe412 ("mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support") > > Signed-off-by: Heiko Stuebner > > --- > > My rk3588-tiger and rk3588-jaguar devicetrees had an accidential > > supports-cqe in their devicetree, which made me run into this problem > > with 6.10-rc1 . > > > > drivers/mmc/host/sdhci-of-dwcmshc.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c > > index 39edf04fedcf7..4410d4523728d 100644 > > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c > > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c > > @@ -1254,10 +1254,14 @@ static int dwcmshc_probe(struct platform_device *pdev) > > > > /* Setup Command Queue Engine if enabled */ > > if (device_property_read_bool(&pdev->dev, "supports-cqe")) { > > - priv->vendor_specific_area2 = > > - sdhci_readw(host, DWCMSHC_P_VENDOR_AREA2); > > + if (pltfm_data && pltfm_data->ops && pltfm_data->ops->irq) { > > ->irq() could be used for other things, so checking it for CQE > support is not appropriate. though here we are in the very limited scope of only the dwcmshc sdhci controller. And at this point, any controller using the generic sdhci_dwcmshc_ops will always get the CQE irq handler, while _all other_ controllers will need to define one to handle the CQE irqs. So any variant trying to enable CQE needs to define an irq handler, hence the check simply was meant to not allow CQE enablement without any irq handler, because that will always cause those unhandled irq issues. > If necessary, it would be better to flag which variants support > CQE in their platform data. I guess we can assume that all of the dwcmshc IP variants support CQE, it's just that the implementation is slightly strange in that a DT can enable CQE support and this will cause the driver to enable the CQE interrupt, even if nothing is there to handle it. For my own case I can also just live with the Rockchip irq handler patch going in (ideally as a fix) and I just wanted to try to fix this will definitly fail if irq-handler not present case. Heiko > However that would probably mean introducing something > like struct dwcmshc_pltfm_data as described here: > > https://lore.kernel.org/linux-mmc/ed900af1-f090-49a9-bc7e-363a28a4ac2b@intel.com/ > > > > + priv->vendor_specific_area2 = > > + sdhci_readw(host, DWCMSHC_P_VENDOR_AREA2); > > > > - dwcmshc_cqhci_init(host, pdev); > > + dwcmshc_cqhci_init(host, pdev); > > + } else { > > + dev_warn(&pdev->dev, "can't enable cqe support without irq handler\n"); > > + } > > } > > > > if (rk_priv) > >