Re: [PATCH 02/10] Provide ioapic-kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 26, 2010 at 05:12:13PM -0300, Glauber Costa wrote:
> This patch provides the file ioapic-kvm.c, which implements a schim over
> the kvm in-kernel IO APIC.
> 
> Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
> ---
>  Makefile.target |    2 +
>  hw/ioapic-kvm.c |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/pc.c         |    7 ++++-
>  hw/pc.h         |    2 +
>  kvm-all.c       |   18 +++++++++++
>  kvm.h           |    4 ++
>  6 files changed, 121 insertions(+), 1 deletions(-)
>  create mode 100644 hw/ioapic-kvm.c
> 
> diff --git a/Makefile.target b/Makefile.target
> index 4c4d397..78aff3c 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -213,6 +213,8 @@ obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
>  obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
>  obj-i386-y += ne2000-isa.o debugcon.o multiboot.o
>  
> +obj-i386-$(CONFIG_KVM) += ioapic-kvm.o
> +
>  # shared objects
>  obj-ppc-y = ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/macio.o
>  obj-ppc-y += ide/cmd646.o
> diff --git a/hw/ioapic-kvm.c b/hw/ioapic-kvm.c
> new file mode 100644
> index 0000000..78e0984
> --- /dev/null
> +++ b/hw/ioapic-kvm.c
> @@ -0,0 +1,89 @@
> +#include "hw.h"
> +#include "pc.h"
> +#include "qemu-timer.h"
> +#include "host-utils.h"
> +#include "kvm.h"
> +
> +#define IOAPIC_NUM_PINS			0x18
> +#define IOAPIC_DEFAULT_BASE_ADDRESS  0xfec00000
> +
> +static void ioapic_reset(void *opaque)
> +{
> +    struct kvm_ioapic_state *s = opaque;
> +    struct kvm_irqchip *chip;
> +    int i;
> +
> +    chip = container_of(s, struct kvm_irqchip, chip.ioapic);
> +
> +    chip->chip_id = KVM_IRQCHIP_IOAPIC;
> +
> +    memset(s, 0, sizeof(*s));
> +    s->base_address = IOAPIC_DEFAULT_BASE_ADDRESS;
> +    for(i = 0; i < IOAPIC_NUM_PINS; i++)
> +        s->redirtbl[i].bits = 1 << 16; /* mask LVT */
> +
> +    kvm_set_irqchip(chip);
> +}
> +
> +static void ioapic_pre_save(void *opaque)
> +{
> +    struct kvm_ioapic_state *s = opaque;
> +    struct kvm_irqchip *chip;
> +
> +    chip = container_of(s, struct kvm_irqchip, chip.ioapic);
> +
> +    kvm_get_irqchip(chip);
> +}
> +
> +static int ioapic_post_load(void *opaque, int version_id)
> +{
> +    struct kvm_ioapic_state *s = opaque;
> +    struct kvm_irqchip *chip;
> +
> +    chip = container_of(s, struct kvm_irqchip, chip.ioapic);
> +
> +    return kvm_set_irqchip(chip);
> +}
> +
> +static const VMStateDescription vmstate_kvm_ioapic = {
> +    .name = "ioapic-kvm",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .post_load = ioapic_post_load,
> +    .pre_save = ioapic_pre_save,
> +    .fields      = (VMStateField []) {
> +        /* Linux does not define __u64 the same as uint64_t */
> +        VMSTATE_U64(base_address, struct kvm_ioapic_state),
> +        VMSTATE_UINT32(id, struct kvm_ioapic_state),
> +        VMSTATE_UINT32(ioregsel, struct kvm_ioapic_state),
> +        VMSTATE_UINT32(irr, struct kvm_ioapic_state),
> +        VMSTATE_ARRAY_UNSAFE(redirtbl, struct kvm_ioapic_state, IOAPIC_NUM_PINS, 0, vmstate_info_u64, __u64),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
> +
> +static void kvm_ioapic_set_irq(void *opaque, int vector, int level)
> +{
> +/*
> +    int pic_ret;
> +
> +    if (kvm_set_irq(vector, level, &pic_ret)) {
> +        if (pic_ret != 0)
> +            apic_set_irq_delivered();
> +        return;
> +    }
> +*/

Didnt you forget to uncomment this later?

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux