Skip to contentSkip to conversation

integrator: fix Linux boot failure

PATCH Superseded [email protected] 2 participants 7 messages Oct 18, 2013

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover integrator: fix Linux boot failure

Quoted 1 line

From Alex Bennée <[email protected]> # This line is ignored.

Hi,

I finally got a chance to follow up on the review comments from Peter and Andreas.

Changes for v3:

* Moved into hw/arm/integrator_debug.c
* Expanded QOM symbol to INTEGRATOR_DEBUG, moved to header
* Use __func__, HWADDR_PRIx and PRIu64 for debug output
* Add copyright statements
* Fixed line lengths

Cheers,

Alex.

#1 lore raw

PATCH v3 1/1 integrator: fix Linux boot failure by emulating dbg region

From: Alex Bennée <[email protected]>

Commit 9b8c69243 (since reverted) broke the ability to boot the kernel as the value returned by unassigned_mem_read returned non-zero and left the kernel looping forever waiting for it to change (see integrator_led_set in the kernel code).

Relying on a varying implementation detail is incorrect anyway so this introduces a basic stub of a memory region for the debug/LED section on the integrator board.

---
 hw/arm/Makefile.objs              |   3 +-
 hw/arm/integrator_debug.c         | 103 ++++++++++++++++++++++++++++++++++++++
 hw/arm/integratorcp.c             |   2 +
 include/hw/arm/integrator_debug.h |  18 +++++++
 4 files changed, 125 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/integrator_debug.c
 create mode 100644 include/hw/arm/integrator_debug.h
hw/arm/Makefile.objs +2 -1
index 3671b42..ffdf7ee 100644
@@ -1,5 +1,6 @@
 obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
+obj-y += integratorcp.o integrator_debug.o
+obj-y += kzm.o mainstone.o musicpal.o nseries.o
 obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
 obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
 
hw/arm/integrator_debug.c new file +103 -0

103 lines not on this page · raw message

hw/arm/integratorcp.c +2 -0
index 2ef93ed..0b2ac2c 100644
@@ -11,6 +11,7 @@
 #include "hw/devices.h"
 #include "hw/boards.h"
 #include "hw/arm/arm.h"
+#include "hw/arm/integrator_debug.h"
 #include "net/net.h"
 #include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
@@ -508,6 +509,7 @@ static void integratorcp_init(QEMUMachineInitArgs *args)
     icp_control_init(0xcb000000);
     sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
     sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
+    sysbus_create_simple(TYPE_INTEGRATOR_DEBUG, 0x1a000000, 0);
     sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
     if (nd_table[0].used)
         smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
