Skip to contentSkip to conversation

hw/sd: Deprecate the SPI mode and the SPI to SD adapter

RFC PATCH In review Philippe Mathieu-Daudé 5 participants 10 messages Jul 5, 2020 – Jul 10, 2020

lore
Share & tools
lore
#0 lore raw

cover hw/sd: Deprecate the SPI mode and the SPI to SD adapter

I tried to maintain the SPI mode because it is useful in tiny embedded devices, and thought it would be helpful for the AVR MCUs.
As AVR was blocked, I thought it was wise to deprecate the SPI mode as users are interested in the faster MMC mode. Today Thomas surprised me by posting an update of it!
https://www.mail-archive.com/[email protected]/msg720089.html

I'm still posting this as RFC to discuss, but I'm reconsiderating keeping this mode a bit more.

Philippe Mathieu-Daudé (2):
hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter' hw/sd/sdcard: Deprecate the SPI mode

 docs/system/deprecated.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
Signature · 1 line
2.21.3
#1 lore raw

RFC PATCH 1/2 hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter'

This device duplicate the SPI mode of the sd-card device. The SPI protocol is better handler in the sd-card, however as the TYPE_SSI_SLAVE is not an interface, the sd-card can not implement it easily to be pluggable on a SPI bus. Meanwhile the ssi-sd device acts as a bridge, but is bitroting. Deprecate it.

---
 docs/system/deprecated.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/system/deprecated.rst +5 -0
index 47f84be8e0..5e67d7f3e0 100644
@@ -343,6 +343,11 @@ The 'ide-drive' device is deprecated. Users should use 'ide-hd' or
 The 'scsi-disk' device is deprecated. Users should use 'scsi-hd' or
 'scsi-cd' as appropriate to get a SCSI hard disk or CD-ROM as needed.
 
+``ssi-sd`` (since 5.1)
+'''''''''''''''''''''''''
+
+The 'ssi-sd' (SSI to SD card adapter) device is deprecated.
+
 System emulator machines
 ------------------------
 
Signature · 1 line
2.21.3
#2 lore raw

Re: [RFC PATCH 1/2] hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter'

Quoted 1 line · Philippe Mathieu-Daudé

This device duplicate the SPI mode of the sd-card device. The

duplicates

Quoted 4 lines

SPI protocol is better handler in the sd-card, however as the TYPE_SSI_SLAVE is not an interface, the sd-card can not implement it easily to be pluggable on a SPI bus. Meanwhile the ssi-sd device acts as a bridge, but is bitroting. Deprecate it.

bitrotting

Quoted 11 lines
---
  docs/system/deprecated.rst | 5 +++++
  1 file changed, 5 insertions(+)
docs/system/deprecated.rst +0 -0
index 47f84be8e0..5e67d7f3e0 100644

docs/system/deprecated.rst The 'ide-drive' device is deprecated. Users should use 'ide-hd' or · line 347

Quoted 5 lines
docs/system/deprecated.rst +2 -0
@@ -343,6 +343,11 @@ The 'ide-drive' device is deprecated. Users should use 'ide-hd' or
  The 'scsi-disk' device is deprecated. Users should use 'scsi-hd' or
  'scsi-cd' as appropriate to get a SCSI hard disk or CD-ROM as needed.
 
+``ssi-sd`` (since 5.1)
+'''''''''''''''''''''''''

Inconsistent line lengths

docs/system/deprecated.rst The 'ide-drive' device is deprecated. Users should use 'ide-hd' or · line 349

Quoted 2 lines
docs/system/deprecated.rst +2 -0
+
+The 'ssi-sd' (SSI to SD card adapter) device is deprecated.

What is the recommended replacement? Or at least document if it is disappearing with no replacement.

Quoted 5 lines
docs/system/deprecated.rst +1 -0
+
  System emulator machines
  ------------------------
 
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
Acked-by on v1 1/2
#3 lore raw

Re: [RFC PATCH 1/2] hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter'

In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

This device duplicate the SPI mode of the sd-card device. The SPI protocol is better handler in the sd-card, however as the TYPE_SSI_SLAVE is not an interface, the sd-card can not implement it easily to be pluggable on a SPI bus. Meanwhile the ssi-sd device acts as a bridge, but is bitroting. Deprecate it.

---
 docs/system/deprecated.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/system/deprecated.rst +0 -0
index 47f84be8e0..5e67d7f3e0 100644

docs/system/deprecated.rst The 'ide-drive' device is deprecated. Users should use 'ide-hd' or · line 349

Quoted 7 lines
docs/system/deprecated.rst +4 -0
@@ -343,6 +343,11 @@ The 'ide-drive' device is deprecated. Users should use 'ide-hd' or
 The 'scsi-disk' device is deprecated. Users should use 'scsi-hd' or
 'scsi-cd' as appropriate to get a SCSI hard disk or CD-ROM as needed.
 
+``ssi-sd`` (since 5.1)
+'''''''''''''''''''''''''
+
+The 'ssi-sd' (SSI to SD card adapter) device is deprecated.

libvirt didn't allow configuring this device yet, so from our view it's okay to remove it.

#4 lore raw

RFC PATCH 2/2 hw/sd/sdcard: Deprecate the SPI mode

In reply to Philippe Mathieu-Daudé

SD cards be used with SPI, SD or MMC protocol.

Unfortunately, maintaining the SPI protocol make improving the MMC mode very difficult. As of 2020 users are more interested in using cards with the MMC protocol.

---
 docs/system/deprecated.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/system/deprecated.rst +5 -0
index 5e67d7f3e0..01dca3d038 100644
@@ -384,6 +384,11 @@ full SCSI support.  Use virtio-scsi instead when SCSI passthrough is required.
 Note this also applies to ``-device virtio-blk-pci,scsi=on|off``, which is an
 alias.
 
