mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Asutosh Das (asd)" <quic_asutoshd@quicinc.com>
To: Bean Huo <huobean@gmail.com>, <quic_nguyenb@quicinc.com>,
	<quic_xiaosenh@quicinc.com>, <stanley.chu@mediatek.com>,
	<adrian.hunter@intel.com>, <bvanassche@acm.org>,
	<avri.altman@wdc.com>, <mani@kernel.org>, <quic_cang@quicinc.com>,
	<beanhuo@micron.com>, <martin.petersen@oracle.com>,
	<linux-scsi@vger.kernel.org>
Cc: <linux-arm-msm@vger.kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v3 1/4] ufs: core: prepare ufs for multi circular queue support
Date: Wed, 7 Sep 2022 20:00:56 -0700	[thread overview]
Message-ID: <df32bbd5-4109-903b-c7ba-7777a298f5aa@quicinc.com> (raw)
In-Reply-To: <6e594dc2ce6103884b7768c2fed55eabec0d5ed8.camel@gmail.com>

Hello Bean
Thanks for your comments. Responses inline.

On 9/5/2022 5:26 AM, Bean Huo wrote:
> Asutosh,
> 
> 
[...]
> 
>>   static inline
>> -void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
>> +void ufshcd_send_command(struct ufs_hba *hba, struct ufshcd_lrb
>> *lrbp)
>>   {
>> -       struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
>> +       int task_tag = lrbp->task_tag;
>>          unsigned long flags;
>>   
>>          lrbp->issue_time_stamp = ktime_get();
>>          lrbp->compl_time_stamp = ktime_set(0, 0);
>> -       ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
>> +       ufshcd_add_command_trace(hba, lrbp, UFS_CMD_SEND);
>>          ufshcd_clk_scaling_start_busy(hba);
>>          if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
>>                  ufshcd_start_monitor(hba, lrbp);
>> @@ -2553,9 +2554,10 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct
>> ufshcd_lrb *lrbp, u8 upiu_flags)
>>          /* command descriptor fields */
>>          ucd_req_ptr->header.dword_0 = UPIU_HEADER_DWORD(
>>                                  UPIU_TRANSACTION_COMMAND, upiu_flags,
>> -                               lrbp->lun, lrbp->task_tag);
>> +                               lrbp->lun, lrbp->task_tag & 0xff);
>>          ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
>> -                               UPIU_COMMAND_SET_TYPE_SCSI, 0, 0, 0);
>> +                               UPIU_COMMAND_SET_TYPE_SCSI, 0, 0,
>> +                               (lrbp->task_tag & 0xf00) << 4);
>>   
> 
> Are you sure here "(lrbp->task_tag & 0xf00) << 4" is correct?
> 
EXT_IID is the higher nibble in DWORD1. So this looks correct to me.

COMMAND UPIU
0 	    1 	  2 	3
xx000001b Flags LUN Task Tag
4 			5 	6 	7
IID Command Set Type Reserved Reserved EXT_IID | Reserved
> 
> this will overwrite other fields, see UPIU_HEADER_DWORD:
> 
> #define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
>                          cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
>                           (byte1 << 8) | (byte0))
> 
> 
> 
>>
>>   
>> -       ufshcd_send_command(hba, tag);
>> +       ufshcd_send_command(hba, lrbp);
>>          err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
>>          ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR :
>> UFS_QUERY_COMP,
>>                                      (struct utp_upiu_req *)lrbp-
>>> ucd_rsp_ptr);
>> @@ -4513,6 +4515,7 @@ int ufshcd_make_hba_operational(struct ufs_hba
>> *hba)
>>                          REG_UTP_TRANSFER_REQ_LIST_BASE_L);
>>          ufshcd_writel(hba, upper_32_bits(hba->utrdl_dma_addr),
>>                          REG_UTP_TRANSFER_REQ_LIST_BASE_H);
>> +
>>          ufshcd_writel(hba, lower_32_bits(hba->utmrdl_dma_addr),
>>                          REG_UTP_TASK_REQ_LIST_BASE_L);
>>          ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr),
>> @@ -5320,6 +5323,32 @@ static void ufshcd_release_scsi_cmd(struct
>> ufs_hba *hba,
>>          ufshcd_clk_scaling_update_busy(hba);
>>   }
>>   
>> +void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag)
> 
> This function does only complete one task. What does cqe stand for?
> 
CQE - Completion Queue Entry. The term 'task' is used for TM commands in 
scsi, hence there was a comment to change it to CQE.

>> +{
>> +       struct ufshcd_lrb *lrbp;
>> +       struct scsi_cmnd *cmd;
>> +
>> +       lrbp = &hba->lrb[task_tag];
>> +       lrbp->compl_time_stamp = ktime_get();
>> +       cmd = lrbp->cmd;
>> +       if (cmd) {
>> +               if (unlikely(ufshcd_should_inform_monitor(hba,
>> lrbp)))
>> +                       ufshcd_update_monitor(hba, lrbp);
>> +               ufshcd_add_command_trace(hba, lrbp, UFS_CMD_COMP);
>> +               cmd->result = ufshcd_transfer_rsp_status(hba, lrbp);
>> +               ufshcd_release_scsi_cmd(hba, lrbp);
>> +               /* Do not touch lrbp after scsi done */
>> +               scsi_done(cmd);
>> +       } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
>> +                  lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
>> +               if (hba->dev_cmd.complete) {
>> +                       ufshcd_add_command_trace(hba, lrbp,
>> UFS_DEV_COMP);
>> +                       complete(hba->dev_cmd.complete);
>> +                       ufshcd_clk_scaling_update_busy(hba);
>> +               }
>> +       }
>> +}
>> +
> 
> 
> Kind regards,
> Bean
> 


  reply	other threads:[~2022-09-08  3:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1662157846.git.quic_asutoshd@quicinc.com>
2022-09-02 22:41 ` Asutosh Das
2022-09-05 12:26   ` Bean Huo
2022-09-08  3:00     ` Asutosh Das (asd) [this message]
2022-09-08  8:23       ` Bean Huo
2022-09-08 21:58   ` Bart Van Assche
2022-09-09 22:48     ` Asutosh Das (asd)
2022-09-09 23:38       ` Bart Van Assche
2022-09-12 18:18         ` Asutosh Das (asd)
2022-09-02 22:41 ` [RFC PATCH v3 2/4] ufs: core: mcq: Adds Multi-Circular Queue support Asutosh Das
2022-09-05 13:48   ` Bean Huo
2022-09-08  3:01     ` Asutosh Das (asd)
2022-09-05 14:19   ` Bean Huo
2022-09-05 16:27   ` Bean Huo
2022-09-08  3:01     ` Asutosh Das (asd)
2022-09-08 22:02     ` Bart Van Assche
2022-09-08 23:21   ` Bart Van Assche
2022-09-02 22:41 ` [RFC PATCH v3 3/4] ufs: core: Add Event Specific Interrupt configuration vendor specific ops Asutosh Das
2022-09-02 22:41 ` [RFC PATCH v3 4/4] ufs: host: qcom: Add MCQ support Asutosh Das
2022-09-08 22:30   ` Bart Van Assche
2022-09-09 22:43     ` Asutosh Das (asd)

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=df32bbd5-4109-903b-c7ba-7777a298f5aa@quicinc.com \
    --to=quic_asutoshd@quicinc.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=huobean@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_xiaosenh@quicinc.com \
    --cc=stanley.chu@mediatek.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

all inboxes | Powered by JetHome®