Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【6.9】飞腾 SPI 驱动无法构建 #2

Open
Tracked by #11 ...
MingcongBai opened this issue Jun 27, 2024 · 0 comments
Open
Tracked by #11 ...

【6.9】飞腾 SPI 驱动无法构建 #2

MingcongBai opened this issue Jun 27, 2024 · 0 comments

Comments

@MingcongBai
Copy link

MingcongBai commented Jun 27, 2024

详见日志(需要进行移植适配):

  CC [M]  drivers/spi/spi-phytium.o
  CC [M]  drivers/spi/spi-phytium-pci.o
  CC [M]  drivers/spi/spi-phytium-dma.o
In file included from ./include/linux/bits.h:6,
                 from ./include/linux/bitops.h:6,
                 from ./include/linux/kernel.h:23,
                 from ./include/linux/clk.h:13,
                 from drivers/spi/spi-phytium.c:11:
drivers/spi/spi-phytium.c: In functionphytium_spi_set_cs’:
./include/vdso/bits.h:7:40: error: invalid operands to binary << (have ‘long unsigned intandu8 *’ {aka ‘unsigned char *’})
    7 | #define BIT(nr)                 (UL(1) << (nr))
      |                                        ^~
      |                                        |
      |                                        u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:56:42: note: in expansion of macroBIT56 |                 phytium_writel(fts, SER, BIT(spi->chip_select));
      |                                          ^~~
drivers/spi/spi-phytium.c:59:63: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   59 |                         phytium_writel(fts, GCSR, origin | (1 << spi->chip_select));
      |                                                               ^~
      |                                                               |
      |                                                               u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:64:64: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   64 |                         phytium_writel(fts, GCSR, origin & ~(1 << spi->chip_select));
      |                                                                ^~
      |                                                                |
      |                                                                u8 * {aka unsigned char *}
In file included from ./include/linux/device.h:15,
                 from ./include/linux/platform_device.h:13,
                 from drivers/spi/spi-phytium.c:17:
drivers/spi/spi-phytium.c: In functionphytium_spi_check_status’:
drivers/spi/spi-phytium.c:133:37: error: invalid use of undefined typestruct spi_master133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:133:17: note: in expansion of macrodev_err133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:138:37: error: invalid use of undefined typestruct spi_master138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:138:17: note: in expansion of macrodev_err138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:143:37: error: invalid use of undefined typestruct spi_master143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:143:17: note: in expansion of macrodev_err143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:150:32: error: invalid use of undefined typestruct spi_master150 |                 if (fts->master->cur_msg)
      |                                ^~
drivers/spi/spi-phytium.c:151:36: error: invalid use of undefined typestruct spi_master151 |                         fts->master->cur_msg->status = ret;
      |                                    ^~
drivers/spi/spi-phytium.c: In functionint_error_stop’:
drivers/spi/spi-phytium.c:161:29: error: invalid use of undefined typestruct spi_master161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |                             ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:161:9: note: in expansion of macrodev_err161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |         ^~~~~~~
drivers/spi/spi-phytium.c:162:20: error: invalid use of undefined typestruct spi_master162 |         fts->master->cur_msg->status = -EIO;
      |                    ^~
drivers/spi/spi-phytium.c:163:42: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  163 |         spi_finalize_current_transfer(fts->master);
      |                                       ~~~^~~~~~~~
      |                                          |
      |                                          struct spi_master *
In file included from drivers/spi/spi-phytium.c:19:
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functioninterrupt_transfer’:
drivers/spi/spi-phytium.c:179:50: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  179 |                 spi_finalize_current_transfer(fts->master);
      |                                               ~~~^~~~~~~~
      |                                                  |
      |                                                  struct spi_master *
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_irq’:
drivers/spi/spi-phytium.c:194:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
  194 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium.c:194:62: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_init’:
drivers/spi/spi-phytium-dma.c:79:20: error: invalid use of undefined typestruct spi_master79 |         fts->master->dma_rx = fts->rxchan;
      |                    ^~
drivers/spi/spi-phytium.c:200:20: error: invalid use of undefined typestruct spi_master200 |         if (!master->cur_msg) {
      |                    ^~
drivers/spi/spi-phytium-dma.c:80:20: error: invalid use of undefined typestruct spi_master80 |         fts->master->dma_tx = fts->txchan;
      |                    ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_transfer_one’:
drivers/spi/spi-phytium.c:225:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  225 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from ./include/linux/device.h:15,
                 from ./include/linux/dma-mapping.h:8,
                 from drivers/spi/spi-phytium-dma.c:8:
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait’:
drivers/spi/spi-phytium-dma.c:146:37: error: invalid use of undefined typestruct spi_master146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:146:17: note: in expansion of macrodev_err146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:281:19: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                   ^~
drivers/spi/spi-phytium.c:281:38: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                                      ^~
drivers/spi/spi-phytium.c:282:41: error: invalid use of undefined typestruct spi_master282 |                 fts->dma_mapped = master->cur_msg_mapped;
      |                                         ^~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_tx_done’:
drivers/spi/spi-phytium-dma.c:190:37: error: invalid use of undefined typestruct spi_master190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:190:17: note: in expansion of macrodev_err190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_rx_done’:
drivers/spi/spi-phytium.c: In functionphytium_spi_handle_err’:
drivers/spi/spi-phytium.c:318:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  318 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium-dma.c:283:37: error: invalid use of undefined typestruct spi_master283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:283:17: note: in expansion of macrodev_err283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                 ^~~~~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_setup’:
drivers/spi/spi-phytium.c:330:40: error: ‘struct spi_devicehas no member namedmaster330 |         struct spi_master *master = spi->master;
      |                                        ^~
drivers/spi/spi-phytium.c:331:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  331 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_add_host’:
drivers/spi/spi-phytium.c:400:16: error: assignment tostruct spi_master *from incompatible pointer typestruct spi_controller *’ [-Werror=incompatible-pointer-types]
  400 |         master = spi_alloc_master(dev, 0);
      |                ^
drivers/spi/spi-phytium.c:415:15: error: invalid use of undefined typestruct spi_master415 |         master->use_gpio_descriptors = true;
      |               ^~
drivers/spi/spi-phytium.c:416:15: error: invalid use of undefined typestruct spi_master416 |         master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
      |               ^~
drivers/spi/spi-phytium.c:417:15: error: invalid use of undefined typestruct spi_master417 |         master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
      |               ^~
drivers/spi/spi-phytium.c:418:15: error: invalid use of undefined typestruct spi_master418 |         master->bus_num = fts->bus_num;
      |               ^~
drivers/spi/spi-phytium.c:419:15: error: invalid use of undefined typestruct spi_master419 |         master->num_chipselect = fts->num_cs;
      |               ^~
drivers/spi/spi-phytium.c:420:15: error: invalid use of undefined typestruct spi_master420 |         master->setup = phytium_spi_setup;
      |               ^~
drivers/spi/spi-phytium.c:421:15: error: invalid use of undefined typestruct spi_master421 |         master->cleanup = phytium_spi_cleanup;
      |               ^~
drivers/spi/spi-phytium.c:422:15: error: invalid use of undefined typestruct spi_master422 |         master->set_cs = phytium_spi_set_cs;
      |               ^~
drivers/spi/spi-phytium.c:423:15: error: invalid use of undefined typestruct spi_master423 |         master->transfer_one = phytium_spi_transfer_one;
      |               ^~
drivers/spi/spi-phytium.c:424:15: error: invalid use of undefined typestruct spi_master424 |         master->handle_err = phytium_spi_handle_err;
      |               ^~
drivers/spi/spi-phytium.c:425:15: error: invalid use of undefined typestruct spi_master425 |         master->max_speed_hz = fts->max_freq;
      |               ^~
drivers/spi/spi-phytium.c:426:15: error: invalid use of undefined typestruct spi_master426 |         master->dev.of_node = dev->of_node;
      |               ^~
drivers/spi/spi-phytium.c:427:15: error: invalid use of undefined typestruct spi_master427 |         master->dev.fwnode = dev->fwnode;
      |               ^~
drivers/spi/spi-phytium.c:428:15: error: invalid use of undefined typestruct spi_master428 |         master->flags = SPI_CONTROLLER_GPIO_SS;
      |               ^~
drivers/spi/spi-phytium.c:437:31: error: invalid use of undefined typestruct spi_master437 |                         master->can_dma = fts->dma_ops->can_dma;
      |                               ^~
drivers/spi/spi-phytium.c:438:31: error: invalid use of undefined typestruct spi_master438 |                         master->flags |= SPI_CONTROLLER_MUST_TX;
      |                               ^~
drivers/spi/spi-phytium.c:442:36: error: passing argument 1 ofspi_controller_set_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  442 |         spi_controller_set_devdata(master, fts);
      |                                    ^~~~~~
      |                                    |
      |                                    struct spi_master *
./include/linux/spi/spi.h:785:70: note: expectedstruct spi_controller *but argument is of typestruct spi_master *785 | static inline void spi_controller_set_devdata(struct spi_controller *ctlr,
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:443:39: error: passing argument 1 ofspi_register_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  443 |         ret = spi_register_controller(master);
      |                                       ^~~~~~
      |                                       |
      |                                       struct spi_master *
./include/linux/spi/spi.h:899:59: note: expectedstruct spi_controller *but argument is of typestruct spi_master *899 | extern int spi_register_controller(struct spi_controller *ctlr);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:445:32: error: invalid use of undefined typestruct spi_master445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                                ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:445:17: note: in expansion of macrodev_err445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_transfer’:
drivers/spi/spi-phytium-dma.c:514:24: error: invalid use of undefined typestruct spi_master514 |         if (fts->master->cur_msg->status == -EINPROGRESS) {
      |                        ^~
drivers/spi/spi-phytium-dma.c:520:40: error: invalid use of undefined typestruct spi_master520 |         if (xfer->rx_buf && fts->master->cur_msg->status == -EINPROGRESS)
      |                                        ^~
drivers/spi/spi-phytium-pci.c: In functionspi_suspend’:
drivers/spi/spi-phytium-pci.c:92:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
   92 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium-pci.c:92:62: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-phytium-pci.c:91:28: error: unused variablemaster’ [-Werror=unused-variable]
   91 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
drivers/spi/spi-phytium-pci.c: In functionspi_resume’:
drivers/spi/spi-phytium-pci.c:100:62: error: ‘spi_controllerundeclared (first use in this function)
  100 |         struct phytium_spi *fts = spi_controller_get_devdata(spi_controller);
      |                                                              ^~~~~~~~~~~~~~
drivers/spi/spi-phytium-pci.c:99:28: error: unused variablemaster’ [-Werror=unused-variable]
   99 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
drivers/spi/spi-phytium.c:457:9: error: implicit declaration of functionspi_master_put’; did you meanspi_dev_put’? [-Werror=implicit-function-declaration]
  457 |         spi_master_put(master);
      |         ^~~~~~~~~~~~~~
      |         spi_dev_put
drivers/spi/spi-phytium.c: In functionphytium_spi_remove_host’:
drivers/spi/spi-phytium.c:468:38: error: passing argument 1 ofspi_unregister_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  468 |         spi_unregister_controller(fts->master);
      |                                   ~~~^~~~~~~~
      |                                      |
      |                                      struct spi_master *
./include/linux/spi/spi.h:902:62: note: expectedstruct spi_controller *but argument is of typestruct spi_master *902 | extern void spi_unregister_controller(struct spi_controller *ctlr);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_suspend_host’:
drivers/spi/spi-phytium.c:478:41: error: passing argument 1 ofspi_controller_suspendfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  478 |         ret = spi_controller_suspend(fts->master);
      |                                      ~~~^~~~~~~~
      |                                         |
      |                                         struct spi_master *
./include/linux/spi/spi.h:815:58: note: expectedstruct spi_controller *but argument is of typestruct spi_master *815 | extern int spi_controller_suspend(struct spi_controller *ctlr);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_resume_host’:
drivers/spi/spi-phytium.c:491:33: error: invalid use of undefined typestruct spi_master491 |         spi_hw_init(&fts->master->dev, fts);
      |                                 ^~
drivers/spi/spi-phytium.c:492:40: error: passing argument 1 ofspi_controller_resumefrom incompatible pointer type [-Werror=incompatible-pointer-types]
  492 |         ret = spi_controller_resume(fts->master);
      |                                     ~~~^~~~~~~~
      |                                        |
      |                                        struct spi_master *
./include/linux/spi/spi.h:816:57: note: expectedstruct spi_controller *but argument is of typestruct spi_master *816 | extern int spi_controller_resume(struct spi_controller *ctlr);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:494:37: error: invalid use of undefined typestruct spi_master494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:494:17: note: in expansion of macrodev_err494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                 ^~~~~~~
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-dma.o] 错误 1
make[7]: *** 正在等待未完成的任务....
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-pci.o] 错误 1
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium.o] 错误 1
make[6]: *** [scripts/Makefile.build:485drivers/spi] 错误 2
make[6]: *** 正在等待未完成的任务....
  CHK     kernel/kheaders_data.tar.xz
^Cmake[7]: *** [scripts/Makefile.build:485: sound/soc/codecs] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/nouveau] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/amd/amdgpu] 中断
make[6]: *** [scripts/Makefile.build:485: sound/soc] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/i915] 中断
make[5]: *** [scripts/Makefile.build:485: sound] 中断
make[7]: *** [scripts/Makefile.build:485: drivers/gpu/drm] 中断
make[6]: *** [scripts/Makefile.build:485: drivers/gpu] 中断
make[5]: *** [scripts/Makefile.build:485: drivers] 中断
make[4]: *** [Makefile:1915: .] 中断
make[3]: *** [debian/rules:74: build-arch] 中断
dpkg-buildpackage: error: make -f debian/rules binary subprocess was killed by signal 2
make[2]: *** [scripts/Makefile.package:121: bindeb-pkg] 中断
make[1]: *** [/root/linux/Makefile:1537: bindeb-pkg] 中断
make: *** [Makefile:240: __sub-make] 中断

root@deepinci-amd7:~/linux# ^C
root@deepinci-amd7:~/linux# nano +492 drivers/spi/spi-phytium.c
root@deepinci-amd7:~/linux# make bindeb-pkg -j$(nproc)
  GEN     debian
dpkg-buildpackage --build=binary --no-pre-clean --unsigned-changes -R'make -f debian/rules' -j1 -a$(cat debian/arch)
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 23.01.01.01
dpkg-buildpackage: info: source distribution beige
dpkg-buildpackage: info: source changed by root <root@deepinci-amd7>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 make -f debian/rules binary                                                                
#                                                                                           
# No change to .config
#
mkdir -p /root/linux/tools/objtool && make O=/root/linux subdir=tools/objtool --no-print-directory -C objtool 
mkdir -p /root/linux/tools/bpf/resolve_btfids && make O=/root/linux subdir=tools/bpf/resolve_btfids --no-print-directory -C bpf/resolve_btfids 
  INSTALL libsubcmd_headers
  INSTALL libsubcmd_headers
  CALL    scripts/checksyscalls.sh
  CC [M]  drivers/spi/spi-phytium.o
  CC [M]  drivers/spi/spi-phytium-pci.o
  CC [M]  drivers/spi/spi-phytium-dma.o
In file included from ./include/linux/bits.h:6,
                 from ./include/linux/bitops.h:6,
                 from ./include/linux/kernel.h:23,
                 from ./include/linux/clk.h:13,
                 from drivers/spi/spi-phytium.c:11:
drivers/spi/spi-phytium.c: In functionphytium_spi_set_cs’:
./include/vdso/bits.h:7:40: error: invalid operands to binary << (have ‘long unsigned intandu8 *’ {aka ‘unsigned char *’})
    7 | #define BIT(nr)                 (UL(1) << (nr))
      |                                        ^~
      |                                        |
      |                                        u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:56:42: note: in expansion of macroBIT56 |                 phytium_writel(fts, SER, BIT(spi->chip_select));
      |                                          ^~~
drivers/spi/spi-phytium.c:59:63: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   59 |                         phytium_writel(fts, GCSR, origin | (1 << spi->chip_select));
      |                                                               ^~
      |                                                               |
      |                                                               u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:64:64: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   64 |                         phytium_writel(fts, GCSR, origin & ~(1 << spi->chip_select));
      |                                                                ^~
      |                                                                |
      |                                                                u8 * {aka unsigned char *}
In file included from ./include/linux/device.h:15,
                 from ./include/linux/platform_device.h:13,
                 from drivers/spi/spi-phytium.c:17:
drivers/spi/spi-phytium.c: In functionphytium_spi_check_status’:
drivers/spi/spi-phytium.c:133:37: error: invalid use of undefined typestruct spi_master133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:133:17: note: in expansion of macrodev_err133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:138:37: error: invalid use of undefined typestruct spi_master138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:138:17: note: in expansion of macrodev_err138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:143:37: error: invalid use of undefined typestruct spi_master143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:143:17: note: in expansion of macrodev_err143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:150:32: error: invalid use of undefined typestruct spi_master150 |                 if (fts->master->cur_msg)
      |                                ^~
drivers/spi/spi-phytium.c:151:36: error: invalid use of undefined typestruct spi_master151 |                         fts->master->cur_msg->status = ret;
      |                                    ^~
drivers/spi/spi-phytium.c: In functionint_error_stop’:
drivers/spi/spi-phytium.c:161:29: error: invalid use of undefined typestruct spi_master161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |                             ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:161:9: note: in expansion of macrodev_err161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |         ^~~~~~~
drivers/spi/spi-phytium.c:162:20: error: invalid use of undefined typestruct spi_master162 |         fts->master->cur_msg->status = -EIO;
      |                    ^~
drivers/spi/spi-phytium.c:163:42: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  163 |         spi_finalize_current_transfer(fts->master);
      |                                       ~~~^~~~~~~~
      |                                          |
      |                                          struct spi_master *
In file included from drivers/spi/spi-phytium.c:19:
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functioninterrupt_transfer’:
drivers/spi/spi-phytium.c:179:50: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  179 |                 spi_finalize_current_transfer(fts->master);
      |                                               ~~~^~~~~~~~
      |                                                  |
      |                                                  struct spi_master *
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_irq’:
drivers/spi/spi-phytium.c:194:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
  194 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium.c:194:62: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-phytium.c:200:20: error: invalid use of undefined typestruct spi_master200 |         if (!master->cur_msg) {
      |                    ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_transfer_one’:
drivers/spi/spi-phytium.c:225:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  225 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:281:19: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                   ^~
drivers/spi/spi-phytium.c:281:38: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                                      ^~
drivers/spi/spi-phytium.c:282:41: error: invalid use of undefined typestruct spi_master282 |                 fts->dma_mapped = master->cur_msg_mapped;
      |                                         ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_handle_err’:
drivers/spi/spi-phytium.c:318:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  318 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_setup’:
drivers/spi/spi-phytium.c:330:40: error: ‘struct spi_devicehas no member namedmaster330 |         struct spi_master *master = spi->master;
      |                                        ^~
drivers/spi/spi-phytium.c:331:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  331 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_add_host’:
drivers/spi/spi-phytium.c:400:16: error: assignment tostruct spi_master *from incompatible pointer typestruct spi_controller *’ [-Werror=incompatible-pointer-types]
  400 |         master = spi_alloc_master(dev, 0);
      |                ^
drivers/spi/spi-phytium.c:415:15: error: invalid use of undefined typestruct spi_master415 |         master->use_gpio_descriptors = true;
      |               ^~
drivers/spi/spi-phytium.c:416:15: error: invalid use of undefined typestruct spi_master416 |         master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
      |               ^~
drivers/spi/spi-phytium.c:417:15: error: invalid use of undefined typestruct spi_master417 |         master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
      |               ^~
drivers/spi/spi-phytium.c:418:15: error: invalid use of undefined typestruct spi_master418 |         master->bus_num = fts->bus_num;
      |               ^~
drivers/spi/spi-phytium.c:419:15: error: invalid use of undefined typestruct spi_master419 |         master->num_chipselect = fts->num_cs;
      |               ^~
drivers/spi/spi-phytium.c:420:15: error: invalid use of undefined typestruct spi_master420 |         master->setup = phytium_spi_setup;
      |               ^~
drivers/spi/spi-phytium.c:421:15: error: invalid use of undefined typestruct spi_master421 |         master->cleanup = phytium_spi_cleanup;
      |               ^~
drivers/spi/spi-phytium.c:422:15: error: invalid use of undefined typestruct spi_master422 |         master->set_cs = phytium_spi_set_cs;
      |               ^~
drivers/spi/spi-phytium.c:423:15: error: invalid use of undefined typestruct spi_master423 |         master->transfer_one = phytium_spi_transfer_one;
      |               ^~
drivers/spi/spi-phytium.c:424:15: error: invalid use of undefined typestruct spi_master424 |         master->handle_err = phytium_spi_handle_err;
      |               ^~
drivers/spi/spi-phytium.c:425:15: error: invalid use of undefined typestruct spi_master425 |         master->max_speed_hz = fts->max_freq;
      |               ^~
drivers/spi/spi-phytium.c:426:15: error: invalid use of undefined typestruct spi_master426 |         master->dev.of_node = dev->of_node;
      |               ^~
drivers/spi/spi-phytium.c:427:15: error: invalid use of undefined typestruct spi_master427 |         master->dev.fwnode = dev->fwnode;
      |               ^~
drivers/spi/spi-phytium.c:428:15: error: invalid use of undefined typestruct spi_master428 |         master->flags = SPI_CONTROLLER_GPIO_SS;
      |               ^~
drivers/spi/spi-phytium.c:437:31: error: invalid use of undefined typestruct spi_master437 |                         master->can_dma = fts->dma_ops->can_dma;
      |                               ^~
drivers/spi/spi-phytium.c:438:31: error: invalid use of undefined typestruct spi_master438 |                         master->flags |= SPI_CONTROLLER_MUST_TX;
      |                               ^~
drivers/spi/spi-phytium.c:442:36: error: passing argument 1 ofspi_controller_set_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  442 |         spi_controller_set_devdata(master, fts);
      |                                    ^~~~~~
      |                                    |
      |                                    struct spi_master *
./include/linux/spi/spi.h:785:70: note: expectedstruct spi_controller *but argument is of typestruct spi_master *785 | static inline void spi_controller_set_devdata(struct spi_controller *ctlr,
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:443:39: error: passing argument 1 ofspi_register_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  443 |         ret = spi_register_controller(master);
      |                                       ^~~~~~
      |                                       |
      |                                       struct spi_master *
./include/linux/spi/spi.h:899:59: note: expectedstruct spi_controller *but argument is of typestruct spi_master *899 | extern int spi_register_controller(struct spi_controller *ctlr);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:445:32: error: invalid use of undefined typestruct spi_master445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                                ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:445:17: note: in expansion of macrodev_err445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-pci.c: In functionspi_suspend’:
drivers/spi/spi-phytium-pci.c:92:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
   92 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium-pci.c:92:62: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-phytium-pci.c:91:28: error: unused variablemaster’ [-Werror=unused-variable]
   91 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_init’:
drivers/spi/spi-phytium-dma.c:79:20: error: invalid use of undefined typestruct spi_master79 |         fts->master->dma_rx = fts->rxchan;
      |                    ^~
drivers/spi/spi-phytium-dma.c:80:20: error: invalid use of undefined typestruct spi_master80 |         fts->master->dma_tx = fts->txchan;
      |                    ^~
In file included from ./include/linux/device.h:15,
                 from ./include/linux/dma-mapping.h:8,
                 from drivers/spi/spi-phytium-dma.c:8:
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait’:
drivers/spi/spi-phytium-dma.c:146:37: error: invalid use of undefined typestruct spi_master146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:146:17: note: in expansion of macrodev_err146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_tx_done’:
drivers/spi/spi-phytium-dma.c:190:37: error: invalid use of undefined typestruct spi_master190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:190:17: note: in expansion of macrodev_err190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_rx_done’:
drivers/spi/spi-phytium-dma.c:283:37: error: invalid use of undefined typestruct spi_master283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:283:17: note: in expansion of macrodev_err283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:457:9: error: implicit declaration of functionspi_master_put’; did you meanspi_dev_put’? [-Werror=implicit-function-declaration]
  457 |         spi_master_put(master);
      |         ^~~~~~~~~~~~~~
      |         spi_dev_put
drivers/spi/spi-phytium.c: In functionphytium_spi_remove_host’:
drivers/spi/spi-phytium-pci.c: In functionspi_resume’:
drivers/spi/spi-phytium-pci.c:100:62: error: ‘spi_controllerundeclared (first use in this function)
  100 |         struct phytium_spi *fts = spi_controller_get_devdata(spi_controller);
      |                                                              ^~~~~~~~~~~~~~
drivers/spi/spi-phytium-pci.c:99:28: error: unused variablemaster’ [-Werror=unused-variable]
   99 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
drivers/spi/spi-phytium.c:468:38: error: passing argument 1 ofspi_unregister_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  468 |         spi_unregister_controller(fts->master);
      |                                   ~~~^~~~~~~~
      |                                      |
      |                                      struct spi_master *
./include/linux/spi/spi.h:902:62: note: expectedstruct spi_controller *but argument is of typestruct spi_master *902 | extern void spi_unregister_controller(struct spi_controller *ctlr);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_suspend_host’:
drivers/spi/spi-phytium.c:478:41: error: passing argument 1 ofspi_controller_suspendfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  478 |         ret = spi_controller_suspend(fts->master);
      |                                      ~~~^~~~~~~~
      |                                         |
      |                                         struct spi_master *
./include/linux/spi/spi.h:815:58: note: expectedstruct spi_controller *but argument is of typestruct spi_master *815 | extern int spi_controller_suspend(struct spi_controller *ctlr);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_resume_host’:
drivers/spi/spi-phytium.c:491:33: error: invalid use of undefined typestruct spi_master491 |         spi_hw_init(&fts->master->dev, fts);
      |                                 ^~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_transfer’:
drivers/spi/spi-phytium-dma.c:514:24: error: invalid use of undefined typestruct spi_master514 |         if (fts->master->cur_msg->status == -EINPROGRESS) {
      |                        ^~
drivers/spi/spi-phytium-dma.c:520:40: error: invalid use of undefined typestruct spi_master520 |         if (xfer->rx_buf && fts->master->cur_msg->status == -EINPROGRESS)
      |                                        ^~
cc1: all warnings being treated as errors
drivers/spi/spi-phytium.c:492:37: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
  492 |         ret = spi_controller_resume(controller);
      |                                     ^~~~~~~~~~
      |                                     spi_controller
drivers/spi/spi-phytium.c:494:37: error: invalid use of undefined typestruct spi_master494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:494:17: note: in expansion of macrodev_err494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                 ^~~~~~~
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-pci.o] 错误 1
make[7]: *** 正在等待未完成的任务....
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-dma.o] 错误 1
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium.o] 错误 1
make[6]: *** [scripts/Makefile.build:485drivers/spi] 错误 2
make[6]: *** 正在等待未完成的任务....
  CHK     kernel/kheaders_data.tar.xz
^Cmake[6]: *** [scripts/Makefile.build:485: fs/xfs] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/i915] 中断
make[9]: *** [scripts/Makefile.build:485: drivers/net/ethernet/mellanox/mlx5/core] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/nouveau] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/gpu/drm/amd/amdgpu] 中断
make[8]: *** [scripts/Makefile.build:485: drivers/net/ethernet/mellanox] 中断
make[5]: *** [scripts/Makefile.build:485: fs] 中断
make[7]: *** [scripts/Makefile.build:485: drivers/net/ethernet] 中断
make[7]: *** [scripts/Makefile.build:485: sound/soc/codecs] 中断
make[7]: *** [scripts/Makefile.build:485: drivers/gpu/drm] 中断
make[6]: *** [scripts/Makefile.build:485: drivers/net] 中断
make[6]: *** [scripts/Makefile.build:485: drivers/gpu] 中断
make[6]: *** [scripts/Makefile.build:485: sound/soc] 中断
make[5]: *** [scripts/Makefile.build:485: drivers] 中断
make[5]: *** [scripts/Makefile.build:485: sound] 中断
make[4]: *** [Makefile:1915: .] 中断
make[3]: *** [debian/rules:74: build-arch] 中断
dpkg-buildpackage: error: make -f debian/rules binary subprocess was killed by signal 2
make[2]: *** [scripts/Makefile.package:121: bindeb-pkg] 中断
make[1]: *** [/root/linux/Makefile:1537: bindeb-pkg] 中断
make: *** [Makefile:240: __sub-make] 中断

root@deepinci-amd7:~/linux# ^C
root@deepinci-amd7:~/linux# make bindeb-pkg -j$(nproc)
  GEN     debian
dpkg-buildpackage --build=binary --no-pre-clean --unsigned-changes -R'make -f debian/rules' -j1 -a$(cat debian/arch)
^Cmake[2]: *** [scripts/Makefile.package:121: bindeb-pkg] 中断
make[1]: *** [/root/linux/Makefile:1537: bindeb-pkg] 中断
make: *** [Makefile:240: __sub-make] 中断

root@deepinci-amd7:~/linux# nano +492 drivers/spi/spi-phytium.c
root@deepinci-amd7:~/linux# nano +492 drivers/spi/spi-phytium.c
root@deepinci-amd7:~/linux# make bindeb-pkg -j$(nproc)
  GEN     debian
dpkg-buildpackage --build=binary --no-pre-clean --unsigned-changes -R'make -f debian/rules' -j1 -a$(cat debian/arch)
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 23.01.01.01
dpkg-buildpackage: info: source distribution beige
dpkg-buildpackage: info: source changed by root <root@deepinci-amd7>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 make -f debian/rules binary                                                                
#                                                                                           
# No change to .config
#
mkdir -p /root/linux/tools/objtool && make O=/root/linux subdir=tools/objtool --no-print-directory -C objtool 
mkdir -p /root/linux/tools/bpf/resolve_btfids && make O=/root/linux subdir=tools/bpf/resolve_btfids --no-print-directory -C bpf/resolve_btfids 
  INSTALL libsubcmd_headers
  INSTALL libsubcmd_headers
  CALL    scripts/checksyscalls.sh
  CC [M]  drivers/spi/spi-phytium.o
  CC [M]  drivers/spi/spi-phytium-pci.o
  CC [M]  drivers/spi/spi-phytium-dma.o
