kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "Chan Kim" <ckim@etri.re.kr>
To: "'qemu-discuss'" <qemu-discuss@nongnu.org>,
	<kernelnewbies@kernelnewbies.org>
Subject: irq_desc not found for my interrupt number during request_irq (radix tree of irq_desc has only 64 entries..)
Date: Wed, 6 Apr 2022 10:45:33 +0900	[thread overview]
Message-ID: <037101d84958$01595110$040bf330$@etri.re.kr> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2975 bytes --]

Hello all, 

I'm doing an linux driver and application test on a qemu arm64 virtual
machine.
My virtual machine is slightly modified version of arm 'virt' machine and it
has our device model included.
When I do request_irq for INTID 208 (SPI 176) in linux on my arm64 virtual
machine, it returns -EINVAL.
I poked into that function and found the desc is returning NULL in function
request_threaded_irq.

	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)
	{
	    struct irqaction *action;
	    struct irq_desc *desc;
	    int retval;
	...
	desc = irq_to_desc(irq);
	    if (!desc) 
	        return -EINVAL;
	...
	}

and irq_to_desc is supposed to return an irq_desc from the irq_radix_tree as
shown below.

	struct irq_desc *irq_to_desc(unsigned int irq)
	{
	    return radix_tree_lookup(&irq_desc_tree, irq);
	}

	void *radix_tree_lookup(const struct radix_tree_root *root, unsigned
long index)
	{
	    return __radix_tree_lookup(root, index, NULL, NULL);
	}

	void *__radix_tree_lookup(const struct radix_tree_root *root,
	              unsigned long index, struct radix_tree_node **nodep,
	              void __rcu ***slotp)
	{
	    struct radix_tree_node *node, *parent;
	    unsigned long maxindex;
	    void __rcu **slot;

	 restart:
	    parent = NULL;
	    slot = (void __rcu **)&root->xa_head;
	    radix_tree_load_root(root, &node, &maxindex);
	    if (index > maxindex)
	        return NULL;
	...
	}
	
and I found my request index is 208 but the maxindex of the radix tree is
63. 
So it looks like the radix tree of irq_desc has been set to have maximum 64
irq_descs. 
Where and how can I set this radix tree size?
I looked at qemu's hw/arm/ab21q-build-acpi.c for MADT or DSDT table parts
but couldn't find what to add.
I have my devices address range and irq added in the DSDT and MADT.

static void
build_dsdt(GArray *table_data, BIOSLinker *linker, Ab21qMachineState *vms)
{
...
acpi_dsdt_add_axpu(scope, &memmap[AB21Q_AXPU],
                       (irqmap[AB21Q_AXPU] + ARM_SPI_BASE));
...
}
static void acpi_dsdt_add_axpu(Aml *scope, const MemMapEntry *axpu_memmap,
                                           uint32_t irq)
{
    Aml *dev = aml_device("AXPU");
    aml_append(dev, aml_name_decl("_HID", aml_string("AXPU0011")));
    aml_append(dev, aml_name_decl("_UID", aml_int(0)));

    Aml *crs = aml_resource_template();
    aml_append(crs, aml_memory32_fixed(axpu_memmap->base,
                                       axpu_memmap->size, AML_READ_WRITE));
    aml_append(crs,
               aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
                             AML_EXCLUSIVE, &irq, 1));
    aml_append(dev, aml_name_decl("_CRS", crs));

    aml_append(scope, dev);
}

I'm not sure if I can just use _HID value as "AXPU0011". 
If you see anything wrong and have a suggestion, please tell me.

Thank you!
Chan Kim


[-- Attachment #1.2: Type: text/html, Size: 16406 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2022-04-06  1:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  1:45 Chan Kim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-06  2:50 irq_desc not found for my interrupt number during request_irq (radix tree of irq_desc has only 64 entries..) Chan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='037101d84958$01595110$040bf330$@etri.re.kr' \
    --to=ckim@etri.re.kr \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=qemu-discuss@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).