From: Avi Kivity <avi@qumranet.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [patch 7/7] KVM: in-kernel ACPI C2 idle emulation
Date: Mon, 23 Jun 2008 06:01:02 +0300 [thread overview]
Message-ID: <485F11EE.5010206@qumranet.com> (raw)
In-Reply-To: <20080618164854.789420485@localhost.localdomain>
Marcelo Tosatti wrote:
> Some guests fail to process the _CST notification which invalidates the C2 state.
>
>
Which?
> Emulate C2 similarly to HLT for those cases.
>
Please split the API change from actual addition of the ACPI emulation.
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> Index: kvm/arch/x86/kvm/Makefile
> ===================================================================
> --- kvm.orig/arch/x86/kvm/Makefile
> +++ kvm/arch/x86/kvm/Makefile
> @@ -11,7 +11,7 @@ endif
> EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
>
> kvm-objs := $(common-objs) x86.o mmu.o x86_emulate.o i8259.o irq.o lapic.o \
> - i8254.o
> + i8254.o acpi.o
> obj-$(CONFIG_KVM) += kvm.o
> kvm-intel-objs = vmx.o
> obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
> Index: kvm/arch/x86/kvm/acpi.c
> ===================================================================
> --- /dev/null
> +++ kvm/arch/x86/kvm/acpi.c
> @@ -0,0 +1,82 @@
> +#include <linux/kvm_host.h>
> +#include <linux/kvm.h>
> +#include <linux/acpi_pmtmr.h>
> +#include <asm/io.h>
> +#include "iodev.h"
> +#include "irq.h"
> +
> +/*
> + * P_LVL2 = PBLK + 4h
> + *
> + * Note: matches BIOS (currently hardcoded) definition.
> + */
> +#define ACPI_PBLK 0xb010
>
Please make it part of the API.
> +
> +struct kvm_acpi {
> + struct kvm_io_device dev;
> + struct kvm *kvm;
> +};
> +
> +static void acpi_cstate_halt(struct kvm_vcpu *vcpu)
> +{
> + vcpu->arch.mp_state = KVM_MP_STATE_HALTED;
> + mutex_unlock(&vcpu->kvm->lock);
> + up_read(&vcpu->kvm->slots_lock);
> + kvm_vcpu_block(vcpu);
> + down_read(&vcpu->kvm->slots_lock);
> + mutex_lock(&vcpu->kvm->lock);
> + vcpu->arch.pio.size = 0;
> +}
> +
> +static void acpi_ioport_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
> + gpa_t addr, int len, void *data)
> +{
> +
> + if (addr == ACPI_PBLK + 0x4)
> + acpi_cstate_halt(vcpu);
> +
>
Don't you need to write to the data here?
> @@ -1725,6 +1727,10 @@ long kvm_arch_vm_ioctl(struct file *filp
> r = 0;
> break;
> }
> + case KVM_ENABLE_ACPI_C2: {
> + r = kvm_acpi_init(kvm);
> + break;
> + }
>
Need a disable too.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
next prev parent reply other threads:[~2008-06-23 3:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-18 16:42 [patch 0/7] force the TSC unreliable by reporting C2 state Marcelo Tosatti
2008-06-18 16:42 ` [patch 1/7] kvm: qemu: inform valid C2 state in ACPI table Marcelo Tosatti
2008-06-18 16:42 ` [patch 2/7] kvm: qemu: disable c2 via _CST notification Marcelo Tosatti
2008-06-18 16:42 ` [patch 3/7] libkvm: in-kernel C2 halt interface Marcelo Tosatti
2008-06-18 16:42 ` [patch 4/7] libkvm: handle_io return handler value Marcelo Tosatti
2008-06-18 16:42 ` [patch 5/7] qemu: kvm: unhalt vcpu0 on pit irq Marcelo Tosatti
2008-06-18 16:42 ` [patch 6/7] kvm: qemu: enable in-kernel C2 emulation / userspace emulation Marcelo Tosatti
2008-06-18 16:42 ` [patch 7/7] KVM: in-kernel ACPI C2 idle emulation Marcelo Tosatti
2008-06-23 3:01 ` Avi Kivity [this message]
2008-06-18 20:09 ` [patch 0/7] force the TSC unreliable by reporting C2 state Anthony Liguori
2008-06-18 20:40 ` Marcelo Tosatti
2008-06-18 21:02 ` Anthony Liguori
2008-06-18 21:21 ` Marcelo Tosatti
2008-06-18 21:42 ` Anthony Liguori
2008-06-18 22:41 ` Marcelo Tosatti
2008-06-18 22:57 ` john stultz
2008-06-18 23:08 ` Nakajima, Jun
2008-06-20 14:07 ` Andi Kleen
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=485F11EE.5010206@qumranet.com \
--to=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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