Skip to contentSkip to conversation

current PowerPC patch

RFC PATCH In review Hollis Blanchard 3 participants 4 messages Oct 19, 2007 – Oct 22, 2007 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 current PowerPC patch

This patch can now execute guest userspace (I'm not saying it's complete or stable or anything though). I need to put together a more full-featured ramdisk to test userspace more completely.

That reminds me, what is the status of KVM VirtIO work? If I can put a virt-io driver in the guest and not need to deal with storage device emulation that would make me very happy.

Once the flurry of refactoring patches settles down in kvm.git, I need to look at actually integrating all of this.

Anyways, for PPC people:

I've also divorced the guest/host MMU emulation a bit, which eventually should allow us to emulate e.g. a Book E guest on a Server host. Take a look at the new stuff in tlb.c.

Since we don't do external interrupt injection yet, I also had to hack the guest device tree to disable UART interrupts, which forces the guest kernel to do polling. Obviously this can be removed once we get some IRQ support. We probably just want to go ahead and implement PIC emulation in-kernel, since x86 moved to the kernel after initially using qemu.

I also need to rebase onto the latest upstream, and hopefully this will compress some of the 19 (!!!) patches I've accumulated. (Most of these are Bamboo and Sequoia board support.)

CPU clock-frequency <- 0x27bc86ae (667MHz)
CPU timebase-frequency <- 0x27bc86ae (667MHz) /plb: clock-frequency <- 9ef21ab (167MHz) /plb/opb: clock-frequency <- 4f790d5 (83MHz) /plb/opb/ebc: clock-frequency <- 34fb5e3 (56MHz) /plb/opb/serial@ef600300: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600400: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600500: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600600: clock-frequency <- a8c000 (11MHz) Memory <- <0x0 0x0 0x2000000> (32MB)
ENET0: local-mac-address <- 00:00:00:00:00:00
ENET1: local-mac-address <- 00:00:00:00:00:00

zImage starting: loaded at 0x00400000 (sp: 0x00fffe98) Allocating 0x295c5c bytes for kernel ...
gunzipping (0x00000000 <- 0x0040b000:0x00693acc)...done 0x275a9c bytes

Linux/PowerPC load:
Finalizing device tree... flat tree at 0x6a03a0
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:setio
MMU:exit
Using Bamboo machine description
Linux version 2.6.23-rc1 (hollisb@basalt) (gcc version 3.4.2) #100 Fri Oct 19 13:07:14 CDT 2007 console [udbg0] enabled
setup_arch: bootmem
arch: exit
Zone PFN ranges:
DMA 0 -> 8192
Normal 8192 -> 8192
Movable zone start PFN for each node
early_node_map[1] active PFN ranges

    0:        0 ->     8192

Built 1 zonelists in Zone order. Total pages: 8128
Kernel command line: console=ttyS0,115200 debug
UIC0 (32 IRQ sources) at DCR 0xc0
UIC1 (32 IRQ sources) at DCR 0xd0
PID hash table entries: 128 (order: 7, 512 bytes)
time_init: decrementer frequency = 666.666670 MHz
time_init: processor frequency = 666.666670 MHz
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 29820k/32768k available (2396k kernel code, 2948k reserved, 100k data, 127k bss, 328k init) Calibrating delay loop... 1163.26 BogoMIPS (lpj=2326528)
Mount-cache hash table entries: 512
NET: Registered protocol family 16

PCI: Probing PCI hardware
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled ef600300.serial: ttyS0 at MMIO 0xef600300 (irq = 0) is a 16450 console handover: boot [udbg0] -> real [ttyS0]
RAMDISK driver initialized: 16 RAM disks of 35000K size 1024 blocksize PPC 4xx OCP EMAC driver, version 3.54
MAL v1 /plb/mcmal, 4 TX channels, 4 RX channels
ZMII /plb/opb/emac-zmii@ef600d00 initialized /plb/opb/emac-zmii@ef600d00: bridge in RMII mode /plb/opb/ethernet@ef600e00: can't find PHY! /plb/opb/ethernet@ef600f00: can't find PHY!
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Freeing unused kernel memory: 328k init
Hello world

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center

PowerPC 440 KVM implementation.

arch/powerpc/boot/dts/bamboo.dts +2 -2
@@ -143,7 +143,7 @@
 		   		clock-frequency = <0>; /* Filled in by zImage */
 		   		current-speed = <1c200>;
 		   		interrupt-parent = <&UIC0>;
-		   		interrupts = <0 4>;
+		   		/* interrupts = <0 4>; */
 	   		};
 
 			UART1: serial@ef600400 {
@@ -247,6 +247,6 @@
 
 	chosen {
 		linux,stdout-path = "/plb/opb/serial@ef600300";
-		bootargs = "console=ttyS0,115200";
+		/* bootargs = "console=ttyS0,115200"; */
 	};
 };
