aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-07-08 14:23:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-07-08 14:23:32 +0100
commitdf34fe314b5da628bc9a2664fb1b887bc0a6cc6d (patch)
treee8ba4903432b7205cc46ee69593869ea78326566
parentc4107e8208d0222f9b328691b519aaee4101db87 (diff)
parent85795187f416326f87177cabc39fae1911f04c50 (diff)
downloadqemu-df34fe314b5da628bc9a2664fb1b887bc0a6cc6d.zip
qemu-df34fe314b5da628bc9a2664fb1b887bc0a6cc6d.tar.gz
qemu-df34fe314b5da628bc9a2664fb1b887bc0a6cc6d.tar.bz2
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190708' into staging
target-arm queue: * tests/migration-test: Fix read off end of aarch64_kernel array * Fix sve_zcr_len_for_el off-by-one error * hw/arm/sbsa-ref: Silence Coverity nit * vfp_helper: Call set_fpscr_to_host before updating to FPSCR # gpg: Signature made Mon 08 Jul 2019 14:21:20 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20190708: target/arm/vfp_helper: Call set_fpscr_to_host before updating to FPSCR hw/arm/sbsa-ref: Remove unnecessary check for secure_sysmem == NULL tests/migration-test: Fix read off end of aarch64_kernel array target/arm: Fix sve_zcr_len_for_el Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/arm/sbsa-ref.c8
-rw-r--r--target/arm/helper.c4
-rw-r--r--target/arm/vfp_helper.c4
-rw-r--r--tests/migration-test.c22
4 files changed, 13 insertions, 25 deletions
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index e8c65e3..9c67d5c 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -254,8 +254,6 @@ static void sbsa_flash_map(SBSAMachineState *sms,
* sysmem is the system memory space. secure_sysmem is the secure view
* of the system, and the first flash device should be made visible only
* there. The second flash device is visible to both secure and nonsecure.
- * If sysmem == secure_sysmem this means there is no separate Secure
- * address space and both flash devices are generally visible.
*/
hwaddr flashsize = sbsa_ref_memmap[SBSA_FLASH].size / 2;
hwaddr flashbase = sbsa_ref_memmap[SBSA_FLASH].base;
@@ -591,7 +589,7 @@ static void sbsa_ref_init(MachineState *machine)
SBSAMachineState *sms = SBSA_MACHINE(machine);
MachineClass *mc = MACHINE_GET_CLASS(machine);
MemoryRegion *sysmem = get_system_memory();
- MemoryRegion *secure_sysmem = NULL;
+ MemoryRegion *secure_sysmem = g_new(MemoryRegion, 1);
MemoryRegion *ram = g_new(MemoryRegion, 1);
bool firmware_loaded;
const CPUArchIdList *possible_cpus;
@@ -615,13 +613,11 @@ static void sbsa_ref_init(MachineState *machine)
* containing the system memory at low priority; any secure-only
* devices go in at higher priority and take precedence.
*/
- secure_sysmem = g_new(MemoryRegion, 1);
memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory",
UINT64_MAX);
memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1);
- firmware_loaded = sbsa_firmware_init(sms, sysmem,
- secure_sysmem ?: sysmem);
+ firmware_loaded = sbsa_firmware_init(sms, sysmem, secure_sysmem);
if (machine->kernel_filename && firmware_loaded) {
error_report("sbsa-ref: No fw_cfg device on this machine, "
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 2df7152..20f8728 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -5283,10 +5283,10 @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el)
if (el <= 1) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1]);
}
- if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) {
+ if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2]);
}
- if (el < 3 && arm_feature(env, ARM_FEATURE_EL3)) {
+ if (arm_feature(env, ARM_FEATURE_EL3)) {
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
}
return zcr_len;
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
index 46041e3..9710ef1 100644
--- a/target/arm/vfp_helper.c
+++ b/target/arm/vfp_helper.c
@@ -197,6 +197,8 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
val &= 0xf7c0009f;
}
+ vfp_set_fpscr_to_host(env, val);
+
/*
* We don't implement trapped exception handling, so the
* trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!)
@@ -217,8 +219,6 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
env->vfp.qc[1] = 0;
env->vfp.qc[2] = 0;
env->vfp.qc[3] = 0;
-
- vfp_set_fpscr_to_host(env, val);
}
void vfp_set_fpscr(CPUARMState *env, uint32_t val)
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 0cd014d..b643462 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -91,23 +91,13 @@ static const char *tmpfs;
*/
#include "tests/migration/i386/a-b-bootblock.h"
#include "tests/migration/aarch64/a-b-kernel.h"
-
-static void init_bootfile(const char *bootpath, void *content)
-{
- FILE *bootfile = fopen(bootpath, "wb");
-
- g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1);
- fclose(bootfile);
-}
-
#include "tests/migration/s390x/a-b-bios.h"
-static void init_bootfile_s390x(const char *bootpath)
+static void init_bootfile(const char *bootpath, void *content, size_t len)
{
FILE *bootfile = fopen(bootpath, "wb");
- size_t len = sizeof(s390x_elf);
- g_assert_cmpint(fwrite(s390x_elf, len, 1, bootfile), ==, 1);
+ g_assert_cmpint(fwrite(content, len, 1, bootfile), ==, 1);
fclose(bootfile);
}
@@ -537,7 +527,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
got_stop = false;
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
- init_bootfile(bootpath, x86_bootsect);
+ /* the assembled x86 boot sector should be exactly one sector large */
+ assert(sizeof(x86_bootsect) == 512);
+ init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect));
extra_opts = use_shmem ? get_shmem_opts("150M", shmem_path) : NULL;
cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
" -name source,debug-threads=on"
@@ -555,7 +547,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
start_address = X86_TEST_MEM_START;
end_address = X86_TEST_MEM_END;
} else if (g_str_equal(arch, "s390x")) {
- init_bootfile_s390x(bootpath);
+ init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf));
extra_opts = use_shmem ? get_shmem_opts("128M", shmem_path) : NULL;
cmd_src = g_strdup_printf("-machine accel=%s -m 128M"
" -name source,debug-threads=on"
@@ -590,7 +582,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
start_address = PPC_TEST_MEM_START;
end_address = PPC_TEST_MEM_END;
} else if (strcmp(arch, "aarch64") == 0) {
- init_bootfile(bootpath, aarch64_kernel);
+ init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel));
extra_opts = use_shmem ? get_shmem_opts("150M", shmem_path) : NULL;
cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=max "
"-name vmsource,debug-threads=on -cpu max "