1 | Arm patches for rc3 : just a handful of bug fixes. | 1 | A few patches for the rc today... |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | The following changes since commit 109918d24a3bb9ed3d05beb34ea4ac6be443c138: |
4 | -- PMM | ||
5 | 4 | ||
6 | 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 | The following changes since commit 4ecc984210ca1bf508a96a550ec8a93a5f833f6c: | ||
8 | |||
9 | Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.2-rc3' into staging (2019-11-26 12:36:40 +0000) | ||
10 | 6 | ||
11 | are available in the Git repository at: | 7 | are available in the Git repository at: |
12 | 8 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191126 | 9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210406 |
14 | 10 | ||
15 | for you to fetch changes up to 6a4ef4e5d1084ce41fafa7d470a644b0fd3d9317: | 11 | for you to fetch changes up to 49bc76550c37f4a2b92a05cb3e6989a739d56ac9: |
16 | 12 | ||
17 | target/arm: Honor HCR_EL2.TID3 trapping requirements (2019-11-26 13:55:37 +0000) | 13 | Remove myself as i.mx31 maintainer (2021-04-06 11:49:15 +0100) |
18 | 14 | ||
19 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
20 | target-arm queue: | 16 | target-arm queue: |
21 | * handle FTYPE flag correctly in v7M exception return | 17 | * ppc/e500 and arm/virt: only add valid dynamic sysbus devices to the |
22 | for v7M CPUs with an FPU (v8M CPUs were already correct) | 18 | platform bus |
23 | * versal: Add the CRP as unimplemented | 19 | * update i.mx31 maintainer list |
24 | * Fix ISR_EL1 tracking when executing at EL2 | 20 | * Revert "target/arm: Make number of counters in PMCR follow the CPU" |
25 | * Honor HCR_EL2.TID3 trapping requirements | ||
26 | 21 | ||
27 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (1): | 23 | Chubb, Peter (Data61, Eveleigh) (1): |
29 | hw/arm: versal: Add the CRP as unimplemented | 24 | Remove myself as i.mx31 maintainer |
30 | 25 | ||
31 | Jean-Hugues Deschênes (1): | 26 | Peter Maydell (5): |
32 | target/arm: Fix handling of cortex-m FTYPE flag in EXCRET | 27 | include/hw/boards.h: Document machine_class_allow_dynamic_sysbus_dev() |
28 | machine: Provide a function to check the dynamic sysbus allowlist | ||
29 | hw/arm/virt: Only try to add valid dynamic sysbus devices to platform bus | ||
30 | hw/ppc/e500plat: Only try to add valid dynamic sysbus devices to platform bus | ||
31 | Revert "target/arm: Make number of counters in PMCR follow the CPU" | ||
33 | 32 | ||
34 | Marc Zyngier (2): | 33 | include/hw/boards.h | 39 +++++++++++++++++++++++++++++++++++++++ |
35 | target/arm: Fix ISR_EL1 tracking when executing at EL2 | 34 | target/arm/cpu.h | 1 - |
36 | target/arm: Honor HCR_EL2.TID3 trapping requirements | 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(-) | ||
37 | 44 | ||
38 | include/hw/arm/xlnx-versal.h | 3 ++ | ||
39 | hw/arm/xlnx-versal.c | 2 ++ | ||
40 | target/arm/helper.c | 83 ++++++++++++++++++++++++++++++++++++++++++-- | ||
41 | target/arm/m_helper.c | 7 ++-- | ||
42 | 4 files changed, 89 insertions(+), 6 deletions(-) | ||
43 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | The function machine_class_allow_dynamic_sysbus_dev() is currently |
---|---|---|---|
2 | undocumented; add a doc comment. | ||
2 | 3 | ||
3 | Add the CRP as unimplemented thus avoiding bus errors when | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | guests access these registers. | 5 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
9 | --- | ||
10 | include/hw/boards.h | 15 +++++++++++++++ | ||
11 | 1 file changed, 15 insertions(+) | ||
5 | 12 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 13 | diff --git a/include/hw/boards.h b/include/hw/boards.h |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20191115154734.26449-2-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/arm/xlnx-versal.h | 3 +++ | ||
13 | hw/arm/xlnx-versal.c | 2 ++ | ||
14 | 2 files changed, 5 insertions(+) | ||
15 | |||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 15 | --- a/include/hw/boards.h |
19 | +++ b/include/hw/arm/xlnx-versal.h | 16 | +++ b/include/hw/boards.h |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 17 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, |
21 | #define MM_IOU_SCNTRS_SIZE 0x10000 | 18 | const CpuInstanceProperties *props, |
22 | #define MM_FPD_CRF 0xfd1a0000U | 19 | Error **errp); |
23 | #define MM_FPD_CRF_SIZE 0x140000 | 20 | |
21 | +/** | ||
22 | + * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices | ||
23 | + * @mc: Machine class | ||
24 | + * @type: type to allow (should be a subtype of TYPE_SYS_BUS_DEVICE) | ||
25 | + * | ||
26 | + * Add the QOM type @type to the list of devices of which are subtypes | ||
27 | + * of TYPE_SYS_BUS_DEVICE but which are still permitted to be dynamically | ||
28 | + * created (eg by the user on the command line with -device). | ||
29 | + * By default if the user tries to create any devices on the command line | ||
30 | + * that are subtypes of TYPE_SYS_BUS_DEVICE they will get an error message; | ||
31 | + * for the special cases which are permitted for this machine model, the | ||
32 | + * machine model class init code must call this function to add them | ||
33 | + * to the list of specifically permitted devices. | ||
34 | + */ | ||
35 | void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); | ||
24 | + | 36 | + |
25 | +#define MM_PMC_CRP 0xf1260000U | 37 | /* |
26 | +#define MM_PMC_CRP_SIZE 0x10000 | 38 | * Checks that backend isn't used, preps it for exclusive usage and |
27 | #endif | 39 | * returns migratable MemoryRegion provided by backend. |
28 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/xlnx-versal.c | ||
31 | +++ b/hw/arm/xlnx-versal.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | ||
33 | MM_CRL, MM_CRL_SIZE); | ||
34 | versal_unimp_area(s, "crf", &s->mr_ps, | ||
35 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | ||
36 | + versal_unimp_area(s, "crp", &s->mr_ps, | ||
37 | + MM_PMC_CRP, MM_PMC_CRP_SIZE); | ||
38 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | ||
39 | MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE); | ||
40 | versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps, | ||
41 | -- | 40 | -- |
42 | 2.20.1 | 41 | 2.20.1 |
43 | 42 | ||
44 | 43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Provide a new function dynamic_sysbus_dev_allowed() which checks the | ||
2 | per-machine list of permitted dynamic sysbus devices and returns a | ||
3 | boolean result indicating whether the device is allowed. We can use | ||
4 | this in the implementation of validate_sysbus_device(), but we will | ||
5 | also need it so that machine hotplug callbacks can validate devices | ||
6 | rather than assuming that any sysbus device might be hotpluggable | ||
7 | into the platform bus. | ||
1 | 8 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
14 | --- | ||
15 | include/hw/boards.h | 24 ++++++++++++++++++++++++ | ||
16 | hw/core/machine.c | 21 ++++++++++++++++----- | ||
17 | 2 files changed, 40 insertions(+), 5 deletions(-) | ||
18 | |||
19 | diff --git a/include/hw/boards.h b/include/hw/boards.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/hw/boards.h | ||
22 | +++ b/include/hw/boards.h | ||
23 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, | ||
24 | */ | ||
25 | void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); | ||
26 | |||
27 | +/** | ||
28 | + * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device | ||
29 | + * @mc: Machine class | ||
30 | + * @dev: device to check | ||
31 | + * | ||
32 | + * Returns: true if @dev is a sysbus device on the machine's list | ||
33 | + * of dynamically pluggable sysbus devices; otherwise false. | ||
34 | + * | ||
35 | + * This function checks whether @dev is a valid dynamic sysbus device, | ||
36 | + * by first confirming that it is a sysbus device and then checking it | ||
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 | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/hw/core/machine.c | ||
57 | +++ b/hw/core/machine.c | ||
58 | @@ -XXX,XX +XXX,XX @@ void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type) | ||
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); | ||
80 | } | ||
81 | |||
82 | - if (!allowed) { | ||
83 | + return allowed; | ||
84 | +} | ||
85 | + | ||
86 | +static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque) | ||
87 | +{ | ||
88 | + MachineState *machine = opaque; | ||
89 | + MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
90 | + | ||
91 | + if (!device_is_dynamic_sysbus(mc, DEVICE(sbdev))) { | ||
92 | error_report("Option '-device %s' cannot be handled by this machine", | ||
93 | object_class_get_name(object_get_class(OBJECT(sbdev)))); | ||
94 | exit(1); | ||
95 | -- | ||
96 | 2.20.1 | ||
97 | |||
98 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The virt machine device plug callback currently calls | ||
2 | platform_bus_link_device() for any sysbus device. This is overly | ||
3 | broad, because platform_bus_link_device() will unconditionally grab | ||
4 | the IRQs and MMIOs of the device it is passed, whether it was | ||
5 | intended for the platform bus or not. Restrict hotpluggability of | ||
6 | sysbus devices to only those devices on the dynamic sysbus | ||
7 | allowlist. | ||
1 | 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. | ||
15 | |||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
19 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
20 | Message-id: 20210325153310.9131-4-peter.maydell@linaro.org | ||
21 | --- | ||
22 | hw/arm/virt.c | 8 ++++++-- | ||
23 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/virt.c | ||
28 | +++ b/hw/arm/virt.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, | ||
30 | VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); | ||
31 | |||
32 | if (vms->platform_bus_dev) { | ||
33 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
34 | + MachineClass *mc = MACHINE_GET_CLASS(vms); | ||
35 | + | ||
36 | + if (device_is_dynamic_sysbus(mc, dev)) { | ||
37 | platform_bus_link_device(PLATFORM_BUS_DEVICE(vms->platform_bus_dev), | ||
38 | SYS_BUS_DEVICE(dev)); | ||
39 | } | ||
40 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_unplug_cb(HotplugHandler *hotplug_dev, | ||
41 | static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | ||
42 | DeviceState *dev) | ||
43 | { | ||
44 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE) || | ||
45 | + MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
46 | + | ||
47 | + if (device_is_dynamic_sysbus(mc, dev) || | ||
48 | (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { | ||
49 | return HOTPLUG_HANDLER(machine); | ||
50 | } | ||
51 | -- | ||
52 | 2.20.1 | ||
53 | |||
54 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | The e500plat machine device plug callback currently calls |
---|---|---|---|
2 | platform_bus_link_device() for any sysbus device. This is overly | ||
3 | broad, because platform_bus_link_device() will unconditionally grab | ||
4 | the IRQs and MMIOs of the device it is passed, whether it was | ||
5 | intended for the platform bus or not. Restrict hotpluggability of | ||
6 | sysbus devices to only those devices on the dynamic sysbus allowlist. | ||
2 | 7 | ||
3 | The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1, | 8 | We were mostly getting away with this because the board creates the |
4 | ISR_EL1 shows the pending status of the physical IRQ, FIQ, or | 9 | platform bus as the last device it creates, and so the hotplug |
5 | SError interrupts. | 10 | callback did not do anything for all the sysbus devices created by |
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 | ||
6 | 15 | ||
7 | Unfortunately, QEMU's implementation only considers the HCR_EL2 | 16 | This isn't a sensible command because the macio-oldworld device |
8 | bits, and ignores the current exception level. This means a hypervisor | 17 | is really specific to the 'g3beige' machine, but we now fail |
9 | trying to look at its own interrupt state actually sees the guest | 18 | with a reasonable error message rather than asserting: |
10 | state, which is unexpected and breaks KVM as of Linux 5.3. | 19 | qemu-system-ppc64: Device heathrow is not supported by this machine yet. |
11 | 20 | ||
12 | Instead, check for the running EL and return the physical bits | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | if not running in a virtualized context. | 22 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
27 | --- | ||
28 | hw/ppc/e500plat.c | 8 ++++++-- | ||
29 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
14 | 30 | ||
15 | Fixes: 636540e9c40b | 31 | diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c |
16 | Cc: qemu-stable@nongnu.org | ||
17 | Reported-by: Quentin Perret <qperret@google.com> | ||
18 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
19 | Message-id: 20191122135833.28953-1-maz@kernel.org | ||
20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
23 | --- | ||
24 | target/arm/helper.c | 7 +++++-- | ||
25 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
26 | |||
27 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/helper.c | 33 | --- a/hw/ppc/e500plat.c |
30 | +++ b/target/arm/helper.c | 34 | +++ b/hw/ppc/e500plat.c |
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 35 | @@ -XXX,XX +XXX,XX @@ static void e500plat_machine_device_plug_cb(HotplugHandler *hotplug_dev, |
32 | CPUState *cs = env_cpu(env); | 36 | PPCE500MachineState *pms = PPCE500_MACHINE(hotplug_dev); |
33 | uint64_t hcr_el2 = arm_hcr_el2_eff(env); | 37 | |
34 | uint64_t ret = 0; | 38 | if (pms->pbus_dev) { |
35 | + bool allow_virt = (arm_current_el(env) == 1 && | 39 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { |
36 | + (!arm_is_secure_below_el3(env) || | 40 | + MachineClass *mc = MACHINE_GET_CLASS(pms); |
37 | + (env->cp15.scr_el3 & SCR_EEL2))); | 41 | + |
38 | 42 | + if (device_is_dynamic_sysbus(mc, dev)) { | |
39 | - if (hcr_el2 & HCR_IMO) { | 43 | platform_bus_link_device(pms->pbus_dev, SYS_BUS_DEVICE(dev)); |
40 | + if (allow_virt && (hcr_el2 & HCR_IMO)) { | ||
41 | if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { | ||
42 | ret |= CPSR_I; | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
45 | } | 44 | } |
46 | } | 45 | } |
47 | 46 | @@ -XXX,XX +XXX,XX @@ static | |
48 | - if (hcr_el2 & HCR_FMO) { | 47 | HotplugHandler *e500plat_machine_get_hotpug_handler(MachineState *machine, |
49 | + if (allow_virt && (hcr_el2 & HCR_FMO)) { | 48 | DeviceState *dev) |
50 | if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { | 49 | { |
51 | ret |= CPSR_F; | 50 | - if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { |
52 | } | 51 | + MachineClass *mc = MACHINE_GET_CLASS(machine); |
52 | + | ||
53 | + if (device_is_dynamic_sysbus(mc, dev)) { | ||
54 | return HOTPLUG_HANDLER(machine); | ||
55 | } | ||
56 | |||
53 | -- | 57 | -- |
54 | 2.20.1 | 58 | 2.20.1 |
55 | 59 | ||
56 | 60 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | This reverts commit f7fb73b8cdd3f77e26f9fcff8cf24ff1b58d200f. |
---|---|---|---|
2 | 2 | ||
3 | HCR_EL2.TID3 mandates that access from EL1 to a long list of id | 3 | This change turned out to be a bit half-baked, and doesn't |
4 | registers traps to EL2, and QEMU has so far ignored this requirement. | 4 | work with KVM, which fails with the error: |
5 | 5 | "qemu-system-aarch64: Failed to retrieve host CPU features" | |
6 | This breaks (among other things) KVM guests that have PtrAuth enabled, | 6 | |
7 | while the hypervisor doesn't want to expose the feature to its guest. | 7 | because KVM does not allow accessing of the PMCR_EL0 value in |
8 | To achieve this, KVM traps the ID registers (ID_AA64ISAR1_EL1 in this | 8 | the scratch "query CPU ID registers" VM unless we have first |
9 | case), and masks out the unsupported feature. | 9 | set the KVM_ARM_VCPU_PMU_V3 feature on the VM. |
10 | 10 | ||
11 | QEMU not honoring the trap request means that the guest observes | 11 | Revert the change for 6.0. |
12 | that the feature is present in the HW, starts using it, and dies | 12 | |
13 | a horrible death when KVM injects an UNDEF, because the feature | 13 | Reported-by: Zenghui Yu <yuzenghui@huawei.com> |
14 | *really* isn't supported. | ||
15 | |||
16 | Do the right thing by trapping to EL2 if HCR_EL2.TID3 is set. | ||
17 | |||
18 | Note that this change does not include trapping of the MVFR | ||
19 | registers from AArch32 (they are accessed via the VMRS | ||
20 | instruction and need to be handled in a different way). | ||
21 | |||
22 | Reported-by: Will Deacon <will@kernel.org> | ||
23 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
24 | Tested-by: Will Deacon <will@kernel.org> | ||
25 | Message-id: 20191123115618.29230-1-maz@kernel.org | ||
26 | [PMM: added missing accessfn line for ID_AA4PFR2_EL1_RESERVED; | ||
27 | changed names of access functions to include _tid3] | ||
28 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | 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 | ||
30 | --- | 17 | --- |
31 | target/arm/helper.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ | 18 | target/arm/cpu.h | 1 - |
32 | 1 file changed, 76 insertions(+) | 19 | target/arm/cpu64.c | 3 --- |
33 | 20 | target/arm/cpu_tcg.c | 5 ----- | |
21 | target/arm/helper.c | 29 ++++++++++++----------------- | ||
22 | target/arm/kvm64.c | 2 -- | ||
23 | 5 files changed, 12 insertions(+), 28 deletions(-) | ||
24 | |||
25 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/arm/cpu.h | ||
28 | +++ b/target/arm/cpu.h | ||
29 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
30 | uint64_t id_aa64mmfr2; | ||
31 | uint64_t id_aa64dfr0; | ||
32 | uint64_t id_aa64dfr1; | ||
33 | - uint64_t reset_pmcr_el0; | ||
34 | } isar; | ||
35 | uint64_t midr; | ||
36 | uint32_t revidr; | ||
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 | |||
34 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 109 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
35 | index XXXXXXX..XXXXXXX 100644 | 110 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/helper.c | 111 | --- a/target/arm/helper.c |
37 | +++ b/target/arm/helper.c | 112 | +++ b/target/arm/helper.c |
38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = { | 113 | @@ -XXX,XX +XXX,XX @@ |
39 | REGINFO_SENTINEL | 114 | #endif |
40 | }; | 115 | |
41 | 116 | #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ | |
42 | +static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | 117 | +#define PMCR_NUM_COUNTERS 4 /* QEMU IMPDEF choice */ |
43 | + bool isread) | 118 | |
44 | +{ | 119 | #ifndef CONFIG_USER_ONLY |
45 | + if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) { | 120 | |
46 | + return CP_ACCESS_TRAP_EL2; | 121 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { |
47 | + } | 122 | |
48 | + | 123 | static inline uint32_t pmu_num_counters(CPUARMState *env) |
49 | + return CP_ACCESS_OK; | ||
50 | +} | ||
51 | + | ||
52 | +static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | ||
53 | + bool isread) | ||
54 | +{ | ||
55 | + if (arm_feature(env, ARM_FEATURE_V8)) { | ||
56 | + return access_aa64_tid3(env, ri, isread); | ||
57 | + } | ||
58 | + | ||
59 | + return CP_ACCESS_OK; | ||
60 | +} | ||
61 | + | ||
62 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
63 | { | 124 | { |
64 | /* Register all the coprocessor registers based on feature bits */ | 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++) { | ||
65 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 168 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
66 | { .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH, | 169 | .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, |
67 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | ||
68 | .access = PL1_R, .type = ARM_CP_CONST, | ||
69 | + .accessfn = access_aa32_tid3, | ||
70 | .resetvalue = cpu->id_pfr0 }, | ||
71 | /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know | ||
72 | * the value of the GIC field until after we define these regs. | ||
73 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
74 | { .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH, | ||
75 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, | ||
76 | .access = PL1_R, .type = ARM_CP_NO_RAW, | ||
77 | + .accessfn = access_aa32_tid3, | ||
78 | .readfn = id_pfr1_read, | ||
79 | .writefn = arm_cp_write_ignore }, | ||
80 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | ||
81 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, | ||
82 | .access = PL1_R, .type = ARM_CP_CONST, | ||
83 | + .accessfn = access_aa32_tid3, | ||
84 | .resetvalue = cpu->id_dfr0 }, | ||
85 | { .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH, | ||
86 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3, | ||
87 | .access = PL1_R, .type = ARM_CP_CONST, | ||
88 | + .accessfn = access_aa32_tid3, | ||
89 | .resetvalue = cpu->id_afr0 }, | ||
90 | { .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH, | ||
91 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4, | ||
92 | .access = PL1_R, .type = ARM_CP_CONST, | ||
93 | + .accessfn = access_aa32_tid3, | ||
94 | .resetvalue = cpu->id_mmfr0 }, | ||
95 | { .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH, | ||
96 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5, | ||
97 | .access = PL1_R, .type = ARM_CP_CONST, | ||
98 | + .accessfn = access_aa32_tid3, | ||
99 | .resetvalue = cpu->id_mmfr1 }, | ||
100 | { .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH, | ||
101 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6, | ||
102 | .access = PL1_R, .type = ARM_CP_CONST, | ||
103 | + .accessfn = access_aa32_tid3, | ||
104 | .resetvalue = cpu->id_mmfr2 }, | ||
105 | { .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH, | ||
106 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7, | ||
107 | .access = PL1_R, .type = ARM_CP_CONST, | ||
108 | + .accessfn = access_aa32_tid3, | ||
109 | .resetvalue = cpu->id_mmfr3 }, | ||
110 | { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, | ||
111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, | ||
112 | .access = PL1_R, .type = ARM_CP_CONST, | ||
113 | + .accessfn = access_aa32_tid3, | ||
114 | .resetvalue = cpu->isar.id_isar0 }, | ||
115 | { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, | ||
116 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, | ||
117 | .access = PL1_R, .type = ARM_CP_CONST, | ||
118 | + .accessfn = access_aa32_tid3, | ||
119 | .resetvalue = cpu->isar.id_isar1 }, | ||
120 | { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, | ||
121 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, | ||
122 | .access = PL1_R, .type = ARM_CP_CONST, | ||
123 | + .accessfn = access_aa32_tid3, | ||
124 | .resetvalue = cpu->isar.id_isar2 }, | ||
125 | { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, | ||
126 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, | ||
127 | .access = PL1_R, .type = ARM_CP_CONST, | ||
128 | + .accessfn = access_aa32_tid3, | ||
129 | .resetvalue = cpu->isar.id_isar3 }, | ||
130 | { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, | ||
131 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, | ||
132 | .access = PL1_R, .type = ARM_CP_CONST, | ||
133 | + .accessfn = access_aa32_tid3, | ||
134 | .resetvalue = cpu->isar.id_isar4 }, | ||
135 | { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, | ||
136 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, | ||
137 | .access = PL1_R, .type = ARM_CP_CONST, | ||
138 | + .accessfn = access_aa32_tid3, | ||
139 | .resetvalue = cpu->isar.id_isar5 }, | ||
140 | { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, | ||
141 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, | ||
142 | .access = PL1_R, .type = ARM_CP_CONST, | ||
143 | + .accessfn = access_aa32_tid3, | ||
144 | .resetvalue = cpu->id_mmfr4 }, | ||
145 | { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, | ||
146 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, | ||
147 | .access = PL1_R, .type = ARM_CP_CONST, | ||
148 | + .accessfn = access_aa32_tid3, | ||
149 | .resetvalue = cpu->isar.id_isar6 }, | ||
150 | REGINFO_SENTINEL | 170 | REGINFO_SENTINEL |
151 | }; | 171 | }; |
152 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 172 | - /* |
153 | { .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64, | 173 | - * The only field of MDCR_EL2 that has a defined architectural reset |
154 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0, | 174 | - * value is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N. |
155 | .access = PL1_R, .type = ARM_CP_NO_RAW, | 175 | - */ |
156 | + .accessfn = access_aa64_tid3, | 176 | - ARMCPRegInfo mdcr_el2 = { |
157 | .readfn = id_aa64pfr0_read, | 177 | - .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, |
158 | .writefn = arm_cp_write_ignore }, | 178 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, |
159 | { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, | 179 | - .access = PL2_RW, .resetvalue = pmu_num_counters(env), |
160 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, | 180 | - .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), |
161 | .access = PL1_R, .type = ARM_CP_CONST, | 181 | - }; |
162 | + .accessfn = access_aa64_tid3, | 182 | - define_one_arm_cp_reg(cpu, &mdcr_el2); |
163 | .resetvalue = cpu->isar.id_aa64pfr1}, | 183 | define_arm_cp_regs(cpu, vpidr_regs); |
164 | { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 184 | define_arm_cp_regs(cpu, el2_cp_reginfo); |
165 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, | 185 | if (arm_feature(env, ARM_FEATURE_V8)) { |
166 | .access = PL1_R, .type = ARM_CP_CONST, | 186 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
167 | + .accessfn = access_aa64_tid3, | 187 | index XXXXXXX..XXXXXXX 100644 |
168 | .resetvalue = 0 }, | 188 | --- a/target/arm/kvm64.c |
169 | { .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 189 | +++ b/target/arm/kvm64.c |
170 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3, | 190 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
171 | .access = PL1_R, .type = ARM_CP_CONST, | 191 | ARM64_SYS_REG(3, 0, 0, 7, 1)); |
172 | + .accessfn = access_aa64_tid3, | 192 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, |
173 | .resetvalue = 0 }, | 193 | ARM64_SYS_REG(3, 0, 0, 7, 2)); |
174 | { .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64, | 194 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, |
175 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4, | 195 | - ARM64_SYS_REG(3, 3, 9, 12, 0)); |
176 | .access = PL1_R, .type = ARM_CP_CONST, | 196 | |
177 | + .accessfn = access_aa64_tid3, | 197 | /* |
178 | /* At present, only SVEver == 0 is defined anyway. */ | 198 | * Note that if AArch32 support is not present in the host, |
179 | .resetvalue = 0 }, | ||
180 | { .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, | ||
182 | .access = PL1_R, .type = ARM_CP_CONST, | ||
183 | + .accessfn = access_aa64_tid3, | ||
184 | .resetvalue = 0 }, | ||
185 | { .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
186 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6, | ||
187 | .access = PL1_R, .type = ARM_CP_CONST, | ||
188 | + .accessfn = access_aa64_tid3, | ||
189 | .resetvalue = 0 }, | ||
190 | { .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
191 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7, | ||
192 | .access = PL1_R, .type = ARM_CP_CONST, | ||
193 | + .accessfn = access_aa64_tid3, | ||
194 | .resetvalue = 0 }, | ||
195 | { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
196 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, | ||
197 | .access = PL1_R, .type = ARM_CP_CONST, | ||
198 | + .accessfn = access_aa64_tid3, | ||
199 | .resetvalue = cpu->id_aa64dfr0 }, | ||
200 | { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
201 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, | ||
202 | .access = PL1_R, .type = ARM_CP_CONST, | ||
203 | + .accessfn = access_aa64_tid3, | ||
204 | .resetvalue = cpu->id_aa64dfr1 }, | ||
205 | { .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
206 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2, | ||
207 | .access = PL1_R, .type = ARM_CP_CONST, | ||
208 | + .accessfn = access_aa64_tid3, | ||
209 | .resetvalue = 0 }, | ||
210 | { .name = "ID_AA64DFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
211 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 3, | ||
212 | .access = PL1_R, .type = ARM_CP_CONST, | ||
213 | + .accessfn = access_aa64_tid3, | ||
214 | .resetvalue = 0 }, | ||
215 | { .name = "ID_AA64AFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
216 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 4, | ||
217 | .access = PL1_R, .type = ARM_CP_CONST, | ||
218 | + .accessfn = access_aa64_tid3, | ||
219 | .resetvalue = cpu->id_aa64afr0 }, | ||
220 | { .name = "ID_AA64AFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
221 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 5, | ||
222 | .access = PL1_R, .type = ARM_CP_CONST, | ||
223 | + .accessfn = access_aa64_tid3, | ||
224 | .resetvalue = cpu->id_aa64afr1 }, | ||
225 | { .name = "ID_AA64AFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
226 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 6, | ||
227 | .access = PL1_R, .type = ARM_CP_CONST, | ||
228 | + .accessfn = access_aa64_tid3, | ||
229 | .resetvalue = 0 }, | ||
230 | { .name = "ID_AA64AFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
231 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 7, | ||
232 | .access = PL1_R, .type = ARM_CP_CONST, | ||
233 | + .accessfn = access_aa64_tid3, | ||
234 | .resetvalue = 0 }, | ||
235 | { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, | ||
236 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, | ||
237 | .access = PL1_R, .type = ARM_CP_CONST, | ||
238 | + .accessfn = access_aa64_tid3, | ||
239 | .resetvalue = cpu->isar.id_aa64isar0 }, | ||
240 | { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, | ||
241 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, | ||
242 | .access = PL1_R, .type = ARM_CP_CONST, | ||
243 | + .accessfn = access_aa64_tid3, | ||
244 | .resetvalue = cpu->isar.id_aa64isar1 }, | ||
245 | { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
246 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, | ||
247 | .access = PL1_R, .type = ARM_CP_CONST, | ||
248 | + .accessfn = access_aa64_tid3, | ||
249 | .resetvalue = 0 }, | ||
250 | { .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
251 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3, | ||
252 | .access = PL1_R, .type = ARM_CP_CONST, | ||
253 | + .accessfn = access_aa64_tid3, | ||
254 | .resetvalue = 0 }, | ||
255 | { .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
256 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4, | ||
257 | .access = PL1_R, .type = ARM_CP_CONST, | ||
258 | + .accessfn = access_aa64_tid3, | ||
259 | .resetvalue = 0 }, | ||
260 | { .name = "ID_AA64ISAR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
261 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 5, | ||
262 | .access = PL1_R, .type = ARM_CP_CONST, | ||
263 | + .accessfn = access_aa64_tid3, | ||
264 | .resetvalue = 0 }, | ||
265 | { .name = "ID_AA64ISAR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
266 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 6, | ||
267 | .access = PL1_R, .type = ARM_CP_CONST, | ||
268 | + .accessfn = access_aa64_tid3, | ||
269 | .resetvalue = 0 }, | ||
270 | { .name = "ID_AA64ISAR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
271 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 7, | ||
272 | .access = PL1_R, .type = ARM_CP_CONST, | ||
273 | + .accessfn = access_aa64_tid3, | ||
274 | .resetvalue = 0 }, | ||
275 | { .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
276 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, | ||
277 | .access = PL1_R, .type = ARM_CP_CONST, | ||
278 | + .accessfn = access_aa64_tid3, | ||
279 | .resetvalue = cpu->isar.id_aa64mmfr0 }, | ||
280 | { .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
281 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, | ||
282 | .access = PL1_R, .type = ARM_CP_CONST, | ||
283 | + .accessfn = access_aa64_tid3, | ||
284 | .resetvalue = cpu->isar.id_aa64mmfr1 }, | ||
285 | { .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
286 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, | ||
287 | .access = PL1_R, .type = ARM_CP_CONST, | ||
288 | + .accessfn = access_aa64_tid3, | ||
289 | .resetvalue = 0 }, | ||
290 | { .name = "ID_AA64MMFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
291 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3, | ||
292 | .access = PL1_R, .type = ARM_CP_CONST, | ||
293 | + .accessfn = access_aa64_tid3, | ||
294 | .resetvalue = 0 }, | ||
295 | { .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
296 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4, | ||
297 | .access = PL1_R, .type = ARM_CP_CONST, | ||
298 | + .accessfn = access_aa64_tid3, | ||
299 | .resetvalue = 0 }, | ||
300 | { .name = "ID_AA64MMFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
301 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 5, | ||
302 | .access = PL1_R, .type = ARM_CP_CONST, | ||
303 | + .accessfn = access_aa64_tid3, | ||
304 | .resetvalue = 0 }, | ||
305 | { .name = "ID_AA64MMFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
306 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 6, | ||
307 | .access = PL1_R, .type = ARM_CP_CONST, | ||
308 | + .accessfn = access_aa64_tid3, | ||
309 | .resetvalue = 0 }, | ||
310 | { .name = "ID_AA64MMFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
311 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 7, | ||
312 | .access = PL1_R, .type = ARM_CP_CONST, | ||
313 | + .accessfn = access_aa64_tid3, | ||
314 | .resetvalue = 0 }, | ||
315 | { .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
316 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0, | ||
317 | .access = PL1_R, .type = ARM_CP_CONST, | ||
318 | + .accessfn = access_aa64_tid3, | ||
319 | .resetvalue = cpu->isar.mvfr0 }, | ||
320 | { .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
321 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1, | ||
322 | .access = PL1_R, .type = ARM_CP_CONST, | ||
323 | + .accessfn = access_aa64_tid3, | ||
324 | .resetvalue = cpu->isar.mvfr1 }, | ||
325 | { .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64, | ||
326 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, | ||
327 | .access = PL1_R, .type = ARM_CP_CONST, | ||
328 | + .accessfn = access_aa64_tid3, | ||
329 | .resetvalue = cpu->isar.mvfr2 }, | ||
330 | { .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
331 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3, | ||
332 | .access = PL1_R, .type = ARM_CP_CONST, | ||
333 | + .accessfn = access_aa64_tid3, | ||
334 | .resetvalue = 0 }, | ||
335 | { .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
336 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, | ||
337 | .access = PL1_R, .type = ARM_CP_CONST, | ||
338 | + .accessfn = access_aa64_tid3, | ||
339 | .resetvalue = 0 }, | ||
340 | { .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
341 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, | ||
342 | .access = PL1_R, .type = ARM_CP_CONST, | ||
343 | + .accessfn = access_aa64_tid3, | ||
344 | .resetvalue = 0 }, | ||
345 | { .name = "MVFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
346 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6, | ||
347 | .access = PL1_R, .type = ARM_CP_CONST, | ||
348 | + .accessfn = access_aa64_tid3, | ||
349 | .resetvalue = 0 }, | ||
350 | { .name = "MVFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
351 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7, | ||
352 | .access = PL1_R, .type = ARM_CP_CONST, | ||
353 | + .accessfn = access_aa64_tid3, | ||
354 | .resetvalue = 0 }, | ||
355 | { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, | ||
356 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, | ||
357 | -- | 199 | -- |
358 | 2.20.1 | 200 | 2.20.1 |
359 | 201 | ||
360 | 202 | diff view generated by jsdifflib |
1 | From: Jean-Hugues Deschênes <Jean-Hugues.Deschenes@ossiaco.com> | 1 | From: "Chubb, Peter (Data61, Eveleigh)" <Peter.Chubb@data61.csiro.au> |
---|---|---|---|
2 | 2 | ||
3 | According to the PushStack() pseudocode in the armv7m RM, | 3 | Remove Peter Chubb as i/MX31 maintainer. |
4 | bit 4 of the LR should be set to NOT(CONTROL.PFCA) when | ||
5 | an FPU is present. Current implementation is doing it for | ||
6 | armv8, but not for armv7. This patch makes the existing | ||
7 | logic applicable to both code paths. | ||
8 | 4 | ||
9 | Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes@ossiaco.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> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | target/arm/m_helper.c | 7 +++---- | 12 | MAINTAINERS | 1 - |
14 | 1 file changed, 3 insertions(+), 4 deletions(-) | 13 | 1 file changed, 1 deletion(-) |
15 | 14 | ||
16 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | 15 | diff --git a/MAINTAINERS b/MAINTAINERS |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/m_helper.c | 17 | --- a/MAINTAINERS |
19 | +++ b/target/arm/m_helper.c | 18 | +++ b/MAINTAINERS |
20 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 19 | @@ -XXX,XX +XXX,XX @@ F: include/hw/misc/imx25_ccm.h |
21 | if (env->v7m.secure) { | 20 | F: include/hw/watchdog/wdt_imx2.h |
22 | lr |= R_V7M_EXCRET_S_MASK; | 21 | |
23 | } | 22 | i.MX31 (kzm) |
24 | - if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | 23 | -M: Peter Chubb <peter.chubb@nicta.com.au> |
25 | - lr |= R_V7M_EXCRET_FTYPE_MASK; | 24 | M: Peter Maydell <peter.maydell@linaro.org> |
26 | - } | 25 | L: qemu-arm@nongnu.org |
27 | } else { | 26 | S: Odd Fixes |
28 | lr = R_V7M_EXCRET_RES1_MASK | | ||
29 | R_V7M_EXCRET_S_MASK | | ||
30 | R_V7M_EXCRET_DCRS_MASK | | ||
31 | - R_V7M_EXCRET_FTYPE_MASK | | ||
32 | R_V7M_EXCRET_ES_MASK; | ||
33 | if (env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK) { | ||
34 | lr |= R_V7M_EXCRET_SPSEL_MASK; | ||
35 | } | ||
36 | } | ||
37 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | ||
38 | + lr |= R_V7M_EXCRET_FTYPE_MASK; | ||
39 | + } | ||
40 | if (!arm_v7m_is_handler_mode(env)) { | ||
41 | lr |= R_V7M_EXCRET_MODE_MASK; | ||
42 | } | ||
43 | -- | 27 | -- |
44 | 2.20.1 | 28 | 2.20.1 |
45 | 29 | ||
46 | 30 | diff view generated by jsdifflib |