drivers/kvm/Kconfig +12 -2
@@ -3,14 +3,14 @@
 #
 menuconfig VIRTUALIZATION
 	bool "Virtualization"
-	depends on X86
+	depends on (X86 || PPC)
 	default y
 
 if VIRTUALIZATION
 
 config KVM
 	tristate "Kernel-based Virtual Machine (KVM) support"
-	depends on X86 && EXPERIMENTAL
+	depends on EXPERIMENTAL
 	select PREEMPT_NOTIFIERS
 	select ANON_INODES
 	---help---
@@ -46,4 +46,14 @@ config KVM_AMD
 	  Provides support for KVM on AMD processors equipped with the AMD-V
 	  (SVM) extensions.
 
+config KVM_POWERPC
+	bool
+
+config KVM_POWERPC_440
+	tristate "KVM guest support for PowerPC 440"
+	depends on KVM && 44x
+	select KVM_POWERPC
+	---help---
+	  Provides support for running PowerPC 440 virtual machines.
+
 endif # VIRTUALIZATION
drivers/kvm/Makefile +2 -0
@@ -8,3 +8,5 @@ obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
 obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
 kvm-amd-objs = svm.o
 obj-$(CONFIG_KVM_AMD) += kvm-amd.o
+
+obj-$(CONFIG_KVM_POWERPC) += powerpc/
drivers/kvm/powerpc/Makefile new file +35 -0
new file mode 100644
@@ -0,0 +1,35 @@
+
+obj-y += hack.o emulate.o tlb.o
+obj-$(CONFIG_KVM_POWERPC_440) += exceptions_44x.o
+AFLAGS_exceptions_44x.o := -I$(src)
+
+
+# XXX something is wrong with these dependencies
+$(obj)/exceptions_44x.o: $(obj)/kvm-offsets.h
+$(obj)/kvm-offsets.h: $(obj)/kvm-offsets.s Kbuild
+	$(call cmd,offsets)
+$(obj)/kvm-offsets.s: $(src)/kvm-offsets.c
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,cc_s_c)
+
+# Default sed regexp - multiline due to syntax constraints
+define sed-y
+	"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
+endef
+
+quiet_cmd_offsets = GEN     $@
+define cmd_offsets
+	(set -e; \
+	 echo "#ifndef __KVM_OFFSETS_H__"; \
+	 echo "#define __KVM_OFFSETS_H__"; \
+	 echo "/*"; \
+	 echo " * DO NOT MODIFY."; \
+	 echo " *"; \
+	 echo " * This file was generated by Kbuild"; \
+	 echo " *"; \
+	 echo " */"; \
+	 echo ""; \
+	 sed -ne $(sed-y) $<; \
+	 echo ""; \
+	 echo "#endif" ) > $@
+endef
drivers/kvm/powerpc/emulate.c new file +590 -0

590 lines not on this page · raw message

drivers/kvm/powerpc/exceptions_44x.S new file +532 -0

532 lines not on this page · raw message

drivers/kvm/powerpc/hack.c new file +693 -0

693 lines not on this page · raw message

drivers/kvm/powerpc/kvm-offsets.c new file +58 -0

58 lines not on this page · raw message

drivers/kvm/powerpc/kvm.h new file +267 -0

267 lines not on this page · raw message

drivers/kvm/powerpc/tlb.c new file +188 -0

188 lines not on this page · raw message

drivers/kvm/powerpc/tlb.h new file +102 -0

102 lines not on this page · raw message

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#1 lore raw
Quoted 9 lines · Hollis Blanchard

This patch can now execute guest userspace (I'm not saying it's complete or stable or anything though). I need to put together a more full-featured ramdisk to test userspace more completely.

That reminds me, what is the status of KVM VirtIO work? If I can put a virt-io driver in the guest and not need to deal with storage device emulation that would make me very happy.

Hi Hollis,
Good luck for the new patch and the ongoing kvm arch support. Sadly KVM's virtio support didn't change much after the forum. Rusty did improve virtio
shared mem and added pci like configuration space as discussed in the forum.
I was too busy with other things. The good thing is that in a week I'll be back on it.

Nevertheless, even with pv block driver you'll need to boot with a virtual device and then move to a pv one.
It will remain this way until we'll add boot from pv support. It will happen but further on.
Regards,
Dor.

Quoted 109 lines

Once the flurry of refactoring patches settles down in kvm.git, I need to look at actually integrating all of this.

Anyways, for PPC people:

I've also divorced the guest/host MMU emulation a bit, which eventually should allow us to emulate e.g. a Book E guest on a Server host. Take a look at the new stuff in tlb.c.

Since we don't do external interrupt injection yet, I also had to hack the guest device tree to disable UART interrupts, which forces the guest kernel to do polling. Obviously this can be removed once we get some IRQ support. We probably just want to go ahead and implement PIC emulation in-kernel, since x86 moved to the kernel after initially using qemu.

I also need to rebase onto the latest upstream, and hopefully this will compress some of the 19 (!!!) patches I've accumulated. (Most of these are Bamboo and Sequoia board support.)

CPU clock-frequency <- 0x27bc86ae (667MHz)
CPU timebase-frequency <- 0x27bc86ae (667MHz) /plb: clock-frequency <- 9ef21ab (167MHz) /plb/opb: clock-frequency <- 4f790d5 (83MHz) /plb/opb/ebc: clock-frequency <- 34fb5e3 (56MHz) /plb/opb/serial@ef600300: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600400: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600500: clock-frequency <- a8c000 (11MHz) /plb/opb/serial@ef600600: clock-frequency <- a8c000 (11MHz) Memory <- <0x0 0x0 0x2000000> (32MB)
ENET0: local-mac-address <- 00:00:00:00:00:00
ENET1: local-mac-address <- 00:00:00:00:00:00

zImage starting: loaded at 0x00400000 (sp: 0x00fffe98) Allocating 0x295c5c bytes for kernel ...
gunzipping (0x00000000 <- 0x0040b000:0x00693acc)...done 0x275a9c bytes

Linux/PowerPC load:
Finalizing device tree... flat tree at 0x6a03a0
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:setio
MMU:exit
Using Bamboo machine description
Linux version 2.6.23-rc1 (hollisb@basalt) (gcc version 3.4.2) #100 Fri Oct 19 13:07:14 CDT 2007 console [udbg0] enabled
setup_arch: bootmem
arch: exit
Zone PFN ranges:
DMA 0 -> 8192
Normal 8192 -> 8192
Movable zone start PFN for each node
early_node_map[1] active PFN ranges

    0:        0 ->     8192

Built 1 zonelists in Zone order. Total pages: 8128
Kernel command line: console=ttyS0,115200 debug
UIC0 (32 IRQ sources) at DCR 0xc0
UIC1 (32 IRQ sources) at DCR 0xd0
PID hash table entries: 128 (order: 7, 512 bytes)
time_init: decrementer frequency = 666.666670 MHz
time_init: processor frequency = 666.666670 MHz
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 29820k/32768k available (2396k kernel code, 2948k reserved, 100k data, 127k bss, 328k init) Calibrating delay loop... 1163.26 BogoMIPS (lpj=2326528)
Mount-cache hash table entries: 512
NET: Registered protocol family 16

PCI: Probing PCI hardware
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled ef600300.serial: ttyS0 at MMIO 0xef600300 (irq = 0) is a 16450 console handover: boot [udbg0] -> real [ttyS0]
RAMDISK driver initialized: 16 RAM disks of 35000K size 1024 blocksize PPC 4xx OCP EMAC driver, version 3.54
MAL v1 /plb/mcmal, 4 TX channels, 4 RX channels
ZMII /plb/opb/emac-zmii@ef600d00 initialized /plb/opb/emac-zmii@ef600d00: bridge in RMII mode /plb/opb/ethernet@ef600e00: can't find PHY! /plb/opb/ethernet@ef600f00: can't find PHY!
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Freeing unused kernel memory: 328k init
Hello world

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
------------------------------------------------------------------------

Quoted 4 lines

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 47192C6D.8020602-atKUWr5tajBWk0Htik3J/[email protected]

#3 lore raw
Quoted 12 lines · Dor Laor
Quoted 1 line · Hollis Blanchard

This patch can now execute guest userspace (I'm not saying it's

complete

Quoted 4 lines

or stable or anything though). I need to put together a more full-featured ramdisk to test userspace more completely.

That reminds me, what is the status of KVM VirtIO work? If I can put

a

Quoted 4 lines

virt-io driver in the guest and not need to deal with storage device emulation that would make me very happy.

Quoted 7 lines

Hi Hollis,
Good luck for the new patch and the ongoing kvm arch support. Sadly KVM's virtio support didn't change much after the forum. Rusty did improve virtio shared mem and added pci like configuration space as discussed in the forum.
I was too busy with other things. The good thing is that in a week I'll be back on it.

OK.

Quoted 4 lines

Nevertheless, even with pv block driver you'll need to boot with a virtual device and then move to a pv one.
It will remain this way until we'll add boot from pv support. It will happen but further on.

I guess you're talking about an x86 BIOS restriction? I don't expect that to be a problem for us, since I'm not currently planning to execute firmware inside the guest VM. That would require a lot of unnecessary emulation to handle probing and very early configuration (e.g. SDRAM).

We can just inform the guest of the (virtual) system topology via the device tree data structure, which is how firmware usually presents that information on PowerPC systems.

Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
#4 lore raw
In reply to Hollis Blanchard
Quoted 3 lines · Hollis Blanchard

This patch can now execute guest userspace (I'm not saying it's complete or stable or anything though). I need to put together a more full-featured ramdisk to test userspace more completely.

Congratulations Hollis, cool stuff :-).

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/