Ajust for Xen 3.1.0 public headers. From Christoph Egger in private mail.

This commit is contained in:
bouyer 2007-09-23 16:54:07 +00:00
parent de1e0997f1
commit 5f0855fadb
8 changed files with 54 additions and 58 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.12 2007/05/17 14:51:35 yamt Exp $
# $NetBSD: genassym.cf,v 1.13 2007/09/23 16:54:07 bouyer Exp $
# NetBSD: genassym.cf,v 1.40 2004/02/20 17:35:01 yamt Exp
#
@ -345,11 +345,11 @@ endif
define SIF_INITDOMAIN SIF_INITDOMAIN
ifdef XEN3
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info, vcpu_data[0].evtchn_upcall_pending)
define EVTCHN_UPCALL_MASK offsetof(struct shared_info, vcpu_data[0].evtchn_upcall_mask)
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info, vcpu_info[0].evtchn_upcall_pending)
define EVTCHN_UPCALL_MASK offsetof(struct shared_info, vcpu_info[0].evtchn_upcall_mask)
else
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info_st, vcpu_data[0].evtchn_upcall_pending)
define EVTCHN_UPCALL_MASK offsetof(struct shared_info_st, vcpu_data[0].evtchn_upcall_mask)
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info_st, vcpu_info[0].evtchn_upcall_pending)
define EVTCHN_UPCALL_MASK offsetof(struct shared_info_st, vcpu_info[0].evtchn_upcall_mask)
endif
define HYPERVISOR_sched_op __HYPERVISOR_sched_op

View File

@ -1,4 +1,4 @@
/* $NetBSD: hypervisor_machdep.c,v 1.17 2007/01/29 01:52:46 hubertf Exp $ */
/* $NetBSD: hypervisor_machdep.c,v 1.18 2007/09/23 16:54:07 bouyer Exp $ */
/*
*
@ -59,7 +59,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.17 2007/01/29 01:52:46 hubertf Exp $");
__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.18 2007/09/23 16:54:07 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -111,12 +111,16 @@ stipending()
* we're only called after STIC, so we know that we'll have to
* STI at the end
*/
while (s->vcpu_data[0].evtchn_upcall_pending) {
while (s->vcpu_info[0].evtchn_upcall_pending) {
cli();
s->vcpu_data[0].evtchn_upcall_pending = 0;
s->vcpu_info[0].evtchn_upcall_pending = 0;
/* NB. No need for a barrier here -- XCHG is a barrier
* on x86. */
#ifdef XEN3
l1 = xen_atomic_xchg(&s->vcpu_info[0].evtchn_pending_sel, 0);
#else
l1 = xen_atomic_xchg(&s->evtchn_pending_sel, 0);
#endif
while ((l1i = ffs(l1)) != 0) {
l1i--;
l1 &= ~(1 << l1i);
@ -184,11 +188,15 @@ do_hypervisor_callback(struct intrframe *regs)
}
#endif
while (s->vcpu_data[0].evtchn_upcall_pending) {
s->vcpu_data[0].evtchn_upcall_pending = 0;
while (s->vcpu_info[0].evtchn_upcall_pending) {
s->vcpu_info[0].evtchn_upcall_pending = 0;
/* NB. No need for a barrier here -- XCHG is a barrier
* on x86. */
#ifdef XEN3
l1 = xen_atomic_xchg(&s->vcpu_info[0].evtchn_pending_sel, 0);
#else
l1 = xen_atomic_xchg(&s->evtchn_pending_sel, 0);
#endif
while ((l1i = ffs(l1)) != 0) {
l1i--;
l1 &= ~(1 << l1i);
@ -226,8 +234,12 @@ do_hypervisor_callback(struct intrframe *regs)
#ifdef DIAGNOSTIC
if (level != ci->ci_ilevel)
printf("hypervisor done %08x level %d/%d ipending %08x\n",
(uint)HYPERVISOR_shared_info->evtchn_pending_sel, level,
ci->ci_ilevel, ci->ci_ipending);
#ifdef XEN3
(uint)HYPERVISOR_shared_info->vcpu_info[0].evtchn_pending_sel,
#else
(uint)HYPERVISOR_shared_info->evtchn_pending_sel,
#endif
level, ci->ci_ilevel, ci->ci_ipending);
#endif
}
@ -247,9 +259,13 @@ hypervisor_unmask_event(unsigned int ev)
* interrupt edge' if the channel is masked.
*/
if (xen_atomic_test_bit(&s->evtchn_pending[0], ev) &&
#ifdef XEN3
!xen_atomic_test_and_set_bit(&s->vcpu_info[0].evtchn_pending_sel, ev>>5)) {
#else
!xen_atomic_test_and_set_bit(&s->evtchn_pending_sel, ev>>5)) {
xen_atomic_set_bit(&s->vcpu_data[0].evtchn_upcall_pending, 0);
if (!s->vcpu_data[0].evtchn_upcall_mask)
#endif
xen_atomic_set_bit(&s->vcpu_info[0].evtchn_upcall_pending, 0);
if (!s->vcpu_info[0].evtchn_upcall_mask)
hypervisor_force_callback();
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpufunc.h,v 1.15 2007/03/04 06:01:10 christos Exp $ */
/* $NetBSD: cpufunc.h,v 1.16 2007/09/23 16:54:07 bouyer Exp $ */
/* NetBSD: cpufunc.h,v 1.28 2004/01/14 11:31:55 yamt Exp */
/*-
@ -313,12 +313,12 @@ breakpoint(void)
__asm volatile("int $3");
}
#define read_psl() (HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask)
#define read_psl() (HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_mask)
#define write_psl(x) do { \
__insn_barrier(); \
HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask = (x) ; \
HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_mask = (x) ; \
x86_lfence(); \
if ((x) == 0 && HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_pending) \
if ((x) == 0 && HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_pending) \
hypervisor_force_callback(); \
} while (0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: xen.h,v 1.4 2006/01/15 22:09:52 bouyer Exp $ */
/* $NetBSD: xen.h,v 1.5 2007/09/23 16:54:08 bouyer Exp $ */
/*
* Copyright (c) 2004, K A Fraser
@ -315,7 +315,7 @@ typedef struct shared_info_st
u8 evtchn_upcall_pending;
u8 evtchn_upcall_mask;
u8 pad0, pad1;
} PACKED vcpu_data[MAX_VIRT_CPUS]; /* 0 */
} PACKED vcpu_info[MAX_VIRT_CPUS]; /* 0 */
/*
* A domain can have up to 1024 "event channels" on which it can send

View File

@ -1,4 +1,4 @@
/* $NetBSD: xen.h,v 1.21 2006/03/06 19:55:47 bouyer Exp $ */
/* $NetBSD: xen.h,v 1.22 2007/09/23 16:54:08 bouyer Exp $ */
/*
*
@ -136,23 +136,23 @@ void xpq_flush_cache(void);
#define __save_flags(x) \
do { \
(x) = HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask; \
(x) = HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_mask; \
} while (0)
#define __restore_flags(x) \
do { \
volatile shared_info_t *_shared = HYPERVISOR_shared_info; \
__insn_barrier(); \
if ((_shared->vcpu_data[0].evtchn_upcall_mask = (x)) == 0) { \
if ((_shared->vcpu_info[0].evtchn_upcall_mask = (x)) == 0) { \
x86_lfence(); \
if (__predict_false(_shared->vcpu_data[0].evtchn_upcall_pending)) \
if (__predict_false(_shared->vcpu_info[0].evtchn_upcall_pending)) \
hypervisor_force_callback(); \
} \
} while (0)
#define __cli() \
do { \
HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask = 1; \
HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_mask = 1; \
x86_lfence(); \
} while (0)
@ -160,9 +160,9 @@ do { \
do { \
volatile shared_info_t *_shared = HYPERVISOR_shared_info; \
__insn_barrier(); \
_shared->vcpu_data[0].evtchn_upcall_mask = 0; \
_shared->vcpu_info[0].evtchn_upcall_mask = 0; \
x86_lfence(); /* unmask then check (avoid races) */ \
if (__predict_false(_shared->vcpu_data[0].evtchn_upcall_pending)) \
if (__predict_false(_shared->vcpu_info[0].evtchn_upcall_pending)) \
hypervisor_force_callback(); \
} while (0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: grant_table.h,v 1.5 2007/09/23 16:19:37 bouyer Exp $ */
/* $NetBSD: grant_table.h,v 1.6 2007/09/23 16:54:08 bouyer Exp $ */
/******************************************************************************
* grant_table.h
*
@ -330,26 +330,6 @@ typedef struct gnttab_query_size gnttab_query_size_t;
DEFINE_XEN_GUEST_HANDLE(gnttab_query_size_t);
/*
* GNTTABOP_query_size: Query the current and maximum sizes of the shared
* grant table.
* NOTES:
* 1. <dom> may be specified as DOMID_SELF.
* 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
*/
#define GNTTABOP_query_size 6
typedef struct gnttab_query_size {
/* IN parameters. */
domid_t dom;
/* OUT parameters. */
uint32_t nr_frames;
uint32_t max_nr_frames;
int16_t status; /* GNTST_* */
} gnttab_query_size_t;
DEFINE_GUEST_HANDLE(gnttab_query_size_t);
/*
* Bitfield values for update_pin_status.flags.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: xen.h,v 1.5 2007/09/23 16:19:38 bouyer Exp $ */
/* $NetBSD: xen.h,v 1.6 2007/09/23 16:54:08 bouyer Exp $ */
/******************************************************************************
* xen.h
*
@ -414,10 +414,6 @@ struct vcpu_info {
typedef struct vcpu_info vcpu_info_t;
#endif
/* Xen2 compat */
#define vcpu_data vcpu_info
#define evtchn_pending_sel vcpu_info[0].evtchn_pending_sel /* XXX smp */
/*
* Xen/kernel shared data -- pointer provided in start_info.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: evtchn.c,v 1.20 2006/12/08 15:05:18 yamt Exp $ */
/* $NetBSD: evtchn.c,v 1.21 2007/09/23 16:54:09 bouyer Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@ -64,7 +64,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.20 2006/12/08 15:05:18 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.21 2007/09/23 16:54:09 bouyer Exp $");
#include "opt_xen.h"
#include "isa.h"
@ -609,10 +609,14 @@ xen_debug_handler(void *arg)
int ci_ipending = ci->ci_ipending;
int ci_idepth = ci->ci_idepth;
u_long upcall_pending =
HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_pending;
HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_pending;
u_long upcall_mask =
HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_mask;
HYPERVISOR_shared_info->vcpu_info[0].evtchn_upcall_mask;
#ifdef XEN3
u_long pending_sel = HYPERVISOR_shared_info->vcpu_info[0].evtchn_pending_sel;
#else
u_long pending_sel = HYPERVISOR_shared_info->evtchn_pending_sel;
#endif
unsigned long evtchn_mask[sizeof(unsigned long) * 8];
unsigned long evtchn_pending[sizeof(unsigned long) * 8];