1 | The following changes since commit 7e7eb9f852a46b51a71ae9d82590b2e4d28827ee: | 1 | Another arm pullreq; nothing particularly exciting here. |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-01-28' into staging (2021-01-28 22:43:18 +0000) | 3 | -- PMM |
4 | |||
5 | |||
6 | The following changes since commit e27d5b488ef08408691bfed61f34ee2858136287: | ||
7 | |||
8 | Merge remote-tracking branch 'remotes/juanquintela/tags/pull-migration-pull-request' into staging (2020-02-28 14:02:31 +0000) | ||
4 | 9 | ||
5 | are available in the Git repository at: | 10 | are available in the Git repository at: |
6 | 11 | ||
7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210129 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200228 |
8 | 13 | ||
9 | for you to fetch changes up to 11749122e1a86866591306d43603d2795a3dea1a: | 14 | for you to fetch changes up to 1904f9b5f1d94fe12fe021db6b504c87d684f6db: |
10 | 15 | ||
11 | hw/arm/stellaris: Remove board-creation reset of STELLARIS_SYS (2021-01-29 10:47:29 +0000) | 16 | hw/intc/arm_gic_kvm: Don't assume kernel can provide a GICv2 (2020-02-28 16:14:57 +0000) |
12 | 17 | ||
13 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
14 | target-arm queue: | 19 | target-arm queue: |
15 | * Implement ID_PFR2 | 20 | * hw/arm: Use TYPE_PL011 to create serial port |
16 | * Conditionalize DBGDIDR | 21 | * target/arm: Set ID_MMFR4.HPDS for aarch64_max_initfn |
17 | * rename xlnx-zcu102.canbusN properties | 22 | * hw/arm/integratorcp: Map the audio codec controller |
18 | * provide powerdown/reset mechanism for secure firmware on 'virt' board | 23 | * GICv2: Correctly implement the limited number of priority bits |
19 | * hw/misc: Fix arith overflow in NPCM7XX PWM module | 24 | * target/arm: refactoring of VFP related feature checks and decode |
20 | * target/arm: Replace magic value by MMU_DATA_LOAD definition | 25 | * xilinx_zynq: Fix USB port instantiation |
21 | * configure: fix preadv errors on Catalina macOS with new XCode | 26 | * acceptance tests for n800, n810, integratorcp |
22 | * Various configure and other cleanups in preparation for iOS support | 27 | * Implement v8.3-RCPC, v8.4-RCPC, v8.3-CCIDX |
23 | * hvf: Add hypervisor entitlement to output binaries (needed for Big Sur) | 28 | * arm_gic_kvm: Don't assume kernel can provide a GICv2 |
24 | * Implement pvpanic-pci device | 29 | (provide better error message for user error) |
25 | * Convert the CMSDK timer devices to the Clock framework | ||
26 | 30 | ||
27 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
28 | Alexander Graf (1): | 32 | Gavin Shan (1): |
29 | hvf: Add hypervisor entitlement to output binaries | 33 | hw/arm: Use TYPE_PL011 to create serial port |
30 | 34 | ||
31 | Hao Wu (1): | 35 | Guenter Roeck (2): |
32 | hw/misc: Fix arith overflow in NPCM7XX PWM module | 36 | hw/arm/xilinx_zynq: Fix USB port instantiation |
37 | hw/usb/hcd-ehci-sysbus: Remove obsolete xlnx, ps7-usb class | ||
33 | 38 | ||
34 | Joelle van Dyne (7): | 39 | Peter Maydell (5): |
35 | configure: cross-compiling with empty cross_prefix | 40 | target/arm: Fix wrong use of FIELD_EX32 on ID_AA64DFR0 |
36 | osdep: build with non-working system() function | 41 | target/arm: Implement v8.3-RCPC |
37 | darwin: remove redundant dependency declaration | 42 | target/arm: Implement v8.4-RCPC |
38 | darwin: fix cross-compiling for Darwin | 43 | target/arm: Implement ARMv8.3-CCIDX |
39 | configure: cross compile should use x86_64 cpu_family | 44 | hw/intc/arm_gic_kvm: Don't assume kernel can provide a GICv2 |
40 | darwin: detect CoreAudio for build | ||
41 | darwin: remove 64-bit build detection on 32-bit OS | ||
42 | 45 | ||
43 | Maxim Uvarov (3): | 46 | Philippe Mathieu-Daudé (3): |
44 | hw: gpio: implement gpio-pwr driver for qemu reset/poweroff | 47 | hw/arm/integratorcp: Map the audio codec controller |
45 | arm-virt: refactor gpios creation | 48 | tests/acceptance: Extract boot_integratorcp() from test_integratorcp() |
46 | arm-virt: add secure pl061 for reset/power down | 49 | tests/acceptance/integratorcp: Verify Tux is displayed on framebuffer |
47 | 50 | ||
48 | Mihai Carabas (4): | 51 | Richard Henderson (17): |
49 | hw/misc/pvpanic: split-out generic and bus dependent code | 52 | target/arm: Set ID_MMFR4.HPDS for aarch64_max_initfn |
50 | hw/misc/pvpanic: add PCI interface support | 53 | target/arm: Add isar_feature_aa32_vfp_simd |
51 | pvpanic : update pvpanic spec document | 54 | target/arm: Rename isar_feature_aa32_fpdp_v2 |
52 | tests/qtest: add a test case for pvpanic-pci | 55 | target/arm: Add isar_feature_aa32_{fpsp_v2, fpsp_v3, fpdp_v3} |
56 | target/arm: Add isar_feature_aa64_fp_simd, isar_feature_aa32_vfp | ||
57 | target/arm: Perform fpdp_v2 check first | ||
58 | target/arm: Replace ARM_FEATURE_VFP3 checks with fp{sp, dp}_v3 | ||
59 | target/arm: Add missing checks for fpsp_v2 | ||
60 | target/arm: Replace ARM_FEATURE_VFP4 with isar_feature_aa32_simdfmac | ||
61 | target/arm: Remove ARM_FEATURE_VFP check from disas_vfp_insn | ||
62 | target/arm: Move VLLDM and VLSTM to vfp.decode | ||
63 | target/arm: Move the vfp decodetree calls next to the base isa | ||
64 | linux-user/arm: Replace ARM_FEATURE_VFP* tests for HWCAP | ||
65 | target/arm: Remove ARM_FEATURE_VFP* | ||
66 | target/arm: Add formats for some vfp 2 and 3-register insns | ||
67 | target/arm: Split VFM decode | ||
68 | target/arm: Split VMINMAXNM decode | ||
53 | 69 | ||
54 | Paolo Bonzini (1): | 70 | Sai Pavan Boddu (3): |
55 | arm: rename xlnx-zcu102.canbusN properties | 71 | arm_gic: Mask the un-supported priority bits |
72 | cpu/a9mpcore: Set number of GIC priority bits to 5 | ||
73 | cpu/arm11mpcore: Set number of GIC priority bits to 4 | ||
56 | 74 | ||
57 | Peter Maydell (26): | 75 | Thomas Huth (2): |
58 | configure: Move preadv check to meson.build | 76 | tests/acceptance: Add a test for the N800 and N810 arm machines |
59 | ptimer: Add new ptimer_set_period_from_clock() function | 77 | tests/acceptance: Add a test for the integratorcp arm machine |
60 | clock: Add new clock_has_source() function | ||
61 | tests: Add a simple test of the CMSDK APB timer | ||
62 | tests: Add a simple test of the CMSDK APB watchdog | ||
63 | tests: Add a simple test of the CMSDK APB dual timer | ||
64 | hw/timer/cmsdk-apb-timer: Rename CMSDKAPBTIMER struct to CMSDKAPBTimer | ||
65 | hw/timer/cmsdk-apb-timer: Add Clock input | ||
66 | hw/timer/cmsdk-apb-dualtimer: Add Clock input | ||
67 | hw/watchdog/cmsdk-apb-watchdog: Add Clock input | ||
68 | hw/arm/armsse: Rename "MAINCLK" property to "MAINCLK_FRQ" | ||
69 | hw/arm/armsse: Wire up clocks | ||
70 | hw/arm/mps2: Inline CMSDK_APB_TIMER creation | ||
71 | hw/arm/mps2: Create and connect SYSCLK Clock | ||
72 | hw/arm/mps2-tz: Create and connect ARMSSE Clocks | ||
73 | hw/arm/musca: Create and connect ARMSSE Clocks | ||
74 | hw/arm/stellaris: Convert SSYS to QOM device | ||
75 | hw/arm/stellaris: Create Clock input for watchdog | ||
76 | hw/timer/cmsdk-apb-timer: Convert to use Clock input | ||
77 | hw/timer/cmsdk-apb-dualtimer: Convert to use Clock input | ||
78 | hw/watchdog/cmsdk-apb-watchdog: Convert to use Clock input | ||
79 | tests/qtest/cmsdk-apb-watchdog-test: Test clock changes | ||
80 | hw/arm/armsse: Use Clock to set system_clock_scale | ||
81 | arm: Don't set freq properties on CMSDK timer, dualtimer, watchdog, ARMSSE | ||
82 | arm: Remove frq properties on CMSDK timer, dualtimer, watchdog, ARMSSE | ||
83 | hw/arm/stellaris: Remove board-creation reset of STELLARIS_SYS | ||
84 | 78 | ||
85 | Philippe Mathieu-Daudé (1): | 79 | include/hw/intc/arm_gic.h | 2 + |
86 | target/arm: Replace magic value by MMU_DATA_LOAD definition | 80 | include/hw/intc/arm_gic_common.h | 1 + |
81 | target/arm/cpu.h | 88 +++++- | ||
82 | hw/arm/integratorcp.c | 1 + | ||
83 | hw/arm/sbsa-ref.c | 3 +- | ||
84 | hw/arm/virt.c | 3 +- | ||
85 | hw/arm/xilinx_zynq.c | 5 +- | ||
86 | hw/arm/xlnx-versal.c | 3 +- | ||
87 | hw/cpu/a9mpcore.c | 4 + | ||
88 | hw/cpu/arm11mpcore.c | 5 + | ||
89 | hw/intc/arm_gic.c | 33 +- | ||
90 | hw/intc/arm_gic_common.c | 1 + | ||
91 | hw/intc/arm_gic_kvm.c | 9 + | ||
92 | hw/intc/armv7m_nvic.c | 20 +- | ||
93 | hw/usb/hcd-ehci-sysbus.c | 17 - | ||
94 | linux-user/arm/signal.c | 4 +- | ||
95 | linux-user/elfload.c | 25 +- | ||
96 | target/arm/arch_dump.c | 11 +- | ||
97 | target/arm/cpu.c | 44 +-- | ||
98 | target/arm/cpu64.c | 5 +- | ||
99 | target/arm/helper.c | 23 +- | ||
100 | target/arm/kvm32.c | 5 - | ||
101 | target/arm/kvm64.c | 1 - | ||
102 | target/arm/m_helper.c | 11 +- | ||
103 | target/arm/machine.c | 5 +- | ||
104 | target/arm/translate-a64.c | 114 +++++++ | ||
105 | target/arm/translate-vfp.inc.c | 448 +++++++++++++++++---------- | ||
106 | target/arm/translate.c | 122 ++------ | ||
107 | MAINTAINERS | 2 + | ||
108 | hw/arm/Kconfig | 1 + | ||
109 | target/arm/vfp-uncond.decode | 12 +- | ||
110 | target/arm/vfp.decode | 153 ++++----- | ||
111 | tests/acceptance/machine_arm_integratorcp.py | 99 ++++++ | ||
112 | tests/acceptance/machine_arm_n8x0.py | 49 +++ | ||
113 | 34 files changed, 865 insertions(+), 464 deletions(-) | ||
114 | create mode 100644 tests/acceptance/machine_arm_integratorcp.py | ||
115 | create mode 100644 tests/acceptance/machine_arm_n8x0.py | ||
87 | 116 | ||
88 | Richard Henderson (2): | ||
89 | target/arm: Implement ID_PFR2 | ||
90 | target/arm: Conditionalize DBGDIDR | ||
91 | |||
92 | docs/devel/clocks.rst | 16 +++ | ||
93 | docs/specs/pci-ids.txt | 1 + | ||
94 | docs/specs/pvpanic.txt | 13 ++- | ||
95 | docs/system/arm/virt.rst | 2 + | ||
96 | configure | 78 ++++++++------ | ||
97 | meson.build | 34 ++++++- | ||
98 | include/hw/arm/armsse.h | 14 ++- | ||
99 | include/hw/arm/virt.h | 2 + | ||
100 | include/hw/clock.h | 15 +++ | ||
101 | include/hw/misc/pvpanic.h | 24 ++++- | ||
102 | include/hw/pci/pci.h | 1 + | ||
103 | include/hw/ptimer.h | 22 ++++ | ||
104 | include/hw/timer/cmsdk-apb-dualtimer.h | 5 +- | ||
105 | include/hw/timer/cmsdk-apb-timer.h | 34 ++----- | ||
106 | include/hw/watchdog/cmsdk-apb-watchdog.h | 5 +- | ||
107 | include/qemu/osdep.h | 12 +++ | ||
108 | include/qemu/typedefs.h | 1 + | ||
109 | target/arm/cpu.h | 1 + | ||
110 | hw/arm/armsse.c | 48 ++++++--- | ||
111 | hw/arm/mps2-tz.c | 14 ++- | ||
112 | hw/arm/mps2.c | 28 ++++- | ||
113 | hw/arm/musca.c | 13 ++- | ||
114 | hw/arm/stellaris.c | 170 +++++++++++++++++++++++-------- | ||
115 | hw/arm/virt.c | 111 ++++++++++++++++---- | ||
116 | hw/arm/xlnx-zcu102.c | 4 +- | ||
117 | hw/core/ptimer.c | 34 +++++++ | ||
118 | hw/gpio/gpio_pwr.c | 70 +++++++++++++ | ||
119 | hw/misc/npcm7xx_pwm.c | 23 ++++- | ||
120 | hw/misc/pvpanic-isa.c | 94 +++++++++++++++++ | ||
121 | hw/misc/pvpanic-pci.c | 94 +++++++++++++++++ | ||
122 | hw/misc/pvpanic.c | 85 ++-------------- | ||
123 | hw/timer/cmsdk-apb-dualtimer.c | 53 +++++++--- | ||
124 | hw/timer/cmsdk-apb-timer.c | 55 +++++----- | ||
125 | hw/watchdog/cmsdk-apb-watchdog.c | 29 ++++-- | ||
126 | target/arm/helper.c | 27 +++-- | ||
127 | target/arm/kvm64.c | 2 + | ||
128 | tests/qtest/cmsdk-apb-dualtimer-test.c | 130 +++++++++++++++++++++++ | ||
129 | tests/qtest/cmsdk-apb-timer-test.c | 75 ++++++++++++++ | ||
130 | tests/qtest/cmsdk-apb-watchdog-test.c | 131 ++++++++++++++++++++++++ | ||
131 | tests/qtest/npcm7xx_pwm-test.c | 4 +- | ||
132 | tests/qtest/pvpanic-pci-test.c | 94 +++++++++++++++++ | ||
133 | tests/qtest/xlnx-can-test.c | 30 +++--- | ||
134 | MAINTAINERS | 3 + | ||
135 | accel/hvf/entitlements.plist | 8 ++ | ||
136 | hw/arm/Kconfig | 1 + | ||
137 | hw/gpio/Kconfig | 3 + | ||
138 | hw/gpio/meson.build | 1 + | ||
139 | hw/i386/Kconfig | 2 +- | ||
140 | hw/misc/Kconfig | 12 ++- | ||
141 | hw/misc/meson.build | 4 +- | ||
142 | scripts/entitlement.sh | 13 +++ | ||
143 | tests/qtest/meson.build | 6 +- | ||
144 | 52 files changed, 1432 insertions(+), 319 deletions(-) | ||
145 | create mode 100644 hw/gpio/gpio_pwr.c | ||
146 | create mode 100644 hw/misc/pvpanic-isa.c | ||
147 | create mode 100644 hw/misc/pvpanic-pci.c | ||
148 | create mode 100644 tests/qtest/cmsdk-apb-dualtimer-test.c | ||
149 | create mode 100644 tests/qtest/cmsdk-apb-timer-test.c | ||
150 | create mode 100644 tests/qtest/cmsdk-apb-watchdog-test.c | ||
151 | create mode 100644 tests/qtest/pvpanic-pci-test.c | ||
152 | create mode 100644 accel/hvf/entitlements.plist | ||
153 | create mode 100755 scripts/entitlement.sh | ||
154 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Gavin Shan <gshan@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | No functional change. Just refactor code to better | 3 | This uses TYPE_PL011 when creating the serial port so that the code |
4 | support secure and normal world gpios. | 4 | looks cleaner. |
5 | 5 | ||
6 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 6 | Signed-off-by: Gavin Shan <gshan@redhat.com> |
7 | Reviewed-by: Andrew Jones <drjones@redhat.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20200224222223.4128-1-gshan@redhat.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | hw/arm/virt.c | 57 ++++++++++++++++++++++++++++++++------------------- | 12 | hw/arm/sbsa-ref.c | 3 ++- |
11 | 1 file changed, 36 insertions(+), 21 deletions(-) | 13 | hw/arm/virt.c | 3 ++- |
14 | hw/arm/xlnx-versal.c | 3 ++- | ||
15 | 3 files changed, 6 insertions(+), 3 deletions(-) | ||
12 | 16 | ||
17 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/sbsa-ref.c | ||
20 | +++ b/hw/arm/sbsa-ref.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #include "hw/pci-host/gpex.h" | ||
23 | #include "hw/qdev-properties.h" | ||
24 | #include "hw/usb.h" | ||
25 | +#include "hw/char/pl011.h" | ||
26 | #include "net/net.h" | ||
27 | |||
28 | #define RAMLIMIT_GB 8192 | ||
29 | @@ -XXX,XX +XXX,XX @@ static void create_uart(const SBSAMachineState *sms, int uart, | ||
30 | { | ||
31 | hwaddr base = sbsa_ref_memmap[uart].base; | ||
32 | int irq = sbsa_ref_irqmap[uart]; | ||
33 | - DeviceState *dev = qdev_create(NULL, "pl011"); | ||
34 | + DeviceState *dev = qdev_create(NULL, TYPE_PL011); | ||
35 | SysBusDevice *s = SYS_BUS_DEVICE(dev); | ||
36 | |||
37 | qdev_prop_set_chr(dev, "chardev", chr); | ||
13 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 38 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
14 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/virt.c | 40 | --- a/hw/arm/virt.c |
16 | +++ b/hw/arm/virt.c | 41 | +++ b/hw/arm/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ static void virt_powerdown_req(Notifier *n, void *opaque) | 42 | @@ -XXX,XX +XXX,XX @@ |
18 | } | 43 | #include "hw/mem/nvdimm.h" |
19 | } | 44 | #include "hw/acpi/generic_event_device.h" |
20 | 45 | #include "hw/virtio/virtio-iommu.h" | |
21 | -static void create_gpio(const VirtMachineState *vms) | 46 | +#include "hw/char/pl011.h" |
22 | +static void create_gpio_keys(const VirtMachineState *vms, | 47 | |
23 | + DeviceState *pl061_dev, | 48 | #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ |
24 | + uint32_t phandle) | 49 | static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ |
25 | +{ | 50 | @@ -XXX,XX +XXX,XX @@ static void create_uart(const VirtMachineState *vms, int uart, |
26 | + gpio_key_dev = sysbus_create_simple("gpio-key", -1, | 51 | int irq = vms->irqmap[uart]; |
27 | + qdev_get_gpio_in(pl061_dev, 3)); | 52 | const char compat[] = "arm,pl011\0arm,primecell"; |
28 | + | 53 | const char clocknames[] = "uartclk\0apb_pclk"; |
29 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); | 54 | - DeviceState *dev = qdev_create(NULL, "pl011"); |
30 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-keys"); | 55 | + DeviceState *dev = qdev_create(NULL, TYPE_PL011); |
31 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); | 56 | SysBusDevice *s = SYS_BUS_DEVICE(dev); |
32 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); | 57 | |
33 | + | 58 | qdev_prop_set_chr(dev, "chardev", chr); |
34 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); | 59 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c |
35 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", | 60 | index XXXXXXX..XXXXXXX 100644 |
36 | + "label", "GPIO Key Poweroff"); | 61 | --- a/hw/arm/xlnx-versal.c |
37 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", | 62 | +++ b/hw/arm/xlnx-versal.c |
38 | + KEY_POWER); | 63 | @@ -XXX,XX +XXX,XX @@ |
39 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", | 64 | #include "hw/misc/unimp.h" |
40 | + "gpios", phandle, 3, 0); | 65 | #include "hw/intc/arm_gicv3_common.h" |
41 | +} | 66 | #include "hw/arm/xlnx-versal.h" |
42 | + | 67 | +#include "hw/char/pl011.h" |
43 | +static void create_gpio_devices(const VirtMachineState *vms, int gpio, | 68 | |
44 | + MemoryRegion *mem) | 69 | #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") |
45 | { | 70 | #define GEM_REVISION 0x40070106 |
46 | char *nodename; | 71 | @@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic) |
47 | DeviceState *pl061_dev; | 72 | DeviceState *dev; |
48 | - hwaddr base = vms->memmap[VIRT_GPIO].base; | 73 | MemoryRegion *mr; |
49 | - hwaddr size = vms->memmap[VIRT_GPIO].size; | 74 | |
50 | - int irq = vms->irqmap[VIRT_GPIO]; | 75 | - dev = qdev_create(NULL, "pl011"); |
51 | + hwaddr base = vms->memmap[gpio].base; | 76 | + dev = qdev_create(NULL, TYPE_PL011); |
52 | + hwaddr size = vms->memmap[gpio].size; | 77 | s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev); |
53 | + int irq = vms->irqmap[gpio]; | 78 | qdev_prop_set_chr(dev, "chardev", serial_hd(i)); |
54 | const char compat[] = "arm,pl061\0arm,primecell"; | 79 | object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); |
55 | + SysBusDevice *s; | ||
56 | |||
57 | - pl061_dev = sysbus_create_simple("pl061", base, | ||
58 | - qdev_get_gpio_in(vms->gic, irq)); | ||
59 | + pl061_dev = qdev_new("pl061"); | ||
60 | + s = SYS_BUS_DEVICE(pl061_dev); | ||
61 | + sysbus_realize_and_unref(s, &error_fatal); | ||
62 | + memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); | ||
63 | + sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq)); | ||
64 | |||
65 | uint32_t phandle = qemu_fdt_alloc_phandle(vms->fdt); | ||
66 | nodename = g_strdup_printf("/pl061@%" PRIx64, base); | ||
67 | @@ -XXX,XX +XXX,XX @@ static void create_gpio(const VirtMachineState *vms) | ||
68 | qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); | ||
69 | qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); | ||
70 | |||
71 | - gpio_key_dev = sysbus_create_simple("gpio-key", -1, | ||
72 | - qdev_get_gpio_in(pl061_dev, 3)); | ||
73 | - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); | ||
74 | - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-keys"); | ||
75 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); | ||
76 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); | ||
77 | - | ||
78 | - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); | ||
79 | - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", | ||
80 | - "label", "GPIO Key Poweroff"); | ||
81 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", | ||
82 | - KEY_POWER); | ||
83 | - qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", | ||
84 | - "gpios", phandle, 3, 0); | ||
85 | g_free(nodename); | ||
86 | + | ||
87 | + /* Child gpio devices */ | ||
88 | + create_gpio_keys(vms, pl061_dev, phandle); | ||
89 | } | ||
90 | |||
91 | static void create_virtio_devices(const VirtMachineState *vms) | ||
92 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
93 | if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) { | ||
94 | vms->acpi_dev = create_acpi_ged(vms); | ||
95 | } else { | ||
96 | - create_gpio(vms); | ||
97 | + create_gpio_devices(vms, VIRT_GPIO, sysmem); | ||
98 | } | ||
99 | |||
100 | /* connect powerdown request */ | ||
101 | -- | 80 | -- |
102 | 2.20.1 | 81 | 2.20.1 |
103 | 82 | ||
104 | 83 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add pvpanic PCI device support details in docs/specs/pvpanic.txt. | 3 | We had set this for aarch32-only in arm_max_initfn, but |
4 | failed to set the same bit for aarch64. | ||
4 | 5 | ||
5 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20200218190958.745-2-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 10 | --- |
9 | docs/specs/pvpanic.txt | 13 ++++++++++++- | 11 | target/arm/cpu64.c | 1 + |
10 | 1 file changed, 12 insertions(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+) |
11 | 13 | ||
12 | diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.txt | 14 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/docs/specs/pvpanic.txt | 16 | --- a/target/arm/cpu64.c |
15 | +++ b/docs/specs/pvpanic.txt | 17 | +++ b/target/arm/cpu64.c |
16 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
17 | PVPANIC DEVICE | 19 | cpu->isar.id_mmfr3 = u; |
18 | ============== | 20 | |
19 | 21 | u = cpu->isar.id_mmfr4; | |
20 | -pvpanic device is a simulated ISA device, through which a guest panic | 22 | + u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ |
21 | +pvpanic device is a simulated device, through which a guest panic | 23 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ |
22 | event is sent to qemu, and a QMP event is generated. This allows | 24 | cpu->isar.id_mmfr4 = u; |
23 | management apps (e.g. libvirt) to be notified and respond to the event. | ||
24 | |||
25 | @@ -XXX,XX +XXX,XX @@ The management app has the option of waiting for GUEST_PANICKED events, | ||
26 | and/or polling for guest-panicked RunState, to learn when the pvpanic | ||
27 | device has fired a panic event. | ||
28 | |||
29 | +The pvpanic device can be implemented as an ISA device (using IOPORT) or as a | ||
30 | +PCI device. | ||
31 | + | ||
32 | ISA Interface | ||
33 | ------------- | ||
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ bit 1: a guest panic has happened and will be handled by the guest; | ||
36 | the host should record it or report it, but should not affect | ||
37 | the execution of the guest. | ||
38 | |||
39 | +PCI Interface | ||
40 | +------------- | ||
41 | + | ||
42 | +The PCI interface is similar to the ISA interface except that it uses an MMIO | ||
43 | +address space provided by its BAR0, 1 byte long. Any machine with a PCI bus | ||
44 | +can enable a pvpanic device by adding '-device pvpanic-pci' to the command | ||
45 | +line. | ||
46 | + | ||
47 | ACPI Interface | ||
48 | -------------- | ||
49 | 25 | ||
50 | -- | 26 | -- |
51 | 2.20.1 | 27 | 2.20.1 |
52 | 28 | ||
53 | 29 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Add secure pl061 for reset/power down machine from | 3 | The Linux kernel displays errors why trying to detect the PL041 |
4 | the secure world (Arm Trusted Firmware). Connect it | 4 | audio interface: |
5 | with gpio-pwr driver. | ||
6 | 5 | ||
7 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 6 | Linux version 4.16.0 (linus@genomnajs) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #142 PREEMPT Wed May 9 13:24:55 CEST 2018 |
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | 7 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177 |
9 | [PMM: Added mention of the new device to the documentation] | 8 | CPU: VIVT data cache, VIVT instruction cache |
9 | OF: fdt: Machine model: ARM Integrator/CP | ||
10 | ... | ||
11 | OF: amba_device_add() failed (-19) for /fpga/aaci@1d000000 | ||
12 | |||
13 | Since we have it already modelled, simply plug it. | ||
14 | |||
15 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20200223233033.15371-2-f4bug@amsat.org | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 19 | --- |
12 | docs/system/arm/virt.rst | 2 ++ | 20 | hw/arm/integratorcp.c | 1 + |
13 | include/hw/arm/virt.h | 2 ++ | 21 | hw/arm/Kconfig | 1 + |
14 | hw/arm/virt.c | 56 +++++++++++++++++++++++++++++++++++++++- | 22 | 2 files changed, 2 insertions(+) |
15 | hw/arm/Kconfig | 1 + | ||
16 | 4 files changed, 60 insertions(+), 1 deletion(-) | ||
17 | 23 | ||
18 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst | 24 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c |
19 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/docs/system/arm/virt.rst | 26 | --- a/hw/arm/integratorcp.c |
21 | +++ b/docs/system/arm/virt.rst | 27 | +++ b/hw/arm/integratorcp.c |
22 | @@ -XXX,XX +XXX,XX @@ The virt board supports: | 28 | @@ -XXX,XX +XXX,XX @@ static void integratorcp_init(MachineState *machine) |
23 | - Secure-World-only devices if the CPU has TrustZone: | 29 | qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_WPROT, 0)); |
24 | 30 | qdev_connect_gpio_out(dev, 1, | |
25 | - A second PL011 UART | 31 | qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_CARDIN, 0)); |
26 | + - A second PL061 GPIO controller, with GPIO lines for triggering | 32 | + sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL); |
27 | + a system reset or system poweroff | 33 | |
28 | - A secure flash memory | 34 | if (nd_table[0].used) |
29 | - 16MB of secure RAM | 35 | smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); |
30 | |||
31 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/include/hw/arm/virt.h | ||
34 | +++ b/include/hw/arm/virt.h | ||
35 | @@ -XXX,XX +XXX,XX @@ enum { | ||
36 | VIRT_GPIO, | ||
37 | VIRT_SECURE_UART, | ||
38 | VIRT_SECURE_MEM, | ||
39 | + VIRT_SECURE_GPIO, | ||
40 | VIRT_PCDIMM_ACPI, | ||
41 | VIRT_ACPI_GED, | ||
42 | VIRT_NVDIMM_ACPI, | ||
43 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineClass { | ||
44 | bool kvm_no_adjvtime; | ||
45 | bool no_kvm_steal_time; | ||
46 | bool acpi_expose_flash; | ||
47 | + bool no_secure_gpio; | ||
48 | }; | ||
49 | |||
50 | struct VirtMachineState { | ||
51 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/arm/virt.c | ||
54 | +++ b/hw/arm/virt.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry base_memmap[] = { | ||
56 | [VIRT_ACPI_GED] = { 0x09080000, ACPI_GED_EVT_SEL_LEN }, | ||
57 | [VIRT_NVDIMM_ACPI] = { 0x09090000, NVDIMM_ACPI_IO_LEN}, | ||
58 | [VIRT_PVTIME] = { 0x090a0000, 0x00010000 }, | ||
59 | + [VIRT_SECURE_GPIO] = { 0x090b0000, 0x00001000 }, | ||
60 | [VIRT_MMIO] = { 0x0a000000, 0x00000200 }, | ||
61 | /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ | ||
62 | [VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 }, | ||
63 | @@ -XXX,XX +XXX,XX @@ static void create_gpio_keys(const VirtMachineState *vms, | ||
64 | "gpios", phandle, 3, 0); | ||
65 | } | ||
66 | |||
67 | +#define SECURE_GPIO_POWEROFF 0 | ||
68 | +#define SECURE_GPIO_RESET 1 | ||
69 | + | ||
70 | +static void create_secure_gpio_pwr(const VirtMachineState *vms, | ||
71 | + DeviceState *pl061_dev, | ||
72 | + uint32_t phandle) | ||
73 | +{ | ||
74 | + DeviceState *gpio_pwr_dev; | ||
75 | + | ||
76 | + /* gpio-pwr */ | ||
77 | + gpio_pwr_dev = sysbus_create_simple("gpio-pwr", -1, NULL); | ||
78 | + | ||
79 | + /* connect secure pl061 to gpio-pwr */ | ||
80 | + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_RESET, | ||
81 | + qdev_get_gpio_in_named(gpio_pwr_dev, "reset", 0)); | ||
82 | + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_POWEROFF, | ||
83 | + qdev_get_gpio_in_named(gpio_pwr_dev, "shutdown", 0)); | ||
84 | + | ||
85 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-poweroff"); | ||
86 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "compatible", | ||
87 | + "gpio-poweroff"); | ||
88 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-poweroff", | ||
89 | + "gpios", phandle, SECURE_GPIO_POWEROFF, 0); | ||
90 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "status", "disabled"); | ||
91 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "secure-status", | ||
92 | + "okay"); | ||
93 | + | ||
94 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-restart"); | ||
95 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "compatible", | ||
96 | + "gpio-restart"); | ||
97 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-restart", | ||
98 | + "gpios", phandle, SECURE_GPIO_RESET, 0); | ||
99 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "status", "disabled"); | ||
100 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "secure-status", | ||
101 | + "okay"); | ||
102 | +} | ||
103 | + | ||
104 | static void create_gpio_devices(const VirtMachineState *vms, int gpio, | ||
105 | MemoryRegion *mem) | ||
106 | { | ||
107 | @@ -XXX,XX +XXX,XX @@ static void create_gpio_devices(const VirtMachineState *vms, int gpio, | ||
108 | qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); | ||
109 | qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); | ||
110 | |||
111 | + if (gpio != VIRT_GPIO) { | ||
112 | + /* Mark as not usable by the normal world */ | ||
113 | + qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); | ||
114 | + qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay"); | ||
115 | + } | ||
116 | g_free(nodename); | ||
117 | |||
118 | /* Child gpio devices */ | ||
119 | - create_gpio_keys(vms, pl061_dev, phandle); | ||
120 | + if (gpio == VIRT_GPIO) { | ||
121 | + create_gpio_keys(vms, pl061_dev, phandle); | ||
122 | + } else { | ||
123 | + create_secure_gpio_pwr(vms, pl061_dev, phandle); | ||
124 | + } | ||
125 | } | ||
126 | |||
127 | static void create_virtio_devices(const VirtMachineState *vms) | ||
128 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
129 | create_gpio_devices(vms, VIRT_GPIO, sysmem); | ||
130 | } | ||
131 | |||
132 | + if (vms->secure && !vmc->no_secure_gpio) { | ||
133 | + create_gpio_devices(vms, VIRT_SECURE_GPIO, secure_sysmem); | ||
134 | + } | ||
135 | + | ||
136 | /* connect powerdown request */ | ||
137 | vms->powerdown_notifier.notify = virt_powerdown_req; | ||
138 | qemu_register_powerdown_notifier(&vms->powerdown_notifier); | ||
139 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 0) | ||
140 | |||
141 | static void virt_machine_5_2_options(MachineClass *mc) | ||
142 | { | ||
143 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
144 | + | ||
145 | virt_machine_6_0_options(mc); | ||
146 | compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); | ||
147 | + vmc->no_secure_gpio = true; | ||
148 | } | ||
149 | DEFINE_VIRT_MACHINE(5, 2) | ||
150 | |||
151 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 36 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
152 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
153 | --- a/hw/arm/Kconfig | 38 | --- a/hw/arm/Kconfig |
154 | +++ b/hw/arm/Kconfig | 39 | +++ b/hw/arm/Kconfig |
155 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | 40 | @@ -XXX,XX +XXX,XX @@ config INTEGRATOR |
41 | select INTEGRATOR_DEBUG | ||
156 | select PL011 # UART | 42 | select PL011 # UART |
157 | select PL031 # RTC | 43 | select PL031 # RTC |
158 | select PL061 # GPIO | 44 | + select PL041 # audio |
159 | + select GPIO_PWR | 45 | select PL050 # keyboard/mouse |
160 | select PLATFORM_BUS | 46 | select PL110 # pl111 LCD controller |
161 | select SMBIOS | 47 | select PL181 # display |
162 | select VIRTIO_MMIO | ||
163 | -- | 48 | -- |
164 | 2.20.1 | 49 | 2.20.1 |
165 | 50 | ||
166 | 51 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB timer device over to using its Clock input; the | 1 | From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> |
---|---|---|---|
2 | pclk-frq property is now ignored. | ||
3 | 2 | ||
3 | The GICv2 allows the implementation to implement a variable number | ||
4 | of priority bits; unimplemented bits in the priority registers | ||
5 | are read as zeros, writes ignored. We were previously always | ||
6 | implementing a full 8 bits of priority, which is allowed but not | ||
7 | what the real hardware typically does (which is usually to have | ||
8 | 4 or 5 bits of priority). | ||
9 | |||
10 | Add a new device property to allow the number of implemented | ||
11 | property bits to be specified. | ||
12 | |||
13 | Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> | ||
14 | Message-id: 1582537164-764-2-git-send-email-sai.pavan.boddu@xilinx.com | ||
15 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | [PMM: improved commit message] | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-19-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-19-peter.maydell@linaro.org | ||
10 | --- | 19 | --- |
11 | hw/timer/cmsdk-apb-timer.c | 18 ++++++++++++++---- | 20 | include/hw/intc/arm_gic.h | 2 ++ |
12 | 1 file changed, 14 insertions(+), 4 deletions(-) | 21 | include/hw/intc/arm_gic_common.h | 1 + |
22 | hw/intc/arm_gic.c | 33 ++++++++++++++++++++++++++++++-- | ||
23 | hw/intc/arm_gic_common.c | 1 + | ||
24 | 4 files changed, 35 insertions(+), 2 deletions(-) | ||
13 | 25 | ||
14 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | 26 | diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h |
15 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/timer/cmsdk-apb-timer.c | 28 | --- a/include/hw/intc/arm_gic.h |
17 | +++ b/hw/timer/cmsdk-apb-timer.c | 29 | +++ b/include/hw/intc/arm_gic.h |
18 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_reset(DeviceState *dev) | 30 | @@ -XXX,XX +XXX,XX @@ |
19 | ptimer_transaction_commit(s->timer); | 31 | |
32 | /* Number of SGI target-list bits */ | ||
33 | #define GIC_TARGETLIST_BITS 8 | ||
34 | +#define GIC_MAX_PRIORITY_BITS 8 | ||
35 | +#define GIC_MIN_PRIORITY_BITS 4 | ||
36 | |||
37 | #define TYPE_ARM_GIC "arm_gic" | ||
38 | #define ARM_GIC(obj) \ | ||
39 | diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/include/hw/intc/arm_gic_common.h | ||
42 | +++ b/include/hw/intc/arm_gic_common.h | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct GICState { | ||
44 | uint16_t priority_mask[GIC_NCPU_VCPU]; | ||
45 | uint16_t running_priority[GIC_NCPU_VCPU]; | ||
46 | uint16_t current_pending[GIC_NCPU_VCPU]; | ||
47 | + uint32_t n_prio_bits; | ||
48 | |||
49 | /* If we present the GICv2 without security extensions to a guest, | ||
50 | * the guest can configure the GICC_CTLR to configure group 1 binary point | ||
51 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/intc/arm_gic.c | ||
54 | +++ b/hw/intc/arm_gic.c | ||
55 | @@ -XXX,XX +XXX,XX @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu, MemTxAttrs attrs) | ||
56 | return ret; | ||
20 | } | 57 | } |
21 | 58 | ||
22 | +static void cmsdk_apb_timer_clk_update(void *opaque) | 59 | +static uint32_t gic_fullprio_mask(GICState *s, int cpu) |
23 | +{ | 60 | +{ |
24 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | 61 | + /* |
62 | + * Return a mask word which clears the unimplemented priority | ||
63 | + * bits from a priority value for an interrupt. (Not to be | ||
64 | + * confused with the group priority, whose mask depends on BPR.) | ||
65 | + */ | ||
66 | + int priBits; | ||
25 | + | 67 | + |
26 | + ptimer_transaction_begin(s->timer); | 68 | + if (gic_is_vcpu(cpu)) { |
27 | + ptimer_set_period_from_clock(s->timer, s->pclk, 1); | 69 | + priBits = GIC_VIRT_MAX_GROUP_PRIO_BITS; |
28 | + ptimer_transaction_commit(s->timer); | 70 | + } else { |
71 | + priBits = s->n_prio_bits; | ||
72 | + } | ||
73 | + return ~0U << (8 - priBits); | ||
29 | +} | 74 | +} |
30 | + | 75 | + |
31 | static void cmsdk_apb_timer_init(Object *obj) | 76 | void gic_dist_set_priority(GICState *s, int cpu, int irq, uint8_t val, |
77 | MemTxAttrs attrs) | ||
32 | { | 78 | { |
33 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 79 | @@ -XXX,XX +XXX,XX @@ void gic_dist_set_priority(GICState *s, int cpu, int irq, uint8_t val, |
34 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | 80 | val = 0x80 | (val >> 1); /* Non-secure view */ |
35 | s, "cmsdk-apb-timer", 0x1000); | 81 | } |
36 | sysbus_init_mmio(sbd, &s->iomem); | 82 | |
37 | sysbus_init_irq(sbd, &s->timerint); | 83 | + val &= gic_fullprio_mask(s, cpu); |
38 | - s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); | 84 | + |
39 | + s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", | 85 | if (irq < GIC_INTERNAL) { |
40 | + cmsdk_apb_timer_clk_update, s); | 86 | s->priority1[irq][cpu] = val; |
87 | } else { | ||
88 | @@ -XXX,XX +XXX,XX @@ static uint32_t gic_dist_get_priority(GICState *s, int cpu, int irq, | ||
89 | } | ||
90 | prio = (prio << 1) & 0xff; /* Non-secure view */ | ||
91 | } | ||
92 | - return prio; | ||
93 | + return prio & gic_fullprio_mask(s, cpu); | ||
41 | } | 94 | } |
42 | 95 | ||
43 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 96 | static void gic_set_priority_mask(GICState *s, int cpu, uint8_t pmask, |
44 | { | 97 | @@ -XXX,XX +XXX,XX @@ static void gic_set_priority_mask(GICState *s, int cpu, uint8_t pmask, |
45 | CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | 98 | return; |
46 | 99 | } | |
47 | - if (s->pclk_frq == 0) { | 100 | } |
48 | - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | 101 | - s->priority_mask[cpu] = pmask; |
49 | + if (!clock_has_source(s->pclk)) { | 102 | + s->priority_mask[cpu] = pmask & gic_fullprio_mask(s, cpu); |
50 | + error_setg(errp, "CMSDK APB timer: pclk clock must be connected"); | 103 | } |
104 | |||
105 | static uint32_t gic_get_priority_mask(GICState *s, int cpu, MemTxAttrs attrs) | ||
106 | @@ -XXX,XX +XXX,XX @@ static void arm_gic_realize(DeviceState *dev, Error **errp) | ||
51 | return; | 107 | return; |
52 | } | 108 | } |
53 | 109 | ||
54 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 110 | + if (s->n_prio_bits > GIC_MAX_PRIORITY_BITS || |
55 | PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); | 111 | + (s->virt_extn ? s->n_prio_bits < GIC_VIRT_MAX_GROUP_PRIO_BITS : |
56 | 112 | + s->n_prio_bits < GIC_MIN_PRIORITY_BITS)) { | |
57 | ptimer_transaction_begin(s->timer); | 113 | + error_setg(errp, "num-priority-bits cannot be greater than %d" |
58 | - ptimer_set_freq(s->timer, s->pclk_frq); | 114 | + " or less than %d", GIC_MAX_PRIORITY_BITS, |
59 | + ptimer_set_period_from_clock(s->timer, s->pclk, 1); | 115 | + s->virt_extn ? GIC_VIRT_MAX_GROUP_PRIO_BITS : |
60 | ptimer_transaction_commit(s->timer); | 116 | + GIC_MIN_PRIORITY_BITS); |
61 | } | 117 | + return; |
118 | + } | ||
119 | + | ||
120 | /* This creates distributor, main CPU interface (s->cpuiomem[0]) and if | ||
121 | * enabled, virtualization extensions related interfaces (main virtual | ||
122 | * interface (s->vifaceiomem[0]) and virtual CPU interface). | ||
123 | diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c | ||
124 | index XXXXXXX..XXXXXXX 100644 | ||
125 | --- a/hw/intc/arm_gic_common.c | ||
126 | +++ b/hw/intc/arm_gic_common.c | ||
127 | @@ -XXX,XX +XXX,XX @@ static Property arm_gic_common_properties[] = { | ||
128 | DEFINE_PROP_BOOL("has-security-extensions", GICState, security_extn, 0), | ||
129 | /* True if the GIC should implement the virtualization extensions */ | ||
130 | DEFINE_PROP_BOOL("has-virtualization-extensions", GICState, virt_extn, 0), | ||
131 | + DEFINE_PROP_UINT32("num-priority-bits", GICState, n_prio_bits, 8), | ||
132 | DEFINE_PROP_END_OF_LIST(), | ||
133 | }; | ||
62 | 134 | ||
63 | -- | 135 | -- |
64 | 2.20.1 | 136 | 2.20.1 |
65 | 137 | ||
66 | 138 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> |
---|---|---|---|
2 | 2 | ||
3 | Build without error on hosts without a working system(). If system() | 3 | All A9 CPUs have a GIC with 5 bits of priority. |
4 | is called, return -1 with ENOSYS. | ||
5 | 4 | ||
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 5 | Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> |
7 | Message-id: 20210126012457.39046-6-j@getutm.app | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Message-id: 1582537164-764-3-git-send-email-sai.pavan.boddu@xilinx.com | ||
8 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | meson.build | 1 + | 12 | hw/cpu/a9mpcore.c | 4 ++++ |
12 | include/qemu/osdep.h | 12 ++++++++++++ | 13 | 1 file changed, 4 insertions(+) |
13 | 2 files changed, 13 insertions(+) | ||
14 | 14 | ||
15 | diff --git a/meson.build b/meson.build | 15 | diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/meson.build | 17 | --- a/hw/cpu/a9mpcore.c |
18 | +++ b/meson.build | 18 | +++ b/hw/cpu/a9mpcore.c |
19 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) | 19 | @@ -XXX,XX +XXX,XX @@ |
20 | config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) | 20 | #include "hw/qdev-properties.h" |
21 | config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) | 21 | #include "hw/core/cpu.h" |
22 | config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) | 22 | |
23 | +config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>')) | 23 | +#define A9_GIC_NUM_PRIORITY_BITS 5 |
24 | |||
25 | config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | ||
26 | |||
27 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/include/qemu/osdep.h | ||
30 | +++ b/include/qemu/osdep.h | ||
31 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_thread_jit_write(void) {} | ||
32 | static inline void qemu_thread_jit_execute(void) {} | ||
33 | #endif | ||
34 | |||
35 | +/** | ||
36 | + * Platforms which do not support system() return ENOSYS | ||
37 | + */ | ||
38 | +#ifndef HAVE_SYSTEM_FUNCTION | ||
39 | +#define system platform_does_not_support_system | ||
40 | +static inline int platform_does_not_support_system(const char *command) | ||
41 | +{ | ||
42 | + errno = ENOSYS; | ||
43 | + return -1; | ||
44 | +} | ||
45 | +#endif /* !HAVE_SYSTEM_FUNCTION */ | ||
46 | + | 24 | + |
47 | #endif | 25 | static void a9mp_priv_set_irq(void *opaque, int irq, int level) |
26 | { | ||
27 | A9MPPrivState *s = (A9MPPrivState *)opaque; | ||
28 | @@ -XXX,XX +XXX,XX @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) | ||
29 | gicdev = DEVICE(&s->gic); | ||
30 | qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu); | ||
31 | qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq); | ||
32 | + qdev_prop_set_uint32(gicdev, "num-priority-bits", | ||
33 | + A9_GIC_NUM_PRIORITY_BITS); | ||
34 | |||
35 | /* Make the GIC's TZ support match the CPUs. We assume that | ||
36 | * either all the CPUs have TZ, or none do. | ||
48 | -- | 37 | -- |
49 | 2.20.1 | 38 | 2.20.1 |
50 | 39 | ||
51 | 40 | diff view generated by jsdifflib |
1 | As the first step in converting the CMSDK_APB_TIMER device to the | 1 | From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> |
---|---|---|---|
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the | ||
4 | wdogclk-frq property to using the Clock once all the users of this | ||
5 | device have been converted to wire up the Clock. | ||
6 | 2 | ||
7 | This is a migration compatibility break for machines mps2-an385, | 3 | The GIC built into the ARM11MPCore is always implemented with 4 |
8 | mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, | 4 | priority bits; set the GIC property accordingly. |
9 | musca-b1, lm3s811evb, lm3s6965evb. | ||
10 | 5 | ||
6 | Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 1582537164-764-4-git-send-email-sai.pavan.boddu@xilinx.com | ||
9 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | [PMM: tweaked commit message] | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20210128114145.20536-10-peter.maydell@linaro.org | ||
16 | Message-id: 20210121190622.22000-10-peter.maydell@linaro.org | ||
17 | --- | 13 | --- |
18 | include/hw/watchdog/cmsdk-apb-watchdog.h | 3 +++ | 14 | hw/cpu/arm11mpcore.c | 5 +++++ |
19 | hw/watchdog/cmsdk-apb-watchdog.c | 7 +++++-- | 15 | 1 file changed, 5 insertions(+) |
20 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
21 | 16 | ||
22 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | 17 | diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c |
23 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/watchdog/cmsdk-apb-watchdog.h | 19 | --- a/hw/cpu/arm11mpcore.c |
25 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | 20 | +++ b/hw/cpu/arm11mpcore.c |
26 | @@ -XXX,XX +XXX,XX @@ | ||
27 | * | ||
28 | * QEMU interface: | ||
29 | * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked | ||
30 | + * + Clock input "WDOGCLK": clock for the watchdog's timer | ||
31 | * + sysbus MMIO region 0: the register bank | ||
32 | * + sysbus IRQ 0: watchdog interrupt | ||
33 | * | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | |||
36 | #include "hw/sysbus.h" | ||
37 | #include "hw/ptimer.h" | ||
38 | +#include "hw/clock.h" | ||
39 | #include "qom/object.h" | ||
40 | |||
41 | #define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog" | ||
42 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBWatchdog { | ||
43 | uint32_t wdogclk_frq; | ||
44 | bool is_luminary; | ||
45 | struct ptimer_state *timer; | ||
46 | + Clock *wdogclk; | ||
47 | |||
48 | uint32_t control; | ||
49 | uint32_t intstatus; | ||
50 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | ||
53 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
55 | #include "hw/irq.h" | 22 | #include "hw/irq.h" |
56 | #include "hw/qdev-properties.h" | 23 | #include "hw/qdev-properties.h" |
57 | #include "hw/registerfields.h" | 24 | |
58 | +#include "hw/qdev-clock.h" | 25 | +#define ARM11MPCORE_NUM_GIC_PRIORITY_BITS 4 |
59 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | 26 | |
60 | #include "migration/vmstate.h" | 27 | static void mpcore_priv_set_irq(void *opaque, int irq, int level) |
61 | 28 | { | |
62 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_init(Object *obj) | 29 | @@ -XXX,XX +XXX,XX @@ static void mpcore_priv_realize(DeviceState *dev, Error **errp) |
63 | s, "cmsdk-apb-watchdog", 0x1000); | 30 | |
64 | sysbus_init_mmio(sbd, &s->iomem); | 31 | qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu); |
65 | sysbus_init_irq(sbd, &s->wdogint); | 32 | qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq); |
66 | + s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); | 33 | + qdev_prop_set_uint32(gicdev, "num-priority-bits", |
67 | 34 | + ARM11MPCORE_NUM_GIC_PRIORITY_BITS); | |
68 | s->is_luminary = false; | 35 | + |
69 | s->id = cmsdk_apb_watchdog_id; | 36 | + |
70 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | 37 | object_property_set_bool(OBJECT(&s->gic), true, "realized", &err); |
71 | 38 | if (err != NULL) { | |
72 | static const VMStateDescription cmsdk_apb_watchdog_vmstate = { | 39 | error_propagate(errp, err); |
73 | .name = "cmsdk-apb-watchdog", | ||
74 | - .version_id = 1, | ||
75 | - .minimum_version_id = 1, | ||
76 | + .version_id = 2, | ||
77 | + .minimum_version_id = 2, | ||
78 | .fields = (VMStateField[]) { | ||
79 | + VMSTATE_CLOCK(wdogclk, CMSDKAPBWatchdog), | ||
80 | VMSTATE_PTIMER(timer, CMSDKAPBWatchdog), | ||
81 | VMSTATE_UINT32(control, CMSDKAPBWatchdog), | ||
82 | VMSTATE_UINT32(intstatus, CMSDKAPBWatchdog), | ||
83 | -- | 40 | -- |
84 | 2.20.1 | 41 | 2.20.1 |
85 | 42 | ||
86 | 43 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Only define the register if it exists for the cpu. | 3 | Use this in the places that were checking ARM_FEATURE_VFP, and |
4 | are obviously testing for the existance of the register set | ||
5 | as opposed to testing for some particular instruction extension. | ||
4 | 6 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210120031656.737646-1-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20200224222232.13807-2-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | target/arm/helper.c | 21 +++++++++++++++------ | 12 | target/arm/cpu.h | 9 +++++++++ |
11 | 1 file changed, 15 insertions(+), 6 deletions(-) | 13 | hw/intc/armv7m_nvic.c | 20 ++++++++++---------- |
12 | 14 | linux-user/arm/signal.c | 4 ++-- | |
15 | target/arm/arch_dump.c | 11 ++++++----- | ||
16 | target/arm/cpu.c | 4 ++-- | ||
17 | target/arm/helper.c | 4 ++-- | ||
18 | target/arm/m_helper.c | 11 ++++++----- | ||
19 | 7 files changed, 37 insertions(+), 26 deletions(-) | ||
20 | |||
21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/cpu.h | ||
24 | +++ b/target/arm/cpu.h | ||
25 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
26 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; | ||
27 | } | ||
28 | |||
29 | +static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id) | ||
30 | +{ | ||
31 | + /* | ||
32 | + * Return true if either VFP or SIMD is implemented. | ||
33 | + * In this case, a minimum of VFP w/ D0-D15. | ||
34 | + */ | ||
35 | + return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0; | ||
36 | +} | ||
37 | + | ||
38 | static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id) | ||
39 | { | ||
40 | /* Return true if D16-D31 are implemented */ | ||
41 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/hw/intc/armv7m_nvic.c | ||
44 | +++ b/hw/intc/armv7m_nvic.c | ||
45 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
46 | case 0xd84: /* CSSELR */ | ||
47 | return cpu->env.v7m.csselr[attrs.secure]; | ||
48 | case 0xd88: /* CPACR */ | ||
49 | - if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
50 | + if (!cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
51 | return 0; | ||
52 | } | ||
53 | return cpu->env.v7m.cpacr[attrs.secure]; | ||
54 | case 0xd8c: /* NSACR */ | ||
55 | - if (!attrs.secure || !arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
56 | + if (!attrs.secure || !cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
57 | return 0; | ||
58 | } | ||
59 | return cpu->env.v7m.nsacr; | ||
60 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
61 | } | ||
62 | return cpu->env.v7m.sfar; | ||
63 | case 0xf34: /* FPCCR */ | ||
64 | - if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
65 | + if (!cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
66 | return 0; | ||
67 | } | ||
68 | if (attrs.secure) { | ||
69 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
70 | return value; | ||
71 | } | ||
72 | case 0xf38: /* FPCAR */ | ||
73 | - if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
74 | + if (!cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
75 | return 0; | ||
76 | } | ||
77 | return cpu->env.v7m.fpcar[attrs.secure]; | ||
78 | case 0xf3c: /* FPDSCR */ | ||
79 | - if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
80 | + if (!cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
81 | return 0; | ||
82 | } | ||
83 | return cpu->env.v7m.fpdscr[attrs.secure]; | ||
84 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
85 | } | ||
86 | break; | ||
87 | case 0xd88: /* CPACR */ | ||
88 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
89 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
90 | /* We implement only the Floating Point extension's CP10/CP11 */ | ||
91 | cpu->env.v7m.cpacr[attrs.secure] = value & (0xf << 20); | ||
92 | } | ||
93 | break; | ||
94 | case 0xd8c: /* NSACR */ | ||
95 | - if (attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
96 | + if (attrs.secure && cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
97 | /* We implement only the Floating Point extension's CP10/CP11 */ | ||
98 | cpu->env.v7m.nsacr = value & (3 << 10); | ||
99 | } | ||
100 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
101 | break; | ||
102 | } | ||
103 | case 0xf34: /* FPCCR */ | ||
104 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
105 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
106 | /* Not all bits here are banked. */ | ||
107 | uint32_t fpccr_s; | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
110 | } | ||
111 | break; | ||
112 | case 0xf38: /* FPCAR */ | ||
113 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
114 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
115 | value &= ~7; | ||
116 | cpu->env.v7m.fpcar[attrs.secure] = value; | ||
117 | } | ||
118 | break; | ||
119 | case 0xf3c: /* FPDSCR */ | ||
120 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
121 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
122 | value &= 0x07c00000; | ||
123 | cpu->env.v7m.fpdscr[attrs.secure] = value; | ||
124 | } | ||
125 | diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/linux-user/arm/signal.c | ||
128 | +++ b/linux-user/arm/signal.c | ||
129 | @@ -XXX,XX +XXX,XX @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc, | ||
130 | setup_sigcontext(&uc->tuc_mcontext, env, set->sig[0]); | ||
131 | /* Save coprocessor signal frame. */ | ||
132 | regspace = uc->tuc_regspace; | ||
133 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
134 | + if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { | ||
135 | regspace = setup_sigframe_v2_vfp(regspace, env); | ||
136 | } | ||
137 | if (arm_feature(env, ARM_FEATURE_IWMMXT)) { | ||
138 | @@ -XXX,XX +XXX,XX @@ static int do_sigframe_return_v2(CPUARMState *env, | ||
139 | |||
140 | /* Restore coprocessor signal frame */ | ||
141 | regspace = uc->tuc_regspace; | ||
142 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
143 | + if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { | ||
144 | regspace = restore_sigframe_v2_vfp(env, regspace); | ||
145 | if (!regspace) { | ||
146 | return 1; | ||
147 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c | ||
148 | index XXXXXXX..XXXXXXX 100644 | ||
149 | --- a/target/arm/arch_dump.c | ||
150 | +++ b/target/arm/arch_dump.c | ||
151 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, | ||
152 | int cpuid, void *opaque) | ||
153 | { | ||
154 | struct arm_note note; | ||
155 | - CPUARMState *env = &ARM_CPU(cs)->env; | ||
156 | + ARMCPU *cpu = ARM_CPU(cs); | ||
157 | + CPUARMState *env = &cpu->env; | ||
158 | DumpState *s = opaque; | ||
159 | - int ret, i, fpvalid = !!arm_feature(env, ARM_FEATURE_VFP); | ||
160 | + int ret, i; | ||
161 | + bool fpvalid = cpu_isar_feature(aa32_vfp_simd, cpu); | ||
162 | |||
163 | arm_note_init(¬e, s, "CORE", 5, NT_PRSTATUS, sizeof(note.prstatus)); | ||
164 | |||
165 | @@ -XXX,XX +XXX,XX @@ int cpu_get_dump_info(ArchDumpInfo *info, | ||
166 | ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) | ||
167 | { | ||
168 | ARMCPU *cpu = ARM_CPU(first_cpu); | ||
169 | - CPUARMState *env = &cpu->env; | ||
170 | size_t note_size; | ||
171 | |||
172 | if (class == ELFCLASS64) { | ||
173 | @@ -XXX,XX +XXX,XX @@ ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) | ||
174 | note_size += AARCH64_PRFPREG_NOTE_SIZE; | ||
175 | #ifdef TARGET_AARCH64 | ||
176 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
177 | - note_size += AARCH64_SVE_NOTE_SIZE(env); | ||
178 | + note_size += AARCH64_SVE_NOTE_SIZE(&cpu->env); | ||
179 | } | ||
180 | #endif | ||
181 | } else { | ||
182 | note_size = ARM_PRSTATUS_NOTE_SIZE; | ||
183 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
184 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
185 | note_size += ARM_VFP_NOTE_SIZE; | ||
186 | } | ||
187 | } | ||
188 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
189 | index XXXXXXX..XXXXXXX 100644 | ||
190 | --- a/target/arm/cpu.c | ||
191 | +++ b/target/arm/cpu.c | ||
192 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | ||
193 | env->v7m.ccr[M_REG_S] |= R_V7M_CCR_UNALIGN_TRP_MASK; | ||
194 | } | ||
195 | |||
196 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
197 | + if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
198 | env->v7m.fpccr[M_REG_NS] = R_V7M_FPCCR_ASPEN_MASK; | ||
199 | env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK | | ||
200 | R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK; | ||
201 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags) | ||
202 | int numvfpregs = 0; | ||
203 | if (cpu_isar_feature(aa32_simd_r32, cpu)) { | ||
204 | numvfpregs = 32; | ||
205 | - } else if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
206 | + } else if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
207 | numvfpregs = 16; | ||
208 | } | ||
209 | for (i = 0; i < numvfpregs; i++) { | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 210 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 211 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 212 | --- a/target/arm/helper.c |
16 | +++ b/target/arm/helper.c | 213 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static void define_debug_regs(ARMCPU *cpu) | 214 | @@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
215 | * ASEDIS [31] and D32DIS [30] are both UNK/SBZP without VFP. | ||
216 | * TRCDIS [28] is RAZ/WI since we do not implement a trace macrocell. | ||
217 | */ | ||
218 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
219 | + if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { | ||
220 | /* VFP coprocessor: cp10 & cp11 [23:20] */ | ||
221 | mask |= (1 << 31) | (1 << 30) | (0xf << 20); | ||
222 | |||
223 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) | ||
224 | } else if (cpu_isar_feature(aa32_simd_r32, cpu)) { | ||
225 | gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, | ||
226 | 35, "arm-vfp3.xml", 0); | ||
227 | - } else if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
228 | + } else if (cpu_isar_feature(aa32_vfp_simd, cpu)) { | ||
229 | gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, | ||
230 | 19, "arm-vfp.xml", 0); | ||
231 | } | ||
232 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
233 | index XXXXXXX..XXXXXXX 100644 | ||
234 | --- a/target/arm/m_helper.c | ||
235 | +++ b/target/arm/m_helper.c | ||
236 | @@ -XXX,XX +XXX,XX @@ static uint32_t v7m_integrity_sig(CPUARMState *env, uint32_t lr) | ||
18 | */ | 237 | */ |
19 | int i; | 238 | uint32_t sig = 0xfefa125a; |
20 | int wrps, brps, ctx_cmps; | 239 | |
21 | - ARMCPRegInfo dbgdidr = { | 240 | - if (!arm_feature(env, ARM_FEATURE_VFP) || (lr & R_V7M_EXCRET_FTYPE_MASK)) { |
22 | - .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0, | 241 | + if (!cpu_isar_feature(aa32_vfp_simd, env_archcpu(env)) |
23 | - .access = PL0_R, .accessfn = access_tda, | 242 | + || (lr & R_V7M_EXCRET_FTYPE_MASK)) { |
24 | - .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, | 243 | sig |= 1; |
25 | - }; | 244 | } |
26 | + | 245 | return sig; |
27 | + /* | 246 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, |
28 | + * The Arm ARM says DBGDIDR is optional and deprecated if EL1 cannot | 247 | |
29 | + * use AArch32. Given that bit 15 is RES1, if the value is 0 then | 248 | if (dotailchain) { |
30 | + * the register must not exist for this cpu. | 249 | /* Sanitize LR FType and PREFIX bits */ |
31 | + */ | 250 | - if (!arm_feature(env, ARM_FEATURE_VFP)) { |
32 | + if (cpu->isar.dbgdidr != 0) { | 251 | + if (!cpu_isar_feature(aa32_vfp_simd, cpu)) { |
33 | + ARMCPRegInfo dbgdidr = { | 252 | lr |= R_V7M_EXCRET_FTYPE_MASK; |
34 | + .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, | 253 | } |
35 | + .opc1 = 0, .opc2 = 0, | 254 | lr = deposit32(lr, 24, 8, 0xff); |
36 | + .access = PL0_R, .accessfn = access_tda, | 255 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
37 | + .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, | 256 | |
38 | + }; | 257 | ftype = excret & R_V7M_EXCRET_FTYPE_MASK; |
39 | + define_one_arm_cp_reg(cpu, &dbgdidr); | 258 | |
40 | + } | 259 | - if (!arm_feature(env, ARM_FEATURE_VFP) && !ftype) { |
41 | 260 | + if (!ftype && !cpu_isar_feature(aa32_vfp_simd, cpu)) { | |
42 | /* Note that all these register fields hold "number of Xs minus 1". */ | 261 | qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero FTYPE in exception " |
43 | brps = arm_num_brps(cpu); | 262 | "exit PC value 0x%" PRIx32 " is UNPREDICTABLE " |
44 | @@ -XXX,XX +XXX,XX @@ static void define_debug_regs(ARMCPU *cpu) | 263 | "if FPU not present\n", |
45 | 264 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | |
46 | assert(ctx_cmps <= brps); | 265 | * SFPA is RAZ/WI from NS. FPCA is RO if NSACR.CP10 == 0, |
47 | 266 | * RES0 if the FPU is not present, and is stored in the S bank | |
48 | - define_one_arm_cp_reg(cpu, &dbgdidr); | 267 | */ |
49 | define_arm_cp_regs(cpu, debug_cp_reginfo); | 268 | - if (arm_feature(env, ARM_FEATURE_VFP) && |
50 | 269 | + if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env)) && | |
51 | if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { | 270 | extract32(env->v7m.nsacr, 10, 1)) { |
271 | env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK; | ||
272 | env->v7m.control[M_REG_S] |= val & R_V7M_CONTROL_FPCA_MASK; | ||
273 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
274 | env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK; | ||
275 | env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK; | ||
276 | } | ||
277 | - if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
278 | + if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { | ||
279 | /* | ||
280 | * SFPA is RAZ/WI from NS or if no FPU. | ||
281 | * FPCA is RO if NSACR.CP10 == 0, RES0 if the FPU is not present. | ||
52 | -- | 282 | -- |
53 | 2.20.1 | 283 | 2.20.1 |
54 | 284 | ||
55 | 285 | diff view generated by jsdifflib |
1 | Now that the CMSDK APB watchdog uses its Clock input, it will | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | correctly respond when the system clock frequency is changed using | 2 | |
3 | the RCC register on in the Stellaris board system registers. Test | 3 | The old name, isar_feature_aa32_fpdp, does not reflect |
4 | that when the RCC register is written it causes the watchdog timer to | 4 | that the test includes VFPv2. We will introduce another |
5 | change speed. | 5 | feature tests for VFPv3. |
6 | 6 | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200224222232.13807-3-richard.henderson@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
10 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20210128114145.20536-22-peter.maydell@linaro.org | ||
12 | Message-id: 20210121190622.22000-22-peter.maydell@linaro.org | ||
13 | --- | 11 | --- |
14 | tests/qtest/cmsdk-apb-watchdog-test.c | 52 +++++++++++++++++++++++++++ | 12 | target/arm/cpu.h | 4 ++-- |
15 | 1 file changed, 52 insertions(+) | 13 | target/arm/translate-vfp.inc.c | 40 +++++++++++++++++----------------- |
16 | 14 | 2 files changed, 22 insertions(+), 22 deletions(-) | |
17 | diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-watchdog-test.c | 15 | |
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/qtest/cmsdk-apb-watchdog-test.c | 18 | --- a/target/arm/cpu.h |
20 | +++ b/tests/qtest/cmsdk-apb-watchdog-test.c | 19 | +++ b/target/arm/cpu.h |
21 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) |
22 | */ | 21 | return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; |
23 | 22 | } | |
24 | #include "qemu/osdep.h" | 23 | |
25 | +#include "qemu/bitops.h" | 24 | -static inline bool isar_feature_aa32_fpdp(const ARMISARegisters *id) |
26 | #include "libqtest-single.h" | 25 | +static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) |
27 | |||
28 | /* | ||
29 | @@ -XXX,XX +XXX,XX @@ | ||
30 | #define WDOGMIS 0x14 | ||
31 | #define WDOGLOCK 0xc00 | ||
32 | |||
33 | +#define SSYS_BASE 0x400fe000 | ||
34 | +#define RCC 0x60 | ||
35 | +#define SYSDIV_SHIFT 23 | ||
36 | +#define SYSDIV_LENGTH 4 | ||
37 | + | ||
38 | static void test_watchdog(void) | ||
39 | { | 26 | { |
40 | g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 27 | - /* Return true if CPU supports double precision floating point */ |
41 | @@ -XXX,XX +XXX,XX @@ static void test_watchdog(void) | 28 | + /* Return true if CPU supports double precision floating point, VFPv2 */ |
42 | g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 29 | return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; |
43 | } | 30 | } |
44 | 31 | ||
45 | +static void test_clock_change(void) | 32 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
46 | +{ | 33 | index XXXXXXX..XXXXXXX 100644 |
47 | + uint32_t rcc; | 34 | --- a/target/arm/translate-vfp.inc.c |
48 | + | 35 | +++ b/target/arm/translate-vfp.inc.c |
49 | + /* | 36 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) |
50 | + * Test that writing to the stellaris board's RCC register to | 37 | return false; |
51 | + * change the system clock frequency causes the watchdog | 38 | } |
52 | + * to change the speed it counts at. | 39 | |
53 | + */ | 40 | - if (dp && !dc_isar_feature(aa32_fpdp, s)) { |
54 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 41 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
55 | + | 42 | return false; |
56 | + writel(WDOG_BASE + WDOGCONTROL, 1); | 43 | } |
57 | + writel(WDOG_BASE + WDOGLOAD, 1000); | 44 | |
58 | + | 45 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) |
59 | + /* Step to just past the 500th tick */ | 46 | return false; |
60 | + clock_step(80 * 500 + 1); | 47 | } |
61 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 48 | |
62 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | 49 | - if (dp && !dc_isar_feature(aa32_fpdp, s)) { |
63 | + | 50 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
64 | + /* Rewrite RCC.SYSDIV from 16 to 8, so the clock is now 40ns per tick */ | 51 | return false; |
65 | + rcc = readl(SSYS_BASE + RCC); | 52 | } |
66 | + g_assert_cmpuint(extract32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH), ==, 0xf); | 53 | |
67 | + rcc = deposit32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH, 7); | 54 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) |
68 | + writel(SSYS_BASE + RCC, rcc); | 55 | return false; |
69 | + | 56 | } |
70 | + /* Just past the 1000th tick: timer should have fired */ | 57 | |
71 | + clock_step(40 * 500); | 58 | - if (dp && !dc_isar_feature(aa32_fpdp, s)) { |
72 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | 59 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
73 | + | 60 | return false; |
74 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 0); | 61 | } |
75 | + | 62 | |
76 | + /* VALUE reloads at following tick */ | 63 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) |
77 | + clock_step(41); | 64 | return false; |
78 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | 65 | } |
79 | + | 66 | |
80 | + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ | 67 | - if (dp && !dc_isar_feature(aa32_fpdp, s)) { |
81 | + clock_step(40 * 500); | 68 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
82 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | 69 | return false; |
83 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | 70 | } |
84 | + writel(WDOG_BASE + WDOGINTCLR, 0); | 71 | |
85 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | 72 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, |
86 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 73 | return false; |
87 | +} | 74 | } |
88 | + | 75 | |
89 | int main(int argc, char **argv) | 76 | - if (!dc_isar_feature(aa32_fpdp, s)) { |
90 | { | 77 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { |
91 | int r; | 78 | return false; |
92 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | 79 | } |
93 | qtest_start("-machine lm3s811evb"); | 80 | |
94 | 81 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) | |
95 | qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); | 82 | return false; |
96 | + qtest_add_func("/cmsdk-apb-watchdog/watchdog_clock_change", | 83 | } |
97 | + test_clock_change); | 84 | |
98 | 85 | - if (!dc_isar_feature(aa32_fpdp, s)) { | |
99 | r = g_test_run(); | 86 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { |
87 | return false; | ||
88 | } | ||
89 | |||
90 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) | ||
91 | return false; | ||
92 | } | ||
93 | |||
94 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
95 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) | ||
100 | return false; | ||
101 | } | ||
102 | |||
103 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
104 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) | ||
109 | return false; | ||
110 | } | ||
111 | |||
112 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
113 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
122 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
123 | return false; | ||
124 | } | ||
125 | |||
126 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) | ||
127 | return false; | ||
128 | } | ||
129 | |||
130 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
131 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
140 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) | ||
145 | return false; | ||
146 | } | ||
147 | |||
148 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
149 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
150 | return false; | ||
151 | } | ||
152 | |||
153 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) | ||
154 | return false; | ||
155 | } | ||
156 | |||
157 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
158 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) | ||
163 | return false; | ||
164 | } | ||
165 | |||
166 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
167 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
168 | return false; | ||
169 | } | ||
170 | |||
171 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) | ||
172 | return false; | ||
173 | } | ||
174 | |||
175 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
176 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
177 | return false; | ||
178 | } | ||
179 | |||
180 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) | ||
181 | return false; | ||
182 | } | ||
183 | |||
184 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
185 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
186 | return false; | ||
187 | } | ||
188 | |||
189 | @@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) | ||
190 | return false; | ||
191 | } | ||
192 | |||
193 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
194 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
195 | return false; | ||
196 | } | ||
197 | |||
198 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
199 | return false; | ||
200 | } | ||
201 | |||
202 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
203 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
204 | return false; | ||
205 | } | ||
206 | |||
207 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) | ||
208 | return false; | ||
209 | } | ||
210 | |||
211 | - if (!dc_isar_feature(aa32_fpdp, s)) { | ||
212 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
213 | return false; | ||
214 | } | ||
100 | 215 | ||
101 | -- | 216 | -- |
102 | 2.20.1 | 217 | 2.20.1 |
103 | 218 | ||
104 | 219 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add PCI interface support for PVPANIC device. Create a new file pvpanic-pci.c | 3 | We will shortly use these to test for VFPv2 and VFPv3 |
4 | where the PCI specific routines reside and update the build system with the new | 4 | in different situations. |
5 | files and config structure. | ||
6 | 5 | ||
7 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | ||
8 | Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200224222232.13807-4-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | docs/specs/pci-ids.txt | 1 + | 11 | target/arm/cpu.h | 18 ++++++++++++++++++ |
14 | include/hw/misc/pvpanic.h | 1 + | 12 | 1 file changed, 18 insertions(+) |
15 | include/hw/pci/pci.h | 1 + | ||
16 | hw/misc/pvpanic-pci.c | 94 +++++++++++++++++++++++++++++++++++++++ | ||
17 | hw/misc/Kconfig | 6 +++ | ||
18 | hw/misc/meson.build | 1 + | ||
19 | 6 files changed, 104 insertions(+) | ||
20 | create mode 100644 hw/misc/pvpanic-pci.c | ||
21 | 13 | ||
22 | diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt | 14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/docs/specs/pci-ids.txt | 16 | --- a/target/arm/cpu.h |
25 | +++ b/docs/specs/pci-ids.txt | 17 | +++ b/target/arm/cpu.h |
26 | @@ -XXX,XX +XXX,XX @@ PCI devices (other than virtio): | 18 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) |
27 | 1b36:000d PCI xhci usb host adapter | 19 | return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; |
28 | 1b36:000f mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c | 20 | } |
29 | 1b36:0010 PCIe NVMe device (-device nvme) | 21 | |
30 | +1b36:0011 PCI PVPanic device (-device pvpanic-pci) | 22 | +static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id) |
31 | |||
32 | All these devices are documented in docs/specs. | ||
33 | |||
34 | diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/hw/misc/pvpanic.h | ||
37 | +++ b/include/hw/misc/pvpanic.h | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | #include "qom/object.h" | ||
40 | |||
41 | #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" | ||
42 | +#define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" | ||
43 | |||
44 | #define PVPANIC_IOPORT_PROP "ioport" | ||
45 | |||
46 | diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/include/hw/pci/pci.h | ||
49 | +++ b/include/hw/pci/pci.h | ||
50 | @@ -XXX,XX +XXX,XX @@ extern bool pci_available; | ||
51 | #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e | ||
52 | #define PCI_DEVICE_ID_REDHAT_MDPY 0x000f | ||
53 | #define PCI_DEVICE_ID_REDHAT_NVME 0x0010 | ||
54 | +#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 | ||
55 | #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 | ||
56 | |||
57 | #define FMT_PCIBUS PRIx64 | ||
58 | diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/hw/misc/pvpanic-pci.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* | ||
65 | + * QEMU simulated PCI pvpanic device. | ||
66 | + * | ||
67 | + * Copyright (C) 2020 Oracle | ||
68 | + * | ||
69 | + * Authors: | ||
70 | + * Mihai Carabas <mihai.carabas@oracle.com> | ||
71 | + * | ||
72 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
73 | + * See the COPYING file in the top-level directory. | ||
74 | + * | ||
75 | + */ | ||
76 | + | ||
77 | +#include "qemu/osdep.h" | ||
78 | +#include "qemu/log.h" | ||
79 | +#include "qemu/module.h" | ||
80 | +#include "sysemu/runstate.h" | ||
81 | + | ||
82 | +#include "hw/nvram/fw_cfg.h" | ||
83 | +#include "hw/qdev-properties.h" | ||
84 | +#include "migration/vmstate.h" | ||
85 | +#include "hw/misc/pvpanic.h" | ||
86 | +#include "qom/object.h" | ||
87 | +#include "hw/pci/pci.h" | ||
88 | + | ||
89 | +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) | ||
90 | + | ||
91 | +/* | ||
92 | + * PVPanicPCIState for PCI device | ||
93 | + */ | ||
94 | +typedef struct PVPanicPCIState { | ||
95 | + PCIDevice dev; | ||
96 | + PVPanicState pvpanic; | ||
97 | +} PVPanicPCIState; | ||
98 | + | ||
99 | +static const VMStateDescription vmstate_pvpanic_pci = { | ||
100 | + .name = "pvpanic-pci", | ||
101 | + .version_id = 1, | ||
102 | + .minimum_version_id = 1, | ||
103 | + .fields = (VMStateField[]) { | ||
104 | + VMSTATE_PCI_DEVICE(dev, PVPanicPCIState), | ||
105 | + VMSTATE_END_OF_LIST() | ||
106 | + } | ||
107 | +}; | ||
108 | + | ||
109 | +static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) | ||
110 | +{ | 23 | +{ |
111 | + PVPanicPCIState *s = PVPANIC_PCI_DEVICE(dev); | 24 | + /* Return true if CPU supports single precision floating point, VFPv2 */ |
112 | + PVPanicState *ps = &s->pvpanic; | 25 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0; |
113 | + | ||
114 | + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 2); | ||
115 | + | ||
116 | + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &ps->mr); | ||
117 | +} | 26 | +} |
118 | + | 27 | + |
119 | +static Property pvpanic_pci_properties[] = { | 28 | +static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id) |
120 | + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | ||
121 | + DEFINE_PROP_END_OF_LIST(), | ||
122 | +}; | ||
123 | + | ||
124 | +static void pvpanic_pci_class_init(ObjectClass *klass, void *data) | ||
125 | +{ | 29 | +{ |
126 | + DeviceClass *dc = DEVICE_CLASS(klass); | 30 | + /* Return true if CPU supports single precision floating point, VFPv3 */ |
127 | + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); | 31 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2; |
128 | + | ||
129 | + device_class_set_props(dc, pvpanic_pci_properties); | ||
130 | + | ||
131 | + pc->realize = pvpanic_pci_realizefn; | ||
132 | + pc->vendor_id = PCI_VENDOR_ID_REDHAT; | ||
133 | + pc->device_id = PCI_DEVICE_ID_REDHAT_PVPANIC; | ||
134 | + pc->revision = 1; | ||
135 | + pc->class_id = PCI_CLASS_SYSTEM_OTHER; | ||
136 | + dc->vmsd = &vmstate_pvpanic_pci; | ||
137 | + | ||
138 | + set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
139 | +} | 32 | +} |
140 | + | 33 | + |
141 | +static TypeInfo pvpanic_pci_info = { | 34 | static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) |
142 | + .name = TYPE_PVPANIC_PCI_DEVICE, | 35 | { |
143 | + .parent = TYPE_PCI_DEVICE, | 36 | /* Return true if CPU supports double precision floating point, VFPv2 */ |
144 | + .instance_size = sizeof(PVPanicPCIState), | 37 | return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; |
145 | + .class_init = pvpanic_pci_class_init, | 38 | } |
146 | + .interfaces = (InterfaceInfo[]) { | 39 | |
147 | + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, | 40 | +static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) |
148 | + { } | ||
149 | + } | ||
150 | +}; | ||
151 | + | ||
152 | +static void pvpanic_register_types(void) | ||
153 | +{ | 41 | +{ |
154 | + type_register_static(&pvpanic_pci_info); | 42 | + /* Return true if CPU supports double precision floating point, VFPv3 */ |
43 | + return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; | ||
155 | +} | 44 | +} |
156 | + | 45 | + |
157 | +type_init(pvpanic_register_types); | 46 | /* |
158 | diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig | 47 | * We always set the FP and SIMD FP16 fields to indicate identical |
159 | index XXXXXXX..XXXXXXX 100644 | 48 | * levels of support (assuming SIMD is implemented at all), so |
160 | --- a/hw/misc/Kconfig | ||
161 | +++ b/hw/misc/Kconfig | ||
162 | @@ -XXX,XX +XXX,XX @@ config IOTKIT_SYSINFO | ||
163 | config PVPANIC_COMMON | ||
164 | bool | ||
165 | |||
166 | +config PVPANIC_PCI | ||
167 | + bool | ||
168 | + default y if PCI_DEVICES | ||
169 | + depends on PCI | ||
170 | + select PVPANIC_COMMON | ||
171 | + | ||
172 | config PVPANIC_ISA | ||
173 | bool | ||
174 | depends on ISA_BUS | ||
175 | diff --git a/hw/misc/meson.build b/hw/misc/meson.build | ||
176 | index XXXXXXX..XXXXXXX 100644 | ||
177 | --- a/hw/misc/meson.build | ||
178 | +++ b/hw/misc/meson.build | ||
179 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) | ||
180 | softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) | ||
181 | |||
182 | softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) | ||
183 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) | ||
184 | softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) | ||
185 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) | ||
186 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) | ||
187 | -- | 49 | -- |
188 | 2.20.1 | 50 | 2.20.1 |
189 | 51 | ||
190 | 52 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB dualtimer device over to using its Clock input; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the pclk-frq property is now ignored. | ||
3 | 2 | ||
3 | We cannot easily create "any" functions for these, because the | ||
4 | ID_AA64PFR0 fields for FP and SIMD signal "enabled" with zero. | ||
5 | Which means that an aarch32-only cpu will return incorrect results | ||
6 | when testing the aarch64 registers. | ||
7 | |||
8 | To use these, we must either have context or additionally test | ||
9 | vs ARM_FEATURE_AARCH64. | ||
10 | |||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 20200224222232.13807-5-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-20-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-20-peter.maydell@linaro.org | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | --- | 15 | --- |
12 | hw/timer/cmsdk-apb-dualtimer.c | 42 ++++++++++++++++++++++++++++++---- | 16 | target/arm/cpu.h | 11 +++++++++++ |
13 | 1 file changed, 37 insertions(+), 5 deletions(-) | 17 | target/arm/cpu.c | 9 ++++++--- |
18 | target/arm/machine.c | 5 +++-- | ||
19 | 3 files changed, 20 insertions(+), 5 deletions(-) | ||
14 | 20 | ||
15 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | 21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/timer/cmsdk-apb-dualtimer.c | 23 | --- a/target/arm/cpu.h |
18 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | 24 | +++ b/target/arm/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_update(CMSDKAPBDualTimer *s) | 25 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) |
20 | qemu_set_irq(s->timerintc, timintc); | 26 | return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; |
21 | } | 27 | } |
22 | 28 | ||
23 | +static int cmsdk_dualtimermod_divisor(CMSDKAPBDualTimerModule *m) | 29 | +static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id) |
24 | +{ | 30 | +{ |
25 | + /* Return the divisor set by the current CONTROL.PRESCALE value */ | 31 | + return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id); |
26 | + switch (FIELD_EX32(m->control, CONTROL, PRESCALE)) { | ||
27 | + case 0: | ||
28 | + return 1; | ||
29 | + case 1: | ||
30 | + return 16; | ||
31 | + case 2: | ||
32 | + case 3: /* UNDEFINED, we treat like 2 (and complained when it was set) */ | ||
33 | + return 256; | ||
34 | + default: | ||
35 | + g_assert_not_reached(); | ||
36 | + } | ||
37 | +} | 32 | +} |
38 | + | 33 | + |
39 | static void cmsdk_dualtimermod_write_control(CMSDKAPBDualTimerModule *m, | 34 | /* |
40 | uint32_t newctrl) | 35 | * We always set the FP and SIMD FP16 fields to indicate identical |
41 | { | 36 | * levels of support (assuming SIMD is implemented at all), so |
42 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_dualtimermod_write_control(CMSDKAPBDualTimerModule *m, | 37 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id) |
43 | default: | 38 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2; |
44 | g_assert_not_reached(); | ||
45 | } | ||
46 | - ptimer_set_freq(m->timer, m->parent->pclk_frq / divisor); | ||
47 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, divisor); | ||
48 | } | ||
49 | |||
50 | if (changed & R_CONTROL_MODE_MASK) { | ||
51 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_dualtimermod_reset(CMSDKAPBDualTimerModule *m) | ||
52 | * limit must both be set to 0xffff, so we wrap at 16 bits. | ||
53 | */ | ||
54 | ptimer_set_limit(m->timer, 0xffff, 1); | ||
55 | - ptimer_set_freq(m->timer, m->parent->pclk_frq); | ||
56 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, | ||
57 | + cmsdk_dualtimermod_divisor(m)); | ||
58 | ptimer_transaction_commit(m->timer); | ||
59 | } | 39 | } |
60 | 40 | ||
61 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_reset(DeviceState *dev) | 41 | +static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) |
62 | s->timeritop = 0; | ||
63 | } | ||
64 | |||
65 | +static void cmsdk_apb_dualtimer_clk_update(void *opaque) | ||
66 | +{ | 42 | +{ |
67 | + CMSDKAPBDualTimer *s = CMSDK_APB_DUALTIMER(opaque); | 43 | + /* We always set the AdvSIMD and FP fields identically. */ |
68 | + int i; | 44 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf; |
69 | + | ||
70 | + for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | ||
71 | + CMSDKAPBDualTimerModule *m = &s->timermod[i]; | ||
72 | + ptimer_transaction_begin(m->timer); | ||
73 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, | ||
74 | + cmsdk_dualtimermod_divisor(m)); | ||
75 | + ptimer_transaction_commit(m->timer); | ||
76 | + } | ||
77 | +} | 45 | +} |
78 | + | 46 | + |
79 | static void cmsdk_apb_dualtimer_init(Object *obj) | 47 | static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) |
80 | { | 48 | { |
81 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 49 | /* We always set the AdvSIMD and FP fields identically wrt FP16. */ |
82 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_init(Object *obj) | 50 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
83 | for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | 51 | index XXXXXXX..XXXXXXX 100644 |
84 | sysbus_init_irq(sbd, &s->timermod[i].timerint); | 52 | --- a/target/arm/cpu.c |
85 | } | 53 | +++ b/target/arm/cpu.c |
86 | - s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); | 54 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj) |
87 | + s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", | 55 | * KVM does not currently allow us to lie to the guest about its |
88 | + cmsdk_apb_dualtimer_clk_update, s); | 56 | * ID/feature registers, so the guest always sees what the host has. |
57 | */ | ||
58 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
59 | + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) | ||
60 | + ? cpu_isar_feature(aa64_fp_simd, cpu) | ||
61 | + : cpu_isar_feature(aa32_vfp, cpu)) { | ||
62 | cpu->has_vfp = true; | ||
63 | if (!kvm_enabled()) { | ||
64 | qdev_property_add_static(DEVICE(obj), &arm_cpu_has_vfp_property); | ||
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
66 | * We rely on no XScale CPU having VFP so we can use the same bits in the | ||
67 | * TB flags field for VECSTRIDE and XSCALE_CPAR. | ||
68 | */ | ||
69 | - assert(!(arm_feature(env, ARM_FEATURE_VFP) && | ||
70 | - arm_feature(env, ARM_FEATURE_XSCALE))); | ||
71 | + assert(arm_feature(&cpu->env, ARM_FEATURE_AARCH64) || | ||
72 | + !cpu_isar_feature(aa32_vfp_simd, cpu) || | ||
73 | + !arm_feature(env, ARM_FEATURE_XSCALE)); | ||
74 | |||
75 | if (arm_feature(env, ARM_FEATURE_V7) && | ||
76 | !arm_feature(env, ARM_FEATURE_M) && | ||
77 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/target/arm/machine.c | ||
80 | +++ b/target/arm/machine.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | static bool vfp_needed(void *opaque) | ||
83 | { | ||
84 | ARMCPU *cpu = opaque; | ||
85 | - CPUARMState *env = &cpu->env; | ||
86 | |||
87 | - return arm_feature(env, ARM_FEATURE_VFP); | ||
88 | + return (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) | ||
89 | + ? cpu_isar_feature(aa64_fp_simd, cpu) | ||
90 | + : cpu_isar_feature(aa32_vfp_simd, cpu)); | ||
89 | } | 91 | } |
90 | 92 | ||
91 | static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | 93 | static int get_fpscr(QEMUFile *f, void *opaque, size_t size, |
92 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | ||
93 | CMSDKAPBDualTimer *s = CMSDK_APB_DUALTIMER(dev); | ||
94 | int i; | ||
95 | |||
96 | - if (s->pclk_frq == 0) { | ||
97 | - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | ||
98 | + if (!clock_has_source(s->timclk)) { | ||
99 | + error_setg(errp, "CMSDK APB dualtimer: TIMCLK clock must be connected"); | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | -- | 94 | -- |
104 | 2.20.1 | 95 | 2.20.1 |
105 | 96 | ||
106 | 97 | diff view generated by jsdifflib |
1 | Now that the watchdog device uses its Clock input rather than being | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | passed the value of system_clock_scale at creation time, we can | 2 | |
3 | remove the hack where we reset the STELLARIS_SYS at board creation | 3 | Shuffle the order of the checks so that we test the ISA |
4 | time to force it to set system_clock_scale. Instead it will be reset | 4 | before we test anything else, such as the register arguments. |
5 | at the usual point in startup and will inform the watchdog of the | 5 | |
6 | clock frequency at that point. | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
8 | Message-id: 20200224222232.13807-7-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
10 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20210128114145.20536-26-peter.maydell@linaro.org | ||
13 | Message-id: 20210121190622.22000-26-peter.maydell@linaro.org | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | --- | 10 | --- |
16 | hw/arm/stellaris.c | 10 ---------- | 11 | target/arm/translate-vfp.inc.c | 140 +++++++++++++++++---------------- |
17 | 1 file changed, 10 deletions(-) | 12 | 1 file changed, 71 insertions(+), 69 deletions(-) |
18 | 13 | ||
19 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 14 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/stellaris.c | 16 | --- a/target/arm/translate-vfp.inc.c |
22 | +++ b/hw/arm/stellaris.c | 17 | +++ b/target/arm/translate-vfp.inc.c |
23 | @@ -XXX,XX +XXX,XX @@ static DeviceState *stellaris_sys_init(uint32_t base, qemu_irq irq, | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) |
24 | sysbus_mmio_map(sbd, 0, base); | 19 | return false; |
25 | sysbus_connect_irq(sbd, 0, irq); | 20 | } |
26 | 21 | ||
27 | - /* | 22 | - /* UNDEF accesses to D16-D31 if they don't exist */ |
28 | - * Normally we should not be resetting devices like this during | 23 | - if (dp && !dc_isar_feature(aa32_simd_r32, s) && |
29 | - * board creation. For the moment we need to do so, because | 24 | - ((a->vm | a->vn | a->vd) & 0x10)) { |
30 | - * system_clock_scale will only get set when the STELLARIS_SYS | 25 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
31 | - * device is reset, and we need its initial value to pass to | 26 | return false; |
32 | - * the watchdog device. This hack can be removed once the | 27 | } |
33 | - * watchdog has been converted to use a Clock input instead. | 28 | |
34 | - */ | 29 | - if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
35 | - device_cold_reset(dev); | 30 | + /* UNDEF accesses to D16-D31 if they don't exist */ |
36 | - | 31 | + if (dp && !dc_isar_feature(aa32_simd_r32, s) && |
37 | return dev; | 32 | + ((a->vm | a->vn | a->vd) & 0x10)) { |
38 | } | 33 | return false; |
34 | } | ||
35 | |||
36 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) | ||
37 | return false; | ||
38 | } | ||
39 | |||
40 | - /* UNDEF accesses to D16-D31 if they don't exist */ | ||
41 | - if (dp && !dc_isar_feature(aa32_simd_r32, s) && | ||
42 | - ((a->vm | a->vn | a->vd) & 0x10)) { | ||
43 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
44 | return false; | ||
45 | } | ||
46 | |||
47 | - if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
48 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
49 | + if (dp && !dc_isar_feature(aa32_simd_r32, s) && | ||
50 | + ((a->vm | a->vn | a->vd) & 0x10)) { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) | ||
55 | return false; | ||
56 | } | ||
57 | |||
58 | - /* UNDEF accesses to D16-D31 if they don't exist */ | ||
59 | - if (dp && !dc_isar_feature(aa32_simd_r32, s) && | ||
60 | - ((a->vm | a->vd) & 0x10)) { | ||
61 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
62 | return false; | ||
63 | } | ||
64 | |||
65 | - if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
66 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
67 | + if (dp && !dc_isar_feature(aa32_simd_r32, s) && | ||
68 | + ((a->vm | a->vd) & 0x10)) { | ||
69 | return false; | ||
70 | } | ||
71 | |||
72 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) | ||
73 | return false; | ||
74 | } | ||
75 | |||
76 | - /* UNDEF accesses to D16-D31 if they don't exist */ | ||
77 | - if (dp && !dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
78 | + if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
79 | return false; | ||
80 | } | ||
81 | |||
82 | - if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
83 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
84 | + if (dp && !dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
85 | return false; | ||
86 | } | ||
87 | |||
88 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, | ||
89 | TCGv_i64 f0, f1, fd; | ||
90 | TCGv_ptr fpst; | ||
91 | |||
92 | - /* UNDEF accesses to D16-D31 if they don't exist */ | ||
93 | - if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vn | vm) & 0x10)) { | ||
94 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
95 | return false; | ||
96 | } | ||
97 | |||
98 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
99 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
100 | + if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vn | vm) & 0x10)) { | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) | ||
105 | int veclen = s->vec_len; | ||
106 | TCGv_i64 f0, fd; | ||
107 | |||
108 | - /* UNDEF accesses to D16-D31 if they don't exist */ | ||
109 | - if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vm) & 0x10)) { | ||
110 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
115 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
116 | + if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vm) & 0x10)) { | ||
117 | return false; | ||
118 | } | ||
119 | |||
120 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) | ||
121 | return false; | ||
122 | } | ||
123 | |||
124 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
125 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
126 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
127 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
128 | return false; | ||
129 | } | ||
130 | |||
131 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) | ||
132 | |||
133 | vd = a->vd; | ||
134 | |||
135 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
136 | - if (!dc_isar_feature(aa32_simd_r32, s) && (vd & 0x10)) { | ||
137 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
138 | return false; | ||
139 | } | ||
140 | |||
141 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
142 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
143 | + if (!dc_isar_feature(aa32_simd_r32, s) && (vd & 0x10)) { | ||
144 | return false; | ||
145 | } | ||
146 | |||
147 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) | ||
148 | { | ||
149 | TCGv_i64 vd, vm; | ||
150 | |||
151 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
152 | + return false; | ||
153 | + } | ||
154 | + | ||
155 | /* Vm/M bits must be zero for the Z variant */ | ||
156 | if (a->z && a->vm != 0) { | ||
157 | return false; | ||
158 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
163 | - return false; | ||
164 | - } | ||
165 | - | ||
166 | if (!vfp_access_check(s)) { | ||
167 | return true; | ||
168 | } | ||
169 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) | ||
170 | TCGv_i32 tmp; | ||
171 | TCGv_i64 vd; | ||
172 | |||
173 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
174 | + return false; | ||
175 | + } | ||
176 | + | ||
177 | if (!dc_isar_feature(aa32_fp16_dpconv, s)) { | ||
178 | return false; | ||
179 | } | ||
180 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) | ||
181 | return false; | ||
182 | } | ||
183 | |||
184 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
185 | - return false; | ||
186 | - } | ||
187 | - | ||
188 | if (!vfp_access_check(s)) { | ||
189 | return true; | ||
190 | } | ||
191 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) | ||
192 | TCGv_i32 tmp; | ||
193 | TCGv_i64 vm; | ||
194 | |||
195 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
196 | + return false; | ||
197 | + } | ||
198 | + | ||
199 | if (!dc_isar_feature(aa32_fp16_dpconv, s)) { | ||
200 | return false; | ||
201 | } | ||
202 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) | ||
203 | return false; | ||
204 | } | ||
205 | |||
206 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
207 | - return false; | ||
208 | - } | ||
209 | - | ||
210 | if (!vfp_access_check(s)) { | ||
211 | return true; | ||
212 | } | ||
213 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) | ||
214 | TCGv_ptr fpst; | ||
215 | TCGv_i64 tmp; | ||
216 | |||
217 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
218 | + return false; | ||
219 | + } | ||
220 | + | ||
221 | if (!dc_isar_feature(aa32_vrint, s)) { | ||
222 | return false; | ||
223 | } | ||
224 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) | ||
225 | return false; | ||
226 | } | ||
227 | |||
228 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
229 | - return false; | ||
230 | - } | ||
231 | - | ||
232 | if (!vfp_access_check(s)) { | ||
233 | return true; | ||
234 | } | ||
235 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) | ||
236 | TCGv_i64 tmp; | ||
237 | TCGv_i32 tcg_rmode; | ||
238 | |||
239 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
240 | + return false; | ||
241 | + } | ||
242 | + | ||
243 | if (!dc_isar_feature(aa32_vrint, s)) { | ||
244 | return false; | ||
245 | } | ||
246 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) | ||
247 | return false; | ||
248 | } | ||
249 | |||
250 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
251 | - return false; | ||
252 | - } | ||
253 | - | ||
254 | if (!vfp_access_check(s)) { | ||
255 | return true; | ||
256 | } | ||
257 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) | ||
258 | TCGv_ptr fpst; | ||
259 | TCGv_i64 tmp; | ||
260 | |||
261 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
262 | + return false; | ||
263 | + } | ||
264 | + | ||
265 | if (!dc_isar_feature(aa32_vrint, s)) { | ||
266 | return false; | ||
267 | } | ||
268 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) | ||
269 | return false; | ||
270 | } | ||
271 | |||
272 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
273 | - return false; | ||
274 | - } | ||
275 | - | ||
276 | if (!vfp_access_check(s)) { | ||
277 | return true; | ||
278 | } | ||
279 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) | ||
280 | TCGv_i64 vd; | ||
281 | TCGv_i32 vm; | ||
282 | |||
283 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
284 | - if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
285 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
286 | return false; | ||
287 | } | ||
288 | |||
289 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
290 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
291 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
292 | return false; | ||
293 | } | ||
294 | |||
295 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) | ||
296 | TCGv_i64 vm; | ||
297 | TCGv_i32 vd; | ||
298 | |||
299 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
300 | - if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
301 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
306 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
307 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
308 | return false; | ||
309 | } | ||
310 | |||
311 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) | ||
312 | TCGv_i64 vd; | ||
313 | TCGv_ptr fpst; | ||
314 | |||
315 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
316 | - if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
317 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
318 | return false; | ||
319 | } | ||
320 | |||
321 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
322 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
323 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
324 | return false; | ||
325 | } | ||
326 | |||
327 | @@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) | ||
328 | TCGv_i32 vd; | ||
329 | TCGv_i64 vm; | ||
330 | |||
331 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
332 | + return false; | ||
333 | + } | ||
334 | + | ||
335 | if (!dc_isar_feature(aa32_jscvt, s)) { | ||
336 | return false; | ||
337 | } | ||
338 | @@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) | ||
339 | return false; | ||
340 | } | ||
341 | |||
342 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
343 | - return false; | ||
344 | - } | ||
345 | - | ||
346 | if (!vfp_access_check(s)) { | ||
347 | return true; | ||
348 | } | ||
349 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
350 | TCGv_ptr fpst; | ||
351 | int frac_bits; | ||
352 | |||
353 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
354 | + return false; | ||
355 | + } | ||
356 | + | ||
357 | if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { | ||
358 | return false; | ||
359 | } | ||
360 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
361 | return false; | ||
362 | } | ||
363 | |||
364 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
365 | - return false; | ||
366 | - } | ||
367 | - | ||
368 | if (!vfp_access_check(s)) { | ||
369 | return true; | ||
370 | } | ||
371 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) | ||
372 | TCGv_i64 vm; | ||
373 | TCGv_ptr fpst; | ||
374 | |||
375 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
376 | - if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
377 | + if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
378 | return false; | ||
379 | } | ||
380 | |||
381 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
382 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
383 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
384 | return false; | ||
385 | } | ||
39 | 386 | ||
40 | -- | 387 | -- |
41 | 2.20.1 | 388 | 2.20.1 |
42 | 389 | ||
43 | 390 | diff view generated by jsdifflib |
1 | While we transition the ARMSSE code from integer properties | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | specifying clock frequencies to Clock objects, we want to have the | ||
3 | device provide both at once. We want the final name of the main | ||
4 | input Clock to be "MAINCLK", following the hardware name. | ||
5 | Unfortunately creating an input Clock with a name X creates an | ||
6 | under-the-hood QOM property X; for "MAINCLK" this clashes with the | ||
7 | existing UINT32 property of that name. | ||
8 | 2 | ||
9 | Rename the UINT32 property to MAINCLK_FRQ so it can coexist with the | 3 | Sort this check to the start of a trans_* function. |
10 | MAINCLK Clock; once the transition is complete MAINCLK_FRQ will be | 4 | Merge this with any existing test for fpdp_v2. |
11 | deleted. | ||
12 | 5 | ||
13 | Commit created with: | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | perl -p -i -e 's/MAINCLK/MAINCLK_FRQ/g' hw/arm/{armsse,mps2-tz,musca}.c include/hw/arm/armsse.h | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200224222232.13807-8-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-vfp.inc.c | 24 ++++++++---------------- | ||
12 | 1 file changed, 8 insertions(+), 16 deletions(-) | ||
15 | 13 | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
19 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
20 | Message-id: 20210128114145.20536-11-peter.maydell@linaro.org | ||
21 | Message-id: 20210121190622.22000-11-peter.maydell@linaro.org | ||
22 | --- | ||
23 | include/hw/arm/armsse.h | 2 +- | ||
24 | hw/arm/armsse.c | 6 +++--- | ||
25 | hw/arm/mps2-tz.c | 2 +- | ||
26 | hw/arm/musca.c | 2 +- | ||
27 | 4 files changed, 6 insertions(+), 6 deletions(-) | ||
28 | |||
29 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | ||
30 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/include/hw/arm/armsse.h | 16 | --- a/target/arm/translate-vfp.inc.c |
32 | +++ b/include/hw/arm/armsse.h | 17 | +++ b/target/arm/translate-vfp.inc.c |
33 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) |
34 | * QEMU interface: | 19 | * VFPv2 allows access to FPSID from userspace; VFPv3 restricts |
35 | * + QOM property "memory" is a MemoryRegion containing the devices provided | 20 | * all ID registers to privileged access only. |
36 | * by the board model. | 21 | */ |
37 | - * + QOM property "MAINCLK" is the frequency of the main system clock | 22 | - if (IS_USER(s) && arm_dc_feature(s, ARM_FEATURE_VFP3)) { |
38 | + * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | 23 | + if (IS_USER(s) && dc_isar_feature(aa32_fpsp_v3, s)) { |
39 | * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. | 24 | return false; |
40 | * (In hardware, the SSE-200 permits the number of expansion interrupts | 25 | } |
41 | * for the two CPUs to be configured separately, but we restrict it to | 26 | ignore_vfp_enabled = true; |
42 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) |
43 | index XXXXXXX..XXXXXXX 100644 | 28 | case ARM_VFP_FPINST: |
44 | --- a/hw/arm/armsse.c | 29 | case ARM_VFP_FPINST2: |
45 | +++ b/hw/arm/armsse.c | 30 | /* Not present in VFPv3 */ |
46 | @@ -XXX,XX +XXX,XX @@ static Property iotkit_properties[] = { | 31 | - if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_VFP3)) { |
47 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | 32 | + if (IS_USER(s) || dc_isar_feature(aa32_fpsp_v3, s)) { |
48 | MemoryRegion *), | 33 | return false; |
49 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | 34 | } |
50 | - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), | 35 | break; |
51 | + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | 36 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) |
52 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | 37 | |
53 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | 38 | vd = a->vd; |
54 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), | 39 | |
55 | @@ -XXX,XX +XXX,XX @@ static Property armsse_properties[] = { | 40 | - if (!dc_isar_feature(aa32_fpshvec, s) && |
56 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | 41 | - (veclen != 0 || s->vec_stride != 0)) { |
57 | MemoryRegion *), | 42 | + if (!dc_isar_feature(aa32_fpsp_v3, s)) { |
58 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | 43 | return false; |
59 | - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), | ||
60 | + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | ||
61 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | ||
62 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | ||
63 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), | ||
64 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
65 | } | 44 | } |
66 | 45 | ||
67 | if (!s->mainclk_frq) { | 46 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { |
68 | - error_setg(errp, "MAINCLK property was not set"); | 47 | + if (!dc_isar_feature(aa32_fpshvec, s) && |
69 | + error_setg(errp, "MAINCLK_FRQ property was not set"); | 48 | + (veclen != 0 || s->vec_stride != 0)) { |
70 | return; | 49 | return false; |
71 | } | 50 | } |
72 | 51 | ||
73 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 52 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) |
74 | index XXXXXXX..XXXXXXX 100644 | 53 | |
75 | --- a/hw/arm/mps2-tz.c | 54 | vd = a->vd; |
76 | +++ b/hw/arm/mps2-tz.c | 55 | |
77 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 56 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { |
78 | object_property_set_link(OBJECT(&mms->iotkit), "memory", | 57 | + if (!dc_isar_feature(aa32_fpdp_v3, s)) { |
79 | OBJECT(system_memory), &error_abort); | 58 | return false; |
80 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | 59 | } |
81 | - qdev_prop_set_uint32(iotkitdev, "MAINCLK", SYSCLK_FRQ); | 60 | |
82 | + qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | 61 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) |
83 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | 62 | return false; |
84 | 63 | } | |
85 | /* | 64 | |
86 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | 65 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { |
87 | index XXXXXXX..XXXXXXX 100644 | 66 | - return false; |
88 | --- a/hw/arm/musca.c | 67 | - } |
89 | +++ b/hw/arm/musca.c | 68 | - |
90 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | 69 | if (!vfp_access_check(s)) { |
91 | qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); | 70 | return true; |
92 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | 71 | } |
93 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | 72 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) |
94 | - qdev_prop_set_uint32(ssedev, "MAINCLK", SYSCLK_FRQ); | 73 | TCGv_ptr fpst; |
95 | + qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | 74 | int frac_bits; |
96 | /* | 75 | |
97 | * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for | 76 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { |
98 | * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. | 77 | + if (!dc_isar_feature(aa32_fpsp_v3, s)) { |
78 | return false; | ||
79 | } | ||
80 | |||
81 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
82 | TCGv_ptr fpst; | ||
83 | int frac_bits; | ||
84 | |||
85 | - if (!dc_isar_feature(aa32_fpdp_v2, s)) { | ||
86 | - return false; | ||
87 | - } | ||
88 | - | ||
89 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { | ||
90 | + if (!dc_isar_feature(aa32_fpdp_v3, s)) { | ||
91 | return false; | ||
92 | } | ||
93 | |||
99 | -- | 94 | -- |
100 | 2.20.1 | 95 | 2.20.1 |
101 | 96 | ||
102 | 97 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add objc to the Meson cross file as well as detection of Darwin. | 3 | We will eventually remove the early ARM_FEATURE_VFP test, |
4 | so add a proper test for each trans_* that does not already | ||
5 | have another ISA test. | ||
4 | 6 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Message-id: 20200224222232.13807-9-richard.henderson@linaro.org |
8 | Message-id: 20210126012457.39046-8-j@getutm.app | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | configure | 4 ++++ | 12 | target/arm/translate-vfp.inc.c | 78 ++++++++++++++++++++++++++++++---- |
12 | 1 file changed, 4 insertions(+) | 13 | 1 file changed, 69 insertions(+), 9 deletions(-) |
13 | 14 | ||
14 | diff --git a/configure b/configure | 15 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
15 | index XXXXXXX..XXXXXXX 100755 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/configure | 17 | --- a/target/arm/translate-vfp.inc.c |
17 | +++ b/configure | 18 | +++ b/target/arm/translate-vfp.inc.c |
18 | @@ -XXX,XX +XXX,XX @@ echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross | 19 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) |
19 | echo "[binaries]" >> $cross | 20 | int pass; |
20 | echo "c = [$(meson_quote $cc)]" >> $cross | 21 | uint32_t offset; |
21 | test -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross | 22 | |
22 | +test -n "$objcc" && echo "objc = [$(meson_quote $objcc)]" >> $cross | 23 | + /* SIZE == 2 is a VFP instruction; otherwise NEON. */ |
23 | echo "ar = [$(meson_quote $ar)]" >> $cross | 24 | + if (a->size == 2 |
24 | echo "nm = [$(meson_quote $nm)]" >> $cross | 25 | + ? !dc_isar_feature(aa32_fpsp_v2, s) |
25 | echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross | 26 | + : !arm_dc_feature(s, ARM_FEATURE_NEON)) { |
26 | @@ -XXX,XX +XXX,XX @@ if test "$cross_compile" = "yes"; then | 27 | + return false; |
27 | if test "$linux" = "yes" ; then | 28 | + } |
28 | echo "system = 'linux'" >> $cross | 29 | + |
29 | fi | 30 | /* UNDEF accesses to D16-D31 if they don't exist */ |
30 | + if test "$darwin" = "yes" ; then | 31 | if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) { |
31 | + echo "system = 'darwin'" >> $cross | 32 | return false; |
32 | + fi | 33 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) |
33 | case "$ARCH" in | 34 | pass = extract32(offset, 2, 1); |
34 | i386|x86_64) | 35 | offset = extract32(offset, 0, 2) * 8; |
35 | echo "cpu_family = 'x86'" >> $cross | 36 | |
37 | - if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
38 | - return false; | ||
39 | - } | ||
40 | - | ||
41 | if (!vfp_access_check(s)) { | ||
42 | return true; | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a) | ||
45 | int pass; | ||
46 | uint32_t offset; | ||
47 | |||
48 | + /* SIZE == 2 is a VFP instruction; otherwise NEON. */ | ||
49 | + if (a->size == 2 | ||
50 | + ? !dc_isar_feature(aa32_fpsp_v2, s) | ||
51 | + : !arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
52 | + return false; | ||
53 | + } | ||
54 | + | ||
55 | /* UNDEF accesses to D16-D31 if they don't exist */ | ||
56 | if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) { | ||
57 | return false; | ||
58 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a) | ||
59 | pass = extract32(offset, 2, 1); | ||
60 | offset = extract32(offset, 0, 2) * 8; | ||
61 | |||
62 | - if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
63 | - return false; | ||
64 | - } | ||
65 | - | ||
66 | if (!vfp_access_check(s)) { | ||
67 | return true; | ||
68 | } | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) | ||
70 | TCGv_i32 tmp; | ||
71 | bool ignore_vfp_enabled = false; | ||
72 | |||
73 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
74 | + return false; | ||
75 | + } | ||
76 | + | ||
77 | if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
78 | /* | ||
79 | * The only M-profile VFP vmrs/vmsr sysreg is FPSCR. | ||
80 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a) | ||
81 | { | ||
82 | TCGv_i32 tmp; | ||
83 | |||
84 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
85 | + return false; | ||
86 | + } | ||
87 | + | ||
88 | if (!vfp_access_check(s)) { | ||
89 | return true; | ||
90 | } | ||
91 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a) | ||
92 | { | ||
93 | TCGv_i32 tmp; | ||
94 | |||
95 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
96 | + return false; | ||
97 | + } | ||
98 | + | ||
99 | /* | ||
100 | * VMOV between two general-purpose registers and two single precision | ||
101 | * floating point registers | ||
102 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_dp *a) | ||
103 | |||
104 | /* | ||
105 | * VMOV between two general-purpose registers and one double precision | ||
106 | - * floating point register | ||
107 | + * floating point register. Note that this does not require support | ||
108 | + * for double precision arithmetic. | ||
109 | */ | ||
110 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
111 | + return false; | ||
112 | + } | ||
113 | |||
114 | /* UNDEF accesses to D16-D31 if they don't exist */ | ||
115 | if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { | ||
116 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) | ||
117 | uint32_t offset; | ||
118 | TCGv_i32 addr, tmp; | ||
119 | |||
120 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
121 | + return false; | ||
122 | + } | ||
123 | + | ||
124 | if (!vfp_access_check(s)) { | ||
125 | return true; | ||
126 | } | ||
127 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a) | ||
128 | TCGv_i32 addr; | ||
129 | TCGv_i64 tmp; | ||
130 | |||
131 | + /* Note that this does not require support for double arithmetic. */ | ||
132 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
133 | + return false; | ||
134 | + } | ||
135 | + | ||
136 | /* UNDEF accesses to D16-D31 if they don't exist */ | ||
137 | if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
138 | return false; | ||
139 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | ||
140 | TCGv_i32 addr, tmp; | ||
141 | int i, n; | ||
142 | |||
143 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
144 | + return false; | ||
145 | + } | ||
146 | + | ||
147 | n = a->imm; | ||
148 | |||
149 | if (n == 0 || (a->vd + n) > 32) { | ||
150 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
151 | TCGv_i64 tmp; | ||
152 | int i, n; | ||
153 | |||
154 | + /* Note that this does not require support for double arithmetic. */ | ||
155 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
156 | + return false; | ||
157 | + } | ||
158 | + | ||
159 | n = a->imm >> 1; | ||
160 | |||
161 | if (n == 0 || (a->vd + n) > 32 || n > 16) { | ||
162 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, | ||
163 | TCGv_i32 f0, f1, fd; | ||
164 | TCGv_ptr fpst; | ||
165 | |||
166 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
167 | + return false; | ||
168 | + } | ||
169 | + | ||
170 | if (!dc_isar_feature(aa32_fpshvec, s) && | ||
171 | (veclen != 0 || s->vec_stride != 0)) { | ||
172 | return false; | ||
173 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) | ||
174 | int veclen = s->vec_len; | ||
175 | TCGv_i32 f0, fd; | ||
176 | |||
177 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
178 | + return false; | ||
179 | + } | ||
180 | + | ||
181 | if (!dc_isar_feature(aa32_fpshvec, s) && | ||
182 | (veclen != 0 || s->vec_stride != 0)) { | ||
183 | return false; | ||
184 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a) | ||
185 | { | ||
186 | TCGv_i32 vd, vm; | ||
187 | |||
188 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
189 | + return false; | ||
190 | + } | ||
191 | + | ||
192 | /* Vm/M bits must be zero for the Z variant */ | ||
193 | if (a->z && a->vm != 0) { | ||
194 | return false; | ||
195 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) | ||
196 | TCGv_i32 vm; | ||
197 | TCGv_ptr fpst; | ||
198 | |||
199 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
200 | + return false; | ||
201 | + } | ||
202 | + | ||
203 | if (!vfp_access_check(s)) { | ||
204 | return true; | ||
205 | } | ||
206 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) | ||
207 | TCGv_i32 vm; | ||
208 | TCGv_ptr fpst; | ||
209 | |||
210 | + if (!dc_isar_feature(aa32_fpsp_v2, s)) { | ||
211 | + return false; | ||
212 | + } | ||
213 | + | ||
214 | if (!vfp_access_check(s)) { | ||
215 | return true; | ||
216 | } | ||
36 | -- | 217 | -- |
37 | 2.20.1 | 218 | 2.20.1 |
38 | 219 | ||
39 | 220 | diff view generated by jsdifflib |
1 | Use the MAINCLK Clock input to set the system_clock_scale variable | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | rather than using the mainclk_frq property. | ||
3 | 2 | ||
3 | All remaining tests for VFP4 are for fused multiply-add insns. | ||
4 | |||
5 | Since the MVFR1 field is used for both VFP and NEON, move its adjustment | ||
6 | from the !has_neon block to the (!has_vfp && !has_neon) block. | ||
7 | |||
8 | Test for vfp of the appropraite width alongside the test for simdfmac | ||
9 | within translate-vfp.inc.c. Within disas_neon_data_insn, we have | ||
10 | already tested for ARM_FEATURE_NEON. | ||
11 | |||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Message-id: 20200224222232.13807-10-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Message-id: 20210128114145.20536-23-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-23-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | hw/arm/armsse.c | 24 +++++++++++++++++++----- | 17 | target/arm/cpu.h | 12 ++++++++++++ |
12 | 1 file changed, 19 insertions(+), 5 deletions(-) | 18 | target/arm/cpu.c | 6 +++++- |
19 | target/arm/translate-vfp.inc.c | 22 ++++++++++++++++++---- | ||
20 | target/arm/translate.c | 2 +- | ||
21 | 4 files changed, 36 insertions(+), 6 deletions(-) | ||
13 | 22 | ||
14 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 23 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/armsse.c | 25 | --- a/target/arm/cpu.h |
17 | +++ b/hw/arm/armsse.c | 26 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ static void armsse_forward_sec_resp_cfg(ARMSSE *s) | 27 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) |
19 | qdev_connect_gpio_out(dev_splitter, 2, s->sec_resp_cfg_in); | 28 | return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; |
20 | } | 29 | } |
21 | 30 | ||
22 | +static void armsse_mainclk_update(void *opaque) | 31 | +/* |
32 | + * Note that this ID register field covers both VFP and Neon FMAC, | ||
33 | + * so should usually be tested in combination with some other | ||
34 | + * check that confirms the presence of whichever of VFP or Neon is | ||
35 | + * relevant, to avoid accidentally enabling a Neon feature on | ||
36 | + * a VFP-no-Neon core or vice-versa. | ||
37 | + */ | ||
38 | +static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) | ||
23 | +{ | 39 | +{ |
24 | + ARMSSE *s = ARM_SSE(opaque); | 40 | + return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; |
25 | + /* | ||
26 | + * Set system_clock_scale from our Clock input; this is what | ||
27 | + * controls the tick rate of the CPU SysTick timer. | ||
28 | + */ | ||
29 | + system_clock_scale = clock_ticks_to_ns(s->mainclk, 1); | ||
30 | +} | 41 | +} |
31 | + | 42 | + |
32 | static void armsse_init(Object *obj) | 43 | static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) |
33 | { | 44 | { |
34 | ARMSSE *s = ARM_SSE(obj); | 45 | return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; |
35 | @@ -XXX,XX +XXX,XX @@ static void armsse_init(Object *obj) | 46 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
36 | assert(info->sram_banks <= MAX_SRAM_BANKS); | 47 | index XXXXXXX..XXXXXXX 100644 |
37 | assert(info->num_cpus <= SSE_MAX_CPUS); | 48 | --- a/target/arm/cpu.c |
38 | 49 | +++ b/target/arm/cpu.c | |
39 | - s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); | 50 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) |
40 | + s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", | 51 | u = FIELD_DP32(u, MVFR1, SIMDINT, 0); |
41 | + armsse_mainclk_update, s); | 52 | u = FIELD_DP32(u, MVFR1, SIMDSP, 0); |
42 | s->s32kclk = qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); | 53 | u = FIELD_DP32(u, MVFR1, SIMDHP, 0); |
43 | 54 | - u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0); | |
44 | memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); | 55 | cpu->isar.mvfr1 = u; |
45 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 56 | |
46 | return; | 57 | u = cpu->isar.mvfr2; |
58 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
59 | u = cpu->isar.mvfr0; | ||
60 | u = FIELD_DP32(u, MVFR0, SIMDREG, 0); | ||
61 | cpu->isar.mvfr0 = u; | ||
62 | + | ||
63 | + /* Despite the name, this field covers both VFP and Neon */ | ||
64 | + u = cpu->isar.mvfr1; | ||
65 | + u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0); | ||
66 | + cpu->isar.mvfr1 = u; | ||
47 | } | 67 | } |
48 | 68 | ||
49 | - if (!s->mainclk_frq) { | 69 | if (arm_feature(env, ARM_FEATURE_M) && !cpu->has_dsp) { |
50 | - error_setg(errp, "MAINCLK_FRQ property was not set"); | 70 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
51 | - return; | 71 | index XXXXXXX..XXXXXXX 100644 |
52 | + if (!clock_has_source(s->mainclk)) { | 72 | --- a/target/arm/translate-vfp.inc.c |
53 | + error_setg(errp, "MAINCLK clock was not connected"); | 73 | +++ b/target/arm/translate-vfp.inc.c |
74 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) | ||
75 | |||
76 | /* | ||
77 | * Present in VFPv4 only. | ||
78 | + * Note that we can't rely on the SIMDFMAC check alone, because | ||
79 | + * in a Neon-no-VFP core that ID register field will be non-zero. | ||
80 | + */ | ||
81 | + if (!dc_isar_feature(aa32_simdfmac, s) || | ||
82 | + !dc_isar_feature(aa32_fpsp_v2, s)) { | ||
83 | + return false; | ||
54 | + } | 84 | + } |
55 | + if (!clock_has_source(s->s32kclk)) { | 85 | + /* |
56 | + error_setg(errp, "S32KCLK clock was not connected"); | 86 | * In v7A, UNPREDICTABLE with non-zero vector length/stride; from |
87 | * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. | ||
88 | */ | ||
89 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || | ||
90 | - (s->vec_len != 0 || s->vec_stride != 0)) { | ||
91 | + if (s->vec_len != 0 || s->vec_stride != 0) { | ||
92 | return false; | ||
57 | } | 93 | } |
58 | 94 | ||
59 | assert(info->num_cpus <= SSE_MAX_CPUS); | 95 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) |
60 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 96 | |
97 | /* | ||
98 | * Present in VFPv4 only. | ||
99 | + * Note that we can't rely on the SIMDFMAC check alone, because | ||
100 | + * in a Neon-no-VFP core that ID register field will be non-zero. | ||
101 | + */ | ||
102 | + if (!dc_isar_feature(aa32_simdfmac, s) || | ||
103 | + !dc_isar_feature(aa32_fpdp_v2, s)) { | ||
104 | + return false; | ||
105 | + } | ||
106 | + /* | ||
107 | * In v7A, UNPREDICTABLE with non-zero vector length/stride; from | ||
108 | * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. | ||
61 | */ | 109 | */ |
62 | sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container); | 110 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || |
63 | 111 | - (s->vec_len != 0 || s->vec_stride != 0)) { | |
64 | - system_clock_scale = NANOSECONDS_PER_SECOND / s->mainclk_frq; | 112 | + if (s->vec_len != 0 || s->vec_stride != 0) { |
65 | + /* Set initial system_clock_scale from MAINCLK */ | 113 | return false; |
66 | + armsse_mainclk_update(s); | 114 | } |
67 | } | 115 | |
68 | 116 | diff --git a/target/arm/translate.c b/target/arm/translate.c | |
69 | static void armsse_idau_check(IDAUInterface *ii, uint32_t address, | 117 | index XXXXXXX..XXXXXXX 100644 |
118 | --- a/target/arm/translate.c | ||
119 | +++ b/target/arm/translate.c | ||
120 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
121 | } | ||
122 | break; | ||
123 | case NEON_3R_VFM_VQRDMLSH: | ||
124 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP4)) { | ||
125 | + if (!dc_isar_feature(aa32_simdfmac, s)) { | ||
126 | return 1; | ||
127 | } | ||
128 | break; | ||
70 | -- | 129 | -- |
71 | 2.20.1 | 130 | 2.20.1 |
72 | 131 | ||
73 | 132 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | A workaround added in early days of 64-bit OSX forced x86_64 if the | 3 | We now have proper ISA checks within each trans_* function. |
4 | host machine had 64-bit support. This creates issues when cross- | ||
5 | compiling for ARM64. Additionally, the user can always use --cpu=* to | ||
6 | manually set the host CPU and therefore this workaround should be | ||
7 | removed. | ||
8 | 4 | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 20210126012457.39046-12-j@getutm.app | 7 | Message-id: 20200224222232.13807-11-richard.henderson@linaro.org |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 9 | --- |
14 | configure | 11 ----------- | 10 | target/arm/translate.c | 4 ---- |
15 | 1 file changed, 11 deletions(-) | 11 | 1 file changed, 4 deletions(-) |
16 | 12 | ||
17 | diff --git a/configure b/configure | 13 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
18 | index XXXXXXX..XXXXXXX 100755 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/configure | 15 | --- a/target/arm/translate.c |
20 | +++ b/configure | 16 | +++ b/target/arm/translate.c |
21 | @@ -XXX,XX +XXX,XX @@ fi | 17 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var) |
22 | # the correct CPU with the --cpu option. | 18 | */ |
23 | case $targetos in | 19 | static int disas_vfp_insn(DisasContext *s, uint32_t insn) |
24 | Darwin) | 20 | { |
25 | - # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | 21 | - if (!arm_dc_feature(s, ARM_FEATURE_VFP)) { |
26 | - # run 64-bit userspace code. | 22 | - return 1; |
27 | - # If the user didn't specify a CPU explicitly and the kernel says this is | 23 | - } |
28 | - # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | 24 | - |
29 | - if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | 25 | /* |
30 | - cpu="x86_64" | 26 | * If the decodetree decoder handles this insn it will always |
31 | - fi | 27 | * emit code to either execute the insn or generate an appropriate |
32 | HOST_DSOSUF=".dylib" | ||
33 | ;; | ||
34 | SunOS) | ||
35 | @@ -XXX,XX +XXX,XX @@ OpenBSD) | ||
36 | Darwin) | ||
37 | bsd="yes" | ||
38 | darwin="yes" | ||
39 | - if [ "$cpu" = "x86_64" ] ; then | ||
40 | - QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" | ||
41 | - QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" | ||
42 | - fi | ||
43 | audio_drv_list="try-coreaudio try-sdl" | ||
44 | audio_possible_drivers="coreaudio sdl" | ||
45 | # Disable attempts to use ObjectiveC features in os/object.h since they | ||
46 | -- | 28 | -- |
47 | 2.20.1 | 29 | 2.20.1 |
48 | 30 | ||
49 | 31 | diff view generated by jsdifflib |
1 | The old-style convenience function cmsdk_apb_timer_create() for | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | creating CMSDK_APB_TIMER objects is used in only two places in | ||
3 | mps2.c. Most of the rest of the code in that file uses the new | ||
4 | "initialize in place" coding style. | ||
5 | 2 | ||
6 | We want to connect up a Clock object which should be done between the | 3 | Now that we no longer have an early check for ARM_FEATURE_VFP, |
7 | object creation and realization; rather than adding a Clock* argument | 4 | we can use the proper ISA check in trans_VLLDM_VLSTM. |
8 | to the convenience function, convert the timer creation code in | ||
9 | mps2.c to the same style as is used already for the watchdog, | ||
10 | dualtimer and other devices, and delete the now-unused convenience | ||
11 | function. | ||
12 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20200224222232.13807-12-richard.henderson@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
16 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20210128114145.20536-13-peter.maydell@linaro.org | ||
18 | Message-id: 20210121190622.22000-13-peter.maydell@linaro.org | ||
19 | --- | 10 | --- |
20 | include/hw/timer/cmsdk-apb-timer.h | 21 --------------------- | 11 | target/arm/translate-vfp.inc.c | 39 +++++++++++++++++++++++++ |
21 | hw/arm/mps2.c | 18 ++++++++++++++++-- | 12 | target/arm/translate.c | 53 ++++++---------------------------- |
22 | 2 files changed, 16 insertions(+), 23 deletions(-) | 13 | target/arm/vfp.decode | 2 ++ |
14 | 3 files changed, 50 insertions(+), 44 deletions(-) | ||
23 | 15 | ||
24 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | 16 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
25 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/timer/cmsdk-apb-timer.h | 18 | --- a/target/arm/translate-vfp.inc.c |
27 | +++ b/include/hw/timer/cmsdk-apb-timer.h | 19 | +++ b/target/arm/translate-vfp.inc.c |
28 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | 20 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) |
29 | uint32_t intstatus; | 21 | tcg_temp_free_ptr(fpst); |
30 | }; | 22 | return true; |
31 | 23 | } | |
32 | -/** | ||
33 | - * cmsdk_apb_timer_create - convenience function to create TYPE_CMSDK_APB_TIMER | ||
34 | - * @addr: location in system memory to map registers | ||
35 | - * @pclk_frq: frequency in Hz of the PCLK clock (used for calculating baud rate) | ||
36 | - */ | ||
37 | -static inline DeviceState *cmsdk_apb_timer_create(hwaddr addr, | ||
38 | - qemu_irq timerint, | ||
39 | - uint32_t pclk_frq) | ||
40 | -{ | ||
41 | - DeviceState *dev; | ||
42 | - SysBusDevice *s; | ||
43 | - | ||
44 | - dev = qdev_new(TYPE_CMSDK_APB_TIMER); | ||
45 | - s = SYS_BUS_DEVICE(dev); | ||
46 | - qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq); | ||
47 | - sysbus_realize_and_unref(s, &error_fatal); | ||
48 | - sysbus_mmio_map(s, 0, addr); | ||
49 | - sysbus_connect_irq(s, 0, timerint); | ||
50 | - return dev; | ||
51 | -} | ||
52 | - | ||
53 | #endif | ||
54 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/hw/arm/mps2.c | ||
57 | +++ b/hw/arm/mps2.c | ||
58 | @@ -XXX,XX +XXX,XX @@ struct MPS2MachineState { | ||
59 | /* CMSDK APB subsystem */ | ||
60 | CMSDKAPBDualTimer dualtimer; | ||
61 | CMSDKAPBWatchdog watchdog; | ||
62 | + CMSDKAPBTimer timer[2]; | ||
63 | }; | ||
64 | |||
65 | #define TYPE_MPS2_MACHINE "mps2" | ||
66 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
67 | } | ||
68 | |||
69 | /* CMSDK APB subsystem */ | ||
70 | - cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ); | ||
71 | - cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ); | ||
72 | + for (i = 0; i < ARRAY_SIZE(mms->timer); i++) { | ||
73 | + g_autofree char *name = g_strdup_printf("timer%d", i); | ||
74 | + hwaddr base = 0x40000000 + i * 0x1000; | ||
75 | + int irqno = 8 + i; | ||
76 | + SysBusDevice *sbd; | ||
77 | + | 24 | + |
78 | + object_initialize_child(OBJECT(mms), name, &mms->timer[i], | 25 | +/* |
79 | + TYPE_CMSDK_APB_TIMER); | 26 | + * Decode VLLDM and VLSTM are nonstandard because: |
80 | + sbd = SYS_BUS_DEVICE(&mms->timer[i]); | 27 | + * * if there is no FPU then these insns must NOP in |
81 | + qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | 28 | + * Secure state and UNDEF in Nonsecure state |
82 | + sysbus_realize_and_unref(sbd, &error_fatal); | 29 | + * * if there is an FPU then these insns do not have |
83 | + sysbus_mmio_map(sbd, 0, base); | 30 | + * the usual behaviour that vfp_access_check() provides of |
84 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); | 31 | + * being controlled by CPACR/NSACR enable bits or the |
32 | + * lazy-stacking logic. | ||
33 | + */ | ||
34 | +static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a) | ||
35 | +{ | ||
36 | + TCGv_i32 fptr; | ||
37 | + | ||
38 | + if (!arm_dc_feature(s, ARM_FEATURE_M) || | ||
39 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + /* If not secure, UNDEF. */ | ||
43 | + if (!s->v8m_secure) { | ||
44 | + return false; | ||
45 | + } | ||
46 | + /* If no fpu, NOP. */ | ||
47 | + if (!dc_isar_feature(aa32_vfp, s)) { | ||
48 | + return true; | ||
85 | + } | 49 | + } |
86 | + | 50 | + |
87 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | 51 | + fptr = load_reg(s, a->rn); |
88 | TYPE_CMSDK_APB_DUALTIMER); | 52 | + if (a->l) { |
89 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | 53 | + gen_helper_v7m_vlldm(cpu_env, fptr); |
54 | + } else { | ||
55 | + gen_helper_v7m_vlstm(cpu_env, fptr); | ||
56 | + } | ||
57 | + tcg_temp_free_i32(fptr); | ||
58 | + | ||
59 | + /* End the TB, because we have updated FP control bits */ | ||
60 | + s->base.is_jmp = DISAS_UPDATE; | ||
61 | + return true; | ||
62 | +} | ||
63 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/target/arm/translate.c | ||
66 | +++ b/target/arm/translate.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
68 | goto illegal_op; /* op0 = 0b11 : unallocated */ | ||
69 | } | ||
70 | |||
71 | - /* | ||
72 | - * Decode VLLDM and VLSTM first: these are nonstandard because: | ||
73 | - * * if there is no FPU then these insns must NOP in | ||
74 | - * Secure state and UNDEF in Nonsecure state | ||
75 | - * * if there is an FPU then these insns do not have | ||
76 | - * the usual behaviour that disas_vfp_insn() provides of | ||
77 | - * being controlled by CPACR/NSACR enable bits or the | ||
78 | - * lazy-stacking logic. | ||
79 | - */ | ||
80 | - if (arm_dc_feature(s, ARM_FEATURE_V8) && | ||
81 | - (insn & 0xffa00f00) == 0xec200a00) { | ||
82 | - /* 0b1110_1100_0x1x_xxxx_xxxx_1010_xxxx_xxxx | ||
83 | - * - VLLDM, VLSTM | ||
84 | - * We choose to UNDEF if the RAZ bits are non-zero. | ||
85 | - */ | ||
86 | - if (!s->v8m_secure || (insn & 0x0040f0ff)) { | ||
87 | + if (disas_vfp_insn(s, insn)) { | ||
88 | + if (((insn >> 8) & 0xe) == 10 && | ||
89 | + dc_isar_feature(aa32_fpsp_v2, s)) { | ||
90 | + /* FP, and the CPU supports it */ | ||
91 | goto illegal_op; | ||
92 | + } else { | ||
93 | + /* All other insns: NOCP */ | ||
94 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
95 | + syn_uncategorized(), | ||
96 | + default_exception_el(s)); | ||
97 | } | ||
98 | - | ||
99 | - if (arm_dc_feature(s, ARM_FEATURE_VFP)) { | ||
100 | - uint32_t rn = (insn >> 16) & 0xf; | ||
101 | - TCGv_i32 fptr = load_reg(s, rn); | ||
102 | - | ||
103 | - if (extract32(insn, 20, 1)) { | ||
104 | - gen_helper_v7m_vlldm(cpu_env, fptr); | ||
105 | - } else { | ||
106 | - gen_helper_v7m_vlstm(cpu_env, fptr); | ||
107 | - } | ||
108 | - tcg_temp_free_i32(fptr); | ||
109 | - | ||
110 | - /* End the TB, because we have updated FP control bits */ | ||
111 | - s->base.is_jmp = DISAS_UPDATE; | ||
112 | - } | ||
113 | - break; | ||
114 | } | ||
115 | - if (arm_dc_feature(s, ARM_FEATURE_VFP) && | ||
116 | - ((insn >> 8) & 0xe) == 10) { | ||
117 | - /* FP, and the CPU supports it */ | ||
118 | - if (disas_vfp_insn(s, insn)) { | ||
119 | - goto illegal_op; | ||
120 | - } | ||
121 | - break; | ||
122 | - } | ||
123 | - | ||
124 | - /* All other insns: NOCP */ | ||
125 | - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized(), | ||
126 | - default_exception_el(s)); | ||
127 | break; | ||
128 | } | ||
129 | if ((insn & 0xfe000a00) == 0xfc000800 | ||
130 | diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode | ||
131 | index XXXXXXX..XXXXXXX 100644 | ||
132 | --- a/target/arm/vfp.decode | ||
133 | +++ b/target/arm/vfp.decode | ||
134 | @@ -XXX,XX +XXX,XX @@ VCVT_sp_int ---- 1110 1.11 110 s:1 .... 1010 rz:1 1.0 .... \ | ||
135 | vd=%vd_sp vm=%vm_sp | ||
136 | VCVT_dp_int ---- 1110 1.11 110 s:1 .... 1011 rz:1 1.0 .... \ | ||
137 | vd=%vd_sp vm=%vm_dp | ||
138 | + | ||
139 | +VLLDM_VLSTM 1110 1100 001 l:1 rn:4 0000 1010 0000 0000 | ||
90 | -- | 140 | -- |
91 | 2.20.1 | 141 | 2.20.1 |
92 | 142 | ||
93 | 143 | diff view generated by jsdifflib |
1 | Create two input clocks on the ARMSSE devices, one for the normal | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | MAINCLK, and one for the 32KHz S32KCLK, and wire these up to the | ||
3 | appropriate devices. The old property-based clock frequency setting | ||
4 | will remain in place until conversion is complete. | ||
5 | 2 | ||
6 | This is a migration compatibility break for machines mps2-an505, | 3 | Have the calls adjacent as an intermediate step toward |
7 | mps2-an521, musca-a, musca-b1. | 4 | actually merging the decodes. |
8 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20200224222232.13807-13-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
12 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20210128114145.20536-12-peter.maydell@linaro.org | ||
14 | Message-id: 20210121190622.22000-12-peter.maydell@linaro.org | ||
15 | --- | 10 | --- |
16 | include/hw/arm/armsse.h | 6 ++++++ | 11 | target/arm/translate.c | 83 +++++++++++++++--------------------------- |
17 | hw/arm/armsse.c | 17 +++++++++++++++-- | 12 | 1 file changed, 29 insertions(+), 54 deletions(-) |
18 | 2 files changed, 21 insertions(+), 2 deletions(-) | ||
19 | 13 | ||
20 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/arm/armsse.h | 16 | --- a/target/arm/translate.c |
23 | +++ b/include/hw/arm/armsse.h | 17 | +++ b/target/arm/translate.c |
24 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var) |
25 | * per-CPU identity and control register blocks | 19 | tcg_temp_free_i32(tmp); |
26 | * | 20 | } |
27 | * QEMU interface: | 21 | |
28 | + * + Clock input "MAINCLK": clock for CPUs and most peripherals | 22 | -/* |
29 | + * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals | 23 | - * Disassemble a VFP instruction. Returns nonzero if an error occurred |
30 | * + QOM property "memory" is a MemoryRegion containing the devices provided | 24 | - * (ie. an undefined instruction). |
31 | * by the board model. | 25 | - */ |
32 | * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | 26 | -static int disas_vfp_insn(DisasContext *s, uint32_t insn) |
33 | @@ -XXX,XX +XXX,XX @@ | 27 | -{ |
34 | #include "hw/misc/armsse-mhu.h" | 28 | - /* |
35 | #include "hw/misc/unimp.h" | 29 | - * If the decodetree decoder handles this insn it will always |
36 | #include "hw/or-irq.h" | 30 | - * emit code to either execute the insn or generate an appropriate |
37 | +#include "hw/clock.h" | 31 | - * exception; so we don't need to ever return non-zero to tell |
38 | #include "hw/core/split-irq.h" | 32 | - * the calling code to emit an UNDEF exception. |
39 | #include "hw/cpu/cluster.h" | 33 | - */ |
40 | #include "qom/object.h" | 34 | - if (extract32(insn, 28, 4) == 0xf) { |
41 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | 35 | - if (disas_vfp_uncond(s, insn)) { |
42 | 36 | - return 0; | |
43 | uint32_t nsccfg; | 37 | - } |
44 | 38 | - } else { | |
45 | + Clock *mainclk; | 39 | - if (disas_vfp(s, insn)) { |
46 | + Clock *s32kclk; | 40 | - return 0; |
47 | + | 41 | - } |
48 | /* Properties */ | 42 | - } |
49 | MemoryRegion *board_memory; | 43 | - /* If the decodetree decoder didn't handle this insn, it must be UNDEF */ |
50 | uint32_t exp_numirq; | 44 | - return 1; |
51 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 45 | -} |
52 | index XXXXXXX..XXXXXXX 100644 | 46 | - |
53 | --- a/hw/arm/armsse.c | 47 | static inline bool use_goto_tb(DisasContext *s, target_ulong dest) |
54 | +++ b/hw/arm/armsse.c | 48 | { |
55 | @@ -XXX,XX +XXX,XX @@ | 49 | #ifndef CONFIG_USER_ONLY |
56 | #include "hw/arm/armsse.h" | 50 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
57 | #include "hw/arm/boot.h" | 51 | ARCH(5); |
58 | #include "hw/irq.h" | 52 | |
59 | +#include "hw/qdev-clock.h" | 53 | /* Unconditional instructions. */ |
60 | 54 | - if (disas_a32_uncond(s, insn)) { | |
61 | /* Format of the System Information block SYS_CONFIG register */ | 55 | + /* TODO: Perhaps merge these into one decodetree output file. */ |
62 | typedef enum SysConfigFormat { | 56 | + if (disas_a32_uncond(s, insn) || |
63 | @@ -XXX,XX +XXX,XX @@ static void armsse_init(Object *obj) | 57 | + disas_vfp_uncond(s, insn)) { |
64 | assert(info->sram_banks <= MAX_SRAM_BANKS); | 58 | return; |
65 | assert(info->num_cpus <= SSE_MAX_CPUS); | 59 | } |
66 | 60 | /* fall back to legacy decoder */ | |
67 | + s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); | 61 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
68 | + s->s32kclk = qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); | 62 | } |
69 | + | 63 | return; |
70 | memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); | 64 | } |
71 | 65 | - if ((insn & 0x0f000e10) == 0x0e000a00) { | |
72 | for (i = 0; i < info->num_cpus; i++) { | 66 | - /* VFP. */ |
73 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 67 | - if (disas_vfp_insn(s, insn)) { |
74 | * map its upstream ends to the right place in the container. | 68 | - goto illegal_op; |
75 | */ | 69 | - } |
76 | qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); | 70 | - return; |
77 | + qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); | 71 | - } |
78 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { | 72 | if ((insn & 0x0e000f00) == 0x0c000100) { |
73 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { | ||
74 | /* iWMMXt register transfer. */ | ||
75 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
76 | arm_skip_unless(s, cond); | ||
77 | } | ||
78 | |||
79 | - if (disas_a32(s, insn)) { | ||
80 | + /* TODO: Perhaps merge these into one decodetree output file. */ | ||
81 | + if (disas_a32(s, insn) || | ||
82 | + disas_vfp(s, insn)) { | ||
79 | return; | 83 | return; |
80 | } | 84 | } |
81 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 85 | /* fall back to legacy decoder */ |
82 | &error_abort); | 86 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
83 | 87 | case 0xd: | |
84 | qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); | 88 | case 0xe: |
85 | + qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); | 89 | if (((insn >> 8) & 0xe) == 10) { |
86 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { | 90 | - /* VFP. */ |
91 | - if (disas_vfp_insn(s, insn)) { | ||
92 | - goto illegal_op; | ||
93 | - } | ||
94 | - } else if (disas_coproc_insn(s, insn)) { | ||
95 | + /* VFP, but failed disas_vfp. */ | ||
96 | + goto illegal_op; | ||
97 | + } | ||
98 | + if (disas_coproc_insn(s, insn)) { | ||
99 | /* Coprocessor. */ | ||
100 | goto illegal_op; | ||
101 | } | ||
102 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
103 | ARCH(6T2); | ||
104 | } | ||
105 | |||
106 | - if (disas_t32(s, insn)) { | ||
107 | + /* | ||
108 | + * TODO: Perhaps merge these into one decodetree output file. | ||
109 | + * Note disas_vfp is written for a32 with cond field in the | ||
110 | + * top nibble. The t32 encoding requires 0xe in the top nibble. | ||
111 | + */ | ||
112 | + if (disas_t32(s, insn) || | ||
113 | + disas_vfp_uncond(s, insn) || | ||
114 | + ((insn >> 28) == 0xe && disas_vfp(s, insn))) { | ||
87 | return; | 115 | return; |
88 | } | 116 | } |
89 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 117 | /* fall back to legacy decoder */ |
90 | &error_abort); | 118 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) |
91 | 119 | goto illegal_op; /* op0 = 0b11 : unallocated */ | |
92 | qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq); | 120 | } |
93 | + qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); | 121 | |
94 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { | 122 | - if (disas_vfp_insn(s, insn)) { |
95 | return; | 123 | - if (((insn >> 8) & 0xe) == 10 && |
96 | } | 124 | - dc_isar_feature(aa32_fpsp_v2, s)) { |
97 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 125 | - /* FP, and the CPU supports it */ |
98 | * 0x4002f000: S32K timer | 126 | - goto illegal_op; |
99 | */ | 127 | - } else { |
100 | qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); | 128 | - /* All other insns: NOCP */ |
101 | + qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); | 129 | - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, |
102 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { | 130 | - syn_uncategorized(), |
103 | return; | 131 | - default_exception_el(s)); |
104 | } | 132 | - } |
105 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 133 | + if (((insn >> 8) & 0xe) == 10 && |
106 | qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI", 0)); | 134 | + dc_isar_feature(aa32_fpsp_v2, s)) { |
107 | 135 | + /* FP, and the CPU supports it */ | |
108 | qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); | 136 | + goto illegal_op; |
109 | + qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); | 137 | + } else { |
110 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { | 138 | + /* All other insns: NOCP */ |
111 | return; | 139 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, |
112 | } | 140 | + syn_uncategorized(), |
113 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 141 | + default_exception_el(s)); |
114 | /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ | 142 | } |
115 | 143 | break; | |
116 | qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk_frq); | 144 | } |
117 | + qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); | 145 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) |
118 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { | 146 | goto illegal_op; |
119 | return; | 147 | } |
120 | } | 148 | } else if (((insn >> 8) & 0xe) == 10) { |
121 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 149 | - if (disas_vfp_insn(s, insn)) { |
122 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); | 150 | - goto illegal_op; |
123 | 151 | - } | |
124 | qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_frq); | 152 | + /* VFP, but failed disas_vfp. */ |
125 | + qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); | 153 | + goto illegal_op; |
126 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { | 154 | } else { |
127 | return; | 155 | if (insn & (1 << 28)) |
128 | } | 156 | goto illegal_op; |
129 | @@ -XXX,XX +XXX,XX @@ static void armsse_idau_check(IDAUInterface *ii, uint32_t address, | ||
130 | |||
131 | static const VMStateDescription armsse_vmstate = { | ||
132 | .name = "iotkit", | ||
133 | - .version_id = 1, | ||
134 | - .minimum_version_id = 1, | ||
135 | + .version_id = 2, | ||
136 | + .minimum_version_id = 2, | ||
137 | .fields = (VMStateField[]) { | ||
138 | + VMSTATE_CLOCK(mainclk, ARMSSE), | ||
139 | + VMSTATE_CLOCK(s32kclk, ARMSSE), | ||
140 | VMSTATE_UINT32(nsccfg, ARMSSE), | ||
141 | VMSTATE_END_OF_LIST() | ||
142 | } | ||
143 | -- | 157 | -- |
144 | 2.20.1 | 158 | 2.20.1 |
145 | 159 | ||
146 | 160 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | On iOS there is no CoreAudio, so we should not assume Darwin always | 3 | Use isar feature tests instead of feature bit tests. |
4 | has it. | ||
5 | 4 | ||
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 5 | Although none of QEMUs current cpus have VFPv3 without D32, |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | replace the large comment explaining why with one line that |
8 | Message-id: 20210126012457.39046-11-j@getutm.app | 7 | sets ARM_HWCAP_ARM_VFPv3D16 under the correct conditions. |
8 | Mirror the test sequence used in the linux kernel. | ||
9 | |||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Message-id: 20200224222232.13807-14-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 14 | --- |
11 | configure | 35 +++++++++++++++++++++++++++++++++-- | 15 | linux-user/elfload.c | 23 +++++++++++++---------- |
12 | 1 file changed, 33 insertions(+), 2 deletions(-) | 16 | 1 file changed, 13 insertions(+), 10 deletions(-) |
13 | 17 | ||
14 | diff --git a/configure b/configure | 18 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c |
15 | index XXXXXXX..XXXXXXX 100755 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/configure | 20 | --- a/linux-user/elfload.c |
17 | +++ b/configure | 21 | +++ b/linux-user/elfload.c |
18 | @@ -XXX,XX +XXX,XX @@ fdt="auto" | 22 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) |
19 | netmap="no" | 23 | |
20 | sdl="auto" | 24 | /* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */ |
21 | sdl_image="auto" | 25 | GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); |
22 | +coreaudio="auto" | 26 | - GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); |
23 | virtiofsd="auto" | 27 | GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); |
24 | virtfs="auto" | 28 | GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); |
25 | libudev="auto" | 29 | GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); |
26 | @@ -XXX,XX +XXX,XX @@ Darwin) | 30 | - GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); |
27 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" | 31 | GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); |
28 | QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" | 32 | - GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4); |
29 | fi | 33 | + GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); |
30 | - audio_drv_list="coreaudio try-sdl" | 34 | GET_FEATURE_ID(aa32_arm_div, ARM_HWCAP_ARM_IDIVA); |
31 | + audio_drv_list="try-coreaudio try-sdl" | 35 | GET_FEATURE_ID(aa32_thumb_div, ARM_HWCAP_ARM_IDIVT); |
32 | audio_possible_drivers="coreaudio sdl" | 36 | - /* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c. |
33 | # Disable attempts to use ObjectiveC features in os/object.h since they | 37 | - * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of |
34 | # won't work when we're compiling with gcc as a C compiler. | 38 | - * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated |
35 | @@ -XXX,XX +XXX,XX @@ EOF | 39 | - * to our VFP_FP16 feature bit. |
36 | fi | 40 | - */ |
37 | fi | 41 | - GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); |
38 | 42 | - GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); | |
39 | +########################################## | 43 | + GET_FEATURE_ID(aa32_vfp, ARM_HWCAP_ARM_VFP); |
40 | +# detect CoreAudio | ||
41 | +if test "$coreaudio" != "no" ; then | ||
42 | + coreaudio_libs="-framework CoreAudio" | ||
43 | + cat > $TMPC << EOF | ||
44 | +#include <CoreAudio/CoreAudio.h> | ||
45 | +int main(void) | ||
46 | +{ | ||
47 | + return (int)AudioGetCurrentHostTime(); | ||
48 | +} | ||
49 | +EOF | ||
50 | + if compile_prog "" "$coreaudio_libs" ; then | ||
51 | + coreaudio=yes | ||
52 | + else | ||
53 | + coreaudio=no | ||
54 | + fi | ||
55 | +fi | ||
56 | + | 44 | + |
57 | ########################################## | 45 | + if (cpu_isar_feature(aa32_fpsp_v3, cpu) || |
58 | # Sound support libraries probe | 46 | + cpu_isar_feature(aa32_fpdp_v3, cpu)) { |
59 | 47 | + hwcaps |= ARM_HWCAP_ARM_VFPv3; | |
60 | @@ -XXX,XX +XXX,XX @@ for drv in $audio_drv_list; do | 48 | + if (cpu_isar_feature(aa32_simd_r32, cpu)) { |
61 | fi | 49 | + hwcaps |= ARM_HWCAP_ARM_VFPD32; |
62 | ;; | 50 | + } else { |
63 | 51 | + hwcaps |= ARM_HWCAP_ARM_VFPv3D16; | |
64 | - coreaudio) | 52 | + } |
65 | + coreaudio | try-coreaudio) | 53 | + } |
66 | + if test "$coreaudio" = "no"; then | 54 | + GET_FEATURE_ID(aa32_simdfmac, ARM_HWCAP_ARM_VFPv4); |
67 | + if test "$drv" = "try-coreaudio"; then | 55 | |
68 | + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-coreaudio//') | 56 | return hwcaps; |
69 | + else | 57 | } |
70 | + error_exit "$drv check failed" \ | ||
71 | + "Make sure to have the $drv is available." | ||
72 | + fi | ||
73 | + else | ||
74 | coreaudio_libs="-framework CoreAudio" | ||
75 | + if test "$drv" = "try-coreaudio"; then | ||
76 | + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-coreaudio/coreaudio/') | ||
77 | + fi | ||
78 | + fi | ||
79 | ;; | ||
80 | |||
81 | dsound) | ||
82 | -- | 58 | -- |
83 | 2.20.1 | 59 | 2.20.1 |
84 | 60 | ||
85 | 61 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This was defined at some point before ARMv8.4, and will | 3 | We have converted all tests against these features |
4 | shortly be used by new processor descriptions. | 4 | to ISAR tests. |
5 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210120204400.1056582-1-richard.henderson@linaro.org | 8 | Message-id: 20200224222232.13807-15-richard.henderson@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | target/arm/cpu.h | 1 + | 11 | target/arm/cpu.h | 3 --- |
12 | target/arm/helper.c | 4 ++-- | 12 | target/arm/cpu.c | 25 ------------------------- |
13 | target/arm/kvm64.c | 2 ++ | 13 | target/arm/cpu64.c | 3 --- |
14 | 3 files changed, 5 insertions(+), 2 deletions(-) | 14 | target/arm/kvm32.c | 5 ----- |
15 | target/arm/kvm64.c | 1 - | ||
16 | 5 files changed, 37 deletions(-) | ||
15 | 17 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 20 | --- a/target/arm/cpu.h |
19 | +++ b/target/arm/cpu.h | 21 | +++ b/target/arm/cpu.h |
20 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 22 | @@ -XXX,XX +XXX,XX @@ QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK); |
21 | uint32_t id_mmfr4; | 23 | * mapping in linux-user/elfload.c:get_elf_hwcap(). |
22 | uint32_t id_pfr0; | 24 | */ |
23 | uint32_t id_pfr1; | 25 | enum arm_features { |
24 | + uint32_t id_pfr2; | 26 | - ARM_FEATURE_VFP, |
25 | uint32_t mvfr0; | 27 | ARM_FEATURE_AUXCR, /* ARM1026 Auxiliary control register. */ |
26 | uint32_t mvfr1; | 28 | ARM_FEATURE_XSCALE, /* Intel XScale extensions. */ |
27 | uint32_t mvfr2; | 29 | ARM_FEATURE_IWMMXT, /* Intel iwMMXt extension. */ |
28 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 30 | @@ -XXX,XX +XXX,XX @@ enum arm_features { |
29 | index XXXXXXX..XXXXXXX 100644 | 31 | ARM_FEATURE_V7, |
30 | --- a/target/arm/helper.c | 32 | ARM_FEATURE_THUMB2, |
31 | +++ b/target/arm/helper.c | 33 | ARM_FEATURE_PMSA, /* no MMU; may have Memory Protection Unit */ |
32 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 34 | - ARM_FEATURE_VFP3, |
33 | .access = PL1_R, .type = ARM_CP_CONST, | 35 | ARM_FEATURE_NEON, |
34 | .accessfn = access_aa64_tid3, | 36 | ARM_FEATURE_M, /* Microcontroller profile. */ |
35 | .resetvalue = 0 }, | 37 | ARM_FEATURE_OMAPCP, /* OMAP specific CP15 ops handling. */ |
36 | - { .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 38 | @@ -XXX,XX +XXX,XX @@ enum arm_features { |
37 | + { .name = "ID_PFR2", .state = ARM_CP_STATE_BOTH, | 39 | ARM_FEATURE_V5, |
38 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, | 40 | ARM_FEATURE_STRONGARM, |
39 | .access = PL1_R, .type = ARM_CP_CONST, | 41 | ARM_FEATURE_VAPA, /* cp15 VA to PA lookups */ |
40 | .accessfn = access_aa64_tid3, | 42 | - ARM_FEATURE_VFP4, /* VFPv4 (implies that NEON is v2) */ |
41 | - .resetvalue = 0 }, | 43 | ARM_FEATURE_GENERIC_TIMER, |
42 | + .resetvalue = cpu->isar.id_pfr2 }, | 44 | ARM_FEATURE_MVFR, /* Media and VFP Feature Registers 0 and 1 */ |
43 | { .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 45 | ARM_FEATURE_DUMMY_C15_REGS, /* RAZ/WI all of cp15 crn=15 */ |
44 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, | 46 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
45 | .access = PL1_R, .type = ARM_CP_CONST, | 47 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/target/arm/cpu.c | ||
49 | +++ b/target/arm/cpu.c | ||
50 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj) | ||
51 | if (arm_feature(&cpu->env, ARM_FEATURE_M)) { | ||
52 | set_feature(&cpu->env, ARM_FEATURE_PMSA); | ||
53 | } | ||
54 | - /* Similarly for the VFP feature bits */ | ||
55 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP4)) { | ||
56 | - set_feature(&cpu->env, ARM_FEATURE_VFP3); | ||
57 | - } | ||
58 | - if (arm_feature(&cpu->env, ARM_FEATURE_VFP3)) { | ||
59 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
60 | - } | ||
61 | |||
62 | if (arm_feature(&cpu->env, ARM_FEATURE_CBAR) || | ||
63 | arm_feature(&cpu->env, ARM_FEATURE_CBAR_RO)) { | ||
64 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
65 | uint64_t t; | ||
66 | uint32_t u; | ||
67 | |||
68 | - unset_feature(env, ARM_FEATURE_VFP); | ||
69 | - unset_feature(env, ARM_FEATURE_VFP3); | ||
70 | - unset_feature(env, ARM_FEATURE_VFP4); | ||
71 | - | ||
72 | t = cpu->isar.id_aa64isar1; | ||
73 | t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 0); | ||
74 | cpu->isar.id_aa64isar1 = t; | ||
75 | @@ -XXX,XX +XXX,XX @@ static void arm926_initfn(Object *obj) | ||
76 | |||
77 | cpu->dtb_compatible = "arm,arm926"; | ||
78 | set_feature(&cpu->env, ARM_FEATURE_V5); | ||
79 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
80 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
81 | set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); | ||
82 | cpu->midr = 0x41069265; | ||
83 | @@ -XXX,XX +XXX,XX @@ static void arm1026_initfn(Object *obj) | ||
84 | |||
85 | cpu->dtb_compatible = "arm,arm1026"; | ||
86 | set_feature(&cpu->env, ARM_FEATURE_V5); | ||
87 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
88 | set_feature(&cpu->env, ARM_FEATURE_AUXCR); | ||
89 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
90 | set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); | ||
91 | @@ -XXX,XX +XXX,XX @@ static void arm1136_r2_initfn(Object *obj) | ||
92 | |||
93 | cpu->dtb_compatible = "arm,arm1136"; | ||
94 | set_feature(&cpu->env, ARM_FEATURE_V6); | ||
95 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
96 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
97 | set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); | ||
98 | set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS); | ||
99 | @@ -XXX,XX +XXX,XX @@ static void arm1136_initfn(Object *obj) | ||
100 | cpu->dtb_compatible = "arm,arm1136"; | ||
101 | set_feature(&cpu->env, ARM_FEATURE_V6K); | ||
102 | set_feature(&cpu->env, ARM_FEATURE_V6); | ||
103 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
104 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
105 | set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); | ||
106 | set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS); | ||
107 | @@ -XXX,XX +XXX,XX @@ static void arm1176_initfn(Object *obj) | ||
108 | |||
109 | cpu->dtb_compatible = "arm,arm1176"; | ||
110 | set_feature(&cpu->env, ARM_FEATURE_V6K); | ||
111 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
112 | set_feature(&cpu->env, ARM_FEATURE_VAPA); | ||
113 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
114 | set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); | ||
115 | @@ -XXX,XX +XXX,XX @@ static void arm11mpcore_initfn(Object *obj) | ||
116 | |||
117 | cpu->dtb_compatible = "arm,arm11mpcore"; | ||
118 | set_feature(&cpu->env, ARM_FEATURE_V6K); | ||
119 | - set_feature(&cpu->env, ARM_FEATURE_VFP); | ||
120 | set_feature(&cpu->env, ARM_FEATURE_VAPA); | ||
121 | set_feature(&cpu->env, ARM_FEATURE_MPIDR); | ||
122 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
123 | @@ -XXX,XX +XXX,XX @@ static void cortex_m4_initfn(Object *obj) | ||
124 | set_feature(&cpu->env, ARM_FEATURE_M); | ||
125 | set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | ||
126 | set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | ||
127 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
128 | cpu->midr = 0x410fc240; /* r0p0 */ | ||
129 | cpu->pmsav7_dregion = 8; | ||
130 | cpu->isar.mvfr0 = 0x10110021; | ||
131 | @@ -XXX,XX +XXX,XX @@ static void cortex_m7_initfn(Object *obj) | ||
132 | set_feature(&cpu->env, ARM_FEATURE_M); | ||
133 | set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | ||
134 | set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | ||
135 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
136 | cpu->midr = 0x411fc272; /* r1p2 */ | ||
137 | cpu->pmsav7_dregion = 8; | ||
138 | cpu->isar.mvfr0 = 0x10110221; | ||
139 | @@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj) | ||
140 | set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | ||
141 | set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); | ||
142 | set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | ||
143 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
144 | cpu->midr = 0x410fd213; /* r0p3 */ | ||
145 | cpu->pmsav7_dregion = 16; | ||
146 | cpu->sau_sregion = 8; | ||
147 | @@ -XXX,XX +XXX,XX @@ static void cortex_r5f_initfn(Object *obj) | ||
148 | ARMCPU *cpu = ARM_CPU(obj); | ||
149 | |||
150 | cortex_r5_initfn(obj); | ||
151 | - set_feature(&cpu->env, ARM_FEATURE_VFP3); | ||
152 | cpu->isar.mvfr0 = 0x10110221; | ||
153 | cpu->isar.mvfr1 = 0x00000011; | ||
154 | } | ||
155 | @@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj) | ||
156 | |||
157 | cpu->dtb_compatible = "arm,cortex-a8"; | ||
158 | set_feature(&cpu->env, ARM_FEATURE_V7); | ||
159 | - set_feature(&cpu->env, ARM_FEATURE_VFP3); | ||
160 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
161 | set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); | ||
162 | set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); | ||
163 | @@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj) | ||
164 | |||
165 | cpu->dtb_compatible = "arm,cortex-a9"; | ||
166 | set_feature(&cpu->env, ARM_FEATURE_V7); | ||
167 | - set_feature(&cpu->env, ARM_FEATURE_VFP3); | ||
168 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
169 | set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); | ||
170 | set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
171 | @@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj) | ||
172 | |||
173 | cpu->dtb_compatible = "arm,cortex-a7"; | ||
174 | set_feature(&cpu->env, ARM_FEATURE_V7VE); | ||
175 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
176 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
177 | set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); | ||
178 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
179 | @@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj) | ||
180 | |||
181 | cpu->dtb_compatible = "arm,cortex-a15"; | ||
182 | set_feature(&cpu->env, ARM_FEATURE_V7VE); | ||
183 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
184 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
185 | set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); | ||
186 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
187 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
188 | index XXXXXXX..XXXXXXX 100644 | ||
189 | --- a/target/arm/cpu64.c | ||
190 | +++ b/target/arm/cpu64.c | ||
191 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) | ||
192 | |||
193 | cpu->dtb_compatible = "arm,cortex-a57"; | ||
194 | set_feature(&cpu->env, ARM_FEATURE_V8); | ||
195 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
196 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
197 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
198 | set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
199 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | ||
200 | |||
201 | cpu->dtb_compatible = "arm,cortex-a53"; | ||
202 | set_feature(&cpu->env, ARM_FEATURE_V8); | ||
203 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
204 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
205 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
206 | set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
207 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | ||
208 | |||
209 | cpu->dtb_compatible = "arm,cortex-a72"; | ||
210 | set_feature(&cpu->env, ARM_FEATURE_V8); | ||
211 | - set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
212 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
213 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
214 | set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
215 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | ||
216 | index XXXXXXX..XXXXXXX 100644 | ||
217 | --- a/target/arm/kvm32.c | ||
218 | +++ b/target/arm/kvm32.c | ||
219 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
220 | * bits, but a few must be tested. | ||
221 | */ | ||
222 | set_feature(&features, ARM_FEATURE_V7VE); | ||
223 | - set_feature(&features, ARM_FEATURE_VFP3); | ||
224 | set_feature(&features, ARM_FEATURE_GENERIC_TIMER); | ||
225 | |||
226 | if (extract32(id_pfr0, 12, 4) == 1) { | ||
227 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
228 | if (extract32(ahcf->isar.mvfr1, 12, 4) == 1) { | ||
229 | set_feature(&features, ARM_FEATURE_NEON); | ||
230 | } | ||
231 | - if (extract32(ahcf->isar.mvfr1, 28, 4) == 1) { | ||
232 | - /* FMAC support implies VFPv4 */ | ||
233 | - set_feature(&features, ARM_FEATURE_VFP4); | ||
234 | - } | ||
235 | |||
236 | ahcf->features = features; | ||
237 | |||
46 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 238 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
47 | index XXXXXXX..XXXXXXX 100644 | 239 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/target/arm/kvm64.c | 240 | --- a/target/arm/kvm64.c |
49 | +++ b/target/arm/kvm64.c | 241 | +++ b/target/arm/kvm64.c |
50 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 242 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
51 | ARM64_SYS_REG(3, 0, 0, 1, 0)); | 243 | * feature bits. |
52 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr1, | 244 | */ |
53 | ARM64_SYS_REG(3, 0, 0, 1, 1)); | 245 | set_feature(&features, ARM_FEATURE_V8); |
54 | + err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr2, | 246 | - set_feature(&features, ARM_FEATURE_VFP4); |
55 | + ARM64_SYS_REG(3, 0, 0, 3, 4)); | 247 | set_feature(&features, ARM_FEATURE_NEON); |
56 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_dfr0, | 248 | set_feature(&features, ARM_FEATURE_AARCH64); |
57 | ARM64_SYS_REG(3, 0, 0, 1, 2)); | 249 | set_feature(&features, ARM_FEATURE_PMU); |
58 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr0, | ||
59 | -- | 250 | -- |
60 | 2.20.1 | 251 | 2.20.1 |
61 | 252 | ||
62 | 253 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Paolo Bonzini <pbonzini@redhat.com> | ||
2 | 1 | ||
3 | The properties to attach a CANBUS object to the xlnx-zcu102 machine have | ||
4 | a period in them. We want to use periods in properties for compound QAPI types, | ||
5 | and besides the "xlnx-zcu102." prefix is both unnecessary and different | ||
6 | from any other machine property name. Remove it. | ||
7 | |||
8 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
9 | Message-id: 20210118162537.779542-1-pbonzini@redhat.com | ||
10 | Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/xlnx-zcu102.c | 4 ++-- | ||
14 | tests/qtest/xlnx-can-test.c | 30 +++++++++++++++--------------- | ||
15 | 2 files changed, 17 insertions(+), 17 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/xlnx-zcu102.c | ||
20 | +++ b/hw/arm/xlnx-zcu102.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_instance_init(Object *obj) | ||
22 | s->secure = false; | ||
23 | /* Default to virt (EL2) being disabled */ | ||
24 | s->virt = false; | ||
25 | - object_property_add_link(obj, "xlnx-zcu102.canbus0", TYPE_CAN_BUS, | ||
26 | + object_property_add_link(obj, "canbus0", TYPE_CAN_BUS, | ||
27 | (Object **)&s->canbus[0], | ||
28 | object_property_allow_set_link, | ||
29 | 0); | ||
30 | |||
31 | - object_property_add_link(obj, "xlnx-zcu102.canbus1", TYPE_CAN_BUS, | ||
32 | + object_property_add_link(obj, "canbus1", TYPE_CAN_BUS, | ||
33 | (Object **)&s->canbus[1], | ||
34 | object_property_allow_set_link, | ||
35 | 0); | ||
36 | diff --git a/tests/qtest/xlnx-can-test.c b/tests/qtest/xlnx-can-test.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/tests/qtest/xlnx-can-test.c | ||
39 | +++ b/tests/qtest/xlnx-can-test.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static void test_can_bus(void) | ||
41 | uint8_t can_timestamp = 1; | ||
42 | |||
43 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
44 | - " -object can-bus,id=canbus0" | ||
45 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
46 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
47 | + " -object can-bus,id=canbus" | ||
48 | + " -machine canbus0=canbus" | ||
49 | + " -machine canbus1=canbus" | ||
50 | ); | ||
51 | |||
52 | /* Configure the CAN0 and CAN1. */ | ||
53 | @@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void) | ||
54 | uint32_t status = 0; | ||
55 | |||
56 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
57 | - " -object can-bus,id=canbus0" | ||
58 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
59 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
60 | + " -object can-bus,id=canbus" | ||
61 | + " -machine canbus0=canbus" | ||
62 | + " -machine canbus1=canbus" | ||
63 | ); | ||
64 | |||
65 | /* Configure the CAN0 in loopback mode. */ | ||
66 | @@ -XXX,XX +XXX,XX @@ static void test_can_filter(void) | ||
67 | uint8_t can_timestamp = 1; | ||
68 | |||
69 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
70 | - " -object can-bus,id=canbus0" | ||
71 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
72 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
73 | + " -object can-bus,id=canbus" | ||
74 | + " -machine canbus0=canbus" | ||
75 | + " -machine canbus1=canbus" | ||
76 | ); | ||
77 | |||
78 | /* Configure the CAN0 and CAN1. */ | ||
79 | @@ -XXX,XX +XXX,XX @@ static void test_can_sleepmode(void) | ||
80 | uint8_t can_timestamp = 1; | ||
81 | |||
82 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
83 | - " -object can-bus,id=canbus0" | ||
84 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
85 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
86 | + " -object can-bus,id=canbus" | ||
87 | + " -machine canbus0=canbus" | ||
88 | + " -machine canbus1=canbus" | ||
89 | ); | ||
90 | |||
91 | /* Configure the CAN0. */ | ||
92 | @@ -XXX,XX +XXX,XX @@ static void test_can_snoopmode(void) | ||
93 | uint8_t can_timestamp = 1; | ||
94 | |||
95 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
96 | - " -object can-bus,id=canbus0" | ||
97 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
98 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
99 | + " -object can-bus,id=canbus" | ||
100 | + " -machine canbus0=canbus" | ||
101 | + " -machine canbus1=canbus" | ||
102 | ); | ||
103 | |||
104 | /* Configure the CAN0. */ | ||
105 | -- | ||
106 | 2.20.1 | ||
107 | |||
108 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Meson will find CoreFoundation, IOKit, and Cocoa as needed. | 3 | Those vfp instructions without extra opcode fields can |
4 | share a common @format for brevity. | ||
4 | 5 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20210126012457.39046-7-j@getutm.app | 8 | Message-id: 20200224222232.13807-16-richard.henderson@linaro.org |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | configure | 1 - | 11 | target/arm/vfp.decode | 134 ++++++++++++++++-------------------------- |
11 | 1 file changed, 1 deletion(-) | 12 | 1 file changed, 52 insertions(+), 82 deletions(-) |
12 | 13 | ||
13 | diff --git a/configure b/configure | 14 | diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode |
14 | index XXXXXXX..XXXXXXX 100755 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/configure | 16 | --- a/target/arm/vfp.decode |
16 | +++ b/configure | 17 | +++ b/target/arm/vfp.decode |
17 | @@ -XXX,XX +XXX,XX @@ Darwin) | 18 | @@ -XXX,XX +XXX,XX @@ |
18 | fi | 19 | |
19 | audio_drv_list="coreaudio try-sdl" | 20 | %vmov_imm 16:4 0:4 |
20 | audio_possible_drivers="coreaudio sdl" | 21 | |
21 | - QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" | 22 | +@vfp_dnm_s ................................ vm=%vm_sp vn=%vn_sp vd=%vd_sp |
22 | # Disable attempts to use ObjectiveC features in os/object.h since they | 23 | +@vfp_dnm_d ................................ vm=%vm_dp vn=%vn_dp vd=%vd_dp |
23 | # won't work when we're compiling with gcc as a C compiler. | 24 | + |
24 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | 25 | +@vfp_dm_ss ................................ vm=%vm_sp vd=%vd_sp |
26 | +@vfp_dm_dd ................................ vm=%vm_dp vd=%vd_dp | ||
27 | +@vfp_dm_ds ................................ vm=%vm_sp vd=%vd_dp | ||
28 | +@vfp_dm_sd ................................ vm=%vm_dp vd=%vd_sp | ||
29 | + | ||
30 | # VMOV scalar to general-purpose register; note that this does | ||
31 | # include some Neon cases. | ||
32 | VMOV_to_gp ---- 1110 u:1 1. 1 .... rt:4 1011 ... 1 0000 \ | ||
33 | @@ -XXX,XX +XXX,XX @@ VDUP ---- 1110 1 b:1 q:1 0 .... rt:4 1011 . 0 e:1 1 0000 \ | ||
34 | vn=%vn_dp | ||
35 | |||
36 | VMSR_VMRS ---- 1110 111 l:1 reg:4 rt:4 1010 0001 0000 | ||
37 | -VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 \ | ||
38 | - vn=%vn_sp | ||
39 | +VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 vn=%vn_sp | ||
40 | |||
41 | -VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... \ | ||
42 | - vm=%vm_sp | ||
43 | -VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... \ | ||
44 | - vm=%vm_dp | ||
45 | +VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... vm=%vm_sp | ||
46 | +VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... vm=%vm_dp | ||
47 | |||
48 | # Note that the half-precision variants of VLDR and VSTR are | ||
49 | # not part of this decodetree at all because they have bits [9:8] == 0b01 | ||
50 | -VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 \ | ||
51 | - vd=%vd_sp | ||
52 | -VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 \ | ||
53 | - vd=%vd_dp | ||
54 | +VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 vd=%vd_sp | ||
55 | +VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 vd=%vd_dp | ||
56 | |||
57 | # We split the load/store multiple up into two patterns to avoid | ||
58 | # overlap with other insns in the "Advanced SIMD load/store and 64-bit move" | ||
59 | @@ -XXX,XX +XXX,XX @@ VLDM_VSTM_dp ---- 1101 0.1 l:1 rn:4 .... 1011 imm:8 \ | ||
60 | vd=%vd_dp p=1 u=0 w=1 | ||
61 | |||
62 | # 3-register VFP data-processing; bits [23,21:20,6] identify the operation. | ||
63 | -VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \ | ||
64 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
65 | -VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \ | ||
66 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
67 | +VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... @vfp_dnm_s | ||
68 | +VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... @vfp_dnm_d | ||
69 | |||
70 | -VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \ | ||
71 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
72 | -VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \ | ||
73 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
74 | +VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... @vfp_dnm_s | ||
75 | +VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... @vfp_dnm_d | ||
76 | |||
77 | -VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... \ | ||
78 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
79 | -VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... \ | ||
80 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
81 | +VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... @vfp_dnm_s | ||
82 | +VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... @vfp_dnm_d | ||
83 | |||
84 | -VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... \ | ||
85 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
86 | -VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... \ | ||
87 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
88 | +VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... @vfp_dnm_s | ||
89 | +VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... @vfp_dnm_d | ||
90 | |||
91 | -VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... \ | ||
92 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
93 | -VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... \ | ||
94 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
95 | +VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... @vfp_dnm_s | ||
96 | +VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... @vfp_dnm_d | ||
97 | |||
98 | -VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... \ | ||
99 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
100 | -VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... \ | ||
101 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
102 | +VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... @vfp_dnm_s | ||
103 | +VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... @vfp_dnm_d | ||
104 | |||
105 | -VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... \ | ||
106 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
107 | -VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... \ | ||
108 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
109 | +VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... @vfp_dnm_s | ||
110 | +VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... @vfp_dnm_d | ||
111 | |||
112 | -VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... \ | ||
113 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
114 | -VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... \ | ||
115 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
116 | +VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... @vfp_dnm_s | ||
117 | +VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... @vfp_dnm_d | ||
118 | |||
119 | -VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... \ | ||
120 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp | ||
121 | -VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... \ | ||
122 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
123 | +VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s | ||
124 | +VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d | ||
125 | |||
126 | VFM_sp ---- 1110 1.01 .... .... 1010 . o2:1 . 0 .... \ | ||
127 | vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=1 | ||
128 | @@ -XXX,XX +XXX,XX @@ VMOV_imm_sp ---- 1110 1.11 .... .... 1010 0000 .... \ | ||
129 | VMOV_imm_dp ---- 1110 1.11 .... .... 1011 0000 .... \ | ||
130 | vd=%vd_dp imm=%vmov_imm | ||
131 | |||
132 | -VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... \ | ||
133 | - vd=%vd_sp vm=%vm_sp | ||
134 | -VMOV_reg_dp ---- 1110 1.11 0000 .... 1011 01.0 .... \ | ||
135 | - vd=%vd_dp vm=%vm_dp | ||
136 | +VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... @vfp_dm_ss | ||
137 | +VMOV_reg_dp ---- 1110 1.11 0000 .... 1011 01.0 .... @vfp_dm_dd | ||
138 | |||
139 | -VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... \ | ||
140 | - vd=%vd_sp vm=%vm_sp | ||
141 | -VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... \ | ||
142 | - vd=%vd_dp vm=%vm_dp | ||
143 | +VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... @vfp_dm_ss | ||
144 | +VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... @vfp_dm_dd | ||
145 | |||
146 | -VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... \ | ||
147 | - vd=%vd_sp vm=%vm_sp | ||
148 | -VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... \ | ||
149 | - vd=%vd_dp vm=%vm_dp | ||
150 | +VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... @vfp_dm_ss | ||
151 | +VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... @vfp_dm_dd | ||
152 | |||
153 | -VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... \ | ||
154 | - vd=%vd_sp vm=%vm_sp | ||
155 | -VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... \ | ||
156 | - vd=%vd_dp vm=%vm_dp | ||
157 | +VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... @vfp_dm_ss | ||
158 | +VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... @vfp_dm_dd | ||
159 | |||
160 | VCMP_sp ---- 1110 1.11 010 z:1 .... 1010 e:1 1.0 .... \ | ||
161 | vd=%vd_sp vm=%vm_sp | ||
162 | @@ -XXX,XX +XXX,XX @@ VCVT_f32_f16 ---- 1110 1.11 0010 .... 1010 t:1 1.0 .... \ | ||
163 | VCVT_f64_f16 ---- 1110 1.11 0010 .... 1011 t:1 1.0 .... \ | ||
164 | vd=%vd_dp vm=%vm_sp | ||
165 | |||
166 | -# VCVTB and VCVTT to f16: Vd format is always vd_sp; Vm format depends on size bit | ||
167 | +# VCVTB and VCVTT to f16: Vd format is always vd_sp; | ||
168 | +# Vm format depends on size bit | ||
169 | VCVT_f16_f32 ---- 1110 1.11 0011 .... 1010 t:1 1.0 .... \ | ||
170 | vd=%vd_sp vm=%vm_sp | ||
171 | VCVT_f16_f64 ---- 1110 1.11 0011 .... 1011 t:1 1.0 .... \ | ||
172 | vd=%vd_sp vm=%vm_dp | ||
173 | |||
174 | -VRINTR_sp ---- 1110 1.11 0110 .... 1010 01.0 .... \ | ||
175 | - vd=%vd_sp vm=%vm_sp | ||
176 | -VRINTR_dp ---- 1110 1.11 0110 .... 1011 01.0 .... \ | ||
177 | - vd=%vd_dp vm=%vm_dp | ||
178 | +VRINTR_sp ---- 1110 1.11 0110 .... 1010 01.0 .... @vfp_dm_ss | ||
179 | +VRINTR_dp ---- 1110 1.11 0110 .... 1011 01.0 .... @vfp_dm_dd | ||
180 | |||
181 | -VRINTZ_sp ---- 1110 1.11 0110 .... 1010 11.0 .... \ | ||
182 | - vd=%vd_sp vm=%vm_sp | ||
183 | -VRINTZ_dp ---- 1110 1.11 0110 .... 1011 11.0 .... \ | ||
184 | - vd=%vd_dp vm=%vm_dp | ||
185 | +VRINTZ_sp ---- 1110 1.11 0110 .... 1010 11.0 .... @vfp_dm_ss | ||
186 | +VRINTZ_dp ---- 1110 1.11 0110 .... 1011 11.0 .... @vfp_dm_dd | ||
187 | |||
188 | -VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... \ | ||
189 | - vd=%vd_sp vm=%vm_sp | ||
190 | -VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... \ | ||
191 | - vd=%vd_dp vm=%vm_dp | ||
192 | +VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... @vfp_dm_ss | ||
193 | +VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... @vfp_dm_dd | ||
194 | |||
195 | -# VCVT between single and double: Vm precision depends on size; Vd is its reverse | ||
196 | -VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... \ | ||
197 | - vd=%vd_dp vm=%vm_sp | ||
198 | -VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... \ | ||
199 | - vd=%vd_sp vm=%vm_dp | ||
200 | +# VCVT between single and double: | ||
201 | +# Vm precision depends on size; Vd is its reverse | ||
202 | +VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... @vfp_dm_ds | ||
203 | +VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... @vfp_dm_sd | ||
204 | |||
205 | # VCVT from integer to floating point: Vm always single; Vd depends on size | ||
206 | VCVT_int_sp ---- 1110 1.11 1000 .... 1010 s:1 1.0 .... \ | ||
207 | @@ -XXX,XX +XXX,XX @@ VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \ | ||
208 | vd=%vd_dp vm=%vm_sp | ||
209 | |||
210 | # VJCVT is always dp to sp | ||
211 | -VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... \ | ||
212 | - vd=%vd_sp vm=%vm_dp | ||
213 | +VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... @vfp_dm_sd | ||
214 | |||
215 | # VCVT between floating-point and fixed-point. The immediate value | ||
216 | # is in the same format as a Vm single-precision register number. | ||
25 | -- | 217 | -- |
26 | 2.20.1 | 218 | 2.20.1 |
27 | 219 | ||
28 | 220 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | To ease the PCI device addition in next patches, split the code as follows: | 3 | Passing the raw o1 and o2 fields from the manual is less |
4 | - generic code (read/write/setup) is being kept in pvpanic.c | 4 | instructive than it might be. Do the full decode and let |
5 | - ISA dependent code moved to pvpanic-isa.c | 5 | the trans_* functions pass in booleans to a helper. |
6 | 6 | ||
7 | Also, rename: | ||
8 | - ISA_PVPANIC_DEVICE -> PVPANIC_ISA_DEVICE. | ||
9 | - TYPE_PVPANIC -> TYPE_PVPANIC_ISA. | ||
10 | - MemoryRegion io -> mr. | ||
11 | - pvpanic_ioport_* in pvpanic_*. | ||
12 | |||
13 | Update the build system with the new files and config structure. | ||
14 | |||
15 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200224222232.13807-17-richard.henderson@linaro.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 11 | --- |
19 | include/hw/misc/pvpanic.h | 23 +++++++++- | 12 | target/arm/translate-vfp.inc.c | 52 ++++++++++++++++++++++++++++++---- |
20 | hw/misc/pvpanic-isa.c | 94 +++++++++++++++++++++++++++++++++++++++ | 13 | target/arm/vfp.decode | 17 +++++------ |
21 | hw/misc/pvpanic.c | 85 +++-------------------------------- | 14 | 2 files changed, 55 insertions(+), 14 deletions(-) |
22 | hw/i386/Kconfig | 2 +- | ||
23 | hw/misc/Kconfig | 6 ++- | ||
24 | hw/misc/meson.build | 3 +- | ||
25 | tests/qtest/meson.build | 2 +- | ||
26 | 7 files changed, 130 insertions(+), 85 deletions(-) | ||
27 | create mode 100644 hw/misc/pvpanic-isa.c | ||
28 | 15 | ||
29 | diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h | 16 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
30 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/include/hw/misc/pvpanic.h | 18 | --- a/target/arm/translate-vfp.inc.c |
32 | +++ b/include/hw/misc/pvpanic.h | 19 | +++ b/target/arm/translate-vfp.inc.c |
33 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_dp *a) |
34 | 21 | return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false); | |
35 | #include "qom/object.h" | 22 | } |
36 | 23 | ||
37 | -#define TYPE_PVPANIC "pvpanic" | 24 | -static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) |
38 | +#define TYPE_PVPANIC_ISA_DEVICE "pvpanic" | 25 | +static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) |
39 | |||
40 | #define PVPANIC_IOPORT_PROP "ioport" | ||
41 | |||
42 | +/* The bit of supported pv event, TODO: include uapi header and remove this */ | ||
43 | +#define PVPANIC_F_PANICKED 0 | ||
44 | +#define PVPANIC_F_CRASHLOADED 1 | ||
45 | + | ||
46 | +/* The pv event value */ | ||
47 | +#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) | ||
48 | +#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) | ||
49 | + | ||
50 | +/* | ||
51 | + * PVPanicState for any device type | ||
52 | + */ | ||
53 | +typedef struct PVPanicState PVPanicState; | ||
54 | +struct PVPanicState { | ||
55 | + MemoryRegion mr; | ||
56 | + uint8_t events; | ||
57 | +}; | ||
58 | + | ||
59 | +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size); | ||
60 | + | ||
61 | static inline uint16_t pvpanic_port(void) | ||
62 | { | 26 | { |
63 | - Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL); | 27 | /* |
64 | + Object *o = object_resolve_path_type("", TYPE_PVPANIC_ISA_DEVICE, NULL); | 28 | * VFNMA : fd = muladd(-fd, fn, fm) |
65 | if (!o) { | 29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) |
66 | return 0; | 30 | |
31 | neon_load_reg32(vn, a->vn); | ||
32 | neon_load_reg32(vm, a->vm); | ||
33 | - if (a->o2) { | ||
34 | + if (neg_n) { | ||
35 | /* VFNMS, VFMS */ | ||
36 | gen_helper_vfp_negs(vn, vn); | ||
67 | } | 37 | } |
68 | diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c | 38 | neon_load_reg32(vd, a->vd); |
69 | new file mode 100644 | 39 | - if (a->o1 & 1) { |
70 | index XXXXXXX..XXXXXXX | 40 | + if (neg_d) { |
71 | --- /dev/null | 41 | /* VFNMA, VFNMS */ |
72 | +++ b/hw/misc/pvpanic-isa.c | 42 | gen_helper_vfp_negs(vd, vd); |
73 | @@ -XXX,XX +XXX,XX @@ | 43 | } |
74 | +/* | 44 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) |
75 | + * QEMU simulated pvpanic device. | 45 | return true; |
76 | + * | 46 | } |
77 | + * Copyright Fujitsu, Corp. 2013 | 47 | |
78 | + * | 48 | -static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) |
79 | + * Authors: | 49 | +static bool trans_VFMA_sp(DisasContext *s, arg_VFMA_sp *a) |
80 | + * Wen Congyang <wency@cn.fujitsu.com> | ||
81 | + * Hu Tao <hutao@cn.fujitsu.com> | ||
82 | + * | ||
83 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
84 | + * See the COPYING file in the top-level directory. | ||
85 | + * | ||
86 | + */ | ||
87 | + | ||
88 | +#include "qemu/osdep.h" | ||
89 | +#include "qemu/log.h" | ||
90 | +#include "qemu/module.h" | ||
91 | +#include "sysemu/runstate.h" | ||
92 | + | ||
93 | +#include "hw/nvram/fw_cfg.h" | ||
94 | +#include "hw/qdev-properties.h" | ||
95 | +#include "hw/misc/pvpanic.h" | ||
96 | +#include "qom/object.h" | ||
97 | +#include "hw/isa/isa.h" | ||
98 | + | ||
99 | +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) | ||
100 | + | ||
101 | +/* | ||
102 | + * PVPanicISAState for ISA device and | ||
103 | + * use ioport. | ||
104 | + */ | ||
105 | +struct PVPanicISAState { | ||
106 | + ISADevice parent_obj; | ||
107 | + | ||
108 | + uint16_t ioport; | ||
109 | + PVPanicState pvpanic; | ||
110 | +}; | ||
111 | + | ||
112 | +static void pvpanic_isa_initfn(Object *obj) | ||
113 | +{ | 50 | +{ |
114 | + PVPanicISAState *s = PVPANIC_ISA_DEVICE(obj); | 51 | + return do_vfm_sp(s, a, false, false); |
115 | + | ||
116 | + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 1); | ||
117 | +} | 52 | +} |
118 | + | 53 | + |
119 | +static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) | 54 | +static bool trans_VFMS_sp(DisasContext *s, arg_VFMS_sp *a) |
120 | +{ | 55 | +{ |
121 | + ISADevice *d = ISA_DEVICE(dev); | 56 | + return do_vfm_sp(s, a, true, false); |
122 | + PVPanicISAState *s = PVPANIC_ISA_DEVICE(dev); | ||
123 | + PVPanicState *ps = &s->pvpanic; | ||
124 | + FWCfgState *fw_cfg = fw_cfg_find(); | ||
125 | + uint16_t *pvpanic_port; | ||
126 | + | ||
127 | + if (!fw_cfg) { | ||
128 | + return; | ||
129 | + } | ||
130 | + | ||
131 | + pvpanic_port = g_malloc(sizeof(*pvpanic_port)); | ||
132 | + *pvpanic_port = cpu_to_le16(s->ioport); | ||
133 | + fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, | ||
134 | + sizeof(*pvpanic_port)); | ||
135 | + | ||
136 | + isa_register_ioport(d, &ps->mr, s->ioport); | ||
137 | +} | 57 | +} |
138 | + | 58 | + |
139 | +static Property pvpanic_isa_properties[] = { | 59 | +static bool trans_VFNMA_sp(DisasContext *s, arg_VFNMA_sp *a) |
140 | + DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), | ||
141 | + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | ||
142 | + DEFINE_PROP_END_OF_LIST(), | ||
143 | +}; | ||
144 | + | ||
145 | +static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
146 | +{ | 60 | +{ |
147 | + DeviceClass *dc = DEVICE_CLASS(klass); | 61 | + return do_vfm_sp(s, a, false, true); |
148 | + | ||
149 | + dc->realize = pvpanic_isa_realizefn; | ||
150 | + device_class_set_props(dc, pvpanic_isa_properties); | ||
151 | + set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
152 | +} | 62 | +} |
153 | + | 63 | + |
154 | +static TypeInfo pvpanic_isa_info = { | 64 | +static bool trans_VFNMS_sp(DisasContext *s, arg_VFNMS_sp *a) |
155 | + .name = TYPE_PVPANIC_ISA_DEVICE, | ||
156 | + .parent = TYPE_ISA_DEVICE, | ||
157 | + .instance_size = sizeof(PVPanicISAState), | ||
158 | + .instance_init = pvpanic_isa_initfn, | ||
159 | + .class_init = pvpanic_isa_class_init, | ||
160 | +}; | ||
161 | + | ||
162 | +static void pvpanic_register_types(void) | ||
163 | +{ | 65 | +{ |
164 | + type_register_static(&pvpanic_isa_info); | 66 | + return do_vfm_sp(s, a, true, true); |
165 | +} | 67 | +} |
166 | + | 68 | + |
167 | +type_init(pvpanic_register_types) | 69 | +static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) |
168 | diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c | 70 | { |
71 | /* | ||
72 | * VFNMA : fd = muladd(-fd, fn, fm) | ||
73 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) | ||
74 | |||
75 | neon_load_reg64(vn, a->vn); | ||
76 | neon_load_reg64(vm, a->vm); | ||
77 | - if (a->o2) { | ||
78 | + if (neg_n) { | ||
79 | /* VFNMS, VFMS */ | ||
80 | gen_helper_vfp_negd(vn, vn); | ||
81 | } | ||
82 | neon_load_reg64(vd, a->vd); | ||
83 | - if (a->o1 & 1) { | ||
84 | + if (neg_d) { | ||
85 | /* VFNMA, VFNMS */ | ||
86 | gen_helper_vfp_negd(vd, vd); | ||
87 | } | ||
88 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) | ||
89 | return true; | ||
90 | } | ||
91 | |||
92 | +static bool trans_VFMA_dp(DisasContext *s, arg_VFMA_dp *a) | ||
93 | +{ | ||
94 | + return do_vfm_dp(s, a, false, false); | ||
95 | +} | ||
96 | + | ||
97 | +static bool trans_VFMS_dp(DisasContext *s, arg_VFMS_dp *a) | ||
98 | +{ | ||
99 | + return do_vfm_dp(s, a, true, false); | ||
100 | +} | ||
101 | + | ||
102 | +static bool trans_VFNMA_dp(DisasContext *s, arg_VFNMA_dp *a) | ||
103 | +{ | ||
104 | + return do_vfm_dp(s, a, false, true); | ||
105 | +} | ||
106 | + | ||
107 | +static bool trans_VFNMS_dp(DisasContext *s, arg_VFNMS_dp *a) | ||
108 | +{ | ||
109 | + return do_vfm_dp(s, a, true, true); | ||
110 | +} | ||
111 | + | ||
112 | static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) | ||
113 | { | ||
114 | uint32_t delta_d = 0; | ||
115 | diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode | ||
169 | index XXXXXXX..XXXXXXX 100644 | 116 | index XXXXXXX..XXXXXXX 100644 |
170 | --- a/hw/misc/pvpanic.c | 117 | --- a/target/arm/vfp.decode |
171 | +++ b/hw/misc/pvpanic.c | 118 | +++ b/target/arm/vfp.decode |
172 | @@ -XXX,XX +XXX,XX @@ | 119 | @@ -XXX,XX +XXX,XX @@ VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... @vfp_dnm_d |
173 | #include "hw/misc/pvpanic.h" | 120 | VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s |
174 | #include "qom/object.h" | 121 | VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d |
175 | 122 | ||
176 | -/* The bit of supported pv event, TODO: include uapi header and remove this */ | 123 | -VFM_sp ---- 1110 1.01 .... .... 1010 . o2:1 . 0 .... \ |
177 | -#define PVPANIC_F_PANICKED 0 | 124 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=1 |
178 | -#define PVPANIC_F_CRASHLOADED 1 | 125 | -VFM_dp ---- 1110 1.01 .... .... 1011 . o2:1 . 0 .... \ |
179 | - | 126 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=1 |
180 | -/* The pv event value */ | 127 | -VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \ |
181 | -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) | 128 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=2 |
182 | -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) | 129 | -VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \ |
183 | - | 130 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2 |
184 | -typedef struct PVPanicState PVPanicState; | 131 | +VFMA_sp ---- 1110 1.10 .... .... 1010 .0. 0 .... @vfp_dnm_s |
185 | -DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE, | 132 | +VFMS_sp ---- 1110 1.10 .... .... 1010 .1. 0 .... @vfp_dnm_s |
186 | - TYPE_PVPANIC) | 133 | +VFNMA_sp ---- 1110 1.01 .... .... 1010 .0. 0 .... @vfp_dnm_s |
187 | - | 134 | +VFNMS_sp ---- 1110 1.01 .... .... 1010 .1. 0 .... @vfp_dnm_s |
188 | static void handle_event(int event) | ||
189 | { | ||
190 | static bool logged; | ||
191 | @@ -XXX,XX +XXX,XX @@ static void handle_event(int event) | ||
192 | } | ||
193 | } | ||
194 | |||
195 | -#include "hw/isa/isa.h" | ||
196 | - | ||
197 | -struct PVPanicState { | ||
198 | - ISADevice parent_obj; | ||
199 | - | ||
200 | - MemoryRegion io; | ||
201 | - uint16_t ioport; | ||
202 | - uint8_t events; | ||
203 | -}; | ||
204 | - | ||
205 | /* return supported events on read */ | ||
206 | -static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size) | ||
207 | +static uint64_t pvpanic_read(void *opaque, hwaddr addr, unsigned size) | ||
208 | { | ||
209 | PVPanicState *pvp = opaque; | ||
210 | return pvp->events; | ||
211 | } | ||
212 | |||
213 | -static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val, | ||
214 | +static void pvpanic_write(void *opaque, hwaddr addr, uint64_t val, | ||
215 | unsigned size) | ||
216 | { | ||
217 | handle_event(val); | ||
218 | } | ||
219 | |||
220 | static const MemoryRegionOps pvpanic_ops = { | ||
221 | - .read = pvpanic_ioport_read, | ||
222 | - .write = pvpanic_ioport_write, | ||
223 | + .read = pvpanic_read, | ||
224 | + .write = pvpanic_write, | ||
225 | .impl = { | ||
226 | .min_access_size = 1, | ||
227 | .max_access_size = 1, | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | -static void pvpanic_isa_initfn(Object *obj) | ||
232 | +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size) | ||
233 | { | ||
234 | - PVPanicState *s = ISA_PVPANIC_DEVICE(obj); | ||
235 | - | ||
236 | - memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1); | ||
237 | + memory_region_init_io(&s->mr, OBJECT(dev), &pvpanic_ops, s, "pvpanic", size); | ||
238 | } | ||
239 | - | ||
240 | -static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) | ||
241 | -{ | ||
242 | - ISADevice *d = ISA_DEVICE(dev); | ||
243 | - PVPanicState *s = ISA_PVPANIC_DEVICE(dev); | ||
244 | - FWCfgState *fw_cfg = fw_cfg_find(); | ||
245 | - uint16_t *pvpanic_port; | ||
246 | - | ||
247 | - if (!fw_cfg) { | ||
248 | - return; | ||
249 | - } | ||
250 | - | ||
251 | - pvpanic_port = g_malloc(sizeof(*pvpanic_port)); | ||
252 | - *pvpanic_port = cpu_to_le16(s->ioport); | ||
253 | - fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, | ||
254 | - sizeof(*pvpanic_port)); | ||
255 | - | ||
256 | - isa_register_ioport(d, &s->io, s->ioport); | ||
257 | -} | ||
258 | - | ||
259 | -static Property pvpanic_isa_properties[] = { | ||
260 | - DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505), | ||
261 | - DEFINE_PROP_UINT8("events", PVPanicState, events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | ||
262 | - DEFINE_PROP_END_OF_LIST(), | ||
263 | -}; | ||
264 | - | ||
265 | -static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
266 | -{ | ||
267 | - DeviceClass *dc = DEVICE_CLASS(klass); | ||
268 | - | ||
269 | - dc->realize = pvpanic_isa_realizefn; | ||
270 | - device_class_set_props(dc, pvpanic_isa_properties); | ||
271 | - set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
272 | -} | ||
273 | - | ||
274 | -static TypeInfo pvpanic_isa_info = { | ||
275 | - .name = TYPE_PVPANIC, | ||
276 | - .parent = TYPE_ISA_DEVICE, | ||
277 | - .instance_size = sizeof(PVPanicState), | ||
278 | - .instance_init = pvpanic_isa_initfn, | ||
279 | - .class_init = pvpanic_isa_class_init, | ||
280 | -}; | ||
281 | - | ||
282 | -static void pvpanic_register_types(void) | ||
283 | -{ | ||
284 | - type_register_static(&pvpanic_isa_info); | ||
285 | -} | ||
286 | - | ||
287 | -type_init(pvpanic_register_types) | ||
288 | diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig | ||
289 | index XXXXXXX..XXXXXXX 100644 | ||
290 | --- a/hw/i386/Kconfig | ||
291 | +++ b/hw/i386/Kconfig | ||
292 | @@ -XXX,XX +XXX,XX @@ config PC | ||
293 | imply ISA_DEBUG | ||
294 | imply PARALLEL | ||
295 | imply PCI_DEVICES | ||
296 | - imply PVPANIC | ||
297 | + imply PVPANIC_ISA | ||
298 | imply QXL | ||
299 | imply SEV | ||
300 | imply SGA | ||
301 | diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig | ||
302 | index XXXXXXX..XXXXXXX 100644 | ||
303 | --- a/hw/misc/Kconfig | ||
304 | +++ b/hw/misc/Kconfig | ||
305 | @@ -XXX,XX +XXX,XX @@ config IOTKIT_SYSCTL | ||
306 | config IOTKIT_SYSINFO | ||
307 | bool | ||
308 | |||
309 | -config PVPANIC | ||
310 | +config PVPANIC_COMMON | ||
311 | + bool | ||
312 | + | 135 | + |
313 | +config PVPANIC_ISA | 136 | +VFMA_dp ---- 1110 1.10 .... .... 1011 .0.0 .... @vfp_dnm_d |
314 | bool | 137 | +VFMS_dp ---- 1110 1.10 .... .... 1011 .1.0 .... @vfp_dnm_d |
315 | depends on ISA_BUS | 138 | +VFNMA_dp ---- 1110 1.01 .... .... 1011 .0.0 .... @vfp_dnm_d |
316 | + select PVPANIC_COMMON | 139 | +VFNMS_dp ---- 1110 1.01 .... .... 1011 .1.0 .... @vfp_dnm_d |
317 | 140 | ||
318 | config AUX | 141 | VMOV_imm_sp ---- 1110 1.11 .... .... 1010 0000 .... \ |
319 | bool | 142 | vd=%vd_sp imm=%vmov_imm |
320 | diff --git a/hw/misc/meson.build b/hw/misc/meson.build | ||
321 | index XXXXXXX..XXXXXXX 100644 | ||
322 | --- a/hw/misc/meson.build | ||
323 | +++ b/hw/misc/meson.build | ||
324 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('emc141x.c')) | ||
325 | softmmu_ss.add(when: 'CONFIG_UNIMP', if_true: files('unimp.c')) | ||
326 | softmmu_ss.add(when: 'CONFIG_EMPTY_SLOT', if_true: files('empty_slot.c')) | ||
327 | softmmu_ss.add(when: 'CONFIG_LED', if_true: files('led.c')) | ||
328 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_COMMON', if_true: files('pvpanic.c')) | ||
329 | |||
330 | # ARM devices | ||
331 | softmmu_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l2x0.c')) | ||
332 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSINFO', if_true: files('iotkit-sysinfo.c') | ||
333 | softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) | ||
334 | softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) | ||
335 | |||
336 | -softmmu_ss.add(when: 'CONFIG_PVPANIC', if_true: files('pvpanic.c')) | ||
337 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) | ||
338 | softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) | ||
339 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) | ||
340 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) | ||
341 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
342 | index XXXXXXX..XXXXXXX 100644 | ||
343 | --- a/tests/qtest/meson.build | ||
344 | +++ b/tests/qtest/meson.build | ||
345 | @@ -XXX,XX +XXX,XX @@ qtests_i386 = \ | ||
346 | (config_host.has_key('CONFIG_LINUX') and \ | ||
347 | config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ | ||
348 | (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ | ||
349 | - (config_all_devices.has_key('CONFIG_PVPANIC') ? ['pvpanic-test'] : []) + \ | ||
350 | + (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ | ||
351 | (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ | ||
352 | (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ | ||
353 | (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ | ||
354 | -- | 143 | -- |
355 | 2.20.1 | 144 | 2.20.1 |
356 | 145 | ||
357 | 146 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Implement gpio-pwr driver to allow reboot and poweroff machine. | 3 | Passing the raw op field from the manual is less instructive |
4 | This is simple driver with just 2 gpios lines. Current use case | 4 | than it might be. Do the full decode and use the existing |
5 | is to reboot and poweroff virt machine in secure mode. Secure | 5 | helpers to perform the expansion. |
6 | pl066 gpio chip is needed for that. | ||
7 | 6 | ||
8 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 7 | Since these are v8 insns, VECLEN+VECSTRIDE are already RES0. |
9 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | 8 | |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200224222232.13807-18-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 13 | --- |
13 | hw/gpio/gpio_pwr.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ | 14 | target/arm/translate-vfp.inc.c | 109 +++++++++++---------------------- |
14 | hw/gpio/Kconfig | 3 ++ | 15 | target/arm/vfp-uncond.decode | 12 ++-- |
15 | hw/gpio/meson.build | 1 + | 16 | 2 files changed, 44 insertions(+), 77 deletions(-) |
16 | 3 files changed, 74 insertions(+) | ||
17 | create mode 100644 hw/gpio/gpio_pwr.c | ||
18 | 17 | ||
19 | diff --git a/hw/gpio/gpio_pwr.c b/hw/gpio/gpio_pwr.c | 18 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
20 | new file mode 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | index XXXXXXX..XXXXXXX | 20 | --- a/target/arm/translate-vfp.inc.c |
22 | --- /dev/null | 21 | +++ b/target/arm/translate-vfp.inc.c |
23 | +++ b/hw/gpio/gpio_pwr.c | 22 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) |
24 | @@ -XXX,XX +XXX,XX @@ | 23 | return true; |
25 | +/* | 24 | } |
26 | + * GPIO qemu power controller | 25 | |
27 | + * | 26 | -static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) |
28 | + * Copyright (c) 2020 Linaro Limited | 27 | -{ |
29 | + * | 28 | - uint32_t rd, rn, rm; |
30 | + * Author: Maxim Uvarov <maxim.uvarov@linaro.org> | 29 | - bool dp = a->dp; |
31 | + * | 30 | - bool vmin = a->op; |
32 | + * Virtual gpio driver which can be used on top of pl061 | 31 | - TCGv_ptr fpst; |
33 | + * to reboot and shutdown qemu virtual machine. One of use | 32 | - |
34 | + * case is gpio driver for secure world application (ARM | 33 | - if (!dc_isar_feature(aa32_vminmaxnm, s)) { |
35 | + * Trusted Firmware.). | 34 | - return false; |
36 | + * | 35 | - } |
37 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 36 | - |
38 | + * See the COPYING file in the top-level directory. | 37 | - if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) { |
39 | + * SPDX-License-Identifier: GPL-2.0-or-later | 38 | - return false; |
40 | + */ | 39 | - } |
41 | + | 40 | - |
42 | +/* | 41 | - /* UNDEF accesses to D16-D31 if they don't exist */ |
43 | + * QEMU interface: | 42 | - if (dp && !dc_isar_feature(aa32_simd_r32, s) && |
44 | + * two named input GPIO lines: | 43 | - ((a->vm | a->vn | a->vd) & 0x10)) { |
45 | + * 'reset' : when asserted, trigger system reset | 44 | - return false; |
46 | + * 'shutdown' : when asserted, trigger system shutdown | 45 | - } |
47 | + */ | 46 | - |
48 | + | 47 | - rd = a->vd; |
49 | +#include "qemu/osdep.h" | 48 | - rn = a->vn; |
50 | +#include "hw/sysbus.h" | 49 | - rm = a->vm; |
51 | +#include "sysemu/runstate.h" | 50 | - |
52 | + | 51 | - if (!vfp_access_check(s)) { |
53 | +#define TYPE_GPIOPWR "gpio-pwr" | 52 | - return true; |
54 | +OBJECT_DECLARE_SIMPLE_TYPE(GPIO_PWR_State, GPIOPWR) | 53 | - } |
55 | + | 54 | - |
56 | +struct GPIO_PWR_State { | 55 | - fpst = get_fpstatus_ptr(0); |
57 | + SysBusDevice parent_obj; | 56 | - |
58 | +}; | 57 | - if (dp) { |
59 | + | 58 | - TCGv_i64 frn, frm, dest; |
60 | +static void gpio_pwr_reset(void *opaque, int n, int level) | 59 | - |
60 | - frn = tcg_temp_new_i64(); | ||
61 | - frm = tcg_temp_new_i64(); | ||
62 | - dest = tcg_temp_new_i64(); | ||
63 | - | ||
64 | - neon_load_reg64(frn, rn); | ||
65 | - neon_load_reg64(frm, rm); | ||
66 | - if (vmin) { | ||
67 | - gen_helper_vfp_minnumd(dest, frn, frm, fpst); | ||
68 | - } else { | ||
69 | - gen_helper_vfp_maxnumd(dest, frn, frm, fpst); | ||
70 | - } | ||
71 | - neon_store_reg64(dest, rd); | ||
72 | - tcg_temp_free_i64(frn); | ||
73 | - tcg_temp_free_i64(frm); | ||
74 | - tcg_temp_free_i64(dest); | ||
75 | - } else { | ||
76 | - TCGv_i32 frn, frm, dest; | ||
77 | - | ||
78 | - frn = tcg_temp_new_i32(); | ||
79 | - frm = tcg_temp_new_i32(); | ||
80 | - dest = tcg_temp_new_i32(); | ||
81 | - | ||
82 | - neon_load_reg32(frn, rn); | ||
83 | - neon_load_reg32(frm, rm); | ||
84 | - if (vmin) { | ||
85 | - gen_helper_vfp_minnums(dest, frn, frm, fpst); | ||
86 | - } else { | ||
87 | - gen_helper_vfp_maxnums(dest, frn, frm, fpst); | ||
88 | - } | ||
89 | - neon_store_reg32(dest, rd); | ||
90 | - tcg_temp_free_i32(frn); | ||
91 | - tcg_temp_free_i32(frm); | ||
92 | - tcg_temp_free_i32(dest); | ||
93 | - } | ||
94 | - | ||
95 | - tcg_temp_free_ptr(fpst); | ||
96 | - return true; | ||
97 | -} | ||
98 | - | ||
99 | /* | ||
100 | * Table for converting the most common AArch32 encoding of | ||
101 | * rounding mode to arm_fprounding order (which matches the | ||
102 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_dp *a) | ||
103 | return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false); | ||
104 | } | ||
105 | |||
106 | +static bool trans_VMINNM_sp(DisasContext *s, arg_VMINNM_sp *a) | ||
61 | +{ | 107 | +{ |
62 | + if (level) { | 108 | + if (!dc_isar_feature(aa32_vminmaxnm, s)) { |
63 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | 109 | + return false; |
64 | + } | 110 | + } |
111 | + return do_vfp_3op_sp(s, gen_helper_vfp_minnums, | ||
112 | + a->vd, a->vn, a->vm, false); | ||
65 | +} | 113 | +} |
66 | + | 114 | + |
67 | +static void gpio_pwr_shutdown(void *opaque, int n, int level) | 115 | +static bool trans_VMAXNM_sp(DisasContext *s, arg_VMAXNM_sp *a) |
68 | +{ | 116 | +{ |
69 | + if (level) { | 117 | + if (!dc_isar_feature(aa32_vminmaxnm, s)) { |
70 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | 118 | + return false; |
71 | + } | 119 | + } |
120 | + return do_vfp_3op_sp(s, gen_helper_vfp_maxnums, | ||
121 | + a->vd, a->vn, a->vm, false); | ||
72 | +} | 122 | +} |
73 | + | 123 | + |
74 | +static void gpio_pwr_init(Object *obj) | 124 | +static bool trans_VMINNM_dp(DisasContext *s, arg_VMINNM_dp *a) |
75 | +{ | 125 | +{ |
76 | + DeviceState *dev = DEVICE(obj); | 126 | + if (!dc_isar_feature(aa32_vminmaxnm, s)) { |
77 | + | 127 | + return false; |
78 | + qdev_init_gpio_in_named(dev, gpio_pwr_reset, "reset", 1); | 128 | + } |
79 | + qdev_init_gpio_in_named(dev, gpio_pwr_shutdown, "shutdown", 1); | 129 | + return do_vfp_3op_dp(s, gen_helper_vfp_minnumd, |
130 | + a->vd, a->vn, a->vm, false); | ||
80 | +} | 131 | +} |
81 | + | 132 | + |
82 | +static const TypeInfo gpio_pwr_info = { | 133 | +static bool trans_VMAXNM_dp(DisasContext *s, arg_VMAXNM_dp *a) |
83 | + .name = TYPE_GPIOPWR, | ||
84 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
85 | + .instance_size = sizeof(GPIO_PWR_State), | ||
86 | + .instance_init = gpio_pwr_init, | ||
87 | +}; | ||
88 | + | ||
89 | +static void gpio_pwr_register_types(void) | ||
90 | +{ | 134 | +{ |
91 | + type_register_static(&gpio_pwr_info); | 135 | + if (!dc_isar_feature(aa32_vminmaxnm, s)) { |
136 | + return false; | ||
137 | + } | ||
138 | + return do_vfp_3op_dp(s, gen_helper_vfp_maxnumd, | ||
139 | + a->vd, a->vn, a->vm, false); | ||
92 | +} | 140 | +} |
93 | + | 141 | + |
94 | +type_init(gpio_pwr_register_types) | 142 | static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) |
95 | diff --git a/hw/gpio/Kconfig b/hw/gpio/Kconfig | 143 | { |
144 | /* | ||
145 | diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode | ||
96 | index XXXXXXX..XXXXXXX 100644 | 146 | index XXXXXXX..XXXXXXX 100644 |
97 | --- a/hw/gpio/Kconfig | 147 | --- a/target/arm/vfp-uncond.decode |
98 | +++ b/hw/gpio/Kconfig | 148 | +++ b/target/arm/vfp-uncond.decode |
99 | @@ -XXX,XX +XXX,XX @@ config PL061 | 149 | @@ -XXX,XX +XXX,XX @@ |
100 | config GPIO_KEY | 150 | %vd_dp 22:1 12:4 |
101 | bool | 151 | %vd_sp 12:4 22:1 |
102 | 152 | ||
103 | +config GPIO_PWR | 153 | +@vfp_dnm_s ................................ vm=%vm_sp vn=%vn_sp vd=%vd_sp |
104 | + bool | 154 | +@vfp_dnm_d ................................ vm=%vm_dp vn=%vn_dp vd=%vd_dp |
105 | + | 155 | + |
106 | config SIFIVE_GPIO | 156 | VSEL 1111 1110 0. cc:2 .... .... 1010 .0.0 .... \ |
107 | bool | 157 | vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 |
108 | diff --git a/hw/gpio/meson.build b/hw/gpio/meson.build | 158 | VSEL 1111 1110 0. cc:2 .... .... 1011 .0.0 .... \ |
109 | index XXXXXXX..XXXXXXX 100644 | 159 | vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 |
110 | --- a/hw/gpio/meson.build | 160 | |
111 | +++ b/hw/gpio/meson.build | 161 | -VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \ |
112 | @@ -XXX,XX +XXX,XX @@ | 162 | - vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 |
113 | softmmu_ss.add(when: 'CONFIG_E500', if_true: files('mpc8xxx.c')) | 163 | -VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \ |
114 | softmmu_ss.add(when: 'CONFIG_GPIO_KEY', if_true: files('gpio_key.c')) | 164 | - vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 |
115 | +softmmu_ss.add(when: 'CONFIG_GPIO_PWR', if_true: files('gpio_pwr.c')) | 165 | +VMAXNM_sp 1111 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s |
116 | softmmu_ss.add(when: 'CONFIG_MAX7310', if_true: files('max7310.c')) | 166 | +VMINNM_sp 1111 1110 1.00 .... .... 1010 .1.0 .... @vfp_dnm_s |
117 | softmmu_ss.add(when: 'CONFIG_PL061', if_true: files('pl061.c')) | 167 | + |
118 | softmmu_ss.add(when: 'CONFIG_PUV3', if_true: files('puv3_gpio.c')) | 168 | +VMAXNM_dp 1111 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d |
169 | +VMINNM_dp 1111 1110 1.00 .... .... 1011 .1.0 .... @vfp_dnm_d | ||
170 | |||
171 | VRINT 1111 1110 1.11 10 rm:2 .... 1010 01.0 .... \ | ||
172 | vm=%vm_sp vd=%vd_sp dp=0 | ||
119 | -- | 173 | -- |
120 | 2.20.1 | 174 | 2.20.1 |
121 | 175 | ||
122 | 176 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Hao Wu <wuhaotsh@google.com> | ||
2 | 1 | ||
3 | Fix potential overflow problem when calculating pwm_duty. | ||
4 | 1. Ensure p->cmr and p->cnr to be from [0,65535], according to the | ||
5 | hardware specification. | ||
6 | 2. Changed duty to uint32_t. However, since MAX_DUTY * (p->cmr+1) | ||
7 | can excceed UINT32_MAX, we convert them to uint64_t in computation | ||
8 | and converted them back to uint32_t. | ||
9 | (duty is guaranteed to be <= MAX_DUTY so it won't overflow.) | ||
10 | |||
11 | Fixes: CID 1442342 | ||
12 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Doug Evans <dje@google.com> | ||
14 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | ||
15 | Message-id: 20210127011142.2122790-1-wuhaotsh@google.com | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | hw/misc/npcm7xx_pwm.c | 23 +++++++++++++++++++---- | ||
20 | tests/qtest/npcm7xx_pwm-test.c | 4 ++-- | ||
21 | 2 files changed, 21 insertions(+), 6 deletions(-) | ||
22 | |||
23 | diff --git a/hw/misc/npcm7xx_pwm.c b/hw/misc/npcm7xx_pwm.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/misc/npcm7xx_pwm.c | ||
26 | +++ b/hw/misc/npcm7xx_pwm.c | ||
27 | @@ -XXX,XX +XXX,XX @@ REG32(NPCM7XX_PWM_PWDR3, 0x50); | ||
28 | #define NPCM7XX_CH_INV BIT(2) | ||
29 | #define NPCM7XX_CH_MOD BIT(3) | ||
30 | |||
31 | +#define NPCM7XX_MAX_CMR 65535 | ||
32 | +#define NPCM7XX_MAX_CNR 65535 | ||
33 | + | ||
34 | /* Offset of each PWM channel's prescaler in the PPR register. */ | ||
35 | static const int npcm7xx_ppr_base[] = { 0, 0, 8, 8 }; | ||
36 | /* Offset of each PWM channel's clock selector in the CSR register. */ | ||
37 | @@ -XXX,XX +XXX,XX @@ static uint32_t npcm7xx_pwm_calculate_freq(NPCM7xxPWM *p) | ||
38 | |||
39 | static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *p) | ||
40 | { | ||
41 | - uint64_t duty; | ||
42 | + uint32_t duty; | ||
43 | |||
44 | if (p->running) { | ||
45 | if (p->cnr == 0) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *p) | ||
47 | } else if (p->cmr >= p->cnr) { | ||
48 | duty = NPCM7XX_PWM_MAX_DUTY; | ||
49 | } else { | ||
50 | - duty = NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->cnr + 1); | ||
51 | + duty = (uint64_t)NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->cnr + 1); | ||
52 | } | ||
53 | } else { | ||
54 | duty = 0; | ||
55 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_pwm_write(void *opaque, hwaddr offset, | ||
56 | case A_NPCM7XX_PWM_CNR2: | ||
57 | case A_NPCM7XX_PWM_CNR3: | ||
58 | p = &s->pwm[npcm7xx_cnr_index(offset)]; | ||
59 | - p->cnr = value; | ||
60 | + if (value > NPCM7XX_MAX_CNR) { | ||
61 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
62 | + "%s: invalid cnr value: %u", __func__, value); | ||
63 | + p->cnr = NPCM7XX_MAX_CNR; | ||
64 | + } else { | ||
65 | + p->cnr = value; | ||
66 | + } | ||
67 | npcm7xx_pwm_update_output(p); | ||
68 | break; | ||
69 | |||
70 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_pwm_write(void *opaque, hwaddr offset, | ||
71 | case A_NPCM7XX_PWM_CMR2: | ||
72 | case A_NPCM7XX_PWM_CMR3: | ||
73 | p = &s->pwm[npcm7xx_cmr_index(offset)]; | ||
74 | - p->cmr = value; | ||
75 | + if (value > NPCM7XX_MAX_CMR) { | ||
76 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
77 | + "%s: invalid cmr value: %u", __func__, value); | ||
78 | + p->cmr = NPCM7XX_MAX_CMR; | ||
79 | + } else { | ||
80 | + p->cmr = value; | ||
81 | + } | ||
82 | npcm7xx_pwm_update_output(p); | ||
83 | break; | ||
84 | |||
85 | diff --git a/tests/qtest/npcm7xx_pwm-test.c b/tests/qtest/npcm7xx_pwm-test.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/tests/qtest/npcm7xx_pwm-test.c | ||
88 | +++ b/tests/qtest/npcm7xx_pwm-test.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static uint64_t pwm_compute_freq(QTestState *qts, uint32_t ppr, uint32_t csr, | ||
90 | |||
91 | static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t cmr, bool inverted) | ||
92 | { | ||
93 | - uint64_t duty; | ||
94 | + uint32_t duty; | ||
95 | |||
96 | if (cnr == 0) { | ||
97 | /* PWM is stopped. */ | ||
98 | @@ -XXX,XX +XXX,XX @@ static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t cmr, bool inverted) | ||
99 | } else if (cmr >= cnr) { | ||
100 | duty = MAX_DUTY; | ||
101 | } else { | ||
102 | - duty = MAX_DUTY * (cmr + 1) / (cnr + 1); | ||
103 | + duty = (uint64_t)MAX_DUTY * (cmr + 1) / (cnr + 1); | ||
104 | } | ||
105 | |||
106 | if (inverted) { | ||
107 | -- | ||
108 | 2.20.1 | ||
109 | |||
110 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | Add a test case for pvpanic-pci device. The scenario is the same as pvpanic | 3 | USB ports on Xilinx Zync must be instantiated as TYPE_CHIPIDEA to work. |
4 | ISA device, but is using the PCI bus. | 4 | Linux expects and checks various chipidea registers, which do not exist |
5 | with the basic ehci emulation. This patch series fixes the problem. | ||
5 | 6 | ||
6 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 7 | Without this patch, USB ports fail to instantiate under Linux. |
7 | Acked-by: Thomas Huth <thuth@redhat.com> | 8 | |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | ci_hdrc ci_hdrc.0: doesn't support host |
9 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 10 | ci_hdrc ci_hdrc.0: no supported roles |
11 | |||
12 | With this patch, USB ports are instantiated, and it is possible | ||
13 | to boot from USB drive. | ||
14 | |||
15 | ci_hdrc ci_hdrc.0: EHCI Host Controller | ||
16 | ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 | ||
17 | ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00 | ||
18 | usb 1-1: new full-speed USB device number 2 using ci_hdrc | ||
19 | usb 1-1: not running at top speed; connect to a high speed hub | ||
20 | usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid maxpacket 512, setting to 64 | ||
21 | usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x2 has invalid maxpacket 512, setting to 64 | ||
22 | usb-storage 1-1:1.0: USB Mass Storage device detected | ||
23 | scsi host0: usb-storage 1-1:1.0 | ||
24 | |||
25 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
26 | Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> | ||
27 | Message-id: 20200215122354.13706-2-linux@roeck-us.net | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 29 | --- |
12 | tests/qtest/pvpanic-pci-test.c | 94 ++++++++++++++++++++++++++++++++++ | 30 | hw/arm/xilinx_zynq.c | 5 +++-- |
13 | tests/qtest/meson.build | 1 + | 31 | 1 file changed, 3 insertions(+), 2 deletions(-) |
14 | 2 files changed, 95 insertions(+) | ||
15 | create mode 100644 tests/qtest/pvpanic-pci-test.c | ||
16 | 32 | ||
17 | diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c | 33 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c |
18 | new file mode 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
19 | index XXXXXXX..XXXXXXX | 35 | --- a/hw/arm/xilinx_zynq.c |
20 | --- /dev/null | 36 | +++ b/hw/arm/xilinx_zynq.c |
21 | +++ b/tests/qtest/pvpanic-pci-test.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | 37 | @@ -XXX,XX +XXX,XX @@ |
23 | +/* | 38 | #include "hw/loader.h" |
24 | + * QTest testcase for PV Panic PCI device | 39 | #include "hw/misc/zynq-xadc.h" |
25 | + * | 40 | #include "hw/ssi/ssi.h" |
26 | + * Copyright (C) 2020 Oracle | 41 | +#include "hw/usb/chipidea.h" |
27 | + * | 42 | #include "qemu/error-report.h" |
28 | + * Authors: | 43 | #include "hw/sd/sdhci.h" |
29 | + * Mihai Carabas <mihai.carabas@oracle.com> | 44 | #include "hw/char/cadence_uart.h" |
30 | + * | 45 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) |
31 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 46 | zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false); |
32 | + * See the COPYING file in the top-level directory. | 47 | zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true); |
33 | + * | 48 | |
34 | + */ | 49 | - sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]); |
35 | + | 50 | - sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]); |
36 | +#include "qemu/osdep.h" | 51 | + sysbus_create_simple(TYPE_CHIPIDEA, 0xE0002000, pic[53 - IRQ_OFFSET]); |
37 | +#include "libqos/libqtest.h" | 52 | + sysbus_create_simple(TYPE_CHIPIDEA, 0xE0003000, pic[76 - IRQ_OFFSET]); |
38 | +#include "qapi/qmp/qdict.h" | 53 | |
39 | +#include "libqos/pci.h" | 54 | cadence_uart_create(0xE0000000, pic[59 - IRQ_OFFSET], serial_hd(0)); |
40 | +#include "libqos/pci-pc.h" | 55 | cadence_uart_create(0xE0001000, pic[82 - IRQ_OFFSET], serial_hd(1)); |
41 | +#include "hw/pci/pci_regs.h" | ||
42 | + | ||
43 | +static void test_panic_nopause(void) | ||
44 | +{ | ||
45 | + uint8_t val; | ||
46 | + QDict *response, *data; | ||
47 | + QTestState *qts; | ||
48 | + QPCIBus *pcibus; | ||
49 | + QPCIDevice *dev; | ||
50 | + QPCIBar bar; | ||
51 | + | ||
52 | + qts = qtest_init("-device pvpanic-pci,addr=04.0 -action panic=none"); | ||
53 | + pcibus = qpci_new_pc(qts, NULL); | ||
54 | + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); | ||
55 | + qpci_device_enable(dev); | ||
56 | + bar = qpci_iomap(dev, 0, NULL); | ||
57 | + | ||
58 | + qpci_memread(dev, bar, 0, &val, sizeof(val)); | ||
59 | + g_assert_cmpuint(val, ==, 3); | ||
60 | + | ||
61 | + val = 1; | ||
62 | + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); | ||
63 | + | ||
64 | + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); | ||
65 | + g_assert(qdict_haskey(response, "data")); | ||
66 | + data = qdict_get_qdict(response, "data"); | ||
67 | + g_assert(qdict_haskey(data, "action")); | ||
68 | + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "run"); | ||
69 | + qobject_unref(response); | ||
70 | + | ||
71 | + qtest_quit(qts); | ||
72 | +} | ||
73 | + | ||
74 | +static void test_panic(void) | ||
75 | +{ | ||
76 | + uint8_t val; | ||
77 | + QDict *response, *data; | ||
78 | + QTestState *qts; | ||
79 | + QPCIBus *pcibus; | ||
80 | + QPCIDevice *dev; | ||
81 | + QPCIBar bar; | ||
82 | + | ||
83 | + qts = qtest_init("-device pvpanic-pci,addr=04.0 -action panic=pause"); | ||
84 | + pcibus = qpci_new_pc(qts, NULL); | ||
85 | + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); | ||
86 | + qpci_device_enable(dev); | ||
87 | + bar = qpci_iomap(dev, 0, NULL); | ||
88 | + | ||
89 | + qpci_memread(dev, bar, 0, &val, sizeof(val)); | ||
90 | + g_assert_cmpuint(val, ==, 3); | ||
91 | + | ||
92 | + val = 1; | ||
93 | + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); | ||
94 | + | ||
95 | + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); | ||
96 | + g_assert(qdict_haskey(response, "data")); | ||
97 | + data = qdict_get_qdict(response, "data"); | ||
98 | + g_assert(qdict_haskey(data, "action")); | ||
99 | + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause"); | ||
100 | + qobject_unref(response); | ||
101 | + | ||
102 | + qtest_quit(qts); | ||
103 | +} | ||
104 | + | ||
105 | +int main(int argc, char **argv) | ||
106 | +{ | ||
107 | + int ret; | ||
108 | + | ||
109 | + g_test_init(&argc, &argv, NULL); | ||
110 | + qtest_add_func("/pvpanic-pci/panic", test_panic); | ||
111 | + qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause); | ||
112 | + | ||
113 | + ret = g_test_run(); | ||
114 | + | ||
115 | + return ret; | ||
116 | +} | ||
117 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/tests/qtest/meson.build | ||
120 | +++ b/tests/qtest/meson.build | ||
121 | @@ -XXX,XX +XXX,XX @@ qtests_i386 = \ | ||
122 | config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ | ||
123 | (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ | ||
124 | (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ | ||
125 | + (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ | ||
126 | (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ | ||
127 | (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ | ||
128 | (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ | ||
129 | -- | 56 | -- |
130 | 2.20.1 | 57 | 2.20.1 |
131 | 58 | ||
132 | 59 | diff view generated by jsdifflib |
1 | Now no users are setting the frq properties on the CMSDK timer, | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | dualtimer, watchdog or ARMSSE SoC devices, we can remove the | ||
3 | properties and the struct fields that back them. | ||
4 | 2 | ||
3 | Xilinx USB devices are now instantiated through TYPE_CHIPIDEA, | ||
4 | and xlnx support in the EHCI code is no longer needed. | ||
5 | |||
6 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
7 | Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> | ||
8 | Message-id: 20200215122354.13706-3-linux@roeck-us.net | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20210128114145.20536-25-peter.maydell@linaro.org | ||
10 | Message-id: 20210121190622.22000-25-peter.maydell@linaro.org | ||
11 | --- | 10 | --- |
12 | include/hw/arm/armsse.h | 2 -- | 11 | hw/usb/hcd-ehci-sysbus.c | 17 ----------------- |
13 | include/hw/timer/cmsdk-apb-dualtimer.h | 2 -- | 12 | 1 file changed, 17 deletions(-) |
14 | include/hw/timer/cmsdk-apb-timer.h | 2 -- | ||
15 | include/hw/watchdog/cmsdk-apb-watchdog.h | 2 -- | ||
16 | hw/arm/armsse.c | 2 -- | ||
17 | hw/timer/cmsdk-apb-dualtimer.c | 6 ------ | ||
18 | hw/timer/cmsdk-apb-timer.c | 6 ------ | ||
19 | hw/watchdog/cmsdk-apb-watchdog.c | 6 ------ | ||
20 | 8 files changed, 28 deletions(-) | ||
21 | 13 | ||
22 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | 14 | diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/arm/armsse.h | 16 | --- a/hw/usb/hcd-ehci-sysbus.c |
25 | +++ b/include/hw/arm/armsse.h | 17 | +++ b/hw/usb/hcd-ehci-sysbus.c |
26 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo ehci_platform_type_info = { |
27 | * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals | 19 | .class_init = ehci_platform_class_init, |
28 | * + QOM property "memory" is a MemoryRegion containing the devices provided | ||
29 | * by the board model. | ||
30 | - * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | ||
31 | * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. | ||
32 | * (In hardware, the SSE-200 permits the number of expansion interrupts | ||
33 | * for the two CPUs to be configured separately, but we restrict it to | ||
34 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | ||
35 | /* Properties */ | ||
36 | MemoryRegion *board_memory; | ||
37 | uint32_t exp_numirq; | ||
38 | - uint32_t mainclk_frq; | ||
39 | uint32_t sram_addr_width; | ||
40 | uint32_t init_svtor; | ||
41 | bool cpu_fpu[SSE_MAX_CPUS]; | ||
42 | diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/include/hw/timer/cmsdk-apb-dualtimer.h | ||
45 | +++ b/include/hw/timer/cmsdk-apb-dualtimer.h | ||
46 | @@ -XXX,XX +XXX,XX @@ | ||
47 | * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
48 | * | ||
49 | * QEMU interface: | ||
50 | - * + QOM property "pclk-frq": frequency at which the timer is clocked | ||
51 | * + Clock input "TIMCLK": clock (for both timers) | ||
52 | * + sysbus MMIO region 0: the register bank | ||
53 | * + sysbus IRQ 0: combined timer interrupt TIMINTC | ||
54 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBDualTimer { | ||
55 | /*< public >*/ | ||
56 | MemoryRegion iomem; | ||
57 | qemu_irq timerintc; | ||
58 | - uint32_t pclk_frq; | ||
59 | Clock *timclk; | ||
60 | |||
61 | CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; | ||
62 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/include/hw/timer/cmsdk-apb-timer.h | ||
65 | +++ b/include/hw/timer/cmsdk-apb-timer.h | ||
66 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | ||
67 | |||
68 | /* | ||
69 | * QEMU interface: | ||
70 | - * + QOM property "pclk-frq": frequency at which the timer is clocked | ||
71 | * + Clock input "pclk": clock for the timer | ||
72 | * + sysbus MMIO region 0: the register bank | ||
73 | * + sysbus IRQ 0: timer interrupt TIMERINT | ||
74 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | ||
75 | /*< public >*/ | ||
76 | MemoryRegion iomem; | ||
77 | qemu_irq timerint; | ||
78 | - uint32_t pclk_frq; | ||
79 | struct ptimer_state *timer; | ||
80 | Clock *pclk; | ||
81 | |||
82 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | --- a/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
85 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
86 | @@ -XXX,XX +XXX,XX @@ | ||
87 | * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
88 | * | ||
89 | * QEMU interface: | ||
90 | - * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked | ||
91 | * + Clock input "WDOGCLK": clock for the watchdog's timer | ||
92 | * + sysbus MMIO region 0: the register bank | ||
93 | * + sysbus IRQ 0: watchdog interrupt | ||
94 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBWatchdog { | ||
95 | /*< public >*/ | ||
96 | MemoryRegion iomem; | ||
97 | qemu_irq wdogint; | ||
98 | - uint32_t wdogclk_frq; | ||
99 | bool is_luminary; | ||
100 | struct ptimer_state *timer; | ||
101 | Clock *wdogclk; | ||
102 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/hw/arm/armsse.c | ||
105 | +++ b/hw/arm/armsse.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static Property iotkit_properties[] = { | ||
107 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | ||
108 | MemoryRegion *), | ||
109 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | ||
110 | - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | ||
111 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | ||
112 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | ||
113 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), | ||
114 | @@ -XXX,XX +XXX,XX @@ static Property armsse_properties[] = { | ||
115 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | ||
116 | MemoryRegion *), | ||
117 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | ||
118 | - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | ||
119 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | ||
120 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | ||
121 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), | ||
122 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | ||
123 | index XXXXXXX..XXXXXXX 100644 | ||
124 | --- a/hw/timer/cmsdk-apb-dualtimer.c | ||
125 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | ||
126 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_dualtimer_vmstate = { | ||
127 | } | ||
128 | }; | 20 | }; |
129 | 21 | ||
130 | -static Property cmsdk_apb_dualtimer_properties[] = { | 22 | -static void ehci_xlnx_class_init(ObjectClass *oc, void *data) |
131 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBDualTimer, pclk_frq, 0), | 23 | -{ |
132 | - DEFINE_PROP_END_OF_LIST(), | 24 | - SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); |
25 | - DeviceClass *dc = DEVICE_CLASS(oc); | ||
26 | - | ||
27 | - set_bit(DEVICE_CATEGORY_USB, dc->categories); | ||
28 | - sec->capsbase = 0x100; | ||
29 | - sec->opregbase = 0x140; | ||
30 | -} | ||
31 | - | ||
32 | -static const TypeInfo ehci_xlnx_type_info = { | ||
33 | - .name = "xlnx,ps7-usb", | ||
34 | - .parent = TYPE_SYS_BUS_EHCI, | ||
35 | - .class_init = ehci_xlnx_class_init, | ||
133 | -}; | 36 | -}; |
134 | - | 37 | - |
135 | static void cmsdk_apb_dualtimer_class_init(ObjectClass *klass, void *data) | 38 | static void ehci_exynos4210_class_init(ObjectClass *oc, void *data) |
136 | { | 39 | { |
137 | DeviceClass *dc = DEVICE_CLASS(klass); | 40 | SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); |
138 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_class_init(ObjectClass *klass, void *data) | 41 | @@ -XXX,XX +XXX,XX @@ static void ehci_sysbus_register_types(void) |
139 | dc->realize = cmsdk_apb_dualtimer_realize; | ||
140 | dc->vmsd = &cmsdk_apb_dualtimer_vmstate; | ||
141 | dc->reset = cmsdk_apb_dualtimer_reset; | ||
142 | - device_class_set_props(dc, cmsdk_apb_dualtimer_properties); | ||
143 | } | ||
144 | |||
145 | static const TypeInfo cmsdk_apb_dualtimer_info = { | ||
146 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/timer/cmsdk-apb-timer.c | ||
149 | +++ b/hw/timer/cmsdk-apb-timer.c | ||
150 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_timer_vmstate = { | ||
151 | } | ||
152 | }; | ||
153 | |||
154 | -static Property cmsdk_apb_timer_properties[] = { | ||
155 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), | ||
156 | - DEFINE_PROP_END_OF_LIST(), | ||
157 | -}; | ||
158 | - | ||
159 | static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | ||
160 | { | 42 | { |
161 | DeviceClass *dc = DEVICE_CLASS(klass); | 43 | type_register_static(&ehci_type_info); |
162 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | 44 | type_register_static(&ehci_platform_type_info); |
163 | dc->realize = cmsdk_apb_timer_realize; | 45 | - type_register_static(&ehci_xlnx_type_info); |
164 | dc->vmsd = &cmsdk_apb_timer_vmstate; | 46 | type_register_static(&ehci_exynos4210_type_info); |
165 | dc->reset = cmsdk_apb_timer_reset; | 47 | type_register_static(&ehci_tegra2_type_info); |
166 | - device_class_set_props(dc, cmsdk_apb_timer_properties); | 48 | type_register_static(&ehci_ppc4xx_type_info); |
167 | } | ||
168 | |||
169 | static const TypeInfo cmsdk_apb_timer_info = { | ||
170 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | ||
171 | index XXXXXXX..XXXXXXX 100644 | ||
172 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | ||
173 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
174 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_watchdog_vmstate = { | ||
175 | } | ||
176 | }; | ||
177 | |||
178 | -static Property cmsdk_apb_watchdog_properties[] = { | ||
179 | - DEFINE_PROP_UINT32("wdogclk-frq", CMSDKAPBWatchdog, wdogclk_frq, 0), | ||
180 | - DEFINE_PROP_END_OF_LIST(), | ||
181 | -}; | ||
182 | - | ||
183 | static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) | ||
184 | { | ||
185 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
186 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) | ||
187 | dc->realize = cmsdk_apb_watchdog_realize; | ||
188 | dc->vmsd = &cmsdk_apb_watchdog_vmstate; | ||
189 | dc->reset = cmsdk_apb_watchdog_reset; | ||
190 | - device_class_set_props(dc, cmsdk_apb_watchdog_properties); | ||
191 | } | ||
192 | |||
193 | static const TypeInfo cmsdk_apb_watchdog_info = { | ||
194 | -- | 49 | -- |
195 | 2.20.1 | 50 | 2.20.1 |
196 | 51 | ||
197 | 52 | diff view generated by jsdifflib |
1 | Add a simple test of the CMSDK dual timer, since we're about to do | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | some refactoring of how it is clocked. | ||
3 | 2 | ||
3 | Old kernels from the Meego project can be used to check that Linux | ||
4 | is at least starting on these machines. | ||
5 | |||
6 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20200225172501.29609-2-philmd@redhat.com | ||
12 | Message-Id: <20200129131920.22302-1-thuth@redhat.com> | ||
13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Message-id: 20210128114145.20536-6-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-6-peter.maydell@linaro.org | ||
10 | --- | 15 | --- |
11 | tests/qtest/cmsdk-apb-dualtimer-test.c | 130 +++++++++++++++++++++++++ | 16 | MAINTAINERS | 1 + |
12 | MAINTAINERS | 1 + | 17 | tests/acceptance/machine_arm_n8x0.py | 49 ++++++++++++++++++++++++++++ |
13 | tests/qtest/meson.build | 1 + | 18 | 2 files changed, 50 insertions(+) |
14 | 3 files changed, 132 insertions(+) | 19 | create mode 100644 tests/acceptance/machine_arm_n8x0.py |
15 | create mode 100644 tests/qtest/cmsdk-apb-dualtimer-test.c | ||
16 | 20 | ||
17 | diff --git a/tests/qtest/cmsdk-apb-dualtimer-test.c b/tests/qtest/cmsdk-apb-dualtimer-test.c | ||
18 | new file mode 100644 | ||
19 | index XXXXXXX..XXXXXXX | ||
20 | --- /dev/null | ||
21 | +++ b/tests/qtest/cmsdk-apb-dualtimer-test.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | +/* | ||
24 | + * QTest testcase for the CMSDK APB dualtimer device | ||
25 | + * | ||
26 | + * Copyright (c) 2021 Linaro Limited | ||
27 | + * | ||
28 | + * This program is free software; you can redistribute it and/or modify it | ||
29 | + * under the terms of the GNU General Public License as published by the | ||
30 | + * Free Software Foundation; either version 2 of the License, or | ||
31 | + * (at your option) any later version. | ||
32 | + * | ||
33 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
34 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
35 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
36 | + * for more details. | ||
37 | + */ | ||
38 | + | ||
39 | +#include "qemu/osdep.h" | ||
40 | +#include "libqtest-single.h" | ||
41 | + | ||
42 | +/* IoTKit/ARMSSE dualtimer; driven at 25MHz in mps2-an385, so 40ns per tick */ | ||
43 | +#define TIMER_BASE 0x40002000 | ||
44 | + | ||
45 | +#define TIMER1LOAD 0 | ||
46 | +#define TIMER1VALUE 4 | ||
47 | +#define TIMER1CONTROL 8 | ||
48 | +#define TIMER1INTCLR 0xc | ||
49 | +#define TIMER1RIS 0x10 | ||
50 | +#define TIMER1MIS 0x14 | ||
51 | +#define TIMER1BGLOAD 0x18 | ||
52 | + | ||
53 | +#define TIMER2LOAD 0x20 | ||
54 | +#define TIMER2VALUE 0x24 | ||
55 | +#define TIMER2CONTROL 0x28 | ||
56 | +#define TIMER2INTCLR 0x2c | ||
57 | +#define TIMER2RIS 0x30 | ||
58 | +#define TIMER2MIS 0x34 | ||
59 | +#define TIMER2BGLOAD 0x38 | ||
60 | + | ||
61 | +#define CTRL_ENABLE (1 << 7) | ||
62 | +#define CTRL_PERIODIC (1 << 6) | ||
63 | +#define CTRL_INTEN (1 << 5) | ||
64 | +#define CTRL_PRESCALE_1 (0 << 2) | ||
65 | +#define CTRL_PRESCALE_16 (1 << 2) | ||
66 | +#define CTRL_PRESCALE_256 (2 << 2) | ||
67 | +#define CTRL_32BIT (1 << 1) | ||
68 | +#define CTRL_ONESHOT (1 << 0) | ||
69 | + | ||
70 | +static void test_dualtimer(void) | ||
71 | +{ | ||
72 | + g_assert_true(readl(TIMER_BASE + TIMER1RIS) == 0); | ||
73 | + | ||
74 | + /* Start timer: will fire after 40000 ns */ | ||
75 | + writel(TIMER_BASE + TIMER1LOAD, 1000); | ||
76 | + /* enable in free-running, wrapping, interrupt mode */ | ||
77 | + writel(TIMER_BASE + TIMER1CONTROL, CTRL_ENABLE | CTRL_INTEN); | ||
78 | + | ||
79 | + /* Step to just past the 500th tick and check VALUE */ | ||
80 | + clock_step(500 * 40 + 1); | ||
81 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 0); | ||
82 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 500); | ||
83 | + | ||
84 | + /* Just past the 1000th tick: timer should have fired */ | ||
85 | + clock_step(500 * 40); | ||
86 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 1); | ||
87 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 0); | ||
88 | + | ||
89 | + /* | ||
90 | + * We are in free-running wrapping 16-bit mode, so on the following | ||
91 | + * tick VALUE should have wrapped round to 0xffff. | ||
92 | + */ | ||
93 | + clock_step(40); | ||
94 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 0xffff); | ||
95 | + | ||
96 | + /* Check that any write to INTCLR clears interrupt */ | ||
97 | + writel(TIMER_BASE + TIMER1INTCLR, 1); | ||
98 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 0); | ||
99 | + | ||
100 | + /* Turn off the timer */ | ||
101 | + writel(TIMER_BASE + TIMER1CONTROL, 0); | ||
102 | +} | ||
103 | + | ||
104 | +static void test_prescale(void) | ||
105 | +{ | ||
106 | + g_assert_true(readl(TIMER_BASE + TIMER2RIS) == 0); | ||
107 | + | ||
108 | + /* Start timer: will fire after 40 * 256 * 1000 == 1024000 ns */ | ||
109 | + writel(TIMER_BASE + TIMER2LOAD, 1000); | ||
110 | + /* enable in periodic, wrapping, interrupt mode, prescale 256 */ | ||
111 | + writel(TIMER_BASE + TIMER2CONTROL, | ||
112 | + CTRL_ENABLE | CTRL_INTEN | CTRL_PERIODIC | CTRL_PRESCALE_256); | ||
113 | + | ||
114 | + /* Step to just past the 500th tick and check VALUE */ | ||
115 | + clock_step(40 * 256 * 501); | ||
116 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 0); | ||
117 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 500); | ||
118 | + | ||
119 | + /* Just past the 1000th tick: timer should have fired */ | ||
120 | + clock_step(40 * 256 * 500); | ||
121 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 1); | ||
122 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 0); | ||
123 | + | ||
124 | + /* In periodic mode the tick VALUE now reloads */ | ||
125 | + clock_step(40 * 256); | ||
126 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 1000); | ||
127 | + | ||
128 | + /* Check that any write to INTCLR clears interrupt */ | ||
129 | + writel(TIMER_BASE + TIMER2INTCLR, 1); | ||
130 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 0); | ||
131 | + | ||
132 | + /* Turn off the timer */ | ||
133 | + writel(TIMER_BASE + TIMER2CONTROL, 0); | ||
134 | +} | ||
135 | + | ||
136 | +int main(int argc, char **argv) | ||
137 | +{ | ||
138 | + int r; | ||
139 | + | ||
140 | + g_test_init(&argc, &argv, NULL); | ||
141 | + | ||
142 | + qtest_start("-machine mps2-an385"); | ||
143 | + | ||
144 | + qtest_add_func("/cmsdk-apb-dualtimer/dualtimer", test_dualtimer); | ||
145 | + qtest_add_func("/cmsdk-apb-dualtimer/prescale", test_prescale); | ||
146 | + | ||
147 | + r = g_test_run(); | ||
148 | + | ||
149 | + qtest_end(); | ||
150 | + | ||
151 | + return r; | ||
152 | +} | ||
153 | diff --git a/MAINTAINERS b/MAINTAINERS | 21 | diff --git a/MAINTAINERS b/MAINTAINERS |
154 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
155 | --- a/MAINTAINERS | 23 | --- a/MAINTAINERS |
156 | +++ b/MAINTAINERS | 24 | +++ b/MAINTAINERS |
157 | @@ -XXX,XX +XXX,XX @@ F: include/hw/timer/cmsdk-apb-timer.h | 25 | @@ -XXX,XX +XXX,XX @@ F: hw/rtc/twl92230.c |
158 | F: tests/qtest/cmsdk-apb-timer-test.c | 26 | F: include/hw/display/blizzard.h |
159 | F: hw/timer/cmsdk-apb-dualtimer.c | 27 | F: include/hw/input/tsc2xxx.h |
160 | F: include/hw/timer/cmsdk-apb-dualtimer.h | 28 | F: include/hw/misc/cbus.h |
161 | +F: tests/qtest/cmsdk-apb-dualtimer-test.c | 29 | +F: tests/acceptance/machine_arm_n8x0.py |
162 | F: hw/char/cmsdk-apb-uart.c | 30 | |
163 | F: include/hw/char/cmsdk-apb-uart.h | 31 | Palm |
164 | F: hw/watchdog/cmsdk-apb-watchdog.c | 32 | M: Andrzej Zaborowski <balrogg@gmail.com> |
165 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 33 | diff --git a/tests/acceptance/machine_arm_n8x0.py b/tests/acceptance/machine_arm_n8x0.py |
166 | index XXXXXXX..XXXXXXX 100644 | 34 | new file mode 100644 |
167 | --- a/tests/qtest/meson.build | 35 | index XXXXXXX..XXXXXXX |
168 | +++ b/tests/qtest/meson.build | 36 | --- /dev/null |
169 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | 37 | +++ b/tests/acceptance/machine_arm_n8x0.py |
170 | 'npcm7xx_timer-test', | 38 | @@ -XXX,XX +XXX,XX @@ |
171 | 'npcm7xx_watchdog_timer-test'] | 39 | +# Functional test that boots a Linux kernel and checks the console |
172 | qtests_arm = \ | 40 | +# |
173 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ | 41 | +# Copyright (c) 2020 Red Hat, Inc. |
174 | (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | 42 | +# |
175 | (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ | 43 | +# Author: |
176 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | 44 | +# Thomas Huth <thuth@redhat.com> |
45 | +# | ||
46 | +# This work is licensed under the terms of the GNU GPL, version 2 or | ||
47 | +# later. See the COPYING file in the top-level directory. | ||
48 | + | ||
49 | +import os | ||
50 | + | ||
51 | +from avocado import skipUnless | ||
52 | +from avocado_qemu import Test | ||
53 | +from avocado_qemu import wait_for_console_pattern | ||
54 | + | ||
55 | +class N8x0Machine(Test): | ||
56 | + """Boots the Linux kernel and checks that the console is operational""" | ||
57 | + | ||
58 | + timeout = 90 | ||
59 | + | ||
60 | + def __do_test_n8x0(self): | ||
61 | + kernel_url = ('http://stskeeps.subnetmask.net/meego-n8x0/' | ||
62 | + 'meego-arm-n8x0-1.0.80.20100712.1431-' | ||
63 | + 'vmlinuz-2.6.35~rc4-129.1-n8x0') | ||
64 | + kernel_hash = 'e9d5ab8d7548923a0061b6fbf601465e479ed269' | ||
65 | + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | ||
66 | + | ||
67 | + self.vm.set_console(console_index=1) | ||
68 | + self.vm.add_args('-kernel', kernel_path, | ||
69 | + '-append', 'printk.time=0 console=ttyS1') | ||
70 | + self.vm.launch() | ||
71 | + wait_for_console_pattern(self, 'TSC2005 driver initializing') | ||
72 | + | ||
73 | + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') | ||
74 | + def test_n800(self): | ||
75 | + """ | ||
76 | + :avocado: tags=arch:arm | ||
77 | + :avocado: tags=machine:n800 | ||
78 | + """ | ||
79 | + self.__do_test_n8x0() | ||
80 | + | ||
81 | + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') | ||
82 | + def test_n810(self): | ||
83 | + """ | ||
84 | + :avocado: tags=arch:arm | ||
85 | + :avocado: tags=machine:n810 | ||
86 | + """ | ||
87 | + self.__do_test_n8x0() | ||
177 | -- | 88 | -- |
178 | 2.20.1 | 89 | 2.20.1 |
179 | 90 | ||
180 | 91 | diff view generated by jsdifflib |
1 | Add a simple test of the CMSDK watchdog, since we're about to do some | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | refactoring of how it is clocked. | ||
3 | 2 | ||
3 | There is a kernel and initrd available on github which we can use | ||
4 | for testing this machine. | ||
5 | |||
6 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> | ||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20200225172501.29609-3-philmd@redhat.com | ||
12 | Message-Id: <20200131170233.14584-1-thuth@redhat.com> | ||
13 | [PMD: Renamed test method, moved description from class to method] | ||
14 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-5-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-5-peter.maydell@linaro.org | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | --- | 16 | --- |
12 | tests/qtest/cmsdk-apb-watchdog-test.c | 79 +++++++++++++++++++++++++++ | 17 | MAINTAINERS | 1 + |
13 | MAINTAINERS | 1 + | 18 | tests/acceptance/machine_arm_integratorcp.py | 43 ++++++++++++++++++++ |
14 | tests/qtest/meson.build | 1 + | 19 | 2 files changed, 44 insertions(+) |
15 | 3 files changed, 81 insertions(+) | 20 | create mode 100644 tests/acceptance/machine_arm_integratorcp.py |
16 | create mode 100644 tests/qtest/cmsdk-apb-watchdog-test.c | ||
17 | 21 | ||
18 | diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-watchdog-test.c | ||
19 | new file mode 100644 | ||
20 | index XXXXXXX..XXXXXXX | ||
21 | --- /dev/null | ||
22 | +++ b/tests/qtest/cmsdk-apb-watchdog-test.c | ||
23 | @@ -XXX,XX +XXX,XX @@ | ||
24 | +/* | ||
25 | + * QTest testcase for the CMSDK APB watchdog device | ||
26 | + * | ||
27 | + * Copyright (c) 2021 Linaro Limited | ||
28 | + * | ||
29 | + * This program is free software; you can redistribute it and/or modify it | ||
30 | + * under the terms of the GNU General Public License as published by the | ||
31 | + * Free Software Foundation; either version 2 of the License, or | ||
32 | + * (at your option) any later version. | ||
33 | + * | ||
34 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
35 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
36 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
37 | + * for more details. | ||
38 | + */ | ||
39 | + | ||
40 | +#include "qemu/osdep.h" | ||
41 | +#include "libqtest-single.h" | ||
42 | + | ||
43 | +/* | ||
44 | + * lm3s811evb watchdog; at board startup this runs at 200MHz / 16 == 12.5MHz, | ||
45 | + * which is 80ns per tick. | ||
46 | + */ | ||
47 | +#define WDOG_BASE 0x40000000 | ||
48 | + | ||
49 | +#define WDOGLOAD 0 | ||
50 | +#define WDOGVALUE 4 | ||
51 | +#define WDOGCONTROL 8 | ||
52 | +#define WDOGINTCLR 0xc | ||
53 | +#define WDOGRIS 0x10 | ||
54 | +#define WDOGMIS 0x14 | ||
55 | +#define WDOGLOCK 0xc00 | ||
56 | + | ||
57 | +static void test_watchdog(void) | ||
58 | +{ | ||
59 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
60 | + | ||
61 | + writel(WDOG_BASE + WDOGCONTROL, 1); | ||
62 | + writel(WDOG_BASE + WDOGLOAD, 1000); | ||
63 | + | ||
64 | + /* Step to just past the 500th tick */ | ||
65 | + clock_step(500 * 80 + 1); | ||
66 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
67 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
68 | + | ||
69 | + /* Just past the 1000th tick: timer should have fired */ | ||
70 | + clock_step(500 * 80); | ||
71 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
72 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 0); | ||
73 | + | ||
74 | + /* VALUE reloads at following tick */ | ||
75 | + clock_step(80); | ||
76 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
77 | + | ||
78 | + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ | ||
79 | + clock_step(500 * 80); | ||
80 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
81 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
82 | + writel(WDOG_BASE + WDOGINTCLR, 0); | ||
83 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
84 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
85 | +} | ||
86 | + | ||
87 | +int main(int argc, char **argv) | ||
88 | +{ | ||
89 | + int r; | ||
90 | + | ||
91 | + g_test_init(&argc, &argv, NULL); | ||
92 | + | ||
93 | + qtest_start("-machine lm3s811evb"); | ||
94 | + | ||
95 | + qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); | ||
96 | + | ||
97 | + r = g_test_run(); | ||
98 | + | ||
99 | + qtest_end(); | ||
100 | + | ||
101 | + return r; | ||
102 | +} | ||
103 | diff --git a/MAINTAINERS b/MAINTAINERS | 22 | diff --git a/MAINTAINERS b/MAINTAINERS |
104 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
105 | --- a/MAINTAINERS | 24 | --- a/MAINTAINERS |
106 | +++ b/MAINTAINERS | 25 | +++ b/MAINTAINERS |
107 | @@ -XXX,XX +XXX,XX @@ F: hw/char/cmsdk-apb-uart.c | 26 | @@ -XXX,XX +XXX,XX @@ S: Maintained |
108 | F: include/hw/char/cmsdk-apb-uart.h | 27 | F: hw/arm/integratorcp.c |
109 | F: hw/watchdog/cmsdk-apb-watchdog.c | 28 | F: hw/misc/arm_integrator_debug.c |
110 | F: include/hw/watchdog/cmsdk-apb-watchdog.h | 29 | F: include/hw/misc/arm_integrator_debug.h |
111 | +F: tests/qtest/cmsdk-apb-watchdog-test.c | 30 | +F: tests/acceptance/machine_arm_integratorcp.py |
112 | F: hw/misc/tz-ppc.c | 31 | |
113 | F: include/hw/misc/tz-ppc.h | 32 | MCIMX6UL EVK / i.MX6ul |
114 | F: hw/misc/tz-mpc.c | 33 | M: Peter Maydell <peter.maydell@linaro.org> |
115 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 34 | diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py |
116 | index XXXXXXX..XXXXXXX 100644 | 35 | new file mode 100644 |
117 | --- a/tests/qtest/meson.build | 36 | index XXXXXXX..XXXXXXX |
118 | +++ b/tests/qtest/meson.build | 37 | --- /dev/null |
119 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | 38 | +++ b/tests/acceptance/machine_arm_integratorcp.py |
120 | 'npcm7xx_watchdog_timer-test'] | 39 | @@ -XXX,XX +XXX,XX @@ |
121 | qtests_arm = \ | 40 | +# Functional test that boots a Linux kernel and checks the console |
122 | (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | 41 | +# |
123 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ | 42 | +# Copyright (c) 2020 Red Hat, Inc. |
124 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | 43 | +# |
125 | (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ | 44 | +# Author: |
126 | ['arm-cpu-features', | 45 | +# Thomas Huth <thuth@redhat.com> |
46 | +# | ||
47 | +# This work is licensed under the terms of the GNU GPL, version 2 or | ||
48 | +# later. See the COPYING file in the top-level directory. | ||
49 | + | ||
50 | +import os | ||
51 | + | ||
52 | +from avocado import skipUnless | ||
53 | +from avocado_qemu import Test | ||
54 | +from avocado_qemu import wait_for_console_pattern | ||
55 | + | ||
56 | +class IntegratorMachine(Test): | ||
57 | + | ||
58 | + timeout = 90 | ||
59 | + | ||
60 | + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') | ||
61 | + def test_integratorcp_console(self): | ||
62 | + """ | ||
63 | + Boots the Linux kernel and checks that the console is operational | ||
64 | + :avocado: tags=arch:arm | ||
65 | + :avocado: tags=machine:integratorcp | ||
66 | + """ | ||
67 | + kernel_url = ('https://github.com/zayac/qemu-arm/raw/master/' | ||
68 | + 'arm-test/kernel/zImage.integrator') | ||
69 | + kernel_hash = '0d7adba893c503267c946a3cbdc63b4b54f25468' | ||
70 | + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | ||
71 | + | ||
72 | + initrd_url = ('https://github.com/zayac/qemu-arm/raw/master/' | ||
73 | + 'arm-test/kernel/arm_root.img') | ||
74 | + initrd_hash = 'b51e4154285bf784e017a37586428332d8c7bd8b' | ||
75 | + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | ||
76 | + | ||
77 | + self.vm.set_console() | ||
78 | + self.vm.add_args('-kernel', kernel_path, | ||
79 | + '-initrd', initrd_path, | ||
80 | + '-append', 'printk.time=0 console=ttyAMA0') | ||
81 | + self.vm.launch() | ||
82 | + wait_for_console_pattern(self, 'Log in as root') | ||
127 | -- | 83 | -- |
128 | 2.20.1 | 84 | 2.20.1 |
129 | 85 | ||
130 | 86 | diff view generated by jsdifflib |
1 | From: Alexander Graf <agraf@csgraf.de> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | In macOS 11, QEMU only gets access to Hypervisor.framework if it has the | 3 | As we want to re-use this code, extract it as a new function. |
4 | respective entitlement. Add an entitlement template and automatically self | 4 | Since we are using the PL011 serial console, add a Avocado tag |
5 | sign and apply the entitlement in the build. | 5 | to ease filtering of tests. |
6 | 6 | ||
7 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
8 | Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> | 8 | Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> |
9 | Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> | 9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Message-id: 20200225172501.29609-4-philmd@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 12 | --- |
12 | meson.build | 29 +++++++++++++++++++++++++---- | 13 | tests/acceptance/machine_arm_integratorcp.py | 18 +++++++++++------- |
13 | accel/hvf/entitlements.plist | 8 ++++++++ | 14 | 1 file changed, 11 insertions(+), 7 deletions(-) |
14 | scripts/entitlement.sh | 13 +++++++++++++ | ||
15 | 3 files changed, 46 insertions(+), 4 deletions(-) | ||
16 | create mode 100644 accel/hvf/entitlements.plist | ||
17 | create mode 100755 scripts/entitlement.sh | ||
18 | 15 | ||
19 | diff --git a/meson.build b/meson.build | 16 | diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py |
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/meson.build | 18 | --- a/tests/acceptance/machine_arm_integratorcp.py |
22 | +++ b/meson.build | 19 | +++ b/tests/acceptance/machine_arm_integratorcp.py |
23 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | 20 | @@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test): |
24 | }] | 21 | |
25 | endif | 22 | timeout = 90 |
26 | foreach exe: execs | 23 | |
27 | - emulators += {exe['name']: | 24 | - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') |
28 | - executable(exe['name'], exe['sources'], | 25 | - def test_integratorcp_console(self): |
29 | - install: true, | 26 | - """ |
30 | + exe_name = exe['name'] | 27 | - Boots the Linux kernel and checks that the console is operational |
31 | + exe_sign = 'CONFIG_HVF' in config_target | 28 | - :avocado: tags=arch:arm |
32 | + if exe_sign | 29 | - :avocado: tags=machine:integratorcp |
33 | + exe_name += '-unsigned' | 30 | - """ |
34 | + endif | 31 | + def boot_integratorcp(self): |
32 | kernel_url = ('https://github.com/zayac/qemu-arm/raw/master/' | ||
33 | 'arm-test/kernel/zImage.integrator') | ||
34 | kernel_hash = '0d7adba893c503267c946a3cbdc63b4b54f25468' | ||
35 | @@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test): | ||
36 | '-initrd', initrd_path, | ||
37 | '-append', 'printk.time=0 console=ttyAMA0') | ||
38 | self.vm.launch() | ||
35 | + | 39 | + |
36 | + emulator = executable(exe_name, exe['sources'], | 40 | + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') |
37 | + install: not exe_sign, | 41 | + def test_integratorcp_console(self): |
38 | c_args: c_args, | 42 | + """ |
39 | dependencies: arch_deps + deps + exe['dependencies'], | 43 | + Boots the Linux kernel and checks that the console is operational |
40 | objects: lib.extract_all_objects(recursive: true), | 44 | + :avocado: tags=arch:arm |
41 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | 45 | + :avocado: tags=machine:integratorcp |
42 | link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), | 46 | + :avocado: tags=device:pl011 |
43 | link_args: link_args, | 47 | + """ |
44 | gui_app: exe['gui']) | 48 | + self.boot_integratorcp() |
45 | - } | 49 | wait_for_console_pattern(self, 'Log in as root') |
46 | + | ||
47 | + if exe_sign | ||
48 | + emulators += {exe['name'] : custom_target(exe['name'], | ||
49 | + install: true, | ||
50 | + install_dir: get_option('bindir'), | ||
51 | + depends: emulator, | ||
52 | + output: exe['name'], | ||
53 | + command: [ | ||
54 | + meson.current_source_dir() / 'scripts/entitlement.sh', | ||
55 | + meson.current_build_dir() / exe_name, | ||
56 | + meson.current_build_dir() / exe['name'], | ||
57 | + meson.current_source_dir() / 'accel/hvf/entitlements.plist' | ||
58 | + ]) | ||
59 | + } | ||
60 | + else | ||
61 | + emulators += {exe['name']: emulator} | ||
62 | + endif | ||
63 | |||
64 | if 'CONFIG_TRACE_SYSTEMTAP' in config_host | ||
65 | foreach stp: [ | ||
66 | diff --git a/accel/hvf/entitlements.plist b/accel/hvf/entitlements.plist | ||
67 | new file mode 100644 | ||
68 | index XXXXXXX..XXXXXXX | ||
69 | --- /dev/null | ||
70 | +++ b/accel/hvf/entitlements.plist | ||
71 | @@ -XXX,XX +XXX,XX @@ | ||
72 | +<?xml version="1.0" encoding="UTF-8"?> | ||
73 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
74 | +<plist version="1.0"> | ||
75 | +<dict> | ||
76 | + <key>com.apple.security.hypervisor</key> | ||
77 | + <true/> | ||
78 | +</dict> | ||
79 | +</plist> | ||
80 | diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh | ||
81 | new file mode 100755 | ||
82 | index XXXXXXX..XXXXXXX | ||
83 | --- /dev/null | ||
84 | +++ b/scripts/entitlement.sh | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | +#!/bin/sh -e | ||
87 | +# | ||
88 | +# Helper script for the build process to apply entitlements | ||
89 | + | ||
90 | +SRC="$1" | ||
91 | +DST="$2" | ||
92 | +ENTITLEMENT="$3" | ||
93 | + | ||
94 | +trap 'rm "$DST.tmp"' exit | ||
95 | +cp -af "$SRC" "$DST.tmp" | ||
96 | +codesign --entitlements "$ENTITLEMENT" --force -s - "$DST.tmp" | ||
97 | +mv "$DST.tmp" "$DST" | ||
98 | +trap '' exit | ||
99 | -- | 50 | -- |
100 | 2.20.1 | 51 | 2.20.1 |
101 | 52 | ||
102 | 53 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type. | 3 | Add a test that verifies the Tux logo is displayed on the framebuffer. |
4 | |||
5 | We simply follow the OpenCV "Template Matching with Multiple Objects" | ||
6 | tutorial, replacing Lionel Messi by Tux: | ||
7 | https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html | ||
8 | |||
9 | When OpenCV and NumPy are installed, this test can be run using: | ||
10 | |||
11 | $ AVOCADO_ALLOW_UNTRUSTED_CODE=hmmm \ | ||
12 | avocado --show=app,framebuffer run -t device:framebuffer \ | ||
13 | tests/acceptance/machine_arm_integratorcp.py | ||
14 | JOB ID : 8c46b0f8269242e87d738247883ea2a470df949e | ||
15 | JOB LOG : avocado/job-results/job-2020-01-31T21.38-8c46b0f/job.log | ||
16 | (1/1) tests/acceptance/machine_arm_integratorcp.py:IntegratorMachine.test_framebuffer_tux_logo: | ||
17 | framebuffer: found Tux at position [x, y] = (0, 0) | ||
18 | PASS (3.96 s) | ||
19 | RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 | ||
20 | JOB TIME : 4.23 s | ||
4 | 21 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 22 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Message-id: 20210127232822.3530782-1-f4bug@amsat.org | 23 | Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Message-id: 20200225172501.29609-5-philmd@redhat.com |
25 | Message-Id: <20200131211102.29612-3-f4bug@amsat.org> | ||
26 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 28 | --- |
10 | target/arm/helper.c | 2 +- | 29 | tests/acceptance/machine_arm_integratorcp.py | 52 ++++++++++++++++++++ |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 30 | 1 file changed, 52 insertions(+) |
12 | 31 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 32 | diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py |
14 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 34 | --- a/tests/acceptance/machine_arm_integratorcp.py |
16 | +++ b/target/arm/helper.c | 35 | +++ b/tests/acceptance/machine_arm_integratorcp.py |
17 | @@ -XXX,XX +XXX,XX @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, | 36 | @@ -XXX,XX +XXX,XX @@ |
18 | 37 | # later. See the COPYING file in the top-level directory. | |
19 | *attrs = (MemTxAttrs) {}; | 38 | |
20 | 39 | import os | |
21 | - ret = get_phys_addr(env, addr, 0, mmu_idx, &phys_addr, | 40 | +import logging |
22 | + ret = get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &phys_addr, | 41 | |
23 | attrs, &prot, &page_size, &fi, &cacheattrs); | 42 | from avocado import skipUnless |
24 | 43 | from avocado_qemu import Test | |
25 | if (ret) { | 44 | from avocado_qemu import wait_for_console_pattern |
45 | |||
46 | + | ||
47 | +NUMPY_AVAILABLE = True | ||
48 | +try: | ||
49 | + import numpy as np | ||
50 | +except ImportError: | ||
51 | + NUMPY_AVAILABLE = False | ||
52 | + | ||
53 | +CV2_AVAILABLE = True | ||
54 | +try: | ||
55 | + import cv2 | ||
56 | +except ImportError: | ||
57 | + CV2_AVAILABLE = False | ||
58 | + | ||
59 | + | ||
60 | class IntegratorMachine(Test): | ||
61 | |||
62 | timeout = 90 | ||
63 | @@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test): | ||
64 | """ | ||
65 | self.boot_integratorcp() | ||
66 | wait_for_console_pattern(self, 'Log in as root') | ||
67 | + | ||
68 | + @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') | ||
69 | + @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') | ||
70 | + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') | ||
71 | + def test_framebuffer_tux_logo(self): | ||
72 | + """ | ||
73 | + Boot Linux and verify the Tux logo is displayed on the framebuffer. | ||
74 | + :avocado: tags=arch:arm | ||
75 | + :avocado: tags=machine:integratorcp | ||
76 | + :avocado: tags=device:pl110 | ||
77 | + :avocado: tags=device:framebuffer | ||
78 | + """ | ||
79 | + screendump_path = os.path.join(self.workdir, "screendump.pbm") | ||
80 | + tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/' | ||
81 | + 'drivers/video/logo/logo_linux_vga16.ppm') | ||
82 | + tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af' | ||
83 | + tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash) | ||
84 | + | ||
85 | + self.boot_integratorcp() | ||
86 | + framebuffer_ready = 'Console: switching to colour frame buffer device' | ||
87 | + wait_for_console_pattern(self, framebuffer_ready) | ||
88 | + self.vm.command('human-monitor-command', command_line='stop') | ||
89 | + self.vm.command('human-monitor-command', | ||
90 | + command_line='screendump %s' % screendump_path) | ||
91 | + logger = logging.getLogger('framebuffer') | ||
92 | + | ||
93 | + cpu_count = 1 | ||
94 | + match_threshold = 0.92 | ||
95 | + screendump_bgr = cv2.imread(screendump_path) | ||
96 | + screendump_gray = cv2.cvtColor(screendump_bgr, cv2.COLOR_BGR2GRAY) | ||
97 | + result = cv2.matchTemplate(screendump_gray, cv2.imread(tuxlogo_path, 0), | ||
98 | + cv2.TM_CCOEFF_NORMED) | ||
99 | + loc = np.where(result >= match_threshold) | ||
100 | + tux_count = 0 | ||
101 | + for tux_count, pt in enumerate(zip(*loc[::-1]), start=1): | ||
102 | + logger.debug('found Tux at position [x, y] = %s', pt) | ||
103 | + self.assertGreaterEqual(tux_count, cpu_count) | ||
26 | -- | 104 | -- |
27 | 2.20.1 | 105 | 2.20.1 |
28 | 106 | ||
29 | 107 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Move the preadv availability check to meson.build. This is what we | ||
2 | want to be doing for host-OS-feature-checks anyway, but it also fixes | ||
3 | a problem with building for macOS with the most recent XCode SDK on a | ||
4 | Catalina host. | ||
5 | 1 | ||
6 | On that configuration, 'preadv()' is provided as a weak symbol, so | ||
7 | that programs can be built with optional support for it and make a | ||
8 | runtime availability check to see whether the preadv() they have is a | ||
9 | working one or one which they must not call because it will | ||
10 | runtime-assert. QEMU's configure test passes (unless you're building | ||
11 | with --enable-werror) because the test program using preadv() | ||
12 | compiles, but then QEMU crashes at runtime when preadv() is called, | ||
13 | with errors like: | ||
14 | |||
15 | dyld: lazy symbol binding failed: Symbol not found: _preadv | ||
16 | Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication | ||
17 | Expected in: /usr/lib/libSystem.B.dylib | ||
18 | |||
19 | dyld: Symbol not found: _preadv | ||
20 | Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication | ||
21 | Expected in: /usr/lib/libSystem.B.dylib | ||
22 | |||
23 | Meson's own function availability check has a special case for macOS | ||
24 | which adds '-Wl,-no_weak_imports' to the compiler flags, which forces | ||
25 | the test to require the real function, not the macOS-version-too-old | ||
26 | stub. | ||
27 | |||
28 | So this commit fixes the bug where macOS builds on Catalina currently | ||
29 | require --disable-werror. | ||
30 | |||
31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
32 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
33 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
34 | Message-id: 20210126155846.17109-1-peter.maydell@linaro.org | ||
35 | --- | ||
36 | configure | 16 ---------------- | ||
37 | meson.build | 4 +++- | ||
38 | 2 files changed, 3 insertions(+), 17 deletions(-) | ||
39 | |||
40 | diff --git a/configure b/configure | ||
41 | index XXXXXXX..XXXXXXX 100755 | ||
42 | --- a/configure | ||
43 | +++ b/configure | ||
44 | @@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then | ||
45 | iovec=yes | ||
46 | fi | ||
47 | |||
48 | -########################################## | ||
49 | -# preadv probe | ||
50 | -cat > $TMPC <<EOF | ||
51 | -#include <sys/types.h> | ||
52 | -#include <sys/uio.h> | ||
53 | -#include <unistd.h> | ||
54 | -int main(void) { return preadv(0, 0, 0, 0); } | ||
55 | -EOF | ||
56 | -preadv=no | ||
57 | -if compile_prog "" "" ; then | ||
58 | - preadv=yes | ||
59 | -fi | ||
60 | - | ||
61 | ########################################## | ||
62 | # fdt probe | ||
63 | |||
64 | @@ -XXX,XX +XXX,XX @@ fi | ||
65 | if test "$iovec" = "yes" ; then | ||
66 | echo "CONFIG_IOVEC=y" >> $config_host_mak | ||
67 | fi | ||
68 | -if test "$preadv" = "yes" ; then | ||
69 | - echo "CONFIG_PREADV=y" >> $config_host_mak | ||
70 | -fi | ||
71 | if test "$membarrier" = "yes" ; then | ||
72 | echo "CONFIG_MEMBARRIER=y" >> $config_host_mak | ||
73 | fi | ||
74 | diff --git a/meson.build b/meson.build | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/meson.build | ||
77 | +++ b/meson.build | ||
78 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) | ||
79 | config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) | ||
80 | config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) | ||
81 | |||
82 | +config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | ||
83 | + | ||
84 | ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target | ||
85 | arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] | ||
86 | strings = ['HOST_DSOSUF', 'CONFIG_IASL'] | ||
87 | @@ -XXX,XX +XXX,XX @@ summary_info += {'PIE': get_option('b_pie')} | ||
88 | summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} | ||
89 | summary_info += {'malloc trim support': has_malloc_trim} | ||
90 | summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} | ||
91 | -summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')} | ||
92 | +summary_info += {'preadv support': config_host_data.get('CONFIG_PREADV')} | ||
93 | summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} | ||
94 | summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} | ||
95 | summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} | ||
96 | -- | ||
97 | 2.20.1 | ||
98 | |||
99 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Joelle van Dyne <j@getutm.app> | ||
2 | 1 | ||
3 | The iOS toolchain does not use the host prefix naming convention. So we | ||
4 | need to enable cross-compile options while allowing the PREFIX to be | ||
5 | blank. | ||
6 | |||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
9 | Message-id: 20210126012457.39046-3-j@getutm.app | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | configure | 6 ++++-- | ||
13 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/configure b/configure | ||
16 | index XXXXXXX..XXXXXXX 100755 | ||
17 | --- a/configure | ||
18 | +++ b/configure | ||
19 | @@ -XXX,XX +XXX,XX @@ cpu="" | ||
20 | iasl="iasl" | ||
21 | interp_prefix="/usr/gnemul/qemu-%M" | ||
22 | static="no" | ||
23 | +cross_compile="no" | ||
24 | cross_prefix="" | ||
25 | audio_drv_list="" | ||
26 | block_drv_rw_whitelist="" | ||
27 | @@ -XXX,XX +XXX,XX @@ for opt do | ||
28 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') | ||
29 | case "$opt" in | ||
30 | --cross-prefix=*) cross_prefix="$optarg" | ||
31 | + cross_compile="yes" | ||
32 | ;; | ||
33 | --cc=*) CC="$optarg" | ||
34 | ;; | ||
35 | @@ -XXX,XX +XXX,XX @@ $(echo Deprecated targets: $deprecated_targets_list | \ | ||
36 | --target-list-exclude=LIST exclude a set of targets from the default target-list | ||
37 | |||
38 | Advanced options (experts only): | ||
39 | - --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | ||
40 | + --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] | ||
41 | --cc=CC use C compiler CC [$cc] | ||
42 | --iasl=IASL use ACPI compiler IASL [$iasl] | ||
43 | --host-cc=CC use C compiler CC [$host_cc] for code run at | ||
44 | @@ -XXX,XX +XXX,XX @@ if has $sdl2_config; then | ||
45 | fi | ||
46 | echo "strip = [$(meson_quote $strip)]" >> $cross | ||
47 | echo "windres = [$(meson_quote $windres)]" >> $cross | ||
48 | -if test -n "$cross_prefix"; then | ||
49 | +if test "$cross_compile" = "yes"; then | ||
50 | cross_arg="--cross-file config-meson.cross" | ||
51 | echo "[host_machine]" >> $cross | ||
52 | if test "$mingw32" = "yes" ; then | ||
53 | -- | ||
54 | 2.20.1 | ||
55 | |||
56 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Joelle van Dyne <j@getutm.app> | ||
2 | 1 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
4 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
5 | Message-id: 20210126012457.39046-9-j@getutm.app | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | configure | 5 ++++- | ||
9 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/configure b/configure | ||
12 | index XXXXXXX..XXXXXXX 100755 | ||
13 | --- a/configure | ||
14 | +++ b/configure | ||
15 | @@ -XXX,XX +XXX,XX @@ if test "$cross_compile" = "yes"; then | ||
16 | echo "system = 'darwin'" >> $cross | ||
17 | fi | ||
18 | case "$ARCH" in | ||
19 | - i386|x86_64) | ||
20 | + i386) | ||
21 | echo "cpu_family = 'x86'" >> $cross | ||
22 | ;; | ||
23 | + x86_64) | ||
24 | + echo "cpu_family = 'x86_64'" >> $cross | ||
25 | + ;; | ||
26 | ppc64le) | ||
27 | echo "cpu_family = 'ppc64'" >> $cross | ||
28 | ;; | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
1 | Create and connect the Clock input for the watchdog device on the | 1 | We missed an instance of using FIELD_EX32 on a 64-bit ID |
---|---|---|---|
2 | Stellaris boards. Because the Stellaris boards model the ability to | 2 | register, in isar_feature_aa64_pmu_8_4(). Fix it. |
3 | change the clock rate by programming PLL registers, we have to create | ||
4 | an output Clock on the ssys_state device and wire it up to the | ||
5 | watchdog. | ||
6 | |||
7 | Note that the old comment on ssys_calculate_system_clock() got the | ||
8 | units wrong -- system_clock_scale is in nanoseconds, not | ||
9 | milliseconds. Improve the commentary to clarify how we are | ||
10 | calculating the period. | ||
11 | 3 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Message-id: 20200224172846.13053-2-peter.maydell@linaro.org |
16 | Message-id: 20210128114145.20536-18-peter.maydell@linaro.org | ||
17 | Message-id: 20210121190622.22000-18-peter.maydell@linaro.org | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | --- | 8 | --- |
20 | hw/arm/stellaris.c | 43 +++++++++++++++++++++++++++++++------------ | 9 | target/arm/cpu.h | 4 ++-- |
21 | 1 file changed, 31 insertions(+), 12 deletions(-) | 10 | 1 file changed, 2 insertions(+), 2 deletions(-) |
22 | 11 | ||
23 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 12 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
24 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/arm/stellaris.c | 14 | --- a/target/arm/cpu.h |
26 | +++ b/hw/arm/stellaris.c | 15 | +++ b/target/arm/cpu.h |
27 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmu_8_1(const ARMISARegisters *id) |
28 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | 17 | |
29 | #include "migration/vmstate.h" | 18 | static inline bool isar_feature_aa64_pmu_8_4(const ARMISARegisters *id) |
30 | #include "hw/misc/unimp.h" | 19 | { |
31 | +#include "hw/qdev-clock.h" | 20 | - return FIELD_EX32(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && |
32 | #include "cpu.h" | 21 | - FIELD_EX32(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; |
33 | #include "qom/object.h" | 22 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && |
34 | 23 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | |
35 | @@ -XXX,XX +XXX,XX @@ struct ssys_state { | ||
36 | uint32_t clkvclr; | ||
37 | uint32_t ldoarst; | ||
38 | qemu_irq irq; | ||
39 | + Clock *sysclk; | ||
40 | /* Properties (all read-only registers) */ | ||
41 | uint32_t user0; | ||
42 | uint32_t user1; | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool ssys_use_rcc2(ssys_state *s) | ||
44 | } | 24 | } |
45 | 25 | ||
46 | /* | 26 | /* |
47 | - * Caculate the sys. clock period in ms. | ||
48 | + * Calculate the system clock period. We only want to propagate | ||
49 | + * this change to the rest of the system if we're not being called | ||
50 | + * from migration post-load. | ||
51 | */ | ||
52 | -static void ssys_calculate_system_clock(ssys_state *s) | ||
53 | +static void ssys_calculate_system_clock(ssys_state *s, bool propagate_clock) | ||
54 | { | ||
55 | + /* | ||
56 | + * SYSDIV field specifies divisor: 0 == /1, 1 == /2, etc. Input | ||
57 | + * clock is 200MHz, which is a period of 5 ns. Dividing the clock | ||
58 | + * frequency by X is the same as multiplying the period by X. | ||
59 | + */ | ||
60 | if (ssys_use_rcc2(s)) { | ||
61 | system_clock_scale = 5 * (((s->rcc2 >> 23) & 0x3f) + 1); | ||
62 | } else { | ||
63 | system_clock_scale = 5 * (((s->rcc >> 23) & 0xf) + 1); | ||
64 | } | ||
65 | + clock_set_ns(s->sysclk, system_clock_scale); | ||
66 | + if (propagate_clock) { | ||
67 | + clock_propagate(s->sysclk); | ||
68 | + } | ||
69 | } | ||
70 | |||
71 | static void ssys_write(void *opaque, hwaddr offset, | ||
72 | @@ -XXX,XX +XXX,XX @@ static void ssys_write(void *opaque, hwaddr offset, | ||
73 | s->int_status |= (1 << 6); | ||
74 | } | ||
75 | s->rcc = value; | ||
76 | - ssys_calculate_system_clock(s); | ||
77 | + ssys_calculate_system_clock(s, true); | ||
78 | break; | ||
79 | case 0x070: /* RCC2 */ | ||
80 | if (ssys_board_class(s) == DID0_CLASS_SANDSTORM) { | ||
81 | @@ -XXX,XX +XXX,XX @@ static void ssys_write(void *opaque, hwaddr offset, | ||
82 | s->int_status |= (1 << 6); | ||
83 | } | ||
84 | s->rcc2 = value; | ||
85 | - ssys_calculate_system_clock(s); | ||
86 | + ssys_calculate_system_clock(s, true); | ||
87 | break; | ||
88 | case 0x100: /* RCGC0 */ | ||
89 | s->rcgc[0] = value; | ||
90 | @@ -XXX,XX +XXX,XX @@ static void stellaris_sys_reset_hold(Object *obj) | ||
91 | { | ||
92 | ssys_state *s = STELLARIS_SYS(obj); | ||
93 | |||
94 | - ssys_calculate_system_clock(s); | ||
95 | + /* OK to propagate clocks from the hold phase */ | ||
96 | + ssys_calculate_system_clock(s, true); | ||
97 | } | ||
98 | |||
99 | static void stellaris_sys_reset_exit(Object *obj) | ||
100 | @@ -XXX,XX +XXX,XX @@ static int stellaris_sys_post_load(void *opaque, int version_id) | ||
101 | { | ||
102 | ssys_state *s = opaque; | ||
103 | |||
104 | - ssys_calculate_system_clock(s); | ||
105 | + ssys_calculate_system_clock(s, false); | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_stellaris_sys = { | ||
110 | VMSTATE_UINT32_ARRAY(dcgc, ssys_state, 3), | ||
111 | VMSTATE_UINT32(clkvclr, ssys_state), | ||
112 | VMSTATE_UINT32(ldoarst, ssys_state), | ||
113 | + /* No field for sysclk -- handled in post-load instead */ | ||
114 | VMSTATE_END_OF_LIST() | ||
115 | } | ||
116 | }; | ||
117 | @@ -XXX,XX +XXX,XX @@ static void stellaris_sys_instance_init(Object *obj) | ||
118 | memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000); | ||
119 | sysbus_init_mmio(sbd, &s->iomem); | ||
120 | sysbus_init_irq(sbd, &s->irq); | ||
121 | + s->sysclk = qdev_init_clock_out(DEVICE(s), "SYSCLK"); | ||
122 | } | ||
123 | |||
124 | -static int stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
125 | - stellaris_board_info * board, | ||
126 | - uint8_t *macaddr) | ||
127 | +static DeviceState *stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
128 | + stellaris_board_info *board, | ||
129 | + uint8_t *macaddr) | ||
130 | { | ||
131 | DeviceState *dev = qdev_new(TYPE_STELLARIS_SYS); | ||
132 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
133 | @@ -XXX,XX +XXX,XX @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
134 | */ | ||
135 | device_cold_reset(dev); | ||
136 | |||
137 | - return 0; | ||
138 | + return dev; | ||
139 | } | ||
140 | |||
141 | /* I2C controller. */ | ||
142 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
143 | int flash_size; | ||
144 | I2CBus *i2c; | ||
145 | DeviceState *dev; | ||
146 | + DeviceState *ssys_dev; | ||
147 | int i; | ||
148 | int j; | ||
149 | |||
150 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
151 | } | ||
152 | } | ||
153 | |||
154 | - stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), | ||
155 | - board, nd_table[0].macaddr.a); | ||
156 | + ssys_dev = stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), | ||
157 | + board, nd_table[0].macaddr.a); | ||
158 | |||
159 | |||
160 | if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
161 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
162 | /* system_clock_scale is valid now */ | ||
163 | uint32_t mainclk = NANOSECONDS_PER_SECOND / system_clock_scale; | ||
164 | qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); | ||
165 | + qdev_connect_clock_in(dev, "WDOGCLK", | ||
166 | + qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
167 | |||
168 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
169 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), | ||
170 | -- | 27 | -- |
171 | 2.20.1 | 28 | 2.20.1 |
172 | 29 | ||
173 | 30 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB watchdog device over to using its Clock input; | 1 | The v8.3-RCPC extension implements three new load instructions |
---|---|---|---|
2 | the wdogclk_frq property is now ignored. | 2 | which provide slightly weaker consistency guarantees than the |
3 | existing load-acquire operations. For QEMU we choose to simply | ||
4 | implement them with a full LDAQ barrier. | ||
3 | 5 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 8 | Message-id: 20200224172846.13053-3-peter.maydell@linaro.org |
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-21-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-21-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | hw/watchdog/cmsdk-apb-watchdog.c | 18 ++++++++++++++---- | 10 | target/arm/cpu.h | 5 +++++ |
12 | 1 file changed, 14 insertions(+), 4 deletions(-) | 11 | linux-user/elfload.c | 1 + |
12 | target/arm/cpu64.c | 1 + | ||
13 | target/arm/translate-a64.c | 24 ++++++++++++++++++++++++ | ||
14 | 4 files changed, 31 insertions(+) | ||
13 | 15 | ||
14 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | 16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | 18 | --- a/target/arm/cpu.h |
17 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | 19 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_reset(DeviceState *dev) | 20 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmu_8_4(const ARMISARegisters *id) |
19 | ptimer_transaction_commit(s->timer); | 21 | FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; |
20 | } | 22 | } |
21 | 23 | ||
22 | +static void cmsdk_apb_watchdog_clk_update(void *opaque) | 24 | +static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) |
23 | +{ | 25 | +{ |
24 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque); | 26 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; |
25 | + | ||
26 | + ptimer_transaction_begin(s->timer); | ||
27 | + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); | ||
28 | + ptimer_transaction_commit(s->timer); | ||
29 | +} | 27 | +} |
30 | + | 28 | + |
31 | static void cmsdk_apb_watchdog_init(Object *obj) | 29 | /* |
32 | { | 30 | * Feature tests for "does this exist in either 32-bit or 64-bit?" |
33 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 31 | */ |
34 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_init(Object *obj) | 32 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c |
35 | s, "cmsdk-apb-watchdog", 0x1000); | 33 | index XXXXXXX..XXXXXXX 100644 |
36 | sysbus_init_mmio(sbd, &s->iomem); | 34 | --- a/linux-user/elfload.c |
37 | sysbus_init_irq(sbd, &s->wdogint); | 35 | +++ b/linux-user/elfload.c |
38 | - s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); | 36 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) |
39 | + s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", | 37 | GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); |
40 | + cmsdk_apb_watchdog_clk_update, s); | 38 | GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM); |
41 | 39 | GET_FEATURE_ID(aa64_dcpop, ARM_HWCAP_A64_DCPOP); | |
42 | s->is_luminary = false; | 40 | + GET_FEATURE_ID(aa64_rcpc_8_3, ARM_HWCAP_A64_LRCPC); |
43 | s->id = cmsdk_apb_watchdog_id; | 41 | |
44 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | 42 | return hwcaps; |
45 | { | 43 | } |
46 | CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev); | 44 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
47 | 45 | index XXXXXXX..XXXXXXX 100644 | |
48 | - if (s->wdogclk_frq == 0) { | 46 | --- a/target/arm/cpu64.c |
49 | + if (!clock_has_source(s->wdogclk)) { | 47 | +++ b/target/arm/cpu64.c |
50 | error_setg(errp, | 48 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
51 | - "CMSDK APB watchdog: wdogclk-frq property must be set"); | 49 | t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); |
52 | + "CMSDK APB watchdog: WDOGCLK clock must be connected"); | 50 | t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); |
51 | t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
52 | + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 1); /* ARMv8.3-RCPC */ | ||
53 | cpu->isar.id_aa64isar1 = t; | ||
54 | |||
55 | t = cpu->isar.id_aa64pfr0; | ||
56 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/translate-a64.c | ||
59 | +++ b/target/arm/translate-a64.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
61 | int rs = extract32(insn, 16, 5); | ||
62 | int rn = extract32(insn, 5, 5); | ||
63 | int o3_opc = extract32(insn, 12, 4); | ||
64 | + bool r = extract32(insn, 22, 1); | ||
65 | + bool a = extract32(insn, 23, 1); | ||
66 | TCGv_i64 tcg_rs, clean_addr; | ||
67 | AtomicThreeOpFn *fn; | ||
68 | |||
69 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
70 | case 010: /* SWP */ | ||
71 | fn = tcg_gen_atomic_xchg_i64; | ||
72 | break; | ||
73 | + case 014: /* LDAPR, LDAPRH, LDAPRB */ | ||
74 | + if (!dc_isar_feature(aa64_rcpc_8_3, s) || | ||
75 | + rs != 31 || a != 1 || r != 0) { | ||
76 | + unallocated_encoding(s); | ||
77 | + return; | ||
78 | + } | ||
79 | + break; | ||
80 | default: | ||
81 | unallocated_encoding(s); | ||
53 | return; | 82 | return; |
83 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
84 | gen_check_sp_alignment(s); | ||
54 | } | 85 | } |
55 | 86 | clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); | |
56 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | 87 | + |
57 | PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); | 88 | + if (o3_opc == 014) { |
58 | 89 | + /* | |
59 | ptimer_transaction_begin(s->timer); | 90 | + * LDAPR* are a special case because they are a simple load, not a |
60 | - ptimer_set_freq(s->timer, s->wdogclk_frq); | 91 | + * fetch-and-do-something op. |
61 | + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); | 92 | + * The architectural consistency requirements here are weaker than |
62 | ptimer_transaction_commit(s->timer); | 93 | + * full load-acquire (we only need "load-acquire processor consistent"), |
63 | } | 94 | + * but we choose to implement them as full LDAQ. |
64 | 95 | + */ | |
96 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, false, | ||
97 | + true, rt, disas_ldst_compute_iss_sf(size, false, 0), true); | ||
98 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
99 | + return; | ||
100 | + } | ||
101 | + | ||
102 | tcg_rs = read_cpu_reg(s, rs, true); | ||
103 | |||
104 | if (o3_opc == 1) { /* LDCLR */ | ||
65 | -- | 105 | -- |
66 | 2.20.1 | 106 | 2.20.1 |
67 | 107 | ||
68 | 108 | diff view generated by jsdifflib |
1 | The ptimer API currently provides two methods for setting the period: | 1 | The v8.4-RCPC extension implements some new instructions: |
---|---|---|---|
2 | ptimer_set_period(), which takes a period in nanoseconds, and | 2 | * LDAPUR, LDAPURB, LDAPURH, LDAPRSB, LDAPRSH, LDAPRSW |
3 | ptimer_set_freq(), which takes a frequency in Hz. Neither of these | 3 | * STLUR, STLURB, STLURH |
4 | lines up nicely with the Clock API, because although both the Clock | ||
5 | and the ptimer track the frequency using a representation of whole | ||
6 | and fractional nanoseconds, conversion via either period-in-ns or | ||
7 | frequency-in-Hz will introduce a rounding error. | ||
8 | 4 | ||
9 | Add a new function ptimer_set_period_from_clock() which takes the | 5 | These are all in a new subgroup of encodings that sits below the |
10 | Clock object directly to avoid the rounding issues. This includes a | 6 | top-level "Loads and Stores" group in the Arm ARM. |
11 | facility for the user to specify that there is a frequency divider | ||
12 | between the Clock proper and the timer, as some timer devices like | ||
13 | the CMSDK APB dualtimer need this. | ||
14 | 7 | ||
15 | To avoid having to drag in clock.h from ptimer.h we add the Clock | 8 | The STLUR* instructions have standard store-release semantics; the |
16 | type to typedefs.h. | 9 | LDAPUR* have Load-AcquirePC semantics, but (as with LDAPR*) we choose |
10 | to implement them as the slightly stronger Load-Acquire. | ||
17 | 11 | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
20 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Message-id: 20200224172846.13053-4-peter.maydell@linaro.org |
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Message-id: 20210128114145.20536-2-peter.maydell@linaro.org | ||
23 | Message-id: 20210121190622.22000-2-peter.maydell@linaro.org | ||
24 | --- | 15 | --- |
25 | include/hw/ptimer.h | 22 ++++++++++++++++++++++ | 16 | target/arm/cpu.h | 5 +++ |
26 | include/qemu/typedefs.h | 1 + | 17 | linux-user/elfload.c | 1 + |
27 | hw/core/ptimer.c | 34 ++++++++++++++++++++++++++++++++++ | 18 | target/arm/cpu64.c | 2 +- |
28 | 3 files changed, 57 insertions(+) | 19 | target/arm/translate-a64.c | 90 ++++++++++++++++++++++++++++++++++++++ |
20 | 4 files changed, 97 insertions(+), 1 deletion(-) | ||
29 | 21 | ||
30 | diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h | 22 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
31 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/include/hw/ptimer.h | 24 | --- a/target/arm/cpu.h |
33 | +++ b/include/hw/ptimer.h | 25 | +++ b/target/arm/cpu.h |
34 | @@ -XXX,XX +XXX,XX @@ void ptimer_transaction_commit(ptimer_state *s); | 26 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) |
27 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
28 | } | ||
29 | |||
30 | +static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
31 | +{ | ||
32 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
33 | +} | ||
34 | + | ||
35 | /* | ||
36 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
35 | */ | 37 | */ |
36 | void ptimer_set_period(ptimer_state *s, int64_t period); | 38 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c |
37 | |||
38 | +/** | ||
39 | + * ptimer_set_period_from_clock - Set counter increment from a Clock | ||
40 | + * @s: ptimer to configure | ||
41 | + * @clk: pointer to Clock object to take period from | ||
42 | + * @divisor: value to scale the clock frequency down by | ||
43 | + * | ||
44 | + * If the ptimer is being driven from a Clock, this is the preferred | ||
45 | + * way to tell the ptimer about the period, because it avoids any | ||
46 | + * possible rounding errors that might happen if the internal | ||
47 | + * representation of the Clock period was converted to either a period | ||
48 | + * in ns or a frequency in Hz. | ||
49 | + * | ||
50 | + * If the ptimer should run at the same frequency as the clock, | ||
51 | + * pass 1 as the @divisor; if the ptimer should run at half the | ||
52 | + * frequency, pass 2, and so on. | ||
53 | + * | ||
54 | + * This function will assert if it is called outside a | ||
55 | + * ptimer_transaction_begin/commit block. | ||
56 | + */ | ||
57 | +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clock, | ||
58 | + unsigned int divisor); | ||
59 | + | ||
60 | /** | ||
61 | * ptimer_set_freq - Set counter frequency in Hz | ||
62 | * @s: ptimer to configure | ||
63 | diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h | ||
64 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
65 | --- a/include/qemu/typedefs.h | 40 | --- a/linux-user/elfload.c |
66 | +++ b/include/qemu/typedefs.h | 41 | +++ b/linux-user/elfload.c |
67 | @@ -XXX,XX +XXX,XX @@ typedef struct BlockDriverState BlockDriverState; | 42 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) |
68 | typedef struct BusClass BusClass; | 43 | GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM); |
69 | typedef struct BusState BusState; | 44 | GET_FEATURE_ID(aa64_dcpop, ARM_HWCAP_A64_DCPOP); |
70 | typedef struct Chardev Chardev; | 45 | GET_FEATURE_ID(aa64_rcpc_8_3, ARM_HWCAP_A64_LRCPC); |
71 | +typedef struct Clock Clock; | 46 | + GET_FEATURE_ID(aa64_rcpc_8_4, ARM_HWCAP_A64_ILRCPC); |
72 | typedef struct CompatProperty CompatProperty; | 47 | |
73 | typedef struct CoMutex CoMutex; | 48 | return hwcaps; |
74 | typedef struct CPUAddressSpace CPUAddressSpace; | 49 | } |
75 | diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c | 50 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
76 | index XXXXXXX..XXXXXXX 100644 | 51 | index XXXXXXX..XXXXXXX 100644 |
77 | --- a/hw/core/ptimer.c | 52 | --- a/target/arm/cpu64.c |
78 | +++ b/hw/core/ptimer.c | 53 | +++ b/target/arm/cpu64.c |
79 | @@ -XXX,XX +XXX,XX @@ | 54 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
80 | #include "sysemu/qtest.h" | 55 | t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); |
81 | #include "block/aio.h" | 56 | t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); |
82 | #include "sysemu/cpus.h" | 57 | t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); |
83 | +#include "hw/clock.h" | 58 | - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 1); /* ARMv8.3-RCPC */ |
84 | 59 | + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | |
85 | #define DELTA_ADJUST 1 | 60 | cpu->isar.id_aa64isar1 = t; |
86 | #define DELTA_NO_ADJUST -1 | 61 | |
87 | @@ -XXX,XX +XXX,XX @@ void ptimer_set_period(ptimer_state *s, int64_t period) | 62 | t = cpu->isar.id_aa64pfr0; |
63 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/target/arm/translate-a64.c | ||
66 | +++ b/target/arm/translate-a64.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, | ||
88 | } | 68 | } |
89 | } | 69 | } |
90 | 70 | ||
91 | +/* Set counter increment interval from a Clock */ | 71 | +/* |
92 | +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clk, | 72 | + * LDAPR/STLR (unscaled immediate) |
93 | + unsigned int divisor) | 73 | + * |
74 | + * 31 30 24 22 21 12 10 5 0 | ||
75 | + * +------+-------------+-----+---+--------+-----+----+-----+ | ||
76 | + * | size | 0 1 1 0 0 1 | opc | 0 | imm9 | 0 0 | Rn | Rt | | ||
77 | + * +------+-------------+-----+---+--------+-----+----+-----+ | ||
78 | + * | ||
79 | + * Rt: source or destination register | ||
80 | + * Rn: base register | ||
81 | + * imm9: unscaled immediate offset | ||
82 | + * opc: 00: STLUR*, 01/10/11: various LDAPUR* | ||
83 | + * size: size of load/store | ||
84 | + */ | ||
85 | +static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) | ||
94 | +{ | 86 | +{ |
95 | + /* | 87 | + int rt = extract32(insn, 0, 5); |
96 | + * The raw clock period is a 64-bit value in units of 2^-32 ns; | 88 | + int rn = extract32(insn, 5, 5); |
97 | + * put another way it's a 32.32 fixed-point ns value. Our internal | 89 | + int offset = sextract32(insn, 12, 9); |
98 | + * representation of the period is 64.32 fixed point ns, so | 90 | + int opc = extract32(insn, 22, 2); |
99 | + * the conversion is simple. | 91 | + int size = extract32(insn, 30, 2); |
100 | + */ | 92 | + TCGv_i64 clean_addr, dirty_addr; |
101 | + uint64_t raw_period = clock_get(clk); | 93 | + bool is_store = false; |
102 | + uint64_t period_frac; | 94 | + bool is_signed = false; |
95 | + bool extend = false; | ||
96 | + bool iss_sf; | ||
103 | + | 97 | + |
104 | + assert(s->in_transaction); | 98 | + if (!dc_isar_feature(aa64_rcpc_8_4, s)) { |
105 | + s->delta = ptimer_get_count(s); | 99 | + unallocated_encoding(s); |
106 | + s->period = extract64(raw_period, 32, 32); | 100 | + return; |
107 | + period_frac = extract64(raw_period, 0, 32); | 101 | + } |
108 | + /* | ||
109 | + * divisor specifies a possible frequency divisor between the | ||
110 | + * clock and the timer, so it is a multiplier on the period. | ||
111 | + * We do the multiply after splitting the raw period out into | ||
112 | + * period and frac to avoid having to do a 32*64->96 multiply. | ||
113 | + */ | ||
114 | + s->period *= divisor; | ||
115 | + period_frac *= divisor; | ||
116 | + s->period += extract64(period_frac, 32, 32); | ||
117 | + s->period_frac = (uint32_t)period_frac; | ||
118 | + | 102 | + |
119 | + if (s->enabled) { | 103 | + switch (opc) { |
120 | + s->need_reload = true; | 104 | + case 0: /* STLURB */ |
105 | + is_store = true; | ||
106 | + break; | ||
107 | + case 1: /* LDAPUR* */ | ||
108 | + break; | ||
109 | + case 2: /* LDAPURS* 64-bit variant */ | ||
110 | + if (size == 3) { | ||
111 | + unallocated_encoding(s); | ||
112 | + return; | ||
113 | + } | ||
114 | + is_signed = true; | ||
115 | + break; | ||
116 | + case 3: /* LDAPURS* 32-bit variant */ | ||
117 | + if (size > 1) { | ||
118 | + unallocated_encoding(s); | ||
119 | + return; | ||
120 | + } | ||
121 | + is_signed = true; | ||
122 | + extend = true; /* zero-extend 32->64 after signed load */ | ||
123 | + break; | ||
124 | + default: | ||
125 | + g_assert_not_reached(); | ||
126 | + } | ||
127 | + | ||
128 | + iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); | ||
129 | + | ||
130 | + if (rn == 31) { | ||
131 | + gen_check_sp_alignment(s); | ||
132 | + } | ||
133 | + | ||
134 | + dirty_addr = read_cpu_reg_sp(s, rn, 1); | ||
135 | + tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); | ||
136 | + clean_addr = clean_data_tbi(s, dirty_addr); | ||
137 | + | ||
138 | + if (is_store) { | ||
139 | + /* Store-Release semantics */ | ||
140 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
141 | + do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, iss_sf, true); | ||
142 | + } else { | ||
143 | + /* | ||
144 | + * Load-AcquirePC semantics; we implement as the slightly more | ||
145 | + * restrictive Load-Acquire. | ||
146 | + */ | ||
147 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, is_signed, extend, | ||
148 | + true, rt, iss_sf, true); | ||
149 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
121 | + } | 150 | + } |
122 | +} | 151 | +} |
123 | + | 152 | + |
124 | /* Set counter frequency in Hz. */ | 153 | /* Load/store register (all forms) */ |
125 | void ptimer_set_freq(ptimer_state *s, uint32_t freq) | 154 | static void disas_ldst_reg(DisasContext *s, uint32_t insn) |
126 | { | 155 | { |
156 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst(DisasContext *s, uint32_t insn) | ||
157 | case 0x0d: /* AdvSIMD load/store single structure */ | ||
158 | disas_ldst_single_struct(s, insn); | ||
159 | break; | ||
160 | + case 0x19: /* LDAPR/STLR (unscaled immediate) */ | ||
161 | + if (extract32(insn, 10, 2) != 0 || | ||
162 | + extract32(insn, 21, 1) != 0) { | ||
163 | + unallocated_encoding(s); | ||
164 | + break; | ||
165 | + } | ||
166 | + disas_ldst_ldapr_stlr(s, insn); | ||
167 | + break; | ||
168 | default: | ||
169 | unallocated_encoding(s); | ||
170 | break; | ||
127 | -- | 171 | -- |
128 | 2.20.1 | 172 | 2.20.1 |
129 | 173 | ||
130 | 174 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add a function for checking whether a clock has a source. This is | ||
2 | useful for devices which have input clocks that must be wired up by | ||
3 | the board as it allows them to fail in realize rather than ploughing | ||
4 | on with a zero-period clock. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20210128114145.20536-3-peter.maydell@linaro.org | ||
11 | Message-id: 20210121190622.22000-3-peter.maydell@linaro.org | ||
12 | --- | ||
13 | docs/devel/clocks.rst | 16 ++++++++++++++++ | ||
14 | include/hw/clock.h | 15 +++++++++++++++ | ||
15 | 2 files changed, 31 insertions(+) | ||
16 | |||
17 | diff --git a/docs/devel/clocks.rst b/docs/devel/clocks.rst | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/docs/devel/clocks.rst | ||
20 | +++ b/docs/devel/clocks.rst | ||
21 | @@ -XXX,XX +XXX,XX @@ object during device instance init. For example: | ||
22 | /* set initial value to 10ns / 100MHz */ | ||
23 | clock_set_ns(clk, 10); | ||
24 | |||
25 | +To enforce that the clock is wired up by the board code, you can | ||
26 | +call ``clock_has_source()`` in your device's realize method: | ||
27 | + | ||
28 | +.. code-block:: c | ||
29 | + | ||
30 | + if (!clock_has_source(s->clk)) { | ||
31 | + error_setg(errp, "MyDevice: clk input must be connected"); | ||
32 | + return; | ||
33 | + } | ||
34 | + | ||
35 | +Note that this only checks that the clock has been wired up; it is | ||
36 | +still possible that the output clock connected to it is disabled | ||
37 | +or has not yet been configured, in which case the period will be | ||
38 | +zero. You should use the clock callback to find out when the clock | ||
39 | +period changes. | ||
40 | + | ||
41 | Fetching clock frequency/period | ||
42 | ------------------------------- | ||
43 | |||
44 | diff --git a/include/hw/clock.h b/include/hw/clock.h | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/include/hw/clock.h | ||
47 | +++ b/include/hw/clock.h | ||
48 | @@ -XXX,XX +XXX,XX @@ void clock_clear_callback(Clock *clk); | ||
49 | */ | ||
50 | void clock_set_source(Clock *clk, Clock *src); | ||
51 | |||
52 | +/** | ||
53 | + * clock_has_source: | ||
54 | + * @clk: the clock | ||
55 | + * | ||
56 | + * Returns true if the clock has a source clock connected to it. | ||
57 | + * This is useful for devices which have input clocks which must | ||
58 | + * be connected by the board/SoC code which creates them. The | ||
59 | + * device code can use this to check in its realize method that | ||
60 | + * the clock has been connected. | ||
61 | + */ | ||
62 | +static inline bool clock_has_source(const Clock *clk) | ||
63 | +{ | ||
64 | + return clk->source != NULL; | ||
65 | +} | ||
66 | + | ||
67 | /** | ||
68 | * clock_set: | ||
69 | * @clk: the clock to initialize. | ||
70 | -- | ||
71 | 2.20.1 | ||
72 | |||
73 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add a simple test of the CMSDK APB timer, since we're about to do | ||
2 | some refactoring of how it is clocked. | ||
3 | 1 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-4-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-4-peter.maydell@linaro.org | ||
10 | --- | ||
11 | tests/qtest/cmsdk-apb-timer-test.c | 75 ++++++++++++++++++++++++++++++ | ||
12 | MAINTAINERS | 1 + | ||
13 | tests/qtest/meson.build | 1 + | ||
14 | 3 files changed, 77 insertions(+) | ||
15 | create mode 100644 tests/qtest/cmsdk-apb-timer-test.c | ||
16 | |||
17 | diff --git a/tests/qtest/cmsdk-apb-timer-test.c b/tests/qtest/cmsdk-apb-timer-test.c | ||
18 | new file mode 100644 | ||
19 | index XXXXXXX..XXXXXXX | ||
20 | --- /dev/null | ||
21 | +++ b/tests/qtest/cmsdk-apb-timer-test.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | +/* | ||
24 | + * QTest testcase for the CMSDK APB timer device | ||
25 | + * | ||
26 | + * Copyright (c) 2021 Linaro Limited | ||
27 | + * | ||
28 | + * This program is free software; you can redistribute it and/or modify it | ||
29 | + * under the terms of the GNU General Public License as published by the | ||
30 | + * Free Software Foundation; either version 2 of the License, or | ||
31 | + * (at your option) any later version. | ||
32 | + * | ||
33 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
34 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
35 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
36 | + * for more details. | ||
37 | + */ | ||
38 | + | ||
39 | +#include "qemu/osdep.h" | ||
40 | +#include "libqtest-single.h" | ||
41 | + | ||
42 | +/* IoTKit/ARMSSE-200 timer0; driven at 25MHz in mps2-an385, so 40ns per tick */ | ||
43 | +#define TIMER_BASE 0x40000000 | ||
44 | + | ||
45 | +#define CTRL 0 | ||
46 | +#define VALUE 4 | ||
47 | +#define RELOAD 8 | ||
48 | +#define INTSTATUS 0xc | ||
49 | + | ||
50 | +static void test_timer(void) | ||
51 | +{ | ||
52 | + g_assert_true(readl(TIMER_BASE + INTSTATUS) == 0); | ||
53 | + | ||
54 | + /* Start timer: will fire after 40 * 1000 == 40000 ns */ | ||
55 | + writel(TIMER_BASE + RELOAD, 1000); | ||
56 | + writel(TIMER_BASE + CTRL, 9); | ||
57 | + | ||
58 | + /* Step to just past the 500th tick and check VALUE */ | ||
59 | + clock_step(40 * 500 + 1); | ||
60 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 0); | ||
61 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 500); | ||
62 | + | ||
63 | + /* Just past the 1000th tick: timer should have fired */ | ||
64 | + clock_step(40 * 500); | ||
65 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 1); | ||
66 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 0); | ||
67 | + | ||
68 | + /* VALUE reloads at the following tick */ | ||
69 | + clock_step(40); | ||
70 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 1000); | ||
71 | + | ||
72 | + /* Check write-1-to-clear behaviour of INTSTATUS */ | ||
73 | + writel(TIMER_BASE + INTSTATUS, 0); | ||
74 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 1); | ||
75 | + writel(TIMER_BASE + INTSTATUS, 1); | ||
76 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 0); | ||
77 | + | ||
78 | + /* Turn off the timer */ | ||
79 | + writel(TIMER_BASE + CTRL, 0); | ||
80 | +} | ||
81 | + | ||
82 | +int main(int argc, char **argv) | ||
83 | +{ | ||
84 | + int r; | ||
85 | + | ||
86 | + g_test_init(&argc, &argv, NULL); | ||
87 | + | ||
88 | + qtest_start("-machine mps2-an385"); | ||
89 | + | ||
90 | + qtest_add_func("/cmsdk-apb-timer/timer", test_timer); | ||
91 | + | ||
92 | + r = g_test_run(); | ||
93 | + | ||
94 | + qtest_end(); | ||
95 | + | ||
96 | + return r; | ||
97 | +} | ||
98 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/MAINTAINERS | ||
101 | +++ b/MAINTAINERS | ||
102 | @@ -XXX,XX +XXX,XX @@ F: include/hw/rtc/pl031.h | ||
103 | F: include/hw/arm/primecell.h | ||
104 | F: hw/timer/cmsdk-apb-timer.c | ||
105 | F: include/hw/timer/cmsdk-apb-timer.h | ||
106 | +F: tests/qtest/cmsdk-apb-timer-test.c | ||
107 | F: hw/timer/cmsdk-apb-dualtimer.c | ||
108 | F: include/hw/timer/cmsdk-apb-dualtimer.h | ||
109 | F: hw/char/cmsdk-apb-uart.c | ||
110 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/qtest/meson.build | ||
113 | +++ b/tests/qtest/meson.build | ||
114 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | ||
115 | 'npcm7xx_timer-test', | ||
116 | 'npcm7xx_watchdog_timer-test'] | ||
117 | qtests_arm = \ | ||
118 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | ||
119 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | ||
120 | (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ | ||
121 | ['arm-cpu-features', | ||
122 | -- | ||
123 | 2.20.1 | ||
124 | |||
125 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The state struct for the CMSDK APB timer device doesn't follow our | ||
2 | usual naming convention of camelcase -- "CMSDK" and "APB" are both | ||
3 | acronyms, but "TIMER" is not so should not be all-uppercase. | ||
4 | Globally rename the struct to "CMSDKAPBTimer" (bringing it into line | ||
5 | with CMSDKAPBWatchdog and CMSDKAPBDualTimer; CMSDKAPBUART remains | ||
6 | as-is because "UART" is an acronym). | ||
7 | 1 | ||
8 | Commit created with: | ||
9 | perl -p -i -e 's/CMSDKAPBTIMER/CMSDKAPBTimer/g' hw/timer/cmsdk-apb-timer.c include/hw/arm/armsse.h include/hw/timer/cmsdk-apb-timer.h | ||
10 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20210128114145.20536-7-peter.maydell@linaro.org | ||
16 | Message-id: 20210121190622.22000-7-peter.maydell@linaro.org | ||
17 | --- | ||
18 | include/hw/arm/armsse.h | 6 +++--- | ||
19 | include/hw/timer/cmsdk-apb-timer.h | 4 ++-- | ||
20 | hw/timer/cmsdk-apb-timer.c | 28 ++++++++++++++-------------- | ||
21 | 3 files changed, 19 insertions(+), 19 deletions(-) | ||
22 | |||
23 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/include/hw/arm/armsse.h | ||
26 | +++ b/include/hw/arm/armsse.h | ||
27 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | ||
28 | TZPPC apb_ppc0; | ||
29 | TZPPC apb_ppc1; | ||
30 | TZMPC mpc[IOTS_NUM_MPC]; | ||
31 | - CMSDKAPBTIMER timer0; | ||
32 | - CMSDKAPBTIMER timer1; | ||
33 | - CMSDKAPBTIMER s32ktimer; | ||
34 | + CMSDKAPBTimer timer0; | ||
35 | + CMSDKAPBTimer timer1; | ||
36 | + CMSDKAPBTimer s32ktimer; | ||
37 | qemu_or_irq ppc_irq_orgate; | ||
38 | SplitIRQ sec_resp_splitter; | ||
39 | SplitIRQ ppc_irq_splitter[NUM_PPCS]; | ||
40 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/include/hw/timer/cmsdk-apb-timer.h | ||
43 | +++ b/include/hw/timer/cmsdk-apb-timer.h | ||
44 | @@ -XXX,XX +XXX,XX @@ | ||
45 | #include "qom/object.h" | ||
46 | |||
47 | #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" | ||
48 | -OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTIMER, CMSDK_APB_TIMER) | ||
49 | +OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | ||
50 | |||
51 | -struct CMSDKAPBTIMER { | ||
52 | +struct CMSDKAPBTimer { | ||
53 | /*< private >*/ | ||
54 | SysBusDevice parent_obj; | ||
55 | |||
56 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/timer/cmsdk-apb-timer.c | ||
59 | +++ b/hw/timer/cmsdk-apb-timer.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static const int timer_id[] = { | ||
61 | 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ | ||
62 | }; | ||
63 | |||
64 | -static void cmsdk_apb_timer_update(CMSDKAPBTIMER *s) | ||
65 | +static void cmsdk_apb_timer_update(CMSDKAPBTimer *s) | ||
66 | { | ||
67 | qemu_set_irq(s->timerint, !!(s->intstatus & R_INTSTATUS_IRQ_MASK)); | ||
68 | } | ||
69 | |||
70 | static uint64_t cmsdk_apb_timer_read(void *opaque, hwaddr offset, unsigned size) | ||
71 | { | ||
72 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | ||
73 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | ||
74 | uint64_t r; | ||
75 | |||
76 | switch (offset) { | ||
77 | @@ -XXX,XX +XXX,XX @@ static uint64_t cmsdk_apb_timer_read(void *opaque, hwaddr offset, unsigned size) | ||
78 | static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value, | ||
79 | unsigned size) | ||
80 | { | ||
81 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | ||
82 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | ||
83 | |||
84 | trace_cmsdk_apb_timer_write(offset, value, size); | ||
85 | |||
86 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps cmsdk_apb_timer_ops = { | ||
87 | |||
88 | static void cmsdk_apb_timer_tick(void *opaque) | ||
89 | { | ||
90 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | ||
91 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | ||
92 | |||
93 | if (s->ctrl & R_CTRL_IRQEN_MASK) { | ||
94 | s->intstatus |= R_INTSTATUS_IRQ_MASK; | ||
95 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_tick(void *opaque) | ||
96 | |||
97 | static void cmsdk_apb_timer_reset(DeviceState *dev) | ||
98 | { | ||
99 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(dev); | ||
100 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | ||
101 | |||
102 | trace_cmsdk_apb_timer_reset(); | ||
103 | s->ctrl = 0; | ||
104 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_reset(DeviceState *dev) | ||
105 | static void cmsdk_apb_timer_init(Object *obj) | ||
106 | { | ||
107 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
108 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(obj); | ||
109 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(obj); | ||
110 | |||
111 | memory_region_init_io(&s->iomem, obj, &cmsdk_apb_timer_ops, | ||
112 | s, "cmsdk-apb-timer", 0x1000); | ||
113 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | ||
114 | |||
115 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | ||
116 | { | ||
117 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(dev); | ||
118 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | ||
119 | |||
120 | if (s->pclk_frq == 0) { | ||
121 | error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | ||
122 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_timer_vmstate = { | ||
123 | .version_id = 1, | ||
124 | .minimum_version_id = 1, | ||
125 | .fields = (VMStateField[]) { | ||
126 | - VMSTATE_PTIMER(timer, CMSDKAPBTIMER), | ||
127 | - VMSTATE_UINT32(ctrl, CMSDKAPBTIMER), | ||
128 | - VMSTATE_UINT32(value, CMSDKAPBTIMER), | ||
129 | - VMSTATE_UINT32(reload, CMSDKAPBTIMER), | ||
130 | - VMSTATE_UINT32(intstatus, CMSDKAPBTIMER), | ||
131 | + VMSTATE_PTIMER(timer, CMSDKAPBTimer), | ||
132 | + VMSTATE_UINT32(ctrl, CMSDKAPBTimer), | ||
133 | + VMSTATE_UINT32(value, CMSDKAPBTimer), | ||
134 | + VMSTATE_UINT32(reload, CMSDKAPBTimer), | ||
135 | + VMSTATE_UINT32(intstatus, CMSDKAPBTimer), | ||
136 | VMSTATE_END_OF_LIST() | ||
137 | } | ||
138 | }; | ||
139 | |||
140 | static Property cmsdk_apb_timer_properties[] = { | ||
141 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTIMER, pclk_frq, 0), | ||
142 | + DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), | ||
143 | DEFINE_PROP_END_OF_LIST(), | ||
144 | }; | ||
145 | |||
146 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | ||
147 | static const TypeInfo cmsdk_apb_timer_info = { | ||
148 | .name = TYPE_CMSDK_APB_TIMER, | ||
149 | .parent = TYPE_SYS_BUS_DEVICE, | ||
150 | - .instance_size = sizeof(CMSDKAPBTIMER), | ||
151 | + .instance_size = sizeof(CMSDKAPBTimer), | ||
152 | .instance_init = cmsdk_apb_timer_init, | ||
153 | .class_init = cmsdk_apb_timer_class_init, | ||
154 | }; | ||
155 | -- | ||
156 | 2.20.1 | ||
157 | |||
158 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | As the first step in converting the CMSDK_APB_TIMER device to the | ||
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the pclk-frq | ||
4 | property to using the Clock once all the users of this device have | ||
5 | been converted to wire up the Clock. | ||
6 | 1 | ||
7 | Since the device doesn't already have a doc comment for its "QEMU | ||
8 | interface", we add one including the new Clock. | ||
9 | |||
10 | This is a migration compatibility break for machines mps2-an505, | ||
11 | mps2-an521, musca-a, musca-b1. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
16 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20210128114145.20536-8-peter.maydell@linaro.org | ||
18 | Message-id: 20210121190622.22000-8-peter.maydell@linaro.org | ||
19 | --- | ||
20 | include/hw/timer/cmsdk-apb-timer.h | 9 +++++++++ | ||
21 | hw/timer/cmsdk-apb-timer.c | 7 +++++-- | ||
22 | 2 files changed, 14 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/include/hw/timer/cmsdk-apb-timer.h | ||
27 | +++ b/include/hw/timer/cmsdk-apb-timer.h | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | #include "hw/qdev-properties.h" | ||
30 | #include "hw/sysbus.h" | ||
31 | #include "hw/ptimer.h" | ||
32 | +#include "hw/clock.h" | ||
33 | #include "qom/object.h" | ||
34 | |||
35 | #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" | ||
36 | OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | ||
37 | |||
38 | +/* | ||
39 | + * QEMU interface: | ||
40 | + * + QOM property "pclk-frq": frequency at which the timer is clocked | ||
41 | + * + Clock input "pclk": clock for the timer | ||
42 | + * + sysbus MMIO region 0: the register bank | ||
43 | + * + sysbus IRQ 0: timer interrupt TIMERINT | ||
44 | + */ | ||
45 | struct CMSDKAPBTimer { | ||
46 | /*< private >*/ | ||
47 | SysBusDevice parent_obj; | ||
48 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | ||
49 | qemu_irq timerint; | ||
50 | uint32_t pclk_frq; | ||
51 | struct ptimer_state *timer; | ||
52 | + Clock *pclk; | ||
53 | |||
54 | uint32_t ctrl; | ||
55 | uint32_t value; | ||
56 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/timer/cmsdk-apb-timer.c | ||
59 | +++ b/hw/timer/cmsdk-apb-timer.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | #include "hw/sysbus.h" | ||
62 | #include "hw/irq.h" | ||
63 | #include "hw/registerfields.h" | ||
64 | +#include "hw/qdev-clock.h" | ||
65 | #include "hw/timer/cmsdk-apb-timer.h" | ||
66 | #include "migration/vmstate.h" | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | ||
69 | s, "cmsdk-apb-timer", 0x1000); | ||
70 | sysbus_init_mmio(sbd, &s->iomem); | ||
71 | sysbus_init_irq(sbd, &s->timerint); | ||
72 | + s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); | ||
73 | } | ||
74 | |||
75 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | ||
76 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | ||
77 | |||
78 | static const VMStateDescription cmsdk_apb_timer_vmstate = { | ||
79 | .name = "cmsdk-apb-timer", | ||
80 | - .version_id = 1, | ||
81 | - .minimum_version_id = 1, | ||
82 | + .version_id = 2, | ||
83 | + .minimum_version_id = 2, | ||
84 | .fields = (VMStateField[]) { | ||
85 | VMSTATE_PTIMER(timer, CMSDKAPBTimer), | ||
86 | + VMSTATE_CLOCK(pclk, CMSDKAPBTimer), | ||
87 | VMSTATE_UINT32(ctrl, CMSDKAPBTimer), | ||
88 | VMSTATE_UINT32(value, CMSDKAPBTimer), | ||
89 | VMSTATE_UINT32(reload, CMSDKAPBTimer), | ||
90 | -- | ||
91 | 2.20.1 | ||
92 | |||
93 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | As the first step in converting the CMSDK_APB_DUALTIMER device to the | ||
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the pclk-frq | ||
4 | property to using the Clock once all the users of this device have | ||
5 | been converted to wire up the Clock. | ||
6 | 1 | ||
7 | We take the opportunity to correct the name of the clock input to | ||
8 | match the hardware -- the dual timer names the clock which drives the | ||
9 | timers TIMCLK. (It does also have a 'pclk' input, which is used only | ||
10 | for the register and APB bus logic; on the SSE-200 these clocks are | ||
11 | both connected together.) | ||
12 | |||
13 | This is a migration compatibility break for machines mps2-an385, | ||
14 | mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, | ||
15 | musca-b1. | ||
16 | |||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
20 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20210128114145.20536-9-peter.maydell@linaro.org | ||
22 | Message-id: 20210121190622.22000-9-peter.maydell@linaro.org | ||
23 | --- | ||
24 | include/hw/timer/cmsdk-apb-dualtimer.h | 3 +++ | ||
25 | hw/timer/cmsdk-apb-dualtimer.c | 7 +++++-- | ||
26 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
27 | |||
28 | diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/include/hw/timer/cmsdk-apb-dualtimer.h | ||
31 | +++ b/include/hw/timer/cmsdk-apb-dualtimer.h | ||
32 | @@ -XXX,XX +XXX,XX @@ | ||
33 | * | ||
34 | * QEMU interface: | ||
35 | * + QOM property "pclk-frq": frequency at which the timer is clocked | ||
36 | + * + Clock input "TIMCLK": clock (for both timers) | ||
37 | * + sysbus MMIO region 0: the register bank | ||
38 | * + sysbus IRQ 0: combined timer interrupt TIMINTC | ||
39 | * + sysbus IRO 1: timer block 1 interrupt TIMINT1 | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | |||
42 | #include "hw/sysbus.h" | ||
43 | #include "hw/ptimer.h" | ||
44 | +#include "hw/clock.h" | ||
45 | #include "qom/object.h" | ||
46 | |||
47 | #define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer" | ||
48 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBDualTimer { | ||
49 | MemoryRegion iomem; | ||
50 | qemu_irq timerintc; | ||
51 | uint32_t pclk_frq; | ||
52 | + Clock *timclk; | ||
53 | |||
54 | CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; | ||
55 | uint32_t timeritcr; | ||
56 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/timer/cmsdk-apb-dualtimer.c | ||
59 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | #include "hw/irq.h" | ||
62 | #include "hw/qdev-properties.h" | ||
63 | #include "hw/registerfields.h" | ||
64 | +#include "hw/qdev-clock.h" | ||
65 | #include "hw/timer/cmsdk-apb-dualtimer.h" | ||
66 | #include "migration/vmstate.h" | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_init(Object *obj) | ||
69 | for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | ||
70 | sysbus_init_irq(sbd, &s->timermod[i].timerint); | ||
71 | } | ||
72 | + s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); | ||
73 | } | ||
74 | |||
75 | static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | ||
76 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_dualtimermod_vmstate = { | ||
77 | |||
78 | static const VMStateDescription cmsdk_apb_dualtimer_vmstate = { | ||
79 | .name = "cmsdk-apb-dualtimer", | ||
80 | - .version_id = 1, | ||
81 | - .minimum_version_id = 1, | ||
82 | + .version_id = 2, | ||
83 | + .minimum_version_id = 2, | ||
84 | .fields = (VMStateField[]) { | ||
85 | + VMSTATE_CLOCK(timclk, CMSDKAPBDualTimer), | ||
86 | VMSTATE_STRUCT_ARRAY(timermod, CMSDKAPBDualTimer, | ||
87 | CMSDK_APB_DUALTIMER_NUM_MODULES, | ||
88 | 1, cmsdk_dualtimermod_vmstate, | ||
89 | -- | ||
90 | 2.20.1 | ||
91 | |||
92 | diff view generated by jsdifflib |
1 | Convert the SSYS code in the Stellaris boards (which encapsulates the | 1 | The ARMv8.3-CCIDX extension makes the CCSIDR_EL1 system ID registers |
---|---|---|---|
2 | system registers) to a proper QOM device. This will provide us with | 2 | have a format that uses the full 64 bit width of the register, and |
3 | somewhere to put the output Clock whose frequency depends on the | 3 | adds a new CCSIDR2 register so AArch32 can get at the high 32 bits. |
4 | setting of the PLL configuration registers. | ||
5 | 4 | ||
6 | This is a migration compatibility break for lm3s811evb, lm3s6965evb. | 5 | QEMU doesn't implement caches, so we just treat these ID registers as |
6 | opaque values that are set to the correct constant values for each | ||
7 | CPU. The only thing we need to do is allow 64-bit values in our | ||
8 | cssidr[] array and provide the CCSIDR2 accessors. | ||
7 | 9 | ||
8 | We use 3-phase reset here because the Clock will need to propagate | 10 | We don't set the CCIDX field in our 'max' CPU because the CCSIDR |
9 | its value in the hold phase. | 11 | constant values we use are the same as the ones used by the |
10 | 12 | Cortex-A57 and they are in the old 32-bit format. This means | |
11 | For the moment we reset the device during the board creation so that | 13 | that the extra regdef added here is unused currently, but it |
12 | the system_clock_scale global gets set; this will be removed in a | 14 | means that whenever in the future we add a CPU that does need |
13 | subsequent commit. | 15 | the new 64-bit format it will just work when we set the cssidr |
16 | values and the ID registers for it. | ||
14 | 17 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
17 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 20 | Message-id: 20200224182626.29252-1-peter.maydell@linaro.org |
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Message-id: 20210128114145.20536-17-peter.maydell@linaro.org | ||
20 | Message-id: 20210121190622.22000-17-peter.maydell@linaro.org | ||
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | --- | 21 | --- |
23 | hw/arm/stellaris.c | 132 ++++++++++++++++++++++++++++++++++++--------- | 22 | target/arm/cpu.h | 17 ++++++++++++++++- |
24 | 1 file changed, 107 insertions(+), 25 deletions(-) | 23 | target/arm/helper.c | 19 +++++++++++++++++++ |
24 | 2 files changed, 35 insertions(+), 1 deletion(-) | ||
25 | 25 | ||
26 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 26 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
27 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/arm/stellaris.c | 28 | --- a/target/arm/cpu.h |
29 | +++ b/hw/arm/stellaris.c | 29 | +++ b/target/arm/cpu.h |
30 | @@ -XXX,XX +XXX,XX @@ static void stellaris_gptm_realize(DeviceState *dev, Error **errp) | 30 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { |
31 | 31 | /* The elements of this array are the CCSIDR values for each cache, | |
32 | /* System controller. */ | 32 | * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc. |
33 | 33 | */ | |
34 | -typedef struct { | 34 | - uint32_t ccsidr[16]; |
35 | +#define TYPE_STELLARIS_SYS "stellaris-sys" | 35 | + uint64_t ccsidr[16]; |
36 | +OBJECT_DECLARE_SIMPLE_TYPE(ssys_state, STELLARIS_SYS) | 36 | uint64_t reset_cbar; |
37 | + | 37 | uint32_t reset_auxcr; |
38 | +struct ssys_state { | 38 | bool reset_hivecs; |
39 | + SysBusDevice parent_obj; | 39 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id) |
40 | + | 40 | return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0; |
41 | MemoryRegion iomem; | 41 | } |
42 | uint32_t pborctl; | 42 | |
43 | uint32_t ldopctl; | 43 | +static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) |
44 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 44 | +{ |
45 | uint32_t dcgc[3]; | 45 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; |
46 | uint32_t clkvclr; | ||
47 | uint32_t ldoarst; | ||
48 | + qemu_irq irq; | ||
49 | + /* Properties (all read-only registers) */ | ||
50 | uint32_t user0; | ||
51 | uint32_t user1; | ||
52 | - qemu_irq irq; | ||
53 | - stellaris_board_info *board; | ||
54 | -} ssys_state; | ||
55 | + uint32_t did0; | ||
56 | + uint32_t did1; | ||
57 | + uint32_t dc0; | ||
58 | + uint32_t dc1; | ||
59 | + uint32_t dc2; | ||
60 | + uint32_t dc3; | ||
61 | + uint32_t dc4; | ||
62 | +}; | ||
63 | |||
64 | static void ssys_update(ssys_state *s) | ||
65 | { | ||
66 | @@ -XXX,XX +XXX,XX @@ static uint32_t pllcfg_fury[16] = { | ||
67 | |||
68 | static int ssys_board_class(const ssys_state *s) | ||
69 | { | ||
70 | - uint32_t did0 = s->board->did0; | ||
71 | + uint32_t did0 = s->did0; | ||
72 | switch (did0 & DID0_VER_MASK) { | ||
73 | case DID0_VER_0: | ||
74 | return DID0_CLASS_SANDSTORM; | ||
75 | @@ -XXX,XX +XXX,XX @@ static uint64_t ssys_read(void *opaque, hwaddr offset, | ||
76 | |||
77 | switch (offset) { | ||
78 | case 0x000: /* DID0 */ | ||
79 | - return s->board->did0; | ||
80 | + return s->did0; | ||
81 | case 0x004: /* DID1 */ | ||
82 | - return s->board->did1; | ||
83 | + return s->did1; | ||
84 | case 0x008: /* DC0 */ | ||
85 | - return s->board->dc0; | ||
86 | + return s->dc0; | ||
87 | case 0x010: /* DC1 */ | ||
88 | - return s->board->dc1; | ||
89 | + return s->dc1; | ||
90 | case 0x014: /* DC2 */ | ||
91 | - return s->board->dc2; | ||
92 | + return s->dc2; | ||
93 | case 0x018: /* DC3 */ | ||
94 | - return s->board->dc3; | ||
95 | + return s->dc3; | ||
96 | case 0x01c: /* DC4 */ | ||
97 | - return s->board->dc4; | ||
98 | + return s->dc4; | ||
99 | case 0x030: /* PBORCTL */ | ||
100 | return s->pborctl; | ||
101 | case 0x034: /* LDOPCTL */ | ||
102 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ssys_ops = { | ||
103 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
104 | }; | ||
105 | |||
106 | -static void ssys_reset(void *opaque) | ||
107 | +static void stellaris_sys_reset_enter(Object *obj, ResetType type) | ||
108 | { | ||
109 | - ssys_state *s = (ssys_state *)opaque; | ||
110 | + ssys_state *s = STELLARIS_SYS(obj); | ||
111 | |||
112 | s->pborctl = 0x7ffd; | ||
113 | s->rcc = 0x078e3ac0; | ||
114 | @@ -XXX,XX +XXX,XX @@ static void ssys_reset(void *opaque) | ||
115 | s->rcgc[0] = 1; | ||
116 | s->scgc[0] = 1; | ||
117 | s->dcgc[0] = 1; | ||
118 | +} | 46 | +} |
119 | + | 47 | + |
120 | +static void stellaris_sys_reset_hold(Object *obj) | 48 | /* |
49 | * 64-bit feature tests via id registers. | ||
50 | */ | ||
51 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
52 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
53 | } | ||
54 | |||
55 | +static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
121 | +{ | 56 | +{ |
122 | + ssys_state *s = STELLARIS_SYS(obj); | 57 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; |
123 | + | ||
124 | ssys_calculate_system_clock(s); | ||
125 | } | ||
126 | |||
127 | +static void stellaris_sys_reset_exit(Object *obj) | ||
128 | +{ | ||
129 | +} | 58 | +} |
130 | + | 59 | + |
131 | static int stellaris_sys_post_load(void *opaque, int version_id) | 60 | /* |
132 | { | 61 | * Feature tests for "does this exist in either 32-bit or 64-bit?" |
133 | ssys_state *s = opaque; | 62 | */ |
134 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_stellaris_sys = { | 63 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_pmu_8_4(const ARMISARegisters *id) |
135 | } | 64 | return isar_feature_aa64_pmu_8_4(id) || isar_feature_aa32_pmu_8_4(id); |
65 | } | ||
66 | |||
67 | +static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
68 | +{ | ||
69 | + return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
70 | +} | ||
71 | + | ||
72 | /* | ||
73 | * Forward to the above feature tests given an ARMCPU pointer. | ||
74 | */ | ||
75 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
76 | index XXXXXXX..XXXXXXX 100644 | ||
77 | --- a/target/arm/helper.c | ||
78 | +++ b/target/arm/helper.c | ||
79 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = { | ||
80 | REGINFO_SENTINEL | ||
136 | }; | 81 | }; |
137 | 82 | ||
138 | +static Property stellaris_sys_properties[] = { | 83 | +static uint64_t ccsidr2_read(CPUARMState *env, const ARMCPRegInfo *ri) |
139 | + DEFINE_PROP_UINT32("user0", ssys_state, user0, 0), | 84 | +{ |
140 | + DEFINE_PROP_UINT32("user1", ssys_state, user1, 0), | 85 | + /* Read the high 32 bits of the current CCSIDR */ |
141 | + DEFINE_PROP_UINT32("did0", ssys_state, did0, 0), | 86 | + return extract64(ccsidr_read(env, ri), 32, 32); |
142 | + DEFINE_PROP_UINT32("did1", ssys_state, did1, 0), | 87 | +} |
143 | + DEFINE_PROP_UINT32("dc0", ssys_state, dc0, 0), | 88 | + |
144 | + DEFINE_PROP_UINT32("dc1", ssys_state, dc1, 0), | 89 | +static const ARMCPRegInfo ccsidr2_reginfo[] = { |
145 | + DEFINE_PROP_UINT32("dc2", ssys_state, dc2, 0), | 90 | + { .name = "CCSIDR2", .state = ARM_CP_STATE_BOTH, |
146 | + DEFINE_PROP_UINT32("dc3", ssys_state, dc3, 0), | 91 | + .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 2, |
147 | + DEFINE_PROP_UINT32("dc4", ssys_state, dc4, 0), | 92 | + .access = PL1_R, |
148 | + DEFINE_PROP_END_OF_LIST() | 93 | + .accessfn = access_aa64_tid2, |
94 | + .readfn = ccsidr2_read, .type = ARM_CP_NO_RAW }, | ||
95 | + REGINFO_SENTINEL | ||
149 | +}; | 96 | +}; |
150 | + | 97 | + |
151 | +static void stellaris_sys_instance_init(Object *obj) | 98 | static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, |
152 | +{ | 99 | bool isread) |
153 | + ssys_state *s = STELLARIS_SYS(obj); | 100 | { |
154 | + SysBusDevice *sbd = SYS_BUS_DEVICE(s); | 101 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
102 | define_arm_cp_regs(cpu, predinv_reginfo); | ||
103 | } | ||
104 | |||
105 | + if (cpu_isar_feature(any_ccidx, cpu)) { | ||
106 | + define_arm_cp_regs(cpu, ccsidr2_reginfo); | ||
107 | + } | ||
155 | + | 108 | + |
156 | + memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000); | 109 | #ifndef CONFIG_USER_ONLY |
157 | + sysbus_init_mmio(sbd, &s->iomem); | 110 | /* |
158 | + sysbus_init_irq(sbd, &s->irq); | 111 | * Register redirections and aliases must be done last, |
159 | +} | ||
160 | + | ||
161 | static int stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
162 | stellaris_board_info * board, | ||
163 | uint8_t *macaddr) | ||
164 | { | ||
165 | - ssys_state *s; | ||
166 | + DeviceState *dev = qdev_new(TYPE_STELLARIS_SYS); | ||
167 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
168 | |||
169 | - s = g_new0(ssys_state, 1); | ||
170 | - s->irq = irq; | ||
171 | - s->board = board; | ||
172 | /* Most devices come preprogrammed with a MAC address in the user data. */ | ||
173 | - s->user0 = macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 16); | ||
174 | - s->user1 = macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 16); | ||
175 | + qdev_prop_set_uint32(dev, "user0", | ||
176 | + macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 16)); | ||
177 | + qdev_prop_set_uint32(dev, "user1", | ||
178 | + macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 16)); | ||
179 | + qdev_prop_set_uint32(dev, "did0", board->did0); | ||
180 | + qdev_prop_set_uint32(dev, "did1", board->did1); | ||
181 | + qdev_prop_set_uint32(dev, "dc0", board->dc0); | ||
182 | + qdev_prop_set_uint32(dev, "dc1", board->dc1); | ||
183 | + qdev_prop_set_uint32(dev, "dc2", board->dc2); | ||
184 | + qdev_prop_set_uint32(dev, "dc3", board->dc3); | ||
185 | + qdev_prop_set_uint32(dev, "dc4", board->dc4); | ||
186 | + | ||
187 | + sysbus_realize_and_unref(sbd, &error_fatal); | ||
188 | + sysbus_mmio_map(sbd, 0, base); | ||
189 | + sysbus_connect_irq(sbd, 0, irq); | ||
190 | + | ||
191 | + /* | ||
192 | + * Normally we should not be resetting devices like this during | ||
193 | + * board creation. For the moment we need to do so, because | ||
194 | + * system_clock_scale will only get set when the STELLARIS_SYS | ||
195 | + * device is reset, and we need its initial value to pass to | ||
196 | + * the watchdog device. This hack can be removed once the | ||
197 | + * watchdog has been converted to use a Clock input instead. | ||
198 | + */ | ||
199 | + device_cold_reset(dev); | ||
200 | |||
201 | - memory_region_init_io(&s->iomem, NULL, &ssys_ops, s, "ssys", 0x00001000); | ||
202 | - memory_region_add_subregion(get_system_memory(), base, &s->iomem); | ||
203 | - ssys_reset(s); | ||
204 | - vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_stellaris_sys, s); | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | - | ||
209 | /* I2C controller. */ | ||
210 | |||
211 | #define TYPE_STELLARIS_I2C "stellaris-i2c" | ||
212 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo stellaris_adc_info = { | ||
213 | .class_init = stellaris_adc_class_init, | ||
214 | }; | ||
215 | |||
216 | +static void stellaris_sys_class_init(ObjectClass *klass, void *data) | ||
217 | +{ | ||
218 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
219 | + ResettableClass *rc = RESETTABLE_CLASS(klass); | ||
220 | + | ||
221 | + dc->vmsd = &vmstate_stellaris_sys; | ||
222 | + rc->phases.enter = stellaris_sys_reset_enter; | ||
223 | + rc->phases.hold = stellaris_sys_reset_hold; | ||
224 | + rc->phases.exit = stellaris_sys_reset_exit; | ||
225 | + device_class_set_props(dc, stellaris_sys_properties); | ||
226 | +} | ||
227 | + | ||
228 | +static const TypeInfo stellaris_sys_info = { | ||
229 | + .name = TYPE_STELLARIS_SYS, | ||
230 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
231 | + .instance_size = sizeof(ssys_state), | ||
232 | + .instance_init = stellaris_sys_instance_init, | ||
233 | + .class_init = stellaris_sys_class_init, | ||
234 | +}; | ||
235 | + | ||
236 | static void stellaris_register_types(void) | ||
237 | { | ||
238 | type_register_static(&stellaris_i2c_info); | ||
239 | type_register_static(&stellaris_gptm_info); | ||
240 | type_register_static(&stellaris_adc_info); | ||
241 | + type_register_static(&stellaris_sys_info); | ||
242 | } | ||
243 | |||
244 | type_init(stellaris_register_types) | ||
245 | -- | 112 | -- |
246 | 2.20.1 | 113 | 2.20.1 |
247 | 114 | ||
248 | 115 | diff view generated by jsdifflib |
1 | Create a fixed-frequency Clock object to be the SYSCLK, and wire it | 1 | In our KVM GICv2 realize function, we try to cope with old kernels |
---|---|---|---|
2 | up to the devices that require it. | 2 | that don't provide the device control API (KVM_CAP_DEVICE_CTRL): we |
3 | try to use the device control, and if that fails we fall back to | ||
4 | assuming that the kernel has the old style KVM_CREATE_IRQCHIP and | ||
5 | that it will provide a GICv2. | ||
6 | |||
7 | This doesn't cater for the possibility of a kernel and hardware which | ||
8 | only provide a GICv3, which is very common now. On that setup we | ||
9 | will abort() later on in kvm_arm_pmu_set_irq() when we try to wire up | ||
10 | an interrupt to the GIC we failed to create: | ||
11 | |||
12 | qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument | ||
13 | qemu-system-aarch64: failed to set irq for PMU | ||
14 | Aborted | ||
15 | |||
16 | If the kernel advertises KVM_CAP_DEVICE_CTRL we should trust it if it | ||
17 | says it can't create a GICv2, rather than assuming it has one. We | ||
18 | can then produce a more helpful error message including a hint about | ||
19 | the most probable reason for the failure. | ||
20 | |||
21 | If the kernel doesn't advertise KVM_CAP_DEVICE_CTRL then it is truly | ||
22 | ancient by this point but we might as well still fall back to a | ||
23 | KVM_CREATE_IRQCHIP GICv2. | ||
24 | |||
25 | With this patch then the user misconfiguration which previously | ||
26 | caused an abort now prints: | ||
27 | qemu-system-aarch64: Initialization of device kvm-arm-gic failed: error creating in-kernel VGIC: No such device | ||
28 | Perhaps the host CPU does not support GICv2? | ||
3 | 29 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 31 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 32 | Reviewed-by: Andrew Jones <drjones@redhat.com> |
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 33 | Tested-by: Andrew Jones <drjones@redhat.com> |
8 | Message-id: 20210128114145.20536-14-peter.maydell@linaro.org | 34 | Message-id: 20200225182435.1131-1-peter.maydell@linaro.org |
9 | Message-id: 20210121190622.22000-14-peter.maydell@linaro.org | ||
10 | --- | 35 | --- |
11 | hw/arm/mps2.c | 9 +++++++++ | 36 | hw/intc/arm_gic_kvm.c | 9 +++++++++ |
12 | 1 file changed, 9 insertions(+) | 37 | 1 file changed, 9 insertions(+) |
13 | 38 | ||
14 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | 39 | diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c |
15 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/mps2.c | 41 | --- a/hw/intc/arm_gic_kvm.c |
17 | +++ b/hw/arm/mps2.c | 42 | +++ b/hw/intc/arm_gic_kvm.c |
18 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) |
19 | #include "hw/net/lan9118.h" | 44 | KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, |
20 | #include "net/net.h" | 45 | &error_abort); |
21 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | 46 | } |
22 | +#include "hw/qdev-clock.h" | 47 | + } else if (kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) { |
23 | #include "qom/object.h" | 48 | + error_setg_errno(errp, -ret, "error creating in-kernel VGIC"); |
24 | 49 | + error_append_hint(errp, | |
25 | typedef enum MPS2FPGAType { | 50 | + "Perhaps the host CPU does not support GICv2?\n"); |
26 | @@ -XXX,XX +XXX,XX @@ struct MPS2MachineState { | 51 | } else if (ret != -ENODEV && ret != -ENOTSUP) { |
27 | CMSDKAPBDualTimer dualtimer; | 52 | + /* |
28 | CMSDKAPBWatchdog watchdog; | 53 | + * Very ancient kernel without KVM_CAP_DEVICE_CTRL: assume that |
29 | CMSDKAPBTimer timer[2]; | 54 | + * ENODEV or ENOTSUP mean "can't create GICv2 with KVM_CREATE_DEVICE", |
30 | + Clock *sysclk; | 55 | + * and that we will get a GICv2 via KVM_CREATE_IRQCHIP. |
31 | }; | 56 | + */ |
32 | 57 | error_setg_errno(errp, -ret, "error creating in-kernel VGIC"); | |
33 | #define TYPE_MPS2_MACHINE "mps2" | 58 | return; |
34 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
35 | exit(EXIT_FAILURE); | ||
36 | } | 59 | } |
37 | |||
38 | + /* This clock doesn't need migration because it is fixed-frequency */ | ||
39 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | ||
40 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | ||
41 | + | ||
42 | /* The FPGA images have an odd combination of different RAMs, | ||
43 | * because in hardware they are different implementations and | ||
44 | * connected to different buses, giving varying performance/size | ||
45 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
46 | TYPE_CMSDK_APB_TIMER); | ||
47 | sbd = SYS_BUS_DEVICE(&mms->timer[i]); | ||
48 | qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | ||
49 | + qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); | ||
50 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
51 | sysbus_mmio_map(sbd, 0, base); | ||
52 | sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
54 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
55 | TYPE_CMSDK_APB_DUALTIMER); | ||
56 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
57 | + qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); | ||
58 | sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); | ||
59 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
60 | qdev_get_gpio_in(armv7m, 10)); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
62 | object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, | ||
63 | TYPE_CMSDK_APB_WATCHDOG); | ||
64 | qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); | ||
65 | + qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); | ||
66 | sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); | ||
67 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, | ||
68 | qdev_get_gpio_in_named(armv7m, "NMI", 0)); | ||
69 | -- | 60 | -- |
70 | 2.20.1 | 61 | 2.20.1 |
71 | 62 | ||
72 | 63 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Create and connect the two clocks needed by the ARMSSE. | ||
2 | 1 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20210128114145.20536-15-peter.maydell@linaro.org | ||
8 | Message-id: 20210121190622.22000-15-peter.maydell@linaro.org | ||
9 | --- | ||
10 | hw/arm/mps2-tz.c | 13 +++++++++++++ | ||
11 | 1 file changed, 13 insertions(+) | ||
12 | |||
13 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/mps2-tz.c | ||
16 | +++ b/hw/arm/mps2-tz.c | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #include "hw/net/lan9118.h" | ||
19 | #include "net/net.h" | ||
20 | #include "hw/core/split-irq.h" | ||
21 | +#include "hw/qdev-clock.h" | ||
22 | #include "qom/object.h" | ||
23 | |||
24 | #define MPS2TZ_NUMIRQ 92 | ||
25 | @@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState { | ||
26 | qemu_or_irq uart_irq_orgate; | ||
27 | DeviceState *lan9118; | ||
28 | SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ]; | ||
29 | + Clock *sysclk; | ||
30 | + Clock *s32kclk; | ||
31 | }; | ||
32 | |||
33 | #define TYPE_MPS2TZ_MACHINE "mps2tz" | ||
34 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE) | ||
35 | |||
36 | /* Main SYSCLK frequency in Hz */ | ||
37 | #define SYSCLK_FRQ 20000000 | ||
38 | +/* Slow 32Khz S32KCLK frequency in Hz */ | ||
39 | +#define S32KCLK_FRQ (32 * 1000) | ||
40 | |||
41 | /* Create an alias of an entire original MemoryRegion @orig | ||
42 | * located at @base in the memory map. | ||
43 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
44 | exit(EXIT_FAILURE); | ||
45 | } | ||
46 | |||
47 | + /* These clocks don't need migration because they are fixed-frequency */ | ||
48 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | ||
49 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | ||
50 | + mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); | ||
51 | + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); | ||
52 | + | ||
53 | object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | ||
54 | mmc->armsse_type); | ||
55 | iotkitdev = DEVICE(&mms->iotkit); | ||
56 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
57 | OBJECT(system_memory), &error_abort); | ||
58 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | ||
59 | qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
60 | + qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); | ||
61 | + qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); | ||
62 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | ||
63 | |||
64 | /* | ||
65 | -- | ||
66 | 2.20.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Create and connect the two clocks needed by the ARMSSE. | ||
2 | 1 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20210128114145.20536-16-peter.maydell@linaro.org | ||
8 | Message-id: 20210121190622.22000-16-peter.maydell@linaro.org | ||
9 | --- | ||
10 | hw/arm/musca.c | 12 ++++++++++++ | ||
11 | 1 file changed, 12 insertions(+) | ||
12 | |||
13 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/musca.c | ||
16 | +++ b/hw/arm/musca.c | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #include "hw/misc/tz-ppc.h" | ||
19 | #include "hw/misc/unimp.h" | ||
20 | #include "hw/rtc/pl031.h" | ||
21 | +#include "hw/qdev-clock.h" | ||
22 | #include "qom/object.h" | ||
23 | |||
24 | #define MUSCA_NUMIRQ_MAX 96 | ||
25 | @@ -XXX,XX +XXX,XX @@ struct MuscaMachineState { | ||
26 | UnimplementedDeviceState sdio; | ||
27 | UnimplementedDeviceState gpio; | ||
28 | UnimplementedDeviceState cryptoisland; | ||
29 | + Clock *sysclk; | ||
30 | + Clock *s32kclk; | ||
31 | }; | ||
32 | |||
33 | #define TYPE_MUSCA_MACHINE "musca" | ||
34 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(MuscaMachineState, MuscaMachineClass, MUSCA_MACHINE) | ||
35 | * don't model that in our SSE-200 model yet. | ||
36 | */ | ||
37 | #define SYSCLK_FRQ 40000000 | ||
38 | +/* Slow 32Khz S32KCLK frequency in Hz */ | ||
39 | +#define S32KCLK_FRQ (32 * 1000) | ||
40 | |||
41 | static qemu_irq get_sse_irq_in(MuscaMachineState *mms, int irqno) | ||
42 | { | ||
43 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
44 | exit(1); | ||
45 | } | ||
46 | |||
47 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | ||
48 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | ||
49 | + mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); | ||
50 | + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); | ||
51 | + | ||
52 | object_initialize_child(OBJECT(machine), "sse-200", &mms->sse, | ||
53 | TYPE_SSE200); | ||
54 | ssedev = DEVICE(&mms->sse); | ||
55 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
56 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | ||
57 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | ||
58 | qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
59 | + qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); | ||
60 | + qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); | ||
61 | /* | ||
62 | * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for | ||
63 | * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. | ||
64 | -- | ||
65 | 2.20.1 | ||
66 | |||
67 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Remove all the code that sets frequency properties on the CMSDK | ||
2 | timer, dualtimer and watchdog devices and on the ARMSSE SoC device: | ||
3 | these properties are unused now that the devices rely on their Clock | ||
4 | inputs instead. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
9 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20210128114145.20536-24-peter.maydell@linaro.org | ||
11 | Message-id: 20210121190622.22000-24-peter.maydell@linaro.org | ||
12 | --- | ||
13 | hw/arm/armsse.c | 7 ------- | ||
14 | hw/arm/mps2-tz.c | 1 - | ||
15 | hw/arm/mps2.c | 3 --- | ||
16 | hw/arm/musca.c | 1 - | ||
17 | hw/arm/stellaris.c | 3 --- | ||
18 | 5 files changed, 15 deletions(-) | ||
19 | |||
20 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/arm/armsse.c | ||
23 | +++ b/hw/arm/armsse.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
25 | * it to the appropriate PPC port; then we can realize the PPC and | ||
26 | * map its upstream ends to the right place in the container. | ||
27 | */ | ||
28 | - qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); | ||
29 | qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); | ||
30 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { | ||
31 | return; | ||
32 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
33 | object_property_set_link(OBJECT(&s->apb_ppc0), "port[0]", OBJECT(mr), | ||
34 | &error_abort); | ||
35 | |||
36 | - qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); | ||
37 | qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); | ||
38 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { | ||
39 | return; | ||
40 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
41 | object_property_set_link(OBJECT(&s->apb_ppc0), "port[1]", OBJECT(mr), | ||
42 | &error_abort); | ||
43 | |||
44 | - qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq); | ||
45 | qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); | ||
46 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { | ||
47 | return; | ||
48 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
49 | /* Devices behind APB PPC1: | ||
50 | * 0x4002f000: S32K timer | ||
51 | */ | ||
52 | - qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); | ||
53 | qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); | ||
54 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { | ||
55 | return; | ||
56 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
57 | qdev_connect_gpio_out(DEVICE(&s->nmi_orgate), 0, | ||
58 | qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI", 0)); | ||
59 | |||
60 | - qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); | ||
61 | qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); | ||
62 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { | ||
63 | return; | ||
64 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
65 | |||
66 | /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ | ||
67 | |||
68 | - qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk_frq); | ||
69 | qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); | ||
70 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { | ||
71 | return; | ||
72 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
73 | armsse_get_common_irq_in(s, 1)); | ||
74 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); | ||
75 | |||
76 | - qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_frq); | ||
77 | qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); | ||
78 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { | ||
79 | return; | ||
80 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/hw/arm/mps2-tz.c | ||
83 | +++ b/hw/arm/mps2-tz.c | ||
84 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
85 | object_property_set_link(OBJECT(&mms->iotkit), "memory", | ||
86 | OBJECT(system_memory), &error_abort); | ||
87 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | ||
88 | - qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
89 | qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); | ||
90 | qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); | ||
91 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | ||
92 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
93 | index XXXXXXX..XXXXXXX 100644 | ||
94 | --- a/hw/arm/mps2.c | ||
95 | +++ b/hw/arm/mps2.c | ||
96 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
97 | object_initialize_child(OBJECT(mms), name, &mms->timer[i], | ||
98 | TYPE_CMSDK_APB_TIMER); | ||
99 | sbd = SYS_BUS_DEVICE(&mms->timer[i]); | ||
100 | - qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | ||
101 | qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); | ||
102 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
103 | sysbus_mmio_map(sbd, 0, base); | ||
104 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
105 | |||
106 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
107 | TYPE_CMSDK_APB_DUALTIMER); | ||
108 | - qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
109 | qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); | ||
110 | sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); | ||
111 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
112 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
113 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); | ||
114 | object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, | ||
115 | TYPE_CMSDK_APB_WATCHDOG); | ||
116 | - qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); | ||
117 | qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); | ||
118 | sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); | ||
119 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, | ||
120 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/hw/arm/musca.c | ||
123 | +++ b/hw/arm/musca.c | ||
124 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
125 | qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); | ||
126 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | ||
127 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | ||
128 | - qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
129 | qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); | ||
130 | qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); | ||
131 | /* | ||
132 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
133 | index XXXXXXX..XXXXXXX 100644 | ||
134 | --- a/hw/arm/stellaris.c | ||
135 | +++ b/hw/arm/stellaris.c | ||
136 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
137 | if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
138 | dev = qdev_new(TYPE_LUMINARY_WATCHDOG); | ||
139 | |||
140 | - /* system_clock_scale is valid now */ | ||
141 | - uint32_t mainclk = NANOSECONDS_PER_SECOND / system_clock_scale; | ||
142 | - qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); | ||
143 | qdev_connect_clock_in(dev, "WDOGCLK", | ||
144 | qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
145 | |||
146 | -- | ||
147 | 2.20.1 | ||
148 | |||
149 | diff view generated by jsdifflib |