PPC: E500: Implement reboot controller
PATCH v2 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.
---
v1 -> v2:
- change name to mpc8544-guts
- rename file accordingly
- implement PVR and SVR registers
- add stub register defines
- add stderr printf when accessing unknown register
--- Makefile.target | 2 +- hw/mpc8544_guts.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++ hw/ppce500_mpc8544ds.c | 4 ++ pc-bios/mpc8544ds.dtb | Bin 12288 -> 2257 bytes pc-bios/mpc8544ds.dts | 6 ++ 5 files changed, 145 insertions(+), 1 deletions(-) create mode 100644 hw/mpc8544_guts.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 mpc8544_guts.o # PowerPC 440 Xilinx ML507 reference board. obj-ppc-y += virtex_ml507.o obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
hw/mpc8544_guts.c new file +134 -0
134 lines not on this page · raw message
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 ("mpc8544-guts" ,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]],
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,mpc8544-guts"; + reg = <0xe0000 0x1000>; + fsl,has-rstcr; + }; }; pci0: pci@e0008000 {
Signature · 1 line
1.6.0.2
hw/mpc8544_guts.c line 72
Quoted 6 lines · On Thu, 2 Jun 2011 20:37:30 +0200 Alexander Graf <[email protected]> wrote:
hw/mpc8544_guts.c new file +6
-0+case MPC8544_GUTS_ADDR_PVR : + value = env->spr[SPR_PVR ]; +break ; +case MPC8544_GUTS_ADDR_SVR : + value = env->spr[SPR_E500_SVR ]; +break ;
Heh, I didn't even realize these were in there -- I was just thinking of the guest using the SPR version of SVR to decide how to program devices like guts or tsec, and the conflicting demands that might place on that value if you have both directly-assigned devices and emulated devices that target a specific chip.
I can see where that produced confusion. :-)
hw/mpc8544_guts.c line 76
Quoted 4 lines
hw/mpc8544_guts.c new file +4
-0+default : +fprintf (stderr,"Unknown register read: %x = %x\n" , (int )addr, value); +break ; + }
Should say something like "guts" or __func__ in there somewhere. Especially if we're going to throw away the upper 4 bits of the address. :-)
-Scott
Quoted 10 lines · Scott Wood
hw/mpc8544_guts.c line 72
Quoted 6 lines · On Thu, 2 Jun 2011 20:37:30 +0200 Alexander Graf <[email protected]> wrote:
hw/mpc8544_guts.c new file +6
-0+case MPC8544_GUTS_ADDR_PVR : + value = env->spr[SPR_PVR ]; +break ; +case MPC8544_GUTS_ADDR_SVR : + value = env->spr[SPR_E500_SVR ]; +break ;
Quoted 7 lines
Heh, I didn't even realize these were in there -- I was just thinking of the guest using the SPR version of SVR to decide how to program devices like guts or tsec, and the conflicting demands that might place on that value if you have both directly-assigned devices and emulated devices that target a specific chip.
I can see where that produced confusion. :-)
Yeah, pretty confusing :). Well, they were easy enough to add and at least cover the very unusual use-case that a guest OS reads from mmio instead of its SPRs *shrug* :).
Quoted 8 lines
hw/mpc8544_guts.c line 76
Quoted 5 lines
hw/mpc8544_guts.c new file +4
-0+default : +fprintf (stderr,"Unknown register read: %x = %x\n" , (int )addr, value); +break ; + }Should say something like "guts" or
__func__in there somewhere. Especially if we're going to throw away the upper 4 bits of the address. :-)
Good point :). v3 is out.
Alex