Commit 4acf9cbb authored by Abhiram Balasubramanian's avatar Abhiram Balasubramanian Committed by Vikram Narayanan
Browse files

Fix compilation error



- moved dependancies accordingly
Signed-off-by: Abhiram Balasubramanian's avatarAbhiram Balasubramanian <abhiram@cs.utah.edu>
parent 4e643c28
......@@ -271,8 +271,8 @@ static inline hpa_t hva2hpa(hva_t hva)
#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(0xc9 << 40)
#define LCD_IOREMAP_GPA_SIZE (1 << 45) /* 32 TB set aside for ioremap */
#define LCD_IOREMAP_GPA_BASE __gpa(0xc9UL << 40)
#define LCD_IOREMAP_GPA_SIZE (1UL << 45) /* 32 TB set aside for ioremap */
/* guest virtual addresses */
#define LCD_GV_PAGING_MEM_GVA __gva(gpa_val(LCD_GV_PAGING_MEM_GPA))
......
......@@ -466,60 +466,6 @@ static int gv_map(gva_t gva, gpa_t gpa)
return 0;
}
int gp_ioremap(cptr_t phys_addr, unsigned long size, gpa_t *base)
{
unsigned int slots = 0;
unsigned int index = 0;
int ret = 0;
slots = size >> PAGE_SHIFT;
index = find_first_zero_bits(ioremap_gpa_bmap, LCD_IOREMAP_BMAP_SIZE, slots);
if(index >= LCD_IOREMAP_BMAP_SIZE) {
lcd_printk("gpa_ioremap: exhausted memory space in GPA \n");
return -ENOMEM;
}
/* Size required for mapping is figured out by the microkernel as capabilities
* are associated with their size */
*base = gpa_add(LCD_IOREMAP_GPA_BASE, index << PAGE_SHIFT);
ret = lcd_page_map(phys_addr, *base);
if (ret) {
lcd_printk("gpa_ioremap: cannot map physical address to GPA \n");
return ret;
}
set_bits(index, ioremap_gpa_bmap, slots);
ioremap_gpa_phys2cptr[index] = phys_addr;
return ret;
}
int gp_iounmap(gpa_t phys_addr, unsigned long size)
{
unsigned int slots = 0;
unsigned index = 0;
int ret = 0;
slots = size >> PAGE_SHIFT;
index = (gpa_val(phys_addr) - gpa_val(LCD_IOREMAP_GPA_BASE)) >> PAGE_SHIFT;
if(!(gpa_val(phys_addr) >= gpa_val(LCD_IOREMAP_GPA_BASE) &&
gpa_val(gpa_add(phys_addr, index << PAGE_SHIFT)) <
gpa_val(gpa_add(LCD_IOREMAP_GPA_BASE, LCD_IOREMAP_GPA_SIZE)))) {
lcd_printk("gp_iounmap: Trying to unmap invalid region of memory \n");
return -EFAULT;
}
ret = lcd_page_unmap(ioremap_gpa_phys2cptr[index], phys_addr);
if(ret) {
lcd_printf("gp_iounmap: unmap failed \n");
}
clear_bits(index, ioremap_gpa_bmap, slots);
ioremap_gpa_phys2cptr[index] = LCD_CPTR_NULL;
return ret;
}
static int gv_unmap(gva_t gva)
{
int ret;
......@@ -1000,6 +946,61 @@ void lcd_free_memcg_kmem_pages(unsigned long addr, unsigned int order)
lcd_free_pages(__gva(addr), order);
}
int gp_ioremap(cptr_t phys_addr, unsigned long size, gpa_t *base)
{
unsigned int slots = 0;
unsigned int index = 0;
int ret = 0;
slots = size >> PAGE_SHIFT;
index = find_first_zero_bits(ioremap_gpa_bmap, LCD_IOREMAP_BMAP_SIZE, slots);
if(index >= LCD_IOREMAP_BMAP_SIZE) {
lcd_printk("gpa_ioremap: exhausted memory space in GPA \n");
return -ENOMEM;
}
/* Size required for mapping is figured out by the microkernel as capabilities
* are associated with their size */
*base = gpa_add(LCD_IOREMAP_GPA_BASE, index << PAGE_SHIFT);
ret = lcd_page_map(phys_addr, *base);
if (ret) {
lcd_printk("gpa_ioremap: cannot map physical address to GPA \n");
return ret;
}
set_bits(index, ioremap_gpa_bmap, slots);
ioremap_gpa_phys2cptr[index] = phys_addr;
return ret;
}
int gp_iounmap(gpa_t phys_addr, unsigned long size)
{
unsigned int slots = 0;
unsigned index = 0;
int ret = 0;
slots = size >> PAGE_SHIFT;
index = (gpa_val(phys_addr) - gpa_val(LCD_IOREMAP_GPA_BASE)) >> PAGE_SHIFT;
if(!(gpa_val(phys_addr) >= gpa_val(LCD_IOREMAP_GPA_BASE) &&
gpa_val(gpa_add(phys_addr, index << PAGE_SHIFT)) <
gpa_val(gpa_add(LCD_IOREMAP_GPA_BASE, LCD_IOREMAP_GPA_SIZE)))) {
lcd_printk("gp_iounmap: Trying to unmap invalid region of memory \n");
return -EFAULT;
}
ret = lcd_page_unmap(ioremap_gpa_phys2cptr[index], phys_addr);
if(ret) {
lcd_printk("gp_iounmap: unmap failed \n");
}
clear_bits(index, ioremap_gpa_bmap, slots);
ioremap_gpa_phys2cptr[index] = LCD_CPTR_NULL;
return ret;
}
/* ADDR -> CPTR TRANSLATION ---------------------------------------- */
static int fits_in_page(unsigned long data, unsigned long len)
......
Markdown is supported
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