In file included from ./include/linux/bits.h:6,
                 from ./include/linux/bitops.h:6,
                 from ./include/linux/kernel.h:23,
                 from ./include/linux/clk.h:13,
                 from drivers/spi/spi-phytium.c:11:
drivers/spi/spi-phytium.c: In functionphytium_spi_set_cs’:
./include/vdso/bits.h:7:40: error: invalid operands to binary << (have ‘long unsigned intandu8 *’ {aka ‘unsigned char *’})
    7 | #define BIT(nr)                 (UL(1) << (nr))
      |                                        ^~
      |                                        |
      |                                        u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:56:42: note: in expansion of macroBIT56 |                 phytium_writel(fts, SER, BIT(spi->chip_select));
      |                                          ^~~
drivers/spi/spi-phytium.c:59:63: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   59 |                         phytium_writel(fts, GCSR, origin | (1 << spi->chip_select));
      |                                                               ^~
      |                                                               |
      |                                                               u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:64:64: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   64 |                         phytium_writel(fts, GCSR, origin & ~(1 << spi->chip_select));
      |                                                                ^~
      |                                                                |
      |                                                                u8 * {aka unsigned char *}
In file included from ./include/linux/device.h:15,
                 from ./include/linux/platform_device.h:13,
                 from drivers/spi/spi-phytium.c:17:
drivers/spi/spi-phytium.c: In functionphytium_spi_check_status’:
drivers/spi/spi-phytium.c:133:37: error: invalid use of undefined typestruct spi_master133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:133:17: note: in expansion of macrodev_err133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:138:37: error: invalid use of undefined typestruct spi_master138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:138:17: note: in expansion of macrodev_err138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:143:37: error: invalid use of undefined typestruct spi_master143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:143:17: note: in expansion of macrodev_err143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:150:32: error: invalid use of undefined typestruct spi_master150 |                 if (fts->master->cur_msg)
      |                                ^~
drivers/spi/spi-phytium.c:151:36: error: invalid use of undefined typestruct spi_master151 |                         fts->master->cur_msg->status = ret;
      |                                    ^~
drivers/spi/spi-phytium.c: In functionint_error_stop’:
drivers/spi/spi-phytium.c:161:29: error: invalid use of undefined typestruct spi_master161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |                             ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:161:9: note: in expansion of macrodev_err161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |         ^~~~~~~
drivers/spi/spi-phytium.c:162:20: error: invalid use of undefined typestruct spi_master162 |         fts->master->cur_msg->status = -EIO;
      |                    ^~
drivers/spi/spi-phytium.c:163:42: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  163 |         spi_finalize_current_transfer(fts->master);
      |                                       ~~~^~~~~~~~
      |                                          |
      |                                          struct spi_master *
In file included from drivers/spi/spi-phytium.c:19:
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functioninterrupt_transfer’:
drivers/spi/spi-phytium.c:179:50: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  179 |                 spi_finalize_current_transfer(fts->master);
      |                                               ~~~^~~~~~~~
      |                                                  |
      |                                                  struct spi_master *
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_init’:
drivers/spi/spi-phytium-dma.c:79:20: error: invalid use of undefined typestruct spi_master79 |         fts->master->dma_rx = fts->rxchan;
      |                    ^~
drivers/spi/spi-phytium-dma.c:80:20: error: invalid use of undefined typestruct spi_master80 |         fts->master->dma_tx = fts->txchan;
      |                    ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_irq’:
drivers/spi/spi-phytium.c:194:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
  194 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium.c:194:62: note: each undeclared identifier is reported only once for each function it appears in
In file included from ./include/linux/device.h:15,
                 from ./include/linux/dma-mapping.h:8,
                 from drivers/spi/spi-phytium-dma.c:8:
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait’:
drivers/spi/spi-phytium.c:200:20: error: invalid use of undefined typestruct spi_master200 |         if (!master->cur_msg) {
      |                    ^~
drivers/spi/spi-phytium-dma.c:146:37: error: invalid use of undefined typestruct spi_master146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:146:17: note: in expansion of macrodev_err146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                 ^~~~~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_transfer_one’:
drivers/spi/spi-phytium.c:225:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  225 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_tx_done’:
drivers/spi/spi-phytium-dma.c:190:37: error: invalid use of undefined typestruct spi_master190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:190:17: note: in expansion of macrodev_err190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:281:19: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                   ^~
drivers/spi/spi-phytium.c:281:38: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                                      ^~
drivers/spi/spi-phytium.c:282:41: error: invalid use of undefined typestruct spi_master282 |                 fts->dma_mapped = master->cur_msg_mapped;
      |                                         ^~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_rx_done’:
drivers/spi/spi-phytium-dma.c:283:37: error: invalid use of undefined typestruct spi_master283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:283:17: note: in expansion of macrodev_err283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                 ^~~~~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_handle_err’:
drivers/spi/spi-phytium.c:318:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  318 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_setup’:
drivers/spi/spi-phytium.c:330:40: error: ‘struct spi_devicehas no member namedmaster330 |         struct spi_master *master = spi->master;
      |                                        ^~
drivers/spi/spi-phytium.c:331:62: error: passing argument 1 ofspi_controller_get_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  331 |         struct phytium_spi *fts = spi_controller_get_devdata(master);
      |                                                              ^~~~~~
      |                                                              |
      |                                                              struct spi_master *
./include/linux/spi/spi.h:780:71: note: expectedstruct spi_controller *but argument is of typestruct spi_master *780 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
      |                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_add_host’:
drivers/spi/spi-phytium.c:400:16: error: assignment tostruct spi_master *from incompatible pointer typestruct spi_controller *’ [-Werror=incompatible-pointer-types]
  400 |         master = spi_alloc_master(dev, 0);
      |                ^
drivers/spi/spi-phytium.c:415:15: error: invalid use of undefined typestruct spi_master415 |         master->use_gpio_descriptors = true;
      |               ^~
drivers/spi/spi-phytium.c:416:15: error: invalid use of undefined typestruct spi_master416 |         master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
      |               ^~
drivers/spi/spi-phytium.c:417:15: error: invalid use of undefined typestruct spi_master417 |         master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
      |               ^~
drivers/spi/spi-phytium.c:418:15: error: invalid use of undefined typestruct spi_master418 |         master->bus_num = fts->bus_num;
      |               ^~
drivers/spi/spi-phytium.c:419:15: error: invalid use of undefined typestruct spi_master419 |         master->num_chipselect = fts->num_cs;
      |               ^~
drivers/spi/spi-phytium-pci.c: In functionspi_suspend’:
drivers/spi/spi-phytium.c:420:15: error: invalid use of undefined typestruct spi_master420 |         master->setup = phytium_spi_setup;
      |               ^~
drivers/spi/spi-phytium-pci.c:92:62: error: ‘controllerundeclared (first use in this function); did you meanspi_controller’?
   92 |         struct phytium_spi *fts = spi_controller_get_devdata(controller);
      |                                                              ^~~~~~~~~~
      |                                                              spi_controller
drivers/spi/spi-phytium.c:421:15: error: invalid use of undefined typestruct spi_master421 |         master->cleanup = phytium_spi_cleanup;
      |               ^~
drivers/spi/spi-phytium-pci.c:92:62: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-phytium.c:422:15: error: invalid use of undefined typestruct spi_master422 |         master->set_cs = phytium_spi_set_cs;
      |               ^~
drivers/spi/spi-phytium-pci.c:91:28: error: unused variablemaster’ [-Werror=unused-variable]
   91 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
drivers/spi/spi-phytium.c:423:15: error: invalid use of undefined typestruct spi_master423 |         master->transfer_one = phytium_spi_transfer_one;
      |               ^~
drivers/spi/spi-phytium.c:424:15: error: invalid use of undefined typestruct spi_master424 |         master->handle_err = phytium_spi_handle_err;
      |               ^~
drivers/spi/spi-phytium.c:425:15: error: invalid use of undefined typestruct spi_master425 |         master->max_speed_hz = fts->max_freq;
      |               ^~
drivers/spi/spi-phytium.c:426:15: error: invalid use of undefined typestruct spi_master426 |         master->dev.of_node = dev->of_node;
      |               ^~
drivers/spi/spi-phytium.c:427:15: error: invalid use of undefined typestruct spi_master427 |         master->dev.fwnode = dev->fwnode;
      |               ^~
drivers/spi/spi-phytium.c:428:15: error: invalid use of undefined typestruct spi_master428 |         master->flags = SPI_CONTROLLER_GPIO_SS;
      |               ^~
drivers/spi/spi-phytium.c:437:31: error: invalid use of undefined typestruct spi_master437 |                         master->can_dma = fts->dma_ops->can_dma;
      |                               ^~
drivers/spi/spi-phytium.c:438:31: error: invalid use of undefined typestruct spi_master438 |                         master->flags |= SPI_CONTROLLER_MUST_TX;
      |                               ^~
drivers/spi/spi-phytium.c:442:36: error: passing argument 1 ofspi_controller_set_devdatafrom incompatible pointer type [-Werror=incompatible-pointer-types]
  442 |         spi_controller_set_devdata(master, fts);
      |                                    ^~~~~~
      |                                    |
      |                                    struct spi_master *
./include/linux/spi/spi.h:785:70: note: expectedstruct spi_controller *but argument is of typestruct spi_master *785 | static inline void spi_controller_set_devdata(struct spi_controller *ctlr,
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:443:39: error: passing argument 1 ofspi_register_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  443 |         ret = spi_register_controller(master);
      |                                       ^~~~~~
      |                                       |
      |                                       struct spi_master *
./include/linux/spi/spi.h:899:59: note: expectedstruct spi_controller *but argument is of typestruct spi_master *899 | extern int spi_register_controller(struct spi_controller *ctlr);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:445:32: error: invalid use of undefined typestruct spi_master445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                                ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:445:17: note: in expansion of macrodev_err445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_transfer’:
drivers/spi/spi-phytium-dma.c:514:24: error: invalid use of undefined typestruct spi_master514 |         if (fts->master->cur_msg->status == -EINPROGRESS) {
      |                        ^~
drivers/spi/spi-phytium-dma.c:520:40: error: invalid use of undefined typestruct spi_master520 |         if (xfer->rx_buf && fts->master->cur_msg->status == -EINPROGRESS)
      |                                        ^~
drivers/spi/spi-phytium-pci.c: In functionspi_resume’:
drivers/spi/spi-phytium-pci.c:100:62: error: ‘spi_controllerundeclared (first use in this function)
  100 |         struct phytium_spi *fts = spi_controller_get_devdata(spi_controller);
      |                                                              ^~~~~~~~~~~~~~
drivers/spi/spi-phytium-pci.c:99:28: error: unused variablemaster’ [-Werror=unused-variable]
   99 |         struct spi_master *master = dev_get_drvdata(dev);
      |                            ^~~~~~
cc1: all warnings being treated as errors
drivers/spi/spi-phytium.c:457:9: error: implicit declaration of functionspi_master_put’; did you meanspi_dev_put’? [-Werror=implicit-function-declaration]
  457 |         spi_master_put(master);
      |         ^~~~~~~~~~~~~~
      |         spi_dev_put
drivers/spi/spi-phytium.c: In functionphytium_spi_remove_host’:
drivers/spi/spi-phytium.c:468:38: error: passing argument 1 ofspi_unregister_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  468 |         spi_unregister_controller(fts->master);
      |                                   ~~~^~~~~~~~
      |                                      |
      |                                      struct spi_master *
./include/linux/spi/spi.h:902:62: note: expectedstruct spi_controller *but argument is of typestruct spi_master *902 | extern void spi_unregister_controller(struct spi_controller *ctlr);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_suspend_host’:
drivers/spi/spi-phytium.c:478:41: error: passing argument 1 ofspi_controller_suspendfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  478 |         ret = spi_controller_suspend(fts->master);
      |                                      ~~~^~~~~~~~
      |                                         |
      |                                         struct spi_master *
./include/linux/spi/spi.h:815:58: note: expectedstruct spi_controller *but argument is of typestruct spi_master *815 | extern int spi_controller_suspend(struct spi_controller *ctlr);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_resume_host’:
drivers/spi/spi-phytium.c:491:33: error: invalid use of undefined typestruct spi_master491 |         spi_hw_init(&fts->master->dev, fts);
      |                                 ^~
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-dma.o] 错误 1
make[7]: *** 正在等待未完成的任务....
drivers/spi/spi-phytium.c:492:37: error: ‘spi_controllerundeclared (first use in this function)
  492 |         ret = spi_controller_resume(spi_controller);
      |                                     ^~~~~~~~~~~~~~
drivers/spi/spi-phytium.c:494:37: error: invalid use of undefined typestruct spi_master494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:494:17: note: in expansion of macrodev_err494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                 ^~~~~~~
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-pci.o] 错误 1
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium.o] 错误 1
make[6]: *** [scripts/Makefile.build:485drivers/spi] 错误 2
make[6]: *** 正在等待未完成的任务....
  CHK     kernel/kheaders_data.tar.xz
