mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Per-vcpu IO evtchn support for VT-i guests (ia64).
Signed-off-by Kevin Tian <kevin.tian@intel.com> Signed-off-by Xin Li <xin.b.li@intel.com>
This commit is contained in:
1 parent
bb86d19e6e
commit
28a8fc92e9
5 files changed
+20
-15
No files matched your search
@@ -154,7 +154,7 @@ static void low_mmio_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
|
||||
|
||||
set_bit(ARCH_VMX_IO_WAIT, &v->arch.arch_vmx.flags);
|
||||
p->state = STATE_IOREQ_READY;
|
||||
evtchn_send(iopacket_port(v->domain));
|
||||
evtchn_send(iopacket_port(v));
|
||||
vmx_wait_io();
|
||||
if(dir==IOREQ_READ){ //read
|
||||
*val=p->u.data;
|
||||
@@ -187,7 +187,7 @@ static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
|
||||
|
||||
set_bit(ARCH_VMX_IO_WAIT, &v->arch.arch_vmx.flags);
|
||||
p->state = STATE_IOREQ_READY;
|
||||
evtchn_send(iopacket_port(v->domain));
|
||||
evtchn_send(iopacket_port(v));
|
||||
|
||||
vmx_wait_io();
|
||||
if(dir==IOREQ_READ){ //read
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <xen/mm.h>
|
||||
#include <public/arch-ia64.h>
|
||||
#include <asm/hvm/vioapic.h>
|
||||
#include <public/event_channel.h>
|
||||
|
||||
/* Global flag to identify whether Intel vmx feature is on */
|
||||
u32 vmx_enabled = 0;
|
||||
@@ -254,9 +255,6 @@ vmx_final_setup_guest(struct vcpu *v)
|
||||
{
|
||||
vpd_t *vpd;
|
||||
|
||||
/* Allocate resources for vcpu 0 */
|
||||
//memset(&v->arch.arch_vmx, 0, sizeof(struct arch_vmx_struct));
|
||||
|
||||
vpd = alloc_vpd();
|
||||
ASSERT(vpd);
|
||||
|
||||
@@ -375,20 +373,15 @@ int vmx_alloc_contig_pages(struct domain *d)
|
||||
|
||||
void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c)
|
||||
{
|
||||
shared_iopage_t *sp;
|
||||
|
||||
ASSERT(d != dom0); /* only for non-privileged vti domain */
|
||||
d->arch.vmx_platform.shared_page_va =
|
||||
__va(__gpa_to_mpa(d, IO_PAGE_START));
|
||||
sp = get_sp(d);
|
||||
//memset((char *)sp,0,PAGE_SIZE);
|
||||
/* TEMP */
|
||||
d->arch.vmx_platform.pib_base = 0xfee00000UL;
|
||||
|
||||
/* Only open one port for I/O and interrupt emulation */
|
||||
memset(&d->shared_info->evtchn_mask[0], 0xff,
|
||||
sizeof(d->shared_info->evtchn_mask));
|
||||
clear_bit(iopacket_port(d), &d->shared_info->evtchn_mask[0]);
|
||||
|
||||
/* Initialize the virtual interrupt lines */
|
||||
vmx_virq_line_init(d);
|
||||
@@ -397,4 +390,16 @@ void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c)
|
||||
hvm_vioapic_init(d);
|
||||
}
|
||||
|
||||
void vmx_do_launch(struct vcpu *v)
|
||||
{
|
||||
if (evtchn_bind_vcpu(iopacket_port(v), v->vcpu_id) < 0) {
|
||||
printk("VMX domain bind port %d to vcpu %d failed!\n",
|
||||
iopacket_port(v), v->vcpu_id);
|
||||
domain_crash_synchronous();
|
||||
}
|
||||
|
||||
clear_bit(iopacket_port(v),
|
||||
&v->domain->shared_info->evtchn_mask[0]);
|
||||
|
||||
vmx_load_all_rr(v);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ void vmx_wait_io(void)
|
||||
{
|
||||
struct vcpu *v = current;
|
||||
struct domain *d = v->domain;
|
||||
int port = iopacket_port(d);
|
||||
int port = iopacket_port(v);
|
||||
|
||||
do {
|
||||
if (!test_bit(port,
|
||||
@@ -129,7 +129,7 @@ void vmx_intr_assist(struct vcpu *v)
|
||||
struct domain *d = v->domain;
|
||||
extern void vmx_vcpu_pend_batch_interrupt(VCPU *vcpu,
|
||||
unsigned long *pend_irr);
|
||||
int port = iopacket_port(d);
|
||||
int port = iopacket_port(v);
|
||||
|
||||
/* I/O emulation is atomic, so it's impossible to see execution flow
|
||||
* out of vmx_wait_io, when guest is still waiting for response.
|
||||
|
||||
@@ -71,7 +71,7 @@ void schedule_tail(struct vcpu *prev)
|
||||
context_saved(prev);
|
||||
|
||||
if (VMX_DOMAIN(current)) {
|
||||
vmx_load_all_rr(current);
|
||||
vmx_do_launch(current);
|
||||
} else {
|
||||
load_region_regs(current);
|
||||
vcpu_load_kernel_regs(current);
|
||||
|
||||
@@ -40,9 +40,9 @@ static inline vcpu_iodata_t *get_vio(struct domain *d, unsigned long cpu)
|
||||
return &((shared_iopage_t *)d->arch.vmx_platform.shared_page_va)->vcpu_iodata[cpu];
|
||||
}
|
||||
|
||||
static inline int iopacket_port(struct domain *d)
|
||||
static inline int iopacket_port(struct vcpu *v)
|
||||
{
|
||||
return ((shared_iopage_t *)d->arch.vmx_platform.shared_page_va)->sp_global.eport;
|
||||
return get_vio(v->domain, v->vcpu_id)->vp_eport;
|
||||
}
|
||||
|
||||
static inline shared_iopage_t *get_sp(struct domain *d)
|
||||
|
||||