aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2023-04-25 10:34:31 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-05-02 15:47:40 +0100
commitf802ff1e281eac50f2b4b177b180be97e80da21f (patch)
treed151200340eb288858c655ffd0a573ba9ce1e88c /hw/arm
parent471896381ae895b1c4c2afe1eff2ce13d85e6c2c (diff)
downloadqemu-f802ff1e281eac50f2b4b177b180be97e80da21f.zip
qemu-f802ff1e281eac50f2b4b177b180be97e80da21f.tar.gz
qemu-f802ff1e281eac50f2b4b177b180be97e80da21f.tar.bz2
hw/arm/bcm2835_property: Implement "get command line" message
This query copies the kernel command line into the message buffer. It was previously stubbed out to return empty, this commit makes it reflect the arguments specified with `-append`. I observed the following peculiarities on my Pi 3B+: - If the buffer is shorter than the string, the response header gives the full length, but no data is actually copied. - No NUL terminator is added: even if the buffer is long enough to fit one, the buffer's original contents are preserved past the string's end. - The VC firmware adds the following extra parameters beside the user-supplied ones (via /boot/cmdline.txt): `video`, `vc_mem.mem_base` and `vc_mem.mem_size`. This is currently not implemented in qemu. Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev> Message-id: 20230425103250.56653-1-dani@danielbertalan.dev Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: added comment about NUL and short-buffer behaviour] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/bcm2835_peripherals.c2
-rw-r--r--hw/arm/bcm2836.c2
-rw-r--r--hw/arm/raspi.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index 3c2a416..0233038 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -90,6 +90,8 @@ static void bcm2835_peripherals_init(Object *obj)
TYPE_BCM2835_PROPERTY);
object_property_add_alias(obj, "board-rev", OBJECT(&s->property),
"board-rev");
+ object_property_add_alias(obj, "command-line", OBJECT(&s->property),
+ "command-line");
object_property_add_const_link(OBJECT(&s->property), "fb",
OBJECT(&s->fb));
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
index f894338..166dc89 100644
--- a/hw/arm/bcm2836.c
+++ b/hw/arm/bcm2836.c
@@ -55,6 +55,8 @@ static void bcm2836_init(Object *obj)
TYPE_BCM2835_PERIPHERALS);
object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals),
"board-rev");
+ object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals),
+ "command-line");
object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals),
"vcram-size");
}
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 92d068d..7b9221c 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -280,6 +280,8 @@ static void raspi_machine_init(MachineState *machine)
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev,
&error_abort);
+ object_property_set_str(OBJECT(&s->soc), "command-line",
+ machine->kernel_cmdline, &error_abort);
qdev_realize(DEVICE(&s->soc), NULL, &error_fatal);
/* Create and plug in the SD cards */