RFC blk/scsi/ufs: scatter-gather read support
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | blk: add scatter-gather read supportdrivers/ drivers/ include/ | +146 | 0 replies | |
| 2/3 | scsi: add scatter-gather read supportdrivers/ include/ | +64 | 0 replies | |
| 3/3 | ufs: add scatter-gather read supportdrivers/ drivers/ | +80 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/3] blk/scsi/ufs: scatter-gather read support
This implements the scatter-gather read design discussed in [1].
Reading one contiguous block range into several separate buffers currently takes one read request per buffer, since the block uclass has no way to pass a list of destination addresses to a driver. Controllers which accept such a list for a single command, like UFS with its PRDT, cannot make use of it.
Patch 1 adds the block layer side: an optional read_sg() operation taking a struct blk_sg_list, and blk_read_sg() to drive it. blk_read_sg() checks that every entry is a non-zero multiple of the block size and that the lengths add up to the requested block count, then either calls the driver or loops blk_read() over the list, so callers behave the same way regardless of the driver. Patches 2 and 3 implement read_sg() for SCSI and UFS.
Changes from the design posted in [1]:
- addr in struct blk_sg_entry is void * rather than unsigned int, and entries carry a byte length rather than a block count.
- The list is still a struct rather than a bare count argument, to leave room for flags or alignment hints without changing the read_sg() signature or its callers.
- Names are prefixed blk_sg_ / read_sg to keep the storage sense of scatter-gather distinct from the DMA one.
- blk_read_sg() falls back to one blk_read() per buffer when the driver has no read_sg(), or rejects a list with -ENOSYS or -EOPNOTSUPP, instead of returning -ENOSYS to the caller.
- Kconfig symbols are BLK_SCATTER_GATHER_READ and UFS_SCATTER_GATHER, as the generic part belongs to the block layer rather than SCSI.
There is no in-tree user yet, so both symbols default to off and no defconfig selects them.
Tested on qemu_arm64 with QEMU's UFS device, reading a block range into several buffers with blk_read_sg() via UFS_PCI.
[1] https://lore.kernel.org/u-boot/ptmm7jaltdwuyxj5ks26oht2cj6ckp4at6prvra27l4r6idkiz@xzyj2s3spx25/
Urvashi Sharma (3):
blk: add scatter-gather read support
scsi: add scatter-gather read support
ufs: add scatter-gather read support
drivers/block/Kconfig | 10 +++++ drivers/block/blk-uclass.c | 75 ++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi.c | 58 +++++++++++++++++++++++++++++ drivers/ufs/Kconfig | 8 ++++ drivers/ufs/ufs-uclass.c | 75 ++++++++++++++++++++++++++++++++++++-- include/blk.h | 61 +++++++++++++++++++++++++++++++ include/scsi.h | 6 +++ 7 files changed, 290 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1