Search code examples
raspberry-pi3raspberry-pi2bare-metal

What steps are needed to detect a GPU interrupt on a Raspberry Pi3?


I am writing a bare-metal kernel, but an interrupt doesn't seem to be triggered when the EMMC INTERRUPT register becomes non-zero.

I have two cores idling, and one at EL3 with no data caches enabled continually displaying a page of memory, in order to see what the code I'm testing is up to. (The test code regularly flushes its cache, on the working QA7 millisecond interrupt.)

The code being tested is running at Secure EL0 on core 0, with interrupts enabled. Interrupts are routed to core 0:

QA7.GPU_interrupts_routing = 0; // IRQ and FIQ to Core 0

The EMMC interface is initialised, and a reset command sent to the card, at which point the INTERRUPT register becomes 1 (bit 0 set: command has finished), but no GPU interrupt seems to be signalled to the QA7 hardware (bit 8 in the Core 0 interrupt source register stays zero).

The EMMC registers IRPT_MASK and IRPT_EN are both set to 0x017f7137, which I think should enable all known interrupts from that peripheral, and certainly bit 0.

The BCM8235 interrupt registers have been written as so:

  Enable_IRQs_1 = 0x20000000; // (1 << 29);
  Enable_IRQs_2 = 0x02ff6800; // 0b00000010111111110110100000000000;
  Enable_Basic_IRQs = 0x303;

But they read back as:

  Enable_IRQs_1: 0x20000200 // (1 << 9) also set
  Enable_IRQs_2: 0x02ff6800 // unchanged
  Enable_Basic_IRQs: 0x3    // No interrupts from IRQs 1 or 2.

What have I missed?

(Tagged raspberry-pi2, since it also has the QA7 component.)


Solution

  • The simple answer is nothing more. The Arasan SD interface interrupt is number 62, bit 20 in the IRQ basic pending register. Enable bit 30 in IRQ pending 2, and the interrupt comes through.

    Enable_IRQs_2 = 0x42ff6800;
    

    I just had to ignore the advice: "The table above has many empty entries. These should not be enabled as they will interfere with the GPU operation." in the documentation.