Re: Another approach of UFSHPB

From: Bart Van Assche
Date: Fri May 22 2020 - 12:49:50 EST


On 2020-05-19 15:31, yongmyung lee wrote:
> Currently, UFS driver (usually ufshcd.c) has become bulky and complex.
> So, I would like to split these codes into layers
> like the works of Bean Huo and Avril Altman.
> Especially, I suggest the UFS-Feature Driver model based on Linux Bus-Driver Model,
> which is suitable to manage all Extended UFS-Feature drivers like the Figure as below:
>
>
> UFS Driver data structure (struct ufs_hba)
> |
> | ----------------------- -- ufshpb driver -- <- attach ufshpb device driver (it can be loadable)
> |---| ufs-ext feature layer | -- ufs-wb driver -- <- attach ufswb device driver
> | | | -- ... -- <- ...
> | ----------------------- -- next ufs feature driver -- <- attach ufs-next feature driver
>
> * wb : write-booster

Splitting the UFS driver into multiple modules would be great if the
interface between these modules can be kept small and elegant. However,
I'm not sure that this approach should be based on Linux device driver
bus concept. Devices can be unbound at any time from their driver by
writing into the "unbind" sysfs attribute. I don't think we want the UFS
core functionality ever to be unbound while any other UFS functionality
is still active. Has it been considered to implement each feature as a
loadable module without relying on the bus model? The existing kernel
module infrastructure already prevents to unload modules (e.g. the UFS
core) that are in use by a kernel module that depends on it (e.g. UFS HPB).

> Furthermore, each ufs-ext feature driver will be written as a loadable kernel module.
> Vendors (e.g., Android Phone manufacturer) could optionally load and remove each module.

What will happen if a feature module is unloaded (e.g. HPB) while I/O is
ongoing that relies on HPB?

> Also they can customize the parameters of ufs-ext feature drivers
> while each module is being loaded.
> (For example, vendor would set the maximum memory size
> that can be reclaimed in the Host Control mode in HPB)

Should these parameters be per module or per UFS device?

> In addition, we plan to provide QEMU with UFS-simulator
> for a test environment for UFS driver development.

A UFS simulator for QEMU support would definitely be welcome.

Thanks,

Bart.