> +static bool ufshpb_is_hpb_rsp_valid(struct ufs_hba *hba,
> +                                        struct ufshcd_lrb *lrbp,
> +                                        struct utp_hpb_rsp *rsp_field)
> +{
> +       if (be16_to_cpu(rsp_field->sense_data_len) != DEV_SENSE_SEG_LEN ||
> +           rsp_field->desc_type != DEV_DES_TYPE ||
> +           rsp_field->additional_len != DEV_ADDITIONAL_LEN ||
> +           rsp_field->active_rgn_cnt > MAX_ACTIVE_NUM ||
> +           rsp_field->inactive_rgn_cnt > MAX_INACTIVE_NUM ||
> +           (rsp_field->hpb_op == HPB_RSP_REQ_REGION_UPDATE &&
> +            !rsp_field->active_rgn_cnt && !rsp_field->inactive_rgn_cnt))
> +               return false;
> +
> +       /* we cannot access HPB from other LU */
> +       if (lrbp->lun != rsp_field->lun)
> +               return false;
Why not?
Clearly this against the spec which allows to attach hpb sense crossed luns

> +
> +       if (!ufshpb_is_general_lun(lrbp->lun)) {
> +               dev_warn(hba->dev, "ufshpb: lun(%d) not supported\n",
> +                        lrbp->lun);
> +               return false;
> +       }
> +
> +       return true;
> +}




> +void ufshpb_rsp_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> +{
> +       struct ufshpb_lu *hpb = ufshpb_get_hpb_data(lrbp->cmd->device);
> +       struct utp_hpb_rsp *rsp_field;
> +       int data_seg_len;
> +
> +       if (!hpb)
> +               return;
Ditto

Reply via email to