PPC: E500: Implement reboot controller
PATCH 1/1 PPC: E500: Implement reboot controller
When Linux reboots an e500 VM, it writes to a magic register in the "global-utilities" device indicated by the device tree. We were not emulating that device so far, renedering the VM reboot-less.
This patch implements that device with only the reboot functionality implemented and adds it to the device tree. With this patch applied, I can successfully reboot a -M mpc8544ds VM.
--- Makefile.target | 2 +- hw/ppce500_mpc8544ds.c | 4 ++ hw/ppce500_util.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ pc-bios/mpc8544ds.dtb | Bin 12288 -> 2257 bytes pc-bios/mpc8544ds.dts | 6 +++ 5 files changed, 105 insertions(+), 1 deletions(-) create mode 100644 hw/ppce500_util.c
Makefile.target +1 -1
@@ -258,7 +258,7 @@ endif obj-ppc-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o obj-ppc-y += ppc440.o ppc440_bamboo.o # PowerPC E500 boards -obj-ppc-y += ppce500_mpc8544ds.o +obj-ppc-y += ppce500_mpc8544ds.o ppce500_util.o # PowerPC 440 Xilinx ML507 reference board. obj-ppc-y += virtex_ml507.o obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
hw/ppce500_mpc8544ds.c +4 -0
@@ -50,6 +50,7 @@#define MPC8544_PCI_REGS_SIZE 0x1000#define MPC8544_PCI_IO 0xE1000000#define MPC8544_PCI_IOLEN 0x10000 +#define MPC8544_UTIL_BASE (MPC8544_CCSRBAR_BASE + 0xe0000)struct boot_info {
@@ -270,6 +271,9 @@ static void mpc8544ds_init(ram_addr_t ram_size, serial_hds[0], 1, 1); } +/* General Utility device */ +sysbus_create_simple ("e500-util" ,MPC8544_UTIL_BASE ,NULL ); +/* PCI */ dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE, mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
hw/ppce500_util.c new file +94 -0
94 lines not on this page · raw message
pc-bios/mpc8544ds.dtb binary +0 -0
pc-bios/mpc8544ds.dts +6 -0
@@ -82,6 +82,12 @@ compatible = "chrp,open-pic"; device_type = "open-pic"; }; + + global-utilities@e0000 { //global utilities block + compatible = "fsl,mpc8548-guts"; + reg = <0xe0000 0x1000>; + fsl,has-rstcr; + }; }; pci0: pci@e0008000 {
Signature · 1 line
1.6.0.2
Quoted 5 lines · On Thu, 2 Jun 2011 13:57:50 +0200 Alexander Graf <[email protected]> wrote:
pc-bios/mpc8544ds.dts +0
-0
pc-bios/mpc8544ds.dts line 91
Quoted 10 lines
pc-bios/mpc8544ds.dts +6
-0@@ -82,6 +82,12 @@ compatible = "chrp,open-pic"; device_type = "open-pic"; }; + + global-utilities@e0000 { //global utilities block + compatible = "fsl,mpc8548-guts"; + reg = <0xe0000 0x1000>; + fsl,has-rstcr; + }; };
We're not providing a full mpc8548 (or mpc8544) guts, only the rstcr register.
Currently Linux looks for a node with the name "global-utilities" and a property "fsl,has-rstcr", so there's no compatibility reason for a misleading compatible, either.
I'd go with compatible = "fsl,guts-rstcr" (what we've been using internally, and would be a nicer thing to bind against than what the kernel currently does). Or if the goal is to provide more guts registers later, use "fsl,mpc8544-guts" and have qemu log a warning if other accesses are made.
-Scott
Quoted 13 lines · Scott Wood
Quoted 10 lines · On Thu, 2 Jun 2011 13:57:50 +0200 Alexander Graf <[email protected]> wrote:
pc-bios/mpc8544ds.dts +2
-0@@ -82,6 +82,12 @@ compatible = "chrp,open-pic"; device_type = "open-pic"; }; + + global-utilities@e0000 { //global utilities block
Quoted 8 lines
pc-bios/mpc8544ds.dts line 91
Quoted 5 lines
pc-bios/mpc8544ds.dts +4
-0+ compatible = "fsl,mpc8548-guts"; + reg = <0xe0000 0x1000>; + fsl,has-rstcr; + }; };We're not providing a full mpc8548 (or mpc8544) guts, only the rstcr register.
Do you have any pointers to what the guts is?
Quoted 9 lines
Currently Linux looks for a node with the name "global-utilities" and a property "fsl,has-rstcr", so there's no compatibility reason for a misleading compatible, either.
I'd go with compatible = "fsl,guts-rstcr" (what we've been using internally, and would be a nicer thing to bind against than what the kernel currently does). Or if the goal is to provide more guts registers later, use "fsl,mpc8544-guts" and have qemu log a warning if other accesses are made.
What's the difference between the two revisions? Ideally, we should try to emulate real hardware, so implementing the real deal would certainly be the better option.
Alex
Quoted 26 lines · Scott Wood
Quoted 5 lines · On Thu, 2 Jun 2011 13:57:50 +0200 Alexander Graf <[email protected]> wrote:
pc-bios/mpc8544ds.dts +0
-0pc-bios/mpc8544ds.dts line 91
Quoted 10 lines
pc-bios/mpc8544ds.dts +6
-0@@ -82,6 +82,12 @@ compatible = "chrp,open-pic"; device_type = "open-pic"; }; + + global-utilities@e0000 { //global utilities block + compatible = "fsl,mpc8548-guts"; + reg = <0xe0000 0x1000>; + fsl,has-rstcr; + }; };We're not providing a full mpc8548 (or mpc8544) guts, only the rstcr register.
Currently Linux looks for a node with the name "global-utilities" and a property "fsl,has-rstcr", so there's no compatibility reason for a misleading compatible, either.
Quoted 5 lines
I'd go with compatible = "fsl,guts-rstcr" (what we've been using internally, and would be a nicer thing to bind against than what the kernel currently does). Or if the goal is to provide more guts registers later, use "fsl,mpc8544-guts" and have qemu log a warning if other accesses are made.
Ugh - 8544 is the SoC we're emulating - sorry, it's evening already :). So yes, implementing an mpc8544-guts is certainly what we want!
Alex