From: "Yang, Sheng" <sheng.yang@intel.com>
To: kvm-devel@lists.sourceforge.net
Subject: [PATCH] KVM: Add reset support for in kernel PIT
Date: Thu, 13 Mar 2008 10:24:44 +0800 [thread overview]
Message-ID: <200803131024.44218.sheng.yang@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]
From 2d08f4266a8f47d9c52db9d4f629ab5d2f8fd044 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Thu, 13 Mar 2008 10:22:26 +0800
Subject: [PATCH] KVM: Add reset support for in kernel PIT
Separate the reset part and prepare for reset support.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
arch/x86/kvm/i8254.c | 30 +++++++++++++++++++-----------
arch/x86/kvm/i8254.h | 1 +
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 7776f50..06a241a 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -476,12 +476,28 @@ static int speaker_in_range(struct kvm_io_device *this,
gpa_t addr)
return (addr == KVM_SPEAKER_BASE_ADDRESS);
}
-struct kvm_pit *kvm_create_pit(struct kvm *kvm)
+void kvm_pit_reset(struct kvm_pit *pit)
{
int i;
+ struct kvm_kpit_channel_state *c;
+
+ mutex_lock(&pit->pit_state.lock);
+ for (i = 0; i < 3; i++) {
+ c = &pit->pit_state.channels[i];
+ c->mode = 0xff;
+ c->gate = (i != 2);
+ pit_load_count(pit->kvm, i, 0);
+ }
+ mutex_unlock(&pit->pit_state.lock);
+
+ atomic_set(&pit->pit_state.pit_timer.pending, 0);
+ pit->pit_state.inject_pending = 1;
+}
+
+struct kvm_pit *kvm_create_pit(struct kvm *kvm)
+{
struct kvm_pit *pit;
struct kvm_kpit_state *pit_state;
- struct kvm_kpit_channel_state *c;
pit = kzalloc(sizeof(struct kvm_pit), GFP_KERNEL);
if (!pit)
@@ -510,17 +526,9 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
pit_state->pit = pit;
hrtimer_init(&pit_state->pit_timer.timer,
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
- atomic_set(&pit_state->pit_timer.pending, 0);
- for (i = 0; i < 3; i++) {
- c = &pit_state->channels[i];
- c->mode = 0xff;
- c->gate = (i != 2);
- pit_load_count(kvm, i, 0);
- }
-
mutex_unlock(&pit->pit_state.lock);
- pit->pit_state.inject_pending = 1;
+ kvm_pit_reset(pit);
return pit;
}
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
index 586bbf0..e63ef38 100644
--- a/arch/x86/kvm/i8254.h
+++ b/arch/x86/kvm/i8254.h
@@ -57,5 +57,6 @@ void kvm_pit_timer_intr_post(struct kvm_vcpu *vcpu, int
vec);
void kvm_pit_load_count(struct kvm *kvm, int channel, u32 val);
struct kvm_pit *kvm_create_pit(struct kvm *kvm);
void kvm_free_pit(struct kvm *kvm);
+void kvm_pit_reset(struct kvm_pit *pit);
#endif
--
debian.1.5.3.7.1-dirty
[-- Attachment #2: 0001-KVM-Add-reset-support-for-in-kernel-PIT.patch --]
[-- Type: text/x-diff, Size: 2430 bytes --]
From 2d08f4266a8f47d9c52db9d4f629ab5d2f8fd044 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Thu, 13 Mar 2008 10:22:26 +0800
Subject: [PATCH] KVM: Add reset support for in kernel PIT
Separate the reset part and prepare for reset support.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
arch/x86/kvm/i8254.c | 30 +++++++++++++++++++-----------
arch/x86/kvm/i8254.h | 1 +
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 7776f50..06a241a 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -476,12 +476,28 @@ static int speaker_in_range(struct kvm_io_device *this, gpa_t addr)
return (addr == KVM_SPEAKER_BASE_ADDRESS);
}
-struct kvm_pit *kvm_create_pit(struct kvm *kvm)
+void kvm_pit_reset(struct kvm_pit *pit)
{
int i;
+ struct kvm_kpit_channel_state *c;
+
+ mutex_lock(&pit->pit_state.lock);
+ for (i = 0; i < 3; i++) {
+ c = &pit->pit_state.channels[i];
+ c->mode = 0xff;
+ c->gate = (i != 2);
+ pit_load_count(pit->kvm, i, 0);
+ }
+ mutex_unlock(&pit->pit_state.lock);
+
+ atomic_set(&pit->pit_state.pit_timer.pending, 0);
+ pit->pit_state.inject_pending = 1;
+}
+
+struct kvm_pit *kvm_create_pit(struct kvm *kvm)
+{
struct kvm_pit *pit;
struct kvm_kpit_state *pit_state;
- struct kvm_kpit_channel_state *c;
pit = kzalloc(sizeof(struct kvm_pit), GFP_KERNEL);
if (!pit)
@@ -510,17 +526,9 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
pit_state->pit = pit;
hrtimer_init(&pit_state->pit_timer.timer,
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
- atomic_set(&pit_state->pit_timer.pending, 0);
- for (i = 0; i < 3; i++) {
- c = &pit_state->channels[i];
- c->mode = 0xff;
- c->gate = (i != 2);
- pit_load_count(kvm, i, 0);
- }
-
mutex_unlock(&pit->pit_state.lock);
- pit->pit_state.inject_pending = 1;
+ kvm_pit_reset(pit);
return pit;
}
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
index 586bbf0..e63ef38 100644
--- a/arch/x86/kvm/i8254.h
+++ b/arch/x86/kvm/i8254.h
@@ -57,5 +57,6 @@ void kvm_pit_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
void kvm_pit_load_count(struct kvm *kvm, int channel, u32 val);
struct kvm_pit *kvm_create_pit(struct kvm *kvm);
void kvm_free_pit(struct kvm *kvm);
+void kvm_pit_reset(struct kvm_pit *pit);
#endif
--
debian.1.5.3.7.1-dirty
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
next reply other threads:[~2008-03-13 2:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 2:24 Yang, Sheng [this message]
2008-03-16 14:36 ` [PATCH] KVM: Add reset support for in kernel PIT Avi Kivity
2008-03-16 15:01 ` Yang, Sheng
2008-03-16 15:15 ` Avi Kivity
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=200803131024.44218.sheng.yang@intel.com \
--to=sheng.yang@intel.com \
--cc=kvm-devel@lists.sourceforge.net \
/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 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.