mbox series

[v5,00/15] introduce exynosauto v9 ufs driver

Message ID 20211018124216.153072-1-chanho61.park@samsung.com (mailing list archive)
Headers show
Series introduce exynosauto v9 ufs driver | expand

Message

Chanho Park Oct. 18, 2021, 12:42 p.m. UTC
In ExynosAuto(variant of the Exynos for automotive), the UFS Storage needs
to be accessed from multiple VMs. Traditional virtualization solution
provides para-virtualized block driver such as virtio-blk. However, they
can be highly depends on the Dom0 where the backend of the PV is
located. When the system gets high cpu pressure, the performance of
guest VMs are also affected. To overcome this, the SoC implements the
virtualization concept as the H/W controller level.

Below figure is a conceptual design of the UFS Multi Host architecture.

    +------+          +------+
    | OS#1 |          | OS#2 |
    +------+          +------+
       |                 |
 +------------+     +------------+
 |  Physical  |     |   Virtual  |
 |    Host    |     |    Host    |
 +------------+     +------------+
   |      |              | <-- UTP_CMD_SAP, UTP_TM_SAP
   |   +-------------------------+
   |   |    Function Arbiter     |
   |   +-------------------------+
 +-------------------------------+
 |           UTP Layer           |
 +-------------------------------+
 +-------------------------------+
 |           UIC Layer           |
 +-------------------------------+

There are two types of host controllers of the UFS host controller
that we designed. The controller has a Function Arbiter that arranges
commands of each hosts. It will arrange the doorbells among the PH and
VHs as Round-Robin. When each host transmits a command to the Arbiter,
the Arbiter transmits it to the UTP layer. Physical Host(PH) support all
UFSHCI functions(all SAPs) same as conventional UFSHCI.
Virtual Hosts(VHs) support only data transfer function(UTP_CMD_SAP and
UTP_TM_SAP).

In an environment where multiple VMs are used, the OS that has the
leadership of the system is called System OS(Dom0). This system OS will
own the PH and has a responsibility to handle UIC errors.

VHs can only supports data transfer functions compared with the PH,
they're necessary to send a request to the PH for error handling of VHs.
To interface among the PH and VHs, the UFSHCI controller supports mailbox.
The mailbox register has 8 bit fields and they can be used as
arguments of the mailbox protocol. In this initial patchset, the PH
ready message is supported and they will be implemented to the next
steps.

To support this virtual host type controller which only supports data
transfer function (TP_CMD_SAP and UTP_TM_SAP), we need to add below two
quirks.
- UFSHCD_QUIRK_BROKEN_UIC_CMD
- UFSHCD_QUIRK_SKIP_PH_CONFIGURATION

First two patches, I picked them up from Jonmin's patchset[1] and the third
patch has been dropped because it's not necessary anymore.

[1]: https://lore.kernel.org/linux-scsi/20210527030901.88403-1-jjmin.jeong@samsung.com/

Patch 0003 ~ 0010, they are changes of exynos7 ufs driver to apply
exynosauto v9 variant and PH/VH capabilities.
Patch 0011 ~ 0015, the patches introduce the exynosauto v9 ufs MHCI which
includes the PH and VHs.

Changes from v4:
- s/Arbitor/Arbiter/g of cover-letter.
- Rephrase descriptions of cover letter from original patchset.
- Except 0007-scsi-ufs-ufs-exynos-correct-timeout-value-setting-re.patch
  from this patchset and sent it independently
- Patch11/12: Consolidate sysreg and samsung,ufs-shareability-reg-offset
  property.
- Patch14:
  Drop wlun_dev_clr_ua configuration
  Add TODO: tag for further implementations

Changes from v3:
- Drop "[PATCH v3 06/17] scsi: ufs: ufs-exynos: get sysreg regmap for
  io-coherency" and squash it to Patch12
- Patch12: Use macro to avoid raw value usage and describe the value of M-Phy setting
- Patch13: Add dma-coherent property
- Patch14: Use macro to avoid raw value and describe the value of HCI_MH_ALLOWABLE_TRAN_OF_VH

Changes from v2:
- Separate dt-binding patches on top of
  https://lore.kernel.org/linux-devicetree/YUNdqnZ2kYefxFUC@robh.at.kernel.org/

