lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250326193047.1902835-1-erick.shepherd@ni.com>
Date: Wed, 26 Mar 2025 14:30:47 -0500
From: Erick Shepherd <erick.shepherd@...com>
To: <adrian.hunter@...el.com>
CC: <andy-ld.lu@...iatek.com>, <avri.altman@....com>, <dsimic@...jaro.org>,
        <erick.shepherd@...com>, <jason.lai@...esyslogic.com.tw>,
        <jeff.johnson@....qualcomm.com>, <jonathan@...pberrypi.com>,
        <keita.aihara@...y.com>, <linux-kernel@...r.kernel.org>,
        <linux-mmc@...r.kernel.org>, <ulf.hansson@...aro.org>,
        <victor.shih@...esyslogic.com.tw>, <wsa+renesas@...g-engineering.com>
Subject: Re: [PATCH] mmc: Add quirk to disable DDR50 tuning

> Perhaps make a helper function (untested):

Making a helper function seems like a good idea to me. How does this
look? I tested it using the SD card with our issue to confirm the I/O
errors no longer appear. I also tested it with another DDR50 SD card
to make sure the tuning is still executed in that case. I don't have a
SDR50 or SDR104 card on hand but could try to find them if you believe
the helper function needs to be tested further.

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index cc757b850e79..fc3416027033 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -613,6 +613,29 @@ static int sd_set_current_limit(struct mmc_card *card, u8 *status)
 	return 0;
 }
 
+/*
+ * Determine if the card should tune or not.
+ */
+static bool mmc_sd_use_tuning(struct mmc_card *card)
+{
+	/*
+	 * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
+	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
+	 */
+	if (mmc_host_is_spi(card->host))
+		return false;
+
+	switch (card->host->ios.timing) {
+	case MMC_TIMING_UHS_SDR50:
+	case MMC_TIMING_UHS_SDR104:
+		return true;
+	case MMC_TIMING_UHS_DDR50:
+		return !mmc_card_no_uhs_ddr50_tuning(card);
+	}
+
+	return false;
+}
+
 /*
  * UHS-I specific initialization procedure
  */
@@ -656,14 +679,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	if (err)
 		goto out;
 
-	/*
-	 * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
-	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
-	 */
-	if (!mmc_host_is_spi(card->host) &&
-		(card->host->ios.timing == MMC_TIMING_UHS_SDR50 ||
-		 card->host->ios.timing == MMC_TIMING_UHS_DDR50 ||
-		 card->host->ios.timing == MMC_TIMING_UHS_SDR104)) {
+	if (mmc_sd_use_tuning(card)) {
 		err = mmc_execute_tuning(card);
 
 		/*

Regards,
Erick

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