From patchwork Wed May 1 15:50:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 2507951 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CF6E240206 for ; Wed, 1 May 2013 15:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758911Ab3EAPut (ORCPT ); Wed, 1 May 2013 11:50:49 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:42925 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758803Ab3EAPue (ORCPT ); Wed, 1 May 2013 11:50:34 -0400 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.203.36]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r41FoKki024141; Wed, 1 May 2013 16:50:20 +0100 (BST) Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id A9668C2B18; Wed, 1 May 2013 16:50:18 +0100 (BST) From: Will Deacon To: kvm@vger.kernel.org Cc: penberg@kernel.org, marc.zyngier@arm.com, anup@brainfault.org, rusty@rustcorp.com.au, pranavkumar@linaro.org, michael@ellerman.id.au, Will Deacon Subject: [RFC PATCH 06/11] kvm tools: ioport: add arch callback to remap IRQ lines for ioport devices Date: Wed, 1 May 2013 16:50:11 +0100 Message-Id: <1367423416-24640-7-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1367423416-24640-1-git-send-email-will.deacon@arm.com> References: <1367423416-24640-1-git-send-email-will.deacon@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If an architecture other than x86 wants to make use of ioport devices, the interrupt lines will likely need remapping from their fixed values. This patch allows an architecture callback, ioport__map_irq, to map interrupts as appropriate. Signed-off-by: Will Deacon --- tools/kvm/arm/ioport.c | 7 +++++++ tools/kvm/hw/serial.c | 1 + tools/kvm/include/kvm/ioport.h | 1 + tools/kvm/powerpc/ioport.c | 4 ++++ tools/kvm/x86/ioport.c | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/tools/kvm/arm/ioport.c b/tools/kvm/arm/ioport.c index 3c03fa0..74ee10e 100644 --- a/tools/kvm/arm/ioport.c +++ b/tools/kvm/arm/ioport.c @@ -1,5 +1,12 @@ #include "kvm/ioport.h" +#include "arm-common/gic.h" + void ioport__setup_arch(struct kvm *kvm) { } + +void ioport__map_irq(u8 *irq) +{ + *irq = gic__alloc_irqnum(); +} diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c index 18bf569..384ee37 100644 --- a/tools/kvm/hw/serial.c +++ b/tools/kvm/hw/serial.c @@ -402,6 +402,7 @@ static int serial8250__device_init(struct kvm *kvm, struct serial8250_device *de { int r; + ioport__map_irq(&dev->irq); r = ioport__register(kvm, dev->iobase, &serial8250_ops, 8, NULL); kvm__irq_line(kvm, dev->irq, 0); diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h index 6660acb..1556dd3 100644 --- a/tools/kvm/include/kvm/ioport.h +++ b/tools/kvm/include/kvm/ioport.h @@ -30,6 +30,7 @@ struct ioport_operations { }; void ioport__setup_arch(struct kvm *kvm); +void ioport__map_irq(u8 *irq); int ioport__register(struct kvm *kvm, u16 port, struct ioport_operations *ops, int count, void *param); diff --git a/tools/kvm/powerpc/ioport.c b/tools/kvm/powerpc/ioport.c index 264fb7e..58dc625 100644 --- a/tools/kvm/powerpc/ioport.c +++ b/tools/kvm/powerpc/ioport.c @@ -16,3 +16,7 @@ void ioport__setup_arch(struct kvm *kvm) { /* PPC has no legacy ioports to set up */ } + +void ioport__map_irq(u8 *irq) +{ +} diff --git a/tools/kvm/x86/ioport.c b/tools/kvm/x86/ioport.c index 824ef25..03a1286 100644 --- a/tools/kvm/x86/ioport.c +++ b/tools/kvm/x86/ioport.c @@ -65,6 +65,10 @@ static struct ioport_operations ps2_control_a_ops = { .io_out = dummy_io_out, }; +void ioport__map_irq(u8 *irq) +{ +} + void ioport__setup_arch(struct kvm *kvm) { /* Legacy ioport setup */