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:   Tue, 19 May 2020 09:17:11 +0000
From:   冯锐 <rui_feng@...lsil.com.cn>
To:     Ulf Hansson <ulf.hansson@...aro.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        Christoph Hellwig <hch@...radead.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: 答复: [PATCH] mmc: rtsx: Add SD Express mode support for RTS5261

> On Tue, 28 Apr 2020 at 05:44, 冯锐 <rui_feng@...lsil.com.cn> wrote:
> >
> > >
> > > On Mon, Apr 27, 2020 at 11:41 AM 冯锐 <rui_feng@...lsil.com.cn>
> wrote:
> > > >
> > > >
> > > > > On Sun, Apr 26, 2020 at 09:25:46AM +0800,
> > > > > rui_feng@...lsil.com.cn
> > > wrote:
> > > > > > From: Rui Feng <rui_feng@...lsil.com.cn>
> > > > > >
> > > > > > RTS5261 support legacy SD mode and SD Express mode.
> > > > > > In SD7.x, SD association introduce SD Express as a new mode.
> > > > > > SD Express mode is distinguished by CMD8.
> > > > > > Therefore, CMD8 has new bit for SD Express.
> > > > > > SD Express is based on PCIe/NVMe.
> > > > > > RTS5261 uses CMD8 to switch to SD Express mode.
> > > > >
> > > > > So how does this bit work?  They way I imagined SD Express to
> > > > > work is that the actual SD Card just shows up as a real PCIe
> > > > > device, similar to say Thunderbolt.
> > > >
> > > > New SD Express card has dual mode. One is SD mode and another is
> > > > PCIe
> > > mode.
> > > > In PCIe mode, it act as a PCIe device and use PCIe protocol not
> > > > Thunderbolt
> > > protocol.
> > >
> > > I think what Christoph was asking about is why you need to issue any
> > > commands at all in SD mode when you want to use PCIe mode instead.
> > > What happens if you load the NVMe dthriver before loading the rts5261
> driver?
> > >
> > >        Arnd
> > >
> > > ------Please consider the environment before printing this e-mail.
> >
> > RTS5261 support SD mode and PCIe/NVMe mode. The workflow is as follows.
> > 1.RTS5261 work in SD mode.
> > 2.If card is plugged in, Host send CMD8 to ask card's PCIe availability.
> 
> This sounds like the card insert/removal needs to be managed by the
> rtsx_pci_sdmmc driver (mmc).
> 
> > 3.If the card has PCIe availability, RTS5261 switch to PCIe/NVMe mode.
> 
> This switch is done by the mmc driver, but how does the PCIe/NVMe driver
> know when to take over? Isn't there a synchronization point needed?
> 
> > 4.Mmc driver exit and NVMe driver start working.
> 
> Having the mmc driver to exit seems wrong to me. Else how would you handle
> a card being removed and inserted again?
> 
> In principle you want the mmc core to fail to detect the card and then do a
> handover, somehow. No?
> 
> Although, to make this work there are a couple of problems you need to deal
> with.
> 
> 1. If the mmc core doesn't successfully detect a card, it will request the mmc
> host to power off the card. In this situation, you want to keep the power to the
> card, but leave it to be managed by the PCIe/NVMe driver in some way.
> 
> 2. During system resume, the mmc core may try to restore power for a card,
> especially if it's a removable slot, as to make sure it gets detected if someone
> inserted a card while the system was suspended.
> Not sure if this plays well with the PCIe/NVMe driver's behaviour.
> Again, I think some kind of synchronization is needed.
> 
> > 5.If card is unplugged, RTS5261 will switch to SD mode.
> 
> Alright, clearly the mmc driver is needed to manage card insert/removal.
> 
> > We should send CMD8 in SD mode to ask card's PCIe availability, and the
> order of NVMe driver and rts5261 driver doesn't matter.
> 
> That assumes there's another synchronization mechanism. Maybe there is, but
> I don't understand how.
> 
If no card in RTS5261, RTS5261 works in SD mode. If you run command lspci, you can see the RTS5261 device.
When insert a SD Express card, Mmc driver will send CMD8 to ask the card's PCIe availability, because it's a SD EXPRESS card,
RTS5261 will switch to NVMe mode, after switch if you run lspci, you can see RTS5261 disappeared and a NVMe device replaces RTS5261.
In NVMe mode, RTS5261 only provide a bridge between SD Express card and PCIe. For NVMe driver, just like a new NVMe device is inserted.
Mmc core doesn't successfully detect the card and handover to NVMe driver. Because of detect the card failed,
Mmc driver will request the RTS5261 to power off the card, but at that time power off the card will not succeed.
When the card is unplugged, RTS5261 will switch to SD mode by itself and don't need mmc driver to do anything,
If you run lspci, you can see NVMe device disappeared and RTS5261 appeared again.

Kind regards

Powered by blists - more mailing lists