1 | Arm queue; bugfixes only. | 1 | A few patches for the rc today... |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | The following changes since commit 109918d24a3bb9ed3d05beb34ea4ac6be443c138: |
4 | -- PMM | ||
5 | 4 | ||
6 | The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739: | 5 | Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-for-6.0-pull-request' into staging (2021-04-05 22:15:38 +0100) |
7 | |||
8 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000) | ||
9 | 6 | ||
10 | are available in the Git repository at: | 7 | are available in the Git repository at: |
11 | 8 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117 | 9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210406 |
13 | 10 | ||
14 | for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42: | 11 | for you to fetch changes up to 49bc76550c37f4a2b92a05cb3e6989a739d56ac9: |
15 | 12 | ||
16 | tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000) | 13 | Remove myself as i.mx31 maintainer (2021-04-06 11:49:15 +0100) |
17 | 14 | ||
18 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
19 | target-arm queue: | 16 | target-arm queue: |
20 | * hw/arm/virt: ARM_VIRT must select ARM_GIC | 17 | * ppc/e500 and arm/virt: only add valid dynamic sysbus devices to the |
21 | * exynos: Fix bad printf format specifiers | 18 | platform bus |
22 | * hw/input/ps2.c: Remove remnants of printf debug | 19 | * update i.mx31 maintainer list |
23 | * target/openrisc: Remove dead code attempting to check "is timer disabled" | 20 | * Revert "target/arm: Make number of counters in PMCR follow the CPU" |
24 | * register: Remove unnecessary NULL check | ||
25 | * util/cutils: Fix Coverity array overrun in freq_to_str() | ||
26 | * configure: Make "does libgio work" test pull in some actual functions | ||
27 | * tmp105: reset the T_low and T_High registers | ||
28 | * tmp105: Correct handling of temperature limit checks | ||
29 | 21 | ||
30 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
31 | Alex Chen (1): | 23 | Chubb, Peter (Data61, Eveleigh) (1): |
32 | exynos: Fix bad printf format specifiers | 24 | Remove myself as i.mx31 maintainer |
33 | |||
34 | Alistair Francis (1): | ||
35 | register: Remove unnecessary NULL check | ||
36 | |||
37 | Andrew Jones (1): | ||
38 | hw/arm/virt: ARM_VIRT must select ARM_GIC | ||
39 | 25 | ||
40 | Peter Maydell (5): | 26 | Peter Maydell (5): |
41 | hw/input/ps2.c: Remove remnants of printf debug | 27 | include/hw/boards.h: Document machine_class_allow_dynamic_sysbus_dev() |
42 | target/openrisc: Remove dead code attempting to check "is timer disabled" | 28 | machine: Provide a function to check the dynamic sysbus allowlist |
43 | configure: Make "does libgio work" test pull in some actual functions | 29 | hw/arm/virt: Only try to add valid dynamic sysbus devices to platform bus |
44 | hw/misc/tmp105: reset the T_low and T_High registers | 30 | hw/ppc/e500plat: Only try to add valid dynamic sysbus devices to platform bus |
45 | tmp105: Correct handling of temperature limit checks | 31 | Revert "target/arm: Make number of counters in PMCR follow the CPU" |
46 | 32 | ||
47 | Philippe Mathieu-Daudé (1): | 33 | include/hw/boards.h | 39 +++++++++++++++++++++++++++++++++++++++ |
48 | util/cutils: Fix Coverity array overrun in freq_to_str() | 34 | target/arm/cpu.h | 1 - |
35 | hw/arm/virt.c | 8 ++++++-- | ||
36 | hw/core/machine.c | 21 ++++++++++++++++----- | ||
37 | hw/ppc/e500plat.c | 8 ++++++-- | ||
38 | target/arm/cpu64.c | 3 --- | ||
39 | target/arm/cpu_tcg.c | 5 ----- | ||
40 | target/arm/helper.c | 29 ++++++++++++----------------- | ||
41 | target/arm/kvm64.c | 2 -- | ||
42 | MAINTAINERS | 1 - | ||
43 | 10 files changed, 79 insertions(+), 38 deletions(-) | ||
49 | 44 | ||
50 | configure | 11 +++++-- | ||
51 | hw/misc/tmp105.h | 7 +++++ | ||
52 | hw/core/register.c | 4 --- | ||
53 | hw/input/ps2.c | 9 ------ | ||
54 | hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------ | ||
55 | hw/timer/exynos4210_mct.c | 4 +-- | ||
56 | hw/timer/exynos4210_pwm.c | 8 ++--- | ||
57 | target/openrisc/sys_helper.c | 3 -- | ||
58 | util/cutils.c | 3 +- | ||
59 | hw/arm/Kconfig | 1 + | ||
60 | 10 files changed, 89 insertions(+), 34 deletions(-) | ||
61 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | The removal of the selection of A15MPCORE from ARM_VIRT also | ||
4 | removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC. | ||
5 | |||
6 | Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals") | ||
7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> | ||
8 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20201111143440.112763-1-drjones@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/Kconfig | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/Kconfig | ||
20 | +++ b/hw/arm/Kconfig | ||
21 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | ||
22 | imply VFIO_PLATFORM | ||
23 | imply VFIO_XGMAC | ||
24 | imply TPM_TIS_SYSBUS | ||
25 | + select ARM_GIC | ||
26 | select ACPI | ||
27 | select ARM_SMMUV3 | ||
28 | select GPIO_KEY | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alex Chen <alex.chen@huawei.com> | ||
2 | 1 | ||
3 | We should use printf format specifier "%u" instead of "%d" for | ||
4 | argument of type "unsigned int". | ||
5 | |||
6 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> | ||
8 | Message-id: 20201111073651.72804-1-alex.chen@huawei.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/timer/exynos4210_mct.c | 4 ++-- | ||
13 | hw/timer/exynos4210_pwm.c | 8 ++++---- | ||
14 | 2 files changed, 6 insertions(+), 6 deletions(-) | ||
15 | |||
16 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/timer/exynos4210_mct.c | ||
19 | +++ b/hw/timer/exynos4210_mct.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id) | ||
21 | /* If CSTAT is pending and IRQ is enabled */ | ||
22 | if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) && | ||
23 | (s->reg.int_enb & G_INT_ENABLE(id))) { | ||
24 | - DPRINTF("gcmp timer[%d] IRQ\n", id); | ||
25 | + DPRINTF("gcmp timer[%u] IRQ\n", id); | ||
26 | qemu_irq_raise(s->irq[id]); | ||
27 | } | ||
28 | } | ||
29 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) | ||
30 | MCT_CFG_GET_DIVIDER(s->reg_mct_cfg)); | ||
31 | |||
32 | if (freq != s->freq) { | ||
33 | - DPRINTF("freq=%dHz\n", s->freq); | ||
34 | + DPRINTF("freq=%uHz\n", s->freq); | ||
35 | |||
36 | /* global timer */ | ||
37 | tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq); | ||
38 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/timer/exynos4210_pwm.c | ||
41 | +++ b/hw/timer/exynos4210_pwm.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id) | ||
43 | |||
44 | if (freq != s->timer[id].freq) { | ||
45 | ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq); | ||
46 | - DPRINTF("freq=%dHz\n", s->timer[id].freq); | ||
47 | + DPRINTF("freq=%uHz\n", s->timer[id].freq); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) | ||
52 | uint32_t id = s->id; | ||
53 | bool cmp; | ||
54 | |||
55 | - DPRINTF("timer %d tick\n", id); | ||
56 | + DPRINTF("timer %u tick\n", id); | ||
57 | |||
58 | /* set irq status */ | ||
59 | p->reg_tint_cstat |= TINT_CSTAT_STATUS(id); | ||
60 | |||
61 | /* raise IRQ */ | ||
62 | if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) { | ||
63 | - DPRINTF("timer %d IRQ\n", id); | ||
64 | + DPRINTF("timer %u IRQ\n", id); | ||
65 | qemu_irq_raise(p->timer[id].irq); | ||
66 | } | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) | ||
69 | } | ||
70 | |||
71 | if (cmp) { | ||
72 | - DPRINTF("auto reload timer %d count to %x\n", id, | ||
73 | + DPRINTF("auto reload timer %u count to %x\n", id, | ||
74 | p->timer[id].reg_tcntb); | ||
75 | ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb); | ||
76 | ptimer_run(p->timer[id].ptimer, 1); | ||
77 | -- | ||
78 | 2.20.1 | ||
79 | |||
80 | diff view generated by jsdifflib |
1 | In commit 76346b6264a9b01979 we tried to add a configure check that | 1 | The function machine_class_allow_dynamic_sysbus_dev() is currently |
---|---|---|---|
2 | the libgio pkg-config data was correct, which builds an executable | 2 | undocumented; add a doc comment. |
3 | linked against it. Unfortunately this doesn't catch the problem | ||
4 | (missing static library dependency info), because a "do nothing" test | ||
5 | source file doesn't have any symbol references that cause the linker | ||
6 | to pull in .o files from libgio.a, and so we don't see the "missing | ||
7 | symbols from libmount" error that a full QEMU link triggers. | ||
8 | |||
9 | (The ineffective test went unnoticed because of a typo that | ||
10 | effectively disabled libgio unconditionally, but after commit | ||
11 | 3569a5dfc11f2 fixed that, a static link of the system emulator on | ||
12 | Ubuntu stopped working again.) | ||
13 | |||
14 | Improve the gio test by having the test source fragment reference a | ||
15 | g_dbus function (which is what is indirectly causing us to end up | ||
16 | wanting functions from libmount). | ||
17 | 3 | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
20 | Message-id: 20201116104617.18333-1-peter.maydell@linaro.org | 6 | Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Message-id: 20210325153310.9131-2-peter.maydell@linaro.org | ||
21 | --- | 9 | --- |
22 | configure | 11 +++++++++-- | 10 | include/hw/boards.h | 15 +++++++++++++++ |
23 | 1 file changed, 9 insertions(+), 2 deletions(-) | 11 | 1 file changed, 15 insertions(+) |
24 | 12 | ||
25 | diff --git a/configure b/configure | 13 | diff --git a/include/hw/boards.h b/include/hw/boards.h |
26 | index XXXXXXX..XXXXXXX 100755 | 14 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/configure | 15 | --- a/include/hw/boards.h |
28 | +++ b/configure | 16 | +++ b/include/hw/boards.h |
29 | @@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then | 17 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, |
30 | # Check that the libraries actually work -- Ubuntu 18.04 ships | 18 | const CpuInstanceProperties *props, |
31 | # with pkg-config --static --libs data for gio-2.0 that is missing | 19 | Error **errp); |
32 | # -lblkid and will give a link error. | 20 | |
33 | - write_c_skeleton | 21 | +/** |
34 | - if compile_prog "" "$gio_libs" ; then | 22 | + * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices |
35 | + cat > $TMPC <<EOF | 23 | + * @mc: Machine class |
36 | +#include <gio/gio.h> | 24 | + * @type: type to allow (should be a subtype of TYPE_SYS_BUS_DEVICE) |
37 | +int main(void) | 25 | + * |
38 | +{ | 26 | + * Add the QOM type @type to the list of devices of which are subtypes |
39 | + g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); | 27 | + * of TYPE_SYS_BUS_DEVICE but which are still permitted to be dynamically |
40 | + return 0; | 28 | + * created (eg by the user on the command line with -device). |
41 | +} | 29 | + * By default if the user tries to create any devices on the command line |
42 | +EOF | 30 | + * that are subtypes of TYPE_SYS_BUS_DEVICE they will get an error message; |
43 | + if compile_prog "$gio_cflags" "$gio_libs" ; then | 31 | + * for the special cases which are permitted for this machine model, the |
44 | gio=yes | 32 | + * machine model class init code must call this function to add them |
45 | else | 33 | + * to the list of specifically permitted devices. |
46 | gio=no | 34 | + */ |
35 | void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); | ||
36 | + | ||
37 | /* | ||
38 | * Checks that backend isn't used, preps it for exclusive usage and | ||
39 | * returns migratable MemoryRegion provided by backend. | ||
47 | -- | 40 | -- |
48 | 2.20.1 | 41 | 2.20.1 |
49 | 42 | ||
50 | 43 | diff view generated by jsdifflib |
1 | The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device | 1 | Provide a new function dynamic_sysbus_dev_allowed() which checks the |
---|---|---|---|
2 | signals an alert when the temperature equals or exceeds the T_high value and | 2 | per-machine list of permitted dynamic sysbus devices and returns a |
3 | then remains high until a device register is read or the device responds to | 3 | boolean result indicating whether the device is allowed. We can use |
4 | the SMBUS Alert Response address, or the device is put into Shutdown Mode. | 4 | this in the implementation of validate_sysbus_device(), but we will |
5 | Thereafter the Alert pin will only be re-signalled when temperature falls | 5 | also need it so that machine hotplug callbacks can validate devices |
6 | below T_low; alert can then be cleared in the same set of ways, and the | 6 | rather than assuming that any sysbus device might be hotpluggable |
7 | device returns to its initial "alert when temperature goes above T_high" | 7 | into the platform bus. |
8 | mode. (If this textual description is confusing, see figure 3 in the | ||
9 | TI datasheet at https://www.ti.com/lit/gpn/tmp105 .) | ||
10 | |||
11 | We were misimplementing this as a simple "always alert if temperature is | ||
12 | above T_high or below T_low" condition, which gives a spurious alert on | ||
13 | startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset | ||
14 | limit values. | ||
15 | |||
16 | Implement the correct (hysteresis) behaviour by tracking whether we | ||
17 | are currently looking for the temperature to rise over T_high or | ||
18 | for it to fall below T_low. Our implementation of the comparator | ||
19 | mode (TM==0) wasn't wrong, but rephrase it to match the way that | ||
20 | interrupt mode is now handled for clarity. | ||
21 | 8 | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
24 | Message-id: 20201110150023.25533-3-peter.maydell@linaro.org | 11 | Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
12 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
13 | Message-id: 20210325153310.9131-3-peter.maydell@linaro.org | ||
25 | --- | 14 | --- |
26 | hw/misc/tmp105.h | 7 +++++ | 15 | include/hw/boards.h | 24 ++++++++++++++++++++++++ |
27 | hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++------- | 16 | hw/core/machine.c | 21 ++++++++++++++++----- |
28 | 2 files changed, 68 insertions(+), 9 deletions(-) | 17 | 2 files changed, 40 insertions(+), 5 deletions(-) |
29 | 18 | ||
30 | diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h | 19 | diff --git a/include/hw/boards.h b/include/hw/boards.h |
31 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/misc/tmp105.h | 21 | --- a/include/hw/boards.h |
33 | +++ b/hw/misc/tmp105.h | 22 | +++ b/include/hw/boards.h |
34 | @@ -XXX,XX +XXX,XX @@ struct TMP105State { | 23 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, |
35 | int16_t limit[2]; | 24 | */ |
36 | int faults; | 25 | void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); |
37 | uint8_t alarm; | 26 | |
38 | + /* | 27 | +/** |
39 | + * The TMP105 initially looks for a temperature rising above T_high; | 28 | + * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device |
40 | + * once this is detected, the condition it looks for next is the | 29 | + * @mc: Machine class |
41 | + * temperature falling below T_low. This flag is false when initially | 30 | + * @dev: device to check |
42 | + * looking for T_high, true when looking for T_low. | 31 | + * |
43 | + */ | 32 | + * Returns: true if @dev is a sysbus device on the machine's list |
44 | + bool detect_falling; | 33 | + * of dynamically pluggable sysbus devices; otherwise false. |
45 | }; | 34 | + * |
46 | 35 | + * This function checks whether @dev is a valid dynamic sysbus device, | |
47 | #endif | 36 | + * by first confirming that it is a sysbus device and then checking it |
48 | diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c | 37 | + * against the list of permitted dynamic sysbus devices which has been |
38 | + * set up by the machine using machine_class_allow_dynamic_sysbus_dev(). | ||
39 | + * | ||
40 | + * It is valid to call this with something that is not a subclass of | ||
41 | + * TYPE_SYS_BUS_DEVICE; the function will return false in this case. | ||
42 | + * This allows hotplug callback functions to be written as: | ||
43 | + * if (device_is_dynamic_sysbus(mc, dev)) { | ||
44 | + * handle dynamic sysbus case; | ||
45 | + * } else if (some other kind of hotplug) { | ||
46 | + * handle that; | ||
47 | + * } | ||
48 | + */ | ||
49 | +bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev); | ||
50 | + | ||
51 | /* | ||
52 | * Checks that backend isn't used, preps it for exclusive usage and | ||
53 | * returns migratable MemoryRegion provided by backend. | ||
54 | diff --git a/hw/core/machine.c b/hw/core/machine.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | 55 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/hw/misc/tmp105.c | 56 | --- a/hw/core/machine.c |
51 | +++ b/hw/misc/tmp105.c | 57 | +++ b/hw/core/machine.c |
52 | @@ -XXX,XX +XXX,XX @@ static void tmp105_alarm_update(TMP105State *s) | 58 | @@ -XXX,XX +XXX,XX @@ void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type) |
53 | return; | 59 | QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type)); |
60 | } | ||
61 | |||
62 | -static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque) | ||
63 | +bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev) | ||
64 | { | ||
65 | - MachineState *machine = opaque; | ||
66 | - MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
67 | bool allowed = false; | ||
68 | strList *wl; | ||
69 | + Object *obj = OBJECT(dev); | ||
70 | + | ||
71 | + if (!object_dynamic_cast(obj, TYPE_SYS_BUS_DEVICE)) { | ||
72 | + return false; | ||
73 | + } | ||
74 | |||
75 | for (wl = mc->allowed_dynamic_sysbus_devices; | ||
76 | !allowed && wl; | ||
77 | wl = wl->next) { | ||
78 | - allowed |= !!object_dynamic_cast(OBJECT(sbdev), wl->value); | ||
79 | + allowed |= !!object_dynamic_cast(obj, wl->value); | ||
54 | } | 80 | } |
55 | 81 | ||
56 | - if ((s->config >> 1) & 1) { /* TM */ | 82 | - if (!allowed) { |
57 | - if (s->temperature >= s->limit[1]) | 83 | + return allowed; |
58 | - s->alarm = 1; | ||
59 | - else if (s->temperature < s->limit[0]) | ||
60 | - s->alarm = 1; | ||
61 | + if (s->config >> 1 & 1) { | ||
62 | + /* | ||
63 | + * TM == 1 : Interrupt mode. We signal Alert when the | ||
64 | + * temperature rises above T_high, and expect the guest to clear | ||
65 | + * it (eg by reading a device register). | ||
66 | + */ | ||
67 | + if (s->detect_falling) { | ||
68 | + if (s->temperature < s->limit[0]) { | ||
69 | + s->alarm = 1; | ||
70 | + s->detect_falling = false; | ||
71 | + } | ||
72 | + } else { | ||
73 | + if (s->temperature >= s->limit[1]) { | ||
74 | + s->alarm = 1; | ||
75 | + s->detect_falling = true; | ||
76 | + } | ||
77 | + } | ||
78 | } else { | ||
79 | - if (s->temperature >= s->limit[1]) | ||
80 | - s->alarm = 1; | ||
81 | - else if (s->temperature < s->limit[0]) | ||
82 | - s->alarm = 0; | ||
83 | + /* | ||
84 | + * TM == 0 : Comparator mode. We signal Alert when the temperature | ||
85 | + * rises above T_high, and stop signalling it when the temperature | ||
86 | + * falls below T_low. | ||
87 | + */ | ||
88 | + if (s->detect_falling) { | ||
89 | + if (s->temperature < s->limit[0]) { | ||
90 | + s->alarm = 0; | ||
91 | + s->detect_falling = false; | ||
92 | + } | ||
93 | + } else { | ||
94 | + if (s->temperature >= s->limit[1]) { | ||
95 | + s->alarm = 1; | ||
96 | + s->detect_falling = true; | ||
97 | + } | ||
98 | + } | ||
99 | } | ||
100 | |||
101 | tmp105_interrupt_update(s); | ||
102 | @@ -XXX,XX +XXX,XX @@ static int tmp105_post_load(void *opaque, int version_id) | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | +static bool detect_falling_needed(void *opaque) | ||
107 | +{ | ||
108 | + TMP105State *s = opaque; | ||
109 | + | ||
110 | + /* | ||
111 | + * We only need to migrate the detect_falling bool if it's set; | ||
112 | + * for migration from older machines we assume that it is false | ||
113 | + * (ie temperature is not out of range). | ||
114 | + */ | ||
115 | + return s->detect_falling; | ||
116 | +} | 84 | +} |
117 | + | 85 | + |
118 | +static const VMStateDescription vmstate_tmp105_detect_falling = { | 86 | +static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque) |
119 | + .name = "TMP105/detect-falling", | 87 | +{ |
120 | + .version_id = 1, | 88 | + MachineState *machine = opaque; |
121 | + .minimum_version_id = 1, | 89 | + MachineClass *mc = MACHINE_GET_CLASS(machine); |
122 | + .needed = detect_falling_needed, | ||
123 | + .fields = (VMStateField[]) { | ||
124 | + VMSTATE_BOOL(detect_falling, TMP105State), | ||
125 | + VMSTATE_END_OF_LIST() | ||
126 | + } | ||
127 | +}; | ||
128 | + | 90 | + |
129 | static const VMStateDescription vmstate_tmp105 = { | 91 | + if (!device_is_dynamic_sysbus(mc, DEVICE(sbdev))) { |
130 | .name = "TMP105", | 92 | error_report("Option '-device %s' cannot be handled by this machine", |
131 | .version_id = 0, | 93 | object_class_get_name(object_get_class(OBJECT(sbdev)))); |
132 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = { | 94 | exit(1); |
133 | VMSTATE_UINT8(alarm, TMP105State), | ||
134 | VMSTATE_I2C_SLAVE(i2c, TMP105State), | ||
135 | VMSTATE_END_OF_LIST() | ||
136 | + }, | ||
137 | + .subsections = (const VMStateDescription*[]) { | ||
138 | + &vmstate_tmp105_detect_falling, | ||
139 | + NULL | ||
140 | } | ||
141 | }; | ||
142 | |||
143 | @@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c) | ||
144 | s->config = 0; | ||
145 | s->faults = tmp105_faultq[(s->config >> 3) & 3]; | ||
146 | s->alarm = 0; | ||
147 | + s->detect_falling = false; | ||
148 | |||
149 | s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */ | ||
150 | s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */ | ||
151 | -- | 95 | -- |
152 | 2.20.1 | 96 | 2.20.1 |
153 | 97 | ||
154 | 98 | diff view generated by jsdifflib |
1 | In commit 5edab03d4040 we added tracepoints to the ps2 keyboard | 1 | The virt machine device plug callback currently calls |
---|---|---|---|
2 | and mouse emulation. However we didn't remove all the debug-by-printf | 2 | platform_bus_link_device() for any sysbus device. This is overly |
3 | support. In fact there is only one printf() remaining, and it is | 3 | broad, because platform_bus_link_device() will unconditionally grab |
4 | redundant with the trace_ps2_write_mouse() event next to it. | 4 | the IRQs and MMIOs of the device it is passed, whether it was |
5 | Remove the printf() and the now-unused DEBUG* macros. | 5 | intended for the platform bus or not. Restrict hotpluggability of |
6 | sysbus devices to only those devices on the dynamic sysbus | ||
7 | allowlist. | ||
8 | |||
9 | We were mostly getting away with this because the board creates the | ||
10 | platform bus as the last device it creates, and so the hotplug | ||
11 | callback did not do anything for all the sysbus devices created by | ||
12 | the board itself. However if the user plugged in a device which | ||
13 | itself uses a sysbus device internally we would have mishandled this | ||
14 | and probably asserted. | ||
6 | 15 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | 18 | Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
10 | Message-id: 20201101133258.4240-1-peter.maydell@linaro.org | 19 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
20 | Message-id: 20210325153310.9131-4-peter.maydell@linaro.org | ||
11 | --- | 21 | --- |
12 | hw/input/ps2.c | 9 --------- | 22 | hw/arm/virt.c | 8 ++++++-- |
13 | 1 file changed, 9 deletions(-) | 23 | 1 file changed, 6 insertions(+), 2 deletions(-) |
14 | 24 | ||
15 | diff --git a/hw/input/ps2.c b/hw/input/ps2.c | 25 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
16 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/input/ps2.c | 27 | --- a/hw/arm/virt.c |
18 | +++ b/hw/input/ps2.c | 28 | +++ b/hw/arm/virt.c |
19 | @@ -XXX,XX +XXX,XX @@ | 29 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, |
20 | 30 | VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); | |
21 | #include "trace.h" | 31 | |
22 | 32 | if (vms->platform_bus_dev) { | |
23 | -/* debug PC keyboard */ | 33 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { |
24 | -//#define DEBUG_KBD | 34 | + MachineClass *mc = MACHINE_GET_CLASS(vms); |
25 | - | 35 | + |
26 | -/* debug PC keyboard : only mouse */ | 36 | + if (device_is_dynamic_sysbus(mc, dev)) { |
27 | -//#define DEBUG_MOUSE | 37 | platform_bus_link_device(PLATFORM_BUS_DEVICE(vms->platform_bus_dev), |
28 | - | 38 | SYS_BUS_DEVICE(dev)); |
29 | /* Keyboard Commands */ | 39 | } |
30 | #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ | 40 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_unplug_cb(HotplugHandler *hotplug_dev, |
31 | #define KBD_CMD_ECHO 0xEE | 41 | static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
32 | @@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val) | 42 | DeviceState *dev) |
33 | PS2MouseState *s = (PS2MouseState *)opaque; | 43 | { |
34 | 44 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE) || | |
35 | trace_ps2_write_mouse(opaque, val); | 45 | + MachineClass *mc = MACHINE_GET_CLASS(machine); |
36 | -#ifdef DEBUG_MOUSE | 46 | + |
37 | - printf("kbd: write mouse 0x%02x\n", val); | 47 | + if (device_is_dynamic_sysbus(mc, dev) || |
38 | -#endif | 48 | (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { |
39 | switch(s->common.write_cmd) { | 49 | return HOTPLUG_HANDLER(machine); |
40 | default: | 50 | } |
41 | case -1: | ||
42 | -- | 51 | -- |
43 | 2.20.1 | 52 | 2.20.1 |
44 | 53 | ||
45 | 54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In the mtspr helper we attempt to check for "is the timer disabled" | ||
2 | with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE | ||
3 | is zero and the condition is always false (Coverity complains about | ||
4 | the dead code.) | ||
5 | 1 | ||
6 | The correct check would be to test whether the TTMR_M field in the | ||
7 | register is equal to TIMER_NONE instead. However, the | ||
8 | cpu_openrisc_timer_update() function checks whether the timer is | ||
9 | enabled (it looks at cpu->env.is_counting, which is set to 0 via | ||
10 | cpu_openrisc_count_stop() when the TTMR_M field is set to | ||
11 | TIMER_NONE), so there's no need to check for "timer disabled" in the | ||
12 | target/openrisc code. Instead, simply remove the dead code. | ||
13 | |||
14 | Fixes: Coverity CID 1005812 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Acked-by: Stafford Horne <shorne@gmail.com> | ||
17 | Message-id: 20201103114654.18540-1-peter.maydell@linaro.org | ||
18 | --- | ||
19 | target/openrisc/sys_helper.c | 3 --- | ||
20 | 1 file changed, 3 deletions(-) | ||
21 | |||
22 | diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/openrisc/sys_helper.c | ||
25 | +++ b/target/openrisc/sys_helper.c | ||
26 | @@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) | ||
27 | |||
28 | case TO_SPR(10, 1): /* TTCR */ | ||
29 | cpu_openrisc_count_set(cpu, rb); | ||
30 | - if (env->ttmr & TIMER_NONE) { | ||
31 | - return; | ||
32 | - } | ||
33 | cpu_openrisc_timer_update(cpu); | ||
34 | break; | ||
35 | #endif | ||
36 | -- | ||
37 | 2.20.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
1 | The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the | 1 | The e500plat machine device plug callback currently calls |
---|---|---|---|
2 | power-up reset values for the T_low and T_high registers are 80 degrees C | 2 | platform_bus_link_device() for any sysbus device. This is overly |
3 | and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These | 3 | broad, because platform_bus_link_device() will unconditionally grab |
4 | values are then shifted right by four bits to give the register reset | 4 | the IRQs and MMIOs of the device it is passed, whether it was |
5 | values, since both registers store the 12 bits of temperature data in bits | 5 | intended for the platform bus or not. Restrict hotpluggability of |
6 | [15..4] of a 16 bit register. | 6 | sysbus devices to only those devices on the dynamic sysbus allowlist. |
7 | 7 | ||
8 | We were resetting these registers to zero, which is problematic for Linux | 8 | We were mostly getting away with this because the board creates the |
9 | guests which enable the alert interrupt and then immediately take an | 9 | platform bus as the last device it creates, and so the hotplug |
10 | unexpected overtemperature alert because the current temperature is above | 10 | callback did not do anything for all the sysbus devices created by |
11 | freezing... | 11 | the board itself. However if the user plugged in a device which |
12 | itself uses a sysbus device internally we would have mishandled this | ||
13 | and probably asserted. An example of this is: | ||
14 | qemu-system-ppc64 -M ppce500 -device macio-oldworld | ||
15 | |||
16 | This isn't a sensible command because the macio-oldworld device | ||
17 | is really specific to the 'g3beige' machine, but we now fail | ||
18 | with a reasonable error message rather than asserting: | ||
19 | qemu-system-ppc64: Device heathrow is not supported by this machine yet. | ||
12 | 20 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
15 | Message-id: 20201110150023.25533-2-peter.maydell@linaro.org | 23 | Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
24 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
25 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | ||
26 | Message-id: 20210325153310.9131-5-peter.maydell@linaro.org | ||
16 | --- | 27 | --- |
17 | hw/misc/tmp105.c | 3 +++ | 28 | hw/ppc/e500plat.c | 8 ++++++-- |
18 | 1 file changed, 3 insertions(+) | 29 | 1 file changed, 6 insertions(+), 2 deletions(-) |
19 | 30 | ||
20 | diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c | 31 | diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c |
21 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/misc/tmp105.c | 33 | --- a/hw/ppc/e500plat.c |
23 | +++ b/hw/misc/tmp105.c | 34 | +++ b/hw/ppc/e500plat.c |
24 | @@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c) | 35 | @@ -XXX,XX +XXX,XX @@ static void e500plat_machine_device_plug_cb(HotplugHandler *hotplug_dev, |
25 | s->faults = tmp105_faultq[(s->config >> 3) & 3]; | 36 | PPCE500MachineState *pms = PPCE500_MACHINE(hotplug_dev); |
26 | s->alarm = 0; | 37 | |
27 | 38 | if (pms->pbus_dev) { | |
28 | + s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */ | 39 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { |
29 | + s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */ | 40 | + MachineClass *mc = MACHINE_GET_CLASS(pms); |
30 | + | 41 | + |
31 | tmp105_interrupt_update(s); | 42 | + if (device_is_dynamic_sysbus(mc, dev)) { |
32 | } | 43 | platform_bus_link_device(pms->pbus_dev, SYS_BUS_DEVICE(dev)); |
44 | } | ||
45 | } | ||
46 | @@ -XXX,XX +XXX,XX @@ static | ||
47 | HotplugHandler *e500plat_machine_get_hotpug_handler(MachineState *machine, | ||
48 | DeviceState *dev) | ||
49 | { | ||
50 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
51 | + MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
52 | + | ||
53 | + if (device_is_dynamic_sysbus(mc, dev)) { | ||
54 | return HOTPLUG_HANDLER(machine); | ||
55 | } | ||
33 | 56 | ||
34 | -- | 57 | -- |
35 | 2.20.1 | 58 | 2.20.1 |
36 | 59 | ||
37 | 60 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | This reverts commit f7fb73b8cdd3f77e26f9fcff8cf24ff1b58d200f. |
---|---|---|---|
2 | 2 | ||
3 | Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN): | 3 | This change turned out to be a bit half-baked, and doesn't |
4 | 4 | work with KVM, which fails with the error: | |
5 | >>> Overrunning array "suffixes" of 7 8-byte elements at element | 5 | "qemu-system-aarch64: Failed to retrieve host CPU features" |
6 | index 7 (byte offset 63) using index "idx" (which evaluates to 7). | 6 | |
7 | 7 | because KVM does not allow accessing of the PMCR_EL0 value in | |
8 | Note, the biggest input value freq_to_str() can accept is UINT64_MAX, | 8 | the scratch "query CPU ID registers" VM unless we have first |
9 | which is ~18.446 EHz, less than 1000 EHz. | 9 | set the KVM_ARM_VCPU_PMU_V3 feature on the VM. |
10 | 10 | ||
11 | Reported-by: Eduardo Habkost <ehabkost@redhat.com> | 11 | Revert the change for 6.0. |
12 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 12 | |
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Reported-by: Zenghui Yu <yuzenghui@huawei.com> |
14 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | ||
15 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
16 | Message-id: 20201101215755.2021421-1-f4bug@amsat.org | ||
17 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Tested-by: Zenghui Yu <yuzenghui@huawei.com> | ||
16 | Message-id: 20210331154822.23332-1-peter.maydell@linaro.org | ||
20 | --- | 17 | --- |
21 | util/cutils.c | 3 ++- | 18 | target/arm/cpu.h | 1 - |
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | 19 | target/arm/cpu64.c | 3 --- |
23 | 20 | target/arm/cpu_tcg.c | 5 ----- | |
24 | diff --git a/util/cutils.c b/util/cutils.c | 21 | target/arm/helper.c | 29 ++++++++++++----------------- |
25 | index XXXXXXX..XXXXXXX 100644 | 22 | target/arm/kvm64.c | 2 -- |
26 | --- a/util/cutils.c | 23 | 5 files changed, 12 insertions(+), 28 deletions(-) |
27 | +++ b/util/cutils.c | 24 | |
28 | @@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz) | 25 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
29 | double freq = freq_hz; | 26 | index XXXXXXX..XXXXXXX 100644 |
30 | size_t idx = 0; | 27 | --- a/target/arm/cpu.h |
31 | 28 | +++ b/target/arm/cpu.h | |
32 | - while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) { | 29 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { |
33 | + while (freq >= 1000.0) { | 30 | uint64_t id_aa64mmfr2; |
34 | freq /= 1000.0; | 31 | uint64_t id_aa64dfr0; |
35 | idx++; | 32 | uint64_t id_aa64dfr1; |
36 | } | 33 | - uint64_t reset_pmcr_el0; |
37 | + assert(idx < ARRAY_SIZE(suffixes)); | 34 | } isar; |
38 | 35 | uint64_t midr; | |
39 | return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]); | 36 | uint32_t revidr; |
40 | } | 37 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/cpu64.c | ||
40 | +++ b/target/arm/cpu64.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) | ||
42 | cpu->gic_num_lrs = 4; | ||
43 | cpu->gic_vpribits = 5; | ||
44 | cpu->gic_vprebits = 5; | ||
45 | - cpu->isar.reset_pmcr_el0 = 0x41013000; | ||
46 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
47 | } | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | ||
50 | cpu->gic_num_lrs = 4; | ||
51 | cpu->gic_vpribits = 5; | ||
52 | cpu->gic_vprebits = 5; | ||
53 | - cpu->isar.reset_pmcr_el0 = 0x41033000; | ||
54 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
55 | } | ||
56 | |||
57 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | ||
58 | cpu->gic_num_lrs = 4; | ||
59 | cpu->gic_vpribits = 5; | ||
60 | cpu->gic_vprebits = 5; | ||
61 | - cpu->isar.reset_pmcr_el0 = 0x41023000; | ||
62 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
63 | } | ||
64 | |||
65 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/cpu_tcg.c | ||
68 | +++ b/target/arm/cpu_tcg.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj) | ||
70 | cpu->ccsidr[1] = 0x2007e01a; /* 16k L1 icache. */ | ||
71 | cpu->ccsidr[2] = 0xf0000000; /* No L2 icache. */ | ||
72 | cpu->reset_auxcr = 2; | ||
73 | - cpu->isar.reset_pmcr_el0 = 0x41002000; | ||
74 | define_arm_cp_regs(cpu, cortexa8_cp_reginfo); | ||
75 | } | ||
76 | |||
77 | @@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj) | ||
78 | cpu->clidr = (1 << 27) | (1 << 24) | 3; | ||
79 | cpu->ccsidr[0] = 0xe00fe019; /* 16k L1 dcache. */ | ||
80 | cpu->ccsidr[1] = 0x200fe019; /* 16k L1 icache. */ | ||
81 | - cpu->isar.reset_pmcr_el0 = 0x41093000; | ||
82 | define_arm_cp_regs(cpu, cortexa9_cp_reginfo); | ||
83 | } | ||
84 | |||
85 | @@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj) | ||
86 | cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */ | ||
87 | cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */ | ||
88 | cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */ | ||
89 | - cpu->isar.reset_pmcr_el0 = 0x41072000; | ||
90 | define_arm_cp_regs(cpu, cortexa15_cp_reginfo); /* Same as A15 */ | ||
91 | } | ||
92 | |||
93 | @@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj) | ||
94 | cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */ | ||
95 | cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */ | ||
96 | cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */ | ||
97 | - cpu->isar.reset_pmcr_el0 = 0x410F3000; | ||
98 | define_arm_cp_regs(cpu, cortexa15_cp_reginfo); | ||
99 | } | ||
100 | |||
101 | @@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj) | ||
102 | cpu->isar.id_isar6 = 0x0; | ||
103 | cpu->mp_is_up = true; | ||
104 | cpu->pmsav7_dregion = 16; | ||
105 | - cpu->isar.reset_pmcr_el0 = 0x41151800; | ||
106 | define_arm_cp_regs(cpu, cortexr5_cp_reginfo); | ||
107 | } | ||
108 | |||
109 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/target/arm/helper.c | ||
112 | +++ b/target/arm/helper.c | ||
113 | @@ -XXX,XX +XXX,XX @@ | ||
114 | #endif | ||
115 | |||
116 | #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ | ||
117 | +#define PMCR_NUM_COUNTERS 4 /* QEMU IMPDEF choice */ | ||
118 | |||
119 | #ifndef CONFIG_USER_ONLY | ||
120 | |||
121 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { | ||
122 | |||
123 | static inline uint32_t pmu_num_counters(CPUARMState *env) | ||
124 | { | ||
125 | - ARMCPU *cpu = env_archcpu(env); | ||
126 | - | ||
127 | - return (cpu->isar.reset_pmcr_el0 & PMCRN_MASK) >> PMCRN_SHIFT; | ||
128 | + return (env->cp15.c9_pmcr & PMCRN_MASK) >> PMCRN_SHIFT; | ||
129 | } | ||
130 | |||
131 | /* Bits allowed to be set/cleared for PMCNTEN* and PMINTEN* */ | ||
132 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
133 | .resetvalue = 0, | ||
134 | .writefn = gt_hyp_ctl_write, .raw_writefn = raw_write }, | ||
135 | #endif | ||
136 | + /* The only field of MDCR_EL2 that has a defined architectural reset value | ||
137 | + * is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N. | ||
138 | + */ | ||
139 | + { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
140 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, | ||
141 | + .access = PL2_RW, .resetvalue = PMCR_NUM_COUNTERS, | ||
142 | + .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), }, | ||
143 | { .name = "HPFAR", .state = ARM_CP_STATE_AA32, | ||
144 | .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, | ||
145 | .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
146 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
147 | * field as main ID register, and we implement four counters in | ||
148 | * addition to the cycle count register. | ||
149 | */ | ||
150 | - unsigned int i, pmcrn = pmu_num_counters(&cpu->env); | ||
151 | + unsigned int i, pmcrn = PMCR_NUM_COUNTERS; | ||
152 | ARMCPRegInfo pmcr = { | ||
153 | .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, | ||
154 | .access = PL0_RW, | ||
155 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
156 | .access = PL0_RW, .accessfn = pmreg_access, | ||
157 | .type = ARM_CP_IO, | ||
158 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), | ||
159 | - .resetvalue = cpu->isar.reset_pmcr_el0, | ||
160 | + .resetvalue = (cpu->midr & 0xff000000) | (pmcrn << PMCRN_SHIFT) | | ||
161 | + PMCRLC, | ||
162 | .writefn = pmcr_write, .raw_writefn = raw_write, | ||
163 | }; | ||
164 | - | ||
165 | define_one_arm_cp_reg(cpu, &pmcr); | ||
166 | define_one_arm_cp_reg(cpu, &pmcr64); | ||
167 | for (i = 0; i < pmcrn; i++) { | ||
168 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
169 | .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, | ||
170 | REGINFO_SENTINEL | ||
171 | }; | ||
172 | - /* | ||
173 | - * The only field of MDCR_EL2 that has a defined architectural reset | ||
174 | - * value is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N. | ||
175 | - */ | ||
176 | - ARMCPRegInfo mdcr_el2 = { | ||
177 | - .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
178 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, | ||
179 | - .access = PL2_RW, .resetvalue = pmu_num_counters(env), | ||
180 | - .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), | ||
181 | - }; | ||
182 | - define_one_arm_cp_reg(cpu, &mdcr_el2); | ||
183 | define_arm_cp_regs(cpu, vpidr_regs); | ||
184 | define_arm_cp_regs(cpu, el2_cp_reginfo); | ||
185 | if (arm_feature(env, ARM_FEATURE_V8)) { | ||
186 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
187 | index XXXXXXX..XXXXXXX 100644 | ||
188 | --- a/target/arm/kvm64.c | ||
189 | +++ b/target/arm/kvm64.c | ||
190 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
191 | ARM64_SYS_REG(3, 0, 0, 7, 1)); | ||
192 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, | ||
193 | ARM64_SYS_REG(3, 0, 0, 7, 2)); | ||
194 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, | ||
195 | - ARM64_SYS_REG(3, 3, 9, 12, 0)); | ||
196 | |||
197 | /* | ||
198 | * Note that if AArch32 support is not present in the host, | ||
41 | -- | 199 | -- |
42 | 2.20.1 | 200 | 2.20.1 |
43 | 201 | ||
44 | 202 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: "Chubb, Peter (Data61, Eveleigh)" <Peter.Chubb@data61.csiro.au> |
---|---|---|---|
2 | 2 | ||
3 | This patch fixes CID 1432800 by removing an unnecessary check. | 3 | Remove Peter Chubb as i/MX31 maintainer. |
4 | 4 | ||
5 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 5 | I'm leaving my current job and will no longer have access to the |
6 | hardware to test or maintain this port. | ||
7 | |||
8 | Signed-off-by: Peter Chubb <peter.chubb@data61.csiro.au> | ||
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/core/register.c | 4 ---- | 12 | MAINTAINERS | 1 - |
10 | 1 file changed, 4 deletions(-) | 13 | 1 file changed, 1 deletion(-) |
11 | 14 | ||
12 | diff --git a/hw/core/register.c b/hw/core/register.c | 15 | diff --git a/MAINTAINERS b/MAINTAINERS |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/core/register.c | 17 | --- a/MAINTAINERS |
15 | +++ b/hw/core/register.c | 18 | +++ b/MAINTAINERS |
16 | @@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner, | 19 | @@ -XXX,XX +XXX,XX @@ F: include/hw/misc/imx25_ccm.h |
17 | int index = rae[i].addr / data_size; | 20 | F: include/hw/watchdog/wdt_imx2.h |
18 | RegisterInfo *r = &ri[index]; | 21 | |
19 | 22 | i.MX31 (kzm) | |
20 | - if (data + data_size * index == 0 || !&rae[i]) { | 23 | -M: Peter Chubb <peter.chubb@nicta.com.au> |
21 | - continue; | 24 | M: Peter Maydell <peter.maydell@linaro.org> |
22 | - } | 25 | L: qemu-arm@nongnu.org |
23 | - | 26 | S: Odd Fixes |
24 | /* Init the register, this will zero it. */ | ||
25 | object_initialize((void *)r, sizeof(*r), TYPE_REGISTER); | ||
26 | |||
27 | -- | 27 | -- |
28 | 2.20.1 | 28 | 2.20.1 |
29 | 29 | ||
30 | 30 | diff view generated by jsdifflib |