include/hw/arm/integrator_debug.h new file +18 -0
new file mode 100644
index 0000000..37789b6
@@ -0,0 +1,18 @@
+/*
+ * ARM Integrator Board Debug, switch and LED section
+ *
+ * Browse the data sheet:
+ *
+ *    http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0159b/Babbfijf.html
+ *
+ * Copyright (c) 2013 Alex Bennée <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_INTEGRATOR_DEBUG_H
+#define QEMU_INTEGRATOR_DEBUG_H
+
+#define TYPE_INTEGRATOR_DEBUG "integrator_debug"
+
+#endif
Signature · 1 line
1.8.4
#2 lore raw

Re: [Qemu-devel] [PATCH v3] integrator: fix Linux boot failure by emulating dbg region

hw/arm/integrator_debug.c line 32

Quoted 8 lines · On 18 October 2013 12:45, <[email protected]> wrote:
hw/arm/integrator_debug.c new file +8 -0
+typedef struct {
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+
+    uint32_t alpha;
+    uint32_t leds;
+    uint32_t switches;

These three fields are never used, or did I miss something?

Quoted 1 line

+} IntegratorDebugState;

Looks good otherwise.

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH v3] integrator: fix Linux boot failure by emulating dbg region

Quoted 11 lines · [email protected] writes:

hw/arm/integrator_debug.c line 32

Quoted 8 lines · On 18 October 2013 12:45, <[email protected]> wrote:
hw/arm/integrator_debug.c new file +8 -0
+typedef struct {
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+
+    uint32_t alpha;
+    uint32_t leds;
+    uint32_t switches;

These three fields are never used, or did I miss something?

Nope, I obviously had thoughts of tracking the actual LED/Switch state and never added it in.

Quoted 7 lines
Quoted 2 lines

+} IntegratorDebugState;

Looks good otherwise.

thanks
-- PMM

Signature · 1 line
Alex Bennée
#4 lore raw

Re: [Qemu-devel] [PATCH v3] integrator: fix Linux boot failure by emulating dbg region

In reply to [email protected]

hw/arm/integrator_debug.c

Quoted 38 lines · On 18 October 2013 12:45, <[email protected]> wrote:

From: Alex Bennée <[email protected]>

Commit 9b8c69243 (since reverted) broke the ability to boot the kernel as the value returned by unassigned_mem_read returned non-zero and left the kernel looping forever waiting for it to change (see integrator_led_set in the kernel code).

Relying on a varying implementation detail is incorrect anyway so this introduces a basic stub of a memory region for the debug/LED section on the integrator board.

---
 hw/arm/Makefile.objs              |   3 +-
 hw/arm/integrator_debug.c         | 103 ++++++++++++++++++++++++++++++++++++++
 hw/arm/integratorcp.c             |   2 +
 include/hw/arm/integrator_debug.h |  18 +++++++
 4 files changed, 125 insertions(+), 1 deletion(-)
 create mode 100644 hw/arm/integrator_debug.c
 create mode 100644 include/hw/arm/integrator_debug.h
hw/arm/Makefile.objs +2 -1
index 3671b42..ffdf7ee 100644
@@ -1,5 +1,6 @@
 obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
+obj-y += integratorcp.o integrator_debug.o
+obj-y += kzm.o mainstone.o musicpal.o nseries.o
 obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
 obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
 
hw/arm/integrator_debug.c new file +0 -0
new file mode 100644
index 0000000..c9dd7f0

Oh, and this belongs in hw/misc/, since it's a standalone device model.

thanks
-- PMM

#5 lore raw

Re: [Qemu-devel] [PATCH v3] integrator: fix Linux boot failure by emulating dbg region

Quoted 16 lines · [email protected] writes:
Quoted 15 lines · On 18 October 2013 12:45, <[email protected]> wrote:

From: Alex Bennée <[email protected]>

Commit 9b8c69243 (since reverted) broke the ability to boot the kernel as the value returned by unassigned_mem_read returned non-zero and left the kernel looping forever waiting for it to change (see integrator_led_set in the kernel code).

Relying on a varying implementation detail is incorrect anyway so this introduces a basic stub of a memory region for the debug/LED section on the integrator board.

---
 hw/arm/Makefile.objs              |   3 +-
 hw/arm/integrator_debug.c         | 103 ++++++++++++++++++++++++++++++++++++++

<snip>

Quoted 3 lines

Oh, and this belongs in hw/misc/, since it's a standalone device model.

<snip>

Ahh I was pondering this. Surely as it's only associated with ARM (and specifically integrator) it gets grouped with that?

I was following up on Andreas' comments and deciding between:

hw/misc/arm_integrator_debug.c with include/hw/misc/arm_integrator_debug.c

and what I went with.

The existing devices are a mix of inline ones in integratorcp.c and integrator_pit which is in hw/timer/arm_timer.c.

Perhaps there should be an addendum to HACKING.txt or a doc/src_layout.txt?

Signature · 1 line
Alex Bennée
#6 lore raw

Re: [Qemu-devel] [PATCH v3] integrator: fix Linux boot failure by emulating dbg region

Quoted 7 lines · Alex Bennée
Quoted 2 lines · [email protected] writes:

Oh, and this belongs in hw/misc/, since it's a standalone device model.

Ahh I was pondering this. Surely as it's only associated with ARM (and specifically integrator) it gets grouped with that?

No, the only things in hw/arm are:
* board models
* random bits of code like the boot code which aren't devices
* a few legacy "still in the same file as the board model" devices; ideally we'll split these out at some point

Anything that's a freestanding qdev device model goes elsewhere.

-- PMM