Hi, I'd like to connect a specific SD card to a specific SDHCI from command line, and I'm getting a bit lost with command line options.
I'm using an updated version of this patch, but this is not relevant to this thread: http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg01914.html In the following example, I'd like to connect an UHS-I enabled SD card to the first SHDCI of the Exynos4210 board (Nuri). I tried: $ ./arm-softmmu/qemu-system-arm -M nuri \ -device sd-card,id=sd0,uhs=1 \ -drive if=sd,id=sd0,driver=null-co,size=4G \ -monitor stdio -S But then the QTree looks unexpected: (qemu) info qtree bus: main-system-bus type System dev: generic-sdhci, id "" gpio-out "sysbus-irq" 1 sd-spec-version = 2 (0x2) uhs = 0 (0x0) capareg = 99090560 (0x5e80080) maxcurr = 0 (0x0) pending-insert-quirk = false dma = "" mmio 0000000012540000/0000000000000100 bus: sd-bus type sdhci-bus dev: sd-card, id "sd0" drive = "" spi = false uhs = 1 (0x1) dev: sd-card, id "" drive = "" spi = false uhs = 0 (0x0) ^---- 2 cards dev: generic-sdhci, id "" gpio-out "sysbus-irq" 1 sd-spec-version = 2 (0x2) uhs = 0 (0x0) capareg = 99090560 (0x5e80080) maxcurr = 0 (0x0) pending-insert-quirk = false dma = "" mmio 0000000012530000/0000000000000100 bus: sd-bus type sdhci-bus dev: sd-card, id "" drive = "" spi = false uhs = 0 (0x0) dev: generic-sdhci, id "" gpio-out "sysbus-irq" 1 sd-spec-version = 2 (0x2) uhs = 0 (0x0) capareg = 99090560 (0x5e80080) maxcurr = 0 (0x0) pending-insert-quirk = false dma = "" mmio 0000000012520000/0000000000000100 bus: sd-bus type sdhci-bus dev: sd-card, id "" drive = "" spi = false uhs = 0 (0x0) dev: generic-sdhci, id "" gpio-out "sysbus-irq" 1 sd-spec-version = 2 (0x2) uhs = 0 (0x0) capareg = 99090560 (0x5e80080) maxcurr = 0 (0x0) pending-insert-quirk = false dma = "" mmio 0000000012510000/0000000000000100 bus: sd-bus type sdhci-bus dev: sd-card, id "" drive = "sd0" ^------- drive is here spi = false uhs = 0 (0x0) in hw/sd/core.c we have: static SDState *get_card(SDBus *sdbus) { /* We only ever have one child on the bus so just return it */ BusChild *kid = QTAILQ_FIRST(&sdbus->qbus.children); if (!kid) { return NULL; } return SD_CARD(kid->child); } Spec v1 allow multiple cards per bus but Spec v2 (and up) restrict to 1 per bus. in exynos4210_init() we have: di = drive_get(IF_SD, 0, n); blk = di ? blk_by_legacy_dinfo(di) : NULL; carddev = qdev_create(qdev_get_child_bus(dev, "sd-bus"), TYPE_SD_CARD); so there are no restriction in connecting various slaves to the same bus. I also wonder about this drive_get(), is this an outdated API? Only used in 3 boards: $ git grep 'drive_get(IF_SD' hw/arm/exynos4210.c:397: di = drive_get(IF_SD, 0, n); hw/arm/omap1.c:3990: dinfo = drive_get(IF_SD, 0, 0); hw/arm/omap2.c:2489: dinfo = drive_get(IF_SD, 0, 0); hw/arm/pxa2xx.c:2098: dinfo = drive_get(IF_SD, 0, 0); hw/arm/pxa2xx.c:2222: dinfo = drive_get(IF_SD, 0, 0); versus drive_get_next() used in others: hw/arm/mcimx7d-sabre.c:70: di = drive_get_next(IF_SD); hw/arm/raspi.c:200: di = drive_get_next(IF_SD); hw/arm/xilinx_zynq.c:269: di = drive_get_next(IF_SD); hw/arm/xlnx-zcu102.c:114: DriveInfo *di = drive_get_next(IF_SD); hw/sd/milkymist-memcard.c:279: dinfo = drive_get_next(IF_SD); hw/sd/pl181.c:508: dinfo = drive_get_next(IF_SD); hw/sd/ssi-sd.c:254: dinfo = drive_get_next(IF_SD); Now trying with the PC machine: $ x86_64-softmmu/qemu-system-x86_64 -M pc \ -device sdhci-pci,id=sdhci1 \ -device sdhci-pci,id=sdhci2,sd-spec-version=3,uhs=2 \ -device sd-card,id=sdcard0 \ -device sd-card,uhs=1,id=sdcard1 \ -monitor stdio -S (qemu) info qtree bus: main-system-bus type System dev: i440FX-pcihost, id "" bus: pci.0 type PCI dev: sdhci-pci, id "sdhci2" sd-spec-version = 3 (0x3) uhs = 2 (0x2) capareg = 91763892 (0x57834b4) maxcurr = 0 (0x0) addr = 05.0 romfile = "" rombar = 1 (0x1) multifunction = false command_serr_enable = true x-pcie-lnksta-dllla = true x-pcie-extcap-init = true class Class 0805, addr 00:05.0, pci id 1b36:0007 (sub 1af4:1100) bar 0: mem at 0xffffffffffffffff [0xfe] bus: sd-bus type sdhci-bus dev: sd-card, id "sdcard1" drive = "" spi = false uhs = 1 (0x1) dev: sd-card, id "sdcard0" drive = "" spi = false uhs = 0 (0x0) ^--- 2 cards... dev: sdhci-pci, id "sdhci1" sd-spec-version = 2 (0x2) uhs = 0 (0x0) capareg = 91763892 (0x57834b4) maxcurr = 0 (0x0) addr = 04.0 romfile = "" rombar = 1 (0x1) multifunction = false command_serr_enable = true x-pcie-lnksta-dllla = true x-pcie-extcap-init = true class Class 0805, addr 00:04.0, pci id 1b36:0007 (sub 1af4:1100) bar 0: mem at 0xffffffffffffffff [0xfe] bus: sd-bus type sdhci-bus ^--- no card And trying the -drive option: $ x86_64-softmmu/qemu-system-x86_64 -M pc \ -device sdhci-pci,id=sdhci1 \ -device sdhci-pci,id=sdhci2,sd-spec-version=3,uhs=2 \ -device sd-card,id=sdcard0 \ -device sd-card,uhs=1,id=sdcard1 \ -drive if=sd,id=sd0,driver=null-co,size=2G \ -drive if=sd,id=sd1,driver=null-co,size=4G qemu-system-x86_64: -drive if=sd,id=sd0,driver=null-co,size=2G: machine type does not support if=sd,bus=0,unit=0 qemu-system-x86_64: -drive if=sd,id=sd1,driver=null-co,size=4G: machine type does not support if=sd,bus=0,unit=1 How can I create the card with UHS-I enabled and connect it to the 2nd SDHCI? Thanks! Phil.
signature.asc
Description: OpenPGP digital signature