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] [thread-next>] [day] [month] [year] [list]
Message-ID: <000001da5faa$d34e1600$79ea4200$@samsung.com>
Date: Thu, 15 Feb 2024 10:03:45 +0900
From: 이승희 <sh043.lee@...sung.com>
To: "'Ulf Hansson'" <ulf.hansson@...aro.org>
Cc: <linux-mmc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<gregkh@...uxfoundation.org>, <avri.altman@....com>,
	<grant.jung@...sung.com>, <jt77.jang@...sung.com>,
	<dh0421.hwang@...sung.com>, <junwoo80.lee@...sung.com>,
	<jangsub.yi@...sung.com>, <cw9316.lee@...sung.com>,
	<sh8267.baek@...sung.com>, <wkon.kim@...sung.com>, <sh043.lee@...sung.com>
Subject: RE: [PATCH] mmc: sd: Add a variable to check a faulty device

> -----Original Message-----
> From: Ulf Hansson <ulf.hansson@...aro.org>
> Sent: Wednesday, February 14, 2024 8:27 PM
> To: Seunghui Lee <sh043.lee@...sung.com>
> Cc: linux-mmc@...r.kernel.org; linux-kernel@...r.kernel.org;
> gregkh@...uxfoundation.org; avri.altman@....com; grant.jung@...sungcom;
> jt77.jang@...sung.com; dh0421.hwang@...sung.com; junwoo80.lee@...sung.com;
> jangsub.yi@...sung.com; cw9316.lee@...sung.com; sh8267.baek@...sungcom;
> wkon.kim@...sung.com
> Subject: Re: [PATCH] mmc: sd: Add a variable to check a faulty device
> 
> On Tue, 13 Feb 2024 at 06:13, Seunghui Lee <sh043.lee@...sung.com> wrote:
> >
> > In mobile devices, suspend/resume situations are frequent.
> > In the case of a defective SD card in which initialization fails,
> > unnecessary initialization time is consumed for each resume.
> > A field is needed to check that SD card initialization has failed on
> > the host. It could be used to remove unnecessary initialization.
> 
> It's not clear to me, under what circumstance you want to optimize for.
> 
> Is the SD card ever getting properly initialized during boot?
> 
> Kind regards
> Uffe
> 
We receive a lot of reports about SD card issues in the market.
There was no problem with the first time at the time of use, and there are many cases where people recognize that it is not recognized later on. In most cases, this is a problem with the SD card itself.

SD card users cannot determine whether or not an SD card is a problem, so they should be guided in this regard.
It is necessary to distinguish whether the SD card is inserted but unrecognized or the SD card itself is not inserted, and if there is a field that can check for initialization failure, it will facilitate guidance, so we considered the patch.

The variable's usage is expected to be used through the sysfs node in the vendor module.
> >
> > Signed-off-by: Seunghui Lee <sh043.lee@...sung.com>
> > ---
> >  drivers/mmc/core/sd.c        | 12 +++++++++++-
> >  drivers/mmc/core/slot-gpio.c |  1 +
> >  include/linux/mmc/host.h     |  1 +
> >  3 files changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index
> > c3e554344c99..f0eb3864dc24 100644
> > --- a/drivers/mmc/core/sd.c
> > +++ b/drivers/mmc/core/sd.c
> > @@ -1410,6 +1410,7 @@ static int mmc_sd_init_card(struct mmc_host *host,
> u32 ocr,
> >         bool v18_fixup_failed = false;
> >
> >         WARN_ON(!host->claimed);
> > +       host->init_failed = false;
> >  retry:
> >         err = mmc_sd_get_cid(host, ocr, cid, &rocr);
> >         if (err)
> > @@ -1752,6 +1753,8 @@ static int _mmc_sd_resume(struct mmc_host *host)
> >
> >         mmc_power_up(host, host->card->ocr);
> >         err = mmc_sd_init_card(host, host->card->ocr, host->card);
> > +       if (err)
> > +               host->init_failed = true;
> >         mmc_card_clr_suspended(host->card);
> >
> >  out:
> > @@ -1803,8 +1806,12 @@ static int mmc_sd_runtime_resume(struct
> > mmc_host *host)
> >
> >  static int mmc_sd_hw_reset(struct mmc_host *host)  {
> > +       int err;
> >         mmc_power_cycle(host, host->card->ocr);
> > -       return mmc_sd_init_card(host, host->card->ocr, host->card);
> > +       err = mmc_sd_init_card(host, host->card->ocr, host->card);
> > +       if (err)
> > +               host->init_failed = true;
> > +       return err;
> >  }
> >
> >  static const struct mmc_bus_ops mmc_sd_ops = { @@ -1891,5 +1898,8 @@
> > int mmc_attach_sd(struct mmc_host *host)
> >         pr_err("%s: error %d whilst initialising SD card\n",
> >                 mmc_hostname(host), err);
> >
> > +       if (err)
> > +               host->init_failed = true;
> > +
> >         return err;
> >  }
> > diff --git a/drivers/mmc/core/slot-gpio.c
> > b/drivers/mmc/core/slot-gpio.c index 2a2d949a9344..93d081c7dd53 100644
> > --- a/drivers/mmc/core/slot-gpio.c
> > +++ b/drivers/mmc/core/slot-gpio.c
> > @@ -33,6 +33,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void
> *dev_id)
> >         struct mmc_gpio *ctx = host->slot.handler_priv;
> >
> >         host->trigger_card_event = true;
> > +       host->init_failed = false;
> >         mmc_detect_change(host,
> > msecs_to_jiffies(ctx->cd_debounce_delay_ms));
> >
> >         return IRQ_HANDLED;
> > diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index
> > 2f445c651742..1d75cfdbf981 100644
> > --- a/include/linux/mmc/host.h
> > +++ b/include/linux/mmc/host.h
> > @@ -467,6 +467,7 @@ struct mmc_host {
> >         struct timer_list       retune_timer;   /* for periodic re-tuning */
> >
> >         bool                    trigger_card_event; /* card_event necessary */
> > +       bool                    init_failed;    /* check if failed to
> initialize */
> >
> >         struct mmc_card         *card;          /* device attached to this host
> */
> >
> > --
> > 2.29.0
> >


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