public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
       [not found] <CGME20240812065927epcas2p4ace98e8757a76e62efa3165de719408a@epcas2p4.samsung.com>
@ 2024-08-12  7:01 ` Kiwoong Kim
  2024-08-12 15:41   ` Bean Huo
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kiwoong Kim @ 2024-08-12  7:01 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, bvanassche,
	jejb, martin.petersen, beanhuo, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, kwangwon.min, junwoo80.lee, wkon.kim
  Cc: Kiwoong Kim

UFSHCI defines OCS values but doesn't specify what exact
conditions raise them. E.g. when some commands are nullified
or cleaned up, Exynos host reposts OCS_ABORT. Even if
an OEM wants to issue them again, not fail, current UFS driver
fails them because it set command result to DID_ABORT.

So I think it needs another callback to replace the original OCS
value with the value that works the way you want.

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..4dec6eb 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);
+
+	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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
  2024-08-12  7:01 ` [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs Kiwoong Kim
@ 2024-08-12 15:41   ` Bean Huo
  2024-08-12 17:12     ` Bart Van Assche
  2024-08-12 17:29   ` kernel test robot
  2024-08-13  3:24   ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Bean Huo @ 2024-08-12 15:41 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	bvanassche, jejb, martin.petersen, beanhuo, adrian.hunter,
	h10.kim, hy50.seo, sh425.lee, kwangwon.min, junwoo80.lee,
	wkon.kim

On Mon, 2024-08-12 at 16:01 +0900, Kiwoong Kim wrote:
> UFSHCI defines OCS values but doesn't specify what exact
> conditions raise them. E.g. when some commands are nullified
> or cleaned up, Exynos host reposts OCS_ABORT. Even if
> an OEM wants to issue them again, not fail, current UFS driver
> fails them because it set command result to DID_ABORT.
> 
> So I think it needs another callback to replace the original OCS
> value with the value that works the way you want.
> 
I'm not clear on OCS was initiated by UFSHCI, but could you explain why
it can't be altered within UFSHCI?



> 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..4dec6eb 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);

it is useless until you should introudce an usage case.


Kind regards,
Bean

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
  2024-08-12 15:41   ` Bean Huo
@ 2024-08-12 17:12     ` Bart Van Assche
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2024-08-12 17:12 UTC (permalink / raw)
  To: Bean Huo, Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar,
	avri.altman, jejb, martin.petersen, beanhuo, adrian.hunter,
	h10.kim, hy50.seo, sh425.lee, kwangwon.min, junwoo80.lee,
	wkon.kim

On 8/12/24 8:41 AM, Bean Huo wrote:
> On Mon, 2024-08-12 at 16:01 +0900, Kiwoong Kim wrote:
>> +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);
> 
> it is useless until you should introduce an usage case.

Indeed. If a new callback is introduced, a user for that callback should
be introduced in the same patch series.

Thanks,

Bart.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
  2024-08-12  7:01 ` [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs Kiwoong Kim
  2024-08-12 15:41   ` Bean Huo
