Message ID | iwlwifi.20210210172142.7ce41ca91884.Ie234805047df3be84f4235f9dafaf4cdecf0db9a@changeid (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Luca Coelho |
Headers | show |
Series | iwlwifi: updates intended for v5.12 2021-02-10 part 2 | expand |
Hi Luca, I love your patch! Yet something to improve: [auto build test ERROR on wireless-drivers-next/master] [also build test ERROR on wireless-drivers/master linus/master v5.11-rc7] [cannot apply to next-20210125] [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] url: https://github.com/0day-ci/linux/commits/Luca-Coelho/iwlwifi-updates-intended-for-v5-12-2021-02-10-part-2/20210210-233911 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master config: ia64-allmodconfig (attached as .config) compiler: ia64-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 # https://github.com/0day-ci/linux/commit/477683319e91793d94debf7f0c0019a31e6cde3f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Luca-Coelho/iwlwifi-updates-intended-for-v5-12-2021-02-10-part-2/20210210-233911 git checkout 477683319e91793d94debf7f0c0019a31e6cde3f # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All error/warnings (new ones prefixed by >>): >> drivers/net/wireless/intel/iwlwifi/fw/pnvm.c:228:28: warning: "LINUX_VERSION_IS_GEQ" is not defined, evaluates to 0 [-Wundef] 228 | #if defined(CONFIG_EFI) && LINUX_VERSION_IS_GEQ(5,4,0) | ^~~~~~~~~~~~~~~~~~~~ >> drivers/net/wireless/intel/iwlwifi/fw/pnvm.c:228:48: error: missing binary operator before token "(" 228 | #if defined(CONFIG_EFI) && LINUX_VERSION_IS_GEQ(5,4,0) | ^ Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for FRAME_POINTER Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS Selected by - FAULT_INJECTION_STACKTRACE_FILTER && FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT && !X86_64 && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 vim +228 drivers/net/wireless/intel/iwlwifi/fw/pnvm.c 222 223 /* 224 * This is known to be broken on v4.19 and to work on v5.4. Until we 225 * figure out why this is the case and how to make it work, simply 226 * disable the feature in old kernels. 227 */ > 228 #if defined(CONFIG_EFI) && LINUX_VERSION_IS_GEQ(5,4,0) 229 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c index d515af8c1686..5c2977b6364b 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c @@ -10,6 +10,7 @@ #include "fw/api/commands.h" #include "fw/api/nvm-reg.h" #include "fw/api/alive.h" +#include <linux/efi.h> struct iwl_pnvm_section { __le32 offset; @@ -219,6 +220,88 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data, return -ENOENT; } +/* + * This is known to be broken on v4.19 and to work on v5.4. Until we + * figure out why this is the case and how to make it work, simply + * disable the feature in old kernels. + */ +#if defined(CONFIG_EFI) && LINUX_VERSION_IS_GEQ(5,4,0) + +#define IWL_EFI_VAR_GUID EFI_GUID(0x92daaf2f, 0xc02b, 0x455b, \ + 0xb2, 0xec, 0xf5, 0xa3, \ + 0x59, 0x4f, 0x4a, 0xea) + +#define IWL_UEFI_OEM_PNVM_NAME L"UefiCnvWlanOemSignedPnvm" + +#define IWL_HARDCODED_PNVM_SIZE 4096 + +struct pnvm_sku_package { + u8 rev; + u8 reserved1[3]; + u32 total_size; + u8 n_skus; + u8 reserved2[11]; + u8 data[]; +}; + +static int iwl_pnvm_get_from_efi(struct iwl_trans *trans, + u8 **data, size_t *len) +{ + struct efivar_entry *pnvm_efivar; + struct pnvm_sku_package *package; + unsigned long package_size; + int err; + + pnvm_efivar = kzalloc(sizeof(*pnvm_efivar), GFP_KERNEL); + if (!pnvm_efivar) + return -ENOMEM; + + memcpy(&pnvm_efivar->var.VariableName, IWL_UEFI_OEM_PNVM_NAME, + sizeof(IWL_UEFI_OEM_PNVM_NAME)); + pnvm_efivar->var.VendorGuid = IWL_EFI_VAR_GUID; + + /* + * TODO: we hardcode a maximum length here, because reading + * from the UEFI is not working. To implement this properly, + * we have to call efivar_entry_size(). + */ + package_size = IWL_HARDCODED_PNVM_SIZE; + + package = kmalloc(package_size, GFP_KERNEL); + if (!package) { + err = -ENOMEM; + goto out; + } + + err = efivar_entry_get(pnvm_efivar, NULL, &package_size, package); + if (err) { + IWL_DEBUG_FW(trans, + "PNVM UEFI variable not found %d (len %zd)\n", + err, package_size); + goto out; + } + + IWL_DEBUG_FW(trans, "Read PNVM fro UEFI with size %zd\n", package_size); + + *data = kmemdup(package->data, *len, GFP_KERNEL); + if (!*data) + err = -ENOMEM; + *len = package_size - sizeof(*package); + +out: + kfree(package); + kfree(pnvm_efivar); + + return err; +} +#else /* CONFIG_EFI */ +static inline int iwl_pnvm_get_from_efi(struct iwl_trans *trans, + u8 **data, size_t *len) +{ + return -EOPNOTSUPP; +} +#endif /* CONFIG_EFI */ + static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len) { const struct firmware *pnvm; @@ -277,7 +360,12 @@ int iwl_pnvm_load(struct iwl_trans *trans, goto skip_parse; } - /* Try to load the PNVM from the filesystem */ + /* First attempt to get the PNVM from BIOS */ + ret = iwl_pnvm_get_from_efi(trans, &data, &len); + if (!ret) + goto parse; + + /* If it's not available, try from the filesystem */ ret = iwl_pnvm_get_from_fs(trans, &data, &len); if (ret) { /* @@ -290,6 +378,7 @@ int iwl_pnvm_load(struct iwl_trans *trans, goto skip_parse; } +parse: iwl_pnvm_parse(trans, data, len); kfree(data);