Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1435563 > unrolled thread

[PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()

Started byAlexander Popov <alex.popov@linux.com>
First post2016-07-01 21:40 +0200
Last post2016-07-08 10:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs() Alexander Popov <alex.popov@linux.com> - 2016-07-01 21:40 +0200
    Re: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and  irq_domain_free_irqs() Thomas Gleixner <tglx@linutronix.de> - 2016-07-06 13:30 +0200
      Re: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and  irq_domain_free_irqs() Alexander Popov <alex.popov@linux.com> - 2016-07-08 10:40 +0200

#1435563 — [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()

FromAlexander Popov <alex.popov@linux.com>
Date2016-07-01 21:40 +0200
Subject[PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()
Message-ID<rQcs9-2aJ-9@gated-at.bofh.it>
Export __irq_domain_alloc_irqs() and irq_domain_free_irqs() for being
able to work with irq_domain hierarchy in modules.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
---
 kernel/irq/irqdomain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 8798b6c..0ad85be 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1225,6 +1225,7 @@ out_free_desc:
 	irq_free_descs(virq, nr_irqs);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(__irq_domain_alloc_irqs);
 
 /**
  * irq_domain_free_irqs - Free IRQ number and associated data structures
@@ -1249,6 +1250,7 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs)
 	irq_domain_free_irq_data(virq, nr_irqs);
 	irq_free_descs(virq, nr_irqs);
 }
+EXPORT_SYMBOL_GPL(irq_domain_free_irqs);
 
 /**
  * irq_domain_alloc_irqs_parent - Allocate interrupts from parent domain
-- 
1.9.1

[toc] | [next] | [standalone]


#1437646 — Re: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()

FromThomas Gleixner <tglx@linutronix.de>
Date2016-07-06 13:30 +0200
SubjectRe: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()
Message-ID<rRTbH-71-1@gated-at.bofh.it>
In reply to#1435563
On Fri, 1 Jul 2016, Alexander Popov wrote:

> Export __irq_domain_alloc_irqs() and irq_domain_free_irqs() for being
> able to work with irq_domain hierarchy in modules.

We usually export only when we have a proper use case which is supposed to go
into the kernel tree proper. What's yours?
 
Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1439173 — Re: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()

FromAlexander Popov <alex.popov@linux.com>
Date2016-07-08 10:40 +0200
SubjectRe: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs()
Message-ID<rSzuh-2gt-5@gated-at.bofh.it>
In reply to#1437646
On 06.07.2016 14:17, Thomas Gleixner wrote:
> On Fri, 1 Jul 2016, Alexander Popov wrote:
> 
>> Export __irq_domain_alloc_irqs() and irq_domain_free_irqs() for being
>> able to work with irq_domain hierarchy in modules.
> 
> We usually export only when we have a proper use case which is supposed to go
> into the kernel tree proper. What's yours?

Hello, Thomas,

I work at Positive Technologies ( https://www.ptsecurity.com/ ). We develop
a bare-metal hypervisor, which targets x86_64 and supports Linux as a guest OS.

Intel VT-x allows hypervisor to inject interrupts into virtual machines.
We want to handle these interrupts in guest Linux.

So I wrote a simple kernel module creating an irq_domain, which has
x86_vector_domain as a parent in the hierarchy. In this module I just call:
- irq_domain_alloc_irqs() to allocate irqs and allow calling request_irq()
   for them;
- irqd_cfg(irq_get_irq_data()) to get the APIC vectors of the allocated irqs;
- irq_domain_free_irqs() to free the resources at the end.

It allows to handle interrupts injected by the hypervisor in guest Linux easily,
without emulating MSI-capable PCI device at the hypervisor side.

Everything works fine if __irq_domain_alloc_irqs() and irq_domain_free_irqs()
are exported. Is it a proper use-case?

Do you think my module could be useful for the mainline in some form?
It took me some time to understand irq_domain hierarchy design, so I can
prepare some patch or share my code to help others.

Best regards,
Alexander

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web