This patch is to declare override_cqe_ocs callback to
override OCS value.
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
drivers/ufs/core/ufshcd-priv.h | 9 +++++++++
drivers/ufs/core/ufshcd.c | 4 +++-
include/ufs/ufshcd.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index ce36154..be593d1 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -275,6 +275,15 @@ static inline int ufshcd_mcq_vops_config_esi(struct ufs_hba *hba)
return -EOPNOTSUPP;
}
+static inline enum utp_ocs ufshcd_vops_override_cqe_ocs(struct ufs_hba *hba,
+ enum utp_ocs ocs)
+{
+ if (hba->vops && hba->vops->override_cqe_ocs)
+ return hba->vops->override_cqe_ocs(hba, ocs);
+
+ return ocs;
+}
+
extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
/**
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 0dd2605..83a1870 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -825,7 +825,9 @@ static enum utp_ocs ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp,
struct cq_entry *cqe)
{
if (cqe)
- return le32_to_cpu(cqe->status) & MASK_OCS;
+ return ufshcd_vops_override_cqe_ocs(hba,
+ le32_to_cpu(cqe->status) &
+ MASK_OCS);
return lrbp->utr_descriptor_ptr->header.ocs & MASK_OCS;
}
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index a43b142..64444fb 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -382,6 +382,7 @@ struct ufs_hba_variant_ops {
int (*get_outstanding_cqs)(struct ufs_hba *hba,
unsigned long *ocqs);
int (*config_esi)(struct ufs_hba *hba);
+ enum utp_ocs (*override_cqe_ocs)(struct ufs_hba *hba, enum utp_ocs);
};
/* clock gating state */
--
2.7.4
Hi Kiwoong,
kernel test robot noticed the following build errors:
[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next krzk/for-next linus/master v6.11-rc4 next-20240822]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kiwoong-Kim/scsi-ufs-core-introduce-override_cqe_ocs/20240821-144404
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/895b69ac1e938490cd1d17b5f82b6f730bcd82c2.1724222619.git.kwmad.kim%40samsung.com
patch subject: [PATCH v1 1/2] scsi: ufs: core: introduce override_cqe_ocs
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20240822/202408221823.jnozM7Ys-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408221823.jnozM7Ys-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408221823.jnozM7Ys-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/ufs/core/ufshcd.c:828:39: error: use of undeclared identifier 'hba'
828 | return ufshcd_vops_override_cqe_ocs(hba,
| ^
drivers/ufs/core/ufshcd.c:10344:44: warning: shift count >= width of type [-Wshift-count-overflow]
10344 | if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64)))
| ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
| ^ ~~~
1 warning and 1 error generated.
vim +/hba +828 drivers/ufs/core/ufshcd.c
814
815 /**
816 * ufshcd_get_tr_ocs - Get the UTRD Overall Command Status
817 * @lrbp: pointer to local command reference block
818 * @cqe: pointer to the completion queue entry
819 *
820 * This function is used to get the OCS field from UTRD
821 *
822 * Return: the OCS field in the UTRD.
823 */
824 static enum utp_ocs ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp,
825 struct cq_entry *cqe)
826 {
827 if (cqe)
> 828 return ufshcd_vops_override_cqe_ocs(hba,
829 le32_to_cpu(cqe->status) &
830 MASK_OCS);
831
832 return lrbp->utr_descriptor_ptr->header.ocs & MASK_OCS;
833 }
834
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.