Skip to contentSkip to conversation

PPC: E500: Implement reboot controller

PATCH Superseded Alexander Graf 2 participants 3 messages Jun 3, 2011 – Jun 4, 2011 Kbuild

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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

v2 -> v3:

- show subsystem in printfs

---
 Makefile.target        |    2 +-
 hw/mpc8544_guts.c      |  135 ++++++++++++++++++++++++++++++++++++++++++++++++
 hw/ppce500_mpc8544ds.c |    4 ++
 pc-bios/mpc8544ds.dtb  |  Bin 12288 -> 2257 bytes
 pc-bios/mpc8544ds.dts  |    6 ++
 5 files changed, 146 insertions(+), 1 deletions(-)
 create mode 100644 hw/mpc8544_guts.c
Makefile.target +1 -1
index 602d50d..ee5ef78 100644
@@ -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 +135 -0

135 lines not on this page · raw message

hw/ppce500_mpc8544ds.c +4 -0
index 6b57fbf..3ba8e75 100644
@@ -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
index 3299546696bf21f53f8ce2c9eba7fcb740c547da..189224e5875e9dd0d9195c22624b85bfb29dd820 100644
GIT binary patch
pc-bios/mpc8544ds.dts +6 -0
index 872152d..fd792d5 100644
@@ -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
#1 lore raw

Am 02.06.2011 um 20:58 schrieb Alexander Graf:

Quoted 3 lines

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.

rendering

Quoted 20 lines

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

v2 -> v3:

- show subsystem in printfs
---

[...]

Quoted 5 lines
hw/mpc8544_guts.c new file +0 -0
new file mode 100644
index 0000000..ebe15ac

[...]

hw/mpc8544_guts.c line 135

Quoted 5 lines
hw/mpc8544_guts.c new file +5 -0
+static void mpc8544_pci_register(void)
+{
+    sysbus_register_withprop(&mpc8544_guts_info);
+}
+device_init(mpc8544_pci_register);

Is the naming mpc8544_pci_register() intentional? I would find mpc8544_guts_register() more intuitive since the file is called mpc8544_guts.c.

Otherwise looks okay to me.

Andreas

#2 lore raw
Quoted 7 lines · Andreas Färber

Am 02.06.2011 um 20:58 schrieb Alexander Graf:

Quoted 3 lines

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.

rendering

Oops :)

Quoted 28 lines
Quoted 21 lines

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

v2 -> v3:

- show subsystem in printfs
---

[...]

Quoted 5 lines
hw/mpc8544_guts.c new file +0 -0
new file mode 100644
index 0000000..ebe15ac

[...]

Quoted 8 lines

hw/mpc8544_guts.c line 135

Quoted 5 lines
hw/mpc8544_guts.c new file +5 -0
+static void mpc8544_pci_register(void)
+{
+    sysbus_register_withprop(&mpc8544_guts_info);
+}
+device_init(mpc8544_pci_register);

Is the naming mpc8544_pci_register() intentional? I would find mpc8544_guts_register() more intuitive since the file is called mpc8544_guts.c.

Eh - no :). That's me being very bad on copy&paste ;)

Alex