From: Inki Dae <inki.dae@samsung.com>
To: Chanho Park <chanho61.park@samsung.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.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>,
Christoph Hellwig <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,
Kiwoong Kim <kwmad.kim@samsung.com>, "cpgs ." <cpgs@samsung.com>
Subject: Re: [PATCH v4 14/16] scsi: ufs: ufs-exynos: multi-host configuration for exynosauto
Date: Mon, 18 Oct 2021 14:34:14 +0900 [thread overview]
Message-ID: <1891546521.01634536081285.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: <20211007080934.108804-15-chanho61.park@samsung.com>
21. 10. 7. 오후 5:09에 Chanho Park 이(가) 쓴 글:
> UFS controller of ExynosAuto v9 SoC supports multi-host interface for I/O
> virtualization. In general, we're using para-virtualized driver to
> support a block device by several virtual machines. However, it should
> be relayed by backend driver. Multi-host functionality extends the host
> controller by providing register interfaces that can be used by each
> VM's ufs drivers respectively. By this, we can provide direct access to
> the UFS device for multiple VMs. It's similar with SR-IOV of PCIe.
>
> We divide this M-HCI as PH(Physical Host) and VHs(Virtual Host). The PH
> supports all UFSHCI functions(all SAPs) same as conventional UFSHCI but
> the VH only supports data transfer function. Thus, except UTP_CMD_SAP and
> UTP_TMPSAP, the PH should handle all the physical features.
>
> This patch provides an initial implementation of PH part. M-HCI can
> support up to four interfaces but this patch initially supports only 1
> PH and 1 VH. For this, we uses TASK_TAG[7:5] field so TASK_TAG[4:0] for
> 32 doorbel will be supported. After the PH is initiated, this will send
> a ready message to VHs through a mailbox register. The message handler
> is not fully implemented yet such as supporting reset / abort cases.
>
> Cc: Alim Akhtar <alim.akhtar@samsung.com>
> Cc: Kiwoong Kim <kwmad.kim@samsung.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---
> drivers/scsi/ufs/ufs-exynos.c | 68 +++++++++++++++++++++++++++++++++++
> 1 file changed, 68 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
> index 9d32f19395b8..32f73c906018 100644
> --- a/drivers/scsi/ufs/ufs-exynos.c
> +++ b/drivers/scsi/ufs/ufs-exynos.c
> @@ -83,6 +83,44 @@
> #define UFS_SHARABLE (UFS_WR_SHARABLE | UFS_RD_SHARABLE)
> #define UFS_SHAREABILITY_OFFSET 0x710
>
> +/* Multi-host registers */
> +#define MHCTRL 0xC4
> +#define MHCTRL_EN_VH_MASK (0xE)
> +#define MHCTRL_EN_VH(vh) (vh << 1)
> +#define PH2VH_MBOX 0xD8
> +
> +#define MH_MSG_MASK (0xFF)
> +
> +#define MH_MSG(id, msg) ((id << 8) | (msg & 0xFF))
> +#define MH_MSG_PH_READY 0x1
> +#define MH_MSG_VH_READY 0x2
> +
> +#define ALLOW_INQUIRY BIT(25)
> +#define ALLOW_MODE_SELECT BIT(24)
> +#define ALLOW_MODE_SENSE BIT(23)
> +#define ALLOW_PRE_FETCH GENMASK(22, 21)
> +#define ALLOW_READ_CMD_ALL GENMASK(20, 18) /* read_6/10/16 */
> +#define ALLOW_READ_BUFFER BIT(17)
> +#define ALLOW_READ_CAPACITY GENMASK(16, 15)
> +#define ALLOW_REPORT_LUNS BIT(14)
> +#define ALLOW_REQUEST_SENSE BIT(13)
> +#define ALLOW_SYNCHRONIZE_CACHE GENMASK(8, 7)
> +#define ALLOW_TEST_UNIT_READY BIT(6)
> +#define ALLOW_UNMAP BIT(5)
> +#define ALLOW_VERIFY BIT(4)
> +#define ALLOW_WRITE_CMD_ALL GENMASK(3, 1) /* write_6/10/16 */
> +
> +#define ALLOW_TRANS_VH_DEFAULT (ALLOW_INQUIRY | ALLOW_MODE_SELECT | \
> + ALLOW_MODE_SENSE | ALLOW_PRE_FETCH | \
> + ALLOW_READ_CMD_ALL | ALLOW_READ_BUFFER | \
> + ALLOW_READ_CAPACITY | ALLOW_REPORT_LUNS | \
> + ALLOW_REQUEST_SENSE | ALLOW_SYNCHRONIZE_CACHE | \
> + ALLOW_TEST_UNIT_READY | ALLOW_UNMAP | \
> + ALLOW_VERIFY | ALLOW_WRITE_CMD_ALL)
> +
> +#define HCI_MH_ALLOWABLE_TRAN_OF_VH 0x30C
> +#define HCI_MH_IID_IN_TASK_TAG 0X308
> +
> enum {
> UNIPRO_L1_5 = 0,/* PHY Adapter */
> UNIPRO_L2, /* Data Link */
> @@ -174,6 +212,20 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs)
> return 0;
> }
>
> +static int exynosauto_ufs_post_hce_enable(struct exynos_ufs *ufs)
> +{
> + struct ufs_hba *hba = ufs->hba;
> +
> + /* Enable Virtual Host #1 */
> + ufshcd_rmwl(hba, MHCTRL_EN_VH_MASK, MHCTRL_EN_VH(1), MHCTRL);
> + /* Default VH Transfer permissions */
> + hci_writel(ufs, ALLOW_TRANS_VH_DEFAULT, HCI_MH_ALLOWABLE_TRAN_OF_VH);
> + /* IID information is replaced in TASKTAG[7:5] instead of IID in UCD */
> + hci_writel(ufs, 0x1, HCI_MH_IID_IN_TASK_TAG);
> +
Reviewed-by : Inki Dae <inki.dae@samsung.com>
Thanks,
Inki Dae
next prev parent reply other threads:[~2021-10-18 5:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20211007081133epcas2p31f973709609d82dbbc76bd7b51232cb2@epcas2p3.samsung.com>
2021-10-07 8:09 ` [PATCH v4 00/16] introduce exynosauto v9 ufs driver Chanho Park
2021-10-07 8:09 ` [PATCH v4 01/16] scsi: ufs: add quirk to handle broken UIC command Chanho Park
2021-10-14 10:48 ` Avri Altman
2021-10-07 8:09 ` [PATCH v4 02/16] scsi: ufs: add quirk to enable host controller without ph configuration Chanho Park
2021-10-14 10:49 ` Avri Altman
2021-10-07 8:09 ` [PATCH v4 03/16] scsi: ufs: ufs-exynos: change pclk available max value Chanho Park
2021-10-07 8:09 ` [PATCH v4 04/16] scsi: ufs: ufs-exynos: simplify drv_data retrieval Chanho Park
2021-10-07 8:09 ` [PATCH v4 05/16] scsi: ufs: ufs-exynos: add refclkout_stop control Chanho Park
2021-10-07 8:09 ` [PATCH v4 06/16] scsi: ufs: ufs-exynos: add setup_clocks callback Chanho Park
2021-10-07 8:09 ` [PATCH v4 07/16] scsi: ufs: ufs-exynos: correct timeout value setting registers Chanho Park
2021-10-14 12:12 ` Avri Altman
2021-10-15 9:53 ` Chanho Park
2021-10-07 8:09 ` [PATCH v4 08/16] scsi: ufs: ufs-exynos: support custom version of ufs_hba_variant_ops Chanho Park
2021-10-07 8:09 ` [PATCH v4 09/16] scsi: ufs: ufs-exynos: add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option Chanho Park
2021-10-07 8:09 ` [PATCH v4 10/16] scsi: ufs: ufs-exynos: factor out priv data init Chanho Park
2021-10-07 8:09 ` [PATCH v4 11/16] scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks Chanho Park
2021-10-07 8:09 ` [PATCH v4 12/16] scsi: ufs: ufs-exynos: support exynosauto v9 ufs driver Chanho Park
2021-10-07 8:09 ` [PATCH v4 13/16] dt-bindings: ufs: exynos-ufs: add io-coherency property Chanho Park
2021-10-15 13:50 ` Rob Herring
2021-10-18 0:26 ` Chanho Park
2021-10-18 13:23 ` Rob Herring
2021-10-18 11:07 ` Chanho Park
2021-10-07 8:09 ` [PATCH v4 14/16] scsi: ufs: ufs-exynos: multi-host configuration for exynosauto Chanho Park
2021-10-14 18:51 ` Avri Altman
2021-10-15 11:44 ` Chanho Park
2021-10-18 5:34 ` Inki Dae [this message]
2021-10-07 8:09 ` [PATCH v4 15/16] scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host Chanho Park
2021-10-14 19:03 ` Avri Altman
2021-10-15 12:13 ` Chanho Park
2021-10-07 8:09 ` [PATCH v4 16/16] dt-bindings: ufs: exynos-ufs: add exynosautov9 compatible Chanho Park
2021-10-14 10:04 ` [PATCH v4 00/16] introduce exynosauto v9 ufs driver Avri Altman
2021-10-15 11:57 ` Chanho Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1891546521.01634536081285.JavaMail.epsvc@epcpadp4 \
--to=inki.dae@samsung.com \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=cang@codeaurora.org \
--cc=chanho61.park@samsung.com \
--cc=cpgs@samsung.com \
--cc=goodjob.kwon@samsung.com \
--cc=hch@infradead.org \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=jh80.chung@samsung.com \
--cc=krzysztof.kozlowski@canonical.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sowon.na@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox