Message ID | 464c059503bf1262e01bb16ea9b0726bc179be8c.1593655834.git.kwmad.kim@samsung.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ufs: support various values per device | expand |
Hi Kiwoong, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on scsi/for-next] [also build test WARNING on mkp-scsi/for-next v5.8-rc3 next-20200701] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Kiwoong-Kim/ufs-support-various-values-per-device/20200702-102146 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: mips-allyesconfig (attached as .config) compiler: mips-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/scsi/ufs/ufshcd.c:6951:6: warning: no previous prototype for 'ufshcd_set_dev_values' [-Wmissing-prototypes] 6951 | void ufshcd_set_dev_values(struct ufs_hba *hba, struct ufs_dev_value *value) | ^~~~~~~~~~~~~~~~~~~~~ drivers/scsi/ufs/ufshcd.c: In function 'ufs_fixup_device_setup': >> drivers/scsi/ufs/ufshcd.c:6978:29: warning: passing argument 2 of 'ufshcd_set_dev_values' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 6978 | ufshcd_set_dev_values(hba, ufs_dev_values); | ^~~~~~~~~~~~~~ drivers/scsi/ufs/ufshcd.c:6951:71: note: expected 'struct ufs_dev_value *' but argument is of type 'const struct ufs_dev_value *' 6951 | void ufshcd_set_dev_values(struct ufs_hba *hba, struct ufs_dev_value *value) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ vim +6978 drivers/scsi/ufs/ufshcd.c 6971 6972 static void ufs_fixup_device_setup(struct ufs_hba *hba) 6973 { 6974 /* fix by general quirk table */ 6975 ufshcd_fixup_dev_quirks(hba, ufs_fixups); 6976 6977 /* set device specific values */ > 6978 ufshcd_set_dev_values(hba, ufs_dev_values); 6979 6980 /* allow vendors to fix quirks */ 6981 ufshcd_vops_fixup_dev_quirks(hba); 6982 } 6983 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Kiwoong, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on scsi/for-next] [also build test WARNING on mkp-scsi/for-next v5.8-rc3 next-20200702] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Kiwoong-Kim/ufs-support-various-values-per-device/20200702-102146 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: sparc64-randconfig-s032-20200701 (attached as .config) compiler: sparc64-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.2-3-gfa153962-dirty # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> drivers/scsi/ufs/ufshcd.c:211:13: sparse: sparse: Using plain integer as NULL pointer >> drivers/scsi/ufs/ufshcd.c:6978:36: sparse: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct ufs_dev_value *value @@ got struct ufs_dev_value const * @@ >> drivers/scsi/ufs/ufshcd.c:6978:36: sparse: expected struct ufs_dev_value *value >> drivers/scsi/ufs/ufshcd.c:6978:36: sparse: got struct ufs_dev_value const * vim +211 drivers/scsi/ufs/ufshcd.c 209 210 static const struct ufs_dev_value ufs_dev_values[] = { > 211 {0, 0, 0, 0, false}, 212 }; 213 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index 2a00414..f074093 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -29,6 +29,19 @@ struct ufs_dev_fix { unsigned int quirk; }; +enum dev_val_type { + DEV_VAL_FDEVICEINIT = 0x0, + DEV_VAL_NUM, +}; + +struct ufs_dev_value { + u16 wmanufacturerid; + u8 *model; + u32 key; + u32 val; + bool enable; +}; + #define END_FIX { } /* add specific device quirk */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 52abe82..7b6f13a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -207,6 +207,21 @@ static struct ufs_dev_fix ufs_fixups[] = { END_FIX }; +static const struct ufs_dev_value ufs_dev_values[] = { + {0, 0, 0, 0, false}, +}; + +static inline bool +ufs_get_dev_specific_value(struct ufs_hba *hba, + enum dev_val_type type, u32 *val) +{ + if (!ufs_dev_values[type].enable) + return false; + + *val = hba->dev_value[type]; + return true; +} + static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba); static void ufshcd_async_scan(void *data, async_cookie_t cookie); static int ufshcd_reset_and_restore(struct ufs_hba *hba); @@ -6923,11 +6938,35 @@ void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups) } EXPORT_SYMBOL_GPL(ufshcd_fixup_dev_quirks); +void ufshcd_set_dev_values(struct ufs_hba *hba, struct ufs_dev_value *value) +{ + struct ufs_dev_value *f; + struct ufs_dev_info *dev_info = &hba->dev_info; + + if (!value) + return; + + for (f = value; f->val; f++) { + if ((f->wmanufacturerid == dev_info->wmanufacturerid || + f->wmanufacturerid == UFS_ANY_VENDOR) && + ((dev_info->model && + STR_PRFX_EQUAL(f->model, dev_info->model)) || + !strcmp(f->model, UFS_ANY_MODEL))) { + f->enable = true; + hba->dev_value[f->key] = f->val; + } + } +} +EXPORT_SYMBOL_GPL(ufshcd_set_dev_values); + static void ufs_fixup_device_setup(struct ufs_hba *hba) { /* fix by general quirk table */ ufshcd_fixup_dev_quirks(hba, ufs_fixups); + /* set device specific values */ + ufshcd_set_dev_values(hba, ufs_dev_values); + /* allow vendors to fix quirks */ ufshcd_vops_fixup_dev_quirks(hba); } diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index c774012..f221ca7 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -670,6 +670,7 @@ struct ufs_hba { /* Device deviations from standard UFS device spec. */ unsigned int dev_quirks; + u32 dev_value[DEV_VAL_NUM]; struct blk_mq_tag_set tmf_tag_set; struct request_queue *tmf_queue;
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> Respective UFS devices have their own characteristics and many of them could be a form of numbers, such as timeout and a number of retires. This introduces the way to set those things per specific device vendor or specific device. I wrote this like the style of ufs_fixups stuffs. --- drivers/scsi/ufs/ufs_quirks.h | 13 +++++++++++++ drivers/scsi/ufs/ufshcd.c | 39 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd.h | 1 + 3 files changed, 53 insertions(+)