mini-os: support HVMlite mode
Subsystems (4)
Juergen Gross
maintainerv2 cover mini-os: support HVMlite mode
This patch series adds HVMlite support for Mini-OS. Setting CONFIG_PARAVIRT to "n" (default is "y") will build mini-os as a HVMlite domain on x86. Both 32- and 64-bit builds are supported.
Tested with plain Mini-OS configuration to work in 32- and 64-bit mode either paravirtualized or as HVM domain (device-model none).
Ballooning should basically work, too, but there is some support for a sparse memory map missing in HVMlite mode.
Changes in V2:
- some minor changes requested by Samuel Thibault (added comments, moved sone code to another position in file, add one print)
Juergen Gross (22):
mini-os: resync xen headers
mini-os: make dump_regs() work in early boot
mini-os: add CONFIG_PARAVIRT
mini-os: make some memory management related macros usable from
assembler
mini-os: add boot code for HVMlite support
mini-os: setup hypercall page for HVMlite
mini-os: support hvm_op hypercall
mini-os: initialize trap handling for HVMlite
mini-os: support HVMlite traps
mini-os: make p2m related code depend on CONFIG_PARAVIRT
mini-os: add static page tables for virtual kernel area for HVMlite
mini-os: add x86 native page table handling
mini-os: correct wrong calculation of alloc bitmap size
mini-os: add map_frame_virt() function
mini-os: setup console interface parameters
mini-os: setup xenbus interface parameters
mini-os: add get_cmdline() function
mini-os: map shared info page for HVMlite
mini-os: remove using start_info in architecture independent code
mini-os: print start of day messages depending on domain type
mini-os: get physical memory map
mini-os: support idle for HVMlite
Config.mk | 6 + Makefile | 2 +- arch/arm/arm32.S | 4 +- arch/arm/balloon.c | 7 - arch/arm/mm.c | 17 +- arch/arm/setup.c | 66 +----- arch/x86/arch.mk | 4 + arch/x86/balloon.c | 26 ++- arch/x86/events.c | 4 +- arch/x86/mm.c | 347 +++++++++++++++++++++++++++----- arch/x86/setup.c | 156 +++++++++------ arch/x86/time.c | 11 +- arch/x86/traps.c | 108 +++++++++- arch/x86/x86_32.S | 50 ++++- arch/x86/x86_64.S | 66 +++++- arch/x86/x86_hvm.S | 88 ++++++++ balloon.c | 12 +- console/xencons_ring.c | 38 +++- daytime.c | 2 +- events.c | 3 +- hypervisor.c | 44 ++++ include/arm/arch_mm.h | 3 - include/balloon.h | 4 - include/compiler.h | 1 + include/console.h | 3 +- include/e820.h | 48 +++++ include/hypervisor.h | 17 +- include/kernel.h | 3 + include/mm.h | 3 +- include/paravirt.h | 81 ++++++++ include/x86/arch_mm.h | 101 +++++----- include/x86/desc.h | 367 ++++++++++++++++++++++++++++++++++ include/x86/os.h | 110 ++++++++-- include/x86/x86_32/hypercall-x86_32.h | 6 + include/x86/x86_64/hypercall-x86_64.h | 6 + include/xen/arch-x86/hvm/start_info.h | 98 +++++++++ include/xen/arch-x86/xen-x86_32.h | 2 + include/xen/arch-x86/xen-x86_64.h | 2 + include/xen/elfnote.h | 12 +- include/xenbus.h | 3 + kernel.c | 7 +- main.c | 11 +- minios.mk | 2 +- mm.c | 80 +++++--- test.c | 20 +- xenbus/xenbus.c | 40 +++- 46 files changed, 1713 insertions(+), 378 deletions(-) create mode 100644 arch/x86/x86_hvm.S create mode 100644 include/e820.h create mode 100644 include/paravirt.h create mode 100644 include/x86/desc.h create mode 100644 include/xen/arch-x86/hvm/start_info.h
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 1/22 mini-os: resync xen headers
Use the latest Xen headers.
--- include/xen/arch-x86/hvm/start_info.h | 98 +++++++++++++++++++++++++++++++++++ include/xen/elfnote.h | 12 ++++- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 include/xen/arch-x86/hvm/start_info.h
include/xen/arch-x86/hvm/start_info.h new file +98 -0
@@ -0,0 +1,98 @@ +/* +* 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 (c) 2016, Citrix Systems, Inc. +*/ + +#ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ +#define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ + +/* +* Start of day structure passed to PVH guests and to HVM guests in %ebx. +* +* NOTE: nothing will be loaded at physical address 0, so a 0 value in any +* of the address fields should be treated as not present. +* +* 0 +----------------+ +* | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE +* | | ("xEn3" with the 0x80 bit of the "E" set). +* 4 +----------------+ +* | version | Version of this structure. Current version is 0. New +* | | versions are guaranteed to be backwards-compatible. +* 8 +----------------+ +* | flags | SIF_xxx flags. +* 12 +----------------+ +* | nr_modules | Number of modules passed to the kernel. +* 16 +----------------+ +* | modlist_paddr | Physical address of an array of modules +* | | (layout of the structure below). +* 24 +----------------+ +* | cmdline_paddr | Physical address of the command line, +* | | a zero-terminated ASCII string. +* 32 +----------------+ +* | rsdp_paddr | Physical address of the RSDP ACPI data structure. +* 40 +----------------+ +* +* The layout of each entry in the module structure is the following: +* +* 0 +----------------+ +* | paddr | Physical address of the module. +* 8 +----------------+ +* | size | Size of the module in bytes. +* 16 +----------------+ +* | cmdline_paddr | Physical address of the command line, +* | | a zero-terminated ASCII string. +* 24 +----------------+ +* | reserved | +* 32 +----------------+ +* +* The address and sizes are always a 64bit little endian unsigned integer. +* +* NB: Xen on x86 will always try to place all the data below the 4GiB +* boundary. +*/ +#define XEN_HVM_START_MAGIC_VALUE 0x336ec578 + +/* +* C representation of the x86/HVM start info layout. +* +* The canonical definition of this layout is above, this is just a way to +* represent the layout described there using C types. +*/ +struct hvm_start_info { +uint32_t magic;/* Contains the magic value 0x336ec578 */ +/* ("xEn3" with the 0x80 bit of the "E" set).*/ +uint32_t version;/* Version of this structure. */ +uint32_t flags;/* SIF_xxx flags. */ +uint32_t nr_modules;/* Number of modules passed to the kernel. */ +uint64_t modlist_paddr;/* Physical address of an array of */ +/* hvm_modlist_entry. */ +uint64_t cmdline_paddr;/* Physical address of the command line. */ +uint64_t rsdp_paddr;/* Physical address of the RSDP ACPI data */ +/* structure. */ +}; + +struct hvm_modlist_entry { +uint64_t paddr;/* Physical address of the module. */ +uint64_t size;/* Size of the module in bytes. */ +uint64_t cmdline_paddr;/* Physical address of the command line. */ +uint64_t reserved; +}; + +#endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
include/xen/elfnote.h +11 -1
@@ -200,9 +200,19 @@#define XEN_ELFNOTE_SUPPORTED_FEATURES 17/* +* Physical entry point into the kernel. +* +* 32bit entry point into the kernel. When requested to launch the +* guest kernel in a HVM container, Xen will use this entry point to +* launch the guest in 32bit protected mode with paging disabled. +* Ignored otherwise. +*/ +#define XEN_ELFNOTE_PHYS32_ENTRY 18 + +/* * The number of the highest elfnote defined. */ -#define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES +#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_ENTRY/* * System information exported through crash notes.
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 2/22 mini-os: make dump_regs() work in early boot
In reply to Juergen Grossdump_regs() will result in page fault in early boot as there is no current thread pointer. Handle this case.
--- arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/traps.c +1 -1
@@ -32,7 +32,7 @@ void machine_check(void);void dump_regs (struct pt_regs *regs) { -printk ("Thread: %s\n" , current->name); +printk ("Thread: %s\n" , current ? current->name :"*NONE*" );#ifdef __i386__printk ("EIP: %lx, EFLAGS %lx.\n" , regs->eip, regs->eflags); printk("EBX: %08lx ECX: %08lx EDX: %08lx\n",
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 3/22 mini-os: add CONFIG_PARAVIRT
In reply to Juergen GrossAdd a new config macro CONFIG_PARAVIRT which defaults to be defined on x86. This is the first step for supporting a HVMlite Mini-OS.
Doing this via CONFIG_PARAVIRT instead of something like CONFIG_HVMLITE was chosen as the arm port can then drop some dummy routines needed for para-virtualization only.
Add include/paravirt.h for future support of paravirt specific handling.
--- Config.mk | 6 ++++++ include/paravirt.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/paravirt.h
Config.mk +6 -0
@@ -153,6 +153,11 @@ LDFLAGS-$(clang) += -plugin LLVMgold.so endif # Configuration defaults +ifeq ($(TARGET_ARCH_FAM),x86) +CONFIG_PARAVIRT ?= y +else +CONFIG_PARAVIRT ?= n +endif CONFIG_START_NETWORK ?= y CONFIG_SPARSE_BSS ?= y CONFIG_QEMU_XS_ARGS ?= n
@@ -172,6 +177,7 @@ CONFIG_LWIP ?= $(lwip) CONFIG_BALLOON ?= n # Export config items as compiler directives +DEFINES-$(CONFIG_PARAVIRT) += -DCONFIG_PARAVIRT DEFINES-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK DEFINES-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS DEFINES-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
include/paravirt.h new file +33 -0
@@ -0,0 +1,33 @@ +/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- +* +* (C) 2016 - Juergen Gross, SUSE Linux GmbH +* +* 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 _PARAVIRT_H +#define _PARAVIRT_H + +#if defined(CONFIG_PARAVIRT ) + +#else + +#endif + +#endif /* _PARAVIRT_H */
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 4/22 mini-os: make some memory management related macros usable from assembler
In reply to Juergen GrossEspecially page table entry definitions are currently not usable from assembler sources on x86 as the constants are defined with ULL suffix. Change this by adding the suffix only when the header is included from a C source.
Hide some C prototypes when in assembler environment.
--- include/x86/arch_mm.h | 56 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 22 deletions(-)
include/x86/arch_mm.h +34 -22
@@ -29,11 +29,16 @@#include <xen/xen.h> #if defined(__i386__)#include <xen/arch-x86_32.h> +#define __CONST (x) x ## ULL#elif defined(__x86_64__)#include <xen/arch-x86_64.h> +#define __CONST (x) x ## UL#else #error "Unsupported architecture"#endif +#define CONST (x) __CONST(x) +#else +#define CONST (x) x#endif /*
@@ -81,14 +86,16 @@#define PRIpte "016llx"#ifndef __ASSEMBLY__typedef uint64_t pgentry_t ; +#else +#define PTE (val) .long val; .long 0#endif -#define MAX_MEM_SIZE 0x3f000000UL -#define VIRT_KERNEL_AREA 0x3f000000UL -#define VIRT_DEMAND_AREA 0x40000000UL -#define VIRT_HEAP_AREA 0xb0000000UL +#define MAX_MEM_SIZE CONST(0x3f000000) +#define VIRT_KERNEL_AREA CONST(0x3f000000) +#define VIRT_DEMAND_AREA CONST(0x40000000) +#define VIRT_HEAP_AREA CONST(0xb0000000) -#define DEMAND_MAP_PAGES 0x6ffffUL +#define DEMAND_MAP_PAGES CONST(0x6ffff)#define HEAP_PAGES_MAX ((HYPERVISOR_VIRT_START - VIRT_HEAP_AREA) / \ PAGE_SIZE - 1)
@@ -115,15 +122,17 @@ typedef uint64_t pgentry_t;#define PRIpte "016lx"#ifndef __ASSEMBLY__typedef unsigned long pgentry_t ; +#else +#define PTE (val) .quad val#endif -#define MAX_MEM_SIZE (512ULL << 30) -#define VIRT_KERNEL_AREA 0x0000008000000000UL -#define VIRT_DEMAND_AREA 0x0000100000000000UL -#define VIRT_HEAP_AREA 0x0000200000000000UL +#define MAX_MEM_SIZE (CONST(512) << 30) +#define VIRT_KERNEL_AREA CONST(0x0000008000000000) +#define VIRT_DEMAND_AREA CONST(0x0000100000000000) +#define VIRT_HEAP_AREA CONST(0x0000200000000000) -#define DEMAND_MAP_PAGES 0x8000000UL -#define HEAP_PAGES_MAX 0x8000000UL +#define DEMAND_MAP_PAGES CONST(0x8000000) +#define HEAP_PAGES_MAX CONST(0x8000000)#endif
@@ -147,16 +156,16 @@ typedef unsigned long pgentry_t; (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))#endif -#define _PAGE_PRESENT 0x001ULL -#define _PAGE_RW 0x002ULL -#define _PAGE_USER 0x004ULL -#define _PAGE_PWT 0x008ULL -#define _PAGE_PCD 0x010ULL -#define _PAGE_ACCESSED 0x020ULL -#define _PAGE_DIRTY 0x040ULL -#define _PAGE_PAT 0x080ULL -#define _PAGE_PSE 0x080ULL -#define _PAGE_GLOBAL 0x100ULL +#define _PAGE_PRESENT CONST(0x001) +#define _PAGE_RW CONST(0x002) +#define _PAGE_USER CONST(0x004) +#define _PAGE_PWT CONST(0x008) +#define _PAGE_PCD CONST(0x010) +#define _PAGE_ACCESSED CONST(0x020) +#define _PAGE_DIRTY CONST(0x040) +#define _PAGE_PAT CONST(0x080) +#define _PAGE_PSE CONST(0x080) +#define _PAGE_GLOBAL CONST(0x100)#if defined(__i386__)#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
@@ -191,12 +200,14 @@ typedef unsigned long pgentry_t;#define L3_P2M_IDX (pfn) (((pfn) >> L2_P2M_SHIFT) & P2M_MASK)#define INVALID_P2M_ENTRY (~0UL) +#ifndef __ASSEMBLY__void p2m_chk_pfn (unsigned long pfn);static inline unsigned long p2m_pages (unsigned long pages) {return (pages +P2M_ENTRIES -1 ) >>L1_P2M_SHIFT ; } +#endif #include "arch_limits.h" #define PAGE_SIZE __PAGE_SIZE
@@ -239,7 +250,6 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine) phys = (phys <<PAGE_SHIFT ) | (machine & ~PAGE_MASK );return phys; } -#endif #define VIRT_START ((unsigned long)&_text)
@@ -288,4 +298,6 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)pgentry_t *need_pgt (unsigned long addr); +#endif +#endif /* _ARCH_MM_H_ */
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 5/22 mini-os: add boot code for HVMlite support
In reply to Juergen GrossA HVMlite domain is always starting in 32 bit mode. Add the appropriate boot code to arch/x86 for the non-paravirtualized case.
For this boot code to become active we need to suppress the pv related elfnotes and add an appropriate elfnote for HVMlite.
As the HVMlite boot code is more or less the same for 32- and 64-bit Mini-OS #include the new code from x86_[32|64].S in order to avoid error prone code duplication. The specific parts of 32- or 64-bit code are added to x86_[32|64].S
This enables Mini-OS to start the boot process in HVMlite mode until it enters C code. This is working for 32- and for 64-bit mode.
---
V2: add some comments as requested by Samuel Thibault
--- Makefile | 2 +- arch/x86/arch.mk | 4 + arch/x86/mm.c | 31 +++++ arch/x86/setup.c | 4 +- arch/x86/x86_32.S | 31 ++++- arch/x86/x86_64.S | 35 ++++- arch/x86/x86_hvm.S | 88 +++++++++++++ include/compiler.h | 1 + include/x86/desc.h | 367 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/x86/os.h | 5 + minios.mk | 2 +- 11 files changed, 556 insertions(+), 14 deletions(-) create mode 100644 arch/x86/x86_hvm.S create mode 100644 include/x86/desc.h
Makefile +1 -1
@@ -24,7 +24,7 @@ include minios.mk LDLIBS := APP_LDLIBS := LDARCHLIB := -L$(OBJ_DIR)/$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME) -LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds +LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds $(ARCH_LDFLAGS_FINAL) # Prefix for global API names. All other symbols are localised before # linking with EXTRA_OBJS.
arch/x86/arch.mk +4 -0
@@ -20,3 +20,7 @@ EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) endif +ifeq ($(CONFIG_PARAVIRT),n) +ARCH_LDFLAGS_FINAL := --oformat=elf32-i386 +ARCH_AS_DEPS += x86_hvm.S +endif
arch/x86/mm.c +31 -0
@@ -56,6 +56,37 @@ unsigned long mfn_zero;extern char stack[];extern void page_walk (unsigned long va); +#ifndef CONFIG_PARAVIRT +#include <mini-os/desc.h> +user_desc gdt[NR_GDT_ENTRIES ] = +{ + [GDTE_CS64_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL0 ,R ,L ), + [GDTE_CS32_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL0 ,R ,D ), + [GDTE_DS32_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,DATA ,DPL0 ,B ,W ), + + [GDTE_CS64_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL3 ,R ,L ), + [GDTE_CS32_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL3 ,R ,D ), + [GDTE_DS32_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,DATA ,DPL3 ,B ,W ), + +/* [GDTE_TSS] */ +/* [GDTE_TSS + 1] */ +}; + +desc_ptr gdt_ptr = +{ + .limit =sizeof (gdt) -1 , + .base = (unsigned long )&gdt, +}; + +gate_desc idt[256 ] = { }; + +desc_ptr idt_ptr = +{ + .limit =sizeof (idt) -1 , + .base = (unsigned long )&idt, +}; +#endif +/* * Make pt_pfn a new 'level' page table frame and hook it into the page * table at offset in previous level MFN (pref_l_mfn). pt_pfn is a guest
arch/x86/setup.c +3 -1
@@ -94,9 +94,10 @@ static inline void sse_init(void) {* INITIAL C ENTRY POINT. */ void -arch_init (start_info_t *si) +arch_init (void *par) {static char hello[] ="Bootstrapping...\n" ; +start_info_t *si; (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello);
@@ -111,6 +112,7 @@ arch_init(start_info_t *si)/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ + si = par;memcpy (&start_info, si,sizeof (*si));/* print out some useful information */
arch/x86/x86_32.S +26 -5
@@ -1,20 +1,31 @@ #include <mini-os/os.h> #include <mini-os/x86/arch_limits.h> #include <mini-os/asm_macros.h> +#include <mini-os/arch_mm.h> +#include <mini-os/desc.h> +#include <xen/arch-x86_32.h> #include <xen/elfnote.h> #include <xen/arch-x86_32.h> +#ifdef CONFIG_PARAVIRT ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "Mini-OS") ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _WORD hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") +.text -.globl _start, shared_info, hypercall_page +.globl _start _start: - cld lss stack_start,%esp +#else + +#include "x86_hvm.S" + movl stack_start,%esp + +#endif + cld andl $(~(__STACK_SIZE-1)), %esp push %esi call arch_init
@@ -22,14 +33,15 @@ _start: stack_start: .long stack+(2*__STACK_SIZE), __KERNEL_SS +.globl shared_info, hypercall_page /* Unpleasant -- the PTE that maps this page is actually overwritten */ /* to map the real shared-info page! :-) */ - .org 0x1000 + .align __PAGE_SIZE shared_info: - .org 0x2000 + .fill __PAGE_SIZE,1,0 hypercall_page: - .org 0x3000 + .fill __PAGE_SIZE,1,0 ES = 0x20 ORIG_EAX = 0x24
@@ -300,3 +312,12 @@ ENTRY(__arch_switch_threads) popl %ebx popl %ebp ret + +#ifndef CONFIG_PARAVIRT +.data +.globl page_table_base + .align __PAGE_SIZE +page_table_base: + PTE(page_table_l2 + L3_PROT) + .align __PAGE_SIZE, 0 +#endif
arch/x86/x86_64.S +29 -6
@@ -1,19 +1,29 @@ #include <mini-os/os.h> #include <mini-os/x86/arch_limits.h> #include <mini-os/asm_macros.h> +#include <mini-os/arch_mm.h> +#include <mini-os/desc.h> +#include <xen/features.h> #include <xen/elfnote.h> #include <xen/features.h> +#define ENTRY(X) .globl X ; X : + +#ifdef CONFIG_PARAVIRT ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "Mini-OS") ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _WORD hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") +.text -#define ENTRY(X) .globl X ; X : -.globl _start, shared_info, hypercall_page - +.globl _start _start: +#else + +#include "x86_hvm.S" + +#endif cld movq stack_start(%rip),%rsp andq $(~(__STACK_SIZE-1)), %rsp
@@ -23,14 +33,15 @@ _start: stack_start: .quad stack+(2*__STACK_SIZE) +.globl shared_info, hypercall_page /* Unpleasant -- the PTE that maps this page is actually overwritten */ /* to map the real shared-info page! :-) */ - .org 0x1000 + .align __PAGE_SIZE shared_info: - .org 0x2000 + .fill __PAGE_SIZE,1,0 hypercall_page: - .org 0x3000 + .fill __PAGE_SIZE,1,0 #define XEN_GET_VCPU_INFO(reg) movq HYPERVISOR_shared_info,reg
@@ -378,3 +389,15 @@ ENTRY(__arch_switch_threads) popq %rbx popq %rbp ret + +#ifndef CONFIG_PARAVIRT +.data +.globl page_table_base + .align __PAGE_SIZE +page_table_l3: + PTE(page_table_l2 + L3_PROT) + .align __PAGE_SIZE, 0 +page_table_base: + PTE(page_table_l3 + L4_PROT) + .align __PAGE_SIZE, 0 +#endif
arch/x86/x86_hvm.S new file +88 -0
88 lines not on this page · raw message
include/compiler.h +1 -0
@@ -6,5 +6,6 @@#endif #define unlikely (x) __builtin_expect(!!(x),0)#define likely (x) __builtin_expect(!!(x),1) +#define __packed __attribute__((__packed__))#endif /* __MINIOS_COMPILER_H_ */
include/x86/desc.h new file +367 -0
367 lines not on this page · raw message
include/x86/os.h +5 -0
@@ -24,7 +24,12 @@#endif #include <xen/xen.h> +#define MSR_EFER 0xc0000080 +#define _EFER_LME 8/* Long mode enable */ +#define X86_CR0_PG 0x80000000/* Paging */ +#define X86_CR4_PAE 0x00000020/* enable physical address extensions */ +#define X86_CR4_OSFXSR 0x00000200/* enable fast FPU save and restore */ #define __KERNEL_CS FLAT_KERNEL_CS#define __KERNEL_DS FLAT_KERNEL_DS
minios.mk +1 -1
@@ -68,7 +68,7 @@ HEAD_OBJ := $(OBJ_DIR)/$(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ) $(OBJ_DIR)/%.o: %.c $(HDRS) Makefile $(EXTRA_DEPS) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS) +$(OBJ_DIR)/%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS) $(ARCH_AS_DEPS) $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 6/22 mini-os: setup hypercall page for HVMlite
In reply to Juergen GrossWhen running in HVMlite mode we need to setup the hypercall page by ourself.
---
V2: move wrmsr definitions as requested by Samuel Thibault
--- arch/x86/events.c | 4 ++-- arch/x86/setup.c | 26 ++++++++++++++++++++++++++ include/x86/os.h | 28 ++++++++++++++++++++-------- 3 files changed, 48 insertions(+), 10 deletions(-)
arch/x86/events.c +2 -2
@@ -16,7 +16,7 @@ void arch_init_events(void) {#if defined(__x86_64__) asmvolatile ("movl %0,%%fs ; movl %0,%%gs" ::"r" (0 )); -wrmsrl (0xc0000101 , &cpu0_pda);/* 0xc0000101 is MSR_GS_BASE */ +wrmsrl (0xc0000101 , (uint64_t )&cpu0_pda);/* 0xc0000101 is MSR_GS_BASE */ cpu0_pda.irqcount =-1 ; cpu0_pda.irqstackptr = (void *) (((unsigned long )irqstack +2 *STACK_SIZE ) & ~(STACK_SIZE -1 ));
@@ -30,6 +30,6 @@ void arch_unbind_ports(void)void arch_fini_events (void ) {#if defined(__x86_64__) -wrmsrl (0xc0000101 ,NULL );/* 0xc0000101 is MSR_GS_BASE */ +wrmsrl (0xc0000101 ,0 );/* 0xc0000101 is MSR_GS_BASE */ #endif }
arch/x86/setup.c +26 -0
@@ -30,6 +30,7 @@#include <mini-os/lib.h> /* for printk, memcpy */ #include <mini-os/kernel.h> #include <xen/xen.h> +#include <xen/arch-x86/cpuid.h> /* * Shared page for communicating with the hypervisor.
@@ -89,6 +90,30 @@ static inline void sse_init(void) {#define sse_init ()#endif +#ifdef CONFIG_PARAVIRT +#define hpc_init () +#else +static void hpc_init (void ) +{ +uint32_t eax, ebx, ecx, edx, base; + +for ( base =XEN_CPUID_FIRST_LEAF ; + base <XEN_CPUID_FIRST_LEAF +0x10000 ; base +=0x100 ) + { +cpuid (base, &eax, &ebx, &ecx, &edx); + +if ( (ebx ==XEN_CPUID_SIGNATURE_EBX ) && + (ecx ==XEN_CPUID_SIGNATURE_ECX ) && + (edx ==XEN_CPUID_SIGNATURE_EDX ) && + ((eax - base) >=2 ) ) +break ; + } + +cpuid (base +2 , &eax, &ebx, &ecx, &edx); +wrmsrl (ebx, (unsigned long )&hypercall_page); +barrier (); +} +#endif /* * INITIAL C ENTRY POINT.
@@ -99,6 +124,7 @@ arch_init(void *par)static char hello[] ="Bootstrapping...\n" ;start_info_t *si; +hpc_init (); (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello);trap_init ();
include/x86/os.h +20 -8
@@ -440,20 +440,23 @@ static __inline__ unsigned long __ffs(unsigned long word) (val) = ((unsigned long )__a) | (((unsigned long )__d)<<32 ); \ } while(0) -#define wrmsr(msr,val1,val2) \ - __asm__ __volatile__("wrmsr" \ - : /* no outputs */ \ - : "c" (msr), "a" (val1), "d" (val2)) - -#define wrmsrl (msr,val) wrmsr(msr,(uint32_t)((uint64_t)(val)),((uint64_t)(val))>>32) - -#else /* ifdef __x86_64__ */ #error "Unsupported architecture"#endif +#endif /* ifdef __INSIDE_MINIOS */ /********************* common i386 and x86_64 ****************************/ +#define wrmsr(msr,val1,val2) \ + __asm__ __volatile__("wrmsr" \ + : /* no outputs */ \ + : "c" (msr), "a" (val1), "d" (val2)) + +static inline void wrmsrl (unsigned msr,uint64_t val) +{ +wrmsr (msr, (uint32_t )(val &0xffffffffULL ), (uint32_t )(val >>32 )); +} +struct __synch_xchg_dummy {unsigned long a[100 ]; };#define __synch_xg (x) ((struct __synch_xchg_dummy *)(x))
@@ -571,6 +574,15 @@ HYPERVISOR_xsm_op( return _hypercall1(int, xsm_op, op); } +static inline void cpuid (uint32_t leaf, +uint32_t *eax,uint32_t *ebx, +uint32_t *ecx,uint32_t *edx) +{ + asmvolatile ("cpuid" + :"=a" (*eax),"=b" (*ebx),"=c" (*ecx),"=d" (*edx) + :"0" (leaf)); +} +#undef ADDR#endif /* not assembly */
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 7/22 mini-os: support hvm_op hypercall
In reply to Juergen GrossSupport the HYPERVISOR_hvm_op() hypercall which is needed for HVMlite. Add convenience functions hvm_get_parameter() and hvm_set_parameter().
--- arch/arm/setup.c | 15 --------------- hypervisor.c | 27 +++++++++++++++++++++++++++ include/hypervisor.h | 5 +++++ include/x86/x86_32/hypercall-x86_32.h | 6 ++++++ include/x86/x86_64/hypercall-x86_64.h | 6 ++++++ 5 files changed, 44 insertions(+), 15 deletions(-)
arch/arm/setup.c +0 -15
@@ -25,21 +25,6 @@ extern char shared_info_page[PAGE_SIZE];void *device_tree; -static int hvm_get_parameter (int idx,uint64_t *value) -{ -struct xen_hvm_param xhv; -int ret; - - xhv.domid =DOMID_SELF ; - xhv.index = idx; - ret =HYPERVISOR_hvm_op (HVMOP_get_param, &xhv); -if (ret <0 ) { -BUG (); - } - *value = xhv.value; -return ret; -} -static void get_console (void ) {uint64_t v =-1 ;
hypervisor.c +27 -0
@@ -36,6 +36,33 @@int in_callback; +#ifndef CONFIG_PARAVIRT +int hvm_get_parameter (int idx,uint64_t *value) +{ +struct xen_hvm_param xhv; +int ret; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + ret =HYPERVISOR_hvm_op (HVMOP_get_param, &xhv); +if ( ret <0 ) +BUG (); + + *value = xhv.value; +return ret; +} + +int hvm_set_parameter (int idx,uint64_t value) +{ +struct xen_hvm_param xhv; + + xhv.domid =DOMID_SELF ; + xhv.index = idx; + xhv.value = value; +return HYPERVISOR_hvm_op (HVMOP_set_param, &xhv); +} +#endif +void do_hypervisor_callback (struct pt_regs *regs) {unsigned long l1, l2, l1i, l2i;
include/hypervisor.h +5 -0
@@ -23,6 +23,7 @@#else #error "Unsupported architecture"#endif +#include <xen/hvm/hvm_op.h> #include <mini-os/traps.h> /*
@@ -37,6 +38,10 @@ extern union start_info_union start_info_union;#define start_info (start_info_union.start_info)/* hypervisor.c */ +#ifndef CONFIG_PARAVIRT +int hvm_get_parameter (int idx,uint64_t *value); +int hvm_set_parameter (int idx,uint64_t value); +#endif void force_evtchn_callback (void );void do_hypervisor_callback (struct pt_regs *regs);void mask_evtchn (uint32_t port);
include/x86/x86_32/hypercall-x86_32.h +6 -0
@@ -324,6 +324,12 @@ HYPERVISOR_domctl(return _hypercall1 (int, domctl, op); } +static inline unsigned long +HYPERVISOR_hvm_op (int op,void *arg) +{ + return _hypercall2(unsigned long, hvm_op, op, arg); +} +#endif /* __HYPERCALL_X86_32_H__ */ /*
include/x86/x86_64/hypercall-x86_64.h +6 -0
@@ -331,6 +331,12 @@ HYPERVISOR_domctl(return _hypercall1 (int, domctl, op); } +static inline unsigned long +HYPERVISOR_hvm_op (int op,void *arg) +{ + return _hypercall2(unsigned long, hvm_op, op, arg); +} +#endif /* __HYPERCALL_X86_64_H__ */ /*
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 8/22 mini-os: initialize trap handling for HVMlite
In reply to Juergen GrossTrap handling for HVMlite domains requires an initialized IDT.
--- arch/x86/setup.c | 15 ---------- arch/x86/traps.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/x86/x86_64.S | 4 +++ include/x86/os.h | 1 + 4 files changed, 93 insertions(+), 15 deletions(-)
arch/x86/setup.c +0 -15
@@ -52,10 +52,6 @@ char stack[2*STACK_SIZE];extern char shared_info[PAGE_SIZE ]; -/* Assembler interface fns in entry.S. */ -void hypervisor_callback (void ); -void failsafe_callback (void ); -#if defined(__x86_64__)#define __pte (x) ((pte_t) { (x) } )#else
@@ -162,17 +158,6 @@ arch_init(void *par)/* Grab the shared_info pointer and put it in a safe place. */ HYPERVISOR_shared_info =map_shared_info (start_info.shared_info); -/* Set up event and failsafe callback addresses. */ -#ifdef __i386__ -HYPERVISOR_set_callbacks ( - __KERNEL_CS, (unsigned long )hypervisor_callback, - __KERNEL_CS, (unsigned long )failsafe_callback); -#else -HYPERVISOR_set_callbacks ( - (unsigned long )hypervisor_callback, - (unsigned long )failsafe_callback,0 ); -#endif -start_kernel (); }
arch/x86/traps.c +88 -0
113 lines not on this page · raw message
arch/x86/x86_64.S +4 -0
@@ -130,18 +130,22 @@ KERNEL_CS_MASK = 0xfc .endm .macro HYPERVISOR_IRET flag +#ifdef CONFIG_PARAVIRT testl $NMI_MASK,2*8(%rsp) jnz 2f +#endif /* Direct iret to kernel space. Correct CS and SS. */ orb $3,1*8(%rsp) orb $3,4*8(%rsp) iretq +#ifdef CONFIG_PARAVIRT 2: /* Slow iret via hypervisor. */ andl $~NMI_MASK, 16(%rsp) pushq $\flag jmp hypercall_page + (__HYPERVISOR_iret * 32) +#endif .endm
include/x86/os.h +1 -0
@@ -56,6 +56,7 @@#define TRAP_machine_check 18#define TRAP_simd_error 19#define TRAP_deferred_nmi 31 +#define TRAP_xen_callback 32/* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 9/22 mini-os: support HVMlite traps
In reply to Juergen GrossTrap handling in HVMlite domain is different from pv one.
--- arch/x86/traps.c | 2 -- arch/x86/x86_32.S | 19 ++++++++++++++-- arch/x86/x86_64.S | 22 +++++++++++++++++- include/x86/os.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 101 insertions(+), 9 deletions(-)
arch/x86/traps.c +0 -2
@@ -191,8 +191,6 @@ static void dump_mem(unsigned long addr) }printk ("\n" ); } -#define read_cr2 () \ - (HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].arch.cr2)static int handling_pg_fault =0 ;
arch/x86/x86_32.S +17 -2
@@ -8,6 +8,9 @@ #include <xen/arch-x86_32.h> #ifdef CONFIG_PARAVIRT + +#define KERNEL_DS __KERNEL_DS + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "Mini-OS") ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _WORD hypercall_page)
@@ -21,6 +24,8 @@ _start: lss stack_start,%esp #else +#define KERNEL_DS __KERN_DS + #include "x86_hvm.S" movl stack_start,%esp
@@ -61,7 +66,7 @@ CS = 0x2C pushl %edx; \ pushl %ecx; \ pushl %ebx; \ - movl $(__KERNEL_DS),%edx; \ + movl $(KERNEL_DS),%edx; \ movl %edx,%ds; \ movl %edx,%es;
@@ -98,7 +103,7 @@ do_exception: movl ORIG_EAX(%esp), %edx # get the error code movl %eax, ORIG_EAX(%esp) movl %ecx, ES(%esp) - movl $(__KERNEL_DS), %ecx + movl $(KERNEL_DS), %ecx movl %ecx, %ds movl %ecx, %es movl %esp,%eax # pt_regs pointer
@@ -112,6 +117,7 @@ ret_from_exception: addl $8,%esp RESTORE_ALL +#ifdef CONFIG_PARAVIRT # A note on the "critical region" in our callback handler. # We want to avoid stacking callback handlers due to events occurring # during handling of the last event. To do this, we keep events disabled
@@ -189,6 +195,15 @@ critical_fixup_table: .byte 0x28 # iret .byte 0x00,0x00,0x00,0x00 # movb $1,1(%esi) .byte 0x00,0x00 # jmp 11b + +#else + +ENTRY(hypervisor_callback) + pushl $0 + pushl $do_hypervisor_callback + jmp do_exception + +#endif # Hypervisor uses this for application faults while it executes. ENTRY(failsafe_callback)
arch/x86/x86_64.S +21 -1
@@ -78,9 +78,11 @@ KERNEL_CS_MASK = 0xfc /* Macros */ .macro zeroentry sym +#ifdef CONFIG_PARAVIRT movq (%rsp),%rcx movq 8(%rsp),%r11 addq $0x10,%rsp /* skip rcx and r11 */ +#endif pushq $0 /* push error code/oldrax */ pushq %rax /* push real oldrax to the rdi slot */ leaq \sym(%rip),%rax
@@ -88,9 +90,11 @@ KERNEL_CS_MASK = 0xfc .endm .macro errorentry sym +#ifdef CONFIG_PARAVIRT movq (%rsp),%rcx movq 8(%rsp),%r11 addq $0x10,%rsp /* rsp points to the error code */ +#endif pushq %rax leaq \sym(%rip),%rax jmp error_entry
@@ -133,11 +137,11 @@ KERNEL_CS_MASK = 0xfc #ifdef CONFIG_PARAVIRT testl $NMI_MASK,2*8(%rsp) jnz 2f -#endif /* Direct iret to kernel space. Correct CS and SS. */ orb $3,1*8(%rsp) orb $3,4*8(%rsp) +#endif iretq #ifdef CONFIG_PARAVIRT
@@ -182,6 +186,7 @@ error_call_handler: jmp error_exit +#ifdef CONFIG_PARAVIRT /* * Xen event (virtual interrupt) entry point. */
@@ -285,11 +290,26 @@ critical_region_fixup: andb $KERNEL_CS_MASK,CS(%rsp) # CS might have changed jmp 11b +#else +error_exit: + RESTORE_REST + RESTORE_ALL + HYPERVISOR_IRET 0 +/* + * Xen event (virtual interrupt) entry point. + */ +ENTRY(hypervisor_callback) + zeroentry do_hypervisor_callback + + +#endif ENTRY(failsafe_callback) +#ifdef CONFIG_PARAVIRT popq %rcx popq %r11 +#endif iretq
include/x86/os.h +63 -4
96 lines not on this page · raw message
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 10/22 mini-os: make p2m related code depend on CONFIG_PARAVIRT
In reply to Juergen GrossAll handling related to p2m is needed for paravirtualized environment only. So put all functions operating on p2m list in #ifdef CONFIG_PARAVIRT sections. Add a paravirt.h header defining dummy functions for non-paravirtualized environments. Instead of using references to start_info use dedicated variables initialized from start_info on boot.
--- arch/arm/balloon.c | 5 --- arch/arm/mm.c | 4 --- arch/x86/balloon.c | 13 ++++++++ arch/x86/mm.c | 67 +++++++++++++++++++++++++++++---------- arch/x86/setup.c | 6 ++-- arch/x86/traps.c | 6 ++-- balloon.c | 1 + include/arm/arch_mm.h | 3 -- include/balloon.h | 3 -- include/mm.h | 2 +- include/paravirt.h | 48 ++++++++++++++++++++++++++++ include/x86/arch_mm.h | 40 +++++------------------ include/xen/arch-x86/xen-x86_32.h | 2 ++ include/xen/arch-x86/xen-x86_64.h | 2 ++ mm.c | 1 + 15 files changed, 133 insertions(+), 70 deletions(-)
arch/arm/balloon.c +0 -5
@@ -27,11 +27,6 @@unsigned long virt_kernel_area_end;/* TODO: find a virtual area */ -int arch_expand_p2m (unsigned long max_pfn) -{ -return 0 ; -} -void arch_pfn_add (unsigned long pfn,unsigned long mfn) { }
arch/arm/mm.c +0 -4
@@ -72,10 +72,6 @@ void arch_init_mm(unsigned long *start_pfn_p, unsigned long *max_pfn_p) *max_pfn_p =to_phys (new_device_tree) >>PAGE_SHIFT ; } -void arch_init_p2m (unsigned long max_pfn) -{ -} -void arch_init_demand_mapping_area (void ) { }
arch/x86/balloon.c +13 -0
@@ -26,11 +26,13 @@#include <mini-os/errno.h> #include <mini-os/lib.h> #include <mini-os/mm.h> +#include <mini-os/paravirt.h> #ifdef CONFIG_BALLOON unsigned long virt_kernel_area_end = VIRT_KERNEL_AREA; +#ifdef CONFIG_PARAVIRT static void p2m_invalidate(unsigned long *list, unsigned long start_idx) { unsigned long idx;
@@ -143,5 +145,16 @@ void arch_pfn_add(unsigned long pfn, unsigned long mfn)do_exit (); } } +#else +void arch_pfn_add (unsigned long pfn,unsigned long mfn) +{ +pgentry_t *pgt; + + pgt =need_pgt ((unsigned long )pfn_to_virt (pfn)); +ASSERT (pgt); +if ( !(*pgt & _PAGE_PSE) ) + *pgt = (pgentry_t)(mfn <<PAGE_SHIFT ) | _PAGE_PRESENT | _PAGE_RW; +} +#endif #endif
arch/x86/mm.c +51 -16
160 lines not on this page · raw message
arch/x86/setup.c +3 -3
@@ -131,6 +131,9 @@ arch_init(void *par)/* Initialize SSE */ sse_init (); +/* Setup memory management info from start_info. */ +arch_mm_preinit (par); +/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */
@@ -152,9 +155,6 @@ arch_init(void *par) si->cmd_line ? (const char *)si->cmd_line : "NULL");printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); -/* set up minimal memory infos */ - phys_to_machine_mapping = (unsigned long *)start_info.mfn_list; -/* Grab the shared_info pointer and put it in a safe place. */ HYPERVISOR_shared_info =map_shared_info (start_info.shared_info);
arch/x86/traps.c +3 -3
@@ -97,9 +97,9 @@ DO_ERROR(18, "machine check", machine_check)void page_walk (unsigned long virt_address) { -pgentry_t *tab = (pgentry_t *)start_info.pt_base, page; +pgentry_t *tab = pt_base, page;unsigned long addr = virt_address; -printk ("Pagetable walk from virt %lx, base %lx:\n" , virt_address, start_info.pt_base); +printk ("Pagetable walk from virt %lx, base %p:\n" , virt_address, pt_base);#if defined(__x86_64__) page = tab[l4_table_offset (addr)];
@@ -119,7 +119,7 @@ void page_walk(unsigned long virt_address) }static int handle_cow (unsigned long addr) { -pgentry_t *tab = (pgentry_t *)start_info.pt_base, page; +pgentry_t *tab = pt_base, page;unsigned long new_page;int rc;
balloon.c +1 -0
@@ -25,6 +25,7 @@#include <mini-os/balloon.h> #include <mini-os/errno.h> #include <mini-os/lib.h> +#include <mini-os/paravirt.h> #include <xen/xen.h> #include <xen/memory.h>
include/arm/arch_mm.h +0 -3
@@ -29,9 +29,6 @@ extern uint32_t physical_address_offset; /* Add this to a virtual address to get#define mfn_to_virt (_mfn) (to_virt(PFN_PHYS(_mfn)))#define pfn_to_virt (_pfn) (to_virt(PFN_PHYS(_pfn))) -#define mfn_to_pfn (x) (x) -#define pfn_to_mfn (x) (x) -#define virtual_to_mfn (_virt) virt_to_mfn(_virt)// FIXME
include/balloon.h +0 -3
@@ -39,16 +39,13 @@ extern unsigned long nr_mem_pages;void get_max_pages (void );int balloon_up (unsigned long n_pages); -void arch_remap_p2m (unsigned long max_pfn);void mm_alloc_bitmap_remap (void ); -int arch_expand_p2m (unsigned long max_pfn);void arch_pfn_add (unsigned long pfn,unsigned long mfn);int chk_free_pages (unsigned long needed);#else /* CONFIG_BALLOON */ static inline void get_max_pages (void ) { } -static inline void arch_remap_p2m (unsigned long max_pfn) { }static inline void mm_alloc_bitmap_remap (void ) { }static inline int chk_free_pages (unsigned long needed) {
include/mm.h +1 -1
@@ -36,6 +36,7 @@#endif #include <xen/xen.h> +#include <mini-os/paravirt.h> #include <mini-os/arch_limits.h> #include <mini-os/arch_mm.h>
@@ -67,7 +68,6 @@ static __inline__ int get_order(unsigned long size)void arch_init_demand_mapping_area (void );void arch_init_mm (unsigned long * start_pfn_p,unsigned long * max_pfn_p); -void arch_init_p2m (unsigned long max_pfn_p);unsigned long allocate_ondemand (unsigned long n,unsigned long alignment);/* map f[i*stride]+i*increment for i in 0..n-1, aligned on alignment pages */
include/paravirt.h +48 -0
55 lines not on this page · raw message
include/x86/arch_mm.h +8 -32
@@ -184,31 +184,6 @@ typedef unsigned long pgentry_t;#define IO_PROT (L1_PROT)#define IO_PROT_NOCACHE (L1_PROT | _PAGE_PCD) -/* for P2M */ -#ifdef __x86_64__ -#define P2M_SHIFT 9 -#else -#define P2M_SHIFT 10 -#endif -#define P2M_ENTRIES (1UL << P2M_SHIFT) -#define P2M_MASK (P2M_ENTRIES - 1) -#define L1_P2M_SHIFT P2M_SHIFT -#define L2_P2M_SHIFT (2 * P2M_SHIFT) -#define L3_P2M_SHIFT (3 * P2M_SHIFT) -#define L1_P2M_IDX (pfn) ((pfn) & P2M_MASK) -#define L2_P2M_IDX (pfn) (((pfn) >> L1_P2M_SHIFT) & P2M_MASK) -#define L3_P2M_IDX (pfn) (((pfn) >> L2_P2M_SHIFT) & P2M_MASK) -#define INVALID_P2M_ENTRY (~0UL) - -#ifndef __ASSEMBLY__ -void p2m_chk_pfn (unsigned long pfn); - -static inline unsigned long p2m_pages (unsigned long pages) -{ -return (pages +P2M_ENTRIES -1 ) >>L1_P2M_SHIFT ; -} -#endif -#include "arch_limits.h" #define PAGE_SIZE __PAGE_SIZE#define PAGE_SHIFT __PAGE_SHIFT
@@ -232,10 +207,14 @@ typedef unsigned long paddr_t;typedef unsigned long maddr_t ;#endif +extern pgentry_t *pt_base; +#ifdef CONFIG_PARAVIRT extern unsigned long *phys_to_machine_mapping; +#else +extern pgentry_t page_table_base[]; +#endif extern char _text, _etext, _erodata, _edata, _end;extern unsigned long mfn_zero; -#define pfn_to_mfn (_pfn) (phys_to_machine_mapping[(_pfn)])static __inline__maddr_t phys_to_machine (paddr_t phys) {maddr_t machine =pfn_to_mfn (phys >>PAGE_SHIFT );
@@ -243,7 +222,6 @@ static __inline__ maddr_t phys_to_machine(paddr_t phys)return machine; } -#define mfn_to_pfn (_mfn) (machine_to_phys_mapping[(_mfn)])static __inline__paddr_t machine_to_phys (maddr_t machine) {paddr_t phys =mfn_to_pfn (machine >>PAGE_SHIFT );
@@ -267,13 +245,10 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)#define pte_to_mfn (_pte) (((_pte) & (PADDR_MASK&PAGE_MASK)) >> L1_PAGETABLE_SHIFT)#define pte_to_virt (_pte) to_virt(mfn_to_pfn(pte_to_mfn(_pte)) << PAGE_SHIFT) - -#define PT_BASE ((pgentry_t *)start_info.pt_base) -#ifdef __x86_64__ -#define virtual_to_l3 (_virt) ((pgentry_t *)pte_to_virt(PT_BASE[l4_table_offset(_virt)])) +#define virtual_to_l3 (_virt) ((pgentry_t *)pte_to_virt(pt_base[l4_table_offset(_virt)]))#else -#define virtual_to_l3 (_virt) PT_BASE +#define virtual_to_l3 (_virt) pt_base#endif #define virtual_to_l2 (_virt) ({ \
@@ -297,6 +272,7 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)#define do_map_zero (start, n) do_map_frames(start, &mfn_zero, n, 0, 0, DOMID_SELF, NULL, L1_PROT_RO)pgentry_t *need_pgt (unsigned long addr); +void arch_mm_preinit (void *p);#endif
include/xen/arch-x86/xen-x86_32.h +2 -0
@@ -55,6 +55,7 @@#define FLAT_USER_DS FLAT_RING3_DS#define FLAT_USER_SS FLAT_RING3_SS +#ifdef CONFIG_PARAVIRT #define __HYPERVISOR_VIRT_START_PAE 0xF5800000#define __MACH2PHYS_VIRT_START_PAE 0xF5800000#define __MACH2PHYS_VIRT_END_PAE 0xF6800000
@@ -90,6 +91,7 @@#ifndef machine_to_phys_mapping#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)#endif +#endif /* 32-/64-bit invariability for control interfaces (domctl/sysctl). */ #if defined(__XEN__) || defined(__XEN_TOOLS__)
include/xen/arch-x86/xen-x86_64.h +2 -0
@@ -70,6 +70,7 @@#define FLAT_USER_SS32 FLAT_RING3_SS32#define FLAT_USER_SS FLAT_USER_SS64 +#ifdef CONFIG_PARAVIRT #define __HYPERVISOR_VIRT_START 0xFFFF800000000000#define __HYPERVISOR_VIRT_END 0xFFFF880000000000#define __MACH2PHYS_VIRT_START 0xFFFF800000000000
@@ -86,6 +87,7 @@#ifndef machine_to_phys_mapping#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)#endif +#endif /* * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
mm.c +1 -0
@@ -39,6 +39,7 @@#include <xen/memory.h> #include <mini-os/mm.h> #include <mini-os/balloon.h> +#include <mini-os/paravirt.h> #include <mini-os/types.h> #include <mini-os/lib.h> #include <mini-os/xmalloc.h>
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 11/22 mini-os: add static page tables for virtual kernel area for HVMlite
In reply to Juergen GrossIn HVMlite mode we need the virtual kernel area for mapping of the console and xenbus ring pages as especially on 32 bit architecture their pfns might be above the supported maximum memory size.
Add the page tables needed for doing the mapping.
--- arch/x86/mm.c | 11 +++++++++++ arch/x86/x86_64.S | 7 +++++++ 2 files changed, 18 insertions(+)
arch/x86/mm.c +11 -0
@@ -733,6 +733,17 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) *start_pfn_p = start_pfn; *max_pfn_p = max_pfn; + +#ifndef CONFIG_PARAVIRT +#ifdef __x86_64__ +BUILD_BUG_ON (l4_table_offset (VIRT_KERNEL_AREA ) !=1 || +l3_table_offset (VIRT_KERNEL_AREA ) !=0 || +l2_table_offset (VIRT_KERNEL_AREA ) !=0 ); +#else +BUILD_BUG_ON (l3_table_offset (VIRT_KERNEL_AREA ) !=0 || +l2_table_offset (VIRT_KERNEL_AREA ) ==0 ); +#endif +#endif }grant_entry_t *arch_init_gnttab (int nr_grant_frames)
arch/x86/x86_64.S +7 -0
@@ -418,10 +418,17 @@ ENTRY(__arch_switch_threads) .data .globl page_table_base .align __PAGE_SIZE +page_table_virt_l2: + PTE(page_table_virt_l1 + L2_PROT) + .align __PAGE_SIZE, 0 +page_table_virt_l3: + PTE(page_table_virt_l2 + L3_PROT) + .align __PAGE_SIZE, 0 page_table_l3: PTE(page_table_l2 + L3_PROT) .align __PAGE_SIZE, 0 page_table_base: PTE(page_table_l3 + L4_PROT) + PTE(page_table_virt_l3 + L4_PROT) .align __PAGE_SIZE, 0 #endif
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 12/22 mini-os: add x86 native page table handling
In reply to Juergen GrossFor support of HVMlite don't use mmu_update hypercalls, but write the page table entries directly.
--- arch/x86/mm.c | 147 +++++++++++++++++++++++++++++++++++++------------- arch/x86/traps.c | 10 ++++ include/x86/arch_mm.h | 4 ++ include/x86/os.h | 9 ++++ 4 files changed, 132 insertions(+), 38 deletions(-)
arch/x86/mm.c +109 -38
@@ -123,16 +123,25 @@ void arch_mm_preinit(void *p)* table at offset in previous level MFN (pref_l_mfn). pt_pfn is a guest * PFN. */ +static pgentry_t pt_prot[PAGETABLE_LEVELS ] = { +L1_PROT , +L2_PROT , +L3_PROT , +#if defined(__x86_64__) +L4_PROT , +#endif +}; +static void new_pt_frame (unsigned long *pt_pfn,unsigned long prev_l_mfn,unsigned long offset,unsigned long level) { -pgentry_t *tab = pt_base; +pgentry_t *tab;unsigned long pt_page = (unsigned long )pfn_to_virt (*pt_pfn); -pgentry_t prot_e, prot_t; +#ifdef CONFIG_PARAVIRT mmu_update_t mmu_updates[1 ];int rc; +#endif - prot_e = prot_t =0 ;DEBUG ("Allocating new L%d pt frame for pfn=%lx, " "prev_l_mfn=%lx, offset=%lx" , level, *pt_pfn, prev_l_mfn, offset);
@@ -140,30 +149,12 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,/* We need to clear the page, otherwise we might fail to map it as a page table page */ memset ((void *) pt_page,0 ,PAGE_SIZE ); - -switch ( level ) - { -case L1_FRAME : - prot_e =L1_PROT ; - prot_t =L2_PROT ; -break ; -case L2_FRAME : - prot_e =L2_PROT ; - prot_t =L3_PROT ; -break ; -#if defined(__x86_64__) -case L3_FRAME : - prot_e =L3_PROT ; - prot_t =L4_PROT ; -break ; -#endif -default : -printk ("new_pt_frame() called with invalid level number %lu\n" , level); -do_exit (); -break ; - } +ASSERT (level >=1 && level <=PAGETABLE_LEVELS ); + +#ifdef CONFIG_PARAVIRT /* Make PFN a page table page */ + tab = pt_base;#if defined(__x86_64__) tab =pte_to_virt (tab[l4_table_offset (pt_page)]);#endif
@@ -172,7 +163,7 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn, mmu_updates[0 ].ptr = (tab[l2_table_offset (pt_page)] &PAGE_MASK ) +sizeof (pgentry_t) *l1_table_offset (pt_page); mmu_updates[0 ].val = (pgentry_t )pfn_to_mfn (*pt_pfn) <<PAGE_SHIFT | - (prot_e & ~_PAGE_RW); + (pt_prot[level -1 ] & ~_PAGE_RW);if ( (rc =HYPERVISOR_mmu_update (mmu_updates,1 ,NULL ,DOMID_SELF )) <0 ) {
@@ -184,13 +175,18 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,/* Hook the new page table page into the hierarchy */ mmu_updates[0 ].ptr = ((pgentry_t )prev_l_mfn <<PAGE_SHIFT ) +sizeof (pgentry_t) * offset; - mmu_updates[0 ].val = (pgentry_t )pfn_to_mfn (*pt_pfn) <<PAGE_SHIFT | prot_t; + mmu_updates[0 ].val = (pgentry_t )pfn_to_mfn (*pt_pfn) <<PAGE_SHIFT | + pt_prot[level];if ( (rc =HYPERVISOR_mmu_update (mmu_updates,1 ,NULL ,DOMID_SELF )) <0 ) {printk ("ERROR: mmu_update failed with rc=%d\n" , rc);do_exit (); } +#else + tab =mfn_to_virt (prev_l_mfn); + tab[offset] = (*pt_pfn <<PAGE_SHIFT ) | pt_prot[level]; +#endif *pt_pfn +=1 ; }
@@ -202,12 +198,14 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn) {unsigned long start_address, end_address;unsigned long pfn_to_map, pt_pfn = *start_pfn; -static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES +1 ];pgentry_t *tab = pt_base, page;unsigned long pt_mfn =pfn_to_mfn (virt_to_pfn (pt_base));unsigned long offset; +#ifdef CONFIG_PARAVIRT +static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES +1 ];int count =0 ;int rc; +#endif /* Be conservative: even if we know there will be more pages already mapped, start the loop at the very beginning. */
@@ -225,6 +223,10 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn) ((unsigned long )pfn_to_virt (*max_pfn) - (unsigned long)&_text)>>20); } +#else +/* Round up to next 2MB boundary as we are using 2MB pages on HVMlite. */ + pfn_to_map = (pfn_to_map +L1_PAGETABLE_ENTRIES -1 ) & + ~(L1_PAGETABLE_ENTRIES -1 );#endif start_address = (unsigned long )pfn_to_virt (pfn_to_map);
@@ -257,6 +259,7 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn) pt_mfn =pte_to_mfn (page); tab =to_virt (mfn_to_pfn (pt_mfn) <<PAGE_SHIFT ); offset =l2_table_offset (start_address); +#ifdef CONFIG_PARAVIRT /* Need new L1 pt frame */ if ( !(tab[offset] & _PAGE_PRESENT) )new_pt_frame (&pt_pfn, pt_mfn, offset,L1_FRAME );
@@ -288,6 +291,12 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn) count = 0; } start_address +=PAGE_SIZE ; +#else +if ( !(tab[offset] & _PAGE_PRESENT) ) + tab[offset] = (pgentry_t )pfn_to_map <<PAGE_SHIFT | +L2_PROT | _PAGE_PSE; + start_address +=1UL <<L2_PAGETABLE_SHIFT ; +#endif } *start_pfn = pt_pfn;
@@ -302,16 +311,19 @@ static void set_readonly(void *text, void *etext)unsigned long start_address = ((unsigned long ) text +PAGE_SIZE -1 ) &PAGE_MASK ;unsigned long end_address = (unsigned long ) etext; -static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES +1 ];pgentry_t *tab = pt_base, page;unsigned long mfn =pfn_to_mfn (virt_to_pfn (pt_base));unsigned long offset; +unsigned long page_size =PAGE_SIZE ; +#ifdef CONFIG_PARAVIRT +static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES +1 ];int count =0 ;int rc; +#endif printk ("setting %p-%p readonly\n" , text, etext); -while ( start_address +PAGE_SIZE <= end_address ) +while ( start_address + page_size <= end_address ) { tab = pt_base; mfn =pfn_to_mfn (virt_to_pfn (pt_base));
@@ -327,26 +339,34 @@ static void set_readonly(void *text, void *etext) mfn =pte_to_mfn (page); tab =to_virt (mfn_to_pfn (mfn) <<PAGE_SHIFT ); offset =l2_table_offset (start_address); - page = tab[offset]; - mfn =pte_to_mfn (page); - tab =to_virt (mfn_to_pfn (mfn) <<PAGE_SHIFT ); +if ( !(tab[offset] & _PAGE_PSE) ) + { + page = tab[offset]; + mfn =pte_to_mfn (page); + tab =to_virt (mfn_to_pfn (mfn) <<PAGE_SHIFT ); - offset =l1_table_offset (start_address); + offset =l1_table_offset (start_address); + }if ( start_address != (unsigned long )&shared_info ) { +#ifdef CONFIG_PARAVIRT mmu_updates[count].ptr = ((pgentry_t )mfn <<PAGE_SHIFT ) +sizeof (pgentry_t) * offset; mmu_updates[count].val = tab[offset] & ~_PAGE_RW; count++; +#else + tab[offset] &= ~_PAGE_RW; +#endif }else printk ("skipped %lx\n" , start_address); - start_address +=PAGE_SIZE ; + start_address += page_size; +#ifdef CONFIG_PARAVIRT if ( count ==L1_PAGETABLE_ENTRIES || - start_address +PAGE_SIZE > end_address ) + start_address + page_size > end_address ) { rc =HYPERVISOR_mmu_update (mmu_updates, count,NULL ,DOMID_SELF );if ( rc <0 )
@@ -356,8 +376,13 @@ static void set_readonly(void *text, void *etext) } count =0 ; } +#else +if ( start_address == (1UL <<L2_PAGETABLE_SHIFT ) ) + page_size =1UL <<L2_PAGETABLE_SHIFT ; +#endif } +#ifdef CONFIG_PARAVIRT { mmuext_op_t op = { .cmd = MMUEXT_TLB_FLUSH_ALL,
@@ -365,6 +390,9 @@ static void set_readonly(void *text, void *etext)int count; HYPERVISOR_mmuext_op(&op, 1, &count, DOMID_SELF); } +#else +write_cr3 ((unsigned long )pt_base); +#endif }/*
@@ -394,6 +422,8 @@ static pgentry_t *get_pgt(unsigned long va) offset =l2_table_offset (va);if ( !(tab[offset] & _PAGE_PRESENT) )return NULL ; +if ( tab[offset] & _PAGE_PSE ) +return &tab[offset]; mfn =pte_to_mfn (tab[offset]); tab =mfn_to_virt (mfn); offset =l1_table_offset (va);
@@ -448,6 +478,9 @@ pgentry_t *need_pgt(unsigned long va)new_pt_frame (&pt_pfn, pt_mfn, offset,L1_FRAME ); }ASSERT (tab[offset] & _PAGE_PRESENT); +if ( tab[offset] & _PAGE_PSE ) +return &tab[offset]; + pt_mfn =pte_to_mfn (tab[offset]); tab =mfn_to_virt (pt_mfn);
@@ -524,8 +557,6 @@ int do_map_frames(unsigned long va, {pgentry_t *pgt =NULL ;unsigned long done =0 ; -unsigned long i; -int rc;if ( !mfns ) {
@@ -539,6 +570,9 @@ int do_map_frames(unsigned long va,memset (err,0x00 , n *sizeof (int ));while ( done < n ) { +#ifdef CONFIG_PARAVIRT +unsigned long i; +int rc;unsigned long todo;if ( err )
@@ -578,6 +612,17 @@ int do_map_frames(unsigned long va, } } done += todo; +#else +if ( !pgt || !(va &L1_MASK ) ) + pgt =need_pgt (va & ~L1_MASK ); +if ( !pgt ) +return -ENOMEM ; + +ASSERT (!(*pgt & _PAGE_PSE)); + pgt[l1_table_offset (va)] = (pgentry_t) + (((mfns[done * stride] + done * incr) <<PAGE_SHIFT ) | prot); + done++; +#endif }return 0 ;
@@ -609,16 +654,21 @@ void *map_frames_ex(const unsigned long *mfns, unsigned long n,#define UNMAP_BATCH ((STACK_SIZE / 2) / sizeof(multicall_entry_t))int unmap_frames (unsigned long va,unsigned long num_frames) { +#ifdef CONFIG_PARAVIRT int n =UNMAP_BATCH ;multicall_entry_t call[n];int ret;int i; +#else +pgentry_t *pgt; +#endif ASSERT (!((unsigned long )va & ~PAGE_MASK ));DEBUG ("va=%p, num=0x%lx\n" , va, num_frames);while ( num_frames ) { +#ifdef CONFIG_PARAVIRT if ( n > num_frames ) n = num_frames;
@@ -653,6 +703,17 @@ int unmap_frames(unsigned long va, unsigned long num_frames) } } num_frames -= n; +#else + pgt =get_pgt (va); +if ( pgt ) + { +ASSERT (!(*pgt & _PAGE_PSE)); + *pgt =0 ; +invlpg (va); + } + va +=PAGE_SIZE ; + num_frames--; +#endif }return 0 ; }
@@ -662,14 +723,24 @@ int unmap_frames(unsigned long va, unsigned long num_frames)*/ static void clear_bootstrap (void ) { +#ifdef CONFIG_PARAVIRT pte_t nullpte = { };int rc; +#else +pgentry_t *pgt; +#endif /* Use first page as the CoW zero page */ memset (&_text,0 ,PAGE_SIZE ); mfn_zero =virt_to_mfn ((unsigned long ) &_text); +#ifdef CONFIG_PARAVIRT if ( (rc =HYPERVISOR_update_va_mapping (0 , nullpte,UVMF_INVLPG )) )printk ("Unable to unmap NULL page. rc=%d\n" , rc); +#else + pgt =get_pgt ((unsigned long )&_text); + *pgt =0 ; +invlpg ((unsigned long )&_text); +#endif }#ifdef CONFIG_PARAVIRT
arch/x86/traps.c +10 -0
@@ -121,7 +121,9 @@ void page_walk(unsigned long virt_address)static int handle_cow (unsigned long addr) {pgentry_t *tab = pt_base, page;unsigned long new_page; +#ifdef CONFIG_PARAVIRT int rc; +#endif #if defined(__x86_64__) page = tab[l4_table_offset (addr)];
@@ -137,6 +139,8 @@ static int handle_cow(unsigned long addr) { page = tab[l2_table_offset (addr)];if (!(page & _PAGE_PRESENT))return 0 ; +if ( page & _PAGE_PSE ) +return 0 ; tab =pte_to_virt (page); page = tab[l1_table_offset (addr)];
@@ -149,12 +153,18 @@ static int handle_cow(unsigned long addr) { new_page =alloc_pages (0 );memset ((void *) new_page,0 ,PAGE_SIZE ); +#ifdef CONFIG_PARAVIRT rc =HYPERVISOR_update_va_mapping (addr &PAGE_MASK ,__pte (virt_to_mach (new_page) |L1_PROT ),UVMF_INVLPG );if (!rc)return 1 ;printk ("Map zero page to %lx failed: %d.\n" , addr, rc);return 0 ; +#else + tab[l1_table_offset (addr)] =virt_to_mach (new_page) |L1_PROT ; +invlpg (addr); +return 1 ; +#endif }static void do_stack_walk (unsigned long frame_base)
include/x86/arch_mm.h +4 -0
@@ -78,6 +78,8 @@#define L2_PAGETABLE_ENTRIES 512#define L3_PAGETABLE_ENTRIES 4 +#define PAGETABLE_LEVELS 3 +#define PADDR_BITS 44#define PADDR_MASK ((1ULL << PADDR_BITS)-1)
@@ -110,6 +112,8 @@ typedef uint64_t pgentry_t;#define L3_PAGETABLE_ENTRIES 512#define L4_PAGETABLE_ENTRIES 512 +#define PAGETABLE_LEVELS 4 +/* These are page-table limitations. Current CPUs support only 40-bit phys. */ #define PADDR_BITS 52#define VADDR_BITS 48
include/x86/os.h +9 -0
@@ -206,6 +206,15 @@ static inline int irqs_disabled(void)*/ typedef struct {volatile int counter; }atomic_t ; +static inline void write_cr3 (unsigned long cr3) +{ + asmvolatile ("mov %0, %%cr3" : :"r" (cr3) :"memory" ); +} + +static inline void invlpg (unsigned long va) +{ + asmvolatile ("invlpg %0" : :"m" (*(const char *)(va)) :"memory" ); +}/************************** i386 *******************************/ #ifdef __INSIDE_MINIOS__
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 13/22 mini-os: correct wrong calculation of alloc bitmap size
In reply to Juergen GrossWhen remapping the page allocator's bitmap for the ballooning support the calculation of the needed size is wrong. This doesn't really matter today as nothing is allocated after that bitmap, but it should be corrected nevertheless.
--- balloon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
balloon.c +2 -2
@@ -52,7 +52,7 @@ void mm_alloc_bitmap_remap(void) {unsigned long i; -if ( mm_alloc_bitmap_size >= ((nr_max_pages +1 ) >> (PAGE_SHIFT +3 )) ) +if ( mm_alloc_bitmap_size >= ((nr_max_pages +1 ) >>3 ) )return ;for ( i =0 ; i < mm_alloc_bitmap_size; i +=PAGE_SIZE )
@@ -62,7 +62,7 @@ void mm_alloc_bitmap_remap(void) } mm_alloc_bitmap = (unsigned long *)virt_kernel_area_end; - virt_kernel_area_end +=round_pgup ((nr_max_pages +1 ) >> (PAGE_SHIFT +3 )); + virt_kernel_area_end +=round_pgup ((nr_max_pages +1 ) >>3 );ASSERT (virt_kernel_area_end <=VIRT_DEMAND_AREA ); }
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 14/22 mini-os: add map_frame_virt() function
In reply to Juergen GrossAdd a function map_frame_virt() to map a given frame and return its virtual address.
On arm we just use the frame physical address, while on x86 we take a page from the virtual kernel area. For this purpose make this area available even in case of undefined CONFIG_BALLOON.
--- arch/arm/balloon.c | 2 -- arch/arm/mm.c | 5 +++++ arch/x86/balloon.c | 13 ++++--------- arch/x86/mm.c | 23 +++++++++++++++++++++++ balloon.c | 9 ++++----- include/balloon.h | 1 - include/mm.h | 1 + include/x86/arch_mm.h | 1 + 8 files changed, 38 insertions(+), 17 deletions(-)
arch/arm/balloon.c +0 -2
@@ -25,8 +25,6 @@#ifdef CONFIG_BALLOON -unsigned long virt_kernel_area_end;/* TODO: find a virtual area */ -void arch_pfn_add (unsigned long pfn,unsigned long mfn) { }
arch/arm/mm.c +5 -0
@@ -141,3 +141,8 @@ grant_entry_t *arch_init_gnttab(int nr_grant_frames)return to_virt (gnttab_table); } + +unsigned long map_frame_virt (unsigned long mfn) +{ +return mfn_to_virt (mfn); +}
arch/x86/balloon.c +4 -9
@@ -29,9 +29,6 @@#include <mini-os/paravirt.h> #ifdef CONFIG_BALLOON - -unsigned long virt_kernel_area_end = VIRT_KERNEL_AREA; - #ifdef CONFIG_PARAVIRT static void p2m_invalidate(unsigned long *list, unsigned long start_idx) {
@@ -53,7 +50,7 @@ static inline unsigned long *p2m_to_virt(unsigned long p2m)void arch_remap_p2m (unsigned long max_pfn) { -unsigned long pfn; +unsigned long pfn, new_p2m;unsigned long *l3_list, *l2_list, *l1_list; l3_list =p2m_l3list ();
@@ -67,17 +64,15 @@ void arch_remap_p2m(unsigned long max_pfn)if (p2m_pages (nr_max_pages) <=p2m_pages (max_pfn) )return ; + new_p2m =alloc_virt_kernel (p2m_pages (nr_max_pages));for ( pfn =0 ; pfn < max_pfn; pfn +=P2M_ENTRIES ) { -map_frame_rw (virt_kernel_area_end +PAGE_SIZE * (pfn /P2M_ENTRIES ), +map_frame_rw (new_p2m +PAGE_SIZE * (pfn /P2M_ENTRIES ),virt_to_mfn (phys_to_machine_mapping + pfn)); } - phys_to_machine_mapping = (unsigned long *)virt_kernel_area_end; + phys_to_machine_mapping = (unsigned long *)new_p2m;printk ("remapped p2m list to %p\n" , phys_to_machine_mapping); - - virt_kernel_area_end +=PAGE_SIZE *p2m_pages (nr_max_pages); -ASSERT (virt_kernel_area_end <=VIRT_DEMAND_AREA ); }int arch_expand_p2m (unsigned long max_pfn)
arch/x86/mm.c +23 -0
@@ -57,6 +57,7 @@ unsigned long mfn_zero;pgentry_t *pt_base;static unsigned long first_free_pfn;static unsigned long last_free_pfn; +static unsigned long virt_kernel_area_end =VIRT_KERNEL_AREA ;extern char stack[];extern void page_walk (unsigned long va);
@@ -829,3 +830,25 @@ grant_entry_t *arch_init_gnttab(int nr_grant_frames)HYPERVISOR_grant_table_op (GNTTABOP_setup_table, &setup,1 );return map_frames (frames, nr_grant_frames); } + +unsigned long alloc_virt_kernel (unsigned n_pages) +{ +unsigned long addr; + + addr = virt_kernel_area_end; + virt_kernel_area_end +=PAGE_SIZE * n_pages; +ASSERT (virt_kernel_area_end <=VIRT_DEMAND_AREA ); + +return addr; +} + +unsigned long map_frame_virt (unsigned long mfn) +{ +unsigned long addr; + + addr =alloc_virt_kernel (1 ); +if (map_frame_rw (addr, mfn) ) +return 0 ; + +return addr; +}
balloon.c +4 -5
@@ -50,20 +50,19 @@ void get_max_pages(void)void mm_alloc_bitmap_remap (void ) { -unsigned long i; +unsigned long i, new_bitmap;if ( mm_alloc_bitmap_size >= ((nr_max_pages +1 ) >>3 ) )return ; + new_bitmap =alloc_virt_kernel (PFN_UP ((nr_max_pages +1 ) >>3 ));for ( i =0 ; i < mm_alloc_bitmap_size; i +=PAGE_SIZE ) { -map_frame_rw (virt_kernel_area_end + i, +map_frame_rw (new_bitmap + i,virt_to_mfn ((unsigned long )(mm_alloc_bitmap) + i)); } - mm_alloc_bitmap = (unsigned long *)virt_kernel_area_end; - virt_kernel_area_end +=round_pgup ((nr_max_pages +1 ) >>3 ); -ASSERT (virt_kernel_area_end <=VIRT_DEMAND_AREA ); + mm_alloc_bitmap = (unsigned long *)new_bitmap; }#define N_BALLOON_FRAMES 64
include/balloon.h +0 -1
@@ -33,7 +33,6 @@#define BALLOON_EMERGENCY_PAGES 64extern unsigned long nr_max_pages; -extern unsigned long virt_kernel_area_end;extern unsigned long nr_mem_pages;void get_max_pages (void );
include/mm.h +1 -0
@@ -79,6 +79,7 @@ int do_map_frames(unsigned long addr, unsigned long increment, domid_t id, int *err, unsigned long prot);int unmap_frames (unsigned long va,unsigned long num_frames);int map_frame_rw (unsigned long addr,unsigned long mfn); +unsigned long map_frame_virt (unsigned long mfn);#ifdef HAVE_LIBC extern unsigned long heap, brk, heap_mapped, heap_end;#endif
include/x86/arch_mm.h +1 -0
@@ -277,6 +277,7 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)pgentry_t *need_pgt (unsigned long addr);void arch_mm_preinit (void *p); +unsigned long alloc_virt_kernel (unsigned n_pages);#endif
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 15/22 mini-os: setup console interface parameters
In reply to Juergen GrossIn order to support HVMlite we need to get the ring page and event channel from the hypervisor via hypercalls. Move the already existing get_console() function from arm specific coding to console/xencons_ring.c and provide a similar paravirtualized function.
--- arch/arm/setup.c | 16 +--------------- arch/x86/setup.c | 1 + console/xencons_ring.c | 38 ++++++++++++++++++++++++++++++-------- events.c | 2 +- include/console.h | 3 ++- 5 files changed, 35 insertions(+), 25 deletions(-)
arch/arm/setup.c +1 -15
@@ -25,20 +25,6 @@ extern char shared_info_page[PAGE_SIZE];void *device_tree; -static void get_console (void ) -{ -uint64_t v =-1 ; - -hvm_get_parameter (HVM_PARAM_CONSOLE_EVTCHN , &v); - start_info.console.domU.evtchn = v; - -hvm_get_parameter (HVM_PARAM_CONSOLE_PFN , &v); - start_info.console.domU.mfn = v; - -printk ("Console is on port %d\n" , start_info.console.domU.evtchn); -printk ("Console ring is at mfn %lx\n" , (unsigned long ) start_info.console.domU.mfn); -} -void get_xenbus (void ) {uint64_t value;
@@ -85,7 +71,7 @@ void arch_init(void *dtb_pointer, uint32_t physical_offset) HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;/* Fill in start_info */ -get_console (); +get_console (NULL );get_xenbus ();gic_init ();
arch/x86/setup.c +1 -0
@@ -137,6 +137,7 @@ arch_init(void *par)/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ +get_console (par); si = par;memcpy (&start_info, si,sizeof (*si));
console/xencons_ring.c +30 -8
@@ -9,27 +9,49 @@#include <xen/io/console.h> #include <xen/io/protocols.h> #include <xen/io/ring.h> +#include <xen/hvm/params.h> #include <mini-os/xmalloc.h> #include <mini-os/gnttab.h> #include "console.h" DECLARE_WAIT_QUEUE_HEAD (console_queue); +static struct xencons_interface *console_ring; +uint32_t console_evtchn; + +#ifdef CONFIG_PARAVIRT +void get_console (void *p) +{ +start_info_t *si = p; + + console_ring =mfn_to_virt (si->console.domU.mfn); + console_evtchn = si->console.domU.evtchn; +} +#else +void get_console (void *p) +{ +uint64_t v =-1 ; + +hvm_get_parameter (HVM_PARAM_CONSOLE_EVTCHN , &v); + console_evtchn = v; + +hvm_get_parameter (HVM_PARAM_CONSOLE_PFN , &v); + console_ring = (struct xencons_interface *)map_frame_virt (v); +} +#endif +static inline void notify_daemon (struct consfront_dev *dev) {/* Use evtchn: this is called early, before irq is set up. */ if (!dev) -notify_remote_via_evtchn (start_info.console.domU.evtchn); +notify_remote_via_evtchn (console_evtchn);else notify_remote_via_evtchn (dev->evtchn); }static inline struct xencons_interface *xencons_interface (void ) { -if (start_info.console.domU.evtchn) -return mfn_to_virt (start_info.console.domU.mfn); -else -return NULL ; +return console_evtchn ? console_ring :NULL ; }int xencons_ring_send_no_notify (struct consfront_dev *dev,const char *data,unsigned len)
@@ -158,7 +180,7 @@ struct consfront_dev *xencons_ring_init(void)int err;struct consfront_dev *dev; -if (!start_info.console.domU.evtchn) +if (!console_evtchn)return 0 ; dev =malloc (sizeof (struct consfront_dev ));
@@ -171,8 +193,8 @@ struct consfront_dev *xencons_ring_init(void)#ifdef HAVE_LIBC dev->fd =-1 ;#endif - dev->evtchn = start_info.console.domU.evtchn; - dev->ring = (struct xencons_interface *)mfn_to_virt (start_info.console.domU.mfn); + dev->evtchn = console_evtchn; + dev->ring =xencons_interface (); err =bind_evtchn (dev->evtchn, console_handle_input, dev);if (err <=0 ) {
events.c +1 -1
@@ -46,7 +46,7 @@ void unbind_all_ports(void)for ( i =0 ; i <NR_EVS ; i++ ) { -if ( i == start_info.console.domU.evtchn || +if ( i == console_evtchn || i == start_info.store_evtchn)continue ;
include/console.h +2 -1
@@ -61,7 +61,7 @@ struct consfront_dev {#endif }; - +extern uint32_t console_evtchn;void int direct,const char *fmt,va_list args);void printk (const char *fmt, ...) __attribute__ ((format (printf,1 ,2 )));
@@ -72,6 +72,7 @@ void xprintk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));void xencons_rx (char *buf,unsigned len,struct pt_regs *regs);void xencons_tx (void ); +void get_console (void *p);void init_console (void );void console_print (struct consfront_dev *dev,char *data,int length);void fini_console (struct consfront_dev *dev);
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 16/22 mini-os: setup xenbus interface parameters
In reply to Juergen GrossIn order to support HVMlite we need to get the ring page and event channel from the hypervisor via hypercalls. Move the already existing get_xenbus() function from arm specific coding to xenbus/xenbus.c and provide a similar paravirtualized function.
--- arch/arm/setup.c | 16 +--------------- arch/x86/setup.c | 1 + events.c | 3 +-- include/xenbus.h | 3 +++ xenbus/xenbus.c | 40 +++++++++++++++++++++++++++++++--------- 5 files changed, 37 insertions(+), 26 deletions(-)
arch/arm/setup.c +1 -15
@@ -25,20 +25,6 @@ extern char shared_info_page[PAGE_SIZE];void *device_tree; -void get_xenbus (void ) -{ -uint64_t value; - -if (hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &value)) -BUG (); - - start_info.store_evtchn = (int )value; - -if (hvm_get_parameter (HVM_PARAM_STORE_PFN , &value)) -BUG (); - start_info.store_mfn = (unsigned long )value; -} -/* * INITIAL C ENTRY POINT. */
@@ -72,7 +58,7 @@ void arch_init(void *dtb_pointer, uint32_t physical_offset)/* Fill in start_info */ get_console (NULL ); -get_xenbus (); +get_xenbus (NULL );gic_init ();
arch/x86/setup.c +1 -0
@@ -138,6 +138,7 @@ arch_init(void *par)/* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ get_console (par); +get_xenbus (par); si = par;memcpy (&start_info, si,sizeof (*si));
events.c +1 -2
@@ -46,8 +46,7 @@ void unbind_all_ports(void)for ( i =0 ; i <NR_EVS ; i++ ) { -if ( i == console_evtchn || - i == start_info.store_evtchn) +if ( i == console_evtchn || i == xenbus_evtchn )continue ;if (test_and_clear_bit (i, bound_ports) )
include/xenbus.h +3 -0
@@ -29,6 +29,9 @@ struct xenbus_event { };typedef struct xenbus_event *xenbus_event_queue ; +extern uint32_t xenbus_evtchn; + +void get_xenbus (void *p);char *xenbus_watch_path_token (xenbus_transaction_t xbt,const char *path,const char *token,xenbus_event_queue *events);char *xenbus_unwatch_path_token (xenbus_transaction_t xbt,const char *path,const char *token);extern struct wait_queue_head xenbus_watch_queue;
xenbus/xenbus.c +31 -9
@@ -26,6 +26,7 @@#include <mini-os/sched.h> #include <mini-os/wait.h> #include <xen/io/xs_wire.h> +#include <xen/hvm/params.h> #include <mini-os/spinlock.h> #include <mini-os/xmalloc.h>
@@ -62,6 +63,31 @@ struct xenbus_req_info#define NR_REQS 32static struct xenbus_req_info req_info[NR_REQS ]; +uint32_t xenbus_evtchn; + +#ifdef CONFIG_PARAVIRT +void get_xenbus (void *p) +{ +start_info_t *si = p; + + xenbus_evtchn = si->store_evtchn; + xenstore_buf =mfn_to_virt (si->store_mfn); +} +#else +void get_xenbus (void *p) +{ +uint64_t v; + +if (hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &v) ) +BUG (); + xenbus_evtchn = v; + +if (hvm_get_parameter (HVM_PARAM_STORE_PFN , &v) ) +BUG (); + xenstore_buf = (struct xenstore_domain_interface *)map_frame_virt (v); +} +#endif + static void memcpy_from_ring(const void *Ring, void *Dest, int off,
@@ -269,7 +295,7 @@ static void xenbus_thread_func(void *ign) }wmb (); -notify_remote_via_evtchn (start_info.store_evtchn); +notify_remote_via_evtchn (xenbus_evtchn); } } }
@@ -335,15 +361,11 @@ void init_xenbus(void) {int err;DEBUG ("init_xenbus called.\n" ); - xenstore_buf =mfn_to_virt (start_info.store_mfn);create_thread ("xenstore" , xenbus_thread_func,NULL );DEBUG ("buf at %p.\n" , xenstore_buf); - err =bind_evtchn (start_info.store_evtchn, - xenbus_evtchn_handler, -NULL ); -unmask_evtchn (start_info.store_evtchn); -printk ("xenbus initialised on irq %d mfn %#llx\n" , - err, (unsigned long long ) start_info.store_mfn); + err =bind_evtchn (xenbus_evtchn, xenbus_evtchn_handler,NULL ); +unmask_evtchn (xenbus_evtchn); +printk ("xenbus initialised on irq %d\n" , err); }void fini_xenbus (void )
@@ -425,7 +447,7 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id, xenstore_buf->req_prod += len;/* Send evtchn to notify remote */ -notify_remote_via_evtchn (start_info.store_evtchn); +notify_remote_via_evtchn (xenbus_evtchn); }/* Send a mesasge to xenbus, in the same fashion as xb_write, and
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 17/22 mini-os: add get_cmdline() function
In reply to Juergen GrossThe command line parameters are passed in start_info structure for pv, but via hvm_start_info for HVMlite. Add a generic function to fill a local cmdline variable with the command line string.
--- arch/x86/setup.c | 20 ++++++++++++++++++-- include/kernel.h | 3 +++ kernel.c | 1 + main.c | 5 +++-- 4 files changed, 25 insertions(+), 4 deletions(-)
arch/x86/setup.c +18 -2
@@ -31,6 +31,7 @@#include <mini-os/kernel.h> #include <xen/xen.h> #include <xen/arch-x86/cpuid.h> +#include <xen/arch-x86/hvm/start_info.h> /* * Shared page for communicating with the hypervisor.
@@ -88,6 +89,13 @@ static inline void sse_init(void) {#ifdef CONFIG_PARAVIRT #define hpc_init () + +static void get_cmdline (void *p) +{ +start_info_t *si = p; + +strncpy (cmdline, (char *)si->cmd_line,MAX_CMDLINE_SIZE -1 ); +}#else static void hpc_init (void ) {
@@ -109,6 +117,14 @@ static void hpc_init(void)wrmsrl (ebx, (unsigned long )&hypercall_page); barrier(); } + +static void get_cmdline (void *p) +{ +struct hvm_start_info *si = p; + +if ( si->cmdline_paddr ) +strncpy (cmdline,to_virt (si->cmdline_paddr),MAX_CMDLINE_SIZE -1 ); +}#endif /*
@@ -139,6 +155,7 @@ arch_init(void *par)shared_info. Use xprintk instead. */ get_console (par);get_xenbus (par); +get_cmdline (par); si = par;memcpy (&start_info, si,sizeof (*si));
@@ -153,8 +170,7 @@ arch_init(void *par)printk (" mod_start: 0x%lx(VA)\n" , si->mod_start);printk (" mod_len: %lu\n" , si->mod_len);printk (" flags: 0x%x\n" , (unsigned int )si->flags); -printk (" cmd_line: %s\n" , - si->cmd_line ? (const char *)si->cmd_line :"NULL" ); +printk (" cmd_line: %s\n" , cmdline);printk (" stack: %p-%p\n" , stack, stack +sizeof (stack));/* Grab the shared_info pointer and put it in a safe place. */
include/kernel.h +3 -0
@@ -1,6 +1,9 @@#ifndef _KERNEL_H_#define _KERNEL_H_ +#define MAX_CMDLINE_SIZE 1024 +extern char cmdline[MAX_CMDLINE_SIZE ]; +void start_kernel (void );void do_exit (void ) __attribute__((noreturn));void arch_do_exit (void );
kernel.c +1 -0
@@ -48,6 +48,7 @@#include <xen/version.h> uint8_t xen_features[XENFEAT_NR_SUBMAPS *32 ]; +char cmdline[MAX_CMDLINE_SIZE ];void setup_xen_features (void ) {
main.c +3 -2
@@ -6,6 +6,7 @@#ifdef HAVE_LIBC #include <os.h> +#include <kernel.h> #include <sched.h> #include <console.h> #include <netfront.h>
@@ -134,7 +135,7 @@ static void call_main(void *p)#define PARSE_ARGS_COUNT (ARGS ) PARSE_ARGS(ARGS, argc++, c++, )#define PARSE_ARGS_STORE (ARGS ) PARSE_ARGS(ARGS, argv[argc++] = c, memmove(c, c + 1, strlen(c + 1) + 1), *c++ = 0) -PARSE_ARGS_COUNT ((char *)start_info.cmd_line); +PARSE_ARGS_COUNT (cmdline);#ifdef CONFIG_QEMU_XS_ARGS PARSE_ARGS_COUNT (domargs);#endif
@@ -143,7 +144,7 @@ static void call_main(void *p) argv[0 ] ="main" ; argc =1 ; - PARSE_ARGS_STORE((char*)start_info.cmd_line) + PARSE_ARGS_STORE(cmdline)#ifdef CONFIG_QEMU_XS_ARGS PARSE_ARGS_STORE(domargs)#endif
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 18/22 mini-os: map shared info page for HVMlite
In reply to Juergen GrossAdd a service function to map the shared info page on a non-paravirtualized system. The code is already existing on ARM side, just move it to hypervisor.c.
--- arch/arm/arm32.S | 4 ++-- arch/arm/setup.c | 11 +---------- arch/x86/setup.c | 38 ++++++++++++++++++++------------------ hypervisor.c | 17 +++++++++++++++++ include/hypervisor.h | 1 + 5 files changed, 41 insertions(+), 30 deletions(-)
arch/arm/arm32.S +2 -2
@@ -151,8 +151,8 @@ stage2: .pushsection .bss @ Note: calling arch_init zeroes out this region. .align 12 -.globl shared_info_page -shared_info_page: +.globl shared_info +shared_info: .fill (1024), 4, 0x0 .align 3
arch/arm/setup.c +1 -10
@@ -21,8 +21,6 @@ union start_info_union start_info_union;*/ shared_info_t *HYPERVISOR_shared_info; -extern char shared_info_page[PAGE_SIZE ]; -void *device_tree;/*
@@ -30,7 +28,6 @@ void *device_tree;*/ void arch_init (void *dtb_pointer,uint32_t physical_offset) { -struct xen_add_to_physmap xatp;int r;memset (&__bss_start,0 , &_end - &__bss_start);
@@ -48,13 +45,7 @@ void arch_init(void *dtb_pointer, uint32_t physical_offset) device_tree = dtb_pointer;/* Map shared_info page */ - xatp.domid =DOMID_SELF ; - xatp.idx =0 ; - xatp.space = XENMAPSPACE_shared_info; - xatp.gpfn =virt_to_pfn (shared_info_page); -if (HYPERVISOR_memory_op (XENMEM_add_to_physmap, &xatp) !=0 ) -BUG (); - HYPERVISOR_shared_info = (struct shared_info *)shared_info_page; + HYPERVISOR_shared_info =map_shared_info (NULL );/* Fill in start_info */ get_console (NULL );
arch/x86/setup.c +20 -18
@@ -60,20 +60,6 @@ extern char shared_info[PAGE_SIZE]; ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })#endif -static -shared_info_t *map_shared_info (unsigned long pa) -{ -int rc; - -if ( (rc =HYPERVISOR_update_va_mapping ( - (unsigned long )shared_info,__pte (pa |7 ),UVMF_INVLPG )) ) - { -printk ("Failed to map shared_info!! rc=%d\n" , rc); -do_exit (); - } -return (shared_info_t *)shared_info; -} -static inline void fpu_init (void ) { asmvolatile ("fninit" ); }
@@ -90,6 +76,21 @@ static inline void sse_init(void) {#ifdef CONFIG_PARAVIRT #define hpc_init () +shared_info_t *map_shared_info (void *p) +{ +int rc; +start_info_t *si = p; +unsigned long pa = si->shared_info; + +if ( (rc =HYPERVISOR_update_va_mapping ((unsigned long )shared_info, +__pte (pa |7 ),UVMF_INVLPG )) ) + { +printk ("Failed to map shared_info!! rc=%d\n" , rc); +do_exit (); + } +return (shared_info_t *)shared_info; +} +static void get_cmdline (void *p) {start_info_t *si = p;
@@ -156,6 +157,10 @@ arch_init(void *par)get_console (par);get_xenbus (par);get_cmdline (par); + +/* Grab the shared_info pointer and put it in a safe place. */ + HYPERVISOR_shared_info =map_shared_info (par); + si = par;memcpy (&start_info, si,sizeof (*si));
@@ -163,7 +168,7 @@ arch_init(void *par)printk ("Xen Minimal OS!\n" );printk (" start_info: %p(VA)\n" , si);printk (" nr_pages: 0x%lx\n" , si->nr_pages); -printk (" shared_inf: 0x%08lx(MA)\n" , si->shared_info); +printk (" shared_inf: %p(VA)\n" , HYPERVISOR_shared_info);printk (" pt_base: %p(VA)\n" , (void *)si->pt_base);printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames);printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list);
@@ -173,9 +178,6 @@ arch_init(void *par)printk (" cmd_line: %s\n" , cmdline);printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); -/* Grab the shared_info pointer and put it in a safe place. */ - HYPERVISOR_shared_info =map_shared_info (start_info.shared_info); -start_kernel (); }
hypervisor.c +17 -0
@@ -29,6 +29,7 @@#include <mini-os/lib.h> #include <mini-os/hypervisor.h> #include <mini-os/events.h> +#include <xen/memory.h> #define active_evtchns (cpu,sh,idx) \ ((sh)->evtchn_pending[idx] & \
@@ -37,6 +38,8 @@int in_callback;#ifndef CONFIG_PARAVIRT +extern shared_info_t shared_info; +int hvm_get_parameter (int idx,uint64_t *value) {struct xen_hvm_param xhv;
@@ -61,6 +64,20 @@ int hvm_set_parameter(int idx, uint64_t value) xhv.value = value; return HYPERVISOR_hvm_op(HVMOP_set_param, &xhv); } + +shared_info_t *map_shared_info (void *p) +{ +struct xen_add_to_physmap xatp; + + xatp.domid =DOMID_SELF ; + xatp.idx =0 ; + xatp.space = XENMAPSPACE_shared_info; + xatp.gpfn =virt_to_pfn (&shared_info); +if (HYPERVISOR_memory_op (XENMEM_add_to_physmap, &xatp) !=0 ) +BUG (); + +return &shared_info; +}#endif void do_hypervisor_callback (struct pt_regs *regs)
include/hypervisor.h +1 -0
@@ -42,6 +42,7 @@ extern union start_info_union start_info_union;int hvm_get_parameter (int idx,uint64_t *value);int hvm_set_parameter (int idx,uint64_t value);#endif +shared_info_t *map_shared_info (void *p);void force_evtchn_callback (void );void do_hypervisor_callback (struct pt_regs *regs);void mask_evtchn (uint32_t port);
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 19/22 mini-os: remove using start_info in architecture independent code
In reply to Juergen GrossThe start_info structure should be used only in case of CONFIG_PARAVIRT defined. Remove it from being used in other places. Especially the usage as parameter for applications linked to the kernel is no good idea.
--- arch/arm/setup.c | 8 -------- arch/x86/setup.c | 8 -------- daytime.c | 2 +- include/hypervisor.h | 11 ----------- kernel.c | 6 +++--- main.c | 6 +++--- test.c | 20 ++++++++++---------- 7 files changed, 17 insertions(+), 44 deletions(-)
arch/arm/setup.c +0 -8
@@ -9,13 +9,6 @@#include <libfdt.h> /* -* This structure contains start-of-day info, such as pagetable base pointer, -* address of the shared_info structure, and things like that. -* On x86, the hypervisor passes it to us. On ARM, we fill it in ourselves. -*/ -union start_info_union start_info_union; - -/* * Shared page for communicating with the hypervisor. * Events flags go here, for example. */
@@ -47,7 +40,6 @@ void arch_init(void *dtb_pointer, uint32_t physical_offset)/* Map shared_info page */ HYPERVISOR_shared_info =map_shared_info (NULL ); -/* Fill in start_info */ get_console (NULL );get_xenbus (NULL );
arch/x86/setup.c +0 -8
@@ -40,12 +40,6 @@shared_info_t *HYPERVISOR_shared_info;/* -* This structure contains start-of-day info, such as pagetable base pointer, -* address of the shared_info structure, and things like that. -*/ -union start_info_union start_info_union; - -/* * Just allocate the kernel stack here. SS:ESP is set up to point here * in head.S. */
@@ -151,7 +145,6 @@ arch_init(void *par)/* Setup memory management info from start_info. */ arch_mm_preinit (par); -/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ get_console (par);
@@ -162,7 +155,6 @@ arch_init(void *par) HYPERVISOR_shared_info =map_shared_info (par); si = par; -memcpy (&start_info, si,sizeof (*si));/* print out some useful information */ printk ("Xen Minimal OS!\n" );
daytime.c +1 -1
@@ -60,7 +60,7 @@ void run_server(void *p) } -int app_main (start_info_t *si) +int app_main (void *p) {create_thread ("server" , run_server,NULL );return 0 ;
include/hypervisor.h +0 -11
@@ -26,17 +26,6 @@#include <xen/hvm/hvm_op.h> #include <mini-os/traps.h> -/* -* a placeholder for the start of day information passed up from the hypervisor -*/ -union start_info_union -{ -start_info_t start_info; -char padding[512 ]; -}; -extern union start_info_union start_info_union; -#define start_info (start_info_union.start_info) -/* hypervisor.c */ #ifndef CONFIG_PARAVIRT int hvm_get_parameter (int idx,uint64_t *value);
kernel.c +3 -3
@@ -110,9 +110,9 @@ static void shutdown_thread(void *p)/* This should be overridden by the application we are linked against. */ -__attribute__((weak))int app_main (start_info_t *si) +__attribute__((weak))int app_main (void *p) { -printk ("kernel.c: dummy main: start_info=%p\n" , si); +printk ("kernel.c: dummy main: par=%p\n" , p);return 0 ; }
@@ -149,7 +149,7 @@ void start_kernel(void)#endif /* Call (possibly overridden) app_main() */ -app_main (&start_info); +app_main (NULL );/* Everything initialised, start idle thread */ run_idle_thread ();
main.c +3 -3
@@ -185,10 +185,10 @@ void _exit(int ret) do_exit(); } -int app_main (start_info_t *si) +int app_main (void *p) { -printk ("main.c: dummy main: start_info=%p\n" , si); - main_thread =create_thread ("main" , call_main, si); +printk ("main.c: dummy main: par=%p\n" , p); + main_thread =create_thread ("main" , call_main, p);return 0 ; }#endif
test.c +10 -10
@@ -552,28 +552,28 @@ static void shutdown_thread(void *p) }#endif -int app_main (start_info_t *si) +int app_main (void *p) { -printk ("Test main: start_info=%p\n" , si); +printk ("Test main: par=%p\n" , p);#ifdef CONFIG_XENBUS -create_thread ("xenbus_tester" , xenbus_tester, si); +create_thread ("xenbus_tester" , xenbus_tester, p);#endif -create_thread ("periodic_thread" , periodic_thread, si); +create_thread ("periodic_thread" , periodic_thread, p);#ifdef CONFIG_NETFRONT -create_thread ("netfront" , netfront_thread, si); +create_thread ("netfront" , netfront_thread, p);#endif #ifdef CONFIG_BLKFRONT -create_thread ("blkfront" , blkfront_thread, si); +create_thread ("blkfront" , blkfront_thread, p);#endif #if defined(CONFIG_FBFRONT ) && defined(CONFIG_KBDFRONT ) -create_thread ("fbfront" , fbfront_thread, si); -create_thread ("kbdfront" , kbdfront_thread, si); +create_thread ("fbfront" , fbfront_thread, p); +create_thread ("kbdfront" , kbdfront_thread, p);#endif #ifdef CONFIG_PCIFRONT -create_thread ("pcifront" , pcifront_thread, si); +create_thread ("pcifront" , pcifront_thread, p);#endif #ifdef CONFIG_XENBUS -create_thread ("shutdown" , shutdown_thread, si); +create_thread ("shutdown" , shutdown_thread, p);#endif return 0 ; }
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 20/22 mini-os: print start of day messages depending on domain type
In reply to Juergen GrossSelect what to print in arch_init() depending on the domain type.
---
V2: add printing nr_modules as requested by Samuel Thibault
--- arch/x86/setup.c | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-)
arch/x86/setup.c +33 -15
@@ -91,6 +91,24 @@ static void get_cmdline(void *p)strncpy (cmdline, (char *)si->cmd_line,MAX_CMDLINE_SIZE -1 ); } + +static void print_start_of_day (void *p) +{ +start_info_t *si = p; + +printk ("Xen Minimal OS (pv)!\n" ); +printk (" start_info: %p(VA)\n" , si); +printk (" nr_pages: 0x%lx\n" , si->nr_pages); +printk (" shared_inf: 0x%08lx(MA)\n" , si->shared_info); +printk (" pt_base: %p(VA)\n" , (void *)si->pt_base); +printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames); +printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list); +printk (" mod_start: 0x%lx(VA)\n" , si->mod_start); +printk (" mod_len: %lu\n" , si->mod_len); +printk (" flags: 0x%x\n" , (unsigned int )si->flags); +printk (" cmd_line: %s\n" , cmdline); +printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); +}#else static void hpc_init (void ) {
@@ -120,6 +138,20 @@ static void get_cmdline(void *p)if ( si->cmdline_paddr ) strncpy(cmdline, to_virt(si->cmdline_paddr), MAX_CMDLINE_SIZE - 1); } + +static void print_start_of_day (void *p) +{ +struct hvm_start_info *si = p; + +printk ("Xen Minimal OS (hvm)!\n" ); +printk (" start_info: %p(VA)\n" , si); +printk (" shared_inf: %p(VA)\n" , HYPERVISOR_shared_info); +printk (" modlist: 0x%lx(PA)\n" , (unsigned long )si->modlist_paddr); +printk (" nr_modules: %u\n" , si->nr_modules); +printk (" flags: 0x%x\n" , (unsigned int )si->flags); +printk (" cmd_line: %s\n" , cmdline); +printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); +}#endif /*
@@ -129,7 +161,6 @@ void arch_init(void *par) {static char hello[] ="Bootstrapping...\n" ; -start_info_t *si;hpc_init (); (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello);
@@ -154,21 +185,8 @@ arch_init(void *par)/* Grab the shared_info pointer and put it in a safe place. */ HYPERVISOR_shared_info =map_shared_info (par); - si = par; -/* print out some useful information */ -printk ("Xen Minimal OS!\n" ); -printk (" start_info: %p(VA)\n" , si); -printk (" nr_pages: 0x%lx\n" , si->nr_pages); -printk (" shared_inf: %p(VA)\n" , HYPERVISOR_shared_info); -printk (" pt_base: %p(VA)\n" , (void *)si->pt_base); -printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames); -printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list); -printk (" mod_start: 0x%lx(VA)\n" , si->mod_start); -printk (" mod_len: %lu\n" , si->mod_len); -printk (" flags: 0x%x\n" , (unsigned int )si->flags); -printk (" cmd_line: %s\n" , cmdline); -printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); +print_start_of_day (par);start_kernel (); }
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 21/22 mini-os: get physical memory map
In reply to Juergen GrossOn HVMlite we have to look at the physical memory map to know which memory frames are usable.
In order to make life easier we define a dummy memory map for other domain types (pv and arm) which has just one entry with a maximum memory size.
--- arch/arm/mm.c | 8 ++++++ arch/x86/mm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ arch/x86/setup.c | 1 + include/e820.h | 48 +++++++++++++++++++++++++++++++ include/x86/arch_mm.h | 4 +++ mm.c | 79 ++++++++++++++++++++++++++++++++------------------- 6 files changed, 183 insertions(+), 29 deletions(-) create mode 100644 include/e820.h
arch/arm/mm.c +8 -0
@@ -7,6 +7,14 @@#include <lib.h> uint32_t physical_address_offset; +struct e820entry e820_map[1 ] = { + { + .addr =0 , + .size =ULONG_MAX -1 , + .type =E820_RAM + } +}; +unsigned e820_entries =1 ;unsigned long allocate_ondemand (unsigned long n,unsigned long alignment) {
arch/x86/mm.c +72 -0
100 lines not on this page · raw message
arch/x86/setup.c +1 -0
@@ -151,6 +151,7 @@ static void print_start_of_day(void *p)printk (" flags: 0x%x\n" , (unsigned int )si->flags);printk (" cmd_line: %s\n" , cmdline);printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); + arch_print_memmap(); }#endif
include/e820.h new file +48 -0
48 lines not on this page · raw message
include/x86/arch_mm.h +4 -0
@@ -279,6 +279,10 @@ pgentry_t *need_pgt(unsigned long addr);void arch_mm_preinit (void *p);unsigned long alloc_virt_kernel (unsigned n_pages); +#ifndef CONFIG_PARAVIRT +void arch_print_memmap (void ); +#endif +#endif #endif /* _ARCH_MM_H_ */
mm.c +50 -29
113 lines not on this page · raw message
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH v2 22/22 mini-os: support idle for HVMlite
In reply to Juergen GrossInstead of calling HYPERVISOR_sched_op(SCHEDOP_block, 0) we need to use the "hlt" instruction with interrupts enabled to switch to idle when running as HVMlite domain.
This requires to setup a new timer in the timer handler as there is no guarantee the original timer event we are waiting for won't fire between enabling interrupts and calling "hlt".
--- arch/x86/time.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/time.c +7 -4
@@ -212,17 +212,20 @@ void block_domain(s_time_t until)if (monotonic_clock () < until) {HYPERVISOR_set_timer_op (until); +#ifdef CONFIG_PARAVIRT HYPERVISOR_sched_op (SCHEDOP_block,0 ); +#else +local_irq_enable (); + asmvolatile ("hlt" : : :"memory" ); +#endif local_irq_disable (); +HYPERVISOR_set_timer_op (0 ); } } - -/* -* Just a dummy -*/ static void timer_handler (evtchn_port_t ev,struct pt_regs *regs,void *ign) { +HYPERVISOR_set_timer_op (monotonic_clock () +MILLISECS (1 )); }
Signature · 7 lines
2.6.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 05/22] mini-os: add boot code for HVMlite support
In reply to Juergen GrossQuoted 11 lines · Juergen Gross, on Wed 24 Aug 2016 12:11:27 +0200, wrote:
A HVMlite domain is always starting in 32 bit mode. Add the appropriate boot code to
arch/x86for the non-paravirtualized case.For this boot code to become active we need to suppress the pv related elfnotes and add an appropriate elfnote for HVMlite.
As the HVMlite boot code is more or less the same for 32- and 64-bit Mini-OS #include the new code from x86_[32|64].S in order to avoid error prone code duplication. The specific parts of 32- or 64-bit code are added to x86_[32|64].S
Quoted 6 lines
This enables Mini-OS to start the boot process in HVMlite mode until it enters C code. This is working for 32- and for 64-bit mode.
Signed-off-by Juergen Gross <[email protected]>---
V2: add some comments as requested by Samuel Thibault
Way clearer, thanks!
Quoted 760 lines
--- Makefile | 2 +- arch/x86/arch.mk | 4 + arch/x86/mm.c | 31 +++++ arch/x86/setup.c | 4 +- arch/x86/x86_32.S | 31 ++++- arch/x86/x86_64.S | 35 ++++- arch/x86/x86_hvm.S | 88 +++++++++++++ include/compiler.h | 1 + include/x86/desc.h | 367 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/x86/os.h | 5 + minios.mk | 2 +- 11 files changed, 556 insertions(+), 14 deletions(-) create mode 100644 arch/x86/x86_hvm.S create mode 100644 include/x86/desc.hMakefile +1
-1@@ -24,7 +24,7 @@ include minios.mk LDLIBS := APP_LDLIBS := LDARCHLIB := -L$(OBJ_DIR)/$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME) -LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds +LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds $(ARCH_LDFLAGS_FINAL) # Prefix for global API names. All other symbols are localised before # linking with EXTRA_OBJS.arch/x86/arch.mk +4
-0@@ -20,3 +20,7 @@ EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) endif +ifeq ($(CONFIG_PARAVIRT),n) +ARCH_LDFLAGS_FINAL := --oformat=elf32-i386 +ARCH_AS_DEPS += x86_hvm.S +endifarch/x86/mm.c +31
-0@@ -56,6 +56,37 @@ unsigned long mfn_zero;extern char stack[];extern void page_walk (unsigned long va); +#ifndef CONFIG_PARAVIRT +#include <mini-os/desc.h> +user_desc gdt[NR_GDT_ENTRIES ] = +{ + [GDTE_CS64_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL0 ,R ,L ), + [GDTE_CS32_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL0 ,R ,D ), + [GDTE_DS32_DPL0 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,DATA ,DPL0 ,B ,W ), + + [GDTE_CS64_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL3 ,R ,L ), + [GDTE_CS32_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,CODE ,DPL3 ,R ,D ), + [GDTE_DS32_DPL3 ] =INIT_GDTE_SYM (0 ,0xfffff ,COMMON ,DATA ,DPL3 ,B ,W ), + +/* [GDTE_TSS] */ +/* [GDTE_TSS + 1] */ +}; + +desc_ptr gdt_ptr = +{ + .limit =sizeof (gdt) -1 , + .base = (unsigned long )&gdt, +}; + +gate_desc idt[256 ] = { }; + +desc_ptr idt_ptr = +{ + .limit =sizeof (idt) -1 , + .base = (unsigned long )&idt, +}; +#endif +/* * Make pt_pfn a new 'level' page table frame and hook it into the page * table at offset in previous level MFN (pref_l_mfn). pt_pfn is a guest arch/x86/setup.c +3
-1@@ -94,9 +94,10 @@ static inline void sse_init(void) {* INITIAL C ENTRY POINT. */ void -arch_init (start_info_t *si) +arch_init (void *par) {static char hello[] ="Bootstrapping...\n" ; +start_info_t *si; (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello);@@ -111,6 +112,7 @@ arch_init(start_info_t *si)/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ + si = par;memcpy (&start_info, si,sizeof (*si));/* print out some useful information */ arch/x86/x86_32.S +26
-5@@ -1,20 +1,31 @@ #include <mini-os/os.h> #include <mini-os/x86/arch_limits.h> #include <mini-os/asm_macros.h> +#include <mini-os/arch_mm.h> +#include <mini-os/desc.h> +#include <xen/arch-x86_32.h> #include <xen/elfnote.h> #include <xen/arch-x86_32.h> +#ifdef CONFIG_PARAVIRT ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "Mini-OS") ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _WORD hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") +.text -.globl _start, shared_info, hypercall_page +.globl _start _start: - cld lss stack_start,%esp +#else + +#include "x86_hvm.S" + movl stack_start,%esp + +#endif + cld andl $(~(__STACK_SIZE-1)), %esp push %esi call arch_init@@ -22,14 +33,15 @@ _start: stack_start: .long stack+(2*__STACK_SIZE), __KERNEL_SS +.globl shared_info, hypercall_page /* Unpleasant -- the PTE that maps this page is actually overwritten */ /* to map the real shared-info page! :-) */ - .org 0x1000 + .align __PAGE_SIZE shared_info: - .org 0x2000 + .fill __PAGE_SIZE,1,0 hypercall_page: - .org 0x3000 + .fill __PAGE_SIZE,1,0 ES = 0x20 ORIG_EAX = 0x24@@ -300,3 +312,12 @@ ENTRY(__arch_switch_threads) popl %ebx popl %ebp ret + +#ifndef CONFIG_PARAVIRT +.data +.globl page_table_base + .align __PAGE_SIZE +page_table_base: + PTE(page_table_l2 + L3_PROT) + .align __PAGE_SIZE, 0 +#endifarch/x86/x86_64.S +29
-6@@ -1,19 +1,29 @@ #include <mini-os/os.h> #include <mini-os/x86/arch_limits.h> #include <mini-os/asm_macros.h> +#include <mini-os/arch_mm.h> +#include <mini-os/desc.h> +#include <xen/features.h> #include <xen/elfnote.h> #include <xen/features.h> +#define ENTRY(X) .globl X ; X : + +#ifdef CONFIG_PARAVIRT ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "Mini-OS") ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _WORD hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") +.text -#define ENTRY(X) .globl X ; X : -.globl _start, shared_info, hypercall_page - +.globl _start _start: +#else + +#include "x86_hvm.S" + +#endif cld movq stack_start(%rip),%rsp andq $(~(__STACK_SIZE-1)), %rsp@@ -23,14 +33,15 @@ _start: stack_start: .quad stack+(2*__STACK_SIZE) +.globl shared_info, hypercall_page /* Unpleasant -- the PTE that maps this page is actually overwritten */ /* to map the real shared-info page! :-) */ - .org 0x1000 + .align __PAGE_SIZE shared_info: - .org 0x2000 + .fill __PAGE_SIZE,1,0 hypercall_page: - .org 0x3000 + .fill __PAGE_SIZE,1,0 #define XEN_GET_VCPU_INFO(reg) movq HYPERVISOR_shared_info,reg@@ -378,3 +389,15 @@ ENTRY(__arch_switch_threads) popq %rbx popq %rbp ret + +#ifndef CONFIG_PARAVIRT +.data +.globl page_table_base + .align __PAGE_SIZE +page_table_l3: + PTE(page_table_l2 + L3_PROT) + .align __PAGE_SIZE, 0 +page_table_base: + PTE(page_table_l3 + L4_PROT) + .align __PAGE_SIZE, 0 +#endifarch/x86/x86_hvm.S new file +88
-0@@ -0,0 +1,88 @@ +/* Included by x86_[32|64].S */ + + ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long _start) +.text + .code32 /* Always starts in 32bit flat mode. */ + +.globl _start + +_start: + mov $(X86_CR4_PAE | X86_CR4_OSFXSR), %eax + mov %eax, %cr4 + mov $page_table_base, %eax + mov %eax, %cr3 + +#ifdef __x86_64__ /* EFER.LME = 1 */ + mov $MSR_EFER, %ecx + rdmsr + bts $_EFER_LME, %eax + wrmsr +#endif /* __x86_64__ */ + + mov %cr0, %eax + or $X86_CR0_PG, %eax + mov %eax, %cr0 + + lgdt gdt_ptr + + /* Load code segment. */ + ljmp $__KERN_CS, $1f +#ifdef __x86_64__ + .code64 +#endif + + /* Load data segments. */ +1: + mov $__USER_DS, %eax + mov %eax, %ds + mov %eax, %es + mov %eax, %fs + mov %eax, %gs + mov $__KERN_DS, %eax + mov %eax, %ss + + mov %ebx, %esi + +.data +/* + * Macro to create a sequence of page table entries. + * As a loop can be done via recursion only and the nesting level is limited + * we treat the first 32 PTEs in a special way limiting nesting level to 64 + * in case of a complete page table (512 PTEs) to be filled. + * prot: protection bits in all PTEs + * addr: physical address of the area to map + * incr: increment of address for each PTE + * idx: index of first PTE in page table + * end: index of last PTE in page table + 1 + */ + .macro PTES prot, addr, incr, idx, end + .ifgt \end-\idx-32 + PTES \prot, \addr, \incr, \idx, "(\idx+32)" + PTES \prot, "(\addr+32*\incr)", \incr, "(\idx+32)", \end + .else + PTE(\addr + \prot) + .if \end-\idx-1 + PTES \prot, "(\addr+\incr)", \incr, "(\idx+1)", \end + .endif + .endif + .endm + .align __PAGE_SIZE +page_table_virt_l1: + PTE(0) + .align __PAGE_SIZE, 0 +page_table_l1: + PTES L1_PROT, 0x00000000, 0x00001000, 0, L1_PAGETABLE_ENTRIES + .align __PAGE_SIZE, 0 +page_table_l2: + /* Map the first 1GB of memory (on 32 bit 16MB less). */ + PTE(page_table_l1 + L2_PROT) +#ifdef __x86_64__ + PTES L2_PROT|_PAGE_PSE, 0x00200000, 0x00200000, 1, L2_PAGETABLE_ENTRIES +#else + /* At 3f000000 virtual kernel area is starting. */ + PTES L2_PROT|_PAGE_PSE, 0x00200000, 0x00200000, 1, l2_table_offset(VIRT_KERNEL_AREA) + PTE(page_table_virt_l1 + L2_PROT) +#endif + .align __PAGE_SIZE, 0 + +.textinclude/compiler.h +1
-0@@ -6,5 +6,6 @@#endif #define unlikely (x) __builtin_expect(!!(x),0)#define likely (x) __builtin_expect(!!(x),1) +#define __packed __attribute__((__packed__))#endif /* __MINIOS_COMPILER_H_ */ include/x86/desc.h new file +367
-0@@ -0,0 +1,367 @@ +/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- +* +* (C) 2016 - Juergen Gross, SUSE Linux GmbH +* based on some header files from Xen Test Framework by Andrew Cooper +* +* 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 _DESC_H_ +#define _DESC_H_ + +/* +* Count the number of varadic arguments provided. +* +* <pre> +* VA_NARGS() => 0 +* VA_NARGS(x) => 1 +* VA_NARGS(x, y) => 2 +* </pre> +* +* Currently functions for 0 to 11 arguments. +*/ +#define VA_NARGS_ (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12,N , ...) N +#define VA_NARGS (...) \ + VA_NARGS_(X,##__VA_ARGS__, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + +/* +* Call a macro variation, based on the number of varadic arguments. +* +* @param macro Partial token to call a variation of. +* @param c1 Constant parameter to pass through. +* @param ... Varadic arguments to pass through. +* +* Tokenises 'macro' with the count of varadic arguments, passing 'c1' and the +* varadic arguments. +* +* <pre> +* VAR_MACRO_C1(m, c) => m0(c) +* VAR_MACRO_C1(m, c, x) => m1(c, x) +* VAR_MACRO_C1(m, c, x, y) => m2(c, x, y) +* VAR_MACRO_C1(m, c, x, y, z) => m3(c, x, y, z) +* </pre> +*/ +#define VAR_MACRO_C1__ (macro, c1, count, ...) macro##count(c1, ##__VA_ARGS__) +#define VAR_MACRO_C1_ (macro, c1, count, ...) \ + VAR_MACRO_C1__(macro, c1, count, ##__VA_ARGS__) +#define VAR_MACRO_C1 (macro, c1, ...) \ + VAR_MACRO_C1_(macro, c1, VA_NARGS(__VA_ARGS__), ##__VA_ARGS__) + +/* +* GDT layout: +* +* 0 - null +* 1 - 64bit supervisor code +* 2 - 32bit supervisor code +* 3 - 32bit supervisor data +* 4 - 64bit userspace code +* 5 - 32bit userspace code +* 6 - 32bit userspace data +* 7 - TSS (two slots in long mode) +* +* 9-12 - Available for test use +*/ + +#define GDTE_CS64_DPL0 1 +#define GDTE_CS32_DPL0 2 +#define GDTE_DS32_DPL0 3 +#define GDTE_CS64_DPL3 4 +#define GDTE_CS32_DPL3 5 +#define GDTE_DS32_DPL3 6 + +#define GDTE_TSS 7 + +#define GDTE_AVAIL0 9 +#define GDTE_AVAIL1 10 +#define GDTE_AVAIL2 11 +#define GDTE_AVAIL3 12 + +#define NR_GDT_ENTRIES 13 + +#ifdef __x86_64__ + +#define __KERN_CS (GDTE_CS64_DPL0 * 8) +#define __KERN_DS (0) +#define __USER_CS (GDTE_CS64_DPL3 * 8 + 3) +#define __USER_DS (GDTE_DS32_DPL3 * 8 + 3) + +#else /* __x86_64__ */ + +#define __KERN_CS (GDTE_CS32_DPL0 * 8) +#define __KERN_DS (GDTE_DS32_DPL0 * 8) +#define __USER_CS (GDTE_CS32_DPL3 * 8 + 3) +#define __USER_DS (GDTE_DS32_DPL3 * 8 + 3) + +#endif /* __x86_64__ */ + +#ifndef __ASSEMBLY__ +/* 8 byte user segment descriptor (GDT/LDT entries with .s = 1) */ +struct __packed seg_desc32 { +union { +/* Raw backing integers. */ +struct { +uint32_t lo, hi; + }; +/* Common named fields. */ +struct { +uint16_t limit0; +uint16_t base0; +uint8_t base1; +unsigned type:4 ; +unsigned s:1 , dpl:2 , p:1 ; +unsigned limit:4 ; +unsigned avl:1 , l:1 , d:1 , g:1 ; +uint8_t base2; + }; +/* Code segment specific field names. */ +struct { +uint16_t limit0; +uint16_t base0; +uint8_t base1; +unsigned a:1 , r:1 , c:1 , x:1 ; +unsigned s:1 , dpl:2 , p:1 ; +unsigned limit:4 ; +unsigned avl:1 , l:1 , d:1 , g:1 ; +uint8_t base2; + } code; +/* Data segment specific field names. */ +struct { +uint16_t limit0; +uint16_t base0; +uint8_t base1; +unsigned a:1 , w:1 , e:1 , x:1 ; +unsigned s:1 , dpl:2 , p:1 ; +unsigned limit:4 ; +unsigned avl:1 , _r0:1 , b:1 , g:1 ; +uint8_t base2; + } data; + }; +}; + +/* 8-byte gate - Protected mode IDT entry, GDT task/call gate. */ +struct __packed seg_gate32 { +union { +struct { +uint32_t lo, hi; + }; +struct { +uint16_t offset0; +uint16_t selector; +uint8_t _r0; +unsigned type:4 , s:1 , dpl:2 , p:1 ; +uint16_t offset1; + }; + }; +}; + +/* 16-byte gate - Long mode IDT entry. */ +struct __packed seg_gate64 { +union { +struct { +uint64_t lo, hi; + }; +struct { +uint16_t offset0; +uint16_t selector; +unsigned ist:3 , _r0:5 , type:4 , s:1 , dpl:2 , p:1 ; +uint16_t offset1; +uint32_t offset2; +uint32_t _r1; + }; + }; +}; + +/* GDT/LDT attribute flags for user segments */ + +/* Common */ +#define SEG_ATTR_G 0x8000/* Granularity of limit (0 = 1, 1 = 4K) */ +#define SEG_ATTR_AVL 0x1000/* Available for software use */ +#define SEG_ATTR_P 0x0080/* Present? */ +#define SEG_ATTR_S 0x0010/* !System desc (0 = system, 1 = user) */ +#define SEG_ATTR_A 0x0001/* Accessed? (set by hardware) */ + +#define SEG_ATTR_COMMON 0x8091/* Commonly set bits (G P S A) */ + +#define SEG_ATTR_DPL0 0x0000/* Descriptor privilege level 0 */ +#define SEG_ATTR_DPL1 0x0020/* Descriptor privilege level 1 */ +#define SEG_ATTR_DPL2 0x0040/* Descriptor privilege level 2 */ +#define SEG_ATTR_DPL3 0x0060/* Descriptor privilege level 3 */ +#define SEG_ATTR_CODE 0x0008/* Type (0 = data, 1 = code) */ +#define SEG_ATTR_DATA 0x0000/* Type (0 = data, 1 = code) */ + +/* Code segments */ +#define SEG_ATTR_D 0x4000/* Default operand size (0 = 16bit, 1 = 32bit) */ +#define SEG_ATTR_L 0x2000/* Long segment? (1 = 64bit) */ +#define SEG_ATTR_C 0x0004/* Conforming? (0 = non, 1 = conforming) */ +#define SEG_ATTR_R 0x0002/* Readable? (0 = XO seg, 1 = RX seg) */ + +/* Data segments */ +#define SEG_ATTR_B 0x4000/* 'Big' flag. +* - For %ss, default operand size. +* - For expand-down segment, sets upper bound. */ +#define SEG_ATTR_E 0x0004/* Expand-down? (0 = normal, 1 = expand-down) */ +#define SEG_ATTR_W 0x0002/* Writable? (0 = RO seg, 1 = RW seg) */ + +/* +* Initialise an LDT/GDT entry using a raw attribute number. +* +* @param base Segment base. +* @param limit Segment limit. +* @param attr Segment attributes. +*/ +#define INIT_GDTE (base, limit, attr) { { { \ + .lo = (((base) & 0xffff) << 16) | ((limit) & 0xffff), \ + .hi = ((base) & 0xff000000) | ((limit) & 0xf0000) | \ + (((attr) & 0xf0ff) << 8) | (((base) & 0xff0000) >> 16) \ + } } } + +/* +* Tokenise and OR together. +* +* For each varadic parameter, tokenise with 't' and OR together. +* +* @param t Common stem partial token. +* @param ... Partial tokens. +* +* Example: +* <pre> +* TOK_OR(t, x, y) => (t ## x | t ## y) +* TOK_OR(t, x, y, z) => (t ## x | t ## y | t ## z) +* </pre> +*/ +#define TOK_OR0 (t) (0) +#define TOK_OR1 (t, x) (t ## x) +#define TOK_OR2 (t, x, ...) (t ## x | TOK_OR1(t, ##__VA_ARGS__)) +#define TOK_OR3 (t, x, ...) (t ## x | TOK_OR2(t, ##__VA_ARGS__)) +#define TOK_OR4 (t, x, ...) (t ## x | TOK_OR3(t, ##__VA_ARGS__)) +#define TOK_OR5 (t, x, ...) (t ## x | TOK_OR4(t, ##__VA_ARGS__)) +#define TOK_OR6 (t, x, ...) (t ## x | TOK_OR5(t, ##__VA_ARGS__)) +#define TOK_OR7 (t, x, ...) (t ## x | TOK_OR6(t, ##__VA_ARGS__)) +#define TOK_OR8 (t, x, ...) (t ## x | TOK_OR7(t, ##__VA_ARGS__)) +#define TOK_OR (t, ...) VAR_MACRO_C1(TOK_OR, t, ##__VA_ARGS__) + +/* +* Initialise an LDT/GDT entry using SEG_ATTR_ mnemonics. +* +* @param base Segment base. +* @param limit Segment limit. +* @param ... Partial SEG_ATTR_ tokens for attributes. +* +* Example usage: +* - INIT_GDTE_SYM(0, 0xfffff, P) +* - uses @ref SEG_ATTR_P +* +* - INIT_GDTE_SYM(0, 0xfffff, CODE, L) +* - uses @ref SEG_ATTR_CODE and @ref SEG_ATTR_L +*/ +#define INIT_GDTE_SYM (base, limit, ...) \ + INIT_GDTE(base, limit, TOK_OR(SEG_ATTR_, ##__VA_ARGS__)) + +/* Long mode lgdt/lidt table pointer. */ +struct __packed desc_ptr64 { +uint16_t limit; +uint64_t base; +}; + +/* Protected mode lgdt/lidt table pointer. */ +struct __packed desc_ptr32 { +uint16_t limit; +uint32_t base; +}; + +struct __packed hw_tss32 { +uint16_t link;uint16_t _r0; + +uint32_t esp0; +uint16_t ss0;uint16_t _r1; + +uint32_t esp1; +uint16_t ss1;uint16_t _r2; + +uint32_t esp2; +uint16_t ss2;uint16_t _r3; + +uint32_t cr3; +uint32_t eip; +uint32_t eflags; +uint32_t eax; +uint32_t ecx; +uint32_t edx; +uint32_t ebx; +uint32_t esp; +uint32_t ebp; +uint32_t esi; +uint32_t edi; + +uint16_t es;uint16_t _r4; +uint16_t cs;uint16_t _r5; +uint16_t ss;uint16_t _r6; +uint16_t ds;uint16_t _r7; +uint16_t fs;uint16_t _r8; +uint16_t gs;uint16_t _r9; +uint16_t ldtr;uint16_t _r10; +uint16_t t;uint16_t iopb; +}; + +struct __packed hw_tss64 { +uint16_t link;uint16_t _r0; + +uint64_t rsp0; +uint64_t rsp1; +uint64_t rsp2; + +uint64_t _r1; + +uint64_t ist[7 ];/* 1-based structure */ + +uint64_t _r2; + +uint16_t t; +uint16_t iopb; +}; + +#define X86_TSS_INVALID_IO_BITMAP 0x8000 + +#if defined(__x86_64__) + +typedef struct desc_ptr64 desc_ptr ; +typedef struct seg_desc32 user_desc ; +typedef struct seg_gate64 gate_desc ; +typedef struct hw_tss64 hw_tss ; + +#elif defined(__i386__) + +typedef struct desc_ptr32 desc_ptr ; +typedef struct seg_desc32 user_desc ; +typedef struct seg_gate32 gate_desc ; +typedef struct hw_tss32 hw_tss ; + +#endif + +extern user_desc gdt[NR_GDT_ENTRIES ]; +extern desc_ptr gdt_ptr; + +extern gate_desc idt[256 ]; +extern desc_ptr idt_ptr; + +extern hw_tss tss; + +#endif + +#endif /* _DESC_H_ */ include/x86/os.h +5
-0@@ -24,7 +24,12 @@#endif #include <xen/xen.h> +#define MSR_EFER 0xc0000080 +#define _EFER_LME 8/* Long mode enable */ +#define X86_CR0_PG 0x80000000/* Paging */ +#define X86_CR4_PAE 0x00000020/* enable physical address extensions */ +#define X86_CR4_OSFXSR 0x00000200/* enable fast FPU save and restore */ #define __KERNEL_CS FLAT_KERNEL_CS#define __KERNEL_DS FLAT_KERNEL_DSminios.mk +1
-1@@ -68,7 +68,7 @@ HEAD_OBJ := $(OBJ_DIR)/$(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ) $(OBJ_DIR)/%.o: %.c $(HDRS) Makefile $(EXTRA_DEPS) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS) +$(OBJ_DIR)/%.o: %.S $(HDRS) Makefile $(EXTRA_DEPS) $(ARCH_AS_DEPS) $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@Signature · 1 line
2.6.6
Signature · 14 lines
Samuel +#if defined(__alpha__) && defined(CONFIG_PCI) + /* + * The meaning of life, the universe, and everything. Plus + * this makes the year come out right. + */ + year -= 42; +#endif (From the patch for 1.3.2: (kernel/time.c), submitted by Marcus Meissner) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 30 lines · Juergen Gross
This patch series adds HVMlite support for Mini-OS. Setting
CONFIG_PARAVIRTto "n" (default is "y") will build mini-os as a HVMlite domain on x86. Both 32- and 64-bit builds are supported.Tested with plain Mini-OS configuration to work in 32- and 64-bit mode either paravirtualized or as HVM domain (device-model none).
Ballooning should basically work, too, but there is some support for a sparse memory map missing in HVMlite mode.
Changes in V2:
- some minor changes requested by Samuel Thibault (added comments, moved sone code to another position in file, add one print)Juergen Gross (22):
mini-os: resync xen headers
mini-os: makedump_regs()work in early boot
mini-os: addCONFIG_PARAVIRT
mini-os: make some memory management related macros usable from
assembler
mini-os: add boot code for HVMlite support
mini-os: setup hypercall page for HVMlite
mini-os: supporthvm_ophypercall
mini-os: initialize trap handling for HVMlite
mini-os: support HVMlite traps
mini-os: make p2m related code depend onCONFIG_PARAVIRT
mini-os: add static page tables for virtual kernel area for HVMlite
mini-os: add x86 native page table handling
mini-os: correct wrong calculation of alloc bitmap size
mini-os: addmap_frame_virt()function
Quoted 8 lines
mini-os: setup console interface parameters
mini-os: setup xenbus interface parameters
mini-os: addget_cmdline()function
mini-os: map shared info page for HVMlite
mini-os: remove usingstart_infoin architecture independent code
mini-os: print start of day messages depending on domain type
mini-os: get physical memory map
mini-os: support idle for HVMlite
Folded in Samuel's RoB in patch 5 and pushed.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel