From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751405AbcGPBb5 (ORCPT ); Fri, 15 Jul 2016 21:31:57 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33684 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbcGPBby (ORCPT ); Fri, 15 Jul 2016 21:31:54 -0400 Reply-To: alex.popov@linux.com Subject: Re: [PATCH 1/1] irqdomain: Export __irq_domain_alloc_irqs() and irq_domain_free_irqs() References: <1467401388-11221-1-git-send-email-alex.popov@linux.com> <577F6578.6030904@linux.com> To: Thomas Gleixner Cc: Marc Zyngier , LKML From: Alexander Popov Message-ID: <57898F07.7030609@linux.com> Date: Sat, 16 Jul 2016 04:33:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <577F6578.6030904@linux.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.07.2016 11:34, Alexander Popov wrote: > 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? Hello again, Thomas, Did I properly answer your question? Will you accept my patch exporting these two functions? > 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. Do you think my paravirtualization code registering a child irq_domain for x86_vector_domain could bring any profit to the mainline? I would be glad to put effort and do it. Thanks again, sorry for disturbing. Best regards, Alexander