Changes from v1:
- Change quirk name from UFSHCD_QUIRK_SKIP_INTERFACE_CONFIGURATION to
  UFSHCD_QUIRK_SKIP_PH_CONFIGURATION
- Add compatibles to Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml
  on top of https://lore.kernel.org/linux-scsi/20200613024706.27975-9-alim.akhtar@samsung.com/

Chanho Park (13):
  scsi: ufs: ufs-exynos: change pclk available max value
  scsi: ufs: ufs-exynos: simplify drv_data retrieval
  scsi: ufs: ufs-exynos: add refclkout_stop control
  scsi: ufs: ufs-exynos: add setup_clocks callback
  scsi: ufs: ufs-exynos: support custom version of ufs_hba_variant_ops
  scsi: ufs: ufs-exynos: add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option
  scsi: ufs: ufs-exynos: factor out priv data init
  scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks
  scsi: ufs: ufs-exynos: support exynosauto v9 ufs driver
  dt-bindings: ufs: exynos-ufs: add io-coherency property
  scsi: ufs: ufs-exynos: multi-host configuration for exynosauto
  scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host
  dt-bindings: ufs: exynos-ufs: add exynosautov9 compatible

jongmin jeong (2):
  scsi: ufs: add quirk to handle broken UIC command
  scsi: ufs: add quirk to enable host controller without ph
    configuration

 .../bindings/ufs/samsung,exynos-ufs.yaml      |  10 +
 drivers/scsi/ufs/ufs-exynos.c                 | 354 +++++++++++++++++-
 drivers/scsi/ufs/ufs-exynos.h                 |  27 +-
 drivers/scsi/ufs/ufshcd.c                     |   6 +
 drivers/scsi/ufs/ufshcd.h                     |  12 +
 5 files changed, 386 insertions(+), 23 deletions(-)

Comments