+``-device sd-card,spi=on`` (since 5.1)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SPI mode of the 'sd-card' device is deprecated.
+
 Block device options
 ''''''''''''''''''''
 
Signature · 1 line
2.21.3
Acked-by on v1 2/2
#5 lore raw

Re: [RFC PATCH 2/2] hw/sd/sdcard: Deprecate the SPI mode

Quoted 16 lines · Philippe Mathieu-Daudé

SD cards be used with SPI, SD or MMC protocol.

Unfortunately, maintaining the SPI protocol make improving the MMC mode very difficult. As of 2020 users are more interested in using cards with the MMC protocol.

---
 docs/system/deprecated.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/system/deprecated.rst +0 -0
index 5e67d7f3e0..01dca3d038 100644

docs/system/deprecated.rst full SCSI support. Use virtio-scsi instead when SCSI passthrough is required. · line 390

Quoted 7 lines
docs/system/deprecated.rst +4 -0
@@ -384,6 +384,11 @@ full SCSI support.  Use virtio-scsi instead when SCSI passthrough is required.
 Note this also applies to ``-device virtio-blk-pci,scsi=on|off``, which is an
 alias.
 
+``-device sd-card,spi=on`` (since 5.1)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SPI mode of the 'sd-card' device is deprecated.

libvirt didn't implement this knob so it's okay to remove it without replacement.

#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

I tried to maintain the SPI mode because it is useful in tiny embedded devices, and thought it would be helpful for the AVR MCUs.
As AVR was blocked, I thought it was wise to deprecate the SPI mode as users are interested in the faster MMC mode. Today Thomas surprised me by posting an update of it!
https://www.mail-archive.com/[email protected]/msg720089.html

I'm still posting this as RFC to discuss, but I'm reconsiderating keeping this mode a bit more.

I think it's worth keeping.

I'm pretty sure the HiFive Unleashed (sifive_u in QEMU) uses SD over SPI. There isn't an upstream model but I think there are out of tree patches that hopefully one day will make it upstream.

Alistair

Quoted 12 lines

Philippe Mathieu-Daudé (2):
hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter' hw/sd/sdcard: Deprecate the SPI mode

 docs/system/deprecated.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

--
2.21.3

#7 lore raw
Quoted 10 lines · Alistair Francis
Quoted 9 lines · Philippe Mathieu-Daudé

I tried to maintain the SPI mode because it is useful in tiny embedded devices, and thought it would be helpful for the AVR MCUs.
As AVR was blocked, I thought it was wise to deprecate the SPI mode as users are interested in the faster MMC mode. Today Thomas surprised me by posting an update of it!
https://www.mail-archive.com/[email protected]/msg720089.html

Quoted 8 lines
Quoted 2 lines

I'm still posting this as RFC to discuss, but I'm reconsiderating keeping this mode a bit more.

I think it's worth keeping.

I'm pretty sure the HiFive Unleashed (sifive_u in QEMU) uses SD over SPI. There isn't an upstream model but I think there are out of tree patches that hopefully one day will make it upstream.

Glad to hear that! :)

Quoted 16 lines

Alistair

Quoted 12 lines

Philippe Mathieu-Daudé (2):
hw/sd/ssi-sd: Deprecate the SPI to SD card 'adapter' hw/sd/sdcard: Deprecate the SPI mode

 docs/system/deprecated.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

--
2.21.3

#8 lore raw
In reply to Philippe Mathieu-Daudé

Hi Philippe,

Quoted 9 lines · Philippe Mathieu-Daudé

I tried to maintain the SPI mode because it is useful in tiny embedded devices, and thought it would be helpful for the AVR MCUs.
As AVR was blocked, I thought it was wise to deprecate the SPI mode as users are interested in the faster MMC mode. Today Thomas surprised me by posting an update of it!
https://www.mail-archive.com/[email protected]/msg720089.html

Quoted 3 lines

I'm still posting this as RFC to discuss, but I'm reconsiderating keeping this mode a bit more.

AFAIK, SiFive folks (Pragnesh in cc) are investigating supporting QSPI model on "sifive_u" machine, and it will definitely use this SPI over SD model.

In fact, the QSPI is the last big gap in the "sifive_u" machine to make it a complete platform for hardware replacement.

Regards,
Bin

#9 lore raw
Quoted 16 lines · Bin Meng

Hi Philippe,

Quoted 9 lines · Philippe Mathieu-Daudé

I tried to maintain the SPI mode because it is useful in tiny embedded devices, and thought it would be helpful for the AVR MCUs.
As AVR was blocked, I thought it was wise to deprecate the SPI mode as users are interested in the faster MMC mode. Today Thomas surprised me by posting an update of it!
https://www.mail-archive.com/[email protected]/msg720089.html

Quoted 3 lines

I'm still posting this as RFC to discuss, but I'm reconsiderating keeping this mode a bit more.

Quoted 6 lines

AFAIK, SiFive folks (Pragnesh in cc) are investigating supporting QSPI model on "sifive_u" machine, and it will definitely use this SPI over SD model.

In fact, the QSPI is the last big gap in the "sifive_u" machine to make it a complete platform for hardware replacement.

Good news!

I have some idea about the design, but don't have the time to work on it. Help in this area is welcomed, and I am happy to review the patches.

The way I'd do it is keep the generic sd.c code and make it an abstract class (or interface), and split SD / SPI protocols handling in different implementation files. Only the negotiation at reset is common, once you switch to a protocol mode you can't switch to another without resetting the device. Also this would make the MMC protocol (already implemented by Xilinx) upstreamable more easily.

Having different files also allows different maintenance granularity.

I haven't looked at QSPI, but I expect it to be quite different that the old SPI mode.

Regards,

Phil.