Code Monkey home page Code Monkey logo

Comments (7)

sergforce avatar sergforce commented on August 15, 2024

from xtrx_linux_pcie_drv.

hewittc avatar hewittc commented on August 15, 2024

As requested:

% cat /proc/interrupts 
           CPU0       CPU1       
  1:          0          0     GICv3  25 Level     vgic
  3:     151707      51493     GICv3  30 Level     arch_timer
  4:          0          0     GICv3  27 Level     kvm guest timer
  6:          0          0     GICv3  23 Level     arm-pmu
  7:        434          0     GICv3  32 Level     d0010600.spi
  9:       3486          0     GICv3  44 Level     d0012000.serial
 10:          0          0     GICv3  45 Level     d0012000.serial
 11:       5731          0     GICv3  74 Level     eth0
 12:          0          0     GICv3  35 Level     xhci-hcd:usb2
 13:          0          0     GICv3  49 Level     ehci_hcd:usb1
 20:      10921          0     GICv3  57 Level     mmc0
 21:          0          0     GICv3  59 Level     ahci-mvebu[d00e0000.sata]
 22:          1          0     GICv3  61 Level     advk-pcie
 40:          2          0     GICv3  79 Level     d0060900.xor
 41:          2          0     GICv3  80 Level     d0060900.xor
 42:          0          0     GPIO1   3 Edge      d00d0000.sdhci cd
 46:          0          0  mv88e6xxx-g1   3 Edge      mv88e6xxx-g1-atu-prob
 48:          0          0  mv88e6xxx-g1   5 Edge      mv88e6xxx-g1-vtu-prob
 50:          2          1  mv88e6xxx-g1   7 Edge      mv88e6xxx-g2
 53:          2          1  mv88e6xxx-g2   1 Edge      !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:11
 54:          0          0  mv88e6xxx-g2   2 Edge      !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:12
 55:          0          0  mv88e6xxx-g2   3 Edge      !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:13
 67:          0          0  mv88e6xxx-g2  15 Edge      mv88e6xxx-watchdog
 69:          0          0  advk-MSI   0 Edge      xtrx_pps
 70:          0          0  advk-MSI   1 Edge      xtrx_tx
 71:          1          0  advk-MSI   2 Edge      xtrx_rx
 72:          0          0  advk-MSI   3 Edge      xtrx_other
IPI0:      3564      10302       Rescheduling interrupts
IPI1:       148        574       Function call interrupts
IPI2:         0          0       CPU stop interrupts
IPI3:         0          0       CPU stop (for crash dump) interrupts
IPI4:         0          0       Timer broadcast interrupts
IPI5:         0          0       IRQ work interrupts
IPI6:         0          0       CPU wake-up interrupts
Err:          0

from xtrx_linux_pcie_drv.

hewittc avatar hewittc commented on August 15, 2024

And here is the device tree section relevant to PCIe.
The original source shows interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;.
Maybe that doesn't match the actual interrupt number? Not sure if there's an offset applied.

		pcie@d0070000 {
			compatible = "marvell,armada-3700-pcie";
			device_type = "pci";
			status = "okay";
			reg = < 0x00 0xd0070000 0x00 0x20000 >;
			#address-cells = < 0x03 >;
			#size-cells = < 0x02 >;
			bus-range = < 0x00 0xff >;
			interrupts = < 0x00 0x1d 0x04 >;
			#interrupt-cells = < 0x01 >;
			msi-parent = < 0x0f >;
			msi-controller;
			ranges = < 0x82000000 0x00 0xe8000000 0x00 0xe8000000 0x00 0x1000000 0x81000000 0x00 0xe9000000 0x00 0xe9000000 0x00 0x10000 >;
			interrupt-map-mask = < 0x00 0x00 0x00 0x07 >;
			interrupt-map = < 0x00 0x00 0x00 0x01 0x10 0x00 0x00 0x00 0x00 0x02 0x10 0x01 0x00 0x00 0x00 0x03 0x10 0x02 0x00 0x00 0x00 0x04 0x10 0x03 >;
			phandle = < 0x0f >;

			interrupt-controller {
				interrupt-controller;
				#interrupt-cells = < 0x01 >;
				phandle = < 0x10 >;
			};
		};

from xtrx_linux_pcie_drv.

sergforce avatar sergforce commented on August 15, 2024

That's indeed strange

 69:          0          0  advk-MSI   0 Edge      xtrx_pps
 70:          0          0  advk-MSI   1 Edge      xtrx_tx
 71:          1          0  advk-MSI   2 Edge      xtrx_rx
 72:          0          0  advk-MSI   3 Edge      xtrx_other

Interrupt should've been on xtrx_other but appeared on xtrx_rx and there's no way to raise such interrupt in hardware during initialization phase. I'd check errata for that SOC and contacted manufacturer.

