From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: Re: [PATCH 1/2] kvm tools: Fix IRQ assignments Date: Fri, 06 May 2011 11:47:42 +0400 Message-ID: <4DC3A79E.3090406@gmail.com> References: <1304666795-15251-1-git-send-email-levinsasha928@gmail.com> <1304667363.10534.5.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Pekka Enberg , mingo@elte.hu, asias.hejun@gmail.com, prasadjoshi124@gmail.com, kvm@vger.kernel.org To: Sasha Levin Return-path: Received: from mail-ew0-f46.google.com ([209.85.215.46]:55203 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676Ab1EFHrr (ORCPT ); Fri, 6 May 2011 03:47:47 -0400 Received: by ewy4 with SMTP id 4so889149ewy.19 for ; Fri, 06 May 2011 00:47:46 -0700 (PDT) In-Reply-To: <1304667363.10534.5.camel@lappy> Sender: kvm-owner@vger.kernel.org List-ID: On 05/06/2011 11:36 AM, Sasha Levin wrote: > On Fri, 2011-05-06 at 10:29 +0300, Pekka Enberg wrote: >> On Fri, May 6, 2011 at 10:26 AM, Sasha Levin wrote: >>> virtio-blk needs a block of 4 IRQs (currently - staticly defined). >>> Giving the initial IRQ of 15 causes breakage when adding more >>> than one device. >>> >>> Signed-off-by: Sasha Levin >> >> Can we make the allocation dynamic instead? AFAICT, it could be a simple as >> >> int kvm__request_irq(struct kvm *kvm) >> { >> return kvm->next_irq++; >> } >> >> that's done at device init time and then we'd just add "int irq" to >> the individual struct devices. >> >> Pekka > > afaik, we need to have same IRQ pins for devices which may have > different IRQ lines (All virtio-blk share same IRQ pin but different > line, I assume it'll be same with different virtio devices). > > So mptable has to manage association between device type and the > corresponding IRQ pin/line assignment, So dynamic assignment will be > more of a call with device type and return IRQ pin + line - which makes > it more complex than just allocating next free IRQ line. > Nod, making it dynamic force us to implement some kind of collector for pci devices, so that it would know pin/vector pair for every device. So in device init time we need to call kinda mptable_request_irq_pin() where we could "hint" allocator which pin and irq we need, and say "exclusive" flag which would tell allocator to fail if irq/pin already borrowed. The "hints" for every device might left hardcoded in some enum, for other irqs we might need pure dynamic vector allocator. -- Thanks, Cyrill