From 491108697b47fc63a58ef1bb1f4d062f5aa63a76 Mon Sep 17 00:00:00 2001 From: kmacy Date: Fri, 24 Nov 2006 18:50:56 +0000 Subject: [PATCH] Implement mmu functions and cpu_mondo_send fix some more kernel compile fallout --- sys/sun4v/include/hv_api.h | 7 ++++ sys/sun4v/include/hypervisorvar.h | 5 +-- sys/sun4v/sun4v/hcall.S | 63 +++++++++++++++++++++++++++++-- sys/sun4v/sun4v/hviommu.c | 4 ++ sys/sun4v/sun4v/pmap.c | 2 +- sys/sun4v/sun4v/trap.c | 2 +- 6 files changed, 75 insertions(+), 8 deletions(-) diff --git a/sys/sun4v/include/hv_api.h b/sys/sun4v/include/hv_api.h index 846225df01d8..7341411e406d 100644 --- a/sys/sun4v/include/hv_api.h +++ b/sys/sun4v/include/hv_api.h @@ -59,6 +59,10 @@ extern uint64_t hv_mach_watchdog(uint64_t timeout, uint64_t *time_remaining); * Section 11 CPU Services */ +extern uint64_t hv_cpu_yield(void); +extern uint64_t hv_cpu_state(uint64_t cpuid, uint64_t *state); +extern uint64_t hv_cpu_mondo_send(int ncpu, vm_paddr_t cpulist_ra); + /* * Section 12 MMU Services */ @@ -78,11 +82,14 @@ typedef struct hv_tsb_info { extern uint64_t hv_mmu_tsb_ctx0(uint64_t, uint64_t); extern uint64_t hv_mmu_tsb_ctxnon0(uint64_t, uint64_t); +extern uint64_t hv_mmu_map_perm_addr(vm_offset_t va, uint64_t, tte_t tte, uint64_t flags); /* * Section 13 Cache and Memory Services */ +extern uint64_t hv_mem_scrub(vm_paddr_t ra, uint64_t length, uint64_t *scrubbed); + /* * Section 14 Device Interrupt Services */ diff --git a/sys/sun4v/include/hypervisorvar.h b/sys/sun4v/include/hypervisorvar.h index e54fe9ab271f..ca2cc1f364aa 100644 --- a/sys/sun4v/include/hypervisorvar.h +++ b/sys/sun4v/include/hypervisorvar.h @@ -42,8 +42,7 @@ #define CORE_TRAP 0xff /* - * Error returns in %o0. - * (Additional result is returned in %o1.) + * Status returns in %o0. */ #define H_EOK 0 /* Successful return */ #define H_ENOCPU 1 /* Invalid CPU id */ @@ -74,7 +73,7 @@ #define HV_SEND_MONDO_ENTRYDONE 0xffff /* - * Function numbers for API_TRAP. + * Function numbers for CORE_TRAP. */ #define API_SET_VERSION 0x00 #define API_PUTCHAR 0x01 diff --git a/sys/sun4v/sun4v/hcall.S b/sys/sun4v/sun4v/hcall.S index d712f9b499a2..4d4544621f13 100644 --- a/sys/sun4v/sun4v/hcall.S +++ b/sys/sun4v/sun4v/hcall.S @@ -53,11 +53,10 @@ * */ ENTRY(api_set_version) - mov %o3, %o4 mov API_SET_VERSION, %o5 ta CORE_TRAP retl - stx %o1, [%o4] + stx %o1, [%o3] END(api_set_version) /* @@ -313,6 +312,11 @@ END(hv_cpu_qinfo) * */ ENTRY(hv_cpu_mondo_send) + ldx [PCPU(MONDO_DATA_RA)], %o2 + mov HV_INTR_SEND, %o5 + ta FAST_TRAP + retl + membar #Sync END(hv_cpu_mondo_send) /* @@ -399,6 +403,10 @@ END(hv_mmu_tsb_ctxnon0) * */ ENTRY(hv_mmu_demap_page) + mov MMU_DEMAP_PAGE, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_demap_page) /* @@ -413,6 +421,10 @@ END(hv_mmu_demap_page) * */ ENTRY(hv_mmu_demap_ctx) + mov MMU_DEMAP_CTX, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_demap_ctx) /* @@ -427,6 +439,10 @@ END(hv_mmu_demap_ctx) * */ ENTRY(hv_mmu_demap_all) + mov MMU_DEMAP_ALL, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_demap_all) /* @@ -441,6 +457,10 @@ END(hv_mmu_demap_all) * */ ENTRY(hv_mmu_map_addr) + mov MMU_MAP_ADDR, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_map_addr) /* @@ -455,6 +475,10 @@ END(hv_mmu_map_addr) * */ ENTRY(hv_mmu_map_perm_addr) + mov MMU_MAP_PERM_ADDR, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_map_perm_addr) /* @@ -468,6 +492,10 @@ END(hv_mmu_map_perm_addr) * */ ENTRY(hv_mmu_unmap_addr) + mov MMU_UNMAP_ADDR, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_unmap_addr) /* @@ -481,6 +509,10 @@ END(hv_mmu_unmap_addr) * */ ENTRY(hv_mmu_unmap_perm_addr) + mov MMU_UNMAP_PERM_ADDR, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_unmap_perm_addr) /* @@ -489,10 +521,15 @@ END(hv_mmu_unmap_perm_addr) * arg0 raddr (%o0) * * ret0 status (%o0) - * ret1 prev_raddr (%o0) + * ret1 prev_raddr (%o1) * */ ENTRY(hv_mmu_fault_area_conf) + mov %o1, %o2 + mov MMU_FAULT_AREA_CONF, %o5 + ta FAST_TRAP + retl + stx %o1, [%o2] END(hv_mmu_fault_area_conf) /* @@ -505,6 +542,10 @@ END(hv_mmu_fault_area_conf) * */ ENTRY(hv_mmu_enable) + mov MMU_ENABLE, %o5 + ta FAST_TRAP + retl + nop END(hv_mmu_enable) /* @@ -518,6 +559,11 @@ END(hv_mmu_enable) * */ ENTRY(hv_mmu_tsb_ctx0_info) + mov %o1, %o2 + mov MMU_TSB_CTX0_INFO, %o5 + ta FAST_TRAP + retl + stx %o1, [%o2] END(hv_mmu_tsb_ctx0_info) /* @@ -531,6 +577,11 @@ END(hv_mmu_tsb_ctx0_info) * */ ENTRY(hv_mmu_tsb_ctxnon0_info) + mov %o1, %o2 + mov MMU_TSB_CTXNON0_INFO, %o5 + ta FAST_TRAP + retl + stx %o1, [%o2] END(hv_mmu_tsb_ctxnon0_info) /* @@ -541,6 +592,12 @@ END(hv_mmu_tsb_ctxnon0_info) * */ ENTRY(hv_mmu_fault_area_info) + mov %o0, %o2 + mov MMU_FAULT_AREA_INFO, %o5 + ta FAST_TRAP + retl + stx %o1, [%o2] + END(hv_mmu_fault_area_info) /* diff --git a/sys/sun4v/sun4v/hviommu.c b/sys/sun4v/sun4v/hviommu.c index d47d53401970..4261a24f7410 100644 --- a/sys/sun4v/sun4v/hviommu.c +++ b/sys/sun4v/sun4v/hviommu.c @@ -120,6 +120,10 @@ #include #include +#include +#include + + #include /* diff --git a/sys/sun4v/sun4v/pmap.c b/sys/sun4v/sun4v/pmap.c index c0e2b336cf30..b1115a87c31c 100644 --- a/sys/sun4v/sun4v/pmap.c +++ b/sys/sun4v/sun4v/pmap.c @@ -472,7 +472,7 @@ pmap_bootstrap(vm_offset_t ekva) translations[i].om_start <= KERNBASE + 3*PAGE_SIZE_4M)) { KDPRINTF("mapping permanent translation\n"); pa = TTE_GET_PA(translations[i].om_tte); - error = hv_mmu_map_perm_addr((char *)translations[i].om_start, + error = hv_mmu_map_perm_addr(translations[i].om_start, KCONTEXT, pa | TTE_KERNEL | VTD_4M, MAP_ITLB | MAP_DTLB); if (error != H_EOK) panic("map_perm_addr returned error=%ld", error); diff --git a/sys/sun4v/sun4v/trap.c b/sys/sun4v/sun4v/trap.c index d660eb3469a0..602410f05142 100644 --- a/sys/sun4v/sun4v/trap.c +++ b/sys/sun4v/sun4v/trap.c @@ -90,7 +90,7 @@ #include #include -#include +#include #include