Commit 692432c7 authored by Vikram Narayanan's avatar Vikram Narayanan
Browse files

merge/v4.8/lcd: Update files



These files got messed up somehow during merge.

Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <vikram186@gmail.com>
parent ebe88e85
......@@ -96,235 +96,6 @@ static inline hpa_t hpa_add(hpa_t hpa, unsigned long off)
{
return __hpa(hpa_val(hpa) + off);
}
static inline hpa_t pa2hpa(unsigned long pa)
{
return (hpa_t){ pa };
}
static inline hpa_t va2hpa(void *va)
{
return (hpa_t){ __pa(va) };
}
static inline void * hpa2va(hpa_t hpa)
{
return __va(hpa_val(hpa));
}
static inline hva_t hpa2hva(hpa_t hpa)
{
return (hva_t){ (unsigned long)__va(hpa.hpa) };
}
static inline void * hva2va(hva_t hva)
{
return (void *)hva_val(hva);
}
static inline hva_t va2hva(void *va)
{
return __hva((unsigned long)va);
}
static inline hpa_t hva2hpa(hva_t hva)
{
return (hpa_t){ (unsigned long)__pa(hva2va(hva)) };
}
/* BOOT ADDRESS SPACE & INFO ------------------------------------------- */
/*
* Guest Physical Memory Layout
* ============================
*
* No gdt/tss/idt for now (easier). See Documentation/lcd-domains/vmx.txt.
*
* From bottom to top,
*
* -- The bottom 1 MB is unmapped / reserved in case the module is expecting
* the standard physical memory layout of a PC. (Of course, it or its
* creator would need to map something there to emulate that memory.) No
* memory mapped here for the gcc stack protector, so make sure you have
* that turned off when building the code for the lcd.
*
* -- Guest virtual page tables come next, 4 MBs. This puts a (big) upper
* limit on the size of the module that can be mapped. The page tables
* in the hierarchy are allocated on demand as the module is mapped.
*
* -- The UTCB used by the initial thread when the lcd boots. (The
* microkernel manages this page.)
*
* -- The stack
*
* -- Heap. The module is put at the beginning of the heap.
*
* -- A huge chunk of free/unmapped guest physical memory available to the
* module.
*
* -- The upper part is unusable (see Intel SDM V3 28.2.2). The last
* usable byte is at 0x0000 FFFF FFFF FFFF.
*
* +---------------------------+ 0xFFFF FFFF FFFF FFFF
* | Unusable |
* +---------------------------+ 0x0000 FFFF FFFF FFFF
* | Free |
* | |
* +---------------------------+ 0x0000 E8FF FFFF FFFF
* | |
* | Ioremap space |
* | (32 TB) |
* | |
* +---------------------------+ 0x0000 C900 0000 0000
* | |
* : Free :
* | |
* +---------------------------+ 0x0000 0000 0150 8000
* | |
* | Heap |
* | (module mapped |
* | at the bottom) |
* : (16 MBs) :
* | |
* +---------------------------+ 0x0000 0000 0050 8000
* | Stack |
* | (8 KBs) |
* +---------------------------+ 0x0000 0000 0050 6000
* | Guard page |
* | (not mapped) |
* | (4 KBs) |
* +---------------------------+ 0x0000 0000 0050 5000
* | UTCB |
* | (4 KBs) |
* +---------------------------+ 0x0000 0000 0050 4000
* | Boot info |
* | (16 KBs) |
* +---------------------------+ 0x0000 0000 0050 0000
* | Guest Virtual Page Tables |
* | (4 MBs max) |
* +---------------------------+ 0x0000 0000 0010 0000
* | Free / Unmapped |
* | (1 MB) |
* +---------------------------+ 0x0000 0000 0000 0000
*
* Guest Virtual Memory Layout
* ===========================
*
* The lower part has the same layout as the guest physical.
*
* The module is mapped per the guest virtual addresses in the lcd_module_page
* list returned from the module loader, so that relinking is unnecessary.
*
* +---------------------------+ 0xFFFF FFFF FFFF FFFF
* | Unused |
* | (free) |
* +---------------------------+ 0x0000 E8FF FFFF FFFF
* | |
* | Ioremap Space |
* : (32 TB) :
* | |
* The module +---------------------------+ 0x0000 C900 0000 0000
* gets mapped | |
* somewhere in : Unused :
* here --------> | (free) |
* | |
* +---------------------------+ 0x0000 0000 0150 8000
* | |
* | Heap |
* : (16 MBs) :
* | |
* +---------------------------+ 0x0000 0000 0050 8000
* | Stack |
* | (8 KBs) |
* +---------------------------+ 0x0000 0000 0050 6000
* | Guard page |
* | (not mapped) |
* | (4 KBs) |
* +---------------------------+ 0x0000 0000 0050 5000
* | UTCB |
* | (4 KBs) |
* +---------------------------+ 0x0000 0000 0050 4000
* | Boot info |
* | (16 KBs) |
* +---------------------------+ 0x0000 0000 0050 0000
* | Guest Virtual Page Tables |
* | (4 MBs max) |
* +---------------------------+ 0x0000 0000 0010 0000
* | Free / Unmapped |
* | (1 MB) |
* +---------------------------+ 0x0000 0000 0000 0000
*/
#define LCD_BOOT_PAGES_ORDER 2
#define LCD_STACK_PAGES_ORDER 1
/* guest physical addresses */
#define LCD_GV_PAGING_MEM_GPA __gpa(1 << 20) /* low 1 MB is empty */
#define LCD_GV_PAGING_MEM_SIZE (4 << 20)
#define LCD_BOOT_PAGES_GPA gpa_add(LCD_GV_PAGING_MEM_GPA, \
LCD_GV_PAGING_MEM_SIZE)
#define LCD_BOOT_PAGES_SIZE ((1 << LCD_BOOT_PAGES_ORDER) * (4 << 10))
#define LCD_UTCB_GPA gpa_add(LCD_BOOT_PAGES_GPA, LCD_BOOT_PAGES_SIZE)
#define LCD_UTCB_SIZE (4 << 10)
#define LCD_UTCB_STACK_GAP (4 << 10) /* guard page, not mapped */
#define LCD_STACK_GPA gpa_add(LCD_UTCB_GPA, LCD_UTCB_SIZE + LCD_UTCB_STACK_GAP)
#define LCD_STACK_SIZE ((1 << LCD_STACK_PAGES_ORDER) * (4 << 10))
#define LCD_MODULE_GPA gpa_add(LCD_STACK_GPA, LCD_STACK_SIZE)
/* Unused area in between heap and ioremap space */
#define LCD_IOREMAP_GPA_BASE __gpa(0xc9UL << 40)
#define LCD_IOREMAP_GPA_SIZE (1UL << 24) /* 16 MB set aside for ioremap */
/* guest virtual addresses */
#define LCD_GV_PAGING_MEM_GVA __gva(gpa_val(LCD_GV_PAGING_MEM_GPA))
#define LCD_BOOT_PAGES_GVA __gva(gpa_val(LCD_BOOT_PAGES_GPA))
#define LCD_UTCB_GVA __gva(gpa_val(LCD_UTCB_GPA))
#define LCD_STACK_GVA __gva(gpa_val(LCD_STACK_GPA))
#define LCD_IOREMAP_GVA __gva(gpa_val(LCD_IOREMAP_GPA))
#define LCD_NUM_BOOT_CPTRS 8
struct lcd_boot_info_for_page {
cptr_t my_cptr;
gpa_t page_gpa;
};
/*
* Hack for now to make boot easier, used in liblcd/lcd/cap.c for cptr
* cache.
*/
#define LCD_BMAP0_SIZE (1 << (LCD_CPTR_SLOT_BITS + 0 * LCD_CPTR_FANOUT_BITS))
#define LCD_BMAP1_SIZE (1 << (LCD_CPTR_SLOT_BITS + 1 * LCD_CPTR_FANOUT_BITS))
#define LCD_BMAP2_SIZE (1 << (LCD_CPTR_SLOT_BITS + 2 * LCD_CPTR_FANOUT_BITS))
#define LCD_BMAP3_SIZE (1 << (LCD_CPTR_SLOT_BITS + 3 * LCD_CPTR_FANOUT_BITS))
#define LCD_BMAP0_NUM_LONGS BITS_TO_LONGS(LCD_BMAP0_SIZE)
#define LCD_BMAP1_NUM_LONGS BITS_TO_LONGS(LCD_BMAP1_SIZE)
#define LCD_BMAP2_NUM_LONGS BITS_TO_LONGS(LCD_BMAP2_SIZE)
#define LCD_BMAP3_NUM_LONGS BITS_TO_LONGS(LCD_BMAP3_SIZE)
struct lcd_boot_info {
/*
* Bootstrap cptr cache --------------------
*
* level 0
*/
unsigned long bmap0[LCD_BMAP0_NUM_LONGS];
/* level 1 */
unsigned long bmap1[LCD_BMAP1_NUM_LONGS];
/* level 2 */
unsigned long bmap2[LCD_BMAP2_NUM_LONGS];
/* level 3 */
unsigned long bmap3[LCD_BMAP3_NUM_LONGS];
/*
* Bootstrap page info --------------------
*/
unsigned num_boot_mem_pi;
unsigned num_stack_mem_pi;
unsigned num_paging_mem_pi;
unsigned num_free_mem_pi;
struct lcd_boot_info_for_page *boot_mem_pi_start;
struct lcd_boot_info_for_page *stack_mem_pi_start;
struct lcd_boot_info_for_page *paging_mem_pi_start;
struct lcd_boot_info_for_page *free_mem_pi_start;
/*
* Other capabilities (e.g., endpoints)
*/
cptr_t cptrs[LCD_NUM_BOOT_CPTRS];
};
/* MACRO HELPERS -------------------------------------------------- */
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment