Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D860C433F5 for ; Wed, 6 Apr 2022 01:46:12 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nbuk0-00035k-2N; Tue, 05 Apr 2022 21:45:48 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1nbujw-000358-Da for kernelnewbies@kernelnewbies.org; Tue, 05 Apr 2022 21:45:45 -0400 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 6 Apr 2022 10:45:36 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send002-relay.gov-dooray.com with SMTP id ab02d9d3624cf0c0; Wed, 06 Apr 2022 10:45:36 +0900 DKIM-Signature: a=rsa-sha256; b=V4a1154iUKd9ykm87nBiMIRuD4leywz+K4/hn5JnAo03Hrg4HxfaWxG4JEu97WNCD3CtW80WYp p3Eu8rLgI7HSCRPtFGW2YbA7iRGdEb3qPNYTkRLcKaAmKe7jhxSV1tuLLtrhIbc7qOEk0g+eIzO7 thbnSYO6acV7i6zpYUW3g3vew3TaxaIwCGZbZoJGmTy61LIvIFWdpB6QsvDhWYmYJWPu4TC1zOAd cVzte9O2gvA9NTylJdlSe9xWxzjOrhnNtINHs4+MJNLA8sI+x4WRbd7zE2EeDVP2iAvf1vfIPWQx yytnmhR4QbTSsLMNw6TQ4a0hIYHbgPd2LsfTWN2g==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=xRqoTKNRa+4afNqNAWv4AKsRDpc4nwwf0UkyrBuQHsg=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id 716ae20d624cf0bf; Wed, 06 Apr 2022 10:45:35 +0900 From: "Chan Kim" To: "'qemu-discuss'" , 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 Message-ID: <037101d84958$01595110$040bf330$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AdhJV/XCZrEq0dniSwWG3Dn+wpP6ag== X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============8854021540054186799==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============8854021540054186799== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0372_01D849A3.71416E40" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_0372_01D849A3.71416E40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_0372_01D849A3.71416E40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable irq_desc not found for my interrupt number during request_irq = (radix tree of irq_desc has only 64 entries..)

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,

               &n= bsp; irq_handler_t thread_fn, unsigned long irqflags,

               &n= bsp; const char *devname, void *dev_id)

    {

        struct irqaction *action;

        struct irq_desc *desc;

        int retval;

    ...

    desc =3D 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,

               &n= bsp;  unsigned long index, struct radix_tree_node = **nodep,

               &n= bsp;  void __rcu ***slotp)

    {

        struct radix_tree_node *node, *parent;

        unsigned long maxindex;

        void __rcu **slot;

     restart:

        parent =3D NULL;

        slot =3D (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],

           &n= bsp;           = (irqmap[AB21Q_AXPU] + ARM_SPI_BASE));

...

}

static void acpi_dsdt_add_axpu(Aml *scope, const MemMapEntry = *axpu_memmap,

           &n= bsp;           &nb= sp;           &nbs= p;       uint32_t irq)

{

    Aml *dev =3D = 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 =3D aml_resource_template();

    aml_append(crs, = aml_memory32_fixed(axpu_memmap->base,

           &n= bsp;           &nb= sp;           &nbs= p;   axpu_memmap->size, AML_READ_WRITE));

    aml_append(crs,

           &n= bsp;   aml_interrupt(AML_CONSUMER, AML_LEVEL, = AML_ACTIVE_HIGH,

           &n= bsp;           &nb= sp;     = 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

------=_NextPart_000_0372_01D849A3.71416E40-- --===============8854021540054186799== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============8854021540054186799==--