From: Stanley Chu <stanley.chu@mediatek.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: <linux-scsi@vger.kernel.org>, <martin.petersen@oracle.com>,
<avri.altman@wdc.com>, <alim.akhtar@samsung.com>,
<jejb@linux.ibm.com>, <beanhuo@micron.com>, <cang@codeaurora.org>,
<satyat@google.com>, <matthias.bgg@gmail.com>,
<linux-mediatek@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-fscrypt@vger.kernel.org>,
<kuohong.wang@mediatek.com>, <peter.wang@mediatek.com>,
<chun-hung.wu@mediatek.com>, <andy.teng@mediatek.com>,
<light.hsieh@mediatek.com>
Subject: Re: [RFC PATCH v1] scsi: ufs-mediatek: add inline encryption support
Date: Wed, 4 Mar 2020 10:25:36 +0800 [thread overview]
Message-ID: <1583288736.14250.2.camel@mtksdccf07> (raw)
In-Reply-To: <20200302180231.GB98133@gmail.com>
Hi Eric,
On Mon, 2020-03-02 at 10:02 -0800, Eric Biggers wrote:
> On Mon, Mar 02, 2020 at 05:11:38PM +0800, Stanley Chu wrote:
> > Add inline encryption support to ufs-mediatek.
> >
> > The standards-compliant parts, such as querying the crypto capabilities
> > and enabling crypto for individual UFS requests, are already handled by
> > ufshcd-crypto.c, which itself is wired into the blk-crypto framework.
> >
> > However MediaTek UFS host requires a vendor-specific hce_enable operation
> > to allow crypto-related registers being accessed normally in kernel.
> > After this step, MediaTek UFS host can work as standard-compliant host
> > for inline-encryption related functions.
> >
> > This patch is rebased to the latest wip-inline-encryption branch in
> > Eric Biggers's git:
> > https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/
>
> Please don't use a random work-in-progress branch from my git repository (which
> hasn't been updated to the v7 patchset yet and will be rebased); use instead:
>
> Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
> Tag: inline-encryption-v7
>
> Also, this patch doesn't apply to either branch anyway:
>
> Applying: scsi: ufs-mediatek: add inline encryption support
> Using index info to reconstruct a base tree...
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.c:15
> error: drivers/scsi/ufs/ufs-mediatek.c: patch does not apply
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.h:58
> error: drivers/scsi/ufs/ufs-mediatek.h: patch does not apply
> error: Did you hand edit your patch?
Sorry for this.
I rebased this patch as RFC v2 to below tag,
Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
Tag: inline-encryption-v7
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> > index 53eae5fe2ade..12d01fd3d5e1 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> > @@ -15,6 +15,7 @@
> > #include <linux/soc/mediatek/mtk_sip_svc.h>
> >
> > #include "ufshcd.h"
> > +#include "ufshcd-crypto.h"
> > #include "ufshcd-pltfrm.h"
> > #include "ufs_quirks.h"
> > #include "unipro.h"
> > @@ -24,6 +25,9 @@
> > arm_smccc_smc(MTK_SIP_UFS_CONTROL, \
> > cmd, val, 0, 0, 0, 0, 0, &(res))
> >
> > +#define ufs_mtk_crypto_ctrl(res, enable) \
> > + ufs_mtk_smc(UFS_MTK_SIP_CRYPTO_CTRL, enable, res)
> > +
> > #define ufs_mtk_ref_clk_notify(on, res) \
> > ufs_mtk_smc(UFS_MTK_SIP_REF_CLK_NOTIFICATION, on, res)
> >
> > @@ -66,7 +70,27 @@ static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)
> > }
> > }
> >
> > -static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > +static void ufs_mtk_crypto_enable(struct ufs_hba *hba)
> > +{
> > + struct arm_smccc_res res;
> > +
> > + ufs_mtk_crypto_ctrl(res, 1);
> > + if (res.a0) {
> > + dev_info(hba->dev, "%s: crypto enable failed, err: %lu\n",
> > + __func__, res.a0);
> > + }
> > +}
> > +
> > +static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
> > + enum ufs_notify_change_status status)
> > +{
> > + if (status == PRE_CHANGE && ufshcd_hba_is_crypto_supported(hba))
> > + ufs_mtk_crypto_enable(hba);
> > +
> > + return 0;
> > +}
> > +
> > +int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > {
> > struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> > struct device *dev = hba->dev;
> > @@ -494,6 +518,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
> > .name = "mediatek.ufshci",
> > .init = ufs_mtk_init,
> > .setup_clocks = ufs_mtk_setup_clocks,
> > + .hce_enable_notify = ufs_mtk_hce_enable_notify,
> > .link_startup_notify = ufs_mtk_link_startup_notify,
> > .pwr_change_notify = ufs_mtk_pwr_change_notify,
> > .apply_dev_quirks = ufs_mtk_apply_dev_quirks,
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
> > index fccdd979d6fb..5ebaa59898bf 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.h
> > +++ b/drivers/scsi/ufs/ufs-mediatek.h
> > @@ -58,6 +58,7 @@
> > */
> > #define MTK_SIP_UFS_CONTROL MTK_SIP_SMC_CMD(0x276)
> > #define UFS_MTK_SIP_DEVICE_RESET BIT(1)
> > +#define UFS_MTK_SIP_CRYPTO_CTRL BIT(2)
> > #define UFS_MTK_SIP_REF_CLK_NOTIFICATION BIT(3)
>
> But if this is all that's needed to get inline crypto working with Mediatek UFS,
> that's great news.
Thanks for your review :)
Stanley Chu
>
> Thanks!
>
> - Eric
WARNING: multiple messages have this Message-ID (diff)
From: Stanley Chu <stanley.chu@mediatek.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
andy.teng@mediatek.com, jejb@linux.ibm.com,
chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com,
linux-kernel@vger.kernel.org, light.hsieh@mediatek.com,
satyat@google.com, avri.altman@wdc.com,
linux-fscrypt@vger.kernel.org, cang@codeaurora.org,
linux-mediatek@lists.infradead.org, peter.wang@mediatek.com,
alim.akhtar@samsung.com, matthias.bgg@gmail.com,
linux-arm-kernel@lists.infradead.org, beanhuo@micron.com
Subject: Re: [RFC PATCH v1] scsi: ufs-mediatek: add inline encryption support
Date: Wed, 4 Mar 2020 10:25:36 +0800 [thread overview]
Message-ID: <1583288736.14250.2.camel@mtksdccf07> (raw)
In-Reply-To: <20200302180231.GB98133@gmail.com>
Hi Eric,
On Mon, 2020-03-02 at 10:02 -0800, Eric Biggers wrote:
> On Mon, Mar 02, 2020 at 05:11:38PM +0800, Stanley Chu wrote:
> > Add inline encryption support to ufs-mediatek.
> >
> > The standards-compliant parts, such as querying the crypto capabilities
> > and enabling crypto for individual UFS requests, are already handled by
> > ufshcd-crypto.c, which itself is wired into the blk-crypto framework.
> >
> > However MediaTek UFS host requires a vendor-specific hce_enable operation
> > to allow crypto-related registers being accessed normally in kernel.
> > After this step, MediaTek UFS host can work as standard-compliant host
> > for inline-encryption related functions.
> >
> > This patch is rebased to the latest wip-inline-encryption branch in
> > Eric Biggers's git:
> > https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/
>
> Please don't use a random work-in-progress branch from my git repository (which
> hasn't been updated to the v7 patchset yet and will be rebased); use instead:
>
> Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
> Tag: inline-encryption-v7
>
> Also, this patch doesn't apply to either branch anyway:
>
> Applying: scsi: ufs-mediatek: add inline encryption support
> Using index info to reconstruct a base tree...
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.c:15
> error: drivers/scsi/ufs/ufs-mediatek.c: patch does not apply
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.h:58
> error: drivers/scsi/ufs/ufs-mediatek.h: patch does not apply
> error: Did you hand edit your patch?
Sorry for this.
I rebased this patch as RFC v2 to below tag,
Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
Tag: inline-encryption-v7
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> > index 53eae5fe2ade..12d01fd3d5e1 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> > @@ -15,6 +15,7 @@
> > #include <linux/soc/mediatek/mtk_sip_svc.h>
> >
> > #include "ufshcd.h"
> > +#include "ufshcd-crypto.h"
> > #include "ufshcd-pltfrm.h"
> > #include "ufs_quirks.h"
> > #include "unipro.h"
> > @@ -24,6 +25,9 @@
> > arm_smccc_smc(MTK_SIP_UFS_CONTROL, \
> > cmd, val, 0, 0, 0, 0, 0, &(res))
> >
> > +#define ufs_mtk_crypto_ctrl(res, enable) \
> > + ufs_mtk_smc(UFS_MTK_SIP_CRYPTO_CTRL, enable, res)
> > +
> > #define ufs_mtk_ref_clk_notify(on, res) \
> > ufs_mtk_smc(UFS_MTK_SIP_REF_CLK_NOTIFICATION, on, res)
> >
> > @@ -66,7 +70,27 @@ static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)
> > }
> > }
> >
> > -static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > +static void ufs_mtk_crypto_enable(struct ufs_hba *hba)
> > +{
> > + struct arm_smccc_res res;
> > +
> > + ufs_mtk_crypto_ctrl(res, 1);
> > + if (res.a0) {
> > + dev_info(hba->dev, "%s: crypto enable failed, err: %lu\n",
> > + __func__, res.a0);
> > + }
> > +}
> > +
> > +static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
> > + enum ufs_notify_change_status status)
> > +{
> > + if (status == PRE_CHANGE && ufshcd_hba_is_crypto_supported(hba))
> > + ufs_mtk_crypto_enable(hba);
> > +
> > + return 0;
> > +}
> > +
> > +int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > {
> > struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> > struct device *dev = hba->dev;
> > @@ -494,6 +518,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
> > .name = "mediatek.ufshci",
> > .init = ufs_mtk_init,
> > .setup_clocks = ufs_mtk_setup_clocks,
> > + .hce_enable_notify = ufs_mtk_hce_enable_notify,
> > .link_startup_notify = ufs_mtk_link_startup_notify,
> > .pwr_change_notify = ufs_mtk_pwr_change_notify,
> > .apply_dev_quirks = ufs_mtk_apply_dev_quirks,
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
> > index fccdd979d6fb..5ebaa59898bf 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.h
> > +++ b/drivers/scsi/ufs/ufs-mediatek.h
> > @@ -58,6 +58,7 @@
> > */
> > #define MTK_SIP_UFS_CONTROL MTK_SIP_SMC_CMD(0x276)
> > #define UFS_MTK_SIP_DEVICE_RESET BIT(1)
> > +#define UFS_MTK_SIP_CRYPTO_CTRL BIT(2)
> > #define UFS_MTK_SIP_REF_CLK_NOTIFICATION BIT(3)
>
> But if this is all that's needed to get inline crypto working with Mediatek UFS,
> that's great news.
Thanks for your review :)
Stanley Chu
>
> Thanks!
>
> - Eric
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
WARNING: multiple messages have this Message-ID (diff)
From: Stanley Chu <stanley.chu@mediatek.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
andy.teng@mediatek.com, jejb@linux.ibm.com,
chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com,
linux-kernel@vger.kernel.org, light.hsieh@mediatek.com,
satyat@google.com, avri.altman@wdc.com,
linux-fscrypt@vger.kernel.org, cang@codeaurora.org,
linux-mediatek@lists.infradead.org, peter.wang@mediatek.com,
alim.akhtar@samsung.com, matthias.bgg@gmail.com,
linux-arm-kernel@lists.infradead.org, beanhuo@micron.com
Subject: Re: [RFC PATCH v1] scsi: ufs-mediatek: add inline encryption support
Date: Wed, 4 Mar 2020 10:25:36 +0800 [thread overview]
Message-ID: <1583288736.14250.2.camel@mtksdccf07> (raw)
In-Reply-To: <20200302180231.GB98133@gmail.com>
Hi Eric,
On Mon, 2020-03-02 at 10:02 -0800, Eric Biggers wrote:
> On Mon, Mar 02, 2020 at 05:11:38PM +0800, Stanley Chu wrote:
> > Add inline encryption support to ufs-mediatek.
> >
> > The standards-compliant parts, such as querying the crypto capabilities
> > and enabling crypto for individual UFS requests, are already handled by
> > ufshcd-crypto.c, which itself is wired into the blk-crypto framework.
> >
> > However MediaTek UFS host requires a vendor-specific hce_enable operation
> > to allow crypto-related registers being accessed normally in kernel.
> > After this step, MediaTek UFS host can work as standard-compliant host
> > for inline-encryption related functions.
> >
> > This patch is rebased to the latest wip-inline-encryption branch in
> > Eric Biggers's git:
> > https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/
>
> Please don't use a random work-in-progress branch from my git repository (which
> hasn't been updated to the v7 patchset yet and will be rebased); use instead:
>
> Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
> Tag: inline-encryption-v7
>
> Also, this patch doesn't apply to either branch anyway:
>
> Applying: scsi: ufs-mediatek: add inline encryption support
> Using index info to reconstruct a base tree...
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.c:15
> error: drivers/scsi/ufs/ufs-mediatek.c: patch does not apply
> error: patch failed: drivers/scsi/ufs/ufs-mediatek.h:58
> error: drivers/scsi/ufs/ufs-mediatek.h: patch does not apply
> error: Did you hand edit your patch?
Sorry for this.
I rebased this patch as RFC v2 to below tag,
Repo: https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git
Tag: inline-encryption-v7
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> > index 53eae5fe2ade..12d01fd3d5e1 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> > @@ -15,6 +15,7 @@
> > #include <linux/soc/mediatek/mtk_sip_svc.h>
> >
> > #include "ufshcd.h"
> > +#include "ufshcd-crypto.h"
> > #include "ufshcd-pltfrm.h"
> > #include "ufs_quirks.h"
> > #include "unipro.h"
> > @@ -24,6 +25,9 @@
> > arm_smccc_smc(MTK_SIP_UFS_CONTROL, \
> > cmd, val, 0, 0, 0, 0, 0, &(res))
> >
> > +#define ufs_mtk_crypto_ctrl(res, enable) \
> > + ufs_mtk_smc(UFS_MTK_SIP_CRYPTO_CTRL, enable, res)
> > +
> > #define ufs_mtk_ref_clk_notify(on, res) \
> > ufs_mtk_smc(UFS_MTK_SIP_REF_CLK_NOTIFICATION, on, res)
> >
> > @@ -66,7 +70,27 @@ static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)
> > }
> > }
> >
> > -static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > +static void ufs_mtk_crypto_enable(struct ufs_hba *hba)
> > +{
> > + struct arm_smccc_res res;
> > +
> > + ufs_mtk_crypto_ctrl(res, 1);
> > + if (res.a0) {
> > + dev_info(hba->dev, "%s: crypto enable failed, err: %lu\n",
> > + __func__, res.a0);
> > + }
> > +}
> > +
> > +static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
> > + enum ufs_notify_change_status status)
> > +{
> > + if (status == PRE_CHANGE && ufshcd_hba_is_crypto_supported(hba))
> > + ufs_mtk_crypto_enable(hba);
> > +
> > + return 0;
> > +}
> > +
> > +int ufs_mtk_bind_mphy(struct ufs_hba *hba)
> > {
> > struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> > struct device *dev = hba->dev;
> > @@ -494,6 +518,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
> > .name = "mediatek.ufshci",
> > .init = ufs_mtk_init,
> > .setup_clocks = ufs_mtk_setup_clocks,
> > + .hce_enable_notify = ufs_mtk_hce_enable_notify,
> > .link_startup_notify = ufs_mtk_link_startup_notify,
> > .pwr_change_notify = ufs_mtk_pwr_change_notify,
> > .apply_dev_quirks = ufs_mtk_apply_dev_quirks,
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
> > index fccdd979d6fb..5ebaa59898bf 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.h
> > +++ b/drivers/scsi/ufs/ufs-mediatek.h
> > @@ -58,6 +58,7 @@
> > */
> > #define MTK_SIP_UFS_CONTROL MTK_SIP_SMC_CMD(0x276)
> > #define UFS_MTK_SIP_DEVICE_RESET BIT(1)
> > +#define UFS_MTK_SIP_CRYPTO_CTRL BIT(2)
> > #define UFS_MTK_SIP_REF_CLK_NOTIFICATION BIT(3)
>
> But if this is all that's needed to get inline crypto working with Mediatek UFS,
> that's great news.
Thanks for your review :)
Stanley Chu
>
> Thanks!
>
> - Eric
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-03-04 2:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 9:11 [RFC PATCH v1] scsi: ufs-mediatek: add inline encryption support Stanley Chu
2020-03-02 9:11 ` Stanley Chu
2020-03-02 9:11 ` Stanley Chu
2020-03-02 18:02 ` Eric Biggers
2020-03-02 18:02 ` Eric Biggers
2020-03-02 18:02 ` Eric Biggers
2020-03-04 2:25 ` Stanley Chu [this message]
2020-03-04 2:25 ` Stanley Chu
2020-03-04 2:25 ` Stanley Chu
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=1583288736.14250.2.camel@mtksdccf07 \
--to=stanley.chu@mediatek.com \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=cang@codeaurora.org \
--cc=chun-hung.wu@mediatek.com \
--cc=ebiggers@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=kuohong.wang@mediatek.com \
--cc=light.hsieh@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=peter.wang@mediatek.com \
--cc=satyat@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.