What you can do is to disable MSI completle to see if legacy interrupt work. Check this

diff --git a/xtrx.c b/xtrx.c
index c7e35cf..a037f3b 100644
--- a/xtrx.c
+++ b/xtrx.c
@@ -1035,10 +1035,11 @@ static int xtrx_probe(struct pci_dev *pdev,
        init_waitqueue_head(&xtrxdev->queue_i2c);
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(4,11,0)
-       err = pci_enable_msi_range(pdev, XTRX_MSI_COUNT, XTRX_MSI_COUNT);
+       //err = pci_enable_msi_range(pdev, XTRX_MSI_COUNT, XTRX_MSI_COUNT);
 #else
-       err = pci_alloc_irq_vectors(pdev, XTRX_MSI_COUNT, XTRX_MSI_COUNT, PCI_IRQ_MSI);
+       //err = pci_alloc_irq_vectors(pdev, XTRX_MSI_COUNT, XTRX_MSI_COUNT, PCI_IRQ_MSI);
 #endif
+       err = 0;
        if (err == XTRX_MSI_COUNT) {
                xtrxdev->inttype = XTRX_MSI_4;
 

from xtrx_linux_pcie_drv.

hewittc avatar hewittc commented on August 15, 2024

Even with legacy interrupt mode it seems to not be working correctly. I ran test_xtrxll successfully once right after loading xtrx.ko but command fails when executed a second time. I heard there may be some large changes for the Aardvark PCIe controller driver starting in 4.19 kernel so I will see if that helps. Thank you for the suggestions.

First attempt:

% sudo ./test_xtrxll 
11:24:12.219717 REGS:   internal_xtrxll_reg_in:151 [PCIE] PCI:/dev/xtrx0: Read  [001a] = 04000013
11:24:12.219995 INFO:   xtrxll_base_dev_init:792 [CTRL] PCI:/dev/xtrx0: XTRX Rev4 (04000013)
11:24:12.220028 INFO:   xtrxllpciebase_dma_start:529 [BPCI] PCI:/dev/xtrx0: RX DMA STOP MIMO (BLK:0 TS:0); TX DMA STOP MIMO
11:24:12.220054 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [000d] = c0000000
11:24:12.220071 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [000d] = 42000000
11:24:12.220088 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [0001] = 00008fff
11:24:12.220103 INFO:   xtrxllpciev0_open:352 [PCIE] PCI:/dev/xtrx0: Device `/dev/xtrx0` was opened
11:24:12.220122 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [0000] = 002fffff
11:24:12.220145 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:1
11:24:12.220163 REGS:   internal_xtrxll_reg_in:151 [PCIE] PCI:/dev/xtrx0: Read  [0000] = 00000000
11:24:12.220179 DEBUG:  xtrxllpciev0_lms7_spi_bulk:198 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] 002fffff => 00000000
Detected LMS #0: 00000000

Second attempt:

% sudo ./test_xtrxll
11:24:16.031291 REGS:   internal_xtrxll_reg_in:151 [PCIE] PCI:/dev/xtrx0: Read  [001a] = 04000013
11:24:16.031599 INFO:   xtrxll_base_dev_init:792 [CTRL] PCI:/dev/xtrx0: XTRX Rev4 (04000013)
11:24:16.031678 INFO:   xtrxllpciebase_dma_start:529 [BPCI] PCI:/dev/xtrx0: RX DMA STOP MIMO (BLK:0 TS:0); TX DMA STOP MIMO
11:24:16.031739 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [000d] = c0000000
11:24:16.031827 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [000d] = 42000000
11:24:16.031883 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [0001] = 00008fff
11:24:16.031975 INFO:   xtrxllpciev0_open:352 [PCIE] PCI:/dev/xtrx0: Device `/dev/xtrx0` was opened
11:24:16.032048 REGS:   internal_xtrxll_reg_out:142 [PCIE] PCI:/dev/xtrx0: Write [0000] = 002fffff
11:24:18.078342 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1
11:24:20.158336 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1
11:24:22.238351 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1
11:24:24.318332 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1
11:24:26.398333 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1
11:24:28.478331 DEBUG:  xtrxllpciev0_lms7_spi_bulk:192 [ DEF] XTRX PCI:/dev/xtrx0: SPI[0/1] I:-1

from xtrx_linux_pcie_drv.

sergforce avatar sergforce commented on August 15, 2024

The first transmission is Ok. The second transmission failed due to missing interrupt at all. Unfortunately, I can't suggest anything else to work around faulty interrupt behavior at the moment.

from xtrx_linux_pcie_drv.

sergforce avatar sergforce commented on August 15, 2024

I close this since there's no information where XTRX driver may misbehave. If you get more input feel free to reopen

from xtrx_linux_pcie_drv.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.