Commit 7db35f31 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Fill holes in hypervisor APIs and fix KTSB registry.

Several interfaces were missing and others misnumbered or
improperly documented.

Also, make sure to check the return value when registering
the kernel TSBs with the hypervisor.  This helped to find
the 4MB kernel TSB alignment bug fixed in a previous changeset.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d9e2763
This diff is collapsed.
...@@ -680,22 +680,14 @@ static int starfire_set_time(u32 val) ...@@ -680,22 +680,14 @@ static int starfire_set_time(u32 val)
static u32 hypervisor_get_time(void) static u32 hypervisor_get_time(void)
{ {
register unsigned long func asm("%o5"); unsigned long ret, time;
register unsigned long arg0 asm("%o0");
register unsigned long arg1 asm("%o1");
int retries = 10000; int retries = 10000;
retry: retry:
func = HV_FAST_TOD_GET; ret = sun4v_tod_get(&time);
arg0 = 0; if (ret == HV_EOK)
arg1 = 0; return time;
__asm__ __volatile__("ta %6" if (ret == HV_EWOULDBLOCK) {
: "=&r" (func), "=&r" (arg0), "=&r" (arg1)
: "0" (func), "1" (arg0), "2" (arg1),
"i" (HV_FAST_TRAP));
if (arg0 == HV_EOK)
return arg1;
if (arg0 == HV_EWOULDBLOCK) {
if (--retries > 0) { if (--retries > 0) {
udelay(100); udelay(100);
goto retry; goto retry;
...@@ -709,20 +701,14 @@ retry: ...@@ -709,20 +701,14 @@ retry:
static int hypervisor_set_time(u32 secs) static int hypervisor_set_time(u32 secs)
{ {
register unsigned long func asm("%o5"); unsigned long ret;
register unsigned long arg0 asm("%o0");
int retries = 10000; int retries = 10000;
retry: retry:
func = HV_FAST_TOD_SET; ret = sun4v_tod_set(secs);
arg0 = secs; if (ret == HV_EOK)
__asm__ __volatile__("ta %4"
: "=&r" (func), "=&r" (arg0)
: "0" (func), "1" (arg0),
"i" (HV_FAST_TRAP));
if (arg0 == HV_EOK)
return 0; return 0;
if (arg0 == HV_EWOULDBLOCK) { if (ret == HV_EWOULDBLOCK) {
if (--retries > 0) { if (--retries > 0) {
udelay(100); udelay(100);
goto retry; goto retry;
......
...@@ -558,26 +558,11 @@ static void __init hypervisor_tlb_lock(unsigned long vaddr, ...@@ -558,26 +558,11 @@ static void __init hypervisor_tlb_lock(unsigned long vaddr,
unsigned long pte, unsigned long pte,
unsigned long mmu) unsigned long mmu)
{ {
register unsigned long func asm("%o5"); unsigned long ret = sun4v_mmu_map_perm_addr(vaddr, 0, pte, mmu);
register unsigned long arg0 asm("%o0");
register unsigned long arg1 asm("%o1"); if (ret != 0) {
register unsigned long arg2 asm("%o2");
register unsigned long arg3 asm("%o3");
func = HV_FAST_MMU_MAP_PERM_ADDR;
arg0 = vaddr;
arg1 = 0;
arg2 = pte;
arg3 = mmu;
__asm__ __volatile__("ta 0x80"
: "=&r" (func), "=&r" (arg0),
"=&r" (arg1), "=&r" (arg2),
"=&r" (arg3)
: "0" (func), "1" (arg0), "2" (arg1),
"3" (arg2), "4" (arg3));
if (arg0 != 0) {
prom_printf("hypervisor_tlb_lock[%lx:%lx:%lx:%lx]: " prom_printf("hypervisor_tlb_lock[%lx:%lx:%lx:%lx]: "
"errors with %lx\n", vaddr, 0, pte, mmu, arg0); "errors with %lx\n", vaddr, 0, pte, mmu, ret);
prom_halt(); prom_halt();
} }
} }
...@@ -1314,20 +1299,16 @@ static void __init sun4v_ktsb_init(void) ...@@ -1314,20 +1299,16 @@ static void __init sun4v_ktsb_init(void)
void __cpuinit sun4v_ktsb_register(void) void __cpuinit sun4v_ktsb_register(void)
{ {
register unsigned long func asm("%o5"); unsigned long pa, ret;
register unsigned long arg0 asm("%o0");
register unsigned long arg1 asm("%o1");
unsigned long pa;
pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE);
func = HV_FAST_MMU_TSB_CTX0; ret = sun4v_mmu_tsb_ctx0(NUM_KTSB_DESCR, pa);
arg0 = NUM_KTSB_DESCR; if (ret != 0) {
arg1 = pa; prom_printf("hypervisor_mmu_tsb_ctx0[%lx]: "
__asm__ __volatile__("ta %6" "errors with %lx\n", pa, ret);
: "=&r" (func), "=&r" (arg0), "=&r" (arg1) prom_halt();
: "0" (func), "1" (arg0), "2" (arg1), }
"i" (HV_FAST_TRAP));
} }
/* paging_init() sets up the page tables */ /* paging_init() sets up the page tables */
......
This diff is collapsed.
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