xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>,
	"Wei Liu (Intern)" <wei.liu2@citrix.com>,
	"liuw@liuw.name" <liuw@liuw.name>,
	QEMU-devel <qemu-devel@nongnu.org>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up.
Date: Wed, 11 Apr 2012 18:01:46 +0200	[thread overview]
Message-ID: <4F85AAEA.5000301@siemens.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1204111700450.15151@kaball-desktop>

On 2012-04-11 18:02, Stefano Stabellini wrote:
> Jan, Anthony, any opinions on this patch?
> If it is OK for you, I am going to include it in the next Xen pull request.
> 

Looks good to me.

Jan

> 
> On Thu, 5 Apr 2012, Wei Liu (Intern) wrote:
>>
>> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>> ---
>>  Makefile.target |    2 +-
>>  hw/pc.c         |    8 +++++
>>  hw/xen_apic.c   |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 99 insertions(+), 1 deletions(-)
>>  create mode 100644 hw/xen_apic.c
>>
>> diff --git a/Makefile.target b/Makefile.target
>> index cff15f0..6210bae 100644
>> --- a/Makefile.target
>> +++ b/Makefile.target
>> @@ -235,7 +235,7 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
>>  obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
>>  obj-$(CONFIG_NO_XEN) += xen-stub.o
>>  
>> -obj-i386-$(CONFIG_XEN) += xen_platform.o
>> +obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o
>>  
>>  # Inter-VM PCI shared memory
>>  CONFIG_IVSHMEM =
>> diff --git a/hw/pc.c b/hw/pc.c
>> index 83a1b5b..5585cac 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -42,6 +42,7 @@
>>  #include "sysbus.h"
>>  #include "sysemu.h"
>>  #include "kvm.h"
>> +#include "xen.h"
>>  #include "blockdev.h"
>>  #include "ui/qemu-spice.h"
>>  #include "memory.h"
>> @@ -891,9 +892,12 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
>>  
>>      if (kvm_irqchip_in_kernel()) {
>>          dev = qdev_create(NULL, "kvm-apic");
>> +    } else if (xen_enabled()) {
>> +        dev = qdev_create(NULL, "xen-apic");
>>      } else {
>>          dev = qdev_create(NULL, "apic");
>>      }
>> +
>>      qdev_prop_set_uint8(dev, "id", apic_id);
>>      qdev_prop_set_ptr(dev, "cpu_env", env);
>>      qdev_init_nofail(dev);
>> @@ -912,6 +916,10 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
>>          msi_supported = true;
>>      }
>>  
>> +    if (xen_enabled()) {
>> +        msi_supported = true;
>> +    }
>> +
>>      return dev;
>>  }
>>  
>> diff --git a/hw/xen_apic.c b/hw/xen_apic.c
>> new file mode 100644
>> index 0000000..b1060b7
>> --- /dev/null
>> +++ b/hw/xen_apic.c
>> @@ -0,0 +1,90 @@
>> +/*
>> + * Xen basic APIC support
>> + *
>> + * Copyright (c) 2012 Citrix
>> + *
>> + * Authors:
>> + *  Wei Liu <wei.liu2@citrix.com>
>> + *
>> + * This work is licensed under the terms of the GNU GPL version 2.
>> + * See the COPYING file in the top-level directory.
>> + */
>> +#include "hw/apic_internal.h"
>> +#include "hw/msi.h"
>> +#include "xen.h"
>> +
>> +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr,
>> +                                  unsigned size)
>> +{
>> +    return -1U;
>> +}
>> +
>> +static void xen_apic_mem_write(void *opaque, target_phys_addr_t addr,
>> +                               uint64_t data, unsigned size)
>> +{
>> +    if (size != sizeof(uint32_t)) {
>> +        fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size);
>> +        return;
>> +    }
>> +
>> +    xen_hvm_inject_msi(addr, data);
>> +}
>> +
>> +static const MemoryRegionOps xen_apic_io_ops = {
>> +    .read = xen_apic_mem_read,
>> +    .write = xen_apic_mem_write,
>> +    .endianness = DEVICE_NATIVE_ENDIAN,
>> +};
>> +
>> +static void xen_apic_init(APICCommonState *s)
>> +{
>> +    memory_region_init_io(&s->io_memory, &xen_apic_io_ops, s, "xen-apic-msi",
>> +                          MSI_SPACE_SIZE);
>> +}
>> +
>> +static void xen_apic_set_base(APICCommonState *s, uint64_t val)
>> +{
>> +}
>> +
>> +static void xen_apic_set_tpr(APICCommonState *s, uint8_t val)
>> +{
>> +}
>> +
>> +static uint8_t xen_apic_get_tpr(APICCommonState *s)
>> +{
>> +    return 0;
>> +}
>> +
>> +static void xen_apic_vapic_base_update(APICCommonState *s)
>> +{
>> +}
>> +
>> +static void xen_apic_external_nmi(APICCommonState *s)
>> +{
>> +}
>> +
>> +static void xen_apic_class_init(ObjectClass *klass, void *data)
>> +{
>> +    APICCommonClass *k = APIC_COMMON_CLASS(klass);
>> +
>> +    k->init = xen_apic_init;
>> +    k->set_base = xen_apic_set_base;
>> +    k->set_tpr = xen_apic_set_tpr;
>> +    k->get_tpr = xen_apic_get_tpr;
>> +    k->vapic_base_update = xen_apic_vapic_base_update;
>> +    k->external_nmi = xen_apic_external_nmi;
>> +}
>> +
>> +static TypeInfo xen_apic_info = {
>> +    .name = "xen-apic",
>> +    .parent = TYPE_APIC_COMMON,
>> +    .instance_size = sizeof(APICCommonState),
>> +    .class_init = xen_apic_class_init,
>> +};
>> +
>> +static void xen_apic_register_types(void)
>> +{
>> +    type_register_static(&xen_apic_info);
>> +}
>> +
>> +type_init(xen_apic_register_types)
>> -- 
>> 1.7.2.5
>>
>>
>>
>>
>>

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-04-11 16:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05  9:32 [PATCH 0/0] MSI/MSIX injection for Xen HVM guests Wei Liu
2012-04-05  9:34 ` [PATCH 1/2] Xen: basic HVM MSI injection support Wei Liu
2012-04-05  9:35 ` [PATCH 2/2] Xen: Add xen-apic support and hook it up Wei Liu
2012-04-11 16:02   ` Stefano Stabellini
2012-04-11 16:01     ` Jan Kiszka [this message]
2012-04-11 16:07   ` Peter Maydell
2012-04-11 16:13     ` Jan Kiszka
2012-04-11 16:23       ` Peter Maydell
2012-04-11 16:17     ` Stefano Stabellini
2012-04-11 16:19       ` Stefano Stabellini
2012-04-11 17:02       ` Eric Blake
2012-04-12  3:23         ` [Qemu-devel] " Wei Liu
2012-04-11 21:37       ` Paolo Bonzini
2012-04-05 10:14 ` [PATCH 0/0] MSI/MSIX injection for Xen HVM guests Paolo Bonzini
2012-04-05 10:43   ` Stefano Stabellini
2012-04-05 10:50     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F85AAEA.5000301@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=anthony@codemonkey.ws \
    --cc=liuw@liuw.name \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).