Re: [PATCH] ath10k: Search SMBIOS for OEM board file extension

2017-01-16 Thread Waldemar Rymarkiewicz
On 14 January 2017 at 19:09, kbuild test robot  wrote:
> Hi Waldemar,
>
> [auto build test WARNING on ath6kl/ath-next]
> [also build test WARNING on v4.10-rc3 next-20170113]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Waldemar-Rymarkiewicz/ath10k-Search-SMBIOS-for-OEM-board-file-extension/20170115-005232
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
> config: xtensa-allmodconfig (attached as .config)
> compiler: xtensa-linux-gcc (GCC) 4.9.0
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=xtensa
>
> All warnings (new ones prefixed by >>):
>
>drivers/net/wireless/ath/ath10k/core.c: In function 
> 'ath10k_core_check_bdfext':
>>> drivers/net/wireless/ath/ath10k/core.c:754:2: warning: ignoring return 
>>> value of 'strscpy', declared with attribute warn_unused_result 
>>> [-Wunused-result]
>  strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic),
>  ^

I will fix and send v2.

Thanks,
/Waldek


Re: [PATCH] ath10k: Search SMBIOS for OEM board file extension

2017-01-14 Thread kbuild test robot
Hi Waldemar,

[auto build test WARNING on ath6kl/ath-next]
[also build test WARNING on v4.10-rc3 next-20170113]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Waldemar-Rymarkiewicz/ath10k-Search-SMBIOS-for-OEM-board-file-extension/20170115-005232
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ath/ath10k/core.c: In function 
'ath10k_core_check_bdfext':
>> drivers/net/wireless/ath/ath10k/core.c:754:2: warning: ignoring return value 
>> of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
 strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic),
 ^

vim +/strscpy +754 drivers/net/wireless/ath/ath10k/core.c

   738  
   739  if (memcmp(bdf_ext, magic, strlen(magic)) != 0) {
   740  ath10k_dbg(ar, ATH10K_DBG_BOOT,
   741 "bdf variant magic does not match.\n");
   742  return;
   743  }
   744  
   745  for (i = 0; i < strlen(bdf_ext); i++) {
   746  if (!isascii(bdf_ext[i]) || !isprint(bdf_ext[i])) {
   747  ath10k_dbg(ar, ATH10K_DBG_BOOT,
   748 "bdf variant name contains non ascii 
chars.\n");
   749  return;
   750  }
   751  }
   752  
   753  /* Copy extension name without magic suffix */
 > 754  strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic),
   755  sizeof(ar->id.bdf_ext));
   756  
   757  ath10k_dbg(ar, ATH10K_DBG_BOOT,
   758 "found and validated bdf variant smbios_type 0x%x 
bdf %s\n",
   759 ATH10K_SMBIOS_BDF_EXT_TYPE, bdf_ext);
   760  }
   761  
   762  static int ath10k_core_check_smbios(struct ath10k *ar)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH] ath10k: Search SMBIOS for OEM board file extension

2017-01-13 Thread Waldemar Rymarkiewicz
Board Data File (BDF) is loaded upon driver boot-up procedure. The right
board data file is identified, among others, by device and sybsystem ids.

The problem, however, can occur when the (default) board data file cannot
fulfill with the vendor requirements and it is necessary to use a different
board data file.

To solve the issue QCA uses SMBIOS type 0xF8 to store Board Data File Name
Extension to specify the extension/variant name. The driver will take the
extension suffix into consideration and will load the right (non-default)
board data file if necessary.

If it is unnecessary to use extension board data file, please leave the
SMBIOS field blank and default configuration will be used.

Example:
If a default board data file for a specific board is identified by a string
  "bus=pci,vendor=168c,device=003e,subsystem-vendor=1028,
   subsystem-device=0310"
then the OEM specific data file, if used, could be identified by variant
suffix:
  "bus=pci,vendor=168c,device=003e,subsystem-vendor=1028,
   subsystem-device=0310,variant=DE_1AB"

Signed-off-by: Waldemar Rymarkiewicz 
---
 drivers/net/wireless/ath/ath10k/core.c | 79 --
 drivers/net/wireless/ath/ath10k/core.h | 19 
 2 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 874c2a755c66..e6276027ec83 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include "core.h"
@@ -707,6 +709,67 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k 
*ar)
return 0;
 }
 
+static void ath10k_core_check_bdfext(const struct dmi_header *hdr, void *data)
+{
+   struct ath10k *ar = data;
+   const char *bdf_ext;
+   const char *magic = ATH10K_SMBIOS_BDF_EXT_MAGIC;
+   u8 bdf_enabled;
+   int i;
+
+   if (hdr->type != ATH10K_SMBIOS_BDF_EXT_TYPE)
+   return;
+
+   if (hdr->length != ATH10K_SMBIOS_BDF_EXT_LENGTH) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "wrong smbios bdf ext type length (%d).\n",
+  hdr->length);
+   return;
+   }
+
+   bdf_enabled = *((u8 *)hdr + ATH10K_SMBIOS_BDF_EXT_OFFSET);
+   if (!bdf_enabled) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not 
found.\n");
+   return;
+   }
+
+   /* Only one string exists (per spec) */
+   bdf_ext = (char *)hdr + hdr->length;
+
+   if (memcmp(bdf_ext, magic, strlen(magic)) != 0) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "bdf variant magic does not match.\n");
+   return;
+   }
+
+   for (i = 0; i < strlen(bdf_ext); i++) {
+   if (!isascii(bdf_ext[i]) || !isprint(bdf_ext[i])) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "bdf variant name contains non ascii 
chars.\n");
+   return;
+   }
+   }
+
+   /* Copy extension name without magic suffix */
+   strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic),
+   sizeof(ar->id.bdf_ext));
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "found and validated bdf variant smbios_type 0x%x bdf %s\n",
+  ATH10K_SMBIOS_BDF_EXT_TYPE, bdf_ext);
+}
+
+static int ath10k_core_check_smbios(struct ath10k *ar)
+{
+   ar->id.bdf_ext[0] = '\0';
+   dmi_walk(ath10k_core_check_bdfext, ar);
+
+   if (ar->id.bdf_ext[0] == '\0')
+   return -ENODATA;
+
+   return 0;
+}
+
 static int ath10k_download_and_run_otp(struct ath10k *ar)
 {
u32 result, address = ar->hw_params.patch_load_addr;
@@ -1053,6 +1116,9 @@ static int ath10k_core_fetch_board_data_api_n(struct 
ath10k *ar,
 static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
 size_t name_len)
 {
+   /* strlen(',variant=') + strlen(ar->id.bdf_ext) */
+   char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH];
+
if (ar->id.bmi_ids_valid) {
scnprintf(name, name_len,
  "bus=%s,bmi-chip-id=%d,bmi-board-id=%d",
@@ -1062,12 +1128,15 @@ static int ath10k_core_create_board_name(struct ath10k 
*ar, char *name,
goto out;
}
 
+   if (ar->id.bdf_ext[0] != '\0')
+   scnprintf(variant, sizeof(variant), ",variant=%s",
+ ar->id.bdf_ext);
+
scnprintf(name, name_len,
- 
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x",
+ 
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
  ath10k_bus_str(ar->hif.bus),
  ar->id.vendor, ar->id.device,
-