U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Urvashi Sharma <urvashi.sharma@oss.qualcomm.com>
To: u-boot@lists.denx.de
Cc: neil.armstrong@linaro.org, bhupesh.linux@gmail.com,
	n-francis@ti.com, marek.vasut+renesas@mailbox.org,
	iwamatsu@nigauri.org, trini@konsulko.com,
	digant.shah@oss.qualcomm.com
Subject: [RFC PATCH 0/3] blk/scsi/ufs: scatter-gather read support
Date: Fri, 13 Nov 2026 20:05:52 -0800	[thread overview]
Message-ID: <cover.1794628845.git.urvashi.sharma@oss.qualcomm.com> (raw)
In-Reply-To: <ptmm7jaltdwuyxj5ks26oht2cj6ckp4at6prvra27l4r6idkiz@xzyj2s3spx25>

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(-)

-- 
2.34.1


  parent reply	other threads:[~2026-11-14  4:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 22:52 [RFC] blk/scsi/ufs: scatter-gather read support Urvashi Sharma
2026-11-11  8:14 ` neil.armstrong
2026-11-12  2:19   ` Urvashi Sharma
2026-11-14  4:05 ` Urvashi Sharma [this message]
2026-11-14  4:05   ` [RFC PATCH 1/3] blk: add " Urvashi Sharma
2026-11-14  4:05   ` [RFC PATCH 2/3] scsi: " Urvashi Sharma
2026-11-14  4:05   ` [RFC PATCH 3/3] ufs: " Urvashi Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1794628845.git.urvashi.sharma@oss.qualcomm.com \
    --to=urvashi.sharma@oss.qualcomm.com \
    --cc=bhupesh.linux@gmail.com \
    --cc=digant.shah@oss.qualcomm.com \
    --cc=iwamatsu@nigauri.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=n-francis@ti.com \
    --cc=neil.armstrong@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox