Messages in this thread | | | Date | Thu, 14 Jan 2021 19:34:37 +0800 | From | kernel test robot <> | Subject | drivers/mmc/host/dw_mmc.c:602:29: sparse: sparse: incorrect type in argument 1 (different address spaces) |
| |
Hi Mike,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d commit: 3ed6751bb8fa89c3014399bb0414348499ee202a mips: fix build when "48 bits virtual memory" is enabled date: 1 year, 2 months ago config: mips-randconfig-s032-20210114 (attached as .config) compiler: mips64el-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.3-208-g46a52ca4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ed6751bb8fa89c3014399bb0414348499ee202a git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 3ed6751bb8fa89c3014399bb0414348499ee202a # 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=mips
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 >>)" command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> drivers/mmc/host/dw_mmc.c:602:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:2> *mem @@ got unsigned int * @@ drivers/mmc/host/dw_mmc.c:602:29: sparse: expected void const volatile [noderef] <asn:2> *mem drivers/mmc/host/dw_mmc.c:602:29: sparse: got unsigned int * >> drivers/mmc/host/dw_mmc.c:602:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:2> *mem @@ got unsigned int * @@ drivers/mmc/host/dw_mmc.c:602:29: sparse: expected void const volatile [noderef] <asn:2> *mem drivers/mmc/host/dw_mmc.c:602:29: sparse: got unsigned int * drivers/mmc/host/dw_mmc.c:615:25: sparse: sparse: restricted __le32 degrades to integer drivers/mmc/host/dw_mmc.c:615:25: sparse: sparse: restricted __le32 degrades to integer >> drivers/mmc/host/dw_mmc.c:674:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:2> *mem @@ got restricted __le32 * @@ drivers/mmc/host/dw_mmc.c:674:29: sparse: expected void const volatile [noderef] <asn:2> *mem drivers/mmc/host/dw_mmc.c:674:29: sparse: got restricted __le32 * drivers/mmc/host/dw_mmc.c:674:29: sparse: sparse: restricted __le32 degrades to integer >> drivers/mmc/host/dw_mmc.c:674:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:2> *mem @@ got restricted __le32 * @@ drivers/mmc/host/dw_mmc.c:674:29: sparse: expected void const volatile [noderef] <asn:2> *mem drivers/mmc/host/dw_mmc.c:674:29: sparse: got restricted __le32 * drivers/mmc/host/dw_mmc.c:674:29: sparse: sparse: restricted __le32 degrades to integer -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> drivers/tty/serial/zs.c:988:26: sparse: sparse: Using plain integer as NULL pointer >> drivers/tty/serial/zs.c:218:9: sparse: sparse: context imbalance in 'zs_spin_lock_cond_irq' - wrong count at exit drivers/tty/serial/zs.c:227:32: sparse: sparse: context imbalance in 'zs_spin_unlock_cond_irq' - unexpected unlock -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> drivers/watchdog/mtx-1_wdt.c:185:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@ expected long ( *write )( ... ) @@ got long ( * )( ... ) @@ drivers/watchdog/mtx-1_wdt.c:185:27: sparse: expected long ( *write )( ... ) drivers/watchdog/mtx-1_wdt.c:185:27: sparse: got long ( * )( ... ) -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition drivers/watchdog/ar7_wdt.c:193:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const [noderef] <asn:1> *__gu_ptr @@ got char const * @@ drivers/watchdog/ar7_wdt.c:193:29: sparse: expected char const [noderef] <asn:1> *__gu_ptr drivers/watchdog/ar7_wdt.c:193:29: sparse: got char const * drivers/watchdog/ar7_wdt.c:216:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:1> *to @@ got struct watchdog_info * @@ drivers/watchdog/ar7_wdt.c:216:35: sparse: expected void [noderef] <asn:1> *to drivers/watchdog/ar7_wdt.c:216:35: sparse: got struct watchdog_info * drivers/watchdog/ar7_wdt.c:222:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int [noderef] <asn:1> *__pu_addr @@ got int * @@ drivers/watchdog/ar7_wdt.c:222:21: sparse: expected int [noderef] <asn:1> *__pu_addr drivers/watchdog/ar7_wdt.c:222:21: sparse: got int * drivers/watchdog/ar7_wdt.c:229:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const [noderef] <asn:1> *__gu_ptr @@ got int * @@ drivers/watchdog/ar7_wdt.c:229:21: sparse: expected int const [noderef] <asn:1> *__gu_ptr drivers/watchdog/ar7_wdt.c:229:21: sparse: got int * drivers/watchdog/ar7_wdt.c:241:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int [noderef] <asn:1> *__pu_addr @@ got int * @@ drivers/watchdog/ar7_wdt.c:241:21: sparse: expected int [noderef] <asn:1> *__pu_addr drivers/watchdog/ar7_wdt.c:241:21: sparse: got int * >> drivers/watchdog/ar7_wdt.c:251:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@ expected long ( *write )( ... ) @@ got long ( * )( ... ) @@ drivers/watchdog/ar7_wdt.c:251:27: sparse: expected long ( *write )( ... ) drivers/watchdog/ar7_wdt.c:251:27: sparse: got long ( * )( ... ) drivers/watchdog/ar7_wdt.c:270:17: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct ar7_wdt *static [toplevel] ar7_wdt @@ got void [noderef] <asn:2> * @@ drivers/watchdog/ar7_wdt.c:270:17: sparse: expected struct ar7_wdt *static [toplevel] ar7_wdt drivers/watchdog/ar7_wdt.c:270:17: sparse: got void [noderef] <asn:2> * -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> drivers/video/fbdev/pmag-aa-fb.c:110:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:110:39: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:110:39: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 drivers/video/fbdev/pmag-aa-fb.c:115:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:115:39: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:115:39: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 drivers/video/fbdev/pmag-aa-fb.c:118:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:118:42: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:118:42: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 >> drivers/video/fbdev/pmag-aa-fb.c:124:43: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:124:43: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:124:43: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:125:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:125:42: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:125:42: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:126:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:126:42: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:126:42: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:129:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:129:37: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:129:37: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 drivers/video/fbdev/pmag-aa-fb.c:134:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:134:40: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:134:40: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 drivers/video/fbdev/pmag-aa-fb.c:146:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:146:35: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:146:35: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:212:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:212:35: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:212:35: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:213:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt455_regs *regs @@ got struct bt455_regs [noderef] <asn:2> *bt455 @@ drivers/video/fbdev/pmag-aa-fb.c:213:34: sparse: expected struct bt455_regs *regs drivers/video/fbdev/pmag-aa-fb.c:213:34: sparse: got struct bt455_regs [noderef] <asn:2> *bt455 drivers/video/fbdev/pmag-aa-fb.c:216:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:216:31: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:216:31: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 drivers/video/fbdev/pmag-aa-fb.c:217:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct bt431_regs *regs @@ got struct bt431_regs [noderef] <asn:2> *bt431 @@ drivers/video/fbdev/pmag-aa-fb.c:217:30: sparse: expected struct bt431_regs *regs drivers/video/fbdev/pmag-aa-fb.c:217:30: sparse: got struct bt431_regs [noderef] <asn:2> *bt431 -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> arch/mips/dec/kn01-berr.c:104:34: sparse: sparse: cast removes address space '<asn:1>' of expression -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition >> arch/mips/dec/tc.c:32:16: sparse: sparse: cast removes address space '<asn:2>' of expression >> arch/mips/dec/tc.c:32:16: sparse: sparse: cast removes address space '<asn:2>' of expression >> arch/mips/dec/tc.c:32:16: sparse: sparse: cast removes address space '<asn:2>' of expression >> arch/mips/dec/tc.c:32:16: sparse: sparse: cast removes address space '<asn:2>' of expression -- command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition arch/mips/kernel/kgdb.c:147:56: sparse: sparse: no member 'fpu' in struct thread_struct >> arch/mips/kernel/kgdb.c:147:33: sparse: sparse: cast from unknown type arch/mips/kernel/kgdb.c:155:48: sparse: sparse: no member 'fpu' in struct thread_struct arch/mips/kernel/kgdb.c:155:25: sparse: sparse: cast from unknown type arch/mips/kernel/kgdb.c:182:61: sparse: sparse: no member 'fpu' in struct thread_struct arch/mips/kernel/kgdb.c:182:38: sparse: sparse: cast from unknown type arch/mips/kernel/kgdb.c:191:53: sparse: sparse: no member 'fpu' in struct thread_struct arch/mips/kernel/kgdb.c:191:30: sparse: sparse: cast from unknown type
vim +602 drivers/mmc/host/dw_mmc.c
3b2a067b98b45f7a Shawn Lin 2016-09-02 573 3b2a067b98b45f7a Shawn Lin 2016-09-02 574 static inline int dw_mci_prepare_desc64(struct dw_mci *host, ec0baaa6b33932a2 Shawn Lin 2016-09-02 575 struct mmc_data *data, f95f3850f7a9e1d4 Will Newton 2011-01-02 576 unsigned int sg_len) f95f3850f7a9e1d4 Will Newton 2011-01-02 577 { 5959b32e3636f9bf Alexey Brodkin 2015-06-25 578 unsigned int desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 579 struct idmac_desc_64addr *desc_first, *desc_last, *desc; b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 580 u32 val; ec0baaa6b33932a2 Shawn Lin 2016-09-02 581 int i; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 582 5959b32e3636f9bf Alexey Brodkin 2015-06-25 583 desc_first = desc_last = desc = host->sg_cpu; 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 584 5959b32e3636f9bf Alexey Brodkin 2015-06-25 585 for (i = 0; i < sg_len; i++) { 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 586 unsigned int length = sg_dma_len(&data->sg[i]); 0e3a22c044478b61 Shawn Lin 2015-08-03 587 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 588 u64 mem_addr = sg_dma_address(&data->sg[i]); 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 589 5959b32e3636f9bf Alexey Brodkin 2015-06-25 590 for ( ; length ; desc++) { 5959b32e3636f9bf Alexey Brodkin 2015-06-25 591 desc_len = (length <= DW_MCI_DESC_DATA_LENGTH) ? 5959b32e3636f9bf Alexey Brodkin 2015-06-25 592 length : DW_MCI_DESC_DATA_LENGTH; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 593 5959b32e3636f9bf Alexey Brodkin 2015-06-25 594 length -= desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 595 3b2a067b98b45f7a Shawn Lin 2016-09-02 596 /* 3b2a067b98b45f7a Shawn Lin 2016-09-02 597 * Wait for the former clear OWN bit operation 3b2a067b98b45f7a Shawn Lin 2016-09-02 598 * of IDMAC to make sure that this descriptor 3b2a067b98b45f7a Shawn Lin 2016-09-02 599 * isn't still owned by IDMAC as IDMAC's write 3b2a067b98b45f7a Shawn Lin 2016-09-02 600 * ops and CPU's read ops are asynchronous. 3b2a067b98b45f7a Shawn Lin 2016-09-02 601 */ b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 @602 if (readl_poll_timeout_atomic(&desc->des0, val, b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 603 !(val & IDMAC_DES0_OWN), b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 604 10, 100 * USEC_PER_MSEC)) 3b2a067b98b45f7a Shawn Lin 2016-09-02 605 goto err_own_bit; 3b2a067b98b45f7a Shawn Lin 2016-09-02 606 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 607 /* 5959b32e3636f9bf Alexey Brodkin 2015-06-25 608 * Set the OWN bit and disable interrupts 5959b32e3636f9bf Alexey Brodkin 2015-06-25 609 * for this descriptor 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 610 */ 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 611 desc->des0 = IDMAC_DES0_OWN | IDMAC_DES0_DIC | 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 612 IDMAC_DES0_CH; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 613 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 614 /* Buffer length */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 615 IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, desc_len); 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 616 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 617 /* Physical address to DMA to/from */ 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 618 desc->des4 = mem_addr & 0xffffffff; 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 619 desc->des5 = mem_addr >> 32; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 620 5959b32e3636f9bf Alexey Brodkin 2015-06-25 621 /* Update physical address for the next desc */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 622 mem_addr += desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 623 5959b32e3636f9bf Alexey Brodkin 2015-06-25 624 /* Save pointer to the last descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 625 desc_last = desc; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 626 } 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 627 } 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 628 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 629 /* Set first descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 630 desc_first->des0 |= IDMAC_DES0_FD; 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 631 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 632 /* Set last descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 633 desc_last->des0 &= ~(IDMAC_DES0_CH | IDMAC_DES0_DIC); 5959b32e3636f9bf Alexey Brodkin 2015-06-25 634 desc_last->des0 |= IDMAC_DES0_LD; 3b2a067b98b45f7a Shawn Lin 2016-09-02 635 3b2a067b98b45f7a Shawn Lin 2016-09-02 636 return 0; 3b2a067b98b45f7a Shawn Lin 2016-09-02 637 err_own_bit: 3b2a067b98b45f7a Shawn Lin 2016-09-02 638 /* restore the descriptor chain as it's polluted */ 26be9d705f44521d Colin Ian King 2016-11-16 639 dev_dbg(host->dev, "descriptor is still owned by IDMAC.\n"); cc190d4c6499b1b3 Shawn Lin 2016-09-02 640 memset(host->sg_cpu, 0, DESC_RING_BUF_SZ); 3b2a067b98b45f7a Shawn Lin 2016-09-02 641 dw_mci_idmac_init(host); 3b2a067b98b45f7a Shawn Lin 2016-09-02 642 return -EINVAL; ec0baaa6b33932a2 Shawn Lin 2016-09-02 643 } 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 644 ec0baaa6b33932a2 Shawn Lin 2016-09-02 645 3b2a067b98b45f7a Shawn Lin 2016-09-02 646 static inline int dw_mci_prepare_desc32(struct dw_mci *host, ec0baaa6b33932a2 Shawn Lin 2016-09-02 647 struct mmc_data *data, ec0baaa6b33932a2 Shawn Lin 2016-09-02 648 unsigned int sg_len) ec0baaa6b33932a2 Shawn Lin 2016-09-02 649 { ec0baaa6b33932a2 Shawn Lin 2016-09-02 650 unsigned int desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 651 struct idmac_desc *desc_first, *desc_last, *desc; b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 652 u32 val; ec0baaa6b33932a2 Shawn Lin 2016-09-02 653 int i; f95f3850f7a9e1d4 Will Newton 2011-01-02 654 5959b32e3636f9bf Alexey Brodkin 2015-06-25 655 desc_first = desc_last = desc = host->sg_cpu; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 656 5959b32e3636f9bf Alexey Brodkin 2015-06-25 657 for (i = 0; i < sg_len; i++) { f95f3850f7a9e1d4 Will Newton 2011-01-02 658 unsigned int length = sg_dma_len(&data->sg[i]); 0e3a22c044478b61 Shawn Lin 2015-08-03 659 f95f3850f7a9e1d4 Will Newton 2011-01-02 660 u32 mem_addr = sg_dma_address(&data->sg[i]); f95f3850f7a9e1d4 Will Newton 2011-01-02 661 5959b32e3636f9bf Alexey Brodkin 2015-06-25 662 for ( ; length ; desc++) { 5959b32e3636f9bf Alexey Brodkin 2015-06-25 663 desc_len = (length <= DW_MCI_DESC_DATA_LENGTH) ? 5959b32e3636f9bf Alexey Brodkin 2015-06-25 664 length : DW_MCI_DESC_DATA_LENGTH; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 665 5959b32e3636f9bf Alexey Brodkin 2015-06-25 666 length -= desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 667 3b2a067b98b45f7a Shawn Lin 2016-09-02 668 /* 3b2a067b98b45f7a Shawn Lin 2016-09-02 669 * Wait for the former clear OWN bit operation 3b2a067b98b45f7a Shawn Lin 2016-09-02 670 * of IDMAC to make sure that this descriptor 3b2a067b98b45f7a Shawn Lin 2016-09-02 671 * isn't still owned by IDMAC as IDMAC's write 3b2a067b98b45f7a Shawn Lin 2016-09-02 672 * ops and CPU's read ops are asynchronous. 3b2a067b98b45f7a Shawn Lin 2016-09-02 673 */ b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 @674 if (readl_poll_timeout_atomic(&desc->des0, val, b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 675 IDMAC_OWN_CLR64(val), b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 676 10, b6d2d81c5c2de6b3 Shawn Lin 2017-02-17 677 100 * USEC_PER_MSEC)) 3b2a067b98b45f7a Shawn Lin 2016-09-02 678 goto err_own_bit; 3b2a067b98b45f7a Shawn Lin 2016-09-02 679 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 680 /* 5959b32e3636f9bf Alexey Brodkin 2015-06-25 681 * Set the OWN bit and disable interrupts 5959b32e3636f9bf Alexey Brodkin 2015-06-25 682 * for this descriptor 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 683 */ 6687c42fa71acd6a Ben Dooks 2015-03-25 684 desc->des0 = cpu_to_le32(IDMAC_DES0_OWN | 5959b32e3636f9bf Alexey Brodkin 2015-06-25 685 IDMAC_DES0_DIC | 5959b32e3636f9bf Alexey Brodkin 2015-06-25 686 IDMAC_DES0_CH); 5959b32e3636f9bf Alexey Brodkin 2015-06-25 687 f95f3850f7a9e1d4 Will Newton 2011-01-02 688 /* Buffer length */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 689 IDMAC_SET_BUFFER1_SIZE(desc, desc_len); f95f3850f7a9e1d4 Will Newton 2011-01-02 690 f95f3850f7a9e1d4 Will Newton 2011-01-02 691 /* Physical address to DMA to/from */ 6687c42fa71acd6a Ben Dooks 2015-03-25 692 desc->des2 = cpu_to_le32(mem_addr); 5959b32e3636f9bf Alexey Brodkin 2015-06-25 693 5959b32e3636f9bf Alexey Brodkin 2015-06-25 694 /* Update physical address for the next desc */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 695 mem_addr += desc_len; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 696 5959b32e3636f9bf Alexey Brodkin 2015-06-25 697 /* Save pointer to the last descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 698 desc_last = desc; 5959b32e3636f9bf Alexey Brodkin 2015-06-25 699 } f95f3850f7a9e1d4 Will Newton 2011-01-02 700 } f95f3850f7a9e1d4 Will Newton 2011-01-02 701 f95f3850f7a9e1d4 Will Newton 2011-01-02 702 /* Set first descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 703 desc_first->des0 |= cpu_to_le32(IDMAC_DES0_FD); f95f3850f7a9e1d4 Will Newton 2011-01-02 704 f95f3850f7a9e1d4 Will Newton 2011-01-02 705 /* Set last descriptor */ 5959b32e3636f9bf Alexey Brodkin 2015-06-25 706 desc_last->des0 &= cpu_to_le32(~(IDMAC_DES0_CH | 5959b32e3636f9bf Alexey Brodkin 2015-06-25 707 IDMAC_DES0_DIC)); 5959b32e3636f9bf Alexey Brodkin 2015-06-25 708 desc_last->des0 |= cpu_to_le32(IDMAC_DES0_LD); 3b2a067b98b45f7a Shawn Lin 2016-09-02 709 3b2a067b98b45f7a Shawn Lin 2016-09-02 710 return 0; 3b2a067b98b45f7a Shawn Lin 2016-09-02 711 err_own_bit: 3b2a067b98b45f7a Shawn Lin 2016-09-02 712 /* restore the descriptor chain as it's polluted */ 26be9d705f44521d Colin Ian King 2016-11-16 713 dev_dbg(host->dev, "descriptor is still owned by IDMAC.\n"); cc190d4c6499b1b3 Shawn Lin 2016-09-02 714 memset(host->sg_cpu, 0, DESC_RING_BUF_SZ); 3b2a067b98b45f7a Shawn Lin 2016-09-02 715 dw_mci_idmac_init(host); 3b2a067b98b45f7a Shawn Lin 2016-09-02 716 return -EINVAL; 69d99fdcfd7815df Prabu Thangamuthu 2014-10-20 717 } f95f3850f7a9e1d4 Will Newton 2011-01-02 718
:::::: The code at line 602 was first introduced by commit :::::: b6d2d81c5c2de6b3c69da3be9b2044dd008dbe45 mmc: dw_mmc: improve the timeout polling code
:::::: TO: Shawn Lin <shawn.lin@rock-chips.com> :::::: CC: Ulf Hansson <ulf.hansson@linaro.org>
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |