drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:233:24: warning: taking address of packed member 'param1' of class or structure 'qtnf_extra_bd_params' may result in an unaligned pointer value

From: kernel test robot
Date: Mon Mar 01 2021 - 08:23:11 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
commit: 1062fc45d1e93faefb93961f3be0a687f3f0e2e1 MIPS: Loongson64: Select SMP in Kconfig to avoid build error
date: 5 months ago
config: mips-randconfig-r011-20210301 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b077d82b00d81934c7c27ac89dd8b0e7f448bded)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1062fc45d1e93faefb93961f3be0a687f3f0e2e1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 1062fc45d1e93faefb93961f3be0a687f3f0e2e1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:6:
In file included from include/linux/pci.h:1439:
In file included from include/linux/dmapool.h:14:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:10:
In file included from include/linux/skbuff.h:28:
In file included from include/net/checksum.h:22:
arch/mips/include/asm/checksum.h:195:9: error: unsupported inline asm: input with type 'unsigned long' matching output with type '__wsum' (aka 'unsigned int')
: "0" ((__force unsigned long)daddr),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:15:
In file included from drivers/net/wireless/quantenna/qtnfmac/bus.h:7:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
} while (cmpxchg(&n->state, val, new) != val);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:15:
In file included from drivers/net/wireless/quantenna/qtnfmac/bus.h:7:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:15:
In file included from drivers/net/wireless/quantenna/qtnfmac/bus.h:11:
In file included from drivers/net/wireless/quantenna/qtnfmac/core.h:15:
In file included from include/net/sock.h:61:
include/linux/poll.h:142:27: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
include/linux/poll.h:142:39: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:15:
In file included from drivers/net/wireless/quantenna/qtnfmac/bus.h:11:
In file included from drivers/net/wireless/quantenna/qtnfmac/core.h:15:
include/net/sock.h:1971:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:16:
In file included from drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h:15:
In file included from drivers/net/wireless/quantenna/qtnfmac/bus.h:11:
In file included from drivers/net/wireless/quantenna/qtnfmac/core.h:15:
include/net/sock.h:2219:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
err = xchg(&sk->sk_err, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:233:24: warning: taking address of packed member 'param1' of class or structure 'qtnf_extra_bd_params' may result in an unaligned pointer value [-Waddress-of-packed-member]
ts->ep_next_rx_pkt = &extra_params->param1;
^~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:236:22: warning: taking address of packed member 'param2' of class or structure 'qtnf_extra_bd_params' may result in an unaligned pointer value [-Waddress-of-packed-member]
ts->txqueue_wake = &extra_params->param2;
^~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c:237:20: warning: taking address of packed member 'param3' of class or structure 'qtnf_extra_bd_params' may result in an unaligned pointer value [-Waddress-of-packed-member]
ts->ep_pmstate = &extra_params->param3;
^~~~~~~~~~~~~~~~~~~~
21 warnings and 1 error generated.
--
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:29:
In file included from include/linux/lockdep.h:14:
In file included from include/linux/smp.h:15:
In file included from include/linux/smp_types.h:5:
include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:64:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:29:
In file included from include/linux/lockdep.h:27:
include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:69:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-io.h:61:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h:15:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:13:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
^
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:69:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-io.h:61:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h:15:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:13:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:69:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-io.h:61:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h:15:
In file included from include/linux/skbuff.h:28:
In file included from include/net/checksum.h:22:
arch/mips/include/asm/checksum.h:195:9: error: unsupported inline asm: input with type 'unsigned long' matching output with type '__wsum' (aka 'unsigned int')
: "0" ((__force unsigned long)daddr),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:69:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-io.h:61:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h:16:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
} while (cmpxchg(&n->state, val, new) != val);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:69:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-io.h:61:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h:16:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/pcie/rx.c:70:
>> drivers/net/wireless/intel/iwlwifi/pcie/internal.h:273:20: warning: taking address of packed member 'closed_rb_num' of class or structure 'iwl_rb_status' may result in an unaligned pointer value [-Waddress-of-packed-member]
return READ_ONCE(rb_stts->closed_rb_num);
^~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
__READ_ONCE(x); \
^
include/asm-generic/rwonce.h:44:72: note: expanded from macro '__READ_ONCE'
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
^
15 warnings and 1 error generated.
--
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:29:
In file included from include/linux/lockdep.h:14:
In file included from include/linux/smp.h:15:
In file included from include/linux/smp_types.h:5:
include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:64:
In file included from include/linux/devcoredump.h:8:
In file included from include/linux/device.h:15:
In file included from include/linux/dev_printk.h:16:
In file included from include/linux/ratelimit.h:6:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:29:
In file included from include/linux/lockdep.h:27:
include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:64:
In file included from include/linux/devcoredump.h:12:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
^
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:64:
In file included from include/linux/devcoredump.h:12:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:66:
In file included from drivers/net/wireless/intel/iwlwifi/fw/runtime.h:63:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-config.h:64:
In file included from include/linux/netdevice.h:37:
In file included from include/linux/ethtool.h:18:
In file included from include/uapi/linux/ethtool.h:19:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:28:
In file included from include/net/checksum.h:22:
arch/mips/include/asm/checksum.h:195:9: error: unsupported inline asm: input with type 'unsigned long' matching output with type '__wsum' (aka 'unsigned int')
: "0" ((__force unsigned long)daddr),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:66:
In file included from drivers/net/wireless/intel/iwlwifi/fw/runtime.h:63:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-config.h:64:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
} while (cmpxchg(&n->state, val, new) != val);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:66:
In file included from drivers/net/wireless/intel/iwlwifi/fw/runtime.h:63:
In file included from drivers/net/wireless/intel/iwlwifi/iwl-config.h:64:
include/linux/netdevice.h:567:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> drivers/net/wireless/intel/iwlwifi/fw/dbg.c:1940:17: warning: taking address of packed member 'list' of class or structure 'iwl_fw_ini_dump_entry' may result in an unaligned pointer value [-Waddress-of-packed-member]
list_add_tail(&entry->list, list);
^~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2046:12: warning: taking address of packed member 'list' of class or structure 'iwl_fw_ini_dump_entry' may result in an unaligned pointer value [-Waddress-of-packed-member]
list_add(&entry->list, list);
^~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2219:12: warning: taking address of packed member 'list' of class or structure 'iwl_fw_ini_dump_entry' may result in an unaligned pointer value [-Waddress-of-packed-member]
list_add(&entry->list, list);
^~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2286:13: warning: taking address of packed member 'list' of class or structure 'iwl_fw_ini_dump_entry' may result in an unaligned pointer value [-Waddress-of-packed-member]
list_del(&entry->list);
^~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2314:23: warning: taking address of packed member 'list' of class or structure 'iwl_fw_ini_dump_entry' may result in an unaligned pointer value [-Waddress-of-packed-member]
list_for_each_entry(entry, &dump_list, list) {
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:620:8: note: expanded from macro 'list_for_each_entry'
&pos->member != (head); \
^~~~~~~~~~~
19 warnings and 1 error generated.
..


vim +233 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c

e401fa25cfa23d Sergey Matyukevich 2018-10-16 182
e401fa25cfa23d Sergey Matyukevich 2018-10-16 183 static int topaz_alloc_bd_table(struct qtnf_pcie_topaz_state *ts,
e401fa25cfa23d Sergey Matyukevich 2018-10-16 184 struct qtnf_topaz_bda __iomem *bda)
e401fa25cfa23d Sergey Matyukevich 2018-10-16 185 {
e401fa25cfa23d Sergey Matyukevich 2018-10-16 186 struct qtnf_extra_bd_params __iomem *extra_params;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 187 struct qtnf_pcie_bus_priv *priv = &ts->base;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 188 dma_addr_t paddr;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 189 void *vaddr;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 190 int len;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 191 int i;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 192
e401fa25cfa23d Sergey Matyukevich 2018-10-16 193 /* bd table */
e401fa25cfa23d Sergey Matyukevich 2018-10-16 194
e401fa25cfa23d Sergey Matyukevich 2018-10-16 195 len = priv->tx_bd_num * sizeof(struct qtnf_topaz_tx_bd) +
e401fa25cfa23d Sergey Matyukevich 2018-10-16 196 priv->rx_bd_num * sizeof(struct qtnf_topaz_rx_bd) +
e401fa25cfa23d Sergey Matyukevich 2018-10-16 197 sizeof(struct qtnf_extra_bd_params);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 198
e401fa25cfa23d Sergey Matyukevich 2018-10-16 199 vaddr = dmam_alloc_coherent(&priv->pdev->dev, len, &paddr, GFP_KERNEL);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 200 if (!vaddr)
e401fa25cfa23d Sergey Matyukevich 2018-10-16 201 return -ENOMEM;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 202
e401fa25cfa23d Sergey Matyukevich 2018-10-16 203 /* tx bd */
e401fa25cfa23d Sergey Matyukevich 2018-10-16 204
e401fa25cfa23d Sergey Matyukevich 2018-10-16 205 ts->tx_bd_vbase = vaddr;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 206 qtnf_non_posted_write(paddr, &bda->bda_rc_tx_bd_base);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 207
e401fa25cfa23d Sergey Matyukevich 2018-10-16 208 for (i = 0; i < priv->tx_bd_num; i++)
e401fa25cfa23d Sergey Matyukevich 2018-10-16 209 ts->tx_bd_vbase[i].info |= cpu_to_le32(QTN_BD_EMPTY);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 210
e401fa25cfa23d Sergey Matyukevich 2018-10-16 211 pr_debug("TX descriptor table: vaddr=0x%p paddr=%pad\n", vaddr, &paddr);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 212
e401fa25cfa23d Sergey Matyukevich 2018-10-16 213 priv->tx_bd_r_index = 0;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 214 priv->tx_bd_w_index = 0;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 215
e401fa25cfa23d Sergey Matyukevich 2018-10-16 216 /* rx bd */
e401fa25cfa23d Sergey Matyukevich 2018-10-16 217
e401fa25cfa23d Sergey Matyukevich 2018-10-16 218 vaddr = ((struct qtnf_topaz_tx_bd *)vaddr) + priv->tx_bd_num;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 219 paddr += priv->tx_bd_num * sizeof(struct qtnf_topaz_tx_bd);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 220
e401fa25cfa23d Sergey Matyukevich 2018-10-16 221 ts->rx_bd_vbase = vaddr;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 222 qtnf_non_posted_write(paddr, &bda->bda_rc_rx_bd_base);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 223
e401fa25cfa23d Sergey Matyukevich 2018-10-16 224 pr_debug("RX descriptor table: vaddr=0x%p paddr=%pad\n", vaddr, &paddr);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 225
e401fa25cfa23d Sergey Matyukevich 2018-10-16 226 /* extra shared params */
e401fa25cfa23d Sergey Matyukevich 2018-10-16 227
e401fa25cfa23d Sergey Matyukevich 2018-10-16 228 vaddr = ((struct qtnf_topaz_rx_bd *)vaddr) + priv->rx_bd_num;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 229 paddr += priv->rx_bd_num * sizeof(struct qtnf_topaz_rx_bd);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 230
e401fa25cfa23d Sergey Matyukevich 2018-10-16 231 extra_params = (struct qtnf_extra_bd_params __iomem *)vaddr;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 232
e401fa25cfa23d Sergey Matyukevich 2018-10-16 @233 ts->ep_next_rx_pkt = &extra_params->param1;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 234 qtnf_non_posted_write(paddr + QTNF_BD_PARAM_OFFSET(1),
e401fa25cfa23d Sergey Matyukevich 2018-10-16 235 &bda->bda_ep_next_pkt);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 @236 ts->txqueue_wake = &extra_params->param2;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 @237 ts->ep_pmstate = &extra_params->param3;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 238 ts->dma_msi_dummy = paddr + QTNF_BD_PARAM_OFFSET(4);
e401fa25cfa23d Sergey Matyukevich 2018-10-16 239
e401fa25cfa23d Sergey Matyukevich 2018-10-16 240 return 0;
e401fa25cfa23d Sergey Matyukevich 2018-10-16 241 }
e401fa25cfa23d Sergey Matyukevich 2018-10-16 242

:::::: The code at line 233 was first introduced by commit
:::::: e401fa25cfa23df8b17960a656ff11f49facae84 qtnfmac: add support for Topaz chipsets

:::::: TO: Sergey Matyukevich <sergey.matyukevich.os@xxxxxxxxxxxxx>
:::::: CC: Kalle Valo <kvalo@xxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip