From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFVqN-0000J4-BQ for qemu-devel@nongnu.org; Tue, 01 Dec 2009 11:44:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFVqG-0000G1-Nk for qemu-devel@nongnu.org; Tue, 01 Dec 2009 11:44:49 -0500 Received: from [199.232.76.173] (port=59520 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFVqG-0000Fl-Hi for qemu-devel@nongnu.org; Tue, 01 Dec 2009 11:44:44 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47755 helo=mx2.suse.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFVqF-00051V-Qf for qemu-devel@nongnu.org; Tue, 01 Dec 2009 11:44:44 -0500 Message-ID: <4B1547F9.1070105@suse.de> Date: Tue, 01 Dec 2009 17:44:41 +0100 From: Alexander Graf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2 7/9] provide apic-kvm References: <1258391527-18840-1-git-send-email-glommer@redhat.com> <1258391527-18840-2-git-send-email-glommer@redhat.com> <1258391527-18840-3-git-send-email-glommer@redhat.com> <1258391527-18840-4-git-send-email-glommer@redhat.com> <1258391527-18840-5-git-send-email-glommer@redhat.com> <1258391527-18840-6-git-send-email-glommer@redhat.com> <1258391527-18840-7-git-send-email-glommer@redhat.com> <1258391527-18840-8-git-send-email-glommer@redhat.com> In-Reply-To: <1258391527-18840-8-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Glauber Costa wrote: > This patch provides the file apic-kvm.c, which implements a schim over > the kvm in-kernel APIC. > > Signed-off-by: Glauber Costa > --- > Makefile.target | 2 +- > hw/apic-kvm.c | 157 +++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > hw/pc.c | 6 ++- > hw/pc.h | 2 + > kvm.h | 3 + > target-i386/cpu.h | 4 ++ > target-i386/kvm.c | 23 ++++++++- > 7 files changed, 194 insertions(+), 3 deletions(-) > create mode 100644 hw/apic-kvm.c > > diff --git a/Makefile.target b/Makefile.target > index 86cf0a5..761e905 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -199,7 +199,7 @@ obj-i386-y +=3D usb-uhci.o vmmouse.o vmport.o vmwar= e_vga.o hpet.o > obj-i386-y +=3D device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o > obj-i386-y +=3D ne2000-isa.o > =20 > -obj-i386-$(CONFIG_KVM) +=3D ioapic-kvm.o i8259-kvm.o > +obj-i386-$(CONFIG_KVM) +=3D ioapic-kvm.o i8259-kvm.o apic-kvm.o > =20 > # shared objects > obj-ppc-y =3D ppc.o ide/core.o ide/qdev.o ide/isa.o ide/pci.o ide/maci= o.o > diff --git a/hw/apic-kvm.c b/hw/apic-kvm.c > new file mode 100644 > index 0000000..089fa45 > --- /dev/null > +++ b/hw/apic-kvm.c > @@ -0,0 +1,157 @@ > +#include "hw.h" > +#include "pc.h" > +#include "pci.h" > +#include "msix.h" > +#include "qemu-timer.h" > +#include "host-utils.h" > +#include "kvm.h" > + > +#define APIC_LVT_NB 6 > +#define APIC_LVT_LINT0 3 > + > +struct qemu_lapic_state { > + uint32_t apicbase; > + uint8_t id; > + uint8_t arb_id; > + uint8_t tpr; > + uint32_t spurious_vec; > + uint8_t log_dest; > + uint8_t dest_mode; > + uint32_t isr[8]; /* in service register */ > + uint32_t tmr[8]; /* trigger mode register */ > + uint32_t irr[8]; /* interrupt request register */ > + uint32_t lvt[APIC_LVT_NB]; > + uint32_t esr; /* error register */ > + uint32_t icr[2]; > + > + uint32_t divide_conf; > + int count_shift; > + uint32_t initial_count; > + int64_t initial_count_load_time, next_time; > + uint32_t idx; > + int sipi_vector; > + int wait_for_sipi; > +}; > + > +typedef struct APICState { > + CPUState *cpu_env; > + > +/* KVM lapic structure is just a big array of regs. But it is what kvm > + * functions expect. So have both the fields separated, for easy acces= s, > + * and the kvm stucture, for ioctls communications */ > + union { > + struct qemu_lapic_state dev; > + struct kvm_lapic_state kvm_lapic_state > =20 On S390X: cc1: warnings being treated as errors In file included from /suse/agraf/work/kvm-s390/qemu.works/vl.c:156: /suse/agraf/work/kvm-s390/qemu.works/kvm.h:104: error: =E2=80=98struct kvm_lapic_state=E2=80=99 declared inside parameter list /suse/agraf/work/kvm-s390/qemu.works/kvm.h:104: error: its scope is only this definition or declaration, which is probably not what you want /suse/agraf/work/kvm-s390/qemu.works/kvm.h:105: error: =E2=80=98struct kvm_lapic_state=E2=80=99 declared inside parameter list Alex