* [PATCH 0 of 2] Add small pieces for userspace powerpc support
@ 2007-11-29 20:16 Jerone Young
2007-11-29 20:16 ` [PATCH 1 of 2] Add powerpc tests Jerone Young
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jerone Young @ 2007-11-29 20:16 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
These patches add two things:
libkvm skelton support
powerpc tests (but missing kvmctl main.c)
I'm submitting these patches to start to trickle in code into upstream
repository. A lot more patches will follow, but these should
start to go in, not just as a refrence. But also to help with some
collaboration. Much more to come.
Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1 of 2] Add powerpc tests 2007-11-29 20:16 [PATCH 0 of 2] Add small pieces for userspace powerpc support Jerone Young @ 2007-11-29 20:16 ` Jerone Young 2007-11-29 20:16 ` [PATCH 2 of 2] Initial skeleton for libkvm powerpc support Jerone Young 2007-11-30 8:17 ` [PATCH 0 of 2] Add small pieces for userspace " Avi Kivity 2 siblings, 0 replies; 4+ messages in thread From: Jerone Young @ 2007-11-29 20:16 UTC (permalink / raw) To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f # HG changeset patch # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> # Date 1196367231 21600 # Node ID 6f34b3cd608868c4cc8280ab333aac78a7ba9a6d # Parent be65ecf21443ddb74f9adbf6aa9778f798b5761b Add powerpc tests This patch adds a set of simple powerpc tests Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak new file mode 100644 --- /dev/null +++ b/user/config-powerpc.mak @@ -0,0 +1,14 @@ +TEST_DIR=test/powerpc +CFLAGS += -m32 +CFLAGS += -D__powerpc__ +CFLAGS += -I $(KERNELDIR)/include + +tests= $(TEST_DIR)/io.S \ + $(TEST_DIR)/spin.S \ + $(TEST_DIR)/sprg.S \ + $(TEST_DIR)/44x/tlbsx.S \ + $(TEST_DIR)/44x/tlbwe_16KB.S \ + $(TEST_DIR)/44x/tlbwe_hole.S \ + $(TEST_DIR)/44x/tlbwe.S + +kvmctl_objs = main.o ../libkvm/libkvm.a diff --git a/user/test/powerpc/44x/tlbsx.S b/user/test/powerpc/44x/tlbsx.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/44x/tlbsx.S @@ -0,0 +1,33 @@ +#define SPRN_MMUCR 0x3b2 + +#define TLBWORD0 0x10000210 +#define TLBWORD1 0x10000000 +#define TLBWORD2 0x00000003 + +.global _start +_start: + li r4, 0 + mtspr SPRN_MMUCR, r4 + + li r3, 23 + + lis r4, TLBWORD0@h + ori r4, r4, TLBWORD0@l + tlbwe r4, r3, 0 + + lis r4, TLBWORD1@h + ori r4, r4, TLBWORD1@l + tlbwe r4, r3, 1 + + lis r4, TLBWORD2@h + ori r4, r4, TLBWORD2@l + tlbwe r4, r3, 2 + + lis r4, 0x1000 + tlbsx r5, r4, r0 + cmpwi r5, 23 + beq good + trap + +good: + b . diff --git a/user/test/powerpc/44x/tlbwe.S b/user/test/powerpc/44x/tlbwe.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/44x/tlbwe.S @@ -0,0 +1,27 @@ +#define SPRN_MMUCR 0x3b2 + +/* Create a mapping at 4MB */ +#define TLBWORD0 0x00400210 +#define TLBWORD1 0x00400000 +#define TLBWORD2 0x00000003 + +.global _start +_start: + li r4, 0 + mtspr SPRN_MMUCR, r4 + + li r3, 23 + + lis r4, TLBWORD0@h + ori r4, r4, TLBWORD0@l + tlbwe r4, r3, 0 + + lis r4, TLBWORD1@h + ori r4, r4, TLBWORD1@l + tlbwe r4, r3, 1 + + lis r4, TLBWORD2@h + ori r4, r4, TLBWORD2@l + tlbwe r4, r3, 2 + + b . diff --git a/user/test/powerpc/44x/tlbwe_16KB.S b/user/test/powerpc/44x/tlbwe_16KB.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/44x/tlbwe_16KB.S @@ -0,0 +1,35 @@ +#define SPRN_MMUCR 0x3b2 + +/* 16KB mapping at 4MB */ +#define TLBWORD0 0x00400220 +#define TLBWORD1 0x00400000 +#define TLBWORD2 0x00000003 + +.global _start +_start: + li r4, 0 + mtspr SPRN_MMUCR, r4 + + li r3, 5 + + lis r4, TLBWORD0@h + ori r4, r4, TLBWORD0@l + tlbwe r4, r3, 0 + + lis r4, TLBWORD1@h + ori r4, r4, TLBWORD1@l + tlbwe r4, r3, 1 + + lis r4, TLBWORD2@h + ori r4, r4, TLBWORD2@l + tlbwe r4, r3, 2 + + /* load from 4MB */ + lis r3, 0x0040 + lwz r4, 0(r3) + + /* load from 4MB+8KB */ + ori r3, r3, 0x2000 + lwz r4, 0(r3) + + b . diff --git a/user/test/powerpc/44x/tlbwe_hole.S b/user/test/powerpc/44x/tlbwe_hole.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/44x/tlbwe_hole.S @@ -0,0 +1,27 @@ +#define SPRN_MMUCR 0x3b2 + +/* Try to map real address 1GB. */ +#define TLBWORD0 0x40000210 +#define TLBWORD1 0x40000000 +#define TLBWORD2 0x00000003 + +.global _start +_start: + li r4, 0 + mtspr SPRN_MMUCR, r4 + + li r3, 23 + + lis r4, TLBWORD0@h + ori r4, r4, TLBWORD0@l + tlbwe r4, r3, 0 + + lis r4, TLBWORD1@h + ori r4, r4, TLBWORD1@l + tlbwe r4, r3, 1 + + lis r4, TLBWORD2@h + ori r4, r4, TLBWORD2@l + tlbwe r4, r3, 2 + + b . diff --git a/user/test/powerpc/io.S b/user/test/powerpc/io.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/io.S @@ -0,0 +1,32 @@ +#define SPRN_MMUCR 0x3b2 + +#define TLBWORD0 0xf0000210 +#define TLBWORD1 0xf0000000 +#define TLBWORD2 0x00000003 + +.global _start +_start: + li r4, 0 + mtspr SPRN_MMUCR, r4 + + li r3, 2 + + lis r4, TLBWORD0@h + ori r4, r4, TLBWORD0@l + tlbwe r4, r3, 0 + + lis r4, TLBWORD1@h + ori r4, r4, TLBWORD1@l + tlbwe r4, r3, 1 + + lis r4, TLBWORD2@h + ori r4, r4, TLBWORD2@l + tlbwe r4, r3, 2 + + lis r3, 0xf000 + lis r4, 0x1234 + ori r4, r4, 0x5678 + stb r4, 0(r3) + lbz r5, 0(r3) + + b . diff --git a/user/test/powerpc/spin.S b/user/test/powerpc/spin.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/spin.S @@ -0,0 +1,4 @@ + +.global _start +_start: + b . diff --git a/user/test/powerpc/sprg.S b/user/test/powerpc/sprg.S new file mode 100644 --- /dev/null +++ b/user/test/powerpc/sprg.S @@ -0,0 +1,7 @@ + +.global _start +_start: + li r3, 42 + mtsprg 0, r3 + mfsprg r4, 0 + b . ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2 of 2] Initial skeleton for libkvm powerpc support 2007-11-29 20:16 [PATCH 0 of 2] Add small pieces for userspace powerpc support Jerone Young 2007-11-29 20:16 ` [PATCH 1 of 2] Add powerpc tests Jerone Young @ 2007-11-29 20:16 ` Jerone Young 2007-11-30 8:17 ` [PATCH 0 of 2] Add small pieces for userspace " Avi Kivity 2 siblings, 0 replies; 4+ messages in thread From: Jerone Young @ 2007-11-29 20:16 UTC (permalink / raw) To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f # HG changeset patch # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> # Date 1196367361 21600 # Node ID edbd1102ce114df80ea0f17bffb5bb98129c37f8 # Parent 6f34b3cd608868c4cc8280ab333aac78a7ba9a6d Initial skeleton for libkvm powerpc support This patch is to add initial skelton code for powerpc. No big implimentations as kernel code is still being worked out. But it can be a good template for other architectures. Once kernel code makes it upstream (and is for the most part finalized) then implimentaions will follow. Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> diff --git a/libkvm/config-powerpc.mak b/libkvm/config-powerpc.mak new file mode 100644 --- /dev/null +++ b/libkvm/config-powerpc.mak @@ -0,0 +1,6 @@ + +LIBDIR := /lib +CFLAGS += -m32 +CFLAGS += -D__powerpc__ + +libkvm-$(ARCH)-objs := libkvm-powerpc.o diff --git a/libkvm/kvm-powerpc.h b/libkvm/kvm-powerpc.h new file mode 100644 --- /dev/null +++ b/libkvm/kvm-powerpc.h @@ -0,0 +1,23 @@ +/* + * This header is for functions & variables that will ONLY be + * used inside libkvm for powerpc. + * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE + * WITHIN LIBKVM. + * + * Copyright (C) 2007 IBM + * + * Authors: + * Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> + * + * This work is licensed under the GNU LGPL license, version 2. + */ + +#ifndef KVM_POWERPC_H +#define KVM_POWERPC_H + +#include "kvm-common.h" + +#define PAGE_SIZE 4096ul +#define PAGE_MASK (~(PAGE_SIZE - 1)) + +#endif diff --git a/libkvm/libkvm-powerpc.c b/libkvm/libkvm-powerpc.c new file mode 100644 --- /dev/null +++ b/libkvm/libkvm-powerpc.c @@ -0,0 +1,34 @@ +#include "libkvm.h" +#include "kvm-powerpc.h" +#include <errno.h> + +int kvm_run_abi10(kvm_context_t kvm, int vcpu) +{ + return -ENOSYS; +} + +void kvm_show_code(kvm_context_t kvm, int vcpu) +{ +} + +void kvm_show_regs(kvm_context_t kvm, int vcpu) +{ +} + +int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, + void **vm_mem) +{ + return 0; +} + +int kvm_arch_create_default_phys_mem(kvm_context_t kvm, + unsigned long phys_mem_bytes, + void **vm_mem) +{ + return 0; +} + +int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu) +{ + return 0; +} diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -39,6 +39,10 @@ #if defined(__x86_64__) || defined(__i386__) #include "kvm-x86.h" +#endif + +#if defined(__powerpc__) +#include "kvm-powerpc.h" #endif int kvm_abi = EXPECTED_KVM_API_VERSION; ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0 of 2] Add small pieces for userspace powerpc support 2007-11-29 20:16 [PATCH 0 of 2] Add small pieces for userspace powerpc support Jerone Young 2007-11-29 20:16 ` [PATCH 1 of 2] Add powerpc tests Jerone Young 2007-11-29 20:16 ` [PATCH 2 of 2] Initial skeleton for libkvm powerpc support Jerone Young @ 2007-11-30 8:17 ` Avi Kivity 2 siblings, 0 replies; 4+ messages in thread From: Avi Kivity @ 2007-11-30 8:17 UTC (permalink / raw) To: Jerone Young; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Jerone Young wrote: > These patches add two things: > libkvm skelton support > powerpc tests (but missing kvmctl main.c) > > Applied, thanks. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-30 8:17 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-11-29 20:16 [PATCH 0 of 2] Add small pieces for userspace powerpc support Jerone Young 2007-11-29 20:16 ` [PATCH 1 of 2] Add powerpc tests Jerone Young 2007-11-29 20:16 ` [PATCH 2 of 2] Initial skeleton for libkvm powerpc support Jerone Young 2007-11-30 8:17 ` [PATCH 0 of 2] Add small pieces for userspace " Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox