From: Arun Sharma <arun.sharma@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] vmx-pit-reset-vector.patch
Date: Mon, 6 Jun 2005 15:42:31 -0700 [thread overview]
Message-ID: <20050606224231.GA31342@intel.com> (raw)
If the guest resets irq_base in the PIC, we should reset the vector
in the hypervisor as well.
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Index: trunk/tools/ioemu/hw/i8254.c
===================================================================
--- trunk/tools/ioemu/hw/i8254.c (revision 1220)
+++ trunk/tools/ioemu/hw/i8254.c (working copy)
@@ -50,6 +50,7 @@
int64_t next_transition_time;
QEMUTimer *irq_timer;
int irq;
+ int vmx_channel; /* Is this accelerated by VMX ? */
} PITChannelState;
struct PITState {
@@ -214,12 +215,47 @@
return s->gate;
}
-static inline void pit_load_count(PITChannelState *s, int val)
+void pit_reset_vmx_vectors()
{
extern void *shared_page;
ioreq_t *req;
- int irq;
+ int irq, i;
+ PITChannelState *s;
+ /* Assumes PIT is wired to IRQ0 and -1 is uninitialized irq base */
+ if ((irq = pic_irq2vec(0)) == -1)
+ return;
+
+ for(i = 0; i < 3; i++) {
+ if (pit_state.channels[i].vmx_channel)
+ break;
+ }
+
+ if (i == 3)
+ return;
+
+ /* Assumes just one VMX accelerated channel */
+ vmx_channel = i;
+ s = &pit_state.channels[vmx_channel];
+ fprintf(logfile,
+ "VMX_PIT:guest init pit channel %d!\n", vmx_channel);
+ req = &((vcpu_iodata_t *) shared_page)->vp_ioreq;
+
+ req->state = STATE_IORESP_HOOK;
+ /*
+ * info passed to HV as following
+ * -- init count:16 bit, timer vec:8 bit,
+ * PIT channel(0~2):2 bit, rw mode:2 bit
+ */
+ req->u.data = s->count;
+ req->u.data |= (irq << 16);
+ req->u.data |= (vmx_channel << 24);
+ req->u.data |= ((s->rw_mode) << 26);
+ fprintf(logfile, "VMX_PIT:pass info 0x%llx to HV!\n", req->u.data);
+}
+
+static inline void pit_load_count(PITChannelState *s, int val)
+{
if (val == 0)
val = 0x10000;
s->count_load_time = qemu_get_clock(vm_clock);
@@ -228,25 +264,8 @@
/* guest init this pit channel for periodic mode. we do not update related
* timer so the channel never send intr from device model*/
if (vmx_channel != -1 && s->mode == 2) {
- /* get the pit irq(0)'s vector from pic DM */
- if ((irq = pic_irq2vec(0)) >= 0) {
- fprintf(logfile,
- "VMX_PIT:guest init pit channel %d!\n", vmx_channel);
- req = &((vcpu_iodata_t *) shared_page)->vp_ioreq;
-
- req->state = STATE_IORESP_HOOK;
- /*
- * info passed to HV as following
- * -- init count:16 bit, timer vec:8 bit,
- * PIT channel(0~2):2 bit, rw mode:2 bit
- */
- req->u.data = s->count;
- req->u.data |= (irq << 16);
- req->u.data |= (vmx_channel << 24);
- req->u.data |= ((s->rw_mode) << 26);
- fprintf(logfile, "VMX_PIT:pass info 0x%llx to HV!\n", req->u.data);
- vmx_channel = -1;
- }
+ pit_reset_vmx_vectors();
+ vmx_channel = -1;
}
/* pit_irq_timer_update(s, s->count_load_time);*/
@@ -306,6 +325,7 @@
}
} else {
s = &pit->channels[addr];
+ s->vmx_channel = 1;
vmx_channel = addr;
switch(s->write_state) {
default:
Index: trunk/tools/ioemu/hw/i8259.c
===================================================================
--- trunk/tools/ioemu/hw/i8259.c (revision 1220)
+++ trunk/tools/ioemu/hw/i8259.c (working copy)
@@ -334,6 +334,7 @@
case 1:
s->irq_base = val & 0xf8;
s->init_state = 2;
+ pit_reset_vmx_vectors();
break;
case 2:
if (s->init4) {
reply other threads:[~2005-06-06 22:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050606224231.GA31342@intel.com \
--to=arun.sharma@intel.com \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.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 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.