* [PATCH 0/3] Remaining S3 bits
@ 2008-12-30 10:37 Gleb Natapov
2008-12-30 10:37 ` [PATCH 1/3] Reset stack pointer to zero on S3 resume Gleb Natapov
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Gleb Natapov @ 2008-12-30 10:37 UTC (permalink / raw)
To: avi; +Cc: kvm
The patch series provides remaining bits for S3 support in KVM. They are
not (yet?) relevant for qemu upstream.
---
Gleb Natapov (3):
KVM does not support SMM. Disable it.
Don't return to guest after CPU issued S3 command.
Reset stack pointer to zero on S3 resume.
bios/rombios.c | 1 +
bios/rombios32.c | 2 +-
qemu/hw/acpi.c | 2 +-
qemu/qemu-kvm.c | 2 +-
qemu/qemu-kvm.h | 1 +
5 files changed, 5 insertions(+), 3 deletions(-)
--
Gleb.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] Reset stack pointer to zero on S3 resume.
2008-12-30 10:37 [PATCH 0/3] Remaining S3 bits Gleb Natapov
@ 2008-12-30 10:37 ` Gleb Natapov
2008-12-30 10:37 ` [PATCH 2/3] Don't return to guest after CPU issued S3 command Gleb Natapov
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2008-12-30 10:37 UTC (permalink / raw)
To: avi; +Cc: kvm
Reset stack pointer to zero on S3 resume before jumping to resume vector
to prevent tpr patching on boot CPU during resume.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
bios/rombios.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/bios/rombios.c b/bios/rombios.c
index b7a240f..54c94bf 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -2225,6 +2225,7 @@ s3_resume()
BX_INFO("S3 resume jump to %x:%x\n", (s3_wakeup_vector >> 4),
(s3_wakeup_vector & 0xF));
ASM_START
+ mov sp, #0 ;; disable tpr patching on boot CPU
jmpf [0x04b6]
ASM_END
return 1;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] Don't return to guest after CPU issued S3 command.
2008-12-30 10:37 [PATCH 0/3] Remaining S3 bits Gleb Natapov
2008-12-30 10:37 ` [PATCH 1/3] Reset stack pointer to zero on S3 resume Gleb Natapov
@ 2008-12-30 10:37 ` Gleb Natapov
2008-12-30 11:19 ` Avi Kivity
2008-12-30 10:37 ` [PATCH 3/3] KVM does not support SMM. Disable it Gleb Natapov
2008-12-30 11:25 ` [PATCH 0/3] Remaining S3 bits Avi Kivity
3 siblings, 1 reply; 8+ messages in thread
From: Gleb Natapov @ 2008-12-30 10:37 UTC (permalink / raw)
To: avi; +Cc: kvm
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
qemu/hw/acpi.c | 2 +-
qemu/qemu-kvm.c | 2 +-
qemu/qemu-kvm.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 0ff8851..219d8ac 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -159,7 +159,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
/* RSM_STS should be set on resume. Pretend that resume
was caused by power button */
s->pmsts |= (RSM_STS | PWRBTN_STS);
- qemu_system_reset_request();
+ kvm_shutdown(NULL, cpu_single_env);
#if defined(TARGET_I386)
cmos_set_s3_resume();
#endif
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 01c265b..179f1c2 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -722,7 +722,7 @@ static int kvm_halt(void *opaque, int vcpu)
return kvm_arch_halt(opaque, vcpu);
}
-static int kvm_shutdown(void *opaque, void *data)
+int kvm_shutdown(void *opaque, void *data)
{
struct CPUState *env = (struct CPUState *)data;
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index ec27d06..249f46a 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -100,6 +100,7 @@ int kvm_arch_remove_hw_breakpoint(target_ulong addr,
target_ulong len, int type);
void kvm_arch_remove_all_hw_breakpoints(void);
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg);
+int kvm_shutdown(void *opaque, void *data);
void qemu_kvm_aio_wait_start(void);
void qemu_kvm_aio_wait(void);
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] KVM does not support SMM. Disable it.
2008-12-30 10:37 [PATCH 0/3] Remaining S3 bits Gleb Natapov
2008-12-30 10:37 ` [PATCH 1/3] Reset stack pointer to zero on S3 resume Gleb Natapov
2008-12-30 10:37 ` [PATCH 2/3] Don't return to guest after CPU issued S3 command Gleb Natapov
@ 2008-12-30 10:37 ` Gleb Natapov
2008-12-30 11:25 ` [PATCH 0/3] Remaining S3 bits Avi Kivity
3 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2008-12-30 10:37 UTC (permalink / raw)
To: avi; +Cc: kvm
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
bios/rombios32.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bios/rombios32.c b/bios/rombios32.c
index fd6ff71..a0c9572 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -38,7 +38,7 @@ typedef unsigned long long uint64_t;
//#define BX_USE_EBDA_TABLES
/* define it if the (emulated) hardware supports SMM mode */
-#define BX_USE_SMM
+//#define BX_USE_SMM
#define cpuid(index, eax, ebx, ecx, edx) \
asm volatile ("cpuid" \
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] Don't return to guest after CPU issued S3 command.
2008-12-30 10:37 ` [PATCH 2/3] Don't return to guest after CPU issued S3 command Gleb Natapov
@ 2008-12-30 11:19 ` Avi Kivity
2008-12-30 12:32 ` Gleb Natapov
0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2008-12-30 11:19 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm
Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>
> qemu/hw/acpi.c | 2 +-
> qemu/qemu-kvm.c | 2 +-
> qemu/qemu-kvm.h | 1 +
> 3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
> index 0ff8851..219d8ac 100644
> --- a/qemu/hw/acpi.c
> +++ b/qemu/hw/acpi.c
> @@ -159,7 +159,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
> /* RSM_STS should be set on resume. Pretend that resume
> was caused by power button */
> s->pmsts |= (RSM_STS | PWRBTN_STS);
> - qemu_system_reset_request();
> + kvm_shutdown(NULL, cpu_single_env);
>
if (kvm_enabled)()?
But I think a qemu API is called for here, not a kvm specific API.
> +int kvm_shutdown(void *opaque, void *data);
That's a bad API. What's the opaque? what's the data?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] Remaining S3 bits
2008-12-30 10:37 [PATCH 0/3] Remaining S3 bits Gleb Natapov
` (2 preceding siblings ...)
2008-12-30 10:37 ` [PATCH 3/3] KVM does not support SMM. Disable it Gleb Natapov
@ 2008-12-30 11:25 ` Avi Kivity
3 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2008-12-30 11:25 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm
Gleb Natapov wrote:
> The patch series provides remaining bits for S3 support in KVM. They are
> not (yet?) relevant for qemu upstream.
>
> ---
>
> Gleb Natapov (3):
> KVM does not support SMM. Disable it.
> Don't return to guest after CPU issued S3 command.
> Reset stack pointer to zero on S3 resume.
>
>
Applied 1 and 3, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] Don't return to guest after CPU issued S3 command.
2008-12-30 11:19 ` Avi Kivity
@ 2008-12-30 12:32 ` Gleb Natapov
2008-12-30 13:25 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: Gleb Natapov @ 2008-12-30 12:32 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
On Tue, Dec 30, 2008 at 01:19:22PM +0200, Avi Kivity wrote:
>> +int kvm_shutdown(void *opaque, void *data);
>
> That's a bad API. What's the opaque? what's the data?
>
How about this one:
Don't return to guest CPU after qemu_system_reset_request().
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 01c265b..8ec8f7f 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -1357,3 +1357,9 @@ int qemu_kvm_has_sync_mmu(void)
{
return kvm_has_sync_mmu(kvm_context);
}
+
+void qemu_kvm_cpu_stop(CPUState *env)
+{
+ if (kvm_enabled())
+ env->kvm_cpu_state.stopped = 1;
+}
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index ec27d06..f8d724b 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -153,6 +153,7 @@ struct ioperm_data {
};
int qemu_kvm_has_sync_mmu(void);
+void qemu_kvm_cpu_stop(CPUState *env);
#define kvm_enabled() (kvm_allowed)
#define qemu_kvm_irqchip_in_kernel() kvm_irqchip_in_kernel(kvm_context)
@@ -168,6 +169,7 @@ void kvm_load_tsc(CPUState *env);
#define kvm_has_sync_mmu() (0)
#define kvm_load_registers(env) do {} while(0)
#define kvm_save_registers(env) do {} while(0)
+#define qemu_kvm_cpu_stop(env) do {} while(0)
static inline void kvm_init_vcpu(CPUState *env) { }
static inline void void kvm_load_tsc(CPUState *env) {}
diff --git a/qemu/vl.c b/qemu/vl.c
index 0d1d236..a0c5472 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -3585,8 +3585,11 @@ void qemu_system_reset_request(void)
} else {
reset_requested = 1;
}
- if (cpu_single_env)
+
+ if (cpu_single_env) {
+ qemu_kvm_cpu_stop(cpu_single_env);
cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT);
+ }
main_loop_break();
}
--
Gleb.
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] Don't return to guest after CPU issued S3 command.
2008-12-30 12:32 ` Gleb Natapov
@ 2008-12-30 13:25 ` Avi Kivity
0 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2008-12-30 13:25 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm
Gleb Natapov wrote:
> On Tue, Dec 30, 2008 at 01:19:22PM +0200, Avi Kivity wrote:
>
>>> +int kvm_shutdown(void *opaque, void *data);
>>>
>> That's a bad API. What's the opaque? what's the data?
>>
>>
> How about this one:
>
> Don't return to guest CPU after qemu_system_reset_request().
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-12-30 13:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-30 10:37 [PATCH 0/3] Remaining S3 bits Gleb Natapov
2008-12-30 10:37 ` [PATCH 1/3] Reset stack pointer to zero on S3 resume Gleb Natapov
2008-12-30 10:37 ` [PATCH 2/3] Don't return to guest after CPU issued S3 command Gleb Natapov
2008-12-30 11:19 ` Avi Kivity
2008-12-30 12:32 ` Gleb Natapov
2008-12-30 13:25 ` Avi Kivity
2008-12-30 10:37 ` [PATCH 3/3] KVM does not support SMM. Disable it Gleb Natapov
2008-12-30 11:25 ` [PATCH 0/3] Remaining S3 bits Avi Kivity
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.