Date: Fri, 14 Jun 2013 23:43:45 +0000 (UTC) From: "Justin T. Gibbs" <gibbs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251767 - in head/sys: amd64/include/xen i386/include/xen xen xen/interface xen/interface/arch-arm/hvm xen/interface/arch-ia64 xen/interface/arch-ia64/hvm xen/interface/arch-x86 xen/int... Message-ID: <201306142343.r5ENhjC0025604@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gibbs Date: Fri Jun 14 23:43:44 2013 New Revision: 251767 URL: http://svnweb.freebsd.org/changeset/base/251767 Log: Upgrade Xen interface headers to Xen 4.2.1. Move FreeBSD from interface version 0x00030204 to 0x00030208. Updates are required to our grant table implementation before we can bump this further. sys/xen/hvm.h: Replace the implementation of hvm_get_parameter(), formerly located in sys/xen/interface/hvm/params.h. Linux has a similar file which primarily stores this function. sys/xen/xenstore/xenstore.c: Include new xen/hvm.h header file to get hvm_get_parameter(). sys/amd64/include/xen/xen-os.h: sys/i386/include/xen/xen-os.h: Correctly protect function definition and variables from being included into assembly files in xen-os.h Xen memory barriers are now prefixed with "xen_" to avoid conflicts with OS native primatives. Define Xen memory barriers in terms of the native FreeBSD primatives. Sponsored by: Spectra Logic Corporation Reviewed by: Roger Pau Monné Tested by: Roger Pau Monné Obtained from: Roger Pau Monné (bug fixes) Added: head/sys/xen/hvm.h (contents, props changed) head/sys/xen/interface/arch-arm.h (contents, props changed) head/sys/xen/interface/arch-arm/hvm/save.h (contents, props changed) head/sys/xen/interface/arch-ia64/debug_op.h (contents, props changed) head/sys/xen/interface/arch-ia64/hvm/memmap.h (contents, props changed) head/sys/xen/interface/arch-ia64/hvm/save.h (contents, props changed) head/sys/xen/interface/arch-ia64/sioemu.h (contents, props changed) head/sys/xen/interface/io/fsif.h (contents, props changed) head/sys/xen/interface/io/libxenvchan.h (contents, props changed) head/sys/xen/interface/io/usbif.h (contents, props changed) head/sys/xen/interface/io/vscsiif.h (contents, props changed) head/sys/xen/interface/mem_event.h (contents, props changed) head/sys/xen/interface/tmem.h (contents, props changed) head/sys/xen/interface/xsm/flask_op.h (contents, props changed) Directory Properties: head/sys/xen/interface/arch-arm/ (props changed) head/sys/xen/interface/arch-arm/hvm/ (props changed) head/sys/xen/interface/arch-ia64/ (props changed) head/sys/xen/interface/arch-ia64/hvm/ (props changed) head/sys/xen/interface/xsm/ (props changed) Deleted: head/sys/xen/interface/hvm/vmx_assist.h Modified: head/sys/amd64/include/xen/xen-os.h head/sys/i386/include/xen/xen-os.h head/sys/xen/interface/arch-ia64.h (contents, props changed) head/sys/xen/interface/arch-x86/cpuid.h (contents, props changed) head/sys/xen/interface/arch-x86/hvm/save.h (contents, props changed) head/sys/xen/interface/arch-x86/xen-mca.h (contents, props changed) head/sys/xen/interface/arch-x86/xen-x86_32.h (contents, props changed) head/sys/xen/interface/arch-x86/xen-x86_64.h (contents, props changed) head/sys/xen/interface/arch-x86/xen.h (contents, props changed) head/sys/xen/interface/arch-x86_32.h (contents, props changed) head/sys/xen/interface/arch-x86_64.h (contents, props changed) head/sys/xen/interface/domctl.h (contents, props changed) head/sys/xen/interface/elfnote.h (contents, props changed) head/sys/xen/interface/event_channel.h (contents, props changed) head/sys/xen/interface/features.h (contents, props changed) head/sys/xen/interface/grant_table.h (contents, props changed) head/sys/xen/interface/hvm/hvm_info_table.h (contents, props changed) head/sys/xen/interface/hvm/hvm_op.h (contents, props changed) head/sys/xen/interface/hvm/ioreq.h (contents, props changed) head/sys/xen/interface/hvm/params.h (contents, props changed) head/sys/xen/interface/hvm/save.h (contents, props changed) head/sys/xen/interface/io/blkif.h (contents, props changed) head/sys/xen/interface/io/netif.h (contents, props changed) head/sys/xen/interface/io/pciif.h (contents, props changed) head/sys/xen/interface/io/protocols.h (contents, props changed) head/sys/xen/interface/io/ring.h (contents, props changed) head/sys/xen/interface/io/xs_wire.h (contents, props changed) head/sys/xen/interface/kexec.h (contents, props changed) head/sys/xen/interface/memory.h (contents, props changed) head/sys/xen/interface/nmi.h (contents, props changed) head/sys/xen/interface/physdev.h (contents, props changed) head/sys/xen/interface/platform.h (contents, props changed) head/sys/xen/interface/sched.h (contents, props changed) head/sys/xen/interface/sysctl.h (contents, props changed) head/sys/xen/interface/trace.h (contents, props changed) head/sys/xen/interface/vcpu.h (contents, props changed) head/sys/xen/interface/version.h (contents, props changed) head/sys/xen/interface/xen-compat.h (contents, props changed) head/sys/xen/interface/xen.h (contents, props changed) head/sys/xen/interface/xenoprof.h (contents, props changed) head/sys/xen/xenstore/xenstore.c Directory Properties: head/sys/xen/interface/ (props changed) head/sys/xen/interface/COPYING (props changed) head/sys/xen/interface/acm.h (props changed) head/sys/xen/interface/acm_ops.h (props changed) head/sys/xen/interface/arch-powerpc.h (props changed) head/sys/xen/interface/arch-x86/ (props changed) head/sys/xen/interface/arch-x86/hvm/ (props changed) head/sys/xen/interface/callback.h (props changed) head/sys/xen/interface/dom0_ops.h (props changed) head/sys/xen/interface/elfstructs.h (props changed) head/sys/xen/interface/foreign/ (props changed) head/sys/xen/interface/foreign/Makefile (props changed) head/sys/xen/interface/foreign/mkchecker.py (props changed) head/sys/xen/interface/foreign/mkheader.py (props changed) head/sys/xen/interface/foreign/reference.size (props changed) head/sys/xen/interface/foreign/structs.py (props changed) head/sys/xen/interface/hvm/ (props changed) head/sys/xen/interface/hvm/e820.h (props changed) head/sys/xen/interface/io/ (props changed) head/sys/xen/interface/io/console.h (props changed) head/sys/xen/interface/io/fbif.h (props changed) head/sys/xen/interface/io/kbdif.h (props changed) head/sys/xen/interface/io/tpmif.h (props changed) head/sys/xen/interface/io/xenbus.h (props changed) head/sys/xen/interface/libelf.h (props changed) head/sys/xen/interface/xencomm.h (props changed) Modified: head/sys/amd64/include/xen/xen-os.h ============================================================================== --- head/sys/amd64/include/xen/xen-os.h Fri Jun 14 23:04:31 2013 (r251766) +++ head/sys/amd64/include/xen/xen-os.h Fri Jun 14 23:43:44 2013 (r251767) @@ -13,16 +13,21 @@ #define CONFIG_X86_PAE #endif +#ifdef LOCORE +#define __ASSEMBLY__ +#endif + #if !defined(__XEN_INTERFACE_VERSION__) -/* - * Can update to a more recent version when we implement - * the hypercall page - */ -#define __XEN_INTERFACE_VERSION__ 0x00030204 +#define __XEN_INTERFACE_VERSION__ 0x00030208 #endif +#define GRANT_REF_INVALID 0xffffffff + #include <xen/interface/xen.h> +/* Everything below this point is not included by assembler (.S) files. */ +#ifndef __ASSEMBLY__ + /* Force a proper event-channel callback from Xen. */ void force_evtchn_callback(void); @@ -43,10 +48,6 @@ static inline void rep_nop(void) void *bootmem_alloc(unsigned int size); void bootmem_free(void *ptr, unsigned int size); - -/* Everything below this point is not included by assembler (.S) files. */ -#ifndef __ASSEMBLY__ - void printk(const char *fmt, ...); /* some function prototypes */ @@ -128,14 +129,14 @@ do { #else #endif -#ifndef mb -#define mb() __asm__ __volatile__("mfence":::"memory") +#ifndef xen_mb +#define xen_mb() mb() #endif -#ifndef rmb -#define rmb() __asm__ __volatile__("lfence":::"memory"); +#ifndef xen_rmb +#define xen_rmb() rmb() #endif -#ifndef wmb -#define wmb() barrier() +#ifndef xen_wmb +#define xen_wmb() wmb() #endif #ifdef SMP #define smp_mb() mb() Modified: head/sys/i386/include/xen/xen-os.h ============================================================================== --- head/sys/i386/include/xen/xen-os.h Fri Jun 14 23:04:31 2013 (r251766) +++ head/sys/i386/include/xen/xen-os.h Fri Jun 14 23:43:44 2013 (r251767) @@ -12,16 +12,21 @@ #define CONFIG_X86_PAE #endif +#ifdef LOCORE +#define __ASSEMBLY__ +#endif + #if !defined(__XEN_INTERFACE_VERSION__) -/* - * Can update to a more recent version when we implement - * the hypercall page - */ -#define __XEN_INTERFACE_VERSION__ 0x00030204 +#define __XEN_INTERFACE_VERSION__ 0x00030208 #endif +#define GRANT_REF_INVALID 0xffffffff + #include <xen/interface/xen.h> +/* Everything below this point is not included by assembler (.S) files. */ +#ifndef __ASSEMBLY__ + /* Force a proper event-channel callback from Xen. */ void force_evtchn_callback(void); @@ -85,9 +90,6 @@ static inline void rep_nop(void) void *bootmem_alloc(unsigned int size); void bootmem_free(void *ptr, unsigned int size); - -/* Everything below this point is not included by assembler (.S) files. */ -#ifndef __ASSEMBLY__ #include <sys/types.h> void printk(const char *fmt, ...); @@ -168,6 +170,15 @@ do { #endif +#ifndef xen_mb +#define xen_mb() mb() +#endif +#ifndef xen_rmb +#define xen_rmb() rmb() +#endif +#ifndef xen_wmb +#define xen_wmb() wmb() +#endif #ifdef SMP #define smp_mb() mb() #define smp_rmb() rmb() Added: head/sys/xen/hvm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/hvm.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,94 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __XEN_HVM_H__ +#define __XEN_HVM_H__ + +#include <xen/interface/hvm/params.h> + +/** + * \brief Wrapper function to obtain a HVM parameter value. + * + * \param index HVM parameter index; see <xen/interface/hvm/params.h>. + * + * \returns 0 on failure; the value of the parameter otherwise. + */ +static inline unsigned long +hvm_get_parameter(int index) +{ + struct xen_hvm_param xhv; + int error; + + xhv.domid = DOMID_SELF; + xhv.index = index; + error = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); + if (error) { + printf("%s: error %d trying to get %d\n", __func__, + error, index); + return (0); + } + return (xhv.value); +} + +/** The callback method types for Hypervisor event delivery to our domain. */ +enum { + HVM_CB_TYPE_GSI, + HVM_CB_TYPE_PCI_INTX, + HVM_CB_TYPE_VECTOR, + HVM_CB_TYPE_MASK = 0xFF, + HVM_CB_TYPE_SHIFT = 56 +}; + +/** Format for specifying a GSI type callback. */ +enum { + HVM_CB_GSI_GSI_MASK = 0xFFFFFFFF, + HVM_CB_GSI_GSI_SHIFT = 0 +}; +#define HVM_CALLBACK_GSI(gsi) \ + (((uint64_t)HVM_CB_TYPE_GSI << HVM_CB_TYPE_SHIFT) \ + | ((gsi) & HVM_CB_GSI_GSI_MASK) << HVM_CB_GSI_GSI_SHIFT) + +/** Format for specifying a virtual PCI interrupt line GSI style callback. */ +enum { + HVM_CB_PCI_INTX_INTPIN_MASK = 0x3, + HVM_CB_PCI_INTX_INTPIN_SHIFT = 0, + HVM_CB_PCI_INTX_SLOT_MASK = 0x1F, + HVM_CB_PCI_INTX_SLOT_SHIFT = 11, +}; +#define HVM_CALLBACK_PCI_INTX(slot, pin) \ + (((uint64_t)HVM_CB_TYPE_PCI_INTX << HVM_CB_TYPE_SHIFT) \ + | (((slot) & HVM_CB_PCI_INTX_SLOT_MASK) << HVM_CB_PCI_INTX_SLOT_SHIFT) \ + | (((pin) & HVM_CB_PCI_INTX_INTPIN_MASK) << HVM_CB_PCI_INTX_INTPIN_SHIFT)) + +/** Format for specifying a direct IDT vector injection style callback. */ +enum { + HVM_CB_VECTOR_VECTOR_MASK = 0xFFFFFFFF, + HVM_CB_VECTOR_VECTOR_SHIFT = 0 +}; +#define HVM_CALLBACK_VECTOR(vector) \ + (((uint64_t)HVM_CB_TYPE_VECTOR << HVM_CB_TYPE_SHIFT) \ + | (((vector) & HVM_CB_GSI_GSI_MASK) << HVM_CB_GSI_GSI_SHIFT)) + +void xen_hvm_set_callback(device_t); +void xen_hvm_suspend(void); +void xen_hvm_resume(void); +#endif /* __XEN_HVM_H__ */ Added: head/sys/xen/interface/arch-arm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-arm.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,176 @@ +/****************************************************************************** + * arch-arm.h + * + * Guest OS interface to ARM Xen. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright 2011 (C) Citrix Systems + */ + +#ifndef __XEN_PUBLIC_ARCH_ARM_H__ +#define __XEN_PUBLIC_ARCH_ARM_H__ + +/* hypercall calling convention + * ---------------------------- + * + * A hypercall is issued using the ARM HVC instruction. + * + * A hypercall can take up to 5 arguments. These are passed in + * registers, the first argument in r0, the second argument in r1, the + * third in r2, the forth in r3 and the fifth in r4. + * + * The hypercall number is passed in r12. + * + * The HVC ISS must contain a Xen specific TAG: XEN_HYPERCALL_TAG. + * + * The return value is in r0. + * + * The hypercall will clobber r12 and the argument registers used by + * that hypercall (except r0 which is the return value) i.e. a 2 + * argument hypercall will clobber r1 and a 4 argument hypercall will + * clobber r1, r2 and r3. + * + */ + +#define XEN_HYPERCALL_TAG 0XEA1 + + +#ifndef __ASSEMBLY__ +#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef struct { type *p; } __guest_handle_ ## name + +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ + ___DEFINE_XEN_GUEST_HANDLE(name, type); \ + ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) +#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name +#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name) +#define set_xen_guest_handle_raw(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 +#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) + +struct cpu_user_regs +{ + uint32_t r0; + uint32_t r1; + uint32_t r2; + uint32_t r3; + uint32_t r4; + uint32_t r5; + uint32_t r6; + uint32_t r7; + uint32_t r8; + uint32_t r9; + uint32_t r10; + union { + uint32_t r11; + uint32_t fp; + }; + uint32_t r12; + + uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */ + + /* r14 - LR: is the same physical register as LR_usr */ + union { + uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */ + uint32_t lr_usr; + }; + + uint32_t pc; /* Return IP */ + uint32_t cpsr; /* Return mode */ + uint32_t pad0; /* Doubleword-align the kernel half of the frame */ + + /* Outer guest frame only from here on... */ + + uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq; + + uint32_t sp_usr; /* LR_usr is the same register as LR, see above */ + + uint32_t sp_svc, sp_abt, sp_und, sp_irq, sp_fiq; + uint32_t lr_svc, lr_abt, lr_und, lr_irq, lr_fiq; + + uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq; + + uint32_t pad1; /* Doubleword-align the user half of the frame */ +}; +typedef struct cpu_user_regs cpu_user_regs_t; +DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t); + +typedef uint64_t xen_pfn_t; +#define PRI_xen_pfn PRIx64 + +/* Maximum number of virtual CPUs in legacy multi-processor guests. */ +/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */ +#define XEN_LEGACY_MAX_VCPUS 1 + +typedef uint32_t xen_ulong_t; + +struct vcpu_guest_context { + struct cpu_user_regs user_regs; /* User-level CPU registers */ + + uint32_t sctlr; + uint32_t ttbr0, ttbr1, ttbcr; +}; +typedef struct vcpu_guest_context vcpu_guest_context_t; +DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); + +struct arch_vcpu_info { }; +typedef struct arch_vcpu_info arch_vcpu_info_t; + +struct arch_shared_info { }; +typedef struct arch_shared_info arch_shared_info_t; +typedef uint64_t xen_callback_t; + +#endif /* ifndef __ASSEMBLY __ */ + +/* PSR bits (CPSR, SPSR)*/ + +/* 0-4: Mode */ +#define PSR_MODE_MASK 0x1f +#define PSR_MODE_USR 0x10 +#define PSR_MODE_FIQ 0x11 +#define PSR_MODE_IRQ 0x12 +#define PSR_MODE_SVC 0x13 +#define PSR_MODE_MON 0x16 +#define PSR_MODE_ABT 0x17 +#define PSR_MODE_HYP 0x1a +#define PSR_MODE_UND 0x1b +#define PSR_MODE_SYS 0x1f + +#define PSR_THUMB (1<<5) /* Thumb Mode enable */ +#define PSR_FIQ_MASK (1<<6) /* Fast Interrupt mask */ +#define PSR_IRQ_MASK (1<<7) /* Interrupt mask */ +#define PSR_ABT_MASK (1<<8) /* Asynchronous Abort mask */ +#define PSR_BIG_ENDIAN (1<<9) /* Big Endian Mode */ +#define PSR_JAZELLE (1<<24) /* Jazelle Mode */ + +#endif /* __XEN_PUBLIC_ARCH_ARM_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ Added: head/sys/xen/interface/arch-arm/hvm/save.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-arm/hvm/save.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,39 @@ +/* + * Structure definitions for HVM state that is held by Xen and must + * be saved along with the domain's memory and device-model state. + * + * Copyright (c) 2012 Citrix Systems Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XEN_PUBLIC_HVM_SAVE_ARM_H__ +#define __XEN_PUBLIC_HVM_SAVE_ARM_H__ + +#endif + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ Modified: head/sys/xen/interface/arch-ia64.h ============================================================================== --- head/sys/xen/interface/arch-ia64.h Fri Jun 14 23:04:31 2013 (r251766) +++ head/sys/xen/interface/arch-ia64.h Fri Jun 14 23:43:44 2013 (r251767) @@ -49,10 +49,11 @@ #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name #define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name) #define uint64_aligned_t uint64_t -#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) +#define set_xen_guest_handle_raw(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 +#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) #ifndef __ASSEMBLY__ typedef unsigned long xen_pfn_t; @@ -66,7 +67,7 @@ typedef unsigned long xen_pfn_t; /* Maximum number of virtual CPUs in multi-processor guests. */ /* WARNING: before changing this, check that shared_info fits on a page */ -#define MAX_VIRT_CPUS 64 +#define XEN_LEGACY_MAX_VCPUS 64 /* IO ports location for PV. */ #define IO_PORTS_PADDR 0x00000ffffc000000UL @@ -198,6 +199,15 @@ struct mapped_regs { unsigned long rrs[8]; // region registers unsigned long krs[8]; // kernel registers unsigned long tmp[16]; // temp registers (e.g. for hyperprivops) + + /* itc paravirtualization + * vAR.ITC = mAR.ITC + itc_offset + * itc_last is one which was lastly passed to + * the guest OS in order to prevent it from + * going backwords. + */ + unsigned long itc_offset; + unsigned long itc_last; }; }; }; @@ -392,6 +402,7 @@ struct vcpu_guest_context { #define VGCF_EXTRA_REGS (1UL << 1) /* Set extra regs. */ #define VGCF_SET_CR_IRR (1UL << 2) /* Set cr_irr[0:3]. */ #define VGCF_online (1UL << 3) /* make this vcpu online */ +#define VGCF_SET_AR_ITC (1UL << 4) /* set pv ar.itc. itc_offset, itc_last */ unsigned long flags; /* VGCF_* flags */ struct vcpu_guest_context_regs regs; @@ -453,6 +464,11 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte /* unexpose the foreign domain's p2m table into privileged domain */ #define IA64_DOM0VP_unexpose_foreign_p2m 13 +/* get memmap_info and memmap. It is possible to map the page directly + by foreign page mapping, but there is a race between writer. + This hypercall avoids such race. */ +#define IA64_DOM0VP_get_memmap 14 + // flags for page assignement to pseudo physical address space #define _ASSIGN_readonly 0 #define ASSIGN_readonly (1UL << _ASSIGN_readonly) Added: head/sys/xen/interface/arch-ia64/debug_op.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-ia64/debug_op.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,99 @@ +/****************************************************************************** + * debug_op.h + * + * Copyright (c) 2007 Tristan Gingold <tgingold@free.fr> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XEN_PUBLIC_IA64_DEBUG_OP_H__ +#define __XEN_PUBLIC_IA64_DEBUG_OP_H__ + +/* Set/Get extra conditions to break. */ +#define XEN_IA64_DEBUG_OP_SET_FLAGS 1 +#define XEN_IA64_DEBUG_OP_GET_FLAGS 2 + +/* Break on kernel single step. */ +#define XEN_IA64_DEBUG_ON_KERN_SSTEP (1 << 0) + +/* Break on kernel debug (breakpoint or watch point). */ +#define XEN_IA64_DEBUG_ON_KERN_DEBUG (1 << 1) + +/* Break on kernel taken branch. */ +#define XEN_IA64_DEBUG_ON_KERN_TBRANCH (1 << 2) + +/* Break on interrupt injection. */ +#define XEN_IA64_DEBUG_ON_EXTINT (1 << 3) + +/* Break on interrupt injection. */ +#define XEN_IA64_DEBUG_ON_EXCEPT (1 << 4) + +/* Break on event injection. */ +#define XEN_IA64_DEBUG_ON_EVENT (1 << 5) + +/* Break on privop/virtualized instruction (slow path only). */ +#define XEN_IA64_DEBUG_ON_PRIVOP (1 << 6) + +/* Break on emulated PAL call (at entry). */ +#define XEN_IA64_DEBUG_ON_PAL (1 << 7) + +/* Break on emulated SAL call (at entry). */ +#define XEN_IA64_DEBUG_ON_SAL (1 << 8) + +/* Break on emulated EFI call (at entry). */ +#define XEN_IA64_DEBUG_ON_EFI (1 << 9) + +/* Break on rfi emulation (slow path only, before exec). */ +#define XEN_IA64_DEBUG_ON_RFI (1 << 10) + +/* Break on address translation switch. */ +#define XEN_IA64_DEBUG_ON_MMU (1 << 11) + +/* Break on bad guest physical address. */ +#define XEN_IA64_DEBUG_ON_BAD_MPA (1 << 12) + +/* Force psr.ss bit. */ +#define XEN_IA64_DEBUG_FORCE_SS (1 << 13) + +/* Force psr.db bit. */ +#define XEN_IA64_DEBUG_FORCE_DB (1 << 14) + +/* Break on ITR/PTR. */ +#define XEN_IA64_DEBUG_ON_TR (1 << 15) + +/* Break on ITC/PTC.L/PTC.G/PTC.GA. */ +#define XEN_IA64_DEBUG_ON_TC (1 << 16) + +/* Get translation cache. */ +#define XEN_IA64_DEBUG_OP_GET_TC 3 + +/* Translate virtual address to guest physical address. */ +#define XEN_IA64_DEBUG_OP_TRANSLATE 4 + +union xen_ia64_debug_op { + uint64_t flags; + struct xen_ia64_debug_vtlb { + uint64_t nbr; /* IN/OUT */ + XEN_GUEST_HANDLE_64(ia64_tr_entry_t) tr; /* IN/OUT */ + } vtlb; +}; +typedef union xen_ia64_debug_op xen_ia64_debug_op_t; +DEFINE_XEN_GUEST_HANDLE(xen_ia64_debug_op_t); + +#endif /* __XEN_PUBLIC_IA64_DEBUG_OP_H__ */ Added: head/sys/xen/interface/arch-ia64/hvm/memmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-ia64/hvm/memmap.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,91 @@ +/****************************************************************************** + * memmap.h + * + * Copyright (c) 2008 Tristan Gingold <tgingold AT free fr> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ +#define __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ + +#define MEM_G (1UL << 30) +#define MEM_M (1UL << 20) +#define MEM_K (1UL << 10) + +/* Guest physical address of IO ports space. */ +#define MMIO_START (3 * MEM_G) +#define MMIO_SIZE (512 * MEM_M) + +#define VGA_IO_START 0xA0000UL +#define VGA_IO_SIZE 0x20000 + +#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) +#define LEGACY_IO_SIZE (64 * MEM_M) + +#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) +#define IO_PAGE_SIZE XEN_PAGE_SIZE + +#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) +#define STORE_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) +#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) +#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE + +#define IO_SAPIC_START 0xfec00000UL +#define IO_SAPIC_SIZE 0x100000 + +#define PIB_START 0xfee00000UL +#define PIB_SIZE 0x200000 + +#define GFW_START (4 * MEM_G - 16 * MEM_M) +#define GFW_SIZE (16 * MEM_M) + +/* domVTI */ +#define GPFN_FRAME_BUFFER 0x1 /* VGA framebuffer */ +#define GPFN_LOW_MMIO 0x2 /* Low MMIO range */ +#define GPFN_PIB 0x3 /* PIB base */ +#define GPFN_IOSAPIC 0x4 /* IOSAPIC base */ +#define GPFN_LEGACY_IO 0x5 /* Legacy I/O base */ +#define GPFN_HIGH_MMIO 0x6 /* High MMIO range */ + +/* Nvram belongs to GFW memory space */ +#define NVRAM_SIZE (MEM_K * 64) +#define NVRAM_START (GFW_START + 10 * MEM_M) + +#define NVRAM_VALID_SIG 0x4650494e45584948 /* "HIXENIPF" */ +struct nvram_save_addr { + unsigned long addr; + unsigned long signature; +}; + +#endif /* __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ Added: head/sys/xen/interface/arch-ia64/hvm/save.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-ia64/hvm/save.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,208 @@ +/****************************************************************************** + * save_types.h + * + * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp> + * VA Linux Systems Japan K.K. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XEN_PUBLIC_HVM_SAVE_IA64_H__ +#define __XEN_PUBLIC_HVM_SAVE_IA64_H__ + +#include "../../hvm/save.h" +#include "../../arch-ia64.h" + +/* + * Save/restore header: general info about the save file. + */ + +/* x86 uses 0x54381286 */ +#define HVM_FILE_MAGIC 0x343641492f6e6558UL /* "Xen/IA64" */ +#define HVM_FILE_VERSION 0x0000000000000001UL + +struct hvm_save_header { + uint64_t magic; /* Must be HVM_FILE_MAGIC */ + uint64_t version; /* File format version */ + uint64_t changeset; /* Version of Xen that saved this file */ + uint64_t cpuid[5]; /* CPUID[0x01][%eax] on the saving machine */ +}; + +DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); + +/* + * CPU + */ +struct hvm_hw_ia64_cpu { + uint64_t ipsr; +}; +DECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_ia64_cpu); + +/* + * CPU + */ +struct hvm_hw_ia64_vpd { + struct vpd vpd; +}; +DECLARE_HVM_SAVE_TYPE(VPD, 3, struct hvm_hw_ia64_vpd); + +/* + * device dependency + * vacpi => viosapic => vlsapic + */ +/* + * vlsapic + */ +struct hvm_hw_ia64_vlsapic { + uint64_t insvc[4]; + uint64_t vhpi; // ??? should this be saved in vpd + uint8_t xtp; + uint8_t pal_init_pending; + uint8_t pad[2]; +}; +DECLARE_HVM_SAVE_TYPE(VLSAPIC, 4, struct hvm_hw_ia64_vlsapic); +/* set + * unconditionaly set v->arch.irq_new_peding = 1 + * unconditionaly set v->arch.irq_new_condition = 0 + */ + +/* + * vtime + */ +/* itc, itm, itv are saved by arch vcpu context */ +struct hvm_hw_ia64_vtime { + uint64_t itc; + uint64_t itm; + + uint64_t last_itc; + uint64_t pending; +}; +DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime); +/* + * calculate v->vtm.vtm_offset + * ??? Or should vtm_offset be set by leave_hypervisor_tail()? + * start vtm_timer if necessary by vtm_set_itm(). + * ??? Or should vtm_timer be set by leave_hypervisor_tail()? + * + * ??? or should be done by schedule_tail() + * => schedule_tail() should do. + */ + +/* + * viosapic + */ +#define VIOSAPIC_NUM_PINS 48 + +/* To share VT-d code which uses vioapic_redir_entry. + * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry + * instead of viosapic_redir_entry. + */ +union vioapic_redir_entry +{ + uint64_t bits; + struct { + uint8_t vector; + + uint8_t delivery_mode : 3; + uint8_t reserve1 : 1; + uint8_t delivery_status: 1; + uint8_t polarity : 1; + uint8_t reserve2 : 1; + uint8_t trig_mode : 1; + + uint8_t mask : 1; + uint8_t reserve3 : 7; + + uint8_t reserved[3]; + uint16_t dest_id; + } fields; +}; + +struct hvm_hw_ia64_viosapic { + uint64_t irr; + uint64_t isr; + uint32_t ioregsel; + uint32_t pad; + uint64_t lowest_vcpu_id; + uint64_t base_address; + union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; +}; +DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic); + +/* + * vacpi + * PM timer + */ +struct vacpi_regs { + union { + struct { + uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */ + uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */ + }; + uint32_t evt_blk; + }; + uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */ +}; + +struct hvm_hw_ia64_vacpi { + struct vacpi_regs regs; +}; +DECLARE_HVM_SAVE_TYPE(VACPI, 7, struct hvm_hw_ia64_vacpi); +/* update last_gtime and setup timer of struct vacpi */ + +/* + * opt_feature: identity mapping of region 4, 5 and 7. + * With the c/s 16396:d2935f9c217f of xen-ia64-devel.hg, + * opt_feature hypercall supports only region 4,5,7 identity mappings. + * structure hvm_hw_ia64_identity_mappings only supports them. + * The new structure, struct hvm_hw_ia64_identity_mappings, is created to + * avoid to keep up with change of the xen/ia64 internal structure, struct + * opt_feature. + * + * If it is enhanced in the future, new structure will be created. + */ +struct hvm_hw_ia64_identity_mapping { + uint64_t on; /* on/off */ + uint64_t pgprot; /* The page protection bit mask of the pte. */ + uint64_t key; /* A protection key. */ +}; + +struct hvm_hw_ia64_identity_mappings { + struct hvm_hw_ia64_identity_mapping im_reg4;/* Region 4 identity mapping */ + struct hvm_hw_ia64_identity_mapping im_reg5;/* Region 5 identity mapping */ + struct hvm_hw_ia64_identity_mapping im_reg7;/* Region 7 identity mapping */ +}; +DECLARE_HVM_SAVE_TYPE(OPT_FEATURE_IDENTITY_MAPPINGS, 8, struct hvm_hw_ia64_identity_mappings); + +/* + * Largest type-code in use + */ +#define HVM_SAVE_CODE_MAX 8 + +#endif /* __XEN_PUBLIC_HVM_SAVE_IA64_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ Added: head/sys/xen/interface/arch-ia64/sioemu.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/interface/arch-ia64/sioemu.h Fri Jun 14 23:43:44 2013 (r251767) @@ -0,0 +1,92 @@ +/****************************************************************************** + * sioemu.h + * + * Copyright (c) 2008 Tristan Gingold <tgingold@free.fr> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XEN_PUBLIC_IA64_SIOEMU_H__ +#define __XEN_PUBLIC_IA64_SIOEMU_H__ + +/* SIOEMU specific hypercalls. + The numbers are the minor part of FW_HYPERCALL_SIOEMU. */ + +/* Defines the callback entry point. r8=ip, r9=data. + Must be called per-vcpu. */ +#define SIOEMU_HYPERCALL_SET_CALLBACK 0x01 + +/* Finish sioemu fw initialization and start firmware. r8=ip. */ +#define SIOEMU_HYPERCALL_START_FW 0x02 + +/* Add IO pages in physmap. */ +#define SIOEMU_HYPERCALL_ADD_IO_PHYSMAP 0x03 + +/* Get wallclock time. */ +#define SIOEMU_HYPERCALL_GET_TIME 0x04 + +/* Flush cache. */ +#define SIOEMU_HYPERCALL_FLUSH_CACHE 0x07 + +/* Get freq base. */ +#define SIOEMU_HYPERCALL_FREQ_BASE 0x08 + +/* Return from callback. */ +#define SIOEMU_HYPERCALL_CALLBACK_RETURN 0x09 + +/* Deliver an interrupt. */ +#define SIOEMU_HYPERCALL_DELIVER_INT 0x0a + +/* SIOEMU callback reason. */ + +/* An event (from event channel) has to be delivered. */ +#define SIOEMU_CB_EVENT 0x00 + +/* Emulate an IO access. */ +#define SIOEMU_CB_IO_EMULATE 0x01 + +/* An IPI is sent to a dead vcpu. */ +#define SIOEMU_CB_WAKEUP_VCPU 0x02 + +/* A SAL hypercall is executed. */ +#define SIOEMU_CB_SAL_ASSIST 0x03 + +#ifndef __ASSEMBLY__ +struct sioemu_callback_info { + /* Saved registers. */ + unsigned long ip; + unsigned long psr; + unsigned long ifs; + unsigned long nats; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + + /* Callback parameters. */ + unsigned long cause; + unsigned long arg0; + unsigned long arg1; + unsigned long arg2; + unsigned long arg3; + unsigned long _pad2[2]; + unsigned long r2; +}; +#endif /* __ASSEMBLY__ */ +#endif /* __XEN_PUBLIC_IA64_SIOEMU_H__ */ Modified: head/sys/xen/interface/arch-x86/cpuid.h ============================================================================== --- head/sys/xen/interface/arch-x86/cpuid.h Fri Jun 14 23:04:31 2013 (r251766) +++ head/sys/xen/interface/arch-x86/cpuid.h Fri Jun 14 23:43:44 2013 (r251767) @@ -24,7 +24,7 @@ * Copyright (c) 2007 Citrix Systems, Inc. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306142343.r5ENhjC0025604>