mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	<manivannan.sadhasivam@linaro.org>, <alim.akhtar@samsung.com>,
	<avri.altman@wdc.com>, <bvanassche@acm.org>, <robh@kernel.org>,
	<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<andersson@kernel.org>, <konrad.dybcio@linaro.org>,
	<James.Bottomley@HansenPartnership.com>,
	<martin.petersen@oracle.com>, <agross@kernel.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<quic_narepall@quicinc.com>, <quic_nitirawa@quicinc.com>,
	Can Guo <quic_cang@quicinc.com>
Subject: Re: [PATCH V1 3/3] scsi: ufs: qcom: Add support for multiple ICE algorithms
Date: Tue, 29 Oct 2024 16:40:23 +0530	[thread overview]
Message-ID: <cb2ecd04-ae0b-40c3-ac3c-9bcb1bf46e7d@quicinc.com> (raw)
In-Reply-To: <517d5373-592a-4a79-8c79-14226ceacbce@wanadoo.fr>



On 06-Oct-24 1:03 AM, Christophe JAILLET wrote:
> Le 05/10/2024 à 08:43, Ram Kumar Dwivedi a écrit :
>> Add support for ICE algorithms for Qualcomm UFS V5.0 and above which
>> uses a pool of crypto cores for TX stream (UFS Write – Encryption)
>> and RX stream (UFS Read – Decryption).
>>
>> Using these algorithms, crypto cores can be dynamically allocated
>> to either RX stream or TX stream based on algorithm selected.
>> Qualcomm UFS controller supports three ICE algorithms:
>> Floor based algorithm, Static Algorithm and Instantaneous algorithm
>> to share crypto cores between TX and RX stream.
>>
>> Floor Based allocation is selected by default after power On or Reset.
>>
>> Co-developed-by: Naveen Kumar Goud Arepalli <quic_narepall@quicinc.com>
>> Signed-off-by: Naveen Kumar Goud Arepalli <quic_narepall@quicinc.com>
>> Co-developed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
>> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
>> Co-developed-by: Can Guo <quic_cang@quicinc.com>
>> Signed-off-by: Can Guo <quic_cang@quicinc.com>
>> Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
>> ---
>>   drivers/ufs/host/ufs-qcom.c | 232 ++++++++++++++++++++++++++++++++++++
>>   drivers/ufs/host/ufs-qcom.h |  38 +++++-
>>   2 files changed, 269 insertions(+), 1 deletion(-)
> 
> Hi,
> 
> a few nitpicks below.
> 
>>
>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
>> index 810e637047d0..c0ca835f13f3 100644
>> --- a/drivers/ufs/host/ufs-qcom.c
>> +++ b/drivers/ufs/host/ufs-qcom.c
>> @@ -105,6 +105,217 @@ static struct ufs_qcom_host *rcdev_to_ufs_host(struct reset_controller_dev *rcd)
>>   }
>>     #ifdef CONFIG_SCSI_UFS_CRYPTO
>> +/*
>> + * Default overrides:
>> + * There're 10 sets of settings for floor-based algorithm
>> + */
>> +static struct ice_alg2_config alg2_config[] = {
> 
> I think that this could easily be a const struct.
> 
>> +    {"G0", {5, 12, 0, 0, 32, 0}},
>> +    {"G1", {12, 5, 32, 0, 0, 0}},
>> +    {"G2", {6, 11, 4, 1, 32, 1}},
>> +    {"G3", {6, 11, 7, 1, 32, 1}},
>> +    {"G4", {7, 10, 11, 1, 32, 1}},
>> +    {"G5", {7, 10, 14, 1, 32, 1}},
>> +    {"G6", {8, 9, 18, 1, 32, 1}},
>> +    {"G7", {9, 8, 21, 1, 32, 1}},
>> +    {"G8", {10, 7, 24, 1, 32, 1}},
>> +    {"G9", {10, 7, 32, 1, 32, 1}},
>> +};
>> +
>> +/**
> 
> This does nor look like a kernel-doc. Just /* ?
> 
>> + * Refer struct ice_alg2_config
>> + */
>> +static inline void __get_alg2_grp_params(unsigned int *val, int *c, int *t)
>> +{
>> +    *c = ((val[0] << 8) | val[1] | (1 << 31));
>> +    *t = ((val[2] << 24) | (val[3] << 16) | (val[4] << 8) | val[5]);
>> +}
> 
> ...
> 
>> +/**
>> + * ufs_qcom_ice_config_alg2 - Floor based ICE algorithm
>> + *
>> + * @hba: host controller instance
>> + * Return: zero for success and non-zero in case of a failure.
>> + */
>> +static int ufs_qcom_ice_config_alg2(struct ufs_hba *hba)
>> +{
>> +    struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>> +    unsigned int reg = REG_UFS_MEM_ICE_ALG2_NUM_CORE_0;
>> +    /* 6 values for each group, refer struct ice_alg2_config */
>> +    unsigned int override_val[ICE_ALG2_NUM_PARAMS];
>> +    char name[8] = {0};
>> +    int i, ret;
>> +
>> +    ufshcd_writel(hba, FLOOR_BASED_ALG2, REG_UFS_MEM_ICE_CONFIG);
>> +    for (i = 0; i < ARRAY_SIZE(alg2_config); i++) {
>> +        int core = 0, task = 0;
>> +
>> +        if (host->ice_conf) {
>> +            snprintf(name, sizeof(name), "%s%d", "g", i);
> 
> Why not just "g%d"?
> 
>> +            ret = of_property_read_variable_u32_array(host->ice_conf,
>> +                                  name,
>> +                                  override_val,
>> +                                  ICE_ALG2_NUM_PARAMS,
>> +                                  ICE_ALG2_NUM_PARAMS);
> 
> ...
> 
> CJ
> 


Hi Christophe,

I have addressed your comments in latest patchset.

Thanks,
Ram.

  reply	other threads:[~2024-10-29 11:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-05  6:43 [PATCH V1 0/3] " Ram Kumar Dwivedi
2024-10-05  6:43 ` [PATCH V1 1/3] dt-bindings: ufs: qcom: Document ice configuration table Ram Kumar Dwivedi
2024-10-05 14:24   ` Rob Herring (Arm)
2024-10-29 10:55     ` Ram Kumar Dwivedi
2024-10-05 14:37   ` Rob Herring
2024-10-05 19:15   ` Eric Biggers
2024-10-29 11:08     ` Ram Kumar Dwivedi
2024-10-06  8:31   ` Krzysztof Kozlowski
2024-10-05  6:43 ` [PATCH V1 2/3] arm64: dts: qcom: sm8650: Add ICE algorithm entries Ram Kumar Dwivedi
2024-10-06  8:32   ` Krzysztof Kozlowski
2024-10-29 11:06     ` Ram Kumar Dwivedi
2024-10-29 11:23       ` Krzysztof Kozlowski
2024-10-05  6:43 ` [PATCH V1 3/3] scsi: ufs: qcom: Add support for multiple ICE algorithms Ram Kumar Dwivedi
2024-10-05 19:33   ` Christophe JAILLET
2024-10-29 11:10     ` Ram Kumar Dwivedi [this message]
2024-10-06  7:14   ` kernel test robot

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=cb2ecd04-ae0b-40c3-ac3c-9bcb1bf46e7d@quicinc.com \
    --to=quic_rdwivedi@quicinc.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=agross@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andersson@kernel.org \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_narepall@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®