target-arm queue
Subsystems (2)
Arm pullreq for the 2.12 codefreeze...
thanks
-- PMM
The following changes since commit b39b61e410022f96ceb53d4381d25cba5126ac44:
memory: fix flatview_access_valid RCU read lock/unlock imbalance (2018-03-09 15:55:20 +0000)
are available in the Git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180309
for you to fetch changes up to 076a0fc32a73a9b960e0f73f04a531bc1bd94308:
MAINTAINERS: Add entries for SD (SDHCI, SDBus, SDCard) (2018-03-09 17:09:45 +0000)
----------------------------------------------------------------
target-arm queue:
* i.MX: Add i.MX7 SOC implementation and i.MX7 Sabre board
* Report the correct core count in A53 L2CTLR on the ZynqMP board
* linux-user: preliminary SVE support work (signal handling)
* hw/arm/boot: fix memory leak in case of error loading ELF file
* hw/arm/boot: avoid reading off end of buffer if passed very small image file
* hw/arm: Use more CONFIG switches for the object files
* target/arm: Add "-cpu max" support
* hw/arm/virt: Support -machine gic-version=max
* hw/sd: improve debug tracing
* hw/sd: sdcard: Add the Tuning Command (CMD 19)
* MAINTAINERS: add Philippe as odd-fixes maintainer for SD
----------------------------------------------------------------
Alistair Francis (2):
target/arm: Add a core count property hw/arm: Set the core count for Xilinx's ZynqMP
Andrey Smirnov (3):
pci: Add support for Designware IP block
i.MX: Add i.MX7 SOC implementation.
Implement support for i.MX7 Sabre board
Marc-André Lureau (2):
arm: fix load ELF error leak
arm: avoid heap-buffer-overflow in load_aarch64_image
Peter Maydell (6):
target/arm: Query host CPU features on-demand at instance init target/arm: Move definition of 'host' cpu type into cpu.c target/arm: Add "-cpu max" support
target/arm: Make 'any' CPU just an alias for 'max' hw/arm/virt: Add "max" to the list of CPU types "virt" supports hw/arm/virt: Support -machine gic-version=max
Philippe Mathieu-Daudé (6):
sdcard: Do not trace CMD55, except when we already expect an ACMD
sdcard: Display command name when tracing CMD/ACMD
sdcard: Display which protocol is used when tracing (SD or SPI)
sdcard: Add the Tuning Command (CMD19)
sdhci: Fix a typo in comment
MAINTAINERS: Add entries for SD (SDHCI, SDBus, SDCard)
Richard Henderson (5):
linux-user: Implement aarch64 PR_SVE_SET/GET_VL
aarch64-linux-user: Split out helpers for guest signal handling
aarch64-linux-user: Remove struct target_aux_context
aarch64-linux-user: Add support for EXTRA signal frame records
aarch64-linux-user: Add support for SVE signal frame records
Thomas Huth (1):
hw/arm: Use more CONFIG switches for the object files
hw/arm/Makefile.objs | 31 +- hw/pci-host/Makefile.objs | 2 + hw/sd/Makefile.objs | 2 +- hw/sd/sdmmc-internal.h | 24 ++ include/hw/arm/fsl-imx7.h | 222 +++++++++++ include/hw/pci-host/designware.h | 102 +++++ include/hw/pci/pci_ids.h | 2 + linux-user/aarch64/target_syscall.h | 3 + target/arm/cpu-qom.h | 2 + target/arm/cpu.h | 11 + target/arm/kvm_arm.h | 35 +- hw/arm/boot.c | 4 +- hw/arm/fsl-imx7.c | 582 ++++++++++++++++++++++++++++ hw/arm/mcimx7d-sabre.c | 90 +++++ hw/arm/virt.c | 30 +- hw/arm/xlnx-zynqmp.c | 2 + hw/pci-host/designware.c | 754 ++++++++++++++++++++++++++++++++++++ hw/sd/sd.c | 55 ++- hw/sd/sdhci.c | 4 +- hw/sd/sdmmc-internal.c | 72 ++++ linux-user/signal.c | 415 ++++++++++++++++---- linux-user/syscall.c | 27 ++ target/arm/cpu.c | 103 ++++- target/arm/cpu64.c | 113 ++++-- target/arm/kvm.c | 53 +-- target/arm/kvm32.c | 8 +- target/arm/kvm64.c | 8 +- MAINTAINERS | 8 + default-configs/arm-softmmu.mak | 9 + hw/sd/trace-events | 8 +- 30 files changed, 2583 insertions(+), 198 deletions(-) create mode 100644 include/hw/arm/fsl-imx7.h create mode 100644 include/hw/pci-host/designware.h create mode 100644 hw/arm/fsl-imx7.c create mode 100644 hw/arm/mcimx7d-sabre.c create mode 100644 hw/pci-host/designware.c create mode 100644 hw/sd/sdmmc-internal.c
[Qemu-devel] [PULL 11/25] hw/arm: Use more CONFIG switches for the object files
From: Thomas Huth <[email protected]>
A lot of ARM object files are linked into the executable unconditionally, even though we have corresponding CONFIG switches like CONFIG_PXA2XX or CONFIG_OMAP. We should make sure to use these switches in the Makefile so that the users can disable certain unwanted boards and devices more easily. While we're at it, also add some new switches for the boards that do not have a CONFIG option yet.
Message-id: [email protected]
--- hw/arm/Makefile.objs | 30 +++++++++++++++++++++--------- default-configs/arm-softmmu.mak | 7 +++++++ 2 files changed, 28 insertions(+), 9 deletions(-)
hw/arm/Makefile.objs +21 -9
@@ -1,15 +1,27 @@ -obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o -obj-$(CONFIG_DIGIC) += digic_boards.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-y += boot.o virt.o sysbus-fdt.o obj-$(CONFIG_ACPI) += virt-acpi-build.o -obj-y += netduino2.o -obj-y += sysbus-fdt.o +obj-$(CONFIG_DIGIC) += digic_boards.o +obj-$(CONFIG_EXYNOS4) += exynos4_boards.o +obj-$(CONFIG_HIGHBANK) += highbank.o +obj-$(CONFIG_INTEGRATOR) += integratorcp.o +obj-$(CONFIG_MAINSTONE) += mainstone.o +obj-$(CONFIG_MUSICPAL) += musicpal.o +obj-$(CONFIG_NETDUINO2) += netduino2.o +obj-$(CONFIG_NSERIES) += nseries.o +obj-$(CONFIG_OMAP) += omap_sx1.o palm.o +obj-$(CONFIG_PXA2XX) += gumstix.o spitz.o tosa.o z2.o +obj-$(CONFIG_REALVIEW) += realview.o +obj-$(CONFIG_STELLARIS) += stellaris.o +obj-$(CONFIG_STRONGARM) += collie.o +obj-$(CONFIG_VERSATILE) += vexpress.o versatilepb.o +obj-$(CONFIG_ZYNQ) += xilinx_zynq.o -obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o +obj-$(CONFIG_ARM_V7M) += armv7m.o +obj-$(CONFIG_EXYNOS4) += exynos4210.o +obj-$(CONFIG_PXA2XX) += pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-$(CONFIG_DIGIC) += digic.o -obj-y += omap1.o omap2.o strongarm.o +obj-$(CONFIG_OMAP) += omap1.o omap2.o +obj-$(CONFIG_STRONGARM) += strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
default-configs/arm-softmmu.mak +7 -0
@@ -47,6 +47,7 @@ CONFIG_A9MPCORE=y CONFIG_A15MPCORE=y CONFIG_ARM_V7M=y +CONFIG_NETDUINO2=y CONFIG_ARM_GIC=y CONFIG_ARM_GIC_KVM=$(CONFIG_KVM)
@@ -109,6 +110,7 @@ CONFIG_TZ_PPC=y CONFIG_IOTKIT=y CONFIG_IOTKIT_SECCTL=y +CONFIG_VERSATILE=y CONFIG_VERSATILE_PCI=y CONFIG_VERSATILE_I2C=y
@@ -117,6 +119,7 @@ CONFIG_VFIO_XGMAC=y CONFIG_VFIO_AMD_XGBE=y CONFIG_SDHCI=y +CONFIG_INTEGRATOR=y CONFIG_INTEGRATOR_DEBUG=y CONFIG_ALLWINNER_A10_PIT=y
@@ -142,3 +145,7 @@ CONFIG_MSF2=y CONFIG_FW_CFG_DMA=y CONFIG_XILINX_AXI=y CONFIG_PCI_DESIGNWARE=y + +CONFIG_STRONGARM=y +CONFIG_HIGHBANK=y +CONFIG_MUSICPAL=y
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 12/25] arm: fix load ELF error leak
In reply to Peter MaydellFrom: Marc-André Lureau <[email protected]>
Spotted by ASAN:
QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64 tests/boot-serial-test
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x7ff8a9b0ca38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
#1 0x7ff8a8ea7f75 in g_malloc0 ../glib/gmem.c:124
#2 0x55fef3d99129 in error_setv /home/elmarco/src/qemu/util/error.c:59
#3 0x55fef3d99738 in error_setg_internal /home/elmarco/src/qemu/util/error.c:95
#4 0x55fef323acb2 in load_elf_hdr /home/elmarco/src/qemu/hw/core/loader.c:393
#5 0x55fef2d15776 in arm_load_elf /home/elmarco/src/qemu/hw/arm/boot.c:830
#6 0x55fef2d16d39 in arm_load_kernel_notify /home/elmarco/src/qemu/hw/arm/boot.c:1022
#7 0x55fef3dc634d in notifier_list_notify /home/elmarco/src/qemu/util/notify.c:40
#8 0x55fef2fc3182 in qemu_run_machine_init_done_notifiers /home/elmarco/src/qemu/vl.c:2716
#9 0x55fef2fcbbd1 in main /home/elmarco/src/qemu/vl.c:4679
#10 0x7ff89dfed009 in __libc_start_main (/lib64/libc.so.6+0x21009)--- hw/arm/boot.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/boot.c +1 -0
@@ -829,6 +829,7 @@ static uint64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,load_elf_hdr (info->kernel_filename, &elf_header, &elf_is64, &err);if (err) { +error_free (err);return ret; }
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 13/25] arm: avoid heap-buffer-overflow in load_aarch64_image
In reply to Peter MaydellFrom: Marc-André Lureau <[email protected]>
Spotted by ASAN:
elmarco@boraha:~/src/qemu/build (master *%)$ QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64 tests/boot-serial-test /aarch64/boot-serial/virt: ** (process:19740): DEBUG: 18:39:30.275: foo /tmp/qtest-boot-serial-cXaS94D
=================================================================
==19740==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000069648 at pc 0x7f1d2201cc54 bp 0x7fff331f6a40 sp 0x7fff331f61e8 READ of size 4 at 0x603000069648 thread T0
#0 0x7f1d2201cc53 (/lib64/libasan.so.4+0xafc53)
#1 0x55bc86685ee3 in load_aarch64_image /home/elmarco/src/qemu/hw/arm/boot.c:894
#2 0x55bc86687217 in arm_load_kernel_notify /home/elmarco/src/qemu/hw/arm/boot.c:1047
#3 0x55bc877363b5 in notifier_list_notify /home/elmarco/src/qemu/util/notify.c:40
#4 0x55bc869331ea in qemu_run_machine_init_done_notifiers /home/elmarco/src/qemu/vl.c:2716
#5 0x55bc8693bc39 in main /home/elmarco/src/qemu/vl.c:4679
#6 0x7f1d1652c009 in __libc_start_main (/lib64/libc.so.6+0x21009)
#7 0x55bc86255cc9 in _start (/home/elmarco/src/qemu/build/aarch64-softmmu/qemu-system-aarch64+0x1ae5cc9)--- hw/arm/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/boot.c +2 -1
@@ -891,7 +891,8 @@ static uint64_t load_aarch64_image(const char *filename, hwaddr mem_base, }/* check the arm64 magic header value -- very old kernels may not have it */ -if (memcmp (buffer +ARM64_MAGIC_OFFSET ,"ARM\x64" ,4 ) ==0 ) { +if (size >ARM64_MAGIC_OFFSET +4 && +memcmp (buffer +ARM64_MAGIC_OFFSET ,"ARM\x64" ,4 ) ==0 ) {uint64_t hdrvals[2 ];/* The arm64 Image header has text_offset and image_size fields at 8 and
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 09/25] aarch64-linux-user: Add support for EXTRA signal frame records
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
The EXTRA record allows for additional space to be allocated beyon what is currently reserved. Add code to emit and read this record type.
Nothing uses extra space yet.
Message-id: [email protected]
--- linux-user/signal.c | 74 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 11 deletions(-)
linux-user/signal.c +63 -11
@@ -1446,6 +1446,15 @@ struct target_fpsimd_context {uint64_t vregs[32 *2 ];/* really uint128_t vregs[32] */ }; +#define TARGET_EXTRA_MAGIC 0x45585401 + +struct target_extra_context { +struct target_aarch64_ctx head; +uint64_t datap;/* 16-byte aligned pointer to extra space cast to __u64 */ +uint32_t size;/* size in bytes of the extra space */ +uint32_t reserved[3 ]; +}; +struct target_rt_sigframe {struct target_siginfo info;struct target_ucontext uc;
@@ -1505,6 +1514,15 @@ static void target_setup_fpsimd_record(struct target_fpsimd_context *fpsimd, } } +static void target_setup_extra_record (struct target_extra_context *extra, +uint64_t datap,uint32_t extra_size) +{ +__put_user (TARGET_EXTRA_MAGIC , &extra->head.magic); +__put_user (sizeof (struct target_extra_context ), &extra->head.size); +__put_user (datap, &extra->datap); +__put_user (extra_size, &extra->size); +} +static void target_setup_end_record (struct target_aarch64_ctx *end) {__put_user (0 , &end->magic);
@@ -1557,48 +1575,74 @@ static void target_restore_fpsimd_record(CPUARMState *env,static int target_restore_sigframe (CPUARMState *env,struct target_rt_sigframe *sf) { -struct target_aarch64_ctx *ctx; +struct target_aarch64_ctx *ctx, *extra =NULL ;struct target_fpsimd_context *fpsimd =NULL ; +uint64_t extra_datap =0 ; +bool used_extra = false; +bool err = false;target_restore_general_frame (env, sf); ctx = (struct target_aarch64_ctx *)sf->uc.tuc_mcontext.__reserved;while (ctx) { -uint32_t magic, size; +uint32_t magic, size, extra_size;__get_user (magic, &ctx->magic);__get_user (size, &ctx->size);switch (magic) {case 0 :if (size !=0 ) { -return 1 ; + err = true; + goto exit; + } +if (used_extra) { + ctx =NULL ; + }else { + ctx = extra; + used_extra = true; } - ctx =NULL ;continue ;case TARGET_FPSIMD_MAGIC :if (fpsimd || size !=sizeof (struct target_fpsimd_context )) { -return 1 ; + err = true; + goto exit; } fpsimd = (struct target_fpsimd_context *)ctx;break ; +case TARGET_EXTRA_MAGIC : +if (extra || size !=sizeof (struct target_extra_context )) { + err = true; + goto exit; + } +__get_user (extra_datap, + &((struct target_extra_context *)ctx)->datap); +__get_user (extra_size, + &((struct target_extra_context *)ctx)->size); + extra =lock_user (VERIFY_READ , extra_datap, extra_size,0 ); +break ; +default :/* Unknown record -- we certainly didn't generate it. * Did we in fact get out of sync? */ -return 1 ; + err = true; + goto exit; } ctx = (void *)ctx + size; }/* Require FPSIMD always. */ -if (!fpsimd) { -return 1 ; +if (fpsimd) { +target_restore_fpsimd_record (env, fpsimd); + }else { + err = true; } -target_restore_fpsimd_record (env, fpsimd); -return 0 ; + exit: +unlock_user (extra, extra_datap,0 ); +return err; }static abi_ulong get_sigframe (struct target_sigaction *ka,CPUARMState *env)
@@ -1624,7 +1668,8 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, CPUARMState *env) { int size = offsetof(struct target_rt_sigframe, uc.tuc_mcontext.__reserved); -int fpsimd_ofs, end1_ofs, fr_ofs; +int fpsimd_ofs, end1_ofs, fr_ofs, end2_ofs =0 ; +int extra_ofs =0 , extra_base =0 , extra_size =0 ;struct target_rt_sigframe *frame;struct target_rt_frame_record *fr;abi_ulong frame_addr, return_addr;
@@ -1644,7 +1689,14 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,target_setup_general_frame (frame, env, set);target_setup_fpsimd_record ((void *)frame + fpsimd_ofs, env); +if (extra_ofs) { +target_setup_extra_record ((void *)frame + extra_ofs, + frame_addr + extra_base, extra_size); + }target_setup_end_record ((void *)frame + end1_ofs); +if (end2_ofs) { +target_setup_end_record ((void *)frame + end2_ofs); + }/* Set up the stack frame for unwinding. */ fr = (void *)frame + fr_ofs;
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 10/25] aarch64-linux-user: Add support for SVE signal frame records
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Depending on the currently selected size of the SVE vector registers, we can either store the data within the "standard" allocation, or we may beedn to allocate additional space with an EXTRA record.
Message-id: [email protected]
--- linux-user/signal.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 192 insertions(+), 18 deletions(-)
linux-user/signal.c +192 -18
@@ -1455,6 +1455,34 @@ struct target_extra_context {uint32_t reserved[3 ]; }; +#define TARGET_SVE_MAGIC 0x53564501 + +struct target_sve_context { +struct target_aarch64_ctx head; +uint16_t vl; +uint16_t reserved[3 ]; +/* The actual SVE data immediately follows. It is layed out +* according to TARGET_SVE_SIG_{Z,P}REG_OFFSET, based off of +* the original struct pointer. +*/ +}; + +#define TARGET_SVE_VQ_BYTES 16 + +#define TARGET_SVE_SIG_ZREG_SIZE (VQ ) ((VQ) * TARGET_SVE_VQ_BYTES) +#define TARGET_SVE_SIG_PREG_SIZE (VQ ) ((VQ) * (TARGET_SVE_VQ_BYTES / 8)) + +#define TARGET_SVE_SIG_REGS_OFFSET \ + QEMU_ALIGN_UP(sizeof(struct target_sve_context), TARGET_SVE_VQ_BYTES) +#define TARGET_SVE_SIG_ZREG_OFFSET (VQ ,N ) \ + (TARGET_SVE_SIG_REGS_OFFSET + TARGET_SVE_SIG_ZREG_SIZE(VQ) * (N)) +#define TARGET_SVE_SIG_PREG_OFFSET (VQ ,N ) \ + (TARGET_SVE_SIG_ZREG_OFFSET(VQ, 32) + TARGET_SVE_SIG_PREG_SIZE(VQ) * (N)) +#define TARGET_SVE_SIG_FFR_OFFSET (VQ ) \ + (TARGET_SVE_SIG_PREG_OFFSET(VQ, 16)) +#define TARGET_SVE_SIG_CONTEXT_SIZE (VQ ) \ + (TARGET_SVE_SIG_PREG_OFFSET(VQ, 17)) +struct target_rt_sigframe {struct target_siginfo info;struct target_ucontext uc;
@@ -1529,6 +1557,34 @@ static void target_setup_end_record(struct target_aarch64_ctx *end)__put_user (0 , &end->size); } +static void target_setup_sve_record (struct target_sve_context *sve, +CPUARMState *env,int vq,int size) +{ +int i, j; + +__put_user (TARGET_SVE_MAGIC , &sve->head.magic); +__put_user (size, &sve->head.size); +__put_user (vq *TARGET_SVE_VQ_BYTES , &sve->vl); + +/* Note that SVE regs are stored as a byte stream, with each byte element +* at a subsequent address. This corresponds to a little-endian store +* of our 64-bit hunks. +*/ +for (i =0 ; i <32 ; ++i) { +uint64_t *z = (void *)sve +TARGET_SVE_SIG_ZREG_OFFSET (vq, i); +for (j =0 ; j < vq *2 ; ++j) { +__put_user_e (env->vfp.zregs[i].d[j], z + j, le); + } + } +for (i =0 ; i <=16 ; ++i) { +uint16_t *p = (void *)sve +TARGET_SVE_SIG_PREG_OFFSET (vq, i); +for (j =0 ; j < vq; ++j) { +uint64_t r = env->vfp.pregs[i].p[j >>2 ]; +__put_user_e (r >> ((j &3 ) *16 ), p + j, le); + } + } +} +static void target_restore_general_frame (CPUARMState *env,struct target_rt_sigframe *sf) {
@@ -1572,14 +1628,45 @@ static void target_restore_fpsimd_record(CPUARMState *env, } } +static void target_restore_sve_record (CPUARMState *env, +struct target_sve_context *sve,int vq) +{ +int i, j; + +/* Note that SVE regs are stored as a byte stream, with each byte element +* at a subsequent address. This corresponds to a little-endian load +* of our 64-bit hunks. +*/ +for (i =0 ; i <32 ; ++i) { +uint64_t *z = (void *)sve +TARGET_SVE_SIG_ZREG_OFFSET (vq, i); +for (j =0 ; j < vq *2 ; ++j) { +__get_user_e (env->vfp.zregs[i].d[j], z + j, le); + } + } +for (i =0 ; i <=16 ; ++i) { +uint16_t *p = (void *)sve +TARGET_SVE_SIG_PREG_OFFSET (vq, i); +for (j =0 ; j < vq; ++j) { +uint16_t r; +__get_user_e (r, p + j, le); +if (j &3 ) { + env->vfp.pregs[i].p[j >>2 ] |= (uint64_t )r << ((j &3 ) *16 ); + }else { + env->vfp.pregs[i].p[j >>2 ] = r; + } + } + } +} +static int target_restore_sigframe (CPUARMState *env,struct target_rt_sigframe *sf) {struct target_aarch64_ctx *ctx, *extra =NULL ;struct target_fpsimd_context *fpsimd =NULL ; +struct target_sve_context *sve =NULL ;uint64_t extra_datap =0 ;bool used_extra = false;bool err = false; +int vq =0 , sve_size =0 ;target_restore_general_frame (env, sf);
@@ -1611,6 +1698,18 @@ static int target_restore_sigframe(CPUARMState *env, fpsimd = (struct target_fpsimd_context *)ctx;break ; +case TARGET_SVE_MAGIC : +if (arm_feature (env,ARM_FEATURE_SVE )) { + vq = (env->vfp.zcr_el[1 ] &0xf ) +1 ; + sve_size =QEMU_ALIGN_UP (TARGET_SVE_SIG_CONTEXT_SIZE (vq),16 ); +if (!sve && size == sve_size) { + sve = (struct target_sve_context *)ctx; +break ; + } + } + err = true; + goto exit; +case TARGET_EXTRA_MAGIC :if (extra || size !=sizeof (struct target_extra_context )) { err = true;
@@ -1640,12 +1739,18 @@ static int target_restore_sigframe(CPUARMState *env, err = true; } +/* SVE data, if present, overwrites FPSIMD data. */ +if (sve) { +target_restore_sve_record (env, sve, vq); + } + exit:unlock_user (extra, extra_datap,0 );return err; } -static abi_ulong get_sigframe (struct target_sigaction *ka,CPUARMState *env) +static abi_ulong get_sigframe (struct target_sigaction *ka, +CPUARMState *env,int size) {abi_ulong sp;
@@ -1658,30 +1763,97 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, CPUARMState *env) sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; } - sp = (sp -sizeof (struct target_rt_sigframe )) & ~15 ; + sp = (sp - size) & ~15 ;return sp; } +typedef struct { +int total_size; +int extra_base; +int extra_size; +int std_end_ofs; +int extra_ofs; +int extra_end_ofs; +}target_sigframe_layout ; + +static int alloc_sigframe_space (int this_size,target_sigframe_layout *l) +{ +/* Make sure there will always be space for the end marker. */ +const int std_size =sizeof (struct target_rt_sigframe ) + -sizeof (struct target_aarch64_ctx ); +int this_loc = l->total_size; + +if (l->extra_base) { +/* Once we have begun an extra space, all allocations go there. */ + l->extra_size += this_size; + }else if (this_size + this_loc > std_size) { +/* This allocation does not fit in the standard space. */ +/* Allocate the extra record. */ + l->extra_ofs = this_loc; + l->total_size +=sizeof (struct target_extra_context ); + +/* Allocate the standard end record. */ + l->std_end_ofs = l->total_size; + l->total_size +=sizeof (struct target_aarch64_ctx ); + +/* Allocate the requested record. */ + l->extra_base = this_loc = l->total_size; + l->extra_size = this_size; + } + l->total_size += this_size; + +return this_loc; +} +static void target_setup_frame (int usig,struct target_sigaction *ka,target_siginfo_t *info,target_sigset_t *set,CPUARMState *env) { - int size = offsetof(struct target_rt_sigframe, uc.tuc_mcontext.__reserved); -int fpsimd_ofs, end1_ofs, fr_ofs, end2_ofs =0 ; -int extra_ofs =0 , extra_base =0 , extra_size =0 ; +target_sigframe_layout layout = { +/* Begin with the size pointing to the reserved space. */ + .total_size = offsetof(struct target_rt_sigframe , + uc.tuc_mcontext.__reserved), + }; +int fpsimd_ofs, fr_ofs, sve_ofs =0 , vq =0 , sve_size =0 ;struct target_rt_sigframe *frame;struct target_rt_frame_record *fr;abi_ulong frame_addr, return_addr; - fpsimd_ofs = size; - size +=sizeof (struct target_fpsimd_context ); - end1_ofs = size; - size +=sizeof (struct target_aarch64_ctx ); - fr_ofs = size; - size +=sizeof (struct target_rt_frame_record ); +/* FPSIMD record is always in the standard space. */ + fpsimd_ofs =alloc_sigframe_space (sizeof (struct target_fpsimd_context ), + &layout); - frame_addr =get_sigframe (ka, env); +/* SVE state needs saving only if it exists. */ +if (arm_feature (env,ARM_FEATURE_SVE )) { + vq = (env->vfp.zcr_el[1 ] &0xf ) +1 ; + sve_size =QEMU_ALIGN_UP (TARGET_SVE_SIG_CONTEXT_SIZE (vq),16 ); + sve_ofs =alloc_sigframe_space (sve_size, &layout); + } + +if (layout.extra_ofs) { +/* Reserve space for the extra end marker. The standard end marker +* will have been allocated when we allocated the extra record. +*/ + layout.extra_end_ofs + =alloc_sigframe_space (sizeof (struct target_aarch64_ctx ), &layout); + }else { +/* Reserve space for the standard end marker. +* Do not use alloc_sigframe_space because we cheat +* std_size therein to reserve space for this. +*/ + layout.std_end_ofs = layout.total_size; + layout.total_size +=sizeof (struct target_aarch64_ctx ); + } + +/* Reserve space for the return code. On a real system this would +* be within the VDSO. So, despite the name this is not a "real" +* record within the frame. +*/ + fr_ofs = layout.total_size; + layout.total_size +=sizeof (struct target_rt_frame_record ); + + frame_addr =get_sigframe (ka, env, layout.total_size);trace_user_setup_frame (env, frame_addr);if (!lock_user_struct (VERIFY_WRITE , frame, frame_addr,0 )) { goto give_sigsegv;
@@ -1689,13 +1861,15 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,target_setup_general_frame (frame, env, set);target_setup_fpsimd_record ((void *)frame + fpsimd_ofs, env); -if (extra_ofs) { -target_setup_extra_record ((void *)frame + extra_ofs, - frame_addr + extra_base, extra_size); +target_setup_end_record ((void *)frame + layout.std_end_ofs); +if (layout.extra_ofs) { +target_setup_extra_record ((void *)frame + layout.extra_ofs, + frame_addr + layout.extra_base, + layout.extra_size); +target_setup_end_record ((void *)frame + layout.extra_end_ofs); } -target_setup_end_record ((void *)frame + end1_ofs); -if (end2_ofs) { -target_setup_end_record ((void *)frame + end2_ofs); +if (sve_ofs) { +target_setup_sve_record ((void *)frame + sve_ofs, env, vq, sve_size); }/* Set up the stack frame for unwinding. */
Signature · 1 line
2.16.2
Re: [Qemu-devel] [PULL 10/25] aarch64-linux-user: Add support for SVE signal frame records
Quoted 6 lines · Peter Maydell
From: Richard Henderson <[email protected]>
Depending on the currently selected size of the SVE vector registers, we can either store the data within the "standard" allocation, or we may beedn to allocate additional space with an EXTRA record.
Quoted 7 lines
Signed-off-by Richard Henderson <[email protected]>Message-id: [email protected]
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- linux-user/signal.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 192 insertions(+), 18 deletions(-)
I did a 'git bisect' looking for when we introduced the segv bug described in https://bugs.launchpad.net/qemu/+bug/1761535,
and git bisect thinks this commit is it.
At least for me, with a xenial aarch64 chroot, with this patch if I chroot in and run 'ls' then we get a spurious segfault (I think in the guest bash):
e104462:xenial:chroot$ sudo chroot xenial-aarch64
root@e104462:/# ls Deadlock.class bin home hotspot_pid17113.log mnt root srv var Deadlock.java boot hotspot_pid14759.log hotspot_pid19407.log opt run sys HelloWorld.class dev hotspot_pid16542.log lib proc sbin tmp HelloWorld.java etc hotspot_pid16895.log media risu sdbg9 usr qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (core dumped)
Reverting f914baef8e39f7 on master fixes the segfault.
Richard (Henderson): I'll have a closer look at this on Monday if you don't get to it first...
thanks
-- PMM
Re: [Qemu-devel] [PULL 10/25] aarch64-linux-user: Add support for SVE signal frame records
Quoted 36 lines · Peter Maydell
Quoted 6 lines · Peter Maydell
From: Richard Henderson <[email protected]>
Depending on the currently selected size of the SVE vector registers, we can either store the data within the "standard" allocation, or we may beedn to allocate additional space with an EXTRA record.
Quoted 7 lines
Signed-off-by Richard Henderson <[email protected]>Message-id: [email protected]
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- linux-user/signal.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 192 insertions(+), 18 deletions(-)I did a 'git bisect' looking for when we introduced the segv bug described in https://bugs.launchpad.net/qemu/+bug/1761535,
and git bisect thinks this commit is it.At least for me, with a xenial aarch64 chroot, with this patch if I chroot in and run 'ls' then we get a spurious segfault (I think in the guest bash):
e104462:xenial:chroot$ sudo chroot xenial-aarch64
root@e104462:/# ls Deadlock.class bin home hotspot_pid17113.log mnt root srv var Deadlock.java boot hotspot_pid14759.log hotspot_pid19407.log opt run sys HelloWorld.class dev hotspot_pid16542.log lib proc sbin tmp HelloWorld.java etc hotspot_pid16895.log media risu sdbg9 usr qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (core dumped)
Quoted 1 line
Reverting
f914baef8e39f7on master fixes the segfault.
Er, I mean "reverting 8c5931de0ac77388096d79c". Accidentally quoted the git hash of the local revert-commit I was testing rather than of the commit it's reverting...
thanks
-- PMM
Re: [Qemu-devel] [PULL 10/25] aarch64-linux-user: Add support for SVE signal frame records
In reply to Peter MaydellQuoted 2 lines · Peter Maydell
Richard (Henderson): I'll have a closer look at this on Monday if you don't get to it first...
I should have an env to reproduce shortly.
r~
[Qemu-devel] [PULL 15/25] target/arm: Move definition of 'host' cpu type into cpu.c
In reply to Peter MaydellMove the definition of the 'host' cpu type into cpu.c, where all the other CPU types are defined. We can do this now we've decoupled it from the KVM-specific host feature probing. This means we now create the type unconditionally (assuming we were built with KVM support at all), but if you try to use it without -enable-kvm this will end up in the "host cpu probe failed and KVM not enabled" path in arm_cpu_realizefn(), for an appropriate error message.
Message-id: [email protected]
--- target/arm/cpu.c | 24 ++++++++++++++++++++++++ target/arm/kvm.c | 19 ------------------- 2 files changed, 24 insertions(+), 19 deletions(-)
target/arm/cpu.c +24 -0
@@ -1864,6 +1864,26 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)#endif } +#ifdef CONFIG_KVM +static void arm_host_initfn (Object *obj) +{ +ARMCPU *cpu =ARM_CPU (obj); + +kvm_arm_set_cpu_features_from_host (cpu); +} + +static const TypeInfo host_arm_cpu_type_info = { + .name =TYPE_ARM_HOST_CPU , +#ifdef TARGET_AARCH64 + .parent =TYPE_AARCH64_CPU , +#else + .parent =TYPE_ARM_CPU , +#endif + .instance_init = arm_host_initfn, +}; + +#endif +static void cpu_register (const ARMCPUInfo *info) {TypeInfo type_info = {
@@ -1908,6 +1928,10 @@ static void arm_cpu_register_types(void)cpu_register (info); info++; } + +#ifdef CONFIG_KVM +type_register_static (&host_arm_cpu_type_info); +#endif }type_init (arm_cpu_register_types)
target/arm/kvm.c +0 -19
@@ -152,23 +152,6 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) env->features = arm_host_cpu_features.features; } -static void kvm_arm_host_cpu_initfn (Object *obj) -{ -ARMCPU *cpu =ARM_CPU (obj); - -kvm_arm_set_cpu_features_from_host (cpu); -} - -static const TypeInfo host_arm_cpu_type_info = { - .name =TYPE_ARM_HOST_CPU , -#ifdef TARGET_AARCH64 - .parent =TYPE_AARCH64_CPU , -#else - .parent =TYPE_ARM_CPU , -#endif - .instance_init = kvm_arm_host_cpu_initfn, -}; -int kvm_arch_init (MachineState *ms,KVMState *s) {/* For ARM interrupt delivery is always asynchronous,
@@ -184,8 +167,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_has_mp_state =kvm_check_extension (s,KVM_CAP_MP_STATE ); -type_register_static (&host_arm_cpu_type_info); -return 0 ; }
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 14/25] target/arm: Query host CPU features on-demand at instance init
In reply to Peter MaydellCurrently we query the host CPU features in the class init function for the TYPE_ARM_HOST_CPU class, so that we can later copy them from the class object into the instance object in the object instance init function. This is awkward for implementing "-cpu max", which should work like "-cpu host" for KVM but like "cpu with all implemented features" for TCG.
Move the place where we store the information about the host CPU from a class object to static variables in kvm.c, and then in the instance init function call a new kvm_arm_set_cpu_features_from_host() function which will query the host kernel if necessary and then fill in the CPU instance fields.
This allows us to drop the special class struct and class init function for TYPE_ARM_HOST_CPU entirely.
We can't delay the probe until realize, because the ARM instance_post_init hook needs to look at the feature bits we set, so we need to do it in the initfn. This is safe because the probing doesn't affect the actual VM state (it creates a separate scratch VM to do its testing), but the probe might fail. Because we can't report errors in retrieving the host features in the initfn, we check this belatedly in the realize function (the intervening code will be able to cope with the relevant fields in the CPU structure being zero).
Message-id: [email protected]
--- target/arm/cpu.h | 5 +++++ target/arm/kvm_arm.h | 35 ++++++++++++++++++++++++----------- target/arm/cpu.c | 13 +++++++++++++ target/arm/kvm.c | 36 +++++++++++++++++++----------------- target/arm/kvm32.c | 8 ++++---- target/arm/kvm64.c | 8 ++++---- 6 files changed, 69 insertions(+), 36 deletions(-)
target/arm/cpu.h +5 -0
@@ -745,6 +745,11 @@ struct ARMCPU {/* Uniprocessor system with MP extensions */ bool mp_is_up; +/* True if we tried kvm_arm_host_cpu_features() during CPU instance_init +* and the probe failed (so we need to report the error in realize) +*/ +bool host_cpu_probe_failed; +/* Specify the number of cores in this CPU cluster. Used for the L2CTLR * register. */
target/arm/kvm_arm.h +24 -11
@@ -152,20 +152,16 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,void kvm_arm_destroy_scratch_host_vcpu (int *fdarray);#define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU -#define ARM_HOST_CPU_CLASS (klass) \ - OBJECT_CLASS_CHECK(ARMHostCPUClass, (klass), TYPE_ARM_HOST_CPU) -#define ARM_HOST_CPU_GET_CLASS (obj) \ - OBJECT_GET_CLASS(ARMHostCPUClass, (obj), TYPE_ARM_HOST_CPU) - -typedef struct ARMHostCPUClass { -/*< private >*/ -ARMCPUClass parent_class; -/*< public >*/ +/** +* ARMHostCPUFeatures: information about the host CPU (identified +* by asking the host kernel) +*/ +typedef struct ARMHostCPUFeatures {uint64_t features;uint32_t target;const char *dtb_compatible; -}ARMHostCPUClass ; +}ARMHostCPUFeatures ;/** * kvm_arm_get_host_cpu_features:
@@ -174,8 +170,16 @@ typedef struct ARMHostCPUClass {* Probe the capabilities of the host kernel's preferred CPU and fill * in the ARMHostCPUClass struct accordingly. */ -bool kvm_arm_get_host_cpu_features (ARMHostCPUClass *ahcc); +bool kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf); +/** +* kvm_arm_set_cpu_features_from_host: +* @cpu: ARMCPU to set the features for +* +* Set up the ARMCPU struct fields up to match the information probed +* from the host CPU. +*/ +void kvm_arm_set_cpu_features_from_host (ARMCPU *cpu);/** * kvm_arm_sync_mpstate_to_kvm
@@ -200,6 +204,15 @@ void kvm_arm_pmu_init(CPUState *cs);#else +static inline void kvm_arm_set_cpu_features_from_host (ARMCPU *cpu) +{ +/* This should never actually be called in the "not KVM" case, +* but set up the fields to indicate an error anyway. +*/ + cpu->kvm_target =QEMU_KVM_ARM_TARGET_NONE ; + cpu->host_cpu_probe_failed = true; +} +static inline int kvm_arm_vgic_probe (void ) {return 0 ;
target/arm/cpu.c +13 -0
@@ -725,6 +725,19 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)int pagebits;Error *local_err =NULL ; +/* If we needed to query the host kernel for the CPU features +* then it's possible that might have failed in the initfn, but +* this is the first point where we can report it. +*/ +if (cpu->host_cpu_probe_failed) { +if (!kvm_enabled ()) { +error_setg (errp,"The 'host' CPU type can only be used with KVM" ); + }else { +error_setg (errp,"Failed to retrieve host CPU features" ); + } +return ; + } +cpu_exec_realizefn (cs, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err);
target/arm/kvm.c +19 -17
@@ -33,6 +33,8 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {static bool cap_has_mp_state; +static ARMHostCPUFeatures arm_host_cpu_features; +int kvm_arm_vcpu_init (CPUState *cs) {ARMCPU *cpu =ARM_CPU (cs);
@@ -129,30 +131,32 @@ void kvm_arm_destroy_scratch_host_vcpu(int *fdarray) } } -static void kvm_arm_host_cpu_class_init (ObjectClass *oc,void *data) +void kvm_arm_set_cpu_features_from_host (ARMCPU *cpu) { -ARMHostCPUClass *ahcc =ARM_HOST_CPU_CLASS (oc); +CPUARMState *env = &cpu->env; -/* All we really need to set up for the 'host' CPU -* is the feature bits -- we rely on the fact that the -* various ID register values in ARMCPU are only used for -* TCG CPUs. -*/ -if (!kvm_arm_get_host_cpu_features (ahcc)) { -fprintf (stderr,"Failed to retrieve host CPU features!\n" ); -abort (); +if (!arm_host_cpu_features.dtb_compatible) { +if (!kvm_enabled () || + !kvm_arm_get_host_cpu_features (&arm_host_cpu_features)) { +/* We can't report this error yet, so flag that we need to +* in arm_cpu_realizefn(). +*/ + cpu->kvm_target =QEMU_KVM_ARM_TARGET_NONE ; + cpu->host_cpu_probe_failed = true; +return ; + } } + + cpu->kvm_target = arm_host_cpu_features.target; + cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible; + env->features = arm_host_cpu_features.features; }static void kvm_arm_host_cpu_initfn (Object *obj) { -ARMHostCPUClass *ahcc =ARM_HOST_CPU_GET_CLASS (obj);ARMCPU *cpu =ARM_CPU (obj); -CPUARMState *env = &cpu->env; - cpu->kvm_target = ahcc->target; - cpu->dtb_compatible = ahcc->dtb_compatible; - env->features = ahcc->features; +kvm_arm_set_cpu_features_from_host (cpu); }static const TypeInfo host_arm_cpu_type_info = {
@@ -163,8 +167,6 @@ static const TypeInfo host_arm_cpu_type_info = { .parent = TYPE_ARM_CPU, #endif .instance_init = kvm_arm_host_cpu_initfn, - .class_init = kvm_arm_host_cpu_class_init, - .class_size = sizeof(ARMHostCPUClass), };int kvm_arch_init (MachineState *ms,KVMState *s)
target/arm/kvm32.c +4 -4
@@ -28,7 +28,7 @@ static inline void set_feature(uint64_t *features, int feature) *features |=1ULL << feature; } -bool kvm_arm_get_host_cpu_features (ARMHostCPUClass *ahcc) +bool kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and * fill out the ARMHostCPUClass fields accordingly. To do this
@@ -74,13 +74,13 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)return false; } - ahcc->target = init.target; + ahcf->target = init.target;/* This is not strictly blessed by the device tree binding docs yet, * but in practice the kernel does not care about this string so * there is no point maintaining an KVM_ARM_TARGET_* -> string table. */ - ahcc->dtb_compatible ="arm,arm-v7" ; + ahcf->dtb_compatible ="arm,arm-v7" ;for (i =0 ; i <ARRAY_SIZE (idregs); i++) { ret =ioctl (fdarray[2 ],KVM_GET_ONE_REG , &idregs[i]);
@@ -132,7 +132,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)set_feature (&features,ARM_FEATURE_VFP4 ); } - ahcc->features = features; + ahcf->features = features;return true; }
target/arm/kvm64.c +4 -4
@@ -443,7 +443,7 @@ static inline void unset_feature(uint64_t *features, int feature) *features &= ~(1ULL << feature); } -bool kvm_arm_get_host_cpu_features (ARMHostCPUClass *ahcc) +bool kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and * fill out the ARMHostCPUClass fields accordingly. To do this
@@ -471,8 +471,8 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)return false; } - ahcc->target = init.target; - ahcc->dtb_compatible ="arm,arm-v8" ; + ahcf->target = init.target; + ahcf->dtb_compatible ="arm,arm-v8" ;kvm_arm_destroy_scratch_host_vcpu (fdarray);
@@ -486,7 +486,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)set_feature (&features,ARM_FEATURE_AARCH64 );set_feature (&features,ARM_FEATURE_PMU ); - ahcc->features = features; + ahcf->features = features;return true; }
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 07/25] aarch64-linux-user: Split out helpers for guest signal handling
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Split out helpers from target_setup_frame and target_restore_sigframe for dealing with general registers, fpsimd registers, and the end record.
When we add support for sve registers, the relative positions of these will change.
Message-id: [email protected]
--- linux-user/signal.c | 120 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 51 deletions(-)
linux-user/signal.c +69 -51
@@ -1465,16 +1465,17 @@ struct target_rt_sigframe {uint32_t tramp[2 ]; }; -static int target_setup_sigframe (struct target_rt_sigframe *sf, -CPUARMState *env,target_sigset_t *set) +static void target_setup_general_frame (struct target_rt_sigframe *sf, +CPUARMState *env,target_sigset_t *set) {int i; -struct target_aux_context *aux = - (struct target_aux_context *)sf->uc.tuc_mcontext.__reserved; -/* set up the stack frame for unwinding */ -__put_user (env->xregs[29 ], &sf->fp); -__put_user (env->xregs[30 ], &sf->lr); +__put_user (0 , &sf->uc.tuc_flags); +__put_user (0 , &sf->uc.tuc_link); + +__put_user (target_sigaltstack_used.ss_sp, &sf->uc.tuc_stack.ss_sp); +__put_user (sas_ss_flags (env->xregs[31 ]), &sf->uc.tuc_stack.ss_flags); +__put_user (target_sigaltstack_used.ss_size, &sf->uc.tuc_stack.ss_size);for (i =0 ; i <31 ; i++) {__put_user (env->xregs[i], &sf->uc.tuc_mcontext.regs[i]);
@@ -1488,39 +1489,42 @@ static int target_setup_sigframe(struct target_rt_sigframe *sf,for (i =0 ; i <TARGET_NSIG_WORDS ; i++) {__put_user (set->sig[i], &sf->uc.tuc_sigmask.sig[i]); } +} + +static void target_setup_fpsimd_record (struct target_fpsimd_context *fpsimd, +CPUARMState *env) +{ +int i; + +__put_user (TARGET_FPSIMD_MAGIC , &fpsimd->head.magic); +__put_user (sizeof (struct target_fpsimd_context ), &fpsimd->head.size); +__put_user (vfp_get_fpsr (env), &fpsimd->fpsr); +__put_user (vfp_get_fpcr (env), &fpsimd->fpcr);for (i =0 ; i <32 ; i++) {uint64_t *q =aa64_vfp_qreg (env, i);#ifdef TARGET_WORDS_BIGENDIAN -__put_user (q[0 ], &aux->fpsimd.vregs[i *2 +1 ]); -__put_user (q[1 ], &aux->fpsimd.vregs[i *2 ]); +__put_user (q[0 ], &fpsimd->vregs[i *2 +1 ]); +__put_user (q[1 ], &fpsimd->vregs[i *2 ]);#else -__put_user (q[0 ], &aux->fpsimd.vregs[i *2 ]); -__put_user (q[1 ], &aux->fpsimd.vregs[i *2 +1 ]); +__put_user (q[0 ], &fpsimd->vregs[i *2 ]); +__put_user (q[1 ], &fpsimd->vregs[i *2 +1 ]);#endif } -__put_user (vfp_get_fpsr (env), &aux->fpsimd.fpsr); -__put_user (vfp_get_fpcr (env), &aux->fpsimd.fpcr); -__put_user (TARGET_FPSIMD_MAGIC , &aux->fpsimd.head.magic); -__put_user (sizeof (struct target_fpsimd_context ), - &aux->fpsimd.head.size); - -/* set the "end" magic */ -__put_user (0 , &aux->end.magic); -__put_user (0 , &aux->end.size); - -return 0 ; } -static int target_restore_sigframe (CPUARMState *env, -struct target_rt_sigframe *sf) +static void target_setup_end_record (struct target_aarch64_ctx *end) +{ +__put_user (0 , &end->magic); +__put_user (0 , &end->size); +} + +static void target_restore_general_frame (CPUARMState *env, +struct target_rt_sigframe *sf) {sigset_t set; -int i; -struct target_aux_context *aux = - (struct target_aux_context *)sf->uc.tuc_mcontext.__reserved; -uint32_t magic, size, fpsr, fpcr;uint64_t pstate; +int i;target_to_host_sigset (&set, &sf->uc.tuc_sigmask);set_sigmask (&set);
@@ -1533,30 +1537,48 @@ static int target_restore_sigframe(CPUARMState *env,__get_user (env->pc, &sf->uc.tuc_mcontext.pc);__get_user (pstate, &sf->uc.tuc_mcontext.pstate);pstate_write (env, pstate); +} -__get_user (magic, &aux->fpsimd.head.magic); -__get_user (size, &aux->fpsimd.head.size); +static void target_restore_fpsimd_record (CPUARMState *env, +struct target_fpsimd_context *fpsimd) +{ +uint32_t fpsr, fpcr; +int i; -if (magic !=TARGET_FPSIMD_MAGIC - || size !=sizeof (struct target_fpsimd_context )) { -return 1 ; - } +__get_user (fpsr, &fpsimd->fpsr); +vfp_set_fpsr (env, fpsr); +__get_user (fpcr, &fpsimd->fpcr); +vfp_set_fpcr (env, fpcr);for (i =0 ; i <32 ; i++) {uint64_t *q =aa64_vfp_qreg (env, i);#ifdef TARGET_WORDS_BIGENDIAN -__get_user (q[0 ], &aux->fpsimd.vregs[i *2 +1 ]); -__get_user (q[1 ], &aux->fpsimd.vregs[i *2 ]); +__get_user (q[0 ], &fpsimd->vregs[i *2 +1 ]); +__get_user (q[1 ], &fpsimd->vregs[i *2 ]);#else -__get_user (q[0 ], &aux->fpsimd.vregs[i *2 ]); -__get_user (q[1 ], &aux->fpsimd.vregs[i *2 +1 ]); +__get_user (q[0 ], &fpsimd->vregs[i *2 ]); +__get_user (q[1 ], &fpsimd->vregs[i *2 +1 ]);#endif } -__get_user (fpsr, &aux->fpsimd.fpsr); -vfp_set_fpsr (env, fpsr); -__get_user (fpcr, &aux->fpsimd.fpcr); -vfp_set_fpcr (env, fpcr); +} +static int target_restore_sigframe (CPUARMState *env, +struct target_rt_sigframe *sf) +{ +struct target_aux_context *aux + = (struct target_aux_context *)sf->uc.tuc_mcontext.__reserved; +uint32_t magic, size; + +target_restore_general_frame (env, sf); + +__get_user (magic, &aux->fpsimd.head.magic); +__get_user (size, &aux->fpsimd.head.size); +if (magic ==TARGET_FPSIMD_MAGIC + && size ==sizeof (struct target_fpsimd_context )) { +target_restore_fpsimd_record (env, &aux->fpsimd); + }else { +return 1 ; + }return 0 ; }
@@ -1583,6 +1605,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, CPUARMState *env) {struct target_rt_sigframe *frame; +struct target_aux_context *aux;abi_ulong frame_addr, return_addr; frame_addr =get_sigframe (ka, env);
@@ -1590,17 +1613,12 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,if (!lock_user_struct (VERIFY_WRITE , frame, frame_addr,0 )) { goto give_sigsegv; } + aux = (struct target_aux_context *)frame->uc.tuc_mcontext.__reserved; -__put_user (0 , &frame->uc.tuc_flags); -__put_user (0 , &frame->uc.tuc_link); +target_setup_general_frame (frame, env, set); +target_setup_fpsimd_record (&aux->fpsimd, env); +target_setup_end_record (&aux->end); -__put_user (target_sigaltstack_used.ss_sp, - &frame->uc.tuc_stack.ss_sp); -__put_user (sas_ss_flags (env->xregs[31 ]), - &frame->uc.tuc_stack.ss_flags); -__put_user (target_sigaltstack_used.ss_size, - &frame->uc.tuc_stack.ss_size); -target_setup_sigframe (frame, env, set);if (ka->sa_flags &TARGET_SA_RESTORER ) { return_addr = ka->sa_restorer; }else {
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 08/25] aarch64-linux-user: Remove struct target_aux_context
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This changes the qemu signal frame layout to be more like the kernel's, in that the various records are dynamically allocated rather than fixed in place by a structure.
For now, all of the allocation is out of uc.tuc_mcontext.__reserved, so the allocation is actually trivial. That will change with SVE support.
Message-id: [email protected]
--- linux-user/signal.c | 89 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 28 deletions(-)
linux-user/signal.c +61 -28
@@ -1446,20 +1446,12 @@ struct target_fpsimd_context {uint64_t vregs[32 *2 ];/* really uint128_t vregs[32] */ }; -/* -* Auxiliary context saved in the sigcontext.__reserved array. Not exported to -* user space as it will change with the addition of new context. User space -* should check the magic/size information. -*/ -struct target_aux_context { -struct target_fpsimd_context fpsimd; -/* additional context to be added before "end" */ -struct target_aarch64_ctx end; -}; -struct target_rt_sigframe {struct target_siginfo info;struct target_ucontext uc; +}; + +struct target_rt_frame_record {uint64_t fp;uint64_t lr;uint32_t tramp[2 ];
@@ -1565,20 +1557,47 @@ static void target_restore_fpsimd_record(CPUARMState *env,static int target_restore_sigframe (CPUARMState *env,struct target_rt_sigframe *sf) { -struct target_aux_context *aux - = (struct target_aux_context *)sf->uc.tuc_mcontext.__reserved; -uint32_t magic, size; +struct target_aarch64_ctx *ctx; +struct target_fpsimd_context *fpsimd =NULL ;target_restore_general_frame (env, sf); -__get_user (magic, &aux->fpsimd.head.magic); -__get_user (size, &aux->fpsimd.head.size); -if (magic ==TARGET_FPSIMD_MAGIC - && size ==sizeof (struct target_fpsimd_context )) { -target_restore_fpsimd_record (env, &aux->fpsimd); - }else { + ctx = (struct target_aarch64_ctx *)sf->uc.tuc_mcontext.__reserved; +while (ctx) { +uint32_t magic, size; + +__get_user (magic, &ctx->magic); +__get_user (size, &ctx->size); +switch (magic) { +case 0 : +if (size !=0 ) { +return 1 ; + } + ctx =NULL ; +continue ; + +case TARGET_FPSIMD_MAGIC : +if (fpsimd || size !=sizeof (struct target_fpsimd_context )) { +return 1 ; + } + fpsimd = (struct target_fpsimd_context *)ctx; +break ; + +default : +/* Unknown record -- we certainly didn't generate it. +* Did we in fact get out of sync? +*/ +return 1 ; + } + ctx = (void *)ctx + size; + } + +/* Require FPSIMD always. */ +if (!fpsimd) {return 1 ; } +target_restore_fpsimd_record (env, fpsimd); +return 0 ; }
@@ -1604,20 +1623,33 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { + int size = offsetof(struct target_rt_sigframe, uc.tuc_mcontext.__reserved); +int fpsimd_ofs, end1_ofs, fr_ofs;struct target_rt_sigframe *frame; -struct target_aux_context *aux; +struct target_rt_frame_record *fr;abi_ulong frame_addr, return_addr; + fpsimd_ofs = size; + size +=sizeof (struct target_fpsimd_context ); + end1_ofs = size; + size +=sizeof (struct target_aarch64_ctx ); + fr_ofs = size; + size +=sizeof (struct target_rt_frame_record ); + frame_addr =get_sigframe (ka, env);trace_user_setup_frame (env, frame_addr);if (!lock_user_struct (VERIFY_WRITE , frame, frame_addr,0 )) { goto give_sigsegv; } - aux = (struct target_aux_context *)frame->uc.tuc_mcontext.__reserved;target_setup_general_frame (frame, env, set); -target_setup_fpsimd_record (&aux->fpsimd, env); -target_setup_end_record (&aux->end); +target_setup_fpsimd_record ((void *)frame + fpsimd_ofs, env); +target_setup_end_record ((void *)frame + end1_ofs); + +/* Set up the stack frame for unwinding. */ + fr = (void *)frame + fr_ofs; +__put_user (env->xregs[29 ], &fr->fp); +__put_user (env->xregs[30 ], &fr->lr);if (ka->sa_flags &TARGET_SA_RESTORER ) { return_addr = ka->sa_restorer;
@@ -1627,13 +1659,14 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,* Since these are instructions they need to be put as little-endian * regardless of target default or current CPU endianness. */ -__put_user_e (0xd2801168 , &frame->tramp[0 ], le); -__put_user_e (0xd4000001 , &frame->tramp[1 ], le); - return_addr = frame_addr + offsetof(struct target_rt_sigframe , tramp); +__put_user_e (0xd2801168 , &fr->tramp[0 ], le); +__put_user_e (0xd4000001 , &fr->tramp[1 ], le); + return_addr = frame_addr + fr_ofs + + offsetof(struct target_rt_frame_record , tramp); } env->xregs[0 ] = usig; env->xregs[31 ] = frame_addr; - env->xregs[29 ] = env->xregs[31 ] + offsetof(struct target_rt_sigframe , fp); + env->xregs[29 ] = frame_addr + fr_ofs; env->pc = ka->_sa_handler; env->xregs[30 ] = return_addr;if (info) {
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 16/25] target/arm: Add "-cpu max" support
In reply to Peter MaydellAdd support for "-cpu max" for ARM guests. This CPU type behaves like "-cpu host" when KVM is enabled, and like a system CPU with the maximum possible feature set otherwise. (Note that this means it won't be migratable across versions, as we will likely add features to it in future.)
Message-id: [email protected]
--- target/arm/cpu-qom.h | 2 ++ target/arm/cpu.c | 24 ++++++++++++++++++++++++ target/arm/cpu64.c | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+)
target/arm/cpu-qom.h +2 -0
@@ -33,6 +33,8 @@ struct arm_boot_info;#define ARM_CPU_GET_CLASS (obj) \ OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU) +#define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU +/** * ARMCPUClass: * @parent_realize: The parent class' realize handler.
target/arm/cpu.c +24 -0
@@ -1702,6 +1702,27 @@ static void pxa270c5_initfn(Object *obj) cpu->reset_sctlr =0x00000078 ; } +#ifndef TARGET_AARCH64 +/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); +* otherwise, a CPU with as many features enabled as our emulation supports. +* The version of '-cpu max' for qemu-system-aarch64 is defined in cpu64.c; +* this only needs to handle 32 bits. +*/ +static void arm_max_initfn (Object *obj) +{ +ARMCPU *cpu =ARM_CPU (obj); + +if (kvm_enabled ()) { +kvm_arm_set_cpu_features_from_host (cpu); + }else { +cortex_a15_initfn (obj); +/* In future we might add feature bits here even if the +* real-world A15 doesn't implement them. +*/ + } +} +#endif +#ifdef CONFIG_USER_ONLY static void arm_any_initfn (Object *obj) {
@@ -1769,6 +1790,9 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "pxa270-b1", .initfn = pxa270b1_initfn }, { .name = "pxa270-c0", .initfn = pxa270c0_initfn }, { .name = "pxa270-c5", .initfn = pxa270c5_initfn }, +#ifndef TARGET_AARCH64 + { .name = "max", .initfn = arm_max_initfn }, +#endif #ifdef CONFIG_USER_ONLY { .name = "any", .initfn = arm_any_initfn }, #endif
target/arm/cpu64.c +21 -0
@@ -28,6 +28,7 @@#include "hw/arm/arm.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" +#include "kvm_arm.h" static inline void set_feature (CPUARMState *env,int feature) {
@@ -214,6 +215,25 @@ static void aarch64_a53_initfn(Object *obj)define_arm_cp_regs (cpu, cortex_a57_a53_cp_reginfo); } +/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); +* otherwise, a CPU with as many features enabled as our emulation supports. +* The version of '-cpu max' for qemu-system-arm is defined in cpu.c; +* this only needs to handle 64 bits. +*/ +static void aarch64_max_initfn (Object *obj) +{ +ARMCPU *cpu =ARM_CPU (obj); + +if (kvm_enabled ()) { +kvm_arm_set_cpu_features_from_host (cpu); + }else { +aarch64_a57_initfn (obj); +/* In future we might add feature bits here even if the +* real-world A57 doesn't implement them. +*/ + } +} +#ifdef CONFIG_USER_ONLY static void aarch64_any_initfn (Object *obj) {
@@ -249,6 +269,7 @@ typedef struct ARMCPUInfo {static const ARMCPUInfo aarch64_cpus[] = { { .name ="cortex-a57" , .initfn = aarch64_a57_initfn }, { .name ="cortex-a53" , .initfn = aarch64_a53_initfn }, + { .name ="max" , .initfn = aarch64_max_initfn }, #ifdef CONFIG_USER_ONLY { .name ="any" , .initfn = aarch64_any_initfn }, #endif
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 18/25] hw/arm/virt: Add "max" to the list of CPU types "virt" supports
In reply to Peter MaydellAllow the virt board to support '-cpu max' in the same way it already handles '-cpu host'.
Message-id: [email protected]
--- hw/arm/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt.c +1 -0
@@ -169,6 +169,7 @@ static const char *valid_cpus[] = {ARM_CPU_TYPE_NAME ("cortex-a53" ),ARM_CPU_TYPE_NAME ("cortex-a57" ),ARM_CPU_TYPE_NAME ("host" ), + ARM_CPU_TYPE_NAME("max"), };static bool cpu_type_valid (const char *cpu)
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 02/25] hw/arm: Set the core count for Xilinx's ZynqMP
In reply to Peter MaydellFrom: Alistair Francis <[email protected]>
Set the ARM CPU core count property for the A53's attached to the Xilnx ZynqMP machine.
Message-id: fe0dd90b85ac73f9fc9548c253bededa70a07006.1520018138.git.alistair.francis@xilinx.com
--- hw/arm/xlnx-zynqmp.c | 2 ++ 1 file changed, 2 insertions(+)
hw/arm/xlnx-zynqmp.c +2 -0
@@ -282,6 +282,8 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) s->virt, "has_el2", NULL);object_property_set_int (OBJECT (&s->apu_cpu[i]),GIC_BASE_ADDR ,"reset-cbar" , &error_abort); +object_property_set_int (OBJECT (&s->apu_cpu[i]), num_apus, +"core-count" , &error_abort);object_property_set_bool (OBJECT (&s->apu_cpu[i]), true,"realized" , &err);if (err) {
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 05/25] Implement support for i.MX7 Sabre board
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Implement code needed to set up emulation of MCIMX7SABRE board from NXP. For more info about the HW see:
--- hw/arm/Makefile.objs | 2 +- hw/arm/mcimx7d-sabre.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 hw/arm/mcimx7d-sabre.c
hw/arm/Makefile.objs +1 -1
@@ -22,4 +22,4 @@ obj-$(CONFIG_MPS2) += mps2.o obj-$(CONFIG_MPS2) += mps2-tz.o obj-$(CONFIG_MSF2) += msf2-soc.o msf2-som.o obj-$(CONFIG_IOTKIT) += iotkit.o -obj-$(CONFIG_FSL_IMX7) += fsl-imx7.o +obj-$(CONFIG_FSL_IMX7) += fsl-imx7.o mcimx7d-sabre.o
hw/arm/mcimx7d-sabre.c new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 06/25] linux-user: Implement aarch64 PR_SVE_SET/GET_VL
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
As an implementation choice, widening VL has zeroed the previously inaccessible portion of the sve registers.
Message-id: [email protected]
--- linux-user/aarch64/target_syscall.h | 3 +++ target/arm/cpu.h | 1 + linux-user/syscall.c | 27 ++++++++++++++++++++++++ target/arm/cpu64.c | 41 +++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+)
linux-user/aarch64/target_syscall.h +3 -0
@@ -19,4 +19,7 @@ struct target_pt_regs {#define TARGET_MLOCKALL_MCL_CURRENT 1#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_PR_SVE_SET_VL 50 +#define TARGET_PR_SVE_GET_VL 51 +#endif /* AARCH64_TARGET_SYSCALL_H */
target/arm/cpu.h +1 -0
@@ -866,6 +866,7 @@ int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,#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); +void aarch64_sve_narrow_vq (CPUARMState *env,unsigned vq);#endif target_ulong do_arm_semihosting (CPUARMState *env);
linux-user/syscall.c +27 -0
@@ -10672,6 +10672,33 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,break ; }#endif +#ifdef TARGET_AARCH64 +case TARGET_PR_SVE_SET_VL : +/* We cannot support either PR_SVE_SET_VL_ONEXEC +or PR_SVE_VL_INHERIT. Therefore, anything above +ARM_MAX_VQ results in EINVAL. */ + ret = -TARGET_EINVAL ; +if (arm_feature (cpu_env,ARM_FEATURE_SVE ) + && arg2 >=0 && arg2 <=ARM_MAX_VQ *16 && !(arg2 &15 )) { +CPUARMState *env = cpu_env; +int old_vq = (env->vfp.zcr_el[1 ] &0xf ) +1 ; +int vq =MAX (arg2 /16 ,1 ); + +if (vq < old_vq) { +aarch64_sve_narrow_vq (env, vq); + } + env->vfp.zcr_el[1 ] = vq -1 ; + ret = vq *16 ; + } +break ; +case TARGET_PR_SVE_GET_VL : + ret = -TARGET_EINVAL ; +if (arm_feature (cpu_env,ARM_FEATURE_SVE )) { +CPUARMState *env = cpu_env; + ret = ((env->vfp.zcr_el[1 ] &0xf ) +1 ) *16 ; + } +break ; +#endif /* AARCH64 */ case PR_GET_SECCOMP :case PR_SET_SECCOMP :/* Disable seccomp to prevent the target disabling syscalls we
target/arm/cpu64.c +41 -0
44 lines not on this page · raw message
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 17/25] target/arm: Make 'any' CPU just an alias for 'max'
In reply to Peter MaydellNow we have a working '-cpu max', the linux-user-only 'any' CPU is pretty much the same thing, so implement it that way.
For the moment we don't add any of the extra feature bits to the system-emulation "max", because we don't set the ID register bits we would need to to advertise those features as present.
Message-id: [email protected]
--- target/arm/cpu.c | 52 +++++++++++++++++++++++++---------------------- target/arm/cpu64.c | 59 ++++++++++++++++++++++++++---------------------------- 2 files changed, 56 insertions(+), 55 deletions(-)
target/arm/cpu.c +28 -24
@@ -970,9 +970,19 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model)ObjectClass *oc;char *typename;char **cpuname; +const char *cpunamestr; cpuname =g_strsplit (cpu_model,"," ,1 ); - typename =g_strdup_printf (ARM_CPU_TYPE_NAME ("%s" ), cpuname[0 ]); + cpunamestr = cpuname[0 ]; +#ifdef CONFIG_USER_ONLY +/* For backwards compatibility usermode emulation allows "-cpu any", +* which has the same semantics as "-cpu max". +*/ +if (!strcmp (cpunamestr,"any" )) { + cpunamestr ="max" ; + } +#endif + typename =g_strdup_printf (ARM_CPU_TYPE_NAME ("%s" ), cpunamestr); oc =object_class_by_name (typename);g_strfreev (cpuname);g_free (typename);
@@ -1716,29 +1726,23 @@ static void arm_max_initfn(Object *obj) kvm_arm_set_cpu_features_from_host(cpu); }else {cortex_a15_initfn (obj); -/* In future we might add feature bits here even if the -* real-world A15 doesn't implement them. -*/ - } -} -#endif -#ifdef CONFIG_USER_ONLY -static void arm_any_initfn (Object *obj) -{ -ARMCPU *cpu =ARM_CPU (obj); -set_feature (&cpu->env,ARM_FEATURE_V8 ); -set_feature (&cpu->env,ARM_FEATURE_VFP4 ); -set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_THUMB2EE ); -set_feature (&cpu->env,ARM_FEATURE_V8_AES ); -set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); -set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); -set_feature (&cpu->env,ARM_FEATURE_V8_PMULL ); -set_feature (&cpu->env,ARM_FEATURE_CRC ); -set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); -set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); - cpu->midr =0xffffffff ; +/* We don't set these in system emulation mode for the moment, +* since we don't correctly set the ID registers to advertise them, +*/ +set_feature (&cpu->env,ARM_FEATURE_V8 ); +set_feature (&cpu->env,ARM_FEATURE_VFP4 ); +set_feature (&cpu->env,ARM_FEATURE_NEON ); +set_feature (&cpu->env,ARM_FEATURE_THUMB2EE ); +set_feature (&cpu->env,ARM_FEATURE_V8_AES ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); +set_feature (&cpu->env,ARM_FEATURE_V8_PMULL ); +set_feature (&cpu->env,ARM_FEATURE_CRC ); +set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); +set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); +#endif + } }#endif
@@ -1794,7 +1798,7 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "max", .initfn = arm_max_initfn }, #endif #ifdef CONFIG_USER_ONLY - { .name = "any", .initfn = arm_any_initfn }, + { .name = "any", .initfn = arm_max_initfn }, #endif #endif { .name = NULL }
target/arm/cpu64.c +28 -31
75 lines not on this page · raw message
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 01/25] target/arm: Add a core count property
In reply to Peter MaydellFrom: Alistair Francis <[email protected]>
The cortex A53 TRM specifies that bits 24 and 25 of the L2CTLR register specify the number of cores in the processor, not the total number of cores in the system. To report this correctly on machines with multiple CPU clusters (ARM's big.LITTLE or Xilinx's ZynqMP) we need to allow the machine to overwrite this value. To do this let's add an optional property.
Message-id: ef01d95c0759e88f47f22d11b14c91512a658b4f.1520018138.git.alistair.francis@xilinx.com
--- target/arm/cpu.h | 5 +++++ target/arm/cpu.c | 6 ++++++ target/arm/cpu64.c | 6 ++++-- 3 files changed, 15 insertions(+), 2 deletions(-)
target/arm/cpu.h +5 -0
@@ -745,6 +745,11 @@ struct ARMCPU {/* Uniprocessor system with MP extensions */ bool mp_is_up; +/* Specify the number of cores in this CPU cluster. Used for the L2CTLR +* register. +*/ +int32_t core_count; +/* The instance init functions for implementation-specific subclasses * set these fields to specify the implementation-dependent values of * various constant registers and reset values of non-constant
target/arm/cpu.c +6 -0
@@ -939,6 +939,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cs->num_ases = 1; }cpu_address_space_init (cs, ARMASIdx_NS,"cpu-memory" , cs->memory); + +/* No core_count specified, default to smp_cpus. */ +if (cpu->core_count ==-1 ) { + cpu->core_count = smp_cpus; + }#endif qemu_init_vcpu (cs);
@@ -1765,6 +1770,7 @@ static Property arm_cpu_properties[] = {DEFINE_PROP_UINT64 ("mp-affinity" ,ARMCPU , mp_affinity,ARM64_AFFINITY_INVALID ),DEFINE_PROP_INT32 ("node-id" ,ARMCPU , node_id,CPU_UNSET_NUMA_NODE_ID ), +DEFINE_PROP_INT32 ("core-count" ,ARMCPU , core_count,-1 ), DEFINE_PROP_END_OF_LIST() };
target/arm/cpu64.c +4 -2
@@ -42,8 +42,10 @@ static inline void unset_feature(CPUARMState *env, int feature)#ifndef CONFIG_USER_ONLY static uint64_t a57_a53_l2ctlr_read (CPUARMState *env,const ARMCPRegInfo *ri) { -/* Number of processors is in [25:24]; otherwise we RAZ */ -return (smp_cpus -1 ) <<24 ; +ARMCPU *cpu =arm_env_get_cpu (env); + +/* Number of cores is in [25:24]; otherwise we RAZ */ +return (cpu->core_count -1 ) <<24 ; }#endif
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 19/25] hw/arm/virt: Support -machine gic-version=max
In reply to Peter MaydellAdd support for passing 'max' to -machine gic-version. By analogy with the -cpu max option, this picks the "best available" GIC version whether you're using KVM or TCG, so it behaves like 'host' when using KVM, and gives you GICv3 when using TCG.
Also like '-cpu host', using -machine gic-version=max' means there is no guarantee of migration compatibility between QEMU versions; in future 'max' might mean '4'.
Message-id: [email protected]
--- hw/arm/virt.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
hw/arm/virt.c +19 -10
@@ -1207,16 +1207,23 @@ static void machvirt_init(MachineState *machine)/* We can probe only here because during property set * KVM is not available yet */ -if (!vms->gic_version) { +if (vms->gic_version <=0 ) { +/* "host" or "max" */ if (!kvm_enabled ()) { -error_report ("gic-version=host requires KVM" ); -exit (1 ); - } - - vms->gic_version =kvm_arm_vgic_probe (); -if (!vms->gic_version) { -error_report ("Unable to determine GIC version supported by host" ); -exit (1 ); +if (vms->gic_version ==0 ) { +error_report ("gic-version=host requires KVM" ); +exit (1 ); + }else { +/* "max": currently means 3 for TCG */ + vms->gic_version =3 ; + } + }else { + vms->gic_version =kvm_arm_vgic_probe (); +if (!vms->gic_version) { +error_report ( +"Unable to determine GIC version supported by host" ); +exit (1 ); + } } }
@@ -1480,9 +1487,11 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp) vms->gic_version =2 ; }else if (!strcmp (value,"host" )) { vms->gic_version =0 ;/* Will probe later */ + }else if (!strcmp (value,"max" )) { + vms->gic_version =-1 ;/* Will probe later */ }else {error_setg (errp,"Invalid gic-version value" ); -error_append_hint (errp,"Valid values are 3, 2, host.\n" ); +error_append_hint (errp,"Valid values are 3, 2, host, max.\n" ); } }
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 20/25] sdcard: Do not trace CMD55, except when we already expect an ACMD
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/sd/sd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
hw/sd/sd.c +8 -3
@@ -866,13 +866,18 @@ static void sd_lock_command(SDState *sd) sd->card_status &= ~CARD_IS_LOCKED ; } -static sd_rsp_type_t sd_normal_command (SDState *sd, -SDRequest req) +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;uint64_t addr = (sd->ocr & (1 <<30 )) ? (uint64_t ) req.arg <<9 : req.arg; -trace_sdcard_normal_command (req.cmd, req.arg,sd_state_name (sd->state)); +/* CMD55 precedes an ACMD, so we are not interested in tracing it. +* However there is no ACMD55, so we want to trace this particular case. +*/ +if (req.cmd !=55 || sd->expecting_acmd) { +trace_sdcard_normal_command (req.cmd, req.arg, +sd_state_name (sd->state)); + }/* Not interpreting this as an app command */ sd->card_status &= ~APP_CMD ;
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 21/25] sdcard: Display command name when tracing CMD/ACMD
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
The SDBus will reuse these functions, so we put them in a new source file.
Message-id: [email protected]
[PMM: slight wordsmithing of comments, added note that string
returned does not need to be freed]
--- hw/sd/Makefile.objs | 2 +- hw/sd/sdmmc-internal.h | 24 +++++++++++++++++ hw/sd/sd.c | 13 +++++---- hw/sd/sdmmc-internal.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/sd/trace-events | 8 +++--- 5 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 hw/sd/sdmmc-internal.c
hw/sd/Makefile.objs +1 -1
@@ -1,6 +1,6 @@ common-obj-$(CONFIG_PL181) += pl181.o common-obj-$(CONFIG_SSI_SD) += ssi-sd.o -common-obj-$(CONFIG_SD) += sd.o core.o +common-obj-$(CONFIG_SD) += sd.o core.o sdmmc-internal.o common-obj-$(CONFIG_SDHCI) += sdhci.o obj-$(CONFIG_MILKYMIST) += milkymist-memcard.o
hw/sd/sdmmc-internal.h +24 -0
@@ -12,4 +12,28 @@#define SDMMC_CMD_MAX 64 +/** +* sd_cmd_name: +* @cmd: A SD "normal" command, up to SDMMC_CMD_MAX. +* +* Returns a human-readable name describing the command. +* The return value is always a static string which does not need +* to be freed after use. +* +* Returns: The command name of @cmd or "UNKNOWN_CMD". +*/ +const char *sd_cmd_name (uint8_t cmd); + +/** +* sd_acmd_name: +* @cmd: A SD "Application-Specific" command, up to SDMMC_CMD_MAX. +* +* Returns a human-readable name describing the application command. +* The return value is always a static string which does not need +* to be freed after use. +* +* Returns: The application command name of @cmd or "UNKNOWN_ACMD". +*/ +const char *sd_acmd_name (uint8_t cmd); +#endif
hw/sd/sd.c +8 -5
@@ -875,8 +875,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)* However there is no ACMD55, so we want to trace this particular case. */ if (req.cmd !=55 || sd->expecting_acmd) { -trace_sdcard_normal_command (req.cmd, req.arg, -sd_state_name (sd->state)); +trace_sdcard_normal_command (sd_cmd_name (req.cmd), req.cmd, + req.arg,sd_state_name (sd->state)); }/* Not interpreting this as an app command */
@@ -1455,7 +1455,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)static sd_rsp_type_t sd_app_command (SDState *sd,SDRequest req) { -trace_sdcard_app_command (req.cmd, req.arg); +trace_sdcard_app_command (sd_acmd_name (req.cmd), + req.cmd, req.arg,sd_state_name (sd->state)); sd->card_status |=APP_CMD ;switch (req.cmd) {case 6 :/* ACMD6: SET_BUS_WIDTH */
@@ -1770,7 +1771,8 @@ void sd_write_data(SDState *sd, uint8_t value)if (sd->card_status & (ADDRESS_ERROR |WP_VIOLATION ))return ; -trace_sdcard_write_data (sd->current_cmd, value); +trace_sdcard_write_data (sd_acmd_name (sd->current_cmd), + sd->current_cmd, value);switch (sd->current_cmd) {case 24 :/* CMD24: WRITE_SINGLE_BLOCK */ sd->data[sd->data_offset ++] = value;
@@ -1908,7 +1910,8 @@ uint8_t sd_read_data(SDState *sd) io_len = (sd->ocr & (1 <<30 )) ?512 : sd->blk_len; -trace_sdcard_read_data (sd->current_cmd, io_len); +trace_sdcard_read_data (sd_acmd_name (sd->current_cmd), + sd->current_cmd, io_len);switch (sd->current_cmd) {case 6 :/* CMD6: SWITCH_FUNCTION */ ret = sd->data[sd->data_offset ++];
hw/sd/sdmmc-internal.c new file +72 -0
72 lines not on this page · raw message
hw/sd/trace-events +4 -4
@@ -24,8 +24,8 @@ sdhci_write_dataport(uint16_t data_count) "write buffer filled with %u bytes of sdhci_capareg(const char *desc, uint16_t val) "%s: %u" # hw/sd/sd.c -sdcard_normal_command(uint8_t cmd, uint32_t arg, const char *state) "CMD%d arg 0x%08x (state %s)" -sdcard_app_command(uint8_t acmd, uint32_t arg) "ACMD%d arg 0x%08x" +sdcard_normal_command(const char *cmd_desc, uint8_t cmd, uint32_t arg, const char *state) "%20s/ CMD%02d arg 0x%08x (state %s)" +sdcard_app_command(const char *acmd_desc, uint8_t acmd, uint32_t arg, const char *state) "%23s/ACMD%02d arg 0x%08x (state %s)" sdcard_response(const char *rspdesc, int rsplen) "%s (sz:%d)" sdcard_powerup(void) "" sdcard_inquiry_cmd41(void) ""
@@ -39,8 +39,8 @@ sdcard_lock(void) "" sdcard_unlock(void) "" sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" -sdcard_write_data(uint8_t cmd, uint8_t value) "CMD%02d value 0x%02x" -sdcard_read_data(uint8_t cmd, int length) "CMD%02d len %d" +sdcard_write_data(const char *cmd_desc, uint8_t cmd, uint8_t value) "%20s/ CMD%02d value 0x%02x" +sdcard_read_data(const char *cmd_desc, uint8_t cmd, int length) "%20s/ CMD%02d len %d" sdcard_set_voltage(uint16_t millivolts) "%u mV" # hw/sd/milkymist-memcard.c
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 22/25] sdcard: Display which protocol is used when tracing (SD or SPI)
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/sd/sd.c | 14 ++++++++++---- hw/sd/trace-events | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-)
hw/sd/sd.c +10 -4
@@ -120,6 +120,7 @@ struct SDState {qemu_irq readonly_cb;qemu_irq inserted_cb;QEMUTimer *ocr_power_timer; +const char *proto_name;bool enable;uint8_t dat_lines;bool cmd_line;
@@ -875,7 +876,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)* However there is no ACMD55, so we want to trace this particular case. */ if (req.cmd !=55 || sd->expecting_acmd) { -trace_sdcard_normal_command (sd_cmd_name (req.cmd), req.cmd, +trace_sdcard_normal_command (sd->proto_name, +sd_cmd_name (req.cmd), req.cmd, req.arg,sd_state_name (sd->state)); }
@@ -1455,7 +1457,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)static sd_rsp_type_t sd_app_command (SDState *sd,SDRequest req) { -trace_sdcard_app_command (sd_acmd_name (req.cmd), +trace_sdcard_app_command (sd->proto_name,sd_acmd_name (req.cmd), req.cmd, req.arg,sd_state_name (sd->state)); sd->card_status |=APP_CMD ;switch (req.cmd) {
@@ -1771,7 +1773,8 @@ void sd_write_data(SDState *sd, uint8_t value)if (sd->card_status & (ADDRESS_ERROR |WP_VIOLATION ))return ; -trace_sdcard_write_data (sd_acmd_name (sd->current_cmd), +trace_sdcard_write_data (sd->proto_name, +sd_acmd_name (sd->current_cmd), sd->current_cmd, value);switch (sd->current_cmd) {case 24 :/* CMD24: WRITE_SINGLE_BLOCK */
@@ -1910,7 +1913,8 @@ uint8_t sd_read_data(SDState *sd) io_len = (sd->ocr & (1 <<30 )) ?512 : sd->blk_len; -trace_sdcard_read_data (sd_acmd_name (sd->current_cmd), +trace_sdcard_read_data (sd->proto_name, +sd_acmd_name (sd->current_cmd), sd->current_cmd, io_len);switch (sd->current_cmd) {case 6 :/* CMD6: SWITCH_FUNCTION */
@@ -2037,6 +2041,8 @@ static void sd_realize(DeviceState *dev, Error **errp)SDState *sd =SD_CARD (dev);int ret; + sd->proto_name = sd->spi ?"SPI" :"SD" ; +if (sd->blk &&blk_is_read_only (sd->blk)) {error_setg (errp,"Cannot use read-only drive as SD card" );return ;
hw/sd/trace-events +4 -4
@@ -24,8 +24,8 @@ sdhci_write_dataport(uint16_t data_count) "write buffer filled with %u bytes of sdhci_capareg(const char *desc, uint16_t val) "%s: %u" # hw/sd/sd.c -sdcard_normal_command(const char *cmd_desc, uint8_t cmd, uint32_t arg, const char *state) "%20s/ CMD%02d arg 0x%08x (state %s)" -sdcard_app_command(const char *acmd_desc, uint8_t acmd, uint32_t arg, const char *state) "%23s/ACMD%02d arg 0x%08x (state %s)" +sdcard_normal_command(const char *proto, const char *cmd_desc, uint8_t cmd, uint32_t arg, const char *state) "%s %20s/ CMD%02d arg 0x%08x (state %s)" +sdcard_app_command(const char *proto, const char *acmd_desc, uint8_t acmd, uint32_t arg, const char *state) "%s %23s/ACMD%02d arg 0x%08x (state %s)" sdcard_response(const char *rspdesc, int rsplen) "%s (sz:%d)" sdcard_powerup(void) "" sdcard_inquiry_cmd41(void) ""
@@ -39,8 +39,8 @@ sdcard_lock(void) "" sdcard_unlock(void) "" sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" sdcard_write_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x" -sdcard_write_data(const char *cmd_desc, uint8_t cmd, uint8_t value) "%20s/ CMD%02d value 0x%02x" -sdcard_read_data(const char *cmd_desc, uint8_t cmd, int length) "%20s/ CMD%02d len %d" +sdcard_write_data(const char *proto, const char *cmd_desc, uint8_t cmd, uint8_t value) "%s %20s/ CMD%02d value 0x%02x" +sdcard_read_data(const char *proto, const char *cmd_desc, uint8_t cmd, int length) "%s %20s/ CMD%02d len %d" sdcard_set_voltage(uint16_t millivolts) "%u mV" # hw/sd/milkymist-memcard.c
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 23/25] sdcard: Add the Tuning Command (CMD19)
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Quoted 1 line
From the "Physical Layer Simplified Specification Version 3.01":
A known data block ("Tuning block") can be used to tune sampling point for tuning required hosts. [...]
This procedure gives the system optimal timing for each specific host and card combination and compensates for static delays in the timing budget including process, voltage and different PCB loads and skews. [...]
Data block, carried by DAT[3:0], contains a pattern for tuning sampling position to receive data on the CMD and DAT[3:0] line.
[based on a patch from Alistair Francis <[email protected]>
from qemu/xilinx tag xilinx-v2015.2]
Message-id: [email protected]
--- hw/sd/sd.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
hw/sd/sd.c +29 -0
@@ -1169,6 +1169,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) }break ; +case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ +if (sd->state == sd_transfer_state) { + sd->state = sd_sendingdata_state; + sd->data_offset =0 ; +return sd_r1; + } +break ; +case 23 :/* CMD23: SET_BLOCK_COUNT */ switch (sd->state) {case sd_transfer_state:
@@ -1893,6 +1901,20 @@ void sd_write_data(SDState *sd, uint8_t value) } } +#define SD_TUNING_BLOCK_SIZE 64 + +static const uint8_t sd_tuning_block_pattern[SD_TUNING_BLOCK_SIZE ] = { +/* See: Physical Layer Simplified Specification Version 3.01, Table 4-2 */ +0xff ,0x0f ,0xff ,0x00 ,0x0f ,0xfc ,0xc3 ,0xcc , +0xc3 ,0x3c ,0xcc ,0xff ,0xfe ,0xff ,0xfe ,0xef , +0xff ,0xdf ,0xff ,0xdd ,0xff ,0xfb ,0xff ,0xfb , +0xbf ,0xff ,0x7f ,0xff ,0x77 ,0xf7 ,0xbd ,0xef , +0xff ,0xf0 ,0xff ,0xf0 ,0x0f ,0xfc ,0xcc ,0x3c , +0xcc ,0x33 ,0xcc ,0xcf ,0xff ,0xef ,0xff ,0xee , +0xff ,0xfd ,0xff ,0xfd ,0xdf ,0xff ,0xbf ,0xff , +0xbb ,0xff ,0xf7 ,0xff ,0xf7 ,0x7f ,0x7b ,0xde , +}; +uint8_t sd_read_data (SDState *sd) {/* TODO: Append CRCs */
@@ -1972,6 +1994,13 @@ uint8_t sd_read_data(SDState *sd) }break ; +case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ +if (sd->data_offset >=SD_TUNING_BLOCK_SIZE -1 ) { + sd->state = sd_transfer_state; + } + ret = sd_tuning_block_pattern[sd->data_offset++]; +break ; +case 22 :/* ACMD22: SEND_NUM_WR_BLOCKS */ ret = sd->data[sd->data_offset ++];
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 24/25] sdhci: Fix a typo in comment
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/sd/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/sd/sdhci.c +2 -2
@@ -433,13 +433,13 @@ static void sdhci_read_block_from_card(SDHCIState *s)for (index =0 ; index < blk_size; index++) { data =sdbus_read_data (&s->sdbus);if (!FIELD_EX32 (s->hostctl2,SDHC_HOSTCTL2 ,EXECUTE_TUNING )) { -/* Device is not in tunning */ +/* Device is not in tuning */ s->fifo_buffer[index] = data; } }if (FIELD_EX32 (s->hostctl2,SDHC_HOSTCTL2 ,EXECUTE_TUNING )) { -/* Device is in tunning */ +/* Device is in tuning */ s->hostctl2 &= ~R_SDHC_HOSTCTL2_EXECUTE_TUNING_MASK ; s->hostctl2 |=R_SDHC_HOSTCTL2_SAMPLING_CLKSEL_MASK ; s->prnsts &= ~(SDHC_DAT_LINE_ACTIVE | SDHC_DOING_READ |
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 25/25] MAINTAINERS: Add entries for SD (SDHCI, SDBus, SDCard)
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
After spending months studying all the different SD Specifications from the SD Association, voluntarily add myself as maintainer for the SD code.
Message-id: [email protected]
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -1100,6 +1100,14 @@ M: Peter Crosthwaite <[email protected]> S: Maintained F: hw/ssi/xilinx_* +SD (Secure Card) +M: Philippe Mathieu-Daudé <[email protected]> +S: Odd Fixes +F: include/hw/sd/sd* +F: hw/sd/core.c +F: hw/sd/sd* +F: tests/sd* + USB M: Gerd Hoffmann <[email protected]> S: Maintained
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 04/25] i.MX: Add i.MX7 SOC implementation.
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
The following interfaces are partially or fully emulated:
* up to 2 Cortex A9 cores (SMP works with PSCI)
* A7 MPCORE (identical to A15 MPCORE)
* 4 GPTs modules
* 7 GPIO controllers
* 2 IOMUXC controllers
* 1 CCM module
* 1 SVNS module
* 1 SRC module
* 1 GPCv2 controller
* 4 eCSPI controllers
* 4 I2C controllers
* 7 i.MX UART controllers
* 2 FlexCAN controllers
* 2 Ethernet controllers (FEC)
* 3 SD controllers (USDHC)
* 4 WDT modules
* 1 SDMA module
* 1 GPR module
* 2 USBMISC modules
* 2 ADC modules
* 1 PCIe controller
Tested to boot and work with upstream Linux (4.13+) guest.
--- hw/arm/Makefile.objs | 1 + include/hw/arm/fsl-imx7.h | 222 +++++++++++++++ hw/arm/fsl-imx7.c | 582 ++++++++++++++++++++++++++++++++++++++++ default-configs/arm-softmmu.mak | 1 + 4 files changed, 806 insertions(+) create mode 100644 include/hw/arm/fsl-imx7.h create mode 100644 hw/arm/fsl-imx7.c
hw/arm/Makefile.objs +1 -0
@@ -22,3 +22,4 @@ obj-$(CONFIG_MPS2) += mps2.o obj-$(CONFIG_MPS2) += mps2-tz.o obj-$(CONFIG_MSF2) += msf2-soc.o msf2-som.o obj-$(CONFIG_IOTKIT) += iotkit.o +obj-$(CONFIG_FSL_IMX7) += fsl-imx7.o
include/hw/arm/fsl-imx7.h new file +222 -0
222 lines not on this page · raw message
hw/arm/fsl-imx7.c new file +582 -0
582 lines not on this page · raw message
default-configs/arm-softmmu.mak +1 -0
@@ -126,6 +126,7 @@ CONFIG_ALLWINNER_A10=y CONFIG_FSL_IMX6=y CONFIG_FSL_IMX31=y CONFIG_FSL_IMX25=y +CONFIG_FSL_IMX7=y CONFIG_IMX_I2C=y
Signature · 1 line
2.16.2
[Qemu-devel] [PULL 03/25] pci: Add support for Designware IP block
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Add code needed to get a functional PCI subsytem when using in conjunction with upstream Linux guest (4.13+). Tested to work against "e1000e" (network adapter, using MSI interrupts) as well as "usb-ehci" (USB controller, using legacy PCI interrupts).
Based on "i.MX6 Applications Processor Reference Manual" (Document
Number: IMX6DQRM Rev. 4) as well as corresponding dirver in Linux kernel (circa 4.13 - 4.16 found in drivers/pci/dwc/*)
--- hw/pci-host/Makefile.objs | 2 + include/hw/pci-host/designware.h | 102 ++++++ include/hw/pci/pci_ids.h | 2 + hw/pci-host/designware.c | 754 +++++++++++++++++++++++++++++++++++++++ default-configs/arm-softmmu.mak | 1 + 5 files changed, 861 insertions(+) create mode 100644 include/hw/pci-host/designware.h create mode 100644 hw/pci-host/designware.c
hw/pci-host/Makefile.objs +2 -0
@@ -17,3 +17,5 @@ common-obj-$(CONFIG_PCI_PIIX) += piix.o common-obj-$(CONFIG_PCI_Q35) += q35.o common-obj-$(CONFIG_PCI_GENERIC) += gpex.o common-obj-$(CONFIG_PCI_XILINX) += xilinx-pcie.o + +common-obj-$(CONFIG_PCI_DESIGNWARE) += designware.o
include/hw/pci-host/designware.h new file +102 -0
102 lines not on this page · raw message
include/hw/pci/pci_ids.h +2 -0
@@ -269,4 +269,6 @@#define PCI_VENDOR_ID_VMWARE 0x15ad#define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820 +#define PCI_VENDOR_ID_SYNOPSYS 0x16C3 +#endif
hw/pci-host/designware.c new file +754 -0
754 lines not on this page · raw message
default-configs/arm-softmmu.mak +1 -0
@@ -140,3 +140,4 @@ CONFIG_GPIO_KEY=y CONFIG_MSF2=y CONFIG_FW_CFG_DMA=y CONFIG_XILINX_AXI=y +CONFIG_PCI_DESIGNWARE=y
Signature · 1 line
2.16.2
Peter Maydell
AppliedQuoted 32 lines · Peter Maydell
Arm pullreq for the 2.12 codefreeze...
thanks
-- PMMThe following changes since commit
b39b61e410022f96ceb53d4381d25cba5126ac44:memory: fix
flatview_access_validRCU read lock/unlock imbalance (2018-03-09 15:55:20 +0000)are available in the Git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20180309for you to fetch changes up to
076a0fc32a73a9b960e0f73f04a531bc1bd94308:
MAINTAINERS: Add entries for SD (SDHCI, SDBus, SDCard) (2018-03-09 17:09:45 +0000)----------------------------------------------------------------
target-arm queue:
* i.MX: Add i.MX7 SOC implementation and i.MX7 Sabre board
* Report the correct core count in A53 L2CTLR on the ZynqMP board
* linux-user: preliminary SVE support work (signal handling)
* hw/arm/boot: fix memory leak in case of error loading ELF file
* hw/arm/boot: avoid reading off end of buffer if passed very small image file
* hw/arm: Use more CONFIG switches for the object files
* target/arm: Add "-cpu max" support
* hw/arm/virt: Support -machine gic-version=max
* hw/sd: improve debug tracing
* hw/sd: sdcard: Add the Tuning Command (CMD 19)
*MAINTAINERS: add Philippe as odd-fixes maintainer for SD
Quoted 1 line
----------------------------------------------------------------
Applied, thanks.
-- PMM