On 9/4/26 09:12, Alexey Charkov wrote:
UFS devices have a built-in A/B boot mechanism implemented via the "boot
well known logical unit" (boot W-LU). This works by marking two of the
provisioned LUs with a flag in their unit configuration descriptor, and
setting the active boot LU in the whole device's attributes. The device
then exposes a special logical unit 0xb0 (the boot W-LU) which is
internally aliased to the currently active boot LU (if one is set). It
allows reading and writing directly through the 0xb0 LU, but doesn't
expose the LU geometry, so it is not quite a full-fledged block device.

Given that the normal use of this mechanism is for symmetric A/B boot,
real world scenarios will usually have both W-LU-A and W-LU-B provisioned
with identical geometry, so the geometry for the boot W-LU can be inferred
from the active boot LU, while its special 0xb0 LUN can still be used for
reads and writes to have the device itself abstract away the actual
request routing, even when the active boot LU is changed.

This series adds support for loading the U-Boot proper from the boot W-LU,
allowing to use the native A/B boot mechanism without the need to hardcode
the "real" LUN in the SPL configuration.

Two classes of prerequisites are handled by the first half of this series
before the enablement itself:
1. The SCSI core needs to learn to repeat inquiry requests when they
    return with a transitive non-zero status, such as the UNIT ATTENTION
    condition, which the W-LU returns when it's first talked to and which
    is not an error (patches 1-2)
2. The scan itself needs to learn to look beyond the normal LUN range when
    the implementation supports W-LUs, as they are numbered above 0x80, and
    "borrow" the geometry from the physical LU the W-LU is aliased to
    (patches 3-5)

Patches 6-10 are the enablement itself, split by logical parts.

CI passes all green:
https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/1175

Signed-off-by: Alexey Charkov <[email protected]>
---
Alexey Charkov (10):
       ufs: hand sense data to the SCSI layer
       scsi: repeat an INQUIRY that a unit attention interrupted
       scsi: size a well known unit from the unit it stands in for
       scsi: allow a controller to declare well known logical units
       scsi: add a lookup by target and LUN
       part: name the well known logical unit device type
       ufs: define the well known logical unit ids
       ufs: report the logical unit the boot W-LU presents
       ufs: expose the boot logical unit as a block device
       spl: ufs: allow loading U-Boot from the boot logical unit

  common/spl/Kconfig         | 30 +++++++++++++-
  common/spl/spl_ufs.c       | 18 +++++++--
  disk/part.c                |  3 ++
  drivers/scsi/scsi-uclass.c | 32 +++++++++++++++
  drivers/scsi/scsi.c        | 98 ++++++++++++++++++++++++++++++++++++++++------
  drivers/ufs/ufs-uclass.c   | 76 ++++++++++++++++++++++++++++++++++-
  drivers/ufs/ufs.h          | 28 +++++++++++++
  include/part.h             |  1 +
  include/scsi.h             | 45 +++++++++++++++++++++
  include/ufs.h              |  8 ++++
  10 files changed, 321 insertions(+), 18 deletions(-)
---
base-commit: 1c5004ffc5e3f000eca6cada32af7c83bd925c2b
change-id: 20260903-ufs-spl-boot-wlu-10ce2e14bf15

Best regards,
--
Alexey Charkov <[email protected]>


Apart 2 NITs, this serie is very good, I have no further comments.

I'll let other people comment & test for a few days to be sure
we didn't miss anything obvious.

Thanks,
Neil

Reply via email to