HomeFreeBSD

ufshci: Introduce the ufshci(4) driver

Description

ufshci: Introduce the ufshci(4) driver

This commit adds a storage driver that supports the Universal Flash
Storage Host Controller Interface (UFSHCI) on FreeBSD.

Universal Flash Storage (UFS) is a flash-based mobile storage device
that replaces eMMC, aiming for high performance with low power. The UFS
Host Controller Interface (UFSHCI) is the host side controller and
connects UFS device to a system bus, such as PCIe.

The code targets the latest standards:

The ufshci(4) driver implements controller/device initialization,
interrupt, single-doorbell(SDB) queue based IO requests. Support for
multi-queue (MCQ) IO requests is planned for a later commit.

Implemented features:

  • PCIe bus support
  • legacy(INTx) Interrupt Handling
  • UIC command support
  • UTP Transfer Request (UTR) support
  • UTP Task Management Request (UTMR) support
  • single doorbell queue (SDB) with multiple queue depth
  • SCSI command set support
  • sysctl

Work in progress:

  • multi-Circular Queue (per-CPU IO queues)
  • MSI-X interrupt Support
  • write booster
  • write Protect
  • Host Performance Booster (HPB)
  • interrupt aggregation
  • ARM based system bus support
  • ufs-utils port

Tests were performed on QEMU and an Intel-based laptop.
Since QEMU has an emulated UFS device, I tested on QEMU.

How to test on QEMU:

  1. Run QEMU $ qemu-system-x86_64 ... -device ufs -drive file=blk1g.bin,format=raw,if=none,id=luimg -device ufs-lu,drive=luimg,lun=0
  2. Loading/unloading the ufshci module on QEMU $ kldload /usr/obj/usr/src/amd64.amd64/sys/modules/ufshci/ufshci.ko $ kldunload ufshci

Testing on real hardware:

  • Samsung Galaxy Book S (Intel Lakefield) with UFS 3.0
  • Lenovo duet 3 11ian8 (Intel N100) with UFS 2.1

Sponsored by: Samsung Electronics
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50370

Details

Provenance
j_yoon.choi_samsung.comAuthored on Jun 13 2025, 6:33 PM
impCommitted on Jun 15 2025, 6:08 AM
Reviewer
imp
Differential Revision
D50370: ufshci: Introduce the ufshci(4) driver
Parents
rGb6e33f0cd536: rc.d/mountcritlocal: Make sure zpools are imported for legacy ZFS
Branches
Unknown
Tags
Unknown