[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 05/15] xen: add a 8259 Interrupt Controller
From: Anthony PERARD <anthony.perard@xxxxxxxxxx> Introduce a 8259 Interrupt Controller for target-xen; every set_irq call makes a Xen hypercall. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- Makefile.target | 2 +- hw/xen_common.h | 3 ++ hw/xen_machine_fv.c | 5 +-- target-xen/i8259-xen-stub.c | 63 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 target-xen/i8259-xen-stub.c diff --git a/Makefile.target b/Makefile.target index 63dc7d1..d1b63f2 100644 --- a/Makefile.target +++ b/Makefile.target @@ -319,7 +319,7 @@ libobj-y := $(filter-out $(bad-libobj-y), $(libobj-y)) endif obj-xen-y += xen_machine_fv.o -obj-xen-y += i8259.o +obj-xen-y += i8259-xen-stub.o obj-xen-y += pc.o obj-xen-y += piix_pci.o obj-xen-y += mc146818rtc.o diff --git a/hw/xen_common.h b/hw/xen_common.h index 2cbc376..c49358c 100644 --- a/hw/xen_common.h +++ b/hw/xen_common.h @@ -52,4 +52,7 @@ typedef xc_interface *qemu_xc_interface; # define xc_fd(xen_xc) (*(int*)xen_xc) #endif +/* hw/i8259-xen-stub.c */ +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 5fef7de..114addf 100644 --- a/hw/xen_machine_fv.c +++ b/hw/xen_machine_fv.c @@ -32,6 +32,7 @@ #include "ide.h" #include "sysemu.h" +#include "xen_common.h" #include "xen_backend.h" #include "xenstore.h" #include "xen/hvm/hvm_info_table.h" @@ -50,7 +51,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; @@ -80,8 +80,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/target-xen/i8259-xen-stub.c b/target-xen/i8259-xen-stub.c new file mode 100644 index 0000000..aa2aae1 --- /dev/null +++ b/target-xen/i8259-xen-stub.c @@ -0,0 +1,63 @@ +/* Xen 8259 stub for interrupt controller emulation + * + * Copyright (c) 2003-2004 Fabrice Bellard + * Copyright (c) 2005 Intel corperation + * Copyright (c) 2008 Citrix / Xensource + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "hw/hw.h" +#include "hw/pc.h" +#include "monitor.h" +#include "hw/xen_common.h" +#include "hw/xen_backend.h" + +#include <xen/hvm/ioreq.h> + +PicState2 *isa_pic = NULL; + +void pic_update_irq(PicState2 *s) +{ +} + +static void i8259_set_irq(void *opaque, int irq, int level) +{ + xc_hvm_set_isa_irq_level(xen_xc, xen_domid, irq, level); +} + +int pic_read_irq(PicState2 *s) +{ + return -1; +} + +void irq_info(Monitor *mon) +{ + monitor_printf(mon, "irq statistics not supported with Xen.\n"); +} + +void pic_info(Monitor *mon) +{ + monitor_printf(mon, "pic_info not supported with Xen .\n"); +} + +qemu_irq *i8259_xen_init(void) +{ + return qemu_allocate_irqs(i8259_set_irq, NULL, 16); +} -- 1.7.0.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |