kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [PATCH v4 12/15] kvm: x86: Add user space part for in-kernel APIC
Date: Fri, 09 Dec 2011 08:52:52 +0100	[thread overview]
Message-ID: <4EE1BE54.2090509@siemens.com> (raw)
In-Reply-To: <4EE1BCA5.80709@siemens.com>

On 2011-12-09 08:45, Jan Kiszka wrote:
> On 2011-12-08 22:16, Blue Swirl wrote:
>> On Thu, Dec 8, 2011 at 11:52, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>> This introduces the alternative APIC backend which makes use of KVM's
>>> in-kernel device model. External NMI injection via LINT1 is emulated by
>>> checking the current state of the in-kernel APIC, only injecting a NMI
>>> into the VCPU if LINT1 is unmasked and configured to DM_NMI.
>>>
>>> MSI is not yet supported, so we disable this when the in-kernel model is
>>> in use.
>>>
>>> CC: Lai Jiangshan <laijs@cn.fujitsu.com>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>  Makefile.target   |    2 +-
>>>  hw/kvm/apic.c     |  154 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  hw/pc.c           |   15 ++++--
>>>  kvm.h             |    3 +
>>>  target-i386/kvm.c |    8 +++
>>>  5 files changed, 176 insertions(+), 6 deletions(-)
>>>  create mode 100644 hw/kvm/apic.c
>>>
>>> diff --git a/Makefile.target b/Makefile.target
>>> index b549988..76de485 100644
>>> --- a/Makefile.target
>>> +++ b/Makefile.target
>>> @@ -236,7 +236,7 @@ obj-i386-y += vmport.o
>>>  obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
>>>  obj-i386-y += debugcon.o multiboot.o
>>>  obj-i386-y += pc_piix.o
>>> -obj-i386-$(CONFIG_KVM) += kvm/clock.o
>>> +obj-i386-$(CONFIG_KVM) += kvm/clock.o kvm/apic.o
>>>  obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
>>>
>>>  # shared objects
>>> diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c
>>> new file mode 100644
>>> index 0000000..3924f9e
>>> --- /dev/null
>>> +++ b/hw/kvm/apic.c
>>> @@ -0,0 +1,154 @@
>>> +/*
>>> + * KVM in-kernel APIC support
>>> + *
>>> + * Copyright (c) 2011 Siemens AG
>>> + *
>>> + * Authors:
>>> + *  Jan Kiszka          <jan.kiszka@siemens.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 "kvm.h"
>>> +
>>> +static inline void kvm_apic_set_reg(struct kvm_lapic_state *kapic,
>>> +                                   int reg_id, uint32_t val)
>>> +{
>>> +    *((uint32_t *)(kapic->regs + (reg_id << 4))) = val;
>>> +}
>>> +
>>> +static inline uint32_t kvm_apic_get_reg(struct kvm_lapic_state *kapic,
>>> +                                       int reg_id)
>>> +{
>>> +    return *((uint32_t *)(kapic->regs + (reg_id << 4)));
>>> +}
>>> +
>>> +int kvm_put_apic(CPUState *env)
>>> +{
>>> +    APICState *s = DO_UPCAST(APICState, busdev.qdev, env->apic_state);
>>
>> Please pass APICState instead of CPUState.
> 
> DeviceState, I suppose. Yes, makes more sense, update will follow.

On second look: no, I'll keep it as is. All kvm_get/put_* helpers have
this kind of signature, i.e. are working against env. kvm_get/put_apic
just happens to be implemented outside of target-i386/kvm.c. And they
require both APIC and CPUState anyway, so it makes no difference.

Jan

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

  reply	other threads:[~2011-12-09  7:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 11:52 [PATCH v4 00/15] uq/master: Introduce basic irqchip support Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 01/15] msi: Generalize msix_supported to msi_supported Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 02/15] kvm: Move kvmclock into hw/kvm folder Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 03/15] apic: Stop timer on reset Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 04/15] apic: Inject external NMI events via LINT1 Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 05/15] apic: Introduce backend/frontend infrastructure for KVM reuse Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 06/15] apic: Open-code timer save/restore Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 07/15] i8259: Introduce backend/frontend infrastructure for KVM reuse Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 08/15] ioapic: " Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 09/15] memory: Introduce memory_region_init_reservation Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 10/15] kvm: Introduce core services for in-kernel irqchip support Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 11/15] kvm: x86: Establish IRQ0 override control Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 12/15] kvm: x86: Add user space part for in-kernel APIC Jan Kiszka
2011-12-08 21:16   ` Blue Swirl
2011-12-09  7:45     ` Jan Kiszka
2011-12-09  7:52       ` Jan Kiszka [this message]
2011-12-10 15:40         ` Blue Swirl
2011-12-10 15:58           ` Jan Kiszka
2011-12-10 16:11             ` Blue Swirl
2011-12-08 11:52 ` [PATCH v4 13/15] kvm: x86: Add user space part for in-kernel i8259 Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 14/15] kvm: x86: Add user space part for in-kernel IOAPIC Jan Kiszka
2011-12-08 11:52 ` [PATCH v4 15/15] kvm: Arm in-kernel irqchip support Jan Kiszka
2011-12-08 21:25 ` [PATCH v4 00/15] uq/master: Introduce basic " Blue Swirl
2011-12-09  7:40   ` Jan Kiszka
2011-12-12 16:37 ` Marcelo Tosatti
2011-12-12 16:51   ` Jan Kiszka
2011-12-12 17:37     ` Avi Kivity
2011-12-12 17:42       ` Jan Kiszka
2011-12-12 17:59         ` Avi Kivity
2011-12-15 10:33     ` Jan Kiszka
2011-12-15 11:54       ` Avi Kivity
2011-12-15 11:59         ` Jan Kiszka

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=4EE1BE54.2090509@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).