make[5]: *** [scripts/Makefile.build:485drivers] 错误 2
make[4]: *** [Makefile:1915:.] 错误 2
make[3]: *** [debian/rules:74build-arch] 错误 2
dpkg-buildpackage: error: make -f debian/rules binary subprocess returned exit status 2
make[2]: *** [scripts/Makefile.package:121bindeb-pkg] 错误 2
make[1]: *** [/root/linux/Makefile:1537bindeb-pkg] 错误 2
make: *** [Makefile:240__sub-make] 错误 2
root@deepinci-amd7:~/linux# ^C
root@deepinci-amd7:~/linux# git checkout -- drivers
root@deepinci-amd7:~/linux# make bindeb-pkg -j$(nproc)
  GEN     debian
dpkg-buildpackage --build=binary --no-pre-clean --unsigned-changes -R'make -f debian/rules' -j1 -a$(cat debian/arch)
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 23.01.01.01
dpkg-buildpackage: info: source distribution beige
dpkg-buildpackage: info: source changed by root <root@deepinci-amd7>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 make -f debian/rules binary                                                                
#                                                                                           
# No change to .config
#
mkdir -p /root/linux/tools/objtool && make O=/root/linux subdir=tools/objtool --no-print-directory -C objtool 
mkdir -p /root/linux/tools/bpf/resolve_btfids && make O=/root/linux subdir=tools/bpf/resolve_btfids --no-print-directory -C bpf/resolve_btfids 
  INSTALL libsubcmd_headers
  INSTALL libsubcmd_headers
  CALL    scripts/checksyscalls.sh
  CC [M]  drivers/spi/spi-phytium.o
  CC [M]  drivers/spi/spi-phytium-pci.o
  CC [M]  drivers/spi/spi-phytium-dma.o
  CHK     kernel/kheaders_data.tar.xz
drivers/spi/spi-phytium.c: In functionphytium_spi_set_cs’:
drivers/spi/spi-phytium.c:48:35: error: implicit declaration of functionspi_master_get_devdata’; did you meanspi_controller_get_devdata’? [-Werror=implicit-function-declaration]
   48 |         struct phytium_spi *fts = spi_master_get_devdata(spi->master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                   spi_controller_get_devdata
drivers/spi/spi-phytium.c:48:61: error: ‘struct spi_devicehas no member namedmaster48 |         struct phytium_spi *fts = spi_master_get_devdata(spi->master);
      |                                                             ^~
In file included from ./include/linux/bits.h:6,
                 from ./include/linux/bitops.h:6,
                 from ./include/linux/kernel.h:23,
                 from ./include/linux/clk.h:13,
                 from drivers/spi/spi-phytium.c:11:
./include/vdso/bits.h:7:40: error: invalid operands to binary << (have ‘long unsigned intandu8 *’ {aka ‘unsigned char *’})
    7 | #define BIT(nr)                 (UL(1) << (nr))
      |                                        ^~
      |                                        |
      |                                        u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:56:42: note: in expansion of macroBIT56 |                 phytium_writel(fts, SER, BIT(spi->chip_select));
      |                                          ^~~
drivers/spi/spi-phytium.c:59:63: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   59 |                         phytium_writel(fts, GCSR, origin | (1 << spi->chip_select));
      |                                                               ^~
      |                                                               |
      |                                                               u8 * {aka unsigned char *}
drivers/spi/spi-phytium.c:64:64: error: invalid operands to binary << (haveintandu8 *’ {aka ‘unsigned char *’})
   64 |                         phytium_writel(fts, GCSR, origin & ~(1 << spi->chip_select));
      |                                                                ^~
      |                                                                |
      |                                                                u8 * {aka unsigned char *}
In file included from ./include/linux/device.h:15,
                 from ./include/linux/platform_device.h:13,
                 from drivers/spi/spi-phytium.c:17:
drivers/spi/spi-phytium.c: In functionphytium_spi_check_status’:
drivers/spi/spi-phytium.c:133:37: error: invalid use of undefined typestruct spi_master133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:133:17: note: in expansion of macrodev_err133 |                 dev_err(&fts->master->dev, "RX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:138:37: error: invalid use of undefined typestruct spi_master138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:138:17: note: in expansion of macrodev_err138 |                 dev_err(&fts->master->dev, "RX FIFO underflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:143:37: error: invalid use of undefined typestruct spi_master143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:143:17: note: in expansion of macrodev_err143 |                 dev_err(&fts->master->dev, "TX FIFO overflow detected\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium.c:150:32: error: invalid use of undefined typestruct spi_master150 |                 if (fts->master->cur_msg)
      |                                ^~
drivers/spi/spi-phytium.c:151:36: error: invalid use of undefined typestruct spi_master151 |                         fts->master->cur_msg->status = ret;
      |                                    ^~
drivers/spi/spi-phytium.c: In functionint_error_stop’:
drivers/spi/spi-phytium.c:161:29: error: invalid use of undefined typestruct spi_master161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |                             ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:161:9: note: in expansion of macrodev_err161 |         dev_err(&fts->master->dev, "%s\n", msg);
      |         ^~~~~~~
drivers/spi/spi-phytium.c:162:20: error: invalid use of undefined typestruct spi_master162 |         fts->master->cur_msg->status = -EIO;
      |                    ^~
drivers/spi/spi-phytium.c:163:42: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  163 |         spi_finalize_current_transfer(fts->master);
      |                                       ~~~^~~~~~~~
      |                                          |
      |                                          struct spi_master *
In file included from drivers/spi/spi-phytium.c:19:
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functioninterrupt_transfer’:
drivers/spi/spi-phytium.c:179:50: error: passing argument 1 ofspi_finalize_current_transferfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  179 |                 spi_finalize_current_transfer(fts->master);
      |                                               ~~~^~~~~~~~
      |                                                  |
      |                                                  struct spi_master *
./include/linux/spi/spi.h:821:66: note: expectedstruct spi_controller *but argument is of typestruct spi_master *821 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_irq’:
drivers/spi/spi-phytium.c:194:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
  194 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-phytium.c:200:20: error: invalid use of undefined typestruct spi_master200 |         if (!master->cur_msg) {
      |                    ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_transfer_one’:
drivers/spi/spi-phytium.c:225:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
  225 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-phytium.c:281:19: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                   ^~
drivers/spi/spi-phytium.c:281:38: error: invalid use of undefined typestruct spi_master281 |         if (master->can_dma && master->can_dma(master, spi, transfer))
      |                                      ^~
drivers/spi/spi-phytium.c:282:41: error: invalid use of undefined typestruct spi_master282 |                 fts->dma_mapped = master->cur_msg_mapped;
      |                                         ^~
drivers/spi/spi-phytium.c: In functionphytium_spi_handle_err’:
drivers/spi/spi-phytium.c:318:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
  318 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_setup’:
drivers/spi/spi-phytium.c:330:40: error: ‘struct spi_devicehas no member namedmaster330 |         struct spi_master *master = spi->master;
      |                                        ^~
drivers/spi/spi-phytium.c:331:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
  331 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_add_host’:
drivers/spi/spi-phytium.c:400:16: error: assignment tostruct spi_master *from incompatible pointer typestruct spi_controller *’ [-Werror=incompatible-pointer-types]
  400 |         master = spi_alloc_master(dev, 0);
      |                ^
drivers/spi/spi-phytium.c:415:15: error: invalid use of undefined typestruct spi_master415 |         master->use_gpio_descriptors = true;
      |               ^~
drivers/spi/spi-phytium.c:416:15: error: invalid use of undefined typestruct spi_master416 |         master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
      |               ^~
drivers/spi/spi-phytium.c:417:15: error: invalid use of undefined typestruct spi_master417 |         master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
      |               ^~
drivers/spi/spi-phytium.c:418:15: error: invalid use of undefined typestruct spi_master418 |         master->bus_num = fts->bus_num;
      |               ^~
drivers/spi/spi-phytium.c:419:15: error: invalid use of undefined typestruct spi_master419 |         master->num_chipselect = fts->num_cs;
      |               ^~
drivers/spi/spi-phytium.c:420:15: error: invalid use of undefined typestruct spi_master420 |         master->setup = phytium_spi_setup;
      |               ^~
drivers/spi/spi-phytium.c:421:15: error: invalid use of undefined typestruct spi_master421 |         master->cleanup = phytium_spi_cleanup;
      |               ^~
drivers/spi/spi-phytium.c:422:15: error: invalid use of undefined typestruct spi_master422 |         master->set_cs = phytium_spi_set_cs;
      |               ^~
drivers/spi/spi-phytium.c:423:15: error: invalid use of undefined typestruct spi_master423 |         master->transfer_one = phytium_spi_transfer_one;
      |               ^~
drivers/spi/spi-phytium.c:424:15: error: invalid use of undefined typestruct spi_master424 |         master->handle_err = phytium_spi_handle_err;
      |               ^~
drivers/spi/spi-phytium.c:425:15: error: invalid use of undefined typestruct spi_master425 |         master->max_speed_hz = fts->max_freq;
      |               ^~
drivers/spi/spi-phytium.c:426:15: error: invalid use of undefined typestruct spi_master426 |         master->dev.of_node = dev->of_node;
      |               ^~
drivers/spi/spi-phytium.c:427:15: error: invalid use of undefined typestruct spi_master427 |         master->dev.fwnode = dev->fwnode;
      |               ^~
drivers/spi/spi-phytium.c:428:15: error: invalid use of undefined typestruct spi_master428 |         master->flags = SPI_CONTROLLER_GPIO_SS;
      |               ^~
drivers/spi/spi-phytium.c:437:31: error: invalid use of undefined typestruct spi_master437 |                         master->can_dma = fts->dma_ops->can_dma;
      |                               ^~
drivers/spi/spi-phytium.c:438:31: error: invalid use of undefined typestruct spi_master438 |                         master->flags |= SPI_CONTROLLER_MUST_TX;
      |                               ^~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_init’:
drivers/spi/spi-phytium-dma.c:79:20: error: invalid use of undefined typestruct spi_master79 |         fts->master->dma_rx = fts->rxchan;
      |                    ^~
drivers/spi/spi-phytium-dma.c:80:20: error: invalid use of undefined typestruct spi_master80 |         fts->master->dma_tx = fts->txchan;
      |                    ^~
In file included from ./include/linux/device.h:15,
                 from ./include/linux/dma-mapping.h:8,
                 from drivers/spi/spi-phytium-dma.c:8:
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait’:
drivers/spi/spi-phytium-dma.c:146:37: error: invalid use of undefined typestruct spi_master146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:146:17: note: in expansion of macrodev_err146 |                 dev_err(&fts->master->cur_msg->spi->dev,
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_tx_done’:
drivers/spi/spi-phytium-dma.c:190:37: error: invalid use of undefined typestruct spi_master190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:190:17: note: in expansion of macrodev_err190 |                 dev_err(&fts->master->dev, "Tx hanged up\n");
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_wait_rx_done’:
drivers/spi/spi-phytium-dma.c:283:37: error: invalid use of undefined typestruct spi_master283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium-dma.c:283:17: note: in expansion of macrodev_err283 |                 dev_err(&fts->master->dev, "Rx hanged up, nents = %d\n", nents);
      |                 ^~~~~~~
drivers/spi/spi-phytium-dma.c: In functionphytium_spi_dma_transfer’:
drivers/spi/spi-phytium-dma.c:514:24: error: invalid use of undefined typestruct spi_master514 |         if (fts->master->cur_msg->status == -EINPROGRESS) {
      |                        ^~
drivers/spi/spi-phytium-pci.c: In functionspi_suspend’:
drivers/spi/spi-phytium-pci.c:92:35: error: implicit declaration of functionspi_master_get_devdata’; did you meanspi_controller_get_devdata’? [-Werror=implicit-function-declaration]
   92 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                   spi_controller_get_devdata
drivers/spi/spi-phytium-pci.c:92:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
drivers/spi/spi-phytium-dma.c:520:40: error: invalid use of undefined typestruct spi_master520 |         if (xfer->rx_buf && fts->master->cur_msg->status == -EINPROGRESS)
      |                                        ^~
drivers/spi/spi-phytium-pci.c: In functionspi_resume’:
drivers/spi/spi-phytium-pci.c:100:35: error: initialization ofstruct phytium_spi *fromintmakes pointer from integer without a cast [-Werror=int-conversion]
  100 |         struct phytium_spi *fts = spi_master_get_devdata(master);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-phytium.c:442:9: error: implicit declaration of functionspi_master_set_devdata’; did you meanspi_controller_set_devdata’? [-Werror=implicit-function-declaration]
  442 |         spi_master_set_devdata(master, fts);
      |         ^~~~~~~~~~~~~~~~~~~~~~
      |         spi_controller_set_devdata
drivers/spi/spi-phytium.c:443:39: error: passing argument 1 ofspi_register_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  443 |         ret = spi_register_controller(master);
      |                                       ^~~~~~
      |                                       |
      |                                       struct spi_master *
./include/linux/spi/spi.h:899:59: note: expectedstruct spi_controller *but argument is of typestruct spi_master *899 | extern int spi_register_controller(struct spi_controller *ctlr);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:445:32: error: invalid use of undefined typestruct spi_master445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                                ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:445:17: note: in expansion of macrodev_err445 |                 dev_err(&master->dev, "problem registering spi master\n");
      |                 ^~~~~~~
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-dma.o] 错误 1
make[7]: *** 正在等待未完成的任务....
drivers/spi/spi-phytium.c:457:9: error: implicit declaration of functionspi_master_put’; did you meanspi_dev_put’? [-Werror=implicit-function-declaration]
  457 |         spi_master_put(master);
      |         ^~~~~~~~~~~~~~
      |         spi_dev_put
drivers/spi/spi-phytium.c: In functionphytium_spi_remove_host’:
drivers/spi/spi-phytium.c:468:38: error: passing argument 1 ofspi_unregister_controllerfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  468 |         spi_unregister_controller(fts->master);
      |                                   ~~~^~~~~~~~
      |                                      |
      |                                      struct spi_master *
./include/linux/spi/spi.h:902:62: note: expectedstruct spi_controller *but argument is of typestruct spi_master *902 | extern void spi_unregister_controller(struct spi_controller *ctlr);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c: In functionphytium_spi_suspend_host’:
drivers/spi/spi-phytium.c:478:41: error: passing argument 1 ofspi_controller_suspendfrom incompatible pointer type [-Werror=incompatible-pointer-types]
  478 |         ret = spi_controller_suspend(fts->master);
      |                                      ~~~^~~~~~~~
      |                                         |
      |                                         struct spi_master *
./include/linux/spi/spi.h:815:58: note: expectedstruct spi_controller *but argument is of typestruct spi_master *815 | extern int spi_controller_suspend(struct spi_controller *ctlr);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors
drivers/spi/spi-phytium.c: In functionphytium_spi_resume_host’:
drivers/spi/spi-phytium.c:491:33: error: invalid use of undefined typestruct spi_master491 |         spi_hw_init(&fts->master->dev, fts);
      |                                 ^~
drivers/spi/spi-phytium.c:492:40: error: passing argument 1 ofspi_controller_resumefrom incompatible pointer type [-Werror=incompatible-pointer-types]
  492 |         ret = spi_controller_resume(fts->master);
      |                                     ~~~^~~~~~~~
      |                                        |
      |                                        struct spi_master *
./include/linux/spi/spi.h:816:57: note: expectedstruct spi_controller *but argument is of typestruct spi_master *816 | extern int spi_controller_resume(struct spi_controller *ctlr);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/spi/spi-phytium.c:494:37: error: invalid use of undefined typestruct spi_master494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                                     ^~
./include/linux/dev_printk.h:110:25: note: in definition of macrodev_printk_index_wrap110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
      |                         ^~~
drivers/spi/spi-phytium.c:494:17: note: in expansion of macrodev_err494 |                 dev_err(&fts->master->dev, "fail to start queue (%d)\n", ret);
      |                 ^~~~~~~
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium-pci.o] 错误 1
make[7]: *** [scripts/Makefile.build:244drivers/spi/spi-phytium.o] 错误 1
make[6]: *** [scripts/Makefile.build:485drivers/spi] 错误 2
make[6]: *** 正在等待未完成的任务....
make[5]: *** [scripts/Makefile.build:485drivers] 错误 2
make[4]: *** [Makefile:1915:.] 错误 2
make[3]: *** [debian/rules:74build-arch] 错误 2
dpkg-buildpackage: error: make -f debian/rules binary subprocess returned exit status 2
make[2]: *** [scripts/Makefile.package:121bindeb-pkg] 错误 2
make[1]: *** [/root/linux/Makefile:1537bindeb-pkg] 错误 2
make: *** [Makefile:240__sub-make] 错误 2
MingcongBai pushed a commit that referenced this issue Jul 1, 2024
[ Upstream commit f1e197a ]

trace_drop_common() is called with preemption disabled, and it acquires
a spin_lock. This is problematic for RT kernels because spin_locks are
sleeping locks in this configuration, which causes the following splat:

BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 449, name: rcuc/47
preempt_count: 1, expected: 0
RCU nest depth: 2, expected: 2
5 locks held by rcuc/47/449:
 #0: ff1100086ec30a60 ((softirq_ctrl.lock)){+.+.}-{2:2}, at: __local_bh_disable_ip+0x105/0x210
 #1: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: rt_spin_lock+0xbf/0x130
 #2: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: __local_bh_disable_ip+0x11c/0x210
 #3: ffffffffb394a160 (rcu_callback){....}-{0:0}, at: rcu_do_batch+0x360/0xc70
 #4: ff1100086ee07520 (&data->lock){+.+.}-{2:2}, at: trace_drop_common.constprop.0+0xb5/0x290
irq event stamp: 139909
hardirqs last  enabled at (139908): [<ffffffffb1df2b33>] _raw_spin_unlock_irqrestore+0x63/0x80
hardirqs last disabled at (139909): [<ffffffffb19bd03d>] trace_drop_common.constprop.0+0x26d/0x290
softirqs last  enabled at (139892): [<ffffffffb07a1083>] __local_bh_enable_ip+0x103/0x170
softirqs last disabled at (139898): [<ffffffffb0909b33>] rcu_cpu_kthread+0x93/0x1f0
Preemption disabled at:
[<ffffffffb1de786b>] rt_mutex_slowunlock+0xab/0x2e0
CPU: 47 PID: 449 Comm: rcuc/47 Not tainted 6.9.0-rc2-rt1+ #7
Hardware name: Dell Inc. PowerEdge R650/0Y2G81, BIOS 1.6.5 04/15/2022
Call Trace:
 <TASK>
 dump_stack_lvl+0x8c/0xd0
 dump_stack+0x14/0x20
 __might_resched+0x21e/0x2f0
 rt_spin_lock+0x5e/0x130
 ? trace_drop_common.constprop.0+0xb5/0x290
 ? skb_queue_purge_reason.part.0+0x1bf/0x230
 trace_drop_common.constprop.0+0xb5/0x290
 ? preempt_count_sub+0x1c/0xd0
 ? _raw_spin_unlock_irqrestore+0x4a/0x80
 ? __pfx_trace_drop_common.constprop.0+0x10/0x10
 ? rt_mutex_slowunlock+0x26a/0x2e0
 ? skb_queue_purge_reason.part.0+0x1bf/0x230
 ? __pfx_rt_mutex_slowunlock+0x10/0x10
 ? skb_queue_purge_reason.part.0+0x1bf/0x230
 trace_kfree_skb_hit+0x15/0x20
 trace_kfree_skb+0xe9/0x150
 kfree_skb_reason+0x7b/0x110
 skb_queue_purge_reason.part.0+0x1bf/0x230
 ? __pfx_skb_queue_purge_reason.part.0+0x10/0x10
 ? mark_lock.part.0+0x8a/0x520
...

trace_drop_common() also disables interrupts, but this is a minor issue
because we could easily replace it with a local_lock.

Replace the spin_lock with raw_spin_lock to avoid sleeping in atomic
context.

Signed-off-by: Wander Lairson Costa <[email protected]>
Reported-by: Hu Chunyu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
MingcongBai pushed a commit that referenced this issue Jul 1, 2024
[ Upstream commit af0cb3f ]

Xiumei and Christoph reported the following lockdep splat, complaining of
the qdisc root lock being taken twice:

 ============================================
 WARNING: possible recursive locking detected
 6.7.0-rc3+ torvalds#598 Not tainted
 --------------------------------------------
 swapper/2/0 is trying to acquire lock:
 ffff888177190110 (&sch->q.lock){+.-.}-{2:2}, at: __dev_queue_xmit+0x1560/0x2e70

 but task is already holding lock:
 ffff88811995a110 (&sch->q.lock){+.-.}-{2:2}, at: __dev_queue_xmit+0x1560/0x2e70

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&sch->q.lock);
   lock(&sch->q.lock);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 5 locks held by swapper/2/0:
  #0: ffff888135a09d98 ((&in_dev->mr_ifc_timer)){+.-.}-{0:0}, at: call_timer_fn+0x11a/0x510
  #1: ffffffffaaee5260 (rcu_read_lock){....}-{1:2}, at: ip_finish_output2+0x2c0/0x1ed0
  #2: ffffffffaaee5200 (rcu_read_lock_bh){....}-{1:2}, at: __dev_queue_xmit+0x209/0x2e70
  #3: ffff88811995a110 (&sch->q.lock){+.-.}-{2:2}, at: __dev_queue_xmit+0x1560/0x2e70
  #4: ffffffffaaee5200 (rcu_read_lock_bh){....}-{1:2}, at: __dev_queue_xmit+0x209/0x2e70

 stack backtrace:
 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.7.0-rc3+ torvalds#598
 Hardware name: Red Hat KVM, BIOS 1.13.0-2.module+el8.3.0+7353+9de0a3cc 04/01/2014
 Call Trace:
  <IRQ>
  dump_stack_lvl+0x4a/0x80
  __lock_acquire+0xfdd/0x3150
  lock_acquire+0x1ca/0x540
  _raw_spin_lock+0x34/0x80
  __dev_queue_xmit+0x1560/0x2e70
  tcf_mirred_act+0x82e/0x1260 [act_mirred]
  tcf_action_exec+0x161/0x480
  tcf_classify+0x689/0x1170
  prio_enqueue+0x316/0x660 [sch_prio]
  dev_qdisc_enqueue+0x46/0x220
  __dev_queue_xmit+0x1615/0x2e70
  ip_finish_output2+0x1218/0x1ed0
  __ip_finish_output+0x8b3/0x1350
  ip_output+0x163/0x4e0
  igmp_ifc_timer_expire+0x44b/0x930
  call_timer_fn+0x1a2/0x510
  run_timer_softirq+0x54d/0x11a0
  __do_softirq+0x1b3/0x88f
  irq_exit_rcu+0x18f/0x1e0
  sysvec_apic_timer_interrupt+0x6f/0x90
  </IRQ>

This happens when TC does a mirred egress redirect from the root qdisc of
device A to the root qdisc of device B. As long as these two locks aren't
protecting the same qdisc, they can be acquired in chain: add a per-qdisc
lockdep key to silence false warnings.
This dynamic key should safely replace the static key we have in sch_htb:
it was added to allow enqueueing to the device "direct qdisc" while still
holding the qdisc root lock.

v2: don't use static keys anymore in HTB direct qdiscs (thanks Eric Dumazet)

CC: Maxim Mikityanskiy <[email protected]>
CC: Xiumei Mu <[email protected]>
Reported-by: Christoph Paasch <[email protected]>
Closes: multipath-tcp/mptcp_net-next#451
Signed-off-by: Davide Caratti <[email protected]>
Link: https://lore.kernel.org/r/7dc06d6158f72053cf877a82e2a7a5bd23692faa.1713448007.git.dcaratti@redhat.com
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
MingcongBai pushed a commit that referenced this issue Jul 1, 2024
[ Upstream commit f6944d4 ]

Lockdep reports the below circular locking dependency issue.  The
mmap_lock acquisition while holding pci_bus_sem is due to the use of
copy_to_user() from within a pci_walk_bus() callback.

Building the devices array directly into the user buffer is only for
convenience.  Instead we can allocate a local buffer for the array,
bounded by the number of devices on the bus/slot, fill the device
information into this local buffer, then copy it into the user buffer
outside the bus walk callback.

======================================================
WARNING: possible circular locking dependency detected
6.9.0-rc5+ torvalds#39 Not tainted
------------------------------------------------------
CPU 0/KVM/4113 is trying to acquire lock:
ffff99a609ee18a8 (&vdev->vma_lock){+.+.}-{4:4}, at: vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]

but task is already holding lock:
ffff99a243a052a0 (&mm->mmap_lock){++++}-{4:4}, at: vaddr_get_pfns+0x3f/0x170 [vfio_iommu_type1]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (&mm->mmap_lock){++++}-{4:4}:
       __lock_acquire+0x4e4/0xb90
       lock_acquire+0xbc/0x2d0
       __might_fault+0x5c/0x80
       _copy_to_user+0x1e/0x60
       vfio_pci_fill_devs+0x9f/0x130 [vfio_pci_core]
       vfio_pci_walk_wrapper+0x45/0x60 [vfio_pci_core]
       __pci_walk_bus+0x6b/0xb0
       vfio_pci_ioctl_get_pci_hot_reset_info+0x10b/0x1d0 [vfio_pci_core]
       vfio_pci_core_ioctl+0x1cb/0x400 [vfio_pci_core]
       vfio_device_fops_unl_ioctl+0x7e/0x140 [vfio]
       __x64_sys_ioctl+0x8a/0xc0
       do_syscall_64+0x8d/0x170
       entry_SYSCALL_64_after_hwframe+0x76/0x7e

-> #2 (pci_bus_sem){++++}-{4:4}:
       __lock_acquire+0x4e4/0xb90
       lock_acquire+0xbc/0x2d0
       down_read+0x3e/0x160
       pci_bridge_wait_for_secondary_bus.part.0+0x33/0x2d0
       pci_reset_bus+0xdd/0x160
       vfio_pci_dev_set_hot_reset+0x256/0x270 [vfio_pci_core]
       vfio_pci_ioctl_pci_hot_reset_groups+0x1a3/0x280 [vfio_pci_core]
       vfio_pci_core_ioctl+0x3b5/0x400 [vfio_pci_core]
       vfio_device_fops_unl_ioctl+0x7e/0x140 [vfio]
       __x64_sys_ioctl+0x8a/0xc0
       do_syscall_64+0x8d/0x170
       entry_SYSCALL_64_after_hwframe+0x76/0x7e

-> #1 (&vdev->memory_lock){+.+.}-{4:4}:
       __lock_acquire+0x4e4/0xb90
       lock_acquire+0xbc/0x2d0
       down_write+0x3b/0xc0
       vfio_pci_zap_and_down_write_memory_lock+0x1c/0x30 [vfio_pci_core]
       vfio_basic_config_write+0x281/0x340 [vfio_pci_core]
       vfio_config_do_rw+0x1fa/0x300 [vfio_pci_core]
       vfio_pci_config_rw+0x75/0xe50 [vfio_pci_core]
       vfio_pci_rw+0xea/0x1a0 [vfio_pci_core]
       vfs_write+0xea/0x520
       __x64_sys_pwrite64+0x90/0xc0
       do_syscall_64+0x8d/0x170
       entry_SYSCALL_64_after_hwframe+0x76/0x7e

-> #0 (&vdev->vma_lock){+.+.}-{4:4}:
       check_prev_add+0xeb/0xcc0
       validate_chain+0x465/0x530
       __lock_acquire+0x4e4/0xb90
       lock_acquire+0xbc/0x2d0
       __mutex_lock+0x97/0xde0
       vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
       __do_fault+0x31/0x160
       do_pte_missing+0x65/0x3b0
       __handle_mm_fault+0x303/0x720
       handle_mm_fault+0x10f/0x460
       fixup_user_fault+0x7f/0x1f0
       follow_fault_pfn+0x66/0x1c0 [vfio_iommu_type1]
       vaddr_get_pfns+0xf2/0x170 [vfio_iommu_type1]
       vfio_pin_pages_remote+0x348/0x4e0 [vfio_iommu_type1]
       vfio_pin_map_dma+0xd2/0x330 [vfio_iommu_type1]
       vfio_dma_do_map+0x2c0/0x440 [vfio_iommu_type1]
       vfio_iommu_type1_ioctl+0xc5/0x1d0 [vfio_iommu_type1]
       __x64_sys_ioctl+0x8a/0xc0
       do_syscall_64+0x8d/0x170
       entry_SYSCALL_64_after_hwframe+0x76/0x7e

other info that might help us debug this:

Chain exists of:
  &vdev->vma_lock --> pci_bus_sem --> &mm->mmap_lock

 Possible unsafe locking scenario:

block dm-0: the capability attribute has been deprecated.
       CPU0                    CPU1
       ----                    ----
  rlock(&mm->mmap_lock);
                               lock(pci_bus_sem);
                               lock(&mm->mmap_lock);
  lock(&vdev->vma_lock);

 *** DEADLOCK ***

2 locks held by CPU 0/KVM/4113:
 #0: ffff99a25f294888 (&iommu->lock#2){+.+.}-{4:4}, at: vfio_dma_do_map+0x60/0x440 [vfio_iommu_type1]
 #1: ffff99a243a052a0 (&mm->mmap_lock){++++}-{4:4}, at: vaddr_get_pfns+0x3f/0x170 [vfio_iommu_type1]

stack backtrace:
CPU: 1 PID: 4113 Comm: CPU 0/KVM Not tainted 6.9.0-rc5+ torvalds#39
Hardware name: Dell Inc. PowerEdge T640/04WYPY, BIOS 2.15.1 06/16/2022
Call Trace:
 <TASK>
 dump_stack_lvl+0x64/0xa0
 check_noncircular+0x131/0x150
 check_prev_add+0xeb/0xcc0
 ? add_chain_cache+0x10a/0x2f0
 ? __lock_acquire+0x4e4/0xb90
 validate_chain+0x465/0x530
 __lock_acquire+0x4e4/0xb90
 lock_acquire+0xbc/0x2d0
 ? vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
 ? lock_is_held_type+0x9a/0x110
 __mutex_lock+0x97/0xde0
 ? vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
 ? lock_acquire+0xbc/0x2d0
 ? vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
 ? find_held_lock+0x2b/0x80
 ? vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
 vfio_pci_mmap_fault+0x35/0x1a0 [vfio_pci_core]
 __do_fault+0x31/0x160
 do_pte_missing+0x65/0x3b0
 __handle_mm_fault+0x303/0x720
 handle_mm_fault+0x10f/0x460
 fixup_user_fault+0x7f/0x1f0
 follow_fault_pfn+0x66/0x1c0 [vfio_iommu_type1]
 vaddr_get_pfns+0xf2/0x170 [vfio_iommu_type1]
 vfio_pin_pages_remote+0x348/0x4e0 [vfio_iommu_type1]
 vfio_pin_map_dma+0xd2/0x330 [vfio_iommu_type1]
 vfio_dma_do_map+0x2c0/0x440 [vfio_iommu_type1]
 vfio_iommu_type1_ioctl+0xc5/0x1d0 [vfio_iommu_type1]
 __x64_sys_ioctl+0x8a/0xc0
 do_syscall_64+0x8d/0x170
 ? rcu_core+0x8d/0x250
 ? __lock_release+0x5e/0x160
 ? rcu_core+0x8d/0x250
 ? lock_release+0x5f/0x120
 ? sched_clock+0xc/0x30
 ? sched_clock_cpu+0xb/0x190
 ? irqtime_account_irq+0x40/0xc0
 ? __local_bh_enable+0x54/0x60
 ? __do_softirq+0x315/0x3ca
 ? lockdep_hardirqs_on_prepare.part.0+0x97/0x140
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f8300d0357b
Code: ff ff ff 85 c0 79 9b 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 75 68 0f 00 f7 d8 64 89 01 48
RSP: 002b:00007f82ef3fb948 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8300d0357b
RDX: 00007f82ef3fb990 RSI: 0000000000003b71 RDI: 0000000000000023
RBP: 00007f82ef3fb9c0 R08: 0000000000000000 R09: 0000561b7e0bcac2
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000200000000 R14: 0000381800000000 R15: 0000000000000000
 </TASK>

Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
MingcongBai pushed a commit that referenced this issue Jul 1, 2024
commit 6cd4a78 upstream.

It is possible to trigger a use-after-free by:
  * attaching an fentry probe to __sock_release() and the probe calling the
    bpf_get_socket_cookie() helper
  * running traceroute -I 1.1.1.1 on a freshly booted VM

A KASAN enabled kernel will log something like below (decoded and stripped):
==================================================================
BUG: KASAN: slab-use-after-free in __sock_gen_cookie (./arch/x86/include/asm/atomic64_64.h:15 ./include/linux/atomic/atomic-arch-fallback.h:2583 ./include/linux/atomic/atomic-instrumented.h:1611 net/core/sock_diag.c:29)
Read of size 8 at addr ffff888007110dd8 by task traceroute/299

CPU: 2 PID: 299 Comm: traceroute Tainted: G            E      6.10.0-rc2+ #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
dump_stack_lvl (lib/dump_stack.c:117 (discriminator 1))
print_report (mm/kasan/report.c:378 mm/kasan/report.c:488)
? __sock_gen_cookie (./arch/x86/include/asm/atomic64_64.h:15 ./include/linux/atomic/atomic-arch-fallback.h:2583 ./include/linux/atomic/atomic-instrumented.h:1611 net/core/sock_diag.c:29)
kasan_report (mm/kasan/report.c:603)
? __sock_gen_cookie (./arch/x86/include/asm/atomic64_64.h:15 ./include/linux/atomic/atomic-arch-fallback.h:2583 ./include/linux/atomic/atomic-instrumented.h:1611 net/core/sock_diag.c:29)
kasan_check_range (mm/kasan/generic.c:183 mm/kasan/generic.c:189)
__sock_gen_cookie (./arch/x86/include/asm/atomic64_64.h:15 ./include/linux/atomic/atomic-arch-fallback.h:2583 ./include/linux/atomic/atomic-instrumented.h:1611 net/core/sock_diag.c:29)
bpf_get_socket_ptr_cookie (./arch/x86/include/asm/preempt.h:94 ./include/linux/sock_diag.h:42 net/core/filter.c:5094 net/core/filter.c:5092)
bpf_prog_875642cf11f1d139___sock_release+0x6e/0x8e
bpf_trampoline_6442506592+0x47/0xaf
__sock_release (net/socket.c:652)
__sock_create (net/socket.c:1601)
...
Allocated by task 299 on cpu 2 at 78.328492s:
kasan_save_stack (mm/kasan/common.c:48)
kasan_save_track (mm/kasan/common.c:68)
__kasan_slab_alloc (mm/kasan/common.c:312 mm/kasan/common.c:338)
kmem_cache_alloc_noprof (mm/slub.c:3941 mm/slub.c:4000 mm/slub.c:4007)
sk_prot_alloc (net/core/sock.c:2075)
sk_alloc (net/core/sock.c:2134)
inet_create (net/ipv4/af_inet.c:327 net/ipv4/af_inet.c:252)
__sock_create (net/socket.c:1572)
__sys_socket (net/socket.c:1660 net/socket.c:1644 net/socket.c:1706)
__x64_sys_socket (net/socket.c:1718)
do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

Freed by task 299 on cpu 2 at 78.328502s:
kasan_save_stack (mm/kasan/common.c:48)
kasan_save_track (mm/kasan/common.c:68)
kasan_save_free_info (mm/kasan/generic.c:582)
poison_slab_object (mm/kasan/common.c:242)
__kasan_slab_free (mm/kasan/common.c:256)
kmem_cache_free (mm/slub.c:4437 mm/slub.c:4511)
__sk_destruct (net/core/sock.c:2117 net/core/sock.c:2208)
inet_create (net/ipv4/af_inet.c:397 net/ipv4/af_inet.c:252)
__sock_create (net/socket.c:1572)
__sys_socket (net/socket.c:1660 net/socket.c:1644 net/socket.c:1706)
__x64_sys_socket (net/socket.c:1718)
do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

Fix this by clearing the struct socket reference in sk_common_release() to cover
all protocol families create functions, which may already attached the
reference to the sk object with sock_init_data().

Fixes: c5dbb89 ("bpf: Expose bpf_get_socket_cookie to tracing programs")
Suggested-by: Kuniyuki Iwashima <[email protected]>
Signed-off-by: Ignat Korchagin <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/netdev/[email protected]/T/
Reviewed-by: Kuniyuki Iwashima <[email protected]>
Reviewed-by: D. Wythe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant