mbox series

[v4,00/16] introduce exynosauto v9 ufs driver

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

Message

Chanho Park Oct. 7, 2021, 8:09 a.m. UTC
In ExynosAuto(variant of the Exynos for automotive), the UFS Storage needs
to be accessed from multi-OS. To increase IO performance and reduce SW
complexity, we implemented UFS-IOV to support storage IO virtualization
feature on UFS.

IO virtualization increases IO performance and reduce SW complexity
with small area cost. And IO virtualization supports virtual machine
isolation for Security and Safety which are requested by Multi-OS system
such as automotive application.

Below figure is the conception of UFS-IOV architeture.

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

There are two types of host controllers on the UFS host controller
that we designed.
The UFS device has a Function Arbitor that arranges commands of each host.
When each host transmits a command to the Arbitor, the Arbitor transmits it
to the UTP layer.
Physical Host(PH) support all UFSHCI functions(all SAPs) same as
conventional UFSHCI.
Virtual Host(VH) support only data transfer function(UTP_CMD_SAP and
UTP_TM_SAP).

In an environment where multiple OSs are used, the OS that has the
leadership of the system is called System OS(Dom0). This system OS uses
PH and controls error handling.

Since VH can only use less functions than PH, it is necessary to send a
request to PH for Detected Error Handling in VH. To interface among PH
and VHs, UFSHCI HW supports mailbox. PH can broadcast mail to other VH at
the same time with arguments and VH can mail to PH with arguments.
PH and VH generate interrupts when mails from PH or VH.

In this structure, the virtual host can't support some feature and need
to skip the some part of ufshcd code by using quirk.
This patchs add quirks so that the UIC command is ignored and the ufshcd
init process can be skipped for VH. Also, according to our UFS-IOV policy,

First two patches, I picked them up from Jonmin's patchset[1] and the third
patch has been dropped because we need to check it again.

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

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

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 (14):
  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: correct timeout value setting registers
  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      |  13 +
 drivers/scsi/ufs/ufs-exynos.c                 | 359 ++++++++++++++++--
 drivers/scsi/ufs/ufs-exynos.h                 |  27 +-
 drivers/scsi/ufs/ufshcd.c                     |   6 +
 drivers/scsi/ufs/ufshcd.h                     |  12 +
 5 files changed, 391 insertions(+), 26 deletions(-)

Comments

Avri Altman Oct. 14, 2021, 10:04 a.m. UTC | #1
Hi, 
> 
> In ExynosAuto(variant of the Exynos for automotive), the UFS Storage needs to
> be accessed from multi-OS. To increase IO performance and reduce SW
> complexity, we implemented UFS-IOV to support storage IO virtualization
> feature on UFS.
> 
> IO virtualization increases IO performance and reduce SW complexity with
> small area cost. And IO virtualization supports virtual machine isolation for
> Security and Safety which are requested by Multi-OS system such as
> automotive application.
> 
> Below figure is the conception of UFS-IOV architeture.
Conception --> a conceptual design

> 
>     +------+          +------+
>     | OS#1 |          | OS#2 |
>     +------+          +------+
>        |                 |
>  +------------+     +------------+
>  |  Physical  |     |   Virtual  |
>  |    Host    |     |    Host    |
>  +------------+     +------------+
>    |      |              | <-- UTP_CMD_SAP, UTP_TM_SAP
>    |   +-------------------------+
>    |   |    Function Arbitor     |
>    |   +-------------------------+
>  +-------------------------------+
>  |           UTP Layer           |
>  +-------------------------------+
>  +-------------------------------+
>  |           UIC Layer           |
>  +-------------------------------+
> 
> There are two types of host controllers on the UFS host controller that we
> designed.
> The UFS device has a Function Arbitor that arranges commands of each host.
> When each host transmits a command to the Arbitor, the Arbitor transmits it to
> the UTP layer.
- Arbitor --> arbiter
 - ufs devise --> host controller
And maybe rephrase the above description (and sketch) so it is clear that the PH, VH, and function arbiter are all hw modules in the host controller.

Thanks,
Avri 

