[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [linux-ppc-2.6] [LINUX][POWERPC] update xen/interface/*.h for dom0_ops split
# HG changeset patch # User Hollis Blanchard <hollisb@xxxxxxxxxx> # Node ID e5b6c025d4d20a24555275fb3c1da40edeac72d5 # Parent 199b457c43256143561ea7943d40ce72713c73b0 [LINUX][POWERPC] update xen/interface/*.h for dom0_ops split - update PPC hcall-munging code for dom0_ops split - also required backporting other interface changes Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx> --- arch/powerpc/platforms/xen/hcall.c | 271 ++++++++----- arch/powerpc/platforms/xen/setup.c | 4 arch/powerpc/platforms/xen/udbg_xen.c | 9 drivers/xen/console/xencons_ring.c | 8 drivers/xen/core/reboot.c | 1 drivers/xen/privcmd/privcmd.c | 23 - include/asm-powerpc/xen/asm/hypervisor.h | 1 include/xen/interface/acm.h | 1 include/xen/interface/acm_ops.h | 1 include/xen/interface/arch-ia64.h | 135 ++++-- include/xen/interface/arch-x86_32.h | 45 ++ include/xen/interface/arch-x86_64.h | 34 + include/xen/interface/dom0_ops.h | 574 ++--------------------------- include/xen/interface/grant_table.h | 51 ++ include/xen/interface/hvm/hvm_info_table.h | 2 include/xen/interface/hvm/ioreq.h | 15 include/xen/interface/io/netif.h | 82 +++- include/xen/interface/memory.h | 12 include/xen/interface/trace.h | 1 include/xen/interface/version.h | 5 include/xen/interface/xen-compat.h | 23 - include/xen/interface/xen.h | 102 ++++- include/xen/interface/xencomm.h | 6 include/xen/interface/xenoprof.h | 9 24 files changed, 622 insertions(+), 793 deletions(-) diff -r 199b457c4325 -r e5b6c025d4d2 arch/powerpc/platforms/xen/hcall.c --- a/arch/powerpc/platforms/xen/hcall.c Mon Aug 28 18:43:52 2006 -0500 +++ b/arch/powerpc/platforms/xen/hcall.c Tue Sep 05 17:55:43 2006 -0500 @@ -4,7 +4,9 @@ #include <linux/gfp.h> #include <linux/module.h> #include <xen/interface/xen.h> -#include <xen/interface/dom0_ops.h> +#include <xen/interface/domctl.h> +#include <xen/interface/sysctl.h> +#include <xen/interface/platform.h> #include <xen/interface/memory.h> #include <xen/interface/xencomm.h> #include <xen/interface/version.h> @@ -27,7 +29,7 @@ * to hold the xencomm descriptor. * * In general, we need a xencomm descriptor to cover the top-level data - * structure (e.g. the dom0 op), plus another for every embedded pointer to + * structure (e.g. the domctl op), plus another for every embedded pointer to * another data structure (i.e. for every GUEST_HANDLE). */ @@ -245,26 +247,32 @@ int HYPERVISOR_multicall(void *call_list } EXPORT_SYMBOL(HYPERVISOR_multicall); -static int xenppc_privcmd_dom0_op(privcmd_hypercall_t *hypercall) -{ - dom0_op_t kern_op; - dom0_op_t __user *user_op = (dom0_op_t __user *)hypercall->arg[0]; +static int xenppc_privcmd_domctl(privcmd_hypercall_t *hypercall) +{ + xen_domctl_t kern_op; + xen_domctl_t __user *user_op = (xen_domctl_t __user *)hypercall->arg[0]; struct xencomm_desc *op_desc; struct xencomm_desc *desc = NULL; int ret = 0; - if (copy_from_user(&kern_op, user_op, sizeof(dom0_op_t))) + if (copy_from_user(&kern_op, user_op, sizeof(xen_domctl_t))) return -EFAULT; - if (kern_op.interface_version != DOM0_INTERFACE_VERSION) + if (kern_op.interface_version != XEN_DOMCTL_INTERFACE_VERSION) return -EACCES; - ret = xencomm_create(&kern_op, sizeof(dom0_op_t), &op_desc, GFP_KERNEL); + ret = xencomm_create(&kern_op, sizeof(xen_domctl_t), &op_desc, GFP_KERNEL); if (ret) return ret; switch (kern_op.cmd) { - case DOM0_GETMEMLIST: + case XEN_DOMCTL_createdomain: + case XEN_DOMCTL_destroydomain: + case XEN_DOMCTL_pausedomain: + case XEN_DOMCTL_unpausedomain: + case XEN_DOMCTL_getdomaininfo: + break; + case XEN_DOMCTL_getmemlist: ret = xencomm_create( xen_guest_handle(kern_op.u.getmemlist.buffer), kern_op.u.getmemlist.max_pfns * sizeof(unsigned long), @@ -272,15 +280,97 @@ static int xenppc_privcmd_dom0_op(privcm set_xen_guest_handle(kern_op.u.getmemlist.buffer, (void *)__pa(desc)); break; - case DOM0_SETVCPUCONTEXT: - ret = xencomm_create( - xen_guest_handle(kern_op.u.setvcpucontext.ctxt), + case XEN_DOMCTL_getpageframeinfo: + break; + case XEN_DOMCTL_getpageframeinfo2: + ret = xencomm_create( + xen_guest_handle(kern_op.u.getpageframeinfo2.array), + kern_op.u.getpageframeinfo2.num, + &desc, GFP_KERNEL); + set_xen_guest_handle(kern_op.u.getpageframeinfo2.array, + (void *)__pa(desc)); + break; + case XEN_DOMCTL_shadow_op: + ret = xencomm_create( + xen_guest_handle(kern_op.u.shadow_op.dirty_bitmap), + kern_op.u.shadow_op.pages * sizeof(unsigned long), + &desc, GFP_KERNEL); + set_xen_guest_handle(kern_op.u.shadow_op.dirty_bitmap, + (void *)__pa(desc)); + break; + case XEN_DOMCTL_max_mem: + break; + case XEN_DOMCTL_setvcpucontext: + ret = xencomm_create( + xen_guest_handle(kern_op.u.vcpucontext.ctxt), sizeof(vcpu_guest_context_t), &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.setvcpucontext.ctxt, - (void *)__pa(desc)); - break; - case DOM0_READCONSOLE: + set_xen_guest_handle(kern_op.u.vcpucontext.ctxt, + (void *)__pa(desc)); + break; + case XEN_DOMCTL_getvcpucontext: + ret = xencomm_create( + xen_guest_handle(kern_op.u.vcpucontext.ctxt), + sizeof(vcpu_guest_context_t), + &desc, GFP_KERNEL); + set_xen_guest_handle(kern_op.u.vcpucontext.ctxt, + (void *)__pa(desc)); + break; + case XEN_DOMCTL_getvcpuinfo: + case XEN_DOMCTL_setvcpuaffinity: + case XEN_DOMCTL_getvcpuaffinity: + case XEN_DOMCTL_max_vcpus: + case XEN_DOMCTL_scheduler_op: + case XEN_DOMCTL_setdomainhandle: + case XEN_DOMCTL_setdebugging: + case XEN_DOMCTL_irq_permission: + case XEN_DOMCTL_iomem_permission: + case XEN_DOMCTL_ioport_permission: + case XEN_DOMCTL_hypercall_init: + case XEN_DOMCTL_arch_setup: + case XEN_DOMCTL_settimeoffset: + case XEN_DOMCTL_real_mode_area: + break; + default: + printk(KERN_ERR "%s: unknown domctl cmd %d\n", __func__, kern_op.cmd); + return -ENOSYS; + } + + if (ret) + goto out; /* error mapping the nested pointer */ + + ret = plpar_hcall_norets(XEN_MARK(hypercall->op), __pa(op_desc)); + + if (copy_to_user(user_op, &kern_op, sizeof(xen_domctl_t))) + ret = -EFAULT; + + if (desc) + xencomm_free(desc); +out: + xencomm_free(op_desc); + return ret; +} + +static int xenppc_privcmd_sysctl(privcmd_hypercall_t *hypercall) +{ + xen_sysctl_t kern_op; + xen_sysctl_t __user *user_op = (xen_sysctl_t __user *)hypercall->arg[0]; + struct xencomm_desc *op_desc; + struct xencomm_desc *desc = NULL; + int ret = 0; + + if (copy_from_user(&kern_op, user_op, sizeof(xen_sysctl_t))) + return -EFAULT; + + if (kern_op.interface_version != XEN_SYSCTL_INTERFACE_VERSION) + return -EACCES; + + ret = xencomm_create(&kern_op, sizeof(xen_sysctl_t), &op_desc, GFP_KERNEL); + if (ret) + return ret; + + switch (kern_op.cmd) { + case XEN_SYSCTL_readconsole: ret = xencomm_create( xen_guest_handle(kern_op.u.readconsole.buffer), kern_op.u.readconsole.count, @@ -288,88 +378,26 @@ static int xenppc_privcmd_dom0_op(privcm set_xen_guest_handle(kern_op.u.readconsole.buffer, (void *)__pa(desc)); break; - case DOM0_SHADOW_CONTROL: - ret = xencomm_create( - xen_guest_handle(kern_op.u.shadow_control.dirty_bitmap), - kern_op.u.shadow_control.pages * sizeof(unsigned long), - &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.shadow_control.dirty_bitmap, - (void *)__pa(desc)); - break; - case DOM0_GETPAGEFRAMEINFO2: - ret = xencomm_create( - xen_guest_handle(kern_op.u.getpageframeinfo2.array), - kern_op.u.getpageframeinfo2.num, - &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.getpageframeinfo2.array, - (void *)__pa(desc)); - break; - case DOM0_PERFCCONTROL: - ret = xencomm_create( - xen_guest_handle(kern_op.u.perfccontrol.desc), - kern_op.u.perfccontrol.nr_counters * - sizeof(dom0_perfc_desc_t), - &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.perfccontrol.desc, - (void *)__pa(desc)); - break; - case DOM0_GETVCPUCONTEXT: - ret = xencomm_create( - xen_guest_handle(kern_op.u.getvcpucontext.ctxt), - sizeof(vcpu_guest_context_t), - &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.getvcpucontext.ctxt, - (void *)__pa(desc)); - break; - case DOM0_GETDOMAININFOLIST: + case XEN_SYSCTL_tbuf_op: + case XEN_SYSCTL_physinfo: + case XEN_SYSCTL_sched_id: + break; + case XEN_SYSCTL_perfc_op: + /* XXX this requires *two* embedded xencomm mappings (desc and val), + * and I don't feel like it right now. */ + printk(KERN_ERR "%s: unknown sysctl cmd %d\n", __func__, kern_op.cmd); + return -ENOSYS; + case XEN_SYSCTL_getdomaininfolist: ret = xencomm_create( xen_guest_handle(kern_op.u.getdomaininfolist.buffer), kern_op.u.getdomaininfolist.num_domains * - sizeof(dom0_getdomaininfo_t), + sizeof(xen_domctl_getdomaininfo_t), &desc, GFP_KERNEL); set_xen_guest_handle(kern_op.u.getdomaininfolist.buffer, (void *)__pa(desc)); break; - case DOM0_PHYSICAL_MEMORY_MAP: - ret = xencomm_create( - xen_guest_handle(kern_op.u.physical_memory_map.memory_map), - kern_op.u.physical_memory_map.nr_map_entries * - sizeof(struct dom0_memory_map_entry), - &desc, GFP_KERNEL); - set_xen_guest_handle(kern_op.u.physical_memory_map.memory_map, - (void *)__pa(desc)); - break; - - case DOM0_SCHEDCTL: - case DOM0_ADJUSTDOM: - case DOM0_CREATEDOMAIN: - case DOM0_DESTROYDOMAIN: - case DOM0_PAUSEDOMAIN: - case DOM0_UNPAUSEDOMAIN: - case DOM0_GETDOMAININFO: - case DOM0_MSR: - case DOM0_SETTIME: - case DOM0_GETPAGEFRAMEINFO: - case DOM0_SETVCPUAFFINITY: - case DOM0_TBUFCONTROL: - case DOM0_PHYSINFO: - case DOM0_SCHED_ID: - case DOM0_SETDOMAINMAXMEM: - case DOM0_ADD_MEMTYPE: - case DOM0_DEL_MEMTYPE: - case DOM0_READ_MEMTYPE: - case DOM0_IOPORT_PERMISSION: - case DOM0_GETVCPUINFO: - case DOM0_PLATFORM_QUIRK: - case DOM0_MAX_VCPUS: - case DOM0_SETDOMAINHANDLE: - case DOM0_SETDEBUGGING: - case DOM0_ALLOC_REAL_MODE_AREA: - /* no munging needed */ - break; - - default: - printk(KERN_ERR "%s: unknown dom0 cmd %d\n", __func__, kern_op.cmd); + default: + printk(KERN_ERR "%s: unknown sysctl cmd %d\n", __func__, kern_op.cmd); return -ENOSYS; } @@ -378,7 +406,56 @@ static int xenppc_privcmd_dom0_op(privcm ret = plpar_hcall_norets(XEN_MARK(hypercall->op), __pa(op_desc)); - if (copy_to_user(user_op, &kern_op, sizeof(dom0_op_t))) + if (copy_to_user(user_op, &kern_op, sizeof(xen_sysctl_t))) + ret = -EFAULT; + + if (desc) + xencomm_free(desc); +out: + xencomm_free(op_desc); + return ret; +} + +static int xenppc_privcmd_platform_op(privcmd_hypercall_t *hypercall) +{ + xen_platform_op_t kern_op; + xen_platform_op_t __user *user_op = + (xen_platform_op_t __user *)hypercall->arg[0]; + struct xencomm_desc *op_desc; + struct xencomm_desc *desc = NULL; + int ret = 0; + + if (copy_from_user(&kern_op, user_op, sizeof(xen_platform_op_t))) + return -EFAULT; + + if (kern_op.interface_version != XENPF_INTERFACE_VERSION) + return -EACCES; + + ret = xencomm_create(&kern_op, sizeof(xen_platform_op_t), &op_desc, + GFP_KERNEL); + if (ret) + return ret; + + switch (kern_op.cmd) { + case XENPF_settime: + case XENPF_add_memtype: + case XENPF_del_memtype: + case XENPF_read_memtype: + case XENPF_microcode_update: + case XENPF_platform_quirk: + break; + default: + printk(KERN_ERR "%s: unknown platform_op cmd %d\n", __func__, + kern_op.cmd); + return -ENOSYS; + } + + if (ret) + goto out; /* error mapping the nested pointer */ + + ret = plpar_hcall_norets(XEN_MARK(hypercall->op), __pa(op_desc)); + + if (copy_to_user(user_op, &kern_op, sizeof(xen_platform_op_t))) ret = -EFAULT; if (desc) @@ -506,8 +583,12 @@ int arch_privcmd_hypercall(privcmd_hyper int arch_privcmd_hypercall(privcmd_hypercall_t *hypercall) { switch (hypercall->op) { - case __HYPERVISOR_dom0_op: - return xenppc_privcmd_dom0_op(hypercall); + case __HYPERVISOR_domctl: + return xenppc_privcmd_domctl(hypercall); + case __HYPERVISOR_sysctl: + return xenppc_privcmd_sysctl(hypercall); + case __HYPERVISOR_platform_op: + return xenppc_privcmd_platform_op(hypercall); case __HYPERVISOR_memory_op: return xenppc_privcmd_memory_op(hypercall); case __HYPERVISOR_xen_version: diff -r 199b457c4325 -r e5b6c025d4d2 arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.c Mon Aug 28 18:43:52 2006 -0500 +++ b/arch/powerpc/platforms/xen/setup.c Tue Sep 05 17:55:43 2006 -0500 @@ -107,8 +107,8 @@ static void __init xen_init_early(void) xen_start_info->shared_info, HYPERVISOR_shared_info); DBG(" store_mfn %llx\n", xen_start_info->store_mfn); DBG(" store_evtchn %x\n", xen_start_info->store_evtchn); - DBG(" console_mfn %llx\n", xen_start_info->console_mfn); - DBG(" console_evtchn %x\n", xen_start_info->console_evtchn); + DBG(" console_mfn %llx\n", xen_start_info->console.domU.mfn); + DBG(" console_evtchn %x\n", xen_start_info->console.domU.evtchn); is_dom0 = !!(xen_start_info->flags & SIF_INITDOMAIN); diff -r 199b457c4325 -r e5b6c025d4d2 arch/powerpc/platforms/xen/udbg_xen.c --- a/arch/powerpc/platforms/xen/udbg_xen.c Mon Aug 28 18:43:52 2006 -0500 +++ b/arch/powerpc/platforms/xen/udbg_xen.c Tue Sep 05 17:55:43 2006 -0500 @@ -85,7 +85,7 @@ static void udbg_putc_domu_xen(char c) intf->out_prod = prod; if (xen_start_info) - notify_remote_via_evtchn(xen_start_info->console_evtchn); + notify_remote_via_evtchn(xen_start_info->console.domU.evtchn); } static int udbg_getc_poll_domu_xen(void) @@ -106,7 +106,7 @@ static int udbg_getc_poll_domu_xen(void) intf->in_cons = cons; if (xen_start_info) - notify_remote_via_evtchn(xen_start_info->console_evtchn); + notify_remote_via_evtchn(xen_start_info->console.domU.evtchn); return c; } @@ -134,7 +134,7 @@ void udbg_init_xen(void) if (xen_start_info) { /* we can find out where everything is */ if (!(xen_start_info->flags & SIF_INITDOMAIN)) - console_mfn = xen_start_info->console_mfn; + console_mfn = xen_start_info->console.domU.mfn; } else { /* VERY early printf */ #ifdef CONFIG_PPC_EARLY_DEBUG_XEN_DOMU @@ -150,7 +150,6 @@ void udbg_init_xen(void) udbg_putc = udbg_putc_domu_xen; udbg_getc = udbg_getc_domu_xen; udbg_getc_poll = udbg_getc_poll_domu_xen; - intf = (struct xencons_interface *) - mfn_to_virt(console_mfn); + intf = (struct xencons_interface *)mfn_to_virt(console_mfn); } } diff -r 199b457c4325 -r e5b6c025d4d2 drivers/xen/console/xencons_ring.c --- a/drivers/xen/console/xencons_ring.c Mon Aug 28 18:43:52 2006 -0500 +++ b/drivers/xen/console/xencons_ring.c Tue Sep 05 17:55:43 2006 -0500 @@ -52,13 +52,13 @@ static int xencons_irq; static inline struct xencons_interface *xencons_interface(void) { - return mfn_to_virt(xen_start_info->console_mfn); + return mfn_to_virt(xen_start_info->console.domU.mfn); } static inline void notify_daemon(void) { /* Use evtchn: this is called early, before irq is set up. */ - notify_remote_via_evtchn(xen_start_info->console_evtchn); + notify_remote_via_evtchn(xen_start_info->console.domU.evtchn); } int xencons_ring_send(const char *data, unsigned len) @@ -116,11 +116,11 @@ int xencons_ring_init(void) unbind_from_irqhandler(xencons_irq, NULL); xencons_irq = 0; - if (!xen_start_info->console_evtchn) + if (!xen_start_info->console.domU.evtchn) return 0; err = bind_evtchn_to_irqhandler( - xen_start_info->console_evtchn, + xen_start_info->console.domU.evtchn, handle_input, 0, "xencons", NULL); if (err <= 0) { printk(KERN_ERR "XEN console request irq failed %i\n", err); diff -r 199b457c4325 -r e5b6c025d4d2 drivers/xen/core/reboot.c --- a/drivers/xen/core/reboot.c Mon Aug 28 18:43:52 2006 -0500 +++ b/drivers/xen/core/reboot.c Tue Sep 05 17:55:43 2006 -0500 @@ -11,7 +11,6 @@ #include <asm/mmu_context.h> #include <xen/evtchn.h> #include <asm/hypervisor.h> -#include <xen/interface/dom0_ops.h> #include <xen/xenbus.h> #include <linux/cpu.h> #include <linux/kthread.h> diff -r 199b457c4325 -r e5b6c025d4d2 drivers/xen/privcmd/privcmd.c --- a/drivers/xen/privcmd/privcmd.c Mon Aug 28 18:43:52 2006 -0500 +++ b/drivers/xen/privcmd/privcmd.c Tue Sep 05 17:55:43 2006 -0500 @@ -29,14 +29,10 @@ #include <asm/hypervisor.h> #include <xen/public/privcmd.h> #include <xen/interface/xen.h> -#include <xen/interface/dom0_ops.h> #include <xen/xen_proc.h> static struct proc_dir_entry *privcmd_intf; static struct proc_dir_entry *capabilities_intf; - -#define NR_HYPERCALLS 64 -static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS); extern int arch_privcmd_hypercall(privcmd_hypercall_t *hypercall); @@ -52,12 +48,6 @@ static int privcmd_ioctl(struct inode *i if (copy_from_user(&hypercall, udata, sizeof(hypercall))) return -EFAULT; - - /* Check hypercall number for validity. */ - if (hypercall.op >= NR_HYPERCALLS) - return -EINVAL; - if (!test_bit(hypercall.op, hypercall_permission_map)) - return -EINVAL; #if defined(__i386__) __asm__ __volatile__ ( @@ -262,19 +252,6 @@ static int __init privcmd_init(void) if (!is_running_on_xen()) return -ENODEV; - /* Set of hypercalls that privileged applications may execute. */ - set_bit(__HYPERVISOR_acm_op, hypercall_permission_map); - set_bit(__HYPERVISOR_dom0_op, hypercall_permission_map); - set_bit(__HYPERVISOR_event_channel_op, hypercall_permission_map); - set_bit(__HYPERVISOR_memory_op, hypercall_permission_map); - set_bit(__HYPERVISOR_mmu_update, hypercall_permission_map); - set_bit(__HYPERVISOR_mmuext_op, hypercall_permission_map); - set_bit(__HYPERVISOR_xen_version, hypercall_permission_map); - set_bit(__HYPERVISOR_sched_op, hypercall_permission_map); - set_bit(__HYPERVISOR_sched_op_compat, hypercall_permission_map); - set_bit(__HYPERVISOR_event_channel_op_compat, - hypercall_permission_map); - privcmd_intf = create_xen_proc_entry("privcmd", 0400); if (privcmd_intf != NULL) privcmd_intf->proc_fops = &privcmd_file_ops; diff -r 199b457c4325 -r e5b6c025d4d2 include/asm-powerpc/xen/asm/hypervisor.h --- a/include/asm-powerpc/xen/asm/hypervisor.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/asm-powerpc/xen/asm/hypervisor.h Tue Sep 05 17:55:43 2006 -0500 @@ -36,7 +36,6 @@ #include <linux/version.h> #include <xen/interface/xen.h> #include <xen/foreign_page.h> -#include <xen/interface/dom0_ops.h> #include <asm/ptrace.h> #include <asm/page.h> #include <asm/irq.h> diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/acm.h --- a/include/xen/interface/acm.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/acm.h Tue Sep 05 17:55:43 2006 -0500 @@ -9,7 +9,6 @@ #define _XEN_PUBLIC_ACM_H #include "xen.h" -#include "sched_ctl.h" /* if ACM_DEBUG defined, all hooks should * print a short trace message (comment it out diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/acm_ops.h --- a/include/xen/interface/acm_ops.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/acm_ops.h Tue Sep 05 17:55:43 2006 -0500 @@ -9,7 +9,6 @@ #define __XEN_PUBLIC_ACM_OPS_H__ #include "xen.h" -#include "sched_ctl.h" #include "acm.h" /* diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/arch-ia64.h --- a/include/xen/interface/arch-ia64.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/arch-ia64.h Tue Sep 05 17:55:43 2006 -0500 @@ -7,17 +7,26 @@ #ifndef __HYPERVISOR_IF_IA64_H__ #define __HYPERVISOR_IF_IA64_H__ +/* Structural guest handles introduced in 0x00030201. */ +#if __XEN_INTERFACE_VERSION__ >= 0x00030201 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name +#else +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef type * __guest_handle_ ## name +#endif #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define XEN_GUEST_HANDLE_64(name) __guest_handle_ ## name #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) #ifdef __XEN_TOOLS__ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) #endif #ifndef __ASSEMBLY__ +typedef uint64_t uint64_aligned_t; + /* Guest handles for primitive C types. */ __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); @@ -40,18 +49,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #ifndef __ASSEMBLY__ -#define MAX_NR_SECTION 32 /* at most 32 memory holes */ -struct mm_section { - unsigned long start; /* start of memory hole */ - unsigned long end; /* end of memory hole */ -}; -typedef struct mm_section mm_section_t; - -struct pmt_entry { - unsigned long mfn : 56; - unsigned long type: 8; -}; -typedef struct pmt_entry pmt_entry_t; +typedef unsigned long xen_ulong_t; #define GPFN_MEM (0UL << 56) /* Guest pfn is normal mem */ #define GPFN_FRAME_BUFFER (1UL << 56) /* VGA framebuffer */ @@ -93,16 +91,6 @@ typedef struct pmt_entry pmt_entry_t; #define GFW_START (4*MEM_G -16*MEM_M) #define GFW_SIZE (16*MEM_M) - -/* - * NB. This may become a 64-bit count with no shift. If this happens then the - * structure size will still be 8 bytes, so no other alignments will change. - */ -struct tsc_timestamp { - unsigned int tsc_bits; /* 0: 32 bits read from the CPU's TSC. */ - unsigned int tsc_bitshift; /* 4: 'tsc_bits' uses N:N+31 of TSC. */ -}; /* 8 bytes */ -typedef struct tsc_timestamp tsc_timestamp_t; struct pt_fpreg { union { @@ -183,7 +171,7 @@ struct cpu_user_regs { unsigned long r6; /* preserved */ unsigned long r7; /* preserved */ unsigned long eml_unat; /* used for emulating instruction */ - unsigned long rfi_pfs; /* used for elulating rfi */ + unsigned long pad0; /* alignment pad */ }; typedef struct cpu_user_regs cpu_user_regs_t; @@ -283,64 +271,70 @@ struct mapped_regs { * shared info area now. interrupt_mask_addr is the address * of evtchn_upcall_mask for current vcpu */ - unsigned long interrupt_mask_addr; + unsigned char *interrupt_mask_addr; int pending_interruption; int incomplete_regframe; // see SDM vol2 6.8 - unsigned long reserved5_1[4]; + unsigned char vpsr_pp; + unsigned char reserved5_2[7]; + unsigned long reserved5_1[3]; int metaphysical_mode; // 1 = use metaphys mapping, 0 = use virtual int banknum; // 0 or 1, which virtual register bank is active unsigned long rrs[8]; // region registers unsigned long krs[8]; // kernel registers unsigned long pkrs[8]; // protection key registers unsigned long tmp[8]; // temp registers (e.g. for hyperprivops) - // FIXME: tmp[8] temp'ly being used for virtual psr.pp }; }; +}; +typedef struct mapped_regs mapped_regs_t; + +struct vpd { + struct mapped_regs vpd_low; unsigned long reserved6[3456]; unsigned long vmm_avail[128]; unsigned long reserved7[4096]; }; -typedef struct mapped_regs mapped_regs_t; +typedef struct vpd vpd_t; struct arch_vcpu_info { }; typedef struct arch_vcpu_info arch_vcpu_info_t; -typedef mapped_regs_t vpd_t; - struct arch_shared_info { - unsigned int flags; + /* PFN of the start_info page. */ unsigned long start_info_pfn; /* Interrupt vector for event channel. */ int evtchn_vector; + + uint64_t pad[32]; }; typedef struct arch_shared_info arch_shared_info_t; -struct arch_initrd_info { - unsigned long start; - unsigned long size; -}; -typedef struct arch_initrd_info arch_initrd_info_t; - typedef unsigned long xen_callback_t; -#define IA64_COMMAND_LINE_SIZE 512 +struct ia64_tr_entry { + unsigned long pte; + unsigned long itir; + unsigned long vadr; + unsigned long rid; +}; + +struct vcpu_extra_regs { + struct ia64_tr_entry itrs[8]; + struct ia64_tr_entry dtrs[8]; + unsigned long iva; + unsigned long dcr; + unsigned long event_callback_ip; +}; + struct vcpu_guest_context { -#define VGCF_FPU_VALID (1<<0) -#define VGCF_VMX_GUEST (1<<1) -#define VGCF_IN_KERNEL (1<<2) +#define VGCF_EXTRA_REGS (1<<1) /* Get/Set extra regs. */ unsigned long flags; /* VGCF_* flags */ - unsigned long pt_base; /* PMT table base */ - unsigned long share_io_pg; /* Shared page for I/O emulation */ - unsigned long sys_pgnr; /* System pages out of domain memory */ - unsigned long vm_assist; /* VMASST_TYPE_* bitmap, now none on IPF */ - - struct cpu_user_regs regs; - struct mapped_regs *privregs; - struct arch_shared_info shared; - struct arch_initrd_info initrd; - char cmdline[IA64_COMMAND_LINE_SIZE]; + + struct cpu_user_regs user_regs; + struct vcpu_extra_regs extra_regs; + unsigned long privregs_pfn; }; typedef struct vcpu_guest_context vcpu_guest_context_t; DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); @@ -376,8 +370,45 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte #define _ASSIGN_readonly 0 #define ASSIGN_readonly (1UL << _ASSIGN_readonly) #define ASSIGN_writable (0UL << _ASSIGN_readonly) // dummy flag +/* Internal only: memory attribute must be WC/UC/UCE. */ +#define _ASSIGN_nocache 1 +#define ASSIGN_nocache (1UL << _ASSIGN_nocache) + +/* This structure has the same layout of struct ia64_boot_param, defined in + <asm/system.h>. It is redefined here to ease use. */ +struct xen_ia64_boot_param { + unsigned long command_line; /* physical address of cmd line args */ + unsigned long efi_systab; /* physical address of EFI system table */ + unsigned long efi_memmap; /* physical address of EFI memory map */ + unsigned long efi_memmap_size; /* size of EFI memory map */ + unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor */ + unsigned int efi_memdesc_version; /* memory descriptor version */ + struct { + unsigned short num_cols; /* number of columns on console. */ + unsigned short num_rows; /* number of rows on console. */ + unsigned short orig_x; /* cursor's x position */ + unsigned short orig_y; /* cursor's y position */ + } console_info; + unsigned long fpswa; /* physical address of the fpswa interface */ + unsigned long initrd_start; + unsigned long initrd_size; + unsigned long domain_start; /* va where the boot time domain begins */ + unsigned long domain_size; /* how big is the boot domain */ +}; #endif /* !__ASSEMBLY__ */ + +/* Address of shared_info in domain virtual space. + This is the default address, for compatibility only. */ +#define XSI_BASE 0xf100000000000000 + +/* Size of the shared_info area (this is not related to page size). */ +#define XSI_SHIFT 14 +#define XSI_SIZE (1 << XSI_SHIFT) +/* Log size of mapped_regs area (64 KB - only 4KB is used). */ +#define XMAPPEDREGS_SHIFT 12 +/* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */ +#define XMAPPEDREGS_OFS XSI_SIZE /* Hyperprivops. */ #define HYPERPRIVOP_RFI 0x1 @@ -403,7 +434,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte #define HYPERPRIVOP_GET_PMD 0x15 #define HYPERPRIVOP_GET_EFLAG 0x16 #define HYPERPRIVOP_SET_EFLAG 0x17 -#define HYPERPRIVOP_MAX 0x17 +#define HYPERPRIVOP_RSM_BE 0x18 +#define HYPERPRIVOP_GET_PSR 0x19 +#define HYPERPRIVOP_MAX 0x19 #endif /* __HYPERVISOR_IF_IA64_H__ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/arch-x86_32.h --- a/include/xen/interface/arch-x86_32.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/arch-x86_32.h Tue Sep 05 17:55:43 2006 -0500 @@ -9,14 +9,51 @@ #ifndef __XEN_PUBLIC_ARCH_X86_32_H__ #define __XEN_PUBLIC_ARCH_X86_32_H__ +/* + * Hypercall interface: + * Input: %ebx, %ecx, %edx, %esi, %edi (arguments 1-5) + * Output: %eax + * Access is via hypercall page (set up by guest loader or via a Xen MSR): + * call hypercall_page + hypercall-number * 32 + * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx) + */ + +#if __XEN_INTERFACE_VERSION__ < 0x00030203 +/* + * Legacy hypercall interface: + * As above, except the entry sequence to the hypervisor is: + * mov $hypercall-number*32,%eax ; int $0x82 + */ +#define TRAP_INSTR "int $0x82" +#endif + +/* Structural guest handles introduced in 0x00030201. */ +#if (defined(__XEN__) || defined(__XEN_TOOLS__)) && !defined(__ASSEMBLY__) +typedef uint64_t __attribute__((aligned(8))) uint64_aligned_t; +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef struct { type *p; } \ + __guest_handle_ ## name; \ + typedef struct { union { type *p; uint64_aligned_t q; }; } \ + __guest_handle_64_ ## name +#elif __XEN_INTERFACE_VERSION__ >= 0x00030201 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name +#else +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef type * __guest_handle_ ## name +#endif #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name -#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) +#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name #ifdef __XEN_TOOLS__ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) +#define set_xen_guest_handle(hnd, val) \ + do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \ + (hnd).p = val; \ + } while ( 0 ) +#else +#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) #endif #ifndef __ASSEMBLY__ @@ -65,9 +102,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define FLAT_USER_DS FLAT_RING3_DS #define FLAT_USER_SS FLAT_RING3_SS -/* And the trap vector is... */ -#define TRAP_INSTR "int $0x82" - /* * Virtual addresses beyond this are not modifiable by guest OSes. The * machine->physical mapping table starts at this address, read-only. @@ -97,6 +131,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define MAX_VIRT_CPUS 32 #ifndef __ASSEMBLY__ + +typedef unsigned long xen_ulong_t; /* * Send an array of these to HYPERVISOR_set_trap_table() @@ -189,6 +225,7 @@ struct arch_shared_info { /* Frame containing list of mfns containing list of mfns containing p2m. */ xen_pfn_t pfn_to_mfn_frame_list_list; unsigned long nmi_reason; + uint64_t pad[32]; }; typedef struct arch_shared_info arch_shared_info_t; diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/arch-x86_64.h --- a/include/xen/interface/arch-x86_64.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/arch-x86_64.h Tue Sep 05 17:55:43 2006 -0500 @@ -9,17 +9,45 @@ #ifndef __XEN_PUBLIC_ARCH_X86_64_H__ #define __XEN_PUBLIC_ARCH_X86_64_H__ +/* + * Hypercall interface: + * Input: %rdi, %rsi, %rdx, %r10, %r8 (arguments 1-5) + * Output: %rax + * Access is via hypercall page (set up by guest loader or via a Xen MSR): + * call hypercall_page + hypercall-number * 32 + * Clobbered: argument registers (e.g., 2-arg hypercall clobbers %rdi,%rsi) + */ + +#if __XEN_INTERFACE_VERSION__ < 0x00030203 +/* + * Legacy hypercall interface: + * As above, except the entry sequence to the hypervisor is: + * mov $hypercall-number*32,%eax ; syscall + * Clobbered: %rcx, %r11, argument registers (as above) + */ +#define TRAP_INSTR "syscall" +#endif + +/* Structural guest handles introduced in 0x00030201. */ +#if __XEN_INTERFACE_VERSION__ >= 0x00030201 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name +#else +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef type * __guest_handle_ ## name +#endif #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define XEN_GUEST_HANDLE_64(name) __guest_handle_ ## name #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) #ifdef __XEN_TOOLS__ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) #endif #ifndef __ASSEMBLY__ +typedef uint64_t uint64_aligned_t; + /* Guest handles for primitive C types. */ __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); @@ -80,9 +108,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define FLAT_USER_SS32 FLAT_RING3_SS32 #define FLAT_USER_SS FLAT_USER_SS64 -/* And the trap vector is... */ -#define TRAP_INSTR "syscall" - #define __HYPERVISOR_VIRT_START 0xFFFF800000000000 #define __HYPERVISOR_VIRT_END 0xFFFF880000000000 #define __MACH2PHYS_VIRT_START 0xFFFF800000000000 @@ -104,6 +129,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define MAX_VIRT_CPUS 32 #ifndef __ASSEMBLY__ + +typedef unsigned long xen_ulong_t; /* * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base) @@ -259,6 +286,7 @@ struct arch_shared_info { /* Frame containing list of mfns containing list of mfns containing p2m. */ xen_pfn_t pfn_to_mfn_frame_list_list; unsigned long nmi_reason; + uint64_t pad[32]; }; typedef struct arch_shared_info arch_shared_info_t; diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/dom0_ops.h --- a/include/xen/interface/dom0_ops.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/dom0_ops.h Tue Sep 05 17:55:43 2006 -0500 @@ -4,122 +4,49 @@ * Process command requests from domain-0 guest OS. * * Copyright (c) 2002-2003, B Dragovic - * Copyright (c) 2002-2004, K Fraser + * Copyright (c) 2002-2006, K Fraser */ - #ifndef __XEN_PUBLIC_DOM0_OPS_H__ #define __XEN_PUBLIC_DOM0_OPS_H__ #include "xen.h" -#include "sched_ctl.h" +#include "platform.h" -/* - * Make sure you increment the interface version whenever you modify this file! - * This makes sure that old versions of dom0 tools will stop working in a - * well-defined way (rather than crashing the machine, for instance). - */ -#define DOM0_INTERFACE_VERSION 0x03000001 +#if __XEN_INTERFACE_VERSION__ >= 0x00030204 +#error "dom0_ops.h is a compatibility interface only" +#endif -/************************************************************************/ +#define DOM0_INTERFACE_VERSION XENPF_INTERFACE_VERSION -#define DOM0_GETMEMLIST 2 -struct dom0_getmemlist { - /* IN variables. */ - domid_t domain; - uint64_t max_pfns; - XEN_GUEST_HANDLE(xen_pfn_t) buffer; - /* OUT variables. */ - uint64_t num_pfns; -}; -typedef struct dom0_getmemlist dom0_getmemlist_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getmemlist_t); +#define DOM0_SETTIME XENPF_settime +#define dom0_settime xenpf_settime +#define dom0_settime_t xenpf_settime_t -#define DOM0_SCHEDCTL 6 - /* struct sched_ctl_cmd is from sched-ctl.h */ -typedef struct sched_ctl_cmd dom0_schedctl_t; -DEFINE_XEN_GUEST_HANDLE(dom0_schedctl_t); +#define DOM0_ADD_MEMTYPE XENPF_add_memtype +#define dom0_add_memtype xenpf_add_memtype +#define dom0_add_memtype_t xenpf_add_memtype_t -#define DOM0_ADJUSTDOM 7 -/* struct sched_adjdom_cmd is from sched-ctl.h */ -typedef struct sched_adjdom_cmd dom0_adjustdom_t; -DEFINE_XEN_GUEST_HANDLE(dom0_adjustdom_t); +#define DOM0_DEL_MEMTYPE XENPF_del_memtype +#define dom0_del_memtype xenpf_del_memtype +#define dom0_del_memtype_t xenpf_del_memtype_t -#define DOM0_CREATEDOMAIN 8 -struct dom0_createdomain { - /* IN parameters */ - uint32_t ssidref; - xen_domain_handle_t handle; - /* IN/OUT parameters. */ - /* Identifier for new domain (auto-allocate if zero is specified). */ - domid_t domain; -}; -typedef struct dom0_createdomain dom0_createdomain_t; -DEFINE_XEN_GUEST_HANDLE(dom0_createdomain_t); +#define DOM0_READ_MEMTYPE XENPF_read_memtype +#define dom0_read_memtype xenpf_read_memtype +#define dom0_read_memtype_t xenpf_read_memtype_t -#define DOM0_DESTROYDOMAIN 9 -struct dom0_destroydomain { - /* IN variables. */ - domid_t domain; -}; -typedef struct dom0_destroydomain dom0_destroydomain_t; -DEFINE_XEN_GUEST_HANDLE(dom0_destroydomain_t); +#define DOM0_MICROCODE XENPF_microcode_update +#define dom0_microcode xenpf_microcode_update +#define dom0_microcode_t xenpf_microcode_update_t -#define DOM0_PAUSEDOMAIN 10 -struct dom0_pausedomain { - /* IN parameters. */ - domid_t domain; -}; -typedef struct dom0_pausedomain dom0_pausedomain_t; -DEFINE_XEN_GUEST_HANDLE(dom0_pausedomain_t); +#define DOM0_PLATFORM_QUIRK XENPF_platform_quirk +#define dom0_platform_quirk xenpf_platform_quirk +#define dom0_platform_quirk_t xenpf_platform_quirk_t -#define DOM0_UNPAUSEDOMAIN 11 -struct dom0_unpausedomain { - /* IN parameters. */ - domid_t domain; -}; -typedef struct dom0_unpausedomain dom0_unpausedomain_t; -DEFINE_XEN_GUEST_HANDLE(dom0_unpausedomain_t); +typedef uint64_t cpumap_t; -#define DOM0_GETDOMAININFO 12 -struct dom0_getdomaininfo { - /* IN variables. */ - domid_t domain; /* NB. IN/OUT variable. */ - /* OUT variables. */ -#define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */ -#define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut down. */ -#define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */ -#define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */ -#define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */ -#define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */ -#define DOMFLAGS_CPUSHIFT 8 -#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */ -#define DOMFLAGS_SHUTDOWNSHIFT 16 - uint32_t flags; - uint64_t tot_pages; - uint64_t max_pages; - xen_pfn_t shared_info_frame; /* MFN of shared_info struct */ - uint64_t cpu_time; - uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ - uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ - uint32_t ssidref; - xen_domain_handle_t handle; -}; -typedef struct dom0_getdomaininfo dom0_getdomaininfo_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfo_t); - -#define DOM0_SETVCPUCONTEXT 13 -struct dom0_setvcpucontext { - /* IN variables. */ - domid_t domain; - uint32_t vcpu; - /* IN/OUT parameters */ - XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; -}; -typedef struct dom0_setvcpucontext dom0_setvcpucontext_t; -DEFINE_XEN_GUEST_HANDLE(dom0_setvcpucontext_t); - -#define DOM0_MSR 15 +/* Unsupported legacy operation -- defined for API compatibility. */ +#define DOM0_MSR 15 struct dom0_msr { /* IN variables. */ uint32_t write; @@ -134,317 +61,8 @@ typedef struct dom0_msr dom0_msr_t; typedef struct dom0_msr dom0_msr_t; DEFINE_XEN_GUEST_HANDLE(dom0_msr_t); -/* - * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC, - * 1 January, 1970 if the current system time was <system_time>. - */ -#define DOM0_SETTIME 17 -struct dom0_settime { - /* IN variables. */ - uint32_t secs; - uint32_t nsecs; - uint64_t system_time; -}; -typedef struct dom0_settime dom0_settime_t; -DEFINE_XEN_GUEST_HANDLE(dom0_settime_t); - -#define DOM0_GETPAGEFRAMEINFO 18 -#define LTAB_SHIFT 28 -#define NOTAB 0 /* normal page */ -#define L1TAB (1<<LTAB_SHIFT) -#define L2TAB (2<<LTAB_SHIFT) -#define L3TAB (3<<LTAB_SHIFT) -#define L4TAB (4<<LTAB_SHIFT) -#define LPINTAB (1<<31) -#define XTAB (0xf<<LTAB_SHIFT) /* invalid page */ -#define LTAB_MASK XTAB -#define LTABTYPE_MASK (0x7<<LTAB_SHIFT) - -struct dom0_getpageframeinfo { - /* IN variables. */ - xen_pfn_t mfn; /* Machine page frame number to query. */ - domid_t domain; /* To which domain does the frame belong? */ - /* OUT variables. */ - /* Is the page PINNED to a type? */ - uint32_t type; /* see above type defs */ -}; -typedef struct dom0_getpageframeinfo dom0_getpageframeinfo_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo_t); - -/* - * Read console content from Xen buffer ring. - */ -#define DOM0_READCONSOLE 19 -struct dom0_readconsole { - /* IN variables. */ - uint32_t clear; /* Non-zero -> clear after reading. */ - /* IN/OUT variables. */ - XEN_GUEST_HANDLE(char) buffer; /* In: Buffer start; Out: Used buffer start */ - uint32_t count; /* In: Buffer size; Out: Used buffer size */ -}; -typedef struct dom0_readconsole dom0_readconsole_t; -DEFINE_XEN_GUEST_HANDLE(dom0_readconsole_t); - -/* - * Set which physical cpus a vcpu can execute on. - */ -#define DOM0_SETVCPUAFFINITY 20 -struct dom0_setvcpuaffinity { - /* IN variables. */ - domid_t domain; - uint32_t vcpu; - cpumap_t cpumap; -}; -typedef struct dom0_setvcpuaffinity dom0_setvcpuaffinity_t; -DEFINE_XEN_GUEST_HANDLE(dom0_setvcpuaffinity_t); - -/* Get trace buffers machine base address */ -#define DOM0_TBUFCONTROL 21 -struct dom0_tbufcontrol { - /* IN variables */ -#define DOM0_TBUF_GET_INFO 0 -#define DOM0_TBUF_SET_CPU_MASK 1 -#define DOM0_TBUF_SET_EVT_MASK 2 -#define DOM0_TBUF_SET_SIZE 3 -#define DOM0_TBUF_ENABLE 4 -#define DOM0_TBUF_DISABLE 5 - uint32_t op; - /* IN/OUT variables */ - cpumap_t cpu_mask; - uint32_t evt_mask; - /* OUT variables */ - xen_pfn_t buffer_mfn; - uint32_t size; -}; -typedef struct dom0_tbufcontrol dom0_tbufcontrol_t; -DEFINE_XEN_GUEST_HANDLE(dom0_tbufcontrol_t); - -/* - * Get physical information about the host machine - */ -#define DOM0_PHYSINFO 22 -struct dom0_physinfo { - uint32_t threads_per_core; - uint32_t cores_per_socket; - uint32_t sockets_per_node; - uint32_t nr_nodes; - uint32_t cpu_khz; - uint64_t total_pages; - uint64_t free_pages; - uint32_t hw_cap[8]; -}; -typedef struct dom0_physinfo dom0_physinfo_t; -DEFINE_XEN_GUEST_HANDLE(dom0_physinfo_t); - -/* - * Get the ID of the current scheduler. - */ -#define DOM0_SCHED_ID 24 -struct dom0_sched_id { - /* OUT variable */ - uint32_t sched_id; -}; -typedef struct dom0_physinfo dom0_sched_id_t; -DEFINE_XEN_GUEST_HANDLE(dom0_sched_id_t); - -/* - * Control shadow pagetables operation - */ -#define DOM0_SHADOW_CONTROL 25 - -#define DOM0_SHADOW_CONTROL_OP_OFF 0 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3 - -#define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */ -#define DOM0_SHADOW_CONTROL_OP_CLEAN 11 -#define DOM0_SHADOW_CONTROL_OP_PEEK 12 - -struct dom0_shadow_control_stats { - uint32_t fault_count; - uint32_t dirty_count; - uint32_t dirty_net_count; - uint32_t dirty_block_count; -}; -typedef struct dom0_shadow_control_stats dom0_shadow_control_stats_t; -DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_stats_t); - -struct dom0_shadow_control { - /* IN variables. */ - domid_t domain; - uint32_t op; - XEN_GUEST_HANDLE(ulong) dirty_bitmap; - /* IN/OUT variables. */ - uint64_t pages; /* size of buffer, updated with actual size */ - /* OUT variables. */ - struct dom0_shadow_control_stats stats; -}; -typedef struct dom0_shadow_control dom0_shadow_control_t; -DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_t); - -#define DOM0_SETDOMAINMAXMEM 28 -struct dom0_setdomainmaxmem { - /* IN variables. */ - domid_t domain; - uint64_t max_memkb; -}; -typedef struct dom0_setdomainmaxmem dom0_setdomainmaxmem_t; -DEFINE_XEN_GUEST_HANDLE(dom0_setdomainmaxmem_t); - -#define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */ -struct dom0_getpageframeinfo2 { - /* IN variables. */ - domid_t domain; - uint64_t num; - /* IN/OUT variables. */ - XEN_GUEST_HANDLE(ulong) array; -}; -typedef struct dom0_getpageframeinfo2 dom0_getpageframeinfo2_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo2_t); - -/* - * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type. - * On x86, @type is an architecture-defined MTRR memory type. - * On success, returns the MTRR that was used (@reg) and a handle that can - * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting. - * (x86-specific). - */ -#define DOM0_ADD_MEMTYPE 31 -struct dom0_add_memtype { - /* IN variables. */ - xen_pfn_t mfn; - uint64_t nr_mfns; - uint32_t type; - /* OUT variables. */ - uint32_t handle; - uint32_t reg; -}; -typedef struct dom0_add_memtype dom0_add_memtype_t; -DEFINE_XEN_GUEST_HANDLE(dom0_add_memtype_t); - -/* - * Tear down an existing memory-range type. If @handle is remembered then it - * should be passed in to accurately tear down the correct setting (in case - * of overlapping memory regions with differing types). If it is not known - * then @handle should be set to zero. In all cases @reg must be set. - * (x86-specific). - */ -#define DOM0_DEL_MEMTYPE 32 -struct dom0_del_memtype { - /* IN variables. */ - uint32_t handle; - uint32_t reg; -}; -typedef struct dom0_del_memtype dom0_del_memtype_t; -DEFINE_XEN_GUEST_HANDLE(dom0_del_memtype_t); - -/* Read current type of an MTRR (x86-specific). */ -#define DOM0_READ_MEMTYPE 33 -struct dom0_read_memtype { - /* IN variables. */ - uint32_t reg; - /* OUT variables. */ - xen_pfn_t mfn; - uint64_t nr_mfns; - uint32_t type; -}; -typedef struct dom0_read_memtype dom0_read_memtype_t; -DEFINE_XEN_GUEST_HANDLE(dom0_read_memtype_t); - -/* Interface for controlling Xen software performance counters. */ -#define DOM0_PERFCCONTROL 34 -/* Sub-operations: */ -#define DOM0_PERFCCONTROL_OP_RESET 1 /* Reset all counters to zero. */ -#define DOM0_PERFCCONTROL_OP_QUERY 2 /* Get perfctr information. */ -struct dom0_perfc_desc { - char name[80]; /* name of perf counter */ - uint32_t nr_vals; /* number of values for this counter */ - uint32_t vals[64]; /* array of values */ -}; -typedef struct dom0_perfc_desc dom0_perfc_desc_t; -DEFINE_XEN_GUEST_HANDLE(dom0_perfc_desc_t); - -struct dom0_perfccontrol { - /* IN variables. */ - uint32_t op; /* DOM0_PERFCCONTROL_OP_??? */ - /* OUT variables. */ - uint32_t nr_counters; /* number of counters */ - XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc; /* counter information (or NULL) */ -}; -typedef struct dom0_perfccontrol dom0_perfccontrol_t; -DEFINE_XEN_GUEST_HANDLE(dom0_perfccontrol_t); - -#define DOM0_MICROCODE 35 -struct dom0_microcode { - /* IN variables. */ - XEN_GUEST_HANDLE(void) data; /* Pointer to microcode data */ - uint32_t length; /* Length of microcode data. */ -}; -typedef struct dom0_microcode dom0_microcode_t; -DEFINE_XEN_GUEST_HANDLE(dom0_microcode_t); - -#define DOM0_IOPORT_PERMISSION 36 -struct dom0_ioport_permission { - domid_t domain; /* domain to be affected */ - uint32_t first_port; /* first port int range */ - uint32_t nr_ports; /* size of port range */ - uint8_t allow_access; /* allow or deny access to range? */ -}; -typedef struct dom0_ioport_permission dom0_ioport_permission_t; -DEFINE_XEN_GUEST_HANDLE(dom0_ioport_permission_t); - -#define DOM0_GETVCPUCONTEXT 37 -struct dom0_getvcpucontext { - /* IN variables. */ - domid_t domain; /* domain to be affected */ - uint32_t vcpu; /* vcpu # */ - /* OUT variables. */ - XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; -}; -typedef struct dom0_getvcpucontext dom0_getvcpucontext_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getvcpucontext_t); - -#define DOM0_GETVCPUINFO 43 -struct dom0_getvcpuinfo { - /* IN variables. */ - domid_t domain; /* domain to be affected */ - uint32_t vcpu; /* vcpu # */ - /* OUT variables. */ - uint8_t online; /* currently online (not hotplugged)? */ - uint8_t blocked; /* blocked waiting for an event? */ - uint8_t running; /* currently scheduled on its CPU? */ - uint64_t cpu_time; /* total cpu time consumed (ns) */ - uint32_t cpu; /* current mapping */ - cpumap_t cpumap; /* allowable mapping */ -}; -typedef struct dom0_getvcpuinfo dom0_getvcpuinfo_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getvcpuinfo_t); - -#define DOM0_GETDOMAININFOLIST 38 -struct dom0_getdomaininfolist { - /* IN variables. */ - domid_t first_domain; - uint32_t max_domains; - XEN_GUEST_HANDLE(dom0_getdomaininfo_t) buffer; - /* OUT variables. */ - uint32_t num_domains; -}; -typedef struct dom0_getdomaininfolist dom0_getdomaininfolist_t; -DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfolist_t); - -#define DOM0_PLATFORM_QUIRK 39 -#define QUIRK_NOIRQBALANCING 1 /* Do not restrict IO-APIC RTE targets */ -#define QUIRK_IOAPIC_BAD_REGSEL 2 /* IO-APIC REGSEL forgets its value */ -#define QUIRK_IOAPIC_GOOD_REGSEL 3 /* IO-APIC REGSEL behaves properly */ -struct dom0_platform_quirk { - /* IN variables. */ - uint32_t quirk_id; -}; -typedef struct dom0_platform_quirk dom0_platform_quirk_t; -DEFINE_XEN_GUEST_HANDLE(dom0_platform_quirk_t); - -#define DOM0_PHYSICAL_MEMORY_MAP 40 /* Unimplemented from 3.0.3 onwards */ +/* Unsupported legacy operation -- defined for API compatibility. */ +#define DOM0_PHYSICAL_MEMORY_MAP 40 struct dom0_memory_map_entry { uint64_t start, end; uint32_t flags; /* reserved */ @@ -453,140 +71,18 @@ typedef struct dom0_memory_map_entry dom typedef struct dom0_memory_map_entry dom0_memory_map_entry_t; DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t); -struct dom0_physical_memory_map { - /* IN variables. */ - uint32_t max_map_entries; - /* OUT variables. */ - uint32_t nr_map_entries; - XEN_GUEST_HANDLE(dom0_memory_map_entry_t) memory_map; -}; -typedef struct dom0_physical_memory_map dom0_physical_memory_map_t; -DEFINE_XEN_GUEST_HANDLE(dom0_physical_memory_map_t); - -#define DOM0_MAX_VCPUS 41 -struct dom0_max_vcpus { - domid_t domain; /* domain to be affected */ - uint32_t max; /* maximum number of vcpus */ -}; -typedef struct dom0_max_vcpus dom0_max_vcpus_t; -DEFINE_XEN_GUEST_HANDLE(dom0_max_vcpus_t); - -#define DOM0_SETDOMAINHANDLE 44 -struct dom0_setdomainhandle { - domid_t domain; - xen_domain_handle_t handle; -}; -typedef struct dom0_setdomainhandle dom0_setdomainhandle_t; -DEFINE_XEN_GUEST_HANDLE(dom0_setdomainhandle_t); - -#define DOM0_SETDEBUGGING 45 -struct dom0_setdebugging { - domid_t domain; - uint8_t enable; -}; -typedef struct dom0_setdebugging dom0_setdebugging_t; -DEFINE_XEN_GUEST_HANDLE(dom0_setdebugging_t); - -#define DOM0_IRQ_PERMISSION 46 -struct dom0_irq_permission { - domid_t domain; /* domain to be affected */ - uint8_t pirq; - uint8_t allow_access; /* flag to specify enable/disable of IRQ access */ -}; -typedef struct dom0_irq_permission dom0_irq_permission_t; -DEFINE_XEN_GUEST_HANDLE(dom0_irq_permission_t); - -#define DOM0_IOMEM_PERMISSION 47 -struct dom0_iomem_permission { - domid_t domain; /* domain to be affected */ - xen_pfn_t first_mfn; /* first page (physical page number) in range */ - uint64_t nr_mfns; /* number of pages in range (>0) */ - uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ -}; -typedef struct dom0_iomem_permission dom0_iomem_permission_t; -DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permission_t); - -#define DOM0_HYPERCALL_INIT 48 -struct dom0_hypercall_init { - domid_t domain; /* domain to be affected */ - xen_pfn_t mfn; /* machine frame to be initialised */ -}; -typedef struct dom0_hypercall_init dom0_hypercall_init_t; -DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t); - -#define DOM0_DOMAIN_SETUP 49 -#define _XEN_DOMAINSETUP_hvm_guest 0 -#define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest) -typedef struct dom0_domain_setup { - domid_t domain; /* domain to be affected */ - unsigned long flags; /* XEN_DOMAINSETUP_* */ -#ifdef __ia64__ - unsigned long bp; /* mpaddr of boot param area */ - unsigned long maxmem; /* Highest memory address for MDT. */ -#endif -} dom0_domain_setup_t; -DEFINE_XEN_GUEST_HANDLE(dom0_domain_setup_t); - -#define DOM0_SETTIMEOFFSET 50 -struct dom0_settimeoffset { - domid_t domain; - int32_t time_offset_seconds; /* applied to domain wallclock time */ -}; -typedef struct dom0_settimeoffset dom0_settimeoffset_t; -DEFINE_XEN_GUEST_HANDLE(dom0_settimeoffset_t); - -#define DOM0_ALLOC_REAL_MODE_AREA 51 -struct dom0_alloc_real_mode_area { - domid_t domain; - uint32_t order; -}; -typedef struct dom0_alloc_real_mode_area dom0_alloc_real_mode_area_t; -DEFINE_XEN_GUEST_HANDLE(dom0_alloc_real_mode_area_t); - struct dom0_op { uint32_t cmd; uint32_t interface_version; /* DOM0_INTERFACE_VERSION */ union { - struct dom0_createdomain createdomain; - struct dom0_pausedomain pausedomain; - struct dom0_unpausedomain unpausedomain; - struct dom0_destroydomain destroydomain; - struct dom0_getmemlist getmemlist; - struct sched_ctl_cmd schedctl; - struct sched_adjdom_cmd adjustdom; - struct dom0_setvcpucontext setvcpucontext; - struct dom0_getdomaininfo getdomaininfo; - struct dom0_getpageframeinfo getpageframeinfo; struct dom0_msr msr; struct dom0_settime settime; - struct dom0_readconsole readconsole; - struct dom0_setvcpuaffinity setvcpuaffinity; - struct dom0_tbufcontrol tbufcontrol; - struct dom0_physinfo physinfo; - struct dom0_sched_id sched_id; - struct dom0_shadow_control shadow_control; - struct dom0_setdomainmaxmem setdomainmaxmem; - struct dom0_getpageframeinfo2 getpageframeinfo2; struct dom0_add_memtype add_memtype; struct dom0_del_memtype del_memtype; struct dom0_read_memtype read_memtype; - struct dom0_perfccontrol perfccontrol; struct dom0_microcode microcode; - struct dom0_ioport_permission ioport_permission; - struct dom0_getvcpucontext getvcpucontext; - struct dom0_getvcpuinfo getvcpuinfo; - struct dom0_getdomaininfolist getdomaininfolist; struct dom0_platform_quirk platform_quirk; - struct dom0_physical_memory_map physical_memory_map; - struct dom0_max_vcpus max_vcpus; - struct dom0_setdomainhandle setdomainhandle; - struct dom0_setdebugging setdebugging; - struct dom0_irq_permission irq_permission; - struct dom0_iomem_permission iomem_permission; - struct dom0_hypercall_init hypercall_init; - struct dom0_domain_setup domain_setup; - struct dom0_settimeoffset settimeoffset; - struct dom0_alloc_real_mode_area alloc_real_mode_area; + struct dom0_memory_map_entry physical_memory_map; uint8_t pad[128]; } u; }; @@ -594,3 +90,13 @@ DEFINE_XEN_GUEST_HANDLE(dom0_op_t); DEFINE_XEN_GUEST_HANDLE(dom0_op_t); #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/grant_table.h --- a/include/xen/interface/grant_table.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/grant_table.h Tue Sep 05 17:55:43 2006 -0500 @@ -145,9 +145,9 @@ typedef uint32_t grant_handle_t; * that must be presented later to destroy the mapping(s). On error, <handle> * is a negative status code. * NOTES: - * 1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address + * 1. If GNTMAP_device_map is specified then <dev_bus_addr> is the address * via which I/O devices may access the granted frame. - * 2. If GNTPIN_map_for_host is specified then a mapping will be added at + * 2. If GNTMAP_host_map is specified then a mapping will be added at * either a host virtual address in the current address space, or at * a PTE at the specified machine address. The type of mapping to * perform is selected through the GNTMAP_contains_pte flag, and the @@ -248,6 +248,49 @@ struct gnttab_transfer { }; typedef struct gnttab_transfer gnttab_transfer_t; DEFINE_XEN_GUEST_HANDLE(gnttab_transfer_t); + + +/* + * GNTTABOP_copy: Hypervisor based copy + * source and destinations can be eithers MFNs or, for foreign domains, + * grant references. the foreign domain has to grant read/write access + * in its grant table. + * + * The flags specify what type source and destinations are (either MFN + * or grant reference). + * + * Note that this can also be used to copy data between two domains + * via a third party if the source and destination domains had previously + * grant appropriate access to their pages to the third party. + * + * source_offset specifies an offset in the source frame, dest_offset + * the offset in the target frame and len specifies the number of + * bytes to be copied. + */ + +#define _GNTCOPY_source_gref (0) +#define GNTCOPY_source_gref (1<<_GNTCOPY_source_gref) +#define _GNTCOPY_dest_gref (1) +#define GNTCOPY_dest_gref (1<<_GNTCOPY_dest_gref) + +#define GNTTABOP_copy 5 +typedef struct gnttab_copy { + /* IN parameters. */ + struct { + union { + grant_ref_t ref; + xen_pfn_t gmfn; + } u; + domid_t domid; + uint16_t offset; + } source, dest; + uint16_t len; + uint16_t flags; /* GNTCOPY_* */ + /* OUT parameters. */ + int16_t status; +} gnttab_copy_t; +DEFINE_XEN_GUEST_HANDLE(gnttab_copy_t); + /* * Bitfield values for update_pin_status.flags. @@ -290,6 +333,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_transfer_ #define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */ #define GNTST_permission_denied (-8) /* Not enough privilege for operation. */ #define GNTST_bad_page (-9) /* Specified page was invalid for op. */ +#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */ #define GNTTABOP_error_msgs { \ "okay", \ @@ -301,7 +345,8 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_transfer_ "invalid device address", \ "no spare translation slot in the I/O MMU", \ "permission denied", \ - "bad page" \ + "bad page", \ + "copy arguments cross page boundary" \ } #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/hvm/hvm_info_table.h --- a/include/xen/interface/hvm/hvm_info_table.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/hvm/hvm_info_table.h Tue Sep 05 17:55:43 2006 -0500 @@ -16,8 +16,6 @@ struct hvm_info_table { uint32_t length; uint8_t checksum; uint8_t acpi_enabled; - uint8_t apic_enabled; - uint8_t pae_enabled; uint32_t nr_vcpus; }; diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/hvm/ioreq.h --- a/include/xen/interface/hvm/ioreq.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/hvm/ioreq.h Tue Sep 05 17:55:43 2006 -0500 @@ -27,7 +27,6 @@ #define STATE_IOREQ_READY 1 #define STATE_IOREQ_INPROCESS 2 #define STATE_IORESP_READY 3 -#define STATE_IORESP_HOOK 4 #define IOREQ_TYPE_PIO 0 /* pio */ #define IOREQ_TYPE_COPY 1 /* mmio ops */ @@ -58,11 +57,6 @@ struct ioreq { }; typedef struct ioreq ioreq_t; -#define MAX_VECTOR 256 -#define BITS_PER_BYTE 8 -#define INTR_LEN (MAX_VECTOR/(BITS_PER_BYTE * sizeof(uint64_t))) -#define INTR_LEN_32 (MAX_VECTOR/(BITS_PER_BYTE * sizeof(uint32_t))) - struct global_iodata { uint16_t pic_elcr; uint16_t pic_irr; @@ -75,7 +69,6 @@ struct vcpu_iodata { struct ioreq vp_ioreq; /* Event channel port */ unsigned int vp_eport; /* VMX vcpu uses this to notify DM */ - unsigned int dm_eport; /* DM uses this to notify VMX vcpu */ }; typedef struct vcpu_iodata vcpu_iodata_t; @@ -84,6 +77,14 @@ struct shared_iopage { struct vcpu_iodata vcpu_iodata[1]; }; typedef struct shared_iopage shared_iopage_t; + +#define IOREQ_BUFFER_SLOT_NUM 80 +struct buffered_iopage { + unsigned long read_pointer; + unsigned long write_pointer; + ioreq_t ioreq[IOREQ_BUFFER_SLOT_NUM]; +}; /* sizeof this structure must be in one page */ +typedef struct buffered_iopage buffered_iopage_t; #endif /* _IOREQ_H_ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/io/netif.h --- a/include/xen/interface/io/netif.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/io/netif.h Tue Sep 05 17:55:43 2006 -0500 @@ -13,10 +13,22 @@ #include "../grant_table.h" /* - * Note that there is *never* any need to notify the backend when - * enqueuing receive requests (struct netif_rx_request). Notifications - * after enqueuing any other type of message should be conditional on + * Notifications after enqueuing any type of message should be conditional on * the appropriate req_event or rsp_event field in the shared ring. + * If the client sends notification for rx requests then it should specify + * feature 'feature-rx-notify' via xenbus. Otherwise the backend will assume + * that it cannot safely queue packets (as it may not be kicked to send them). + */ + +/* + * This is the 'wire' format for packets: + * Request 1: netif_tx_request -- NETTXF_* (any flags) + * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) + * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) + * Request 4: netif_tx_request -- NETTXF_more_data + * Request 5: netif_tx_request -- NETTXF_more_data + * ... + * Request N: netif_tx_request -- 0 */ /* Protocol checksum field is blank in the packet (hardware offload)? */ @@ -27,9 +39,13 @@ #define _NETTXF_data_validated (1) #define NETTXF_data_validated (1U<<_NETTXF_data_validated) -/* Packet continues in the request. */ +/* Packet continues in the next request descriptor. */ #define _NETTXF_more_data (2) #define NETTXF_more_data (1U<<_NETTXF_more_data) + +/* Packet to be followed by extra descriptor(s). */ +#define _NETTXF_extra_info (3) +#define NETTXF_extra_info (1U<<_NETTXF_extra_info) struct netif_tx_request { grant_ref_t gref; /* Reference to buffer page */ @@ -39,6 +55,54 @@ struct netif_tx_request { uint16_t size; /* Packet size in bytes. */ }; typedef struct netif_tx_request netif_tx_request_t; + +/* Types of netif_extra_info descriptors. */ +#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ +#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ +#define XEN_NETIF_EXTRA_TYPE_MAX (2) + +/* netif_extra_info flags. */ +#define _XEN_NETIF_EXTRA_FLAG_MORE (0) +#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) + +/* GSO types - only TCPv4 currently supported. */ +#define XEN_NETIF_GSO_TYPE_TCPV4 (1) + +/* + * This structure needs to fit within both netif_tx_request and + * netif_rx_response for compatibility. + */ +struct netif_extra_info { + uint8_t type; /* XEN_NETIF_EXTRA_TYPE_* */ + uint8_t flags; /* XEN_NETIF_EXTRA_FLAG_* */ + + union { + struct { + /* + * Maximum payload size of each segment. For example, for TCP this + * is just the path MSS. + */ + uint16_t size; + + /* + * GSO type. This determines the protocol of the packet and any + * extra features required to segment the packet properly. + */ + uint8_t type; /* XEN_NETIF_GSO_TYPE_* */ + + /* Future expansion. */ + uint8_t pad; + + /* + * GSO features. This specifies any extra GSO features required + * to process this packet, such as ECN support for TCPv4. + */ + uint16_t features; /* XEN_NETIF_GSO_FEAT_* */ + } gso; + + uint16_t pad[3]; + } u; +}; struct netif_tx_response { uint16_t id; @@ -60,6 +124,14 @@ typedef struct netif_rx_request netif_rx #define _NETRXF_csum_blank (1) #define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) +/* Packet continues in the next request descriptor. */ +#define _NETRXF_more_data (2) +#define NETRXF_more_data (1U<<_NETRXF_more_data) + +/* Packet to be followed by extra descriptor(s). */ +#define _NETRXF_extra_info (3) +#define NETRXF_extra_info (1U<<_NETRXF_extra_info) + struct netif_rx_response { uint16_t id; uint16_t offset; /* Offset in page of start of received packet */ @@ -78,6 +150,8 @@ DEFINE_RING_TYPES(netif_rx, struct netif #define NETIF_RSP_DROPPED -2 #define NETIF_RSP_ERROR -1 #define NETIF_RSP_OKAY 0 +/* No response: used for auxiliary requests (e.g., netif_tx_extra). */ +#define NETIF_RSP_NULL 1 #endif diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/memory.h --- a/include/xen/interface/memory.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/memory.h Tue Sep 05 17:55:43 2006 -0500 @@ -32,7 +32,7 @@ struct xen_memory_reservation { XEN_GUEST_HANDLE(xen_pfn_t) extent_start; /* Number of extents, and size/alignment of each (2^extent_order pages). */ - unsigned long nr_extents; + xen_ulong_t nr_extents; unsigned int extent_order; /* @@ -90,7 +90,7 @@ struct xen_memory_exchange { * command will be non-zero. * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER! */ - unsigned long nr_exchanged; + xen_ulong_t nr_exchanged; }; typedef struct xen_memory_exchange xen_memory_exchange_t; DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t); @@ -148,8 +148,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn */ #define XENMEM_machphys_mapping 12 struct xen_machphys_mapping { - unsigned long v_start, v_end; /* Start and end virtual addresses. */ - unsigned long max_mfn; /* Maximum MFN that can be looked up. */ + xen_ulong_t v_start, v_end; /* Start and end virtual addresses. */ + xen_ulong_t max_mfn; /* Maximum MFN that can be looked up. */ }; typedef struct xen_machphys_mapping xen_machphys_mapping_t; DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t); @@ -170,7 +170,7 @@ struct xen_add_to_physmap { unsigned int space; /* Index into source mapping space. */ - unsigned long idx; + xen_ulong_t idx; /* GPFN where the source mapping page should appear. */ xen_pfn_t gpfn; @@ -188,7 +188,7 @@ struct xen_translate_gpfn_list { domid_t domid; /* Length of list. */ - unsigned long nr_gpfns; + xen_ulong_t nr_gpfns; /* List of GPFNs to translate. */ XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list; diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/trace.h --- a/include/xen/interface/trace.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/trace.h Tue Sep 05 17:55:43 2006 -0500 @@ -26,6 +26,7 @@ #define TRC_VMXIO 0x00088000 /* VMX io emulation trace */ /* Trace events per class */ +#define TRC_LOST_RECORDS (TRC_GEN + 1) #define TRC_SCHED_DOM_ADD (TRC_SCHED + 1) #define TRC_SCHED_DOM_REM (TRC_SCHED + 2) diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/version.h --- a/include/xen/interface/version.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/version.h Tue Sep 05 17:55:43 2006 -0500 @@ -10,7 +10,7 @@ #ifndef __XEN_PUBLIC_VERSION_H__ #define __XEN_PUBLIC_VERSION_H__ -/* NB. All ops return zero on success, except XENVER_version. */ +/* NB. All ops return zero on success, except XENVER_{version,pagesize} */ /* arg == NULL; returns major:minor (16:16). */ #define XENVER_version 0 @@ -57,6 +57,9 @@ typedef struct xen_feature_info xen_feat /* arg == NULL; returns host memory page size. */ #define XENVER_pagesize 7 +/* arg == xen_domain_handle_t. */ +#define XENVER_guest_handle 8 + #endif /* __XEN_PUBLIC_VERSION_H__ */ /* diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/xen-compat.h --- a/include/xen/interface/xen-compat.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/xen-compat.h Tue Sep 05 17:55:43 2006 -0500 @@ -9,7 +9,7 @@ #ifndef __XEN_PUBLIC_XEN_COMPAT_H__ #define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030202 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030204 #if defined(__XEN__) || defined(__XEN_TOOLS__) /* Xen is built with matching headers and implements the latest interface. */ @@ -23,25 +23,4 @@ #error "These header files do not support the requested interface version." #endif -/* New sched_op hypercall introduced in 0x00030101. */ -#if __XEN_INTERFACE_VERSION__ < 0x00030101 -#undef __HYPERVISOR_sched_op -#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat -#endif - -/* Structural guest handles introduced in 0x00030201. */ -#if __XEN_INTERFACE_VERSION__ < 0x00030201 -#undef __DEFINE_XEN_GUEST_HANDLE -#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name -#endif - -/* New event-channel and physdev hypercalls introduced in 0x00030202. */ -#if __XEN_INTERFACE_VERSION__ < 0x00030202 -#undef __HYPERVISOR_event_channel_op -#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat -#undef __HYPERVISOR_physdev_op -#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat -#endif - #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/xen.h --- a/include/xen/interface/xen.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/xen.h Tue Sep 05 17:55:43 2006 -0500 @@ -8,6 +8,8 @@ #ifndef __XEN_PUBLIC_XEN_H__ #define __XEN_PUBLIC_XEN_H__ + +#include "xen-compat.h" #if defined(__i386__) #include "arch-x86_32.h" @@ -15,24 +17,16 @@ #include "arch-x86_64.h" #elif defined(__ia64__) #include "arch-ia64.h" -#elif defined(__PPC64__) -#include "arch-ppc64.h" +#elif defined(__powerpc__) +#include "arch-powerpc.h" #else #error "Unsupported architecture" #endif /* - * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). - */ - -/* - * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. - * EAX = return value - * (argument registers may be clobbered on return) - * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6. - * RAX = return value - * (argument registers not clobbered on return; RCX, R11 are) - */ + * HYPERCALLS + */ + #define __HYPERVISOR_set_trap_table 0 #define __HYPERVISOR_mmu_update 1 #define __HYPERVISOR_set_gdt 2 @@ -40,7 +34,7 @@ #define __HYPERVISOR_set_callbacks 4 #define __HYPERVISOR_fpu_taskswitch 5 #define __HYPERVISOR_sched_op_compat 6 /* compat since 0x00030101 */ -#define __HYPERVISOR_dom0_op 7 +#define __HYPERVISOR_platform_op 7 #define __HYPERVISOR_set_debugreg 8 #define __HYPERVISOR_get_debugreg 9 #define __HYPERVISOR_update_descriptor 10 @@ -66,6 +60,10 @@ #define __HYPERVISOR_xenoprof_op 31 #define __HYPERVISOR_event_channel_op 32 #define __HYPERVISOR_physdev_op 33 +#define __HYPERVISOR_hvm_op 34 +#define __HYPERVISOR_sysctl 35 +#define __HYPERVISOR_domctl 36 +#define __HYPERVISOR_kexec_op 37 /* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48 @@ -76,6 +74,29 @@ #define __HYPERVISOR_arch_5 53 #define __HYPERVISOR_arch_6 54 #define __HYPERVISOR_arch_7 55 + +/* + * HYPERCALL COMPATIBILITY. + */ + +/* New sched_op hypercall introduced in 0x00030101. */ +#if __XEN_INTERFACE_VERSION__ < 0x00030101 +#undef __HYPERVISOR_sched_op +#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat +#endif + +/* New event-channel and physdev hypercalls introduced in 0x00030202. */ +#if __XEN_INTERFACE_VERSION__ < 0x00030202 +#undef __HYPERVISOR_event_channel_op +#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat +#undef __HYPERVISOR_physdev_op +#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat +#endif + +/* New platform_op hypercall introduced in 0x00030204. */ +#if __XEN_INTERFACE_VERSION__ < 0x00030204 +#define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op +#endif /* * VIRTUAL INTERRUPTS @@ -375,7 +396,11 @@ typedef struct vcpu_info vcpu_info_t; /* * Xen/kernel shared data -- pointer provided in start_info. - * NB. We expect that this struct is smaller than a page. + * + * This structure is defined to be both smaller than a page, and the + * only data on the shared page, but may vary in actual size even within + * compatible Xen versions; guests should not rely on the size + * of this structure remaining constant. */ struct shared_info { struct vcpu_info vcpu_info[MAX_VIRT_CPUS]; @@ -461,8 +486,16 @@ struct start_info { uint32_t flags; /* SIF_xxx flags. */ xen_pfn_t store_mfn; /* MACHINE page number of shared page. */ uint32_t store_evtchn; /* Event channel for store communication. */ - xen_pfn_t console_mfn; /* MACHINE page number of console page. */ - uint32_t console_evtchn; /* Event channel for console messages. */ + union { + struct { + xen_pfn_t mfn; /* MACHINE page number of console page. */ + uint32_t evtchn; /* Event channel for console page. */ + } domU; + struct { + uint32_t info_off; /* Offset of console_info struct. */ + uint32_t info_size; /* Size of console_info struct from start.*/ + } dom0; + } console; /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */ unsigned long pt_base; /* VIRTUAL address of page directory. */ unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */ @@ -473,11 +506,37 @@ struct start_info { }; typedef struct start_info start_info_t; +/* New console union for dom0 introduced in 0x00030203. */ +#if __XEN_INTERFACE_VERSION__ < 0x00030203 +#define console_mfn console.domU.mfn +#define console_evtchn console.domU.evtchn +#endif + /* These flags are passed in the 'flags' field of start_info_t. */ #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */ #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */ -typedef uint64_t cpumap_t; +typedef struct dom0_vga_console_info { + uint8_t video_type; + uint8_t txt_points; + uint16_t txt_mode; + uint16_t txt_x; + uint16_t txt_y; + uint16_t video_width; + uint16_t video_height; + uint16_t lfb_linelen; + uint16_t lfb_depth; + unsigned long lfb_base; + unsigned long lfb_size; + uint8_t red_pos; + uint8_t red_size; + uint8_t green_pos; + uint8_t green_size; + uint8_t blue_pos; + uint8_t blue_size; + uint8_t rsvd_pos; + uint8_t rsvd_size; +} dom0_vga_console_info_t; typedef uint8_t xen_domain_handle_t[16]; @@ -485,14 +544,17 @@ typedef uint8_t xen_domain_handle_t[16]; #define __mk_unsigned_long(x) x ## UL #define mk_unsigned_long(x) __mk_unsigned_long(x) +DEFINE_XEN_GUEST_HANDLE(uint8_t); +DEFINE_XEN_GUEST_HANDLE(uint16_t); +DEFINE_XEN_GUEST_HANDLE(uint32_t); +DEFINE_XEN_GUEST_HANDLE(uint64_t); + #else /* __ASSEMBLY__ */ /* In assembly code we cannot use C numeric constant suffixes. */ #define mk_unsigned_long(x) x #endif /* !__ASSEMBLY__ */ - -#include "xen-compat.h" #endif /* __XEN_PUBLIC_XEN_H__ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/xencomm.h --- a/include/xen/interface/xencomm.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/xencomm.h Tue Sep 05 17:55:43 2006 -0500 @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _XENCOMM_H_ -#define _XENCOMM_H_ +#ifndef _XEN_XENCOMM_H_ +#define _XEN_XENCOMM_H_ /* A xencomm descriptor is a scatter/gather list containing physical * addresses corresponding to a virtually contiguous memory area. The @@ -34,4 +34,4 @@ struct xencomm_desc { uint64_t address[0]; }; -#endif +#endif /* _XEN_XENCOMM_H_ */ diff -r 199b457c4325 -r e5b6c025d4d2 include/xen/interface/xenoprof.h --- a/include/xen/interface/xenoprof.h Mon Aug 28 18:43:52 2006 -0500 +++ b/include/xen/interface/xenoprof.h Tue Sep 05 17:55:43 2006 -0500 @@ -80,6 +80,15 @@ typedef struct xenoprof_counter xenoprof typedef struct xenoprof_counter xenoprof_counter_t; DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t); +typedef struct xenoprof_passive { + uint16_t domain_id; + int32_t max_samples; + int32_t nbuf; + int32_t bufsize; + uint64_t buf_maddr; +} xenoprof_passive_t; +DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t); + #endif /* __XEN_PUBLIC_XENOPROF_H__ */ _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ppc-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |