* [Qemu-devel] [PULL 1/3] hw/sparc64: Create VGA device only if it has really been requested
2019-02-06 21:30 [Qemu-devel] [PULL 0/3] qemu-sparc queue 20190206 Mark Cave-Ayland
@ 2019-02-06 21:30 ` Mark Cave-Ayland
2019-02-06 21:30 ` [Qemu-devel] [PULL 2/3] sun4u: add power_mem_read routine Mark Cave-Ayland
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2019-02-06 21:30 UTC (permalink / raw)
To: qemu-devel, peter.maydell
From: Thomas Huth <huth@tuxfamily.org>
The sun4u/sun4v machine currently always creates a VGA device, even if
the user started QEMU with "-nodefaults" or "-vga none". That's likely
not what the users expect in this case, so add a check whether the VGA
adapter has really been requested.
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/sparc64/sun4u.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index f76b19e4e9..37ecc14c6d 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -596,7 +596,15 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", 4,
qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_SER_IRQ));
- pci_dev = pci_create_simple(pci_busA, PCI_DEVFN(2, 0), "VGA");
+ switch (vga_interface_type) {
+ case VGA_STD:
+ pci_create_simple(pci_busA, PCI_DEVFN(2, 0), "VGA");
+ break;
+ case VGA_NONE:
+ break;
+ default:
+ abort(); /* Should not happen - types are checked in vl.c already */
+ }
memset(&macaddr, 0, sizeof(MACAddr));
onboard_nic = false;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 2/3] sun4u: add power_mem_read routine
2019-02-06 21:30 [Qemu-devel] [PULL 0/3] qemu-sparc queue 20190206 Mark Cave-Ayland
2019-02-06 21:30 ` [Qemu-devel] [PULL 1/3] hw/sparc64: Create VGA device only if it has really been requested Mark Cave-Ayland
@ 2019-02-06 21:30 ` Mark Cave-Ayland
2019-02-06 21:30 ` [Qemu-devel] [PULL 3/3] sun4m: pass initrd size to OpenBIOS via fw_cfg interface Mark Cave-Ayland
2019-02-07 18:18 ` [Qemu-devel] [PULL 0/3] qemu-sparc queue 20190206 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2019-02-06 21:30 UTC (permalink / raw)
To: qemu-devel, peter.maydell
From: Prasad J Pandit <pjp@fedoraproject.org>
Define skeleton 'power_mem_read' routine. Avoid NULL dereference.
Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/sparc64/sun4u.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 37ecc14c6d..518d695de3 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -214,6 +214,11 @@ typedef struct PowerDevice {
} PowerDevice;
/* Power */
+static uint64_t power_mem_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0;
+}
+
static void power_mem_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
@@ -224,6 +229,7 @@ static void power_mem_write(void *opaque, hwaddr addr,
}
static const MemoryRegionOps power_mem_ops = {
+ .read = power_mem_read,
.write = power_mem_write,
.endianness = DEVICE_NATIVE_ENDIAN,
.valid = {
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 3/3] sun4m: pass initrd size to OpenBIOS via fw_cfg interface
2019-02-06 21:30 [Qemu-devel] [PULL 0/3] qemu-sparc queue 20190206 Mark Cave-Ayland
2019-02-06 21:30 ` [Qemu-devel] [PULL 1/3] hw/sparc64: Create VGA device only if it has really been requested Mark Cave-Ayland
2019-02-06 21:30 ` [Qemu-devel] [PULL 2/3] sun4u: add power_mem_read routine Mark Cave-Ayland
@ 2019-02-06 21:30 ` Mark Cave-Ayland
2019-02-07 18:18 ` [Qemu-devel] [PULL 0/3] qemu-sparc queue 20190206 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2019-02-06 21:30 UTC (permalink / raw)
To: qemu-devel, peter.maydell
This is to enable OpenBIOS to claim the initrd memory as in-use before attempting
to boot the kernel.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/sparc/sun4m.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 709ee37e08..1c9217315e 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -224,11 +224,12 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
static unsigned long sun4m_load_kernel(const char *kernel_filename,
const char *initrd_filename,
- ram_addr_t RAM_size)
+ ram_addr_t RAM_size,
+ uint32_t *initrd_size)
{
int linux_boot;
unsigned int i;
- long initrd_size, kernel_size;
+ long kernel_size;
uint8_t *ptr;
linux_boot = (kernel_filename != NULL);
@@ -258,23 +259,23 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
}
/* load initrd */
- initrd_size = 0;
+ *initrd_size = 0;
if (initrd_filename) {
- initrd_size = load_image_targphys(initrd_filename,
- INITRD_LOAD_ADDR,
- RAM_size - INITRD_LOAD_ADDR);
- if (initrd_size < 0) {
+ *initrd_size = load_image_targphys(initrd_filename,
+ INITRD_LOAD_ADDR,
+ RAM_size - INITRD_LOAD_ADDR);
+ if ((int)*initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
exit(1);
}
}
- if (initrd_size > 0) {
+ if (*initrd_size > 0) {
for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
ptr = rom_ptr(KERNEL_LOAD_ADDR + i, 24);
if (ptr && ldl_p(ptr) == 0x48647253) { /* HdrS */
stl_p(ptr + 16, INITRD_LOAD_ADDR);
- stl_p(ptr + 20, initrd_size);
+ stl_p(ptr + 20, *initrd_size);
break;
}
}
@@ -844,6 +845,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS];
qemu_irq fdc_tc;
unsigned long kernel_size;
+ uint32_t initrd_size;
DriveInfo *fd[MAX_FD];
FWCfgState *fw_cfg;
unsigned int num_vsimms;
@@ -1022,9 +1024,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
empty_slot_init(hwdef->bpp_base, 0x20);
}
+ initrd_size = 0;
kernel_size = sun4m_load_kernel(machine->kernel_filename,
machine->initrd_filename,
- machine->ram_size);
+ machine->ram_size, &initrd_size);
nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, machine->kernel_cmdline,
machine->boot_order, machine->ram_size, kernel_size,
@@ -1067,7 +1070,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
}
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR);
- fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used
+ fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, machine->boot_order[0]);
qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread