From patchwork Thu Oct 21 17:36:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 68753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B4CCB70EC for ; Fri, 22 Oct 2010 05:31:27 +1100 (EST) Received: from localhost ([127.0.0.1]:43838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8zOO-0008Uo-Ek for incoming@patchwork.ozlabs.org; Thu, 21 Oct 2010 13:57:32 -0400 Received: from [140.186.70.92] (port=42773 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8z5H-0000fg-Nk for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:37:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8z5F-0005l9-89 for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:37:46 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:52050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8z5F-0005jY-1A for qemu-devel@nongnu.org; Thu, 21 Oct 2010 13:37:45 -0400 X-IronPort-AV: E=Sophos;i="4.58,218,1286164800"; d="scan'208";a="119106420" Received: from ftlpexchmx02.citrite.net ([10.9.154.127]) by FTLPIPO02.CITRIX.COM with ESMTP; 21 Oct 2010 13:37:44 -0400 Received: from smtp01.ad.xensource.com ([10.219.128.104]) by FTLPEXCHMX02.citrite.net with Microsoft SMTPSVC(6.0.3790.4675); Thu, 21 Oct 2010 13:37:43 -0400 Received: from perard.cam.xci-test.com (perard.cam.xci-test.com [10.80.248.106]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id o9LHb2io009642; Thu, 21 Oct 2010 10:37:43 -0700 From: anthony.perard@citrix.com To: QEMU-devel Date: Thu, 21 Oct 2010 18:36:20 +0100 Message-Id: <1287682587-18642-9-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1287682587-18642-1-git-send-email-anthony.perard@citrix.com> References: <1287682587-18642-1-git-send-email-anthony.perard@citrix.com> X-OriginalArrivalTime: 21 Oct 2010 17:37:43.0964 (UTC) FILETIME=[AAEF25C0:01CB7146] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony PERARD , Xen Devel , Stefano Stabellini Subject: [Qemu-devel] [PATCH V6 08/15] xen: add a 8259 Interrupt Controller X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD Introduce a 8259 Interrupt Controller for target-xen; every set_irq call makes a Xen hypercall. Signed-off-by: Anthony PERARD Signed-off-by: Stefano Stabellini --- hw/xen_common.h | 2 ++ hw/xen_machine_fv.c | 5 ++--- xen-all.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/xen_common.h b/hw/xen_common.h index 4c0f97d..a24bcb3 100644 --- a/hw/xen_common.h +++ b/hw/xen_common.h @@ -44,4 +44,6 @@ typedef xc_interface *qemu_xc_interface; # define xc_fd(xen_xc) (*(int*)xen_xc) #endif +qemu_irq *i8259_xen_init(void); + #endif /* QEMU_HW_XEN_COMMON_H */ diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c index 39ee7c7..fe4491f 100644 --- a/hw/xen_machine_fv.c +++ b/hw/xen_machine_fv.c @@ -36,6 +36,7 @@ #include "xen_common.h" #include "xen/hvm/hvm_info_table.h" #include "xen_platform.h" +#include "xen_common.h" #define MAX_IDE_BUS 2 @@ -51,7 +52,6 @@ static void xen_init_fv(ram_addr_t ram_size, PCIBus *pci_bus; PCII440FXState *i440fx_state; int piix3_devfn = -1; - qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; qemu_irq *cmos_s3; @@ -75,8 +75,7 @@ static void xen_init_fv(ram_addr_t ram_size, env = cpu_init(cpu_model); env->halted = 1; - cpu_irq = pc_allocate_cpu_irq(); - i8259 = i8259_init(cpu_irq[0]); + i8259 = i8259_xen_init(); isa_irq_state = qemu_mallocz(sizeof (*isa_irq_state)); isa_irq_state->i8259 = i8259; diff --git a/xen-all.c b/xen-all.c index f913e1f..90c03eb 100644 --- a/xen-all.c +++ b/xen-all.c @@ -42,6 +42,18 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) } } +/* i8259 */ + +static void i8259_set_irq(void *opaque, int irq, int level) +{ + xc_hvm_set_isa_irq_level(xen_xc, xen_domid, irq, level); +} + +qemu_irq *i8259_xen_init(void) +{ + return qemu_allocate_irqs(i8259_set_irq, NULL, 16); +} + /* Initialise Xen */ int xen_init(int smp_cpus)