120a96506SLiam Merwick /* 220a96506SLiam Merwick * Permission is hereby granted, free of charge, to any person obtaining a copy 320a96506SLiam Merwick * of this software and associated documentation files (the "Software"), to 420a96506SLiam Merwick * deal in the Software without restriction, including without limitation the 520a96506SLiam Merwick * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 620a96506SLiam Merwick * sell copies of the Software, and to permit persons to whom the Software is 720a96506SLiam Merwick * furnished to do so, subject to the following conditions: 820a96506SLiam Merwick * 920a96506SLiam Merwick * The above copyright notice and this permission notice shall be included in 1020a96506SLiam Merwick * all copies or substantial portions of the Software. 1120a96506SLiam Merwick * 1220a96506SLiam Merwick * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1320a96506SLiam Merwick * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1420a96506SLiam Merwick * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1520a96506SLiam Merwick * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1620a96506SLiam Merwick * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1720a96506SLiam Merwick * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 1820a96506SLiam Merwick * DEALINGS IN THE SOFTWARE. 1920a96506SLiam Merwick * 2020a96506SLiam Merwick * Copyright (c) 2016, Citrix Systems, Inc. 2120a96506SLiam Merwick */ 2220a96506SLiam Merwick 23*a8b991b5SMarkus Armbruster #ifndef XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H 24*a8b991b5SMarkus Armbruster #define XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H 2520a96506SLiam Merwick 2620a96506SLiam Merwick /* 2720a96506SLiam Merwick * Start of day structure passed to PVH guests and to HVM guests in %ebx. 2820a96506SLiam Merwick * 2920a96506SLiam Merwick * NOTE: nothing will be loaded at physical address 0, so a 0 value in any 3020a96506SLiam Merwick * of the address fields should be treated as not present. 3120a96506SLiam Merwick * 3220a96506SLiam Merwick * 0 +----------------+ 3320a96506SLiam Merwick * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE 3420a96506SLiam Merwick * | | ("xEn3" with the 0x80 bit of the "E" set). 3520a96506SLiam Merwick * 4 +----------------+ 3620a96506SLiam Merwick * | version | Version of this structure. Current version is 1. New 3720a96506SLiam Merwick * | | versions are guaranteed to be backwards-compatible. 3820a96506SLiam Merwick * 8 +----------------+ 3920a96506SLiam Merwick * | flags | SIF_xxx flags. 4020a96506SLiam Merwick * 12 +----------------+ 4120a96506SLiam Merwick * | nr_modules | Number of modules passed to the kernel. 4220a96506SLiam Merwick * 16 +----------------+ 4320a96506SLiam Merwick * | modlist_paddr | Physical address of an array of modules 4420a96506SLiam Merwick * | | (layout of the structure below). 4520a96506SLiam Merwick * 24 +----------------+ 4620a96506SLiam Merwick * | cmdline_paddr | Physical address of the command line, 4720a96506SLiam Merwick * | | a zero-terminated ASCII string. 4820a96506SLiam Merwick * 32 +----------------+ 4920a96506SLiam Merwick * | rsdp_paddr | Physical address of the RSDP ACPI data structure. 5020a96506SLiam Merwick * 40 +----------------+ 5120a96506SLiam Merwick * | memmap_paddr | Physical address of the (optional) memory map. Only 5220a96506SLiam Merwick * | | present in version 1 and newer of the structure. 5320a96506SLiam Merwick * 48 +----------------+ 5420a96506SLiam Merwick * | memmap_entries | Number of entries in the memory map table. Only 5520a96506SLiam Merwick * | | present in version 1 and newer of the structure. 5620a96506SLiam Merwick * | | Zero if there is no memory map being provided. 5720a96506SLiam Merwick * 52 +----------------+ 5820a96506SLiam Merwick * | reserved | Version 1 and newer only. 5920a96506SLiam Merwick * 56 +----------------+ 6020a96506SLiam Merwick * 6120a96506SLiam Merwick * The layout of each entry in the module structure is the following: 6220a96506SLiam Merwick * 6320a96506SLiam Merwick * 0 +----------------+ 6420a96506SLiam Merwick * | paddr | Physical address of the module. 6520a96506SLiam Merwick * 8 +----------------+ 6620a96506SLiam Merwick * | size | Size of the module in bytes. 6720a96506SLiam Merwick * 16 +----------------+ 6820a96506SLiam Merwick * | cmdline_paddr | Physical address of the command line, 6920a96506SLiam Merwick * | | a zero-terminated ASCII string. 7020a96506SLiam Merwick * 24 +----------------+ 7120a96506SLiam Merwick * | reserved | 7220a96506SLiam Merwick * 32 +----------------+ 7320a96506SLiam Merwick * 7420a96506SLiam Merwick * The layout of each entry in the memory map table is as follows: 7520a96506SLiam Merwick * 7620a96506SLiam Merwick * 0 +----------------+ 7720a96506SLiam Merwick * | addr | Base address 7820a96506SLiam Merwick * 8 +----------------+ 7920a96506SLiam Merwick * | size | Size of mapping in bytes 8020a96506SLiam Merwick * 16 +----------------+ 8120a96506SLiam Merwick * | type | Type of mapping as defined between the hypervisor 8220a96506SLiam Merwick * | | and guest it's starting. E820_TYPE_xxx, for example. 8320a96506SLiam Merwick * 20 +----------------| 8420a96506SLiam Merwick * | reserved | 8520a96506SLiam Merwick * 24 +----------------+ 8620a96506SLiam Merwick * 8720a96506SLiam Merwick * The address and sizes are always a 64bit little endian unsigned integer. 8820a96506SLiam Merwick * 8920a96506SLiam Merwick * NB: Xen on x86 will always try to place all the data below the 4GiB 9020a96506SLiam Merwick * boundary. 9120a96506SLiam Merwick * 9220a96506SLiam Merwick * Version numbers of the hvm_start_info structure have evolved like this: 9320a96506SLiam Merwick * 9420a96506SLiam Merwick * Version 0: 9520a96506SLiam Merwick * 9620a96506SLiam Merwick * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of 9720a96506SLiam Merwick * padding) to the end of the hvm_start_info struct. These new 9820a96506SLiam Merwick * fields can be used to pass a memory map to the guest. The 9920a96506SLiam Merwick * memory map is optional and so guests that understand version 1 10020a96506SLiam Merwick * of the structure must check that memmap_entries is non-zero 10120a96506SLiam Merwick * before trying to read the memory map. 10220a96506SLiam Merwick */ 10320a96506SLiam Merwick #define XEN_HVM_START_MAGIC_VALUE 0x336ec578 10420a96506SLiam Merwick 10520a96506SLiam Merwick /* 10620a96506SLiam Merwick * C representation of the x86/HVM start info layout. 10720a96506SLiam Merwick * 10820a96506SLiam Merwick * The canonical definition of this layout is above, this is just a way to 10920a96506SLiam Merwick * represent the layout described there using C types. 11020a96506SLiam Merwick */ 11120a96506SLiam Merwick struct hvm_start_info { 11220a96506SLiam Merwick uint32_t magic; /* Contains the magic value 0x336ec578 */ 11320a96506SLiam Merwick /* ("xEn3" with the 0x80 bit of the "E" set).*/ 11420a96506SLiam Merwick uint32_t version; /* Version of this structure. */ 11520a96506SLiam Merwick uint32_t flags; /* SIF_xxx flags. */ 11620a96506SLiam Merwick uint32_t nr_modules; /* Number of modules passed to the kernel. */ 11720a96506SLiam Merwick uint64_t modlist_paddr; /* Physical address of an array of */ 11820a96506SLiam Merwick /* hvm_modlist_entry. */ 11920a96506SLiam Merwick uint64_t cmdline_paddr; /* Physical address of the command line. */ 12020a96506SLiam Merwick uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ 12120a96506SLiam Merwick /* structure. */ 12220a96506SLiam Merwick uint64_t memmap_paddr; /* Physical address of an array of */ 12320a96506SLiam Merwick /* hvm_memmap_table_entry. Only present in */ 12420a96506SLiam Merwick /* version 1 and newer of the structure */ 12520a96506SLiam Merwick uint32_t memmap_entries; /* Number of entries in the memmap table. */ 12620a96506SLiam Merwick /* Only present in version 1 and newer of */ 12720a96506SLiam Merwick /* the structure. Value will be zero if */ 12820a96506SLiam Merwick /* there is no memory map being provided. */ 12920a96506SLiam Merwick uint32_t reserved; 13020a96506SLiam Merwick }; 13120a96506SLiam Merwick 13220a96506SLiam Merwick struct hvm_modlist_entry { 13320a96506SLiam Merwick uint64_t paddr; /* Physical address of the module. */ 13420a96506SLiam Merwick uint64_t size; /* Size of the module in bytes. */ 13520a96506SLiam Merwick uint64_t cmdline_paddr; /* Physical address of the command line. */ 13620a96506SLiam Merwick uint64_t reserved; 13720a96506SLiam Merwick }; 13820a96506SLiam Merwick 13920a96506SLiam Merwick struct hvm_memmap_table_entry { 14020a96506SLiam Merwick uint64_t addr; /* Base address of the memory region */ 14120a96506SLiam Merwick uint64_t size; /* Size of the memory region in bytes */ 14220a96506SLiam Merwick uint32_t type; /* Mapping type */ 14320a96506SLiam Merwick uint32_t reserved; 14420a96506SLiam Merwick }; 14520a96506SLiam Merwick 146*a8b991b5SMarkus Armbruster #endif /* XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H */ 147