All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] hw/sd: Improve performance of read/write/erase
@ 2026-02-04 13:22 Christian Speich via qemu development
  2026-02-04 13:22 ` [PATCH v3 1/6] hw/sd: Switch read/write primitive to buf+len Christian Speich via qemu development
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Christian Speich via qemu development @ 2026-02-04 13:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Bin Meng, qemu-block,
	Christian Speich

This patch series improves the performance of read/write/erase operations
on sdcards.

This is done by increasing the maximum buffer size that is worked on.
From 1 byte (master) to 512 bytes (commit 1-3) to larger than 512
(adma commit).

Testing on my system with fio I see the following rough performance
values in MiB/s.

              read write readwrite
       master:   6     6     3/  3
 first commit:  51    43    23/ 23
second commit: 392   180   144/143

Tested on a 2GiB raw image with:
  fio --filename=/dev/mmcblk0 --direct=1 --runtime=60 --time_based --bs=128k --rw={mode}

The adma values are somewhat unstable but always >100MiB/s, I'm not sure
why but I guess it has something to do with the host side caching.

The fifth commit fixes the DATA_STAT_AFTER_ERASE bit in SCR and
introduces an option to allow to erase blocks to 0x00.

The sixth commit optimizes block erase when erase-blocks-as-zero=true
is used, by passing the zeroing request down the to the block device.
Erasing 2GiB now takes 0.1s instead of 26s.

Signed-off-by: Christian Speich <c.speich@avm.de>
---
Changes in v3:
- Rebase onto master, updating read/write path for newly added RBMP
- Split up commit 1 into multiple commits
  - change interface to allow "short" read/writes that are continued
    by the core later by calling again
- Link to v2: https://lore.kernel.org/qemu-devel/20251202-sdcard-performance-b4-v2-0-d42490b11322@avm.de

Changes in v2:
- Properly set DATA_STAT_AFTER_ERASE in SCR
- Add erase-blocks-as-zero option to allow the user to switch between
  0x00 and 0xFF for erased blocks.
- Link to v1: https://lore.kernel.org/qemu-devel/20250919-sdcard-performance-b4-v1-0-e1037e481a19@avm.de

---
Christian Speich (6):
      hw/sd: Switch read/write primitive to buf+len
      hw/sd/sd: Allow multi-byte read/write for generic paths
      hw/sd/sd: Use multi-byte/block writes for block path
      hw/sd/sdhci: Don't use bounce buffer for ADMA
      hw/sd/sdcard: Add erase-blocks-as-zero option.
      hw/sd/sdcard: Optimize erase blocks as zero.

 hw/sd/core.c       |  26 +++--
 hw/sd/sd.c         | 333 ++++++++++++++++++++++++++++++++++++++++-------------
 hw/sd/sdhci.c      | 102 ++++++++--------
 include/hw/sd/sd.h |  22 ++--
 4 files changed, 341 insertions(+), 142 deletions(-)
---
base-commit: 28a6ca268c2cd3718b5bf24c2d97e3d1e95fc604
change-id: 20250912-sdcard-performance-b4-d908bbb5a004

Best regards,
-- 
Christian Speich <c.speich@avm.de>



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-04-16 13:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 13:22 [PATCH v3 0/6] hw/sd: Improve performance of read/write/erase Christian Speich via qemu development
2026-02-04 13:22 ` [PATCH v3 1/6] hw/sd: Switch read/write primitive to buf+len Christian Speich via qemu development
2026-04-14 13:38   ` Philippe Mathieu-Daudé
2026-02-04 13:22 ` [PATCH v3 2/6] hw/sd/sd: Allow multi-byte read/write for generic paths Christian Speich via qemu development
2026-04-14 13:38   ` Philippe Mathieu-Daudé
2026-02-04 13:22 ` [PATCH v3 3/6] hw/sd/sd: Use multi-byte/block writes for block path Christian Speich
2026-04-14 13:45   ` Philippe Mathieu-Daudé
2026-02-04 13:22 ` [PATCH v3 4/6] hw/sd/sdhci: Don't use bounce buffer for ADMA Christian Speich
2026-04-14 13:51   ` Philippe Mathieu-Daudé
2026-04-16  7:52     ` Christian Speich
2026-04-16  8:27       ` Philippe Mathieu-Daudé
2026-04-16 13:51         ` Stefan Hajnoczi
2026-02-04 13:22 ` [PATCH v3 5/6] hw/sd/sdcard: Add erase-blocks-as-zero option Christian Speich
2026-04-14 15:02   ` Philippe Mathieu-Daudé
2026-04-16  8:02     ` Christian Speich
2026-04-16  8:26       ` Philippe Mathieu-Daudé
2026-02-04 13:22 ` [PATCH v3 6/6] hw/sd/sdcard: Optimize erase blocks as zero Christian Speich
2026-04-14 13:58   ` Philippe Mathieu-Daudé
2026-03-19  8:37 ` [PATCH v3 0/6] hw/sd: Improve performance of read/write/erase Christian Speich
2026-04-14 15:23   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.