1 | Target-arm queue... | 1 | The following changes since commit ad1b4ec39caa5b3f17cbd8160283a03a3dcfe2ae: |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | Merge remote-tracking branch 'remotes/kraxel/tags/input-20180515-pull-request' into staging (2018-05-15 12:50:06 +0100) |
4 | -- PMM | ||
5 | 4 | ||
6 | The following changes since commit 735286a4f88255e1463d42ce28d8d14181fd32d4: | 5 | are available in the Git repository at: |
7 | 6 | ||
8 | Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170613' into staging (2017-06-13 13:51:29 +0100) | 7 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180515 |
9 | 8 | ||
10 | are available in the git repository at: | 9 | for you to fetch changes up to ae7651804748c6b479d5ae09aeac4edb9c44f76e: |
11 | 10 | ||
12 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170613 | 11 | tcg: Optionally log FPU state in TCG -d cpu logging (2018-05-15 14:58:44 +0100) |
13 | |||
14 | for you to fetch changes up to 252a7a6a968c279a4636a86b0559ba3a930a90b5: | ||
15 | |||
16 | hw/intc/arm_gicv3_its: Allow save/restore (2017-06-13 14:57:01 +0100) | ||
17 | 12 | ||
18 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
19 | target-arm queue: | 14 | target-arm queue: |
20 | * vITS: Support save/restore | 15 | * Fix coverity nit in int_to_float code |
21 | * timer/aspeed: Fix timer enablement when reload is not set | 16 | * Don't set Invalid for float-to-int(MAXINT) |
22 | * aspped: add temperature sensor device | 17 | * Fix fp_status_f16 tininess before rounding |
23 | * timer.h: Provide better monotonic time on ARM hosts | 18 | * Add various missing insns from the v8.2-FP16 extension |
24 | * exynos4210: various cleanups | 19 | * Fix sqrt_f16 exception raising |
25 | * exynos4210: support system poweroff | 20 | * sdcard: Correct CRC16 offset in sd_function_switch() |
21 | * tcg: Optionally log FPU state in TCG -d cpu logging | ||
26 | 22 | ||
27 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
28 | Cédric Le Goater (3): | 24 | Alex Bennée (5): |
29 | hw/misc: add a TMP42{1, 2, 3} device model | 25 | fpu/softfloat: int_to_float ensure r fully initialised |
30 | aspeed: add a temp sensor device on I2C bus 3 | 26 | target/arm: Implement FCMP for fp16 |
31 | timer/aspeed: fix timer enablement when a reload is not set | 27 | target/arm: Implement FCSEL for fp16 |
28 | target/arm: Implement FMOV (immediate) for fp16 | ||
29 | target/arm: Fix sqrt_f16 exception raising | ||
32 | 30 | ||
33 | Eric Auger (4): | 31 | Peter Maydell (3): |
34 | kvm-all: Pass an error object to kvm_device_access | 32 | fpu/softfloat: Don't set Invalid for float-to-int(MAXINT) |
35 | hw/intc/arm_gicv3_its: Implement state save/restore | 33 | target/arm: Fix fp_status_f16 tininess before rounding |
36 | hw/intc/arm_gicv3_kvm: Implement pending table save | 34 | tcg: Optionally log FPU state in TCG -d cpu logging |
37 | hw/intc/arm_gicv3_its: Allow save/restore | ||
38 | 35 | ||
39 | Krzysztof Kozlowski (9): | 36 | Philippe Mathieu-Daudé (1): |
40 | hw/intc/exynos4210_gic: Use more meaningful name for local variable | 37 | sdcard: Correct CRC16 offset in sd_function_switch() |
41 | hw/timer/exynos4210_mct: Fix checkpatch style errors | ||
42 | hw/timer/exynos4210_mct: Cleanup indentation and empty new lines | ||
43 | hw/timer/exynos4210_mct: Remove unused defines | ||
44 | hw/arm/exynos: Move DRAM initialization next boards | ||
45 | hw/arm/exynos: Declare local variables in some order | ||
46 | hw/arm/exynos: Use type define instead of hard-coded a9mpcore_priv string | ||
47 | hw/intc/exynos4210_gic: Constify array of combiner interrupts | ||
48 | hw/misc/exynos4210_pmu: Add support for system poweroff | ||
49 | 38 | ||
50 | Pranith Kumar (1): | 39 | Richard Henderson (7): |
51 | timer.h: Provide better monotonic time | 40 | target/arm: Implement FMOV (general) for fp16 |
41 | target/arm: Early exit after unallocated_encoding in disas_fp_int_conv | ||
42 | target/arm: Implement FCVT (scalar, integer) for fp16 | ||
43 | target/arm: Implement FCVT (scalar, fixed-point) for fp16 | ||
44 | target/arm: Introduce and use read_fp_hreg | ||
45 | target/arm: Implement FP data-processing (2 source) for fp16 | ||
46 | target/arm: Implement FP data-processing (3 source) for fp16 | ||
52 | 47 | ||
53 | hw/misc/Makefile.objs | 1 + | 48 | include/qemu/log.h | 1 + |
54 | include/hw/arm/exynos4210.h | 5 +- | 49 | target/arm/helper-a64.h | 2 + |
55 | include/hw/intc/arm_gicv3_its_common.h | 8 + | 50 | target/arm/helper.h | 6 + |
56 | include/migration/vmstate.h | 2 + | 51 | accel/tcg/cpu-exec.c | 9 +- |
57 | include/qemu/timer.h | 5 +- | 52 | fpu/softfloat.c | 6 +- |
58 | include/sysemu/kvm.h | 11 +- | 53 | hw/sd/sd.c | 2 +- |
59 | hw/arm/aspeed.c | 9 + | 54 | target/arm/cpu.c | 2 + |
60 | hw/arm/exynos4210.c | 27 +-- | 55 | target/arm/helper-a64.c | 10 ++ |
61 | hw/arm/exynos4_boards.c | 50 +++- | 56 | target/arm/helper.c | 38 +++- |
62 | hw/intc/arm_gic_kvm.c | 9 +- | 57 | target/arm/translate-a64.c | 421 ++++++++++++++++++++++++++++++++++++++------- |
63 | hw/intc/arm_gicv3_common.c | 1 + | 58 | util/log.c | 2 + |
64 | hw/intc/arm_gicv3_its_common.c | 12 +- | 59 | 11 files changed, 428 insertions(+), 71 deletions(-) |
65 | hw/intc/arm_gicv3_its_kvm.c | 131 +++++++++-- | ||
66 | hw/intc/arm_gicv3_kvm.c | 48 +++- | ||
67 | hw/intc/exynos4210_gic.c | 14 +- | ||
68 | hw/misc/exynos4210_pmu.c | 20 +- | ||
69 | hw/misc/tmp421.c | 402 +++++++++++++++++++++++++++++++++ | ||
70 | hw/timer/aspeed_timer.c | 37 ++- | ||
71 | hw/timer/exynos4210_mct.c | 50 ++-- | ||
72 | kvm-all.c | 14 +- | ||
73 | default-configs/arm-softmmu.mak | 1 + | ||
74 | 21 files changed, 741 insertions(+), 116 deletions(-) | ||
75 | create mode 100644 hw/misc/tmp421.c | ||
76 | 60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | ||
2 | 1 | ||
3 | There are to SysBusDevice variables in exynos4210_gic_realize() | ||
4 | function: one for the device itself and second for arm_gic device. Add | ||
5 | a prefix "gic" to the second one so it will be easier to understand the | ||
6 | code. | ||
7 | |||
8 | While at it, put local uninitialized 'i' variable at the end, next to | ||
9 | other uninitialized ones. | ||
10 | |||
11 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/intc/exynos4210_gic.c | 12 ++++++------ | ||
17 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
18 | |||
19 | diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/intc/exynos4210_gic.c | ||
22 | +++ b/hw/intc/exynos4210_gic.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_init(Object *obj) | ||
24 | DeviceState *dev = DEVICE(obj); | ||
25 | Exynos4210GicState *s = EXYNOS4210_GIC(obj); | ||
26 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
27 | - uint32_t i; | ||
28 | const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; | ||
29 | const char dist_prefix[] = "exynos4210-gic-alias_dist"; | ||
30 | char cpu_alias_name[sizeof(cpu_prefix) + 3]; | ||
31 | char dist_alias_name[sizeof(cpu_prefix) + 3]; | ||
32 | - SysBusDevice *busdev; | ||
33 | + SysBusDevice *gicbusdev; | ||
34 | + uint32_t i; | ||
35 | |||
36 | s->gic = qdev_create(NULL, "arm_gic"); | ||
37 | qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu); | ||
38 | qdev_prop_set_uint32(s->gic, "num-irq", EXYNOS4210_GIC_NIRQ); | ||
39 | qdev_init_nofail(s->gic); | ||
40 | - busdev = SYS_BUS_DEVICE(s->gic); | ||
41 | + gicbusdev = SYS_BUS_DEVICE(s->gic); | ||
42 | |||
43 | /* Pass through outbound IRQ lines from the GIC */ | ||
44 | - sysbus_pass_irq(sbd, busdev); | ||
45 | + sysbus_pass_irq(sbd, gicbusdev); | ||
46 | |||
47 | /* Pass through inbound GPIO lines to the GIC */ | ||
48 | qdev_init_gpio_in(dev, exynos4210_gic_set_irq, | ||
49 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_init(Object *obj) | ||
50 | sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); | ||
51 | memory_region_init_alias(&s->cpu_alias[i], obj, | ||
52 | cpu_alias_name, | ||
53 | - sysbus_mmio_get_region(busdev, 1), | ||
54 | + sysbus_mmio_get_region(gicbusdev, 1), | ||
55 | 0, | ||
56 | EXYNOS4210_GIC_CPU_REGION_SIZE); | ||
57 | memory_region_add_subregion(&s->cpu_container, | ||
58 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_init(Object *obj) | ||
59 | sprintf(dist_alias_name, "%s%x", dist_prefix, i); | ||
60 | memory_region_init_alias(&s->dist_alias[i], obj, | ||
61 | dist_alias_name, | ||
62 | - sysbus_mmio_get_region(busdev, 0), | ||
63 | + sysbus_mmio_get_region(gicbusdev, 0), | ||
64 | 0, | ||
65 | EXYNOS4210_GIC_DIST_REGION_SIZE); | ||
66 | memory_region_add_subregion(&s->dist_container, | ||
67 | -- | ||
68 | 2.7.4 | ||
69 | |||
70 | diff view generated by jsdifflib |
1 | From: Pranith Kumar <bobby.prani@gmail.com> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Tested and confirmed that the stretch i386 debian qcow2 image on a | 3 | Reported by Coverity (CID1390635). We ensure this for uint_to_float |
4 | raspberry pi 2 works. | 4 | later on so we might as well mirror that. |
5 | 5 | ||
6 | Fixes: LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/> | 6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20170418191817.10430-1-bobby.prani@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | include/qemu/timer.h | 5 ++--- | 11 | fpu/softfloat.c | 2 +- |
13 | 1 file changed, 2 insertions(+), 3 deletions(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 13 | ||
15 | diff --git a/include/qemu/timer.h b/include/qemu/timer.h | 14 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/qemu/timer.h | 16 | --- a/fpu/softfloat.c |
18 | +++ b/include/qemu/timer.h | 17 | +++ b/fpu/softfloat.c |
19 | @@ -XXX,XX +XXX,XX @@ static inline int64_t cpu_get_host_ticks(void) | 18 | @@ -XXX,XX +XXX,XX @@ FLOAT_TO_UINT(64, 64) |
20 | /* The host CPU doesn't have an easily accessible cycle counter. | 19 | |
21 | Just return a monotonically increasing value. This will be | 20 | static FloatParts int_to_float(int64_t a, float_status *status) |
22 | totally wrong, but hopefully better than nothing. */ | ||
23 | -static inline int64_t cpu_get_host_ticks (void) | ||
24 | +static inline int64_t cpu_get_host_ticks(void) | ||
25 | { | 21 | { |
26 | - static int64_t ticks = 0; | 22 | - FloatParts r; |
27 | - return ticks++; | 23 | + FloatParts r = {}; |
28 | + return get_clock(); | 24 | if (a == 0) { |
29 | } | 25 | r.cls = float_class_zero; |
30 | #endif | 26 | r.sign = false; |
31 | |||
32 | -- | 27 | -- |
33 | 2.7.4 | 28 | 2.17.0 |
34 | 29 | ||
35 | 30 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | In float-to-integer conversion, if the floating point input |
---|---|---|---|
2 | converts exactly to the largest or smallest integer that | ||
3 | fits in to the result type, this is not an overflow. | ||
4 | In this situation we were producing the correct result value, | ||
5 | but were incorrectly setting the Invalid flag. | ||
6 | For example for Arm A64, "FCVTAS w0, d0" on an input of | ||
7 | 0x41dfffffffc00000 should produce 0x7fffffff and set no flags. | ||
2 | 8 | ||
3 | Bring some more readability by declaring local function variables: first | 9 | Fix the boundary case to take the right half of the if() |
4 | initialized ones and then the rest (with reversed-christmas-tree order). | 10 | statements. |
5 | 11 | ||
6 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 12 | This fixes a regression from 2.11 introduced by the softfloat |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 13 | refactoring. |
14 | |||
15 | Cc: qemu-stable@nongnu.org | ||
16 | Fixes: ab52f973a50 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Message-id: 20180510140141.12120-1-peter.maydell@linaro.org | ||
9 | --- | 20 | --- |
10 | hw/arm/exynos4210.c | 4 ++-- | 21 | fpu/softfloat.c | 4 ++-- |
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | 22 | 1 file changed, 2 insertions(+), 2 deletions(-) |
12 | 23 | ||
13 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 24 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c |
14 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/exynos4210.c | 26 | --- a/fpu/softfloat.c |
16 | +++ b/hw/arm/exynos4210.c | 27 | +++ b/fpu/softfloat.c |
17 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu) | 28 | @@ -XXX,XX +XXX,XX @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode, |
18 | 29 | r = UINT64_MAX; | |
19 | Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 30 | } |
20 | { | 31 | if (p.sign) { |
21 | - int i, n; | 32 | - if (r < -(uint64_t) min) { |
22 | Exynos4210State *s = g_new(Exynos4210State, 1); | 33 | + if (r <= -(uint64_t) min) { |
23 | qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; | 34 | return -r; |
24 | - DeviceState *dev; | 35 | } else { |
25 | SysBusDevice *busdev; | 36 | s->float_exception_flags = orig_flags | float_flag_invalid; |
26 | ObjectClass *cpu_oc; | 37 | return min; |
27 | + DeviceState *dev; | 38 | } |
28 | + int i, n; | 39 | } else { |
29 | 40 | - if (r < max) { | |
30 | cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, "cortex-a9"); | 41 | + if (r <= max) { |
31 | assert(cpu_oc); | 42 | return r; |
43 | } else { | ||
44 | s->float_exception_flags = orig_flags | float_flag_invalid; | ||
32 | -- | 45 | -- |
33 | 2.7.4 | 46 | 2.17.0 |
34 | 47 | ||
35 | 48 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | In commit d81ce0ef2c4f105 we added an extra float_status field |
---|---|---|---|
2 | fp_status_fp16 for Arm, but forgot to initialize it correctly | ||
3 | by setting it to float_tininess_before_rounding. This currently | ||
4 | will only cause problems for the new V8_FP16 feature, since the | ||
5 | float-to-float conversion code doesn't use it yet. The effect | ||
6 | would be that we failed to set the Underflow IEEE exception flag | ||
7 | in all the cases where we should. | ||
2 | 8 | ||
3 | Temperatures can be changed from the monitor with : | 9 | Add the missing initialization. |
4 | 10 | ||
5 | (qemu) qom-set /machine/unattached/device[2] temperature0 12000 | 11 | Fixes: d81ce0ef2c4f105 |
12 | Cc: qemu-stable@nongnu.org | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Message-id: 20180512004311.9299-16-richard.henderson@linaro.org | ||
17 | --- | ||
18 | target/arm/cpu.c | 2 ++ | ||
19 | 1 file changed, 2 insertions(+) | ||
6 | 20 | ||
7 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 21 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
8 | Message-id: 1496739230-32109-3-git-send-email-clg@kaod.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/aspeed.c | 9 +++++++++ | ||
13 | 1 file changed, 9 insertions(+) | ||
14 | |||
15 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/aspeed.c | 23 | --- a/target/arm/cpu.c |
18 | +++ b/hw/arm/aspeed.c | 24 | +++ b/target/arm/cpu.c |
19 | @@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine, | 25 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) |
20 | static void palmetto_bmc_i2c_init(AspeedBoardState *bmc) | 26 | &env->vfp.fp_status); |
21 | { | 27 | set_float_detect_tininess(float_tininess_before_rounding, |
22 | AspeedSoCState *soc = &bmc->soc; | 28 | &env->vfp.standard_fp_status); |
23 | + DeviceState *dev; | 29 | + set_float_detect_tininess(float_tininess_before_rounding, |
24 | 30 | + &env->vfp.fp_status_f16); | |
25 | /* The palmetto platform expects a ds3231 RTC but a ds1338 is | 31 | #ifndef CONFIG_USER_ONLY |
26 | * enough to provide basic RTC features. Alarms will be missing */ | 32 | if (kvm_enabled()) { |
27 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68); | 33 | kvm_arm_reset_vcpu(cpu); |
28 | + | ||
29 | + /* add a TMP423 temperature sensor */ | ||
30 | + dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2), | ||
31 | + "tmp423", 0x4c); | ||
32 | + object_property_set_int(OBJECT(dev), 31000, "temperature0", &error_abort); | ||
33 | + object_property_set_int(OBJECT(dev), 28000, "temperature1", &error_abort); | ||
34 | + object_property_set_int(OBJECT(dev), 20000, "temperature2", &error_abort); | ||
35 | + object_property_set_int(OBJECT(dev), 110000, "temperature3", &error_abort); | ||
36 | } | ||
37 | |||
38 | static void palmetto_bmc_init(MachineState *machine) | ||
39 | -- | 34 | -- |
40 | 2.7.4 | 35 | 2.17.0 |
41 | 36 | ||
42 | 37 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Remove defines not used anywhere. | 3 | Adding the fp16 moves to/from general registers. |
4 | 4 | ||
5 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 5 | Cc: qemu-stable@nongnu.org |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Message-id: 20180512003217.9105-2-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 11 | --- |
9 | hw/timer/exynos4210_mct.c | 3 --- | 12 | target/arm/translate-a64.c | 21 +++++++++++++++++++++ |
10 | 1 file changed, 3 deletions(-) | 13 | 1 file changed, 21 insertions(+) |
11 | 14 | ||
12 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/timer/exynos4210_mct.c | 17 | --- a/target/arm/translate-a64.c |
15 | +++ b/hw/timer/exynos4210_mct.c | 18 | +++ b/target/arm/translate-a64.c |
16 | @@ -XXX,XX +XXX,XX @@ enum LocalTimerRegCntIndexes { | 19 | @@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) |
17 | L_REG_CNT_AMOUNT | 20 | tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd)); |
18 | }; | 21 | clear_vec_high(s, true, rd); |
19 | 22 | break; | |
20 | -#define MCT_NIRQ 6 | 23 | + case 3: |
21 | #define MCT_SFR_SIZE 0x444 | 24 | + /* 16 bit */ |
22 | 25 | + tmp = tcg_temp_new_i64(); | |
23 | #define MCT_GT_CMP_NUM 4 | 26 | + tcg_gen_ext16u_i64(tmp, tcg_rn); |
24 | 27 | + write_fp_dreg(s, rd, tmp); | |
25 | -#define MCT_GT_MAX_VAL UINT64_MAX | 28 | + tcg_temp_free_i64(tmp); |
26 | - | 29 | + break; |
27 | #define MCT_GT_COUNTER_STEP 0x100000000ULL | 30 | + default: |
28 | #define MCT_LT_COUNTER_STEP 0x100000000ULL | 31 | + g_assert_not_reached(); |
29 | #define MCT_LT_CNT_LOW_LIMIT 0x100 | 32 | } |
33 | } else { | ||
34 | TCGv_i64 tcg_rd = cpu_reg(s, rd); | ||
35 | @@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) | ||
36 | /* 64 bits from top half */ | ||
37 | tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn)); | ||
38 | break; | ||
39 | + case 3: | ||
40 | + /* 16 bit */ | ||
41 | + tcg_gen_ld16u_i64(tcg_rd, cpu_env, fp_reg_offset(s, rn, MO_16)); | ||
42 | + break; | ||
43 | + default: | ||
44 | + g_assert_not_reached(); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) | ||
49 | case 0xa: /* 64 bit */ | ||
50 | case 0xd: /* 64 bit to top half of quad */ | ||
51 | break; | ||
52 | + case 0x6: /* 16-bit float, 32-bit int */ | ||
53 | + case 0xe: /* 16-bit float, 64-bit int */ | ||
54 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { | ||
55 | + break; | ||
56 | + } | ||
57 | + /* fallthru */ | ||
58 | default: | ||
59 | /* all other sf/type/rmode combinations are invalid */ | ||
60 | unallocated_encoding(s); | ||
30 | -- | 61 | -- |
31 | 2.7.4 | 62 | 2.17.0 |
32 | 63 | ||
33 | 64 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The static array of interrupt combiner mappings is not modified so it | 3 | No sense in emitting code after the exception. |
4 | can be made const for code safeness. | ||
5 | 4 | ||
6 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Tested-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Message-id: 20180512003217.9105-3-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | hw/intc/exynos4210_gic.c | 2 +- | 11 | target/arm/translate-a64.c | 2 +- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 13 | ||
13 | diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c | 14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/intc/exynos4210_gic.c | 16 | --- a/target/arm/translate-a64.c |
16 | +++ b/hw/intc/exynos4210_gic.c | 17 | +++ b/target/arm/translate-a64.c |
17 | @@ -XXX,XX +XXX,XX @@ enum ExtInt { | 18 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) |
18 | * which is INTG16 in Internal Interrupt Combiner. | 19 | default: |
19 | */ | 20 | /* all other sf/type/rmode combinations are invalid */ |
20 | 21 | unallocated_encoding(s); | |
21 | -static uint32_t | 22 | - break; |
22 | +static const uint32_t | 23 | + return; |
23 | combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | 24 | } |
24 | /* int combiner groups 16-19 */ | 25 | |
25 | { }, { }, { }, { }, | 26 | if (!fp_access_check(s)) { |
26 | -- | 27 | -- |
27 | 2.7.4 | 28 | 2.17.0 |
28 | 29 | ||
29 | 30 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | On all Exynos-based boards, the system powers down itself by driving | 3 | Cc: qemu-stable@nongnu.org |
4 | PS_HOLD signal low - eight bit in PS_HOLD_CONTROL register of PMU. | 4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
5 | Handle writing to respective PMU register to fix power off failure: | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | 6 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | |
7 | reboot: Power down | 7 | Message-id: 20180512003217.9105-4-richard.henderson@linaro.org |
8 | Unable to poweroff system | ||
9 | shutdown: 31 output lines suppressed due to ratelimiting | ||
10 | Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 | ||
11 | |||
12 | CPU: 0 PID: 1 Comm: shutdown Not tainted 4.11.0-rc8 #846 | ||
13 | Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) | ||
14 | [<c031050c>] (unwind_backtrace) from [<c030ba6c>] (show_stack+0x10/0x14) | ||
15 | [<c030ba6c>] (show_stack) from [<c05b2800>] (dump_stack+0x88/0x9c) | ||
16 | [<c05b2800>] (dump_stack) from [<c03d3140>] (panic+0xdc/0x268) | ||
17 | [<c03d3140>] (panic) from [<c0343614>] (do_exit+0xa90/0xab4) | ||
18 | [<c0343614>] (do_exit) from [<c035f2dc>] (SyS_reboot+0x164/0x1d0) | ||
19 | [<c035f2dc>] (SyS_reboot) from [<c0307c80>] (ret_fast_syscall+0x0/0x3c) | ||
20 | |||
21 | Additionally the initial value of PS_HOLD has to be changed because | ||
22 | recent Linux kernel (v4.12-rc1) uses regmap cache for this access. | ||
23 | When the register is kept at reset value, the kernel will not issue a | ||
24 | write to it. Usually the bootloader sets the eight bit of PS_HOLD high | ||
25 | so mimic its existence here. | ||
26 | |||
27 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | ||
28 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
31 | --- | 9 | --- |
32 | hw/misc/exynos4210_pmu.c | 20 +++++++++++++++++++- | 10 | target/arm/helper.h | 6 +++ |
33 | 1 file changed, 19 insertions(+), 1 deletion(-) | 11 | target/arm/helper.c | 38 ++++++++++++++- |
34 | 12 | target/arm/translate-a64.c | 96 +++++++++++++++++++++++++++++++------- | |
35 | diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c | 13 | 3 files changed, 122 insertions(+), 18 deletions(-) |
14 | |||
15 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
36 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/hw/misc/exynos4210_pmu.c | 17 | --- a/target/arm/helper.h |
38 | +++ b/hw/misc/exynos4210_pmu.c | 18 | +++ b/target/arm/helper.h |
39 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr) |
40 | 20 | DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr) | |
41 | #include "qemu/osdep.h" | 21 | DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr) |
42 | #include "hw/sysbus.h" | 22 | DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr) |
43 | +#include "sysemu/sysemu.h" | 23 | +DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr) |
44 | 24 | +DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr) | |
45 | #ifndef DEBUG_PMU | 25 | +DEF_HELPER_3(vfp_touqh, i64, f16, i32, ptr) |
46 | #define DEBUG_PMU 0 | 26 | +DEF_HELPER_3(vfp_tosqh, i64, f16, i32, ptr) |
47 | @@ -XXX,XX +XXX,XX @@ static const Exynos4210PmuReg exynos4210_pmu_regs[] = { | 27 | DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr) |
48 | {"PAD_RETENTION_MMCB_OPTION", PAD_RETENTION_MMCB_OPTION, 0x00000000}, | 28 | DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr) |
49 | {"PAD_RETENTION_EBIA_OPTION", PAD_RETENTION_EBIA_OPTION, 0x00000000}, | 29 | DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr) |
50 | {"PAD_RETENTION_EBIB_OPTION", PAD_RETENTION_EBIB_OPTION, 0x00000000}, | 30 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr) |
51 | - {"PS_HOLD_CONTROL", PS_HOLD_CONTROL, 0x00005200}, | 31 | DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr) |
52 | + /* | 32 | DEF_HELPER_3(vfp_sltoh, f16, i32, i32, ptr) |
53 | + * PS_HOLD_CONTROL: reset value and manually toggle high the DATA bit. | 33 | DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr) |
54 | + * DATA bit high, set usually by bootloader, keeps system on. | 34 | +DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr) |
55 | + */ | 35 | +DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr) |
56 | + {"PS_HOLD_CONTROL", PS_HOLD_CONTROL, 0x00005200 | BIT(8)}, | 36 | |
57 | {"XUSBXTI_CONFIGURATION", XUSBXTI_CONFIGURATION, 0x00000001}, | 37 | DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr) |
58 | {"XUSBXTI_STATUS", XUSBXTI_STATUS, 0x00000001}, | 38 | DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env) |
59 | {"XUSBXTI_DURATION", XUSBXTI_DURATION, 0xFFF00000}, | 39 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
60 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210PmuState { | 40 | index XXXXXXX..XXXXXXX 100644 |
61 | uint32_t reg[PMU_NUM_OF_REGISTERS]; | 41 | --- a/target/arm/helper.c |
62 | } Exynos4210PmuState; | 42 | +++ b/target/arm/helper.c |
63 | 43 | @@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64) | |
64 | +static void exynos4210_pmu_poweroff(void) | 44 | #undef VFP_CONV_FIX_A64 |
65 | +{ | 45 | |
66 | + PRINT_DEBUG("QEMU PMU: PS_HOLD bit down, powering off\n"); | 46 | /* Conversion to/from f16 can overflow to infinity before/after scaling. |
67 | + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | 47 | - * Therefore we convert to f64 (which does not round), scale, |
68 | +} | 48 | - * and then convert f64 to f16 (which may round). |
69 | + | 49 | + * Therefore we convert to f64, scale, and then convert f64 to f16; or |
70 | static uint64_t exynos4210_pmu_read(void *opaque, hwaddr offset, | 50 | + * vice versa for conversion to integer. |
71 | unsigned size) | 51 | + * |
52 | + * For 16- and 32-bit integers, the conversion to f64 never rounds. | ||
53 | + * For 64-bit integers, any integer that would cause rounding will also | ||
54 | + * overflow to f16 infinity, so there is no double rounding problem. | ||
55 | */ | ||
56 | |||
57 | static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) | ||
58 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | ||
59 | return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); | ||
60 | } | ||
61 | |||
62 | +float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
63 | +{ | ||
64 | + return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst); | ||
65 | +} | ||
66 | + | ||
67 | +float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
68 | +{ | ||
69 | + return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst); | ||
70 | +} | ||
71 | + | ||
72 | static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst) | ||
72 | { | 73 | { |
73 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pmu_write(void *opaque, hwaddr offset, | 74 | if (unlikely(float16_is_any_nan(f))) { |
74 | PRINT_DEBUG_EXTEND("%s <0x%04x> <- 0x%04x\n", reg_p->name, | 75 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst) |
75 | (uint32_t)offset, (uint32_t)val); | 76 | return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); |
76 | s->reg[i] = val; | 77 | } |
77 | + if ((offset == PS_HOLD_CONTROL) && ((val & BIT(8)) == 0)) { | 78 | |
78 | + /* | 79 | +uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst) |
79 | + * We are interested only in setting data bit | 80 | +{ |
80 | + * of PS_HOLD_CONTROL register to indicate power off request. | 81 | + return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst); |
81 | + */ | 82 | +} |
82 | + exynos4210_pmu_poweroff(); | 83 | + |
83 | + } | 84 | +uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst) |
85 | +{ | ||
86 | + return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst); | ||
87 | +} | ||
88 | + | ||
89 | +uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst) | ||
90 | +{ | ||
91 | + return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst); | ||
92 | +} | ||
93 | + | ||
94 | +uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst) | ||
95 | +{ | ||
96 | + return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst); | ||
97 | +} | ||
98 | + | ||
99 | /* Set the current fp rounding mode and return the old one. | ||
100 | * The argument is a softfloat float_round_ value. | ||
101 | */ | ||
102 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/target/arm/translate-a64.c | ||
105 | +++ b/target/arm/translate-a64.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
107 | bool itof, int rmode, int scale, int sf, int type) | ||
108 | { | ||
109 | bool is_signed = !(opcode & 1); | ||
110 | - bool is_double = type; | ||
111 | TCGv_ptr tcg_fpstatus; | ||
112 | - TCGv_i32 tcg_shift; | ||
113 | + TCGv_i32 tcg_shift, tcg_single; | ||
114 | + TCGv_i64 tcg_double; | ||
115 | |||
116 | - tcg_fpstatus = get_fpstatus_ptr(false); | ||
117 | + tcg_fpstatus = get_fpstatus_ptr(type == 3); | ||
118 | |||
119 | tcg_shift = tcg_const_i32(64 - scale); | ||
120 | |||
121 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
122 | tcg_int = tcg_extend; | ||
123 | } | ||
124 | |||
125 | - if (is_double) { | ||
126 | - TCGv_i64 tcg_double = tcg_temp_new_i64(); | ||
127 | + switch (type) { | ||
128 | + case 1: /* float64 */ | ||
129 | + tcg_double = tcg_temp_new_i64(); | ||
130 | if (is_signed) { | ||
131 | gen_helper_vfp_sqtod(tcg_double, tcg_int, | ||
132 | tcg_shift, tcg_fpstatus); | ||
133 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
134 | } | ||
135 | write_fp_dreg(s, rd, tcg_double); | ||
136 | tcg_temp_free_i64(tcg_double); | ||
137 | - } else { | ||
138 | - TCGv_i32 tcg_single = tcg_temp_new_i32(); | ||
139 | + break; | ||
140 | + | ||
141 | + case 0: /* float32 */ | ||
142 | + tcg_single = tcg_temp_new_i32(); | ||
143 | if (is_signed) { | ||
144 | gen_helper_vfp_sqtos(tcg_single, tcg_int, | ||
145 | tcg_shift, tcg_fpstatus); | ||
146 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
147 | } | ||
148 | write_fp_sreg(s, rd, tcg_single); | ||
149 | tcg_temp_free_i32(tcg_single); | ||
150 | + break; | ||
151 | + | ||
152 | + case 3: /* float16 */ | ||
153 | + tcg_single = tcg_temp_new_i32(); | ||
154 | + if (is_signed) { | ||
155 | + gen_helper_vfp_sqtoh(tcg_single, tcg_int, | ||
156 | + tcg_shift, tcg_fpstatus); | ||
157 | + } else { | ||
158 | + gen_helper_vfp_uqtoh(tcg_single, tcg_int, | ||
159 | + tcg_shift, tcg_fpstatus); | ||
160 | + } | ||
161 | + write_fp_sreg(s, rd, tcg_single); | ||
162 | + tcg_temp_free_i32(tcg_single); | ||
163 | + break; | ||
164 | + | ||
165 | + default: | ||
166 | + g_assert_not_reached(); | ||
167 | } | ||
168 | } else { | ||
169 | TCGv_i64 tcg_int = cpu_reg(s, rd); | ||
170 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
171 | |||
172 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); | ||
173 | |||
174 | - if (is_double) { | ||
175 | - TCGv_i64 tcg_double = read_fp_dreg(s, rn); | ||
176 | + switch (type) { | ||
177 | + case 1: /* float64 */ | ||
178 | + tcg_double = read_fp_dreg(s, rn); | ||
179 | if (is_signed) { | ||
180 | if (!sf) { | ||
181 | gen_helper_vfp_tosld(tcg_int, tcg_double, | ||
182 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
183 | tcg_shift, tcg_fpstatus); | ||
184 | } | ||
185 | } | ||
186 | + if (!sf) { | ||
187 | + tcg_gen_ext32u_i64(tcg_int, tcg_int); | ||
188 | + } | ||
189 | tcg_temp_free_i64(tcg_double); | ||
190 | - } else { | ||
191 | - TCGv_i32 tcg_single = read_fp_sreg(s, rn); | ||
192 | + break; | ||
193 | + | ||
194 | + case 0: /* float32 */ | ||
195 | + tcg_single = read_fp_sreg(s, rn); | ||
196 | if (sf) { | ||
197 | if (is_signed) { | ||
198 | gen_helper_vfp_tosqs(tcg_int, tcg_single, | ||
199 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
200 | tcg_temp_free_i32(tcg_dest); | ||
201 | } | ||
202 | tcg_temp_free_i32(tcg_single); | ||
203 | + break; | ||
204 | + | ||
205 | + case 3: /* float16 */ | ||
206 | + tcg_single = read_fp_sreg(s, rn); | ||
207 | + if (sf) { | ||
208 | + if (is_signed) { | ||
209 | + gen_helper_vfp_tosqh(tcg_int, tcg_single, | ||
210 | + tcg_shift, tcg_fpstatus); | ||
211 | + } else { | ||
212 | + gen_helper_vfp_touqh(tcg_int, tcg_single, | ||
213 | + tcg_shift, tcg_fpstatus); | ||
214 | + } | ||
215 | + } else { | ||
216 | + TCGv_i32 tcg_dest = tcg_temp_new_i32(); | ||
217 | + if (is_signed) { | ||
218 | + gen_helper_vfp_toslh(tcg_dest, tcg_single, | ||
219 | + tcg_shift, tcg_fpstatus); | ||
220 | + } else { | ||
221 | + gen_helper_vfp_toulh(tcg_dest, tcg_single, | ||
222 | + tcg_shift, tcg_fpstatus); | ||
223 | + } | ||
224 | + tcg_gen_extu_i32_i64(tcg_int, tcg_dest); | ||
225 | + tcg_temp_free_i32(tcg_dest); | ||
226 | + } | ||
227 | + tcg_temp_free_i32(tcg_single); | ||
228 | + break; | ||
229 | + | ||
230 | + default: | ||
231 | + g_assert_not_reached(); | ||
232 | } | ||
233 | |||
234 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); | ||
235 | tcg_temp_free_i32(tcg_rmode); | ||
236 | - | ||
237 | - if (!sf) { | ||
238 | - tcg_gen_ext32u_i64(tcg_int, tcg_int); | ||
239 | - } | ||
240 | } | ||
241 | |||
242 | tcg_temp_free_ptr(tcg_fpstatus); | ||
243 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) | ||
244 | /* actual FP conversions */ | ||
245 | bool itof = extract32(opcode, 1, 1); | ||
246 | |||
247 | - if (type > 1 || (rmode != 0 && opcode > 1)) { | ||
248 | + if (rmode != 0 && opcode > 1) { | ||
249 | + unallocated_encoding(s); | ||
250 | + return; | ||
251 | + } | ||
252 | + switch (type) { | ||
253 | + case 0: /* float32 */ | ||
254 | + case 1: /* float64 */ | ||
255 | + break; | ||
256 | + case 3: /* float16 */ | ||
257 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { | ||
258 | + break; | ||
259 | + } | ||
260 | + /* fallthru */ | ||
261 | + default: | ||
262 | unallocated_encoding(s); | ||
84 | return; | 263 | return; |
85 | } | 264 | } |
86 | reg_p++; | ||
87 | -- | 265 | -- |
88 | 2.7.4 | 266 | 2.17.0 |
89 | 267 | ||
90 | 268 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We change the restoration priority of both the GICv3 and ITS. The | 3 | Cc: qemu-stable@nongnu.org |
4 | GICv3 must be restored before the ITS and the ITS needs to be restored | 4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
5 | before PCIe devices since it translates their MSI transactions. | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | 6 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | |
7 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 7 | Message-id: 20180512003217.9105-5-richard.henderson@linaro.org |
8 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
9 | Message-id: 1497023553-18411-5-git-send-email-eric.auger@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | include/migration/vmstate.h | 2 ++ | 10 | target/arm/translate-a64.c | 17 +++++++++++++++-- |
13 | hw/intc/arm_gicv3_common.c | 1 + | 11 | 1 file changed, 15 insertions(+), 2 deletions(-) |
14 | hw/intc/arm_gicv3_its_common.c | 2 +- | ||
15 | hw/intc/arm_gicv3_its_kvm.c | 24 ++++++++++++------------ | ||
16 | 4 files changed, 16 insertions(+), 13 deletions(-) | ||
17 | 12 | ||
18 | diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
19 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/migration/vmstate.h | 15 | --- a/target/arm/translate-a64.c |
21 | +++ b/include/migration/vmstate.h | 16 | +++ b/target/arm/translate-a64.c |
22 | @@ -XXX,XX +XXX,XX @@ enum VMStateFlags { | 17 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn) |
23 | typedef enum { | 18 | bool sf = extract32(insn, 31, 1); |
24 | MIG_PRI_DEFAULT = 0, | 19 | bool itof; |
25 | MIG_PRI_IOMMU, /* Must happen before PCI devices */ | 20 | |
26 | + MIG_PRI_GICV3_ITS, /* Must happen before PCI devices */ | 21 | - if (sbit || (type > 1) |
27 | + MIG_PRI_GICV3, /* Must happen before the ITS */ | 22 | - || (!sf && scale < 32)) { |
28 | MIG_PRI_MAX, | 23 | + if (sbit || (!sf && scale < 32)) { |
29 | } MigrationPriority; | 24 | + unallocated_encoding(s); |
30 | 25 | + return; | |
31 | diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/intc/arm_gicv3_common.c | ||
34 | +++ b/hw/intc/arm_gicv3_common.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_gicv3 = { | ||
36 | .minimum_version_id = 1, | ||
37 | .pre_save = gicv3_pre_save, | ||
38 | .post_load = gicv3_post_load, | ||
39 | + .priority = MIG_PRI_GICV3, | ||
40 | .fields = (VMStateField[]) { | ||
41 | VMSTATE_UINT32(gicd_ctlr, GICv3State), | ||
42 | VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2), | ||
43 | diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/hw/intc/arm_gicv3_its_common.c | ||
46 | +++ b/hw/intc/arm_gicv3_its_common.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_its = { | ||
48 | .name = "arm_gicv3_its", | ||
49 | .pre_save = gicv3_its_pre_save, | ||
50 | .post_load = gicv3_its_post_load, | ||
51 | - .unmigratable = true, | ||
52 | + .priority = MIG_PRI_GICV3_ITS, | ||
53 | .fields = (VMStateField[]) { | ||
54 | VMSTATE_UINT32(ctlr, GICv3ITSState), | ||
55 | VMSTATE_UINT32(iidr, GICv3ITSState), | ||
56 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/intc/arm_gicv3_its_kvm.c | ||
59 | +++ b/hw/intc/arm_gicv3_its_kvm.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | ||
61 | GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev); | ||
62 | Error *local_err = NULL; | ||
63 | |||
64 | - /* | ||
65 | - * Block migration of a KVM GICv3 ITS device: the API for saving and | ||
66 | - * restoring the state in the kernel is not yet available | ||
67 | - */ | ||
68 | - error_setg(&s->migration_blocker, "vITS migration is not implemented"); | ||
69 | - migrate_add_blocker(s->migration_blocker, &local_err); | ||
70 | - if (local_err) { | ||
71 | - error_propagate(errp, local_err); | ||
72 | - error_free(s->migration_blocker); | ||
73 | - return; | ||
74 | - } | ||
75 | - | ||
76 | s->dev_fd = kvm_create_device(kvm_state, KVM_DEV_TYPE_ARM_VGIC_ITS, false); | ||
77 | if (s->dev_fd < 0) { | ||
78 | error_setg_errno(errp, -s->dev_fd, "error creating in-kernel ITS"); | ||
79 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | ||
80 | |||
81 | gicv3_its_init_mmio(s, NULL); | ||
82 | |||
83 | + if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
84 | + GITS_CTLR)) { | ||
85 | + error_setg(&s->migration_blocker, "This operating system kernel " | ||
86 | + "does not support vITS migration"); | ||
87 | + migrate_add_blocker(s->migration_blocker, &local_err); | ||
88 | + if (local_err) { | ||
89 | + error_propagate(errp, local_err); | ||
90 | + error_free(s->migration_blocker); | ||
91 | + return; | ||
92 | + } | ||
93 | + } | 26 | + } |
94 | + | 27 | + |
95 | kvm_msi_use_devid = true; | 28 | + switch (type) { |
96 | kvm_gsi_direct_mapping = false; | 29 | + case 0: /* float32 */ |
97 | kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled(); | 30 | + case 1: /* float64 */ |
31 | + break; | ||
32 | + case 3: /* float16 */ | ||
33 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { | ||
34 | + break; | ||
35 | + } | ||
36 | + /* fallthru */ | ||
37 | + default: | ||
38 | unallocated_encoding(s); | ||
39 | return; | ||
40 | } | ||
98 | -- | 41 | -- |
99 | 2.7.4 | 42 | 2.17.0 |
100 | 43 | ||
101 | 44 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When a timer is enabled before a reload value is set, the controller | 3 | Cc: qemu-stable@nongnu.org |
4 | waits for a reload value to be set before starting decrementing. This | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | fix tries to cover that case by changing the timer expiry only when | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | a reload value is valid. | 6 | Tested-by: Alex Bennée <alex.bennee@linaro.org> |
7 | 7 | Message-id: 20180512003217.9105-6-richard.henderson@linaro.org | |
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
9 | Reviewed-by: Andrew Jeffery <andrew@aj.id.au> | ||
10 | Message-id: 1496739312-32304-1-git-send-email-clg@kaod.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | hw/timer/aspeed_timer.c | 37 +++++++++++++++++++++++++++++-------- | 10 | target/arm/translate-a64.c | 30 ++++++++++++++---------------- |
14 | 1 file changed, 29 insertions(+), 8 deletions(-) | 11 | 1 file changed, 14 insertions(+), 16 deletions(-) |
15 | 12 | ||
16 | diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/timer/aspeed_timer.c | 15 | --- a/target/arm/translate-a64.c |
19 | +++ b/hw/timer/aspeed_timer.c | 16 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ static uint64_t calculate_next(struct AspeedTimer *t) | 17 | @@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg) |
21 | next = seq[1]; | 18 | return v; |
22 | } else if (now < seq[2]) { | ||
23 | next = seq[2]; | ||
24 | - } else { | ||
25 | + } else if (t->reload) { | ||
26 | reload_ns = muldiv64(t->reload, NANOSECONDS_PER_SECOND, rate); | ||
27 | t->start = now - ((now - t->start) % reload_ns); | ||
28 | + } else { | ||
29 | + /* no reload value, return 0 */ | ||
30 | + break; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | return next; | ||
35 | } | 19 | } |
36 | 20 | ||
37 | +static void aspeed_timer_mod(AspeedTimer *t) | 21 | +static TCGv_i32 read_fp_hreg(DisasContext *s, int reg) |
38 | +{ | 22 | +{ |
39 | + uint64_t next = calculate_next(t); | 23 | + TCGv_i32 v = tcg_temp_new_i32(); |
40 | + if (next) { | 24 | + |
41 | + timer_mod(&t->timer, next); | 25 | + tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16)); |
42 | + } | 26 | + return v; |
43 | +} | 27 | +} |
44 | + | 28 | + |
45 | static void aspeed_timer_expire(void *opaque) | 29 | /* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64). |
30 | * If SVE is not enabled, then there are only 128 bits in the vector. | ||
31 | */ | ||
32 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) | ||
33 | static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) | ||
46 | { | 34 | { |
47 | AspeedTimer *t = opaque; | 35 | TCGv_ptr fpst = NULL; |
48 | @@ -XXX,XX +XXX,XX @@ static void aspeed_timer_expire(void *opaque) | 36 | - TCGv_i32 tcg_op = tcg_temp_new_i32(); |
49 | qemu_set_irq(t->irq, t->level); | 37 | + TCGv_i32 tcg_op = read_fp_hreg(s, rn); |
38 | TCGv_i32 tcg_res = tcg_temp_new_i32(); | ||
39 | |||
40 | - read_vec_element_i32(s, tcg_op, rn, 0, MO_16); | ||
41 | - | ||
42 | switch (opcode) { | ||
43 | case 0x0: /* FMOV */ | ||
44 | tcg_gen_mov_i32(tcg_res, tcg_op); | ||
45 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn) | ||
46 | tcg_temp_free_i64(tcg_op2); | ||
47 | tcg_temp_free_i64(tcg_res); | ||
48 | } else { | ||
49 | - TCGv_i32 tcg_op1 = tcg_temp_new_i32(); | ||
50 | - TCGv_i32 tcg_op2 = tcg_temp_new_i32(); | ||
51 | + TCGv_i32 tcg_op1 = read_fp_hreg(s, rn); | ||
52 | + TCGv_i32 tcg_op2 = read_fp_hreg(s, rm); | ||
53 | TCGv_i64 tcg_res = tcg_temp_new_i64(); | ||
54 | |||
55 | - read_vec_element_i32(s, tcg_op1, rn, 0, MO_16); | ||
56 | - read_vec_element_i32(s, tcg_op2, rm, 0, MO_16); | ||
57 | - | ||
58 | gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2); | ||
59 | gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_res); | ||
60 | |||
61 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s, | ||
62 | |||
63 | fpst = get_fpstatus_ptr(true); | ||
64 | |||
65 | - tcg_op1 = tcg_temp_new_i32(); | ||
66 | - tcg_op2 = tcg_temp_new_i32(); | ||
67 | + tcg_op1 = read_fp_hreg(s, rn); | ||
68 | + tcg_op2 = read_fp_hreg(s, rm); | ||
69 | tcg_res = tcg_temp_new_i32(); | ||
70 | |||
71 | - read_vec_element_i32(s, tcg_op1, rn, 0, MO_16); | ||
72 | - read_vec_element_i32(s, tcg_op2, rm, 0, MO_16); | ||
73 | - | ||
74 | switch (fpopcode) { | ||
75 | case 0x03: /* FMULX */ | ||
76 | gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
77 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) | ||
50 | } | 78 | } |
51 | 79 | ||
52 | - timer_mod(&t->timer, calculate_next(t)); | 80 | if (is_scalar) { |
53 | + aspeed_timer_mod(t); | 81 | - TCGv_i32 tcg_op = tcg_temp_new_i32(); |
54 | } | 82 | + TCGv_i32 tcg_op = read_fp_hreg(s, rn); |
55 | 83 | TCGv_i32 tcg_res = tcg_temp_new_i32(); | |
56 | static uint64_t aspeed_timer_get_value(AspeedTimer *t, int reg) | 84 | |
57 | @@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg, | 85 | - read_vec_element_i32(s, tcg_op, rn, 0, MO_16); |
58 | uint32_t value) | 86 | - |
59 | { | 87 | switch (fpop) { |
60 | AspeedTimer *t; | 88 | case 0x1a: /* FCVTNS */ |
61 | + uint32_t old_reload; | 89 | case 0x1b: /* FCVTMS */ |
62 | |||
63 | trace_aspeed_timer_set_value(timer, reg, value); | ||
64 | t = &s->timers[timer]; | ||
65 | switch (reg) { | ||
66 | + case TIMER_REG_RELOAD: | ||
67 | + old_reload = t->reload; | ||
68 | + t->reload = value; | ||
69 | + | ||
70 | + /* If the reload value was not previously set, or zero, and | ||
71 | + * the current value is valid, try to start the timer if it is | ||
72 | + * enabled. | ||
73 | + */ | ||
74 | + if (old_reload || !t->reload) { | ||
75 | + break; | ||
76 | + } | ||
77 | + | ||
78 | case TIMER_REG_STATUS: | ||
79 | if (timer_enabled(t)) { | ||
80 | uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); | ||
81 | @@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg, | ||
82 | uint32_t rate = calculate_rate(t); | ||
83 | |||
84 | t->start += muldiv64(delta, NANOSECONDS_PER_SECOND, rate); | ||
85 | - timer_mod(&t->timer, calculate_next(t)); | ||
86 | + aspeed_timer_mod(t); | ||
87 | } | ||
88 | break; | ||
89 | - case TIMER_REG_RELOAD: | ||
90 | - t->reload = value; | ||
91 | - break; | ||
92 | case TIMER_REG_MATCH_FIRST: | ||
93 | case TIMER_REG_MATCH_SECOND: | ||
94 | t->match[reg - 2] = value; | ||
95 | if (timer_enabled(t)) { | ||
96 | - timer_mod(&t->timer, calculate_next(t)); | ||
97 | + aspeed_timer_mod(t); | ||
98 | } | ||
99 | break; | ||
100 | default: | ||
101 | @@ -XXX,XX +XXX,XX @@ static void aspeed_timer_ctrl_enable(AspeedTimer *t, bool enable) | ||
102 | trace_aspeed_timer_ctrl_enable(t->id, enable); | ||
103 | if (enable) { | ||
104 | t->start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); | ||
105 | - timer_mod(&t->timer, calculate_next(t)); | ||
106 | + aspeed_timer_mod(t); | ||
107 | } else { | ||
108 | timer_del(&t->timer); | ||
109 | } | ||
110 | -- | 90 | -- |
111 | 2.7.4 | 91 | 2.17.0 |
112 | 92 | ||
113 | 93 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Before QOM-ifying the Exynos4 SoC model, move the DRAM initialization | 3 | We missed all of the scalar fp16 binary operations. |
4 | from exynos4210.c to exynos4_boards.c because DRAM is board specific, | ||
5 | not SoC. | ||
6 | 4 | ||
7 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 5 | Cc: qemu-stable@nongnu.org |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20180512003217.9105-7-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | include/hw/arm/exynos4210.h | 5 +---- | 12 | target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++ |
12 | hw/arm/exynos4210.c | 20 +----------------- | 13 | 1 file changed, 65 insertions(+) |
13 | hw/arm/exynos4_boards.c | 50 ++++++++++++++++++++++++++++++++++++++------- | ||
14 | 3 files changed, 45 insertions(+), 30 deletions(-) | ||
15 | 14 | ||
16 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/exynos4210.h | 17 | --- a/target/arm/translate-a64.c |
19 | +++ b/include/hw/arm/exynos4210.h | 18 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State { | 19 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_2src_double(DisasContext *s, int opcode, |
21 | MemoryRegion iram_mem; | 20 | tcg_temp_free_i64(tcg_res); |
22 | MemoryRegion irom_mem; | ||
23 | MemoryRegion irom_alias_mem; | ||
24 | - MemoryRegion dram0_mem; | ||
25 | - MemoryRegion dram1_mem; | ||
26 | MemoryRegion boot_secondary; | ||
27 | MemoryRegion bootreg_mem; | ||
28 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State { | ||
30 | void exynos4210_write_secondary(ARMCPU *cpu, | ||
31 | const struct arm_boot_info *info); | ||
32 | |||
33 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem, | ||
34 | - unsigned long ram_size); | ||
35 | +Exynos4210State *exynos4210_init(MemoryRegion *system_mem); | ||
36 | |||
37 | /* Initialize exynos4210 IRQ subsystem stub */ | ||
38 | qemu_irq *exynos4210_init_irq(Exynos4210Irq *env); | ||
39 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/hw/arm/exynos4210.c | ||
42 | +++ b/hw/arm/exynos4210.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu) | ||
44 | return mp_affinity; | ||
45 | } | 21 | } |
46 | 22 | ||
47 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem, | 23 | +/* Floating-point data-processing (2 source) - half precision */ |
48 | - unsigned long ram_size) | 24 | +static void handle_fp_2src_half(DisasContext *s, int opcode, |
49 | +Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 25 | + int rd, int rn, int rm) |
50 | { | 26 | +{ |
51 | int i, n; | 27 | + TCGv_i32 tcg_op1; |
52 | Exynos4210State *s = g_new(Exynos4210State, 1); | 28 | + TCGv_i32 tcg_op2; |
53 | qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; | 29 | + TCGv_i32 tcg_res; |
54 | - unsigned long mem_size; | 30 | + TCGv_ptr fpst; |
55 | DeviceState *dev; | ||
56 | SysBusDevice *busdev; | ||
57 | ObjectClass *cpu_oc; | ||
58 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, | ||
59 | memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR, | ||
60 | &s->iram_mem); | ||
61 | |||
62 | - /* DRAM */ | ||
63 | - mem_size = ram_size; | ||
64 | - if (mem_size > EXYNOS4210_DRAM_MAX_SIZE) { | ||
65 | - memory_region_init_ram(&s->dram1_mem, NULL, "exynos4210.dram1", | ||
66 | - mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_fatal); | ||
67 | - vmstate_register_ram_global(&s->dram1_mem); | ||
68 | - memory_region_add_subregion(system_mem, EXYNOS4210_DRAM1_BASE_ADDR, | ||
69 | - &s->dram1_mem); | ||
70 | - mem_size = EXYNOS4210_DRAM_MAX_SIZE; | ||
71 | - } | ||
72 | - memory_region_init_ram(&s->dram0_mem, NULL, "exynos4210.dram0", mem_size, | ||
73 | - &error_fatal); | ||
74 | - vmstate_register_ram_global(&s->dram0_mem); | ||
75 | - memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR, | ||
76 | - &s->dram0_mem); | ||
77 | - | ||
78 | /* PMU. | ||
79 | * The only reason of existence at the moment is that secondary CPU boot | ||
80 | * loader uses PMU INFORM5 register as a holding pen. | ||
81 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/hw/arm/exynos4_boards.c | ||
84 | +++ b/hw/arm/exynos4_boards.c | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | */ | ||
87 | |||
88 | #include "qemu/osdep.h" | ||
89 | +#include "qapi/error.h" | ||
90 | #include "qemu/error-report.h" | ||
91 | #include "qemu-common.h" | ||
92 | #include "cpu.h" | ||
93 | @@ -XXX,XX +XXX,XX @@ typedef enum Exynos4BoardType { | ||
94 | EXYNOS4_NUM_OF_BOARDS | ||
95 | } Exynos4BoardType; | ||
96 | |||
97 | +typedef struct Exynos4BoardState { | ||
98 | + Exynos4210State *soc; | ||
99 | + MemoryRegion dram0_mem; | ||
100 | + MemoryRegion dram1_mem; | ||
101 | +} Exynos4BoardState; | ||
102 | + | 31 | + |
103 | static int exynos4_board_id[EXYNOS4_NUM_OF_BOARDS] = { | 32 | + tcg_res = tcg_temp_new_i32(); |
104 | [EXYNOS4_BOARD_NURI] = 0xD33, | 33 | + fpst = get_fpstatus_ptr(true); |
105 | [EXYNOS4_BOARD_SMDKC210] = 0xB16, | 34 | + tcg_op1 = read_fp_hreg(s, rn); |
106 | @@ -XXX,XX +XXX,XX @@ static void lan9215_init(uint32_t base, qemu_irq irq) | 35 | + tcg_op2 = read_fp_hreg(s, rm); |
107 | } | ||
108 | } | ||
109 | |||
110 | -static Exynos4210State *exynos4_boards_init_common(MachineState *machine, | ||
111 | - Exynos4BoardType board_type) | ||
112 | +static void exynos4_boards_init_ram(Exynos4BoardState *s, | ||
113 | + MemoryRegion *system_mem, | ||
114 | + unsigned long ram_size) | ||
115 | +{ | ||
116 | + unsigned long mem_size = ram_size; | ||
117 | + | 36 | + |
118 | + if (mem_size > EXYNOS4210_DRAM_MAX_SIZE) { | 37 | + switch (opcode) { |
119 | + memory_region_init_ram(&s->dram1_mem, NULL, "exynos4210.dram1", | 38 | + case 0x0: /* FMUL */ |
120 | + mem_size - EXYNOS4210_DRAM_MAX_SIZE, | 39 | + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); |
121 | + &error_fatal); | 40 | + break; |
122 | + vmstate_register_ram_global(&s->dram1_mem); | 41 | + case 0x1: /* FDIV */ |
123 | + memory_region_add_subregion(system_mem, EXYNOS4210_DRAM1_BASE_ADDR, | 42 | + gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst); |
124 | + &s->dram1_mem); | 43 | + break; |
125 | + mem_size = EXYNOS4210_DRAM_MAX_SIZE; | 44 | + case 0x2: /* FADD */ |
45 | + gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
46 | + break; | ||
47 | + case 0x3: /* FSUB */ | ||
48 | + gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
49 | + break; | ||
50 | + case 0x4: /* FMAX */ | ||
51 | + gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
52 | + break; | ||
53 | + case 0x5: /* FMIN */ | ||
54 | + gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
55 | + break; | ||
56 | + case 0x6: /* FMAXNM */ | ||
57 | + gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
58 | + break; | ||
59 | + case 0x7: /* FMINNM */ | ||
60 | + gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
61 | + break; | ||
62 | + case 0x8: /* FNMUL */ | ||
63 | + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); | ||
64 | + tcg_gen_xori_i32(tcg_res, tcg_res, 0x8000); | ||
65 | + break; | ||
66 | + default: | ||
67 | + g_assert_not_reached(); | ||
126 | + } | 68 | + } |
127 | + | 69 | + |
128 | + memory_region_init_ram(&s->dram0_mem, NULL, "exynos4210.dram0", mem_size, | 70 | + write_fp_sreg(s, rd, tcg_res); |
129 | + &error_fatal); | 71 | + |
130 | + vmstate_register_ram_global(&s->dram0_mem); | 72 | + tcg_temp_free_ptr(fpst); |
131 | + memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR, | 73 | + tcg_temp_free_i32(tcg_op1); |
132 | + &s->dram0_mem); | 74 | + tcg_temp_free_i32(tcg_op2); |
75 | + tcg_temp_free_i32(tcg_res); | ||
133 | +} | 76 | +} |
134 | + | 77 | + |
135 | +static Exynos4BoardState * | 78 | /* Floating point data-processing (2 source) |
136 | +exynos4_boards_init_common(MachineState *machine, | 79 | * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0 |
137 | + Exynos4BoardType board_type) | 80 | * +---+---+---+-----------+------+---+------+--------+-----+------+------+ |
138 | { | 81 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_2src(DisasContext *s, uint32_t insn) |
139 | + Exynos4BoardState *s = g_new(Exynos4BoardState, 1); | 82 | } |
140 | MachineClass *mc = MACHINE_GET_CLASS(machine); | 83 | handle_fp_2src_double(s, opcode, rd, rn, rm); |
141 | 84 | break; | |
142 | if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) { | 85 | + case 3: |
143 | @@ -XXX,XX +XXX,XX @@ static Exynos4210State *exynos4_boards_init_common(MachineState *machine, | 86 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
144 | machine->kernel_cmdline, | 87 | + unallocated_encoding(s); |
145 | machine->initrd_filename); | 88 | + return; |
146 | 89 | + } | |
147 | - return exynos4210_init(get_system_memory(), | 90 | + if (!fp_access_check(s)) { |
148 | - exynos4_board_ram_size[board_type]); | 91 | + return; |
149 | + exynos4_boards_init_ram(s, get_system_memory(), | 92 | + } |
150 | + exynos4_board_ram_size[board_type]); | 93 | + handle_fp_2src_half(s, opcode, rd, rn, rm); |
151 | + | 94 | + break; |
152 | + s->soc = exynos4210_init(get_system_memory()); | 95 | default: |
153 | + | 96 | unallocated_encoding(s); |
154 | + return s; | 97 | } |
155 | } | ||
156 | |||
157 | static void nuri_init(MachineState *machine) | ||
158 | @@ -XXX,XX +XXX,XX @@ static void nuri_init(MachineState *machine) | ||
159 | |||
160 | static void smdkc210_init(MachineState *machine) | ||
161 | { | ||
162 | - Exynos4210State *s = exynos4_boards_init_common(machine, | ||
163 | - EXYNOS4_BOARD_SMDKC210); | ||
164 | + Exynos4BoardState *s = exynos4_boards_init_common(machine, | ||
165 | + EXYNOS4_BOARD_SMDKC210); | ||
166 | |||
167 | lan9215_init(SMDK_LAN9118_BASE_ADDR, | ||
168 | - qemu_irq_invert(s->irq_table[exynos4210_get_irq(37, 1)])); | ||
169 | + qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)])); | ||
170 | arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo); | ||
171 | } | ||
172 | |||
173 | -- | 98 | -- |
174 | 2.7.4 | 99 | 2.17.0 |
175 | 100 | ||
176 | 101 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Largely inspired by the TMP105 temperature sensor, here is a model for | 3 | We missed all of the scalar fp16 fma operations. |
4 | the TMP42{1,2,3} temperature sensors. | ||
5 | 4 | ||
6 | Specs can be found here : | 5 | Cc: qemu-stable@nongnu.org |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20180512003217.9105-8-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++ | ||
13 | 1 file changed, 48 insertions(+) | ||
7 | 14 | ||
8 | http://www.ti.com/lit/gpn/tmp421 | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
9 | |||
10 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
11 | Message-id: 1496739230-32109-2-git-send-email-clg@kaod.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/misc/Makefile.objs | 1 + | ||
16 | hw/misc/tmp421.c | 402 ++++++++++++++++++++++++++++++++++++++++ | ||
17 | default-configs/arm-softmmu.mak | 1 + | ||
18 | 3 files changed, 404 insertions(+) | ||
19 | create mode 100644 hw/misc/tmp421.c | ||
20 | |||
21 | diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs | ||
22 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/misc/Makefile.objs | 17 | --- a/target/arm/translate-a64.c |
24 | +++ b/hw/misc/Makefile.objs | 18 | +++ b/target/arm/translate-a64.c |
25 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1, |
26 | common-obj-$(CONFIG_APPLESMC) += applesmc.o | 20 | tcg_temp_free_i64(tcg_res); |
27 | common-obj-$(CONFIG_MAX111X) += max111x.o | 21 | } |
28 | common-obj-$(CONFIG_TMP105) += tmp105.o | 22 | |
29 | +common-obj-$(CONFIG_TMP421) += tmp421.o | 23 | +/* Floating-point data-processing (3 source) - half precision */ |
30 | common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o | 24 | +static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1, |
31 | common-obj-$(CONFIG_SGA) += sga.o | 25 | + int rd, int rn, int rm, int ra) |
32 | common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o | 26 | +{ |
33 | diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c | 27 | + TCGv_i32 tcg_op1, tcg_op2, tcg_op3; |
34 | new file mode 100644 | 28 | + TCGv_i32 tcg_res = tcg_temp_new_i32(); |
35 | index XXXXXXX..XXXXXXX | 29 | + TCGv_ptr fpst = get_fpstatus_ptr(true); |
36 | --- /dev/null | ||
37 | +++ b/hw/misc/tmp421.c | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | +/* | ||
40 | + * Texas Instruments TMP421 temperature sensor. | ||
41 | + * | ||
42 | + * Copyright (c) 2016 IBM Corporation. | ||
43 | + * | ||
44 | + * Largely inspired by : | ||
45 | + * | ||
46 | + * Texas Instruments TMP105 temperature sensor. | ||
47 | + * | ||
48 | + * Copyright (C) 2008 Nokia Corporation | ||
49 | + * Written by Andrzej Zaborowski <andrew@openedhand.com> | ||
50 | + * | ||
51 | + * This program is free software; you can redistribute it and/or | ||
52 | + * modify it under the terms of the GNU General Public License as | ||
53 | + * published by the Free Software Foundation; either version 2 or | ||
54 | + * (at your option) version 3 of the License. | ||
55 | + * | ||
56 | + * This program is distributed in the hope that it will be useful, | ||
57 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
58 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
59 | + * GNU General Public License for more details. | ||
60 | + * | ||
61 | + * You should have received a copy of the GNU General Public License along | ||
62 | + * with this program; if not, see <http://www.gnu.org/licenses/>. | ||
63 | + */ | ||
64 | + | 30 | + |
65 | +#include "qemu/osdep.h" | 31 | + tcg_op1 = read_fp_hreg(s, rn); |
66 | +#include "hw/hw.h" | 32 | + tcg_op2 = read_fp_hreg(s, rm); |
67 | +#include "hw/i2c/i2c.h" | 33 | + tcg_op3 = read_fp_hreg(s, ra); |
68 | +#include "qapi/error.h" | ||
69 | +#include "qapi/visitor.h" | ||
70 | + | 34 | + |
71 | +/* Manufacturer / Device ID's */ | 35 | + /* These are fused multiply-add, and must be done as one |
72 | +#define TMP421_MANUFACTURER_ID 0x55 | 36 | + * floating point operation with no rounding between the |
73 | +#define TMP421_DEVICE_ID 0x21 | 37 | + * multiplication and addition steps. |
74 | +#define TMP422_DEVICE_ID 0x22 | 38 | + * NB that doing the negations here as separate steps is |
75 | +#define TMP423_DEVICE_ID 0x23 | 39 | + * correct : an input NaN should come out with its sign bit |
76 | + | 40 | + * flipped if it is a negated-input. |
77 | +typedef struct DeviceInfo { | 41 | + */ |
78 | + int model; | 42 | + if (o1 == true) { |
79 | + const char *name; | 43 | + tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000); |
80 | +} DeviceInfo; | ||
81 | + | ||
82 | +static const DeviceInfo devices[] = { | ||
83 | + { TMP421_DEVICE_ID, "tmp421" }, | ||
84 | + { TMP422_DEVICE_ID, "tmp422" }, | ||
85 | + { TMP423_DEVICE_ID, "tmp423" }, | ||
86 | +}; | ||
87 | + | ||
88 | +typedef struct TMP421State { | ||
89 | + /*< private >*/ | ||
90 | + I2CSlave i2c; | ||
91 | + /*< public >*/ | ||
92 | + | ||
93 | + int16_t temperature[4]; | ||
94 | + | ||
95 | + uint8_t status; | ||
96 | + uint8_t config[2]; | ||
97 | + uint8_t rate; | ||
98 | + | ||
99 | + uint8_t len; | ||
100 | + uint8_t buf[2]; | ||
101 | + uint8_t pointer; | ||
102 | + | ||
103 | +} TMP421State; | ||
104 | + | ||
105 | +typedef struct TMP421Class { | ||
106 | + I2CSlaveClass parent_class; | ||
107 | + DeviceInfo *dev; | ||
108 | +} TMP421Class; | ||
109 | + | ||
110 | +#define TYPE_TMP421 "tmp421-generic" | ||
111 | +#define TMP421(obj) OBJECT_CHECK(TMP421State, (obj), TYPE_TMP421) | ||
112 | + | ||
113 | +#define TMP421_CLASS(klass) \ | ||
114 | + OBJECT_CLASS_CHECK(TMP421Class, (klass), TYPE_TMP421) | ||
115 | +#define TMP421_GET_CLASS(obj) \ | ||
116 | + OBJECT_GET_CLASS(TMP421Class, (obj), TYPE_TMP421) | ||
117 | + | ||
118 | +/* the TMP421 registers */ | ||
119 | +#define TMP421_STATUS_REG 0x08 | ||
120 | +#define TMP421_STATUS_BUSY (1 << 7) | ||
121 | +#define TMP421_CONFIG_REG_1 0x09 | ||
122 | +#define TMP421_CONFIG_RANGE (1 << 2) | ||
123 | +#define TMP421_CONFIG_SHUTDOWN (1 << 6) | ||
124 | +#define TMP421_CONFIG_REG_2 0x0A | ||
125 | +#define TMP421_CONFIG_RC (1 << 2) | ||
126 | +#define TMP421_CONFIG_LEN (1 << 3) | ||
127 | +#define TMP421_CONFIG_REN (1 << 4) | ||
128 | +#define TMP421_CONFIG_REN2 (1 << 5) | ||
129 | +#define TMP421_CONFIG_REN3 (1 << 6) | ||
130 | + | ||
131 | +#define TMP421_CONVERSION_RATE_REG 0x0B | ||
132 | +#define TMP421_ONE_SHOT 0x0F | ||
133 | + | ||
134 | +#define TMP421_RESET 0xFC | ||
135 | +#define TMP421_MANUFACTURER_ID_REG 0xFE | ||
136 | +#define TMP421_DEVICE_ID_REG 0xFF | ||
137 | + | ||
138 | +#define TMP421_TEMP_MSB0 0x00 | ||
139 | +#define TMP421_TEMP_MSB1 0x01 | ||
140 | +#define TMP421_TEMP_MSB2 0x02 | ||
141 | +#define TMP421_TEMP_MSB3 0x03 | ||
142 | +#define TMP421_TEMP_LSB0 0x10 | ||
143 | +#define TMP421_TEMP_LSB1 0x11 | ||
144 | +#define TMP421_TEMP_LSB2 0x12 | ||
145 | +#define TMP421_TEMP_LSB3 0x13 | ||
146 | + | ||
147 | +static const int32_t mins[2] = { -40000, -55000 }; | ||
148 | +static const int32_t maxs[2] = { 127000, 150000 }; | ||
149 | + | ||
150 | +static void tmp421_get_temperature(Object *obj, Visitor *v, const char *name, | ||
151 | + void *opaque, Error **errp) | ||
152 | +{ | ||
153 | + TMP421State *s = TMP421(obj); | ||
154 | + bool ext_range = (s->config[0] & TMP421_CONFIG_RANGE); | ||
155 | + int offset = ext_range * 64 * 256; | ||
156 | + int64_t value; | ||
157 | + int tempid; | ||
158 | + | ||
159 | + if (sscanf(name, "temperature%d", &tempid) != 1) { | ||
160 | + error_setg(errp, "error reading %s: %m", name); | ||
161 | + return; | ||
162 | + } | 44 | + } |
163 | + | 45 | + |
164 | + if (tempid >= 4 || tempid < 0) { | 46 | + if (o0 != o1) { |
165 | + error_setg(errp, "error reading %s", name); | 47 | + tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000); |
166 | + return; | ||
167 | + } | 48 | + } |
168 | + | 49 | + |
169 | + value = ((s->temperature[tempid] - offset) * 1000 + 128) / 256; | 50 | + gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst); |
170 | + | 51 | + |
171 | + visit_type_int(v, name, &value, errp); | 52 | + write_fp_sreg(s, rd, tcg_res); |
53 | + | ||
54 | + tcg_temp_free_ptr(fpst); | ||
55 | + tcg_temp_free_i32(tcg_op1); | ||
56 | + tcg_temp_free_i32(tcg_op2); | ||
57 | + tcg_temp_free_i32(tcg_op3); | ||
58 | + tcg_temp_free_i32(tcg_res); | ||
172 | +} | 59 | +} |
173 | + | 60 | + |
174 | +/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 | 61 | /* Floating point data-processing (3 source) |
175 | + * fixed point, so units are 1/256 centigrades. A simple ratio will do. | 62 | * 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0 |
176 | + */ | 63 | * +---+---+---+-----------+------+----+------+----+------+------+------+ |
177 | +static void tmp421_set_temperature(Object *obj, Visitor *v, const char *name, | 64 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_3src(DisasContext *s, uint32_t insn) |
178 | + void *opaque, Error **errp) | 65 | } |
179 | +{ | 66 | handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra); |
180 | + TMP421State *s = TMP421(obj); | 67 | break; |
181 | + Error *local_err = NULL; | 68 | + case 3: |
182 | + int64_t temp; | 69 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
183 | + bool ext_range = (s->config[0] & TMP421_CONFIG_RANGE); | 70 | + unallocated_encoding(s); |
184 | + int offset = ext_range * 64 * 256; | 71 | + return; |
185 | + int tempid; | 72 | + } |
186 | + | 73 | + if (!fp_access_check(s)) { |
187 | + visit_type_int(v, name, &temp, &local_err); | 74 | + return; |
188 | + if (local_err) { | 75 | + } |
189 | + error_propagate(errp, local_err); | 76 | + handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra); |
190 | + return; | ||
191 | + } | ||
192 | + | ||
193 | + if (temp >= maxs[ext_range] || temp < mins[ext_range]) { | ||
194 | + error_setg(errp, "value %" PRId64 ".%03" PRIu64 " °C is out of range", | ||
195 | + temp / 1000, temp % 1000); | ||
196 | + return; | ||
197 | + } | ||
198 | + | ||
199 | + if (sscanf(name, "temperature%d", &tempid) != 1) { | ||
200 | + error_setg(errp, "error reading %s: %m", name); | ||
201 | + return; | ||
202 | + } | ||
203 | + | ||
204 | + if (tempid >= 4 || tempid < 0) { | ||
205 | + error_setg(errp, "error reading %s", name); | ||
206 | + return; | ||
207 | + } | ||
208 | + | ||
209 | + s->temperature[tempid] = (int16_t) ((temp * 256 - 128) / 1000) + offset; | ||
210 | +} | ||
211 | + | ||
212 | +static void tmp421_read(TMP421State *s) | ||
213 | +{ | ||
214 | + TMP421Class *sc = TMP421_GET_CLASS(s); | ||
215 | + | ||
216 | + s->len = 0; | ||
217 | + | ||
218 | + switch (s->pointer) { | ||
219 | + case TMP421_MANUFACTURER_ID_REG: | ||
220 | + s->buf[s->len++] = TMP421_MANUFACTURER_ID; | ||
221 | + break; | 77 | + break; |
222 | + case TMP421_DEVICE_ID_REG: | 78 | default: |
223 | + s->buf[s->len++] = sc->dev->model; | 79 | unallocated_encoding(s); |
224 | + break; | 80 | } |
225 | + case TMP421_CONFIG_REG_1: | ||
226 | + s->buf[s->len++] = s->config[0]; | ||
227 | + break; | ||
228 | + case TMP421_CONFIG_REG_2: | ||
229 | + s->buf[s->len++] = s->config[1]; | ||
230 | + break; | ||
231 | + case TMP421_CONVERSION_RATE_REG: | ||
232 | + s->buf[s->len++] = s->rate; | ||
233 | + break; | ||
234 | + case TMP421_STATUS_REG: | ||
235 | + s->buf[s->len++] = s->status; | ||
236 | + break; | ||
237 | + | ||
238 | + /* FIXME: check for channel enablement in config registers */ | ||
239 | + case TMP421_TEMP_MSB0: | ||
240 | + s->buf[s->len++] = (((uint16_t) s->temperature[0]) >> 8); | ||
241 | + s->buf[s->len++] = (((uint16_t) s->temperature[0]) >> 0) & 0xf0; | ||
242 | + break; | ||
243 | + case TMP421_TEMP_MSB1: | ||
244 | + s->buf[s->len++] = (((uint16_t) s->temperature[1]) >> 8); | ||
245 | + s->buf[s->len++] = (((uint16_t) s->temperature[1]) >> 0) & 0xf0; | ||
246 | + break; | ||
247 | + case TMP421_TEMP_MSB2: | ||
248 | + s->buf[s->len++] = (((uint16_t) s->temperature[2]) >> 8); | ||
249 | + s->buf[s->len++] = (((uint16_t) s->temperature[2]) >> 0) & 0xf0; | ||
250 | + break; | ||
251 | + case TMP421_TEMP_MSB3: | ||
252 | + s->buf[s->len++] = (((uint16_t) s->temperature[3]) >> 8); | ||
253 | + s->buf[s->len++] = (((uint16_t) s->temperature[3]) >> 0) & 0xf0; | ||
254 | + break; | ||
255 | + case TMP421_TEMP_LSB0: | ||
256 | + s->buf[s->len++] = (((uint16_t) s->temperature[0]) >> 0) & 0xf0; | ||
257 | + break; | ||
258 | + case TMP421_TEMP_LSB1: | ||
259 | + s->buf[s->len++] = (((uint16_t) s->temperature[1]) >> 0) & 0xf0; | ||
260 | + break; | ||
261 | + case TMP421_TEMP_LSB2: | ||
262 | + s->buf[s->len++] = (((uint16_t) s->temperature[2]) >> 0) & 0xf0; | ||
263 | + break; | ||
264 | + case TMP421_TEMP_LSB3: | ||
265 | + s->buf[s->len++] = (((uint16_t) s->temperature[3]) >> 0) & 0xf0; | ||
266 | + break; | ||
267 | + } | ||
268 | +} | ||
269 | + | ||
270 | +static void tmp421_reset(I2CSlave *i2c); | ||
271 | + | ||
272 | +static void tmp421_write(TMP421State *s) | ||
273 | +{ | ||
274 | + switch (s->pointer) { | ||
275 | + case TMP421_CONVERSION_RATE_REG: | ||
276 | + s->rate = s->buf[0]; | ||
277 | + break; | ||
278 | + case TMP421_CONFIG_REG_1: | ||
279 | + s->config[0] = s->buf[0]; | ||
280 | + break; | ||
281 | + case TMP421_CONFIG_REG_2: | ||
282 | + s->config[1] = s->buf[0]; | ||
283 | + break; | ||
284 | + case TMP421_RESET: | ||
285 | + tmp421_reset(I2C_SLAVE(s)); | ||
286 | + break; | ||
287 | + } | ||
288 | +} | ||
289 | + | ||
290 | +static int tmp421_rx(I2CSlave *i2c) | ||
291 | +{ | ||
292 | + TMP421State *s = TMP421(i2c); | ||
293 | + | ||
294 | + if (s->len < 2) { | ||
295 | + return s->buf[s->len++]; | ||
296 | + } else { | ||
297 | + return 0xff; | ||
298 | + } | ||
299 | +} | ||
300 | + | ||
301 | +static int tmp421_tx(I2CSlave *i2c, uint8_t data) | ||
302 | +{ | ||
303 | + TMP421State *s = TMP421(i2c); | ||
304 | + | ||
305 | + if (s->len == 0) { | ||
306 | + /* first byte is the register pointer for a read or write | ||
307 | + * operation */ | ||
308 | + s->pointer = data; | ||
309 | + s->len++; | ||
310 | + } else if (s->len == 1) { | ||
311 | + /* second byte is the data to write. The device only supports | ||
312 | + * one byte writes */ | ||
313 | + s->buf[0] = data; | ||
314 | + tmp421_write(s); | ||
315 | + } | ||
316 | + | ||
317 | + return 0; | ||
318 | +} | ||
319 | + | ||
320 | +static int tmp421_event(I2CSlave *i2c, enum i2c_event event) | ||
321 | +{ | ||
322 | + TMP421State *s = TMP421(i2c); | ||
323 | + | ||
324 | + if (event == I2C_START_RECV) { | ||
325 | + tmp421_read(s); | ||
326 | + } | ||
327 | + | ||
328 | + s->len = 0; | ||
329 | + return 0; | ||
330 | +} | ||
331 | + | ||
332 | +static const VMStateDescription vmstate_tmp421 = { | ||
333 | + .name = "TMP421", | ||
334 | + .version_id = 0, | ||
335 | + .minimum_version_id = 0, | ||
336 | + .fields = (VMStateField[]) { | ||
337 | + VMSTATE_UINT8(len, TMP421State), | ||
338 | + VMSTATE_UINT8_ARRAY(buf, TMP421State, 2), | ||
339 | + VMSTATE_UINT8(pointer, TMP421State), | ||
340 | + VMSTATE_UINT8_ARRAY(config, TMP421State, 2), | ||
341 | + VMSTATE_UINT8(status, TMP421State), | ||
342 | + VMSTATE_UINT8(rate, TMP421State), | ||
343 | + VMSTATE_INT16_ARRAY(temperature, TMP421State, 4), | ||
344 | + VMSTATE_I2C_SLAVE(i2c, TMP421State), | ||
345 | + VMSTATE_END_OF_LIST() | ||
346 | + } | ||
347 | +}; | ||
348 | + | ||
349 | +static void tmp421_reset(I2CSlave *i2c) | ||
350 | +{ | ||
351 | + TMP421State *s = TMP421(i2c); | ||
352 | + TMP421Class *sc = TMP421_GET_CLASS(s); | ||
353 | + | ||
354 | + memset(s->temperature, 0, sizeof(s->temperature)); | ||
355 | + s->pointer = 0; | ||
356 | + | ||
357 | + s->config[0] = 0; /* TMP421_CONFIG_RANGE */ | ||
358 | + | ||
359 | + /* resistance correction and channel enablement */ | ||
360 | + switch (sc->dev->model) { | ||
361 | + case TMP421_DEVICE_ID: | ||
362 | + s->config[1] = 0x1c; | ||
363 | + break; | ||
364 | + case TMP422_DEVICE_ID: | ||
365 | + s->config[1] = 0x3c; | ||
366 | + break; | ||
367 | + case TMP423_DEVICE_ID: | ||
368 | + s->config[1] = 0x7c; | ||
369 | + break; | ||
370 | + } | ||
371 | + | ||
372 | + s->rate = 0x7; /* 8Hz */ | ||
373 | + s->status = 0; | ||
374 | +} | ||
375 | + | ||
376 | +static int tmp421_init(I2CSlave *i2c) | ||
377 | +{ | ||
378 | + TMP421State *s = TMP421(i2c); | ||
379 | + | ||
380 | + tmp421_reset(&s->i2c); | ||
381 | + | ||
382 | + return 0; | ||
383 | +} | ||
384 | + | ||
385 | +static void tmp421_initfn(Object *obj) | ||
386 | +{ | ||
387 | + object_property_add(obj, "temperature0", "int", | ||
388 | + tmp421_get_temperature, | ||
389 | + tmp421_set_temperature, NULL, NULL, NULL); | ||
390 | + object_property_add(obj, "temperature1", "int", | ||
391 | + tmp421_get_temperature, | ||
392 | + tmp421_set_temperature, NULL, NULL, NULL); | ||
393 | + object_property_add(obj, "temperature2", "int", | ||
394 | + tmp421_get_temperature, | ||
395 | + tmp421_set_temperature, NULL, NULL, NULL); | ||
396 | + object_property_add(obj, "temperature3", "int", | ||
397 | + tmp421_get_temperature, | ||
398 | + tmp421_set_temperature, NULL, NULL, NULL); | ||
399 | +} | ||
400 | + | ||
401 | +static void tmp421_class_init(ObjectClass *klass, void *data) | ||
402 | +{ | ||
403 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
404 | + I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); | ||
405 | + TMP421Class *sc = TMP421_CLASS(klass); | ||
406 | + | ||
407 | + k->init = tmp421_init; | ||
408 | + k->event = tmp421_event; | ||
409 | + k->recv = tmp421_rx; | ||
410 | + k->send = tmp421_tx; | ||
411 | + dc->vmsd = &vmstate_tmp421; | ||
412 | + sc->dev = (DeviceInfo *) data; | ||
413 | +} | ||
414 | + | ||
415 | +static const TypeInfo tmp421_info = { | ||
416 | + .name = TYPE_TMP421, | ||
417 | + .parent = TYPE_I2C_SLAVE, | ||
418 | + .instance_size = sizeof(TMP421State), | ||
419 | + .class_size = sizeof(TMP421Class), | ||
420 | + .instance_init = tmp421_initfn, | ||
421 | + .abstract = true, | ||
422 | +}; | ||
423 | + | ||
424 | +static void tmp421_register_types(void) | ||
425 | +{ | ||
426 | + int i; | ||
427 | + | ||
428 | + type_register_static(&tmp421_info); | ||
429 | + for (i = 0; i < ARRAY_SIZE(devices); ++i) { | ||
430 | + TypeInfo ti = { | ||
431 | + .name = devices[i].name, | ||
432 | + .parent = TYPE_TMP421, | ||
433 | + .class_init = tmp421_class_init, | ||
434 | + .class_data = (void *) &devices[i], | ||
435 | + }; | ||
436 | + type_register(&ti); | ||
437 | + } | ||
438 | +} | ||
439 | + | ||
440 | +type_init(tmp421_register_types) | ||
441 | diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak | ||
442 | index XXXXXXX..XXXXXXX 100644 | ||
443 | --- a/default-configs/arm-softmmu.mak | ||
444 | +++ b/default-configs/arm-softmmu.mak | ||
445 | @@ -XXX,XX +XXX,XX @@ CONFIG_TWL92230=y | ||
446 | CONFIG_TSC2005=y | ||
447 | CONFIG_LM832X=y | ||
448 | CONFIG_TMP105=y | ||
449 | +CONFIG_TMP421=y | ||
450 | CONFIG_STELLARIS=y | ||
451 | CONFIG_STELLARIS_INPUT=y | ||
452 | CONFIG_STELLARIS_ENET=y | ||
453 | -- | 81 | -- |
454 | 2.7.4 | 82 | 2.17.0 |
455 | 83 | ||
456 | 84 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We need to handle both registers and ITS tables. While | 3 | These where missed out from the rest of the half-precision work. |
4 | register handling is standard, ITS table handling is more | 4 | |
5 | challenging since the kernel API is devised so that the | 5 | Cc: qemu-stable@nongnu.org |
6 | tables are flushed into guest RAM and not in vmstate buffers. | ||
7 | |||
8 | Flushing the ITS tables on device pre_save() is too late | ||
9 | since the guest RAM is already saved at this point. | ||
10 | |||
11 | Table flushing needs to happen when we are sure the vcpus | ||
12 | are stopped and before the last dirty page saving. The | ||
13 | right point is RUN_STATE_FINISH_MIGRATE but sometimes the | ||
14 | VM gets stopped before migration launch so let's simply | ||
15 | flush the tables each time the VM gets stopped. | ||
16 | |||
17 | For regular ITS registers we just can use vmstate pre_save() | ||
18 | and post_load() callbacks. | ||
19 | |||
20 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
21 | Message-id: 1497023553-18411-3-git-send-email-eric.auger@redhat.com | ||
22 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20180512003217.9105-9-richard.henderson@linaro.org | ||
11 | [rth: Diagnose lack of FP16 before fp_access_check] | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
24 | --- | 14 | --- |
25 | include/hw/intc/arm_gicv3_its_common.h | 8 +++ | 15 | target/arm/helper-a64.h | 2 + |
26 | hw/intc/arm_gicv3_its_common.c | 10 ++++ | 16 | target/arm/helper-a64.c | 10 +++++ |
27 | hw/intc/arm_gicv3_its_kvm.c | 105 +++++++++++++++++++++++++++++++++ | 17 | target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++-------- |
28 | 3 files changed, 123 insertions(+) | 18 | 3 files changed, 83 insertions(+), 17 deletions(-) |
29 | 19 | ||
30 | diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h | 20 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h |
31 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/include/hw/intc/arm_gicv3_its_common.h | 22 | --- a/target/arm/helper-a64.h |
33 | +++ b/include/hw/intc/arm_gicv3_its_common.h | 23 | +++ b/target/arm/helper-a64.h |
34 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ |
35 | #define ITS_TRANS_SIZE 0x10000 | 25 | DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64) |
36 | #define ITS_SIZE (ITS_CONTROL_SIZE + ITS_TRANS_SIZE) | 26 | DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64) |
37 | 27 | DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64) | |
38 | +#define GITS_CTLR 0x0 | 28 | +DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr) |
39 | +#define GITS_IIDR 0x4 | 29 | +DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr) |
40 | +#define GITS_CBASER 0x80 | 30 | DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr) |
41 | +#define GITS_CWRITER 0x88 | 31 | DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr) |
42 | +#define GITS_CREADR 0x90 | 32 | DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr) |
43 | +#define GITS_BASER 0x100 | 33 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c |
44 | + | ||
45 | struct GICv3ITSState { | ||
46 | SysBusDevice parent_obj; | ||
47 | |||
48 | @@ -XXX,XX +XXX,XX @@ struct GICv3ITSState { | ||
49 | |||
50 | /* Registers */ | ||
51 | uint32_t ctlr; | ||
52 | + uint32_t iidr; | ||
53 | uint64_t cbaser; | ||
54 | uint64_t cwriter; | ||
55 | uint64_t creadr; | ||
56 | diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/hw/intc/arm_gicv3_its_common.c | 35 | --- a/target/arm/helper-a64.c |
59 | +++ b/hw/intc/arm_gicv3_its_common.c | 36 | +++ b/target/arm/helper-a64.c |
60 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_its = { | 37 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res) |
61 | .pre_save = gicv3_its_pre_save, | 38 | return flags; |
62 | .post_load = gicv3_its_post_load, | 39 | } |
63 | .unmigratable = true, | 40 | |
64 | + .fields = (VMStateField[]) { | 41 | +uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status) |
65 | + VMSTATE_UINT32(ctlr, GICv3ITSState), | 42 | +{ |
66 | + VMSTATE_UINT32(iidr, GICv3ITSState), | 43 | + return float_rel_to_flags(float16_compare_quiet(x, y, fp_status)); |
67 | + VMSTATE_UINT64(cbaser, GICv3ITSState), | 44 | +} |
68 | + VMSTATE_UINT64(cwriter, GICv3ITSState), | 45 | + |
69 | + VMSTATE_UINT64(creadr, GICv3ITSState), | 46 | +uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status) |
70 | + VMSTATE_UINT64_ARRAY(baser, GICv3ITSState, 8), | 47 | +{ |
71 | + VMSTATE_END_OF_LIST() | 48 | + return float_rel_to_flags(float16_compare(x, y, fp_status)); |
72 | + }, | 49 | +} |
73 | }; | 50 | + |
74 | 51 | uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status) | |
75 | static MemTxResult gicv3_its_trans_read(void *opaque, hwaddr offset, | 52 | { |
76 | @@ -XXX,XX +XXX,XX @@ static void gicv3_its_common_reset(DeviceState *dev) | 53 | return float_rel_to_flags(float32_compare_quiet(x, y, fp_status)); |
77 | s->cbaser = 0; | 54 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
78 | s->cwriter = 0; | ||
79 | s->creadr = 0; | ||
80 | + s->iidr = 0; | ||
81 | memset(&s->baser, 0, sizeof(s->baser)); | ||
82 | |||
83 | gicv3_its_post_load(s, 0); | ||
84 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | 55 | index XXXXXXX..XXXXXXX 100644 |
86 | --- a/hw/intc/arm_gicv3_its_kvm.c | 56 | --- a/target/arm/translate-a64.c |
87 | +++ b/hw/intc/arm_gicv3_its_kvm.c | 57 | +++ b/target/arm/translate-a64.c |
88 | @@ -XXX,XX +XXX,XX @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid) | 58 | @@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) |
89 | return kvm_vm_ioctl(kvm_state, KVM_SIGNAL_MSI, &msi); | 59 | } |
90 | } | 60 | } |
91 | 61 | ||
92 | +/** | 62 | -static void handle_fp_compare(DisasContext *s, bool is_double, |
93 | + * vm_change_state_handler - VM change state callback aiming at flushing | 63 | +static void handle_fp_compare(DisasContext *s, int size, |
94 | + * ITS tables into guest RAM | 64 | unsigned int rn, unsigned int rm, |
95 | + * | 65 | bool cmp_with_zero, bool signal_all_nans) |
96 | + * The tables get flushed to guest RAM whenever the VM gets stopped. | 66 | { |
97 | + */ | 67 | TCGv_i64 tcg_flags = tcg_temp_new_i64(); |
98 | +static void vm_change_state_handler(void *opaque, int running, | 68 | - TCGv_ptr fpst = get_fpstatus_ptr(false); |
99 | + RunState state) | 69 | + TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16); |
100 | +{ | 70 | |
101 | + GICv3ITSState *s = (GICv3ITSState *)opaque; | 71 | - if (is_double) { |
102 | + Error *err = NULL; | 72 | + if (size == MO_64) { |
103 | + int ret; | 73 | TCGv_i64 tcg_vn, tcg_vm; |
104 | + | 74 | |
105 | + if (running) { | 75 | tcg_vn = read_fp_dreg(s, rn); |
76 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double, | ||
77 | tcg_temp_free_i64(tcg_vn); | ||
78 | tcg_temp_free_i64(tcg_vm); | ||
79 | } else { | ||
80 | - TCGv_i32 tcg_vn, tcg_vm; | ||
81 | + TCGv_i32 tcg_vn = tcg_temp_new_i32(); | ||
82 | + TCGv_i32 tcg_vm = tcg_temp_new_i32(); | ||
83 | |||
84 | - tcg_vn = read_fp_sreg(s, rn); | ||
85 | + read_vec_element_i32(s, tcg_vn, rn, 0, size); | ||
86 | if (cmp_with_zero) { | ||
87 | - tcg_vm = tcg_const_i32(0); | ||
88 | + tcg_gen_movi_i32(tcg_vm, 0); | ||
89 | } else { | ||
90 | - tcg_vm = read_fp_sreg(s, rm); | ||
91 | + read_vec_element_i32(s, tcg_vm, rm, 0, size); | ||
92 | } | ||
93 | - if (signal_all_nans) { | ||
94 | - gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
95 | - } else { | ||
96 | - gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
97 | + | ||
98 | + switch (size) { | ||
99 | + case MO_32: | ||
100 | + if (signal_all_nans) { | ||
101 | + gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
102 | + } else { | ||
103 | + gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
104 | + } | ||
105 | + break; | ||
106 | + case MO_16: | ||
107 | + if (signal_all_nans) { | ||
108 | + gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
109 | + } else { | ||
110 | + gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst); | ||
111 | + } | ||
112 | + break; | ||
113 | + default: | ||
114 | + g_assert_not_reached(); | ||
115 | } | ||
116 | + | ||
117 | tcg_temp_free_i32(tcg_vn); | ||
118 | tcg_temp_free_i32(tcg_vm); | ||
119 | } | ||
120 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double, | ||
121 | static void disas_fp_compare(DisasContext *s, uint32_t insn) | ||
122 | { | ||
123 | unsigned int mos, type, rm, op, rn, opc, op2r; | ||
124 | + int size; | ||
125 | |||
126 | mos = extract32(insn, 29, 3); | ||
127 | - type = extract32(insn, 22, 2); /* 0 = single, 1 = double */ | ||
128 | + type = extract32(insn, 22, 2); | ||
129 | rm = extract32(insn, 16, 5); | ||
130 | op = extract32(insn, 14, 2); | ||
131 | rn = extract32(insn, 5, 5); | ||
132 | opc = extract32(insn, 3, 2); | ||
133 | op2r = extract32(insn, 0, 3); | ||
134 | |||
135 | - if (mos || op || op2r || type > 1) { | ||
136 | + if (mos || op || op2r) { | ||
137 | + unallocated_encoding(s); | ||
106 | + return; | 138 | + return; |
107 | + } | 139 | + } |
108 | + | 140 | + |
109 | + ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | 141 | + switch (type) { |
110 | + KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err); | 142 | + case 0: |
111 | + if (err) { | 143 | + size = MO_32; |
112 | + error_report_err(err); | 144 | + break; |
113 | + } | 145 | + case 1: |
114 | + if (ret < 0 && ret != -EFAULT) { | 146 | + size = MO_64; |
115 | + abort(); | 147 | + break; |
116 | + } | 148 | + case 3: |
117 | +} | 149 | + size = MO_16; |
118 | + | 150 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
119 | static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | 151 | + break; |
120 | { | 152 | + } |
121 | GICv3ITSState *s = ARM_GICV3_ITS_COMMON(dev); | 153 | + /* fallthru */ |
122 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | 154 | + default: |
123 | kvm_msi_use_devid = true; | 155 | unallocated_encoding(s); |
124 | kvm_gsi_direct_mapping = false; | 156 | return; |
125 | kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled(); | 157 | } |
126 | + | 158 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_compare(DisasContext *s, uint32_t insn) |
127 | + qemu_add_vm_change_state_handler(vm_change_state_handler, s); | 159 | return; |
160 | } | ||
161 | |||
162 | - handle_fp_compare(s, type, rn, rm, opc & 1, opc & 2); | ||
163 | + handle_fp_compare(s, size, rn, rm, opc & 1, opc & 2); | ||
128 | } | 164 | } |
129 | 165 | ||
130 | static void kvm_arm_its_init(Object *obj) | 166 | /* Floating point conditional compare |
131 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_init(Object *obj) | 167 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) |
132 | &error_abort); | 168 | unsigned int mos, type, rm, cond, rn, op, nzcv; |
133 | } | 169 | TCGv_i64 tcg_flags; |
134 | 170 | TCGLabel *label_continue = NULL; | |
135 | +/** | 171 | + int size; |
136 | + * kvm_arm_its_pre_save - handles the saving of ITS registers. | 172 | |
137 | + * ITS tables are flushed into guest RAM separately and earlier, | 173 | mos = extract32(insn, 29, 3); |
138 | + * through the VM change state handler, since at the moment pre_save() | 174 | - type = extract32(insn, 22, 2); /* 0 = single, 1 = double */ |
139 | + * is called, the guest RAM has already been saved. | 175 | + type = extract32(insn, 22, 2); |
140 | + */ | 176 | rm = extract32(insn, 16, 5); |
141 | +static void kvm_arm_its_pre_save(GICv3ITSState *s) | 177 | cond = extract32(insn, 12, 4); |
142 | +{ | 178 | rn = extract32(insn, 5, 5); |
143 | + int i; | 179 | op = extract32(insn, 4, 1); |
144 | + | 180 | nzcv = extract32(insn, 0, 4); |
145 | + for (i = 0; i < 8; i++) { | 181 | |
146 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 182 | - if (mos || type > 1) { |
147 | + GITS_BASER + i * 8, &s->baser[i], false, | 183 | + if (mos) { |
148 | + &error_abort); | 184 | + unallocated_encoding(s); |
149 | + } | ||
150 | + | ||
151 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
152 | + GITS_CTLR, &s->ctlr, false, &error_abort); | ||
153 | + | ||
154 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
155 | + GITS_CBASER, &s->cbaser, false, &error_abort); | ||
156 | + | ||
157 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
158 | + GITS_CREADR, &s->creadr, false, &error_abort); | ||
159 | + | ||
160 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
161 | + GITS_CWRITER, &s->cwriter, false, &error_abort); | ||
162 | + | ||
163 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
164 | + GITS_IIDR, &s->iidr, false, &error_abort); | ||
165 | +} | ||
166 | + | ||
167 | +/** | ||
168 | + * kvm_arm_its_post_load - Restore both the ITS registers and tables | ||
169 | + */ | ||
170 | +static void kvm_arm_its_post_load(GICv3ITSState *s) | ||
171 | +{ | ||
172 | + int i; | ||
173 | + | ||
174 | + if (!s->iidr) { | ||
175 | + return; | 185 | + return; |
176 | + } | 186 | + } |
177 | + | 187 | + |
178 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 188 | + switch (type) { |
179 | + GITS_IIDR, &s->iidr, true, &error_abort); | 189 | + case 0: |
180 | + | 190 | + size = MO_32; |
181 | + /* | 191 | + break; |
182 | + * must be written before GITS_CREADR since GITS_CBASER write | 192 | + case 1: |
183 | + * access resets GITS_CREADR. | 193 | + size = MO_64; |
184 | + */ | 194 | + break; |
185 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 195 | + case 3: |
186 | + GITS_CBASER, &s->cbaser, true, &error_abort); | 196 | + size = MO_16; |
187 | + | 197 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
188 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 198 | + break; |
189 | + GITS_CREADR, &s->creadr, true, &error_abort); | 199 | + } |
190 | + | 200 | + /* fallthru */ |
191 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 201 | + default: |
192 | + GITS_CWRITER, &s->cwriter, true, &error_abort); | 202 | unallocated_encoding(s); |
193 | + | 203 | return; |
194 | + | 204 | } |
195 | + for (i = 0; i < 8; i++) { | 205 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) |
196 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 206 | gen_set_label(label_match); |
197 | + GITS_BASER + i * 8, &s->baser[i], true, | 207 | } |
198 | + &error_abort); | 208 | |
199 | + } | 209 | - handle_fp_compare(s, type, rn, rm, false, op); |
200 | + | 210 | + handle_fp_compare(s, size, rn, rm, false, op); |
201 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | 211 | |
202 | + KVM_DEV_ARM_ITS_RESTORE_TABLES, NULL, true, | 212 | if (cond < 0x0e) { |
203 | + &error_abort); | 213 | gen_set_label(label_continue); |
204 | + | ||
205 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | ||
206 | + GITS_CTLR, &s->ctlr, true, &error_abort); | ||
207 | +} | ||
208 | + | ||
209 | static void kvm_arm_its_class_init(ObjectClass *klass, void *data) | ||
210 | { | ||
211 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
212 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_class_init(ObjectClass *klass, void *data) | ||
213 | |||
214 | dc->realize = kvm_arm_its_realize; | ||
215 | icc->send_msi = kvm_its_send_msi; | ||
216 | + icc->pre_save = kvm_arm_its_pre_save; | ||
217 | + icc->post_load = kvm_arm_its_post_load; | ||
218 | } | ||
219 | |||
220 | static const TypeInfo kvm_arm_its_info = { | ||
221 | -- | 214 | -- |
222 | 2.7.4 | 215 | 2.17.0 |
223 | 216 | ||
224 | 217 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This patch adds the flush of the LPI pending bits into the | 3 | These were missed out from the rest of the half-precision work. |
4 | redistributor pending tables. This happens on VM stop. | ||
5 | 4 | ||
6 | There is no explicit restore as the tables are implicitly sync'ed | 5 | Cc: qemu-stable@nongnu.org |
7 | on ITS table restore and on LPI enable at redistributor level. | ||
8 | |||
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Message-id: 1497023553-18411-4-git-send-email-eric.auger@redhat.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20180512003217.9105-10-richard.henderson@linaro.org | ||
11 | [rth: Fix erroneous check vs type] | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 14 | --- |
14 | hw/intc/arm_gicv3_kvm.c | 34 ++++++++++++++++++++++++++++++++++ | 15 | target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------ |
15 | 1 file changed, 34 insertions(+) | 16 | 1 file changed, 25 insertions(+), 6 deletions(-) |
16 | 17 | ||
17 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 18 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/intc/arm_gicv3_kvm.c | 20 | --- a/target/arm/translate-a64.c |
20 | +++ b/hw/intc/arm_gicv3_kvm.c | 21 | +++ b/target/arm/translate-a64.c |
21 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) |
22 | #include "hw/sysbus.h" | 23 | unsigned int mos, type, rm, cond, rn, rd; |
23 | #include "qemu/error-report.h" | 24 | TCGv_i64 t_true, t_false, t_zero; |
24 | #include "sysemu/kvm.h" | 25 | DisasCompare64 c; |
25 | +#include "sysemu/sysemu.h" | 26 | + TCGMemOp sz; |
26 | #include "kvm_arm.h" | 27 | |
27 | #include "gicv3_internal.h" | 28 | mos = extract32(insn, 29, 3); |
28 | #include "vgic_common.h" | 29 | - type = extract32(insn, 22, 2); /* 0 = single, 1 = double */ |
29 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { | 30 | + type = extract32(insn, 22, 2); |
30 | REGINFO_SENTINEL | 31 | rm = extract32(insn, 16, 5); |
31 | }; | 32 | cond = extract32(insn, 12, 4); |
32 | 33 | rn = extract32(insn, 5, 5); | |
33 | +/** | 34 | rd = extract32(insn, 0, 5); |
34 | + * vm_change_state_handler - VM change state callback aiming at flushing | 35 | |
35 | + * RDIST pending tables into guest RAM | 36 | - if (mos || type > 1) { |
36 | + * | 37 | + if (mos) { |
37 | + * The tables get flushed to guest RAM whenever the VM gets stopped. | 38 | + unallocated_encoding(s); |
38 | + */ | ||
39 | +static void vm_change_state_handler(void *opaque, int running, | ||
40 | + RunState state) | ||
41 | +{ | ||
42 | + GICv3State *s = (GICv3State *)opaque; | ||
43 | + Error *err = NULL; | ||
44 | + int ret; | ||
45 | + | ||
46 | + if (running) { | ||
47 | + return; | 39 | + return; |
48 | + } | 40 | + } |
49 | + | 41 | + |
50 | + ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | 42 | + switch (type) { |
51 | + KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES, | 43 | + case 0: |
52 | + NULL, true, &err); | 44 | + sz = MO_32; |
53 | + if (err) { | 45 | + break; |
54 | + error_report_err(err); | 46 | + case 1: |
55 | + } | 47 | + sz = MO_64; |
56 | + if (ret < 0 && ret != -EFAULT) { | 48 | + break; |
57 | + abort(); | 49 | + case 3: |
58 | + } | 50 | + sz = MO_16; |
59 | +} | 51 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
60 | + | 52 | + break; |
61 | + | 53 | + } |
62 | static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | 54 | + /* fallthru */ |
63 | { | 55 | + default: |
64 | GICv3State *s = KVM_ARM_GICV3(dev); | 56 | unallocated_encoding(s); |
65 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | 57 | return; |
66 | return; | ||
67 | } | ||
68 | } | 58 | } |
69 | + if (kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | 59 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) |
70 | + KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES)) { | 60 | return; |
71 | + qemu_add_vm_change_state_handler(vm_change_state_handler, s); | 61 | } |
72 | + } | 62 | |
73 | } | 63 | - /* Zero extend sreg inputs to 64 bits now. */ |
74 | 64 | + /* Zero extend sreg & hreg inputs to 64 bits now. */ | |
75 | static void kvm_arm_gicv3_class_init(ObjectClass *klass, void *data) | 65 | t_true = tcg_temp_new_i64(); |
66 | t_false = tcg_temp_new_i64(); | ||
67 | - read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32); | ||
68 | - read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32); | ||
69 | + read_vec_element(s, t_true, rn, 0, sz); | ||
70 | + read_vec_element(s, t_false, rm, 0, sz); | ||
71 | |||
72 | a64_test_cc(&c, cond); | ||
73 | t_zero = tcg_const_i64(0); | ||
74 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) | ||
75 | tcg_temp_free_i64(t_false); | ||
76 | a64_free_cc(&c); | ||
77 | |||
78 | - /* Note that sregs write back zeros to the high bits, | ||
79 | + /* Note that sregs & hregs write back zeros to the high bits, | ||
80 | and we've already done the zero-extension. */ | ||
81 | write_fp_dreg(s, rd, t_true); | ||
82 | tcg_temp_free_i64(t_true); | ||
76 | -- | 83 | -- |
77 | 2.7.4 | 84 | 2.17.0 |
78 | 85 | ||
79 | 86 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Statements under 'case' were in some places wrongly indented bringing | 3 | All the hard work is already done by vfp_expand_imm, we just need to |
4 | confusion and making the code less readable. Remove also few unneeded | 4 | make sure we pick up the correct size. |
5 | blank lines. No functional changes. | ||
6 | 5 | ||
7 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 6 | Cc: qemu-stable@nongnu.org |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
9 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20180512003217.9105-11-richard.henderson@linaro.org | ||
12 | [rth: Merge unallocated_encoding check with TCGMemOp conversion.] | ||
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 15 | --- |
12 | hw/timer/exynos4210_mct.c | 45 ++++++++++++++++++++------------------------- | 16 | target/arm/translate-a64.c | 20 +++++++++++++++++--- |
13 | 1 file changed, 20 insertions(+), 25 deletions(-) | 17 | 1 file changed, 17 insertions(+), 3 deletions(-) |
14 | 18 | ||
15 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | 19 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/timer/exynos4210_mct.c | 21 | --- a/target/arm/translate-a64.c |
18 | +++ b/hw/timer/exynos4210_mct.c | 22 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset, | 23 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) |
20 | 24 | { | |
21 | case G_COMP_L(0): case G_COMP_L(1): case G_COMP_L(2): case G_COMP_L(3): | 25 | int rd = extract32(insn, 0, 5); |
22 | case G_COMP_U(0): case G_COMP_U(1): case G_COMP_U(2): case G_COMP_U(3): | 26 | int imm8 = extract32(insn, 13, 8); |
23 | - index = GET_G_COMP_IDX(offset); | 27 | - int is_double = extract32(insn, 22, 2); |
24 | - shift = 8 * (offset & 0x4); | 28 | + int type = extract32(insn, 22, 2); |
25 | - value = UINT32_MAX & (s->g_timer.reg.comp[index] >> shift); | 29 | uint64_t imm; |
26 | + index = GET_G_COMP_IDX(offset); | 30 | TCGv_i64 tcg_res; |
27 | + shift = 8 * (offset & 0x4); | 31 | + TCGMemOp sz; |
28 | + value = UINT32_MAX & (s->g_timer.reg.comp[index] >> shift); | 32 | |
29 | break; | 33 | - if (is_double > 1) { |
30 | 34 | + switch (type) { | |
31 | case G_TCON: | 35 | + case 0: |
32 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset, | 36 | + sz = MO_32; |
33 | lt_i = GET_L_TIMER_IDX(offset); | 37 | + break; |
34 | 38 | + case 1: | |
35 | value = exynos4210_lfrc_get_count(&s->l_timer[lt_i]); | 39 | + sz = MO_64; |
36 | - | 40 | + break; |
37 | break; | 41 | + case 3: |
38 | 42 | + sz = MO_16; | |
39 | case L0_TCON: case L1_TCON: | 43 | + if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { |
40 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | 44 | + break; |
41 | |||
42 | case G_COMP_L(0): case G_COMP_L(1): case G_COMP_L(2): case G_COMP_L(3): | ||
43 | case G_COMP_U(0): case G_COMP_U(1): case G_COMP_U(2): case G_COMP_U(3): | ||
44 | - index = GET_G_COMP_IDX(offset); | ||
45 | - shift = 8 * (offset & 0x4); | ||
46 | - s->g_timer.reg.comp[index] = | ||
47 | - (s->g_timer.reg.comp[index] & | ||
48 | - (((uint64_t)UINT32_MAX << 32) >> shift)) + | ||
49 | - (value << shift); | ||
50 | + index = GET_G_COMP_IDX(offset); | ||
51 | + shift = 8 * (offset & 0x4); | ||
52 | + s->g_timer.reg.comp[index] = | ||
53 | + (s->g_timer.reg.comp[index] & | ||
54 | + (((uint64_t)UINT32_MAX << 32) >> shift)) + | ||
55 | + (value << shift); | ||
56 | |||
57 | - DPRINTF("comparator %d write 0x%llx val << %d\n", index, value, shift); | ||
58 | + DPRINTF("comparator %d write 0x%llx val << %d\n", index, value, shift); | ||
59 | |||
60 | - if (offset & 0x4) { | ||
61 | - s->g_timer.reg.wstat |= G_WSTAT_COMP_U(index); | ||
62 | - } else { | ||
63 | - s->g_timer.reg.wstat |= G_WSTAT_COMP_L(index); | ||
64 | - } | ||
65 | + if (offset & 0x4) { | ||
66 | + s->g_timer.reg.wstat |= G_WSTAT_COMP_U(index); | ||
67 | + } else { | ||
68 | + s->g_timer.reg.wstat |= G_WSTAT_COMP_L(index); | ||
69 | + } | 45 | + } |
70 | 46 | + /* fallthru */ | |
71 | - exynos4210_gfrc_restart(s); | 47 | + default: |
72 | - break; | 48 | unallocated_encoding(s); |
73 | + exynos4210_gfrc_restart(s); | 49 | return; |
74 | + break; | 50 | } |
75 | 51 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) | |
76 | case G_TCON: | 52 | return; |
77 | old_val = s->g_timer.reg.tcon; | 53 | } |
78 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | 54 | |
79 | break; | 55 | - imm = vfp_expand_imm(MO_32 + is_double, imm8); |
80 | 56 | + imm = vfp_expand_imm(sz, imm8); | |
81 | case G_INT_ENB: | 57 | |
82 | - | 58 | tcg_res = tcg_const_i64(imm); |
83 | /* Raise IRQ if transition from disabled to enabled and CSTAT pending */ | 59 | write_fp_dreg(s, rd, tcg_res); |
84 | for (i = 0; i < MCT_GT_CMP_NUM; i++) { | ||
85 | if ((value & G_INT_ENABLE(i)) > (s->g_timer.reg.tcon & | ||
86 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | ||
87 | break; | ||
88 | |||
89 | case L0_TCNTB: case L1_TCNTB: | ||
90 | - | ||
91 | lt_i = GET_L_TIMER_IDX(offset); | ||
92 | index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i); | ||
93 | |||
94 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | ||
95 | break; | ||
96 | |||
97 | case L0_ICNTB: case L1_ICNTB: | ||
98 | - | ||
99 | lt_i = GET_L_TIMER_IDX(offset); | ||
100 | index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i); | ||
101 | |||
102 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | ||
103 | if (icntb_max[lt_i] < value) { | ||
104 | icntb_max[lt_i] = value; | ||
105 | } | ||
106 | -DPRINTF("local timer[%d] ICNTB write %llx; max=%x, min=%x\n\n", | ||
107 | - lt_i, value, icntb_max[lt_i], icntb_min[lt_i]); | ||
108 | + DPRINTF("local timer[%d] ICNTB write %llx; max=%x, min=%x\n\n", | ||
109 | + lt_i, value, icntb_max[lt_i], icntb_min[lt_i]); | ||
110 | #endif | ||
111 | -break; | ||
112 | + break; | ||
113 | |||
114 | case L0_FRCNTB: case L1_FRCNTB: | ||
115 | - | ||
116 | lt_i = GET_L_TIMER_IDX(offset); | ||
117 | index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i); | ||
118 | |||
119 | -- | 60 | -- |
120 | 2.7.4 | 61 | 2.17.0 |
121 | 62 | ||
122 | 63 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Use a define for a9mpcore_priv device type name instead of hard-coded | 3 | We are meant to explicitly pass fpst, not cpu_env. |
4 | string. | ||
5 | 4 | ||
6 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | 5 | Cc: qemu-stable@nongnu.org |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Message-id: 20180512003217.9105-12-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 12 | --- |
10 | hw/arm/exynos4210.c | 3 ++- | 13 | target/arm/translate-a64.c | 3 ++- |
11 | 1 file changed, 2 insertions(+), 1 deletion(-) | 14 | 1 file changed, 2 insertions(+), 1 deletion(-) |
12 | 15 | ||
13 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/exynos4210.c | 18 | --- a/target/arm/translate-a64.c |
16 | +++ b/hw/arm/exynos4210.c | 19 | +++ b/target/arm/translate-a64.c |
17 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) |
18 | #include "qemu-common.h" | 21 | tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000); |
19 | #include "qemu/log.h" | 22 | break; |
20 | #include "cpu.h" | 23 | case 0x3: /* FSQRT */ |
21 | +#include "hw/cpu/a9mpcore.h" | 24 | - gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env); |
22 | #include "hw/boards.h" | 25 | + fpst = get_fpstatus_ptr(true); |
23 | #include "sysemu/sysemu.h" | 26 | + gen_helper_sqrt_f16(tcg_res, tcg_op, fpst); |
24 | #include "hw/sysbus.h" | 27 | break; |
25 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 28 | case 0x8: /* FRINTN */ |
26 | } | 29 | case 0x9: /* FRINTP */ |
27 | |||
28 | /* Private memory region and Internal GIC */ | ||
29 | - dev = qdev_create(NULL, "a9mpcore_priv"); | ||
30 | + dev = qdev_create(NULL, TYPE_A9MPCORE_PRIV); | ||
31 | qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS); | ||
32 | qdev_init_nofail(dev); | ||
33 | busdev = SYS_BUS_DEVICE(dev); | ||
34 | -- | 30 | -- |
35 | 2.7.4 | 31 | 2.17.0 |
36 | 32 | ||
37 | 33 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | In some circumstances, we don't want to abort if the | 3 | Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status": |
4 | kvm_device_access fails. This will be the case during ITS | ||
5 | migration, in case the ITS table save/restore fails because | ||
6 | the guest did not program the vITS correctly. So let's pass an | ||
7 | error object to the function and return the ioctl value. New | ||
8 | callers will be able to make a decision upon this returned | ||
9 | value. | ||
10 | 4 | ||
11 | Existing callers pass &error_abort which will cause the | 5 | The block length is predefined to 512 bits |
12 | function to abort on failure. | ||
13 | 6 | ||
14 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 7 | and "4.10.2 SD Status": |
15 | Reviewed-by: Juan Quintela <quintela@redhat.com> | 8 | |
16 | Reviewed-by: Peter Xu <peterx@redhat.com> | 9 | The SD Status contains status bits that are related to the SD Memory Card |
17 | Message-id: 1497023553-18411-2-git-send-email-eric.auger@redhat.com | 10 | proprietary features and may be used for future application-specific usage. |
18 | [PMM: wrapped long line] | 11 | The size of the SD Status is one data block of 512 bit. The content of this |
12 | register is transmitted to the Host over the DAT bus along with a 16-bit CRC. | ||
13 | |||
14 | Thus the 16-bit CRC goes at offset 64. | ||
15 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20180509060104.4458-3-f4bug@amsat.org | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 20 | --- |
21 | include/sysemu/kvm.h | 11 +++++++---- | 21 | hw/sd/sd.c | 2 +- |
22 | hw/intc/arm_gic_kvm.c | 9 +++++---- | 22 | 1 file changed, 1 insertion(+), 1 deletion(-) |
23 | hw/intc/arm_gicv3_its_kvm.c | 2 +- | ||
24 | hw/intc/arm_gicv3_kvm.c | 14 +++++++------- | ||
25 | kvm-all.c | 14 ++++++++------ | ||
26 | 5 files changed, 28 insertions(+), 22 deletions(-) | ||
27 | 23 | ||
28 | diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h | 24 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c |
29 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/include/sysemu/kvm.h | 26 | --- a/hw/sd/sd.c |
31 | +++ b/include/sysemu/kvm.h | 27 | +++ b/hw/sd/sd.c |
32 | @@ -XXX,XX +XXX,XX @@ int kvm_device_check_attr(int fd, uint32_t group, uint64_t attr); | 28 | @@ -XXX,XX +XXX,XX @@ static void sd_function_switch(SDState *sd, uint32_t arg) |
33 | * @attr: the attribute of that group to set or get | 29 | sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4); |
34 | * @val: pointer to a storage area for the value | 30 | } |
35 | * @write: true for set and false for get operation | 31 | memset(&sd->data[17], 0, 47); |
36 | + * @errp: error object handle | 32 | - stw_be_p(sd->data + 65, sd_crc16(sd->data, 64)); |
37 | * | 33 | + stw_be_p(sd->data + 64, sd_crc16(sd->data, 64)); |
38 | - * This function is not allowed to fail. Use kvm_device_check_attr() | ||
39 | - * in order to check for the availability of optional attributes. | ||
40 | + * Returns: 0 on success | ||
41 | + * < 0 on error | ||
42 | + * Use kvm_device_check_attr() in order to check for the availability | ||
43 | + * of optional attributes. | ||
44 | */ | ||
45 | -void kvm_device_access(int fd, int group, uint64_t attr, | ||
46 | - void *val, bool write); | ||
47 | +int kvm_device_access(int fd, int group, uint64_t attr, | ||
48 | + void *val, bool write, Error **errp); | ||
49 | |||
50 | /** | ||
51 | * kvm_create_device - create a KVM device for the device control API | ||
52 | diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/hw/intc/arm_gic_kvm.c | ||
55 | +++ b/hw/intc/arm_gic_kvm.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void kvm_gicd_access(GICState *s, int offset, int cpu, | ||
57 | uint32_t *val, bool write) | ||
58 | { | ||
59 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_DIST_REGS, | ||
60 | - KVM_VGIC_ATTR(offset, cpu), val, write); | ||
61 | + KVM_VGIC_ATTR(offset, cpu), val, write, &error_abort); | ||
62 | } | 34 | } |
63 | 35 | ||
64 | static void kvm_gicc_access(GICState *s, int offset, int cpu, | 36 | static inline bool sd_wp_addr(SDState *sd, uint64_t addr) |
65 | uint32_t *val, bool write) | ||
66 | { | ||
67 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_REGS, | ||
68 | - KVM_VGIC_ATTR(offset, cpu), val, write); | ||
69 | + KVM_VGIC_ATTR(offset, cpu), val, write, &error_abort); | ||
70 | } | ||
71 | |||
72 | #define for_each_irq_reg(_ctr, _max_irq, _field_width) \ | ||
73 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) | ||
74 | if (kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0)) { | ||
75 | uint32_t numirqs = s->num_irq; | ||
76 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0, | ||
77 | - &numirqs, true); | ||
78 | + &numirqs, true, &error_abort); | ||
79 | } | ||
80 | /* Tell the kernel to complete VGIC initialization now */ | ||
81 | if (kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
82 | KVM_DEV_ARM_VGIC_CTRL_INIT)) { | ||
83 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
84 | - KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true); | ||
85 | + KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, | ||
86 | + &error_abort); | ||
87 | } | ||
88 | } else if (ret != -ENODEV && ret != -ENOTSUP) { | ||
89 | error_setg_errno(errp, -ret, "error creating in-kernel VGIC"); | ||
90 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/hw/intc/arm_gicv3_its_kvm.c | ||
93 | +++ b/hw/intc/arm_gicv3_its_kvm.c | ||
94 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | ||
95 | |||
96 | /* explicit init of the ITS */ | ||
97 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
98 | - KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true); | ||
99 | + KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, &error_abort); | ||
100 | |||
101 | /* register the base address */ | ||
102 | kvm_arm_register_device(&s->iomem_its_cntrl, -1, KVM_DEV_ARM_VGIC_GRP_ADDR, | ||
103 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | ||
104 | index XXXXXXX..XXXXXXX 100644 | ||
105 | --- a/hw/intc/arm_gicv3_kvm.c | ||
106 | +++ b/hw/intc/arm_gicv3_kvm.c | ||
107 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_gicd_access(GICv3State *s, int offset, | ||
108 | { | ||
109 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_DIST_REGS, | ||
110 | KVM_VGIC_ATTR(offset, 0), | ||
111 | - val, write); | ||
112 | + val, write, &error_abort); | ||
113 | } | ||
114 | |||
115 | static inline void kvm_gicr_access(GICv3State *s, int offset, int cpu, | ||
116 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_gicr_access(GICv3State *s, int offset, int cpu, | ||
117 | { | ||
118 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_REDIST_REGS, | ||
119 | KVM_VGIC_ATTR(offset, s->cpu[cpu].gicr_typer), | ||
120 | - val, write); | ||
121 | + val, write, &error_abort); | ||
122 | } | ||
123 | |||
124 | static inline void kvm_gicc_access(GICv3State *s, uint64_t reg, int cpu, | ||
125 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_gicc_access(GICv3State *s, uint64_t reg, int cpu, | ||
126 | { | ||
127 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS, | ||
128 | KVM_VGIC_ATTR(reg, s->cpu[cpu].gicr_typer), | ||
129 | - val, write); | ||
130 | + val, write, &error_abort); | ||
131 | } | ||
132 | |||
133 | static inline void kvm_gic_line_level_access(GICv3State *s, int irq, int cpu, | ||
134 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_gic_line_level_access(GICv3State *s, int irq, int cpu, | ||
135 | KVM_VGIC_ATTR(irq, s->cpu[cpu].gicr_typer) | | ||
136 | (VGIC_LEVEL_INFO_LINE_LEVEL << | ||
137 | KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT), | ||
138 | - val, write); | ||
139 | + val, write, &error_abort); | ||
140 | } | ||
141 | |||
142 | /* Loop through each distributor IRQ related register; since bits | ||
143 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri) | ||
144 | /* Initialize to actual HW supported configuration */ | ||
145 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS, | ||
146 | KVM_VGIC_ATTR(ICC_CTLR_EL1, cpu->mp_affinity), | ||
147 | - &c->icc_ctlr_el1[GICV3_NS], false); | ||
148 | + &c->icc_ctlr_el1[GICV3_NS], false, &error_abort); | ||
149 | |||
150 | c->icc_ctlr_el1[GICV3_S] = c->icc_ctlr_el1[GICV3_NS]; | ||
151 | } | ||
152 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | ||
153 | } | ||
154 | |||
155 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, | ||
156 | - 0, &s->num_irq, true); | ||
157 | + 0, &s->num_irq, true, &error_abort); | ||
158 | |||
159 | /* Tell the kernel to complete VGIC initialization now */ | ||
160 | kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
161 | - KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true); | ||
162 | + KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, &error_abort); | ||
163 | |||
164 | kvm_arm_register_device(&s->iomem_dist, -1, KVM_DEV_ARM_VGIC_GRP_ADDR, | ||
165 | KVM_VGIC_V3_ADDR_TYPE_DIST, s->dev_fd); | ||
166 | diff --git a/kvm-all.c b/kvm-all.c | ||
167 | index XXXXXXX..XXXXXXX 100644 | ||
168 | --- a/kvm-all.c | ||
169 | +++ b/kvm-all.c | ||
170 | @@ -XXX,XX +XXX,XX @@ | ||
171 | #include "qemu/option.h" | ||
172 | #include "qemu/config-file.h" | ||
173 | #include "qemu/error-report.h" | ||
174 | +#include "qapi/error.h" | ||
175 | #include "hw/hw.h" | ||
176 | #include "hw/pci/msi.h" | ||
177 | #include "hw/pci/msix.h" | ||
178 | @@ -XXX,XX +XXX,XX @@ int kvm_device_check_attr(int dev_fd, uint32_t group, uint64_t attr) | ||
179 | return kvm_device_ioctl(dev_fd, KVM_HAS_DEVICE_ATTR, &attribute) ? 0 : 1; | ||
180 | } | ||
181 | |||
182 | -void kvm_device_access(int fd, int group, uint64_t attr, | ||
183 | - void *val, bool write) | ||
184 | +int kvm_device_access(int fd, int group, uint64_t attr, | ||
185 | + void *val, bool write, Error **errp) | ||
186 | { | ||
187 | struct kvm_device_attr kvmattr; | ||
188 | int err; | ||
189 | @@ -XXX,XX +XXX,XX @@ void kvm_device_access(int fd, int group, uint64_t attr, | ||
190 | write ? KVM_SET_DEVICE_ATTR : KVM_GET_DEVICE_ATTR, | ||
191 | &kvmattr); | ||
192 | if (err < 0) { | ||
193 | - error_report("KVM_%s_DEVICE_ATTR failed: %s", | ||
194 | - write ? "SET" : "GET", strerror(-err)); | ||
195 | - error_printf("Group %d attr 0x%016" PRIx64 "\n", group, attr); | ||
196 | - abort(); | ||
197 | + error_setg_errno(errp, -err, | ||
198 | + "KVM_%s_DEVICE_ATTR failed: Group %d " | ||
199 | + "attr 0x%016" PRIx64, | ||
200 | + write ? "SET" : "GET", group, attr); | ||
201 | } | ||
202 | + return err; | ||
203 | } | ||
204 | |||
205 | /* Return 1 on success, 0 on failure */ | ||
206 | -- | 37 | -- |
207 | 2.7.4 | 38 | 2.17.0 |
208 | 39 | ||
209 | 40 | diff view generated by jsdifflib |
1 | From: Krzysztof Kozlowski <krzk@kernel.org> | 1 | Usually the logging of the CPU state produced by -d cpu is sufficient |
---|---|---|---|
2 | to diagnose problems, but sometimes you want to see the state of | ||
3 | the floating point registers as well. We don't want to enable that | ||
4 | by default as it adds a lot of extra data to the log; instead, | ||
5 | allow it to be optionally enabled via -d fpu. | ||
2 | 6 | ||
3 | Fix checkpatch errors: | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | 1. ERROR: spaces required around that '+' (ctx:VxV) | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | 2. ERROR: spaces required around that '&' (ctx:VxV) | 9 | Message-id: 20180510130024.31678-1-peter.maydell@linaro.org |
10 | --- | ||
11 | include/qemu/log.h | 1 + | ||
12 | accel/tcg/cpu-exec.c | 9 ++++++--- | ||
13 | util/log.c | 2 ++ | ||
14 | 3 files changed, 9 insertions(+), 3 deletions(-) | ||
6 | 15 | ||
7 | No functional changes. | 16 | diff --git a/include/qemu/log.h b/include/qemu/log.h |
8 | |||
9 | Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/timer/exynos4210_mct.c | 4 ++-- | ||
15 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/timer/exynos4210_mct.c | 18 | --- a/include/qemu/log.h |
20 | +++ b/hw/timer/exynos4210_mct.c | 19 | +++ b/include/qemu/log.h |
21 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) | 20 | @@ -XXX,XX +XXX,XX @@ static inline bool qemu_log_separate(void) |
22 | { | 21 | #define CPU_LOG_PAGE (1 << 14) |
23 | uint32_t freq = s->freq; | 22 | /* LOG_TRACE (1 << 15) is defined in log-for-trace.h */ |
24 | s->freq = 24000000 / | 23 | #define CPU_LOG_TB_OP_IND (1 << 16) |
25 | - ((MCT_CFG_GET_PRESCALER(s->reg_mct_cfg)+1) * | 24 | +#define CPU_LOG_TB_FPU (1 << 17) |
26 | + ((MCT_CFG_GET_PRESCALER(s->reg_mct_cfg) + 1) * | 25 | |
27 | MCT_CFG_GET_DIVIDER(s->reg_mct_cfg)); | 26 | /* Lock output for a series of related logs. Since this is not needed |
28 | 27 | * for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we | |
29 | if (freq != s->freq) { | 28 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c |
30 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | 29 | index XXXXXXX..XXXXXXX 100644 |
31 | 30 | --- a/accel/tcg/cpu-exec.c | |
32 | DPRINTF("comparator %d write 0x%llx val << %d\n", index, value, shift); | 31 | +++ b/accel/tcg/cpu-exec.c |
33 | 32 | @@ -XXX,XX +XXX,XX @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb) | |
34 | - if (offset&0x4) { | 33 | if (qemu_loglevel_mask(CPU_LOG_TB_CPU) |
35 | + if (offset & 0x4) { | 34 | && qemu_log_in_addr_range(itb->pc)) { |
36 | s->g_timer.reg.wstat |= G_WSTAT_COMP_U(index); | 35 | qemu_log_lock(); |
37 | } else { | 36 | + int flags = 0; |
38 | s->g_timer.reg.wstat |= G_WSTAT_COMP_L(index); | 37 | + if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) { |
38 | + flags |= CPU_DUMP_FPU; | ||
39 | + } | ||
40 | #if defined(TARGET_I386) | ||
41 | - log_cpu_state(cpu, CPU_DUMP_CCOP); | ||
42 | -#else | ||
43 | - log_cpu_state(cpu, 0); | ||
44 | + flags |= CPU_DUMP_CCOP; | ||
45 | #endif | ||
46 | + log_cpu_state(cpu, flags); | ||
47 | qemu_log_unlock(); | ||
48 | } | ||
49 | #endif /* DEBUG_DISAS */ | ||
50 | diff --git a/util/log.c b/util/log.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/util/log.c | ||
53 | +++ b/util/log.c | ||
54 | @@ -XXX,XX +XXX,XX @@ const QEMULogItem qemu_log_items[] = { | ||
55 | "show trace before each executed TB (lots of logs)" }, | ||
56 | { CPU_LOG_TB_CPU, "cpu", | ||
57 | "show CPU registers before entering a TB (lots of logs)" }, | ||
58 | + { CPU_LOG_TB_FPU, "fpu", | ||
59 | + "include FPU registers in the 'cpu' logging" }, | ||
60 | { CPU_LOG_MMU, "mmu", | ||
61 | "log MMU-related activities" }, | ||
62 | { CPU_LOG_PCALL, "pcall", | ||
39 | -- | 63 | -- |
40 | 2.7.4 | 64 | 2.17.0 |
41 | 65 | ||
42 | 66 | diff view generated by jsdifflib |