> Physical Host(PH) support all UFSHCI functions(all SAPs) same as conventional
> UFSHCI.
> Virtual Host(VH) support only data transfer function(UTP_CMD_SAP and
> UTP_TM_SAP).
> 
> In an environment where multiple OSs are used, the OS that has the leadership
> of the system is called System OS(Dom0). This system OS uses PH and controls
> error handling.
> 
> Since VH can only use less functions than PH, it is necessary to send a request to
> PH for Detected Error Handling in VH. To interface among PH and VHs, UFSHCI
> HW supports mailbox. PH can broadcast mail to other VH at the same time with
> arguments and VH can mail to PH with arguments.
> PH and VH generate interrupts when mails from PH or VH.
> 
> In this structure, the virtual host can't support some feature and need to skip
> the some part of ufshcd code by using quirk.
> This patchs add quirks so that the UIC command is ignored and the ufshcd init
> process can be skipped for VH. Also, according to our UFS-IOV policy,
> 
> First two patches, I picked them up from Jonmin's patchset[1] and the third
> patch has been dropped because we need to check it again.
> 
> [1]: https://lore.kernel.org/linux-scsi/20210527030901.88403-1-
> jjmin.jeong@samsung.com/
> 
> Patch 0003 ~ 0013, they are changes of exynos7 ufs driver to apply exynosauto
> v9 variant and PH/VH capabilities.
> Patch 0014 ~ 0017, the patches introduce exynosauto v9 ufs MHCI which
> includes PH and VH.
> 
> 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 (14):
>   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: correct timeout value setting registers
>   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      |  13 +
>  drivers/scsi/ufs/ufs-exynos.c                 | 359 ++++++++++++++++--
>  drivers/scsi/ufs/ufs-exynos.h                 |  27 +-
>  drivers/scsi/ufs/ufshcd.c                     |   6 +
>  drivers/scsi/ufs/ufshcd.h                     |  12 +
>  5 files changed, 391 insertions(+), 26 deletions(-)
> 
> --
> 2.33.0
Chanho Park Oct. 15, 2021, 11:57 a.m. UTC | #2
Hi, Thanks for your review.

> -----Original Message-----
> From: Avri Altman <Avri.Altman@wdc.com>
> Sent: Thursday, October 14, 2021 7:05 PM
> To: Chanho Park <chanho61.park@samsung.com>; Alim Akhtar
> <alim.akhtar@samsung.com>; James E . J . Bottomley <jejb@linux.ibm.com>;
> Martin K . Petersen <martin.petersen@oracle.com>; Krzysztof Kozlowski
> <krzysztof.kozlowski@canonical.com>
> Cc: Bean Huo <beanhuo@micron.com>; Bart Van Assche <bvanassche@acm.org>;
> Adrian Hunter <adrian.hunter@intel.com>; hch@infradead.org; Can Guo
> <cang@codeaurora.org>; Jaegeuk Kim <jaegeuk@kernel.org>; Jaehoon Chung
> <jh80.chung@samsung.com>; Gyunghoon Kwon <goodjob.kwon@samsung.com>; Sowon
> Na <sowon.na@samsung.com>; linux-samsung-soc@vger.kernel.org; linux-
> scsi@vger.kernel.org
> Subject: RE: [PATCH v4 00/16] introduce exynosauto v9 ufs driver
> 
> Hi,
> >
> > In ExynosAuto(variant of the Exynos for automotive), the UFS Storage
> > needs to be accessed from multi-OS. To increase IO performance and
> > reduce SW complexity, we implemented UFS-IOV to support storage IO
> > virtualization feature on UFS.
> >
> > IO virtualization increases IO performance and reduce SW complexity
> > with small area cost. And IO virtualization supports virtual machine
> > isolation for Security and Safety which are requested by Multi-OS
> > system such as automotive application.
> >
> > Below figure is the conception of UFS-IOV architeture.
> Conception --> a conceptual design
> 
> >
> >     +------+          +------+
> >     | OS#1 |          | OS#2 |
> >     +------+          +------+
> >        |                 |
> >  +------------+     +------------+
> >  |  Physical  |     |   Virtual  |
> >  |    Host    |     |    Host    |
> >  +------------+     +------------+
> >    |      |              | <-- UTP_CMD_SAP, UTP_TM_SAP
> >    |   +-------------------------+
> >    |   |    Function Arbitor     |
> >    |   +-------------------------+
> >  +-------------------------------+
> >  |           UTP Layer           |
> >  +-------------------------------+
> >  +-------------------------------+
> >  |           UIC Layer           |
> >  +-------------------------------+
> >
> > There are two types of host controllers on the UFS host controller
> > that we designed.
> > The UFS device has a Function Arbitor that arranges commands of each
> host.
> > When each host transmits a command to the Arbitor, the Arbitor
> > transmits it to the UTP layer.
> - Arbitor --> arbiter
>  - ufs devise --> host controller
> And maybe rephrase the above description (and sketch) so it is clear that
> the PH, VH, and function arbiter are all hw modules in the host controller.

I'll rephrase the descriptions next patchset. Thanks.

Best Regards,
Chanho Park