2007-04-24 09:40:49 +02:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC 405 evaluation boards emulation
|
2007-09-16 23:08:06 +02:00
|
|
|
*
|
2007-04-24 09:40:49 +02:00
|
|
|
* Copyright (c) 2007 Jocelyn Mayer
|
2007-09-16 23:08:06 +02:00
|
|
|
*
|
2007-04-24 09:40:49 +02:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2016-01-26 19:16:58 +01:00
|
|
|
#include "qemu/osdep.h"
|
2018-06-25 14:42:24 +02:00
|
|
|
#include "qemu/units.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 09:01:28 +01:00
|
|
|
#include "qapi/error.h"
|
2016-01-19 21:51:44 +01:00
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "cpu.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/hw.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/ppc/ppc.h"
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "ppc405.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/timer/m48t59.h"
|
|
|
|
#include "hw/block/flash.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/sysemu.h"
|
2013-08-05 15:27:23 +02:00
|
|
|
#include "sysemu/qtest.h"
|
2014-10-07 13:59:18 +02:00
|
|
|
#include "sysemu/block-backend.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/boards.h"
|
2012-12-17 18:20:00 +01:00
|
|
|
#include "qemu/log.h"
|
2013-08-05 15:27:23 +02:00
|
|
|
#include "qemu/error-report.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/loader.h"
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/address-spaces.h"
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
#define BIOS_FILENAME "ppc405_rom.bin"
|
2018-06-25 14:42:24 +02:00
|
|
|
#define BIOS_SIZE (2 * MiB)
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
#define KERNEL_LOAD_ADDR 0x00000000
|
|
|
|
#define INITRD_LOAD_ADDR 0x01800000
|
|
|
|
|
|
|
|
#define USE_FLASH_BIOS
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* PPC405EP reference board (IBM) */
|
|
|
|
/* Standalone board with:
|
|
|
|
* - PowerPC 405EP CPU
|
|
|
|
* - SDRAM (0x00000000)
|
|
|
|
* - Flash (0xFFF80000)
|
|
|
|
* - SRAM (0xFFF00000)
|
|
|
|
* - NVRAM (0xF0000000)
|
|
|
|
* - FPGA (0xF0300000)
|
|
|
|
*/
|
2009-10-01 23:12:16 +02:00
|
|
|
typedef struct ref405ep_fpga_t ref405ep_fpga_t;
|
|
|
|
struct ref405ep_fpga_t {
|
2007-04-24 09:40:49 +02:00
|
|
|
uint8_t reg0;
|
|
|
|
uint8_t reg1;
|
|
|
|
};
|
|
|
|
|
2018-08-02 16:44:29 +02:00
|
|
|
static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ref405ep_fpga_t *fpga;
|
2007-04-24 09:40:49 +02:00
|
|
|
uint32_t ret;
|
|
|
|
|
|
|
|
fpga = opaque;
|
|
|
|
switch (addr) {
|
|
|
|
case 0x0:
|
|
|
|
ret = fpga->reg0;
|
|
|
|
break;
|
|
|
|
case 0x1:
|
|
|
|
ret = fpga->reg1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-02 16:44:29 +02:00
|
|
|
static void ref405ep_fpga_writeb(void *opaque, hwaddr addr, uint64_t value,
|
|
|
|
unsigned size)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ref405ep_fpga_t *fpga;
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
fpga = opaque;
|
|
|
|
switch (addr) {
|
|
|
|
case 0x0:
|
|
|
|
/* Read only */
|
|
|
|
break;
|
|
|
|
case 0x1:
|
|
|
|
fpga->reg1 = value;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-12 15:43:53 +02:00
|
|
|
static const MemoryRegionOps ref405ep_fpga_ops = {
|
2018-08-02 16:44:29 +02:00
|
|
|
.read = ref405ep_fpga_readb,
|
|
|
|
.write = ref405ep_fpga_writeb,
|
|
|
|
.impl.min_access_size = 1,
|
|
|
|
.impl.max_access_size = 1,
|
|
|
|
.valid.min_access_size = 1,
|
|
|
|
.valid.max_access_size = 4,
|
|
|
|
.endianness = DEVICE_BIG_ENDIAN,
|
2007-04-24 09:40:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void ref405ep_fpga_reset (void *opaque)
|
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ref405ep_fpga_t *fpga;
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
fpga = opaque;
|
|
|
|
fpga->reg0 = 0x00;
|
|
|
|
fpga->reg1 = 0x0F;
|
|
|
|
}
|
|
|
|
|
2012-10-15 22:22:02 +02:00
|
|
|
static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ref405ep_fpga_t *fpga;
|
2011-09-12 15:43:53 +02:00
|
|
|
MemoryRegion *fpga_memory = g_new(MemoryRegion, 1);
|
2007-04-24 09:40:49 +02:00
|
|
|
|
2011-08-21 05:09:37 +02:00
|
|
|
fpga = g_malloc0(sizeof(ref405ep_fpga_t));
|
2013-06-06 11:41:28 +02:00
|
|
|
memory_region_init_io(fpga_memory, NULL, &ref405ep_fpga_ops, fpga,
|
2011-09-12 15:43:53 +02:00
|
|
|
"fpga", 0x00000100);
|
|
|
|
memory_region_add_subregion(sysmem, base, fpga_memory);
|
2009-06-27 09:25:07 +02:00
|
|
|
qemu_register_reset(&ref405ep_fpga_reset, fpga);
|
2007-04-24 09:40:49 +02:00
|
|
|
}
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
static void ref405ep_init(MachineState *machine)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
2014-05-07 16:42:57 +02:00
|
|
|
ram_addr_t ram_size = machine->ram_size;
|
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
|
|
|
const char *kernel_cmdline = machine->kernel_cmdline;
|
|
|
|
const char *initrd_filename = machine->initrd_filename;
|
2009-05-30 01:52:44 +02:00
|
|
|
char *filename;
|
2009-10-01 23:12:16 +02:00
|
|
|
ppc4xx_bd_info_t bd;
|
2007-04-24 09:40:49 +02:00
|
|
|
CPUPPCState *env;
|
|
|
|
qemu_irq *pic;
|
2011-08-04 14:55:30 +02:00
|
|
|
MemoryRegion *bios;
|
2011-09-12 15:43:53 +02:00
|
|
|
MemoryRegion *sram = g_new(MemoryRegion, 1);
|
|
|
|
ram_addr_t bdloc;
|
2018-11-27 14:05:29 +01:00
|
|
|
MemoryRegion *ram_memories = g_new(MemoryRegion, 2);
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_bases[2], ram_sizes[2];
|
2010-09-18 07:53:14 +02:00
|
|
|
target_ulong sram_size;
|
|
|
|
long bios_size;
|
2007-04-24 09:40:49 +02:00
|
|
|
//int phy_addr = 0;
|
|
|
|
//static int phy_addr = 1;
|
2010-09-18 07:53:14 +02:00
|
|
|
target_ulong kernel_base, initrd_base;
|
|
|
|
long kernel_size, initrd_size;
|
2007-04-24 09:40:49 +02:00
|
|
|
int linux_boot;
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
int len;
|
2009-07-22 16:42:57 +02:00
|
|
|
DriveInfo *dinfo;
|
2011-09-12 15:43:53 +02:00
|
|
|
MemoryRegion *sysmem = get_system_memory();
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
/* XXX: fix this */
|
2014-07-10 14:01:03 +02:00
|
|
|
memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram",
|
|
|
|
0x08000000);
|
2011-08-15 16:17:27 +02:00
|
|
|
ram_bases[0] = 0;
|
2007-04-24 09:40:49 +02:00
|
|
|
ram_sizes[0] = 0x08000000;
|
2013-06-06 11:41:28 +02:00
|
|
|
memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0);
|
2007-04-24 09:40:49 +02:00
|
|
|
ram_bases[1] = 0x00000000;
|
|
|
|
ram_sizes[1] = 0x00000000;
|
2018-06-25 14:42:24 +02:00
|
|
|
ram_size = 128 * MiB;
|
2011-09-12 15:43:53 +02:00
|
|
|
env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,
|
2011-08-12 01:07:17 +02:00
|
|
|
33333333, &pic, kernel_filename == NULL ? 0 : 1);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* allocate SRAM */
|
2018-06-25 14:42:24 +02:00
|
|
|
sram_size = 512 * KiB;
|
2017-07-07 16:42:53 +02:00
|
|
|
memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size,
|
Fix bad error handling after memory_region_init_ram()
Symptom:
$ qemu-system-x86_64 -m 10000000
Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
Aborted (core dumped)
Root cause: commit ef701d7 screwed up handling of out-of-memory
conditions. Before the commit, we report the error and exit(1), in
one place, ram_block_add(). The commit lifts the error handling up
the call chain some, to three places. Fine. Except it uses
&error_abort in these places, changing the behavior from exit(1) to
abort(), and thus undoing the work of commit 3922825 "exec: Don't
abort when we can't allocate guest memory".
The three places are:
* memory_region_init_ram()
Commit 4994653 (right after commit ef701d7) lifted the error
handling further, through memory_region_init_ram(), multiplying the
incorrect use of &error_abort. Later on, imitation of existing
(bad) code may have created more.
* memory_region_init_ram_ptr()
The &error_abort is still there.
* memory_region_init_rom_device()
Doesn't need fixing, because commit 33e0eb5 (soon after commit
ef701d7) lifted the error handling further, and in the process
changed it from &error_abort to passing it up the call chain.
Correct, because the callers are realize() methods.
Fix the error handling after memory_region_init_ram() with a
Coccinelle semantic patch:
@r@
expression mr, owner, name, size, err;
position p;
@@
memory_region_init_ram(mr, owner, name, size,
(
- &error_abort
+ &error_fatal
|
err@p
)
);
@script:python@
p << r.p;
@@
print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
When the last argument is &error_abort, it gets replaced by
&error_fatal. This is the fix.
If the last argument is anything else, its position is reported. This
lets us check the fix is complete. Four positions get reported:
* ram_backend_memory_alloc()
Error is passed up the call chain, ultimately through
user_creatable_complete(). As far as I can tell, it's callers all
handle the error sanely.
* fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
DeviceClass.realize() methods, errors handled sanely further up the
call chain.
We're good. Test case again behaves:
$ qemu-system-x86_64 -m 10000000
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
[Exit 1 ]
The next commits will repair the rest of commit ef701d7's damage.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1441983105-26376-3-git-send-email-armbru@redhat.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
2015-09-11 16:51:43 +02:00
|
|
|
&error_fatal);
|
2011-09-12 15:43:53 +02:00
|
|
|
memory_region_add_subregion(sysmem, 0xFFF00000, sram);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* allocate and load BIOS */
|
|
|
|
#ifdef USE_FLASH_BIOS
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
dinfo = drive_get(IF_PFLASH, 0, 0);
|
2009-07-22 16:42:57 +02:00
|
|
|
if (dinfo) {
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
bios_size = 8 * MiB;
|
2011-08-04 14:55:30 +02:00
|
|
|
pflash_cfi02_register((uint32_t)(-bios_size),
|
2019-03-08 10:46:09 +01:00
|
|
|
"ef405ep.bios", bios_size,
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
|
2019-03-08 10:46:10 +01:00
|
|
|
64 * KiB, 1,
|
2011-08-25 21:39:18 +02:00
|
|
|
2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
|
|
|
|
1);
|
2007-04-24 09:40:49 +02:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2011-08-04 14:55:30 +02:00
|
|
|
bios = g_new(MemoryRegion, 1);
|
2017-07-07 16:42:53 +02:00
|
|
|
memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE,
|
Fix bad error handling after memory_region_init_ram()
Symptom:
$ qemu-system-x86_64 -m 10000000
Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
Aborted (core dumped)
Root cause: commit ef701d7 screwed up handling of out-of-memory
conditions. Before the commit, we report the error and exit(1), in
one place, ram_block_add(). The commit lifts the error handling up
the call chain some, to three places. Fine. Except it uses
&error_abort in these places, changing the behavior from exit(1) to
abort(), and thus undoing the work of commit 3922825 "exec: Don't
abort when we can't allocate guest memory".
The three places are:
* memory_region_init_ram()
Commit 4994653 (right after commit ef701d7) lifted the error
handling further, through memory_region_init_ram(), multiplying the
incorrect use of &error_abort. Later on, imitation of existing
(bad) code may have created more.
* memory_region_init_ram_ptr()
The &error_abort is still there.
* memory_region_init_rom_device()
Doesn't need fixing, because commit 33e0eb5 (soon after commit
ef701d7) lifted the error handling further, and in the process
changed it from &error_abort to passing it up the call chain.
Correct, because the callers are realize() methods.
Fix the error handling after memory_region_init_ram() with a
Coccinelle semantic patch:
@r@
expression mr, owner, name, size, err;
position p;
@@
memory_region_init_ram(mr, owner, name, size,
(
- &error_abort
+ &error_fatal
|
err@p
)
);
@script:python@
p << r.p;
@@
print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
When the last argument is &error_abort, it gets replaced by
&error_fatal. This is the fix.
If the last argument is anything else, its position is reported. This
lets us check the fix is complete. Four positions get reported:
* ram_backend_memory_alloc()
Error is passed up the call chain, ultimately through
user_creatable_complete(). As far as I can tell, it's callers all
handle the error sanely.
* fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
DeviceClass.realize() methods, errors handled sanely further up the
call chain.
We're good. Test case again behaves:
$ qemu-system-x86_64 -m 10000000
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
[Exit 1 ]
The next commits will repair the rest of commit ef701d7's damage.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1441983105-26376-3-git-send-email-armbru@redhat.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
2015-09-11 16:51:43 +02:00
|
|
|
&error_fatal);
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
|
2007-10-05 15:08:35 +02:00
|
|
|
if (bios_name == NULL)
|
|
|
|
bios_name = BIOS_FILENAME;
|
2009-05-30 01:52:44 +02:00
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
|
|
|
if (filename) {
|
2018-12-14 14:30:50 +01:00
|
|
|
bios_size = load_image_size(filename,
|
|
|
|
memory_region_get_ram_ptr(bios),
|
|
|
|
BIOS_SIZE);
|
2011-08-21 05:09:37 +02:00
|
|
|
g_free(filename);
|
2018-12-14 14:30:50 +01:00
|
|
|
if (bios_size < 0) {
|
2013-08-05 15:27:23 +02:00
|
|
|
error_report("Could not load PowerPC BIOS '%s'", bios_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
bios_size = (bios_size + 0xfff) & ~0xfff;
|
|
|
|
memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
|
|
|
|
} else if (!qtest_enabled() || kernel_filename != NULL) {
|
|
|
|
error_report("Could not load PowerPC BIOS '%s'", bios_name);
|
|
|
|
exit(1);
|
2009-05-30 01:52:44 +02:00
|
|
|
} else {
|
2013-08-05 15:27:23 +02:00
|
|
|
/* Avoid an uninitialized variable warning */
|
2009-05-30 01:52:44 +02:00
|
|
|
bios_size = -1;
|
|
|
|
}
|
2011-08-04 14:55:30 +02:00
|
|
|
memory_region_set_readonly(bios, true);
|
2007-04-24 09:40:49 +02:00
|
|
|
}
|
|
|
|
/* Register FPGA */
|
2011-09-12 15:43:53 +02:00
|
|
|
ref405ep_fpga_init(sysmem, 0xF0300000);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* Register NVRAM */
|
2015-03-02 23:23:27 +01:00
|
|
|
m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* Load kernel */
|
|
|
|
linux_boot = (kernel_filename != NULL);
|
|
|
|
if (linux_boot) {
|
|
|
|
memset(&bd, 0, sizeof(bd));
|
|
|
|
bd.bi_memstart = 0x00000000;
|
|
|
|
bd.bi_memsize = ram_size;
|
2007-10-03 03:04:20 +02:00
|
|
|
bd.bi_flashstart = -bios_size;
|
2007-04-24 09:40:49 +02:00
|
|
|
bd.bi_flashsize = -bios_size;
|
|
|
|
bd.bi_flashoffset = 0;
|
|
|
|
bd.bi_sramstart = 0xFFF00000;
|
|
|
|
bd.bi_sramsize = sram_size;
|
|
|
|
bd.bi_bootflags = 0;
|
|
|
|
bd.bi_intfreq = 133333333;
|
|
|
|
bd.bi_busfreq = 33333333;
|
|
|
|
bd.bi_baudrate = 115200;
|
|
|
|
bd.bi_s_version[0] = 'Q';
|
|
|
|
bd.bi_s_version[1] = 'M';
|
|
|
|
bd.bi_s_version[2] = 'U';
|
|
|
|
bd.bi_s_version[3] = '\0';
|
|
|
|
bd.bi_r_version[0] = 'Q';
|
|
|
|
bd.bi_r_version[1] = 'E';
|
|
|
|
bd.bi_r_version[2] = 'M';
|
|
|
|
bd.bi_r_version[3] = 'U';
|
|
|
|
bd.bi_r_version[4] = '\0';
|
|
|
|
bd.bi_procfreq = 133333333;
|
|
|
|
bd.bi_plb_busfreq = 33333333;
|
|
|
|
bd.bi_pci_busfreq = 33333333;
|
|
|
|
bd.bi_opbfreq = 33333333;
|
2007-09-27 01:55:31 +02:00
|
|
|
bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001);
|
2007-04-24 09:40:49 +02:00
|
|
|
env->gpr[3] = bdloc;
|
|
|
|
kernel_base = KERNEL_LOAD_ADDR;
|
|
|
|
/* now we can load the kernel */
|
2009-04-10 16:29:45 +02:00
|
|
|
kernel_size = load_image_targphys(kernel_filename, kernel_base,
|
|
|
|
ram_size - kernel_base);
|
2007-04-24 09:40:49 +02:00
|
|
|
if (kernel_size < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 09:43:10 +01:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2007-04-24 09:40:49 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
2010-09-18 07:53:14 +02:00
|
|
|
printf("Load kernel size %ld at " TARGET_FMT_lx,
|
2009-04-10 16:29:45 +02:00
|
|
|
kernel_size, kernel_base);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* load initrd */
|
|
|
|
if (initrd_filename) {
|
|
|
|
initrd_base = INITRD_LOAD_ADDR;
|
2009-04-10 16:29:45 +02:00
|
|
|
initrd_size = load_image_targphys(initrd_filename, initrd_base,
|
|
|
|
ram_size - initrd_base);
|
2007-04-24 09:40:49 +02:00
|
|
|
if (initrd_size < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 09:43:10 +01:00
|
|
|
error_report("could not load initial ram disk '%s'",
|
|
|
|
initrd_filename);
|
2007-04-24 09:40:49 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
initrd_base = 0;
|
|
|
|
initrd_size = 0;
|
|
|
|
}
|
|
|
|
env->gpr[4] = initrd_base;
|
|
|
|
env->gpr[5] = initrd_size;
|
|
|
|
if (kernel_cmdline != NULL) {
|
|
|
|
len = strlen(kernel_cmdline);
|
|
|
|
bdloc -= ((len + 255) & ~255);
|
2013-04-12 20:53:58 +02:00
|
|
|
cpu_physical_memory_write(bdloc, kernel_cmdline, len + 1);
|
2007-04-24 09:40:49 +02:00
|
|
|
env->gpr[6] = bdloc;
|
|
|
|
env->gpr[7] = bdloc + len;
|
|
|
|
} else {
|
|
|
|
env->gpr[6] = 0;
|
|
|
|
env->gpr[7] = 0;
|
|
|
|
}
|
|
|
|
env->nip = KERNEL_LOAD_ADDR;
|
|
|
|
} else {
|
|
|
|
kernel_base = 0;
|
|
|
|
kernel_size = 0;
|
|
|
|
initrd_base = 0;
|
|
|
|
initrd_size = 0;
|
|
|
|
bdloc = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static void ref405ep_class_init(ObjectClass *oc, void *data)
|
2015-09-04 20:37:08 +02:00
|
|
|
{
|
2015-09-19 10:49:44 +02:00
|
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
mc->desc = "ref405ep";
|
|
|
|
mc->init = ref405ep_init;
|
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static const TypeInfo ref405ep_type = {
|
|
|
|
.name = MACHINE_TYPE_NAME("ref405ep"),
|
|
|
|
.parent = TYPE_MACHINE,
|
|
|
|
.class_init = ref405ep_class_init,
|
|
|
|
};
|
2007-04-24 09:40:49 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* AMCC Taihu evaluation board */
|
|
|
|
/* - PowerPC 405EP processor
|
|
|
|
* - SDRAM 128 MB at 0x00000000
|
|
|
|
* - Boot flash 2 MB at 0xFFE00000
|
|
|
|
* - Application flash 32 MB at 0xFC000000
|
|
|
|
* - 2 serial ports
|
|
|
|
* - 2 ethernet PHY
|
|
|
|
* - 1 USB 1.1 device 0x50000000
|
|
|
|
* - 1 LCD display 0x50100000
|
|
|
|
* - 1 CPLD 0x50100000
|
|
|
|
* - 1 I2C EEPROM
|
|
|
|
* - 1 I2C thermal sensor
|
|
|
|
* - a set of LEDs
|
|
|
|
* - bit-bang SPI port using GPIOs
|
|
|
|
* - 1 EBC interface connector 0 0x50200000
|
|
|
|
* - 1 cardbus controller + expansion slot.
|
|
|
|
* - 1 PCI expansion slot.
|
|
|
|
*/
|
|
|
|
typedef struct taihu_cpld_t taihu_cpld_t;
|
|
|
|
struct taihu_cpld_t {
|
|
|
|
uint8_t reg0;
|
|
|
|
uint8_t reg1;
|
|
|
|
};
|
|
|
|
|
2015-11-16 15:57:50 +01:00
|
|
|
static uint64_t taihu_cpld_read(void *opaque, hwaddr addr, unsigned size)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
|
|
|
taihu_cpld_t *cpld;
|
|
|
|
uint32_t ret;
|
|
|
|
|
|
|
|
cpld = opaque;
|
|
|
|
switch (addr) {
|
|
|
|
case 0x0:
|
|
|
|
ret = cpld->reg0;
|
|
|
|
break;
|
|
|
|
case 0x1:
|
|
|
|
ret = cpld->reg1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-11-16 15:57:50 +01:00
|
|
|
static void taihu_cpld_write(void *opaque, hwaddr addr,
|
|
|
|
uint64_t value, unsigned size)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
|
|
|
taihu_cpld_t *cpld;
|
|
|
|
|
|
|
|
cpld = opaque;
|
|
|
|
switch (addr) {
|
|
|
|
case 0x0:
|
|
|
|
/* Read only */
|
|
|
|
break;
|
|
|
|
case 0x1:
|
|
|
|
cpld->reg1 = value;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-12 15:43:53 +02:00
|
|
|
static const MemoryRegionOps taihu_cpld_ops = {
|
2015-11-16 15:57:50 +01:00
|
|
|
.read = taihu_cpld_read,
|
|
|
|
.write = taihu_cpld_write,
|
|
|
|
.impl = {
|
|
|
|
.min_access_size = 1,
|
|
|
|
.max_access_size = 1,
|
2011-09-12 15:43:53 +02:00
|
|
|
},
|
|
|
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
2007-04-24 09:40:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void taihu_cpld_reset (void *opaque)
|
|
|
|
{
|
|
|
|
taihu_cpld_t *cpld;
|
|
|
|
|
|
|
|
cpld = opaque;
|
|
|
|
cpld->reg0 = 0x01;
|
|
|
|
cpld->reg1 = 0x80;
|
|
|
|
}
|
|
|
|
|
2012-10-15 22:22:02 +02:00
|
|
|
static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
|
|
|
taihu_cpld_t *cpld;
|
2011-09-12 15:43:53 +02:00
|
|
|
MemoryRegion *cpld_memory = g_new(MemoryRegion, 1);
|
2007-04-24 09:40:49 +02:00
|
|
|
|
2011-08-21 05:09:37 +02:00
|
|
|
cpld = g_malloc0(sizeof(taihu_cpld_t));
|
2013-06-06 11:41:28 +02:00
|
|
|
memory_region_init_io(cpld_memory, NULL, &taihu_cpld_ops, cpld, "cpld", 0x100);
|
2011-09-12 15:43:53 +02:00
|
|
|
memory_region_add_subregion(sysmem, base, cpld_memory);
|
2009-06-27 09:25:07 +02:00
|
|
|
qemu_register_reset(&taihu_cpld_reset, cpld);
|
2007-04-24 09:40:49 +02:00
|
|
|
}
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
static void taihu_405ep_init(MachineState *machine)
|
2007-04-24 09:40:49 +02:00
|
|
|
{
|
2014-05-07 16:42:57 +02:00
|
|
|
ram_addr_t ram_size = machine->ram_size;
|
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
|
|
|
const char *initrd_filename = machine->initrd_filename;
|
2009-05-30 01:52:44 +02:00
|
|
|
char *filename;
|
2007-04-24 09:40:49 +02:00
|
|
|
qemu_irq *pic;
|
2011-09-12 15:43:53 +02:00
|
|
|
MemoryRegion *sysmem = get_system_memory();
|
2011-08-04 14:55:30 +02:00
|
|
|
MemoryRegion *bios;
|
2018-11-27 14:05:29 +01:00
|
|
|
MemoryRegion *ram_memories = g_new(MemoryRegion, 2);
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
MemoryRegion *ram = g_malloc0(sizeof(*ram));
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_bases[2], ram_sizes[2];
|
2010-09-18 07:53:14 +02:00
|
|
|
long bios_size;
|
|
|
|
target_ulong kernel_base, initrd_base;
|
|
|
|
long kernel_size, initrd_size;
|
2007-04-24 09:40:49 +02:00
|
|
|
int linux_boot;
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
int fl_idx;
|
2009-07-22 16:42:57 +02:00
|
|
|
DriveInfo *dinfo;
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2007-04-24 09:40:49 +02:00
|
|
|
/* RAM is soldered to the board so the size cannot be changed */
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
ram_size = 0x08000000;
|
|
|
|
memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram",
|
|
|
|
ram_size);
|
|
|
|
|
2011-08-15 16:17:27 +02:00
|
|
|
ram_bases[0] = 0;
|
2007-04-24 09:40:49 +02:00
|
|
|
ram_sizes[0] = 0x04000000;
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
memory_region_init_alias(&ram_memories[0], NULL,
|
|
|
|
"taihu_405ep.ram-0", ram, ram_bases[0],
|
|
|
|
ram_sizes[0]);
|
2011-08-15 16:17:27 +02:00
|
|
|
ram_bases[1] = 0x04000000;
|
2007-04-24 09:40:49 +02:00
|
|
|
ram_sizes[1] = 0x04000000;
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
memory_region_init_alias(&ram_memories[1], NULL,
|
|
|
|
"taihu_405ep.ram-1", ram, ram_bases[1],
|
|
|
|
ram_sizes[1]);
|
2011-09-12 15:43:53 +02:00
|
|
|
ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,
|
2011-08-12 01:07:17 +02:00
|
|
|
33333333, &pic, kernel_filename == NULL ? 0 : 1);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* allocate and load BIOS */
|
|
|
|
fl_idx = 0;
|
|
|
|
#if defined(USE_FLASH_BIOS)
|
2009-07-22 16:42:57 +02:00
|
|
|
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
|
|
|
|
if (dinfo) {
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
bios_size = 2 * MiB;
|
|
|
|
pflash_cfi02_register(0xFFE00000,
|
2019-03-08 10:46:09 +01:00
|
|
|
"taihu_405ep.bios", bios_size,
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
|
2019-03-08 10:46:10 +01:00
|
|
|
64 * KiB, 1,
|
2011-08-25 21:39:18 +02:00
|
|
|
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
|
|
|
|
1);
|
2007-04-24 09:40:49 +02:00
|
|
|
fl_idx++;
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2007-10-05 15:08:35 +02:00
|
|
|
if (bios_name == NULL)
|
|
|
|
bios_name = BIOS_FILENAME;
|
2011-08-04 14:55:30 +02:00
|
|
|
bios = g_new(MemoryRegion, 1);
|
2017-07-07 16:42:53 +02:00
|
|
|
memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
|
Fix bad error handling after memory_region_init_ram()
Symptom:
$ qemu-system-x86_64 -m 10000000
Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
Aborted (core dumped)
Root cause: commit ef701d7 screwed up handling of out-of-memory
conditions. Before the commit, we report the error and exit(1), in
one place, ram_block_add(). The commit lifts the error handling up
the call chain some, to three places. Fine. Except it uses
&error_abort in these places, changing the behavior from exit(1) to
abort(), and thus undoing the work of commit 3922825 "exec: Don't
abort when we can't allocate guest memory".
The three places are:
* memory_region_init_ram()
Commit 4994653 (right after commit ef701d7) lifted the error
handling further, through memory_region_init_ram(), multiplying the
incorrect use of &error_abort. Later on, imitation of existing
(bad) code may have created more.
* memory_region_init_ram_ptr()
The &error_abort is still there.
* memory_region_init_rom_device()
Doesn't need fixing, because commit 33e0eb5 (soon after commit
ef701d7) lifted the error handling further, and in the process
changed it from &error_abort to passing it up the call chain.
Correct, because the callers are realize() methods.
Fix the error handling after memory_region_init_ram() with a
Coccinelle semantic patch:
@r@
expression mr, owner, name, size, err;
position p;
@@
memory_region_init_ram(mr, owner, name, size,
(
- &error_abort
+ &error_fatal
|
err@p
)
);
@script:python@
p << r.p;
@@
print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
When the last argument is &error_abort, it gets replaced by
&error_fatal. This is the fix.
If the last argument is anything else, its position is reported. This
lets us check the fix is complete. Four positions get reported:
* ram_backend_memory_alloc()
Error is passed up the call chain, ultimately through
user_creatable_complete(). As far as I can tell, it's callers all
handle the error sanely.
* fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
DeviceClass.realize() methods, errors handled sanely further up the
call chain.
We're good. Test case again behaves:
$ qemu-system-x86_64 -m 10000000
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
[Exit 1 ]
The next commits will repair the rest of commit ef701d7's damage.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1441983105-26376-3-git-send-email-armbru@redhat.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
2015-09-11 16:51:43 +02:00
|
|
|
&error_fatal);
|
2009-05-30 01:52:44 +02:00
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
|
|
|
if (filename) {
|
2018-12-14 14:30:50 +01:00
|
|
|
bios_size = load_image_size(filename,
|
|
|
|
memory_region_get_ram_ptr(bios),
|
|
|
|
BIOS_SIZE);
|
2011-08-21 05:09:37 +02:00
|
|
|
g_free(filename);
|
2018-12-14 14:30:50 +01:00
|
|
|
if (bios_size < 0) {
|
2013-08-05 15:27:23 +02:00
|
|
|
error_report("Could not load PowerPC BIOS '%s'", bios_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
bios_size = (bios_size + 0xfff) & ~0xfff;
|
|
|
|
memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
|
|
|
|
} else if (!qtest_enabled()) {
|
|
|
|
error_report("Could not load PowerPC BIOS '%s'", bios_name);
|
2007-04-24 09:40:49 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
2011-08-04 14:55:30 +02:00
|
|
|
memory_region_set_readonly(bios, true);
|
2007-04-24 09:40:49 +02:00
|
|
|
}
|
|
|
|
/* Register Linux flash */
|
2009-07-22 16:42:57 +02:00
|
|
|
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
|
|
|
|
if (dinfo) {
|
2018-06-25 14:42:24 +02:00
|
|
|
bios_size = 32 * MiB;
|
2019-03-08 10:46:09 +01:00
|
|
|
pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
|
ppc405_boards: Don't size flash memory to match backing image
Machine "ref405ep" maps its flash memory at address 2^32 - image size.
Image size is rounded up to the next multiple of 64KiB. Useless,
because pflash_cfi02_realize() fails with "failed to read the initial
flash content" unless the rounding is a no-op.
If the image size exceeds 0x80000 Bytes, we overlap first SRAM, then
other stuff. No idea how that would play out, but useful outcomes
seem unlikely.
Map the flash memory at fixed address 0xFFF80000 with size 512KiB,
regardless of image size, to match the physical hardware.
Machine "taihu" maps its boot flash memory similarly. The code even
has a comment /* XXX: should check that size is 2MB */, followed by
disabled code to adjust the size to 2MiB regardless of image size.
Its code to map its application flash memory looks the same, except
there the XXX comment asks for 32MiB, and the code to adjust the size
isn't disabled. Note that pflash_cfi02_realize() fails with "failed
to read the initial flash content" for images smaller than 32MiB.
Map the boot flash memory at fixed address 0xFFE00000 with size 2MiB,
to match the physical hardware. Delete dead code from application
flash mapping, and simplify some.
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-9-armbru@redhat.com>
2019-03-08 10:46:03 +01:00
|
|
|
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
|
2019-03-08 10:46:10 +01:00
|
|
|
64 * KiB, 1,
|
2011-08-25 21:39:18 +02:00
|
|
|
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
|
|
|
|
1);
|
2007-04-24 09:40:49 +02:00
|
|
|
fl_idx++;
|
|
|
|
}
|
|
|
|
/* Register CLPD & LCD display */
|
2011-09-12 15:43:53 +02:00
|
|
|
taihu_cpld_init(sysmem, 0x50100000);
|
2007-04-24 09:40:49 +02:00
|
|
|
/* Load kernel */
|
|
|
|
linux_boot = (kernel_filename != NULL);
|
|
|
|
if (linux_boot) {
|
|
|
|
kernel_base = KERNEL_LOAD_ADDR;
|
|
|
|
/* now we can load the kernel */
|
2009-04-10 16:29:45 +02:00
|
|
|
kernel_size = load_image_targphys(kernel_filename, kernel_base,
|
|
|
|
ram_size - kernel_base);
|
2007-04-24 09:40:49 +02:00
|
|
|
if (kernel_size < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 09:43:10 +01:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2007-04-24 09:40:49 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
/* load initrd */
|
|
|
|
if (initrd_filename) {
|
|
|
|
initrd_base = INITRD_LOAD_ADDR;
|
2009-04-10 16:29:45 +02:00
|
|
|
initrd_size = load_image_targphys(initrd_filename, initrd_base,
|
|
|
|
ram_size - initrd_base);
|
2007-04-24 09:40:49 +02:00
|
|
|
if (initrd_size < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 09:43:10 +01:00
|
|
|
error_report("could not load initial ram disk '%s'",
|
|
|
|
initrd_filename);
|
2007-04-24 09:40:49 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
initrd_base = 0;
|
|
|
|
initrd_size = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
kernel_base = 0;
|
|
|
|
kernel_size = 0;
|
|
|
|
initrd_base = 0;
|
|
|
|
initrd_size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static void taihu_class_init(ObjectClass *oc, void *data)
|
2009-05-21 01:38:09 +02:00
|
|
|
{
|
2015-09-19 10:49:44 +02:00
|
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
mc->desc = "taihu";
|
|
|
|
mc->init = taihu_405ep_init;
|
2009-05-21 01:38:09 +02:00
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static const TypeInfo taihu_type = {
|
|
|
|
.name = MACHINE_TYPE_NAME("taihu"),
|
|
|
|
.parent = TYPE_MACHINE,
|
|
|
|
.class_init = taihu_class_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void ppc405_machine_init(void)
|
|
|
|
{
|
|
|
|
type_register_static(&ref405ep_type);
|
|
|
|
type_register_static(&taihu_type);
|
|
|
|
}
|
|
|
|
|
2016-02-16 21:59:04 +01:00
|
|
|
type_init(ppc405_machine_init)
|