[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] Update Xen public headers
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1328890307 -3600 # Node ID 7c89207af621ff8293f9b64c046eb70a8f85ef75 # Parent ddb83aec5afc6f7980aaae2497a5b171c1549eff Update Xen public headers Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-arm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/xen/interface/arch-arm.h Fri Feb 10 17:11:47 2012 +0100 @@ -0,0 +1,125 @@ +/****************************************************************************** + * 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__ + +#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) */ + uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as 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, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq; + uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq; + + uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq; +}; +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 */ + union { + uint32_t reg[16]; + struct { + uint32_t __pad[12]; + uint32_t sp; /* r13 */ + uint32_t lr; /* r14 */ + uint32_t pc; /* r15 */ + }; + }; +}; +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; +#endif + +#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: + */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/hvm/save.h --- a/include/xen/interface/arch-x86/hvm/save.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/arch-x86/hvm/save.h Fri Feb 10 17:11:47 2012 +0100 @@ -344,12 +344,7 @@ * IO-APIC */ -#ifdef __ia64__ -#define VIOAPIC_IS_IOSAPIC 1 -#define VIOAPIC_NUM_PINS 24 -#else #define VIOAPIC_NUM_PINS 48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */ -#endif struct hvm_hw_vioapic { uint64_t base_address; @@ -368,13 +363,8 @@ uint8_t trig_mode:1; uint8_t mask:1; uint8_t reserve:7; -#if !VIOAPIC_IS_IOSAPIC uint8_t reserved[4]; uint8_t dest_id; -#else - uint8_t reserved[3]; - uint16_t dest_id; -#endif } fields; } redirtbl[VIOAPIC_NUM_PINS]; }; @@ -564,7 +554,7 @@ struct { char x[0]; } ymm; /* YMM */ } save_area; -} __attribute__((packed)); +}; #define CPU_XSAVE_CODE 16 diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/xen.h --- a/include/xen/interface/arch-x86/xen.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/arch-x86/xen.h Fri Feb 10 17:11:47 2012 +0100 @@ -82,7 +82,13 @@ typedef unsigned long xen_ulong_t; /* + * ` enum neg_errnoval + * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]); + * ` + */ +/* * Send an array of these to HYPERVISOR_set_trap_table(). + * Terminate the array with a sentinel entry, with traps[].address==0. * The privilege level specifies which modes may enter a trap via a software * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate * privilege levels as follows: diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/domctl.h --- a/include/xen/interface/domctl.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/domctl.h Fri Feb 10 17:11:47 2012 +0100 @@ -742,8 +742,12 @@ uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */ uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */ - /* OP_ENABLE */ - uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */ + union { + /* OP_ENABLE IN: Virtual address of shared page */ + uint64_aligned_t shared_addr; + /* PAGING_PREP IN: buffer to immediately fill page in */ + uint64_aligned_t buffer; + } u; uint64_aligned_t ring_addr; /* IN: Virtual address of ring page */ /* Other OPs */ @@ -767,10 +771,24 @@ #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN 5 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN 6 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF 7 +#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP 8 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID (-10) #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID (-9) +/* The following allows sharing of grant refs. This is useful + * for sharing utilities sitting as "filters" in IO backends + * (e.g. memshr + blktap(2)). The IO backend is only exposed + * to grant references, and this allows sharing of the grefs */ +#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG (1ULL << 62) + +#define XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(field, val) \ + (field) = (XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG | val) +#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(field) \ + ((field) & XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG) +#define XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(field) \ + ((field) & (~XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG)) + struct xen_domctl_mem_sharing_op { uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */ @@ -784,8 +802,11 @@ } u; uint64_aligned_t handle; /* OUT: the handle */ } nominate; - struct mem_sharing_op_share { /* OP_SHARE */ + struct mem_sharing_op_share { /* OP_SHARE/ADD_PHYSMAP */ + uint64_aligned_t source_gfn; /* IN: the gfn of the source page */ uint64_aligned_t source_handle; /* IN: handle to the source page */ + domid_t client_domain; /* IN: the client domain id */ + uint64_aligned_t client_gfn; /* IN: the client gfn */ uint64_aligned_t client_handle; /* IN: handle to the client page */ } share; struct mem_sharing_op_debug { /* OP_DEBUG_xxx */ @@ -800,6 +821,21 @@ typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_sharing_op_t); +struct xen_domctl_audit_p2m { + /* OUT error counts */ + uint64_t orphans; + uint64_t m2p_bad; + uint64_t p2m_bad; +}; +typedef struct xen_domctl_audit_p2m xen_domctl_audit_p2m_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_audit_p2m_t); + +struct xen_domctl_set_virq_handler { + uint32_t virq; /* IN */ +}; +typedef struct xen_domctl_set_virq_handler xen_domctl_set_virq_handler_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_virq_handler_t); + #if defined(__i386__) || defined(__x86_64__) /* XEN_DOMCTL_setvcpuextstate */ /* XEN_DOMCTL_getvcpuextstate */ @@ -898,6 +934,8 @@ #define XEN_DOMCTL_setvcpuextstate 62 #define XEN_DOMCTL_getvcpuextstate 63 #define XEN_DOMCTL_set_access_required 64 +#define XEN_DOMCTL_audit_p2m 65 +#define XEN_DOMCTL_set_virq_handler 66 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -951,6 +989,8 @@ struct xen_domctl_vcpuextstate vcpuextstate; #endif struct xen_domctl_set_access_required access_required; + struct xen_domctl_audit_p2m audit_p2m; + struct xen_domctl_set_virq_handler set_virq_handler; struct xen_domctl_gdbsx_memio gdbsx_guest_memio; struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu; struct xen_domctl_gdbsx_domstatus gdbsx_domstatus; diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/grant_table.h --- a/include/xen/interface/grant_table.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/grant_table.h Fri Feb 10 17:11:47 2012 +0100 @@ -117,6 +117,13 @@ }; typedef struct grant_entry_v1 grant_entry_v1_t; +/* The first few grant table entries will be preserved across grant table + * version changes and may be pre-populated at domain creation by tools. + */ +#define GNTTAB_NR_RESERVED_ENTRIES 8 +#define GNTTAB_RESERVED_CONSOLE 0 +#define GNTTAB_RESERVED_XENSTORE 1 + /* * Type of grant entry. * GTF_invalid: This grant entry grants no privileges. @@ -511,6 +518,20 @@ typedef struct gnttab_get_version gnttab_get_version_t; DEFINE_XEN_GUEST_HANDLE(gnttab_get_version_t); +/* + * GNTTABOP_swap_grant_ref: Swap the contents of two grant entries. + */ +#define GNTTABOP_swap_grant_ref 11 +struct gnttab_swap_grant_ref { + /* IN parameters */ + grant_ref_t ref_a; + grant_ref_t ref_b; + /* OUT parameters */ + int16_t status; /* GNTST_* */ +}; +typedef struct gnttab_swap_grant_ref gnttab_swap_grant_ref_t; +DEFINE_XEN_GUEST_HANDLE(gnttab_swap_grant_ref_t); + #endif /* __XEN_INTERFACE_VERSION__ */ /* @@ -566,7 +587,7 @@ #define GNTST_bad_page (-9) /* Specified page was invalid for op. */ #define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */ #define GNTST_address_too_big (-11) /* transfer page address too large. */ -#define GNTST_eagain (-12) /* Could not map at the moment. Retry. */ +#define GNTST_eagain (-12) /* Operation not done; try again. */ #define GNTTABOP_error_msgs { \ "okay", \ @@ -581,7 +602,7 @@ "bad page", \ "copy arguments cross page boundary", \ "page address size too large", \ - "could not map at the moment, retry" \ + "operation not done; try again" \ } #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_info_table.h --- a/include/xen/interface/hvm/hvm_info_table.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/hvm/hvm_info_table.h Fri Feb 10 17:11:47 2012 +0100 @@ -37,9 +37,6 @@ uint32_t length; uint8_t checksum; - /* Should firmware build ACPI tables? */ - uint8_t acpi_enabled; - /* Should firmware build APIC descriptors (APIC MADT / MP BIOS)? */ uint8_t apic_mode; diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_op.h --- a/include/xen/interface/hvm/hvm_op.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/hvm/hvm_op.h Fri Feb 10 17:11:47 2012 +0100 @@ -174,6 +174,9 @@ HVMMEM_access_rwx, HVMMEM_access_rx2rw, /* Page starts off as r-x, but automatically * change to r-w on a write */ + HVMMEM_access_n2rwx, /* Log access: starts off as n, automatically + * goes to rwx, generating an event without + * pausing the vcpu */ HVMMEM_access_default /* Take the domain default */ } hvmmem_access_t; /* Notify that a region of memory is to have specific access types */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/params.h --- a/include/xen/interface/hvm/params.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/hvm/params.h Fri Feb 10 17:11:47 2012 +0100 @@ -52,6 +52,7 @@ #define HVM_PARAM_IOREQ_PFN 5 #define HVM_PARAM_BUFIOREQ_PFN 6 +#define HVM_PARAM_BUFIOREQ_EVTCHN 26 #ifdef __ia64__ @@ -141,6 +142,6 @@ /* Boolean: Enable nestedhvm (hvm only) */ #define HVM_PARAM_NESTEDHVM 24 -#define HVM_NR_PARAMS 26 +#define HVM_NR_PARAMS 27 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/mem_event.h --- a/include/xen/interface/mem_event.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/mem_event.h Fri Feb 10 17:11:47 2012 +0100 @@ -39,6 +39,8 @@ #define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0) #define MEM_EVENT_FLAG_DROP_PAGE (1 << 1) #define MEM_EVENT_FLAG_EVICT_FAIL (1 << 2) +#define MEM_EVENT_FLAG_FOREIGN (1 << 3) +#define MEM_EVENT_FLAG_DUMMY (1 << 4) /* Reasons for the memory event request */ #define MEM_EVENT_REASON_UNKNOWN 0 /* typical reason */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/memory.h --- a/include/xen/interface/memory.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/memory.h Fri Feb 10 17:11:47 2012 +0100 @@ -208,10 +208,14 @@ /* Which domain to change the mapping for. */ domid_t domid; + /* Number of pages to go through for gmfn_range */ + uint16_t size; + /* Source mapping space. */ #define XENMAPSPACE_shared_info 0 /* shared info page */ #define XENMAPSPACE_grant_table 1 /* grant table page */ #define XENMAPSPACE_gmfn 2 /* GMFN */ +#define XENMAPSPACE_gmfn_range 3 /* GMFN range */ unsigned int space; #define XENMAPIDX_grant_table_status 0x80000000 @@ -225,6 +229,22 @@ typedef struct xen_add_to_physmap xen_add_to_physmap_t; DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t); +/* + * Unmaps the page appearing at a particular GPFN from the specified guest's + * pseudophysical address space. + * arg == addr of xen_remove_from_physmap_t. + */ +#define XENMEM_remove_from_physmap 15 +struct xen_remove_from_physmap { + /* Which domain to change the mapping for. */ + domid_t domid; + + /* GPFN of the current mapping of the page. */ + xen_pfn_t gpfn; +}; +typedef struct xen_remove_from_physmap xen_remove_from_physmap_t; +DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t); + /*** REMOVED ***/ /*#define XENMEM_translate_gpfn_list 8*/ @@ -290,6 +310,7 @@ * The call never fails. */ #define XENMEM_get_sharing_freed_pages 18 +#define XENMEM_get_sharing_shared_pages 19 #endif /* __XEN_PUBLIC_MEMORY_H__ */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/physdev.h Fri Feb 10 17:11:47 2012 +0100 @@ -49,7 +49,15 @@ * will automatically get unmasked. The page registered is used as a bit * array indexed by Xen's PIRQ value. */ -#define PHYSDEVOP_pirq_eoi_gmfn 17 +#define PHYSDEVOP_pirq_eoi_gmfn_v1 17 +/* + * Register a shared page for the hypervisor to indicate whether the + * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to + * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of + * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by + * Xen's PIRQ value. + */ +#define PHYSDEVOP_pirq_eoi_gmfn_v2 28 struct physdev_pirq_eoi_gmfn { /* IN */ xen_pfn_t gmfn; @@ -325,6 +333,12 @@ #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi #define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared +#if __XEN_INTERFACE_VERSION__ < 0x00040200 +#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1 +#else +#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2 +#endif + #endif /* __XEN_PUBLIC_PHYSDEV_H__ */ /* diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/platform.h --- a/include/xen/interface/platform.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/platform.h Fri Feb 10 17:11:47 2012 +0100 @@ -449,6 +449,21 @@ typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t; DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t); +#define XENPF_get_cpu_version 48 +struct xenpf_pcpu_version { + /* IN */ + uint32_t xen_cpuid; + /* OUT */ + /* The maxium cpu_id that is present */ + uint32_t max_present; + char vendor_id[12]; + uint32_t family; + uint32_t model; + uint32_t stepping; +}; +typedef struct xenpf_pcpu_version xenpf_pcpu_version_t; +DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t); + #define XENPF_cpu_online 56 #define XENPF_cpu_offline 57 struct xenpf_cpu_ol @@ -492,6 +507,7 @@ struct xenpf_getidletime getidletime; struct xenpf_set_processor_pminfo set_pminfo; struct xenpf_pcpuinfo pcpu_info; + struct xenpf_pcpu_version pcpu_version; struct xenpf_cpu_ol cpu_ol; struct xenpf_cpu_hotadd cpu_add; struct xenpf_mem_hotadd mem_add; diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/trace.h --- a/include/xen/interface/trace.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/trace.h Fri Feb 10 17:11:47 2012 +0100 @@ -164,6 +164,10 @@ #define TRC_HVM_RDTSC (TRC_HVM_HANDLER + 0x1a) #define TRC_HVM_INTR_WINDOW (TRC_HVM_HANDLER + 0x20) #define TRC_HVM_NPF (TRC_HVM_HANDLER + 0x21) +#define TRC_HVM_REALMODE_EMULATE (TRC_HVM_HANDLER + 0x22) +#define TRC_HVM_TRAP (TRC_HVM_HANDLER + 0x23) +#define TRC_HVM_TRAP_DEBUG (TRC_HVM_HANDLER + 0x24) +#define TRC_HVM_VLAPIC (TRC_HVM_HANDLER + 0x25) #define TRC_HVM_IOPORT_WRITE (TRC_HVM_HANDLER + 0x216) #define TRC_HVM_IOMEM_WRITE (TRC_HVM_HANDLER + 0x217) diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen-compat.h --- a/include/xen/interface/xen-compat.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/xen-compat.h Fri Feb 10 17:11:47 2012 +0100 @@ -27,7 +27,7 @@ #ifndef __XEN_PUBLIC_XEN_COMPAT_H__ #define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200 #if defined(__XEN__) || defined(__XEN_TOOLS__) /* Xen is built with matching headers and implements the latest interface. */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen.h --- a/include/xen/interface/xen.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/xen.h Fri Feb 10 17:11:47 2012 +0100 @@ -33,6 +33,8 @@ #include "arch-x86/xen.h" #elif defined(__ia64__) #include "arch-ia64.h" +#elif defined(__arm__) +#include "arch-arm.h" #else #error "Unsupported architecture" #endif @@ -55,6 +57,10 @@ * HYPERCALLS */ +/* `incontents 100 hcalls List of hypercalls + * ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*() + */ + #define __HYPERVISOR_set_trap_table 0 #define __HYPERVISOR_mmu_update 1 #define __HYPERVISOR_set_gdt 2 @@ -105,6 +111,8 @@ #define __HYPERVISOR_arch_6 54 #define __HYPERVISOR_arch_7 55 +/* ` } */ + /* * HYPERCALL COMPATIBILITY. */ @@ -163,8 +171,11 @@ #define NR_VIRQS 24 /* - * HYPERVISOR_mmu_update(reqs, count, pdone, foreigndom) - * + * ` enum neg_errnoval + * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[], + * ` unsigned count, unsigned *done_out, + * ` unsigned foreigndom) + * ` * @reqs is an array of mmu_update_t structures ((ptr, val) pairs). * @count is the length of the above array. * @pdone is an output parameter indicating number of completed operations @@ -187,6 +198,40 @@ * FD == DOMID_XEN: Map restricted areas of Xen's heap space. * ptr[:2] -- Machine address of the page-table entry to modify. * val -- Value to write. + * + * There also certain implicit requirements when using this hypercall. The + * pages that make up a pagetable must be mapped read-only in the guest. + * This prevents uncontrolled guest updates to the pagetable. Xen strictly + * enforces this, and will disallow any pagetable update which will end up + * mapping pagetable page RW, and will disallow using any writable page as a + * pagetable. In practice it means that when constructing a page table for a + * process, thread, etc, we MUST be very dilligient in following these rules: + * 1). Start with top-level page (PGD or in Xen language: L4). Fill out + * the entries. + * 2). Keep on going, filling out the upper (PUD or L3), and middle (PMD + * or L2). + * 3). Start filling out the PTE table (L1) with the PTE entries. Once + * done, make sure to set each of those entries to RO (so writeable bit + * is unset). Once that has been completed, set the PMD (L2) for this + * PTE table as RO. + * 4). When completed with all of the PMD (L2) entries, and all of them have + * been set to RO, make sure to set RO the PUD (L3). Do the same + * operation on PGD (L4) pagetable entries that have a PUD (L3) entry. + * 5). Now before you can use those pages (so setting the cr3), you MUST also + * pin them so that the hypervisor can verify the entries. This is done + * via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame + * number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op( + * MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be + * issued. + * For 32-bit guests, the L4 is not used (as there is less pagetables), so + * instead use L3. + * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE + * hypercall. Also if so desired the OS can also try to write to the PTE + * and be trapped by the hypervisor (as the PTE entry is RO). + * + * To deallocate the pages, the operations are the reverse of the steps + * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the + * pagetable MUST not be in use (meaning that the cr3 is not set to it). * * ptr[1:0] == MMU_MACHPHYS_UPDATE: * Updates an entry in the machine->pseudo-physical mapping table. @@ -197,6 +242,72 @@ * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD: * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed * with those in @val. + * + * @val is usually the machine frame number along with some attributes. + * The attributes by default follow the architecture defined bits. Meaning that + * if this is a X86_64 machine and four page table layout is used, the layout + * of val is: + * - 63 if set means No execute (NX) + * - 46-13 the machine frame number + * - 12 available for guest + * - 11 available for guest + * - 10 available for guest + * - 9 available for guest + * - 8 global + * - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages) + * - 6 dirty + * - 5 accessed + * - 4 page cached disabled + * - 3 page write through + * - 2 userspace accessible + * - 1 writeable + * - 0 present + * + * The one bits that does not fit with the default layout is the PAGE_PSE + * also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the + * HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB + * (or 2MB) instead of using the PAGE_PSE bit. + * + * The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen + * using it as the Page Attribute Table (PAT) bit - for details on it please + * refer to Intel SDM 10.12. The PAT allows to set the caching attributes of + * pages instead of using MTRRs. + * + * The PAT MSR is as follow (it is a 64-bit value, each entry is 8 bits): + * PAT4 PAT0 + * +---+----+----+----+-----+----+----+ + * WC | WC | WB | UC | UC- | WC | WB | <= Linux + * +---+----+----+----+-----+----+----+ + * WC | WT | WB | UC | UC- | WT | WB | <= BIOS (default when machine boots) + * +---+----+----+----+-----+----+----+ + * WC | WP | WC | UC | UC- | WT | WB | <= Xen + * +---+----+----+----+-----+----+----+ + * + * The lookup of this index table translates to looking up + * Bit 7, Bit 4, and Bit 3 of val entry: + * + * PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3). + * + * If all bits are off, then we are using PAT0. If bit 3 turned on, + * then we are using PAT1, if bit 3 and bit 4, then PAT2.. + * + * As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means + * that if a guest that follows Linux's PAT setup and would like to set Write + * Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is + * set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the + * caching as: + * + * WB = none (so PAT0) + * WC = PWT (bit 3 on) + * UC = PWT | PCD (bit 3 and 4 are on). + * + * To make it work with Xen, it needs to translate the WC bit as so: + * + * PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3 + * + * And to translate back it would: + * + * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7. */ #define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ #define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xenoprof.h --- a/include/xen/interface/xenoprof.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/xenoprof.h Fri Feb 10 17:11:47 2012 +0100 @@ -68,7 +68,7 @@ }; /* PC value that indicates a special code */ -#define XENOPROF_ESCAPE_CODE ~0UL +#define XENOPROF_ESCAPE_CODE (~0ULL) /* Transient events for the xenoprof->oprofile cpu buf */ #define XENOPROF_TRACE_BEGIN 1 diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xsm/flask_op.h --- a/include/xen/interface/xsm/flask_op.h Wed Feb 01 13:59:04 2012 +0100 +++ b/include/xen/interface/xsm/flask_op.h Fri Feb 10 17:11:47 2012 +0100 @@ -25,6 +25,118 @@ #ifndef __FLASK_OP_H__ #define __FLASK_OP_H__ +#define XEN_FLASK_INTERFACE_VERSION 1 + +struct xen_flask_load { + XEN_GUEST_HANDLE(char) buffer; + uint32_t size; +}; + +struct xen_flask_setenforce { + uint32_t enforcing; +}; + +struct xen_flask_sid_context { + /* IN/OUT: sid to convert to/from string */ + uint32_t sid; + /* IN: size of the context buffer + * OUT: actual size of the output context string + */ + uint32_t size; + XEN_GUEST_HANDLE(char) context; +}; + +struct xen_flask_access { + /* IN: access request */ + uint32_t ssid; + uint32_t tsid; + uint32_t tclass; + uint32_t req; + /* OUT: AVC data */ + uint32_t allowed; + uint32_t audit_allow; + uint32_t audit_deny; + uint32_t seqno; +}; + +struct xen_flask_transition { + /* IN: transition SIDs and class */ + uint32_t ssid; + uint32_t tsid; + uint32_t tclass; + /* OUT: new SID */ + uint32_t newsid; +}; + +struct xen_flask_userlist { + /* IN: starting SID for list */ + uint32_t start_sid; + /* IN: size of user string and output buffer + * OUT: number of SIDs returned */ + uint32_t size; + union { + /* IN: user to enumerate SIDs */ + XEN_GUEST_HANDLE(char) user; + /* OUT: SID list */ + XEN_GUEST_HANDLE(uint32) sids; + } u; +}; + +struct xen_flask_boolean { + /* IN/OUT: numeric identifier for boolean [GET/SET] + * If -1, name will be used and bool_id will be filled in. */ + uint32_t bool_id; + /* OUT: current enforcing value of boolean [GET/SET] */ + uint8_t enforcing; + /* OUT: pending value of boolean [GET/SET] */ + uint8_t pending; + /* IN: new value of boolean [SET] */ + uint8_t new_value; + /* IN: commit new value instead of only setting pending [SET] */ + uint8_t commit; + /* IN: size of boolean name buffer [GET/SET] + * OUT: actual size of name [GET only] */ + uint32_t size; + /* IN: if bool_id is -1, used to find boolean [GET/SET] + * OUT: textual name of boolean [GET only] + */ + XEN_GUEST_HANDLE(char) name; +}; + +struct xen_flask_setavc_threshold { + /* IN */ + uint32_t threshold; +}; + +struct xen_flask_hash_stats { + /* OUT */ + uint32_t entries; + uint32_t buckets_used; + uint32_t buckets_total; + uint32_t max_chain_len; +}; + +struct xen_flask_cache_stats { + /* IN */ + uint32_t cpu; + /* OUT */ + uint32_t lookups; + uint32_t hits; + uint32_t misses; + uint32_t allocations; + uint32_t reclaims; + uint32_t frees; +}; + +struct xen_flask_ocontext { + /* IN */ + uint32_t ocon; + uint32_t sid; + uint64_t low, high; +}; + +struct xen_flask_op { + uint32_t cmd; #define FLASK_LOAD 1 #define FLASK_GETENFORCE 2 #define FLASK_SETENFORCE 3 @@ -47,15 +159,26 @@ #define FLASK_MEMBER 20 #define FLASK_ADD_OCONTEXT 21 #define FLASK_DEL_OCONTEXT 22 - -#define FLASK_LAST FLASK_DEL_OCONTEXT - -typedef struct flask_op { - uint32_t cmd; - uint32_t size; - char *buf; -} flask_op_t; - -DEFINE_XEN_GUEST_HANDLE(flask_op_t); + uint32_t interface_version; /* XEN_FLASK_INTERFACE_VERSION */ + union { + struct xen_flask_load load; + struct xen_flask_setenforce enforce; + /* FLASK_CONTEXT_TO_SID and FLASK_SID_TO_CONTEXT */ + struct xen_flask_sid_context sid_context; + struct xen_flask_access access; + /* FLASK_CREATE, FLASK_RELABEL, FLASK_MEMBER */ + struct xen_flask_transition transition; + struct xen_flask_userlist userlist; + /* FLASK_GETBOOL, FLASK_SETBOOL */ + struct xen_flask_boolean boolean; + struct xen_flask_setavc_threshold setavc_threshold; + struct xen_flask_hash_stats hash_stats; + struct xen_flask_cache_stats cache_stats; + /* FLASK_ADD_OCONTEXT, FLASK_DEL_OCONTEXT */ + struct xen_flask_ocontext ocontext; + } u; +}; +typedef struct xen_flask_op xen_flask_op_t; +DEFINE_XEN_GUEST_HANDLE(xen_flask_op_t); #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |