<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 16.0.10366.20016">
<TITLE>irq_desc not found for my interrupt number during request_irq (radix tree of irq_desc has only 64 entries..)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">H</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">ello all,</FONT></SPAN><SPAN LANG="en-us"> </SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">'m doing an</FONT> <FONT SIZE=2 FACE="Courier New">linux</FONT> <FONT SIZE=2 FACE="Courier New">driver and application test on a qemu</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">arm64</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">virtual ma</FONT><FONT SIZE=2 FACE="Courier New">chine.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">M</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">y virtual machine is slig</FONT><FONT SIZE=2 FACE="Courier New">h</FONT><FONT SIZE=2 FACE="Courier New">tly modifi</FONT><FONT SIZE=2 FACE="Courier New">ed</FONT> <FONT SIZE=2 FACE="Courier New">version of</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">arm</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">'</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">virt</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">'</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> machine</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> and</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">it has</FONT> <FONT SIZE=2 FACE="Courier New">our device model</FONT><FONT SIZE=2 FACE="Courier New"> included</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">W</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">hen I do request_irq for INTID 208 (SPI 176)</FONT><FONT SIZE=2 FACE="Courier New"> in linux on m</FONT><FONT SIZE=2 FACE="Courier New">y arm64 virtual machine</FONT><FONT SIZE=2 FACE="Courier New">, it return</FONT><FONT SIZE=2 FACE="Courier New">s -EINVAL.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">poked into that function and found</FONT><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">the desc is r</FONT><FONT SIZE=2 FACE="Courier New">eturn</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">ing</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> NULL</FONT><FONT SIZE=2 FACE="Courier New"> in func</FONT><FONT SIZE=2 FACE="Courier New">tion request_</FONT><FONT SIZE=2 FACE="Courier New">thread</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">ed</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">_irq.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<UL DIR=LTR>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">int request_threaded_i</FONT><FONT SIZE=2 FACE="Courier New">rq(unsigned int irq, irq_handler_t handler,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> irq_handler_t thread_fn, unsigned long irqflags,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> const char *devname, void *dev_id)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> struct irqaction *action;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> struct irq_desc *desc;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> int retval;</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>..</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">desc = irq_to_desc(irq);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> if (!desc) </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> return -EINVAL;</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>..</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>}</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
</UL>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">a</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">nd irq_to</FONT><FONT SIZE=2 FACE="Courier New">_desc is sup</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">p</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">osed to return an irq_desc</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">from</FONT> <FONT SIZE=2 FACE="Courier New">the</FONT> <FONT SIZE=2 FACE="Courier New">irq_</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">radix</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">_tree</FONT><FONT SIZE=2 FACE="Courier New"> as</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> shown below.</FONT></SPAN></P>
<UL DIR=LTR>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">struct irq_desc *irq_to_desc(unsigned int irq)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> return radix_tree_lookup(&irq_desc_tree, irq);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">void *radix_tree_lookup(const struct radix_tree_root *root, unsigned long index)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> return __radix_tree_lookup(root, index, NULL, NULL);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">void *__radix_tree_lookup(const struct radix_tree_root *root,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> unsigned long index, struct radix_tree_node **nodep,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> void __rcu ***slotp)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> struct radix_tree_node *no</FONT><FONT SIZE=2 FACE="Courier New">de, *parent;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> unsigned long maxindex;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> void __rcu **slot;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> restart:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> parent = NULL;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> slot = (void __rcu **)&root->xa_head;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> radix_tree_load_root(root, &node, &maxindex);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> if (index > maxindex)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> return NULL;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>..</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>}</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
</UL>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">a</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">nd I found my requ</FONT><FONT SIZE=2 FACE="Courier New">e</FONT><FONT SIZE=2 FACE="Courier New">st index is 208 but the maxindex of the radix tree is 63.</FONT></SPAN><SPAN LANG="en-us"> </SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">S</FONT><FONT SIZE=2 FACE="Courier New">o</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> it looks like</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">the</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">radix tree of</FONT> <FONT SIZE=2 FACE="Courier New">irq_desc</FONT><FONT SIZE=2 FACE="Courier New"></FONT> <FONT SIZE=2 FACE="Courier New">has been</FONT><FONT SIZE=2 FACE="Courier New"> set to have maximu</FONT><FONT SIZE=2 FACE="Courier New">m</FONT><FONT SIZE=2 FACE="Courier New"> 64 irq_descs. </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">W</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">here</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">and how can I set</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"></FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">this</FONT> <FONT SIZE=2 FACE="Courier New">radix tree size</FONT><FONT SIZE=2 FACE="Courier New">?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> looked at qemu's hw/arm/ab21q-build-acpi.c for MADT or DSDT table parts b</FONT><FONT SIZE=2 FACE="Courier New">ut couldn't find</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">what to add.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> have my device</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">s address range and irq added in the DS</FONT><FONT SIZE=2 FACE="Courier New">DT and MADT.</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">static void</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">build_dsdt(GArray *table_data, BIOSLinker *linker, Ab21qMachineState *vms)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>..</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">acpi_dsdt_add_axpu(scop</FONT><FONT SIZE=2 FACE="Courier New">e, &memmap[AB21Q_AXPU],</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> (irqmap[AB21Q_AXPU] + ARM_SPI_BASE));</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>.</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2>..</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2>}</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">static void acpi_dsdt_add_axpu(Aml *scope, const MemMapEntry *axpu_memmap,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> uint32_t irq)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">{</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> Aml *dev = aml_device("AXPU");</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(dev, aml_name_decl("_HID", aml_string("AXPU0011")));</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(dev, aml_name_decl("_UID", aml_int(0)));</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> Aml *crs = aml_resource_template(</FONT><FONT SIZE=2 FACE="Courier New">);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(crs, aml_memory32_fixed(axpu_memmap->base,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> axpu_memmap->size, AML_READ_WRITE));</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(crs,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> </FONT> <FONT SIZE=2 FACE="Courier New"> AML_EXCLUSIVE, &irq, 1));</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(dev, aml_name_decl("_CRS", crs));</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> aml_append(scope, dev);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">}</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">'m not sure if I can just use _HID value as "AXPU0011". </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">f you see anything wrong and have a suggestion,</FONT> <FONT SIZE=2 FACE="Courier New">p</FONT><FONT SIZE=2 FACE="Courier New">lease te</FONT><FONT SIZE=2 FACE="Courier New">ll m</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">e.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">T</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">hank you!</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">C</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">han Kim</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
</BODY>
</HTML>