Rob Herring (Arm) Oct. 28, 2021, 1:26 p.m. UTC | #1
On Mon, 18 Oct 2021 21:42:01 +0900, Chanho Park wrote:
> In ExynosAuto(variant of the Exynos for automotive), the UFS Storage needs
> to be accessed from multiple VMs. Traditional virtualization solution
> provides para-virtualized block driver such as virtio-blk. However, they
> can be highly depends on the Dom0 where the backend of the PV is
> located. When the system gets high cpu pressure, the performance of
> guest VMs are also affected. To overcome this, the SoC implements the
> virtualization concept as the H/W controller level.
> 
> Below figure is a conceptual design of the UFS Multi Host architecture.
> 
>     +------+          +------+
>     | OS#1 |          | OS#2 |
>     +------+          +------+
>        |                 |
>  +------------+     +------------+
>  |  Physical  |     |   Virtual  |
>  |    Host    |     |    Host    |
>  +------------+     +------------+
>    |      |              | <-- UTP_CMD_SAP, UTP_TM_SAP
>    |   +-------------------------+
>    |   |    Function Arbiter     |
>    |   +-------------------------+
>  +-------------------------------+
>  |           UTP Layer           |
>  +-------------------------------+
>  +-------------------------------+
>  |           UIC Layer           |
>  +-------------------------------+
> 
> There are two types of host controllers of the UFS host controller
> that we designed. The controller has a Function Arbiter that arranges
> commands of each hosts. It will arrange the doorbells among the PH and
> VHs as Round-Robin. When each host transmits a command to the Arbiter,
> the Arbiter transmits it to the UTP layer. Physical Host(PH) support all
> UFSHCI functions(all SAPs) same as conventional UFSHCI.
> Virtual Hosts(VHs) support only data transfer function(UTP_CMD_SAP and
> UTP_TM_SAP).
> 
> In an environment where multiple VMs are used, the OS that has the
> leadership of the system is called System OS(Dom0). This system OS will
> own the PH and has a responsibility to handle UIC errors.
> 
> VHs can only supports data transfer functions compared with the PH,
> they're necessary to send a request to the PH for error handling of VHs.
> To interface among the PH and VHs, the UFSHCI controller supports mailbox.
> The mailbox register has 8 bit fields and they can be used as
> arguments of the mailbox protocol. In this initial patchset, the PH
> ready message is supported and they will be implemented to the next
> steps.
> 
> To support this virtual host type controller which only supports data
> transfer function (TP_CMD_SAP and UTP_TM_SAP), we need to add below two
> quirks.
> - UFSHCD_QUIRK_BROKEN_UIC_CMD
> - UFSHCD_QUIRK_SKIP_PH_CONFIGURATION
> 
> First two patches, I picked them up from Jonmin's patchset[1] and the third
> patch has been dropped because it's not necessary anymore.
> 
> [1]: https://lore.kernel.org/linux-scsi/20210527030901.88403-1-jjmin.jeong@samsung.com/
> 
> Patch 0003 ~ 0010, they are changes of exynos7 ufs driver to apply
> exynosauto v9 variant and PH/VH capabilities.
> Patch 0011 ~ 0015, the patches introduce the exynosauto v9 ufs MHCI which
> includes the PH and VHs.
> 
> Changes from v4:
> - s/Arbitor/Arbiter/g of cover-letter.
> - Rephrase descriptions of cover letter from original patchset.
> - Except 0007-scsi-ufs-ufs-exynos-correct-timeout-value-setting-re.patch
>   from this patchset and sent it independently
> - Patch11/12: Consolidate sysreg and samsung,ufs-shareability-reg-offset
>   property.
> - Patch14:
>   Drop wlun_dev_clr_ua configuration
>   Add TODO: tag for further implementations
> 
> Changes from v3:
> - Drop "[PATCH v3 06/17] scsi: ufs: ufs-exynos: get sysreg regmap for
>   io-coherency" and squash it to Patch12
> - Patch12: Use macro to avoid raw value usage and describe the value of M-Phy setting
> - Patch13: Add dma-coherent property
> - Patch14: Use macro to avoid raw value and describe the value of HCI_MH_ALLOWABLE_TRAN_OF_VH
> 
> Changes from v2:
> - Separate dt-binding patches on top of
>   https://lore.kernel.org/linux-devicetree/YUNdqnZ2kYefxFUC@robh.at.kernel.org/
> 
> Changes from v1:
> - Change quirk name from UFSHCD_QUIRK_SKIP_INTERFACE_CONFIGURATION to
>   UFSHCD_QUIRK_SKIP_PH_CONFIGURATION
> - Add compatibles to Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml
>   on top of https://lore.kernel.org/linux-scsi/20200613024706.27975-9-alim.akhtar@samsung.com/
> 
> Chanho Park (13):
>   scsi: ufs: ufs-exynos: change pclk available max value
>   scsi: ufs: ufs-exynos: simplify drv_data retrieval
>   scsi: ufs: ufs-exynos: add refclkout_stop control
>   scsi: ufs: ufs-exynos: add setup_clocks callback
>   scsi: ufs: ufs-exynos: support custom version of ufs_hba_variant_ops
>   scsi: ufs: ufs-exynos: add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option
>   scsi: ufs: ufs-exynos: factor out priv data init
>   scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks
>   scsi: ufs: ufs-exynos: support exynosauto v9 ufs driver
>   dt-bindings: ufs: exynos-ufs: add io-coherency property
>   scsi: ufs: ufs-exynos: multi-host configuration for exynosauto
>   scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host
>   dt-bindings: ufs: exynos-ufs: add exynosautov9 compatible
> 
> jongmin jeong (2):
>   scsi: ufs: add quirk to handle broken UIC command
>   scsi: ufs: add quirk to enable host controller without ph
>     configuration
> 
>  .../bindings/ufs/samsung,exynos-ufs.yaml      |  10 +
>  drivers/scsi/ufs/ufs-exynos.c                 | 354 +++++++++++++++++-
>  drivers/scsi/ufs/ufs-exynos.h                 |  27 +-
>  drivers/scsi/ufs/ufshcd.c                     |   6 +
>  drivers/scsi/ufs/ufshcd.h                     |  12 +
>  5 files changed, 386 insertions(+), 23 deletions(-)
> 
> --
> 2.33.0
> 
> 
> 
> 

Applied patches 12 and 15, thanks!