@ 2024-08-12 17:29   ` kernel test robot
  2024-08-13  3:24   ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-08-12 17:29 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	bvanassche, jejb, martin.petersen, beanhuo, adrian.hunter,
	h10.kim, hy50.seo, sh425.lee, kwangwon.min, junwoo80.lee,
	wkon.kim
  Cc: oe-kbuild-all, Kiwoong Kim

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 linus/master v6.11-rc3 next-20240812]
[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/20240812-151156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/1723446114-153235-1-git-send-email-kwmad.kim%40samsung.com
patch subject: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
config: arc-randconfig-002-20240812 (https://download.01.org/0day-ci/archive/20240812/202408122344.dvhCpFj0-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240812/202408122344.dvhCpFj0-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/202408122344.dvhCpFj0-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/ufs/core/ufshcd.c:31:
   drivers/ufs/core/ufshcd-priv.h: In function 'ufshcd_vops_override_cqe_ocs':
>> drivers/ufs/core/ufshcd-priv.h:282:24: error: too few arguments to function 'hba->vops->override_cqe_ocs'
     282 |                 return hba->vops->override_cqe_ocs(hba);
         |                        ^~~
   drivers/ufs/core/ufshcd.c: In function 'ufshcd_get_tr_ocs':
>> drivers/ufs/core/ufshcd.c:828:53: error: 'hba' undeclared (first use in this function)
     828 |                 return ufshcd_vops_override_cqe_ocs(hba,
         |                                                     ^~~
   drivers/ufs/core/ufshcd.c:828:53: note: each undeclared identifier is reported only once for each function it appears in
--
   In file included from drivers/ufs/core/ufs_bsg.c:14:
   drivers/ufs/core/ufshcd-priv.h: In function 'ufshcd_vops_override_cqe_ocs':
>> drivers/ufs/core/ufshcd-priv.h:282:24: error: too few arguments to function 'hba->vops->override_cqe_ocs'
     282 |                 return hba->vops->override_cqe_ocs(hba);
         |                        ^~~


vim +282 drivers/ufs/core/ufshcd-priv.h

   277	
   278	static inline enum utp_ocs ufshcd_vops_override_cqe_ocs(struct ufs_hba *hba,
   279								enum utp_ocs ocs)
   280	{
   281		if (hba->vops && hba->vops->override_cqe_ocs)
 > 282			return hba->vops->override_cqe_ocs(hba);
   283	
   284		return ocs;
   285	}
   286	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
  2024-08-12  7:01 ` [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs Kiwoong Kim
  2024-08-12 15:41   ` Bean Huo
  2024-08-12 17:29   ` kernel test robot
@ 2024-08-13  3:24   ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-08-13  3:24 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	bvanassche, jejb, martin.petersen, beanhuo, adrian.hunter,
	h10.kim, hy50.seo, sh425.lee, kwangwon.min, junwoo80.lee,
	wkon.kim
  Cc: llvm, oe-kbuild-all, Kiwoong Kim

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 linus/master v6.11-rc3 next-20240812]
[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/20240812-151156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/1723446114-153235-1-git-send-email-kwmad.kim%40samsung.com
patch subject: [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs
config: i386-buildonly-randconfig-004-20240812 (https://download.01.org/0day-ci/archive/20240813/202408131018.XQ8EvnAi-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/20240813/202408131018.XQ8EvnAi-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/202408131018.XQ8EvnAi-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/ufs/core/ufshcd.c:31:
>> drivers/ufs/core/ufshcd-priv.h:282:41: error: too few arguments to function call, expected 2, have 1
     282 |                 return hba->vops->override_cqe_ocs(hba);
         |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~    ^
>> 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:10340:44: warning: shift count >= width of type [-Wshift-count-overflow]
    10340 |                 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 2 errors generated.
--
   In file included from drivers/ufs/core/ufs-debugfs.c:8:
>> drivers/ufs/core/ufshcd-priv.h:282:41: error: too few arguments to function call, expected 2, have 1
     282 |                 return hba->vops->override_cqe_ocs(hba);
         |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~    ^
   1 error generated.


vim +282 drivers/ufs/core/ufshcd-priv.h

   277	
   278	static inline enum utp_ocs ufshcd_vops_override_cqe_ocs(struct ufs_hba *hba,
   279								enum utp_ocs ocs)
   280	{
   281		if (hba->vops && hba->vops->override_cqe_ocs)
 > 282			return hba->vops->override_cqe_ocs(hba);
   283	
   284		return ocs;
   285	}
   286	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-13  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240812065927epcas2p4ace98e8757a76e62efa3165de719408a@epcas2p4.samsung.com>
2024-08-12  7:01 ` [PATCH v1] scsi: ufs: core: introduce override_cqe_ocs Kiwoong Kim
2024-08-12 15:41   ` Bean Huo
2024-08-12 17:12     ` Bart Van Assche
2024-08-12 17:29   ` kernel test robot
2024-08-13  3:24   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox