1*20a96506SLiam Merwick /* 2*20a96506SLiam Merwick * Permission is hereby granted, free of charge, to any person obtaining a copy 3*20a96506SLiam Merwick * of this software and associated documentation files (the "Software"), to 4*20a96506SLiam Merwick * deal in the Software without restriction, including without limitation the 5*20a96506SLiam Merwick * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 6*20a96506SLiam Merwick * sell copies of the Software, and to permit persons to whom the Software is 7*20a96506SLiam Merwick * furnished to do so, subject to the following conditions: 8*20a96506SLiam Merwick * 9*20a96506SLiam Merwick * The above copyright notice and this permission notice shall be included in 10*20a96506SLiam Merwick * all copies or substantial portions of the Software. 11*20a96506SLiam Merwick * 12*20a96506SLiam Merwick * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13*20a96506SLiam Merwick * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14*20a96506SLiam Merwick * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15*20a96506SLiam Merwick * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16*20a96506SLiam Merwick * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17*20a96506SLiam Merwick * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18*20a96506SLiam Merwick * DEALINGS IN THE SOFTWARE. 19*20a96506SLiam Merwick * 20*20a96506SLiam Merwick * Copyright (c) 2016, Citrix Systems, Inc. 21*20a96506SLiam Merwick */ 22*20a96506SLiam Merwick 23*20a96506SLiam Merwick #ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ 24*20a96506SLiam Merwick #define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ 25*20a96506SLiam Merwick 26*20a96506SLiam Merwick /* 27*20a96506SLiam Merwick * Start of day structure passed to PVH guests and to HVM guests in %ebx. 28*20a96506SLiam Merwick * 29*20a96506SLiam Merwick * NOTE: nothing will be loaded at physical address 0, so a 0 value in any 30*20a96506SLiam Merwick * of the address fields should be treated as not present. 31*20a96506SLiam Merwick * 32*20a96506SLiam Merwick * 0 +----------------+ 33*20a96506SLiam Merwick * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE 34*20a96506SLiam Merwick * | | ("xEn3" with the 0x80 bit of the "E" set). 35*20a96506SLiam Merwick * 4 +----------------+ 36*20a96506SLiam Merwick * | version | Version of this structure. Current version is 1. New 37*20a96506SLiam Merwick * | | versions are guaranteed to be backwards-compatible. 38*20a96506SLiam Merwick * 8 +----------------+ 39*20a96506SLiam Merwick * | flags | SIF_xxx flags. 40*20a96506SLiam Merwick * 12 +----------------+ 41*20a96506SLiam Merwick * | nr_modules | Number of modules passed to the kernel. 42*20a96506SLiam Merwick * 16 +----------------+ 43*20a96506SLiam Merwick * | modlist_paddr | Physical address of an array of modules 44*20a96506SLiam Merwick * | | (layout of the structure below). 45*20a96506SLiam Merwick * 24 +----------------+ 46*20a96506SLiam Merwick * | cmdline_paddr | Physical address of the command line, 47*20a96506SLiam Merwick * | | a zero-terminated ASCII string. 48*20a96506SLiam Merwick * 32 +----------------+ 49*20a96506SLiam Merwick * | rsdp_paddr | Physical address of the RSDP ACPI data structure. 50*20a96506SLiam Merwick * 40 +----------------+ 51*20a96506SLiam Merwick * | memmap_paddr | Physical address of the (optional) memory map. Only 52*20a96506SLiam Merwick * | | present in version 1 and newer of the structure. 53*20a96506SLiam Merwick * 48 +----------------+ 54*20a96506SLiam Merwick * | memmap_entries | Number of entries in the memory map table. Only 55*20a96506SLiam Merwick * | | present in version 1 and newer of the structure. 56*20a96506SLiam Merwick * | | Zero if there is no memory map being provided. 57*20a96506SLiam Merwick * 52 +----------------+ 58*20a96506SLiam Merwick * | reserved | Version 1 and newer only. 59*20a96506SLiam Merwick * 56 +----------------+ 60*20a96506SLiam Merwick * 61*20a96506SLiam Merwick * The layout of each entry in the module structure is the following: 62*20a96506SLiam Merwick * 63*20a96506SLiam Merwick * 0 +----------------+ 64*20a96506SLiam Merwick * | paddr | Physical address of the module. 65*20a96506SLiam Merwick * 8 +----------------+ 66*20a96506SLiam Merwick * | size | Size of the module in bytes. 67*20a96506SLiam Merwick * 16 +----------------+ 68*20a96506SLiam Merwick * | cmdline_paddr | Physical address of the command line, 69*20a96506SLiam Merwick * | | a zero-terminated ASCII string. 70*20a96506SLiam Merwick * 24 +----------------+ 71*20a96506SLiam Merwick * | reserved | 72*20a96506SLiam Merwick * 32 +----------------+ 73*20a96506SLiam Merwick * 74*20a96506SLiam Merwick * The layout of each entry in the memory map table is as follows: 75*20a96506SLiam Merwick * 76*20a96506SLiam Merwick * 0 +----------------+ 77*20a96506SLiam Merwick * | addr | Base address 78*20a96506SLiam Merwick * 8 +----------------+ 79*20a96506SLiam Merwick * | size | Size of mapping in bytes 80*20a96506SLiam Merwick * 16 +----------------+ 81*20a96506SLiam Merwick * | type | Type of mapping as defined between the hypervisor 82*20a96506SLiam Merwick * | | and guest it's starting. E820_TYPE_xxx, for example. 83*20a96506SLiam Merwick * 20 +----------------| 84*20a96506SLiam Merwick * | reserved | 85*20a96506SLiam Merwick * 24 +----------------+ 86*20a96506SLiam Merwick * 87*20a96506SLiam Merwick * The address and sizes are always a 64bit little endian unsigned integer. 88*20a96506SLiam Merwick * 89*20a96506SLiam Merwick * NB: Xen on x86 will always try to place all the data below the 4GiB 90*20a96506SLiam Merwick * boundary. 91*20a96506SLiam Merwick * 92*20a96506SLiam Merwick * Version numbers of the hvm_start_info structure have evolved like this: 93*20a96506SLiam Merwick * 94*20a96506SLiam Merwick * Version 0: 95*20a96506SLiam Merwick * 96*20a96506SLiam Merwick * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of 97*20a96506SLiam Merwick * padding) to the end of the hvm_start_info struct. These new 98*20a96506SLiam Merwick * fields can be used to pass a memory map to the guest. The 99*20a96506SLiam Merwick * memory map is optional and so guests that understand version 1 100*20a96506SLiam Merwick * of the structure must check that memmap_entries is non-zero 101*20a96506SLiam Merwick * before trying to read the memory map. 102*20a96506SLiam Merwick */ 103*20a96506SLiam Merwick #define XEN_HVM_START_MAGIC_VALUE 0x336ec578 104*20a96506SLiam Merwick 105*20a96506SLiam Merwick /* 106*20a96506SLiam Merwick * C representation of the x86/HVM start info layout. 107*20a96506SLiam Merwick * 108*20a96506SLiam Merwick * The canonical definition of this layout is above, this is just a way to 109*20a96506SLiam Merwick * represent the layout described there using C types. 110*20a96506SLiam Merwick */ 111*20a96506SLiam Merwick struct hvm_start_info { 112*20a96506SLiam Merwick uint32_t magic; /* Contains the magic value 0x336ec578 */ 113*20a96506SLiam Merwick /* ("xEn3" with the 0x80 bit of the "E" set).*/ 114*20a96506SLiam Merwick uint32_t version; /* Version of this structure. */ 115*20a96506SLiam Merwick uint32_t flags; /* SIF_xxx flags. */ 116*20a96506SLiam Merwick uint32_t nr_modules; /* Number of modules passed to the kernel. */ 117*20a96506SLiam Merwick uint64_t modlist_paddr; /* Physical address of an array of */ 118*20a96506SLiam Merwick /* hvm_modlist_entry. */ 119*20a96506SLiam Merwick uint64_t cmdline_paddr; /* Physical address of the command line. */ 120*20a96506SLiam Merwick uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ 121*20a96506SLiam Merwick /* structure. */ 122*20a96506SLiam Merwick uint64_t memmap_paddr; /* Physical address of an array of */ 123*20a96506SLiam Merwick /* hvm_memmap_table_entry. Only present in */ 124*20a96506SLiam Merwick /* version 1 and newer of the structure */ 125*20a96506SLiam Merwick uint32_t memmap_entries; /* Number of entries in the memmap table. */ 126*20a96506SLiam Merwick /* Only present in version 1 and newer of */ 127*20a96506SLiam Merwick /* the structure. Value will be zero if */ 128*20a96506SLiam Merwick /* there is no memory map being provided. */ 129*20a96506SLiam Merwick uint32_t reserved; 130*20a96506SLiam Merwick }; 131*20a96506SLiam Merwick 132*20a96506SLiam Merwick struct hvm_modlist_entry { 133*20a96506SLiam Merwick uint64_t paddr; /* Physical address of the module. */ 134*20a96506SLiam Merwick uint64_t size; /* Size of the module in bytes. */ 135*20a96506SLiam Merwick uint64_t cmdline_paddr; /* Physical address of the command line. */ 136*20a96506SLiam Merwick uint64_t reserved; 137*20a96506SLiam Merwick }; 138*20a96506SLiam Merwick 139*20a96506SLiam Merwick struct hvm_memmap_table_entry { 140*20a96506SLiam Merwick uint64_t addr; /* Base address of the memory region */ 141*20a96506SLiam Merwick uint64_t size; /* Size of the memory region in bytes */ 142*20a96506SLiam Merwick uint32_t type; /* Mapping type */ 143*20a96506SLiam Merwick uint32_t reserved; 144*20a96506SLiam Merwick }; 145*20a96506SLiam Merwick 146*20a96506SLiam Merwick #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */ 147