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]
Date: Wed, 3 Jan 2024 12:23:03 +0000
From: "Fred Ai(WH)" <fred.ai@...hubtech.com>
To: Sean Christopherson <seanjc@...gle.com>, Ben Mesman | Spark Narrowcasting
	<ben@...rknarrowcasting.nl>
CC: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
	"x86@...nel.org" <x86@...nel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Ulf Hansson <ulf.hansson@...aro.org>, Adrian
 Hunter <adrian.hunter@...el.com>, "Chevron Li (WH)"
	<chevron.li@...hubtech.com>, "Shaper Liu (WH)" <shaper.liu@...hubtech.com>
Subject:
 回复: Bug: After a 'warm' reboot the disk is missing (not detected by the bios) on a HP t640

Hi Sean Christopherson
I am maintainer of module “sdhci-pci-o2micro”. I provide the attachment code to fix this issue, but I didn't test this path code. You can test attachment patch code and give the feedback to me.
If this issue can be fixed by this patch, I will consider committing the new patch to fix this issue at linux master branch.

Diff patch in "linux/drivers/mmc/host/sdhci-pci-o2micro.c" as below:

diff --git a/sdhci-pci-o2micro.c b/sdhci-pci-o2micro.c
index 620f52a..d520369 100644
--- a/sdhci-pci-o2micro.c
+++ b/sdhci-pci-o2micro.c
@@ -603,6 +603,31 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
        sdhci_o2_enable_clk(host, clk);
 }

+static void sdhci_pci_o2_remove_slot(struct sdhci_pci_slot *slot, int dead)
+{
+       u8 scratch_8 = 0;
+       u32 reg_val = 0;
+       struct sdhci_pci_chip *chip;
+
+       chip = slot->chip;
+
+       /* UnLock WP */
+       pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
+       scratch_8 &= 0x7f;
+       pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
+
+       /* Set pcr 0x354[16] to switch Clock Source back to OPE Clock */
+       pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &reg_val);
+       reg_val &= ~(O2_SD_SEL_DLL);
+       pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, reg_val);
+
+       /* Lock WP */
+       pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
+       scratch_8 |= 0x80;
+       pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
+
+}
+
 static int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot)
 {
        struct sdhci_pci_chip *chip;
@@ -924,4 +949,5 @@ const struct sdhci_pci_fixes sdhci_o2 = {
 #endif
        .ops = &sdhci_pci_o2_ops,
        .priv_size = sizeof(struct o2_host),
+       .remove_slot= sdhci_pci_o2_remove_slot,
 };


Thanks
Fred
-----邮件原件-----
发件人: Sean Christopherson <seanjc@...gle.com> 
发送时间: 2024年1月3日 1:59
收件人: Ben Mesman | Spark Narrowcasting <ben@...rknarrowcasting.nl>
抄送: Thomas Gleixner <tglx@...utronix.de>; Ingo Molnar <mingo@...hat.com>; Borislav Petkov <bp@...en8.de>; Dave Hansen <dave.hansen@...ux.intel.com>; x86@...nel.org; linux-kernel@...r.kernel.org; Ulf Hansson <ulf.hansson@...aro.org>; Fred Ai(WH) <fred.ai@...hubtech.com>; Adrian Hunter <adrian.hunter@...el.com>
主题: Re: Bug: After a 'warm' reboot the disk is missing (not detected by the bios) on a HP t640

On Thu, Dec 28, 2023, Ben Mesman | Spark Narrowcasting wrote:
> > Please don't send private mails.  Kudos for using get_maintainer.pl, 
> > but a demerit for not Cc'ing the mailing lists :-)
> > 
> > https://people.kernel.org/tglx/notes-about-netiquette
> 
> Definitely saving that in my URLs-cache. Might need it again in a few 
> years :-) (last time I needed it was about 10 years ago)
> 
> > > I recently started upgrading some of my remote managed 
> > > thin-clients from a 5.15.x kernel to a 6.1.x kernel. When 
> > > rebooting with the new(er) kernel, the HP t640 clients failed. The 
> > > problem is that after the warm reboot, the BIOS is unable to locate the internal storage (so it can't boot a valid OS).
> > >
> > > With some digging around I found that adding "reboot=p" will solve 
> > > the problem, but because the systems are remote managed, I am 
> > > unable to add this boot-parameter in any straightforward way.
> [snip]
> > I'm not familiar with this code (I'm not actually a 
> > maintainer/reviewer for this code, by default get_maintainer.pl Cc's 
> > people that have recently modified the file in question), but this looks like a hack to workaround a bug elsewhere.
> > 
> > All of these quirks are obviously workarounds for some kind of bug, 
> > but AFAICT the quirks are to workaround hardware or firmware bugs, 
> > not kernel bugs.  Since 5.15.x kernels worked, odds are good a bug 
> > was introduced between 5.15 and 6.1, i.e. that this is fudging around a kernel bug that can and should be fixed.
> > 
> > Are you able to bisect the kernel between 6.1 and 5.15 to try and 
> > pinpoint an exact commit that introduced the problem?
> 
> That took a few days, but resulted in the following:
> 
> 4be33cf187036744b4ed84824e7157cfc09c6f4c is the first bad commit 
> commit 4be33cf187036744b4ed84824e7157cfc09c6f4c
> Author: Fred Ai <fred.ai@...hubtech.com>
> Date:   Mon Dec 20 20:09:40 2021 -0800
> 
>     mmc: sdhci-pci-o2micro: Improve card input timing at SDR104/HS200 
> mode
>     
>     Card input timing is margin, need to adjust the hold timing of card input.
>     
>     Signed-off-by: Fred Ai <fred.ai@...hubtech.com>
>     Link: https://lore.kernel.org/r/20211221040940.484-1-fred.ai@bayhubtech.com
>     Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
> 
>  drivers/mmc/host/sdhci-pci-o2micro.c | 57 
> ++++++++++++++++++++++++++++++------
>  1 file changed, 48 insertions(+), 9 deletions(-)
> 
> I'm not sure how this code impacts this device, but it does contain a "HS200 MMC card":
> $ dmesg | grep mmc
> [    1.044708] mmc0: emmc 1.8v flag is set, force 1.8v signaling voltage
> [    1.044937] mmc0: SDHCI controller on PCI [0000:01:00.0] using ADMA
> [    2.120632] mmc0: new HS200 MMC card at address 0001
> [    2.122912] mmcblk0: mmc0:0001 hA8aP> 14.7 GiB 
> [    2.124810]  mmcblk0: p1 p2 p3
> 
> I can provide more info on the hardware, which is also available in 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056056

Adding the relevant people from that commit, this is waaaaay outside my area of expertise.

View attachment "sdhci-pci-o2micro.c" of type "text/plain" (27172 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