1 | Some more outstanding target-arm patches; nothing terribly | 1 | Nothing too exciting, but does include the last bits of v8.1M support work. |
---|---|---|---|
2 | exciting. Mostly they're mine; I'm trying to reduce the | ||
3 | number of patches I still have in flight, so I've picked | ||
4 | out some of the reviewed patches from a couple of sets I've | ||
5 | sent out and will resend v2 versions of those sets with the | ||
6 | remaining patches with fixes for issues noted in review once | ||
7 | this is in master. | ||
8 | 2 | ||
9 | thanks | ||
10 | -- PMM | 3 | -- PMM |
11 | 4 | ||
5 | The following changes since commit e79de63ab1bd1f6550e7b915e433bec1ad1a870a: | ||
12 | 6 | ||
13 | The following changes since commit adaec191bfb31e12d40af8ab1b869f5b40d61ee9: | 7 | Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210107' into staging (2021-01-07 20:34:05 +0000) |
14 | |||
15 | Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-08-20 09:48:03 +0100) | ||
16 | 8 | ||
17 | are available in the Git repository at: | 9 | are available in the Git repository at: |
18 | 10 | ||
19 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180820 | 11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210108 |
20 | 12 | ||
21 | for you to fetch changes up to b85fad1588e812566f897f747e38da345a7016d6: | 13 | for you to fetch changes up to c9f8511ea8d2b80723af0fea1f716d752c1b5208: |
22 | 14 | ||
23 | hw/dma/pl080: Remove hw_error() if DMA is enabled (2018-08-20 11:24:33 +0100) | 15 | docs/system: arm: Add sabrelite board description (2021-01-08 15:13:39 +0000) |
24 | 16 | ||
25 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
26 | target-arm queue: | 18 | target-arm queue: |
27 | * Fix crash on conditional instruction in an IT block | 19 | * intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs |
28 | * docs/generic-loader: mention U-Boot and Intel HEX executable formats | 20 | * target/arm: Fix MTE0_ACTIVE |
29 | * hw/intc/arm_gicv3_its: downgrade error_report to warn_report in kvm_arm_its_reset | 21 | * target/arm: Implement v8.1M and Cortex-M55 model |
30 | * imx_serial: Generate interrupt on receive data ready if enabled | 22 | * hw/arm/highbank: Drop dead KVM support code |
31 | * Fix various minor bugs in AArch32 Hyp related coprocessor registers | 23 | * util/qemu-timer: Make timer_free() imply timer_del() |
32 | * Permit accesses to ELR_Hyp from Hyp mode via MSR/MRS (banked) | 24 | * various devices: Use ptimer_free() in finalize function |
33 | * Implement AArch32 ERET instruction | 25 | * docs/system: arm: Add sabrelite board description |
34 | * hw/arm/virt: Add virt-3.1 machine type | 26 | * sabrelite: Minor fixes to allow booting U-Boot |
35 | * sdhci: add i.MX SD Stable Clock bit | ||
36 | * Remove now-obsolete MMIO request_ptr APIs | ||
37 | * hw/timer/m48t59: Move away from old_mmio accessors | ||
38 | * hw/watchdog/cmsdk_apb_watchdog: Implement CMSDK APB watchdog module | ||
39 | * nvic: Expose NMI line | ||
40 | * hw/dma/pl080: cleanups and new features required for use in MPS boards | ||
41 | 27 | ||
42 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
43 | Andrew Jones (1): | 29 | Andrew Jones (1): |
44 | hw/arm/virt: Add virt-3.1 machine type | 30 | hw/arm/virt: Remove virt machine state 'smp_cpus' |
45 | 31 | ||
46 | Hans-Erik Floryd (2): | 32 | Bin Meng (4): |
47 | imx_serial: Generate interrupt on receive data ready if enabled | 33 | hw/misc: imx6_ccm: Update PMU_MISC0 reset value |
48 | sdhci: add i.MX SD Stable Clock bit | 34 | hw/msic: imx6_ccm: Correct register value for silicon type |
35 | hw/arm: sabrelite: Connect the Ethernet PHY at address 6 | ||
36 | docs/system: arm: Add sabrelite board description | ||
49 | 37 | ||
50 | Jia He (1): | 38 | Edgar E. Iglesias (1): |
51 | hw/intc/arm_gicv3_its: downgrade error_report to warn_report in kvm_arm_its_reset | 39 | intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs |
52 | 40 | ||
53 | Peter Maydell (19): | 41 | Gan Qixin (7): |
54 | target/arm: Correct typo in HAMAIR1 regdef name | 42 | digic-timer: Use ptimer_free() in the finalize function to avoid memleaks |
55 | target/arm: Add missing .cp = 15 to HMAIR1 and HAMAIR1 regdefs | 43 | allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks |
56 | target/arm: Implement AArch32 HVBAR | 44 | exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks |
57 | target/arm: Implement AArch32 Hyp FARs | 45 | exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks |
58 | target/arm: Implement ESR_EL2/HSR for AArch32 and no-EL2 | 46 | mss-timer: Use ptimer_free() in the finalize function to avoid memleaks |
59 | target/arm: Permit accesses to ELR_Hyp from Hyp mode via MSR/MRS (banked) | 47 | musicpal: Use ptimer_free() in the finalize function to avoid memleaks |
60 | target/arm: Implement AArch32 ERET instruction | 48 | exynos4210_mct: Use ptimer_free() in the finalize function to avoid memleaks |
61 | hw/ssi/xilinx_spips: Remove unneeded MMIO request_ptr code | ||
62 | memory: Remove MMIO request_ptr APIs | ||
63 | hw/misc: Remove mmio_interface device | ||
64 | hw/timer/m48t59: Move away from old_mmio accessors | ||
65 | hw/watchdog/cmsdk_apb_watchdog: Implement CMSDK APB watchdog module | ||
66 | nvic: Expose NMI line | ||
67 | hw/dma/pl080: Allow use as embedded-struct device | ||
68 | hw/dma/pl080: Support all three interrupt lines | ||
69 | hw/dma/pl080: Don't use CPU address space for DMA accesses | ||
70 | hw/dma/pl080: Provide device reset function | ||
71 | hw/dma/pl080: Correct bug in register address decode logic | ||
72 | hw/dma/pl080: Remove hw_error() if DMA is enabled | ||
73 | 49 | ||
74 | Roman Kapl (1): | 50 | Peter Maydell (9): |
75 | target/arm: Fix crash on conditional instruction in an IT block | 51 | hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN |
52 | target/arm: Correct store of FPSCR value via FPCXT_S | ||
53 | target/arm: Implement FPCXT_NS fp system register | ||
54 | target/arm: Implement Cortex-M55 model | ||
55 | hw/arm/highbank: Drop dead KVM support code | ||
56 | util/qemu-timer: Make timer_free() imply timer_del() | ||
57 | scripts/coccinelle: New script to remove unnecessary timer_del() calls | ||
58 | Remove superfluous timer_del() calls | ||
59 | target/arm: Remove timer_del()/timer_deinit() before timer_free() | ||
76 | 60 | ||
77 | Stefan Hajnoczi (1): | 61 | Richard Henderson (1): |
78 | docs/generic-loader: mention U-Boot and Intel HEX executable formats | 62 | target/arm: Fix MTE0_ACTIVE |
79 | 63 | ||
80 | docs/generic-loader.txt | 20 +- | 64 | docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++ |
81 | Makefile.objs | 1 + | 65 | docs/system/target-arm.rst | 1 + |
82 | hw/misc/Makefile.objs | 1 - | 66 | scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++ |
83 | hw/watchdog/Makefile.objs | 1 + | 67 | include/hw/arm/virt.h | 3 +- |
84 | hw/sd/sdhci-internal.h | 2 + | 68 | include/qemu/timer.h | 24 +++--- |
85 | include/exec/memory.h | 35 ---- | 69 | block/iscsi.c | 2 - |
86 | include/hw/char/imx_serial.h | 1 + | 70 | block/nbd.c | 1 - |
87 | include/hw/dma/pl080.h | 71 +++++++ | 71 | block/qcow2.c | 1 - |
88 | include/hw/misc/mmio_interface.h | 49 ----- | 72 | hw/arm/highbank.c | 14 +-- |
89 | include/hw/watchdog/cmsdk-apb-watchdog.h | 59 ++++++ | 73 | hw/arm/musicpal.c | 12 +++ |
90 | hw/arm/armv7m.c | 1 + | 74 | hw/arm/sabrelite.c | 4 + |
91 | hw/arm/realview.c | 8 +- | 75 | hw/arm/virt-acpi-build.c | 9 +- |
92 | hw/arm/versatilepb.c | 9 +- | 76 | hw/arm/virt.c | 21 +++-- |
93 | hw/arm/virt.c | 23 ++- | 77 | hw/block/nvme.c | 2 - |
94 | hw/char/imx_serial.c | 3 +- | 78 | hw/char/serial.c | 2 - |
95 | hw/dma/pl080.c | 113 ++++++----- | 79 | hw/char/virtio-serial-bus.c | 2 - |
96 | hw/intc/arm_gicv3_its_kvm.c | 2 +- | 80 | hw/ide/core.c | 1 - |
97 | hw/intc/armv7m_nvic.c | 19 ++ | 81 | hw/input/hid.c | 1 - |
98 | hw/misc/mmio_interface.c | 135 ------------- | 82 | hw/intc/apic.c | 1 - |
99 | hw/sd/sdhci.c | 8 + | 83 | hw/intc/arm_gic.c | 4 +- |
100 | hw/ssi/xilinx_spips.c | 46 ----- | 84 | hw/intc/armv7m_nvic.c | 15 ++++ |
101 | hw/timer/m48t59.c | 59 ++---- | 85 | hw/intc/ioapic.c | 1 - |
102 | hw/watchdog/cmsdk-apb-watchdog.c | 326 +++++++++++++++++++++++++++++++ | 86 | hw/ipmi/ipmi_bmc_extern.c | 1 - |
103 | memory.c | 110 ----------- | 87 | hw/misc/imx6_ccm.c | 4 +- |
104 | target/arm/helper.c | 36 +++- | 88 | hw/net/e1000.c | 3 - |
105 | target/arm/op_helper.c | 22 +-- | 89 | hw/net/e1000e_core.c | 8 -- |
106 | target/arm/translate.c | 76 +++++-- | 90 | hw/net/pcnet-pci.c | 1 - |
107 | MAINTAINERS | 3 + | 91 | hw/net/rtl8139.c | 1 - |
108 | default-configs/arm-softmmu.mak | 1 + | 92 | hw/net/spapr_llan.c | 1 - |
109 | hw/intc/trace-events | 1 + | 93 | hw/net/virtio-net.c | 2 - |
110 | hw/watchdog/trace-events | 6 + | 94 | hw/rtc/exynos4210_rtc.c | 9 ++ |
111 | 31 files changed, 717 insertions(+), 530 deletions(-) | 95 | hw/s390x/s390-pci-inst.c | 1 - |
112 | create mode 100644 include/hw/dma/pl080.h | 96 | hw/sd/sd.c | 1 - |
113 | delete mode 100644 include/hw/misc/mmio_interface.h | 97 | hw/sd/sdhci.c | 2 - |
114 | create mode 100644 include/hw/watchdog/cmsdk-apb-watchdog.h | 98 | hw/timer/allwinner-a10-pit.c | 11 +++ |
115 | delete mode 100644 hw/misc/mmio_interface.c | 99 | hw/timer/digic-timer.c | 8 ++ |
116 | create mode 100644 hw/watchdog/cmsdk-apb-watchdog.c | 100 | hw/timer/exynos4210_mct.c | 14 +++ |
117 | create mode 100644 hw/watchdog/trace-events | 101 | hw/timer/exynos4210_pwm.c | 11 +++ |
102 | hw/timer/mss-timer.c | 13 +++ | ||
103 | hw/usb/dev-hub.c | 1 - | ||
104 | hw/usb/hcd-ehci.c | 1 - | ||
105 | hw/usb/hcd-ohci-pci.c | 1 - | ||
106 | hw/usb/hcd-uhci.c | 1 - | ||
107 | hw/usb/hcd-xhci.c | 1 - | ||
108 | hw/usb/redirect.c | 1 - | ||
109 | hw/vfio/display.c | 1 - | ||
110 | hw/virtio/vhost-vsock-common.c | 1 - | ||
111 | hw/virtio/virtio-balloon.c | 1 - | ||
112 | hw/virtio/virtio-rng.c | 1 - | ||
113 | hw/watchdog/wdt_diag288.c | 1 - | ||
114 | hw/watchdog/wdt_i6300esb.c | 1 - | ||
115 | migration/colo.c | 1 - | ||
116 | monitor/hmp-cmds.c | 1 - | ||
117 | net/announce.c | 1 - | ||
118 | net/colo-compare.c | 1 - | ||
119 | net/slirp.c | 1 - | ||
120 | replay/replay-debugging.c | 1 - | ||
121 | target/arm/cpu.c | 2 - | ||
122 | target/arm/cpu_tcg.c | 42 +++++++++ | ||
123 | target/arm/helper.c | 2 +- | ||
124 | target/s390x/cpu.c | 2 - | ||
125 | ui/console.c | 1 - | ||
126 | ui/spice-core.c | 1 - | ||
127 | util/throttle.c | 1 - | ||
128 | target/arm/translate-vfp.c.inc | 114 ++++++++++++++++++++++-- | ||
129 | 65 files changed, 421 insertions(+), 111 deletions(-) | ||
130 | create mode 100644 docs/system/arm/sabrelite.rst | ||
131 | create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci | ||
118 | 132 | diff view generated by jsdifflib |
1 | The MSR (banked) and MRS (banked) instructions allow accesses to ELR_Hyp | 1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> |
---|---|---|---|
2 | from either Monitor or Hyp mode. Our translate time check | ||
3 | was overly strict and only permitted access from Monitor mode. | ||
4 | 2 | ||
5 | The runtime check we do in msr_mrs_banked_exc_checks() had the | 3 | Correct the indexing into s->cpu_ctlr for vCPUs. |
6 | correct code in it, but never got there because of the earlier | ||
7 | "currmode == tgtmode" check. Special case ELR_Hyp. | ||
8 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
8 | Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
11 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
12 | Message-id: 20180814124254.5229-9-peter.maydell@linaro.org | ||
13 | --- | 10 | --- |
14 | target/arm/op_helper.c | 22 +++++++++++----------- | 11 | hw/intc/arm_gic.c | 4 +++- |
15 | target/arm/translate.c | 10 +++++++--- | 12 | 1 file changed, 3 insertions(+), 1 deletion(-) |
16 | 2 files changed, 18 insertions(+), 14 deletions(-) | ||
17 | 13 | ||
18 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 14 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/op_helper.c | 16 | --- a/hw/intc/arm_gic.c |
21 | +++ b/target/arm/op_helper.c | 17 | +++ b/hw/intc/arm_gic.c |
22 | @@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode, | 18 | @@ -XXX,XX +XXX,XX @@ static inline void gic_get_best_virq(GICState *s, int cpu, |
23 | */ | 19 | static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt, |
24 | int curmode = env->uncached_cpsr & CPSR_M; | 20 | int group_mask) |
25 | 21 | { | |
26 | + if (regno == 17) { | 22 | + int cpu_iface = virt ? (cpu + GIC_NCPU) : cpu; |
27 | + /* ELR_Hyp: a special case because access from tgtmode is OK */ | ||
28 | + if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) { | ||
29 | + goto undef; | ||
30 | + } | ||
31 | + return; | ||
32 | + } | ||
33 | + | 23 | + |
34 | if (curmode == tgtmode) { | 24 | if (!virt && !(s->ctlr & group_mask)) { |
35 | goto undef; | 25 | return false; |
36 | } | 26 | } |
37 | @@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode, | 27 | @@ -XXX,XX +XXX,XX @@ static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt, |
28 | return false; | ||
38 | } | 29 | } |
39 | 30 | ||
40 | if (tgtmode == ARM_CPU_MODE_HYP) { | 31 | - if (!(s->cpu_ctlr[cpu] & group_mask)) { |
41 | - switch (regno) { | 32 | + if (!(s->cpu_ctlr[cpu_iface] & group_mask)) { |
42 | - case 17: /* ELR_Hyp */ | 33 | return false; |
43 | - if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) { | ||
44 | - goto undef; | ||
45 | - } | ||
46 | - break; | ||
47 | - default: | ||
48 | - if (curmode != ARM_CPU_MODE_MON) { | ||
49 | - goto undef; | ||
50 | - } | ||
51 | - break; | ||
52 | + /* SPSR_Hyp, r13_hyp: accessible from Monitor mode only */ | ||
53 | + if (curmode != ARM_CPU_MODE_MON) { | ||
54 | + goto undef; | ||
55 | } | ||
56 | } | 34 | } |
57 | 35 | ||
58 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/arm/translate.c | ||
61 | +++ b/target/arm/translate.c | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, | ||
63 | } | ||
64 | break; | ||
65 | case ARM_CPU_MODE_HYP: | ||
66 | - /* Note that we can forbid accesses from EL2 here because they | ||
67 | - * must be from Hyp mode itself | ||
68 | + /* | ||
69 | + * SPSR_hyp and r13_hyp can only be accessed from Monitor mode | ||
70 | + * (and so we can forbid accesses from EL2 or below). elr_hyp | ||
71 | + * can be accessed also from Hyp mode, so forbid accesses from | ||
72 | + * EL0 or EL1. | ||
73 | */ | ||
74 | - if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 3) { | ||
75 | + if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2 || | ||
76 | + (s->current_el < 3 && *regno != 17)) { | ||
77 | goto undef; | ||
78 | } | ||
79 | break; | ||
80 | -- | 36 | -- |
81 | 2.18.0 | 37 | 2.20.1 |
82 | 38 | ||
83 | 39 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | virt machine's 'smp_cpus' and machine->smp.cpus must always have the | ||
4 | same value. And, anywhere we have virt machine state we have machine | ||
5 | state. So let's remove the redundancy. Also, to make it easier to see | ||
6 | that machine->smp is the true source for "smp_cpus" and "max_cpus", | ||
7 | avoid passing them in function parameters, preferring instead to get | ||
8 | them from the state. | ||
9 | |||
10 | No functional change intended. | ||
11 | |||
3 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 12 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 13 | Reviewed-by: David Edmondson <david.edmondson@oracle.com> |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Reviewed-by: Ying Fang <fangying1@huawei.com> |
15 | Message-id: 20201215174815.51520-1-drjones@redhat.com | ||
16 | [PMM: minor formatting tweak to smp_cpus variable declaration] | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 18 | --- |
8 | hw/arm/virt.c | 23 +++++++++++++++++------ | 19 | include/hw/arm/virt.h | 3 +-- |
9 | 1 file changed, 17 insertions(+), 6 deletions(-) | 20 | hw/arm/virt-acpi-build.c | 9 +++++---- |
21 | hw/arm/virt.c | 21 ++++++++++----------- | ||
22 | 3 files changed, 16 insertions(+), 17 deletions(-) | ||
10 | 23 | ||
24 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/include/hw/arm/virt.h | ||
27 | +++ b/include/hw/arm/virt.h | ||
28 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineState { | ||
29 | MemMapEntry *memmap; | ||
30 | char *pciehb_nodename; | ||
31 | const int *irqmap; | ||
32 | - int smp_cpus; | ||
33 | void *fdt; | ||
34 | int fdt_size; | ||
35 | uint32_t clock_phandle; | ||
36 | @@ -XXX,XX +XXX,XX @@ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) | ||
37 | |||
38 | assert(vms->gic_version == VIRT_GIC_VERSION_3); | ||
39 | |||
40 | - return vms->smp_cpus > redist0_capacity ? 2 : 1; | ||
41 | + return MACHINE(vms)->smp.cpus > redist0_capacity ? 2 : 1; | ||
42 | } | ||
43 | |||
44 | #endif /* QEMU_ARM_VIRT_H */ | ||
45 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/hw/arm/virt-acpi-build.c | ||
48 | +++ b/hw/arm/virt-acpi-build.c | ||
49 | @@ -XXX,XX +XXX,XX @@ | ||
50 | |||
51 | #define ACPI_BUILD_TABLE_SIZE 0x20000 | ||
52 | |||
53 | -static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) | ||
54 | +static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms) | ||
55 | { | ||
56 | + MachineState *ms = MACHINE(vms); | ||
57 | uint16_t i; | ||
58 | |||
59 | - for (i = 0; i < smp_cpus; i++) { | ||
60 | + for (i = 0; i < ms->smp.cpus; i++) { | ||
61 | Aml *dev = aml_device("C%.03X", i); | ||
62 | aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); | ||
63 | aml_append(dev, aml_name_decl("_UID", aml_int(i))); | ||
64 | @@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
65 | gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base); | ||
66 | gicd->version = vms->gic_version; | ||
67 | |||
68 | - for (i = 0; i < vms->smp_cpus; i++) { | ||
69 | + for (i = 0; i < MACHINE(vms)->smp.cpus; i++) { | ||
70 | AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data, | ||
71 | sizeof(*gicc)); | ||
72 | ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i)); | ||
73 | @@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
74 | * the RTC ACPI device at all when using UEFI. | ||
75 | */ | ||
76 | scope = aml_scope("\\_SB"); | ||
77 | - acpi_dsdt_add_cpus(scope, vms->smp_cpus); | ||
78 | + acpi_dsdt_add_cpus(scope, vms); | ||
79 | acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], | ||
80 | (irqmap[VIRT_UART] + ARM_SPI_BASE)); | ||
81 | if (vmc->acpi_expose_flash) { | ||
11 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 82 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
12 | index XXXXXXX..XXXXXXX 100644 | 83 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/virt.c | 84 | --- a/hw/arm/virt.c |
14 | +++ b/hw/arm/virt.c | 85 | +++ b/hw/arm/virt.c |
15 | @@ -XXX,XX +XXX,XX @@ static void machvirt_machine_init(void) | 86 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(const VirtMachineState *vms) |
16 | } | 87 | if (vms->gic_version == VIRT_GIC_VERSION_2) { |
17 | type_init(machvirt_machine_init); | 88 | irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START, |
18 | 89 | GIC_FDT_IRQ_PPI_CPU_WIDTH, | |
19 | -#define VIRT_COMPAT_2_12 \ | 90 | - (1 << vms->smp_cpus) - 1); |
20 | - HW_COMPAT_2_12 | 91 | + (1 << MACHINE(vms)->smp.cpus) - 1); |
92 | } | ||
93 | |||
94 | qemu_fdt_add_subnode(vms->fdt, "/timer"); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | ||
96 | int cpu; | ||
97 | int addr_cells = 1; | ||
98 | const MachineState *ms = MACHINE(vms); | ||
99 | + int smp_cpus = ms->smp.cpus; | ||
100 | |||
101 | /* | ||
102 | * From Documentation/devicetree/bindings/arm/cpus.txt | ||
103 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | ||
104 | * The simplest way to go is to examine affinity IDs of all our CPUs. If | ||
105 | * at least one of them has Aff3 populated, we set #address-cells to 2. | ||
106 | */ | ||
107 | - for (cpu = 0; cpu < vms->smp_cpus; cpu++) { | ||
108 | + for (cpu = 0; cpu < smp_cpus; cpu++) { | ||
109 | ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu)); | ||
110 | |||
111 | if (armcpu->mp_affinity & ARM_AFF3_MASK) { | ||
112 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | ||
113 | qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells); | ||
114 | qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0); | ||
115 | |||
116 | - for (cpu = vms->smp_cpus - 1; cpu >= 0; cpu--) { | ||
117 | + for (cpu = smp_cpus - 1; cpu >= 0; cpu--) { | ||
118 | char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu); | ||
119 | ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu)); | ||
120 | CPUState *cs = CPU(armcpu); | ||
121 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | ||
122 | qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", | ||
123 | armcpu->dtb_compatible); | ||
124 | |||
125 | - if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED | ||
126 | - && vms->smp_cpus > 1) { | ||
127 | + if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) { | ||
128 | qemu_fdt_setprop_string(vms->fdt, nodename, | ||
129 | "enable-method", "psci"); | ||
130 | } | ||
131 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | ||
132 | if (vms->gic_version == VIRT_GIC_VERSION_2) { | ||
133 | irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START, | ||
134 | GIC_FDT_IRQ_PPI_CPU_WIDTH, | ||
135 | - (1 << vms->smp_cpus) - 1); | ||
136 | + (1 << MACHINE(vms)->smp.cpus) - 1); | ||
137 | } | ||
138 | |||
139 | qemu_fdt_add_subnode(vms->fdt, "/pmu"); | ||
140 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
141 | * virt_cpu_post_init() must be called after the CPUs have | ||
142 | * been realized and the GIC has been created. | ||
143 | */ | ||
144 | -static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus, | ||
145 | - MemoryRegion *sysmem) | ||
146 | +static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem) | ||
147 | { | ||
148 | + int max_cpus = MACHINE(vms)->smp.max_cpus; | ||
149 | bool aarch64, pmu, steal_time; | ||
150 | CPUState *cpu; | ||
151 | |||
152 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
153 | exit(1); | ||
154 | } | ||
155 | |||
156 | - vms->smp_cpus = smp_cpus; | ||
21 | - | 157 | - |
22 | -static void virt_3_0_instance_init(Object *obj) | 158 | if (vms->virt && kvm_enabled()) { |
23 | +static void virt_3_1_instance_init(Object *obj) | 159 | error_report("mach-virt: KVM does not support providing " |
24 | { | 160 | "Virtualization extensions to the guest CPU"); |
25 | VirtMachineState *vms = VIRT_MACHINE(obj); | 161 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) |
26 | VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); | 162 | create_fdt(vms); |
27 | @@ -XXX,XX +XXX,XX @@ static void virt_3_0_instance_init(Object *obj) | 163 | |
28 | vms->irqmap = a15irqmap; | 164 | possible_cpus = mc->possible_cpu_arch_ids(machine); |
29 | } | 165 | + assert(possible_cpus->len == max_cpus); |
30 | 166 | for (n = 0; n < possible_cpus->len; n++) { | |
31 | -static void virt_machine_3_0_options(MachineClass *mc) | 167 | Object *cpuobj; |
32 | +static void virt_machine_3_1_options(MachineClass *mc) | 168 | CPUState *cs; |
33 | { | 169 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) |
34 | } | 170 | |
35 | -DEFINE_VIRT_MACHINE_AS_LATEST(3, 0) | 171 | create_gic(vms); |
36 | +DEFINE_VIRT_MACHINE_AS_LATEST(3, 1) | 172 | |
37 | + | 173 | - virt_cpu_post_init(vms, possible_cpus->len, sysmem); |
38 | +static void virt_3_0_instance_init(Object *obj) | 174 | + virt_cpu_post_init(vms, sysmem); |
39 | +{ | 175 | |
40 | + virt_3_1_instance_init(obj); | 176 | fdt_add_pmu_nodes(vms); |
41 | +} | 177 | |
42 | + | ||
43 | +static void virt_machine_3_0_options(MachineClass *mc) | ||
44 | +{ | ||
45 | + virt_machine_3_1_options(mc); | ||
46 | +} | ||
47 | +DEFINE_VIRT_MACHINE(3, 0) | ||
48 | + | ||
49 | +#define VIRT_COMPAT_2_12 \ | ||
50 | + HW_COMPAT_2_12 | ||
51 | |||
52 | static void virt_2_12_instance_init(Object *obj) | ||
53 | { | ||
54 | -- | 178 | -- |
55 | 2.18.0 | 179 | 2.20.1 |
56 | 180 | ||
57 | 181 | diff view generated by jsdifflib |
1 | The AArch32 HSR is the equivalent of AArch64 ESR_EL2; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | we can implement it by marking our existing ESR_EL2 regdef | ||
3 | as STATE_BOTH. It also needs to be "RES0 from EL3 if | ||
4 | EL2 not implemented", so add the missing stanza to | ||
5 | el3_no_el2_cp_reginfo. | ||
6 | 2 | ||
3 | In 50244cc76abc we updated mte_check_fail to match the ARM | ||
4 | pseudocode, using the correct EL to select the TCF field. | ||
5 | But we failed to update MTE0_ACTIVE the same way, which led | ||
6 | to g_assert_not_reached(). | ||
7 | |||
8 | Cc: qemu-stable@nongnu.org | ||
9 | Buglink: https://bugs.launchpad.net/bugs/1907137 | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20201221204426.88514-1-richard.henderson@linaro.org | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20180814124254.5229-8-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | target/arm/helper.c | 6 +++++- | 15 | target/arm/helper.c | 2 +- |
13 | 1 file changed, 5 insertions(+), 1 deletion(-) | 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 17 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 18 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 20 | --- a/target/arm/helper.c |
18 | +++ b/target/arm/helper.c | 21 | +++ b/target/arm/helper.c |
19 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | 22 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
20 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, | 23 | if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV) |
21 | .access = PL2_RW, | 24 | && tbid |
22 | .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, | 25 | && !(env->pstate & PSTATE_TCO) |
23 | + { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH, | 26 | - && (sctlr & SCTLR_TCF0) |
24 | + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, | 27 | + && (sctlr & SCTLR_TCF) |
25 | + .access = PL2_RW, | 28 | && allocation_tag_access_enabled(env, 0, sctlr)) { |
26 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 29 | flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1); |
27 | { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH, | 30 | } |
28 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2, | ||
29 | .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
30 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
31 | .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 1, | ||
32 | .access = PL2_RW, | ||
33 | .fieldoffset = offsetof(CPUARMState, elr_el[2]) }, | ||
34 | - { .name = "ESR_EL2", .state = ARM_CP_STATE_AA64, | ||
35 | + { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH, | ||
36 | .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, | ||
37 | .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.esr_el[2]) }, | ||
38 | { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH, | ||
39 | -- | 31 | -- |
40 | 2.18.0 | 32 | 2.20.1 |
41 | 33 | ||
42 | 34 | diff view generated by jsdifflib |
1 | The PL08x model currently will unconditionally call hw_error() | 1 | The CCR is a register most of whose bits are banked between security |
---|---|---|---|
2 | if the DMA engine is enabled by the guest. This has been | 2 | states but where BFHFNMIGN is not, and we keep it in the non-secure |
3 | present since the PL080 model was edded in 2006, and is | 3 | entry of the v7m.ccr[] array. The logic which tries to handle this |
4 | presumably either unintentional debug code left enabled, | 4 | bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS |
5 | or a guard against untested DMA engine code being used. | 5 | is zero" requirement; correct the omission. |
6 | |||
7 | Remove the hw_error(), since we now have a guest which | ||
8 | will actually try to use the DMA engine (the self-test | ||
9 | binary for the AN505 MPS2 FPGA image). | ||
10 | 6 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201210201433.26262-2-peter.maydell@linaro.org | ||
13 | --- | 10 | --- |
14 | hw/dma/pl080.c | 1 - | 11 | hw/intc/armv7m_nvic.c | 15 +++++++++++++++ |
15 | 1 file changed, 1 deletion(-) | 12 | 1 file changed, 15 insertions(+) |
16 | 13 | ||
17 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | 14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/dma/pl080.c | 16 | --- a/hw/intc/armv7m_nvic.c |
20 | +++ b/hw/dma/pl080.c | 17 | +++ b/hw/intc/armv7m_nvic.c |
21 | @@ -XXX,XX +XXX,XX @@ static void pl080_run(PL080State *s) | 18 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) |
22 | if ((s->conf & PL080_CONF_E) == 0) | 19 | */ |
23 | return; | 20 | val = cpu->env.v7m.ccr[attrs.secure]; |
24 | 21 | val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK; | |
25 | -hw_error("DMA active\n"); | 22 | + /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */ |
26 | /* If we are already in the middle of a DMA operation then indicate that | 23 | + if (!attrs.secure) { |
27 | there may be new DMA requests and return immediately. */ | 24 | + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { |
28 | if (s->running) { | 25 | + val &= ~R_V7M_CCR_BFHFNMIGN_MASK; |
26 | + } | ||
27 | + } | ||
28 | return val; | ||
29 | case 0xd24: /* System Handler Control and State (SHCSR) */ | ||
30 | if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) { | ||
31 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
32 | (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | ||
33 | | (value & R_V7M_CCR_BFHFNMIGN_MASK); | ||
34 | value &= ~R_V7M_CCR_BFHFNMIGN_MASK; | ||
35 | + } else { | ||
36 | + /* | ||
37 | + * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so | ||
38 | + * preserve the state currently in the NS element of the array | ||
39 | + */ | ||
40 | + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { | ||
41 | + value &= ~R_V7M_CCR_BFHFNMIGN_MASK; | ||
42 | + value |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK; | ||
43 | + } | ||
44 | } | ||
45 | |||
46 | cpu->env.v7m.ccr[attrs.secure] = value; | ||
29 | -- | 47 | -- |
30 | 2.18.0 | 48 | 2.20.1 |
31 | 49 | ||
32 | 50 | diff view generated by jsdifflib |
1 | The mmio_interface device was a purely internal artifact | 1 | In commit 64f863baeedc8659 we implemented the v8.1M FPCXT_S register, |
---|---|---|---|
2 | of the implementation of the memory subsystem's request_ptr | 2 | but we got the write behaviour wrong. On read, this register reads |
3 | APIs. Now that we have removed those APIs, we can remove | 3 | bits [27:0] of FPSCR plus the CONTROL.SFPA bit. On write, it doesn't |
4 | the mmio_interface device too. | 4 | just write back those bits -- it writes a value to the whole FPSCR, |
5 | whose upper 4 bits are zeroes. | ||
6 | |||
7 | We also incorrectly implemented the write-to-FPSCR as a simple store | ||
8 | to vfp.xregs; this skips the "update the softfloat flags" part of | ||
9 | the vfp_set_fpscr helper so the value would read back correctly but | ||
10 | not actually take effect. | ||
11 | |||
12 | Fix both of these things by doing a complete write to the FPSCR | ||
13 | using the helper function. | ||
5 | 14 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 17 | Message-id: 20201210201433.26262-3-peter.maydell@linaro.org |
9 | Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com> | ||
10 | Message-id: 20180817114619.22354-4-peter.maydell@linaro.org | ||
11 | --- | 18 | --- |
12 | hw/misc/Makefile.objs | 1 - | 19 | target/arm/translate-vfp.c.inc | 12 ++++++------ |
13 | include/hw/misc/mmio_interface.h | 49 ----------- | 20 | 1 file changed, 6 insertions(+), 6 deletions(-) |
14 | hw/misc/mmio_interface.c | 135 ------------------------------- | ||
15 | 3 files changed, 185 deletions(-) | ||
16 | delete mode 100644 include/hw/misc/mmio_interface.h | ||
17 | delete mode 100644 hw/misc/mmio_interface.c | ||
18 | 21 | ||
19 | diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs | 22 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc |
20 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/misc/Makefile.objs | 24 | --- a/target/arm/translate-vfp.c.inc |
22 | +++ b/hw/misc/Makefile.objs | 25 | +++ b/target/arm/translate-vfp.c.inc |
23 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_PVPANIC) += pvpanic.o | 26 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, |
24 | obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o | 27 | } |
25 | obj-$(CONFIG_AUX) += auxbus.o | 28 | case ARM_VFP_FPCXT_S: |
26 | obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o | 29 | { |
27 | -obj-y += mmio_interface.o | 30 | - TCGv_i32 sfpa, control, fpscr; |
28 | obj-$(CONFIG_MSF2) += msf2-sysreg.o | 31 | - /* Set FPSCR[27:0] and CONTROL.SFPA from value */ |
29 | diff --git a/include/hw/misc/mmio_interface.h b/include/hw/misc/mmio_interface.h | 32 | + TCGv_i32 sfpa, control; |
30 | deleted file mode 100644 | 33 | + /* |
31 | index XXXXXXX..XXXXXXX | 34 | + * Set FPSCR and CONTROL.SFPA from value; the new FPSCR takes |
32 | --- a/include/hw/misc/mmio_interface.h | 35 | + * bits [27:0] from value and zeroes bits [31:28]. |
33 | +++ /dev/null | 36 | + */ |
34 | @@ -XXX,XX +XXX,XX @@ | 37 | tmp = loadfn(s, opaque); |
35 | -/* | 38 | sfpa = tcg_temp_new_i32(); |
36 | - * mmio_interface.h | 39 | tcg_gen_shri_i32(sfpa, tmp, 31); |
37 | - * | 40 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, |
38 | - * Copyright (C) 2017 : GreenSocs | 41 | tcg_gen_deposit_i32(control, control, sfpa, |
39 | - * http://www.greensocs.com/ , email: info@greensocs.com | 42 | R_V7M_CONTROL_SFPA_SHIFT, 1); |
40 | - * | 43 | store_cpu_field(control, v7m.control[M_REG_S]); |
41 | - * Developed by : | 44 | - fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); |
42 | - * Frederic Konrad <fred.konrad@greensocs.com> | 45 | - tcg_gen_andi_i32(fpscr, fpscr, FPCR_NZCV_MASK); |
43 | - * | 46 | tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK); |
44 | - * This program is free software; you can redistribute it and/or modify | 47 | - tcg_gen_or_i32(fpscr, fpscr, tmp); |
45 | - * it under the terms of the GNU General Public License as published by | 48 | - store_cpu_field(fpscr, vfp.xregs[ARM_VFP_FPSCR]); |
46 | - * the Free Software Foundation, either version 2 of the License, or | 49 | + gen_helper_vfp_set_fpscr(cpu_env, tmp); |
47 | - * (at your option)any later version. | 50 | tcg_temp_free_i32(tmp); |
48 | - * | 51 | tcg_temp_free_i32(sfpa); |
49 | - * This program is distributed in the hope that it will be useful, | 52 | break; |
50 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
51 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
52 | - * GNU General Public License for more details. | ||
53 | - * | ||
54 | - * You should have received a copy of the GNU General Public License along | ||
55 | - * with this program; if not, see <http://www.gnu.org/licenses/>. | ||
56 | - * | ||
57 | - */ | ||
58 | - | ||
59 | -#ifndef MMIO_INTERFACE_H | ||
60 | -#define MMIO_INTERFACE_H | ||
61 | - | ||
62 | -#include "exec/memory.h" | ||
63 | - | ||
64 | -#define TYPE_MMIO_INTERFACE "mmio_interface" | ||
65 | -#define MMIO_INTERFACE(obj) OBJECT_CHECK(MMIOInterface, (obj), \ | ||
66 | - TYPE_MMIO_INTERFACE) | ||
67 | - | ||
68 | -typedef struct MMIOInterface { | ||
69 | - DeviceState parent_obj; | ||
70 | - | ||
71 | - MemoryRegion *subregion; | ||
72 | - MemoryRegion ram_mem; | ||
73 | - uint64_t start; | ||
74 | - uint64_t end; | ||
75 | - bool ro; | ||
76 | - uint64_t id; | ||
77 | - void *host_ptr; | ||
78 | -} MMIOInterface; | ||
79 | - | ||
80 | -void mmio_interface_map(MMIOInterface *s); | ||
81 | -void mmio_interface_unmap(MMIOInterface *s); | ||
82 | - | ||
83 | -#endif /* MMIO_INTERFACE_H */ | ||
84 | diff --git a/hw/misc/mmio_interface.c b/hw/misc/mmio_interface.c | ||
85 | deleted file mode 100644 | ||
86 | index XXXXXXX..XXXXXXX | ||
87 | --- a/hw/misc/mmio_interface.c | ||
88 | +++ /dev/null | ||
89 | @@ -XXX,XX +XXX,XX @@ | ||
90 | -/* | ||
91 | - * mmio_interface.c | ||
92 | - * | ||
93 | - * Copyright (C) 2017 : GreenSocs | ||
94 | - * http://www.greensocs.com/ , email: info@greensocs.com | ||
95 | - * | ||
96 | - * Developed by : | ||
97 | - * Frederic Konrad <fred.konrad@greensocs.com> | ||
98 | - * | ||
99 | - * This program is free software; you can redistribute it and/or modify | ||
100 | - * it under the terms of the GNU General Public License as published by | ||
101 | - * the Free Software Foundation, either version 2 of the License, or | ||
102 | - * (at your option)any later version. | ||
103 | - * | ||
104 | - * This program is distributed in the hope that it will be useful, | ||
105 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
106 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
107 | - * GNU General Public License for more details. | ||
108 | - * | ||
109 | - * You should have received a copy of the GNU General Public License along | ||
110 | - * with this program; if not, see <http://www.gnu.org/licenses/>. | ||
111 | - * | ||
112 | - */ | ||
113 | - | ||
114 | -#include "qemu/osdep.h" | ||
115 | -#include "qemu/log.h" | ||
116 | -#include "trace.h" | ||
117 | -#include "hw/qdev-properties.h" | ||
118 | -#include "hw/misc/mmio_interface.h" | ||
119 | -#include "qapi/error.h" | ||
120 | - | ||
121 | -#ifndef DEBUG_MMIO_INTERFACE | ||
122 | -#define DEBUG_MMIO_INTERFACE 0 | ||
123 | -#endif | ||
124 | - | ||
125 | -static uint64_t mmio_interface_counter; | ||
126 | - | ||
127 | -#define DPRINTF(fmt, ...) do { \ | ||
128 | - if (DEBUG_MMIO_INTERFACE) { \ | ||
129 | - qemu_log("mmio_interface: 0x%" PRIX64 ": " fmt, s->id, ## __VA_ARGS__);\ | ||
130 | - } \ | ||
131 | -} while (0) | ||
132 | - | ||
133 | -static void mmio_interface_init(Object *obj) | ||
134 | -{ | ||
135 | - MMIOInterface *s = MMIO_INTERFACE(obj); | ||
136 | - | ||
137 | - if (DEBUG_MMIO_INTERFACE) { | ||
138 | - s->id = mmio_interface_counter++; | ||
139 | - } | ||
140 | - | ||
141 | - DPRINTF("interface created\n"); | ||
142 | - s->host_ptr = 0; | ||
143 | - s->subregion = 0; | ||
144 | -} | ||
145 | - | ||
146 | -static void mmio_interface_realize(DeviceState *dev, Error **errp) | ||
147 | -{ | ||
148 | - MMIOInterface *s = MMIO_INTERFACE(dev); | ||
149 | - | ||
150 | - DPRINTF("realize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer" | ||
151 | - " %p\n", s->start, s->end, s->host_ptr); | ||
152 | - | ||
153 | - if (!s->host_ptr) { | ||
154 | - error_setg(errp, "host_ptr property must be set"); | ||
155 | - return; | ||
156 | - } | ||
157 | - | ||
158 | - if (!s->subregion) { | ||
159 | - error_setg(errp, "subregion property must be set"); | ||
160 | - return; | ||
161 | - } | ||
162 | - | ||
163 | - memory_region_init_ram_ptr(&s->ram_mem, OBJECT(s), "ram", | ||
164 | - s->end - s->start + 1, s->host_ptr); | ||
165 | - memory_region_set_readonly(&s->ram_mem, s->ro); | ||
166 | - memory_region_add_subregion(s->subregion, s->start, &s->ram_mem); | ||
167 | -} | ||
168 | - | ||
169 | -static void mmio_interface_unrealize(DeviceState *dev, Error **errp) | ||
170 | -{ | ||
171 | - MMIOInterface *s = MMIO_INTERFACE(dev); | ||
172 | - | ||
173 | - DPRINTF("unrealize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer" | ||
174 | - " %p\n", s->start, s->end, s->host_ptr); | ||
175 | - memory_region_del_subregion(s->subregion, &s->ram_mem); | ||
176 | -} | ||
177 | - | ||
178 | -static void mmio_interface_finalize(Object *obj) | ||
179 | -{ | ||
180 | - MMIOInterface *s = MMIO_INTERFACE(obj); | ||
181 | - | ||
182 | - DPRINTF("finalize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer" | ||
183 | - " %p\n", s->start, s->end, s->host_ptr); | ||
184 | - object_unparent(OBJECT(&s->ram_mem)); | ||
185 | -} | ||
186 | - | ||
187 | -static Property mmio_interface_properties[] = { | ||
188 | - DEFINE_PROP_UINT64("start", MMIOInterface, start, 0), | ||
189 | - DEFINE_PROP_UINT64("end", MMIOInterface, end, 0), | ||
190 | - DEFINE_PROP_PTR("host_ptr", MMIOInterface, host_ptr), | ||
191 | - DEFINE_PROP_BOOL("ro", MMIOInterface, ro, false), | ||
192 | - DEFINE_PROP_MEMORY_REGION("subregion", MMIOInterface, subregion), | ||
193 | - DEFINE_PROP_END_OF_LIST(), | ||
194 | -}; | ||
195 | - | ||
196 | -static void mmio_interface_class_init(ObjectClass *oc, void *data) | ||
197 | -{ | ||
198 | - DeviceClass *dc = DEVICE_CLASS(oc); | ||
199 | - | ||
200 | - dc->realize = mmio_interface_realize; | ||
201 | - dc->unrealize = mmio_interface_unrealize; | ||
202 | - dc->props = mmio_interface_properties; | ||
203 | - /* Reason: pointer property "host_ptr", and this device | ||
204 | - * is an implementation detail of the memory subsystem, | ||
205 | - * not intended to be created directly by the user. | ||
206 | - */ | ||
207 | - dc->user_creatable = false; | ||
208 | -} | ||
209 | - | ||
210 | -static const TypeInfo mmio_interface_info = { | ||
211 | - .name = TYPE_MMIO_INTERFACE, | ||
212 | - .parent = TYPE_DEVICE, | ||
213 | - .instance_size = sizeof(MMIOInterface), | ||
214 | - .instance_init = mmio_interface_init, | ||
215 | - .instance_finalize = mmio_interface_finalize, | ||
216 | - .class_init = mmio_interface_class_init, | ||
217 | -}; | ||
218 | - | ||
219 | -static void mmio_interface_register_types(void) | ||
220 | -{ | ||
221 | - type_register_static(&mmio_interface_info); | ||
222 | -} | ||
223 | - | ||
224 | -type_init(mmio_interface_register_types) | ||
225 | -- | 53 | -- |
226 | 2.18.0 | 54 | 2.20.1 |
227 | 55 | ||
228 | 56 | diff view generated by jsdifflib |
1 | Currently our PL080/PL081 model uses a combination of the CPU's | 1 | Implement the v8.1M FPCXT_NS floating-point system register. This is |
---|---|---|---|
2 | address space (via cpu_physical_memory_{read,write}()) and the | 2 | a little more complicated than FPCXT_S, because it has specific |
3 | system address space for performing DMA accesses. | 3 | handling for "current FP state is inactive", and it only wants to do |
4 | 4 | PreserveFPState(), not the full set of actions done by | |
5 | For the PL081s in the MPS FPGA images, their DMA accesses | 5 | ExecuteFPCheck() which vfp_access_check() implements. |
6 | must go via Master Security Controllers. Switch the | ||
7 | PL080/PL081 model to take a MemoryRegion property which | ||
8 | defines its downstream for making DMA accesses. | ||
9 | |||
10 | Since the PL08x are only used in two board models, we | ||
11 | make provision of the 'downstream' link mandatory and convert | ||
12 | both users at once, rather than having it be optional with | ||
13 | a default to the system address space. | ||
14 | 6 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201210201433.26262-4-peter.maydell@linaro.org | ||
17 | --- | 10 | --- |
18 | include/hw/dma/pl080.h | 5 +++++ | 11 | target/arm/translate-vfp.c.inc | 102 ++++++++++++++++++++++++++++++++- |
19 | hw/arm/realview.c | 8 +++++++- | 12 | 1 file changed, 99 insertions(+), 3 deletions(-) |
20 | hw/arm/versatilepb.c | 9 ++++++++- | ||
21 | hw/dma/pl080.c | 35 +++++++++++++++++++++++++++++------ | ||
22 | 4 files changed, 49 insertions(+), 8 deletions(-) | ||
23 | 13 | ||
24 | diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h | 14 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc |
25 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/dma/pl080.h | 16 | --- a/target/arm/translate-vfp.c.inc |
27 | +++ b/include/hw/dma/pl080.h | 17 | +++ b/target/arm/translate-vfp.c.inc |
28 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno) |
29 | * + sysbus IRQ 1: DMACINTERR error interrupt request | 19 | } |
30 | * + sysbus IRQ 2: DMACINTTC count interrupt request | 20 | break; |
31 | * + sysbus MMIO region 0: MemoryRegion for the device's registers | 21 | case ARM_VFP_FPCXT_S: |
32 | + * + QOM property "downstream": MemoryRegion defining where DMA | 22 | + case ARM_VFP_FPCXT_NS: |
33 | + * bus master transactions are made | 23 | if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { |
34 | */ | 24 | return false; |
35 | 25 | } | |
36 | #ifndef HW_DMA_PL080_H | 26 | @@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno) |
37 | @@ -XXX,XX +XXX,XX @@ typedef struct PL080State { | 27 | return FPSysRegCheckFailed; |
38 | qemu_irq irq; | 28 | } |
39 | qemu_irq interr; | 29 | |
40 | qemu_irq inttc; | 30 | - if (!vfp_access_check(s)) { |
31 | + /* | ||
32 | + * FPCXT_NS is a special case: it has specific handling for | ||
33 | + * "current FP state is inactive", and must do the PreserveFPState() | ||
34 | + * but not the usual full set of actions done by ExecuteFPCheck(). | ||
35 | + * So we don't call vfp_access_check() and the callers must handle this. | ||
36 | + */ | ||
37 | + if (regno != ARM_VFP_FPCXT_NS && !vfp_access_check(s)) { | ||
38 | return FPSysRegCheckDone; | ||
39 | } | ||
40 | - | ||
41 | return FPSysRegCheckContinue; | ||
42 | } | ||
43 | |||
44 | +static void gen_branch_fpInactive(DisasContext *s, TCGCond cond, | ||
45 | + TCGLabel *label) | ||
46 | +{ | ||
47 | + /* | ||
48 | + * FPCXT_NS is a special case: it has specific handling for | ||
49 | + * "current FP state is inactive", and must do the PreserveFPState() | ||
50 | + * but not the usual full set of actions done by ExecuteFPCheck(). | ||
51 | + * We don't have a TB flag that matches the fpInactive check, so we | ||
52 | + * do it at runtime as we don't expect FPCXT_NS accesses to be frequent. | ||
53 | + * | ||
54 | + * Emit code that checks fpInactive and does a conditional | ||
55 | + * branch to label based on it: | ||
56 | + * if cond is TCG_COND_NE then branch if fpInactive != 0 (ie if inactive) | ||
57 | + * if cond is TCG_COND_EQ then branch if fpInactive == 0 (ie if active) | ||
58 | + */ | ||
59 | + assert(cond == TCG_COND_EQ || cond == TCG_COND_NE); | ||
41 | + | 60 | + |
42 | + MemoryRegion *downstream; | 61 | + /* fpInactive = FPCCR_NS.ASPEN == 1 && CONTROL.FPCA == 0 */ |
43 | + AddressSpace downstream_as; | 62 | + TCGv_i32 aspen, fpca; |
44 | } PL080State; | 63 | + aspen = load_cpu_field(v7m.fpccr[M_REG_NS]); |
45 | 64 | + fpca = load_cpu_field(v7m.control[M_REG_S]); | |
46 | #endif | 65 | + tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); |
47 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | 66 | + tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); |
48 | index XXXXXXX..XXXXXXX 100644 | 67 | + tcg_gen_andi_i32(fpca, fpca, R_V7M_CONTROL_FPCA_MASK); |
49 | --- a/hw/arm/realview.c | 68 | + tcg_gen_or_i32(fpca, fpca, aspen); |
50 | +++ b/hw/arm/realview.c | 69 | + tcg_gen_brcondi_i32(tcg_invert_cond(cond), fpca, 0, label); |
51 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, | 70 | + tcg_temp_free_i32(aspen); |
52 | pl011_create(0x1000c000, pic[15], serial_hd(3)); | 71 | + tcg_temp_free_i32(fpca); |
53 | |||
54 | /* DMA controller is optional, apparently. */ | ||
55 | - sysbus_create_simple("pl081", 0x10030000, pic[24]); | ||
56 | + dev = qdev_create(NULL, "pl081"); | ||
57 | + object_property_set_link(OBJECT(dev), OBJECT(sysmem), "downstream", | ||
58 | + &error_fatal); | ||
59 | + qdev_init_nofail(dev); | ||
60 | + busdev = SYS_BUS_DEVICE(dev); | ||
61 | + sysbus_mmio_map(busdev, 0, 0x10030000); | ||
62 | + sysbus_connect_irq(busdev, 0, pic[24]); | ||
63 | |||
64 | sysbus_create_simple("sp804", 0x10011000, pic[4]); | ||
65 | sysbus_create_simple("sp804", 0x10012000, pic[5]); | ||
66 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/hw/arm/versatilepb.c | ||
69 | +++ b/hw/arm/versatilepb.c | ||
70 | @@ -XXX,XX +XXX,XX @@ static void versatile_init(MachineState *machine, int board_id) | ||
71 | pl011_create(0x101f3000, pic[14], serial_hd(2)); | ||
72 | pl011_create(0x10009000, sic[6], serial_hd(3)); | ||
73 | |||
74 | - sysbus_create_simple("pl080", 0x10130000, pic[17]); | ||
75 | + dev = qdev_create(NULL, "pl080"); | ||
76 | + object_property_set_link(OBJECT(dev), OBJECT(sysmem), "downstream", | ||
77 | + &error_fatal); | ||
78 | + qdev_init_nofail(dev); | ||
79 | + busdev = SYS_BUS_DEVICE(dev); | ||
80 | + sysbus_mmio_map(busdev, 0, 0x10130000); | ||
81 | + sysbus_connect_irq(busdev, 0, pic[17]); | ||
82 | + | ||
83 | sysbus_create_simple("sp804", 0x101e2000, pic[4]); | ||
84 | sysbus_create_simple("sp804", 0x101e3000, pic[5]); | ||
85 | |||
86 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/dma/pl080.c | ||
89 | +++ b/hw/dma/pl080.c | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | #include "exec/address-spaces.h" | ||
92 | #include "qemu/log.h" | ||
93 | #include "hw/dma/pl080.h" | ||
94 | +#include "qapi/error.h" | ||
95 | |||
96 | #define PL080_CONF_E 0x1 | ||
97 | #define PL080_CONF_M1 0x2 | ||
98 | @@ -XXX,XX +XXX,XX @@ again: | ||
99 | swidth = 1 << ((ch->ctrl >> 18) & 7); | ||
100 | dwidth = 1 << ((ch->ctrl >> 21) & 7); | ||
101 | for (n = 0; n < dwidth; n+= swidth) { | ||
102 | - cpu_physical_memory_read(ch->src, buff + n, swidth); | ||
103 | + address_space_read(&s->downstream_as, ch->src, | ||
104 | + MEMTXATTRS_UNSPECIFIED, buff + n, swidth); | ||
105 | if (ch->ctrl & PL080_CCTRL_SI) | ||
106 | ch->src += swidth; | ||
107 | } | ||
108 | xsize = (dwidth < swidth) ? swidth : dwidth; | ||
109 | /* ??? This may pad the value incorrectly for dwidth < 32. */ | ||
110 | for (n = 0; n < xsize; n += dwidth) { | ||
111 | - cpu_physical_memory_write(ch->dest + n, buff + n, dwidth); | ||
112 | + address_space_write(&s->downstream_as, ch->dest + n, | ||
113 | + MEMTXATTRS_UNSPECIFIED, buff + n, dwidth); | ||
114 | if (ch->ctrl & PL080_CCTRL_DI) | ||
115 | ch->dest += swidth; | ||
116 | } | ||
117 | @@ -XXX,XX +XXX,XX @@ again: | ||
118 | if (size == 0) { | ||
119 | /* Transfer complete. */ | ||
120 | if (ch->lli) { | ||
121 | - ch->src = address_space_ldl_le(&address_space_memory, | ||
122 | + ch->src = address_space_ldl_le(&s->downstream_as, | ||
123 | ch->lli, | ||
124 | MEMTXATTRS_UNSPECIFIED, | ||
125 | NULL); | ||
126 | - ch->dest = address_space_ldl_le(&address_space_memory, | ||
127 | + ch->dest = address_space_ldl_le(&s->downstream_as, | ||
128 | ch->lli + 4, | ||
129 | MEMTXATTRS_UNSPECIFIED, | ||
130 | NULL); | ||
131 | - ch->ctrl = address_space_ldl_le(&address_space_memory, | ||
132 | + ch->ctrl = address_space_ldl_le(&s->downstream_as, | ||
133 | ch->lli + 12, | ||
134 | MEMTXATTRS_UNSPECIFIED, | ||
135 | NULL); | ||
136 | - ch->lli = address_space_ldl_le(&address_space_memory, | ||
137 | + ch->lli = address_space_ldl_le(&s->downstream_as, | ||
138 | ch->lli + 8, | ||
139 | MEMTXATTRS_UNSPECIFIED, | ||
140 | NULL); | ||
141 | @@ -XXX,XX +XXX,XX @@ static void pl080_init(Object *obj) | ||
142 | s->nchannels = 8; | ||
143 | } | ||
144 | |||
145 | +static void pl080_realize(DeviceState *dev, Error **errp) | ||
146 | +{ | ||
147 | + PL080State *s = PL080(dev); | ||
148 | + | ||
149 | + if (!s->downstream) { | ||
150 | + error_setg(errp, "PL080 'downstream' link not set"); | ||
151 | + return; | ||
152 | + } | ||
153 | + | ||
154 | + address_space_init(&s->downstream_as, s->downstream, "pl080-downstream"); | ||
155 | +} | 72 | +} |
156 | + | 73 | + |
157 | static void pl081_init(Object *obj) | 74 | static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, |
75 | |||
76 | fp_sysreg_loadfn *loadfn, | ||
77 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | ||
158 | { | 78 | { |
159 | PL080State *s = PL080(obj); | 79 | /* Do a write to an M-profile floating point system register */ |
160 | @@ -XXX,XX +XXX,XX @@ static void pl081_init(Object *obj) | 80 | TCGv_i32 tmp; |
161 | s->nchannels = 2; | 81 | + TCGLabel *lab_end = NULL; |
82 | |||
83 | switch (fp_sysreg_checks(s, regno)) { | ||
84 | case FPSysRegCheckFailed: | ||
85 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | ||
86 | tcg_temp_free_i32(tmp); | ||
87 | break; | ||
88 | } | ||
89 | + case ARM_VFP_FPCXT_NS: | ||
90 | + lab_end = gen_new_label(); | ||
91 | + /* fpInactive case: write is a NOP, so branch to end */ | ||
92 | + gen_branch_fpInactive(s, TCG_COND_NE, lab_end); | ||
93 | + /* !fpInactive: PreserveFPState(), and reads same as FPCXT_S */ | ||
94 | + gen_preserve_fp_state(s); | ||
95 | + /* fall through */ | ||
96 | case ARM_VFP_FPCXT_S: | ||
97 | { | ||
98 | TCGv_i32 sfpa, control; | ||
99 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | ||
100 | default: | ||
101 | g_assert_not_reached(); | ||
102 | } | ||
103 | + if (lab_end) { | ||
104 | + gen_set_label(lab_end); | ||
105 | + } | ||
106 | return true; | ||
162 | } | 107 | } |
163 | 108 | ||
164 | +static Property pl080_properties[] = { | 109 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, |
165 | + DEFINE_PROP_LINK("downstream", PL080State, downstream, | 110 | { |
166 | + TYPE_MEMORY_REGION, MemoryRegion *), | 111 | /* Do a read from an M-profile floating point system register */ |
167 | + DEFINE_PROP_END_OF_LIST(), | 112 | TCGv_i32 tmp; |
168 | +}; | 113 | + TCGLabel *lab_end = NULL; |
114 | + bool lookup_tb = false; | ||
115 | |||
116 | switch (fp_sysreg_checks(s, regno)) { | ||
117 | case FPSysRegCheckFailed: | ||
118 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, | ||
119 | fpscr = load_cpu_field(v7m.fpdscr[M_REG_NS]); | ||
120 | gen_helper_vfp_set_fpscr(cpu_env, fpscr); | ||
121 | tcg_temp_free_i32(fpscr); | ||
122 | - gen_lookup_tb(s); | ||
123 | + lookup_tb = true; | ||
124 | + break; | ||
125 | + } | ||
126 | + case ARM_VFP_FPCXT_NS: | ||
127 | + { | ||
128 | + TCGv_i32 control, sfpa, fpscr, fpdscr, zero; | ||
129 | + TCGLabel *lab_active = gen_new_label(); | ||
169 | + | 130 | + |
170 | static void pl080_class_init(ObjectClass *oc, void *data) | 131 | + lookup_tb = true; |
171 | { | 132 | + |
172 | DeviceClass *dc = DEVICE_CLASS(oc); | 133 | + gen_branch_fpInactive(s, TCG_COND_EQ, lab_active); |
173 | 134 | + /* fpInactive case: reads as FPDSCR_NS */ | |
174 | dc->vmsd = &vmstate_pl080; | 135 | + TCGv_i32 tmp = load_cpu_field(v7m.fpdscr[M_REG_NS]); |
175 | + dc->realize = pl080_realize; | 136 | + storefn(s, opaque, tmp); |
176 | + dc->props = pl080_properties; | 137 | + lab_end = gen_new_label(); |
138 | + tcg_gen_br(lab_end); | ||
139 | + | ||
140 | + gen_set_label(lab_active); | ||
141 | + /* !fpInactive: Reads the same as FPCXT_S, but side effects differ */ | ||
142 | + gen_preserve_fp_state(s); | ||
143 | + tmp = tcg_temp_new_i32(); | ||
144 | + sfpa = tcg_temp_new_i32(); | ||
145 | + fpscr = tcg_temp_new_i32(); | ||
146 | + gen_helper_vfp_get_fpscr(fpscr, cpu_env); | ||
147 | + tcg_gen_andi_i32(tmp, fpscr, ~FPCR_NZCV_MASK); | ||
148 | + control = load_cpu_field(v7m.control[M_REG_S]); | ||
149 | + tcg_gen_andi_i32(sfpa, control, R_V7M_CONTROL_SFPA_MASK); | ||
150 | + tcg_gen_shli_i32(sfpa, sfpa, 31 - R_V7M_CONTROL_SFPA_SHIFT); | ||
151 | + tcg_gen_or_i32(tmp, tmp, sfpa); | ||
152 | + tcg_temp_free_i32(control); | ||
153 | + /* Store result before updating FPSCR, in case it faults */ | ||
154 | + storefn(s, opaque, tmp); | ||
155 | + /* If SFPA is zero then set FPSCR from FPDSCR_NS */ | ||
156 | + fpdscr = load_cpu_field(v7m.fpdscr[M_REG_NS]); | ||
157 | + zero = tcg_const_i32(0); | ||
158 | + tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr); | ||
159 | + gen_helper_vfp_set_fpscr(cpu_env, fpscr); | ||
160 | + tcg_temp_free_i32(zero); | ||
161 | + tcg_temp_free_i32(sfpa); | ||
162 | + tcg_temp_free_i32(fpdscr); | ||
163 | + tcg_temp_free_i32(fpscr); | ||
164 | break; | ||
165 | } | ||
166 | default: | ||
167 | g_assert_not_reached(); | ||
168 | } | ||
169 | + | ||
170 | + if (lab_end) { | ||
171 | + gen_set_label(lab_end); | ||
172 | + } | ||
173 | + if (lookup_tb) { | ||
174 | + gen_lookup_tb(s); | ||
175 | + } | ||
176 | return true; | ||
177 | } | 177 | } |
178 | 178 | ||
179 | static const TypeInfo pl080_info = { | ||
180 | -- | 179 | -- |
181 | 2.18.0 | 180 | 2.20.1 |
182 | 181 | ||
183 | 182 | diff view generated by jsdifflib |
1 | We now support direct execution from MMIO regions in the | 1 | Now that we have implemented all the features needed by the v8.1M |
---|---|---|---|
2 | core memory subsystem. This means that we don't need to | 2 | architecture, we can add the model of the Cortex-M55. This is the |
3 | have device-specific support for it, and we can remove | 3 | configuration without MVE support; we'll add MVE later. |
4 | the request_ptr handling from the Xilinx SPIPS device. | ||
5 | (It was broken anyway due to race conditions, and disabled | ||
6 | by default.) | ||
7 | |||
8 | This device is the only in-tree user of this API. | ||
9 | 4 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Message-id: 20201210201433.26262-5-peter.maydell@linaro.org |
13 | Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com> | ||
14 | Message-id: 20180817114619.22354-2-peter.maydell@linaro.org | ||
15 | --- | 8 | --- |
16 | hw/ssi/xilinx_spips.c | 46 ------------------------------------------- | 9 | target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++ |
17 | 1 file changed, 46 deletions(-) | 10 | 1 file changed, 42 insertions(+) |
18 | 11 | ||
19 | diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c | 12 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/ssi/xilinx_spips.c | 14 | --- a/target/arm/cpu_tcg.c |
22 | +++ b/hw/ssi/xilinx_spips.c | 15 | +++ b/target/arm/cpu_tcg.c |
23 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps spips_ops = { | 16 | @@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj) |
24 | 17 | cpu->ctr = 0x8000c000; | |
25 | static void xilinx_qspips_invalidate_mmio_ptr(XilinxQSPIPS *q) | ||
26 | { | ||
27 | - XilinxSPIPS *s = &q->parent_obj; | ||
28 | - | ||
29 | - if ((q->mmio_execution_enabled) && (q->lqspi_cached_addr != ~0ULL)) { | ||
30 | - /* Invalidate the current mapped mmio */ | ||
31 | - memory_region_invalidate_mmio_ptr(&s->mmlqspi, q->lqspi_cached_addr, | ||
32 | - LQSPI_CACHE_SIZE); | ||
33 | - } | ||
34 | - | ||
35 | q->lqspi_cached_addr = ~0ULL; | ||
36 | } | 18 | } |
37 | 19 | ||
38 | @@ -XXX,XX +XXX,XX @@ static void lqspi_load_cache(void *opaque, hwaddr addr) | 20 | +static void cortex_m55_initfn(Object *obj) |
39 | } | 21 | +{ |
40 | } | 22 | + ARMCPU *cpu = ARM_CPU(obj); |
41 | 23 | + | |
42 | -static void *lqspi_request_mmio_ptr(void *opaque, hwaddr addr, unsigned *size, | 24 | + set_feature(&cpu->env, ARM_FEATURE_V8); |
43 | - unsigned *offset) | 25 | + set_feature(&cpu->env, ARM_FEATURE_V8_1M); |
44 | -{ | 26 | + set_feature(&cpu->env, ARM_FEATURE_M); |
45 | - XilinxQSPIPS *q = opaque; | 27 | + set_feature(&cpu->env, ARM_FEATURE_M_MAIN); |
46 | - hwaddr offset_within_the_region; | 28 | + set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); |
47 | - | 29 | + set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); |
48 | - if (!q->mmio_execution_enabled) { | 30 | + cpu->midr = 0x410fd221; /* r0p1 */ |
49 | - return NULL; | 31 | + cpu->revidr = 0; |
50 | - } | 32 | + cpu->pmsav7_dregion = 16; |
51 | - | 33 | + cpu->sau_sregion = 8; |
52 | - offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1); | 34 | + /* |
53 | - lqspi_load_cache(opaque, offset_within_the_region); | 35 | + * These are the MVFR* values for the FPU, no MVE configuration; |
54 | - *size = LQSPI_CACHE_SIZE; | 36 | + * we will update them later when we implement MVE |
55 | - *offset = offset_within_the_region; | 37 | + */ |
56 | - return q->lqspi_buf; | 38 | + cpu->isar.mvfr0 = 0x10110221; |
57 | -} | 39 | + cpu->isar.mvfr1 = 0x12100011; |
58 | - | 40 | + cpu->isar.mvfr2 = 0x00000040; |
59 | static uint64_t | 41 | + cpu->isar.id_pfr0 = 0x20000030; |
60 | lqspi_read(void *opaque, hwaddr addr, unsigned int size) | 42 | + cpu->isar.id_pfr1 = 0x00000230; |
61 | { | 43 | + cpu->isar.id_dfr0 = 0x10200000; |
62 | @@ -XXX,XX +XXX,XX @@ lqspi_read(void *opaque, hwaddr addr, unsigned int size) | 44 | + cpu->id_afr0 = 0x00000000; |
63 | 45 | + cpu->isar.id_mmfr0 = 0x00111040; | |
64 | static const MemoryRegionOps lqspi_ops = { | 46 | + cpu->isar.id_mmfr1 = 0x00000000; |
65 | .read = lqspi_read, | 47 | + cpu->isar.id_mmfr2 = 0x01000000; |
66 | - .request_ptr = lqspi_request_mmio_ptr, | 48 | + cpu->isar.id_mmfr3 = 0x00000011; |
67 | .endianness = DEVICE_NATIVE_ENDIAN, | 49 | + cpu->isar.id_isar0 = 0x01103110; |
68 | .valid = { | 50 | + cpu->isar.id_isar1 = 0x02212000; |
69 | .min_access_size = 1, | 51 | + cpu->isar.id_isar2 = 0x20232232; |
70 | @@ -XXX,XX +XXX,XX @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp) | 52 | + cpu->isar.id_isar3 = 0x01111131; |
71 | sysbus_init_mmio(sbd, &s->mmlqspi); | 53 | + cpu->isar.id_isar4 = 0x01310132; |
72 | 54 | + cpu->isar.id_isar5 = 0x00000000; | |
73 | q->lqspi_cached_addr = ~0ULL; | 55 | + cpu->isar.id_isar6 = 0x00000000; |
74 | - | 56 | + cpu->clidr = 0x00000000; /* caches not implemented */ |
75 | - /* mmio_execution breaks migration better aborting than having strange | 57 | + cpu->ctr = 0x8303c003; |
76 | - * bugs. | 58 | +} |
77 | - */ | 59 | + |
78 | - if (q->mmio_execution_enabled) { | 60 | static const ARMCPRegInfo cortexr5_cp_reginfo[] = { |
79 | - error_setg(&q->migration_blocker, | 61 | /* Dummy the TCM region regs for the moment */ |
80 | - "enabling mmio_execution breaks migration"); | 62 | { .name = "ATCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0, |
81 | - migrate_add_blocker(q->migration_blocker, &error_fatal); | 63 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = { |
82 | - } | 64 | .class_init = arm_v7m_class_init }, |
83 | } | 65 | { .name = "cortex-m33", .initfn = cortex_m33_initfn, |
84 | 66 | .class_init = arm_v7m_class_init }, | |
85 | static void xlnx_zynqmp_qspips_realize(DeviceState *dev, Error **errp) | 67 | + { .name = "cortex-m55", .initfn = cortex_m55_initfn, |
86 | @@ -XXX,XX +XXX,XX @@ static Property xilinx_zynqmp_qspips_properties[] = { | 68 | + .class_init = arm_v7m_class_init }, |
87 | DEFINE_PROP_END_OF_LIST(), | 69 | { .name = "cortex-r5", .initfn = cortex_r5_initfn }, |
88 | }; | 70 | { .name = "cortex-r5f", .initfn = cortex_r5f_initfn }, |
89 | 71 | { .name = "ti925t", .initfn = ti925t_initfn }, | |
90 | -static Property xilinx_qspips_properties[] = { | ||
91 | - /* We had to turn this off for 2.10 as it is not compatible with migration. | ||
92 | - * It can be enabled but will prevent the device to be migrated. | ||
93 | - * This will go aways when a fix will be released. | ||
94 | - */ | ||
95 | - DEFINE_PROP_BOOL("x-mmio-exec", XilinxQSPIPS, mmio_execution_enabled, | ||
96 | - false), | ||
97 | - DEFINE_PROP_END_OF_LIST(), | ||
98 | -}; | ||
99 | - | ||
100 | static Property xilinx_spips_properties[] = { | ||
101 | DEFINE_PROP_UINT8("num-busses", XilinxSPIPS, num_busses, 1), | ||
102 | DEFINE_PROP_UINT8("num-ss-bits", XilinxSPIPS, num_cs, 4), | ||
103 | @@ -XXX,XX +XXX,XX @@ static void xilinx_qspips_class_init(ObjectClass *klass, void * data) | ||
104 | XilinxSPIPSClass *xsc = XILINX_SPIPS_CLASS(klass); | ||
105 | |||
106 | dc->realize = xilinx_qspips_realize; | ||
107 | - dc->props = xilinx_qspips_properties; | ||
108 | xsc->reg_ops = &qspips_ops; | ||
109 | xsc->rx_fifo_size = RXFF_A_Q; | ||
110 | xsc->tx_fifo_size = TXFF_A_Q; | ||
111 | -- | 72 | -- |
112 | 2.18.0 | 73 | 2.20.1 |
113 | 74 | ||
114 | 75 | diff view generated by jsdifflib |
1 | ARMv7VE introduced the ERET instruction, which is necessary to | 1 | Support for running KVM on 32-bit Arm hosts was removed in commit |
---|---|---|---|
2 | return from an exception taken to Hyp mode. Implement this. | 2 | 82bf7ae84ce739e. You can still run a 32-bit guest on a 64-bit Arm |
3 | In A32 encoding it is a completely new encoding; in T32 it | 3 | host CPU, but because Arm KVM requires the host and guest CPU types |
4 | is an adjustment of the behaviour of the existing | 4 | to match, it is not possible to run a guest that requires a Cortex-A9 |
5 | "SUBS PC, LR, #<imm8>" instruction. | 5 | or Cortex-A15 CPU there. That means that the code in the |
6 | highbank/midway board models to support KVM is no longer used, and we | ||
7 | can delete it. | ||
6 | 8 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Message-id: 20180814124254.5229-10-peter.maydell@linaro.org | 12 | Message-id: 20201215144215.28482-1-peter.maydell@linaro.org |
11 | --- | 13 | --- |
12 | target/arm/translate.c | 31 +++++++++++++++++++++++++++++-- | 14 | hw/arm/highbank.c | 14 ++++---------- |
13 | 1 file changed, 29 insertions(+), 2 deletions(-) | 15 | 1 file changed, 4 insertions(+), 10 deletions(-) |
14 | 16 | ||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 19 | --- a/hw/arm/highbank.c |
18 | +++ b/target/arm/translate.c | 20 | +++ b/hw/arm/highbank.c |
19 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 21 | @@ -XXX,XX +XXX,XX @@ |
20 | tcg_temp_free_i32(tmp2); | 22 | #include "hw/arm/boot.h" |
21 | store_reg(s, rd, tmp); | 23 | #include "hw/loader.h" |
22 | break; | 24 | #include "net/net.h" |
23 | + case 0x6: /* ERET */ | 25 | -#include "sysemu/kvm.h" |
24 | + if (op1 != 3) { | 26 | #include "sysemu/runstate.h" |
25 | + goto illegal_op; | 27 | #include "sysemu/sysemu.h" |
26 | + } | 28 | #include "hw/boards.h" |
27 | + if (!arm_dc_feature(s, ARM_FEATURE_V7VE)) { | 29 | @@ -XXX,XX +XXX,XX @@ |
28 | + goto illegal_op; | 30 | #include "hw/cpu/a15mpcore.h" |
29 | + } | 31 | #include "qemu/log.h" |
30 | + if ((insn & 0x000fff0f) != 0x0000000e) { | 32 | #include "qom/object.h" |
31 | + /* UNPREDICTABLE; we choose to UNDEF */ | 33 | +#include "cpu.h" |
32 | + goto illegal_op; | 34 | |
33 | + } | 35 | #define SMP_BOOT_ADDR 0x100 |
34 | + | 36 | #define SMP_BOOT_REG 0x40 |
35 | + if (s->current_el == 2) { | 37 | @@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) |
36 | + tmp = load_cpu_field(elr_el[2]); | 38 | highbank_binfo.loader_start = 0; |
37 | + } else { | 39 | highbank_binfo.write_secondary_boot = hb_write_secondary; |
38 | + tmp = load_reg(s, 14); | 40 | highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary; |
39 | + } | 41 | - if (!kvm_enabled()) { |
40 | + gen_exception_return(s, tmp); | 42 | - highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR; |
41 | + break; | 43 | - highbank_binfo.write_board_setup = hb_write_board_setup; |
42 | case 7: | 44 | - highbank_binfo.secure_board_setup = true; |
43 | { | 45 | - } else { |
44 | int imm16 = extract32(insn, 0, 4) | (extract32(insn, 8, 12) << 4); | 46 | - warn_report("cannot load built-in Monitor support " |
45 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 47 | - "if KVM is enabled. Some guests (such as Linux) " |
46 | if (rn != 14 || rd != 15) { | 48 | - "may not boot."); |
47 | goto illegal_op; | 49 | - } |
48 | } | 50 | + highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR; |
49 | - tmp = load_reg(s, rn); | 51 | + highbank_binfo.write_board_setup = hb_write_board_setup; |
50 | - tcg_gen_subi_i32(tmp, tmp, insn & 0xff); | 52 | + highbank_binfo.secure_board_setup = true; |
51 | + if (s->current_el == 2) { | 53 | |
52 | + /* ERET from Hyp uses ELR_Hyp, not LR */ | 54 | arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo); |
53 | + if (insn & 0xff) { | 55 | } |
54 | + goto illegal_op; | ||
55 | + } | ||
56 | + tmp = load_cpu_field(elr_el[2]); | ||
57 | + } else { | ||
58 | + tmp = load_reg(s, rn); | ||
59 | + tcg_gen_subi_i32(tmp, tmp, insn & 0xff); | ||
60 | + } | ||
61 | gen_exception_return(s, tmp); | ||
62 | break; | ||
63 | case 6: /* MRS */ | ||
64 | -- | 56 | -- |
65 | 2.18.0 | 57 | 2.20.1 |
66 | 58 | ||
67 | 59 | diff view generated by jsdifflib |
1 | Remove the obsolete MMIO request_ptr APIs; they have no | 1 | Currently timer_free() is a simple wrapper for g_free(). This means |
---|---|---|---|
2 | users now. | 2 | that the timer being freed must not be currently active, as otherwise |
3 | QEMU might crash later when the active list is processed and still | ||
4 | has a pointer to freed memory on it. As a result almost all calls to | ||
5 | timer_free() are preceded by a timer_del() call, as can be seen in | ||
6 | the output of | ||
7 | git grep -B1 '\<timer_free\>' | ||
8 | |||
9 | This is unfortunate API design as it makes it easy to accidentally | ||
10 | misuse (by forgetting the timer_del()), and the correct use is | ||
11 | annoyingly verbose. | ||
12 | |||
13 | Make timer_free() imply a timer_del(). | ||
3 | 14 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com> | 18 | Message-id: 20201215154107.3255-2-peter.maydell@linaro.org |
8 | Message-id: 20180817114619.22354-3-peter.maydell@linaro.org | ||
9 | --- | 19 | --- |
10 | include/exec/memory.h | 35 -------------- | 20 | include/qemu/timer.h | 24 +++++++++++++----------- |
11 | memory.c | 110 ------------------------------------------ | 21 | 1 file changed, 13 insertions(+), 11 deletions(-) |
12 | 2 files changed, 145 deletions(-) | ||
13 | 22 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 23 | diff --git a/include/qemu/timer.h b/include/qemu/timer.h |
15 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 25 | --- a/include/qemu/timer.h |
17 | +++ b/include/exec/memory.h | 26 | +++ b/include/qemu/timer.h |
18 | @@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps { | 27 | @@ -XXX,XX +XXX,XX @@ static inline QEMUTimer *timer_new_ms(QEMUClockType type, QEMUTimerCB *cb, |
19 | uint64_t data, | 28 | */ |
20 | unsigned size, | 29 | void timer_deinit(QEMUTimer *ts); |
21 | MemTxAttrs attrs); | ||
22 | - /* Instruction execution pre-callback: | ||
23 | - * @addr is the address of the access relative to the @mr. | ||
24 | - * @size is the size of the area returned by the callback. | ||
25 | - * @offset is the location of the pointer inside @mr. | ||
26 | - * | ||
27 | - * Returns a pointer to a location which contains guest code. | ||
28 | - */ | ||
29 | - void *(*request_ptr)(void *opaque, hwaddr addr, unsigned *size, | ||
30 | - unsigned *offset); | ||
31 | |||
32 | enum device_endian endianness; | ||
33 | /* Guest-visible constraints: */ | ||
34 | @@ -XXX,XX +XXX,XX @@ void memory_global_dirty_log_stop(void); | ||
35 | void mtree_info(fprintf_function mon_printf, void *f, bool flatview, | ||
36 | bool dispatch_tree, bool owner); | ||
37 | 30 | ||
38 | -/** | 31 | -/** |
39 | - * memory_region_request_mmio_ptr: request a pointer to an mmio | 32 | - * timer_free: |
40 | - * MemoryRegion. If it is possible map a RAM MemoryRegion with this pointer. | 33 | - * @ts: the timer |
41 | - * When the device wants to invalidate the pointer it will call | ||
42 | - * memory_region_invalidate_mmio_ptr. | ||
43 | - * | 34 | - * |
44 | - * @mr: #MemoryRegion to check | 35 | - * Free a timer (it must not be on the active list) |
45 | - * @addr: address within that region | ||
46 | - * | ||
47 | - * Returns true on success, false otherwise. | ||
48 | - */ | 36 | - */ |
49 | -bool memory_region_request_mmio_ptr(MemoryRegion *mr, hwaddr addr); | 37 | -static inline void timer_free(QEMUTimer *ts) |
50 | - | 38 | -{ |
51 | -/** | 39 | - g_free(ts); |
52 | - * memory_region_invalidate_mmio_ptr: invalidate the pointer to an mmio | 40 | -} |
53 | - * previously requested. | ||
54 | - * In the end that means that if something wants to execute from this area it | ||
55 | - * will need to request the pointer again. | ||
56 | - * | ||
57 | - * @mr: #MemoryRegion associated to the pointer. | ||
58 | - * @offset: offset within the memory region | ||
59 | - * @size: size of that area. | ||
60 | - */ | ||
61 | -void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset, | ||
62 | - unsigned size); | ||
63 | - | 41 | - |
64 | /** | 42 | /** |
65 | * memory_region_dispatch_read: perform a read directly to the specified | 43 | * timer_del: |
66 | * MemoryRegion. | 44 | * @ts: the timer |
67 | diff --git a/memory.c b/memory.c | 45 | @@ -XXX,XX +XXX,XX @@ static inline void timer_free(QEMUTimer *ts) |
68 | index XXXXXXX..XXXXXXX 100644 | 46 | */ |
69 | --- a/memory.c | 47 | void timer_del(QEMUTimer *ts); |
70 | +++ b/memory.c | 48 | |
71 | @@ -XXX,XX +XXX,XX @@ | 49 | +/** |
72 | #include "exec/ram_addr.h" | 50 | + * timer_free: |
73 | #include "sysemu/kvm.h" | 51 | + * @ts: the timer |
74 | #include "sysemu/sysemu.h" | 52 | + * |
75 | -#include "hw/misc/mmio_interface.h" | 53 | + * Free a timer. This will call timer_del() for you to remove |
76 | #include "hw/qdev-properties.h" | 54 | + * the timer from the active list if it was still active. |
77 | #include "migration/vmstate.h" | 55 | + */ |
78 | 56 | +static inline void timer_free(QEMUTimer *ts) | |
79 | @@ -XXX,XX +XXX,XX @@ void memory_listener_unregister(MemoryListener *listener) | 57 | +{ |
80 | listener->address_space = NULL; | 58 | + timer_del(ts); |
81 | } | 59 | + g_free(ts); |
82 | 60 | +} | |
83 | -bool memory_region_request_mmio_ptr(MemoryRegion *mr, hwaddr addr) | 61 | + |
84 | -{ | 62 | /** |
85 | - void *host; | 63 | * timer_mod_ns: |
86 | - unsigned size = 0; | 64 | * @ts: the timer |
87 | - unsigned offset = 0; | ||
88 | - Object *new_interface; | ||
89 | - | ||
90 | - if (!mr || !mr->ops->request_ptr) { | ||
91 | - return false; | ||
92 | - } | ||
93 | - | ||
94 | - /* | ||
95 | - * Avoid an update if the request_ptr call | ||
96 | - * memory_region_invalidate_mmio_ptr which seems to be likely when we use | ||
97 | - * a cache. | ||
98 | - */ | ||
99 | - memory_region_transaction_begin(); | ||
100 | - | ||
101 | - host = mr->ops->request_ptr(mr->opaque, addr - mr->addr, &size, &offset); | ||
102 | - | ||
103 | - if (!host || !size) { | ||
104 | - memory_region_transaction_commit(); | ||
105 | - return false; | ||
106 | - } | ||
107 | - | ||
108 | - new_interface = object_new("mmio_interface"); | ||
109 | - qdev_prop_set_uint64(DEVICE(new_interface), "start", offset); | ||
110 | - qdev_prop_set_uint64(DEVICE(new_interface), "end", offset + size - 1); | ||
111 | - qdev_prop_set_bit(DEVICE(new_interface), "ro", true); | ||
112 | - qdev_prop_set_ptr(DEVICE(new_interface), "host_ptr", host); | ||
113 | - qdev_prop_set_ptr(DEVICE(new_interface), "subregion", mr); | ||
114 | - object_property_set_bool(OBJECT(new_interface), true, "realized", NULL); | ||
115 | - | ||
116 | - memory_region_transaction_commit(); | ||
117 | - return true; | ||
118 | -} | ||
119 | - | ||
120 | -typedef struct MMIOPtrInvalidate { | ||
121 | - MemoryRegion *mr; | ||
122 | - hwaddr offset; | ||
123 | - unsigned size; | ||
124 | - int busy; | ||
125 | - int allocated; | ||
126 | -} MMIOPtrInvalidate; | ||
127 | - | ||
128 | -#define MAX_MMIO_INVALIDATE 10 | ||
129 | -static MMIOPtrInvalidate mmio_ptr_invalidate_list[MAX_MMIO_INVALIDATE]; | ||
130 | - | ||
131 | -static void memory_region_do_invalidate_mmio_ptr(CPUState *cpu, | ||
132 | - run_on_cpu_data data) | ||
133 | -{ | ||
134 | - MMIOPtrInvalidate *invalidate_data = (MMIOPtrInvalidate *)data.host_ptr; | ||
135 | - MemoryRegion *mr = invalidate_data->mr; | ||
136 | - hwaddr offset = invalidate_data->offset; | ||
137 | - unsigned size = invalidate_data->size; | ||
138 | - MemoryRegionSection section = memory_region_find(mr, offset, size); | ||
139 | - | ||
140 | - qemu_mutex_lock_iothread(); | ||
141 | - | ||
142 | - /* Reset dirty so this doesn't happen later. */ | ||
143 | - cpu_physical_memory_test_and_clear_dirty(offset, size, 1); | ||
144 | - | ||
145 | - if (section.mr != mr) { | ||
146 | - /* memory_region_find add a ref on section.mr */ | ||
147 | - memory_region_unref(section.mr); | ||
148 | - if (MMIO_INTERFACE(section.mr->owner)) { | ||
149 | - /* We found the interface just drop it. */ | ||
150 | - object_property_set_bool(section.mr->owner, false, "realized", | ||
151 | - NULL); | ||
152 | - object_unref(section.mr->owner); | ||
153 | - object_unparent(section.mr->owner); | ||
154 | - } | ||
155 | - } | ||
156 | - | ||
157 | - qemu_mutex_unlock_iothread(); | ||
158 | - | ||
159 | - if (invalidate_data->allocated) { | ||
160 | - g_free(invalidate_data); | ||
161 | - } else { | ||
162 | - invalidate_data->busy = 0; | ||
163 | - } | ||
164 | -} | ||
165 | - | ||
166 | -void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset, | ||
167 | - unsigned size) | ||
168 | -{ | ||
169 | - size_t i; | ||
170 | - MMIOPtrInvalidate *invalidate_data = NULL; | ||
171 | - | ||
172 | - for (i = 0; i < MAX_MMIO_INVALIDATE; i++) { | ||
173 | - if (atomic_cmpxchg(&(mmio_ptr_invalidate_list[i].busy), 0, 1) == 0) { | ||
174 | - invalidate_data = &mmio_ptr_invalidate_list[i]; | ||
175 | - break; | ||
176 | - } | ||
177 | - } | ||
178 | - | ||
179 | - if (!invalidate_data) { | ||
180 | - invalidate_data = g_malloc0(sizeof(MMIOPtrInvalidate)); | ||
181 | - invalidate_data->allocated = 1; | ||
182 | - } | ||
183 | - | ||
184 | - invalidate_data->mr = mr; | ||
185 | - invalidate_data->offset = offset; | ||
186 | - invalidate_data->size = size; | ||
187 | - | ||
188 | - async_safe_run_on_cpu(first_cpu, memory_region_do_invalidate_mmio_ptr, | ||
189 | - RUN_ON_CPU_HOST_PTR(invalidate_data)); | ||
190 | -} | ||
191 | - | ||
192 | void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) | ||
193 | { | ||
194 | memory_region_ref(root); | ||
195 | -- | 65 | -- |
196 | 2.18.0 | 66 | 2.20.1 |
197 | 67 | ||
198 | 68 | diff view generated by jsdifflib |
1 | Create a new include file for the pl081's device struct, | 1 | Now that timer_free() implicitly calls timer_del(), sequences |
---|---|---|---|
2 | type macros, etc, so that it can be instantiated using | 2 | timer_del(mytimer); |
3 | the "embedded struct" coding style. | 3 | timer_free(mytimer); |
4 | |||
5 | can be simplified to just | ||
6 | timer_free(mytimer); | ||
7 | |||
8 | Add a Coccinelle script to do this transformation. | ||
4 | 9 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 11 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20201215154107.3255-3-peter.maydell@linaro.org | ||
7 | --- | 15 | --- |
8 | include/hw/dma/pl080.h | 62 ++++++++++++++++++++++++++++++++++++++++++ | 16 | scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++ |
9 | hw/dma/pl080.c | 34 ++--------------------- | 17 | 1 file changed, 18 insertions(+) |
10 | MAINTAINERS | 1 + | 18 | create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci |
11 | 3 files changed, 65 insertions(+), 32 deletions(-) | ||
12 | create mode 100644 include/hw/dma/pl080.h | ||
13 | 19 | ||
14 | diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h | 20 | diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci |
15 | new file mode 100644 | 21 | new file mode 100644 |
16 | index XXXXXXX..XXXXXXX | 22 | index XXXXXXX..XXXXXXX |
17 | --- /dev/null | 23 | --- /dev/null |
18 | +++ b/include/hw/dma/pl080.h | 24 | +++ b/scripts/coccinelle/timer-del-timer-free.cocci |
19 | @@ -XXX,XX +XXX,XX @@ | 25 | @@ -XXX,XX +XXX,XX @@ |
20 | +/* | 26 | +// Remove superfluous timer_del() calls |
21 | + * ARM PrimeCell PL080/PL081 DMA controller | 27 | +// |
22 | + * | 28 | +// Copyright Linaro Limited 2020 |
23 | + * Copyright (c) 2006 CodeSourcery. | 29 | +// This work is licensed under the terms of the GNU GPLv2 or later. |
24 | + * Copyright (c) 2018 Linaro Limited | 30 | +// |
25 | + * Written by Paul Brook, Peter Maydell | 31 | +// spatch --macro-file scripts/cocci-macro-file.h \ |
26 | + * | 32 | +// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \ |
27 | + * This program is free software; you can redistribute it and/or modify | 33 | +// --in-place --dir . |
28 | + * it under the terms of the GNU General Public License version 2 or | 34 | +// |
29 | + * (at your option) any later version. | 35 | +// The timer_free() function now implicitly calls timer_del() |
30 | + */ | 36 | +// for you, so calls to timer_del() immediately before the |
37 | +// timer_free() of the same timer can be deleted. | ||
31 | + | 38 | + |
32 | +/* This is a model of the Arm PrimeCell PL080/PL081 DMA controller: | 39 | +@@ |
33 | + * The PL080 TRM is: | 40 | +expression T; |
34 | + * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0196g/DDI0196.pdf | 41 | +@@ |
35 | + * and the PL081 TRM is: | 42 | +-timer_del(T); |
36 | + * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0218e/DDI0218.pdf | 43 | + timer_free(T); |
37 | + * | ||
38 | + * QEMU interface: | ||
39 | + * + sysbus IRQ: DMACINTR combined interrupt line | ||
40 | + * + sysbus MMIO region 0: MemoryRegion for the device's registers | ||
41 | + */ | ||
42 | + | ||
43 | +#ifndef HW_DMA_PL080_H | ||
44 | +#define HW_DMA_PL080_H | ||
45 | + | ||
46 | +#include "hw/sysbus.h" | ||
47 | + | ||
48 | +#define PL080_MAX_CHANNELS 8 | ||
49 | + | ||
50 | +typedef struct { | ||
51 | + uint32_t src; | ||
52 | + uint32_t dest; | ||
53 | + uint32_t lli; | ||
54 | + uint32_t ctrl; | ||
55 | + uint32_t conf; | ||
56 | +} pl080_channel; | ||
57 | + | ||
58 | +#define TYPE_PL080 "pl080" | ||
59 | +#define TYPE_PL081 "pl081" | ||
60 | +#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080) | ||
61 | + | ||
62 | +typedef struct PL080State { | ||
63 | + SysBusDevice parent_obj; | ||
64 | + | ||
65 | + MemoryRegion iomem; | ||
66 | + uint8_t tc_int; | ||
67 | + uint8_t tc_mask; | ||
68 | + uint8_t err_int; | ||
69 | + uint8_t err_mask; | ||
70 | + uint32_t conf; | ||
71 | + uint32_t sync; | ||
72 | + uint32_t req_single; | ||
73 | + uint32_t req_burst; | ||
74 | + pl080_channel chan[PL080_MAX_CHANNELS]; | ||
75 | + int nchannels; | ||
76 | + /* Flag to avoid recursive DMA invocations. */ | ||
77 | + int running; | ||
78 | + qemu_irq irq; | ||
79 | +} PL080State; | ||
80 | + | ||
81 | +#endif | ||
82 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | --- a/hw/dma/pl080.c | ||
85 | +++ b/hw/dma/pl080.c | ||
86 | @@ -XXX,XX +XXX,XX @@ | ||
87 | #include "hw/sysbus.h" | ||
88 | #include "exec/address-spaces.h" | ||
89 | #include "qemu/log.h" | ||
90 | +#include "hw/dma/pl080.h" | ||
91 | |||
92 | -#define PL080_MAX_CHANNELS 8 | ||
93 | #define PL080_CONF_E 0x1 | ||
94 | #define PL080_CONF_M1 0x2 | ||
95 | #define PL080_CONF_M2 0x4 | ||
96 | @@ -XXX,XX +XXX,XX @@ | ||
97 | #define PL080_CCTRL_D 0x02000000 | ||
98 | #define PL080_CCTRL_S 0x01000000 | ||
99 | |||
100 | -typedef struct { | ||
101 | - uint32_t src; | ||
102 | - uint32_t dest; | ||
103 | - uint32_t lli; | ||
104 | - uint32_t ctrl; | ||
105 | - uint32_t conf; | ||
106 | -} pl080_channel; | ||
107 | - | ||
108 | -#define TYPE_PL080 "pl080" | ||
109 | -#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080) | ||
110 | - | ||
111 | -typedef struct PL080State { | ||
112 | - SysBusDevice parent_obj; | ||
113 | - | ||
114 | - MemoryRegion iomem; | ||
115 | - uint8_t tc_int; | ||
116 | - uint8_t tc_mask; | ||
117 | - uint8_t err_int; | ||
118 | - uint8_t err_mask; | ||
119 | - uint32_t conf; | ||
120 | - uint32_t sync; | ||
121 | - uint32_t req_single; | ||
122 | - uint32_t req_burst; | ||
123 | - pl080_channel chan[PL080_MAX_CHANNELS]; | ||
124 | - int nchannels; | ||
125 | - /* Flag to avoid recursive DMA invocations. */ | ||
126 | - int running; | ||
127 | - qemu_irq irq; | ||
128 | -} PL080State; | ||
129 | - | ||
130 | static const VMStateDescription vmstate_pl080_channel = { | ||
131 | .name = "pl080_channel", | ||
132 | .version_id = 1, | ||
133 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo pl080_info = { | ||
134 | }; | ||
135 | |||
136 | static const TypeInfo pl081_info = { | ||
137 | - .name = "pl081", | ||
138 | + .name = TYPE_PL081, | ||
139 | .parent = TYPE_PL080, | ||
140 | .instance_init = pl081_init, | ||
141 | }; | ||
142 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/MAINTAINERS | ||
145 | +++ b/MAINTAINERS | ||
146 | @@ -XXX,XX +XXX,XX @@ F: hw/char/pl011.c | ||
147 | F: include/hw/char/pl011.h | ||
148 | F: hw/display/pl110* | ||
149 | F: hw/dma/pl080.c | ||
150 | +F: include/hw/dma/pl080.h | ||
151 | F: hw/dma/pl330.c | ||
152 | F: hw/gpio/pl061.c | ||
153 | F: hw/input/pl050.c | ||
154 | -- | 44 | -- |
155 | 2.18.0 | 45 | 2.20.1 |
156 | 46 | ||
157 | 47 | diff view generated by jsdifflib |
1 | From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com> | 1 | This commit is the result of running the timer-del-timer-free.cocci |
---|---|---|---|
2 | script on the whole source tree. | ||
2 | 3 | ||
3 | Add the ESDHC PRSSTAT_SDSTB bit, using the value of SDHC_CLOCK_INT_STABLE. | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Freescale recommends checking this bit when changing clock frequency. | 5 | Acked-by: Corey Minyard <cminyard@mvista.com> |
6 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20201215154107.3255-4-peter.maydell@linaro.org | ||
10 | --- | ||
11 | block/iscsi.c | 2 -- | ||
12 | block/nbd.c | 1 - | ||
13 | block/qcow2.c | 1 - | ||
14 | hw/block/nvme.c | 2 -- | ||
15 | hw/char/serial.c | 2 -- | ||
16 | hw/char/virtio-serial-bus.c | 2 -- | ||
17 | hw/ide/core.c | 1 - | ||
18 | hw/input/hid.c | 1 - | ||
19 | hw/intc/apic.c | 1 - | ||
20 | hw/intc/ioapic.c | 1 - | ||
21 | hw/ipmi/ipmi_bmc_extern.c | 1 - | ||
22 | hw/net/e1000.c | 3 --- | ||
23 | hw/net/e1000e_core.c | 8 -------- | ||
24 | hw/net/pcnet-pci.c | 1 - | ||
25 | hw/net/rtl8139.c | 1 - | ||
26 | hw/net/spapr_llan.c | 1 - | ||
27 | hw/net/virtio-net.c | 2 -- | ||
28 | hw/s390x/s390-pci-inst.c | 1 - | ||
29 | hw/sd/sd.c | 1 - | ||
30 | hw/sd/sdhci.c | 2 -- | ||
31 | hw/usb/dev-hub.c | 1 - | ||
32 | hw/usb/hcd-ehci.c | 1 - | ||
33 | hw/usb/hcd-ohci-pci.c | 1 - | ||
34 | hw/usb/hcd-uhci.c | 1 - | ||
35 | hw/usb/hcd-xhci.c | 1 - | ||
36 | hw/usb/redirect.c | 1 - | ||
37 | hw/vfio/display.c | 1 - | ||
38 | hw/virtio/vhost-vsock-common.c | 1 - | ||
39 | hw/virtio/virtio-balloon.c | 1 - | ||
40 | hw/virtio/virtio-rng.c | 1 - | ||
41 | hw/watchdog/wdt_diag288.c | 1 - | ||
42 | hw/watchdog/wdt_i6300esb.c | 1 - | ||
43 | migration/colo.c | 1 - | ||
44 | monitor/hmp-cmds.c | 1 - | ||
45 | net/announce.c | 1 - | ||
46 | net/colo-compare.c | 1 - | ||
47 | net/slirp.c | 1 - | ||
48 | replay/replay-debugging.c | 1 - | ||
49 | target/s390x/cpu.c | 2 -- | ||
50 | ui/console.c | 1 - | ||
51 | ui/spice-core.c | 1 - | ||
52 | util/throttle.c | 1 - | ||
53 | 42 files changed, 58 deletions(-) | ||
5 | 54 | ||
6 | Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com> | 55 | diff --git a/block/iscsi.c b/block/iscsi.c |
7 | Message-id: 1534507843-4251-1-git-send-email-hans-erik.floryd@rt-labs.com | 56 | index XXXXXXX..XXXXXXX 100644 |
8 | [PMM: fixed indentation] | 57 | --- a/block/iscsi.c |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 58 | +++ b/block/iscsi.c |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 59 | @@ -XXX,XX +XXX,XX @@ static void iscsi_detach_aio_context(BlockDriverState *bs) |
11 | --- | 60 | iscsilun->events = 0; |
12 | hw/sd/sdhci-internal.h | 2 ++ | 61 | |
13 | hw/sd/sdhci.c | 8 ++++++++ | 62 | if (iscsilun->nop_timer) { |
14 | 2 files changed, 10 insertions(+) | 63 | - timer_del(iscsilun->nop_timer); |
15 | 64 | timer_free(iscsilun->nop_timer); | |
16 | diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h | 65 | iscsilun->nop_timer = NULL; |
17 | index XXXXXXX..XXXXXXX 100644 | 66 | } |
18 | --- a/hw/sd/sdhci-internal.h | 67 | if (iscsilun->event_timer) { |
19 | +++ b/hw/sd/sdhci-internal.h | 68 | - timer_del(iscsilun->event_timer); |
20 | @@ -XXX,XX +XXX,XX @@ extern const VMStateDescription sdhci_vmstate; | 69 | timer_free(iscsilun->event_timer); |
21 | #define ESDHC_CTRL_4BITBUS (0x1 << 1) | 70 | iscsilun->event_timer = NULL; |
22 | #define ESDHC_CTRL_8BITBUS (0x2 << 1) | 71 | } |
23 | 72 | diff --git a/block/nbd.c b/block/nbd.c | |
24 | +#define ESDHC_PRNSTS_SDSTB (1 << 3) | 73 | index XXXXXXX..XXXXXXX 100644 |
25 | + | 74 | --- a/block/nbd.c |
26 | #endif | 75 | +++ b/block/nbd.c |
76 | @@ -XXX,XX +XXX,XX @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s) | ||
77 | static void reconnect_delay_timer_del(BDRVNBDState *s) | ||
78 | { | ||
79 | if (s->reconnect_delay_timer) { | ||
80 | - timer_del(s->reconnect_delay_timer); | ||
81 | timer_free(s->reconnect_delay_timer); | ||
82 | s->reconnect_delay_timer = NULL; | ||
83 | } | ||
84 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/block/qcow2.c | ||
87 | +++ b/block/qcow2.c | ||
88 | @@ -XXX,XX +XXX,XX @@ static void cache_clean_timer_del(BlockDriverState *bs) | ||
89 | { | ||
90 | BDRVQcow2State *s = bs->opaque; | ||
91 | if (s->cache_clean_timer) { | ||
92 | - timer_del(s->cache_clean_timer); | ||
93 | timer_free(s->cache_clean_timer); | ||
94 | s->cache_clean_timer = NULL; | ||
95 | } | ||
96 | diff --git a/hw/block/nvme.c b/hw/block/nvme.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/hw/block/nvme.c | ||
99 | +++ b/hw/block/nvme.c | ||
100 | @@ -XXX,XX +XXX,XX @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req) | ||
101 | static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n) | ||
102 | { | ||
103 | n->sq[sq->sqid] = NULL; | ||
104 | - timer_del(sq->timer); | ||
105 | timer_free(sq->timer); | ||
106 | g_free(sq->io_req); | ||
107 | if (sq->sqid) { | ||
108 | @@ -XXX,XX +XXX,XX @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest *req) | ||
109 | static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n) | ||
110 | { | ||
111 | n->cq[cq->cqid] = NULL; | ||
112 | - timer_del(cq->timer); | ||
113 | timer_free(cq->timer); | ||
114 | msix_vector_unuse(&n->parent_obj, cq->vector); | ||
115 | if (cq->cqid) { | ||
116 | diff --git a/hw/char/serial.c b/hw/char/serial.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/hw/char/serial.c | ||
119 | +++ b/hw/char/serial.c | ||
120 | @@ -XXX,XX +XXX,XX @@ static void serial_unrealize(DeviceState *dev) | ||
121 | |||
122 | qemu_chr_fe_deinit(&s->chr, false); | ||
123 | |||
124 | - timer_del(s->modem_status_poll); | ||
125 | timer_free(s->modem_status_poll); | ||
126 | |||
127 | - timer_del(s->fifo_timeout_timer); | ||
128 | timer_free(s->fifo_timeout_timer); | ||
129 | |||
130 | fifo8_destroy(&s->recv_fifo); | ||
131 | diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/hw/char/virtio-serial-bus.c | ||
134 | +++ b/hw/char/virtio-serial-bus.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static void virtio_serial_post_load_timer_cb(void *opaque) | ||
136 | } | ||
137 | } | ||
138 | g_free(s->post_load->connected); | ||
139 | - timer_del(s->post_load->timer); | ||
140 | timer_free(s->post_load->timer); | ||
141 | g_free(s->post_load); | ||
142 | s->post_load = NULL; | ||
143 | @@ -XXX,XX +XXX,XX @@ static void virtio_serial_device_unrealize(DeviceState *dev) | ||
144 | g_free(vser->ports_map); | ||
145 | if (vser->post_load) { | ||
146 | g_free(vser->post_load->connected); | ||
147 | - timer_del(vser->post_load->timer); | ||
148 | timer_free(vser->post_load->timer); | ||
149 | g_free(vser->post_load); | ||
150 | } | ||
151 | diff --git a/hw/ide/core.c b/hw/ide/core.c | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/hw/ide/core.c | ||
154 | +++ b/hw/ide/core.c | ||
155 | @@ -XXX,XX +XXX,XX @@ void ide_init2(IDEBus *bus, qemu_irq irq) | ||
156 | |||
157 | void ide_exit(IDEState *s) | ||
158 | { | ||
159 | - timer_del(s->sector_write_timer); | ||
160 | timer_free(s->sector_write_timer); | ||
161 | qemu_vfree(s->smart_selftest_data); | ||
162 | qemu_vfree(s->io_buffer); | ||
163 | diff --git a/hw/input/hid.c b/hw/input/hid.c | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/hw/input/hid.c | ||
166 | +++ b/hw/input/hid.c | ||
167 | @@ -XXX,XX +XXX,XX @@ static void hid_idle_timer(void *opaque) | ||
168 | static void hid_del_idle_timer(HIDState *hs) | ||
169 | { | ||
170 | if (hs->idle_timer) { | ||
171 | - timer_del(hs->idle_timer); | ||
172 | timer_free(hs->idle_timer); | ||
173 | hs->idle_timer = NULL; | ||
174 | } | ||
175 | diff --git a/hw/intc/apic.c b/hw/intc/apic.c | ||
176 | index XXXXXXX..XXXXXXX 100644 | ||
177 | --- a/hw/intc/apic.c | ||
178 | +++ b/hw/intc/apic.c | ||
179 | @@ -XXX,XX +XXX,XX @@ static void apic_unrealize(DeviceState *dev) | ||
180 | { | ||
181 | APICCommonState *s = APIC(dev); | ||
182 | |||
183 | - timer_del(s->timer); | ||
184 | timer_free(s->timer); | ||
185 | local_apics[s->id] = NULL; | ||
186 | } | ||
187 | diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c | ||
188 | index XXXXXXX..XXXXXXX 100644 | ||
189 | --- a/hw/intc/ioapic.c | ||
190 | +++ b/hw/intc/ioapic.c | ||
191 | @@ -XXX,XX +XXX,XX @@ static void ioapic_unrealize(DeviceState *dev) | ||
192 | { | ||
193 | IOAPICCommonState *s = IOAPIC_COMMON(dev); | ||
194 | |||
195 | - timer_del(s->delayed_ioapic_service_timer); | ||
196 | timer_free(s->delayed_ioapic_service_timer); | ||
197 | } | ||
198 | |||
199 | diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c | ||
200 | index XXXXXXX..XXXXXXX 100644 | ||
201 | --- a/hw/ipmi/ipmi_bmc_extern.c | ||
202 | +++ b/hw/ipmi/ipmi_bmc_extern.c | ||
203 | @@ -XXX,XX +XXX,XX @@ static void ipmi_bmc_extern_finalize(Object *obj) | ||
204 | { | ||
205 | IPMIBmcExtern *ibe = IPMI_BMC_EXTERN(obj); | ||
206 | |||
207 | - timer_del(ibe->extern_timer); | ||
208 | timer_free(ibe->extern_timer); | ||
209 | } | ||
210 | |||
211 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | ||
212 | index XXXXXXX..XXXXXXX 100644 | ||
213 | --- a/hw/net/e1000.c | ||
214 | +++ b/hw/net/e1000.c | ||
215 | @@ -XXX,XX +XXX,XX @@ pci_e1000_uninit(PCIDevice *dev) | ||
216 | { | ||
217 | E1000State *d = E1000(dev); | ||
218 | |||
219 | - timer_del(d->autoneg_timer); | ||
220 | timer_free(d->autoneg_timer); | ||
221 | - timer_del(d->mit_timer); | ||
222 | timer_free(d->mit_timer); | ||
223 | - timer_del(d->flush_queue_timer); | ||
224 | timer_free(d->flush_queue_timer); | ||
225 | qemu_del_nic(d->nic); | ||
226 | } | ||
227 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | ||
228 | index XXXXXXX..XXXXXXX 100644 | ||
229 | --- a/hw/net/e1000e_core.c | ||
230 | +++ b/hw/net/e1000e_core.c | ||
231 | @@ -XXX,XX +XXX,XX @@ e1000e_intrmgr_pci_unint(E1000ECore *core) | ||
232 | { | ||
233 | int i; | ||
234 | |||
235 | - timer_del(core->radv.timer); | ||
236 | timer_free(core->radv.timer); | ||
237 | - timer_del(core->rdtr.timer); | ||
238 | timer_free(core->rdtr.timer); | ||
239 | - timer_del(core->raid.timer); | ||
240 | timer_free(core->raid.timer); | ||
241 | |||
242 | - timer_del(core->tadv.timer); | ||
243 | timer_free(core->tadv.timer); | ||
244 | - timer_del(core->tidv.timer); | ||
245 | timer_free(core->tidv.timer); | ||
246 | |||
247 | - timer_del(core->itr.timer); | ||
248 | timer_free(core->itr.timer); | ||
249 | |||
250 | for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) { | ||
251 | - timer_del(core->eitr[i].timer); | ||
252 | timer_free(core->eitr[i].timer); | ||
253 | } | ||
254 | } | ||
255 | @@ -XXX,XX +XXX,XX @@ e1000e_core_pci_uninit(E1000ECore *core) | ||
256 | { | ||
257 | int i; | ||
258 | |||
259 | - timer_del(core->autoneg_timer); | ||
260 | timer_free(core->autoneg_timer); | ||
261 | |||
262 | e1000e_intrmgr_pci_unint(core); | ||
263 | diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c | ||
264 | index XXXXXXX..XXXXXXX 100644 | ||
265 | --- a/hw/net/pcnet-pci.c | ||
266 | +++ b/hw/net/pcnet-pci.c | ||
267 | @@ -XXX,XX +XXX,XX @@ static void pci_pcnet_uninit(PCIDevice *dev) | ||
268 | PCIPCNetState *d = PCI_PCNET(dev); | ||
269 | |||
270 | qemu_free_irq(d->state.irq); | ||
271 | - timer_del(d->state.poll_timer); | ||
272 | timer_free(d->state.poll_timer); | ||
273 | qemu_del_nic(d->state.nic); | ||
274 | } | ||
275 | diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c | ||
276 | index XXXXXXX..XXXXXXX 100644 | ||
277 | --- a/hw/net/rtl8139.c | ||
278 | +++ b/hw/net/rtl8139.c | ||
279 | @@ -XXX,XX +XXX,XX @@ static void pci_rtl8139_uninit(PCIDevice *dev) | ||
280 | |||
281 | g_free(s->cplus_txbuffer); | ||
282 | s->cplus_txbuffer = NULL; | ||
283 | - timer_del(s->timer); | ||
284 | timer_free(s->timer); | ||
285 | qemu_del_nic(s->nic); | ||
286 | } | ||
287 | diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c | ||
288 | index XXXXXXX..XXXXXXX 100644 | ||
289 | --- a/hw/net/spapr_llan.c | ||
290 | +++ b/hw/net/spapr_llan.c | ||
291 | @@ -XXX,XX +XXX,XX @@ static void spapr_vlan_instance_finalize(Object *obj) | ||
292 | } | ||
293 | |||
294 | if (dev->rxp_timer) { | ||
295 | - timer_del(dev->rxp_timer); | ||
296 | timer_free(dev->rxp_timer); | ||
297 | } | ||
298 | } | ||
299 | diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c | ||
300 | index XXXXXXX..XXXXXXX 100644 | ||
301 | --- a/hw/net/virtio-net.c | ||
302 | +++ b/hw/net/virtio-net.c | ||
303 | @@ -XXX,XX +XXX,XX @@ static void virtio_net_rsc_cleanup(VirtIONet *n) | ||
304 | g_free(seg); | ||
305 | } | ||
306 | |||
307 | - timer_del(chain->drain_timer); | ||
308 | timer_free(chain->drain_timer); | ||
309 | QTAILQ_REMOVE(&n->rsc_chains, chain, next); | ||
310 | g_free(chain); | ||
311 | @@ -XXX,XX +XXX,XX @@ static void virtio_net_del_queue(VirtIONet *n, int index) | ||
312 | |||
313 | virtio_del_queue(vdev, index * 2); | ||
314 | if (q->tx_timer) { | ||
315 | - timer_del(q->tx_timer); | ||
316 | timer_free(q->tx_timer); | ||
317 | q->tx_timer = NULL; | ||
318 | } else { | ||
319 | diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c | ||
320 | index XXXXXXX..XXXXXXX 100644 | ||
321 | --- a/hw/s390x/s390-pci-inst.c | ||
322 | +++ b/hw/s390x/s390-pci-inst.c | ||
323 | @@ -XXX,XX +XXX,XX @@ void pci_dereg_ioat(S390PCIIOMMU *iommu) | ||
324 | void fmb_timer_free(S390PCIBusDevice *pbdev) | ||
325 | { | ||
326 | if (pbdev->fmb_timer) { | ||
327 | - timer_del(pbdev->fmb_timer); | ||
328 | timer_free(pbdev->fmb_timer); | ||
329 | pbdev->fmb_timer = NULL; | ||
330 | } | ||
331 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | ||
332 | index XXXXXXX..XXXXXXX 100644 | ||
333 | --- a/hw/sd/sd.c | ||
334 | +++ b/hw/sd/sd.c | ||
335 | @@ -XXX,XX +XXX,XX @@ static void sd_instance_finalize(Object *obj) | ||
336 | { | ||
337 | SDState *sd = SD_CARD(obj); | ||
338 | |||
339 | - timer_del(sd->ocr_power_timer); | ||
340 | timer_free(sd->ocr_power_timer); | ||
341 | } | ||
342 | |||
27 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 343 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c |
28 | index XXXXXXX..XXXXXXX 100644 | 344 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/hw/sd/sdhci.c | 345 | --- a/hw/sd/sdhci.c |
30 | +++ b/hw/sd/sdhci.c | 346 | +++ b/hw/sd/sdhci.c |
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t usdhc_read(void *opaque, hwaddr offset, unsigned size) | 347 | @@ -XXX,XX +XXX,XX @@ void sdhci_initfn(SDHCIState *s) |
32 | 348 | ||
33 | break; | 349 | void sdhci_uninitfn(SDHCIState *s) |
34 | 350 | { | |
35 | + case SDHC_PRNSTS: | 351 | - timer_del(s->insert_timer); |
36 | + /* Add SDSTB (SD Clock Stable) bit to PRNSTS */ | 352 | timer_free(s->insert_timer); |
37 | + ret = sdhci_read(opaque, offset, size) & ~ESDHC_PRNSTS_SDSTB; | 353 | - timer_del(s->transfer_timer); |
38 | + if (s->clkcon & SDHC_CLOCK_INT_STABLE) { | 354 | timer_free(s->transfer_timer); |
39 | + ret |= ESDHC_PRNSTS_SDSTB; | 355 | |
40 | + } | 356 | g_free(s->fifo_buffer); |
41 | + break; | 357 | diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c |
42 | + | 358 | index XXXXXXX..XXXXXXX 100644 |
43 | case ESDHC_DLL_CTRL: | 359 | --- a/hw/usb/dev-hub.c |
44 | case ESDHC_TUNE_CTRL_STATUS: | 360 | +++ b/hw/usb/dev-hub.c |
45 | case ESDHC_UNDOCUMENTED_REG27: | 361 | @@ -XXX,XX +XXX,XX @@ static void usb_hub_unrealize(USBDevice *dev) |
362 | &s->ports[i].port); | ||
363 | } | ||
364 | |||
365 | - timer_del(s->port_timer); | ||
366 | timer_free(s->port_timer); | ||
367 | } | ||
368 | |||
369 | diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c | ||
370 | index XXXXXXX..XXXXXXX 100644 | ||
371 | --- a/hw/usb/hcd-ehci.c | ||
372 | +++ b/hw/usb/hcd-ehci.c | ||
373 | @@ -XXX,XX +XXX,XX @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *dev) | ||
374 | trace_usb_ehci_unrealize(); | ||
375 | |||
376 | if (s->frame_timer) { | ||
377 | - timer_del(s->frame_timer); | ||
378 | timer_free(s->frame_timer); | ||
379 | s->frame_timer = NULL; | ||
380 | } | ||
381 | diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c | ||
382 | index XXXXXXX..XXXXXXX 100644 | ||
383 | --- a/hw/usb/hcd-ohci-pci.c | ||
384 | +++ b/hw/usb/hcd-ohci-pci.c | ||
385 | @@ -XXX,XX +XXX,XX @@ static void usb_ohci_exit(PCIDevice *dev) | ||
386 | usb_bus_release(&s->bus); | ||
387 | } | ||
388 | |||
389 | - timer_del(s->eof_timer); | ||
390 | timer_free(s->eof_timer); | ||
391 | } | ||
392 | |||
393 | diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c | ||
394 | index XXXXXXX..XXXXXXX 100644 | ||
395 | --- a/hw/usb/hcd-uhci.c | ||
396 | +++ b/hw/usb/hcd-uhci.c | ||
397 | @@ -XXX,XX +XXX,XX @@ static void usb_uhci_exit(PCIDevice *dev) | ||
398 | trace_usb_uhci_exit(); | ||
399 | |||
400 | if (s->frame_timer) { | ||
401 | - timer_del(s->frame_timer); | ||
402 | timer_free(s->frame_timer); | ||
403 | s->frame_timer = NULL; | ||
404 | } | ||
405 | diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c | ||
406 | index XXXXXXX..XXXXXXX 100644 | ||
407 | --- a/hw/usb/hcd-xhci.c | ||
408 | +++ b/hw/usb/hcd-xhci.c | ||
409 | @@ -XXX,XX +XXX,XX @@ static void usb_xhci_unrealize(DeviceState *dev) | ||
410 | } | ||
411 | |||
412 | if (xhci->mfwrap_timer) { | ||
413 | - timer_del(xhci->mfwrap_timer); | ||
414 | timer_free(xhci->mfwrap_timer); | ||
415 | xhci->mfwrap_timer = NULL; | ||
416 | } | ||
417 | diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c | ||
418 | index XXXXXXX..XXXXXXX 100644 | ||
419 | --- a/hw/usb/redirect.c | ||
420 | +++ b/hw/usb/redirect.c | ||
421 | @@ -XXX,XX +XXX,XX @@ static void usbredir_unrealize(USBDevice *udev) | ||
422 | qemu_bh_delete(dev->chardev_close_bh); | ||
423 | qemu_bh_delete(dev->device_reject_bh); | ||
424 | |||
425 | - timer_del(dev->attach_timer); | ||
426 | timer_free(dev->attach_timer); | ||
427 | |||
428 | usbredir_cleanup_device_queues(dev); | ||
429 | diff --git a/hw/vfio/display.c b/hw/vfio/display.c | ||
430 | index XXXXXXX..XXXXXXX 100644 | ||
431 | --- a/hw/vfio/display.c | ||
432 | +++ b/hw/vfio/display.c | ||
433 | @@ -XXX,XX +XXX,XX @@ static void vfio_display_edid_exit(VFIODisplay *dpy) | ||
434 | |||
435 | g_free(dpy->edid_regs); | ||
436 | g_free(dpy->edid_blob); | ||
437 | - timer_del(dpy->edid_link_timer); | ||
438 | timer_free(dpy->edid_link_timer); | ||
439 | } | ||
440 | |||
441 | diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c | ||
442 | index XXXXXXX..XXXXXXX 100644 | ||
443 | --- a/hw/virtio/vhost-vsock-common.c | ||
444 | +++ b/hw/virtio/vhost-vsock-common.c | ||
445 | @@ -XXX,XX +XXX,XX @@ static void vhost_vsock_common_post_load_timer_cleanup(VHostVSockCommon *vvc) | ||
446 | return; | ||
447 | } | ||
448 | |||
449 | - timer_del(vvc->post_load_timer); | ||
450 | timer_free(vvc->post_load_timer); | ||
451 | vvc->post_load_timer = NULL; | ||
452 | } | ||
453 | diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c | ||
454 | index XXXXXXX..XXXXXXX 100644 | ||
455 | --- a/hw/virtio/virtio-balloon.c | ||
456 | +++ b/hw/virtio/virtio-balloon.c | ||
457 | @@ -XXX,XX +XXX,XX @@ static bool balloon_stats_enabled(const VirtIOBalloon *s) | ||
458 | static void balloon_stats_destroy_timer(VirtIOBalloon *s) | ||
459 | { | ||
460 | if (balloon_stats_enabled(s)) { | ||
461 | - timer_del(s->stats_timer); | ||
462 | timer_free(s->stats_timer); | ||
463 | s->stats_timer = NULL; | ||
464 | s->stats_poll_interval = 0; | ||
465 | diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c | ||
466 | index XXXXXXX..XXXXXXX 100644 | ||
467 | --- a/hw/virtio/virtio-rng.c | ||
468 | +++ b/hw/virtio/virtio-rng.c | ||
469 | @@ -XXX,XX +XXX,XX @@ static void virtio_rng_device_unrealize(DeviceState *dev) | ||
470 | VirtIORNG *vrng = VIRTIO_RNG(dev); | ||
471 | |||
472 | qemu_del_vm_change_state_handler(vrng->vmstate); | ||
473 | - timer_del(vrng->rate_limit_timer); | ||
474 | timer_free(vrng->rate_limit_timer); | ||
475 | virtio_del_queue(vdev, 0); | ||
476 | virtio_cleanup(vdev); | ||
477 | diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c | ||
478 | index XXXXXXX..XXXXXXX 100644 | ||
479 | --- a/hw/watchdog/wdt_diag288.c | ||
480 | +++ b/hw/watchdog/wdt_diag288.c | ||
481 | @@ -XXX,XX +XXX,XX @@ static void wdt_diag288_unrealize(DeviceState *dev) | ||
482 | { | ||
483 | DIAG288State *diag288 = DIAG288(dev); | ||
484 | |||
485 | - timer_del(diag288->timer); | ||
486 | timer_free(diag288->timer); | ||
487 | } | ||
488 | |||
489 | diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c | ||
490 | index XXXXXXX..XXXXXXX 100644 | ||
491 | --- a/hw/watchdog/wdt_i6300esb.c | ||
492 | +++ b/hw/watchdog/wdt_i6300esb.c | ||
493 | @@ -XXX,XX +XXX,XX @@ static void i6300esb_exit(PCIDevice *dev) | ||
494 | { | ||
495 | I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev); | ||
496 | |||
497 | - timer_del(d->timer); | ||
498 | timer_free(d->timer); | ||
499 | } | ||
500 | |||
501 | diff --git a/migration/colo.c b/migration/colo.c | ||
502 | index XXXXXXX..XXXXXXX 100644 | ||
503 | --- a/migration/colo.c | ||
504 | +++ b/migration/colo.c | ||
505 | @@ -XXX,XX +XXX,XX @@ out: | ||
506 | * error. | ||
507 | */ | ||
508 | colo_compare_unregister_notifier(&packets_compare_notifier); | ||
509 | - timer_del(s->colo_delay_timer); | ||
510 | timer_free(s->colo_delay_timer); | ||
511 | qemu_event_destroy(&s->colo_checkpoint_event); | ||
512 | |||
513 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c | ||
514 | index XXXXXXX..XXXXXXX 100644 | ||
515 | --- a/monitor/hmp-cmds.c | ||
516 | +++ b/monitor/hmp-cmds.c | ||
517 | @@ -XXX,XX +XXX,XX @@ static void hmp_migrate_status_cb(void *opaque) | ||
518 | error_report("%s", info->error_desc); | ||
519 | } | ||
520 | monitor_resume(status->mon); | ||
521 | - timer_del(status->timer); | ||
522 | timer_free(status->timer); | ||
523 | g_free(status); | ||
524 | } | ||
525 | diff --git a/net/announce.c b/net/announce.c | ||
526 | index XXXXXXX..XXXXXXX 100644 | ||
527 | --- a/net/announce.c | ||
528 | +++ b/net/announce.c | ||
529 | @@ -XXX,XX +XXX,XX @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named) | ||
530 | { | ||
531 | bool free_timer = false; | ||
532 | if (timer->tm) { | ||
533 | - timer_del(timer->tm); | ||
534 | timer_free(timer->tm); | ||
535 | timer->tm = NULL; | ||
536 | } | ||
537 | diff --git a/net/colo-compare.c b/net/colo-compare.c | ||
538 | index XXXXXXX..XXXXXXX 100644 | ||
539 | --- a/net/colo-compare.c | ||
540 | +++ b/net/colo-compare.c | ||
541 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_timer_init(CompareState *s) | ||
542 | static void colo_compare_timer_del(CompareState *s) | ||
543 | { | ||
544 | if (s->packet_check_timer) { | ||
545 | - timer_del(s->packet_check_timer); | ||
546 | timer_free(s->packet_check_timer); | ||
547 | s->packet_check_timer = NULL; | ||
548 | } | ||
549 | diff --git a/net/slirp.c b/net/slirp.c | ||
550 | index XXXXXXX..XXXXXXX 100644 | ||
551 | --- a/net/slirp.c | ||
552 | +++ b/net/slirp.c | ||
553 | @@ -XXX,XX +XXX,XX @@ static void *net_slirp_timer_new(SlirpTimerCb cb, | ||
554 | |||
555 | static void net_slirp_timer_free(void *timer, void *opaque) | ||
556 | { | ||
557 | - timer_del(timer); | ||
558 | timer_free(timer); | ||
559 | } | ||
560 | |||
561 | diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c | ||
562 | index XXXXXXX..XXXXXXX 100644 | ||
563 | --- a/replay/replay-debugging.c | ||
564 | +++ b/replay/replay-debugging.c | ||
565 | @@ -XXX,XX +XXX,XX @@ static void replay_delete_break(void) | ||
566 | assert(replay_mutex_locked()); | ||
567 | |||
568 | if (replay_break_timer) { | ||
569 | - timer_del(replay_break_timer); | ||
570 | timer_free(replay_break_timer); | ||
571 | replay_break_timer = NULL; | ||
572 | } | ||
573 | diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c | ||
574 | index XXXXXXX..XXXXXXX 100644 | ||
575 | --- a/target/s390x/cpu.c | ||
576 | +++ b/target/s390x/cpu.c | ||
577 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_finalize(Object *obj) | ||
578 | #if !defined(CONFIG_USER_ONLY) | ||
579 | S390CPU *cpu = S390_CPU(obj); | ||
580 | |||
581 | - timer_del(cpu->env.tod_timer); | ||
582 | timer_free(cpu->env.tod_timer); | ||
583 | - timer_del(cpu->env.cpu_timer); | ||
584 | timer_free(cpu->env.cpu_timer); | ||
585 | |||
586 | qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu); | ||
587 | diff --git a/ui/console.c b/ui/console.c | ||
588 | index XXXXXXX..XXXXXXX 100644 | ||
589 | --- a/ui/console.c | ||
590 | +++ b/ui/console.c | ||
591 | @@ -XXX,XX +XXX,XX @@ static void gui_setup_refresh(DisplayState *ds) | ||
592 | timer_mod(ds->gui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); | ||
593 | } | ||
594 | if (!need_timer && ds->gui_timer != NULL) { | ||
595 | - timer_del(ds->gui_timer); | ||
596 | timer_free(ds->gui_timer); | ||
597 | ds->gui_timer = NULL; | ||
598 | } | ||
599 | diff --git a/ui/spice-core.c b/ui/spice-core.c | ||
600 | index XXXXXXX..XXXXXXX 100644 | ||
601 | --- a/ui/spice-core.c | ||
602 | +++ b/ui/spice-core.c | ||
603 | @@ -XXX,XX +XXX,XX @@ static void timer_cancel(SpiceTimer *timer) | ||
604 | |||
605 | static void timer_remove(SpiceTimer *timer) | ||
606 | { | ||
607 | - timer_del(timer->timer); | ||
608 | timer_free(timer->timer); | ||
609 | g_free(timer); | ||
610 | } | ||
611 | diff --git a/util/throttle.c b/util/throttle.c | ||
612 | index XXXXXXX..XXXXXXX 100644 | ||
613 | --- a/util/throttle.c | ||
614 | +++ b/util/throttle.c | ||
615 | @@ -XXX,XX +XXX,XX @@ static void throttle_timer_destroy(QEMUTimer **timer) | ||
616 | { | ||
617 | assert(*timer != NULL); | ||
618 | |||
619 | - timer_del(*timer); | ||
620 | timer_free(*timer); | ||
621 | *timer = NULL; | ||
622 | } | ||
46 | -- | 623 | -- |
47 | 2.18.0 | 624 | 2.20.1 |
48 | 625 | ||
49 | 626 | diff view generated by jsdifflib |
1 | Implement the AArch32 HVBAR register; we can do this just by | 1 | The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(), |
---|---|---|---|
2 | making the existing VBAR_EL2 regdefs be STATE_BOTH. | 2 | timer_free() to free the timer. The timer_deinit() step in this was always |
3 | unnecessary, and now the timer_del() is implied by timer_free(), so we can | ||
4 | collapse this down to simply calling timer_free(). | ||
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: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180814124254.5229-5-peter.maydell@linaro.org | 9 | Message-id: 20201215154107.3255-5-peter.maydell@linaro.org |
8 | --- | 10 | --- |
9 | target/arm/helper.c | 4 ++-- | 11 | target/arm/cpu.c | 2 -- |
10 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | 1 file changed, 2 deletions(-) |
11 | 13 | ||
12 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/helper.c | 16 | --- a/target/arm/cpu.c |
15 | +++ b/target/arm/helper.c | 17 | +++ b/target/arm/cpu.c |
16 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 18 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_finalizefn(Object *obj) |
17 | 19 | } | |
18 | /* Used to describe the behaviour of EL2 regs when EL2 does not exist. */ | 20 | #ifndef CONFIG_USER_ONLY |
19 | static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | 21 | if (cpu->pmu_timer) { |
20 | - { .name = "VBAR_EL2", .state = ARM_CP_STATE_AA64, | 22 | - timer_del(cpu->pmu_timer); |
21 | + { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH, | 23 | - timer_deinit(cpu->pmu_timer); |
22 | .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0, | 24 | timer_free(cpu->pmu_timer); |
23 | .access = PL2_RW, | 25 | } |
24 | .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, | 26 | #endif |
25 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
26 | .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 0, | ||
27 | .access = PL2_RW, | ||
28 | .fieldoffset = offsetof(CPUARMState, banked_spsr[BANK_HYP]) }, | ||
29 | - { .name = "VBAR_EL2", .state = ARM_CP_STATE_AA64, | ||
30 | + { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH, | ||
31 | .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0, | ||
32 | .access = PL2_RW, .writefn = vbar_write, | ||
33 | .fieldoffset = offsetof(CPUARMState, cp15.vbar_el[2]), | ||
34 | -- | 27 | -- |
35 | 2.18.0 | 28 | 2.20.1 |
36 | 29 | ||
37 | 30 | diff view generated by jsdifflib |
1 | Move the m48t59 device away from using old_mmio MemoryRegionOps | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | accessors. | ||
3 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | ||
4 | digic_timer_init function, so use ptimer_free() in the finalize function to | ||
5 | avoid it. | ||
6 | |||
7 | ASAN shows memory leak stack: | ||
8 | |||
9 | Indirect leak of 288 byte(s) in 3 object(s) allocated from: | ||
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
12 | #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 | ||
13 | #3 0xaaabf5b04084 in digic_timer_init /qemu/hw/timer/digic-timer.c:142 | ||
14 | #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
15 | #5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564 | ||
16 | #6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547 | ||
17 | #7 0xaaabf5b40e84 in digic_init /qemu/hw/arm/digic.c:46 | ||
18 | #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
19 | #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
20 | #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
21 | #11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59 | ||
22 | #12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 | ||
23 | |||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
7 | Message-id: 20180802180602.22047-1-peter.maydell@linaro.org | ||
8 | --- | 28 | --- |
9 | hw/timer/m48t59.c | 59 +++++++++-------------------------------------- | 29 | hw/timer/digic-timer.c | 8 ++++++++ |
10 | 1 file changed, 11 insertions(+), 48 deletions(-) | 30 | 1 file changed, 8 insertions(+) |
11 | 31 | ||
12 | diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c | 32 | diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c |
13 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/timer/m48t59.c | 34 | --- a/hw/timer/digic-timer.c |
15 | +++ b/hw/timer/m48t59.c | 35 | +++ b/hw/timer/digic-timer.c |
16 | @@ -XXX,XX +XXX,XX @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size) | 36 | @@ -XXX,XX +XXX,XX @@ static void digic_timer_init(Object *obj) |
17 | return retval; | 37 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); |
18 | } | 38 | } |
19 | 39 | ||
20 | -static void nvram_writeb (void *opaque, hwaddr addr, uint32_t value) | 40 | +static void digic_timer_finalize(Object *obj) |
21 | -{ | 41 | +{ |
22 | - M48t59State *NVRAM = opaque; | 42 | + DigicTimerState *s = DIGIC_TIMER(obj); |
23 | - | 43 | + |
24 | - m48t59_write(NVRAM, addr, value & 0xff); | 44 | + ptimer_free(s->ptimer); |
25 | -} | 45 | +} |
26 | - | 46 | + |
27 | -static void nvram_writew (void *opaque, hwaddr addr, uint32_t value) | 47 | static void digic_timer_class_init(ObjectClass *klass, void *class_data) |
28 | -{ | ||
29 | - M48t59State *NVRAM = opaque; | ||
30 | - | ||
31 | - m48t59_write(NVRAM, addr, (value >> 8) & 0xff); | ||
32 | - m48t59_write(NVRAM, addr + 1, value & 0xff); | ||
33 | -} | ||
34 | - | ||
35 | -static void nvram_writel (void *opaque, hwaddr addr, uint32_t value) | ||
36 | -{ | ||
37 | - M48t59State *NVRAM = opaque; | ||
38 | - | ||
39 | - m48t59_write(NVRAM, addr, (value >> 24) & 0xff); | ||
40 | - m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); | ||
41 | - m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff); | ||
42 | - m48t59_write(NVRAM, addr + 3, value & 0xff); | ||
43 | -} | ||
44 | - | ||
45 | -static uint32_t nvram_readb (void *opaque, hwaddr addr) | ||
46 | +static uint64_t nvram_read(void *opaque, hwaddr addr, unsigned size) | ||
47 | { | 48 | { |
48 | M48t59State *NVRAM = opaque; | 49 | DeviceClass *dc = DEVICE_CLASS(klass); |
49 | 50 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo digic_timer_info = { | |
50 | return m48t59_read(NVRAM, addr); | 51 | .parent = TYPE_SYS_BUS_DEVICE, |
51 | } | 52 | .instance_size = sizeof(DigicTimerState), |
52 | 53 | .instance_init = digic_timer_init, | |
53 | -static uint32_t nvram_readw (void *opaque, hwaddr addr) | 54 | + .instance_finalize = digic_timer_finalize, |
54 | +static void nvram_write(void *opaque, hwaddr addr, uint64_t value, | 55 | .class_init = digic_timer_class_init, |
55 | + unsigned size) | ||
56 | { | ||
57 | M48t59State *NVRAM = opaque; | ||
58 | - uint32_t retval; | ||
59 | |||
60 | - retval = m48t59_read(NVRAM, addr) << 8; | ||
61 | - retval |= m48t59_read(NVRAM, addr + 1); | ||
62 | - return retval; | ||
63 | -} | ||
64 | - | ||
65 | -static uint32_t nvram_readl (void *opaque, hwaddr addr) | ||
66 | -{ | ||
67 | - M48t59State *NVRAM = opaque; | ||
68 | - uint32_t retval; | ||
69 | - | ||
70 | - retval = m48t59_read(NVRAM, addr) << 24; | ||
71 | - retval |= m48t59_read(NVRAM, addr + 1) << 16; | ||
72 | - retval |= m48t59_read(NVRAM, addr + 2) << 8; | ||
73 | - retval |= m48t59_read(NVRAM, addr + 3); | ||
74 | - return retval; | ||
75 | + return m48t59_write(NVRAM, addr, value); | ||
76 | } | ||
77 | |||
78 | static const MemoryRegionOps nvram_ops = { | ||
79 | - .old_mmio = { | ||
80 | - .read = { nvram_readb, nvram_readw, nvram_readl, }, | ||
81 | - .write = { nvram_writeb, nvram_writew, nvram_writel, }, | ||
82 | - }, | ||
83 | - .endianness = DEVICE_NATIVE_ENDIAN, | ||
84 | + .read = nvram_read, | ||
85 | + .write = nvram_write, | ||
86 | + .impl.min_access_size = 1, | ||
87 | + .impl.max_access_size = 1, | ||
88 | + .valid.min_access_size = 1, | ||
89 | + .valid.max_access_size = 4, | ||
90 | + .endianness = DEVICE_BIG_ENDIAN, | ||
91 | }; | 56 | }; |
92 | 57 | ||
93 | static const VMStateDescription vmstate_m48t59 = { | ||
94 | -- | 58 | -- |
95 | 2.18.0 | 59 | 2.20.1 |
96 | 60 | ||
97 | 61 | diff view generated by jsdifflib |
1 | On real v7M hardware, the NMI line is an externally visible signal | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | that an SoC or board can toggle to assert an NMI. Expose it in | ||
3 | our QEMU NVIC and armv7m container objects so that a board model | ||
4 | can wire it up if it needs to. | ||
5 | 2 | ||
6 | In particular, the MPS2 watchdog is wired to NMI. | 3 | When running device-introspect-test, a memory leak occurred in the a10_pit_init |
4 | function, so use ptimer_free() in the finalize function to avoid it. | ||
7 | 5 | ||
6 | ASAN shows memory leak stack: | ||
7 | |||
8 | Indirect leak of 288 byte(s) in 6 object(s) allocated from: | ||
9 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
10 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
11 | #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 | ||
12 | #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 | ||
13 | #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 | ||
14 | #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 | ||
15 | #6 0xaaabf57415e8 in a10_pit_init /qemu/hw/timer/allwinner-a10-pit.c:278 | ||
16 | #7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
17 | #8 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564 | ||
18 | #9 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547 | ||
19 | #10 0xaaabf5b94680 in aw_a10_init /qemu/hw/arm/allwinner-a10.c:49 | ||
20 | #11 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
21 | #12 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
22 | |||
23 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
24 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
25 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | --- | 27 | --- |
11 | hw/arm/armv7m.c | 1 + | 28 | hw/timer/allwinner-a10-pit.c | 11 +++++++++++ |
12 | hw/intc/armv7m_nvic.c | 19 +++++++++++++++++++ | 29 | 1 file changed, 11 insertions(+) |
13 | hw/intc/trace-events | 1 + | ||
14 | 3 files changed, 21 insertions(+) | ||
15 | 30 | ||
16 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | 31 | diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c |
17 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/armv7m.c | 33 | --- a/hw/timer/allwinner-a10-pit.c |
19 | +++ b/hw/arm/armv7m.c | 34 | +++ b/hw/timer/allwinner-a10-pit.c |
20 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) | 35 | @@ -XXX,XX +XXX,XX @@ static void a10_pit_init(Object *obj) |
21 | */ | ||
22 | qdev_pass_gpios(DEVICE(&s->nvic), dev, NULL); | ||
23 | qdev_pass_gpios(DEVICE(&s->nvic), dev, "SYSRESETREQ"); | ||
24 | + qdev_pass_gpios(DEVICE(&s->nvic), dev, "NMI"); | ||
25 | |||
26 | /* Wire the NVIC up to the CPU */ | ||
27 | sbd = SYS_BUS_DEVICE(&s->nvic); | ||
28 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/intc/armv7m_nvic.c | ||
31 | +++ b/hw/intc/armv7m_nvic.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void set_irq_level(void *opaque, int n, int level) | ||
33 | } | 36 | } |
34 | } | 37 | } |
35 | 38 | ||
36 | +/* callback when external NMI line is changed */ | 39 | +static void a10_pit_finalize(Object *obj) |
37 | +static void nvic_nmi_trigger(void *opaque, int n, int level) | ||
38 | +{ | 40 | +{ |
39 | + NVICState *s = opaque; | 41 | + AwA10PITState *s = AW_A10_PIT(obj); |
42 | + int i; | ||
40 | + | 43 | + |
41 | + trace_nvic_set_nmi_level(level); | 44 | + for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) { |
42 | + | 45 | + ptimer_free(s->timer[i]); |
43 | + /* | ||
44 | + * The architecture doesn't specify whether NMI should share | ||
45 | + * the normal-interrupt behaviour of being resampled on | ||
46 | + * exception handler return. We choose not to, so just | ||
47 | + * set NMI pending here and don't track the current level. | ||
48 | + */ | ||
49 | + if (level) { | ||
50 | + armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false); | ||
51 | + } | 46 | + } |
52 | +} | 47 | +} |
53 | + | 48 | + |
54 | static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | 49 | static void a10_pit_class_init(ObjectClass *klass, void *data) |
55 | { | 50 | { |
56 | ARMCPU *cpu = s->cpu; | 51 | DeviceClass *dc = DEVICE_CLASS(klass); |
57 | @@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_instance_init(Object *obj) | 52 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo a10_pit_info = { |
58 | qdev_init_gpio_out_named(dev, &nvic->sysresetreq, "SYSRESETREQ", 1); | 53 | .parent = TYPE_SYS_BUS_DEVICE, |
59 | qdev_init_gpio_in_named(dev, nvic_systick_trigger, "systick-trigger", | 54 | .instance_size = sizeof(AwA10PITState), |
60 | M_REG_NUM_BANKS); | 55 | .instance_init = a10_pit_init, |
61 | + qdev_init_gpio_in_named(dev, nvic_nmi_trigger, "NMI", 1); | 56 | + .instance_finalize = a10_pit_finalize, |
62 | } | 57 | .class_init = a10_pit_class_init, |
63 | 58 | }; | |
64 | static void armv7m_nvic_class_init(ObjectClass *klass, void *data) | ||
65 | diff --git a/hw/intc/trace-events b/hw/intc/trace-events | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/hw/intc/trace-events | ||
68 | +++ b/hw/intc/trace-events | ||
69 | @@ -XXX,XX +XXX,XX @@ nvic_acknowledge_irq(int irq, int prio) "NVIC acknowledge IRQ: %d now active (pr | ||
70 | nvic_get_pending_irq_info(int irq, bool secure) "NVIC next IRQ %d: targets_secure: %d" | ||
71 | nvic_complete_irq(int irq, bool secure) "NVIC complete IRQ %d (secure %d)" | ||
72 | nvic_set_irq_level(int irq, int level) "NVIC external irq %d level set to %d" | ||
73 | +nvic_set_nmi_level(int level) "NVIC external NMI level set to %d" | ||
74 | nvic_sysreg_read(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" | ||
75 | nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" | ||
76 | 59 | ||
77 | -- | 60 | -- |
78 | 2.18.0 | 61 | 2.20.1 |
79 | 62 | ||
80 | 63 | diff view generated by jsdifflib |
1 | The AArch32 virtualization extensions support these fault address | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | registers: | ||
3 | * HDFAR: aliased with AArch64 FAR_EL2[31:0] and AArch32 DFAR(S) | ||
4 | * HIFAR: aliased with AArch64 FAR_EL2[63:32] and AArch32 IFAR(S) | ||
5 | 2 | ||
6 | Implement the accessors for these. This fixes in passing a bug | 3 | When running device-introspect-test, a memory leak occurred in the |
7 | where we weren't implementing the "RES0 from EL3 if EL2 not | 4 | exynos4210_rtc_init function, so use ptimer_free() in the finalize function to |
8 | implemented" behaviour for AArch64 FAR_EL2. | 5 | avoid it. |
9 | 6 | ||
7 | ASAN shows memory leak stack: | ||
8 | |||
9 | Indirect leak of 96 byte(s) in 1 object(s) allocated from: | ||
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
12 | #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 | ||
13 | #3 0xaaabf57b3934 in exynos4210_rtc_init /qemu/hw/rtc/exynos4210_rtc.c:567 | ||
14 | #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
15 | #5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
16 | #6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
17 | #7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59 | ||
18 | #8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 | ||
19 | #9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 | ||
20 | #10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164 | ||
21 | #11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381 | ||
22 | #12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306 | ||
23 | |||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
12 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
13 | Message-id: 20180814124254.5229-7-peter.maydell@linaro.org | ||
14 | --- | 28 | --- |
15 | target/arm/helper.c | 14 +++++++++++++- | 29 | hw/rtc/exynos4210_rtc.c | 9 +++++++++ |
16 | 1 file changed, 13 insertions(+), 1 deletion(-) | 30 | 1 file changed, 9 insertions(+) |
17 | 31 | ||
18 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 32 | diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c |
19 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.c | 34 | --- a/hw/rtc/exynos4210_rtc.c |
21 | +++ b/target/arm/helper.c | 35 | +++ b/hw/rtc/exynos4210_rtc.c |
22 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | 36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_rtc_init(Object *obj) |
23 | { .name = "HSTR_EL2", .state = ARM_CP_STATE_BOTH, | 37 | sysbus_init_mmio(dev, &s->iomem); |
24 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3, | 38 | } |
25 | .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 39 | |
26 | + { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH, | 40 | +static void exynos4210_rtc_finalize(Object *obj) |
27 | + .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0, | 41 | +{ |
28 | + .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 42 | + Exynos4210RTCState *s = EXYNOS4210_RTC(obj); |
29 | + { .name = "HIFAR", .state = ARM_CP_STATE_AA32, | 43 | + |
30 | + .type = ARM_CP_CONST, | 44 | + ptimer_free(s->ptimer); |
31 | + .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2, | 45 | + ptimer_free(s->ptimer_1Hz); |
32 | + .access = PL2_RW, .resetvalue = 0 }, | 46 | +} |
33 | REGINFO_SENTINEL | 47 | + |
48 | static void exynos4210_rtc_class_init(ObjectClass *klass, void *data) | ||
49 | { | ||
50 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
51 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_rtc_info = { | ||
52 | .parent = TYPE_SYS_BUS_DEVICE, | ||
53 | .instance_size = sizeof(Exynos4210RTCState), | ||
54 | .instance_init = exynos4210_rtc_init, | ||
55 | + .instance_finalize = exynos4210_rtc_finalize, | ||
56 | .class_init = exynos4210_rtc_class_init, | ||
34 | }; | 57 | }; |
35 | 58 | ||
36 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
37 | { .name = "ESR_EL2", .state = ARM_CP_STATE_AA64, | ||
38 | .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, | ||
39 | .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.esr_el[2]) }, | ||
40 | - { .name = "FAR_EL2", .state = ARM_CP_STATE_AA64, | ||
41 | + { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH, | ||
42 | .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0, | ||
43 | .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.far_el[2]) }, | ||
44 | + { .name = "HIFAR", .state = ARM_CP_STATE_AA32, | ||
45 | + .type = ARM_CP_ALIAS, | ||
46 | + .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2, | ||
47 | + .access = PL2_RW, | ||
48 | + .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[2]) }, | ||
49 | { .name = "SPSR_EL2", .state = ARM_CP_STATE_AA64, | ||
50 | .type = ARM_CP_ALIAS, | ||
51 | .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 0, | ||
52 | -- | 59 | -- |
53 | 2.18.0 | 60 | 2.20.1 |
54 | 61 | ||
55 | 62 | diff view generated by jsdifflib |
1 | From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com> | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Generate an interrupt if USR2_RDR and UCR4_DREN are both set. | 3 | When running device-introspect-test, a memory leak occurred in the |
4 | exynos4210_pwm_init function, so use ptimer_free() in the finalize function to | ||
5 | avoid it. | ||
4 | 6 | ||
5 | Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com> | 7 | ASAN shows memory leak stack: |
6 | Message-id: 1534341354-11956-1-git-send-email-hans-erik.floryd@rt-labs.com | 8 | |
9 | Indirect leak of 240 byte(s) in 5 object(s) allocated from: | ||
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
12 | #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 | ||
13 | #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 | ||
14 | #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 | ||
15 | #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 | ||
16 | #6 0xaaabf56a36cc in exynos4210_pwm_init /qemu/hw/timer/exynos4210_pwm.c:401 | ||
17 | #7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
18 | #8 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
19 | #9 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
20 | #10 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59 | ||
21 | #11 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 | ||
22 | #12 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 | ||
23 | |||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 28 | --- |
10 | include/hw/char/imx_serial.h | 1 + | 29 | hw/timer/exynos4210_pwm.c | 11 +++++++++++ |
11 | hw/char/imx_serial.c | 3 ++- | 30 | 1 file changed, 11 insertions(+) |
12 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
13 | 31 | ||
14 | diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h | 32 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c |
15 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/hw/char/imx_serial.h | 34 | --- a/hw/timer/exynos4210_pwm.c |
17 | +++ b/include/hw/char/imx_serial.h | 35 | +++ b/hw/timer/exynos4210_pwm.c |
18 | @@ -XXX,XX +XXX,XX @@ | 36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_init(Object *obj) |
19 | #define UCR2_RXEN (1<<1) /* Receiver enable */ | 37 | sysbus_init_mmio(dev, &s->iomem); |
20 | #define UCR2_SRST (1<<0) /* Reset complete */ | 38 | } |
21 | 39 | ||
22 | +#define UCR4_DREN BIT(0) /* Receive Data Ready interrupt enable */ | 40 | +static void exynos4210_pwm_finalize(Object *obj) |
23 | #define UCR4_TCEN BIT(3) /* TX complete interrupt enable */ | 41 | +{ |
24 | 42 | + Exynos4210PWMState *s = EXYNOS4210_PWM(obj); | |
25 | #define UTS1_TXEMPTY (1<<6) | 43 | + int i; |
26 | diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c | 44 | + |
27 | index XXXXXXX..XXXXXXX 100644 | 45 | + for (i = 0; i < EXYNOS4210_PWM_TIMERS_NUM; i++) { |
28 | --- a/hw/char/imx_serial.c | 46 | + ptimer_free(s->timer[i].ptimer); |
29 | +++ b/hw/char/imx_serial.c | 47 | + } |
30 | @@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s) | 48 | +} |
31 | mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0; | 49 | + |
32 | /* | 50 | static void exynos4210_pwm_class_init(ObjectClass *klass, void *data) |
33 | * TCEN and TXDC are both bit 3 | 51 | { |
34 | + * RDR and DREN are both bit 0 | 52 | DeviceClass *dc = DEVICE_CLASS(klass); |
35 | */ | 53 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_pwm_info = { |
36 | - mask |= s->ucr4 & UCR4_TCEN; | 54 | .parent = TYPE_SYS_BUS_DEVICE, |
37 | + mask |= s->ucr4 & (UCR4_TCEN | UCR4_DREN); | 55 | .instance_size = sizeof(Exynos4210PWMState), |
38 | 56 | .instance_init = exynos4210_pwm_init, | |
39 | usr2 = s->usr2 & mask; | 57 | + .instance_finalize = exynos4210_pwm_finalize, |
58 | .class_init = exynos4210_pwm_class_init, | ||
59 | }; | ||
40 | 60 | ||
41 | -- | 61 | -- |
42 | 2.18.0 | 62 | 2.20.1 |
43 | 63 | ||
44 | 64 | diff view generated by jsdifflib |
1 | The PL080/PL081 model is missing a reset function; implement it. | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | ||
4 | mss_timer_init function, so use ptimer_free() in the finalize function to avoid | ||
5 | it. | ||
6 | |||
7 | ASAN shows memory leak stack: | ||
8 | |||
9 | Indirect leak of 192 byte(s) in 2 object(s) allocated from: | ||
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
12 | #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 | ||
13 | #3 0xaaabf58a0010 in mss_timer_init /qemu/hw/timer/mss-timer.c:235 | ||
14 | #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
15 | #5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564 | ||
16 | #6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547 | ||
17 | #7 0xaaabf5b8316c in m2sxxx_soc_initfn /qemu/hw/arm/msf2-soc.c:70 | ||
18 | #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
19 | #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
20 | #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
21 | #11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59 | ||
22 | #12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 | ||
23 | |||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | --- | 28 | --- |
6 | hw/dma/pl080.c | 25 +++++++++++++++++++++++++ | 29 | hw/timer/mss-timer.c | 13 +++++++++++++ |
7 | 1 file changed, 25 insertions(+) | 30 | 1 file changed, 13 insertions(+) |
8 | 31 | ||
9 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | 32 | diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c |
10 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/dma/pl080.c | 34 | --- a/hw/timer/mss-timer.c |
12 | +++ b/hw/dma/pl080.c | 35 | +++ b/hw/timer/mss-timer.c |
13 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps pl080_ops = { | 36 | @@ -XXX,XX +XXX,XX @@ static void mss_timer_init(Object *obj) |
14 | .endianness = DEVICE_NATIVE_ENDIAN, | 37 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &t->mmio); |
15 | }; | 38 | } |
16 | 39 | ||
17 | +static void pl080_reset(DeviceState *dev) | 40 | +static void mss_timer_finalize(Object *obj) |
18 | +{ | 41 | +{ |
19 | + PL080State *s = PL080(dev); | 42 | + MSSTimerState *t = MSS_TIMER(obj); |
20 | + int i; | 43 | + int i; |
21 | + | 44 | + |
22 | + s->tc_int = 0; | 45 | + for (i = 0; i < NUM_TIMERS; i++) { |
23 | + s->tc_mask = 0; | 46 | + struct Msf2Timer *st = &t->timers[i]; |
24 | + s->err_int = 0; | ||
25 | + s->err_mask = 0; | ||
26 | + s->conf = 0; | ||
27 | + s->sync = 0; | ||
28 | + s->req_single = 0; | ||
29 | + s->req_burst = 0; | ||
30 | + s->running = 0; | ||
31 | + | 47 | + |
32 | + for (i = 0; i < s->nchannels; i++) { | 48 | + ptimer_free(st->ptimer); |
33 | + s->chan[i].src = 0; | ||
34 | + s->chan[i].dest = 0; | ||
35 | + s->chan[i].lli = 0; | ||
36 | + s->chan[i].ctrl = 0; | ||
37 | + s->chan[i].conf = 0; | ||
38 | + } | 49 | + } |
39 | +} | 50 | +} |
40 | + | 51 | + |
41 | static void pl080_init(Object *obj) | 52 | static const VMStateDescription vmstate_timers = { |
42 | { | 53 | .name = "mss-timer-block", |
43 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 54 | .version_id = 1, |
44 | @@ -XXX,XX +XXX,XX @@ static void pl080_class_init(ObjectClass *oc, void *data) | 55 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo mss_timer_info = { |
45 | dc->vmsd = &vmstate_pl080; | 56 | .parent = TYPE_SYS_BUS_DEVICE, |
46 | dc->realize = pl080_realize; | 57 | .instance_size = sizeof(MSSTimerState), |
47 | dc->props = pl080_properties; | 58 | .instance_init = mss_timer_init, |
48 | + dc->reset = pl080_reset; | 59 | + .instance_finalize = mss_timer_finalize, |
49 | } | 60 | .class_init = mss_timer_class_init, |
50 | 61 | }; | |
51 | static const TypeInfo pl080_info = { | 62 | |
52 | -- | 63 | -- |
53 | 2.18.0 | 64 | 2.20.1 |
54 | 65 | ||
55 | 66 | diff view generated by jsdifflib |
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The generic loader device supports the U-Boot and Intel HEX executable | 3 | When running device-introspect-test, a memory leak occurred in the |
4 | formats in addition to the document raw and ELF formats. Reword the | 4 | mv88w8618_pit_init function, so use ptimer_free() in the finalize function to |
5 | documentation to include these formats and explain how various options | 5 | avoid it. |
6 | depend on the executable format. | ||
7 | 6 | ||
8 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 7 | ASAN shows memory leak stack: |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | |
10 | Message-id: 20180816145554.9814-1-stefanha@redhat.com | 9 | Indirect leak of 192 byte(s) in 4 object(s) allocated from: |
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | ||
12 | #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 | ||
13 | #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 | ||
14 | #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 | ||
15 | #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 | ||
16 | #6 0xaaabf5bb2290 in mv88w8618_timer_init /qemu/hw/arm/musicpal.c:862 | ||
17 | #7 0xaaabf5bb2290 in mv88w8618_pit_init /qemu/hw/arm/musicpal.c:954 | ||
18 | #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
19 | #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
20 | #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
21 | #11 0xaaabf5a95540 in qdev_device_help /qemu/softmmu/qdev-monitor.c:283 | ||
22 | #12 0xaaabf5a96940 in qmp_device_add /qemu/softmmu/qdev-monitor.c:801 | ||
23 | |||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 28 | --- |
14 | docs/generic-loader.txt | 20 ++++++++++---------- | 29 | hw/arm/musicpal.c | 12 ++++++++++++ |
15 | 1 file changed, 10 insertions(+), 10 deletions(-) | 30 | 1 file changed, 12 insertions(+) |
16 | 31 | ||
17 | diff --git a/docs/generic-loader.txt b/docs/generic-loader.txt | 32 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
18 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/docs/generic-loader.txt | 34 | --- a/hw/arm/musicpal.c |
20 | +++ b/docs/generic-loader.txt | 35 | +++ b/hw/arm/musicpal.c |
21 | @@ -XXX,XX +XXX,XX @@ An example of setting CPU 0's PC to 0x8000 is: | 36 | @@ -XXX,XX +XXX,XX @@ static void mv88w8618_pit_init(Object *obj) |
22 | 37 | sysbus_init_mmio(dev, &s->iomem); | |
23 | Loading Files | 38 | } |
24 | ------------- | 39 | |
25 | -The loader device also allows files to be loaded into memory. It can load raw | 40 | +static void mv88w8618_pit_finalize(Object *obj) |
26 | -files and ELF executable files. Raw files are loaded verbatim. ELF executable | 41 | +{ |
27 | -files are loaded by an ELF loader. The syntax is shown below: | 42 | + SysBusDevice *dev = SYS_BUS_DEVICE(obj); |
28 | +The loader device also allows files to be loaded into memory. It can load ELF, | 43 | + mv88w8618_pit_state *s = MV88W8618_PIT(dev); |
29 | +U-Boot, and Intel HEX executable formats as well as raw images. The syntax is | 44 | + int i; |
30 | +shown below: | 45 | + |
31 | 46 | + for (i = 0; i < 4; i++) { | |
32 | -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>] | 47 | + ptimer_free(s->timer[i].ptimer); |
33 | 48 | + } | |
34 | <file> - A file to be loaded into memory | 49 | +} |
35 | - <addr> - The addr in memory that the file should be loaded. This is | 50 | + |
36 | - ignored if you are using an ELF (unless force-raw is true). | 51 | static const VMStateDescription mv88w8618_timer_vmsd = { |
37 | - This is required if you aren't loading an ELF. | 52 | .name = "timer", |
38 | + <addr> - The memory address where the file should be loaded. This is | 53 | .version_id = 1, |
39 | + required for raw images and ignored for non-raw files. | 54 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo mv88w8618_pit_info = { |
40 | <cpu-num> - This specifies the CPU that should be used. This is an | 55 | .parent = TYPE_SYS_BUS_DEVICE, |
41 | optional argument and will cause the CPU's PC to be set to | 56 | .instance_size = sizeof(mv88w8618_pit_state), |
42 | - where the image is stored or in the case of an ELF file to | 57 | .instance_init = mv88w8618_pit_init, |
43 | - the value in the header. This option should only be used | 58 | + .instance_finalize = mv88w8618_pit_finalize, |
44 | - for the boot image. | 59 | .class_init = mv88w8618_pit_class_init, |
45 | + the memory address where the raw file is loaded or the entry | 60 | }; |
46 | + point specified in the executable format header. This option | 61 | |
47 | + should only be used for the boot image. | ||
48 | This will also cause the image to be written to the specified | ||
49 | CPU's address space. If not specified, the default is CPU 0. | ||
50 | <force-raw> - Setting force-raw=on forces the file to be treated as a raw | ||
51 | - image. This can be used to load ELF files as if they were raw. | ||
52 | + image. This can be used to load supported executable formats | ||
53 | + as if they were raw. | ||
54 | |||
55 | All values are parsed using the standard QemuOps parsing. This allows the user | ||
56 | to specify any values in any format supported. By default the values | ||
57 | -- | 62 | -- |
58 | 2.18.0 | 63 | 2.20.1 |
59 | 64 | ||
60 | 65 | diff view generated by jsdifflib |
1 | From: Roman Kapl <rka@sysgo.com> | 1 | From: Gan Qixin <ganqixin@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | If an instruction is conditional (like CBZ) and it is executed | 3 | When running device-introspect-test, a memory leak occurred in the |
4 | conditionally (using the ITx instruction), a jump to an undefined | 4 | exynos4210_mct_init function, so use ptimer_free() in the finalize function to |
5 | label is generated, and QEMU crashes. | 5 | avoid it. |
6 | 6 | ||
7 | CBZ in IT block is an UNPREDICTABLE behavior, but we should not | 7 | ASAN shows memory leak stack: |
8 | crash. Honouring the condition code is allowed by the spec in this | ||
9 | case (constrained unpredictable, ARMv8, section K1.1.7), and matches | ||
10 | what we do for other "UNPREDICTABLE inside an IT block" instructions. | ||
11 | 8 | ||
12 | Fix the 'skip on condition' code to create a new label only if it | 9 | Indirect leak of 96 byte(s) in 1 object(s) allocated from: |
13 | does not already exist. Previously multiple labels were created, but | 10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) |
14 | only the last one of them was set. | 11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) |
12 | #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 | ||
13 | #3 0xaaabf56b01a0 in exynos4210_mct_init /qemu/hw/timer/exynos4210_mct.c:1505 | ||
14 | #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 | ||
15 | #5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 | ||
16 | #6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153 | ||
17 | #7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59 | ||
18 | #8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 | ||
19 | #9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 | ||
20 | #10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164 | ||
21 | #11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381 | ||
22 | #12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306 | ||
15 | 23 | ||
16 | Signed-off-by: Roman Kapl <rka@sysgo.com> | 24 | Reported-by: Euler Robot <euler.robot@huawei.com> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> |
18 | Message-id: 20180816120533.6587-1-rka@sysgo.com | ||
19 | [PMM: fixed ^ 1 being applied to wrong argument, fixed typo] | ||
20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | --- | 28 | --- |
23 | target/arm/translate.c | 35 +++++++++++++++++++++-------------- | 29 | hw/timer/exynos4210_mct.c | 14 ++++++++++++++ |
24 | 1 file changed, 21 insertions(+), 14 deletions(-) | 30 | 1 file changed, 14 insertions(+) |
25 | 31 | ||
26 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 32 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c |
27 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/translate.c | 34 | --- a/hw/timer/exynos4210_mct.c |
29 | +++ b/target/arm/translate.c | 35 | +++ b/hw/timer/exynos4210_mct.c |
30 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | 36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_init(Object *obj) |
31 | s->base.is_jmp = DISAS_UPDATE; | 37 | sysbus_init_mmio(dev, &s->iomem); |
32 | } | 38 | } |
33 | 39 | ||
34 | +/* Generate a label used for skipping this instruction */ | 40 | +static void exynos4210_mct_finalize(Object *obj) |
35 | +static void arm_gen_condlabel(DisasContext *s) | ||
36 | +{ | 41 | +{ |
37 | + if (!s->condjmp) { | 42 | + int i; |
38 | + s->condlabel = gen_new_label(); | 43 | + Exynos4210MCTState *s = EXYNOS4210_MCT(obj); |
39 | + s->condjmp = 1; | 44 | + |
45 | + ptimer_free(s->g_timer.ptimer_frc); | ||
46 | + | ||
47 | + for (i = 0; i < 2; i++) { | ||
48 | + ptimer_free(s->l_timer[i].tick_timer.ptimer_tick); | ||
49 | + ptimer_free(s->l_timer[i].ptimer_frc); | ||
40 | + } | 50 | + } |
41 | +} | 51 | +} |
42 | + | 52 | + |
43 | +/* Skip this instruction if the ARM condition is false */ | 53 | static void exynos4210_mct_class_init(ObjectClass *klass, void *data) |
44 | +static void arm_skip_unless(DisasContext *s, uint32_t cond) | ||
45 | +{ | ||
46 | + arm_gen_condlabel(s); | ||
47 | + arm_gen_test_cc(cond ^ 1, s->condlabel); | ||
48 | +} | ||
49 | + | ||
50 | static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
51 | { | 54 | { |
52 | unsigned int cond, val, op1, i, shift, rm, rs, rn, rd, sh; | 55 | DeviceClass *dc = DEVICE_CLASS(klass); |
53 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 56 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_mct_info = { |
54 | if (cond != 0xe) { | 57 | .parent = TYPE_SYS_BUS_DEVICE, |
55 | /* if not always execute, we generate a conditional jump to | 58 | .instance_size = sizeof(Exynos4210MCTState), |
56 | next instruction */ | 59 | .instance_init = exynos4210_mct_init, |
57 | - s->condlabel = gen_new_label(); | 60 | + .instance_finalize = exynos4210_mct_finalize, |
58 | - arm_gen_test_cc(cond ^ 1, s->condlabel); | 61 | .class_init = exynos4210_mct_class_init, |
59 | - s->condjmp = 1; | 62 | }; |
60 | + arm_skip_unless(s, cond); | ||
61 | } | ||
62 | if ((insn & 0x0f900000) == 0x03000000) { | ||
63 | if ((insn & (1 << 21)) == 0) { | ||
64 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
65 | /* Conditional branch. */ | ||
66 | op = (insn >> 22) & 0xf; | ||
67 | /* Generate a conditional jump to next instruction. */ | ||
68 | - s->condlabel = gen_new_label(); | ||
69 | - arm_gen_test_cc(op ^ 1, s->condlabel); | ||
70 | - s->condjmp = 1; | ||
71 | + arm_skip_unless(s, op); | ||
72 | |||
73 | /* offset[11:1] = insn[10:0] */ | ||
74 | offset = (insn & 0x7ff) << 1; | ||
75 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
76 | case 1: case 3: case 9: case 11: /* czb */ | ||
77 | rm = insn & 7; | ||
78 | tmp = load_reg(s, rm); | ||
79 | - s->condlabel = gen_new_label(); | ||
80 | - s->condjmp = 1; | ||
81 | + arm_gen_condlabel(s); | ||
82 | if (insn & (1 << 11)) | ||
83 | tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, s->condlabel); | ||
84 | else | ||
85 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
86 | break; | ||
87 | } | ||
88 | /* generate a conditional jump to next instruction */ | ||
89 | - s->condlabel = gen_new_label(); | ||
90 | - arm_gen_test_cc(cond ^ 1, s->condlabel); | ||
91 | - s->condjmp = 1; | ||
92 | + arm_skip_unless(s, cond); | ||
93 | |||
94 | /* jump to the offset */ | ||
95 | val = (uint32_t)s->pc + 2; | ||
96 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
97 | uint32_t cond = dc->condexec_cond; | ||
98 | |||
99 | if (cond != 0x0e) { /* Skip conditional when condition is AL. */ | ||
100 | - dc->condlabel = gen_new_label(); | ||
101 | - arm_gen_test_cc(cond ^ 1, dc->condlabel); | ||
102 | - dc->condjmp = 1; | ||
103 | + arm_skip_unless(dc, cond); | ||
104 | } | ||
105 | } | ||
106 | 63 | ||
107 | -- | 64 | -- |
108 | 2.18.0 | 65 | 2.20.1 |
109 | 66 | ||
110 | 67 | diff view generated by jsdifflib |
1 | The PL080 and PL081 have three outgoing interrupt lines: | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | * DMACINTERR signals DMA errors | ||
3 | * DMACINTTC is the DMA count interrupt | ||
4 | * DMACINTR is a combined interrupt, the logical OR of the other two | ||
5 | 2 | ||
6 | We currently only implement DMACINTR, because that's all the | 3 | U-Boot expects PMU_MISC0 register bit 7 is set (see init_bandgap() |
7 | realview and versatile boards needed, but the instances of the | 4 | in arch/arm/mach-imx/mx6/soc.c) during boot. This bit indicates the |
8 | PL081 in the MPS2 firmware images use all three interrupt lines. | 5 | bandgap has stabilized. |
9 | Implement the missing DMACINTERR and DMACINTTC. | ||
10 | 6 | ||
7 | With this change, the latest upstream U-Boot (v2021.01-rc3) for imx6 | ||
8 | sabrelite board (mx6qsabrelite_defconfig), with a slight change made | ||
9 | by switching CONFIG_OF_SEPARATE to CONFIG_OF_EMBED, boots to U-Boot | ||
10 | shell on QEMU with the following command: | ||
11 | |||
12 | $ qemu-system-arm -M sabrelite -smp 4 -m 1G -kernel u-boot \ | ||
13 | -display none -serial null -serial stdio | ||
14 | |||
15 | Boot log below: | ||
16 | |||
17 | U-Boot 2021.01-rc3 (Dec 12 2020 - 17:40:02 +0800) | ||
18 | |||
19 | CPU: Freescale i.MX?? rev1.0 at 792 MHz | ||
20 | Reset cause: POR | ||
21 | Model: Freescale i.MX6 Quad SABRE Lite Board | ||
22 | Board: SABRE Lite | ||
23 | I2C: ready | ||
24 | DRAM: 1 GiB | ||
25 | force_idle_bus: sda=0 scl=0 sda.gp=0x5c scl.gp=0x55 | ||
26 | force_idle_bus: failed to clear bus, sda=0 scl=0 | ||
27 | force_idle_bus: sda=0 scl=0 sda.gp=0x6d scl.gp=0x6c | ||
28 | force_idle_bus: failed to clear bus, sda=0 scl=0 | ||
29 | force_idle_bus: sda=0 scl=0 sda.gp=0xcb scl.gp=0x5 | ||
30 | force_idle_bus: failed to clear bus, sda=0 scl=0 | ||
31 | MMC: FSL_SDHC: 0, FSL_SDHC: 1 | ||
32 | Loading Environment from MMC... *** Warning - No block device, using default environment | ||
33 | |||
34 | In: serial | ||
35 | Out: serial | ||
36 | Err: serial | ||
37 | Net: Board Net Initialization Failed | ||
38 | No ethernet found. | ||
39 | starting USB... | ||
40 | Bus usb@2184000: usb dr_mode not found | ||
41 | USB EHCI 1.00 | ||
42 | Bus usb@2184200: USB EHCI 1.00 | ||
43 | scanning bus usb@2184000 for devices... 1 USB Device(s) found | ||
44 | scanning bus usb@2184200 for devices... 1 USB Device(s) found | ||
45 | scanning usb for storage devices... 0 Storage Device(s) found | ||
46 | scanning usb for ethernet devices... 0 Ethernet Device(s) found | ||
47 | Hit any key to stop autoboot: 0 | ||
48 | => | ||
49 | |||
50 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
51 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
52 | Message-id: 20210106063504.10841-2-bmeng.cn@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 53 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | --- | 54 | --- |
14 | include/hw/dma/pl080.h | 6 +++++- | 55 | hw/misc/imx6_ccm.c | 2 +- |
15 | hw/dma/pl080.c | 13 ++++++++----- | 56 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | 2 files changed, 13 insertions(+), 6 deletions(-) | ||
17 | 57 | ||
18 | diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h | 58 | diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c |
19 | index XXXXXXX..XXXXXXX 100644 | 59 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/dma/pl080.h | 60 | --- a/hw/misc/imx6_ccm.c |
21 | +++ b/include/hw/dma/pl080.h | 61 | +++ b/hw/misc/imx6_ccm.c |
22 | @@ -XXX,XX +XXX,XX @@ | 62 | @@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev) |
23 | * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0218e/DDI0218.pdf | 63 | s->analog[PMU_REG_3P0] = 0x00000F74; |
24 | * | 64 | s->analog[PMU_REG_2P5] = 0x00005071; |
25 | * QEMU interface: | 65 | s->analog[PMU_REG_CORE] = 0x00402010; |
26 | - * + sysbus IRQ: DMACINTR combined interrupt line | 66 | - s->analog[PMU_MISC0] = 0x04000000; |
27 | + * + sysbus IRQ 0: DMACINTR combined interrupt line | 67 | + s->analog[PMU_MISC0] = 0x04000080; |
28 | + * + sysbus IRQ 1: DMACINTERR error interrupt request | 68 | s->analog[PMU_MISC1] = 0x00000000; |
29 | + * + sysbus IRQ 2: DMACINTTC count interrupt request | 69 | s->analog[PMU_MISC2] = 0x00272727; |
30 | * + sysbus MMIO region 0: MemoryRegion for the device's registers | ||
31 | */ | ||
32 | |||
33 | @@ -XXX,XX +XXX,XX @@ typedef struct PL080State { | ||
34 | /* Flag to avoid recursive DMA invocations. */ | ||
35 | int running; | ||
36 | qemu_irq irq; | ||
37 | + qemu_irq interr; | ||
38 | + qemu_irq inttc; | ||
39 | } PL080State; | ||
40 | |||
41 | #endif | ||
42 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/hw/dma/pl080.c | ||
45 | +++ b/hw/dma/pl080.c | ||
46 | @@ -XXX,XX +XXX,XX @@ static const unsigned char pl081_id[] = | ||
47 | |||
48 | static void pl080_update(PL080State *s) | ||
49 | { | ||
50 | - if ((s->tc_int & s->tc_mask) | ||
51 | - || (s->err_int & s->err_mask)) | ||
52 | - qemu_irq_raise(s->irq); | ||
53 | - else | ||
54 | - qemu_irq_lower(s->irq); | ||
55 | + bool tclevel = (s->tc_int & s->tc_mask); | ||
56 | + bool errlevel = (s->err_int & s->err_mask); | ||
57 | + | ||
58 | + qemu_set_irq(s->interr, errlevel); | ||
59 | + qemu_set_irq(s->inttc, tclevel); | ||
60 | + qemu_set_irq(s->irq, errlevel || tclevel); | ||
61 | } | ||
62 | |||
63 | static void pl080_run(PL080State *s) | ||
64 | @@ -XXX,XX +XXX,XX @@ static void pl080_init(Object *obj) | ||
65 | memory_region_init_io(&s->iomem, OBJECT(s), &pl080_ops, s, "pl080", 0x1000); | ||
66 | sysbus_init_mmio(sbd, &s->iomem); | ||
67 | sysbus_init_irq(sbd, &s->irq); | ||
68 | + sysbus_init_irq(sbd, &s->interr); | ||
69 | + sysbus_init_irq(sbd, &s->inttc); | ||
70 | s->nchannels = 8; | ||
71 | } | ||
72 | 70 | ||
73 | -- | 71 | -- |
74 | 2.18.0 | 72 | 2.20.1 |
75 | 73 | ||
76 | 74 | diff view generated by jsdifflib |
1 | From: Jia He <hejianet@gmail.com> | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | 2 | ||
3 | In scripts/arch-run.bash of kvm-unit-tests, it will check the qemu | 3 | Currently when U-Boot boots, it prints "??" for i.MX processor: |
4 | output log with: | ||
5 | if [ -z "$(echo "$errors" | grep -vi warning)" ]; then | ||
6 | 4 | ||
7 | Thus without the warning prefix, all of the test fail. | 5 | CPU: Freescale i.MX?? rev1.0 at 792 MHz |
8 | 6 | ||
9 | Since it is not unrecoverable error in kvm_arm_its_reset for | 7 | The register that was used to determine the silicon type is |
10 | current implementation, downgrading the report from error to | 8 | undocumented in the latest IMX6DQRM (Rev. 6, 05/2020), but we |
11 | warn makes sense. | 9 | can refer to get_cpu_rev() in arch/arm/mach-imx/mx6/soc.c in |
10 | the U-Boot source codes that USB_ANALOG_DIGPROG is used. | ||
12 | 11 | ||
13 | Signed-off-by: Jia He <jia.he@hxt-semitech.com> | 12 | Update its reset value to indicate i.MX6Q. |
14 | Message-id: 1531969910-32843-1-git-send-email-jia.he@hxt-semitech.com | 13 | |
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Bin Meng <bin.meng@windriver.com> |
15 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
16 | Message-id: 20210106063504.10841-3-bmeng.cn@gmail.com | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 18 | --- |
18 | hw/intc/arm_gicv3_its_kvm.c | 2 +- | 19 | hw/misc/imx6_ccm.c | 2 +- |
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | 20 | 1 file changed, 1 insertion(+), 1 deletion(-) |
20 | 21 | ||
21 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | 22 | diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c |
22 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/intc/arm_gicv3_its_kvm.c | 24 | --- a/hw/misc/imx6_ccm.c |
24 | +++ b/hw/intc/arm_gicv3_its_kvm.c | 25 | +++ b/hw/misc/imx6_ccm.c |
25 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_reset(DeviceState *dev) | 26 | @@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev) |
26 | return; | 27 | s->analog[USB_ANALOG_USB2_VBUS_DETECT] = 0x00000004; |
27 | } | 28 | s->analog[USB_ANALOG_USB2_CHRG_DETECT] = 0x00000000; |
28 | 29 | s->analog[USB_ANALOG_USB2_MISC] = 0x00000002; | |
29 | - error_report("ITS KVM: full reset is not supported by the host kernel"); | 30 | - s->analog[USB_ANALOG_DIGPROG] = 0x00000000; |
30 | + warn_report("ITS KVM: full reset is not supported by the host kernel"); | 31 | + s->analog[USB_ANALOG_DIGPROG] = 0x00630000; |
31 | 32 | ||
32 | if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, | 33 | /* all PLLs need to be locked */ |
33 | GITS_CTLR)) { | 34 | s->analog[CCM_ANALOG_PLL_ARM] |= CCM_ANALOG_PLL_LOCK; |
34 | -- | 35 | -- |
35 | 2.18.0 | 36 | 2.20.1 |
36 | 37 | ||
37 | 38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We implement the HAMAIR1 register as RAZ/WI; we had a typo in the | ||
2 | regdef, though, and were incorrectly naming it HMAIR1 (which is | ||
3 | a different register which we also implement as RAZ/WI). | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
8 | Message-id: 20180814124254.5229-2-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/helper.c | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/helper.c | ||
16 | +++ b/target/arm/helper.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | ||
18 | .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0, | ||
19 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
20 | .resetvalue = 0 }, | ||
21 | - { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, | ||
22 | + { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, | ||
23 | .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
24 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
25 | .resetvalue = 0 }, | ||
26 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
27 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
28 | .resetvalue = 0 }, | ||
29 | /* HAMAIR1 is mapped to AMAIR_EL2[63:32] */ | ||
30 | - { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, | ||
31 | + { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, | ||
32 | .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
33 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
34 | .resetvalue = 0 }, | ||
35 | -- | ||
36 | 2.18.0 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | ARMCPRegInfo structs will default to .cp = 15 if they | ||
2 | are ARM_CP_STATE_BOTH, but not if they are ARM_CP_STATE_AA32 | ||
3 | (because a coprocessor number of 0 is valid for AArch32). | ||
4 | We forgot to explicitly set .cp = 15 for the HMAIR1 and | ||
5 | HAMAIR1 regdefs, which meant they would UNDEF when the guest | ||
6 | tried to access them under cp15. | ||
7 | 1 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
10 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
11 | Message-id: 20180814124254.5229-3-peter.maydell@linaro.org | ||
12 | --- | ||
13 | target/arm/helper.c | 8 ++++---- | ||
14 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/helper.c | ||
19 | +++ b/target/arm/helper.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | ||
21 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
22 | .resetvalue = 0 }, | ||
23 | { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, | ||
24 | - .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, | ||
25 | + .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, | ||
26 | .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
27 | { .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH, | ||
28 | .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0, | ||
29 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
30 | .resetvalue = 0 }, | ||
31 | { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, | ||
32 | - .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
33 | + .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
34 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
35 | .resetvalue = 0 }, | ||
36 | { .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH, | ||
37 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
38 | .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[2]), | ||
39 | .resetvalue = 0 }, | ||
40 | { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, | ||
41 | - .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, | ||
42 | + .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, | ||
43 | .access = PL2_RW, .type = ARM_CP_ALIAS, | ||
44 | .fieldoffset = offsetofhigh32(CPUARMState, cp15.mair_el[2]) }, | ||
45 | { .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH, | ||
46 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
47 | .resetvalue = 0 }, | ||
48 | /* HAMAIR1 is mapped to AMAIR_EL2[63:32] */ | ||
49 | { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, | ||
50 | - .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
51 | + .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | ||
52 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
53 | .resetvalue = 0 }, | ||
54 | { .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH, | ||
55 | -- | ||
56 | 2.18.0 | ||
57 | |||
58 | diff view generated by jsdifflib |
1 | A bug in the handling of the register address decode logic | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | for the PL08x meant that we were incorrectly treating | ||
3 | accesses to the DMA channel registers (DMACCxSrcAddr, | ||
4 | DMACCxDestaddr, DMACCxLLI, DMACCxControl, DMACCxConfiguration) | ||
5 | as bad offsets. Fix this long-standing bug. | ||
6 | 2 | ||
7 | Fixes: https://bugs.launchpad.net/qemu/+bug/1637974 | 3 | At present, when booting U-Boot on QEMU sabrelite, we see: |
4 | |||
5 | Net: Board Net Initialization Failed | ||
6 | No ethernet found. | ||
7 | |||
8 | U-Boot scans PHY at address 4/5/6/7 (see board_eth_init() in the | ||
9 | U-Boot source: board/boundary/nitrogen6x/nitrogen6x.c). On the real | ||
10 | board, the Ethernet PHY is at address 6. Adjust this by updating the | ||
11 | "fec-phy-num" property of the fsl_imx6 SoC object. | ||
12 | |||
13 | With this change, U-Boot sees the PHY but complains MAC address: | ||
14 | |||
15 | Net: using phy at 6 | ||
16 | FEC [PRIME] | ||
17 | Error: FEC address not set. | ||
18 | |||
19 | This is due to U-Boot tries to read the MAC address from the fuse, | ||
20 | which QEMU does not have any valid content filled in. However this | ||
21 | does not prevent the Ethernet from working in QEMU. We just need to | ||
22 | set up the MAC address later in the U-Boot command shell, by: | ||
23 | |||
24 | => setenv ethaddr 00:11:22:33:44:55 | ||
25 | |||
26 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
27 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
28 | Message-id: 20210106063504.10841-4-bmeng.cn@gmail.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | --- | 30 | --- |
11 | hw/dma/pl080.c | 5 +++-- | 31 | hw/arm/sabrelite.c | 4 ++++ |
12 | 1 file changed, 3 insertions(+), 2 deletions(-) | 32 | 1 file changed, 4 insertions(+) |
13 | 33 | ||
14 | diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c | 34 | diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c |
15 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/pl080.c | 36 | --- a/hw/arm/sabrelite.c |
17 | +++ b/hw/dma/pl080.c | 37 | +++ b/hw/arm/sabrelite.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl080_read(void *opaque, hwaddr offset, | 38 | @@ -XXX,XX +XXX,XX @@ static void sabrelite_init(MachineState *machine) |
19 | i = (offset & 0xe0) >> 5; | 39 | |
20 | if (i >= s->nchannels) | 40 | s = FSL_IMX6(object_new(TYPE_FSL_IMX6)); |
21 | goto bad_offset; | 41 | object_property_add_child(OBJECT(machine), "soc", OBJECT(s)); |
22 | - switch (offset >> 2) { | 42 | + |
23 | + switch ((offset >> 2) & 7) { | 43 | + /* Ethernet PHY address is 6 */ |
24 | case 0: /* SrcAddr */ | 44 | + object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal); |
25 | return s->chan[i].src; | 45 | + |
26 | case 1: /* DestAddr */ | 46 | qdev_realize(DEVICE(s), NULL, &error_fatal); |
27 | @@ -XXX,XX +XXX,XX @@ static void pl080_write(void *opaque, hwaddr offset, | 47 | |
28 | i = (offset & 0xe0) >> 5; | 48 | memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR, |
29 | if (i >= s->nchannels) | ||
30 | goto bad_offset; | ||
31 | - switch (offset >> 2) { | ||
32 | + switch ((offset >> 2) & 7) { | ||
33 | case 0: /* SrcAddr */ | ||
34 | s->chan[i].src = value; | ||
35 | break; | ||
36 | @@ -XXX,XX +XXX,XX @@ static void pl080_write(void *opaque, hwaddr offset, | ||
37 | pl080_run(s); | ||
38 | break; | ||
39 | } | ||
40 | + return; | ||
41 | } | ||
42 | switch (offset >> 2) { | ||
43 | case 2: /* IntTCClear */ | ||
44 | -- | 49 | -- |
45 | 2.18.0 | 50 | 2.20.1 |
46 | 51 | ||
47 | 52 | diff view generated by jsdifflib |
1 | The Arm Cortex-M System Design Kit includes a simple watchdog module | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | based on a 32-bit down-counter. Implement this. | ||
3 | 2 | ||
3 | This adds the target guide for SABRE Lite board, and documents how | ||
4 | to boot a Linux kernel and U-Boot bootloader. | ||
5 | |||
6 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Message-id: 20210106063504.10841-5-bmeng.cn@gmail.com | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | --- | 10 | --- |
6 | Makefile.objs | 1 + | 11 | docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++++++++++ |
7 | hw/watchdog/Makefile.objs | 1 + | 12 | docs/system/target-arm.rst | 1 + |
8 | include/hw/watchdog/cmsdk-apb-watchdog.h | 59 ++++ | 13 | 2 files changed, 120 insertions(+) |
9 | hw/watchdog/cmsdk-apb-watchdog.c | 326 +++++++++++++++++++++++ | 14 | create mode 100644 docs/system/arm/sabrelite.rst |
10 | MAINTAINERS | 2 + | ||
11 | default-configs/arm-softmmu.mak | 1 + | ||
12 | hw/watchdog/trace-events | 6 + | ||
13 | 7 files changed, 396 insertions(+) | ||
14 | create mode 100644 include/hw/watchdog/cmsdk-apb-watchdog.h | ||
15 | create mode 100644 hw/watchdog/cmsdk-apb-watchdog.c | ||
16 | create mode 100644 hw/watchdog/trace-events | ||
17 | 15 | ||
18 | diff --git a/Makefile.objs b/Makefile.objs | 16 | diff --git a/docs/system/arm/sabrelite.rst b/docs/system/arm/sabrelite.rst |
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/Makefile.objs | ||
21 | +++ b/Makefile.objs | ||
22 | @@ -XXX,XX +XXX,XX @@ trace-events-subdirs += hw/tpm | ||
23 | trace-events-subdirs += hw/usb | ||
24 | trace-events-subdirs += hw/vfio | ||
25 | trace-events-subdirs += hw/virtio | ||
26 | +trace-events-subdirs += hw/watchdog | ||
27 | trace-events-subdirs += hw/xen | ||
28 | trace-events-subdirs += io | ||
29 | trace-events-subdirs += linux-user | ||
30 | diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/hw/watchdog/Makefile.objs | ||
33 | +++ b/hw/watchdog/Makefile.objs | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | common-obj-y += watchdog.o | ||
36 | +common-obj-$(CONFIG_CMSDK_APB_WATCHDOG) += cmsdk-apb-watchdog.o | ||
37 | common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o | ||
38 | common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o | ||
39 | common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o | ||
40 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
41 | new file mode 100644 | 17 | new file mode 100644 |
42 | index XXXXXXX..XXXXXXX | 18 | index XXXXXXX..XXXXXXX |
43 | --- /dev/null | 19 | --- /dev/null |
44 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | 20 | +++ b/docs/system/arm/sabrelite.rst |
45 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
46 | +/* | 22 | +Boundary Devices SABRE Lite (``sabrelite``) |
47 | + * ARM CMSDK APB watchdog emulation | 23 | +=========================================== |
48 | + * | ||
49 | + * Copyright (c) 2018 Linaro Limited | ||
50 | + * Written by Peter Maydell | ||
51 | + * | ||
52 | + * This program is free software; you can redistribute it and/or modify | ||
53 | + * it under the terms of the GNU General Public License version 2 or | ||
54 | + * (at your option) any later version. | ||
55 | + */ | ||
56 | + | 24 | + |
57 | +/* | 25 | +Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development |
58 | + * This is a model of the "APB watchdog" which is part of the Cortex-M | 26 | +platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad |
59 | + * System Design Kit (CMSDK) and documented in the Cortex-M System | 27 | +Applications Processor. |
60 | + * Design Kit Technical Reference Manual (ARM DDI0479C): | ||
61 | + * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
62 | + * | ||
63 | + * QEMU interface: | ||
64 | + * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked | ||
65 | + * + sysbus MMIO region 0: the register bank | ||
66 | + * + sysbus IRQ 0: watchdog interrupt | ||
67 | + * | ||
68 | + * In real hardware the watchdog's reset output is just a GPIO line | ||
69 | + * which can then be masked by the board or treated as a simple interrupt. | ||
70 | + * (For instance the IoTKit does this with the non-secure watchdog, so that | ||
71 | + * secure code can control whether non-secure code can perform a system | ||
72 | + * reset via its watchdog.) In QEMU, we just wire up the watchdog reset | ||
73 | + * to watchdog_perform_action(), at least for the moment. | ||
74 | + */ | ||
75 | + | 28 | + |
76 | +#ifndef CMSDK_APB_WATCHDOG_H | 29 | +Supported devices |
77 | +#define CMSDK_APB_WATCHDOG_H | 30 | +----------------- |
78 | + | 31 | + |
79 | +#include "hw/sysbus.h" | 32 | +The SABRE Lite machine supports the following devices: |
80 | +#include "hw/ptimer.h" | ||
81 | + | 33 | + |
82 | +#define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog" | 34 | + * Up to 4 Cortex A9 cores |
83 | +#define CMSDK_APB_WATCHDOG(obj) OBJECT_CHECK(CMSDKAPBWatchdog, (obj), \ | 35 | + * Generic Interrupt Controller |
84 | + TYPE_CMSDK_APB_WATCHDOG) | 36 | + * 1 Clock Controller Module |
37 | + * 1 System Reset Controller | ||
38 | + * 5 UARTs | ||
39 | + * 2 EPIC timers | ||
40 | + * 1 GPT timer | ||
41 | + * 2 Watchdog timers | ||
42 | + * 1 FEC Ethernet controller | ||
43 | + * 3 I2C controllers | ||
44 | + * 7 GPIO controllers | ||
45 | + * 4 SDHC storage controllers | ||
46 | + * 4 USB 2.0 host controllers | ||
47 | + * 5 ECSPI controllers | ||
48 | + * 1 SST 25VF016B flash | ||
85 | + | 49 | + |
86 | +typedef struct CMSDKAPBWatchdog { | 50 | +Please note above list is a complete superset the QEMU SABRE Lite machine can |
87 | + /*< private >*/ | 51 | +support. For a normal use case, a device tree blob that represents a real world |
88 | + SysBusDevice parent_obj; | 52 | +SABRE Lite board, only exposes a subset of devices to the guest software. |
89 | + | 53 | + |
90 | + /*< public >*/ | 54 | +Boot options |
91 | + MemoryRegion iomem; | 55 | +------------ |
92 | + qemu_irq wdogint; | ||
93 | + uint32_t wdogclk_frq; | ||
94 | + struct ptimer_state *timer; | ||
95 | + | 56 | + |
96 | + uint32_t control; | 57 | +The SABRE Lite machine can start using the standard -kernel functionality |
97 | + uint32_t intstatus; | 58 | +for loading a Linux kernel, U-Boot bootloader or ELF executable. |
98 | + uint32_t lock; | ||
99 | + uint32_t itcr; | ||
100 | + uint32_t itop; | ||
101 | + uint32_t resetstatus; | ||
102 | +} CMSDKAPBWatchdog; | ||
103 | + | 59 | + |
104 | +#endif | 60 | +Running Linux kernel |
105 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | 61 | +-------------------- |
106 | new file mode 100644 | ||
107 | index XXXXXXX..XXXXXXX | ||
108 | --- /dev/null | ||
109 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
110 | @@ -XXX,XX +XXX,XX @@ | ||
111 | +/* | ||
112 | + * ARM CMSDK APB watchdog emulation | ||
113 | + * | ||
114 | + * Copyright (c) 2018 Linaro Limited | ||
115 | + * Written by Peter Maydell | ||
116 | + * | ||
117 | + * This program is free software; you can redistribute it and/or modify | ||
118 | + * it under the terms of the GNU General Public License version 2 or | ||
119 | + * (at your option) any later version. | ||
120 | + */ | ||
121 | + | 62 | + |
122 | +/* | 63 | +Linux mainline v5.10 release is tested at the time of writing. To build a Linux |
123 | + * This is a model of the "APB watchdog" which is part of the Cortex-M | 64 | +mainline kernel that can be booted by the SABRE Lite machine, simply configure |
124 | + * System Design Kit (CMSDK) and documented in the Cortex-M System | 65 | +the kernel using the imx_v6_v7_defconfig configuration: |
125 | + * Design Kit Technical Reference Manual (ARM DDI0479C): | ||
126 | + * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
127 | + */ | ||
128 | + | 66 | + |
129 | +#include "qemu/osdep.h" | 67 | +.. code-block:: bash |
130 | +#include "qemu/log.h" | ||
131 | +#include "trace.h" | ||
132 | +#include "qapi/error.h" | ||
133 | +#include "qemu/main-loop.h" | ||
134 | +#include "sysemu/watchdog.h" | ||
135 | +#include "hw/sysbus.h" | ||
136 | +#include "hw/registerfields.h" | ||
137 | +#include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
138 | + | 68 | + |
139 | +REG32(WDOGLOAD, 0x0) | 69 | + $ export ARCH=arm |
140 | +REG32(WDOGVALUE, 0x4) | 70 | + $ export CROSS_COMPILE=arm-linux-gnueabihf- |
141 | +REG32(WDOGCONTROL, 0x8) | 71 | + $ make imx_v6_v7_defconfig |
142 | + FIELD(WDOGCONTROL, INTEN, 0, 1) | 72 | + $ make |
143 | + FIELD(WDOGCONTROL, RESEN, 1, 1) | ||
144 | +#define R_WDOGCONTROL_VALID_MASK (R_WDOGCONTROL_INTEN_MASK | \ | ||
145 | + R_WDOGCONTROL_RESEN_MASK) | ||
146 | +REG32(WDOGINTCLR, 0xc) | ||
147 | +REG32(WDOGRIS, 0x10) | ||
148 | + FIELD(WDOGRIS, INT, 0, 1) | ||
149 | +REG32(WDOGMIS, 0x14) | ||
150 | +REG32(WDOGLOCK, 0xc00) | ||
151 | +#define WDOG_UNLOCK_VALUE 0x1ACCE551 | ||
152 | +REG32(WDOGITCR, 0xf00) | ||
153 | + FIELD(WDOGITCR, ENABLE, 0, 1) | ||
154 | +#define R_WDOGITCR_VALID_MASK R_WDOGITCR_ENABLE_MASK | ||
155 | +REG32(WDOGITOP, 0xf04) | ||
156 | + FIELD(WDOGITOP, WDOGRES, 0, 1) | ||
157 | + FIELD(WDOGITOP, WDOGINT, 1, 1) | ||
158 | +#define R_WDOGITOP_VALID_MASK (R_WDOGITOP_WDOGRES_MASK | \ | ||
159 | + R_WDOGITOP_WDOGINT_MASK) | ||
160 | +REG32(PID4, 0xfd0) | ||
161 | +REG32(PID5, 0xfd4) | ||
162 | +REG32(PID6, 0xfd8) | ||
163 | +REG32(PID7, 0xfdc) | ||
164 | +REG32(PID0, 0xfe0) | ||
165 | +REG32(PID1, 0xfe4) | ||
166 | +REG32(PID2, 0xfe8) | ||
167 | +REG32(PID3, 0xfec) | ||
168 | +REG32(CID0, 0xff0) | ||
169 | +REG32(CID1, 0xff4) | ||
170 | +REG32(CID2, 0xff8) | ||
171 | +REG32(CID3, 0xffc) | ||
172 | + | 73 | + |
173 | +/* PID/CID values */ | 74 | +To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use: |
174 | +static const int watchdog_id[] = { | ||
175 | + 0x04, 0x00, 0x00, 0x00, /* PID4..PID7 */ | ||
176 | + 0x24, 0xb8, 0x1b, 0x00, /* PID0..PID3 */ | ||
177 | + 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ | ||
178 | +}; | ||
179 | + | 75 | + |
180 | +static bool cmsdk_apb_watchdog_intstatus(CMSDKAPBWatchdog *s) | 76 | +.. code-block:: bash |
181 | +{ | ||
182 | + /* Return masked interrupt status */ | ||
183 | + return s->intstatus && (s->control & R_WDOGCONTROL_INTEN_MASK); | ||
184 | +} | ||
185 | + | 77 | + |
186 | +static bool cmsdk_apb_watchdog_resetstatus(CMSDKAPBWatchdog *s) | 78 | + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ |
187 | +{ | 79 | + -display none -serial null -serial stdio \ |
188 | + /* Return masked reset status */ | 80 | + -kernel arch/arm/boot/zImage \ |
189 | + return s->resetstatus && (s->control & R_WDOGCONTROL_RESEN_MASK); | 81 | + -dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \ |
190 | +} | 82 | + -initrd /path/to/rootfs.ext4 \ |
83 | + -append "root=/dev/ram" | ||
191 | + | 84 | + |
192 | +static void cmsdk_apb_watchdog_update(CMSDKAPBWatchdog *s) | 85 | +Running U-Boot |
193 | +{ | 86 | +-------------- |
194 | + bool wdogint; | ||
195 | + bool wdogres; | ||
196 | + | 87 | + |
197 | + if (s->itcr) { | 88 | +U-Boot mainline v2020.10 release is tested at the time of writing. To build a |
198 | + wdogint = s->itop & R_WDOGITOP_WDOGINT_MASK; | 89 | +U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use |
199 | + wdogres = s->itop & R_WDOGITOP_WDOGRES_MASK; | 90 | +the mx6qsabrelite_defconfig with similar commands as described above for Linux: |
200 | + } else { | ||
201 | + wdogint = cmsdk_apb_watchdog_intstatus(s); | ||
202 | + wdogres = cmsdk_apb_watchdog_resetstatus(s); | ||
203 | + } | ||
204 | + | 91 | + |
205 | + qemu_set_irq(s->wdogint, wdogint); | 92 | +.. code-block:: bash |
206 | + if (wdogres) { | ||
207 | + watchdog_perform_action(); | ||
208 | + } | ||
209 | +} | ||
210 | + | 93 | + |
211 | +static uint64_t cmsdk_apb_watchdog_read(void *opaque, hwaddr offset, | 94 | + $ export CROSS_COMPILE=arm-linux-gnueabihf- |
212 | + unsigned size) | 95 | + $ make mx6qsabrelite_defconfig |
213 | +{ | ||
214 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque); | ||
215 | + uint64_t r; | ||
216 | + | 96 | + |
217 | + switch (offset) { | 97 | +Note we need to adjust settings by: |
218 | + case A_WDOGLOAD: | ||
219 | + r = ptimer_get_limit(s->timer); | ||
220 | + break; | ||
221 | + case A_WDOGVALUE: | ||
222 | + r = ptimer_get_count(s->timer); | ||
223 | + break; | ||
224 | + case A_WDOGCONTROL: | ||
225 | + r = s->control; | ||
226 | + break; | ||
227 | + case A_WDOGRIS: | ||
228 | + r = s->intstatus; | ||
229 | + break; | ||
230 | + case A_WDOGMIS: | ||
231 | + r = cmsdk_apb_watchdog_intstatus(s); | ||
232 | + break; | ||
233 | + case A_WDOGLOCK: | ||
234 | + r = s->lock; | ||
235 | + break; | ||
236 | + case A_WDOGITCR: | ||
237 | + r = s->itcr; | ||
238 | + break; | ||
239 | + case A_PID4 ... A_CID3: | ||
240 | + r = watchdog_id[(offset - A_PID4) / 4]; | ||
241 | + break; | ||
242 | + case A_WDOGINTCLR: | ||
243 | + case A_WDOGITOP: | ||
244 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
245 | + "CMSDK APB watchdog read: read of WO offset %x\n", | ||
246 | + (int)offset); | ||
247 | + r = 0; | ||
248 | + break; | ||
249 | + default: | ||
250 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
251 | + "CMSDK APB watchdog read: bad offset %x\n", (int)offset); | ||
252 | + r = 0; | ||
253 | + break; | ||
254 | + } | ||
255 | + trace_cmsdk_apb_watchdog_read(offset, r, size); | ||
256 | + return r; | ||
257 | +} | ||
258 | + | 98 | + |
259 | +static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset, | 99 | +.. code-block:: bash |
260 | + uint64_t value, unsigned size) | ||
261 | +{ | ||
262 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque); | ||
263 | + | 100 | + |
264 | + trace_cmsdk_apb_watchdog_write(offset, value, size); | 101 | + $ make menuconfig |
265 | + | 102 | + |
266 | + if (s->lock && offset != A_WDOGLOCK) { | 103 | +then manually select the following configuration in U-Boot: |
267 | + /* Write access is disabled via WDOGLOCK */ | ||
268 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
269 | + "CMSDK APB watchdog write: write to locked watchdog\n"); | ||
270 | + return; | ||
271 | + } | ||
272 | + | 104 | + |
273 | + switch (offset) { | 105 | + Device Tree Control > Provider of DTB for DT Control > Embedded DTB |
274 | + case A_WDOGLOAD: | ||
275 | + /* | ||
276 | + * Reset the load value and the current count, and make sure | ||
277 | + * we're counting. | ||
278 | + */ | ||
279 | + ptimer_set_limit(s->timer, value, 1); | ||
280 | + ptimer_run(s->timer, 0); | ||
281 | + break; | ||
282 | + case A_WDOGCONTROL: | ||
283 | + s->control = value & R_WDOGCONTROL_VALID_MASK; | ||
284 | + cmsdk_apb_watchdog_update(s); | ||
285 | + break; | ||
286 | + case A_WDOGINTCLR: | ||
287 | + s->intstatus = 0; | ||
288 | + ptimer_set_count(s->timer, ptimer_get_limit(s->timer)); | ||
289 | + cmsdk_apb_watchdog_update(s); | ||
290 | + break; | ||
291 | + case A_WDOGLOCK: | ||
292 | + s->lock = (value != WDOG_UNLOCK_VALUE); | ||
293 | + break; | ||
294 | + case A_WDOGITCR: | ||
295 | + s->itcr = value & R_WDOGITCR_VALID_MASK; | ||
296 | + cmsdk_apb_watchdog_update(s); | ||
297 | + break; | ||
298 | + case A_WDOGITOP: | ||
299 | + s->itop = value & R_WDOGITOP_VALID_MASK; | ||
300 | + cmsdk_apb_watchdog_update(s); | ||
301 | + break; | ||
302 | + case A_WDOGVALUE: | ||
303 | + case A_WDOGRIS: | ||
304 | + case A_WDOGMIS: | ||
305 | + case A_PID4 ... A_CID3: | ||
306 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
307 | + "CMSDK APB watchdog write: write to RO offset 0x%x\n", | ||
308 | + (int)offset); | ||
309 | + break; | ||
310 | + default: | ||
311 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
312 | + "CMSDK APB watchdog write: bad offset 0x%x\n", | ||
313 | + (int)offset); | ||
314 | + break; | ||
315 | + } | ||
316 | +} | ||
317 | + | 106 | + |
318 | +static const MemoryRegionOps cmsdk_apb_watchdog_ops = { | 107 | +To start U-Boot using the SABRE Lite machine, provide the u-boot binary to |
319 | + .read = cmsdk_apb_watchdog_read, | 108 | +the -kernel argument, along with an SD card image with rootfs: |
320 | + .write = cmsdk_apb_watchdog_write, | ||
321 | + .endianness = DEVICE_LITTLE_ENDIAN, | ||
322 | + /* byte/halfword accesses are just zero-padded on reads and writes */ | ||
323 | + .impl.min_access_size = 4, | ||
324 | + .impl.max_access_size = 4, | ||
325 | + .valid.min_access_size = 1, | ||
326 | + .valid.max_access_size = 4, | ||
327 | +}; | ||
328 | + | 109 | + |
329 | +static void cmsdk_apb_watchdog_tick(void *opaque) | 110 | +.. code-block:: bash |
330 | +{ | ||
331 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque); | ||
332 | + | 111 | + |
333 | + if (!s->intstatus) { | 112 | + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ |
334 | + /* Count expired for the first time: raise interrupt */ | 113 | + -display none -serial null -serial stdio \ |
335 | + s->intstatus = R_WDOGRIS_INT_MASK; | 114 | + -kernel u-boot |
336 | + } else { | ||
337 | + /* Count expired for the second time: raise reset and stop clock */ | ||
338 | + s->resetstatus = 1; | ||
339 | + ptimer_stop(s->timer); | ||
340 | + } | ||
341 | + cmsdk_apb_watchdog_update(s); | ||
342 | +} | ||
343 | + | 115 | + |
344 | +static void cmsdk_apb_watchdog_reset(DeviceState *dev) | 116 | +The following example shows booting Linux kernel from dhcp, and uses the |
345 | +{ | 117 | +rootfs on an SD card. This requires some additional command line parameters |
346 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev); | 118 | +for QEMU: |
347 | + | 119 | + |
348 | + trace_cmsdk_apb_watchdog_reset(); | 120 | +.. code-block:: none |
349 | + s->control = 0; | ||
350 | + s->intstatus = 0; | ||
351 | + s->lock = 0; | ||
352 | + s->itcr = 0; | ||
353 | + s->itop = 0; | ||
354 | + s->resetstatus = 0; | ||
355 | + /* Set the limit and the count */ | ||
356 | + ptimer_set_limit(s->timer, 0xffffffff, 1); | ||
357 | + ptimer_run(s->timer, 0); | ||
358 | +} | ||
359 | + | 121 | + |
360 | +static void cmsdk_apb_watchdog_init(Object *obj) | 122 | + -nic user,tftp=/path/to/kernel/zImage \ |
361 | +{ | 123 | + -drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs |
362 | + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
363 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(obj); | ||
364 | + | 124 | + |
365 | + memory_region_init_io(&s->iomem, obj, &cmsdk_apb_watchdog_ops, | 125 | +The directory for the built-in TFTP server should also contain the device tree |
366 | + s, "cmsdk-apb-watchdog", 0x1000); | 126 | +blob of the SABRE Lite board. The sample SD card image was populated with the |
367 | + sysbus_init_mmio(sbd, &s->iomem); | 127 | +root file system with one single partition. You may adjust the kernel "root=" |
368 | + sysbus_init_irq(sbd, &s->wdogint); | 128 | +boot parameter accordingly. |
369 | +} | ||
370 | + | 129 | + |
371 | +static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | 130 | +After U-Boot boots, type the following commands in the U-Boot command shell to |
372 | +{ | 131 | +boot the Linux kernel: |
373 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev); | ||
374 | + QEMUBH *bh; | ||
375 | + | 132 | + |
376 | + if (s->wdogclk_frq == 0) { | 133 | +.. code-block:: none |
377 | + error_setg(errp, | ||
378 | + "CMSDK APB watchdog: wdogclk-frq property must be set"); | ||
379 | + return; | ||
380 | + } | ||
381 | + | 134 | + |
382 | + bh = qemu_bh_new(cmsdk_apb_watchdog_tick, s); | 135 | + => setenv ethaddr 00:11:22:33:44:55 |
383 | + s->timer = ptimer_init(bh, | 136 | + => setenv bootfile zImage |
384 | + PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD | | 137 | + => dhcp |
385 | + PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT | | 138 | + => tftpboot 14000000 imx6q-sabrelite.dtb |
386 | + PTIMER_POLICY_NO_IMMEDIATE_RELOAD | | 139 | + => setenv bootargs root=/dev/mmcblk3p1 |
387 | + PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); | 140 | + => bootz 12000000 - 14000000 |
388 | + | 141 | diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst |
389 | + ptimer_set_freq(s->timer, s->wdogclk_frq); | ||
390 | +} | ||
391 | + | ||
392 | +static const VMStateDescription cmsdk_apb_watchdog_vmstate = { | ||
393 | + .name = "cmsdk-apb-watchdog", | ||
394 | + .version_id = 1, | ||
395 | + .minimum_version_id = 1, | ||
396 | + .fields = (VMStateField[]) { | ||
397 | + VMSTATE_PTIMER(timer, CMSDKAPBWatchdog), | ||
398 | + VMSTATE_UINT32(control, CMSDKAPBWatchdog), | ||
399 | + VMSTATE_UINT32(intstatus, CMSDKAPBWatchdog), | ||
400 | + VMSTATE_UINT32(lock, CMSDKAPBWatchdog), | ||
401 | + VMSTATE_UINT32(itcr, CMSDKAPBWatchdog), | ||
402 | + VMSTATE_UINT32(itop, CMSDKAPBWatchdog), | ||
403 | + VMSTATE_UINT32(resetstatus, CMSDKAPBWatchdog), | ||
404 | + VMSTATE_END_OF_LIST() | ||
405 | + } | ||
406 | +}; | ||
407 | + | ||
408 | +static Property cmsdk_apb_watchdog_properties[] = { | ||
409 | + DEFINE_PROP_UINT32("wdogclk-frq", CMSDKAPBWatchdog, wdogclk_frq, 0), | ||
410 | + DEFINE_PROP_END_OF_LIST(), | ||
411 | +}; | ||
412 | + | ||
413 | +static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) | ||
414 | +{ | ||
415 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
416 | + | ||
417 | + dc->realize = cmsdk_apb_watchdog_realize; | ||
418 | + dc->vmsd = &cmsdk_apb_watchdog_vmstate; | ||
419 | + dc->reset = cmsdk_apb_watchdog_reset; | ||
420 | + dc->props = cmsdk_apb_watchdog_properties; | ||
421 | +} | ||
422 | + | ||
423 | +static const TypeInfo cmsdk_apb_watchdog_info = { | ||
424 | + .name = TYPE_CMSDK_APB_WATCHDOG, | ||
425 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
426 | + .instance_size = sizeof(CMSDKAPBWatchdog), | ||
427 | + .instance_init = cmsdk_apb_watchdog_init, | ||
428 | + .class_init = cmsdk_apb_watchdog_class_init, | ||
429 | +}; | ||
430 | + | ||
431 | +static void cmsdk_apb_watchdog_register_types(void) | ||
432 | +{ | ||
433 | + type_register_static(&cmsdk_apb_watchdog_info); | ||
434 | +} | ||
435 | + | ||
436 | +type_init(cmsdk_apb_watchdog_register_types); | ||
437 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
438 | index XXXXXXX..XXXXXXX 100644 | 142 | index XXXXXXX..XXXXXXX 100644 |
439 | --- a/MAINTAINERS | 143 | --- a/docs/system/target-arm.rst |
440 | +++ b/MAINTAINERS | 144 | +++ b/docs/system/target-arm.rst |
441 | @@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c | 145 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running |
442 | F: include/hw/timer/cmsdk-apb-timer.h | 146 | arm/versatile |
443 | F: hw/char/cmsdk-apb-uart.c | 147 | arm/vexpress |
444 | F: include/hw/char/cmsdk-apb-uart.h | 148 | arm/aspeed |
445 | +F: hw/watchdog/cmsdk-apb-watchdog.c | 149 | + arm/sabrelite |
446 | +F: include/hw/watchdog/cmsdk-apb-watchdog.h | 150 | arm/digic |
447 | F: hw/misc/tz-ppc.c | 151 | arm/musicpal |
448 | F: include/hw/misc/tz-ppc.h | 152 | arm/gumstix |
449 | F: hw/misc/tz-mpc.c | ||
450 | diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak | ||
451 | index XXXXXXX..XXXXXXX 100644 | ||
452 | --- a/default-configs/arm-softmmu.mak | ||
453 | +++ b/default-configs/arm-softmmu.mak | ||
454 | @@ -XXX,XX +XXX,XX @@ CONFIG_STM32F205_SOC=y | ||
455 | |||
456 | CONFIG_CMSDK_APB_TIMER=y | ||
457 | CONFIG_CMSDK_APB_UART=y | ||
458 | +CONFIG_CMSDK_APB_WATCHDOG=y | ||
459 | |||
460 | CONFIG_MPS2_FPGAIO=y | ||
461 | CONFIG_MPS2_SCC=y | ||
462 | diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events | ||
463 | new file mode 100644 | ||
464 | index XXXXXXX..XXXXXXX | ||
465 | --- /dev/null | ||
466 | +++ b/hw/watchdog/trace-events | ||
467 | @@ -XXX,XX +XXX,XX @@ | ||
468 | +# See docs/devel/tracing.txt for syntax documentation. | ||
469 | + | ||
470 | +# hw/char/cmsdk_apb_watchdog.c | ||
471 | +cmsdk_apb_watchdog_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
472 | +cmsdk_apb_watchdog_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
473 | +cmsdk_apb_watchdog_reset(void) "CMSDK APB watchdog: reset" | ||
474 | -- | 153 | -- |
475 | 2.18.0 | 154 | 2.20.1 |
476 | 155 | ||
477 | 156 | diff view generated by jsdifflib |