<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iMX8 Mini interrupts in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1595009#M201181</link>
    <description>&lt;P&gt;Thanks, QMiller!&amp;nbsp; &amp;nbsp;This is good info.&amp;nbsp; &amp;nbsp;But where can I find the gicv3 driver?&amp;nbsp; I'm writing bare-metal code to run under ThreadX so I don't have this driver.&amp;nbsp; &amp;nbsp;I'm guessing its a Linux driver somewhere but I could certainly use it as a reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 20:24:33 GMT</pubDate>
    <dc:creator>dhague262</dc:creator>
    <dc:date>2023-02-07T20:24:33Z</dc:date>
    <item>
      <title>iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589105#M200731</link>
      <description>&lt;P&gt;I'm confused about how to figure determine the interrupt source when you get an IRQ or FIQ interrupt.&amp;nbsp; The manual lists 128 IRQ's but how do you determine which one you got in the IRQ_Handler?&amp;nbsp; Is there a register I need to read or something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 22:32:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589105#M200731</guid>
      <dc:creator>dhague262</dc:creator>
      <dc:date>2023-01-27T22:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589395#M200757</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/211819"&gt;@dhague262&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you talking about the M core program?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 01:33:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589395#M200757</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2023-01-30T01:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589811#M200786</link>
      <description>&lt;P&gt;No, I'm talking about the Cortex-A53 core.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 12:42:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1589811#M200786</guid>
      <dc:creator>dhague262</dc:creator>
      <dc:date>2023-01-30T12:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1593560#M201057</link>
      <description>&lt;P&gt;The chip uses GICv3 IP, you can refer&amp;nbsp;&lt;SPAN&gt;gic_irq_domain_translate function in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;the gicv3 driver.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;switch (fwspec-&amp;gt;param[0]) {
		case 0:			/* SPI */
			*hwirq = fwspec-&amp;gt;param[1] + 32;
			break;
		case 1:			/* PPI */
			*hwirq = fwspec-&amp;gt;param[1] + 16;
			break;
		case 2:			/* ESPI */
			*hwirq = fwspec-&amp;gt;param[1] + ESPI_BASE_INTID;
			break;
		case 3:			/* EPPI */
			*hwirq = fwspec-&amp;gt;param[1] + EPPI_BASE_INTID;
			break;
		case GIC_IRQ_TYPE_LPI:	/* LPI */
			*hwirq = fwspec-&amp;gt;param[1];
			break;
		case GIC_IRQ_TYPE_PARTITION:
			*hwirq = fwspec-&amp;gt;param[1];
			if (fwspec-&amp;gt;param[1] &amp;gt;= 16)
				*hwirq += EPPI_BASE_INTID - 16;
			else
				*hwirq += 16;
			break;
		default:
			return -EINVAL;
		}

*type = fwspec-&amp;gt;param[2] &amp;amp; IRQ_TYPE_SENSE_MASK;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There will be a software irq corresponding to the hardware irq(hwirq)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;struct irq_data {
	u32			mask;
	unsigned int		irq;------------------------&amp;gt;software irq
	unsigned long		hwirq;----------------------&amp;gt;hardware irq
	struct irq_common_data	*common;
	struct irq_chip		*chip;--------------------&amp;gt;chip ops
	struct irq_domain	*domain;
	void			*chip_data;
};&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The irq like 128 in manual actually is irq offset, if the irq is SPI type, you can see that the gicv3 driver willl calculate the real irq number: 128+32. When the GICV3 driver detect the hardware irq signal, the kernel will find it's&lt;STRONG&gt; struct&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;irq_data &lt;/STRONG&gt;and the &lt;STRONG&gt;software irq(struct&amp;nbsp;irq_data-&amp;gt;irq).&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We will register the &lt;STRONG&gt;software irq number&lt;/STRONG&gt; and&amp;nbsp; &lt;STRONG&gt;irq handler&lt;/STRONG&gt; in driver using&amp;nbsp;request_threaded_irq in driver. &lt;STRONG&gt;Fill the irq handler to the struct irqaction.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;int request_threaded_irq(unsigned int irq, irq_handler_t handler,
			 irq_handler_t thread_fn, unsigned long irqflags,
			 const char *devname, void *dev_id)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Now, we have the hardware irq, software irq and it's handler.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When the interrupt is detected, the GICv3 driver will use&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;generic_handle_irq(irq)&lt;/STRONG&gt; to handle the interrupt. For example, if the interrupt is SPI type, the kernel will goto the&amp;nbsp;&lt;STRONG&gt;&lt;SPAN class="md-plain"&gt;handle_fasteoi_irq.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="md-plain"&gt;In this function, the calltrace of irq handler we define is below, as the &lt;STRONG&gt;struct irq_desc&amp;nbsp;&lt;/STRONG&gt;maintain the &lt;STRONG&gt;hwirq, irq&lt;/STRONG&gt; and &lt;STRONG&gt;irqaction-&amp;gt;handler&lt;/STRONG&gt;, the kernel will use &lt;STRONG&gt;hwirq&lt;/STRONG&gt; to find the&lt;STRONG&gt; irq&lt;/STRONG&gt; and then find the &lt;STRONG&gt;handler&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;handle_irq_event
-&amp;gt;handle_irq_event_percpu
-&amp;gt;__handle_irq_event_percpu
-&amp;gt;res = action-&amp;gt;handler(irq, action-&amp;gt;dev_id)----&amp;gt;the handler we define&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 02:55:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1593560#M201057</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2023-02-06T02:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1595009#M201181</link>
      <description>&lt;P&gt;Thanks, QMiller!&amp;nbsp; &amp;nbsp;This is good info.&amp;nbsp; &amp;nbsp;But where can I find the gicv3 driver?&amp;nbsp; I'm writing bare-metal code to run under ThreadX so I don't have this driver.&amp;nbsp; &amp;nbsp;I'm guessing its a Linux driver somewhere but I could certainly use it as a reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 20:24:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1595009#M201181</guid>
      <dc:creator>dhague262</dc:creator>
      <dc:date>2023-02-07T20:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: iMX8 Mini interrupts</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1595126#M201190</link>
      <description>&lt;P&gt;You can refer below files:&lt;/P&gt;
&lt;P&gt;1.exception vector: arch/arm64/kernel/entry.S&lt;/P&gt;
&lt;P&gt;2.GICv3 driver:&amp;nbsp;drivers/irqchip/irq-gic-v3.c&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 02:06:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8-Mini-interrupts/m-p/1595126#M201190</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2023-02-08T02:06:38Z</dc:date>
    </item>
  </channel>
</rss>

