target-arm queue
Another target-arm queue flush. I expect there'll be another lot next week...
The following changes since commit b041066421e8dcc7d080dfcfd83551c9c9f24ade:
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2015-09-03 16:17:28 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20150904
for you to fetch changes up to d9fd6f3874a326033a446a6db8cd113bf4015e6a:
arm/virt: Add full-sized CPU affinity handling (2015-09-04 15:49:54 +0100)
----------------------------------------------------------------
target-arm queue:
* cleanup to use g_new() and friends
* support semihosting in A64
* add SMBIOS support to mach-virt
* remove hw_error() usages
* fix bug in the AArch32:AArch64 register mapping
* add a second PCI memory window in highmem on virt board
* fix bug in arm_excp_unmasked()
* add i.MX31 SoC
* remove restriction on handling affinity values in virt board
----------------------------------------------------------------
Christopher Covington (1):
target-arm: Improve semihosting debug prints
Jean-Christophe Dubois (8):
i.MX: Add SOC support for i.MX31
i.MX: KZM: use standalone i.MX31 SOC support i.MX: Add I2C controller emulator
i.MX: Add FEC Ethernet Emulator
i.MX: Add SOC support for i.MX25
i.MX: Add the i.MX25 PDK platform
i.MX: Add qtest support for I2C device emulator. i.MX: Add i2C devices to i.MX31 SOC
Markus Armbruster (1):
arm: Use g_new() & friends where that makes obvious sense
Pavel Fedin (3):
hw/arm/virt: Add high MMIO PCI region, 512G in size
target-arm: Refactor CPU affinity handling arm/virt: Add full-sized CPU affinity handling
Peter Crosthwaite (2):
arm: cpu: assert() on no-EL2 virt IRQ error condition.
arm: Remove hw_error() usages.
Peter Maydell (8):
target-arm/arm-semi.c: Fix broken SYS_WRITE0 via gdb
gdbstub: Implement gdb_do_syscallv() target-arm/arm-semi.c: Factor out repeated 'return env->regs[0]' include/exec/softmmu-semi.h: Add support for 64-bit values target-arm/arm-semi.c: Support widening APIs to 64 bits target-arm/arm-semi.c: Implement A64 specific SyncCacheRange call target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter block
target-arm: Wire up HLT 0xf000 as the A64 semihosting instruction
Sergey Sorokin (2):
target-arm: Fix AArch32:AArch64 general-purpose register mapping
target-arm: Fix arm_excp_unmasked() function
Wei Huang (2):
smbios: add smbios 3.0 support
smbios: implement smbios support for mach-virt
default-configs/arm-softmmu.mak | 7 + gdbstub.c | 14 +- hw/arm/Makefile.objs | 4 +- hw/arm/fsl-imx25.c | 273 +++++++++++++++ hw/arm/fsl-imx31.c | 246 ++++++++++++++ hw/arm/imx25_pdk.c | 159 +++++++++ hw/arm/kzm.c | 205 ++++++----- hw/arm/omap1.c | 30 +- hw/arm/omap2.c | 15 +- hw/arm/pxa2xx.c | 11 +- hw/arm/stellaris.c | 2 +- hw/arm/strongarm.c | 2 +- hw/arm/virt-acpi-build.c | 17 +- hw/arm/virt.c | 126 ++++++- hw/char/imx_serial.c | 35 -- hw/char/omap_uart.c | 3 +- hw/display/omap_dss.c | 3 +- hw/display/omap_lcdc.c | 3 +- hw/dma/omap_dma.c | 6 +- hw/gpio/omap_gpio.c | 4 +- hw/i2c/Makefile.objs | 1 + hw/i2c/imx_i2c.c | 339 +++++++++++++++++++ hw/i386/pc_piix.c | 3 +- hw/i386/pc_q35.c | 3 +- hw/input/stellaris_input.c | 4 +- hw/misc/omap_clk.c | 2 +- hw/misc/omap_gpmc.c | 3 +- hw/misc/omap_sdrc.c | 3 +- hw/net/Makefile.objs | 1 + hw/net/imx_fec.c | 709 +++++++++++++++++++++++++++++++++++++++ hw/sd/omap_mmc.c | 6 +- hw/smbios/smbios.c | 84 +++-- hw/ssi/omap_spi.c | 3 +- hw/timer/imx_epit.c | 11 - hw/timer/imx_gpt.c | 11 - hw/timer/omap_gptimer.c | 3 +- include/exec/gdbstub.h | 27 ++ include/exec/softmmu-semi.h | 18 + include/hw/arm/fsl-imx25.h | 234 +++++++++++++ include/hw/arm/fsl-imx31.h | 110 ++++++ include/hw/arm/imx.h | 26 -- include/hw/arm/virt-acpi-build.h | 1 + include/hw/arm/virt.h | 1 + include/hw/i2c/imx_i2c.h | 87 +++++ include/hw/net/imx_fec.h | 113 +++++++ include/hw/smbios/smbios.h | 62 +++- linux-user/main.c | 3 + qemu-options.hx | 2 +- target-arm/arm-semi.c | 171 +++++++--- target-arm/cpu-qom.h | 13 + target-arm/cpu.c | 11 +- target-arm/cpu.h | 9 +- target-arm/helper-a64.c | 6 + target-arm/helper.c | 78 +++-- target-arm/internals.h | 2 + target-arm/kvm32.c | 3 +- target-arm/kvm64.c | 3 +- target-arm/translate-a64.c | 24 +- tests/Makefile | 3 + tests/bios-tables-test.c | 6 +- tests/ds1338-test.c | 78 +++++ tests/libqos/i2c-imx.c | 209 ++++++++++++ tests/libqos/i2c.h | 3 + 63 files changed, 3248 insertions(+), 406 deletions(-) create mode 100644 hw/arm/fsl-imx25.c create mode 100644 hw/arm/fsl-imx31.c create mode 100644 hw/arm/imx25_pdk.c create mode 100644 hw/i2c/imx_i2c.c create mode 100644 hw/net/imx_fec.c create mode 100644 include/hw/arm/fsl-imx25.h create mode 100644 include/hw/arm/fsl-imx31.h delete mode 100644 include/hw/arm/imx.h create mode 100644 include/hw/i2c/imx_i2c.h create mode 100644 include/hw/net/imx_fec.h create mode 100644 tests/ds1338-test.c create mode 100644 tests/libqos/i2c-imx.c
[Qemu-devel] [PULL 05/27] target-arm/arm-semi.c: Factor out repeated 'return env->regs[0]'
Factor out a repeated pattern in the semihosting code:
gdb_do_syscall(arm_semi_cb, "system,%s", arg0, (int)arg1+1);
/* arm_semi_cb sets env->regs[0] to the syscall return value */
return env->regs[0];For A64 the return value will go in a different register; pull the sequence out into its own function that passes the return value in a static variable rather than overloading regs[0] for the purpose, so the code will work on both A32/T32 and A64.
Note that the lack-of-synchronization bug noted in the FIXME comment is not introduced by this commit, but was already present.
Message-id: [email protected]
--- target-arm/arm-semi.c | 79 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 32 deletions(-)
target-arm/arm-semi.c +47 -32
@@ -134,6 +134,7 @@ static void arm_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)#ifdef CONFIG_USER_ONLY TaskState *ts = cs->opaque;#endif +target_ulong reg0 = env->regs[0 ];if (ret == (target_ulong)-1 ) {#ifdef CONFIG_USER_ONLY
@@ -141,22 +142,23 @@ static void arm_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)#else syscall_err = err;#endif - env->regs[0 ] = ret; + reg0 = ret; }else {/* Fixup syscalls that use nonstardard return conventions. */ -switch (env->regs[0 ]) { +switch (reg0) {case TARGET_SYS_WRITE :case TARGET_SYS_READ : - env->regs[0 ] = arm_semi_syscall_len - ret; + reg0 = arm_semi_syscall_len - ret;break ;case TARGET_SYS_SEEK : - env->regs[0 ] =0 ; + reg0 =0 ;break ;default : - env->regs[0 ] = ret; + reg0 = ret;break ; } } + env->regs[0 ] = reg0; }static void arm_semi_flen_cb (CPUState *cs,target_ulong ret,target_ulong err)
@@ -175,6 +177,25 @@ static void arm_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)#endif } +static target_ulong arm_gdb_syscall (ARMCPU *cpu,gdb_syscall_complete_cb cb, +const char *fmt, ...) +{ +va_list va; +CPUARMState *env = &cpu->env; + +va_start (va, fmt); +gdb_do_syscallv (cb, fmt, va); +va_end (va); + +/* FIXME: we are implicitly relying on the syscall completing +* before this point, which is not guaranteed. We should +* put in an explicit synchronization between this and +* the callback function. +*/ + +return env->regs[0 ]; +} +/* Read the input value from the argument block; fail the semihosting * call if the memory read fails. */
@@ -223,9 +244,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)return result_fileno; }if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"open,%s,%x,1a4" , arg0, - (int )arg2+1 , gdb_open_modeflags[arg1]); - ret = env->regs[0 ]; + ret =arm_gdb_syscall (cpu, arm_semi_cb,"open,%s,%x,1a4" , arg0, + (int )arg2+1 , gdb_open_modeflags[arg1]); }else { ret =set_swi_errno (ts,open (s, open_modeflags[arg1],0644 )); }
@@ -234,8 +254,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)case TARGET_SYS_CLOSE :GET_ARG (0 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"close,%x" , arg0); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"close,%x" , arg0); }else {return set_swi_errno (ts,close (arg0)); }
@@ -248,8 +267,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)return (uint32_t )-1 ;/* Write to debug console. stderr is near enough. */ if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"write,2,%x,1" , args); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"write,2,%x,1" , args); }else {return write (STDERR_FILENO , &c,1 ); }
@@ -260,8 +278,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)return (uint32_t )-1 ; len =strlen (s);if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"write,2,%x,%x" , args, len); - ret = env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"write,2,%x,%x" , + args, len); }else { ret =write (STDERR_FILENO , s, len); }
@@ -274,8 +292,8 @@ uint32_t do_arm_semihosting(CPUARMState *env) len = arg2;if (use_gdb_syscalls ()) { arm_semi_syscall_len = len; -gdb_do_syscall (arm_semi_cb,"write,%x,%x,%x" , arg0, arg1, len); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"write,%x,%x,%x" , + arg0, arg1, len); }else { s =lock_user (VERIFY_READ , arg1, len,1 );if (!s) {
@@ -295,8 +313,8 @@ uint32_t do_arm_semihosting(CPUARMState *env) len = arg2;if (use_gdb_syscalls ()) { arm_semi_syscall_len = len; -gdb_do_syscall (arm_semi_cb,"read,%x,%x,%x" , arg0, arg1, len); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"read,%x,%x,%x" , + arg0, arg1, len); }else { s =lock_user (VERIFY_WRITE , arg1, len,0 );if (!s) {
@@ -317,8 +335,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)case TARGET_SYS_ISTTY :GET_ARG (0 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"isatty,%x" , arg0); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"isatty,%x" , arg0); }else {return isatty (arg0); }
@@ -326,8 +343,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)GET_ARG (0 );GET_ARG (1 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"lseek,%x,%x,0" , arg0, arg1); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"lseek,%x,%x,0" , + arg0, arg1); }else { ret =set_swi_errno (ts,lseek (arg0, arg1,SEEK_SET ));if (ret == (uint32_t )-1 )
@@ -337,9 +354,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)case TARGET_SYS_FLEN :GET_ARG (0 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_flen_cb,"fstat,%x,%x" , - arg0, env->regs[13 ]-64 ); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_flen_cb,"fstat,%x,%x" , + arg0, env->regs[13 ]-64 ); }else {struct stat buf; ret =set_swi_errno (ts,fstat (arg0, &buf));
@@ -354,8 +370,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)GET_ARG (0 );GET_ARG (1 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"unlink,%s" , arg0, (int )arg1+1 ); - ret = env->regs[0 ]; + ret =arm_gdb_syscall (cpu, arm_semi_cb,"unlink,%s" , + arg0, (int )arg1+1 ); }else { s =lock_user_string (arg0);if (!s) {
@@ -372,9 +388,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)GET_ARG (2 );GET_ARG (3 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"rename,%s,%s" , - arg0, (int )arg1+1 , arg2, (int )arg3+1 ); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"rename,%s,%s" , + arg0, (int )arg1+1 , arg2, (int )arg3+1 ); }else {char *s2; s =lock_user_string (arg0);
@@ -398,8 +413,8 @@ uint32_t do_arm_semihosting(CPUARMState *env)GET_ARG (0 );GET_ARG (1 );if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"system,%s" , arg0, (int )arg1+1 ); -return env->regs[0 ]; +return arm_gdb_syscall (cpu, arm_semi_cb,"system,%s" , + arg0, (int )arg1+1 ); }else { s =lock_user_string (arg0);if (!s) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 14/27] arm: Remove hw_error() usages.
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
All of these hw_errors are fatal and indicate something wrong with QEMU implementation.
Convert to g_assert_not_reached.
Message-id: 169194d09017e5725535d31a1507d454c0043706.1440842587.git.crosthwaite.peter@gmail.com
--- target-arm/cpu.c | 4 ++-- target-arm/helper.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
target-arm/cpu.c +2 -2
@@ -342,7 +342,7 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level) }break ;default : -hw_error ("arm_cpu_set_irq: Bad interrupt line %d\n" , irq); +g_assert_not_reached (); } }
@@ -361,7 +361,7 @@ static void arm_cpu_kvm_set_irq(void *opaque, int irq, int level) kvm_irq |=KVM_ARM_IRQ_CPU_FIQ ;break ;default : -hw_error ("arm_cpu_kvm_set_irq: Bad interrupt line %d\n" , irq); +g_assert_not_reached (); } kvm_irq |= cs->cpu_index <<KVM_ARM_IRQ_VCPU_SHIFT ;kvm_set_irq (kvm_state, kvm_irq, level ?1 :0 );
target-arm/helper.c +1 -1
@@ -4990,7 +4990,7 @@ int bank_number(int mode)case ARM_CPU_MODE_MON :return 7 ; } -hw_error ("bank number requested for bad CPSR mode value 0x%x\n" , mode); +g_assert_not_reached (); }void switch_mode (CPUARMState *env,int mode)
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 15/27] target-arm: Fix AArch32:AArch64 general-purpose register mapping
In reply to Peter MaydellFrom: Sergey Sorokin <[email protected]>
There is an error in functions aarch64_sync_32_to_64() and aarch64_sync_64_to_32() with mapping of registers between AArch32 and AArch64. This commit fixes the mapping to match the v8 ARM ARM section D1.20.1 (table D1-77).
Message-id: [email protected]
--- target-arm/helper.c | 64 ++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
target-arm/helper.c +32 -32
@@ -5324,35 +5324,35 @@ void aarch64_sync_32_to_64(CPUARMState *env) }if (mode ==ARM_CPU_MODE_IRQ ) { - env->xregs[16 ] = env->regs[13 ]; - env->xregs[17 ] = env->regs[14 ]; + env->xregs[16 ] = env->regs[14 ]; + env->xregs[17 ] = env->regs[13 ]; }else { - env->xregs[16 ] = env->banked_r13[bank_number (ARM_CPU_MODE_IRQ )]; - env->xregs[17 ] = env->banked_r14[bank_number (ARM_CPU_MODE_IRQ )]; + env->xregs[16 ] = env->banked_r14[bank_number (ARM_CPU_MODE_IRQ )]; + env->xregs[17 ] = env->banked_r13[bank_number (ARM_CPU_MODE_IRQ )]; }if (mode ==ARM_CPU_MODE_SVC ) { - env->xregs[18 ] = env->regs[13 ]; - env->xregs[19 ] = env->regs[14 ]; + env->xregs[18 ] = env->regs[14 ]; + env->xregs[19 ] = env->regs[13 ]; }else { - env->xregs[18 ] = env->banked_r13[bank_number (ARM_CPU_MODE_SVC )]; - env->xregs[19 ] = env->banked_r14[bank_number (ARM_CPU_MODE_SVC )]; + env->xregs[18 ] = env->banked_r14[bank_number (ARM_CPU_MODE_SVC )]; + env->xregs[19 ] = env->banked_r13[bank_number (ARM_CPU_MODE_SVC )]; }if (mode ==ARM_CPU_MODE_ABT ) { - env->xregs[20 ] = env->regs[13 ]; - env->xregs[21 ] = env->regs[14 ]; + env->xregs[20 ] = env->regs[14 ]; + env->xregs[21 ] = env->regs[13 ]; }else { - env->xregs[20 ] = env->banked_r13[bank_number (ARM_CPU_MODE_ABT )]; - env->xregs[21 ] = env->banked_r14[bank_number (ARM_CPU_MODE_ABT )]; + env->xregs[20 ] = env->banked_r14[bank_number (ARM_CPU_MODE_ABT )]; + env->xregs[21 ] = env->banked_r13[bank_number (ARM_CPU_MODE_ABT )]; }if (mode ==ARM_CPU_MODE_UND ) { - env->xregs[22 ] = env->regs[13 ]; - env->xregs[23 ] = env->regs[14 ]; + env->xregs[22 ] = env->regs[14 ]; + env->xregs[23 ] = env->regs[13 ]; }else { - env->xregs[22 ] = env->banked_r13[bank_number (ARM_CPU_MODE_UND )]; - env->xregs[23 ] = env->banked_r14[bank_number (ARM_CPU_MODE_UND )]; + env->xregs[22 ] = env->banked_r14[bank_number (ARM_CPU_MODE_UND )]; + env->xregs[23 ] = env->banked_r13[bank_number (ARM_CPU_MODE_UND )]; }/* Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
@@ -5429,35 +5429,35 @@ void aarch64_sync_64_to_32(CPUARMState *env) }if (mode ==ARM_CPU_MODE_IRQ ) { - env->regs[13 ] = env->xregs[16 ]; - env->regs[14 ] = env->xregs[17 ]; + env->regs[14 ] = env->xregs[16 ]; + env->regs[13 ] = env->xregs[17 ]; }else { - env->banked_r13[bank_number (ARM_CPU_MODE_IRQ )] = env->xregs[16 ]; - env->banked_r14[bank_number (ARM_CPU_MODE_IRQ )] = env->xregs[17 ]; + env->banked_r14[bank_number (ARM_CPU_MODE_IRQ )] = env->xregs[16 ]; + env->banked_r13[bank_number (ARM_CPU_MODE_IRQ )] = env->xregs[17 ]; }if (mode ==ARM_CPU_MODE_SVC ) { - env->regs[13 ] = env->xregs[18 ]; - env->regs[14 ] = env->xregs[19 ]; + env->regs[14 ] = env->xregs[18 ]; + env->regs[13 ] = env->xregs[19 ]; }else { - env->banked_r13[bank_number (ARM_CPU_MODE_SVC )] = env->xregs[18 ]; - env->banked_r14[bank_number (ARM_CPU_MODE_SVC )] = env->xregs[19 ]; + env->banked_r14[bank_number (ARM_CPU_MODE_SVC )] = env->xregs[18 ]; + env->banked_r13[bank_number (ARM_CPU_MODE_SVC )] = env->xregs[19 ]; }if (mode ==ARM_CPU_MODE_ABT ) { - env->regs[13 ] = env->xregs[20 ]; - env->regs[14 ] = env->xregs[21 ]; + env->regs[14 ] = env->xregs[20 ]; + env->regs[13 ] = env->xregs[21 ]; }else { - env->banked_r13[bank_number (ARM_CPU_MODE_ABT )] = env->xregs[20 ]; - env->banked_r14[bank_number (ARM_CPU_MODE_ABT )] = env->xregs[21 ]; + env->banked_r14[bank_number (ARM_CPU_MODE_ABT )] = env->xregs[20 ]; + env->banked_r13[bank_number (ARM_CPU_MODE_ABT )] = env->xregs[21 ]; }if (mode ==ARM_CPU_MODE_UND ) { - env->regs[13 ] = env->xregs[22 ]; - env->regs[14 ] = env->xregs[23 ]; + env->regs[14 ] = env->xregs[22 ]; + env->regs[13 ] = env->xregs[23 ]; }else { - env->banked_r13[bank_number (ARM_CPU_MODE_UND )] = env->xregs[22 ]; - env->banked_r14[bank_number (ARM_CPU_MODE_UND )] = env->xregs[23 ]; + env->banked_r14[bank_number (ARM_CPU_MODE_UND )] = env->xregs[22 ]; + env->banked_r13[bank_number (ARM_CPU_MODE_UND )] = env->xregs[23 ]; }/* Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 19/27] i.MX: KZM: use standalone i.MX31 SOC support
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
Convert the KZM board to use the i.MX31 SoC defintition instead of redefining the entire SoC on the machine level. Major rewrite of the machine init code.
While touching the memory map comment de-indent to the correct level of indentation.
This obsoletes the legacy i.MX device device creation helpers which are removed.
Tested by booting a minimal Linux system on the emulated platform
Message-id: 5e783561f092e1c939562fdff001f1ab1194b07f.1441057361.git.jcd@tribudubois.net
--- hw/arm/kzm.c | 205 +++++++++++++++++++++++++-------------------------- hw/char/imx_serial.c | 35 --------- hw/timer/imx_epit.c | 11 --- hw/timer/imx_gpt.c | 11 --- include/hw/arm/imx.h | 26 ------- 5 files changed, 102 insertions(+), 186 deletions(-) delete mode 100644 include/hw/arm/imx.h
hw/arm/kzm.c +102 -103
@@ -13,131 +13,130 @@* i.MX31 SoC */ -#include "hw/sysbus.h" +#include "hw/arm/fsl-imx31.h" +#include "hw/boards.h" +#include "qemu/error-report.h" #include "exec/address-spaces.h" -#include "hw/hw.h" -#include "hw/arm/arm.h" -#include "hw/devices.h" #include "net/net.h" -#include "sysemu/sysemu.h" -#include "hw/boards.h" +#include "hw/devices.h" #include "hw/char/serial.h" -#include "hw/intc/imx_avic.h" -#include "hw/arm/imx.h" - -/* Memory map for Kzm Emulation Baseboard: -* 0x00000000-0x00003fff 16k secure ROM IGNORED -* 0x00004000-0x00407fff Reserved IGNORED -* 0x00404000-0x00407fff ROM IGNORED -* 0x00408000-0x0fffffff Reserved IGNORED -* 0x10000000-0x1fffbfff RAM aliasing IGNORED -* 0x1fffc000-0x1fffffff RAM EMULATED -* 0x20000000-0x2fffffff Reserved IGNORED -* 0x30000000-0x7fffffff I.MX31 Internal Register Space -* 0x43f00000 IO_AREA0 -* 0x43f90000 UART1 EMULATED -* 0x43f94000 UART2 EMULATED -* 0x68000000 AVIC EMULATED -* 0x53f80000 CCM EMULATED -* 0x53f94000 PIT 1 EMULATED -* 0x53f98000 PIT 2 EMULATED -* 0x53f90000 GPT EMULATED -* 0x80000000-0x87ffffff RAM EMULATED -* 0x88000000-0x8fffffff RAM Aliasing EMULATED -* 0xa0000000-0xafffffff NAND Flash IGNORED -* 0xb0000000-0xb3ffffff Unavailable IGNORED -* 0xb4000000-0xb4000fff 8-bit free space IGNORED -* 0xb4001000-0xb400100f Board control IGNORED -* 0xb4001003 DIP switch -* 0xb4001010-0xb400101f 7-segment LED IGNORED -* 0xb4001020-0xb400102f LED IGNORED -* 0xb4001030-0xb400103f LED IGNORED -* 0xb4001040-0xb400104f FPGA, UART EMULATED -* 0xb4001050-0xb400105f FPGA, UART EMULATED -* 0xb4001060-0xb40fffff FPGA IGNORED -* 0xb6000000-0xb61fffff LAN controller EMULATED -* 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED -* 0xb6300000-0xb7ffffff Free IGNORED -* 0xb8000000-0xb8004fff Memory control registers IGNORED -* 0xc0000000-0xc3ffffff PCMCIA/CF IGNORED -* 0xc4000000-0xffffffff Reserved IGNORED -*/ - -#define KZM_RAMADDRESS (0x80000000) -#define KZM_FPGA (0xb4001040) +#include "sysemu/qtest.h" + +/* Memory map for Kzm Emulation Baseboard: +* 0x00000000-0x7fffffff See i.MX31 SOC for support +* 0x80000000-0x8fffffff RAM EMULATED +* 0x90000000-0x9fffffff RAM EMULATED +* 0xa0000000-0xafffffff Flash IGNORED +* 0xb0000000-0xb3ffffff Unavailable IGNORED +* 0xb4000000-0xb4000fff 8-bit free space IGNORED +* 0xb4001000-0xb400100f Board control IGNORED +* 0xb4001003 DIP switch +* 0xb4001010-0xb400101f 7-segment LED IGNORED +* 0xb4001020-0xb400102f LED IGNORED +* 0xb4001030-0xb400103f LED IGNORED +* 0xb4001040-0xb400104f FPGA, UART EMULATED +* 0xb4001050-0xb400105f FPGA, UART EMULATED +* 0xb4001060-0xb40fffff FPGA IGNORED +* 0xb6000000-0xb61fffff LAN controller EMULATED +* 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED +* 0xb6300000-0xb7ffffff Free IGNORED +* 0xb8000000-0xb8004fff Memory control registers IGNORED +* 0xc0000000-0xc3ffffff PCMCIA/CF IGNORED +* 0xc4000000-0xffffffff Reserved IGNORED +*/ + +typedef struct IMX31KZM { +FslIMX31State soc; +MemoryRegion ram; +MemoryRegion ram_alias; +}IMX31KZM ; + +#define KZM_RAM_ADDR (FSL_IMX31_SDRAM0_ADDR) +#define KZM_FPGA_ADDR (FSL_IMX31_CS4_ADDR + 0x1040) +#define KZM_LAN9118_ADDR (FSL_IMX31_CS5_ADDR)static struct arm_boot_info kzm_binfo = { - .loader_start =KZM_RAMADDRESS , + .loader_start =KZM_RAM_ADDR , .board_id =1722 , };static void kzm_init (MachineState *machine) { -ram_addr_t ram_size = machine->ram_size; -const char *cpu_model = machine->cpu_model; -const char *kernel_filename = machine->kernel_filename; -const char *kernel_cmdline = machine->kernel_cmdline; -const char *initrd_filename = machine->initrd_filename; -ARMCPU *cpu; -MemoryRegion *address_space_mem =get_system_memory (); -MemoryRegion *ram =g_new (MemoryRegion,1 ); -MemoryRegion *sram =g_new (MemoryRegion,1 ); -MemoryRegion *ram_alias =g_new (MemoryRegion,1 ); -DeviceState *dev; -DeviceState *ccm; - -if (!cpu_model) { - cpu_model ="arm1136" ; - } - - cpu =cpu_arm_init (cpu_model); -if (!cpu) { -fprintf (stderr,"Unable to find CPU definition\n" ); +IMX31KZM *s =g_new0 (IMX31KZM ,1 ); +Error *err =NULL ; +unsigned int ram_size; +unsigned int alias_offset; +unsigned int i; + +object_initialize (&s->soc,sizeof (s->soc),TYPE_FSL_IMX31 ); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (&s->soc), + &error_abort); + +object_property_set_bool (OBJECT (&s->soc), true,"realized" , &err); +if (err !=NULL ) { +error_report ("%s" ,error_get_pretty (err));exit (1 ); } -/* On a real system, the first 16k is a `secure boot rom' */ - -memory_region_allocate_system_memory (ram,NULL ,"kzm.ram" , ram_size); -memory_region_add_subregion (address_space_mem,KZM_RAMADDRESS , ram); - -memory_region_init_alias (ram_alias,NULL ,"ram.alias" , ram,0 , ram_size); -memory_region_add_subregion (address_space_mem,0x88000000 , ram_alias); - -memory_region_init_ram (sram,NULL ,"kzm.sram" ,0x4000 , &error_abort); -memory_region_add_subregion (address_space_mem,0x1FFFC000 , sram); - - dev =sysbus_create_varargs (TYPE_IMX_AVIC ,0x68000000 , -qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ ), -qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_FIQ ), -NULL ); - -imx_serial_create (0 ,0x43f90000 ,qdev_get_gpio_in (dev,45 )); -imx_serial_create (1 ,0x43f94000 ,qdev_get_gpio_in (dev,32 )); - - ccm =sysbus_create_simple (TYPE_IMX_CCM ,0x53f80000 ,NULL ); +/* Check the amount of memory is compatible with the SOC */ +if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE )) { +error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); + machine->ram_size =FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ; + } -imx_timerp_create (0x53f94000 ,qdev_get_gpio_in (dev,28 ), ccm); -imx_timerp_create (0x53f98000 ,qdev_get_gpio_in (dev,27 ), ccm); -imx_timerg_create (0x53f90000 ,qdev_get_gpio_in (dev,29 ), ccm); +memory_region_allocate_system_memory (&s->ram,NULL ,"kzm.ram" , + machine->ram_size); +memory_region_add_subregion (get_system_memory (),FSL_IMX31_SDRAM0_ADDR , + &s->ram); + +/* initialize the alias memory if any */ +for (i =0 , ram_size = machine->ram_size, alias_offset =0 ; + (i <2 ) && ram_size; i++) { +unsigned int size; +static const struct { +hwaddr addr; +unsigned int size; + } ram[2 ] = { + {FSL_IMX31_SDRAM0_ADDR ,FSL_IMX31_SDRAM0_SIZE }, + {FSL_IMX31_SDRAM1_ADDR ,FSL_IMX31_SDRAM1_SIZE }, + }; + + size =MIN (ram_size, ram[i].size); + + ram_size -= size; + +if (size < ram[i].size) { +memory_region_init_alias (&s->ram_alias,NULL ,"ram.alias" , + &s->ram, alias_offset, ram[i].size - size); +memory_region_add_subregion (get_system_memory (), + ram[i].addr + size, &s->ram_alias); + } + + alias_offset += ram[i].size; + }if (nd_table[0 ].used) { -lan9118_init (&nd_table[0 ],0xb6000000 ,qdev_get_gpio_in (dev,52 )); +lan9118_init (&nd_table[0 ],KZM_LAN9118_ADDR , +qdev_get_gpio_in (DEVICE (&s->soc.avic),52 )); }if (serial_hds[2 ]) {/* touchscreen */ -serial_mm_init (address_space_mem,KZM_FPGA +0x10 ,0 , -qdev_get_gpio_in (dev,52 ), -14745600 , serial_hds[2 ], -DEVICE_NATIVE_ENDIAN ); +serial_mm_init (get_system_memory (),KZM_FPGA_ADDR +0x10 ,0 , +qdev_get_gpio_in (DEVICE (&s->soc.avic),52 ), +14745600 , serial_hds[2 ],DEVICE_NATIVE_ENDIAN ); } - kzm_binfo.ram_size = ram_size; - kzm_binfo.kernel_filename = kernel_filename; - kzm_binfo.kernel_cmdline = kernel_cmdline; - kzm_binfo.initrd_filename = initrd_filename; + kzm_binfo.ram_size = machine->ram_size; + kzm_binfo.kernel_filename = machine->kernel_filename; + kzm_binfo.kernel_cmdline = machine->kernel_cmdline; + kzm_binfo.initrd_filename = machine->initrd_filename; kzm_binfo.nb_cpus =1 ; -arm_load_kernel (cpu, &kzm_binfo); + +if (!qtest_enabled ()) { +arm_load_kernel (&s->soc.cpu, &kzm_binfo); + } }static QEMUMachine kzm_machine = {
hw/char/imx_serial.c +0 -35
@@ -21,7 +21,6 @@#include "hw/char/imx_serial.h" #include "sysemu/sysemu.h" #include "sysemu/char.h" -#include "hw/arm/imx.h" //#define DEBUG_SERIAL 1 #ifdef DEBUG_SERIAL
@@ -334,40 +333,6 @@ static void imx_serial_init(Object *obj)sysbus_init_irq (sbd, &s->irq); } -void imx_serial_create (int uart,const hwaddr addr,qemu_irq irq) -{ -DeviceState *dev; -SysBusDevice *bus; -CharDriverState *chr; -const char chr_name[] ="serial" ; -char label[ARRAY_SIZE (chr_name) +1 ]; - - dev =qdev_create (NULL ,TYPE_IMX_SERIAL ); - -if (uart >=MAX_SERIAL_PORTS ) { -hw_error ("Cannot assign uart %d: QEMU supports only %d ports\n" , - uart,MAX_SERIAL_PORTS ); - } - chr = serial_hds[uart]; -if (!chr) { -snprintf (label,ARRAY_SIZE (label),"%s%d" , chr_name, uart); - chr =qemu_chr_new (label,"null" ,NULL ); -if (!(chr)) { -hw_error ("Can't assign serial port to imx-uart%d.\n" , uart); - } - } - -qdev_prop_set_chr (dev,"chardev" , chr); - bus =SYS_BUS_DEVICE (dev); -qdev_init_nofail (dev); -if (addr != (hwaddr)-1 ) { -sysbus_mmio_map (bus,0 , addr); - } -sysbus_connect_irq (bus,0 , irq); - -} - -static Property imx_serial_properties[] = {DEFINE_PROP_CHR ("chardev" , IMXSerialState, chr),DEFINE_PROP_END_OF_LIST (),
hw/timer/imx_epit.c +0 -11
@@ -12,7 +12,6 @@* */ -#include "hw/arm/imx.h" #include "hw/timer/imx_epit.h" #include "hw/misc/imx_ccm.h" #include "qemu/main-loop.h"
@@ -287,16 +286,6 @@ static void imx_epit_cmp(void *opaque)imx_epit_update_int (s); } -void imx_timerp_create (const hwaddr addr,qemu_irq irq,DeviceState *ccm) -{ -IMXEPITState *pp; -DeviceState *dev; - - dev =sysbus_create_simple (TYPE_IMX_EPIT , addr, irq); - pp =IMX_EPIT (dev); - pp->ccm = ccm; -} -static const MemoryRegionOps imx_epit_ops = { .read = imx_epit_read, .write = imx_epit_write,
hw/timer/imx_gpt.c +0 -11
@@ -12,7 +12,6 @@* */ -#include "hw/arm/imx.h" #include "hw/timer/imx_gpt.h" #include "hw/misc/imx_ccm.h" #include "qemu/main-loop.h"
@@ -449,16 +448,6 @@ static void imx_gpt_realize(DeviceState *dev, Error **errp) s->timer =ptimer_init (bh); } -void imx_timerg_create (const hwaddr addr,qemu_irq irq,DeviceState *ccm) -{ -IMXGPTState *pp; -DeviceState *dev; - - dev =sysbus_create_simple (TYPE_IMX_GPT , addr, irq); - pp =IMX_GPT (dev); - pp->ccm = ccm; -} -static void imx_gpt_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
include/hw/arm/imx.h deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* i.MX31 emulation -* -* Copyright (C) 2012 Peter Chubb -* NICTA -* -* This code is released under the GPL, version 2.0 or later -* See the file `../COPYING' for details. -*/ - -#ifndef IMX_H -#define IMX_H - -#include "hw/misc/imx_ccm.h" - -void imx_serial_create (int uart,const hwaddr addr,qemu_irq irq); - -void imx_timerp_create (const hwaddr addr, -qemu_irq irq, -DeviceState *ccm); -void imx_timerg_create (const hwaddr addr, -qemu_irq irq, -DeviceState *ccm); - - -#endif /* IMX_H */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 22/27] i.MX: Add SOC support for i.MX25
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
For now we support the following devices:
* CPU: ARM926
* Interrupt Controller: AVIC
* CCM
* UART x 5
* EPIT x 2
* GPT x 4
* FEC
* I2C x 3
Message-id: 62218bfa90f9101f79098e768c3d58bd92dcb7f3.1441057361.git.jcd@tribudubois.net
--- default-configs/arm-softmmu.mak | 1 + hw/arm/Makefile.objs | 1 + hw/arm/fsl-imx25.c | 273 ++++++++++++++++++++++++++++++++++++++++ include/hw/arm/fsl-imx25.h | 234 ++++++++++++++++++++++++++++++++++ 4 files changed, 509 insertions(+) create mode 100644 hw/arm/fsl-imx25.c create mode 100644 include/hw/arm/fsl-imx25.h
default-configs/arm-softmmu.mak +1 -0
@@ -100,6 +100,7 @@ CONFIG_ALLWINNER_A10_PIC=y CONFIG_ALLWINNER_A10=y CONFIG_FSL_IMX31=y +CONFIG_FSL_IMX25=y CONFIG_IMX_I2C=y
hw/arm/Makefile.objs +1 -0
@@ -13,4 +13,5 @@ obj-y += omap1.o omap2.o strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o +obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
hw/arm/fsl-imx25.c new file +273 -0
273 lines not on this page · raw message
include/hw/arm/fsl-imx25.h new file +234 -0
234 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 10/27] target-arm: Wire up HLT 0xf000 as the A64 semihosting instruction
In reply to Peter MaydellFor the A64 instruction set, the semihosting call instruction is 'HLT 0xf000'. Wire this up to call do_arm_semihosting() if semihosting is enabled.
Message-id: [email protected]
--- linux-user/main.c | 3 +++ target-arm/cpu.h | 1 + target-arm/helper-a64.c | 6 ++++++ target-arm/internals.h | 2 ++ target-arm/translate-a64.c | 24 ++++++++++++++++++++++-- 5 files changed, 34 insertions(+), 2 deletions(-)
linux-user/main.c +3 -0
@@ -1052,6 +1052,9 @@ void cpu_loop(CPUARMState *env)queue_signal (env, info.si_signo, &info); }break ; +case EXCP_SEMIHOST : + env->xregs[0 ] =do_arm_semihosting (env); +break ;default :fprintf (stderr,"qemu: unhandled CPU exception 0x%x - aborting\n" , trapnr);
target-arm/cpu.h +1 -0
@@ -56,6 +56,7 @@#define EXCP_SMC 13/* Secure Monitor Call */ #define EXCP_VIRQ 14#define EXCP_VFIQ 15 +#define EXCP_SEMIHOST 16/* semihosting call (A64 only) */ #define ARMV7M_EXCP_RESET 1#define ARMV7M_EXCP_NMI 2
target-arm/helper-a64.c +6 -0
@@ -514,6 +514,12 @@ void aarch64_cpu_do_interrupt(CPUState *cs)case EXCP_VFIQ : addr +=0x100 ;break ; +case EXCP_SEMIHOST : +qemu_log_mask (CPU_LOG_INT , +"...handling as semihosting call 0x%" PRIx64"\n" , + env->xregs[0 ]); + env->xregs[0 ] =do_arm_semihosting (env); +return ;default :cpu_abort (cs,"Unhandled exception 0x%x\n" , cs->exception_index); }
target-arm/internals.h +2 -0
@@ -36,6 +36,7 @@ static inline bool excp_is_internal(int excp) || excp == EXCP_HALTED || excp ==EXCP_EXCEPTION_EXIT || excp ==EXCP_KERNEL_TRAP + || excp ==EXCP_SEMIHOST || excp ==EXCP_STREX ; }
@@ -58,6 +59,7 @@ static const char * const excnames[] = { [EXCP_SMC] = "Secure Monitor Call", [EXCP_VIRQ] = "Virtual IRQ", [EXCP_VFIQ] = "Virtual FIQ", + [EXCP_SEMIHOST] = "Semihosting call", };static inline void arm_log_exception (int idx)
target-arm/translate-a64.c +22 -2
@@ -30,6 +30,7 @@#include "internals.h" #include "qemu/host-utils.h" +#include "exec/semihost.h" #include "exec/gen-icount.h" #include "exec/helper-proto.h"
@@ -1553,8 +1554,27 @@ static void disas_exc(DisasContext *s, uint32_t insn)unallocated_encoding (s);break ; } -/* HLT */ -unsupported_encoding (s, insn); +/* HLT. This has two purposes. +* Architecturally, it is an external halting debug instruction. +* Since QEMU doesn't implement external debug, we treat this as +* it is required for halting debug disabled: it will UNDEF. +* Secondly, "HLT 0xf000" is the A64 semihosting syscall instruction. +*/ +if (semihosting_enabled () && imm16 ==0xf000 ) { +#ifndef CONFIG_USER_ONLY +/* In system mode, don't allow userspace access to semihosting, +* to provide some semblance of security (and for consistency +* with our 32-bit semihosting). +*/ +if (s->current_el ==0 ) { +unsupported_encoding (s, insn); +break ; + } +#endif +gen_exception_internal_insn (s,0 ,EXCP_SEMIHOST ); + }else { +unsupported_encoding (s, insn); + }break ;case 5 :if (op2_ll <1 || op2_ll >3 ) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 17/27] target-arm: Fix arm_excp_unmasked() function
In reply to Peter MaydellFrom: Sergey Sorokin <[email protected]>
There is an error in arm_excp_unmasked() function:
bitwise operator & is used with integer and bool operands causing an incorrect zeroed result.
The patch fixes it.
Message-id: [email protected]
--- target-arm/cpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-arm/cpu.h +3 -3
@@ -1520,8 +1520,8 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,CPUARMState *env = cs->env_ptr;unsigned int cur_el =arm_current_el (env);bool secure =arm_is_secure (env); -uint32_t scr; -uint32_t hcr; +bool scr; +bool hcr;bool pstate_unmasked;int8_t unmasked =0 ;
@@ -1548,7 +1548,7 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,* set then FIQs can be masked by CPSR.F when non-secure but only * when FIQs are only routed to EL3. */ - scr &= !((env->cp15.scr_el3 &SCR_FW ) && !hcr); + scr = scr && !((env->cp15.scr_el3 &SCR_FW ) && !hcr); pstate_unmasked = !(env->daif &PSTATE_F );break ;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 23/27] i.MX: Add the i.MX25 PDK platform
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
Tested by booting a minimal Linux system on the emulated platform Tested by booting the Xvisor hypervisor on the emulated platform
Message-id: d27347300d253509d921bc27a6d0a14db877478b.1441057361.git.jcd@tribudubois.net
--- hw/arm/Makefile.objs | 2 +- hw/arm/imx25_pdk.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 hw/arm/imx25_pdk.c
hw/arm/Makefile.objs +1 -1
@@ -13,5 +13,5 @@ obj-y += omap1.o omap2.o strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o -obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o +obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
hw/arm/imx25_pdk.c new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PULL 23/27] i.MX: Add the i.MX25 PDK platform
Quoted 171 lines · Peter Maydell
From: Jean-Christophe Dubois <[email protected]>
Tested by booting a minimal Linux system on the emulated platform Tested by booting the Xvisor hypervisor on the emulated platform
Signed-off-by Jean-Christophe Dubois <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Message-id: d27347300d253509d921bc27a6d0a14db877478b.1441057361.git.jcd@tribudubois.net
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/Makefile.objs | 2 +- hw/arm/imx25_pdk.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 hw/arm/imx25_pdk.chw/arm/Makefile.objs +1
-1@@ -13,5 +13,5 @@ obj-y += omap1.o omap2.o strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o -obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o +obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.ohw/arm/imx25_pdk.c new file +139
-0@@ -0,0 +1,159 @@ +/* +* Copyright (c) 2013 Jean-Christophe Dubois <[email protected]> +* +* PDK Board System emulation. +* +* Based on hw/arm/kzm.c +* +* Copyright (c) 2008 OKL and 2011 NICTA +* Written by Hans at OK-Labs +* Updated by Peter Chubb. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "hw/arm/fsl-imx25.h" +#include "hw/boards.h" +#include "qemu/error-report.h" +#include "exec/address-spaces.h" +#include "sysemu/qtest.h" +#include "hw/i2c/i2c.h" + +/* Memory map for PDK Emulation Baseboard: +* 0x00000000-0x7fffffff See i.MX25 SOC fr support +* 0x80000000-0x87ffffff RAM + Alias EMULATED +* 0x90000000-0x9fffffff RAM + Alias EMULATED +* 0xa0000000-0xa7ffffff Flash IGNORED +* 0xa8000000-0xafffffff Flash IGNORED +* 0xb0000000-0xb1ffffff SRAM IGNORED +* 0xb2000000-0xb3ffffff SRAM IGNORED +* 0xb4000000-0xb5ffffff CS4 IGNORED +* 0xb6000000-0xb8000fff Reserved IGNORED +* 0xb8001000-0xb8001fff SDRAM CTRL reg IGNORED +* 0xb8002000-0xb8002fff WEIM CTRL reg IGNORED +* 0xb8003000-0xb8003fff M3IF CTRL reg IGNORED +* 0xb8004000-0xb8004fff EMI CTRL reg IGNORED +* 0xb8005000-0xbaffffff Reserved IGNORED +* 0xbb000000-0xbb000fff NAND flash area buf IGNORED +* 0xbb001000-0xbb0011ff NAND flash reserved IGNORED +* 0xbb001200-0xbb001dff Reserved IGNORED +* 0xbb001e00-0xbb001fff NAN flash CTRL reg IGNORED +* 0xbb012000-0xbfffffff Reserved IGNORED +* 0xc0000000-0xffffffff Reserved IGNORED +*/ + +typedef struct IMX25PDK { +FslIMX25State soc; +MemoryRegion ram; +MemoryRegion ram_alias; +}IMX25PDK ; + +static struct arm_boot_info imx25_pdk_binfo; + +static void imx25_pdk_init (MachineState *machine) +{ +IMX25PDK *s =g_new0 (IMX25PDK ,1 ); +Error *err =NULL ; +unsigned int ram_size; +unsigned int alias_offset; +int i; + +object_initialize (&s->soc,sizeof (s->soc),TYPE_FSL_IMX25 ); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (&s->soc), + &error_abort); + +object_property_set_bool (OBJECT (&s->soc), true,"realized" , &err); +if (err !=NULL ) { +error_report ("%s" ,error_get_pretty (err)); +exit (1 ); + } + +/* We need to initialize our memory */ +if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE )) { +error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); + machine->ram_size =FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ; + } + +memory_region_allocate_system_memory (&s->ram,NULL ,"imx25.ram" , + machine->ram_size); +memory_region_add_subregion (get_system_memory (),FSL_IMX25_SDRAM0_ADDR , + &s->ram); + +/* initialize the alias memory if any */ +for (i =0 , ram_size = machine->ram_size, alias_offset =0 ; + (i <2 ) && ram_size; i++) { +unsigned int size; +static const struct { +hwaddr addr; +unsigned int size; + } ram[2 ] = { + {FSL_IMX25_SDRAM0_ADDR ,FSL_IMX25_SDRAM0_SIZE }, + {FSL_IMX25_SDRAM1_ADDR ,FSL_IMX25_SDRAM1_SIZE }, + }; + + size =MIN (ram_size, ram[i].size); + + ram_size -= size; + +if (size < ram[i].size) { +memory_region_init_alias (&s->ram_alias,NULL ,"ram.alias" , + &s->ram, alias_offset, ram[i].size - size); +memory_region_add_subregion (get_system_memory (), + ram[i].addr + size, &s->ram_alias); + } + + alias_offset += ram[i].size; + } + + imx25_pdk_binfo.ram_size = machine->ram_size; + imx25_pdk_binfo.kernel_filename = machine->kernel_filename; + imx25_pdk_binfo.kernel_cmdline = machine->kernel_cmdline; + imx25_pdk_binfo.initrd_filename = machine->initrd_filename; + imx25_pdk_binfo.loader_start =FSL_IMX25_SDRAM0_ADDR ; + imx25_pdk_binfo.board_id =1771 , + imx25_pdk_binfo.nb_cpus =1 ; + +/* +* We test explicitly for qtest here as it is not done (yet?) in +* arm_load_kernel(). Without this the "make check" command would +* fail. +*/ +if (!qtest_enabled ()) { +arm_load_kernel (&s->soc.cpu, &imx25_pdk_binfo); + }else { +/* +* This I2C device doesn't exist on the real board. +* We add it here (only on qtest usage) to be able to do a bit
hw/arm/imx25_pdk.c line 149
Quoted 10 lines
hw/arm/imx25_pdk.c new file +10
-0+* of simple qtest. See "make check" for details. +*/ +i2c_create_slave ((I2CBus *)qdev_get_child_bus (DEVICE (&s->soc.i2c[0 ]), +"i2c" ), +"ds1338" ,0x68 ); + } +} + +static QEMUMachine imx25_pdk_machine = { + .name ="imx25_pdk" ,
I'm looking at the full ARM board list, and all other use - instead of _. Can we fix this before this board sees a release?
Regards,
Peter
Quoted 14 lines
hw/arm/imx25_pdk.c new file +10
-1+ .desc = "ARM i.MX25 PDK board (ARM926)", + .init = imx25_pdk_init, +}; + +static void imx25_pdk_machine_init (void ) +{ +qemu_register_machine (&imx25_pdk_machine); +} + +machine_init (imx25_pdk_machine_init) --1.9.1
Re: [Qemu-devel] [PULL 23/27] i.MX: Add the i.MX25 PDK platform
Quoted 11 lines · Peter Crosthwaite
Quoted 9 lines · Peter Maydell
From: Jean-Christophe Dubois <[email protected]>
Tested by booting a minimal Linux system on the emulated platform Tested by booting the Xvisor hypervisor on the emulated platform
Signed-off-by Jean-Christophe Dubois <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Message-id: d27347300d253509d921bc27a6d0a14db877478b.1441057361.git.jcd@tribudubois.net
Signed-off-by Peter Maydell <[email protected]>
Quoted 5 lines
hw/arm/imx25_pdk.c line 149
Quoted 2 lines
hw/arm/imx25_pdk.c new file +2
-0+static QEMUMachine imx25_pdk_machine = { + .name ="imx25_pdk" ,I'm looking at the full ARM board list, and all other use - instead of _. Can we fix this before this board sees a release?
Makes sense. Are you going to send a patch?
thanks
-- PMM
[Qemu-devel] [PULL 11/27] smbios: add smbios 3.0 support
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
This patch adds support for SMBIOS 3.0 entry point. When caller invokes smbios_set_defaults(), it can specify entry point as 2.1 or 3.0. Then smbios_get_tables() will return the entry point table in right format.
Message-id: [email protected]
--- hw/i386/pc_piix.c | 3 +- hw/i386/pc_q35.c | 3 +- hw/smbios/smbios.c | 84 +++++++++++++++++++++++++++++++++------------- include/hw/smbios/smbios.h | 62 ++++++++++++++++++++++++++-------- tests/bios-tables-test.c | 6 ++-- 5 files changed, 116 insertions(+), 42 deletions(-)
hw/i386/pc_piix.c +2 -1
@@ -173,7 +173,8 @@ static void pc_init1(MachineState *machine)MachineClass *mc =MACHINE_GET_CLASS (machine);/* These values are guest ABI, do not change */ smbios_set_defaults ("QEMU" ,"Standard PC (i440FX + PIIX, 1996)" , - mc->name, smbios_legacy_mode, smbios_uuid_encoded); + mc->name, smbios_legacy_mode, smbios_uuid_encoded, +SMBIOS_ENTRY_POINT_21 ); }/* allocate ram and load rom/bios */
hw/i386/pc_q35.c +2 -1
@@ -165,7 +165,8 @@ static void pc_q35_init(MachineState *machine)if (smbios_defaults) {/* These values are guest ABI, do not change */ smbios_set_defaults ("QEMU" ,"Standard PC (Q35 + ICH9, 2009)" , - mc->name, smbios_legacy_mode, smbios_uuid_encoded); + mc->name, smbios_legacy_mode, smbios_uuid_encoded, +SMBIOS_ENTRY_POINT_21 ); }/* allocate ram and load rom/bios */
hw/smbios/smbios.c +61 -23
112 lines not on this page · raw message
include/hw/smbios/smbios.h +48 -14
83 lines not on this page · raw message
tests/bios-tables-test.c +3 -3
@@ -50,7 +50,7 @@ typedef struct {int rsdt_tables_nr;GArray *tables;uint32_t smbios_ep_addr; -struct smbios_entry_point smbios_ep_table; +struct smbios_21_entry_point smbios_ep_table; } test_data;#define LOW (x) ((x) & 0xff)
@@ -601,7 +601,7 @@ static void test_acpi_asl(test_data *data)static bool smbios_ep_table_ok (test_data *data) { -struct smbios_entry_point *ep_table = &data->smbios_ep_table; +struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;uint32_t addr = data->smbios_ep_addr;ACPI_READ_ARRAY (ep_table->anchor_string, addr);
@@ -681,7 +681,7 @@ static inline bool smbios_single_instance(uint8_t type)static void test_smbios_structs (test_data *data) { DECLARE_BITMAP(struct_bitmap, SMBIOS_MAX_TYPE+1) = { 0 }; -struct smbios_entry_point *ep_table = &data->smbios_ep_table; +struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;uint32_t addr = ep_table->structure_table_address;int i, len, max_len =0 ;uint8_t type, prv, crt;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 25/27] i.MX: Add i2C devices to i.MX31 SOC
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
Message-id: fb20e6bf5cf946c4530b2cfb55c7e37f5a0fc051.1441057361.git.jcd@tribudubois.net
--- hw/arm/fsl-imx31.c | 30 ++++++++++++++++++++++++++++++ include/hw/arm/fsl-imx31.h | 11 +++++++++++ 2 files changed, 41 insertions(+)
hw/arm/fsl-imx31.c +30 -0
@@ -50,6 +50,11 @@ static void fsl_imx31_init(Object *obj)object_initialize (&s->epit[i],sizeof (s->epit[i]),TYPE_IMX_EPIT );qdev_set_parent_bus (DEVICE (&s->epit[i]),sysbus_get_default ()); } + +for (i =0 ; i <FSL_IMX31_NUM_I2CS ; i++) { +object_initialize (&s->i2c[i],sizeof (s->i2c[i]),TYPE_IMX_I2C ); +qdev_set_parent_bus (DEVICE (&s->i2c[i]),sysbus_get_default ()); + } }static void fsl_imx31_realize (DeviceState *dev,Error **errp)
@@ -154,6 +159,31 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) epit_table[i].irq)); } +/* Initialize all I2C */ +for (i =0 ; i <FSL_IMX31_NUM_I2CS ; i++) { +static const struct { +hwaddr addr; +unsigned int irq; + } i2c_table[FSL_IMX31_NUM_I2CS ] = { + {FSL_IMX31_I2C1_ADDR ,FSL_IMX31_I2C1_IRQ }, + {FSL_IMX31_I2C2_ADDR ,FSL_IMX31_I2C2_IRQ }, + {FSL_IMX31_I2C3_ADDR ,FSL_IMX31_I2C3_IRQ } + }; + +/* Initialize the I2C */ +object_property_set_bool (OBJECT (&s->i2c[i]), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +/* Map I2C memory */ +sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c[i]),0 , i2c_table[i].addr); +/* Connect I2C IRQ to PIC */ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c[i]),0 , +qdev_get_gpio_in (DEVICE (&s->avic), + i2c_table[i].irq)); + } +/* On a real system, the first 16k is a `secure boot rom' */ memory_region_init_rom_device(&s->secure_rom, NULL, NULL, NULL, "imx31.secure_rom",
include/hw/arm/fsl-imx31.h +11 -0
@@ -31,6 +31,7 @@#define FSL_IMX31_NUM_UARTS 2#define FSL_IMX31_NUM_EPITS 2 +#define FSL_IMX31_NUM_I2CS 3 typedef struct FslIMX31State { /*< private >*/
@@ -43,6 +44,7 @@ typedef struct FslIMX31State {IMXSerialState uart[FSL_IMX31_NUM_UARTS ];IMXGPTState gpt;IMXEPITState epit[FSL_IMX31_NUM_EPITS ]; +IMXI2CState i2c[FSL_IMX31_NUM_I2CS ];MemoryRegion secure_rom;MemoryRegion rom;MemoryRegion iram;
@@ -57,10 +59,16 @@ typedef struct FslIMX31State {#define FSL_IMX31_IRAM_ALIAS_SIZE 0xFFC0000#define FSL_IMX31_IRAM_ADDR 0x1FFFC000#define FSL_IMX31_IRAM_SIZE 0x4000 +#define FSL_IMX31_I2C1_ADDR 0x43F80000 +#define FSL_IMX31_I2C1_SIZE 0x4000 +#define FSL_IMX31_I2C3_ADDR 0x43F84000 +#define FSL_IMX31_I2C3_SIZE 0x4000#define FSL_IMX31_UART1_ADDR 0x43F90000#define FSL_IMX31_UART1_SIZE 0x4000#define FSL_IMX31_UART2_ADDR 0x43F94000#define FSL_IMX31_UART2_SIZE 0x4000 +#define FSL_IMX31_I2C2_ADDR 0x43F98000 +#define FSL_IMX31_I2C2_SIZE 0x4000#define FSL_IMX31_CCM_ADDR 0x53F80000#define FSL_IMX31_CCM_SIZE 0x4000#define FSL_IMX31_GPT_ADDR 0x53F90000
@@ -95,5 +103,8 @@ typedef struct FslIMX31State {#define FSL_IMX31_GPT_IRQ 29#define FSL_IMX31_UART2_IRQ 32#define FSL_IMX31_UART1_IRQ 45 +#define FSL_IMX31_I2C1_IRQ 10 +#define FSL_IMX31_I2C2_IRQ 4 +#define FSL_IMX31_I2C3_IRQ 3#endif /* FSL_IMX31_H */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 13/27] arm: cpu: assert() on no-EL2 virt IRQ error condition.
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Replace the hw_error() for no-EL2 VIRQ with an assert.
Message-id: 93b6acdee6cafe8ff0422a294a5640c3d35f0e17.1440842587.git.crosthwaite.peter@gmail.com
--- target-arm/cpu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
target-arm/cpu.c +1 -4
@@ -331,10 +331,7 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level)switch (irq) {case ARM_CPU_VIRQ :case ARM_CPU_VFIQ : -if (!arm_feature (env,ARM_FEATURE_EL2 )) { -hw_error ("%s: Virtual interrupt line %d with no EL2 support\n" , - __func__, irq); - } +assert (arm_feature (env,ARM_FEATURE_EL2 ));/* fall through */ case ARM_CPU_IRQ :case ARM_CPU_FIQ :
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 08/27] target-arm/arm-semi.c: Implement A64 specific SyncCacheRange call
In reply to Peter MaydellThe A64 semihosting ABI defines a new call SyncCacheRange for doing a 'clean D-cache and invalidate I-cache' sequence. Since QEMU doesn't implement caches, we can implement this as a nop.
Message-id: [email protected]
--- target-arm/arm-semi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
target-arm/arm-semi.c +10 -0
@@ -58,6 +58,7 @@#define TARGET_SYS_GET_CMDLINE 0x15#define TARGET_SYS_HEAPINFO 0x16#define TARGET_SYS_EXIT 0x18 +#define TARGET_SYS_SYNCCACHE 0x19/* ADP_Stopped_ApplicationExit is used for exit(0), * anything else is implemented as exit(1) */
@@ -623,6 +624,15 @@ target_ulong do_arm_semihosting(CPUARMState *env) ret = (args == ADP_Stopped_ApplicationExit) ?0 :1 ;gdb_exit (env, ret);exit (ret); +case TARGET_SYS_SYNCCACHE : +/* Clean the D-cache and invalidate the I-cache for the specified +* virtual address range. This is a nop for us since we don't +* implement caches. This is only present on A64. +*/ +if (is_a64 (env)) { +return 0 ; + } +/* fall through -- invalid for A32/T32 */ default :fprintf (stderr,"qemu: Unsupported SemiHosting SWI 0x%02x\n" , nr);cpu_dump_state (cs, stderr, fprintf,0 );
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 09/27] target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter block
In reply to Peter MaydellThe A64 semihosting API changes the interface for SYS_EXIT so that instead of taking a single exception type in a register, it takes a parameter block containing the exception type and a sub-code. Implement this.
Message-id: [email protected]
--- target-arm/arm-semi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
target-arm/arm-semi.c +18 -3
@@ -619,9 +619,24 @@ target_ulong do_arm_semihosting(CPUARMState *env)return 0 ; }case TARGET_SYS_EXIT : -/* ARM specifies only Stopped_ApplicationExit as normal -* exit, everything else is considered an error */ - ret = (args == ADP_Stopped_ApplicationExit) ?0 :1 ; +if (is_a64 (env)) { +/* The A64 version of this call takes a parameter block, +* so the application-exit type can return a subcode which +* is the exit status code from the application. +*/ +GET_ARG (0 ); +GET_ARG (1 ); + +if (arg0 == ADP_Stopped_ApplicationExit) { + ret = arg1; + }else { + ret =1 ; + } + }else { +/* ARM specifies only Stopped_ApplicationExit as normal +* exit, everything else is considered an error */ + ret = (args == ADP_Stopped_ApplicationExit) ?0 :1 ; + }gdb_exit (env, ret);exit (ret);case TARGET_SYS_SYNCCACHE :
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 16/27] hw/arm/virt: Add high MMIO PCI region, 512G in size
In reply to Peter MaydellFrom: Pavel Fedin <[email protected]>
This large region is necessary for some devices like ivshmem and video cards 32-bit kernels can be built without LPAE support. In this case such a kernel will not be able to use PCI controller which has windows in high addresses. In order to work around the problem, "highmem" option is introduced. It defaults to on on, but can be manually set to off in order to be able to run those old 32-bit guests.
--- hw/arm/virt-acpi-build.c | 17 +++++++++-- hw/arm/virt.c | 66 +++++++++++++++++++++++++++++++++++----- include/hw/arm/virt-acpi-build.h | 1 + include/hw/arm/virt.h | 1 + 4 files changed, 76 insertions(+), 9 deletions(-)
hw/arm/virt-acpi-build.c +15 -2
@@ -159,7 +159,8 @@ static void acpi_dsdt_add_virtio(Aml *scope, } } -static void acpi_dsdt_add_pci (Aml *scope,const MemMapEntry *memmap,int irq) +static void acpi_dsdt_add_pci (Aml *scope,const MemMapEntry *memmap,int irq, +bool use_highmem) {Aml *method, *crs, *ifctx, *UUID , *ifctx1, *elsectx, *buf;int i, bus_no;
@@ -234,6 +235,17 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq)AML_ENTIRE_RANGE ,0x0000 ,0x0000 , size_pio -1 , base_pio, size_pio)); +if (use_highmem) { +hwaddr base_mmio_high = memmap[VIRT_PCIE_MMIO_HIGH ].base; +hwaddr size_mmio_high = memmap[VIRT_PCIE_MMIO_HIGH ].size; + +aml_append (rbuf, +aml_qword_memory (AML_POS_DECODE ,AML_MIN_FIXED ,AML_MAX_FIXED , +AML_NON_CACHEABLE ,AML_READ_WRITE ,0x0000 , + base_mmio_high, base_mmio_high,0x0000 , + size_mmio_high)); + } +aml_append (method,aml_name_decl ("RBUF" , rbuf));aml_append (method,aml_return (rbuf));aml_append (dev, method);
@@ -510,7 +522,8 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)acpi_dsdt_add_flash (scope, &memmap[VIRT_FLASH ]);acpi_dsdt_add_virtio (scope, &memmap[VIRT_MMIO ], (irqmap[VIRT_MMIO ] +ARM_SPI_BASE ),NUM_VIRTIO_TRANSPORTS ); -acpi_dsdt_add_pci (scope, memmap, (irqmap[VIRT_PCIE ] +ARM_SPI_BASE )); +acpi_dsdt_add_pci (scope, memmap, (irqmap[VIRT_PCIE ] +ARM_SPI_BASE ), + guest_info->use_highmem);aml_append (dsdt, scope);
hw/arm/virt.c +59 -7
123 lines not on this page · raw message
include/hw/arm/virt-acpi-build.h +1 -0
@@ -31,6 +31,7 @@ typedef struct VirtGuestInfo {FWCfgState *fw_cfg;const MemMapEntry *memmap;const int *irqmap; +bool use_highmem; } VirtGuestInfo;
include/hw/arm/virt.h +1 -0
@@ -56,6 +56,7 @@ enum {VIRT_PCIE_ECAM ,VIRT_GIC_V2M ,VIRT_PLATFORM_BUS , + VIRT_PCIE_MMIO_HIGH, }; typedef struct MemMapEntry {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 18/27] i.MX: Add SOC support for i.MX31
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
For now we support the following devices:
* CPU: ARM1136
* Interrupt Controller: AVIC
* CCM
* UART x 2
* EPIT x 2
* GPT
Message-id: f146d819594e41568daec42a1d0f440cdfe3df76.1441057361.git.jcd@tribudubois.net
--- default-configs/arm-softmmu.mak | 2 + hw/arm/Makefile.objs | 3 +- hw/arm/fsl-imx31.c | 216 ++++++++++++++++++++++++++++++++++++++++ include/hw/arm/fsl-imx31.h | 98 ++++++++++++++++++ 4 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 hw/arm/fsl-imx31.c create mode 100644 include/hw/arm/fsl-imx31.h
default-configs/arm-softmmu.mak +2 -0
@@ -98,6 +98,8 @@ CONFIG_ALLWINNER_A10_PIT=y CONFIG_ALLWINNER_A10_PIC=y CONFIG_ALLWINNER_A10=y +CONFIG_FSL_IMX31=y + CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y
hw/arm/Makefile.objs +2 -1
@@ -1,6 +1,6 @@ obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o obj-$(CONFIG_DIGIC) += digic_boards.o -obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o +obj-y += integratorcp.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 virt.o xilinx_zynq.o z2.o obj-$(CONFIG_ACPI) += virt-acpi-build.o
@@ -13,3 +13,4 @@ obj-y += omap1.o omap2.o strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o +obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
hw/arm/fsl-imx31.c new file +216 -0
216 lines not on this page · raw message
include/hw/arm/fsl-imx31.h new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 20/27] i.MX: Add I2C controller emulator
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
The slave mode is not implemented.
Message-id: 508dbf2ebe26ec383d3a12a1db5a7890ac8acf20.1441057361.git.jcd@tribudubois.net
--- default-configs/arm-softmmu.mak | 2 + hw/i2c/Makefile.objs | 1 + hw/i2c/imx_i2c.c | 339 ++++++++++++++++++++++++++++++++++++++++ include/hw/i2c/imx_i2c.h | 87 +++++++++++ 4 files changed, 429 insertions(+) create mode 100644 hw/i2c/imx_i2c.c create mode 100644 include/hw/i2c/imx_i2c.h
default-configs/arm-softmmu.mak +2 -0
@@ -100,6 +100,8 @@ CONFIG_ALLWINNER_A10=y CONFIG_FSL_IMX31=y +CONFIG_IMX_I2C=y + CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y
hw/i2c/Makefile.objs +1 -0
@@ -4,4 +4,5 @@ common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o common-obj-$(CONFIG_BITBANG_I2C) += bitbang_i2c.o common-obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o +common-obj-$(CONFIG_IMX_I2C) += imx_i2c.o obj-$(CONFIG_OMAP) += omap_i2c.o
hw/i2c/imx_i2c.c new file +339 -0
339 lines not on this page · raw message
include/hw/i2c/imx_i2c.h new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 21/27] i.MX: Add FEC Ethernet Emulator
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
This is based on mcf_fec.c FEC implementation for Coldfire
* A generic PHY was added (borrowwed from LAN9118)
* The buffer management is also modified as buffers are slightly different between Coldfire and i.MX
Message-id: fb314f8a120aa49f8f6ad886f312c649b484fb5a.1441057361.git.jcd@tribudubois.net
--- default-configs/arm-softmmu.mak | 1 + hw/net/Makefile.objs | 1 + hw/net/imx_fec.c | 709 ++++++++++++++++++++++++++++++++++++++++ include/hw/net/imx_fec.h | 113 +++++++ 4 files changed, 824 insertions(+) create mode 100644 hw/net/imx_fec.c create mode 100644 include/hw/net/imx_fec.h
default-configs/arm-softmmu.mak +1 -0
@@ -28,6 +28,7 @@ CONFIG_SSI_M25P80=y CONFIG_LAN9118=y CONFIG_SMC91C111=y CONFIG_ALLWINNER_EMAC=y +CONFIG_IMX_FEC=y CONFIG_DS1338=y CONFIG_PFLASH_CFI01=y CONFIG_PFLASH_CFI02=y
hw/net/Makefile.objs +1 -0
@@ -19,6 +19,7 @@ common-obj-$(CONFIG_XGMAC) += xgmac.o common-obj-$(CONFIG_MIPSNET) += mipsnet.o common-obj-$(CONFIG_XILINX_AXI) += xilinx_axienet.o common-obj-$(CONFIG_ALLWINNER_EMAC) += allwinner_emac.o +common-obj-$(CONFIG_IMX_FEC) += imx_fec.o common-obj-$(CONFIG_CADENCE) += cadence_gem.o common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
hw/net/imx_fec.c new file +709 -0
709 lines not on this page · raw message
include/hw/net/imx_fec.h new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 12/27] smbios: implement smbios support for mach-virt
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
This patch generates smbios tables for ARM mach-virt. Also add CONFIG_SMBIOS=y for ARM default config.
Message-id: [email protected]
--- default-configs/arm-softmmu.mak | 1 + hw/arm/virt.c | 26 ++++++++++++++++++++++++++ qemu-options.hx | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-)
default-configs/arm-softmmu.mak +1 -0
@@ -102,3 +102,4 @@ CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y CONFIG_ACPI=y +CONFIG_SMBIOS=y
hw/arm/virt.c +26 -0
@@ -50,6 +50,7 @@#include "hw/arm/fdt.h" #include "hw/intc/arm_gic_common.h" #include "kvm_arm.h" +#include "hw/smbios/smbios.h" /* Number of external interrupt lines to configure the GIC with */ #define NUM_IRQS 256
@@ -788,12 +789,37 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)return board->fdt; } +static void virt_build_smbios (VirtGuestInfo *guest_info) +{ +FWCfgState *fw_cfg = guest_info->fw_cfg; +uint8_t *smbios_tables, *smbios_anchor; +size_t smbios_tables_len, smbios_anchor_len; + +if (!fw_cfg) { +return ; + } + +smbios_set_defaults ("QEMU" ,"QEMU Virtual Machine" , +"1.0" , false, true,SMBIOS_ENTRY_POINT_30 ); + +smbios_get_tables (NULL ,0 , &smbios_tables, &smbios_tables_len, + &smbios_anchor, &smbios_anchor_len); + +if (smbios_anchor) { +fw_cfg_add_file (fw_cfg,"etc/smbios/smbios-tables" , + smbios_tables, smbios_tables_len); +fw_cfg_add_file (fw_cfg,"etc/smbios/smbios-anchor" , + smbios_anchor, smbios_anchor_len); + } +} +static void virt_guest_info_machine_done (Notifier *notifier,void *data) {VirtGuestInfoState *guest_info_state =container_of (notifier, VirtGuestInfoState, machine_done);virt_acpi_setup (&guest_info_state->info); +virt_build_smbios (&guest_info_state->info); }static void machvirt_init (MachineState *machine)
qemu-options.hx +1 -1
@@ -1412,7 +1412,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" " [,asset=str][,part=str][,speed=%d]\n" " specify SMBIOS type 17 fields\n", - QEMU_ARCH_I386) + QEMU_ARCH_I386 | QEMU_ARCH_ARM) STEXI @item -smbios file=@var{binary} @findex -smbios
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 02/27] target-arm/arm-semi.c: Fix broken SYS_WRITE0 via gdb
In reply to Peter MaydellA spurious trailing "\n" in the gdb syscall format string used for SYS_WRITE0 meant that gdb would reject the remote syscall, with the effect that the output from the guest was silently dropped. Remove the newline so that gdb accepts the packet.
--- target-arm/arm-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-arm/arm-semi.c +1 -1
@@ -260,7 +260,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)return (uint32_t )-1 ; len =strlen (s);if (use_gdb_syscalls ()) { -gdb_do_syscall (arm_semi_cb,"write,2,%x,%x\n" , args, len); +gdb_do_syscall (arm_semi_cb,"write,2,%x,%x" , args, len); ret = env->regs[0 ]; }else { ret =write (STDERR_FILENO , s, len);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 03/27] target-arm: Improve semihosting debug prints
In reply to Peter MaydellFrom: Christopher Covington <[email protected]>
Print semihosting debugging information before the do_arm_semihosting() call so that angel_SWIreason_ReportException, which causes the function to not return, gets the same debug prints as other semihosting calls. Also print out the semihosting call number.
Message-id: [email protected]
--- target-arm/helper.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
target-arm/helper.c +9 -3
@@ -5228,8 +5228,10 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) nr =arm_lduw_code (env, env->regs[15 ], env->bswap_code) &0xff ;if (nr ==0xab ) { env->regs[15 ] +=2 ; +qemu_log_mask (CPU_LOG_INT , +"...handling as semihosting call 0x%x\n" , + env->regs[0 ]); env->regs[0 ] =do_arm_semihosting (env); -qemu_log_mask (CPU_LOG_INT ,"...handled as semihosting call\n" );return ; } }
@@ -5549,8 +5551,10 @@ void arm_cpu_do_interrupt(CPUState *cs)if (((mask ==0x123456 && !env->thumb) || (mask ==0xab && env->thumb)) && (env->uncached_cpsr &CPSR_M ) !=ARM_CPU_MODE_USR ) { +qemu_log_mask (CPU_LOG_INT , +"...handling as semihosting call 0x%x\n" , + env->regs[0 ]); env->regs[0 ] =do_arm_semihosting (env); -qemu_log_mask (CPU_LOG_INT ,"...handled as semihosting call\n" );return ; } }
@@ -5567,8 +5571,10 @@ void arm_cpu_do_interrupt(CPUState *cs)if (mask ==0xab && (env->uncached_cpsr &CPSR_M ) !=ARM_CPU_MODE_USR ) { env->regs[15 ] +=2 ; +qemu_log_mask (CPU_LOG_INT , +"...handling as semihosting call 0x%x\n" , + env->regs[0 ]); env->regs[0 ] =do_arm_semihosting (env); -qemu_log_mask (CPU_LOG_INT ,"...handled as semihosting call\n" );return ; } }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 24/27] i.MX: Add qtest support for I2C device emulator.
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
This is using a ds1338 RTC chip on the I2C bus. This RTC chip is not present on the real 3DS PDK board.
Message-id: 05601683a2a95c881cbc9f22651a044d969bd0ae.1441057361.git.jcd@tribudubois.net
--- include/hw/arm/fsl-imx31.h | 1 + tests/Makefile | 3 + tests/ds1338-test.c | 78 +++++++++++++++++ tests/libqos/i2c-imx.c | 209 +++++++++++++++++++++++++++++++++++++++++++++ tests/libqos/i2c.h | 3 + 5 files changed, 294 insertions(+) create mode 100644 tests/ds1338-test.c create mode 100644 tests/libqos/i2c-imx.c
include/hw/arm/fsl-imx31.h +1 -0
@@ -23,6 +23,7 @@#include "hw/char/imx_serial.h" #include "hw/timer/imx_gpt.h" #include "hw/timer/imx_epit.h" +#include "hw/i2c/imx_i2c.h" #include "exec/memory.h" #define TYPE_FSL_IMX31 "fsl,imx31"
tests/Makefile +3 -0
@@ -201,6 +201,7 @@ check-qtest-sparc64-y = tests/endianness-test$(EXESUF) gcov-files-sparc-y += hw/timer/m48t59.c gcov-files-sparc64-y += hw/timer/m48t59.c check-qtest-arm-y = tests/tmp105-test$(EXESUF) +check-qtest-arm-y = tests/ds1338-test$(EXESUF) gcov-files-arm-y += hw/misc/tmp105.c check-qtest-arm-y += tests/virtio-blk-test$(EXESUF) gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
@@ -354,6 +355,7 @@ libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o libqos-pc-obj-y += tests/libqos/ahci.o libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o +libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
@@ -368,6 +370,7 @@ tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y) tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o $(libqos-obj-y) tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) +tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y) tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
tests/ds1338-test.c new file +78 -0
78 lines not on this page · raw message
tests/libqos/i2c-imx.c new file +209 -0
209 lines not on this page · raw message
tests/libqos/i2c.h +3 -0
@@ -27,4 +27,7 @@ void i2c_recv(I2CAdapter *i2c, uint8_t addr,/* libi2c-omap.c */ I2CAdapter *omap_i2c_create (uint64_t addr); +/* libi2c-imx.c */ +I2CAdapter *imx_i2c_create (uint64_t addr); +#endif
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 26/27] target-arm: Refactor CPU affinity handling
In reply to Peter MaydellFrom: Pavel Fedin <[email protected]>
Introduces reusable definitions for CPU affinity masks/shifts and gets rid of hardcoded magic numbers.
Message-id: 7e6def4d0d91ae64615cdd2035b94d408d0a23c6.1441366248.git.p.fedin@samsung.com
--- target-arm/cpu-qom.h | 13 +++++++++++++ target-arm/cpu.c | 2 +- target-arm/kvm32.c | 3 +-- target-arm/kvm64.c | 3 +-- 4 files changed, 16 insertions(+), 5 deletions(-)
target-arm/cpu-qom.h +13 -0
@@ -227,6 +227,19 @@ void arm_gt_vtimer_cb(void *opaque);void arm_gt_htimer_cb (void *opaque);void arm_gt_stimer_cb (void *opaque); +#define ARM_AFF0_SHIFT 0 +#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT) +#define ARM_AFF1_SHIFT 8 +#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT) +#define ARM_AFF2_SHIFT 16 +#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT) +#define ARM_AFF3_SHIFT 32 +#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT) + +#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK) +#define ARM64_AFFINITY_MASK \ + (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK) +#ifdef TARGET_AARCH64 int aarch64_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int aarch64_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target-arm/cpu.c +1 -1
@@ -456,7 +456,7 @@ static void arm_cpu_initfn(Object *obj)*/ Aff1 = cs->cpu_index /ARM_CPUS_PER_CLUSTER ; Aff0 = cs->cpu_index %ARM_CPUS_PER_CLUSTER ; - cpu->mp_affinity = (Aff1 <<8 ) | Aff0; + cpu->mp_affinity = (Aff1 <<ARM_AFF1_SHIFT ) | Aff0;#ifndef CONFIG_USER_ONLY /* Our inbound IRQ and FIQ lines */
target-arm/kvm32.c +1 -2
@@ -181,7 +181,6 @@ int kvm_arm_cpreg_level(uint64_t regidx)return KVM_PUT_RUNTIME_STATE ; } -#define ARM_MPIDR_HWID_BITMASK 0xFFFFFF#define ARM_CPU_ID_MPIDR 0, 0, 0, 5int kvm_arch_init_vcpu (CPUState *cs)
@@ -234,7 +233,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (ret) {return ret; } - cpu->mp_affinity = mpidr &ARM_MPIDR_HWID_BITMASK ; + cpu->mp_affinity = mpidr &ARM32_AFFINITY_MASK ;return kvm_arm_init_cpreg_list (cpu); }
target-arm/kvm64.c +1 -2
@@ -77,7 +77,6 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)return true; } -#define ARM_MPIDR_HWID_BITMASK 0xFF00FFFFFFULL#define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5int kvm_arch_init_vcpu (CPUState *cs)
@@ -120,7 +119,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (ret) {return ret; } - cpu->mp_affinity = mpidr &ARM_MPIDR_HWID_BITMASK ; + cpu->mp_affinity = mpidr &ARM64_AFFINITY_MASK ;return kvm_arm_init_cpreg_list (cpu); }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 27/27] arm/virt: Add full-sized CPU affinity handling
In reply to Peter MaydellFrom: Pavel Fedin <[email protected]>
At least with KVM, currently there's no reason why QEMU would not be capable of handling Aff3 != 0. This commit fixes up FDT creation in such a case.
Message-id: eef5a86e6d9a313780dbc23b35fcb65df42a3e9e.1441366248.git.p.fedin@samsung.com
--- hw/arm/virt.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
hw/arm/virt.c +32 -2
@@ -288,9 +288,32 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)static void fdt_add_cpu_nodes (const VirtBoardInfo *vbi) {int cpu; +int addr_cells =1 ; + +/* +* From Documentation/devicetree/bindings/arm/cpus.txt +* On ARM v8 64-bit systems value should be set to 2, +* that corresponds to the MPIDR_EL1 register size. +* If MPIDR_EL1[63:32] value is equal to 0 on all CPUs +* in the system, #address-cells can be set to 1, since +* MPIDR_EL1[63:32] bits are not used for CPUs +* identification. +* +* Here we actually don't know whether our system is 32- or 64-bit one. +* The simplest way to go is to examine affinity IDs of all our CPUs. If +* at least one of them has Aff3 populated, we set #address-cells to 2. +*/ +for (cpu =0 ; cpu < vbi->smp_cpus; cpu++) { +ARMCPU *armcpu =ARM_CPU (qemu_get_cpu (cpu)); + +if (armcpu->mp_affinity &ARM_AFF3_MASK ) { + addr_cells =2 ; +break ; + } + }qemu_fdt_add_subnode (vbi->fdt,"/cpus" ); -qemu_fdt_setprop_cell (vbi->fdt,"/cpus" ,"#address-cells" ,0x1 ); +qemu_fdt_setprop_cell (vbi->fdt,"/cpus" ,"#address-cells" , addr_cells);qemu_fdt_setprop_cell (vbi->fdt,"/cpus" ,"#size-cells" ,0x0 );for (cpu = vbi->smp_cpus -1 ; cpu >=0 ; cpu--) {
@@ -307,7 +330,14 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) "enable-method", "psci"); } -qemu_fdt_setprop_cell (vbi->fdt, nodename,"reg" , armcpu->mp_affinity); +if (addr_cells ==2 ) { +qemu_fdt_setprop_u64 (vbi->fdt, nodename,"reg" , + armcpu->mp_affinity); + }else { +qemu_fdt_setprop_cell (vbi->fdt, nodename,"reg" , + armcpu->mp_affinity); + } +g_free (nodename); } }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 07/27] target-arm/arm-semi.c: Support widening APIs to 64 bits
In reply to Peter MaydellThe 64-bit A64 semihosting API has some pervasive changes from the 32-bit version:
* all parameter blocks are arrays of 64-bit values, not 32-bit
* the semihosting call number is passed in W0
* the return value is a 64-bit value in X0
Implement the necessary handling for this widening.
Message-id: [email protected]
--- target-arm/arm-semi.c | 69 ++++++++++++++++++++++++++++++++++++++++++--------- target-arm/cpu.h | 2 +- 2 files changed, 58 insertions(+), 13 deletions(-)
target-arm/arm-semi.c +57 -12
@@ -134,7 +134,7 @@ static void arm_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)#ifdef CONFIG_USER_ONLY TaskState *ts = cs->opaque;#endif -target_ulong reg0 = env->regs[0 ]; +target_ulong reg0 =is_a64 (env) ? env->xregs[0 ] : env->regs[0 ];if (ret == (target_ulong)-1 ) {#ifdef CONFIG_USER_ONLY
@@ -158,7 +158,30 @@ static void arm_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)break ; } } - env->regs[0 ] = reg0; +if (is_a64 (env)) { + env->xregs[0 ] = reg0; + }else { + env->regs[0 ] = reg0; + } +} + +static target_ulong arm_flen_buf (ARMCPU *cpu) +{ +/* Return an address in target memory of 64 bytes where the remote +* gdb should write its stat struct. (The format of this structure +* is defined by GDB's remote protocol and is not target-specific.) +* We put this on the guest's stack just below SP. +*/ +CPUARMState *env = &cpu->env; +target_ulong sp; + +if (is_a64 (env)) { + sp = env->xregs[31 ]; + }else { + sp = env->regs[13 ]; + } + +return sp -64 ; }static void arm_semi_flen_cb (CPUState *cs,target_ulong ret,target_ulong err)
@@ -168,8 +191,13 @@ static void arm_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)/* The size is always stored in big-endian order, extract the value. We assume the size always fit in 32 bits. */ uint32_t size; -cpu_memory_rw_debug (cs, env->regs[13 ]-64 +32 , (uint8_t *)&size,4 ,0 ); - env->regs[0 ] =be32_to_cpu (size); +cpu_memory_rw_debug (cs,arm_flen_buf (cpu) +32 , (uint8_t *)&size,4 ,0 ); + size =be32_to_cpu (size); +if (is_a64 (env)) { + env->xregs[0 ] = size; + }else { + env->regs[0 ] = size; + }#ifdef CONFIG_USER_ONLY ((TaskState *)cs->opaque)->swi_errno = err;#else
@@ -193,20 +221,30 @@ static target_ulong arm_gdb_syscall(ARMCPU *cpu, gdb_syscall_complete_cb cb,* the callback function. */ -return env->regs[0 ]; +return is_a64 (env) ? env->xregs[0 ] : env->regs[0 ]; }/* Read the input value from the argument block; fail the semihosting * call if the memory read fails. */ #define GET_ARG (n) do { \ - if (get_user_ual(arg ## n, args + (n) * 4)) { \ - return (uint32_t)-1; \ + if (is_a64(env)) { \ + if (get_user_u64(arg ## n, args + (n) * 8)) { \ + return -1; \ + } \ + } else { \ + if (get_user_u32(arg ## n, args + (n) * 4)) { \ + return -1; \ + } \ } \ } while (0) -#define SET_ARG (n, val) put_user_ual(val, args + (n) * 4) -uint32_t do_arm_semihosting (CPUARMState *env) +#define SET_ARG (n, val) \ + (is_a64(env) ? \ + put_user_u64(val, args + (n) * 8) : \ + put_user_u32(val, args + (n) * 4)) + +target_ulong do_arm_semihosting (CPUARMState *env) {ARMCPU *cpu =arm_env_get_cpu (env);CPUState *cs =CPU (cpu);
@@ -222,8 +260,15 @@ uint32_t do_arm_semihosting(CPUARMState *env)CPUARMState *ts = env;#endif - nr = env->regs[0 ]; - args = env->regs[1 ]; +if (is_a64 (env)) { +/* Note that the syscall number is in W0, not X0 */ + nr = env->xregs[0 ] &0xffffffffU ; + args = env->xregs[1 ]; + }else { + nr = env->regs[0 ]; + args = env->regs[1 ]; + } +switch (nr) {case TARGET_SYS_OPEN :GET_ARG (0 );
@@ -355,7 +400,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)GET_ARG (0 );if (use_gdb_syscalls ()) {return arm_gdb_syscall (cpu, arm_semi_flen_cb,"fstat,%x,%x" , - arg0, env->regs[13 ]-64 ); + arg0,arm_flen_buf (cpu)); }else {struct stat buf; ret =set_swi_errno (ts,fstat (arg0, &buf));
target-arm/cpu.h +1 -1
@@ -504,7 +504,7 @@ typedef struct CPUARMState {ARMCPU *cpu_arm_init (const char *cpu_model);int cpu_arm_exec (CPUState *cpu); -uint32_t do_arm_semihosting (CPUARMState *env); +target_ulong do_arm_semihosting (CPUARMState *env);void aarch64_sync_32_to_64 (CPUARMState *env);void aarch64_sync_64_to_32 (CPUARMState *env);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 04/27] gdbstub: Implement gdb_do_syscallv()
In reply to Peter MaydellImplement a variant of the existing gdb_do_syscall() which takes a va_list.
Message-id: [email protected]
--- gdbstub.c | 14 ++++++++++---- include/exec/gdbstub.h | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-)
gdbstub.c +10 -4
@@ -1301,9 +1301,8 @@ send_packet:%x - target_ulong argument printed in hex. %lx - 64-bit argument printed in hex. %s - string pointer (target_ulong) and length (int) pair. */ -void gdb_do_syscall (gdb_syscall_complete_cb cb,const char *fmt, ...) +void gdb_do_syscallv (gdb_syscall_complete_cb cb,const char *fmt,va_list va) { -va_list va;char *p;char *p_end;target_ulong addr;
@@ -1317,7 +1316,6 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)#ifndef CONFIG_USER_ONLY vm_stop (RUN_STATE_DEBUG );#endif -va_start (va, fmt); p = s->syscall_buf; p_end = &s->syscall_buf[sizeof (s->syscall_buf)]; *(p++) ='F' ;
@@ -1351,7 +1349,6 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) } } *p =0 ; -va_end (va);#ifdef CONFIG_USER_ONLY put_packet (s, s->syscall_buf);gdb_handlesig (s->c_cpu,0 );
@@ -1366,6 +1363,15 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)#endif } +void gdb_do_syscall (gdb_syscall_complete_cb cb,const char *fmt, ...) +{ +va_list va; + +va_start (va, fmt); +gdb_do_syscallv (cb, fmt, va); +va_end (va); +} +static void gdb_read_byte (GDBState *s,int ch) {int i, csum;
include/exec/gdbstub.h +27 -0
@@ -14,7 +14,34 @@typedef void (*gdb_syscall_complete_cb )(CPUState *cpu,target_ulong ret,target_ulong err); +/** +* gdb_do_syscall: +* @cb: function to call when the system call has completed +* @fmt: gdb syscall format string +* ...: list of arguments to interpolate into @fmt +* +* Send a GDB syscall request. This function will return immediately; +* the callback function will be called later when the remote system +* call has completed. +* +* @fmt should be in the 'call-id,parameter,parameter...' format documented +* for the F request packet in the GDB remote protocol. A limited set of +* printf-style format specifiers is supported: +* %x - target_ulong argument printed in hex +* %lx - 64-bit argument printed in hex +* %s - string pointer (target_ulong) and length (int) pair +*/ void gdb_do_syscall (gdb_syscall_complete_cb cb,const char *fmt, ...); +/** +* gdb_do_syscallv: +* @cb: function to call when the system call has completed +* @fmt: gdb syscall format string +* @va: arguments to interpolate into @fmt +* +* As gdb_do_syscall, but taking a va_list rather than a variable +* argument list. +*/ +void gdb_do_syscallv (gdb_syscall_complete_cb cb,const char *fmt,va_list va);int use_gdb_syscalls (void );void gdb_set_stop_cpu (CPUState *cpu);void gdb_exit (CPUArchState *,int );
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 06/27] include/exec/softmmu-semi.h: Add support for 64-bit values
In reply to Peter MaydellAdd support for getting and setting 64-bit values in the softmmu semihosting support functions. This will be needed for 64-bit ARM semihosting.
Message-id: [email protected]
--- include/exec/softmmu-semi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
include/exec/softmmu-semi.h +18 -0
@@ -9,6 +9,14 @@#ifndef SOFTMMU_SEMI_H #define SOFTMMU_SEMI_H 1 +static inline uint64_t softmmu_tget64 (CPUArchState *env,target_ulong addr) +{ +uint64_t val; + +cpu_memory_rw_debug (ENV_GET_CPU (env), addr, (uint8_t *)&val,8 ,0 ); +return tswap64 (val); +} +static inline uint32_t softmmu_tget32 (CPUArchState *env,target_ulong addr) {uint32_t val;
@@ -16,6 +24,7 @@ static inline uint32_t softmmu_tget32(CPUArchState *env, target_ulong addr)cpu_memory_rw_debug (ENV_GET_CPU (env), addr, (uint8_t *)&val,4 ,0 );return tswap32 (val); } +static inline uint32_t softmmu_tget8 (CPUArchState *env,target_ulong addr) {uint8_t val;
@@ -24,16 +33,25 @@ static inline uint32_t softmmu_tget8(CPUArchState *env, target_ulong addr)return val; } +#define get_user_u64 (arg, p) ({ arg = softmmu_tget64(env, p); 0; })#define get_user_u32 (arg, p) ({ arg = softmmu_tget32(env, p) ; 0; })#define get_user_u8 (arg, p) ({ arg = softmmu_tget8(env, p) ; 0; })#define get_user_ual (arg, p) get_user_u32(arg, p) +static inline void softmmu_tput64 (CPUArchState *env, +target_ulong addr,uint64_t val) +{ + val =tswap64 (val); +cpu_memory_rw_debug (ENV_GET_CPU (env), addr, (uint8_t *)&val,8 ,1 ); +} +static inline void softmmu_tput32 (CPUArchState *env,target_ulong addr,uint32_t val) { val =tswap32 (val);cpu_memory_rw_debug (ENV_GET_CPU (env), addr, (uint8_t *)&val,4 ,1 ); } +#define put_user_u64 (arg, p) ({ softmmu_tput64(env, p, arg) ; 0; })#define put_user_u32 (arg, p) ({ softmmu_tput32(env, p, arg) ; 0; })#define put_user_ual (arg, p) put_user_u32(arg, p)
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 01/27] arm: Use g_new() & friends where that makes obvious sense
In reply to Peter MaydellFrom: Markus Armbruster <[email protected]>
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors.
This commit only touches allocations with size arguments of the form sizeof(T).
Coccinelle semantic patch:
@@
type T;
@@
-g_malloc(sizeof(T))
+g_new(T, 1)
@@
type T;
@@
-g_try_malloc(sizeof(T))
+g_try_new(T, 1)
@@
type T;
@@
-g_malloc0(sizeof(T))
+g_new0(T, 1)
@@
type T;
@@
-g_try_malloc0(sizeof(T))
+g_try_new0(T, 1)
@@
type T;
expression n;
@@
-g_malloc(sizeof(T) * (n))
+g_new(T, n)
@@
type T;
expression n;
@@
-g_try_malloc(sizeof(T) * (n))
+g_try_new(T, n)
@@
type T;
expression n;
@@
-g_malloc0(sizeof(T) * (n))
+g_new0(T, n)
@@
type T;
expression n;
@@
-g_try_malloc0(sizeof(T) * (n))
+g_try_new0(T, n)
@@
type T;
expression p, n;
@@
-g_realloc(p, sizeof(T) * (n))
+g_renew(T, p, n)
@@
type T;
expression p, n;
@@
-g_try_realloc(p, sizeof(T) * (n))
+g_try_renew(T, p, n)
@@
type T;
expression n;
@@
-(T *)g_new(T, n)
+g_new(T, n)
@@
type T;
expression n;
@@
-(T *)g_new0(T, n)
+g_new0(T, n)
@@
type T;
expression p, n;
@@
-(T *)g_renew(T, p, n)
+g_renew(T, p, n)Message-id: [email protected]
--- hw/arm/omap1.c | 30 ++++++++++-------------------- hw/arm/omap2.c | 15 +++++---------- hw/arm/pxa2xx.c | 11 +++++------ hw/arm/stellaris.c | 2 +- hw/arm/strongarm.c | 2 +- hw/char/omap_uart.c | 3 +-- hw/display/omap_dss.c | 3 +-- hw/display/omap_lcdc.c | 3 +-- hw/dma/omap_dma.c | 6 ++---- hw/gpio/omap_gpio.c | 4 ++-- hw/input/stellaris_input.c | 4 ++-- hw/misc/omap_clk.c | 2 +- hw/misc/omap_gpmc.c | 3 +-- hw/misc/omap_sdrc.c | 3 +-- hw/sd/omap_mmc.c | 6 ++---- hw/ssi/omap_spi.c | 3 +-- hw/timer/omap_gptimer.c | 3 +-- 17 files changed, 38 insertions(+), 65 deletions(-)
hw/arm/omap1.c +10 -20
@@ -258,8 +258,7 @@ static struct omap_mpu_timer_s *omap_mpu_timer_init(MemoryRegion *system_memory,hwaddr base, qemu_irq irq, omap_clk clk) { - struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) -g_malloc0 (sizeof (struct omap_mpu_timer_s )); + struct omap_mpu_timer_s *s = g_new0(struct omap_mpu_timer_s, 1); s->irq = irq; s->clk = clk;
@@ -388,8 +387,7 @@ static struct omap_watchdog_timer_s *omap_wd_timer_init(MemoryRegion *memory,hwaddr base, qemu_irq irq, omap_clk clk) { - struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) -g_malloc0 (sizeof (struct omap_watchdog_timer_s )); + struct omap_watchdog_timer_s *s = g_new0(struct omap_watchdog_timer_s, 1); s->timer.irq = irq; s->timer.clk = clk;
@@ -495,8 +493,7 @@ static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory,hwaddr base, qemu_irq irq, omap_clk clk) { - struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) -g_malloc0 (sizeof (struct omap_32khz_timer_s )); + struct omap_32khz_timer_s *s = g_new0(struct omap_32khz_timer_s, 1); s->timer.irq = irq; s->timer.clk = clk;
@@ -1236,8 +1233,7 @@ static struct omap_tipb_bridge_s *omap_tipb_bridge_init( MemoryRegion *memory, hwaddr base, qemu_irq abort_irq, omap_clk clk) { - struct omap_tipb_bridge_s *s = (struct omap_tipb_bridge_s *) -g_malloc0 (sizeof (struct omap_tipb_bridge_s )); + struct omap_tipb_bridge_s *s = g_new0(struct omap_tipb_bridge_s, 1); s->abort = abort_irq;omap_tipb_bridge_reset (s);
@@ -2099,8 +2095,7 @@ static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory, qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup, omap_clk clk) { - struct omap_mpuio_s *s = (struct omap_mpuio_s *) -g_malloc0 (sizeof (struct omap_mpuio_s )); + struct omap_mpuio_s *s = g_new0(struct omap_mpuio_s, 1); s->irq = gpio_int; s->kbd_irq = kbd_int;
@@ -2292,8 +2287,7 @@ static struct omap_uwire_s *omap_uwire_init(MemoryRegion *system_memory, qemu_irq dma, omap_clk clk) { -struct omap_uwire_s *s = (struct omap_uwire_s *) -g_malloc0 (sizeof (struct omap_uwire_s )); + struct omap_uwire_s *s = g_new0(struct omap_uwire_s, 1); s->txirq = txirq; s->rxirq = rxirq;
@@ -2932,8 +2926,7 @@ static struct omap_rtc_s *omap_rtc_init(MemoryRegion *system_memory, qemu_irq timerirq, qemu_irq alarmirq, omap_clk clk) { - struct omap_rtc_s *s = (struct omap_rtc_s *) -g_malloc0 (sizeof (struct omap_rtc_s )); + struct omap_rtc_s *s = g_new0(struct omap_rtc_s, 1); s->irq = timerirq; s->alarm = alarmirq;
@@ -3468,8 +3461,7 @@ static struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory, qemu_irq txirq, qemu_irq rxirq, qemu_irq *dma, omap_clk clk) { - struct omap_mcbsp_s *s = (struct omap_mcbsp_s *) -g_malloc0 (sizeof (struct omap_mcbsp_s )); + struct omap_mcbsp_s *s = g_new0(struct omap_mcbsp_s, 1); s->txirq = txirq; s->rxirq = rxirq;
@@ -3648,8 +3640,7 @@ static void omap_lpg_clk_update(void *opaque, int line, int on)static struct omap_lpg_s *omap_lpg_init (MemoryRegion *system_memory,hwaddr base,omap_clk clk) { -struct omap_lpg_s *s = (struct omap_lpg_s *) -g_malloc0 (sizeof (struct omap_lpg_s )); + struct omap_lpg_s *s = g_new0(struct omap_lpg_s, 1); s->tm =timer_new_ms (QEMU_CLOCK_VIRTUAL , omap_lpg_tick, s);
@@ -3853,8 +3844,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, const char *core) {int i; -struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) -g_malloc0 (sizeof (struct omap_mpu_state_s )); + struct omap_mpu_state_s *s = g_new0(struct omap_mpu_state_s, 1);qemu_irq dma_irqs[6 ];DriveInfo *dinfo;SysBusDevice *busdev;
hw/arm/omap2.c +5 -10
@@ -596,8 +596,7 @@ static const MemoryRegionOps omap_eac_ops = {static struct omap_eac_s *omap_eac_init (struct omap_target_agent_s *ta,qemu_irq irq,qemu_irq *drq,omap_clk fclk,omap_clk iclk) { -struct omap_eac_s *s = (struct omap_eac_s *) -g_malloc0 (sizeof (struct omap_eac_s )); + struct omap_eac_s *s = g_new0(struct omap_eac_s, 1); s->irq = irq; s->codec.rxdrq = *drq ++;
@@ -788,8 +787,7 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta, hwaddr channel_base, qemu_irq irq, omap_clk clk, CharDriverState *chr) { - struct omap_sti_s *s = (struct omap_sti_s *) -g_malloc0 (sizeof (struct omap_sti_s )); + struct omap_sti_s *s = g_new0(struct omap_sti_s, 1); s->irq = irq;omap_sti_reset (s);
@@ -1806,8 +1804,7 @@ static struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta, qemu_irq mpu_int, qemu_irq dsp_int, qemu_irq iva_int, struct omap_mpu_state_s *mpu) { - struct omap_prcm_s *s = (struct omap_prcm_s *) -g_malloc0 (sizeof (struct omap_prcm_s )); + struct omap_prcm_s *s = g_new0(struct omap_prcm_s, 1); s->irq[0 ] = mpu_int; s->irq[1 ] = dsp_int;
@@ -2185,8 +2182,7 @@ static void omap_sysctl_reset(struct omap_sysctl_s *s)static struct omap_sysctl_s *omap_sysctl_init (struct omap_target_agent_s *ta,omap_clk iclk,struct omap_mpu_state_s *mpu) { -struct omap_sysctl_s *s = (struct omap_sysctl_s *) -g_malloc0 (sizeof (struct omap_sysctl_s )); + struct omap_sysctl_s *s = g_new0(struct omap_sysctl_s, 1); s->mpu = mpu;omap_sysctl_reset (s);
@@ -2248,8 +2244,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,unsigned long sdram_size, const char *core) { - struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) -g_malloc0 (sizeof (struct omap_mpu_state_s )); + struct omap_mpu_state_s *s = g_new0(struct omap_mpu_state_s, 1);qemu_irq dma_irqs[4 ];DriveInfo *dinfo;int i;
hw/arm/pxa2xx.c +5 -6
@@ -1731,8 +1731,7 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem,hwaddr base, qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma) { - PXA2xxI2SState *s = (PXA2xxI2SState *) -g_malloc0 (sizeof (PXA2xxI2SState)); + PXA2xxI2SState *s = g_new0(PXA2xxI2SState, 1); s->irq = irq; s->rx_dma = rx_dma;
@@ -2061,7 +2060,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,PXA2xxState *s;int i;DriveInfo *dinfo; - s = (PXA2xxState *)g_malloc0 (sizeof (PXA2xxState)); + s =g_new0 (PXA2xxState,1 );if (revision &&strncmp (revision,"pxa27" ,5 )) {fprintf (stderr,"Machine requires a PXA27x processor.\n" );
@@ -2157,7 +2156,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);for (i =0 ; pxa27x_ssp[i].io_base; i ++); - s->ssp = (SSIBus **)g_malloc0 (sizeof (SSIBus *) * i); + s->ssp = g_new0(SSIBus *, i);for (i =0 ; pxa27x_ssp[i].io_base; i ++) {DeviceState *dev; dev = sysbus_create_simple(TYPE_PXA2XX_SSP, pxa27x_ssp[i].io_base,
@@ -2202,7 +2201,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)int i;DriveInfo *dinfo; - s = (PXA2xxState *)g_malloc0 (sizeof (PXA2xxState)); + s =g_new0 (PXA2xxState,1 ); s->cpu =cpu_arm_init ("pxa255" );if (s->cpu ==NULL ) {
@@ -2290,7 +2289,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);for (i =0 ; pxa255_ssp[i].io_base; i ++); - s->ssp = (SSIBus **)g_malloc0 (sizeof (SSIBus *) * i); + s->ssp = g_new0(SSIBus *, i);for (i =0 ; pxa255_ssp[i].io_base; i ++) {DeviceState *dev; dev = sysbus_create_simple(TYPE_PXA2XX_SSP, pxa255_ssp[i].io_base,
hw/arm/stellaris.c +1 -1
@@ -675,7 +675,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, {ssys_state *s; - s = (ssys_state *)g_malloc0 (sizeof (ssys_state)); + s =g_new0 (ssys_state,1 ); s->irq = irq; s->board = board;/* Most devices come preprogrammed with a MAC address in the user data. */
hw/arm/strongarm.c +1 -1
@@ -1588,7 +1588,7 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,StrongARMState *s;int i; - s =g_malloc0 (sizeof (StrongARMState)); + s =g_new0 (StrongARMState,1 );if (!rev) { rev ="sa1110-b5" ;
hw/char/omap_uart.c +1 -2
@@ -55,8 +55,7 @@ struct omap_uart_s *omap_uart_init(hwaddr base, qemu_irq txdma, qemu_irq rxdma, const char *label, CharDriverState *chr) { - struct omap_uart_s *s = (struct omap_uart_s *) -g_malloc0 (sizeof (struct omap_uart_s )); + struct omap_uart_s *s = g_new0(struct omap_uart_s, 1); s->base = base; s->fclk = fclk;
hw/display/omap_dss.c +1 -2
@@ -1051,8 +1051,7 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, omap_clk fck1, omap_clk fck2, omap_clk ck54m, omap_clk ick1, omap_clk ick2) { - struct omap_dss_s *s = (struct omap_dss_s *) -g_malloc0 (sizeof (struct omap_dss_s )); + struct omap_dss_s *s = g_new0(struct omap_dss_s, 1); s->irq = irq; s->drq = drq;
hw/display/omap_lcdc.c +1 -2
@@ -403,8 +403,7 @@ struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem, struct omap_dma_lcd_channel_s *dma, omap_clk clk) { -struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) -g_malloc0 (sizeof (struct omap_lcd_panel_s )); + struct omap_lcd_panel_s *s = g_new0(struct omap_lcd_panel_s, 1); s->irq = irq; s->dma = dma;
hw/dma/omap_dma.c +2 -4
@@ -1626,8 +1626,7 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs, enum omap_dma_model model) {int num_irqs, memsize, i; -struct omap_dma_s *s = (struct omap_dma_s *) -g_malloc0 (sizeof (struct omap_dma_s )); + struct omap_dma_s *s = g_new0(struct omap_dma_s, 1);if (model <= omap_dma_3_1) { num_irqs =6 ;
@@ -2061,8 +2060,7 @@ struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs, int chans, omap_clk iclk, omap_clk fclk) { int i; -struct omap_dma_s *s = (struct omap_dma_s *) -g_malloc0 (sizeof (struct omap_dma_s )); + struct omap_dma_s *s = g_new0(struct omap_dma_s, 1); s->model = omap_dma_4; s->chans = chans;
hw/gpio/omap_gpio.c +2 -2
@@ -710,8 +710,8 @@ static int omap2_gpio_init(SysBusDevice *sbd) }else { s->modulecount =6 ; } - s->modules =g_malloc0 (s->modulecount *sizeof (struct omap2_gpio_s )); - s->handler =g_malloc0 (s->modulecount *32 *sizeof (qemu_irq)); + s->modules = g_new0(struct omap2_gpio_s, s->modulecount); + s->handler =g_new0 (qemu_irq, s->modulecount *32 );qdev_init_gpio_in (dev, omap2_gpio_set, s->modulecount *32 );qdev_init_gpio_out (dev, s->handler, s->modulecount *32 );for (i =0 ; i < s->modulecount; i++) {
hw/input/stellaris_input.c +2 -2
@@ -75,8 +75,8 @@ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode)gamepad_state *s;int i; - s = (gamepad_state *)g_malloc0 (sizeof (gamepad_state)); - s->buttons = (gamepad_button *)g_malloc0 (n *sizeof (gamepad_button)); + s =g_new0 (gamepad_state,1 ); + s->buttons =g_new0 (gamepad_button, n);for (i =0 ; i < n; i++) { s->buttons[i].irq = irq[i]; s->buttons[i].keycode = keycode[i];
hw/misc/omap_clk.c +1 -1
@@ -1239,7 +1239,7 @@ void omap_clk_init(struct omap_mpu_state_s *mpu)for (i = onchip_clks, count =0 ; *i; i ++)if ((*i)->flags & flag) count ++; - mpu->clks = (struct clk *)g_malloc0 (sizeof (struct clk ) * (count +1 )); + mpu->clks = g_new0(struct clk, count + 1);for (i = onchip_clks, j = mpu->clks; *i; i ++)if ((*i)->flags & flag) {memcpy (j, *i,sizeof (struct clk ));
hw/misc/omap_gpmc.c +1 -2
@@ -826,8 +826,7 @@ struct omap_gpmc_s *omap_gpmc_init(struct omap_mpu_state_s *mpu, qemu_irq irq, qemu_irq drq) { int cs; -struct omap_gpmc_s *s = (struct omap_gpmc_s *) -g_malloc0 (sizeof (struct omap_gpmc_s )); + struct omap_gpmc_s *s = g_new0(struct omap_gpmc_s, 1);memory_region_init_io (&s->iomem,NULL , &omap_gpmc_ops, s,"omap-gpmc" ,0x1000 );memory_region_add_subregion (get_system_memory (), base, &s->iomem);
hw/misc/omap_sdrc.c +1 -2
@@ -157,8 +157,7 @@ static const MemoryRegionOps omap_sdrc_ops = {struct omap_sdrc_s *omap_sdrc_init (MemoryRegion *sysmem,hwaddr base) { -struct omap_sdrc_s *s = (struct omap_sdrc_s *) -g_malloc0 (sizeof (struct omap_sdrc_s )); + struct omap_sdrc_s *s = g_new0(struct omap_sdrc_s, 1);omap_sdrc_reset (s);
hw/sd/omap_mmc.c +2 -4
@@ -578,8 +578,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,BlockBackend *blk, qemu_irq irq, qemu_irq dma[], omap_clk clk) { - struct omap_mmc_s *s = (struct omap_mmc_s *) -g_malloc0 (sizeof (struct omap_mmc_s )); + struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1); s->irq = irq; s->dma = dma;
@@ -605,8 +604,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockBackend *blk, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { - struct omap_mmc_s *s = (struct omap_mmc_s *) -g_malloc0 (sizeof (struct omap_mmc_s )); + struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1); s->irq = irq; s->dma = dma;
hw/ssi/omap_spi.c +1 -2
@@ -342,8 +342,7 @@ static const MemoryRegionOps omap_mcspi_ops = {struct omap_mcspi_s *omap_mcspi_init (struct omap_target_agent_s *ta,int chnum,qemu_irq irq,qemu_irq *drq,omap_clk fclk,omap_clk iclk) { -struct omap_mcspi_s *s = (struct omap_mcspi_s *) -g_malloc0 (sizeof (struct omap_mcspi_s )); + struct omap_mcspi_s *s = g_new0(struct omap_mcspi_s, 1);struct omap_mcspi_ch_s *ch = s->ch; s->irq = irq;
hw/timer/omap_gptimer.c +1 -2
@@ -468,8 +468,7 @@ static const MemoryRegionOps omap_gp_timer_ops = {struct omap_gp_timer_s *omap_gp_timer_init (struct omap_target_agent_s *ta,qemu_irq irq,omap_clk fclk,omap_clk iclk) { -struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) -g_malloc0 (sizeof (struct omap_gp_timer_s )); + struct omap_gp_timer_s *s = g_new0(struct omap_gp_timer_s, 1); s->ta = ta; s->irq = irq;
Signature · 1 line
1.9.1
Quoted 17 lines · Peter Maydell
Another target-arm queue flush. I expect there'll be another lot next week...
The following changes since commit
b041066421e8dcc7d080dfcfd83551c9c9f24ade:Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2015-09-03 16:17:28 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20150904for you to fetch changes up to
d9fd6f3874a326033a446a6db8cd113bf4015e6a:arm/virt: Add full-sized CPU affinity handling (2015-09-04 15:49:54 +0100)
Quoted 11 lines
----------------------------------------------------------------
target-arm queue:
* cleanup to useg_new()and friends
* support semihosting in A64
* add SMBIOS support to mach-virt
* removehw_error()usages
* fix bug in the AArch32:AArch64 register mapping
* add a second PCI memory window in highmem on virt board
* fix bug inarm_excp_unmasked()
* add i.MX31 SoC
* remove restriction on handling affinity values in virt board
The clang build complains about an unused function in imx_i2c.c. I'm going to squash in this fix to the offending patch and resend the pullreq (cover letter).
hw/i2c/imx_i2c.c +0 -5
@@ -65,11 +65,6 @@ static inline bool imx_i2c_is_master(IMXI2CState *s)return s->i2cr &I2CR_MSTA ; } -static inline bool imx_i2c_direction_is_tx (IMXI2CState *s) -{ -return s->i2cr &I2CR_MTX ; -} -static void imx_i2c_reset (DeviceState *dev) {IMXI2CState *s =IMX_I2C (dev);
thanks
-- PMM