1 | Small pile of bug fixes for rc1. I've included my patches to get | 1 | I might squeeze in another pullreq before softfreeze, but the |
---|---|---|---|
2 | our docs building with Sphinx 3, just for convenience... | 2 | queue was already big enough that I wanted to send this lot out now. |
3 | 3 | ||
4 | -- PMM | 4 | -- PMM |
5 | 5 | ||
6 | The following changes since commit b149dea55cce97cb226683d06af61984a1c11e96: | 6 | The following changes since commit 4abf70a661a5df3886ac9d7c19c3617fa92b922a: |
7 | 7 | ||
8 | Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20201102' into staging (2020-11-02 10:57:48 +0000) | 8 | Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-06-24' into staging (2020-07-03 15:34:45 +0100) |
9 | 9 | ||
10 | are available in the Git repository at: | 10 | are available in the Git repository at: |
11 | 11 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201102 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200703 |
13 | 13 | ||
14 | for you to fetch changes up to ffb4fbf90a2f63c9cb33e4bb9f854c79bf04ca4a: | 14 | for you to fetch changes up to 0f10bf84a9d489259a5b11c6aa1b05c1175b76ea: |
15 | 15 | ||
16 | tests/qtest/npcm7xx_rng-test: Disable randomness tests (2020-11-02 16:52:18 +0000) | 16 | Deprecate TileGX port (2020-07-03 16:59:46 +0100) |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | target-arm queue: | 19 | target-arm queue: |
20 | * target/arm: Fix Neon emulation bugs on big-endian hosts | 20 | * i.MX6UL EVK board: put PHYs in the correct places |
21 | * target/arm: fix handling of HCR.FB | 21 | * hw/arm/virt: Let the virtio-iommu bypass MSIs |
22 | * target/arm: fix LORID_EL1 access check | 22 | * target/arm: kvm: Handle DABT with no valid ISS |
23 | * disas/capstone: Fix monitor disassembly of >32 bytes | 23 | * hw/arm/virt-acpi-build: Only expose flash on older machine types |
24 | * hw/arm/smmuv3: Fix potential integer overflow (CID 1432363) | 24 | * target/arm: Fix temp double-free in sve ldr/str |
25 | * hw/arm/boot: fix SVE for EL3 direct kernel boot | 25 | * hw/display/bcm2835_fb.c: Initialize all fields of struct |
26 | * hw/display/omap_lcdc: Fix potential NULL pointer dereference | 26 | * hw/arm/spitz: Code cleanup to fix Coverity-detected memory leak |
27 | * hw/display/exynos4210_fimd: Fix potential NULL pointer dereference | 27 | * Deprecate TileGX port |
28 | * target/arm: Get correct MMU index for other-security-state | ||
29 | * configure: Test that gio libs from pkg-config work | ||
30 | * hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work | ||
31 | * docs: Fix building with Sphinx 3 | ||
32 | * tests/qtest/npcm7xx_rng-test: Disable randomness tests | ||
33 | 28 | ||
34 | ---------------------------------------------------------------- | 29 | ---------------------------------------------------------------- |
35 | AlexChen (2): | 30 | Andrew Jones (4): |
36 | hw/display/omap_lcdc: Fix potential NULL pointer dereference | 31 | tests/acpi: remove stale allowed tables |
37 | hw/display/exynos4210_fimd: Fix potential NULL pointer dereference | 32 | tests/acpi: virt: allow DSDT acpi table changes |
33 | hw/arm/virt-acpi-build: Only expose flash on older machine types | ||
34 | tests/acpi: virt: update golden masters for DSDT | ||
38 | 35 | ||
39 | Peter Maydell (9): | 36 | Beata Michalska (2): |
40 | target/arm: Fix float16 pairwise Neon ops on big-endian hosts | 37 | target/arm: kvm: Handle DABT with no valid ISS |
41 | target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts | 38 | target/arm: kvm: Handle misconfigured dabt injection |
42 | disas/capstone: Fix monitor disassembly of >32 bytes | ||
43 | target/arm: Get correct MMU index for other-security-state | ||
44 | configure: Test that gio libs from pkg-config work | ||
45 | hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work | ||
46 | scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments | ||
47 | qemu-option-trace.rst.inc: Don't use option:: markup | ||
48 | tests/qtest/npcm7xx_rng-test: Disable randomness tests | ||
49 | 39 | ||
50 | Philippe Mathieu-Daudé (1): | 40 | Eric Auger (5): |
51 | hw/arm/smmuv3: Fix potential integer overflow (CID 1432363) | 41 | qdev: Introduce DEFINE_PROP_RESERVED_REGION |
42 | virtio-iommu: Implement RESV_MEM probe request | ||
43 | virtio-iommu: Handle reserved regions in the translation process | ||
44 | virtio-iommu-pci: Add array of Interval properties | ||
45 | hw/arm/virt: Let the virtio-iommu bypass MSIs | ||
52 | 46 | ||
53 | Richard Henderson (11): | 47 | Jean-Christophe Dubois (3): |
54 | target/arm: Introduce neon_full_reg_offset | 48 | Add a phy-num property to the i.MX FEC emulator |
55 | target/arm: Move neon_element_offset to translate.c | 49 | Add the ability to select a different PHY for each i.MX6UL FEC interface |
56 | target/arm: Use neon_element_offset in neon_load/store_reg | 50 | Select MDIO device 2 and 1 as PHY devices for i.MX6UL EVK board. |
57 | target/arm: Use neon_element_offset in vfp_reg_offset | ||
58 | target/arm: Add read/write_neon_element32 | ||
59 | target/arm: Expand read/write_neon_element32 to all MemOp | ||
60 | target/arm: Rename neon_load_reg32 to vfp_load_reg32 | ||
61 | target/arm: Add read/write_neon_element64 | ||
62 | target/arm: Rename neon_load_reg64 to vfp_load_reg64 | ||
63 | target/arm: Simplify do_long_3d and do_2scalar_long | ||
64 | target/arm: Improve do_prewiden_3d | ||
65 | 51 | ||
66 | Rémi Denis-Courmont (3): | 52 | Peter Maydell (19): |
67 | target/arm: fix handling of HCR.FB | 53 | hw/display/bcm2835_fb.c: Initialize all fields of struct |
68 | target/arm: fix LORID_EL1 access check | 54 | hw/arm/spitz: Detabify |
69 | hw/arm/boot: fix SVE for EL3 direct kernel boot | 55 | hw/arm/spitz: Create SpitzMachineClass abstract base class |
56 | hw/arm/spitz: Keep pointers to MPU and SSI devices in SpitzMachineState | ||
57 | hw/arm/spitz: Keep pointers to scp0, scp1 in SpitzMachineState | ||
58 | hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals | ||
59 | hw/misc/max111x: provide QOM properties for setting initial values | ||
60 | hw/misc/max111x: Don't use vmstate_register() | ||
61 | ssi: Add ssi_realize_and_unref() | ||
62 | hw/arm/spitz: Use max111x properties to set initial values | ||
63 | hw/misc/max111x: Use GPIO lines rather than max111x_set_input() | ||
64 | hw/misc/max111x: Create header file for documentation, TYPE_ macros | ||
65 | hw/arm/spitz: Encapsulate misc GPIO handling in a device | ||
66 | hw/gpio/zaurus.c: Use LOG_GUEST_ERROR for bad guest register accesses | ||
67 | hw/arm/spitz: Use LOG_GUEST_ERROR for bad guest register accesses | ||
68 | hw/arm/pxa2xx_pic: Use LOG_GUEST_ERROR for bad guest register accesses | ||
69 | hw/arm/spitz: Provide usual QOM macros for corgi-ssp and spitz-lcdtg | ||
70 | Replace uses of FROM_SSI_SLAVE() macro with QOM casts | ||
71 | Deprecate TileGX port | ||
70 | 72 | ||
71 | docs/qemu-option-trace.rst.inc | 6 +- | 73 | Richard Henderson (1): |
72 | configure | 10 +- | 74 | target/arm: Fix temp double-free in sve ldr/str |
73 | include/hw/intc/arm_gicv3_common.h | 1 - | ||
74 | disas/capstone.c | 2 +- | ||
75 | hw/arm/boot.c | 3 + | ||
76 | hw/arm/smmuv3.c | 3 +- | ||
77 | hw/display/exynos4210_fimd.c | 4 +- | ||
78 | hw/display/omap_lcdc.c | 10 +- | ||
79 | hw/intc/arm_gicv3_cpuif.c | 5 +- | ||
80 | target/arm/helper.c | 24 +- | ||
81 | target/arm/m_helper.c | 3 +- | ||
82 | target/arm/translate.c | 153 +++++++++--- | ||
83 | target/arm/vec_helper.c | 12 +- | ||
84 | tests/qtest/npcm7xx_rng-test.c | 14 +- | ||
85 | scripts/kernel-doc | 18 +- | ||
86 | target/arm/translate-neon.c.inc | 472 ++++++++++++++++++++----------------- | ||
87 | target/arm/translate-vfp.c.inc | 341 +++++++++++---------------- | ||
88 | 17 files changed, 588 insertions(+), 493 deletions(-) | ||
89 | 75 | ||
76 | docs/system/deprecated.rst | 11 + | ||
77 | include/exec/memory.h | 6 + | ||
78 | include/hw/arm/fsl-imx6ul.h | 2 + | ||
79 | include/hw/arm/pxa.h | 1 - | ||
80 | include/hw/arm/sharpsl.h | 3 - | ||
81 | include/hw/arm/virt.h | 8 + | ||
82 | include/hw/misc/max111x.h | 56 +++ | ||
83 | include/hw/net/imx_fec.h | 1 + | ||
84 | include/hw/qdev-properties.h | 3 + | ||
85 | include/hw/ssi/ssi.h | 31 +- | ||
86 | include/hw/virtio/virtio-iommu.h | 2 + | ||
87 | include/qemu/typedefs.h | 1 + | ||
88 | target/arm/cpu.h | 2 + | ||
89 | target/arm/kvm_arm.h | 10 + | ||
90 | target/arm/translate-a64.h | 1 + | ||
91 | tests/qtest/bios-tables-test-allowed-diff.h | 18 - | ||
92 | hw/arm/fsl-imx6ul.c | 10 + | ||
93 | hw/arm/mcimx6ul-evk.c | 2 + | ||
94 | hw/arm/pxa2xx_pic.c | 9 +- | ||
95 | hw/arm/spitz.c | 507 ++++++++++++++++------------ | ||
96 | hw/arm/virt-acpi-build.c | 5 +- | ||
97 | hw/arm/virt.c | 33 ++ | ||
98 | hw/arm/z2.c | 11 +- | ||
99 | hw/core/qdev-properties.c | 89 +++++ | ||
100 | hw/display/ads7846.c | 9 +- | ||
101 | hw/display/bcm2835_fb.c | 4 + | ||
102 | hw/display/ssd0323.c | 10 +- | ||
103 | hw/gpio/zaurus.c | 12 +- | ||
104 | hw/misc/max111x.c | 86 +++-- | ||
105 | hw/net/imx_fec.c | 24 +- | ||
106 | hw/sd/ssi-sd.c | 4 +- | ||
107 | hw/ssi/ssi.c | 7 +- | ||
108 | hw/virtio/virtio-iommu-pci.c | 11 + | ||
109 | hw/virtio/virtio-iommu.c | 114 ++++++- | ||
110 | target/arm/kvm.c | 80 +++++ | ||
111 | target/arm/kvm32.c | 34 ++ | ||
112 | target/arm/kvm64.c | 49 +++ | ||
113 | target/arm/translate-a64.c | 6 + | ||
114 | target/arm/translate-sve.c | 8 +- | ||
115 | MAINTAINERS | 1 + | ||
116 | hw/net/trace-events | 4 +- | ||
117 | hw/virtio/trace-events | 1 + | ||
118 | tests/data/acpi/virt/DSDT | Bin 5307 -> 5205 bytes | ||
119 | tests/data/acpi/virt/DSDT.memhp | Bin 6668 -> 6566 bytes | ||
120 | tests/data/acpi/virt/DSDT.numamem | Bin 5307 -> 5205 bytes | ||
121 | 45 files changed, 974 insertions(+), 312 deletions(-) | ||
122 | create mode 100644 include/hw/misc/max111x.h | ||
123 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> |
---|---|---|---|
2 | 2 | ||
3 | In both cases, we can sink the write-back and perform | 3 | We need a solution to use an Ethernet PHY that is not the first device |
4 | the accumulate into the normal destination temps. | 4 | on the MDIO bus (device 0 on MDIO bus). |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | As an example with the i.MX6UL the NXP SOC has 2 Ethernet devices but |
7 | Message-id: 20201030022618.785675-11-richard.henderson@linaro.org | 7 | only one MDIO bus on which the 2 related PHY are connected but at unique |
8 | addresses. | ||
9 | |||
10 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | ||
11 | Message-id: a1a5c0e139d1c763194b8020573dcb6025daeefa.1593296112.git.jcd@tribudubois.net | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 14 | --- |
11 | target/arm/translate-neon.c.inc | 23 +++++++++-------------- | 15 | include/hw/net/imx_fec.h | 1 + |
12 | 1 file changed, 9 insertions(+), 14 deletions(-) | 16 | hw/net/imx_fec.c | 24 +++++++++++++++++------- |
17 | hw/net/trace-events | 4 ++-- | ||
18 | 3 files changed, 20 insertions(+), 9 deletions(-) | ||
13 | 19 | ||
14 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 20 | diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-neon.c.inc | 22 | --- a/include/hw/net/imx_fec.h |
17 | +++ b/target/arm/translate-neon.c.inc | 23 | +++ b/include/hw/net/imx_fec.h |
18 | @@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a, | 24 | @@ -XXX,XX +XXX,XX @@ typedef struct IMXFECState { |
19 | if (accfn) { | 25 | uint32_t phy_advertise; |
20 | tmp = tcg_temp_new_i64(); | 26 | uint32_t phy_int; |
21 | read_neon_element64(tmp, a->vd, 0, MO_64); | 27 | uint32_t phy_int_mask; |
22 | - accfn(tmp, tmp, rd0); | 28 | + uint32_t phy_num; |
23 | - write_neon_element64(tmp, a->vd, 0, MO_64); | 29 | |
24 | + accfn(rd0, tmp, rd0); | 30 | bool is_fec; |
25 | read_neon_element64(tmp, a->vd, 1, MO_64); | 31 | |
26 | - accfn(tmp, tmp, rd1); | 32 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c |
27 | - write_neon_element64(tmp, a->vd, 1, MO_64); | 33 | index XXXXXXX..XXXXXXX 100644 |
28 | + accfn(rd1, tmp, rd1); | 34 | --- a/hw/net/imx_fec.c |
29 | tcg_temp_free_i64(tmp); | 35 | +++ b/hw/net/imx_fec.c |
30 | - } else { | 36 | @@ -XXX,XX +XXX,XX @@ static void imx_phy_reset(IMXFECState *s) |
31 | - write_neon_element64(rd0, a->vd, 0, MO_64); | 37 | static uint32_t imx_phy_read(IMXFECState *s, int reg) |
32 | - write_neon_element64(rd1, a->vd, 1, MO_64); | 38 | { |
39 | uint32_t val; | ||
40 | + uint32_t phy = reg / 32; | ||
41 | |||
42 | - if (reg > 31) { | ||
43 | - /* we only advertise one phy */ | ||
44 | + if (phy != s->phy_num) { | ||
45 | + qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", | ||
46 | + TYPE_IMX_FEC, __func__, phy); | ||
47 | return 0; | ||
33 | } | 48 | } |
34 | 49 | ||
35 | + write_neon_element64(rd0, a->vd, 0, MO_64); | 50 | + reg %= 32; |
36 | + write_neon_element64(rd1, a->vd, 1, MO_64); | 51 | + |
37 | tcg_temp_free_i64(rd0); | 52 | switch (reg) { |
38 | tcg_temp_free_i64(rd1); | 53 | case 0: /* Basic Control */ |
39 | 54 | val = s->phy_control; | |
40 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a, | 55 | @@ -XXX,XX +XXX,XX @@ static uint32_t imx_phy_read(IMXFECState *s, int reg) |
41 | if (accfn) { | 56 | break; |
42 | TCGv_i64 t64 = tcg_temp_new_i64(); | ||
43 | read_neon_element64(t64, a->vd, 0, MO_64); | ||
44 | - accfn(t64, t64, rn0_64); | ||
45 | - write_neon_element64(t64, a->vd, 0, MO_64); | ||
46 | + accfn(rn0_64, t64, rn0_64); | ||
47 | read_neon_element64(t64, a->vd, 1, MO_64); | ||
48 | - accfn(t64, t64, rn1_64); | ||
49 | - write_neon_element64(t64, a->vd, 1, MO_64); | ||
50 | + accfn(rn1_64, t64, rn1_64); | ||
51 | tcg_temp_free_i64(t64); | ||
52 | - } else { | ||
53 | - write_neon_element64(rn0_64, a->vd, 0, MO_64); | ||
54 | - write_neon_element64(rn1_64, a->vd, 1, MO_64); | ||
55 | } | 57 | } |
58 | |||
59 | - trace_imx_phy_read(val, reg); | ||
60 | + trace_imx_phy_read(val, phy, reg); | ||
61 | |||
62 | return val; | ||
63 | } | ||
64 | |||
65 | static void imx_phy_write(IMXFECState *s, int reg, uint32_t val) | ||
66 | { | ||
67 | - trace_imx_phy_write(val, reg); | ||
68 | + uint32_t phy = reg / 32; | ||
69 | |||
70 | - if (reg > 31) { | ||
71 | - /* we only advertise one phy */ | ||
72 | + if (phy != s->phy_num) { | ||
73 | + qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", | ||
74 | + TYPE_IMX_FEC, __func__, phy); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | + reg %= 32; | ||
56 | + | 79 | + |
57 | + write_neon_element64(rn0_64, a->vd, 0, MO_64); | 80 | + trace_imx_phy_write(val, phy, reg); |
58 | + write_neon_element64(rn1_64, a->vd, 1, MO_64); | 81 | + |
59 | tcg_temp_free_i64(rn0_64); | 82 | switch (reg) { |
60 | tcg_temp_free_i64(rn1_64); | 83 | case 0: /* Basic Control */ |
61 | return true; | 84 | if (val & 0x8000) { |
85 | @@ -XXX,XX +XXX,XX @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value, | ||
86 | extract32(value, | ||
87 | 18, 10))); | ||
88 | } else { | ||
89 | - /* This a write operation */ | ||
90 | + /* This is a write operation */ | ||
91 | imx_phy_write(s, extract32(value, 18, 10), extract32(value, 0, 16)); | ||
92 | } | ||
93 | /* raise the interrupt as the PHY operation is done */ | ||
94 | @@ -XXX,XX +XXX,XX @@ static void imx_eth_realize(DeviceState *dev, Error **errp) | ||
95 | static Property imx_eth_properties[] = { | ||
96 | DEFINE_NIC_PROPERTIES(IMXFECState, conf), | ||
97 | DEFINE_PROP_UINT32("tx-ring-num", IMXFECState, tx_ring_num, 1), | ||
98 | + DEFINE_PROP_UINT32("phy-num", IMXFECState, phy_num, 0), | ||
99 | DEFINE_PROP_END_OF_LIST(), | ||
100 | }; | ||
101 | |||
102 | diff --git a/hw/net/trace-events b/hw/net/trace-events | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/hw/net/trace-events | ||
105 | +++ b/hw/net/trace-events | ||
106 | @@ -XXX,XX +XXX,XX @@ i82596_set_multicast(uint16_t count) "Added %d multicast entries" | ||
107 | i82596_channel_attention(void *s) "%p: Received CHANNEL ATTENTION" | ||
108 | |||
109 | # imx_fec.c | ||
110 | -imx_phy_read(uint32_t val, int reg) "0x%04"PRIx32" <= reg[%d]" | ||
111 | -imx_phy_write(uint32_t val, int reg) "0x%04"PRIx32" => reg[%d]" | ||
112 | +imx_phy_read(uint32_t val, int phy, int reg) "0x%04"PRIx32" <= phy[%d].reg[%d]" | ||
113 | +imx_phy_write(uint32_t val, int phy, int reg) "0x%04"PRIx32" => phy[%d].reg[%d]" | ||
114 | imx_phy_update_link(const char *s) "%s" | ||
115 | imx_phy_reset(void) "" | ||
116 | imx_fec_read_bd(uint64_t addr, int flags, int len, int data) "tx_bd 0x%"PRIx64" flags 0x%04x len %d data 0x%08x" | ||
62 | -- | 117 | -- |
63 | 2.20.1 | 118 | 2.20.1 |
64 | 119 | ||
65 | 120 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> |
---|---|---|---|
2 | 2 | ||
3 | The only uses of this function are for loading VFP | 3 | Add properties to the i.MX6UL processor to be able to select a |
4 | double-precision values, and nothing to do with NEON. | 4 | particular PHY on the MDIO bus for each FEC device. |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> |
7 | Message-id: 20201030022618.785675-10-richard.henderson@linaro.org | 7 | Message-id: ea1d604198b6b73ea6521676e45bacfc597aba53.1593296112.git.jcd@tribudubois.net |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | target/arm/translate.c | 8 ++-- | 11 | include/hw/arm/fsl-imx6ul.h | 2 ++ |
12 | target/arm/translate-vfp.c.inc | 84 +++++++++++++++++----------------- | 12 | hw/arm/fsl-imx6ul.c | 10 ++++++++++ |
13 | 2 files changed, 46 insertions(+), 46 deletions(-) | 13 | 2 files changed, 12 insertions(+) |
14 | 14 | ||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 17 | --- a/include/hw/arm/fsl-imx6ul.h |
18 | +++ b/target/arm/translate.c | 18 | +++ b/include/hw/arm/fsl-imx6ul.h |
19 | @@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg) | 19 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState { |
20 | } | 20 | MemoryRegion caam; |
21 | MemoryRegion ocram; | ||
22 | MemoryRegion ocram_alias; | ||
23 | + | ||
24 | + uint32_t phy_num[FSL_IMX6UL_NUM_ETHS]; | ||
25 | } FslIMX6ULState; | ||
26 | |||
27 | enum FslIMX6ULMemoryMap { | ||
28 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/fsl-imx6ul.c | ||
31 | +++ b/hw/arm/fsl-imx6ul.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
33 | FSL_IMX6UL_ENET2_TIMER_IRQ, | ||
34 | }; | ||
35 | |||
36 | + object_property_set_uint(OBJECT(&s->eth[i]), | ||
37 | + s->phy_num[i], | ||
38 | + "phy-num", &error_abort); | ||
39 | object_property_set_uint(OBJECT(&s->eth[i]), | ||
40 | FSL_IMX6UL_ETH_NUM_TX_RINGS, | ||
41 | "tx-ring-num", &error_abort); | ||
42 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
43 | FSL_IMX6UL_OCRAM_ALIAS_ADDR, &s->ocram_alias); | ||
21 | } | 44 | } |
22 | 45 | ||
23 | -static inline void neon_load_reg64(TCGv_i64 var, int reg) | 46 | +static Property fsl_imx6ul_properties[] = { |
24 | +static inline void vfp_load_reg64(TCGv_i64 var, int reg) | 47 | + DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0), |
48 | + DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1), | ||
49 | + DEFINE_PROP_END_OF_LIST(), | ||
50 | +}; | ||
51 | + | ||
52 | static void fsl_imx6ul_class_init(ObjectClass *oc, void *data) | ||
25 | { | 53 | { |
26 | - tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg)); | 54 | DeviceClass *dc = DEVICE_CLASS(oc); |
27 | + tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg)); | 55 | |
28 | } | 56 | + device_class_set_props(dc, fsl_imx6ul_properties); |
29 | 57 | dc->realize = fsl_imx6ul_realize; | |
30 | -static inline void neon_store_reg64(TCGv_i64 var, int reg) | 58 | dc->desc = "i.MX6UL SOC"; |
31 | +static inline void vfp_store_reg64(TCGv_i64 var, int reg) | 59 | /* Reason: Uses serial_hds and nd_table in realize() directly */ |
32 | { | ||
33 | - tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg)); | ||
34 | + tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg)); | ||
35 | } | ||
36 | |||
37 | static inline void vfp_load_reg32(TCGv_i32 var, int reg) | ||
38 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/translate-vfp.c.inc | ||
41 | +++ b/target/arm/translate-vfp.c.inc | ||
42 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) | ||
43 | tcg_gen_ext_i32_i64(nf, cpu_NF); | ||
44 | tcg_gen_ext_i32_i64(vf, cpu_VF); | ||
45 | |||
46 | - neon_load_reg64(frn, rn); | ||
47 | - neon_load_reg64(frm, rm); | ||
48 | + vfp_load_reg64(frn, rn); | ||
49 | + vfp_load_reg64(frm, rm); | ||
50 | switch (a->cc) { | ||
51 | case 0: /* eq: Z */ | ||
52 | tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) | ||
54 | tcg_temp_free_i64(tmp); | ||
55 | break; | ||
56 | } | ||
57 | - neon_store_reg64(dest, rd); | ||
58 | + vfp_store_reg64(dest, rd); | ||
59 | tcg_temp_free_i64(frn); | ||
60 | tcg_temp_free_i64(frm); | ||
61 | tcg_temp_free_i64(dest); | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) | ||
63 | TCGv_i64 tcg_res; | ||
64 | tcg_op = tcg_temp_new_i64(); | ||
65 | tcg_res = tcg_temp_new_i64(); | ||
66 | - neon_load_reg64(tcg_op, rm); | ||
67 | + vfp_load_reg64(tcg_op, rm); | ||
68 | gen_helper_rintd(tcg_res, tcg_op, fpst); | ||
69 | - neon_store_reg64(tcg_res, rd); | ||
70 | + vfp_store_reg64(tcg_res, rd); | ||
71 | tcg_temp_free_i64(tcg_op); | ||
72 | tcg_temp_free_i64(tcg_res); | ||
73 | } else { | ||
74 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) | ||
75 | tcg_double = tcg_temp_new_i64(); | ||
76 | tcg_res = tcg_temp_new_i64(); | ||
77 | tcg_tmp = tcg_temp_new_i32(); | ||
78 | - neon_load_reg64(tcg_double, rm); | ||
79 | + vfp_load_reg64(tcg_double, rm); | ||
80 | if (is_signed) { | ||
81 | gen_helper_vfp_tosld(tcg_res, tcg_double, tcg_shift, fpst); | ||
82 | } else { | ||
83 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a) | ||
84 | tmp = tcg_temp_new_i64(); | ||
85 | if (a->l) { | ||
86 | gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); | ||
87 | - neon_store_reg64(tmp, a->vd); | ||
88 | + vfp_store_reg64(tmp, a->vd); | ||
89 | } else { | ||
90 | - neon_load_reg64(tmp, a->vd); | ||
91 | + vfp_load_reg64(tmp, a->vd); | ||
92 | gen_aa32_st64(s, tmp, addr, get_mem_index(s)); | ||
93 | } | ||
94 | tcg_temp_free_i64(tmp); | ||
95 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
96 | if (a->l) { | ||
97 | /* load */ | ||
98 | gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); | ||
99 | - neon_store_reg64(tmp, a->vd + i); | ||
100 | + vfp_store_reg64(tmp, a->vd + i); | ||
101 | } else { | ||
102 | /* store */ | ||
103 | - neon_load_reg64(tmp, a->vd + i); | ||
104 | + vfp_load_reg64(tmp, a->vd + i); | ||
105 | gen_aa32_st64(s, tmp, addr, get_mem_index(s)); | ||
106 | } | ||
107 | tcg_gen_addi_i32(addr, addr, offset); | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, | ||
109 | fd = tcg_temp_new_i64(); | ||
110 | fpst = fpstatus_ptr(FPST_FPCR); | ||
111 | |||
112 | - neon_load_reg64(f0, vn); | ||
113 | - neon_load_reg64(f1, vm); | ||
114 | + vfp_load_reg64(f0, vn); | ||
115 | + vfp_load_reg64(f1, vm); | ||
116 | |||
117 | for (;;) { | ||
118 | if (reads_vd) { | ||
119 | - neon_load_reg64(fd, vd); | ||
120 | + vfp_load_reg64(fd, vd); | ||
121 | } | ||
122 | fn(fd, f0, f1, fpst); | ||
123 | - neon_store_reg64(fd, vd); | ||
124 | + vfp_store_reg64(fd, vd); | ||
125 | |||
126 | if (veclen == 0) { | ||
127 | break; | ||
128 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, | ||
129 | veclen--; | ||
130 | vd = vfp_advance_dreg(vd, delta_d); | ||
131 | vn = vfp_advance_dreg(vn, delta_d); | ||
132 | - neon_load_reg64(f0, vn); | ||
133 | + vfp_load_reg64(f0, vn); | ||
134 | if (delta_m) { | ||
135 | vm = vfp_advance_dreg(vm, delta_m); | ||
136 | - neon_load_reg64(f1, vm); | ||
137 | + vfp_load_reg64(f1, vm); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) | ||
142 | f0 = tcg_temp_new_i64(); | ||
143 | fd = tcg_temp_new_i64(); | ||
144 | |||
145 | - neon_load_reg64(f0, vm); | ||
146 | + vfp_load_reg64(f0, vm); | ||
147 | |||
148 | for (;;) { | ||
149 | fn(fd, f0); | ||
150 | - neon_store_reg64(fd, vd); | ||
151 | + vfp_store_reg64(fd, vd); | ||
152 | |||
153 | if (veclen == 0) { | ||
154 | break; | ||
155 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) | ||
156 | /* single source one-many */ | ||
157 | while (veclen--) { | ||
158 | vd = vfp_advance_dreg(vd, delta_d); | ||
159 | - neon_store_reg64(fd, vd); | ||
160 | + vfp_store_reg64(fd, vd); | ||
161 | } | ||
162 | break; | ||
163 | } | ||
164 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) | ||
165 | veclen--; | ||
166 | vd = vfp_advance_dreg(vd, delta_d); | ||
167 | vd = vfp_advance_dreg(vm, delta_m); | ||
168 | - neon_load_reg64(f0, vm); | ||
169 | + vfp_load_reg64(f0, vm); | ||
170 | } | ||
171 | |||
172 | tcg_temp_free_i64(f0); | ||
173 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) | ||
174 | vm = tcg_temp_new_i64(); | ||
175 | vd = tcg_temp_new_i64(); | ||
176 | |||
177 | - neon_load_reg64(vn, a->vn); | ||
178 | - neon_load_reg64(vm, a->vm); | ||
179 | + vfp_load_reg64(vn, a->vn); | ||
180 | + vfp_load_reg64(vm, a->vm); | ||
181 | if (neg_n) { | ||
182 | /* VFNMS, VFMS */ | ||
183 | gen_helper_vfp_negd(vn, vn); | ||
184 | } | ||
185 | - neon_load_reg64(vd, a->vd); | ||
186 | + vfp_load_reg64(vd, a->vd); | ||
187 | if (neg_d) { | ||
188 | /* VFNMA, VFNMS */ | ||
189 | gen_helper_vfp_negd(vd, vd); | ||
190 | } | ||
191 | fpst = fpstatus_ptr(FPST_FPCR); | ||
192 | gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst); | ||
193 | - neon_store_reg64(vd, a->vd); | ||
194 | + vfp_store_reg64(vd, a->vd); | ||
195 | |||
196 | tcg_temp_free_ptr(fpst); | ||
197 | tcg_temp_free_i64(vn); | ||
198 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) | ||
199 | fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm)); | ||
200 | |||
201 | for (;;) { | ||
202 | - neon_store_reg64(fd, vd); | ||
203 | + vfp_store_reg64(fd, vd); | ||
204 | |||
205 | if (veclen == 0) { | ||
206 | break; | ||
207 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) | ||
208 | vd = tcg_temp_new_i64(); | ||
209 | vm = tcg_temp_new_i64(); | ||
210 | |||
211 | - neon_load_reg64(vd, a->vd); | ||
212 | + vfp_load_reg64(vd, a->vd); | ||
213 | if (a->z) { | ||
214 | tcg_gen_movi_i64(vm, 0); | ||
215 | } else { | ||
216 | - neon_load_reg64(vm, a->vm); | ||
217 | + vfp_load_reg64(vm, a->vm); | ||
218 | } | ||
219 | |||
220 | if (a->e) { | ||
221 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) | ||
222 | tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t)); | ||
223 | vd = tcg_temp_new_i64(); | ||
224 | gen_helper_vfp_fcvt_f16_to_f64(vd, tmp, fpst, ahp_mode); | ||
225 | - neon_store_reg64(vd, a->vd); | ||
226 | + vfp_store_reg64(vd, a->vd); | ||
227 | tcg_temp_free_i32(ahp_mode); | ||
228 | tcg_temp_free_ptr(fpst); | ||
229 | tcg_temp_free_i32(tmp); | ||
230 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) | ||
231 | tmp = tcg_temp_new_i32(); | ||
232 | vm = tcg_temp_new_i64(); | ||
233 | |||
234 | - neon_load_reg64(vm, a->vm); | ||
235 | + vfp_load_reg64(vm, a->vm); | ||
236 | gen_helper_vfp_fcvt_f64_to_f16(tmp, vm, fpst, ahp_mode); | ||
237 | tcg_temp_free_i64(vm); | ||
238 | tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t)); | ||
239 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) | ||
240 | } | ||
241 | |||
242 | tmp = tcg_temp_new_i64(); | ||
243 | - neon_load_reg64(tmp, a->vm); | ||
244 | + vfp_load_reg64(tmp, a->vm); | ||
245 | fpst = fpstatus_ptr(FPST_FPCR); | ||
246 | gen_helper_rintd(tmp, tmp, fpst); | ||
247 | - neon_store_reg64(tmp, a->vd); | ||
248 | + vfp_store_reg64(tmp, a->vd); | ||
249 | tcg_temp_free_ptr(fpst); | ||
250 | tcg_temp_free_i64(tmp); | ||
251 | return true; | ||
252 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) | ||
253 | } | ||
254 | |||
255 | tmp = tcg_temp_new_i64(); | ||
256 | - neon_load_reg64(tmp, a->vm); | ||
257 | + vfp_load_reg64(tmp, a->vm); | ||
258 | fpst = fpstatus_ptr(FPST_FPCR); | ||
259 | tcg_rmode = tcg_const_i32(float_round_to_zero); | ||
260 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
261 | gen_helper_rintd(tmp, tmp, fpst); | ||
262 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
263 | - neon_store_reg64(tmp, a->vd); | ||
264 | + vfp_store_reg64(tmp, a->vd); | ||
265 | tcg_temp_free_ptr(fpst); | ||
266 | tcg_temp_free_i64(tmp); | ||
267 | tcg_temp_free_i32(tcg_rmode); | ||
268 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) | ||
269 | } | ||
270 | |||
271 | tmp = tcg_temp_new_i64(); | ||
272 | - neon_load_reg64(tmp, a->vm); | ||
273 | + vfp_load_reg64(tmp, a->vm); | ||
274 | fpst = fpstatus_ptr(FPST_FPCR); | ||
275 | gen_helper_rintd_exact(tmp, tmp, fpst); | ||
276 | - neon_store_reg64(tmp, a->vd); | ||
277 | + vfp_store_reg64(tmp, a->vd); | ||
278 | tcg_temp_free_ptr(fpst); | ||
279 | tcg_temp_free_i64(tmp); | ||
280 | return true; | ||
281 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) | ||
282 | vd = tcg_temp_new_i64(); | ||
283 | vfp_load_reg32(vm, a->vm); | ||
284 | gen_helper_vfp_fcvtds(vd, vm, cpu_env); | ||
285 | - neon_store_reg64(vd, a->vd); | ||
286 | + vfp_store_reg64(vd, a->vd); | ||
287 | tcg_temp_free_i32(vm); | ||
288 | tcg_temp_free_i64(vd); | ||
289 | return true; | ||
290 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) | ||
291 | |||
292 | vd = tcg_temp_new_i32(); | ||
293 | vm = tcg_temp_new_i64(); | ||
294 | - neon_load_reg64(vm, a->vm); | ||
295 | + vfp_load_reg64(vm, a->vm); | ||
296 | gen_helper_vfp_fcvtsd(vd, vm, cpu_env); | ||
297 | vfp_store_reg32(vd, a->vd); | ||
298 | tcg_temp_free_i32(vd); | ||
299 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) | ||
300 | /* u32 -> f64 */ | ||
301 | gen_helper_vfp_uitod(vd, vm, fpst); | ||
302 | } | ||
303 | - neon_store_reg64(vd, a->vd); | ||
304 | + vfp_store_reg64(vd, a->vd); | ||
305 | tcg_temp_free_i32(vm); | ||
306 | tcg_temp_free_i64(vd); | ||
307 | tcg_temp_free_ptr(fpst); | ||
308 | @@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) | ||
309 | |||
310 | vm = tcg_temp_new_i64(); | ||
311 | vd = tcg_temp_new_i32(); | ||
312 | - neon_load_reg64(vm, a->vm); | ||
313 | + vfp_load_reg64(vm, a->vm); | ||
314 | gen_helper_vjcvt(vd, vm, cpu_env); | ||
315 | vfp_store_reg32(vd, a->vd); | ||
316 | tcg_temp_free_i64(vm); | ||
317 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
318 | frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm); | ||
319 | |||
320 | vd = tcg_temp_new_i64(); | ||
321 | - neon_load_reg64(vd, a->vd); | ||
322 | + vfp_load_reg64(vd, a->vd); | ||
323 | |||
324 | fpst = fpstatus_ptr(FPST_FPCR); | ||
325 | shift = tcg_const_i32(frac_bits); | ||
326 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) | ||
327 | g_assert_not_reached(); | ||
328 | } | ||
329 | |||
330 | - neon_store_reg64(vd, a->vd); | ||
331 | + vfp_store_reg64(vd, a->vd); | ||
332 | tcg_temp_free_i64(vd); | ||
333 | tcg_temp_free_i32(shift); | ||
334 | tcg_temp_free_ptr(fpst); | ||
335 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) | ||
336 | fpst = fpstatus_ptr(FPST_FPCR); | ||
337 | vm = tcg_temp_new_i64(); | ||
338 | vd = tcg_temp_new_i32(); | ||
339 | - neon_load_reg64(vm, a->vm); | ||
340 | + vfp_load_reg64(vm, a->vm); | ||
341 | |||
342 | if (a->s) { | ||
343 | if (a->rz) { | ||
344 | -- | 60 | -- |
345 | 2.20.1 | 61 | 2.20.1 |
346 | 62 | ||
347 | 63 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | ||
1 | 2 | ||
3 | The i.MX6UL EVK 14x14 board uses: | ||
4 | - PHY 2 for FEC 1 | ||
5 | - PHY 1 for FEC 2 | ||
6 | |||
7 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | ||
8 | Message-id: fb41992126c091a71d76ab3d1898959091f60583.1593296112.git.jcd@tribudubois.net | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/mcimx6ul-evk.c | 2 ++ | ||
13 | 1 file changed, 2 insertions(+) | ||
14 | |||
15 | diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/mcimx6ul-evk.c | ||
18 | +++ b/hw/arm/mcimx6ul-evk.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void mcimx6ul_evk_init(MachineState *machine) | ||
20 | |||
21 | s = FSL_IMX6UL(object_new(TYPE_FSL_IMX6UL)); | ||
22 | object_property_add_child(OBJECT(machine), "soc", OBJECT(s)); | ||
23 | + object_property_set_uint(OBJECT(s), 2, "fec1-phy-num", &error_fatal); | ||
24 | + object_property_set_uint(OBJECT(s), 1, "fec2-phy-num", &error_fatal); | ||
25 | qdev_realize(DEVICE(s), NULL, &error_fatal); | ||
26 | |||
27 | memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR, | ||
28 | -- | ||
29 | 2.20.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
1 | From: AlexChen <alex.chen@huawei.com> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | In omap_lcd_interrupts(), the pointer omap_lcd is dereferinced before | 3 | Introduce a new property defining a reserved region: |
4 | being check if it is valid, which may lead to NULL pointer dereference. | 4 | <low address>:<high address>:<type>. |
5 | So move the assignment to surface after checking that the omap_lcd is valid | ||
6 | and move surface_bits_per_pixel(surface) to after the surface assignment. | ||
7 | 5 | ||
8 | Reported-by: Euler Robot <euler.robot@huawei.com> | 6 | This will be used to encode reserved IOVA regions. |
9 | Signed-off-by: AlexChen <alex.chen@huawei.com> | 7 | |
10 | Message-id: 5F9CDB8A.9000001@huawei.com | 8 | For instance, in virtio-iommu use case, reserved IOVA regions |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | will be passed by the machine code to the virtio-iommu-pci |
10 | device (an array of those). The type of the reserved region | ||
11 | will match the virtio_iommu_probe_resv_mem subtype value: | ||
12 | - VIRTIO_IOMMU_RESV_MEM_T_RESERVED (0) | ||
13 | - VIRTIO_IOMMU_RESV_MEM_T_MSI (1) | ||
14 | |||
15 | on PC/Q35 machine, this will be used to inform the | ||
16 | virtio-iommu-pci device it should bypass the MSI region. | ||
17 | The reserved region will be: 0xfee00000:0xfeefffff:1. | ||
18 | |||
19 | On ARM, we can declare the ITS MSI doorbell as an MSI | ||
20 | region to prevent MSIs from being mapped on guest side. | ||
21 | |||
22 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
23 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
24 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
25 | Message-id: 20200629070404.10969-2-eric.auger@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 27 | --- |
14 | hw/display/omap_lcdc.c | 10 +++++++--- | 28 | include/exec/memory.h | 6 +++ |
15 | 1 file changed, 7 insertions(+), 3 deletions(-) | 29 | include/hw/qdev-properties.h | 3 ++ |
30 | include/qemu/typedefs.h | 1 + | ||
31 | hw/core/qdev-properties.c | 89 ++++++++++++++++++++++++++++++++++++ | ||
32 | 4 files changed, 99 insertions(+) | ||
16 | 33 | ||
17 | diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c | 34 | diff --git a/include/exec/memory.h b/include/exec/memory.h |
18 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/display/omap_lcdc.c | 36 | --- a/include/exec/memory.h |
20 | +++ b/hw/display/omap_lcdc.c | 37 | +++ b/include/exec/memory.h |
21 | @@ -XXX,XX +XXX,XX @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s) | 38 | @@ -XXX,XX +XXX,XX @@ extern bool global_dirty_log; |
22 | static void omap_update_display(void *opaque) | 39 | |
23 | { | 40 | typedef struct MemoryRegionOps MemoryRegionOps; |
24 | struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque; | 41 | |
25 | - DisplaySurface *surface = qemu_console_surface(omap_lcd->con); | 42 | +struct ReservedRegion { |
26 | + DisplaySurface *surface; | 43 | + hwaddr low; |
27 | draw_line_func draw_line; | 44 | + hwaddr high; |
28 | int size, height, first, last; | 45 | + unsigned type; |
29 | int width, linesize, step, bpp, frame_offset; | 46 | +}; |
30 | hwaddr frame_base; | 47 | + |
31 | 48 | typedef struct IOMMUTLBEntry IOMMUTLBEntry; | |
32 | - if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable || | 49 | |
33 | - !surface_bits_per_pixel(surface)) { | 50 | /* See address_space_translate: bit 0 is read, bit 1 is write. */ |
34 | + if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable) { | 51 | diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h |
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/include/hw/qdev-properties.h | ||
54 | +++ b/include/hw/qdev-properties.h | ||
55 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_string; | ||
56 | extern const PropertyInfo qdev_prop_chr; | ||
57 | extern const PropertyInfo qdev_prop_tpm; | ||
58 | extern const PropertyInfo qdev_prop_macaddr; | ||
59 | +extern const PropertyInfo qdev_prop_reserved_region; | ||
60 | extern const PropertyInfo qdev_prop_on_off_auto; | ||
61 | extern const PropertyInfo qdev_prop_multifd_compression; | ||
62 | extern const PropertyInfo qdev_prop_losttickpolicy; | ||
63 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_pcie_link_width; | ||
64 | DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *) | ||
65 | #define DEFINE_PROP_MACADDR(_n, _s, _f) \ | ||
66 | DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) | ||
67 | +#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \ | ||
68 | + DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion) | ||
69 | #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ | ||
70 | DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) | ||
71 | #define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ | ||
72 | diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/include/qemu/typedefs.h | ||
75 | +++ b/include/qemu/typedefs.h | ||
76 | @@ -XXX,XX +XXX,XX @@ typedef struct ISABus ISABus; | ||
77 | typedef struct ISADevice ISADevice; | ||
78 | typedef struct IsaDma IsaDma; | ||
79 | typedef struct MACAddr MACAddr; | ||
80 | +typedef struct ReservedRegion ReservedRegion; | ||
81 | typedef struct MachineClass MachineClass; | ||
82 | typedef struct MachineState MachineState; | ||
83 | typedef struct MemoryListener MemoryListener; | ||
84 | diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/core/qdev-properties.c | ||
87 | +++ b/hw/core/qdev-properties.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | #include "chardev/char.h" | ||
90 | #include "qemu/uuid.h" | ||
91 | #include "qemu/units.h" | ||
92 | +#include "qemu/cutils.h" | ||
93 | |||
94 | void qdev_prop_set_after_realize(DeviceState *dev, const char *name, | ||
95 | Error **errp) | ||
96 | @@ -XXX,XX +XXX,XX @@ const PropertyInfo qdev_prop_macaddr = { | ||
97 | .set = set_mac, | ||
98 | }; | ||
99 | |||
100 | +/* --- Reserved Region --- */ | ||
101 | + | ||
102 | +/* | ||
103 | + * Accepted syntax: | ||
104 | + * <low address>:<high address>:<type> | ||
105 | + * where low/high addresses are uint64_t in hexadecimal | ||
106 | + * and type is a non-negative decimal integer | ||
107 | + */ | ||
108 | +static void get_reserved_region(Object *obj, Visitor *v, const char *name, | ||
109 | + void *opaque, Error **errp) | ||
110 | +{ | ||
111 | + DeviceState *dev = DEVICE(obj); | ||
112 | + Property *prop = opaque; | ||
113 | + ReservedRegion *rr = qdev_get_prop_ptr(dev, prop); | ||
114 | + char buffer[64]; | ||
115 | + char *p = buffer; | ||
116 | + int rc; | ||
117 | + | ||
118 | + rc = snprintf(buffer, sizeof(buffer), "0x%"PRIx64":0x%"PRIx64":%u", | ||
119 | + rr->low, rr->high, rr->type); | ||
120 | + assert(rc < sizeof(buffer)); | ||
121 | + | ||
122 | + visit_type_str(v, name, &p, errp); | ||
123 | +} | ||
124 | + | ||
125 | +static void set_reserved_region(Object *obj, Visitor *v, const char *name, | ||
126 | + void *opaque, Error **errp) | ||
127 | +{ | ||
128 | + DeviceState *dev = DEVICE(obj); | ||
129 | + Property *prop = opaque; | ||
130 | + ReservedRegion *rr = qdev_get_prop_ptr(dev, prop); | ||
131 | + Error *local_err = NULL; | ||
132 | + const char *endptr; | ||
133 | + char *str; | ||
134 | + int ret; | ||
135 | + | ||
136 | + if (dev->realized) { | ||
137 | + qdev_prop_set_after_realize(dev, name, errp); | ||
35 | + return; | 138 | + return; |
36 | + } | 139 | + } |
37 | + | 140 | + |
38 | + surface = qemu_console_surface(omap_lcd->con); | 141 | + visit_type_str(v, name, &str, &local_err); |
39 | + if (!surface_bits_per_pixel(surface)) { | 142 | + if (local_err) { |
40 | return; | 143 | + error_propagate(errp, local_err); |
41 | } | 144 | + return; |
42 | 145 | + } | |
146 | + | ||
147 | + ret = qemu_strtou64(str, &endptr, 16, &rr->low); | ||
148 | + if (ret) { | ||
149 | + error_setg(errp, "start address of '%s'" | ||
150 | + " must be a hexadecimal integer", name); | ||
151 | + goto out; | ||
152 | + } | ||
153 | + if (*endptr != ':') { | ||
154 | + goto separator_error; | ||
155 | + } | ||
156 | + | ||
157 | + ret = qemu_strtou64(endptr + 1, &endptr, 16, &rr->high); | ||
158 | + if (ret) { | ||
159 | + error_setg(errp, "end address of '%s'" | ||
160 | + " must be a hexadecimal integer", name); | ||
161 | + goto out; | ||
162 | + } | ||
163 | + if (*endptr != ':') { | ||
164 | + goto separator_error; | ||
165 | + } | ||
166 | + | ||
167 | + ret = qemu_strtoui(endptr + 1, &endptr, 10, &rr->type); | ||
168 | + if (ret) { | ||
169 | + error_setg(errp, "type of '%s'" | ||
170 | + " must be a non-negative decimal integer", name); | ||
171 | + } | ||
172 | + goto out; | ||
173 | + | ||
174 | +separator_error: | ||
175 | + error_setg(errp, "reserved region fields must be separated with ':'"); | ||
176 | +out: | ||
177 | + g_free(str); | ||
178 | + return; | ||
179 | +} | ||
180 | + | ||
181 | +const PropertyInfo qdev_prop_reserved_region = { | ||
182 | + .name = "reserved_region", | ||
183 | + .description = "Reserved Region, example: 0xFEE00000:0xFEEFFFFF:0", | ||
184 | + .get = get_reserved_region, | ||
185 | + .set = set_reserved_region, | ||
186 | +}; | ||
187 | + | ||
188 | /* --- on/off/auto --- */ | ||
189 | |||
190 | const PropertyInfo qdev_prop_on_off_auto = { | ||
43 | -- | 191 | -- |
44 | 2.20.1 | 192 | 2.20.1 |
45 | 193 | ||
46 | 194 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The only uses of this function are for loading VFP | 3 | This patch implements the PROBE request. At the moment, |
4 | single-precision values, and nothing to do with NEON. | 4 | only THE RESV_MEM property is handled. The first goal is |
5 | 5 | to report iommu wide reserved regions such as the MSI regions | |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | set by the machine code. On x86 this will be the IOAPIC MSI |
7 | Message-id: 20201030022618.785675-8-richard.henderson@linaro.org | 7 | region, [0xFEE00000 - 0xFEEFFFFF], on ARM this may be the ITS |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | doorbell. |
9 | |||
10 | In the future we may introduce per device reserved regions. | ||
11 | This will be useful when protecting host assigned devices | ||
12 | which may expose their own reserved regions | ||
13 | |||
14 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
15 | Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
16 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
17 | Message-id: 20200629070404.10969-3-eric.auger@redhat.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 19 | --- |
11 | target/arm/translate.c | 4 +- | 20 | include/hw/virtio/virtio-iommu.h | 2 + |
12 | target/arm/translate-vfp.c.inc | 184 ++++++++++++++++----------------- | 21 | hw/virtio/virtio-iommu.c | 94 ++++++++++++++++++++++++++++++-- |
13 | 2 files changed, 94 insertions(+), 94 deletions(-) | 22 | hw/virtio/trace-events | 1 + |
14 | 23 | 3 files changed, 93 insertions(+), 4 deletions(-) | |
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 24 | |
25 | diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 27 | --- a/include/hw/virtio/virtio-iommu.h |
18 | +++ b/target/arm/translate.c | 28 | +++ b/include/hw/virtio/virtio-iommu.h |
19 | @@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg64(TCGv_i64 var, int reg) | 29 | @@ -XXX,XX +XXX,XX @@ typedef struct VirtIOIOMMU { |
20 | tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg)); | 30 | GHashTable *as_by_busptr; |
31 | IOMMUPciBus *iommu_pcibus_by_bus_num[PCI_BUS_MAX]; | ||
32 | PCIBus *primary_bus; | ||
33 | + ReservedRegion *reserved_regions; | ||
34 | + uint32_t nb_reserved_regions; | ||
35 | GTree *domains; | ||
36 | QemuMutex mutex; | ||
37 | GTree *endpoints; | ||
38 | diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/virtio/virtio-iommu.c | ||
41 | +++ b/hw/virtio/virtio-iommu.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | |||
44 | /* Max size */ | ||
45 | #define VIOMMU_DEFAULT_QUEUE_SIZE 256 | ||
46 | +#define VIOMMU_PROBE_SIZE 512 | ||
47 | |||
48 | typedef struct VirtIOIOMMUDomain { | ||
49 | uint32_t id; | ||
50 | @@ -XXX,XX +XXX,XX @@ static int virtio_iommu_unmap(VirtIOIOMMU *s, | ||
51 | return ret; | ||
21 | } | 52 | } |
22 | 53 | ||
23 | -static inline void neon_load_reg32(TCGv_i32 var, int reg) | 54 | +static ssize_t virtio_iommu_fill_resv_mem_prop(VirtIOIOMMU *s, uint32_t ep, |
24 | +static inline void vfp_load_reg32(TCGv_i32 var, int reg) | 55 | + uint8_t *buf, size_t free) |
56 | +{ | ||
57 | + struct virtio_iommu_probe_resv_mem prop = {}; | ||
58 | + size_t size = sizeof(prop), length = size - sizeof(prop.head), total; | ||
59 | + int i; | ||
60 | + | ||
61 | + total = size * s->nb_reserved_regions; | ||
62 | + | ||
63 | + if (total > free) { | ||
64 | + return -ENOSPC; | ||
65 | + } | ||
66 | + | ||
67 | + for (i = 0; i < s->nb_reserved_regions; i++) { | ||
68 | + unsigned subtype = s->reserved_regions[i].type; | ||
69 | + | ||
70 | + assert(subtype == VIRTIO_IOMMU_RESV_MEM_T_RESERVED || | ||
71 | + subtype == VIRTIO_IOMMU_RESV_MEM_T_MSI); | ||
72 | + prop.head.type = cpu_to_le16(VIRTIO_IOMMU_PROBE_T_RESV_MEM); | ||
73 | + prop.head.length = cpu_to_le16(length); | ||
74 | + prop.subtype = subtype; | ||
75 | + prop.start = cpu_to_le64(s->reserved_regions[i].low); | ||
76 | + prop.end = cpu_to_le64(s->reserved_regions[i].high); | ||
77 | + | ||
78 | + memcpy(buf, &prop, size); | ||
79 | + | ||
80 | + trace_virtio_iommu_fill_resv_property(ep, prop.subtype, | ||
81 | + prop.start, prop.end); | ||
82 | + buf += size; | ||
83 | + } | ||
84 | + return total; | ||
85 | +} | ||
86 | + | ||
87 | +/** | ||
88 | + * virtio_iommu_probe - Fill the probe request buffer with | ||
89 | + * the properties the device is able to return | ||
90 | + */ | ||
91 | +static int virtio_iommu_probe(VirtIOIOMMU *s, | ||
92 | + struct virtio_iommu_req_probe *req, | ||
93 | + uint8_t *buf) | ||
94 | +{ | ||
95 | + uint32_t ep_id = le32_to_cpu(req->endpoint); | ||
96 | + size_t free = VIOMMU_PROBE_SIZE; | ||
97 | + ssize_t count; | ||
98 | + | ||
99 | + if (!virtio_iommu_mr(s, ep_id)) { | ||
100 | + return VIRTIO_IOMMU_S_NOENT; | ||
101 | + } | ||
102 | + | ||
103 | + count = virtio_iommu_fill_resv_mem_prop(s, ep_id, buf, free); | ||
104 | + if (count < 0) { | ||
105 | + return VIRTIO_IOMMU_S_INVAL; | ||
106 | + } | ||
107 | + buf += count; | ||
108 | + free -= count; | ||
109 | + | ||
110 | + return VIRTIO_IOMMU_S_OK; | ||
111 | +} | ||
112 | + | ||
113 | static int virtio_iommu_iov_to_req(struct iovec *iov, | ||
114 | unsigned int iov_cnt, | ||
115 | void *req, size_t req_sz) | ||
116 | @@ -XXX,XX +XXX,XX @@ virtio_iommu_handle_req(detach) | ||
117 | virtio_iommu_handle_req(map) | ||
118 | virtio_iommu_handle_req(unmap) | ||
119 | |||
120 | +static int virtio_iommu_handle_probe(VirtIOIOMMU *s, | ||
121 | + struct iovec *iov, | ||
122 | + unsigned int iov_cnt, | ||
123 | + uint8_t *buf) | ||
124 | +{ | ||
125 | + struct virtio_iommu_req_probe req; | ||
126 | + int ret = virtio_iommu_iov_to_req(iov, iov_cnt, &req, sizeof(req)); | ||
127 | + | ||
128 | + return ret ? ret : virtio_iommu_probe(s, &req, buf); | ||
129 | +} | ||
130 | + | ||
131 | static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) | ||
25 | { | 132 | { |
26 | tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 133 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); |
134 | struct virtio_iommu_req_head head; | ||
135 | struct virtio_iommu_req_tail tail = {}; | ||
136 | + size_t output_size = sizeof(tail), sz; | ||
137 | VirtQueueElement *elem; | ||
138 | unsigned int iov_cnt; | ||
139 | struct iovec *iov; | ||
140 | - size_t sz; | ||
141 | + void *buf = NULL; | ||
142 | |||
143 | for (;;) { | ||
144 | elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); | ||
145 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) | ||
146 | case VIRTIO_IOMMU_T_UNMAP: | ||
147 | tail.status = virtio_iommu_handle_unmap(s, iov, iov_cnt); | ||
148 | break; | ||
149 | + case VIRTIO_IOMMU_T_PROBE: | ||
150 | + { | ||
151 | + struct virtio_iommu_req_tail *ptail; | ||
152 | + | ||
153 | + output_size = s->config.probe_size + sizeof(tail); | ||
154 | + buf = g_malloc0(output_size); | ||
155 | + | ||
156 | + ptail = (struct virtio_iommu_req_tail *) | ||
157 | + (buf + s->config.probe_size); | ||
158 | + ptail->status = virtio_iommu_handle_probe(s, iov, iov_cnt, buf); | ||
159 | + } | ||
160 | default: | ||
161 | tail.status = VIRTIO_IOMMU_S_UNSUPP; | ||
162 | } | ||
163 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) | ||
164 | |||
165 | out: | ||
166 | sz = iov_from_buf(elem->in_sg, elem->in_num, 0, | ||
167 | - &tail, sizeof(tail)); | ||
168 | - assert(sz == sizeof(tail)); | ||
169 | + buf ? buf : &tail, output_size); | ||
170 | + assert(sz == output_size); | ||
171 | |||
172 | - virtqueue_push(vq, elem, sizeof(tail)); | ||
173 | + virtqueue_push(vq, elem, sz); | ||
174 | virtio_notify(vdev, vq); | ||
175 | g_free(elem); | ||
176 | + g_free(buf); | ||
177 | } | ||
27 | } | 178 | } |
28 | 179 | ||
29 | -static inline void neon_store_reg32(TCGv_i32 var, int reg) | 180 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_device_realize(DeviceState *dev, Error **errp) |
30 | +static inline void vfp_store_reg32(TCGv_i32 var, int reg) | 181 | s->config.page_size_mask = TARGET_PAGE_MASK; |
31 | { | 182 | s->config.input_range.end = -1UL; |
32 | tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 183 | s->config.domain_range.end = 32; |
33 | } | 184 | + s->config.probe_size = VIOMMU_PROBE_SIZE; |
34 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | 185 | |
186 | virtio_add_feature(&s->features, VIRTIO_RING_F_EVENT_IDX); | ||
187 | virtio_add_feature(&s->features, VIRTIO_RING_F_INDIRECT_DESC); | ||
188 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_device_realize(DeviceState *dev, Error **errp) | ||
189 | virtio_add_feature(&s->features, VIRTIO_IOMMU_F_MAP_UNMAP); | ||
190 | virtio_add_feature(&s->features, VIRTIO_IOMMU_F_BYPASS); | ||
191 | virtio_add_feature(&s->features, VIRTIO_IOMMU_F_MMIO); | ||
192 | + virtio_add_feature(&s->features, VIRTIO_IOMMU_F_PROBE); | ||
193 | |||
194 | qemu_mutex_init(&s->mutex); | ||
195 | |||
196 | diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events | ||
35 | index XXXXXXX..XXXXXXX 100644 | 197 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/translate-vfp.c.inc | 198 | --- a/hw/virtio/trace-events |
37 | +++ b/target/arm/translate-vfp.c.inc | 199 | +++ b/hw/virtio/trace-events |
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) | 200 | @@ -XXX,XX +XXX,XX @@ virtio_iommu_get_domain(uint32_t domain_id) "Alloc domain=%d" |
39 | frn = tcg_temp_new_i32(); | 201 | virtio_iommu_put_domain(uint32_t domain_id) "Free domain=%d" |
40 | frm = tcg_temp_new_i32(); | 202 | virtio_iommu_translate_out(uint64_t virt_addr, uint64_t phys_addr, uint32_t sid) "0x%"PRIx64" -> 0x%"PRIx64 " for sid=%d" |
41 | dest = tcg_temp_new_i32(); | 203 | virtio_iommu_report_fault(uint8_t reason, uint32_t flags, uint32_t endpoint, uint64_t addr) "FAULT reason=%d flags=%d endpoint=%d address =0x%"PRIx64 |
42 | - neon_load_reg32(frn, rn); | 204 | +virtio_iommu_fill_resv_property(uint32_t devid, uint8_t subtype, uint64_t start, uint64_t end) "dev= %d, type=%d start=0x%"PRIx64" end=0x%"PRIx64 |
43 | - neon_load_reg32(frm, rm); | ||
44 | + vfp_load_reg32(frn, rn); | ||
45 | + vfp_load_reg32(frm, rm); | ||
46 | switch (a->cc) { | ||
47 | case 0: /* eq: Z */ | ||
48 | tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) | ||
50 | if (sz == 1) { | ||
51 | tcg_gen_andi_i32(dest, dest, 0xffff); | ||
52 | } | ||
53 | - neon_store_reg32(dest, rd); | ||
54 | + vfp_store_reg32(dest, rd); | ||
55 | tcg_temp_free_i32(frn); | ||
56 | tcg_temp_free_i32(frm); | ||
57 | tcg_temp_free_i32(dest); | ||
58 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) | ||
59 | TCGv_i32 tcg_res; | ||
60 | tcg_op = tcg_temp_new_i32(); | ||
61 | tcg_res = tcg_temp_new_i32(); | ||
62 | - neon_load_reg32(tcg_op, rm); | ||
63 | + vfp_load_reg32(tcg_op, rm); | ||
64 | if (sz == 1) { | ||
65 | gen_helper_rinth(tcg_res, tcg_op, fpst); | ||
66 | } else { | ||
67 | gen_helper_rints(tcg_res, tcg_op, fpst); | ||
68 | } | ||
69 | - neon_store_reg32(tcg_res, rd); | ||
70 | + vfp_store_reg32(tcg_res, rd); | ||
71 | tcg_temp_free_i32(tcg_op); | ||
72 | tcg_temp_free_i32(tcg_res); | ||
73 | } | ||
74 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) | ||
75 | gen_helper_vfp_tould(tcg_res, tcg_double, tcg_shift, fpst); | ||
76 | } | ||
77 | tcg_gen_extrl_i64_i32(tcg_tmp, tcg_res); | ||
78 | - neon_store_reg32(tcg_tmp, rd); | ||
79 | + vfp_store_reg32(tcg_tmp, rd); | ||
80 | tcg_temp_free_i32(tcg_tmp); | ||
81 | tcg_temp_free_i64(tcg_res); | ||
82 | tcg_temp_free_i64(tcg_double); | ||
83 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) | ||
84 | TCGv_i32 tcg_single, tcg_res; | ||
85 | tcg_single = tcg_temp_new_i32(); | ||
86 | tcg_res = tcg_temp_new_i32(); | ||
87 | - neon_load_reg32(tcg_single, rm); | ||
88 | + vfp_load_reg32(tcg_single, rm); | ||
89 | if (sz == 1) { | ||
90 | if (is_signed) { | ||
91 | gen_helper_vfp_toslh(tcg_res, tcg_single, tcg_shift, fpst); | ||
92 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) | ||
93 | gen_helper_vfp_touls(tcg_res, tcg_single, tcg_shift, fpst); | ||
94 | } | ||
95 | } | ||
96 | - neon_store_reg32(tcg_res, rd); | ||
97 | + vfp_store_reg32(tcg_res, rd); | ||
98 | tcg_temp_free_i32(tcg_res); | ||
99 | tcg_temp_free_i32(tcg_single); | ||
100 | } | ||
101 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_half(DisasContext *s, arg_VMOV_single *a) | ||
102 | if (a->l) { | ||
103 | /* VFP to general purpose register */ | ||
104 | tmp = tcg_temp_new_i32(); | ||
105 | - neon_load_reg32(tmp, a->vn); | ||
106 | + vfp_load_reg32(tmp, a->vn); | ||
107 | tcg_gen_andi_i32(tmp, tmp, 0xffff); | ||
108 | store_reg(s, a->rt, tmp); | ||
109 | } else { | ||
110 | /* general purpose register to VFP */ | ||
111 | tmp = load_reg(s, a->rt); | ||
112 | tcg_gen_andi_i32(tmp, tmp, 0xffff); | ||
113 | - neon_store_reg32(tmp, a->vn); | ||
114 | + vfp_store_reg32(tmp, a->vn); | ||
115 | tcg_temp_free_i32(tmp); | ||
116 | } | ||
117 | |||
118 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a) | ||
119 | if (a->l) { | ||
120 | /* VFP to general purpose register */ | ||
121 | tmp = tcg_temp_new_i32(); | ||
122 | - neon_load_reg32(tmp, a->vn); | ||
123 | + vfp_load_reg32(tmp, a->vn); | ||
124 | if (a->rt == 15) { | ||
125 | /* Set the 4 flag bits in the CPSR. */ | ||
126 | gen_set_nzcv(tmp); | ||
127 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a) | ||
128 | } else { | ||
129 | /* general purpose register to VFP */ | ||
130 | tmp = load_reg(s, a->rt); | ||
131 | - neon_store_reg32(tmp, a->vn); | ||
132 | + vfp_store_reg32(tmp, a->vn); | ||
133 | tcg_temp_free_i32(tmp); | ||
134 | } | ||
135 | |||
136 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a) | ||
137 | if (a->op) { | ||
138 | /* fpreg to gpreg */ | ||
139 | tmp = tcg_temp_new_i32(); | ||
140 | - neon_load_reg32(tmp, a->vm); | ||
141 | + vfp_load_reg32(tmp, a->vm); | ||
142 | store_reg(s, a->rt, tmp); | ||
143 | tmp = tcg_temp_new_i32(); | ||
144 | - neon_load_reg32(tmp, a->vm + 1); | ||
145 | + vfp_load_reg32(tmp, a->vm + 1); | ||
146 | store_reg(s, a->rt2, tmp); | ||
147 | } else { | ||
148 | /* gpreg to fpreg */ | ||
149 | tmp = load_reg(s, a->rt); | ||
150 | - neon_store_reg32(tmp, a->vm); | ||
151 | + vfp_store_reg32(tmp, a->vm); | ||
152 | tcg_temp_free_i32(tmp); | ||
153 | tmp = load_reg(s, a->rt2); | ||
154 | - neon_store_reg32(tmp, a->vm + 1); | ||
155 | + vfp_store_reg32(tmp, a->vm + 1); | ||
156 | tcg_temp_free_i32(tmp); | ||
157 | } | ||
158 | |||
159 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_dp *a) | ||
160 | if (a->op) { | ||
161 | /* fpreg to gpreg */ | ||
162 | tmp = tcg_temp_new_i32(); | ||
163 | - neon_load_reg32(tmp, a->vm * 2); | ||
164 | + vfp_load_reg32(tmp, a->vm * 2); | ||
165 | store_reg(s, a->rt, tmp); | ||
166 | tmp = tcg_temp_new_i32(); | ||
167 | - neon_load_reg32(tmp, a->vm * 2 + 1); | ||
168 | + vfp_load_reg32(tmp, a->vm * 2 + 1); | ||
169 | store_reg(s, a->rt2, tmp); | ||
170 | } else { | ||
171 | /* gpreg to fpreg */ | ||
172 | tmp = load_reg(s, a->rt); | ||
173 | - neon_store_reg32(tmp, a->vm * 2); | ||
174 | + vfp_store_reg32(tmp, a->vm * 2); | ||
175 | tcg_temp_free_i32(tmp); | ||
176 | tmp = load_reg(s, a->rt2); | ||
177 | - neon_store_reg32(tmp, a->vm * 2 + 1); | ||
178 | + vfp_store_reg32(tmp, a->vm * 2 + 1); | ||
179 | tcg_temp_free_i32(tmp); | ||
180 | } | ||
181 | |||
182 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_hp(DisasContext *s, arg_VLDR_VSTR_sp *a) | ||
183 | tmp = tcg_temp_new_i32(); | ||
184 | if (a->l) { | ||
185 | gen_aa32_ld16u(s, tmp, addr, get_mem_index(s)); | ||
186 | - neon_store_reg32(tmp, a->vd); | ||
187 | + vfp_store_reg32(tmp, a->vd); | ||
188 | } else { | ||
189 | - neon_load_reg32(tmp, a->vd); | ||
190 | + vfp_load_reg32(tmp, a->vd); | ||
191 | gen_aa32_st16(s, tmp, addr, get_mem_index(s)); | ||
192 | } | ||
193 | tcg_temp_free_i32(tmp); | ||
194 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) | ||
195 | tmp = tcg_temp_new_i32(); | ||
196 | if (a->l) { | ||
197 | gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); | ||
198 | - neon_store_reg32(tmp, a->vd); | ||
199 | + vfp_store_reg32(tmp, a->vd); | ||
200 | } else { | ||
201 | - neon_load_reg32(tmp, a->vd); | ||
202 | + vfp_load_reg32(tmp, a->vd); | ||
203 | gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | ||
204 | } | ||
205 | tcg_temp_free_i32(tmp); | ||
206 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | ||
207 | if (a->l) { | ||
208 | /* load */ | ||
209 | gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); | ||
210 | - neon_store_reg32(tmp, a->vd + i); | ||
211 | + vfp_store_reg32(tmp, a->vd + i); | ||
212 | } else { | ||
213 | /* store */ | ||
214 | - neon_load_reg32(tmp, a->vd + i); | ||
215 | + vfp_load_reg32(tmp, a->vd + i); | ||
216 | gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | ||
217 | } | ||
218 | tcg_gen_addi_i32(addr, addr, offset); | ||
219 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, | ||
220 | fd = tcg_temp_new_i32(); | ||
221 | fpst = fpstatus_ptr(FPST_FPCR); | ||
222 | |||
223 | - neon_load_reg32(f0, vn); | ||
224 | - neon_load_reg32(f1, vm); | ||
225 | + vfp_load_reg32(f0, vn); | ||
226 | + vfp_load_reg32(f1, vm); | ||
227 | |||
228 | for (;;) { | ||
229 | if (reads_vd) { | ||
230 | - neon_load_reg32(fd, vd); | ||
231 | + vfp_load_reg32(fd, vd); | ||
232 | } | ||
233 | fn(fd, f0, f1, fpst); | ||
234 | - neon_store_reg32(fd, vd); | ||
235 | + vfp_store_reg32(fd, vd); | ||
236 | |||
237 | if (veclen == 0) { | ||
238 | break; | ||
239 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, | ||
240 | veclen--; | ||
241 | vd = vfp_advance_sreg(vd, delta_d); | ||
242 | vn = vfp_advance_sreg(vn, delta_d); | ||
243 | - neon_load_reg32(f0, vn); | ||
244 | + vfp_load_reg32(f0, vn); | ||
245 | if (delta_m) { | ||
246 | vm = vfp_advance_sreg(vm, delta_m); | ||
247 | - neon_load_reg32(f1, vm); | ||
248 | + vfp_load_reg32(f1, vm); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn, | ||
253 | fd = tcg_temp_new_i32(); | ||
254 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
255 | |||
256 | - neon_load_reg32(f0, vn); | ||
257 | - neon_load_reg32(f1, vm); | ||
258 | + vfp_load_reg32(f0, vn); | ||
259 | + vfp_load_reg32(f1, vm); | ||
260 | |||
261 | if (reads_vd) { | ||
262 | - neon_load_reg32(fd, vd); | ||
263 | + vfp_load_reg32(fd, vd); | ||
264 | } | ||
265 | fn(fd, f0, f1, fpst); | ||
266 | - neon_store_reg32(fd, vd); | ||
267 | + vfp_store_reg32(fd, vd); | ||
268 | |||
269 | tcg_temp_free_i32(f0); | ||
270 | tcg_temp_free_i32(f1); | ||
271 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) | ||
272 | f0 = tcg_temp_new_i32(); | ||
273 | fd = tcg_temp_new_i32(); | ||
274 | |||
275 | - neon_load_reg32(f0, vm); | ||
276 | + vfp_load_reg32(f0, vm); | ||
277 | |||
278 | for (;;) { | ||
279 | fn(fd, f0); | ||
280 | - neon_store_reg32(fd, vd); | ||
281 | + vfp_store_reg32(fd, vd); | ||
282 | |||
283 | if (veclen == 0) { | ||
284 | break; | ||
285 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) | ||
286 | /* single source one-many */ | ||
287 | while (veclen--) { | ||
288 | vd = vfp_advance_sreg(vd, delta_d); | ||
289 | - neon_store_reg32(fd, vd); | ||
290 | + vfp_store_reg32(fd, vd); | ||
291 | } | ||
292 | break; | ||
293 | } | ||
294 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) | ||
295 | veclen--; | ||
296 | vd = vfp_advance_sreg(vd, delta_d); | ||
297 | vm = vfp_advance_sreg(vm, delta_m); | ||
298 | - neon_load_reg32(f0, vm); | ||
299 | + vfp_load_reg32(f0, vm); | ||
300 | } | ||
301 | |||
302 | tcg_temp_free_i32(f0); | ||
303 | @@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_hp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) | ||
304 | } | ||
305 | |||
306 | f0 = tcg_temp_new_i32(); | ||
307 | - neon_load_reg32(f0, vm); | ||
308 | + vfp_load_reg32(f0, vm); | ||
309 | fn(f0, f0); | ||
310 | - neon_store_reg32(f0, vd); | ||
311 | + vfp_store_reg32(f0, vd); | ||
312 | tcg_temp_free_i32(f0); | ||
313 | |||
314 | return true; | ||
315 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_hp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) | ||
316 | vm = tcg_temp_new_i32(); | ||
317 | vd = tcg_temp_new_i32(); | ||
318 | |||
319 | - neon_load_reg32(vn, a->vn); | ||
320 | - neon_load_reg32(vm, a->vm); | ||
321 | + vfp_load_reg32(vn, a->vn); | ||
322 | + vfp_load_reg32(vm, a->vm); | ||
323 | if (neg_n) { | ||
324 | /* VFNMS, VFMS */ | ||
325 | gen_helper_vfp_negh(vn, vn); | ||
326 | } | ||
327 | - neon_load_reg32(vd, a->vd); | ||
328 | + vfp_load_reg32(vd, a->vd); | ||
329 | if (neg_d) { | ||
330 | /* VFNMA, VFNMS */ | ||
331 | gen_helper_vfp_negh(vd, vd); | ||
332 | } | ||
333 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
334 | gen_helper_vfp_muladdh(vd, vn, vm, vd, fpst); | ||
335 | - neon_store_reg32(vd, a->vd); | ||
336 | + vfp_store_reg32(vd, a->vd); | ||
337 | |||
338 | tcg_temp_free_ptr(fpst); | ||
339 | tcg_temp_free_i32(vn); | ||
340 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) | ||
341 | vm = tcg_temp_new_i32(); | ||
342 | vd = tcg_temp_new_i32(); | ||
343 | |||
344 | - neon_load_reg32(vn, a->vn); | ||
345 | - neon_load_reg32(vm, a->vm); | ||
346 | + vfp_load_reg32(vn, a->vn); | ||
347 | + vfp_load_reg32(vm, a->vm); | ||
348 | if (neg_n) { | ||
349 | /* VFNMS, VFMS */ | ||
350 | gen_helper_vfp_negs(vn, vn); | ||
351 | } | ||
352 | - neon_load_reg32(vd, a->vd); | ||
353 | + vfp_load_reg32(vd, a->vd); | ||
354 | if (neg_d) { | ||
355 | /* VFNMA, VFNMS */ | ||
356 | gen_helper_vfp_negs(vd, vd); | ||
357 | } | ||
358 | fpst = fpstatus_ptr(FPST_FPCR); | ||
359 | gen_helper_vfp_muladds(vd, vn, vm, vd, fpst); | ||
360 | - neon_store_reg32(vd, a->vd); | ||
361 | + vfp_store_reg32(vd, a->vd); | ||
362 | |||
363 | tcg_temp_free_ptr(fpst); | ||
364 | tcg_temp_free_i32(vn); | ||
365 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a) | ||
366 | } | ||
367 | |||
368 | fd = tcg_const_i32(vfp_expand_imm(MO_16, a->imm)); | ||
369 | - neon_store_reg32(fd, a->vd); | ||
370 | + vfp_store_reg32(fd, a->vd); | ||
371 | tcg_temp_free_i32(fd); | ||
372 | return true; | ||
373 | } | ||
374 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) | ||
375 | fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm)); | ||
376 | |||
377 | for (;;) { | ||
378 | - neon_store_reg32(fd, vd); | ||
379 | + vfp_store_reg32(fd, vd); | ||
380 | |||
381 | if (veclen == 0) { | ||
382 | break; | ||
383 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_hp(DisasContext *s, arg_VCMP_sp *a) | ||
384 | vd = tcg_temp_new_i32(); | ||
385 | vm = tcg_temp_new_i32(); | ||
386 | |||
387 | - neon_load_reg32(vd, a->vd); | ||
388 | + vfp_load_reg32(vd, a->vd); | ||
389 | if (a->z) { | ||
390 | tcg_gen_movi_i32(vm, 0); | ||
391 | } else { | ||
392 | - neon_load_reg32(vm, a->vm); | ||
393 | + vfp_load_reg32(vm, a->vm); | ||
394 | } | ||
395 | |||
396 | if (a->e) { | ||
397 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a) | ||
398 | vd = tcg_temp_new_i32(); | ||
399 | vm = tcg_temp_new_i32(); | ||
400 | |||
401 | - neon_load_reg32(vd, a->vd); | ||
402 | + vfp_load_reg32(vd, a->vd); | ||
403 | if (a->z) { | ||
404 | tcg_gen_movi_i32(vm, 0); | ||
405 | } else { | ||
406 | - neon_load_reg32(vm, a->vm); | ||
407 | + vfp_load_reg32(vm, a->vm); | ||
408 | } | ||
409 | |||
410 | if (a->e) { | ||
411 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a) | ||
412 | /* The T bit tells us if we want the low or high 16 bits of Vm */ | ||
413 | tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t)); | ||
414 | gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp_mode); | ||
415 | - neon_store_reg32(tmp, a->vd); | ||
416 | + vfp_store_reg32(tmp, a->vd); | ||
417 | tcg_temp_free_i32(ahp_mode); | ||
418 | tcg_temp_free_ptr(fpst); | ||
419 | tcg_temp_free_i32(tmp); | ||
420 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a) | ||
421 | ahp_mode = get_ahp_flag(); | ||
422 | tmp = tcg_temp_new_i32(); | ||
423 | |||
424 | - neon_load_reg32(tmp, a->vm); | ||
425 | + vfp_load_reg32(tmp, a->vm); | ||
426 | gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp_mode); | ||
427 | tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t)); | ||
428 | tcg_temp_free_i32(ahp_mode); | ||
429 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_hp(DisasContext *s, arg_VRINTR_sp *a) | ||
430 | } | ||
431 | |||
432 | tmp = tcg_temp_new_i32(); | ||
433 | - neon_load_reg32(tmp, a->vm); | ||
434 | + vfp_load_reg32(tmp, a->vm); | ||
435 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
436 | gen_helper_rinth(tmp, tmp, fpst); | ||
437 | - neon_store_reg32(tmp, a->vd); | ||
438 | + vfp_store_reg32(tmp, a->vd); | ||
439 | tcg_temp_free_ptr(fpst); | ||
440 | tcg_temp_free_i32(tmp); | ||
441 | return true; | ||
442 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a) | ||
443 | } | ||
444 | |||
445 | tmp = tcg_temp_new_i32(); | ||
446 | - neon_load_reg32(tmp, a->vm); | ||
447 | + vfp_load_reg32(tmp, a->vm); | ||
448 | fpst = fpstatus_ptr(FPST_FPCR); | ||
449 | gen_helper_rints(tmp, tmp, fpst); | ||
450 | - neon_store_reg32(tmp, a->vd); | ||
451 | + vfp_store_reg32(tmp, a->vd); | ||
452 | tcg_temp_free_ptr(fpst); | ||
453 | tcg_temp_free_i32(tmp); | ||
454 | return true; | ||
455 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_hp(DisasContext *s, arg_VRINTZ_sp *a) | ||
456 | } | ||
457 | |||
458 | tmp = tcg_temp_new_i32(); | ||
459 | - neon_load_reg32(tmp, a->vm); | ||
460 | + vfp_load_reg32(tmp, a->vm); | ||
461 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
462 | tcg_rmode = tcg_const_i32(float_round_to_zero); | ||
463 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
464 | gen_helper_rinth(tmp, tmp, fpst); | ||
465 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
466 | - neon_store_reg32(tmp, a->vd); | ||
467 | + vfp_store_reg32(tmp, a->vd); | ||
468 | tcg_temp_free_ptr(fpst); | ||
469 | tcg_temp_free_i32(tcg_rmode); | ||
470 | tcg_temp_free_i32(tmp); | ||
471 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a) | ||
472 | } | ||
473 | |||
474 | tmp = tcg_temp_new_i32(); | ||
475 | - neon_load_reg32(tmp, a->vm); | ||
476 | + vfp_load_reg32(tmp, a->vm); | ||
477 | fpst = fpstatus_ptr(FPST_FPCR); | ||
478 | tcg_rmode = tcg_const_i32(float_round_to_zero); | ||
479 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
480 | gen_helper_rints(tmp, tmp, fpst); | ||
481 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
482 | - neon_store_reg32(tmp, a->vd); | ||
483 | + vfp_store_reg32(tmp, a->vd); | ||
484 | tcg_temp_free_ptr(fpst); | ||
485 | tcg_temp_free_i32(tcg_rmode); | ||
486 | tcg_temp_free_i32(tmp); | ||
487 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_hp(DisasContext *s, arg_VRINTX_sp *a) | ||
488 | } | ||
489 | |||
490 | tmp = tcg_temp_new_i32(); | ||
491 | - neon_load_reg32(tmp, a->vm); | ||
492 | + vfp_load_reg32(tmp, a->vm); | ||
493 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
494 | gen_helper_rinth_exact(tmp, tmp, fpst); | ||
495 | - neon_store_reg32(tmp, a->vd); | ||
496 | + vfp_store_reg32(tmp, a->vd); | ||
497 | tcg_temp_free_ptr(fpst); | ||
498 | tcg_temp_free_i32(tmp); | ||
499 | return true; | ||
500 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a) | ||
501 | } | ||
502 | |||
503 | tmp = tcg_temp_new_i32(); | ||
504 | - neon_load_reg32(tmp, a->vm); | ||
505 | + vfp_load_reg32(tmp, a->vm); | ||
506 | fpst = fpstatus_ptr(FPST_FPCR); | ||
507 | gen_helper_rints_exact(tmp, tmp, fpst); | ||
508 | - neon_store_reg32(tmp, a->vd); | ||
509 | + vfp_store_reg32(tmp, a->vd); | ||
510 | tcg_temp_free_ptr(fpst); | ||
511 | tcg_temp_free_i32(tmp); | ||
512 | return true; | ||
513 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) | ||
514 | |||
515 | vm = tcg_temp_new_i32(); | ||
516 | vd = tcg_temp_new_i64(); | ||
517 | - neon_load_reg32(vm, a->vm); | ||
518 | + vfp_load_reg32(vm, a->vm); | ||
519 | gen_helper_vfp_fcvtds(vd, vm, cpu_env); | ||
520 | neon_store_reg64(vd, a->vd); | ||
521 | tcg_temp_free_i32(vm); | ||
522 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) | ||
523 | vm = tcg_temp_new_i64(); | ||
524 | neon_load_reg64(vm, a->vm); | ||
525 | gen_helper_vfp_fcvtsd(vd, vm, cpu_env); | ||
526 | - neon_store_reg32(vd, a->vd); | ||
527 | + vfp_store_reg32(vd, a->vd); | ||
528 | tcg_temp_free_i32(vd); | ||
529 | tcg_temp_free_i64(vm); | ||
530 | return true; | ||
531 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a) | ||
532 | } | ||
533 | |||
534 | vm = tcg_temp_new_i32(); | ||
535 | - neon_load_reg32(vm, a->vm); | ||
536 | + vfp_load_reg32(vm, a->vm); | ||
537 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
538 | if (a->s) { | ||
539 | /* i32 -> f16 */ | ||
540 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a) | ||
541 | /* u32 -> f16 */ | ||
542 | gen_helper_vfp_uitoh(vm, vm, fpst); | ||
543 | } | ||
544 | - neon_store_reg32(vm, a->vd); | ||
545 | + vfp_store_reg32(vm, a->vd); | ||
546 | tcg_temp_free_i32(vm); | ||
547 | tcg_temp_free_ptr(fpst); | ||
548 | return true; | ||
549 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) | ||
550 | } | ||
551 | |||
552 | vm = tcg_temp_new_i32(); | ||
553 | - neon_load_reg32(vm, a->vm); | ||
554 | + vfp_load_reg32(vm, a->vm); | ||
555 | fpst = fpstatus_ptr(FPST_FPCR); | ||
556 | if (a->s) { | ||
557 | /* i32 -> f32 */ | ||
558 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) | ||
559 | /* u32 -> f32 */ | ||
560 | gen_helper_vfp_uitos(vm, vm, fpst); | ||
561 | } | ||
562 | - neon_store_reg32(vm, a->vd); | ||
563 | + vfp_store_reg32(vm, a->vd); | ||
564 | tcg_temp_free_i32(vm); | ||
565 | tcg_temp_free_ptr(fpst); | ||
566 | return true; | ||
567 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) | ||
568 | |||
569 | vm = tcg_temp_new_i32(); | ||
570 | vd = tcg_temp_new_i64(); | ||
571 | - neon_load_reg32(vm, a->vm); | ||
572 | + vfp_load_reg32(vm, a->vm); | ||
573 | fpst = fpstatus_ptr(FPST_FPCR); | ||
574 | if (a->s) { | ||
575 | /* i32 -> f64 */ | ||
576 | @@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) | ||
577 | vd = tcg_temp_new_i32(); | ||
578 | neon_load_reg64(vm, a->vm); | ||
579 | gen_helper_vjcvt(vd, vm, cpu_env); | ||
580 | - neon_store_reg32(vd, a->vd); | ||
581 | + vfp_store_reg32(vd, a->vd); | ||
582 | tcg_temp_free_i64(vm); | ||
583 | tcg_temp_free_i32(vd); | ||
584 | return true; | ||
585 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) | ||
586 | frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm); | ||
587 | |||
588 | vd = tcg_temp_new_i32(); | ||
589 | - neon_load_reg32(vd, a->vd); | ||
590 | + vfp_load_reg32(vd, a->vd); | ||
591 | |||
592 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
593 | shift = tcg_const_i32(frac_bits); | ||
594 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) | ||
595 | g_assert_not_reached(); | ||
596 | } | ||
597 | |||
598 | - neon_store_reg32(vd, a->vd); | ||
599 | + vfp_store_reg32(vd, a->vd); | ||
600 | tcg_temp_free_i32(vd); | ||
601 | tcg_temp_free_i32(shift); | ||
602 | tcg_temp_free_ptr(fpst); | ||
603 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) | ||
604 | frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm); | ||
605 | |||
606 | vd = tcg_temp_new_i32(); | ||
607 | - neon_load_reg32(vd, a->vd); | ||
608 | + vfp_load_reg32(vd, a->vd); | ||
609 | |||
610 | fpst = fpstatus_ptr(FPST_FPCR); | ||
611 | shift = tcg_const_i32(frac_bits); | ||
612 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) | ||
613 | g_assert_not_reached(); | ||
614 | } | ||
615 | |||
616 | - neon_store_reg32(vd, a->vd); | ||
617 | + vfp_store_reg32(vd, a->vd); | ||
618 | tcg_temp_free_i32(vd); | ||
619 | tcg_temp_free_i32(shift); | ||
620 | tcg_temp_free_ptr(fpst); | ||
621 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a) | ||
622 | |||
623 | fpst = fpstatus_ptr(FPST_FPCR_F16); | ||
624 | vm = tcg_temp_new_i32(); | ||
625 | - neon_load_reg32(vm, a->vm); | ||
626 | + vfp_load_reg32(vm, a->vm); | ||
627 | |||
628 | if (a->s) { | ||
629 | if (a->rz) { | ||
630 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a) | ||
631 | gen_helper_vfp_touih(vm, vm, fpst); | ||
632 | } | ||
633 | } | ||
634 | - neon_store_reg32(vm, a->vd); | ||
635 | + vfp_store_reg32(vm, a->vd); | ||
636 | tcg_temp_free_i32(vm); | ||
637 | tcg_temp_free_ptr(fpst); | ||
638 | return true; | ||
639 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) | ||
640 | |||
641 | fpst = fpstatus_ptr(FPST_FPCR); | ||
642 | vm = tcg_temp_new_i32(); | ||
643 | - neon_load_reg32(vm, a->vm); | ||
644 | + vfp_load_reg32(vm, a->vm); | ||
645 | |||
646 | if (a->s) { | ||
647 | if (a->rz) { | ||
648 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) | ||
649 | gen_helper_vfp_touis(vm, vm, fpst); | ||
650 | } | ||
651 | } | ||
652 | - neon_store_reg32(vm, a->vd); | ||
653 | + vfp_store_reg32(vm, a->vd); | ||
654 | tcg_temp_free_i32(vm); | ||
655 | tcg_temp_free_ptr(fpst); | ||
656 | return true; | ||
657 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) | ||
658 | gen_helper_vfp_touid(vd, vm, fpst); | ||
659 | } | ||
660 | } | ||
661 | - neon_store_reg32(vd, a->vd); | ||
662 | + vfp_store_reg32(vd, a->vd); | ||
663 | tcg_temp_free_i32(vd); | ||
664 | tcg_temp_free_i64(vm); | ||
665 | tcg_temp_free_ptr(fpst); | ||
666 | @@ -XXX,XX +XXX,XX @@ static bool trans_VINS(DisasContext *s, arg_VINS *a) | ||
667 | /* Insert low half of Vm into high half of Vd */ | ||
668 | rm = tcg_temp_new_i32(); | ||
669 | rd = tcg_temp_new_i32(); | ||
670 | - neon_load_reg32(rm, a->vm); | ||
671 | - neon_load_reg32(rd, a->vd); | ||
672 | + vfp_load_reg32(rm, a->vm); | ||
673 | + vfp_load_reg32(rd, a->vd); | ||
674 | tcg_gen_deposit_i32(rd, rd, rm, 16, 16); | ||
675 | - neon_store_reg32(rd, a->vd); | ||
676 | + vfp_store_reg32(rd, a->vd); | ||
677 | tcg_temp_free_i32(rm); | ||
678 | tcg_temp_free_i32(rd); | ||
679 | return true; | ||
680 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOVX(DisasContext *s, arg_VINS *a) | ||
681 | |||
682 | /* Set Vd to high half of Vm */ | ||
683 | rm = tcg_temp_new_i32(); | ||
684 | - neon_load_reg32(rm, a->vm); | ||
685 | + vfp_load_reg32(rm, a->vm); | ||
686 | tcg_gen_shri_i32(rm, rm, 16); | ||
687 | - neon_store_reg32(rm, a->vd); | ||
688 | + vfp_store_reg32(rm, a->vd); | ||
689 | tcg_temp_free_i32(rm); | ||
690 | return true; | ||
691 | } | ||
692 | -- | 205 | -- |
693 | 2.20.1 | 206 | 2.20.1 |
694 | 207 | ||
695 | 208 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | We can use proper widening loads to extend 32-bit inputs, | 3 | When translating an address we need to check if it belongs to |
4 | and skip the "widenfn" step. | 4 | a reserved virtual address range. If it does, there are 2 cases: |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | - it belongs to a RESERVED region: the guest should neither use |
7 | Message-id: 20201030022618.785675-12-richard.henderson@linaro.org | 7 | this address in a MAP not instruct the end-point to DMA on |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | them. We report an error |
9 | |||
10 | - It belongs to an MSI region: we bypass the translation. | ||
11 | |||
12 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
13 | Reviewed-by: Peter Xu <peterx@redhat.com> | ||
14 | Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
15 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
16 | Message-id: 20200629070404.10969-4-eric.auger@redhat.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 18 | --- |
11 | target/arm/translate.c | 6 +++ | 19 | hw/virtio/virtio-iommu.c | 20 ++++++++++++++++++++ |
12 | target/arm/translate-neon.c.inc | 66 ++++++++++++++++++--------------- | 20 | 1 file changed, 20 insertions(+) |
13 | 2 files changed, 43 insertions(+), 29 deletions(-) | ||
14 | 21 | ||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 22 | diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c |
16 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 24 | --- a/hw/virtio/virtio-iommu.c |
18 | +++ b/target/arm/translate.c | 25 | +++ b/hw/virtio/virtio-iommu.c |
19 | @@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop) | 26 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr, |
20 | long off = neon_element_offset(reg, ele, memop); | 27 | uint32_t sid, flags; |
21 | 28 | bool bypass_allowed; | |
22 | switch (memop) { | 29 | bool found; |
23 | + case MO_SL: | 30 | + int i; |
24 | + tcg_gen_ld32s_i64(dest, cpu_env, off); | 31 | |
25 | + break; | 32 | interval.low = addr; |
26 | + case MO_UL: | 33 | interval.high = addr + 1; |
27 | + tcg_gen_ld32u_i64(dest, cpu_env, off); | 34 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr, |
28 | + break; | 35 | goto unlock; |
29 | case MO_Q: | ||
30 | tcg_gen_ld_i64(dest, cpu_env, off); | ||
31 | break; | ||
32 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate-neon.c.inc | ||
35 | +++ b/target/arm/translate-neon.c.inc | ||
36 | @@ -XXX,XX +XXX,XX @@ static bool trans_Vimm_1r(DisasContext *s, arg_1reg_imm *a) | ||
37 | static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
38 | NeonGenWidenFn *widenfn, | ||
39 | NeonGenTwo64OpFn *opfn, | ||
40 | - bool src1_wide) | ||
41 | + int src1_mop, int src2_mop) | ||
42 | { | ||
43 | /* 3-regs different lengths, prewidening case (VADDL/VSUBL/VAADW/VSUBW) */ | ||
44 | TCGv_i64 rn0_64, rn1_64, rm_64; | ||
45 | - TCGv_i32 rm; | ||
46 | |||
47 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
48 | return false; | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
50 | return false; | ||
51 | } | 36 | } |
52 | 37 | ||
53 | - if (!widenfn || !opfn) { | 38 | + for (i = 0; i < s->nb_reserved_regions; i++) { |
54 | + if (!opfn) { | 39 | + ReservedRegion *reg = &s->reserved_regions[i]; |
55 | /* size == 3 case, which is an entirely different insn group */ | 40 | + |
56 | return false; | 41 | + if (addr >= reg->low && addr <= reg->high) { |
57 | } | 42 | + switch (reg->type) { |
58 | 43 | + case VIRTIO_IOMMU_RESV_MEM_T_MSI: | |
59 | - if ((a->vd & 1) || (src1_wide && (a->vn & 1))) { | 44 | + entry.perm = flag; |
60 | + if ((a->vd & 1) || (src1_mop == MO_Q && (a->vn & 1))) { | 45 | + break; |
61 | return false; | 46 | + case VIRTIO_IOMMU_RESV_MEM_T_RESERVED: |
62 | } | 47 | + default: |
63 | 48 | + virtio_iommu_report_fault(s, VIRTIO_IOMMU_FAULT_R_MAPPING, | |
64 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | 49 | + VIRTIO_IOMMU_FAULT_F_ADDRESS, |
65 | rn1_64 = tcg_temp_new_i64(); | 50 | + sid, addr); |
66 | rm_64 = tcg_temp_new_i64(); | 51 | + break; |
67 | 52 | + } | |
68 | - if (src1_wide) { | 53 | + goto unlock; |
69 | - read_neon_element64(rn0_64, a->vn, 0, MO_64); | 54 | + } |
70 | + if (src1_mop >= 0) { | ||
71 | + read_neon_element64(rn0_64, a->vn, 0, src1_mop); | ||
72 | } else { | ||
73 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
74 | read_neon_element32(tmp, a->vn, 0, MO_32); | ||
75 | widenfn(rn0_64, tmp); | ||
76 | tcg_temp_free_i32(tmp); | ||
77 | } | ||
78 | - rm = tcg_temp_new_i32(); | ||
79 | - read_neon_element32(rm, a->vm, 0, MO_32); | ||
80 | + if (src2_mop >= 0) { | ||
81 | + read_neon_element64(rm_64, a->vm, 0, src2_mop); | ||
82 | + } else { | ||
83 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
84 | + read_neon_element32(tmp, a->vm, 0, MO_32); | ||
85 | + widenfn(rm_64, tmp); | ||
86 | + tcg_temp_free_i32(tmp); | ||
87 | + } | 55 | + } |
88 | 56 | + | |
89 | - widenfn(rm_64, rm); | 57 | if (!ep->domain) { |
90 | - tcg_temp_free_i32(rm); | 58 | if (!bypass_allowed) { |
91 | opfn(rn0_64, rn0_64, rm_64); | 59 | error_report_once("%s %02x:%02x.%01x not attached to any domain", |
92 | |||
93 | /* | ||
94 | * Load second pass inputs before storing the first pass result, to | ||
95 | * avoid incorrect results if a narrow input overlaps with the result. | ||
96 | */ | ||
97 | - if (src1_wide) { | ||
98 | - read_neon_element64(rn1_64, a->vn, 1, MO_64); | ||
99 | + if (src1_mop >= 0) { | ||
100 | + read_neon_element64(rn1_64, a->vn, 1, src1_mop); | ||
101 | } else { | ||
102 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
103 | read_neon_element32(tmp, a->vn, 1, MO_32); | ||
104 | widenfn(rn1_64, tmp); | ||
105 | tcg_temp_free_i32(tmp); | ||
106 | } | ||
107 | - rm = tcg_temp_new_i32(); | ||
108 | - read_neon_element32(rm, a->vm, 1, MO_32); | ||
109 | + if (src2_mop >= 0) { | ||
110 | + read_neon_element64(rm_64, a->vm, 1, src2_mop); | ||
111 | + } else { | ||
112 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
113 | + read_neon_element32(tmp, a->vm, 1, MO_32); | ||
114 | + widenfn(rm_64, tmp); | ||
115 | + tcg_temp_free_i32(tmp); | ||
116 | + } | ||
117 | |||
118 | write_neon_element64(rn0_64, a->vd, 0, MO_64); | ||
119 | |||
120 | - widenfn(rm_64, rm); | ||
121 | - tcg_temp_free_i32(rm); | ||
122 | opfn(rn1_64, rn1_64, rm_64); | ||
123 | write_neon_element64(rn1_64, a->vd, 1, MO_64); | ||
124 | |||
125 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
126 | return true; | ||
127 | } | ||
128 | |||
129 | -#define DO_PREWIDEN(INSN, S, EXT, OP, SRC1WIDE) \ | ||
130 | +#define DO_PREWIDEN(INSN, S, OP, SRC1WIDE, SIGN) \ | ||
131 | static bool trans_##INSN##_3d(DisasContext *s, arg_3diff *a) \ | ||
132 | { \ | ||
133 | static NeonGenWidenFn * const widenfn[] = { \ | ||
134 | gen_helper_neon_widen_##S##8, \ | ||
135 | gen_helper_neon_widen_##S##16, \ | ||
136 | - tcg_gen_##EXT##_i32_i64, \ | ||
137 | - NULL, \ | ||
138 | + NULL, NULL, \ | ||
139 | }; \ | ||
140 | static NeonGenTwo64OpFn * const addfn[] = { \ | ||
141 | gen_helper_neon_##OP##l_u16, \ | ||
142 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
143 | tcg_gen_##OP##_i64, \ | ||
144 | NULL, \ | ||
145 | }; \ | ||
146 | - return do_prewiden_3d(s, a, widenfn[a->size], \ | ||
147 | - addfn[a->size], SRC1WIDE); \ | ||
148 | + int narrow_mop = a->size == MO_32 ? MO_32 | SIGN : -1; \ | ||
149 | + return do_prewiden_3d(s, a, widenfn[a->size], addfn[a->size], \ | ||
150 | + SRC1WIDE ? MO_Q : narrow_mop, \ | ||
151 | + narrow_mop); \ | ||
152 | } | ||
153 | |||
154 | -DO_PREWIDEN(VADDL_S, s, ext, add, false) | ||
155 | -DO_PREWIDEN(VADDL_U, u, extu, add, false) | ||
156 | -DO_PREWIDEN(VSUBL_S, s, ext, sub, false) | ||
157 | -DO_PREWIDEN(VSUBL_U, u, extu, sub, false) | ||
158 | -DO_PREWIDEN(VADDW_S, s, ext, add, true) | ||
159 | -DO_PREWIDEN(VADDW_U, u, extu, add, true) | ||
160 | -DO_PREWIDEN(VSUBW_S, s, ext, sub, true) | ||
161 | -DO_PREWIDEN(VSUBW_U, u, extu, sub, true) | ||
162 | +DO_PREWIDEN(VADDL_S, s, add, false, MO_SIGN) | ||
163 | +DO_PREWIDEN(VADDL_U, u, add, false, 0) | ||
164 | +DO_PREWIDEN(VSUBL_S, s, sub, false, MO_SIGN) | ||
165 | +DO_PREWIDEN(VSUBL_U, u, sub, false, 0) | ||
166 | +DO_PREWIDEN(VADDW_S, s, add, true, MO_SIGN) | ||
167 | +DO_PREWIDEN(VADDW_U, u, add, true, 0) | ||
168 | +DO_PREWIDEN(VSUBW_S, s, sub, true, MO_SIGN) | ||
169 | +DO_PREWIDEN(VSUBW_U, u, sub, true, 0) | ||
170 | |||
171 | static bool do_narrow_3d(DisasContext *s, arg_3diff *a, | ||
172 | NeonGenTwo64OpFn *opfn, NeonGenNarrowFn *narrowfn) | ||
173 | -- | 60 | -- |
174 | 2.20.1 | 61 | 2.20.1 |
175 | 62 | ||
176 | 63 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Eric Auger <eric.auger@redhat.com> | ||
1 | 2 | ||
3 | The machine may need to pass reserved regions to the | ||
4 | virtio-iommu-pci device (such as the MSI window on x86 | ||
5 | or the MSI doorbells on ARM). | ||
6 | |||
7 | So let's add an array of Interval properties. | ||
8 | |||
9 | Note: if some reserved regions are already set by the | ||
10 | machine code - which should be the case in general -, | ||
11 | the length of the property array is already set and | ||
12 | prevents the end-user from modifying them. For example, | ||
13 | attempting to use: | ||
14 | |||
15 | -device virtio-iommu-pci,\ | ||
16 | len-reserved-regions=1,reserved-regions[0]=0xfee00000:0xfeefffff:1 | ||
17 | |||
18 | would result in the following error message: | ||
19 | |||
20 | qemu-system-aarch64: -device virtio-iommu-pci,addr=0xa, | ||
21 | len-reserved-regions=1,reserved-regions[0]=0xfee00000:0xfeefffff:1: | ||
22 | array size property len-reserved-regions may not be set more than once | ||
23 | |||
24 | Otherwise, for example, adding two reserved regions is achieved | ||
25 | using the following options: | ||
26 | |||
27 | -device virtio-iommu-pci,addr=0xa,len-reserved-regions=2,\ | ||
28 | reserved-regions[0]=0xfee00000:0xfeefffff:1,\ | ||
29 | reserved-regions[1]=0x1000000:100ffff:1 | ||
30 | |||
31 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
32 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
33 | Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
34 | Reviewed-by: Peter Xu <peterx@redhat.com> | ||
35 | Message-id: 20200629070404.10969-5-eric.auger@redhat.com | ||
36 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
37 | --- | ||
38 | hw/virtio/virtio-iommu-pci.c | 11 +++++++++++ | ||
39 | 1 file changed, 11 insertions(+) | ||
40 | |||
41 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/hw/virtio/virtio-iommu-pci.c | ||
44 | +++ b/hw/virtio/virtio-iommu-pci.c | ||
45 | @@ -XXX,XX +XXX,XX @@ struct VirtIOIOMMUPCI { | ||
46 | |||
47 | static Property virtio_iommu_pci_properties[] = { | ||
48 | DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), | ||
49 | + DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, | ||
50 | + vdev.nb_reserved_regions, vdev.reserved_regions, | ||
51 | + qdev_prop_reserved_region, ReservedRegion), | ||
52 | DEFINE_PROP_END_OF_LIST(), | ||
53 | }; | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | ||
56 | { | ||
57 | VirtIOIOMMUPCI *dev = VIRTIO_IOMMU_PCI(vpci_dev); | ||
58 | DeviceState *vdev = DEVICE(&dev->vdev); | ||
59 | + VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | ||
60 | |||
61 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | ||
62 | MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | ||
63 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | ||
64 | "-no-acpi\n"); | ||
65 | return; | ||
66 | } | ||
67 | + for (int i = 0; i < s->nb_reserved_regions; i++) { | ||
68 | + if (s->reserved_regions[i].type != VIRTIO_IOMMU_RESV_MEM_T_RESERVED && | ||
69 | + s->reserved_regions[i].type != VIRTIO_IOMMU_RESV_MEM_T_MSI) { | ||
70 | + error_setg(errp, "reserved region %d has an invalid type", i); | ||
71 | + error_append_hint(errp, "Valid values are 0 and 1\n"); | ||
72 | + } | ||
73 | + } | ||
74 | object_property_set_link(OBJECT(dev), | ||
75 | OBJECT(pci_get_bus(&vpci_dev->pci_dev)), | ||
76 | "primary-bus", &error_abort); | ||
77 | -- | ||
78 | 2.20.1 | ||
79 | |||
80 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This seems a bit more readable than using offsetof CPU_DoubleU. | 3 | At the moment the virtio-iommu translates MSI transactions. |
4 | This behavior is inherited from ARM SMMU. The virt machine | ||
5 | code knows where the guest MSI doorbells are so we can easily | ||
6 | declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that | ||
7 | setting the guest will not map MSIs through the IOMMU and those | ||
8 | transactions will be simply bypassed. | ||
4 | 9 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Depending on which MSI controller is in use (ITS or GICV2M), |
6 | Message-id: 20201030022618.785675-5-richard.henderson@linaro.org | 11 | we declare either: |
12 | - the ITS interrupt translation space (ITS_base + 0x10000), | ||
13 | containing the GITS_TRANSLATOR or | ||
14 | - The GICV2M single frame, containing the MSI_SETSP_NS register. | ||
15 | |||
16 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
17 | Message-id: 20200629070404.10969-6-eric.auger@redhat.com | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 20 | --- |
10 | target/arm/translate.c | 13 ++++--------- | 21 | include/hw/arm/virt.h | 7 +++++++ |
11 | 1 file changed, 4 insertions(+), 9 deletions(-) | 22 | hw/arm/virt.c | 30 ++++++++++++++++++++++++++++++ |
23 | 2 files changed, 37 insertions(+) | ||
12 | 24 | ||
13 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 25 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h |
14 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.c | 27 | --- a/include/hw/arm/virt.h |
16 | +++ b/target/arm/translate.c | 28 | +++ b/include/hw/arm/virt.h |
17 | @@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp size) | 29 | @@ -XXX,XX +XXX,XX @@ typedef enum VirtIOMMUType { |
18 | return neon_full_reg_offset(reg) + ofs; | 30 | VIRT_IOMMU_VIRTIO, |
31 | } VirtIOMMUType; | ||
32 | |||
33 | +typedef enum VirtMSIControllerType { | ||
34 | + VIRT_MSI_CTRL_NONE, | ||
35 | + VIRT_MSI_CTRL_GICV2M, | ||
36 | + VIRT_MSI_CTRL_ITS, | ||
37 | +} VirtMSIControllerType; | ||
38 | + | ||
39 | typedef enum VirtGICType { | ||
40 | VIRT_GIC_VERSION_MAX, | ||
41 | VIRT_GIC_VERSION_HOST, | ||
42 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
43 | OnOffAuto acpi; | ||
44 | VirtGICType gic_version; | ||
45 | VirtIOMMUType iommu; | ||
46 | + VirtMSIControllerType msi_controller; | ||
47 | uint16_t virtio_iommu_bdf; | ||
48 | struct arm_boot_info bootinfo; | ||
49 | MemMapEntry *memmap; | ||
50 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/arm/virt.c | ||
53 | +++ b/hw/arm/virt.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void create_its(VirtMachineState *vms) | ||
55 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_ITS].base); | ||
56 | |||
57 | fdt_add_its_gic_node(vms); | ||
58 | + vms->msi_controller = VIRT_MSI_CTRL_ITS; | ||
19 | } | 59 | } |
20 | 60 | ||
21 | -static inline long vfp_reg_offset(bool dp, unsigned reg) | 61 | static void create_v2m(VirtMachineState *vms) |
22 | +/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */ | 62 | @@ -XXX,XX +XXX,XX @@ static void create_v2m(VirtMachineState *vms) |
23 | +static long vfp_reg_offset(bool dp, unsigned reg) | 63 | } |
64 | |||
65 | fdt_add_v2m_gic_node(vms); | ||
66 | + vms->msi_controller = VIRT_MSI_CTRL_GICV2M; | ||
67 | } | ||
68 | |||
69 | static void create_gic(VirtMachineState *vms) | ||
70 | @@ -XXX,XX +XXX,XX @@ out: | ||
71 | static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | ||
72 | DeviceState *dev, Error **errp) | ||
24 | { | 73 | { |
25 | if (dp) { | 74 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); |
26 | - return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); | 75 | + |
27 | + return neon_element_offset(reg, 0, MO_64); | 76 | if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { |
28 | } else { | 77 | virt_memory_pre_plug(hotplug_dev, dev, errp); |
29 | - long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]); | 78 | + } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { |
30 | - if (reg & 1) { | 79 | + hwaddr db_start = 0, db_end = 0; |
31 | - ofs += offsetof(CPU_DoubleU, l.upper); | 80 | + char *resv_prop_str; |
32 | - } else { | 81 | + |
33 | - ofs += offsetof(CPU_DoubleU, l.lower); | 82 | + switch (vms->msi_controller) { |
34 | - } | 83 | + case VIRT_MSI_CTRL_NONE: |
35 | - return ofs; | 84 | + return; |
36 | + return neon_element_offset(reg >> 1, reg & 1, MO_32); | 85 | + case VIRT_MSI_CTRL_ITS: |
86 | + /* GITS_TRANSLATER page */ | ||
87 | + db_start = base_memmap[VIRT_GIC_ITS].base + 0x10000; | ||
88 | + db_end = base_memmap[VIRT_GIC_ITS].base + | ||
89 | + base_memmap[VIRT_GIC_ITS].size - 1; | ||
90 | + break; | ||
91 | + case VIRT_MSI_CTRL_GICV2M: | ||
92 | + /* MSI_SETSPI_NS page */ | ||
93 | + db_start = base_memmap[VIRT_GIC_V2M].base; | ||
94 | + db_end = db_start + base_memmap[VIRT_GIC_V2M].size - 1; | ||
95 | + break; | ||
96 | + } | ||
97 | + resv_prop_str = g_strdup_printf("0x%"PRIx64":0x%"PRIx64":%u", | ||
98 | + db_start, db_end, | ||
99 | + VIRTIO_IOMMU_RESV_MEM_T_MSI); | ||
100 | + | ||
101 | + qdev_prop_set_uint32(dev, "len-reserved-regions", 1); | ||
102 | + qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); | ||
103 | + g_free(resv_prop_str); | ||
37 | } | 104 | } |
38 | } | 105 | } |
39 | 106 | ||
40 | -- | 107 | -- |
41 | 2.20.1 | 108 | 2.20.1 |
42 | 109 | ||
43 | 110 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Beata Michalska <beata.michalska@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Replace all uses of neon_load/store_reg64 within translate-neon.c.inc. | 3 | On ARMv7 & ARMv8 some load/store instructions might trigger a data abort |
4 | exception with no valid ISS info to be decoded. The lack of decode info | ||
5 | makes it at least tricky to emulate those instruction which is one of the | ||
6 | (many) reasons why KVM will not even try to do so. | ||
4 | 7 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Add support for handling those by requesting KVM to inject external |
6 | Message-id: 20201030022618.785675-9-richard.henderson@linaro.org | 9 | dabt into the quest. |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | |
11 | Signed-off-by: Beata Michalska <beata.michalska@linaro.org> | ||
12 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
13 | Message-id: 20200629114110.30723-2-beata.michalska@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 15 | --- |
10 | target/arm/translate.c | 26 +++++++++ | 16 | target/arm/kvm.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ |
11 | target/arm/translate-neon.c.inc | 94 ++++++++++++++++----------------- | 17 | 1 file changed, 52 insertions(+) |
12 | 2 files changed, 73 insertions(+), 47 deletions(-) | ||
13 | 18 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 19 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c |
15 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 21 | --- a/target/arm/kvm.c |
17 | +++ b/target/arm/translate.c | 22 | +++ b/target/arm/kvm.c |
18 | @@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | 23 | @@ -XXX,XX +XXX,XX @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { |
24 | |||
25 | static bool cap_has_mp_state; | ||
26 | static bool cap_has_inject_serror_esr; | ||
27 | +static bool cap_has_inject_ext_dabt; | ||
28 | |||
29 | static ARMHostCPUFeatures arm_host_cpu_features; | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_init(MachineState *ms, KVMState *s) | ||
32 | ret = -EINVAL; | ||
33 | } | ||
34 | |||
35 | + if (kvm_check_extension(s, KVM_CAP_ARM_NISV_TO_USER)) { | ||
36 | + if (kvm_vm_enable_cap(s, KVM_CAP_ARM_NISV_TO_USER, 0)) { | ||
37 | + error_report("Failed to enable KVM_CAP_ARM_NISV_TO_USER cap"); | ||
38 | + } else { | ||
39 | + /* Set status for supporting the external dabt injection */ | ||
40 | + cap_has_inject_ext_dabt = kvm_check_extension(s, | ||
41 | + KVM_CAP_ARM_INJECT_EXT_DABT); | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | return ret; | ||
46 | } | ||
47 | |||
48 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_vm_state_change(void *opaque, int running, RunState state) | ||
19 | } | 49 | } |
20 | } | 50 | } |
21 | 51 | ||
22 | +static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop) | 52 | +/** |
53 | + * kvm_arm_handle_dabt_nisv: | ||
54 | + * @cs: CPUState | ||
55 | + * @esr_iss: ISS encoding (limited) for the exception from Data Abort | ||
56 | + * ISV bit set to '0b0' -> no valid instruction syndrome | ||
57 | + * @fault_ipa: faulting address for the synchronous data abort | ||
58 | + * | ||
59 | + * Returns: 0 if the exception has been handled, < 0 otherwise | ||
60 | + */ | ||
61 | +static int kvm_arm_handle_dabt_nisv(CPUState *cs, uint64_t esr_iss, | ||
62 | + uint64_t fault_ipa) | ||
23 | +{ | 63 | +{ |
24 | + long off = neon_element_offset(reg, ele, memop); | 64 | + /* |
25 | + | 65 | + * Request KVM to inject the external data abort into the guest |
26 | + switch (memop) { | 66 | + */ |
27 | + case MO_Q: | 67 | + if (cap_has_inject_ext_dabt) { |
28 | + tcg_gen_ld_i64(dest, cpu_env, off); | 68 | + struct kvm_vcpu_events events = { }; |
29 | + break; | 69 | + /* |
30 | + default: | 70 | + * The external data abort event will be handled immediately by KVM |
31 | + g_assert_not_reached(); | 71 | + * using the address fault that triggered the exit on given VCPU. |
72 | + * Requesting injection of the external data abort does not rely | ||
73 | + * on any other VCPU state. Therefore, in this particular case, the VCPU | ||
74 | + * synchronization can be exceptionally skipped. | ||
75 | + */ | ||
76 | + events.exception.ext_dabt_pending = 1; | ||
77 | + /* KVM_CAP_ARM_INJECT_EXT_DABT implies KVM_CAP_VCPU_EVENTS */ | ||
78 | + return kvm_vcpu_ioctl(cs, KVM_SET_VCPU_EVENTS, &events); | ||
79 | + } else { | ||
80 | + error_report("Data abort exception triggered by guest memory access " | ||
81 | + "at physical address: 0x" TARGET_FMT_lx, | ||
82 | + (target_ulong)fault_ipa); | ||
83 | + error_printf("KVM unable to emulate faulting instruction.\n"); | ||
32 | + } | 84 | + } |
85 | + return -1; | ||
33 | +} | 86 | +} |
34 | + | 87 | + |
35 | static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | 88 | int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) |
36 | { | 89 | { |
37 | long off = neon_element_offset(reg, ele, memop); | 90 | int ret = 0; |
38 | @@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | 91 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) |
39 | } | 92 | ret = EXCP_DEBUG; |
40 | } | 93 | } /* otherwise return to guest */ |
41 | 94 | break; | |
42 | +static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop) | 95 | + case KVM_EXIT_ARM_NISV: |
43 | +{ | 96 | + /* External DABT with no valid iss to decode */ |
44 | + long off = neon_element_offset(reg, ele, memop); | 97 | + ret = kvm_arm_handle_dabt_nisv(cs, run->arm_nisv.esr_iss, |
45 | + | 98 | + run->arm_nisv.fault_ipa); |
46 | + switch (memop) { | ||
47 | + case MO_64: | ||
48 | + tcg_gen_st_i64(src, cpu_env, off); | ||
49 | + break; | 99 | + break; |
50 | + default: | 100 | default: |
51 | + g_assert_not_reached(); | 101 | qemu_log_mask(LOG_UNIMP, "%s: un-handled exit reason %d\n", |
52 | + } | 102 | __func__, run->exit_reason); |
53 | +} | ||
54 | + | ||
55 | static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | ||
56 | { | ||
57 | TCGv_ptr ret = tcg_temp_new_ptr(); | ||
58 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/arm/translate-neon.c.inc | ||
61 | +++ b/target/arm/translate-neon.c.inc | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, | ||
63 | for (pass = 0; pass < a->q + 1; pass++) { | ||
64 | TCGv_i64 tmp = tcg_temp_new_i64(); | ||
65 | |||
66 | - neon_load_reg64(tmp, a->vm + pass); | ||
67 | + read_neon_element64(tmp, a->vm, pass, MO_64); | ||
68 | fn(tmp, cpu_env, tmp, constimm); | ||
69 | - neon_store_reg64(tmp, a->vd + pass); | ||
70 | + write_neon_element64(tmp, a->vd, pass, MO_64); | ||
71 | tcg_temp_free_i64(tmp); | ||
72 | } | ||
73 | tcg_temp_free_i64(constimm); | ||
74 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, | ||
75 | rd = tcg_temp_new_i32(); | ||
76 | |||
77 | /* Load both inputs first to avoid potential overwrite if rm == rd */ | ||
78 | - neon_load_reg64(rm1, a->vm); | ||
79 | - neon_load_reg64(rm2, a->vm + 1); | ||
80 | + read_neon_element64(rm1, a->vm, 0, MO_64); | ||
81 | + read_neon_element64(rm2, a->vm, 1, MO_64); | ||
82 | |||
83 | shiftfn(rm1, rm1, constimm); | ||
84 | narrowfn(rd, cpu_env, rm1); | ||
85 | @@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a, | ||
86 | tcg_gen_shli_i64(tmp, tmp, a->shift); | ||
87 | tcg_gen_andi_i64(tmp, tmp, ~widen_mask); | ||
88 | } | ||
89 | - neon_store_reg64(tmp, a->vd); | ||
90 | + write_neon_element64(tmp, a->vd, 0, MO_64); | ||
91 | |||
92 | widenfn(tmp, rm1); | ||
93 | tcg_temp_free_i32(rm1); | ||
94 | @@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a, | ||
95 | tcg_gen_shli_i64(tmp, tmp, a->shift); | ||
96 | tcg_gen_andi_i64(tmp, tmp, ~widen_mask); | ||
97 | } | ||
98 | - neon_store_reg64(tmp, a->vd + 1); | ||
99 | + write_neon_element64(tmp, a->vd, 1, MO_64); | ||
100 | tcg_temp_free_i64(tmp); | ||
101 | return true; | ||
102 | } | ||
103 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
104 | rm_64 = tcg_temp_new_i64(); | ||
105 | |||
106 | if (src1_wide) { | ||
107 | - neon_load_reg64(rn0_64, a->vn); | ||
108 | + read_neon_element64(rn0_64, a->vn, 0, MO_64); | ||
109 | } else { | ||
110 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
111 | read_neon_element32(tmp, a->vn, 0, MO_32); | ||
112 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
113 | * avoid incorrect results if a narrow input overlaps with the result. | ||
114 | */ | ||
115 | if (src1_wide) { | ||
116 | - neon_load_reg64(rn1_64, a->vn + 1); | ||
117 | + read_neon_element64(rn1_64, a->vn, 1, MO_64); | ||
118 | } else { | ||
119 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
120 | read_neon_element32(tmp, a->vn, 1, MO_32); | ||
121 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
122 | rm = tcg_temp_new_i32(); | ||
123 | read_neon_element32(rm, a->vm, 1, MO_32); | ||
124 | |||
125 | - neon_store_reg64(rn0_64, a->vd); | ||
126 | + write_neon_element64(rn0_64, a->vd, 0, MO_64); | ||
127 | |||
128 | widenfn(rm_64, rm); | ||
129 | tcg_temp_free_i32(rm); | ||
130 | opfn(rn1_64, rn1_64, rm_64); | ||
131 | - neon_store_reg64(rn1_64, a->vd + 1); | ||
132 | + write_neon_element64(rn1_64, a->vd, 1, MO_64); | ||
133 | |||
134 | tcg_temp_free_i64(rn0_64); | ||
135 | tcg_temp_free_i64(rn1_64); | ||
136 | @@ -XXX,XX +XXX,XX @@ static bool do_narrow_3d(DisasContext *s, arg_3diff *a, | ||
137 | rd0 = tcg_temp_new_i32(); | ||
138 | rd1 = tcg_temp_new_i32(); | ||
139 | |||
140 | - neon_load_reg64(rn_64, a->vn); | ||
141 | - neon_load_reg64(rm_64, a->vm); | ||
142 | + read_neon_element64(rn_64, a->vn, 0, MO_64); | ||
143 | + read_neon_element64(rm_64, a->vm, 0, MO_64); | ||
144 | |||
145 | opfn(rn_64, rn_64, rm_64); | ||
146 | |||
147 | narrowfn(rd0, rn_64); | ||
148 | |||
149 | - neon_load_reg64(rn_64, a->vn + 1); | ||
150 | - neon_load_reg64(rm_64, a->vm + 1); | ||
151 | + read_neon_element64(rn_64, a->vn, 1, MO_64); | ||
152 | + read_neon_element64(rm_64, a->vm, 1, MO_64); | ||
153 | |||
154 | opfn(rn_64, rn_64, rm_64); | ||
155 | |||
156 | @@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a, | ||
157 | /* Don't store results until after all loads: they might overlap */ | ||
158 | if (accfn) { | ||
159 | tmp = tcg_temp_new_i64(); | ||
160 | - neon_load_reg64(tmp, a->vd); | ||
161 | + read_neon_element64(tmp, a->vd, 0, MO_64); | ||
162 | accfn(tmp, tmp, rd0); | ||
163 | - neon_store_reg64(tmp, a->vd); | ||
164 | - neon_load_reg64(tmp, a->vd + 1); | ||
165 | + write_neon_element64(tmp, a->vd, 0, MO_64); | ||
166 | + read_neon_element64(tmp, a->vd, 1, MO_64); | ||
167 | accfn(tmp, tmp, rd1); | ||
168 | - neon_store_reg64(tmp, a->vd + 1); | ||
169 | + write_neon_element64(tmp, a->vd, 1, MO_64); | ||
170 | tcg_temp_free_i64(tmp); | ||
171 | } else { | ||
172 | - neon_store_reg64(rd0, a->vd); | ||
173 | - neon_store_reg64(rd1, a->vd + 1); | ||
174 | + write_neon_element64(rd0, a->vd, 0, MO_64); | ||
175 | + write_neon_element64(rd1, a->vd, 1, MO_64); | ||
176 | } | ||
177 | |||
178 | tcg_temp_free_i64(rd0); | ||
179 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a, | ||
180 | |||
181 | if (accfn) { | ||
182 | TCGv_i64 t64 = tcg_temp_new_i64(); | ||
183 | - neon_load_reg64(t64, a->vd); | ||
184 | + read_neon_element64(t64, a->vd, 0, MO_64); | ||
185 | accfn(t64, t64, rn0_64); | ||
186 | - neon_store_reg64(t64, a->vd); | ||
187 | - neon_load_reg64(t64, a->vd + 1); | ||
188 | + write_neon_element64(t64, a->vd, 0, MO_64); | ||
189 | + read_neon_element64(t64, a->vd, 1, MO_64); | ||
190 | accfn(t64, t64, rn1_64); | ||
191 | - neon_store_reg64(t64, a->vd + 1); | ||
192 | + write_neon_element64(t64, a->vd, 1, MO_64); | ||
193 | tcg_temp_free_i64(t64); | ||
194 | } else { | ||
195 | - neon_store_reg64(rn0_64, a->vd); | ||
196 | - neon_store_reg64(rn1_64, a->vd + 1); | ||
197 | + write_neon_element64(rn0_64, a->vd, 0, MO_64); | ||
198 | + write_neon_element64(rn1_64, a->vd, 1, MO_64); | ||
199 | } | ||
200 | tcg_temp_free_i64(rn0_64); | ||
201 | tcg_temp_free_i64(rn1_64); | ||
202 | @@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a) | ||
203 | right = tcg_temp_new_i64(); | ||
204 | dest = tcg_temp_new_i64(); | ||
205 | |||
206 | - neon_load_reg64(right, a->vn); | ||
207 | - neon_load_reg64(left, a->vm); | ||
208 | + read_neon_element64(right, a->vn, 0, MO_64); | ||
209 | + read_neon_element64(left, a->vm, 0, MO_64); | ||
210 | tcg_gen_extract2_i64(dest, right, left, a->imm * 8); | ||
211 | - neon_store_reg64(dest, a->vd); | ||
212 | + write_neon_element64(dest, a->vd, 0, MO_64); | ||
213 | |||
214 | tcg_temp_free_i64(left); | ||
215 | tcg_temp_free_i64(right); | ||
216 | @@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a) | ||
217 | destright = tcg_temp_new_i64(); | ||
218 | |||
219 | if (a->imm < 8) { | ||
220 | - neon_load_reg64(right, a->vn); | ||
221 | - neon_load_reg64(middle, a->vn + 1); | ||
222 | + read_neon_element64(right, a->vn, 0, MO_64); | ||
223 | + read_neon_element64(middle, a->vn, 1, MO_64); | ||
224 | tcg_gen_extract2_i64(destright, right, middle, a->imm * 8); | ||
225 | - neon_load_reg64(left, a->vm); | ||
226 | + read_neon_element64(left, a->vm, 0, MO_64); | ||
227 | tcg_gen_extract2_i64(destleft, middle, left, a->imm * 8); | ||
228 | } else { | ||
229 | - neon_load_reg64(right, a->vn + 1); | ||
230 | - neon_load_reg64(middle, a->vm); | ||
231 | + read_neon_element64(right, a->vn, 1, MO_64); | ||
232 | + read_neon_element64(middle, a->vm, 0, MO_64); | ||
233 | tcg_gen_extract2_i64(destright, right, middle, (a->imm - 8) * 8); | ||
234 | - neon_load_reg64(left, a->vm + 1); | ||
235 | + read_neon_element64(left, a->vm, 1, MO_64); | ||
236 | tcg_gen_extract2_i64(destleft, middle, left, (a->imm - 8) * 8); | ||
237 | } | ||
238 | |||
239 | - neon_store_reg64(destright, a->vd); | ||
240 | - neon_store_reg64(destleft, a->vd + 1); | ||
241 | + write_neon_element64(destright, a->vd, 0, MO_64); | ||
242 | + write_neon_element64(destleft, a->vd, 1, MO_64); | ||
243 | |||
244 | tcg_temp_free_i64(destright); | ||
245 | tcg_temp_free_i64(destleft); | ||
246 | @@ -XXX,XX +XXX,XX @@ static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, | ||
247 | |||
248 | if (accfn) { | ||
249 | TCGv_i64 tmp64 = tcg_temp_new_i64(); | ||
250 | - neon_load_reg64(tmp64, a->vd + pass); | ||
251 | + read_neon_element64(tmp64, a->vd, pass, MO_64); | ||
252 | accfn(rd_64, tmp64, rd_64); | ||
253 | tcg_temp_free_i64(tmp64); | ||
254 | } | ||
255 | - neon_store_reg64(rd_64, a->vd + pass); | ||
256 | + write_neon_element64(rd_64, a->vd, pass, MO_64); | ||
257 | tcg_temp_free_i64(rd_64); | ||
258 | } | ||
259 | return true; | ||
260 | @@ -XXX,XX +XXX,XX @@ static bool do_vmovn(DisasContext *s, arg_2misc *a, | ||
261 | rd0 = tcg_temp_new_i32(); | ||
262 | rd1 = tcg_temp_new_i32(); | ||
263 | |||
264 | - neon_load_reg64(rm, a->vm); | ||
265 | + read_neon_element64(rm, a->vm, 0, MO_64); | ||
266 | narrowfn(rd0, cpu_env, rm); | ||
267 | - neon_load_reg64(rm, a->vm + 1); | ||
268 | + read_neon_element64(rm, a->vm, 1, MO_64); | ||
269 | narrowfn(rd1, cpu_env, rm); | ||
270 | write_neon_element32(rd0, a->vd, 0, MO_32); | ||
271 | write_neon_element32(rd1, a->vd, 1, MO_32); | ||
272 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a) | ||
273 | |||
274 | widenfn(rd, rm0); | ||
275 | tcg_gen_shli_i64(rd, rd, 8 << a->size); | ||
276 | - neon_store_reg64(rd, a->vd); | ||
277 | + write_neon_element64(rd, a->vd, 0, MO_64); | ||
278 | widenfn(rd, rm1); | ||
279 | tcg_gen_shli_i64(rd, rd, 8 << a->size); | ||
280 | - neon_store_reg64(rd, a->vd + 1); | ||
281 | + write_neon_element64(rd, a->vd, 1, MO_64); | ||
282 | |||
283 | tcg_temp_free_i64(rd); | ||
284 | tcg_temp_free_i32(rm0); | ||
285 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSWP(DisasContext *s, arg_2misc *a) | ||
286 | rm = tcg_temp_new_i64(); | ||
287 | rd = tcg_temp_new_i64(); | ||
288 | for (pass = 0; pass < (a->q ? 2 : 1); pass++) { | ||
289 | - neon_load_reg64(rm, a->vm + pass); | ||
290 | - neon_load_reg64(rd, a->vd + pass); | ||
291 | - neon_store_reg64(rm, a->vd + pass); | ||
292 | - neon_store_reg64(rd, a->vm + pass); | ||
293 | + read_neon_element64(rm, a->vm, pass, MO_64); | ||
294 | + read_neon_element64(rd, a->vd, pass, MO_64); | ||
295 | + write_neon_element64(rm, a->vd, pass, MO_64); | ||
296 | + write_neon_element64(rd, a->vm, pass, MO_64); | ||
297 | } | ||
298 | tcg_temp_free_i64(rm); | ||
299 | tcg_temp_free_i64(rd); | ||
300 | -- | 103 | -- |
301 | 2.20.1 | 104 | 2.20.1 |
302 | 105 | ||
303 | 106 | diff view generated by jsdifflib |
1 | From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 1 | From: Beata Michalska <beata.michalska@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | HCR should be applied when NS is set, not when it is cleared. | 3 | Injecting external data abort through KVM might trigger |
4 | 4 | an issue on kernels that do not get updated to include the KVM fix. | |
5 | Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 5 | For those and aarch32 guests, the injected abort gets misconfigured |
6 | to be an implementation defined exception. This leads to the guest | ||
7 | repeatedly re-running the faulting instruction. | ||
8 | |||
9 | Add support for handling that case. | ||
10 | |||
11 | [ | ||
12 | Fixed-by: 018f22f95e8a | ||
13 | ('KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests') | ||
14 | Fixed-by: 21aecdbd7f3a | ||
15 | ('KVM: arm: Make inject_abt32() inject an external abort instead') | ||
16 | ] | ||
17 | |||
18 | Signed-off-by: Beata Michalska <beata.michalska@linaro.org> | ||
19 | Acked-by: Andrew Jones <drjones@redhat.com> | ||
20 | Message-id: 20200629114110.30723-3-beata.michalska@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 23 | --- |
9 | target/arm/helper.c | 5 ++--- | 24 | target/arm/cpu.h | 2 ++ |
10 | 1 file changed, 2 insertions(+), 3 deletions(-) | 25 | target/arm/kvm_arm.h | 10 +++++++++ |
11 | 26 | target/arm/kvm.c | 30 ++++++++++++++++++++++++++- | |
12 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 27 | target/arm/kvm32.c | 34 ++++++++++++++++++++++++++++++ |
13 | index XXXXXXX..XXXXXXX 100644 | 28 | target/arm/kvm64.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ |
14 | --- a/target/arm/helper.c | 29 | 5 files changed, 124 insertions(+), 1 deletion(-) |
15 | +++ b/target/arm/helper.c | 30 | |
16 | @@ -XXX,XX +XXX,XX @@ static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
17 | 32 | index XXXXXXX..XXXXXXX 100644 | |
18 | /* | 33 | --- a/target/arm/cpu.h |
19 | * Non-IS variants of TLB operations are upgraded to | 34 | +++ b/target/arm/cpu.h |
20 | - * IS versions if we are at NS EL1 and HCR_EL2.FB is set to | 35 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { |
21 | + * IS versions if we are at EL1 and HCR_EL2.FB is effectively set to | 36 | uint64_t esr; |
22 | * force broadcast of these operations. | 37 | } serror; |
23 | */ | 38 | |
24 | static bool tlb_force_broadcast(CPUARMState *env) | 39 | + uint8_t ext_dabt_raised; /* Tracking/verifying injection of ext DABT */ |
40 | + | ||
41 | /* State of our input IRQ/FIQ/VIRQ/VFIQ lines */ | ||
42 | uint32_t irq_line_state; | ||
43 | |||
44 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/kvm_arm.h | ||
47 | +++ b/target/arm/kvm_arm.h | ||
48 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_hw_debug_active(CPUState *cs); | ||
49 | struct kvm_guest_debug_arch; | ||
50 | void kvm_arm_copy_hw_debug_data(struct kvm_guest_debug_arch *ptr); | ||
51 | |||
52 | +/** | ||
53 | + * kvm_arm_verify_ext_dabt_pending: | ||
54 | + * @cs: CPUState | ||
55 | + * | ||
56 | + * Verify the fault status code wrt the Ext DABT injection | ||
57 | + * | ||
58 | + * Returns: true if the fault status code is as expected, false otherwise | ||
59 | + */ | ||
60 | +bool kvm_arm_verify_ext_dabt_pending(CPUState *cs); | ||
61 | + | ||
62 | /** | ||
63 | * its_class_name: | ||
64 | * | ||
65 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/kvm.c | ||
68 | +++ b/target/arm/kvm.c | ||
69 | @@ -XXX,XX +XXX,XX @@ int kvm_get_vcpu_events(ARMCPU *cpu) | ||
70 | |||
71 | void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) | ||
25 | { | 72 | { |
26 | - return (env->cp15.hcr_el2 & HCR_FB) && | 73 | + ARMCPU *cpu = ARM_CPU(cs); |
27 | - arm_current_el(env) == 1 && arm_is_secure_below_el3(env); | 74 | + CPUARMState *env = &cpu->env; |
28 | + return arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_FB); | 75 | + |
76 | + if (unlikely(env->ext_dabt_raised)) { | ||
77 | + /* | ||
78 | + * Verifying that the ext DABT has been properly injected, | ||
79 | + * otherwise risking indefinitely re-running the faulting instruction | ||
80 | + * Covering a very narrow case for kernels 5.5..5.5.4 | ||
81 | + * when injected abort was misconfigured to be | ||
82 | + * an IMPLEMENTATION DEFINED exception (for 32-bit EL1) | ||
83 | + */ | ||
84 | + if (!arm_feature(env, ARM_FEATURE_AARCH64) && | ||
85 | + unlikely(!kvm_arm_verify_ext_dabt_pending(cs))) { | ||
86 | + | ||
87 | + error_report("Data abort exception with no valid ISS generated by " | ||
88 | + "guest memory access. KVM unable to emulate faulting " | ||
89 | + "instruction. Failed to inject an external data abort " | ||
90 | + "into the guest."); | ||
91 | + abort(); | ||
92 | + } | ||
93 | + /* Clear the status */ | ||
94 | + env->ext_dabt_raised = 0; | ||
95 | + } | ||
29 | } | 96 | } |
30 | 97 | ||
31 | static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri, | 98 | MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) |
99 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_vm_state_change(void *opaque, int running, RunState state) | ||
100 | static int kvm_arm_handle_dabt_nisv(CPUState *cs, uint64_t esr_iss, | ||
101 | uint64_t fault_ipa) | ||
102 | { | ||
103 | + ARMCPU *cpu = ARM_CPU(cs); | ||
104 | + CPUARMState *env = &cpu->env; | ||
105 | /* | ||
106 | * Request KVM to inject the external data abort into the guest | ||
107 | */ | ||
108 | @@ -XXX,XX +XXX,XX @@ static int kvm_arm_handle_dabt_nisv(CPUState *cs, uint64_t esr_iss, | ||
109 | */ | ||
110 | events.exception.ext_dabt_pending = 1; | ||
111 | /* KVM_CAP_ARM_INJECT_EXT_DABT implies KVM_CAP_VCPU_EVENTS */ | ||
112 | - return kvm_vcpu_ioctl(cs, KVM_SET_VCPU_EVENTS, &events); | ||
113 | + if (!kvm_vcpu_ioctl(cs, KVM_SET_VCPU_EVENTS, &events)) { | ||
114 | + env->ext_dabt_raised = 1; | ||
115 | + return 0; | ||
116 | + } | ||
117 | } else { | ||
118 | error_report("Data abort exception triggered by guest memory access " | ||
119 | "at physical address: 0x" TARGET_FMT_lx, | ||
120 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/target/arm/kvm32.c | ||
123 | +++ b/target/arm/kvm32.c | ||
124 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_pmu_init(CPUState *cs) | ||
125 | { | ||
126 | qemu_log_mask(LOG_UNIMP, "%s: not implemented\n", __func__); | ||
127 | } | ||
128 | + | ||
129 | +#define ARM_REG_DFSR ARM_CP15_REG32(0, 5, 0, 0) | ||
130 | +#define ARM_REG_TTBCR ARM_CP15_REG32(0, 2, 0, 2) | ||
131 | +/* | ||
132 | + *DFSR: | ||
133 | + * TTBCR.EAE == 0 | ||
134 | + * FS[4] - DFSR[10] | ||
135 | + * FS[3:0] - DFSR[3:0] | ||
136 | + * TTBCR.EAE == 1 | ||
137 | + * FS, bits [5:0] | ||
138 | + */ | ||
139 | +#define DFSR_FSC(lpae, v) \ | ||
140 | + ((lpae) ? ((v) & 0x3F) : (((v) >> 6) | ((v) & 0x1F))) | ||
141 | + | ||
142 | +#define DFSC_EXTABT(lpae) ((lpae) ? 0x10 : 0x08) | ||
143 | + | ||
144 | +bool kvm_arm_verify_ext_dabt_pending(CPUState *cs) | ||
145 | +{ | ||
146 | + uint32_t dfsr_val; | ||
147 | + | ||
148 | + if (!kvm_get_one_reg(cs, ARM_REG_DFSR, &dfsr_val)) { | ||
149 | + ARMCPU *cpu = ARM_CPU(cs); | ||
150 | + CPUARMState *env = &cpu->env; | ||
151 | + uint32_t ttbcr; | ||
152 | + int lpae = 0; | ||
153 | + | ||
154 | + if (!kvm_get_one_reg(cs, ARM_REG_TTBCR, &ttbcr)) { | ||
155 | + lpae = arm_feature(env, ARM_FEATURE_LPAE) && (ttbcr & TTBCR_EAE); | ||
156 | + } | ||
157 | + /* The verification is based on FS filed of the DFSR reg only*/ | ||
158 | + return (DFSR_FSC(lpae, dfsr_val) == DFSC_EXTABT(lpae)); | ||
159 | + } | ||
160 | + return false; | ||
161 | +} | ||
162 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
163 | index XXXXXXX..XXXXXXX 100644 | ||
164 | --- a/target/arm/kvm64.c | ||
165 | +++ b/target/arm/kvm64.c | ||
166 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_debug_exit_arch *debug_exit) | ||
167 | |||
168 | return false; | ||
169 | } | ||
170 | + | ||
171 | +#define ARM64_REG_ESR_EL1 ARM64_SYS_REG(3, 0, 5, 2, 0) | ||
172 | +#define ARM64_REG_TCR_EL1 ARM64_SYS_REG(3, 0, 2, 0, 2) | ||
173 | + | ||
174 | +/* | ||
175 | + * ESR_EL1 | ||
176 | + * ISS encoding | ||
177 | + * AARCH64: DFSC, bits [5:0] | ||
178 | + * AARCH32: | ||
179 | + * TTBCR.EAE == 0 | ||
180 | + * FS[4] - DFSR[10] | ||
181 | + * FS[3:0] - DFSR[3:0] | ||
182 | + * TTBCR.EAE == 1 | ||
183 | + * FS, bits [5:0] | ||
184 | + */ | ||
185 | +#define ESR_DFSC(aarch64, lpae, v) \ | ||
186 | + ((aarch64 || (lpae)) ? ((v) & 0x3F) \ | ||
187 | + : (((v) >> 6) | ((v) & 0x1F))) | ||
188 | + | ||
189 | +#define ESR_DFSC_EXTABT(aarch64, lpae) \ | ||
190 | + ((aarch64) ? 0x10 : (lpae) ? 0x10 : 0x8) | ||
191 | + | ||
192 | +bool kvm_arm_verify_ext_dabt_pending(CPUState *cs) | ||
193 | +{ | ||
194 | + uint64_t dfsr_val; | ||
195 | + | ||
196 | + if (!kvm_get_one_reg(cs, ARM64_REG_ESR_EL1, &dfsr_val)) { | ||
197 | + ARMCPU *cpu = ARM_CPU(cs); | ||
198 | + CPUARMState *env = &cpu->env; | ||
199 | + int aarch64_mode = arm_feature(env, ARM_FEATURE_AARCH64); | ||
200 | + int lpae = 0; | ||
201 | + | ||
202 | + if (!aarch64_mode) { | ||
203 | + uint64_t ttbcr; | ||
204 | + | ||
205 | + if (!kvm_get_one_reg(cs, ARM64_REG_TCR_EL1, &ttbcr)) { | ||
206 | + lpae = arm_feature(env, ARM_FEATURE_LPAE) | ||
207 | + && (ttbcr & TTBCR_EAE); | ||
208 | + } | ||
209 | + } | ||
210 | + /* | ||
211 | + * The verification here is based on the DFSC bits | ||
212 | + * of the ESR_EL1 reg only | ||
213 | + */ | ||
214 | + return (ESR_DFSC(aarch64_mode, lpae, dfsr_val) == | ||
215 | + ESR_DFSC_EXTABT(aarch64_mode, lpae)); | ||
216 | + } | ||
217 | + return false; | ||
218 | +} | ||
32 | -- | 219 | -- |
33 | 2.20.1 | 220 | 2.20.1 |
34 | 221 | ||
35 | 222 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
1 | 2 | ||
3 | Fixes: 93dd625f8bf7 ("tests/acpi: update expected data files") | ||
4 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
5 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Message-id: 20200629140938.17566-2-drjones@redhat.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | tests/qtest/bios-tables-test-allowed-diff.h | 18 ------------------ | ||
11 | 1 file changed, 18 deletions(-) | ||
12 | |||
13 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
16 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
17 | @@ -1,19 +1 @@ | ||
18 | /* List of comma-separated changed AML files to ignore */ | ||
19 | -"tests/data/acpi/pc/DSDT", | ||
20 | -"tests/data/acpi/pc/DSDT.acpihmat", | ||
21 | -"tests/data/acpi/pc/DSDT.bridge", | ||
22 | -"tests/data/acpi/pc/DSDT.cphp", | ||
23 | -"tests/data/acpi/pc/DSDT.dimmpxm", | ||
24 | -"tests/data/acpi/pc/DSDT.ipmikcs", | ||
25 | -"tests/data/acpi/pc/DSDT.memhp", | ||
26 | -"tests/data/acpi/pc/DSDT.numamem", | ||
27 | -"tests/data/acpi/q35/DSDT", | ||
28 | -"tests/data/acpi/q35/DSDT.acpihmat", | ||
29 | -"tests/data/acpi/q35/DSDT.bridge", | ||
30 | -"tests/data/acpi/q35/DSDT.cphp", | ||
31 | -"tests/data/acpi/q35/DSDT.dimmpxm", | ||
32 | -"tests/data/acpi/q35/DSDT.ipmibt", | ||
33 | -"tests/data/acpi/q35/DSDT.memhp", | ||
34 | -"tests/data/acpi/q35/DSDT.mmio64", | ||
35 | -"tests/data/acpi/q35/DSDT.numamem", | ||
36 | -"tests/data/acpi/q35/DSDT.tis", | ||
37 | -- | ||
38 | 2.20.1 | ||
39 | |||
40 | diff view generated by jsdifflib |
1 | From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | When booting a CPU with EL3 using the -kernel flag, set up CPTR_EL3 so | 3 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
4 | that SVE will not trap to EL3. | 4 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> |
5 | 5 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | |
6 | Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 6 | Message-id: 20200629140938.17566-3-drjones@redhat.com |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20201030151541.11976-1-remi@remlab.net | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 8 | --- |
11 | hw/arm/boot.c | 3 +++ | 9 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
12 | 1 file changed, 3 insertions(+) | 10 | 1 file changed, 3 insertions(+) |
13 | 11 | ||
14 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 12 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/boot.c | 14 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
17 | +++ b/hw/arm/boot.c | 15 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
18 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) | 16 | @@ -1 +1,4 @@ |
19 | if (cpu_isar_feature(aa64_mte, cpu)) { | 17 | /* List of comma-separated changed AML files to ignore */ |
20 | env->cp15.scr_el3 |= SCR_ATA; | 18 | +"tests/data/acpi/virt/DSDT", |
21 | } | 19 | +"tests/data/acpi/virt/DSDT.memhp", |
22 | + if (cpu_isar_feature(aa64_sve, cpu)) { | 20 | +"tests/data/acpi/virt/DSDT.numamem", |
23 | + env->cp15.cptr_el[3] |= CPTR_EZ; | ||
24 | + } | ||
25 | /* AArch64 kernels never boot in secure mode */ | ||
26 | assert(!info->secure_boot); | ||
27 | /* This hook is only supported for AArch32 currently: | ||
28 | -- | 21 | -- |
29 | 2.20.1 | 22 | 2.20.1 |
30 | 23 | ||
31 | 24 | diff view generated by jsdifflib |
1 | From: AlexChen <alex.chen@huawei.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | In exynos4210_fimd_update(), the pointer s is dereferinced before | 3 | The flash device is exclusively for the host-controlled firmware, so |
4 | being check if it is valid, which may lead to NULL pointer dereference. | 4 | we should not expose it to the OS. Exposing it risks the OS messing |
5 | So move the assignment to global_width after checking that the s is valid. | 5 | with it, which could break firmware runtime services and surprise the |
6 | OS when all its changes disappear after reboot. | ||
6 | 7 | ||
7 | Reported-by: Euler Robot <euler.robot@huawei.com> | 8 | As firmware needs the device and uses DT, we leave the device exposed |
8 | Signed-off-by: Alex Chen <alex.chen@huawei.com> | 9 | there. It's up to firmware to remove the nodes from DT before sending |
10 | it on to the OS. However, there's no need to force firmware to remove | ||
11 | tables from ACPI (which it doesn't know how to do anyway), so we | ||
12 | simply don't add the tables in the first place. But, as we've been | ||
13 | adding the tables for quite some time and don't want to change the | ||
14 | default hardware exposed to versioned machines, then we only stop | ||
15 | exposing the flash device tables for 5.1 and later machine types. | ||
16 | |||
17 | Suggested-by: Ard Biesheuvel <ard.biesheuvel@arm.com> | ||
18 | Suggested-by: Laszlo Ersek <lersek@redhat.com> | ||
19 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
20 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
21 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 22 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
10 | Message-id: 5F9F8D88.9030102@huawei.com | 23 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> |
24 | Message-id: 20200629140938.17566-4-drjones@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 26 | --- |
13 | hw/display/exynos4210_fimd.c | 4 +++- | 27 | include/hw/arm/virt.h | 1 + |
14 | 1 file changed, 3 insertions(+), 1 deletion(-) | 28 | hw/arm/virt-acpi-build.c | 5 ++++- |
29 | hw/arm/virt.c | 3 +++ | ||
30 | 3 files changed, 8 insertions(+), 1 deletion(-) | ||
15 | 31 | ||
16 | diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c | 32 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h |
17 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/display/exynos4210_fimd.c | 34 | --- a/include/hw/arm/virt.h |
19 | +++ b/hw/display/exynos4210_fimd.c | 35 | +++ b/include/hw/arm/virt.h |
20 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_fimd_update(void *opaque) | 36 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
21 | bool blend = false; | 37 | bool no_highmem_ecam; |
22 | uint8_t *host_fb_addr; | 38 | bool no_ged; /* Machines < 4.2 has no support for ACPI GED device */ |
23 | bool is_dirty = false; | 39 | bool kvm_no_adjvtime; |
24 | - const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; | 40 | + bool acpi_expose_flash; |
25 | + int global_width; | 41 | } VirtMachineClass; |
26 | 42 | ||
27 | if (!s || !s->console || !s->enabled || | 43 | typedef struct { |
28 | surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) { | 44 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
29 | return; | 45 | index XXXXXXX..XXXXXXX 100644 |
30 | } | 46 | --- a/hw/arm/virt-acpi-build.c |
47 | +++ b/hw/arm/virt-acpi-build.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker, | ||
49 | static void | ||
50 | build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
51 | { | ||
52 | + VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); | ||
53 | Aml *scope, *dsdt; | ||
54 | MachineState *ms = MACHINE(vms); | ||
55 | const MemMapEntry *memmap = vms->memmap; | ||
56 | @@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
57 | acpi_dsdt_add_cpus(scope, vms->smp_cpus); | ||
58 | acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], | ||
59 | (irqmap[VIRT_UART] + ARM_SPI_BASE)); | ||
60 | - acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); | ||
61 | + if (vmc->acpi_expose_flash) { | ||
62 | + acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); | ||
63 | + } | ||
64 | acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]); | ||
65 | acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], | ||
66 | (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); | ||
67 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/hw/arm/virt.c | ||
70 | +++ b/hw/arm/virt.c | ||
71 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 1) | ||
72 | |||
73 | static void virt_machine_5_0_options(MachineClass *mc) | ||
74 | { | ||
75 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
31 | + | 76 | + |
32 | + global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; | 77 | virt_machine_5_1_options(mc); |
33 | exynos4210_update_resolution(s); | 78 | compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); |
34 | surface = qemu_console_surface(s->console); | 79 | mc->numa_mem_supported = true; |
80 | + vmc->acpi_expose_flash = true; | ||
81 | } | ||
82 | DEFINE_VIRT_MACHINE(5, 0) | ||
35 | 83 | ||
36 | -- | 84 | -- |
37 | 2.20.1 | 85 | 2.20.1 |
38 | 86 | ||
39 | 87 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
1 | 2 | ||
3 | Differences between disassembled ASL files for DSDT: | ||
4 | |||
5 | @@ -XXX,XX +XXX,XX @@ | ||
6 | * | ||
7 | * Disassembling to symbolic ASL+ operators | ||
8 | * | ||
9 | - * Disassembly of a, Mon Jun 29 09:50:01 2020 | ||
10 | + * Disassembly of b, Mon Jun 29 09:50:03 2020 | ||
11 | * | ||
12 | * Original Table Header: | ||
13 | * Signature "DSDT" | ||
14 | - * Length 0x000014BB (5307) | ||
15 | + * Length 0x00001455 (5205) | ||
16 | * Revision 0x02 | ||
17 | - * Checksum 0xD1 | ||
18 | + * Checksum 0xE1 | ||
19 | * OEM ID "BOCHS " | ||
20 | * OEM Table ID "BXPCDSDT" | ||
21 | * OEM Revision 0x00000001 (1) | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | }) | ||
24 | } | ||
25 | |||
26 | - Device (FLS0) | ||
27 | - { | ||
28 | - Name (_HID, "LNRO0015") // _HID: Hardware ID | ||
29 | - Name (_UID, Zero) // _UID: Unique ID | ||
30 | - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
31 | - { | ||
32 | - Memory32Fixed (ReadWrite, | ||
33 | - 0x00000000, // Address Base | ||
34 | - 0x04000000, // Address Length | ||
35 | - ) | ||
36 | - }) | ||
37 | - } | ||
38 | - | ||
39 | - Device (FLS1) | ||
40 | - { | ||
41 | - Name (_HID, "LNRO0015") // _HID: Hardware ID | ||
42 | - Name (_UID, One) // _UID: Unique ID | ||
43 | - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
44 | - { | ||
45 | - Memory32Fixed (ReadWrite, | ||
46 | - 0x04000000, // Address Base | ||
47 | - 0x04000000, // Address Length | ||
48 | - ) | ||
49 | - }) | ||
50 | - } | ||
51 | - | ||
52 | Device (FWCF) | ||
53 | { | ||
54 | Name (_HID, "QEMU0002") // _HID: Hardware ID | ||
55 | |||
56 | The other two binaries have the same changes (the removal of the | ||
57 | flash devices). | ||
58 | |||
59 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
60 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
61 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
62 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
63 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> | ||
64 | Message-id: 20200629140938.17566-5-drjones@redhat.com | ||
65 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
66 | --- | ||
67 | tests/qtest/bios-tables-test-allowed-diff.h | 3 --- | ||
68 | tests/data/acpi/virt/DSDT | Bin 5307 -> 5205 bytes | ||
69 | tests/data/acpi/virt/DSDT.memhp | Bin 6668 -> 6566 bytes | ||
70 | tests/data/acpi/virt/DSDT.numamem | Bin 5307 -> 5205 bytes | ||
71 | 4 files changed, 3 deletions(-) | ||
72 | |||
73 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
76 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
77 | @@ -1,4 +1 @@ | ||
78 | /* List of comma-separated changed AML files to ignore */ | ||
79 | -"tests/data/acpi/virt/DSDT", | ||
80 | -"tests/data/acpi/virt/DSDT.memhp", | ||
81 | -"tests/data/acpi/virt/DSDT.numamem", | ||
82 | diff --git a/tests/data/acpi/virt/DSDT b/tests/data/acpi/virt/DSDT | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | GIT binary patch | ||
85 | delta 28 | ||
86 | kcmdn3c~yhUCD<h-RD^+n>ET2!X{H9}iRuX(-<}f&0DgxFc>n+a | ||
87 | |||
88 | delta 156 | ||
89 | zcmcbrv0IbNCD<iow+I6R)5VEg(oAih6V(&y4c&Z#4LIUGJY9Hw{DS-q3=B;fIO0P+ | ||
90 | zU4W!>P_UpN7hfAE10w?juv9WcH-WSmV$;Hiu7w4t3#`S$E!^1+q9xGPH`KtuzzAr5 | ||
91 | LaERl^1zUvy_;n(J | ||
92 | |||
93 | diff --git a/tests/data/acpi/virt/DSDT.memhp b/tests/data/acpi/virt/DSDT.memhp | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | GIT binary patch | ||
96 | delta 28 | ||
97 | kcmeA%S!T@T66_MPOp<|tiD@F2G*jb@iRuX(-^xn@0CHUjRR910 | ||
98 | |||
99 | delta 156 | ||
100 | zcmZ2x++)J!66_MfBgMeL^l>7WG*kP$iRuaUhHgH=1|0Doo-VvTenI{Q28N~#9Py!^ | ||
101 | zE<n;bC|FRCi?5B7fsp|MSSlH!n?PC&v1wsM*TMqS1=eEW7Vhi@(GuwD8){%+U<5Qj | ||
102 | LIK*+|0yaqism~!^ | ||
103 | |||
104 | diff --git a/tests/data/acpi/virt/DSDT.numamem b/tests/data/acpi/virt/DSDT.numamem | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | GIT binary patch | ||
107 | delta 28 | ||
108 | kcmdn3c~yhUCD<h-RD^+n>ET2!X{H9}iRuX(-<}f&0DgxFc>n+a | ||
109 | |||
110 | delta 156 | ||
111 | zcmcbrv0IbNCD<iow+I6R)5VEg(oAih6V(&y4c&Z#4LIUGJY9Hw{DS-q3=B;fIO0P+ | ||
112 | zU4W!>P_UpN7hfAE10w?juv9WcH-WSmV$;Hiu7w4t3#`S$E!^1+q9xGPH`KtuzzAr5 | ||
113 | LaERl^1zUvy_;n(J | ||
114 | |||
115 | -- | ||
116 | 2.20.1 | ||
117 | |||
118 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This function makes it clear that we're talking about the whole | 3 | The temp that gets assigned to clean_addr has been allocated with |
4 | register, and not the 32-bit piece at index 0. This fixes a bug | 4 | new_tmp_a64, which means that it will be freed at the end of the |
5 | when running on a big-endian host. | 5 | instruction. Freeing it earlier leads to assertion failure. |
6 | 6 | ||
7 | The loop creates a complication, in which we allocate a new local | ||
8 | temp, which does need freeing, and the final code path is shared | ||
9 | between the loop and non-loop. | ||
10 | |||
11 | Fix this complication by adding new_tmp_a64_local so that the new | ||
12 | local temp is freed at the end, and can be treated exactly like | ||
13 | the non-loop path. | ||
14 | |||
15 | Fixes: bba87d0a0f4 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20201030022618.785675-2-richard.henderson@linaro.org | 17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Message-id: 20200702175605.1987125-1-richard.henderson@linaro.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 20 | --- |
12 | target/arm/translate.c | 8 ++++++ | 21 | target/arm/translate-a64.h | 1 + |
13 | target/arm/translate-neon.c.inc | 44 ++++++++++++++++----------------- | 22 | target/arm/translate-a64.c | 6 ++++++ |
14 | target/arm/translate-vfp.c.inc | 2 +- | 23 | target/arm/translate-sve.c | 8 ++------ |
15 | 3 files changed, 31 insertions(+), 23 deletions(-) | 24 | 3 files changed, 9 insertions(+), 6 deletions(-) |
16 | 25 | ||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 26 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h |
18 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 28 | --- a/target/arm/translate-a64.h |
20 | +++ b/target/arm/translate.c | 29 | +++ b/target/arm/translate-a64.h |
21 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | 30 | @@ -XXX,XX +XXX,XX @@ void unallocated_encoding(DisasContext *s); |
22 | unallocated_encoding(s); | 31 | } while (0) |
32 | |||
33 | TCGv_i64 new_tmp_a64(DisasContext *s); | ||
34 | +TCGv_i64 new_tmp_a64_local(DisasContext *s); | ||
35 | TCGv_i64 new_tmp_a64_zero(DisasContext *s); | ||
36 | TCGv_i64 cpu_reg(DisasContext *s, int reg); | ||
37 | TCGv_i64 cpu_reg_sp(DisasContext *s, int reg); | ||
38 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/translate-a64.c | ||
41 | +++ b/target/arm/translate-a64.c | ||
42 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 new_tmp_a64(DisasContext *s) | ||
43 | return s->tmp_a64[s->tmp_a64_count++] = tcg_temp_new_i64(); | ||
23 | } | 44 | } |
24 | 45 | ||
25 | +/* | 46 | +TCGv_i64 new_tmp_a64_local(DisasContext *s) |
26 | + * Return the offset of a "full" NEON Dreg. | ||
27 | + */ | ||
28 | +static long neon_full_reg_offset(unsigned reg) | ||
29 | +{ | 47 | +{ |
30 | + return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); | 48 | + assert(s->tmp_a64_count < TMP_A64_MAX); |
49 | + return s->tmp_a64[s->tmp_a64_count++] = tcg_temp_local_new_i64(); | ||
31 | +} | 50 | +} |
32 | + | 51 | + |
33 | static inline long vfp_reg_offset(bool dp, unsigned reg) | 52 | TCGv_i64 new_tmp_a64_zero(DisasContext *s) |
34 | { | 53 | { |
35 | if (dp) { | 54 | TCGv_i64 t = new_tmp_a64(s); |
36 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 55 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
37 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.c.inc | 57 | --- a/target/arm/translate-sve.c |
39 | +++ b/target/arm/translate-neon.c.inc | 58 | +++ b/target/arm/translate-sve.c |
40 | @@ -XXX,XX +XXX,XX @@ neon_element_offset(int reg, int element, MemOp size) | 59 | @@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) |
41 | ofs ^= 8 - element_size; | 60 | |
61 | /* Copy the clean address into a local temp, live across the loop. */ | ||
62 | t0 = clean_addr; | ||
63 | - clean_addr = tcg_temp_local_new_i64(); | ||
64 | + clean_addr = new_tmp_a64_local(s); | ||
65 | tcg_gen_mov_i64(clean_addr, t0); | ||
66 | - tcg_temp_free_i64(t0); | ||
67 | |||
68 | gen_set_label(loop); | ||
69 | |||
70 | @@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) | ||
71 | tcg_gen_st_i64(t0, cpu_env, vofs + len_align); | ||
72 | tcg_temp_free_i64(t0); | ||
42 | } | 73 | } |
43 | #endif | 74 | - tcg_temp_free_i64(clean_addr); |
44 | - return neon_reg_offset(reg, 0) + ofs; | ||
45 | + return neon_full_reg_offset(reg) + ofs; | ||
46 | } | 75 | } |
47 | 76 | ||
48 | static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) | 77 | /* Similarly for stores. */ |
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | 78 | @@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) |
50 | * We cannot write 16 bytes at once because the | 79 | |
51 | * destination is unaligned. | 80 | /* Copy the clean address into a local temp, live across the loop. */ |
52 | */ | 81 | t0 = clean_addr; |
53 | - tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0), | 82 | - clean_addr = tcg_temp_local_new_i64(); |
54 | + tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd), | 83 | + clean_addr = new_tmp_a64_local(s); |
55 | 8, 8, tmp); | 84 | tcg_gen_mov_i64(clean_addr, t0); |
56 | - tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0), | 85 | - tcg_temp_free_i64(t0); |
57 | - neon_reg_offset(vd, 0), 8, 8); | 86 | |
58 | + tcg_gen_gvec_mov(0, neon_full_reg_offset(vd + 1), | 87 | gen_set_label(loop); |
59 | + neon_full_reg_offset(vd), 8, 8); | 88 | |
60 | } else { | 89 | @@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) |
61 | - tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0), | ||
62 | + tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd), | ||
63 | vec_size, vec_size, tmp); | ||
64 | } | 90 | } |
65 | tcg_gen_addi_i32(addr, addr, 1 << size); | 91 | tcg_temp_free_i64(t0); |
66 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
67 | static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | ||
68 | { | ||
69 | int vec_size = a->q ? 16 : 8; | ||
70 | - int rd_ofs = neon_reg_offset(a->vd, 0); | ||
71 | - int rn_ofs = neon_reg_offset(a->vn, 0); | ||
72 | - int rm_ofs = neon_reg_offset(a->vm, 0); | ||
73 | + int rd_ofs = neon_full_reg_offset(a->vd); | ||
74 | + int rn_ofs = neon_full_reg_offset(a->vn); | ||
75 | + int rm_ofs = neon_full_reg_offset(a->vm); | ||
76 | |||
77 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
78 | return false; | ||
79 | @@ -XXX,XX +XXX,XX @@ static bool do_vector_2sh(DisasContext *s, arg_2reg_shift *a, GVecGen2iFn *fn) | ||
80 | { | ||
81 | /* Handle a 2-reg-shift insn which can be vectorized. */ | ||
82 | int vec_size = a->q ? 16 : 8; | ||
83 | - int rd_ofs = neon_reg_offset(a->vd, 0); | ||
84 | - int rm_ofs = neon_reg_offset(a->vm, 0); | ||
85 | + int rd_ofs = neon_full_reg_offset(a->vd); | ||
86 | + int rm_ofs = neon_full_reg_offset(a->vm); | ||
87 | |||
88 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
89 | return false; | ||
90 | @@ -XXX,XX +XXX,XX @@ static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a, | ||
91 | { | ||
92 | /* FP operations in 2-reg-and-shift group */ | ||
93 | int vec_size = a->q ? 16 : 8; | ||
94 | - int rd_ofs = neon_reg_offset(a->vd, 0); | ||
95 | - int rm_ofs = neon_reg_offset(a->vm, 0); | ||
96 | + int rd_ofs = neon_full_reg_offset(a->vd); | ||
97 | + int rm_ofs = neon_full_reg_offset(a->vm); | ||
98 | TCGv_ptr fpst; | ||
99 | |||
100 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
101 | @@ -XXX,XX +XXX,XX @@ static bool do_1reg_imm(DisasContext *s, arg_1reg_imm *a, | ||
102 | return true; | ||
103 | } | 92 | } |
104 | 93 | - tcg_temp_free_i64(clean_addr); | |
105 | - reg_ofs = neon_reg_offset(a->vd, 0); | ||
106 | + reg_ofs = neon_full_reg_offset(a->vd); | ||
107 | vec_size = a->q ? 16 : 8; | ||
108 | imm = asimd_imm_const(a->imm, a->cmode, a->op); | ||
109 | |||
110 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMULL_P_3d(DisasContext *s, arg_3diff *a) | ||
111 | return true; | ||
112 | } | ||
113 | |||
114 | - tcg_gen_gvec_3_ool(neon_reg_offset(a->vd, 0), | ||
115 | - neon_reg_offset(a->vn, 0), | ||
116 | - neon_reg_offset(a->vm, 0), | ||
117 | + tcg_gen_gvec_3_ool(neon_full_reg_offset(a->vd), | ||
118 | + neon_full_reg_offset(a->vn), | ||
119 | + neon_full_reg_offset(a->vm), | ||
120 | 16, 16, 0, fn_gvec); | ||
121 | return true; | ||
122 | } | 94 | } |
123 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar_fp_vec(DisasContext *s, arg_2scalar *a, | 95 | |
124 | { | 96 | static bool trans_LDR_zri(DisasContext *s, arg_rri *a) |
125 | /* Two registers and a scalar, using gvec */ | ||
126 | int vec_size = a->q ? 16 : 8; | ||
127 | - int rd_ofs = neon_reg_offset(a->vd, 0); | ||
128 | - int rn_ofs = neon_reg_offset(a->vn, 0); | ||
129 | + int rd_ofs = neon_full_reg_offset(a->vd); | ||
130 | + int rn_ofs = neon_full_reg_offset(a->vn); | ||
131 | int rm_ofs; | ||
132 | int idx; | ||
133 | TCGv_ptr fpstatus; | ||
134 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar_fp_vec(DisasContext *s, arg_2scalar *a, | ||
135 | /* a->vm is M:Vm, which encodes both register and index */ | ||
136 | idx = extract32(a->vm, a->size + 2, 2); | ||
137 | a->vm = extract32(a->vm, 0, a->size + 2); | ||
138 | - rm_ofs = neon_reg_offset(a->vm, 0); | ||
139 | + rm_ofs = neon_full_reg_offset(a->vm); | ||
140 | |||
141 | fpstatus = fpstatus_ptr(a->size == 1 ? FPST_STD_F16 : FPST_STD); | ||
142 | tcg_gen_gvec_3_ptr(rd_ofs, rn_ofs, rm_ofs, fpstatus, | ||
143 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) | ||
144 | return true; | ||
145 | } | ||
146 | |||
147 | - tcg_gen_gvec_dup_mem(a->size, neon_reg_offset(a->vd, 0), | ||
148 | + tcg_gen_gvec_dup_mem(a->size, neon_full_reg_offset(a->vd), | ||
149 | neon_element_offset(a->vm, a->index, a->size), | ||
150 | a->q ? 16 : 8, a->q ? 16 : 8); | ||
151 | return true; | ||
152 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) | ||
153 | static bool do_2misc_vec(DisasContext *s, arg_2misc *a, GVecGen2Fn *fn) | ||
154 | { | ||
155 | int vec_size = a->q ? 16 : 8; | ||
156 | - int rd_ofs = neon_reg_offset(a->vd, 0); | ||
157 | - int rm_ofs = neon_reg_offset(a->vm, 0); | ||
158 | + int rd_ofs = neon_full_reg_offset(a->vd); | ||
159 | + int rm_ofs = neon_full_reg_offset(a->vm); | ||
160 | |||
161 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
162 | return false; | ||
163 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/target/arm/translate-vfp.c.inc | ||
166 | +++ b/target/arm/translate-vfp.c.inc | ||
167 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDUP(DisasContext *s, arg_VDUP *a) | ||
168 | } | ||
169 | |||
170 | tmp = load_reg(s, a->rt); | ||
171 | - tcg_gen_gvec_dup_i32(size, neon_reg_offset(a->vn, 0), | ||
172 | + tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(a->vn), | ||
173 | vec_size, vec_size, tmp); | ||
174 | tcg_temp_free_i32(tmp); | ||
175 | |||
176 | -- | 97 | -- |
177 | 2.20.1 | 98 | 2.20.1 |
178 | 99 | ||
179 | 100 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In bcm2835_fb_mbox_push(), Coverity complains (CID 1429989) that we | ||
2 | pass a pointer to a local struct to another function without | ||
3 | initializing all its fields. This is a real bug: | ||
4 | bcm2835_fb_reconfigure() copies the whole of our new BCM2385FBConfig | ||
5 | struct into s->config, so any fields we don't initialize will corrupt | ||
6 | the state of the device. | ||
1 | 7 | ||
8 | Copy the two fields which we don't want to update (pixo and alpha) | ||
9 | from the existing config so we don't accidentally change them. | ||
10 | |||
11 | Fixes: cfb7ba983857e40e88 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20200628195436.27582-1-peter.maydell@linaro.org | ||
15 | --- | ||
16 | hw/display/bcm2835_fb.c | 4 ++++ | ||
17 | 1 file changed, 4 insertions(+) | ||
18 | |||
19 | diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/display/bcm2835_fb.c | ||
22 | +++ b/hw/display/bcm2835_fb.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value) | ||
24 | newconf.base = s->vcram_base | (value & 0xc0000000); | ||
25 | newconf.base += BCM2835_FB_OFFSET; | ||
26 | |||
27 | + /* Copy fields which we don't want to change from the existing config */ | ||
28 | + newconf.pixo = s->config.pixo; | ||
29 | + newconf.alpha = s->config.alpha; | ||
30 | + | ||
31 | bcm2835_fb_validate_config(&newconf); | ||
32 | |||
33 | pitch = bcm2835_fb_get_pitch(&newconf); | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The spitz board has been around a long time, and still has a fair number |
---|---|---|---|
2 | 2 | of hard-coded tab characters in it. We're about to do some work on | |
3 | We can then use this to improve VMOV (scalar to gp) and | 3 | this source file, so start out by expanding out the tabs. |
4 | VMOV (gp to scalar) so that we simply perform the memory | 4 | |
5 | operation that we wanted, rather than inserting or | 5 | This commit is a pure whitespace only change. |
6 | extracting from a 32-bit quantity. | 6 | |
7 | |||
8 | These were the last uses of neon_load/store_reg, so remove them. | ||
9 | |||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20201030022618.785675-7-richard.henderson@linaro.org | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-id: 20200628142429.17111-2-peter.maydell@linaro.org | ||
14 | --- | 11 | --- |
15 | target/arm/translate.c | 50 +++++++++++++----------- | 12 | hw/arm/spitz.c | 156 ++++++++++++++++++++++++------------------------- |
16 | target/arm/translate-vfp.c.inc | 71 +++++----------------------------- | 13 | 1 file changed, 78 insertions(+), 78 deletions(-) |
17 | 2 files changed, 37 insertions(+), 84 deletions(-) | 14 | |
18 | 15 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | |
19 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/translate.c | 17 | --- a/hw/arm/spitz.c |
22 | +++ b/target/arm/translate.c | 18 | +++ b/hw/arm/spitz.c |
23 | @@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg) | 19 | @@ -XXX,XX +XXX,XX @@ |
24 | * Return the offset of a 2**SIZE piece of a NEON register, at index ELE, | 20 | #include "cpu.h" |
25 | * where 0 is the least significant end of the register. | 21 | |
26 | */ | 22 | #undef REG_FMT |
27 | -static long neon_element_offset(int reg, int element, MemOp size) | 23 | -#define REG_FMT "0x%02lx" |
28 | +static long neon_element_offset(int reg, int element, MemOp memop) | 24 | +#define REG_FMT "0x%02lx" |
25 | |||
26 | /* Spitz Flash */ | ||
27 | -#define FLASH_BASE 0x0c000000 | ||
28 | -#define FLASH_ECCLPLB 0x00 /* Line parity 7 - 0 bit */ | ||
29 | -#define FLASH_ECCLPUB 0x04 /* Line parity 15 - 8 bit */ | ||
30 | -#define FLASH_ECCCP 0x08 /* Column parity 5 - 0 bit */ | ||
31 | -#define FLASH_ECCCNTR 0x0c /* ECC byte counter */ | ||
32 | -#define FLASH_ECCCLRR 0x10 /* Clear ECC */ | ||
33 | -#define FLASH_FLASHIO 0x14 /* Flash I/O */ | ||
34 | -#define FLASH_FLASHCTL 0x18 /* Flash Control */ | ||
35 | +#define FLASH_BASE 0x0c000000 | ||
36 | +#define FLASH_ECCLPLB 0x00 /* Line parity 7 - 0 bit */ | ||
37 | +#define FLASH_ECCLPUB 0x04 /* Line parity 15 - 8 bit */ | ||
38 | +#define FLASH_ECCCP 0x08 /* Column parity 5 - 0 bit */ | ||
39 | +#define FLASH_ECCCNTR 0x0c /* ECC byte counter */ | ||
40 | +#define FLASH_ECCCLRR 0x10 /* Clear ECC */ | ||
41 | +#define FLASH_FLASHIO 0x14 /* Flash I/O */ | ||
42 | +#define FLASH_FLASHCTL 0x18 /* Flash Control */ | ||
43 | |||
44 | -#define FLASHCTL_CE0 (1 << 0) | ||
45 | -#define FLASHCTL_CLE (1 << 1) | ||
46 | -#define FLASHCTL_ALE (1 << 2) | ||
47 | -#define FLASHCTL_WP (1 << 3) | ||
48 | -#define FLASHCTL_CE1 (1 << 4) | ||
49 | -#define FLASHCTL_RYBY (1 << 5) | ||
50 | -#define FLASHCTL_NCE (FLASHCTL_CE0 | FLASHCTL_CE1) | ||
51 | +#define FLASHCTL_CE0 (1 << 0) | ||
52 | +#define FLASHCTL_CLE (1 << 1) | ||
53 | +#define FLASHCTL_ALE (1 << 2) | ||
54 | +#define FLASHCTL_WP (1 << 3) | ||
55 | +#define FLASHCTL_CE1 (1 << 4) | ||
56 | +#define FLASHCTL_RYBY (1 << 5) | ||
57 | +#define FLASHCTL_NCE (FLASHCTL_CE0 | FLASHCTL_CE1) | ||
58 | |||
59 | #define TYPE_SL_NAND "sl-nand" | ||
60 | #define SL_NAND(obj) OBJECT_CHECK(SLNANDState, (obj), TYPE_SL_NAND) | ||
61 | @@ -XXX,XX +XXX,XX @@ static uint64_t sl_read(void *opaque, hwaddr addr, unsigned size) | ||
62 | int ryby; | ||
63 | |||
64 | switch (addr) { | ||
65 | -#define BSHR(byte, from, to) ((s->ecc.lp[byte] >> (from - to)) & (1 << to)) | ||
66 | +#define BSHR(byte, from, to) ((s->ecc.lp[byte] >> (from - to)) & (1 << to)) | ||
67 | case FLASH_ECCLPLB: | ||
68 | return BSHR(0, 4, 0) | BSHR(0, 5, 2) | BSHR(0, 6, 4) | BSHR(0, 7, 6) | | ||
69 | BSHR(1, 4, 1) | BSHR(1, 5, 3) | BSHR(1, 6, 5) | BSHR(1, 7, 7); | ||
70 | |||
71 | -#define BSHL(byte, from, to) ((s->ecc.lp[byte] << (to - from)) & (1 << to)) | ||
72 | +#define BSHL(byte, from, to) ((s->ecc.lp[byte] << (to - from)) & (1 << to)) | ||
73 | case FLASH_ECCLPUB: | ||
74 | return BSHL(0, 0, 0) | BSHL(0, 1, 2) | BSHL(0, 2, 4) | BSHL(0, 3, 6) | | ||
75 | BSHL(1, 0, 1) | BSHL(1, 1, 3) | BSHL(1, 2, 5) | BSHL(1, 3, 7); | ||
76 | @@ -XXX,XX +XXX,XX @@ static void sl_nand_realize(DeviceState *dev, Error **errp) | ||
77 | |||
78 | /* Spitz Keyboard */ | ||
79 | |||
80 | -#define SPITZ_KEY_STROBE_NUM 11 | ||
81 | -#define SPITZ_KEY_SENSE_NUM 7 | ||
82 | +#define SPITZ_KEY_STROBE_NUM 11 | ||
83 | +#define SPITZ_KEY_SENSE_NUM 7 | ||
84 | |||
85 | static const int spitz_gpio_key_sense[SPITZ_KEY_SENSE_NUM] = { | ||
86 | 12, 17, 91, 34, 36, 38, 39 | ||
87 | @@ -XXX,XX +XXX,XX @@ static int spitz_keymap[SPITZ_KEY_SENSE_NUM + 1][SPITZ_KEY_STROBE_NUM] = { | ||
88 | { 0x52, 0x43, 0x01, 0x47, 0x49, -1 , -1 , -1 , -1 , -1 , -1 }, | ||
89 | }; | ||
90 | |||
91 | -#define SPITZ_GPIO_AK_INT 13 /* Remote control */ | ||
92 | -#define SPITZ_GPIO_SYNC 16 /* Sync button */ | ||
93 | -#define SPITZ_GPIO_ON_KEY 95 /* Power button */ | ||
94 | -#define SPITZ_GPIO_SWA 97 /* Lid */ | ||
95 | -#define SPITZ_GPIO_SWB 96 /* Tablet mode */ | ||
96 | +#define SPITZ_GPIO_AK_INT 13 /* Remote control */ | ||
97 | +#define SPITZ_GPIO_SYNC 16 /* Sync button */ | ||
98 | +#define SPITZ_GPIO_ON_KEY 95 /* Power button */ | ||
99 | +#define SPITZ_GPIO_SWA 97 /* Lid */ | ||
100 | +#define SPITZ_GPIO_SWB 96 /* Tablet mode */ | ||
101 | |||
102 | /* The special buttons are mapped to unused keys */ | ||
103 | static const int spitz_gpiomap[5] = { | ||
104 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_keydown(SpitzKeyboardState *s, int keycode) | ||
105 | #define SPITZ_MOD_CTRL (1 << 8) | ||
106 | #define SPITZ_MOD_FN (1 << 9) | ||
107 | |||
108 | -#define QUEUE_KEY(c) s->fifo[(s->fifopos + s->fifolen ++) & 0xf] = c | ||
109 | +#define QUEUE_KEY(c) s->fifo[(s->fifopos + s->fifolen ++) & 0xf] = c | ||
110 | |||
111 | static void spitz_keyboard_handler(void *opaque, int keycode) | ||
29 | { | 112 | { |
30 | - int element_size = 1 << size; | 113 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_handler(void *opaque, int keycode) |
31 | + int element_size = 1 << (memop & MO_SIZE); | 114 | uint16_t code; |
32 | int ofs = element * element_size; | 115 | int mapcode; |
33 | #ifdef HOST_WORDS_BIGENDIAN | 116 | switch (keycode) { |
34 | /* | 117 | - case 0x2a: /* Left Shift */ |
35 | @@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg) | 118 | + case 0x2a: /* Left Shift */ |
119 | s->modifiers |= 1; | ||
120 | break; | ||
121 | case 0xaa: | ||
122 | s->modifiers &= ~1; | ||
123 | break; | ||
124 | - case 0x36: /* Right Shift */ | ||
125 | + case 0x36: /* Right Shift */ | ||
126 | s->modifiers |= 2; | ||
127 | break; | ||
128 | case 0xb6: | ||
129 | s->modifiers &= ~2; | ||
130 | break; | ||
131 | - case 0x1d: /* Control */ | ||
132 | + case 0x1d: /* Control */ | ||
133 | s->modifiers |= 4; | ||
134 | break; | ||
135 | case 0x9d: | ||
136 | s->modifiers &= ~4; | ||
137 | break; | ||
138 | - case 0x38: /* Alt */ | ||
139 | + case 0x38: /* Alt */ | ||
140 | s->modifiers |= 8; | ||
141 | break; | ||
142 | case 0xb8: | ||
143 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_realize(DeviceState *dev, Error **errp) | ||
144 | |||
145 | /* LCD backlight controller */ | ||
146 | |||
147 | -#define LCDTG_RESCTL 0x00 | ||
148 | -#define LCDTG_PHACTRL 0x01 | ||
149 | -#define LCDTG_DUTYCTRL 0x02 | ||
150 | -#define LCDTG_POWERREG0 0x03 | ||
151 | -#define LCDTG_POWERREG1 0x04 | ||
152 | -#define LCDTG_GPOR3 0x05 | ||
153 | -#define LCDTG_PICTRL 0x06 | ||
154 | -#define LCDTG_POLCTRL 0x07 | ||
155 | +#define LCDTG_RESCTL 0x00 | ||
156 | +#define LCDTG_PHACTRL 0x01 | ||
157 | +#define LCDTG_DUTYCTRL 0x02 | ||
158 | +#define LCDTG_POWERREG0 0x03 | ||
159 | +#define LCDTG_POWERREG1 0x04 | ||
160 | +#define LCDTG_GPOR3 0x05 | ||
161 | +#define LCDTG_PICTRL 0x06 | ||
162 | +#define LCDTG_POLCTRL 0x07 | ||
163 | |||
164 | typedef struct { | ||
165 | SSISlave ssidev; | ||
166 | @@ -XXX,XX +XXX,XX @@ static void spitz_lcdtg_realize(SSISlave *dev, Error **errp) | ||
167 | |||
168 | /* SSP devices */ | ||
169 | |||
170 | -#define CORGI_SSP_PORT 2 | ||
171 | +#define CORGI_SSP_PORT 2 | ||
172 | |||
173 | -#define SPITZ_GPIO_LCDCON_CS 53 | ||
174 | -#define SPITZ_GPIO_ADS7846_CS 14 | ||
175 | -#define SPITZ_GPIO_MAX1111_CS 20 | ||
176 | -#define SPITZ_GPIO_TP_INT 11 | ||
177 | +#define SPITZ_GPIO_LCDCON_CS 53 | ||
178 | +#define SPITZ_GPIO_ADS7846_CS 14 | ||
179 | +#define SPITZ_GPIO_MAX1111_CS 20 | ||
180 | +#define SPITZ_GPIO_TP_INT 11 | ||
181 | |||
182 | static DeviceState *max1111; | ||
183 | |||
184 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_gpio_cs(void *opaque, int line, int level) | ||
185 | s->enable[line] = !level; | ||
186 | } | ||
187 | |||
188 | -#define MAX1111_BATT_VOLT 1 | ||
189 | -#define MAX1111_BATT_TEMP 2 | ||
190 | -#define MAX1111_ACIN_VOLT 3 | ||
191 | +#define MAX1111_BATT_VOLT 1 | ||
192 | +#define MAX1111_BATT_TEMP 2 | ||
193 | +#define MAX1111_ACIN_VOLT 3 | ||
194 | |||
195 | -#define SPITZ_BATTERY_TEMP 0xe0 /* About 2.9V */ | ||
196 | -#define SPITZ_BATTERY_VOLT 0xd0 /* About 4.0V */ | ||
197 | -#define SPITZ_CHARGEON_ACIN 0x80 /* About 5.0V */ | ||
198 | +#define SPITZ_BATTERY_TEMP 0xe0 /* About 2.9V */ | ||
199 | +#define SPITZ_BATTERY_VOLT 0xd0 /* About 4.0V */ | ||
200 | +#define SPITZ_CHARGEON_ACIN 0x80 /* About 5.0V */ | ||
201 | |||
202 | static void spitz_adc_temp_on(void *opaque, int line, int level) | ||
203 | { | ||
204 | @@ -XXX,XX +XXX,XX @@ static void spitz_microdrive_attach(PXA2xxState *cpu, int slot) | ||
205 | |||
206 | /* Wm8750 and Max7310 on I2C */ | ||
207 | |||
208 | -#define AKITA_MAX_ADDR 0x18 | ||
209 | -#define SPITZ_WM_ADDRL 0x1b | ||
210 | -#define SPITZ_WM_ADDRH 0x1a | ||
211 | +#define AKITA_MAX_ADDR 0x18 | ||
212 | +#define SPITZ_WM_ADDRL 0x1b | ||
213 | +#define SPITZ_WM_ADDRH 0x1a | ||
214 | |||
215 | -#define SPITZ_GPIO_WM 5 | ||
216 | +#define SPITZ_GPIO_WM 5 | ||
217 | |||
218 | static void spitz_wm8750_addr(void *opaque, int line, int level) | ||
219 | { | ||
220 | @@ -XXX,XX +XXX,XX @@ static void spitz_out_switch(void *opaque, int line, int level) | ||
36 | } | 221 | } |
37 | } | 222 | } |
38 | 223 | ||
39 | -static TCGv_i32 neon_load_reg(int reg, int pass) | 224 | -#define SPITZ_SCP_LED_GREEN 1 |
40 | -{ | 225 | -#define SPITZ_SCP_JK_B 2 |
41 | - TCGv_i32 tmp = tcg_temp_new_i32(); | 226 | -#define SPITZ_SCP_CHRG_ON 3 |
42 | - tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32)); | 227 | -#define SPITZ_SCP_MUTE_L 4 |
43 | - return tmp; | 228 | -#define SPITZ_SCP_MUTE_R 5 |
44 | -} | 229 | -#define SPITZ_SCP_CF_POWER 6 |
45 | - | 230 | -#define SPITZ_SCP_LED_ORANGE 7 |
46 | -static void neon_store_reg(int reg, int pass, TCGv_i32 var) | 231 | -#define SPITZ_SCP_JK_A 8 |
47 | -{ | 232 | -#define SPITZ_SCP_ADC_TEMP_ON 9 |
48 | - tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32)); | 233 | -#define SPITZ_SCP2_IR_ON 1 |
49 | - tcg_temp_free_i32(var); | 234 | -#define SPITZ_SCP2_AKIN_PULLUP 2 |
50 | -} | 235 | -#define SPITZ_SCP2_BACKLIGHT_CONT 7 |
51 | - | 236 | -#define SPITZ_SCP2_BACKLIGHT_ON 8 |
52 | static inline void neon_load_reg64(TCGv_i64 var, int reg) | 237 | -#define SPITZ_SCP2_MIC_BIAS 9 |
53 | { | 238 | +#define SPITZ_SCP_LED_GREEN 1 |
54 | tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg)); | 239 | +#define SPITZ_SCP_JK_B 2 |
55 | @@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg) | 240 | +#define SPITZ_SCP_CHRG_ON 3 |
56 | tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 241 | +#define SPITZ_SCP_MUTE_L 4 |
242 | +#define SPITZ_SCP_MUTE_R 5 | ||
243 | +#define SPITZ_SCP_CF_POWER 6 | ||
244 | +#define SPITZ_SCP_LED_ORANGE 7 | ||
245 | +#define SPITZ_SCP_JK_A 8 | ||
246 | +#define SPITZ_SCP_ADC_TEMP_ON 9 | ||
247 | +#define SPITZ_SCP2_IR_ON 1 | ||
248 | +#define SPITZ_SCP2_AKIN_PULLUP 2 | ||
249 | +#define SPITZ_SCP2_BACKLIGHT_CONT 7 | ||
250 | +#define SPITZ_SCP2_BACKLIGHT_ON 8 | ||
251 | +#define SPITZ_SCP2_MIC_BIAS 9 | ||
252 | |||
253 | static void spitz_scoop_gpio_setup(PXA2xxState *cpu, | ||
254 | DeviceState *scp0, DeviceState *scp1) | ||
255 | @@ -XXX,XX +XXX,XX @@ static void spitz_scoop_gpio_setup(PXA2xxState *cpu, | ||
256 | qdev_connect_gpio_out(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); | ||
57 | } | 257 | } |
58 | 258 | ||
59 | -static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size) | 259 | -#define SPITZ_GPIO_HSYNC 22 |
60 | +static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | 260 | -#define SPITZ_GPIO_SD_DETECT 9 |
61 | { | 261 | -#define SPITZ_GPIO_SD_WP 81 |
62 | - long off = neon_element_offset(reg, ele, size); | 262 | -#define SPITZ_GPIO_ON_RESET 89 |
63 | + long off = neon_element_offset(reg, ele, memop); | 263 | -#define SPITZ_GPIO_BAT_COVER 90 |
64 | 264 | -#define SPITZ_GPIO_CF1_IRQ 105 | |
65 | - switch (size) { | 265 | -#define SPITZ_GPIO_CF1_CD 94 |
66 | - case MO_32: | 266 | -#define SPITZ_GPIO_CF2_IRQ 106 |
67 | + switch (memop) { | 267 | -#define SPITZ_GPIO_CF2_CD 93 |
68 | + case MO_SB: | 268 | +#define SPITZ_GPIO_HSYNC 22 |
69 | + tcg_gen_ld8s_i32(dest, cpu_env, off); | 269 | +#define SPITZ_GPIO_SD_DETECT 9 |
70 | + break; | 270 | +#define SPITZ_GPIO_SD_WP 81 |
71 | + case MO_UB: | 271 | +#define SPITZ_GPIO_ON_RESET 89 |
72 | + tcg_gen_ld8u_i32(dest, cpu_env, off); | 272 | +#define SPITZ_GPIO_BAT_COVER 90 |
73 | + break; | 273 | +#define SPITZ_GPIO_CF1_IRQ 105 |
74 | + case MO_SW: | 274 | +#define SPITZ_GPIO_CF1_CD 94 |
75 | + tcg_gen_ld16s_i32(dest, cpu_env, off); | 275 | +#define SPITZ_GPIO_CF2_IRQ 106 |
76 | + break; | 276 | +#define SPITZ_GPIO_CF2_CD 93 |
77 | + case MO_UW: | 277 | |
78 | + tcg_gen_ld16u_i32(dest, cpu_env, off); | 278 | static int spitz_hsync; |
79 | + break; | 279 | |
80 | + case MO_UL: | 280 | @@ -XXX,XX +XXX,XX @@ static void spitz_gpio_setup(PXA2xxState *cpu, int slots) |
81 | + case MO_SL: | 281 | /* Board init. */ |
82 | tcg_gen_ld_i32(dest, cpu_env, off); | 282 | enum spitz_model_e { spitz, akita, borzoi, terrier }; |
83 | break; | 283 | |
84 | default: | 284 | -#define SPITZ_RAM 0x04000000 |
85 | @@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size) | 285 | -#define SPITZ_ROM 0x00800000 |
86 | } | 286 | +#define SPITZ_RAM 0x04000000 |
87 | } | 287 | +#define SPITZ_ROM 0x00800000 |
88 | 288 | ||
89 | -static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size) | 289 | static struct arm_boot_info spitz_binfo = { |
90 | +static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | 290 | .loader_start = PXA2XX_SDRAM_BASE, |
91 | { | ||
92 | - long off = neon_element_offset(reg, ele, size); | ||
93 | + long off = neon_element_offset(reg, ele, memop); | ||
94 | |||
95 | - switch (size) { | ||
96 | + switch (memop) { | ||
97 | + case MO_8: | ||
98 | + tcg_gen_st8_i32(src, cpu_env, off); | ||
99 | + break; | ||
100 | + case MO_16: | ||
101 | + tcg_gen_st16_i32(src, cpu_env, off); | ||
102 | + break; | ||
103 | case MO_32: | ||
104 | tcg_gen_st_i32(src, cpu_env, off); | ||
105 | break; | ||
106 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/target/arm/translate-vfp.c.inc | ||
109 | +++ b/target/arm/translate-vfp.c.inc | ||
110 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) | ||
111 | { | ||
112 | /* VMOV scalar to general purpose register */ | ||
113 | TCGv_i32 tmp; | ||
114 | - int pass; | ||
115 | - uint32_t offset; | ||
116 | |||
117 | - /* SIZE == 2 is a VFP instruction; otherwise NEON. */ | ||
118 | - if (a->size == 2 | ||
119 | + /* SIZE == MO_32 is a VFP instruction; otherwise NEON. */ | ||
120 | + if (a->size == MO_32 | ||
121 | ? !dc_isar_feature(aa32_fpsp_v2, s) | ||
122 | : !arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
123 | return false; | ||
124 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) | ||
125 | return false; | ||
126 | } | ||
127 | |||
128 | - offset = a->index << a->size; | ||
129 | - pass = extract32(offset, 2, 1); | ||
130 | - offset = extract32(offset, 0, 2) * 8; | ||
131 | - | ||
132 | if (!vfp_access_check(s)) { | ||
133 | return true; | ||
134 | } | ||
135 | |||
136 | - tmp = neon_load_reg(a->vn, pass); | ||
137 | - switch (a->size) { | ||
138 | - case 0: | ||
139 | - if (offset) { | ||
140 | - tcg_gen_shri_i32(tmp, tmp, offset); | ||
141 | - } | ||
142 | - if (a->u) { | ||
143 | - gen_uxtb(tmp); | ||
144 | - } else { | ||
145 | - gen_sxtb(tmp); | ||
146 | - } | ||
147 | - break; | ||
148 | - case 1: | ||
149 | - if (a->u) { | ||
150 | - if (offset) { | ||
151 | - tcg_gen_shri_i32(tmp, tmp, 16); | ||
152 | - } else { | ||
153 | - gen_uxth(tmp); | ||
154 | - } | ||
155 | - } else { | ||
156 | - if (offset) { | ||
157 | - tcg_gen_sari_i32(tmp, tmp, 16); | ||
158 | - } else { | ||
159 | - gen_sxth(tmp); | ||
160 | - } | ||
161 | - } | ||
162 | - break; | ||
163 | - case 2: | ||
164 | - break; | ||
165 | - } | ||
166 | + tmp = tcg_temp_new_i32(); | ||
167 | + read_neon_element32(tmp, a->vn, a->index, a->size | (a->u ? 0 : MO_SIGN)); | ||
168 | store_reg(s, a->rt, tmp); | ||
169 | |||
170 | return true; | ||
171 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) | ||
172 | static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a) | ||
173 | { | ||
174 | /* VMOV general purpose register to scalar */ | ||
175 | - TCGv_i32 tmp, tmp2; | ||
176 | - int pass; | ||
177 | - uint32_t offset; | ||
178 | + TCGv_i32 tmp; | ||
179 | |||
180 | - /* SIZE == 2 is a VFP instruction; otherwise NEON. */ | ||
181 | - if (a->size == 2 | ||
182 | + /* SIZE == MO_32 is a VFP instruction; otherwise NEON. */ | ||
183 | + if (a->size == MO_32 | ||
184 | ? !dc_isar_feature(aa32_fpsp_v2, s) | ||
185 | : !arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
186 | return false; | ||
187 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a) | ||
188 | return false; | ||
189 | } | ||
190 | |||
191 | - offset = a->index << a->size; | ||
192 | - pass = extract32(offset, 2, 1); | ||
193 | - offset = extract32(offset, 0, 2) * 8; | ||
194 | - | ||
195 | if (!vfp_access_check(s)) { | ||
196 | return true; | ||
197 | } | ||
198 | |||
199 | tmp = load_reg(s, a->rt); | ||
200 | - switch (a->size) { | ||
201 | - case 0: | ||
202 | - tmp2 = neon_load_reg(a->vn, pass); | ||
203 | - tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 8); | ||
204 | - tcg_temp_free_i32(tmp2); | ||
205 | - break; | ||
206 | - case 1: | ||
207 | - tmp2 = neon_load_reg(a->vn, pass); | ||
208 | - tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 16); | ||
209 | - tcg_temp_free_i32(tmp2); | ||
210 | - break; | ||
211 | - case 2: | ||
212 | - break; | ||
213 | - } | ||
214 | - neon_store_reg(a->vn, pass, tmp); | ||
215 | + write_neon_element32(tmp, a->vn, a->index, a->size); | ||
216 | + tcg_temp_free_i32(tmp); | ||
217 | |||
218 | return true; | ||
219 | } | ||
220 | -- | 291 | -- |
221 | 2.20.1 | 292 | 2.20.1 |
222 | 293 | ||
223 | 294 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | For the four Spitz-family machines (akita, borzoi, spitz, terrier) | |
2 | create a proper abstract class SpitzMachineClass which encapsulates | ||
3 | the common behaviour, rather than having them all derive directly | ||
4 | from TYPE_MACHINE: | ||
5 | * instead of each machine class setting mc->init to a wrapper | ||
6 | function which calls spitz_common_init() with parameters, | ||
7 | put that data in the SpitzMachineClass and make spitz_common_init | ||
8 | the SpitzMachineClass machine-init function | ||
9 | * move the settings of mc->block_default_type and | ||
10 | mc->ignore_memory_transaction_failures into the SpitzMachineClass | ||
11 | class init rather than repeating them in each machine's class init | ||
12 | |||
13 | (The motivation is that we're going to want to keep some state in | ||
14 | the SpitzMachineState so we can connect GPIOs between devices created | ||
15 | in one sub-function of the machine init to devices created in a | ||
16 | different sub-function.) | ||
17 | |||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
20 | Message-id: 20200628142429.17111-3-peter.maydell@linaro.org | ||
21 | --- | ||
22 | hw/arm/spitz.c | 91 ++++++++++++++++++++++++++++++-------------------- | ||
23 | 1 file changed, 55 insertions(+), 36 deletions(-) | ||
24 | |||
25 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/spitz.c | ||
28 | +++ b/hw/arm/spitz.c | ||
29 | @@ -XXX,XX +XXX,XX @@ | ||
30 | #include "exec/address-spaces.h" | ||
31 | #include "cpu.h" | ||
32 | |||
33 | +enum spitz_model_e { spitz, akita, borzoi, terrier }; | ||
34 | + | ||
35 | +typedef struct { | ||
36 | + MachineClass parent; | ||
37 | + enum spitz_model_e model; | ||
38 | + int arm_id; | ||
39 | +} SpitzMachineClass; | ||
40 | + | ||
41 | +typedef struct { | ||
42 | + MachineState parent; | ||
43 | +} SpitzMachineState; | ||
44 | + | ||
45 | +#define TYPE_SPITZ_MACHINE "spitz-common" | ||
46 | +#define SPITZ_MACHINE(obj) \ | ||
47 | + OBJECT_CHECK(SpitzMachineState, obj, TYPE_SPITZ_MACHINE) | ||
48 | +#define SPITZ_MACHINE_GET_CLASS(obj) \ | ||
49 | + OBJECT_GET_CLASS(SpitzMachineClass, obj, TYPE_SPITZ_MACHINE) | ||
50 | +#define SPITZ_MACHINE_CLASS(klass) \ | ||
51 | + OBJECT_CLASS_CHECK(SpitzMachineClass, klass, TYPE_SPITZ_MACHINE) | ||
52 | + | ||
53 | #undef REG_FMT | ||
54 | #define REG_FMT "0x%02lx" | ||
55 | |||
56 | @@ -XXX,XX +XXX,XX @@ static void spitz_gpio_setup(PXA2xxState *cpu, int slots) | ||
57 | } | ||
58 | |||
59 | /* Board init. */ | ||
60 | -enum spitz_model_e { spitz, akita, borzoi, terrier }; | ||
61 | - | ||
62 | #define SPITZ_RAM 0x04000000 | ||
63 | #define SPITZ_ROM 0x00800000 | ||
64 | |||
65 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info spitz_binfo = { | ||
66 | .ram_size = 0x04000000, | ||
67 | }; | ||
68 | |||
69 | -static void spitz_common_init(MachineState *machine, | ||
70 | - enum spitz_model_e model, int arm_id) | ||
71 | +static void spitz_common_init(MachineState *machine) | ||
72 | { | ||
73 | + SpitzMachineClass *smc = SPITZ_MACHINE_GET_CLASS(machine); | ||
74 | + enum spitz_model_e model = smc->model; | ||
75 | PXA2xxState *mpu; | ||
76 | DeviceState *scp0, *scp1 = NULL; | ||
77 | MemoryRegion *address_space_mem = get_system_memory(); | ||
78 | @@ -XXX,XX +XXX,XX @@ static void spitz_common_init(MachineState *machine, | ||
79 | /* A 4.0 GB microdrive is permanently sitting in CF slot 0. */ | ||
80 | spitz_microdrive_attach(mpu, 0); | ||
81 | |||
82 | - spitz_binfo.board_id = arm_id; | ||
83 | + spitz_binfo.board_id = smc->arm_id; | ||
84 | arm_load_kernel(mpu->cpu, machine, &spitz_binfo); | ||
85 | sl_bootparam_write(SL_PXA_PARAM_BASE); | ||
86 | } | ||
87 | |||
88 | -static void spitz_init(MachineState *machine) | ||
89 | +static void spitz_common_class_init(ObjectClass *oc, void *data) | ||
90 | { | ||
91 | - spitz_common_init(machine, spitz, 0x2c9); | ||
92 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
93 | + | ||
94 | + mc->block_default_type = IF_IDE; | ||
95 | + mc->ignore_memory_transaction_failures = true; | ||
96 | + mc->init = spitz_common_init; | ||
97 | } | ||
98 | |||
99 | -static void borzoi_init(MachineState *machine) | ||
100 | -{ | ||
101 | - spitz_common_init(machine, borzoi, 0x33f); | ||
102 | -} | ||
103 | - | ||
104 | -static void akita_init(MachineState *machine) | ||
105 | -{ | ||
106 | - spitz_common_init(machine, akita, 0x2e8); | ||
107 | -} | ||
108 | - | ||
109 | -static void terrier_init(MachineState *machine) | ||
110 | -{ | ||
111 | - spitz_common_init(machine, terrier, 0x33f); | ||
112 | -} | ||
113 | +static const TypeInfo spitz_common_info = { | ||
114 | + .name = TYPE_SPITZ_MACHINE, | ||
115 | + .parent = TYPE_MACHINE, | ||
116 | + .abstract = true, | ||
117 | + .instance_size = sizeof(SpitzMachineState), | ||
118 | + .class_size = sizeof(SpitzMachineClass), | ||
119 | + .class_init = spitz_common_class_init, | ||
120 | +}; | ||
121 | |||
122 | static void akitapda_class_init(ObjectClass *oc, void *data) | ||
123 | { | ||
124 | MachineClass *mc = MACHINE_CLASS(oc); | ||
125 | + SpitzMachineClass *smc = SPITZ_MACHINE_CLASS(oc); | ||
126 | |||
127 | mc->desc = "Sharp SL-C1000 (Akita) PDA (PXA270)"; | ||
128 | - mc->init = akita_init; | ||
129 | - mc->ignore_memory_transaction_failures = true; | ||
130 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c0"); | ||
131 | + smc->model = akita; | ||
132 | + smc->arm_id = 0x2e8; | ||
133 | } | ||
134 | |||
135 | static const TypeInfo akitapda_type = { | ||
136 | .name = MACHINE_TYPE_NAME("akita"), | ||
137 | - .parent = TYPE_MACHINE, | ||
138 | + .parent = TYPE_SPITZ_MACHINE, | ||
139 | .class_init = akitapda_class_init, | ||
140 | }; | ||
141 | |||
142 | static void spitzpda_class_init(ObjectClass *oc, void *data) | ||
143 | { | ||
144 | MachineClass *mc = MACHINE_CLASS(oc); | ||
145 | + SpitzMachineClass *smc = SPITZ_MACHINE_CLASS(oc); | ||
146 | |||
147 | mc->desc = "Sharp SL-C3000 (Spitz) PDA (PXA270)"; | ||
148 | - mc->init = spitz_init; | ||
149 | - mc->block_default_type = IF_IDE; | ||
150 | - mc->ignore_memory_transaction_failures = true; | ||
151 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c0"); | ||
152 | + smc->model = spitz; | ||
153 | + smc->arm_id = 0x2c9; | ||
154 | } | ||
155 | |||
156 | static const TypeInfo spitzpda_type = { | ||
157 | .name = MACHINE_TYPE_NAME("spitz"), | ||
158 | - .parent = TYPE_MACHINE, | ||
159 | + .parent = TYPE_SPITZ_MACHINE, | ||
160 | .class_init = spitzpda_class_init, | ||
161 | }; | ||
162 | |||
163 | static void borzoipda_class_init(ObjectClass *oc, void *data) | ||
164 | { | ||
165 | MachineClass *mc = MACHINE_CLASS(oc); | ||
166 | + SpitzMachineClass *smc = SPITZ_MACHINE_CLASS(oc); | ||
167 | |||
168 | mc->desc = "Sharp SL-C3100 (Borzoi) PDA (PXA270)"; | ||
169 | - mc->init = borzoi_init; | ||
170 | - mc->block_default_type = IF_IDE; | ||
171 | - mc->ignore_memory_transaction_failures = true; | ||
172 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c0"); | ||
173 | + smc->model = borzoi; | ||
174 | + smc->arm_id = 0x33f; | ||
175 | } | ||
176 | |||
177 | static const TypeInfo borzoipda_type = { | ||
178 | .name = MACHINE_TYPE_NAME("borzoi"), | ||
179 | - .parent = TYPE_MACHINE, | ||
180 | + .parent = TYPE_SPITZ_MACHINE, | ||
181 | .class_init = borzoipda_class_init, | ||
182 | }; | ||
183 | |||
184 | static void terrierpda_class_init(ObjectClass *oc, void *data) | ||
185 | { | ||
186 | MachineClass *mc = MACHINE_CLASS(oc); | ||
187 | + SpitzMachineClass *smc = SPITZ_MACHINE_CLASS(oc); | ||
188 | |||
189 | mc->desc = "Sharp SL-C3200 (Terrier) PDA (PXA270)"; | ||
190 | - mc->init = terrier_init; | ||
191 | - mc->block_default_type = IF_IDE; | ||
192 | - mc->ignore_memory_transaction_failures = true; | ||
193 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c5"); | ||
194 | + smc->model = terrier; | ||
195 | + smc->arm_id = 0x33f; | ||
196 | } | ||
197 | |||
198 | static const TypeInfo terrierpda_type = { | ||
199 | .name = MACHINE_TYPE_NAME("terrier"), | ||
200 | - .parent = TYPE_MACHINE, | ||
201 | + .parent = TYPE_SPITZ_MACHINE, | ||
202 | .class_init = terrierpda_class_init, | ||
203 | }; | ||
204 | |||
205 | static void spitz_machine_init(void) | ||
206 | { | ||
207 | + type_register_static(&spitz_common_info); | ||
208 | type_register_static(&akitapda_type); | ||
209 | type_register_static(&spitzpda_type); | ||
210 | type_register_static(&borzoipda_type); | ||
211 | -- | ||
212 | 2.20.1 | ||
213 | |||
214 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Keep pointers to the MPU and the SSI devices in SpitzMachineState. | ||
2 | We're going to want to make GPIO connections between some of the | ||
3 | SSI devices and the SCPs, so we want to keep hold of a pointer to | ||
4 | those; putting the MPU into the struct allows us to pass just | ||
5 | one thing to spitz_ssp_attach() rather than two. | ||
1 | 6 | ||
7 | We have to retain the setting of the global "max1111" variable | ||
8 | for the moment as it is used in spitz_adc_temp_on(); later in | ||
9 | this series of commits we will be able to remove it. | ||
10 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-id: 20200628142429.17111-4-peter.maydell@linaro.org | ||
14 | --- | ||
15 | hw/arm/spitz.c | 50 ++++++++++++++++++++++++++++---------------------- | ||
16 | 1 file changed, 28 insertions(+), 22 deletions(-) | ||
17 | |||
18 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/arm/spitz.c | ||
21 | +++ b/hw/arm/spitz.c | ||
22 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
23 | |||
24 | typedef struct { | ||
25 | MachineState parent; | ||
26 | + PXA2xxState *mpu; | ||
27 | + DeviceState *mux; | ||
28 | + DeviceState *lcdtg; | ||
29 | + DeviceState *ads7846; | ||
30 | + DeviceState *max1111; | ||
31 | } SpitzMachineState; | ||
32 | |||
33 | #define TYPE_SPITZ_MACHINE "spitz-common" | ||
34 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_realize(SSISlave *d, Error **errp) | ||
35 | s->bus[2] = ssi_create_bus(dev, "ssi2"); | ||
36 | } | ||
37 | |||
38 | -static void spitz_ssp_attach(PXA2xxState *cpu) | ||
39 | +static void spitz_ssp_attach(SpitzMachineState *sms) | ||
40 | { | ||
41 | - DeviceState *mux; | ||
42 | - DeviceState *dev; | ||
43 | void *bus; | ||
44 | |||
45 | - mux = ssi_create_slave(cpu->ssp[CORGI_SSP_PORT - 1], "corgi-ssp"); | ||
46 | + sms->mux = ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], "corgi-ssp"); | ||
47 | |||
48 | - bus = qdev_get_child_bus(mux, "ssi0"); | ||
49 | - ssi_create_slave(bus, "spitz-lcdtg"); | ||
50 | + bus = qdev_get_child_bus(sms->mux, "ssi0"); | ||
51 | + sms->lcdtg = ssi_create_slave(bus, "spitz-lcdtg"); | ||
52 | |||
53 | - bus = qdev_get_child_bus(mux, "ssi1"); | ||
54 | - dev = ssi_create_slave(bus, "ads7846"); | ||
55 | - qdev_connect_gpio_out(dev, 0, | ||
56 | - qdev_get_gpio_in(cpu->gpio, SPITZ_GPIO_TP_INT)); | ||
57 | + bus = qdev_get_child_bus(sms->mux, "ssi1"); | ||
58 | + sms->ads7846 = ssi_create_slave(bus, "ads7846"); | ||
59 | + qdev_connect_gpio_out(sms->ads7846, 0, | ||
60 | + qdev_get_gpio_in(sms->mpu->gpio, SPITZ_GPIO_TP_INT)); | ||
61 | |||
62 | - bus = qdev_get_child_bus(mux, "ssi2"); | ||
63 | - max1111 = ssi_create_slave(bus, "max1111"); | ||
64 | - max111x_set_input(max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT); | ||
65 | - max111x_set_input(max1111, MAX1111_BATT_TEMP, 0); | ||
66 | - max111x_set_input(max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN); | ||
67 | + bus = qdev_get_child_bus(sms->mux, "ssi2"); | ||
68 | + sms->max1111 = ssi_create_slave(bus, "max1111"); | ||
69 | + max1111 = sms->max1111; | ||
70 | + max111x_set_input(sms->max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT); | ||
71 | + max111x_set_input(sms->max1111, MAX1111_BATT_TEMP, 0); | ||
72 | + max111x_set_input(sms->max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN); | ||
73 | |||
74 | - qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_LCDCON_CS, | ||
75 | - qdev_get_gpio_in(mux, 0)); | ||
76 | - qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_ADS7846_CS, | ||
77 | - qdev_get_gpio_in(mux, 1)); | ||
78 | - qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_MAX1111_CS, | ||
79 | - qdev_get_gpio_in(mux, 2)); | ||
80 | + qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_LCDCON_CS, | ||
81 | + qdev_get_gpio_in(sms->mux, 0)); | ||
82 | + qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_ADS7846_CS, | ||
83 | + qdev_get_gpio_in(sms->mux, 1)); | ||
84 | + qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_MAX1111_CS, | ||
85 | + qdev_get_gpio_in(sms->mux, 2)); | ||
86 | } | ||
87 | |||
88 | /* CF Microdrive */ | ||
89 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info spitz_binfo = { | ||
90 | static void spitz_common_init(MachineState *machine) | ||
91 | { | ||
92 | SpitzMachineClass *smc = SPITZ_MACHINE_GET_CLASS(machine); | ||
93 | + SpitzMachineState *sms = SPITZ_MACHINE(machine); | ||
94 | enum spitz_model_e model = smc->model; | ||
95 | PXA2xxState *mpu; | ||
96 | DeviceState *scp0, *scp1 = NULL; | ||
97 | @@ -XXX,XX +XXX,XX @@ static void spitz_common_init(MachineState *machine) | ||
98 | /* Setup CPU & memory */ | ||
99 | mpu = pxa270_init(address_space_mem, spitz_binfo.ram_size, | ||
100 | machine->cpu_type); | ||
101 | + sms->mpu = mpu; | ||
102 | |||
103 | sl_flash_register(mpu, (model == spitz) ? FLASH_128M : FLASH_1024M); | ||
104 | |||
105 | @@ -XXX,XX +XXX,XX @@ static void spitz_common_init(MachineState *machine) | ||
106 | /* Setup peripherals */ | ||
107 | spitz_keyboard_register(mpu); | ||
108 | |||
109 | - spitz_ssp_attach(mpu); | ||
110 | + spitz_ssp_attach(sms); | ||
111 | |||
112 | scp0 = sysbus_create_simple("scoop", 0x10800000, NULL); | ||
113 | if (model != akita) { | ||
114 | -- | ||
115 | 2.20.1 | ||
116 | |||
117 | diff view generated by jsdifflib |
1 | In the neon_padd/pmax/pmin helpers for float16, a cut-and-paste error | 1 | Keep pointers to scp0, scp1 in SpitzMachineState, and just pass |
---|---|---|---|
2 | meant we were using the H4() address swizzler macro rather than the | 2 | that to spitz_scoop_gpio_setup(). |
3 | H2() which is required for 2-byte data. This had no effect on | 3 | |
4 | little-endian hosts but meant we put the result data into the | 4 | (We'll want to use some of the other fields in SpitzMachineState |
5 | destination Dreg in the wrong order on big-endian hosts. | 5 | in that function in the next commit.) |
6 | 6 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Message-id: 20200628142429.17111-5-peter.maydell@linaro.org |
10 | Message-id: 20201028191712.4910-2-peter.maydell@linaro.org | ||
11 | --- | 10 | --- |
12 | target/arm/vec_helper.c | 8 ++++---- | 11 | hw/arm/spitz.c | 34 +++++++++++++++++++--------------- |
13 | 1 file changed, 4 insertions(+), 4 deletions(-) | 12 | 1 file changed, 19 insertions(+), 15 deletions(-) |
14 | 13 | ||
15 | diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c | 14 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/vec_helper.c | 16 | --- a/hw/arm/spitz.c |
18 | +++ b/target/arm/vec_helper.c | 17 | +++ b/hw/arm/spitz.c |
19 | @@ -XXX,XX +XXX,XX @@ DO_ABA(gvec_uaba_d, uint64_t) | 18 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
20 | r2 = float16_##OP(m[H2(0)], m[H2(1)], fpst); \ | 19 | DeviceState *lcdtg; |
21 | r3 = float16_##OP(m[H2(2)], m[H2(3)], fpst); \ | 20 | DeviceState *ads7846; |
22 | \ | 21 | DeviceState *max1111; |
23 | - d[H4(0)] = r0; \ | 22 | + DeviceState *scp0; |
24 | - d[H4(1)] = r1; \ | 23 | + DeviceState *scp1; |
25 | - d[H4(2)] = r2; \ | 24 | } SpitzMachineState; |
26 | - d[H4(3)] = r3; \ | 25 | |
27 | + d[H2(0)] = r0; \ | 26 | #define TYPE_SPITZ_MACHINE "spitz-common" |
28 | + d[H2(1)] = r1; \ | 27 | @@ -XXX,XX +XXX,XX @@ static void spitz_out_switch(void *opaque, int line, int level) |
29 | + d[H2(2)] = r2; \ | 28 | #define SPITZ_SCP2_BACKLIGHT_ON 8 |
30 | + d[H2(3)] = r3; \ | 29 | #define SPITZ_SCP2_MIC_BIAS 9 |
30 | |||
31 | -static void spitz_scoop_gpio_setup(PXA2xxState *cpu, | ||
32 | - DeviceState *scp0, DeviceState *scp1) | ||
33 | +static void spitz_scoop_gpio_setup(SpitzMachineState *sms) | ||
34 | { | ||
35 | - qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 8); | ||
36 | + qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, sms->mpu, 8); | ||
37 | |||
38 | - qdev_connect_gpio_out(scp0, SPITZ_SCP_CHRG_ON, outsignals[0]); | ||
39 | - qdev_connect_gpio_out(scp0, SPITZ_SCP_JK_B, outsignals[1]); | ||
40 | - qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_GREEN, outsignals[2]); | ||
41 | - qdev_connect_gpio_out(scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]); | ||
42 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_CHRG_ON, outsignals[0]); | ||
43 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_JK_B, outsignals[1]); | ||
44 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_GREEN, outsignals[2]); | ||
45 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]); | ||
46 | |||
47 | - if (scp1) { | ||
48 | - qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_CONT, outsignals[4]); | ||
49 | - qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_ON, outsignals[5]); | ||
50 | + if (sms->scp1) { | ||
51 | + qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_CONT, | ||
52 | + outsignals[4]); | ||
53 | + qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_ON, | ||
54 | + outsignals[5]); | ||
31 | } | 55 | } |
32 | 56 | ||
33 | DO_NEON_PAIRWISE(neon_padd, add) | 57 | - qdev_connect_gpio_out(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); |
58 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); | ||
59 | } | ||
60 | |||
61 | #define SPITZ_GPIO_HSYNC 22 | ||
62 | @@ -XXX,XX +XXX,XX @@ static void spitz_common_init(MachineState *machine) | ||
63 | SpitzMachineState *sms = SPITZ_MACHINE(machine); | ||
64 | enum spitz_model_e model = smc->model; | ||
65 | PXA2xxState *mpu; | ||
66 | - DeviceState *scp0, *scp1 = NULL; | ||
67 | MemoryRegion *address_space_mem = get_system_memory(); | ||
68 | MemoryRegion *rom = g_new(MemoryRegion, 1); | ||
69 | |||
70 | @@ -XXX,XX +XXX,XX @@ static void spitz_common_init(MachineState *machine) | ||
71 | |||
72 | spitz_ssp_attach(sms); | ||
73 | |||
74 | - scp0 = sysbus_create_simple("scoop", 0x10800000, NULL); | ||
75 | + sms->scp0 = sysbus_create_simple("scoop", 0x10800000, NULL); | ||
76 | if (model != akita) { | ||
77 | - scp1 = sysbus_create_simple("scoop", 0x08800040, NULL); | ||
78 | + sms->scp1 = sysbus_create_simple("scoop", 0x08800040, NULL); | ||
79 | + } else { | ||
80 | + sms->scp1 = NULL; | ||
81 | } | ||
82 | |||
83 | - spitz_scoop_gpio_setup(mpu, scp0, scp1); | ||
84 | + spitz_scoop_gpio_setup(sms); | ||
85 | |||
86 | spitz_gpio_setup(mpu, (model == akita) ? 1 : 2); | ||
87 | |||
34 | -- | 88 | -- |
35 | 2.20.1 | 89 | 2.20.1 |
36 | 90 | ||
37 | 91 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Currently the Spitz board uses a nasty hack for the GPIO lines | ||
2 | that pass "bit5" and "power" information to the LCD controller: | ||
3 | the lcdtg realize function sets a global variable to point to | ||
4 | the instance it just realized, and then the functions spitz_bl_power() | ||
5 | and spitz_bl_bit5() use that to find the device they are changing | ||
6 | the internal state of. There is a comment reading: | ||
7 | FIXME: Implement GPIO properly and remove this hack. | ||
8 | which was added in 2009. | ||
1 | 9 | ||
10 | Implement GPIO properly and remove this hack. | ||
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Message-id: 20200628142429.17111-6-peter.maydell@linaro.org | ||
15 | --- | ||
16 | hw/arm/spitz.c | 28 ++++++++++++---------------- | ||
17 | 1 file changed, 12 insertions(+), 16 deletions(-) | ||
18 | |||
19 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/spitz.c | ||
22 | +++ b/hw/arm/spitz.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void spitz_bl_update(SpitzLCDTG *s) | ||
24 | zaurus_printf("LCD Backlight now off\n"); | ||
25 | } | ||
26 | |||
27 | -/* FIXME: Implement GPIO properly and remove this hack. */ | ||
28 | -static SpitzLCDTG *spitz_lcdtg; | ||
29 | - | ||
30 | static inline void spitz_bl_bit5(void *opaque, int line, int level) | ||
31 | { | ||
32 | - SpitzLCDTG *s = spitz_lcdtg; | ||
33 | + SpitzLCDTG *s = opaque; | ||
34 | int prev = s->bl_intensity; | ||
35 | |||
36 | if (level) | ||
37 | @@ -XXX,XX +XXX,XX @@ static inline void spitz_bl_bit5(void *opaque, int line, int level) | ||
38 | |||
39 | static inline void spitz_bl_power(void *opaque, int line, int level) | ||
40 | { | ||
41 | - SpitzLCDTG *s = spitz_lcdtg; | ||
42 | + SpitzLCDTG *s = opaque; | ||
43 | s->bl_power = !!level; | ||
44 | spitz_bl_update(s); | ||
45 | } | ||
46 | @@ -XXX,XX +XXX,XX @@ static uint32_t spitz_lcdtg_transfer(SSISlave *dev, uint32_t value) | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | -static void spitz_lcdtg_realize(SSISlave *dev, Error **errp) | ||
51 | +static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) | ||
52 | { | ||
53 | - SpitzLCDTG *s = FROM_SSI_SLAVE(SpitzLCDTG, dev); | ||
54 | + SpitzLCDTG *s = FROM_SSI_SLAVE(SpitzLCDTG, ssi); | ||
55 | + DeviceState *dev = DEVICE(s); | ||
56 | |||
57 | - spitz_lcdtg = s; | ||
58 | s->bl_power = 0; | ||
59 | s->bl_intensity = 0x20; | ||
60 | + | ||
61 | + qdev_init_gpio_in_named(dev, spitz_bl_bit5, "bl_bit5", 1); | ||
62 | + qdev_init_gpio_in_named(dev, spitz_bl_power, "bl_power", 1); | ||
63 | } | ||
64 | |||
65 | /* SSP devices */ | ||
66 | @@ -XXX,XX +XXX,XX @@ static void spitz_out_switch(void *opaque, int line, int level) | ||
67 | case 3: | ||
68 | zaurus_printf("Orange LED %s.\n", level ? "on" : "off"); | ||
69 | break; | ||
70 | - case 4: | ||
71 | - spitz_bl_bit5(opaque, line, level); | ||
72 | - break; | ||
73 | - case 5: | ||
74 | - spitz_bl_power(opaque, line, level); | ||
75 | - break; | ||
76 | case 6: | ||
77 | spitz_adc_temp_on(opaque, line, level); | ||
78 | break; | ||
79 | + default: | ||
80 | + g_assert_not_reached(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ static void spitz_scoop_gpio_setup(SpitzMachineState *sms) | ||
85 | |||
86 | if (sms->scp1) { | ||
87 | qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_CONT, | ||
88 | - outsignals[4]); | ||
89 | + qdev_get_gpio_in_named(sms->lcdtg, "bl_bit5", 0)); | ||
90 | qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_ON, | ||
91 | - outsignals[5]); | ||
92 | + qdev_get_gpio_in_named(sms->lcdtg, "bl_power", 0)); | ||
93 | } | ||
94 | |||
95 | qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); | ||
96 | -- | ||
97 | 2.20.1 | ||
98 | |||
99 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Add some QOM properties to the max111x ADC device to allow the |
---|---|---|---|
2 | initial values to be configured. Currently this is done by | ||
3 | board code calling max111x_set_input() after it creates the | ||
4 | device, which doesn't work on system reset. | ||
2 | 5 | ||
3 | Model these off the aa64 read/write_vec_element functions. | 6 | This requires us to implement a reset method for this device, |
4 | Use it within translate-neon.c.inc. The new functions do | 7 | so while we're doing that make sure we reset the other parts |
5 | not allocate or free temps, so this rearranges the calling | 8 | of the device state. |
6 | code a bit. | ||
7 | 9 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20201030022618.785675-6-richard.henderson@linaro.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-id: 20200628142429.17111-7-peter.maydell@linaro.org | ||
12 | --- | 14 | --- |
13 | target/arm/translate.c | 26 ++++ | 15 | hw/misc/max111x.c | 57 ++++++++++++++++++++++++++++++++++++++--------- |
14 | target/arm/translate-neon.c.inc | 256 ++++++++++++++++++++------------ | 16 | 1 file changed, 47 insertions(+), 10 deletions(-) |
15 | 2 files changed, 183 insertions(+), 99 deletions(-) | ||
16 | 17 | ||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 18 | diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 20 | --- a/hw/misc/max111x.c |
20 | +++ b/target/arm/translate.c | 21 | +++ b/hw/misc/max111x.c |
21 | @@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg) | 22 | @@ -XXX,XX +XXX,XX @@ |
22 | tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 23 | #include "hw/ssi/ssi.h" |
24 | #include "migration/vmstate.h" | ||
25 | #include "qemu/module.h" | ||
26 | +#include "hw/qdev-properties.h" | ||
27 | |||
28 | typedef struct { | ||
29 | SSISlave parent_obj; | ||
30 | |||
31 | qemu_irq interrupt; | ||
32 | + /* Values of inputs at system reset (settable by QOM property) */ | ||
33 | + uint8_t reset_input[8]; | ||
34 | + | ||
35 | uint8_t tb1, rb2, rb3; | ||
36 | int cycle; | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ static int max111x_init(SSISlave *d, int inputs) | ||
39 | qdev_init_gpio_out(dev, &s->interrupt, 1); | ||
40 | |||
41 | s->inputs = inputs; | ||
42 | - /* TODO: add a user interface for setting these */ | ||
43 | - s->input[0] = 0xf0; | ||
44 | - s->input[1] = 0xe0; | ||
45 | - s->input[2] = 0xd0; | ||
46 | - s->input[3] = 0xc0; | ||
47 | - s->input[4] = 0xb0; | ||
48 | - s->input[5] = 0xa0; | ||
49 | - s->input[6] = 0x90; | ||
50 | - s->input[7] = 0x80; | ||
51 | - s->com = 0; | ||
52 | |||
53 | vmstate_register(VMSTATE_IF(dev), VMSTATE_INSTANCE_ID_ANY, | ||
54 | &vmstate_max111x, s); | ||
55 | @@ -XXX,XX +XXX,XX @@ void max111x_set_input(DeviceState *dev, int line, uint8_t value) | ||
56 | s->input[line] = value; | ||
23 | } | 57 | } |
24 | 58 | ||
25 | +static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size) | 59 | +static void max111x_reset(DeviceState *dev) |
26 | +{ | 60 | +{ |
27 | + long off = neon_element_offset(reg, ele, size); | 61 | + MAX111xState *s = MAX_111X(dev); |
62 | + int i; | ||
28 | + | 63 | + |
29 | + switch (size) { | 64 | + for (i = 0; i < s->inputs; i++) { |
30 | + case MO_32: | 65 | + s->input[i] = s->reset_input[i]; |
31 | + tcg_gen_ld_i32(dest, cpu_env, off); | ||
32 | + break; | ||
33 | + default: | ||
34 | + g_assert_not_reached(); | ||
35 | + } | 66 | + } |
67 | + s->com = 0; | ||
68 | + s->tb1 = 0; | ||
69 | + s->rb2 = 0; | ||
70 | + s->rb3 = 0; | ||
71 | + s->cycle = 0; | ||
36 | +} | 72 | +} |
37 | + | 73 | + |
38 | +static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size) | 74 | +static Property max1110_properties[] = { |
39 | +{ | 75 | + /* Reset values for ADC inputs */ |
40 | + long off = neon_element_offset(reg, ele, size); | 76 | + DEFINE_PROP_UINT8("input0", MAX111xState, reset_input[0], 0xf0), |
77 | + DEFINE_PROP_UINT8("input1", MAX111xState, reset_input[1], 0xe0), | ||
78 | + DEFINE_PROP_UINT8("input2", MAX111xState, reset_input[2], 0xd0), | ||
79 | + DEFINE_PROP_UINT8("input3", MAX111xState, reset_input[3], 0xc0), | ||
80 | + DEFINE_PROP_END_OF_LIST(), | ||
81 | +}; | ||
41 | + | 82 | + |
42 | + switch (size) { | 83 | +static Property max1111_properties[] = { |
43 | + case MO_32: | 84 | + /* Reset values for ADC inputs */ |
44 | + tcg_gen_st_i32(src, cpu_env, off); | 85 | + DEFINE_PROP_UINT8("input0", MAX111xState, reset_input[0], 0xf0), |
45 | + break; | 86 | + DEFINE_PROP_UINT8("input1", MAX111xState, reset_input[1], 0xe0), |
46 | + default: | 87 | + DEFINE_PROP_UINT8("input2", MAX111xState, reset_input[2], 0xd0), |
47 | + g_assert_not_reached(); | 88 | + DEFINE_PROP_UINT8("input3", MAX111xState, reset_input[3], 0xc0), |
48 | + } | 89 | + DEFINE_PROP_UINT8("input4", MAX111xState, reset_input[4], 0xb0), |
49 | +} | 90 | + DEFINE_PROP_UINT8("input5", MAX111xState, reset_input[5], 0xa0), |
91 | + DEFINE_PROP_UINT8("input6", MAX111xState, reset_input[6], 0x90), | ||
92 | + DEFINE_PROP_UINT8("input7", MAX111xState, reset_input[7], 0x80), | ||
93 | + DEFINE_PROP_END_OF_LIST(), | ||
94 | +}; | ||
50 | + | 95 | + |
51 | static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 96 | static void max111x_class_init(ObjectClass *klass, void *data) |
52 | { | 97 | { |
53 | TCGv_ptr ret = tcg_temp_new_ptr(); | 98 | SSISlaveClass *k = SSI_SLAVE_CLASS(klass); |
54 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 99 | + DeviceClass *dc = DEVICE_CLASS(klass); |
55 | index XXXXXXX..XXXXXXX 100644 | 100 | |
56 | --- a/target/arm/translate-neon.c.inc | 101 | k->transfer = max111x_transfer; |
57 | +++ b/target/arm/translate-neon.c.inc | 102 | + dc->reset = max111x_reset; |
58 | @@ -XXX,XX +XXX,XX @@ static bool do_3same_pair(DisasContext *s, arg_3same *a, NeonGenTwoOpFn *fn) | ||
59 | * early. Since Q is 0 there are always just two passes, so instead | ||
60 | * of a complicated loop over each pass we just unroll. | ||
61 | */ | ||
62 | - tmp = neon_load_reg(a->vn, 0); | ||
63 | - tmp2 = neon_load_reg(a->vn, 1); | ||
64 | + tmp = tcg_temp_new_i32(); | ||
65 | + tmp2 = tcg_temp_new_i32(); | ||
66 | + tmp3 = tcg_temp_new_i32(); | ||
67 | + | ||
68 | + read_neon_element32(tmp, a->vn, 0, MO_32); | ||
69 | + read_neon_element32(tmp2, a->vn, 1, MO_32); | ||
70 | fn(tmp, tmp, tmp2); | ||
71 | - tcg_temp_free_i32(tmp2); | ||
72 | |||
73 | - tmp3 = neon_load_reg(a->vm, 0); | ||
74 | - tmp2 = neon_load_reg(a->vm, 1); | ||
75 | + read_neon_element32(tmp3, a->vm, 0, MO_32); | ||
76 | + read_neon_element32(tmp2, a->vm, 1, MO_32); | ||
77 | fn(tmp3, tmp3, tmp2); | ||
78 | - tcg_temp_free_i32(tmp2); | ||
79 | |||
80 | - neon_store_reg(a->vd, 0, tmp); | ||
81 | - neon_store_reg(a->vd, 1, tmp3); | ||
82 | + write_neon_element32(tmp, a->vd, 0, MO_32); | ||
83 | + write_neon_element32(tmp3, a->vd, 1, MO_32); | ||
84 | + | ||
85 | + tcg_temp_free_i32(tmp); | ||
86 | + tcg_temp_free_i32(tmp2); | ||
87 | + tcg_temp_free_i32(tmp3); | ||
88 | return true; | ||
89 | } | 103 | } |
90 | 104 | ||
91 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, | 105 | static const TypeInfo max111x_info = { |
92 | * 2-reg-and-shift operations, size < 3 case, where the | 106 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo max111x_info = { |
93 | * helper needs to be passed cpu_env. | 107 | static void max1110_class_init(ObjectClass *klass, void *data) |
94 | */ | 108 | { |
95 | - TCGv_i32 constimm; | 109 | SSISlaveClass *k = SSI_SLAVE_CLASS(klass); |
96 | + TCGv_i32 constimm, tmp; | 110 | + DeviceClass *dc = DEVICE_CLASS(klass); |
97 | int pass; | 111 | |
98 | 112 | k->realize = max1110_realize; | |
99 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 113 | + device_class_set_props(dc, max1110_properties); |
100 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, | ||
101 | * by immediate using the variable shift operations. | ||
102 | */ | ||
103 | constimm = tcg_const_i32(dup_const(a->size, a->shift)); | ||
104 | + tmp = tcg_temp_new_i32(); | ||
105 | |||
106 | for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
107 | - TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
108 | + read_neon_element32(tmp, a->vm, pass, MO_32); | ||
109 | fn(tmp, cpu_env, tmp, constimm); | ||
110 | - neon_store_reg(a->vd, pass, tmp); | ||
111 | + write_neon_element32(tmp, a->vd, pass, MO_32); | ||
112 | } | ||
113 | + tcg_temp_free_i32(tmp); | ||
114 | tcg_temp_free_i32(constimm); | ||
115 | return true; | ||
116 | } | 114 | } |
117 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, | 115 | |
118 | constimm = tcg_const_i64(-a->shift); | 116 | static const TypeInfo max1110_info = { |
119 | rm1 = tcg_temp_new_i64(); | 117 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo max1110_info = { |
120 | rm2 = tcg_temp_new_i64(); | 118 | static void max1111_class_init(ObjectClass *klass, void *data) |
121 | + rd = tcg_temp_new_i32(); | 119 | { |
122 | 120 | SSISlaveClass *k = SSI_SLAVE_CLASS(klass); | |
123 | /* Load both inputs first to avoid potential overwrite if rm == rd */ | 121 | + DeviceClass *dc = DEVICE_CLASS(klass); |
124 | neon_load_reg64(rm1, a->vm); | 122 | |
125 | neon_load_reg64(rm2, a->vm + 1); | 123 | k->realize = max1111_realize; |
126 | 124 | + device_class_set_props(dc, max1111_properties); | |
127 | shiftfn(rm1, rm1, constimm); | ||
128 | - rd = tcg_temp_new_i32(); | ||
129 | narrowfn(rd, cpu_env, rm1); | ||
130 | - neon_store_reg(a->vd, 0, rd); | ||
131 | + write_neon_element32(rd, a->vd, 0, MO_32); | ||
132 | |||
133 | shiftfn(rm2, rm2, constimm); | ||
134 | - rd = tcg_temp_new_i32(); | ||
135 | narrowfn(rd, cpu_env, rm2); | ||
136 | - neon_store_reg(a->vd, 1, rd); | ||
137 | + write_neon_element32(rd, a->vd, 1, MO_32); | ||
138 | |||
139 | + tcg_temp_free_i32(rd); | ||
140 | tcg_temp_free_i64(rm1); | ||
141 | tcg_temp_free_i64(rm2); | ||
142 | tcg_temp_free_i64(constimm); | ||
143 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, | ||
144 | constimm = tcg_const_i32(imm); | ||
145 | |||
146 | /* Load all inputs first to avoid potential overwrite */ | ||
147 | - rm1 = neon_load_reg(a->vm, 0); | ||
148 | - rm2 = neon_load_reg(a->vm, 1); | ||
149 | - rm3 = neon_load_reg(a->vm + 1, 0); | ||
150 | - rm4 = neon_load_reg(a->vm + 1, 1); | ||
151 | + rm1 = tcg_temp_new_i32(); | ||
152 | + rm2 = tcg_temp_new_i32(); | ||
153 | + rm3 = tcg_temp_new_i32(); | ||
154 | + rm4 = tcg_temp_new_i32(); | ||
155 | + read_neon_element32(rm1, a->vm, 0, MO_32); | ||
156 | + read_neon_element32(rm2, a->vm, 1, MO_32); | ||
157 | + read_neon_element32(rm3, a->vm, 2, MO_32); | ||
158 | + read_neon_element32(rm4, a->vm, 3, MO_32); | ||
159 | rtmp = tcg_temp_new_i64(); | ||
160 | |||
161 | shiftfn(rm1, rm1, constimm); | ||
162 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, | ||
163 | tcg_temp_free_i32(rm2); | ||
164 | |||
165 | narrowfn(rm1, cpu_env, rtmp); | ||
166 | - neon_store_reg(a->vd, 0, rm1); | ||
167 | + write_neon_element32(rm1, a->vd, 0, MO_32); | ||
168 | + tcg_temp_free_i32(rm1); | ||
169 | |||
170 | shiftfn(rm3, rm3, constimm); | ||
171 | shiftfn(rm4, rm4, constimm); | ||
172 | @@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, | ||
173 | |||
174 | narrowfn(rm3, cpu_env, rtmp); | ||
175 | tcg_temp_free_i64(rtmp); | ||
176 | - neon_store_reg(a->vd, 1, rm3); | ||
177 | + write_neon_element32(rm3, a->vd, 1, MO_32); | ||
178 | + tcg_temp_free_i32(rm3); | ||
179 | return true; | ||
180 | } | 125 | } |
181 | 126 | ||
182 | @@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a, | 127 | static const TypeInfo max1111_info = { |
183 | widen_mask = dup_const(a->size + 1, widen_mask); | ||
184 | } | ||
185 | |||
186 | - rm0 = neon_load_reg(a->vm, 0); | ||
187 | - rm1 = neon_load_reg(a->vm, 1); | ||
188 | + rm0 = tcg_temp_new_i32(); | ||
189 | + rm1 = tcg_temp_new_i32(); | ||
190 | + read_neon_element32(rm0, a->vm, 0, MO_32); | ||
191 | + read_neon_element32(rm1, a->vm, 1, MO_32); | ||
192 | tmp = tcg_temp_new_i64(); | ||
193 | |||
194 | widenfn(tmp, rm0); | ||
195 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
196 | if (src1_wide) { | ||
197 | neon_load_reg64(rn0_64, a->vn); | ||
198 | } else { | ||
199 | - TCGv_i32 tmp = neon_load_reg(a->vn, 0); | ||
200 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
201 | + read_neon_element32(tmp, a->vn, 0, MO_32); | ||
202 | widenfn(rn0_64, tmp); | ||
203 | tcg_temp_free_i32(tmp); | ||
204 | } | ||
205 | - rm = neon_load_reg(a->vm, 0); | ||
206 | + rm = tcg_temp_new_i32(); | ||
207 | + read_neon_element32(rm, a->vm, 0, MO_32); | ||
208 | |||
209 | widenfn(rm_64, rm); | ||
210 | tcg_temp_free_i32(rm); | ||
211 | @@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a, | ||
212 | if (src1_wide) { | ||
213 | neon_load_reg64(rn1_64, a->vn + 1); | ||
214 | } else { | ||
215 | - TCGv_i32 tmp = neon_load_reg(a->vn, 1); | ||
216 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
217 | + read_neon_element32(tmp, a->vn, 1, MO_32); | ||
218 | widenfn(rn1_64, tmp); | ||
219 | tcg_temp_free_i32(tmp); | ||
220 | } | ||
221 | - rm = neon_load_reg(a->vm, 1); | ||
222 | + rm = tcg_temp_new_i32(); | ||
223 | + read_neon_element32(rm, a->vm, 1, MO_32); | ||
224 | |||
225 | neon_store_reg64(rn0_64, a->vd); | ||
226 | |||
227 | @@ -XXX,XX +XXX,XX @@ static bool do_narrow_3d(DisasContext *s, arg_3diff *a, | ||
228 | |||
229 | narrowfn(rd1, rn_64); | ||
230 | |||
231 | - neon_store_reg(a->vd, 0, rd0); | ||
232 | - neon_store_reg(a->vd, 1, rd1); | ||
233 | + write_neon_element32(rd0, a->vd, 0, MO_32); | ||
234 | + write_neon_element32(rd1, a->vd, 1, MO_32); | ||
235 | |||
236 | + tcg_temp_free_i32(rd0); | ||
237 | + tcg_temp_free_i32(rd1); | ||
238 | tcg_temp_free_i64(rn_64); | ||
239 | tcg_temp_free_i64(rm_64); | ||
240 | |||
241 | @@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a, | ||
242 | rd0 = tcg_temp_new_i64(); | ||
243 | rd1 = tcg_temp_new_i64(); | ||
244 | |||
245 | - rn = neon_load_reg(a->vn, 0); | ||
246 | - rm = neon_load_reg(a->vm, 0); | ||
247 | + rn = tcg_temp_new_i32(); | ||
248 | + rm = tcg_temp_new_i32(); | ||
249 | + read_neon_element32(rn, a->vn, 0, MO_32); | ||
250 | + read_neon_element32(rm, a->vm, 0, MO_32); | ||
251 | opfn(rd0, rn, rm); | ||
252 | - tcg_temp_free_i32(rn); | ||
253 | - tcg_temp_free_i32(rm); | ||
254 | |||
255 | - rn = neon_load_reg(a->vn, 1); | ||
256 | - rm = neon_load_reg(a->vm, 1); | ||
257 | + read_neon_element32(rn, a->vn, 1, MO_32); | ||
258 | + read_neon_element32(rm, a->vm, 1, MO_32); | ||
259 | opfn(rd1, rn, rm); | ||
260 | tcg_temp_free_i32(rn); | ||
261 | tcg_temp_free_i32(rm); | ||
262 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var) | ||
263 | |||
264 | static inline TCGv_i32 neon_get_scalar(int size, int reg) | ||
265 | { | ||
266 | - TCGv_i32 tmp; | ||
267 | - if (size == 1) { | ||
268 | - tmp = neon_load_reg(reg & 7, reg >> 4); | ||
269 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
270 | + if (size == MO_16) { | ||
271 | + read_neon_element32(tmp, reg & 7, reg >> 4, MO_32); | ||
272 | if (reg & 8) { | ||
273 | gen_neon_dup_high16(tmp); | ||
274 | } else { | ||
275 | gen_neon_dup_low16(tmp); | ||
276 | } | ||
277 | } else { | ||
278 | - tmp = neon_load_reg(reg & 15, reg >> 4); | ||
279 | + read_neon_element32(tmp, reg & 15, reg >> 4, MO_32); | ||
280 | } | ||
281 | return tmp; | ||
282 | } | ||
283 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar(DisasContext *s, arg_2scalar *a, | ||
284 | * perform an accumulation operation of that result into the | ||
285 | * destination. | ||
286 | */ | ||
287 | - TCGv_i32 scalar; | ||
288 | + TCGv_i32 scalar, tmp; | ||
289 | int pass; | ||
290 | |||
291 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
292 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar(DisasContext *s, arg_2scalar *a, | ||
293 | } | ||
294 | |||
295 | scalar = neon_get_scalar(a->size, a->vm); | ||
296 | + tmp = tcg_temp_new_i32(); | ||
297 | |||
298 | for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
299 | - TCGv_i32 tmp = neon_load_reg(a->vn, pass); | ||
300 | + read_neon_element32(tmp, a->vn, pass, MO_32); | ||
301 | opfn(tmp, tmp, scalar); | ||
302 | if (accfn) { | ||
303 | - TCGv_i32 rd = neon_load_reg(a->vd, pass); | ||
304 | + TCGv_i32 rd = tcg_temp_new_i32(); | ||
305 | + read_neon_element32(rd, a->vd, pass, MO_32); | ||
306 | accfn(tmp, rd, tmp); | ||
307 | tcg_temp_free_i32(rd); | ||
308 | } | ||
309 | - neon_store_reg(a->vd, pass, tmp); | ||
310 | + write_neon_element32(tmp, a->vd, pass, MO_32); | ||
311 | } | ||
312 | + tcg_temp_free_i32(tmp); | ||
313 | tcg_temp_free_i32(scalar); | ||
314 | return true; | ||
315 | } | ||
316 | @@ -XXX,XX +XXX,XX @@ static bool do_vqrdmlah_2sc(DisasContext *s, arg_2scalar *a, | ||
317 | * performs a kind of fused op-then-accumulate using a helper | ||
318 | * function that takes all of rd, rn and the scalar at once. | ||
319 | */ | ||
320 | - TCGv_i32 scalar; | ||
321 | + TCGv_i32 scalar, rn, rd; | ||
322 | int pass; | ||
323 | |||
324 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
325 | @@ -XXX,XX +XXX,XX @@ static bool do_vqrdmlah_2sc(DisasContext *s, arg_2scalar *a, | ||
326 | } | ||
327 | |||
328 | scalar = neon_get_scalar(a->size, a->vm); | ||
329 | + rn = tcg_temp_new_i32(); | ||
330 | + rd = tcg_temp_new_i32(); | ||
331 | |||
332 | for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
333 | - TCGv_i32 rn = neon_load_reg(a->vn, pass); | ||
334 | - TCGv_i32 rd = neon_load_reg(a->vd, pass); | ||
335 | + read_neon_element32(rn, a->vn, pass, MO_32); | ||
336 | + read_neon_element32(rd, a->vd, pass, MO_32); | ||
337 | opfn(rd, cpu_env, rn, scalar, rd); | ||
338 | - tcg_temp_free_i32(rn); | ||
339 | - neon_store_reg(a->vd, pass, rd); | ||
340 | + write_neon_element32(rd, a->vd, pass, MO_32); | ||
341 | } | ||
342 | + tcg_temp_free_i32(rn); | ||
343 | + tcg_temp_free_i32(rd); | ||
344 | tcg_temp_free_i32(scalar); | ||
345 | |||
346 | return true; | ||
347 | @@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a, | ||
348 | scalar = neon_get_scalar(a->size, a->vm); | ||
349 | |||
350 | /* Load all inputs before writing any outputs, in case of overlap */ | ||
351 | - rn = neon_load_reg(a->vn, 0); | ||
352 | + rn = tcg_temp_new_i32(); | ||
353 | + read_neon_element32(rn, a->vn, 0, MO_32); | ||
354 | rn0_64 = tcg_temp_new_i64(); | ||
355 | opfn(rn0_64, rn, scalar); | ||
356 | - tcg_temp_free_i32(rn); | ||
357 | |||
358 | - rn = neon_load_reg(a->vn, 1); | ||
359 | + read_neon_element32(rn, a->vn, 1, MO_32); | ||
360 | rn1_64 = tcg_temp_new_i64(); | ||
361 | opfn(rn1_64, rn, scalar); | ||
362 | tcg_temp_free_i32(rn); | ||
363 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | ||
364 | return false; | ||
365 | } | ||
366 | n <<= 3; | ||
367 | + tmp = tcg_temp_new_i32(); | ||
368 | if (a->op) { | ||
369 | - tmp = neon_load_reg(a->vd, 0); | ||
370 | + read_neon_element32(tmp, a->vd, 0, MO_32); | ||
371 | } else { | ||
372 | - tmp = tcg_temp_new_i32(); | ||
373 | tcg_gen_movi_i32(tmp, 0); | ||
374 | } | ||
375 | - tmp2 = neon_load_reg(a->vm, 0); | ||
376 | + tmp2 = tcg_temp_new_i32(); | ||
377 | + read_neon_element32(tmp2, a->vm, 0, MO_32); | ||
378 | ptr1 = vfp_reg_ptr(true, a->vn); | ||
379 | tmp4 = tcg_const_i32(n); | ||
380 | gen_helper_neon_tbl(tmp2, tmp2, tmp, ptr1, tmp4); | ||
381 | - tcg_temp_free_i32(tmp); | ||
382 | + | ||
383 | if (a->op) { | ||
384 | - tmp = neon_load_reg(a->vd, 1); | ||
385 | + read_neon_element32(tmp, a->vd, 1, MO_32); | ||
386 | } else { | ||
387 | - tmp = tcg_temp_new_i32(); | ||
388 | tcg_gen_movi_i32(tmp, 0); | ||
389 | } | ||
390 | - tmp3 = neon_load_reg(a->vm, 1); | ||
391 | + tmp3 = tcg_temp_new_i32(); | ||
392 | + read_neon_element32(tmp3, a->vm, 1, MO_32); | ||
393 | gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp4); | ||
394 | + tcg_temp_free_i32(tmp); | ||
395 | tcg_temp_free_i32(tmp4); | ||
396 | tcg_temp_free_ptr(ptr1); | ||
397 | - neon_store_reg(a->vd, 0, tmp2); | ||
398 | - neon_store_reg(a->vd, 1, tmp3); | ||
399 | - tcg_temp_free_i32(tmp); | ||
400 | + | ||
401 | + write_neon_element32(tmp2, a->vd, 0, MO_32); | ||
402 | + write_neon_element32(tmp3, a->vd, 1, MO_32); | ||
403 | + tcg_temp_free_i32(tmp2); | ||
404 | + tcg_temp_free_i32(tmp3); | ||
405 | return true; | ||
406 | } | ||
407 | |||
408 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) | ||
409 | static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) | ||
410 | { | ||
411 | int pass, half; | ||
412 | + TCGv_i32 tmp[2]; | ||
413 | |||
414 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
415 | return false; | ||
416 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) | ||
417 | return true; | ||
418 | } | ||
419 | |||
420 | - for (pass = 0; pass < (a->q ? 2 : 1); pass++) { | ||
421 | - TCGv_i32 tmp[2]; | ||
422 | + tmp[0] = tcg_temp_new_i32(); | ||
423 | + tmp[1] = tcg_temp_new_i32(); | ||
424 | |||
425 | + for (pass = 0; pass < (a->q ? 2 : 1); pass++) { | ||
426 | for (half = 0; half < 2; half++) { | ||
427 | - tmp[half] = neon_load_reg(a->vm, pass * 2 + half); | ||
428 | + read_neon_element32(tmp[half], a->vm, pass * 2 + half, MO_32); | ||
429 | switch (a->size) { | ||
430 | case 0: | ||
431 | tcg_gen_bswap32_i32(tmp[half], tmp[half]); | ||
432 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) | ||
433 | g_assert_not_reached(); | ||
434 | } | ||
435 | } | ||
436 | - neon_store_reg(a->vd, pass * 2, tmp[1]); | ||
437 | - neon_store_reg(a->vd, pass * 2 + 1, tmp[0]); | ||
438 | + write_neon_element32(tmp[1], a->vd, pass * 2, MO_32); | ||
439 | + write_neon_element32(tmp[0], a->vd, pass * 2 + 1, MO_32); | ||
440 | } | ||
441 | + | ||
442 | + tcg_temp_free_i32(tmp[0]); | ||
443 | + tcg_temp_free_i32(tmp[1]); | ||
444 | return true; | ||
445 | } | ||
446 | |||
447 | @@ -XXX,XX +XXX,XX @@ static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, | ||
448 | rm0_64 = tcg_temp_new_i64(); | ||
449 | rm1_64 = tcg_temp_new_i64(); | ||
450 | rd_64 = tcg_temp_new_i64(); | ||
451 | - tmp = neon_load_reg(a->vm, pass * 2); | ||
452 | + | ||
453 | + tmp = tcg_temp_new_i32(); | ||
454 | + read_neon_element32(tmp, a->vm, pass * 2, MO_32); | ||
455 | widenfn(rm0_64, tmp); | ||
456 | - tcg_temp_free_i32(tmp); | ||
457 | - tmp = neon_load_reg(a->vm, pass * 2 + 1); | ||
458 | + read_neon_element32(tmp, a->vm, pass * 2 + 1, MO_32); | ||
459 | widenfn(rm1_64, tmp); | ||
460 | tcg_temp_free_i32(tmp); | ||
461 | + | ||
462 | opfn(rd_64, rm0_64, rm1_64); | ||
463 | tcg_temp_free_i64(rm0_64); | ||
464 | tcg_temp_free_i64(rm1_64); | ||
465 | @@ -XXX,XX +XXX,XX @@ static bool do_vmovn(DisasContext *s, arg_2misc *a, | ||
466 | narrowfn(rd0, cpu_env, rm); | ||
467 | neon_load_reg64(rm, a->vm + 1); | ||
468 | narrowfn(rd1, cpu_env, rm); | ||
469 | - neon_store_reg(a->vd, 0, rd0); | ||
470 | - neon_store_reg(a->vd, 1, rd1); | ||
471 | + write_neon_element32(rd0, a->vd, 0, MO_32); | ||
472 | + write_neon_element32(rd1, a->vd, 1, MO_32); | ||
473 | + tcg_temp_free_i32(rd0); | ||
474 | + tcg_temp_free_i32(rd1); | ||
475 | tcg_temp_free_i64(rm); | ||
476 | return true; | ||
477 | } | ||
478 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a) | ||
479 | } | ||
480 | |||
481 | rd = tcg_temp_new_i64(); | ||
482 | + rm0 = tcg_temp_new_i32(); | ||
483 | + rm1 = tcg_temp_new_i32(); | ||
484 | |||
485 | - rm0 = neon_load_reg(a->vm, 0); | ||
486 | - rm1 = neon_load_reg(a->vm, 1); | ||
487 | + read_neon_element32(rm0, a->vm, 0, MO_32); | ||
488 | + read_neon_element32(rm1, a->vm, 1, MO_32); | ||
489 | |||
490 | widenfn(rd, rm0); | ||
491 | tcg_gen_shli_i64(rd, rd, 8 << a->size); | ||
492 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F16_F32(DisasContext *s, arg_2misc *a) | ||
493 | |||
494 | fpst = fpstatus_ptr(FPST_STD); | ||
495 | ahp = get_ahp_flag(); | ||
496 | - tmp = neon_load_reg(a->vm, 0); | ||
497 | + tmp = tcg_temp_new_i32(); | ||
498 | + read_neon_element32(tmp, a->vm, 0, MO_32); | ||
499 | gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
500 | - tmp2 = neon_load_reg(a->vm, 1); | ||
501 | + tmp2 = tcg_temp_new_i32(); | ||
502 | + read_neon_element32(tmp2, a->vm, 1, MO_32); | ||
503 | gen_helper_vfp_fcvt_f32_to_f16(tmp2, tmp2, fpst, ahp); | ||
504 | tcg_gen_shli_i32(tmp2, tmp2, 16); | ||
505 | tcg_gen_or_i32(tmp2, tmp2, tmp); | ||
506 | - tcg_temp_free_i32(tmp); | ||
507 | - tmp = neon_load_reg(a->vm, 2); | ||
508 | + read_neon_element32(tmp, a->vm, 2, MO_32); | ||
509 | gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
510 | - tmp3 = neon_load_reg(a->vm, 3); | ||
511 | - neon_store_reg(a->vd, 0, tmp2); | ||
512 | + tmp3 = tcg_temp_new_i32(); | ||
513 | + read_neon_element32(tmp3, a->vm, 3, MO_32); | ||
514 | + write_neon_element32(tmp2, a->vd, 0, MO_32); | ||
515 | + tcg_temp_free_i32(tmp2); | ||
516 | gen_helper_vfp_fcvt_f32_to_f16(tmp3, tmp3, fpst, ahp); | ||
517 | tcg_gen_shli_i32(tmp3, tmp3, 16); | ||
518 | tcg_gen_or_i32(tmp3, tmp3, tmp); | ||
519 | - neon_store_reg(a->vd, 1, tmp3); | ||
520 | + write_neon_element32(tmp3, a->vd, 1, MO_32); | ||
521 | + tcg_temp_free_i32(tmp3); | ||
522 | tcg_temp_free_i32(tmp); | ||
523 | tcg_temp_free_i32(ahp); | ||
524 | tcg_temp_free_ptr(fpst); | ||
525 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) | ||
526 | fpst = fpstatus_ptr(FPST_STD); | ||
527 | ahp = get_ahp_flag(); | ||
528 | tmp3 = tcg_temp_new_i32(); | ||
529 | - tmp = neon_load_reg(a->vm, 0); | ||
530 | - tmp2 = neon_load_reg(a->vm, 1); | ||
531 | + tmp2 = tcg_temp_new_i32(); | ||
532 | + tmp = tcg_temp_new_i32(); | ||
533 | + read_neon_element32(tmp, a->vm, 0, MO_32); | ||
534 | + read_neon_element32(tmp2, a->vm, 1, MO_32); | ||
535 | tcg_gen_ext16u_i32(tmp3, tmp); | ||
536 | gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
537 | - neon_store_reg(a->vd, 0, tmp3); | ||
538 | + write_neon_element32(tmp3, a->vd, 0, MO_32); | ||
539 | tcg_gen_shri_i32(tmp, tmp, 16); | ||
540 | gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp); | ||
541 | - neon_store_reg(a->vd, 1, tmp); | ||
542 | - tmp3 = tcg_temp_new_i32(); | ||
543 | + write_neon_element32(tmp, a->vd, 1, MO_32); | ||
544 | + tcg_temp_free_i32(tmp); | ||
545 | tcg_gen_ext16u_i32(tmp3, tmp2); | ||
546 | gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
547 | - neon_store_reg(a->vd, 2, tmp3); | ||
548 | + write_neon_element32(tmp3, a->vd, 2, MO_32); | ||
549 | + tcg_temp_free_i32(tmp3); | ||
550 | tcg_gen_shri_i32(tmp2, tmp2, 16); | ||
551 | gen_helper_vfp_fcvt_f16_to_f32(tmp2, tmp2, fpst, ahp); | ||
552 | - neon_store_reg(a->vd, 3, tmp2); | ||
553 | + write_neon_element32(tmp2, a->vd, 3, MO_32); | ||
554 | + tcg_temp_free_i32(tmp2); | ||
555 | tcg_temp_free_i32(ahp); | ||
556 | tcg_temp_free_ptr(fpst); | ||
557 | |||
558 | @@ -XXX,XX +XXX,XX @@ DO_2M_CRYPTO(SHA256SU0, aa32_sha2, 2) | ||
559 | |||
560 | static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) | ||
561 | { | ||
562 | + TCGv_i32 tmp; | ||
563 | int pass; | ||
564 | |||
565 | /* Handle a 2-reg-misc operation by iterating 32 bits at a time */ | ||
566 | @@ -XXX,XX +XXX,XX @@ static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) | ||
567 | return true; | ||
568 | } | ||
569 | |||
570 | + tmp = tcg_temp_new_i32(); | ||
571 | for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
572 | - TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
573 | + read_neon_element32(tmp, a->vm, pass, MO_32); | ||
574 | fn(tmp, tmp); | ||
575 | - neon_store_reg(a->vd, pass, tmp); | ||
576 | + write_neon_element32(tmp, a->vd, pass, MO_32); | ||
577 | } | ||
578 | + tcg_temp_free_i32(tmp); | ||
579 | |||
580 | return true; | ||
581 | } | ||
582 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTRN(DisasContext *s, arg_2misc *a) | ||
583 | return true; | ||
584 | } | ||
585 | |||
586 | - if (a->size == 2) { | ||
587 | + tmp = tcg_temp_new_i32(); | ||
588 | + tmp2 = tcg_temp_new_i32(); | ||
589 | + if (a->size == MO_32) { | ||
590 | for (pass = 0; pass < (a->q ? 4 : 2); pass += 2) { | ||
591 | - tmp = neon_load_reg(a->vm, pass); | ||
592 | - tmp2 = neon_load_reg(a->vd, pass + 1); | ||
593 | - neon_store_reg(a->vm, pass, tmp2); | ||
594 | - neon_store_reg(a->vd, pass + 1, tmp); | ||
595 | + read_neon_element32(tmp, a->vm, pass, MO_32); | ||
596 | + read_neon_element32(tmp2, a->vd, pass + 1, MO_32); | ||
597 | + write_neon_element32(tmp2, a->vm, pass, MO_32); | ||
598 | + write_neon_element32(tmp, a->vd, pass + 1, MO_32); | ||
599 | } | ||
600 | } else { | ||
601 | for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
602 | - tmp = neon_load_reg(a->vm, pass); | ||
603 | - tmp2 = neon_load_reg(a->vd, pass); | ||
604 | - if (a->size == 0) { | ||
605 | + read_neon_element32(tmp, a->vm, pass, MO_32); | ||
606 | + read_neon_element32(tmp2, a->vd, pass, MO_32); | ||
607 | + if (a->size == MO_8) { | ||
608 | gen_neon_trn_u8(tmp, tmp2); | ||
609 | } else { | ||
610 | gen_neon_trn_u16(tmp, tmp2); | ||
611 | } | ||
612 | - neon_store_reg(a->vm, pass, tmp2); | ||
613 | - neon_store_reg(a->vd, pass, tmp); | ||
614 | + write_neon_element32(tmp2, a->vm, pass, MO_32); | ||
615 | + write_neon_element32(tmp, a->vd, pass, MO_32); | ||
616 | } | ||
617 | } | ||
618 | + tcg_temp_free_i32(tmp); | ||
619 | + tcg_temp_free_i32(tmp2); | ||
620 | return true; | ||
621 | } | ||
622 | -- | 128 | -- |
623 | 2.20.1 | 129 | 2.20.1 |
624 | 130 | ||
625 | 131 | diff view generated by jsdifflib |
1 | The randomness tests in the NPCM7xx RNG test fail intermittently | 1 | The max111x is a proper qdev device; we can use dc->vmsd rather than |
---|---|---|---|
2 | but fairly frequently. On my machine running the test in a loop: | 2 | directly calling vmstate_register(). |
3 | while QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/npcm7xx_rng-test; do true; done | ||
4 | 3 | ||
5 | will fail in less than a minute with an error like: | 4 | It's possible that this is a migration compat break, but the only |
6 | ERROR:../../tests/qtest/npcm7xx_rng-test.c:256:test_first_byte_runs: | 5 | boards that use this device are the spitz-family ('akita', 'borzoi', |
7 | assertion failed (calc_runs_p(buf.l, sizeof(buf) * BITS_PER_BYTE) > 0.01): (0.00286205989 > 0.01) | 6 | 'spitz', 'terrier'). |
8 | |||
9 | (Failures have been observed on all 4 of the randomness tests, | ||
10 | not just first_byte_runs.) | ||
11 | |||
12 | It's not clear why these tests are failing like this, but intermittent | ||
13 | failures make CI and merge testing awkward, so disable running them | ||
14 | unless a developer specifically sets QEMU_TEST_FLAKY_RNG_TESTS when | ||
15 | running the test suite, until we work out the cause. | ||
16 | 7 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
19 | Message-id: 20201102152454.8287-1-peter.maydell@linaro.org | 10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
20 | Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com> | 11 | Message-id: 20200628142429.17111-8-peter.maydell@linaro.org |
21 | --- | 12 | --- |
22 | tests/qtest/npcm7xx_rng-test.c | 14 ++++++++++---- | 13 | hw/misc/max111x.c | 3 +-- |
23 | 1 file changed, 10 insertions(+), 4 deletions(-) | 14 | 1 file changed, 1 insertion(+), 2 deletions(-) |
24 | 15 | ||
25 | diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c | 16 | diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c |
26 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/tests/qtest/npcm7xx_rng-test.c | 18 | --- a/hw/misc/max111x.c |
28 | +++ b/tests/qtest/npcm7xx_rng-test.c | 19 | +++ b/hw/misc/max111x.c |
29 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | 20 | @@ -XXX,XX +XXX,XX @@ static int max111x_init(SSISlave *d, int inputs) |
30 | 21 | ||
31 | qtest_add_func("npcm7xx_rng/enable_disable", test_enable_disable); | 22 | s->inputs = inputs; |
32 | qtest_add_func("npcm7xx_rng/rosel", test_rosel); | 23 | |
33 | - qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit); | 24 | - vmstate_register(VMSTATE_IF(dev), VMSTATE_INSTANCE_ID_ANY, |
34 | - qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs); | 25 | - &vmstate_max111x, s); |
35 | - qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit); | 26 | return 0; |
36 | - qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs); | 27 | } |
37 | + /* | 28 | |
38 | + * These tests fail intermittently; only run them on explicit | 29 | @@ -XXX,XX +XXX,XX @@ static void max111x_class_init(ObjectClass *klass, void *data) |
39 | + * request until we figure out why. | 30 | |
40 | + */ | 31 | k->transfer = max111x_transfer; |
41 | + if (getenv("QEMU_TEST_FLAKY_RNG_TESTS")) { | 32 | dc->reset = max111x_reset; |
42 | + qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit); | 33 | + dc->vmsd = &vmstate_max111x; |
43 | + qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs); | 34 | } |
44 | + qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit); | 35 | |
45 | + qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs); | 36 | static const TypeInfo max111x_info = { |
46 | + } | ||
47 | |||
48 | qtest_start("-machine npcm750-evb"); | ||
49 | ret = g_test_run(); | ||
50 | -- | 37 | -- |
51 | 2.20.1 | 38 | 2.20.1 |
52 | 39 | ||
53 | 40 | diff view generated by jsdifflib |
1 | In gicv3_init_cpuif() we copy the ARMCPU gicv3_maintenance_interrupt | 1 | Add an ssi_realize_and_unref(), for the benefit of callers |
---|---|---|---|
2 | into the GICv3CPUState struct's maintenance_irq field. This will | 2 | who want to be able to create an SSI device, set QOM properties |
3 | only work if the board happens to have already wired up the CPU | 3 | on it, and then do the realize-and-unref afterwards. |
4 | maintenance IRQ before the GIC was realized. Unfortunately this is | ||
5 | not the case for the 'virt' board, and so the value that gets copied | ||
6 | is NULL (since a qemu_irq is really a pointer to an IRQState struct | ||
7 | under the hood). The effect is that the CPU interface code never | ||
8 | actually raises the maintenance interrupt line. | ||
9 | 4 | ||
10 | Instead, since the GICv3CPUState has a pointer to the CPUState, make | 5 | The API works on the same principle as the recently added |
11 | the dereference at the point where we want to raise the interrupt, to | 6 | qdev_realize_and_undef(), sysbus_realize_and_undef(), etc. |
12 | avoid an implicit requirement on board code to wire things up in a | ||
13 | particular order. | ||
14 | 7 | ||
15 | Reported-by: Jose Martins <josemartins90@gmail.com> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Message-id: 20201009153904.28529-1-peter.maydell@linaro.org | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
18 | Reviewed-by: Luc Michel <luc@lmichel.fr> | 10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
11 | Message-id: 20200628142429.17111-9-peter.maydell@linaro.org | ||
19 | --- | 12 | --- |
20 | include/hw/intc/arm_gicv3_common.h | 1 - | 13 | include/hw/ssi/ssi.h | 26 ++++++++++++++++++++++++++ |
21 | hw/intc/arm_gicv3_cpuif.c | 5 ++--- | 14 | hw/ssi/ssi.c | 7 ++++++- |
22 | 2 files changed, 2 insertions(+), 4 deletions(-) | 15 | 2 files changed, 32 insertions(+), 1 deletion(-) |
23 | 16 | ||
24 | diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h | 17 | diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h |
25 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/intc/arm_gicv3_common.h | 19 | --- a/include/hw/ssi/ssi.h |
27 | +++ b/include/hw/intc/arm_gicv3_common.h | 20 | +++ b/include/hw/ssi/ssi.h |
28 | @@ -XXX,XX +XXX,XX @@ struct GICv3CPUState { | 21 | @@ -XXX,XX +XXX,XX @@ extern const VMStateDescription vmstate_ssi_slave; |
29 | qemu_irq parent_fiq; | 22 | } |
30 | qemu_irq parent_virq; | 23 | |
31 | qemu_irq parent_vfiq; | 24 | DeviceState *ssi_create_slave(SSIBus *bus, const char *name); |
32 | - qemu_irq maintenance_irq; | 25 | +/** |
33 | 26 | + * ssi_realize_and_unref: realize and unref an SSI slave device | |
34 | /* Redistributor */ | 27 | + * @dev: SSI slave device to realize |
35 | uint32_t level; /* Current IRQ level */ | 28 | + * @bus: SSI bus to put it on |
36 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 29 | + * @errp: error pointer |
30 | + * | ||
31 | + * Call 'realize' on @dev, put it on the specified @bus, and drop the | ||
32 | + * reference to it. Errors are reported via @errp and by returning | ||
33 | + * false. | ||
34 | + * | ||
35 | + * This function is useful if you have created @dev via qdev_new() | ||
36 | + * (which takes a reference to the device it returns to you), so that | ||
37 | + * you can set properties on it before realizing it. If you don't need | ||
38 | + * to set properties then ssi_create_slave() is probably better (as it | ||
39 | + * does the create, init and realize in one step). | ||
40 | + * | ||
41 | + * If you are embedding the SSI slave into another QOM device and | ||
42 | + * initialized it via some variant on object_initialize_child() then | ||
43 | + * do not use this function, because that family of functions arrange | ||
44 | + * for the only reference to the child device to be held by the parent | ||
45 | + * via the child<> property, and so the reference-count-drop done here | ||
46 | + * would be incorrect. (Instead you would want ssi_realize(), which | ||
47 | + * doesn't currently exist but would be trivial to create if we had | ||
48 | + * any code that wanted it.) | ||
49 | + */ | ||
50 | +bool ssi_realize_and_unref(DeviceState *dev, SSIBus *bus, Error **errp); | ||
51 | |||
52 | /* Master interface. */ | ||
53 | SSIBus *ssi_create_bus(DeviceState *parent, const char *name); | ||
54 | diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 55 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/hw/intc/arm_gicv3_cpuif.c | 56 | --- a/hw/ssi/ssi.c |
39 | +++ b/hw/intc/arm_gicv3_cpuif.c | 57 | +++ b/hw/ssi/ssi.c |
40 | @@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs) | 58 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo ssi_slave_info = { |
41 | int irqlevel = 0; | 59 | .abstract = true, |
42 | int fiqlevel = 0; | 60 | }; |
43 | int maintlevel = 0; | 61 | |
44 | + ARMCPU *cpu = ARM_CPU(cs->cpu); | 62 | +bool ssi_realize_and_unref(DeviceState *dev, SSIBus *bus, Error **errp) |
45 | 63 | +{ | |
46 | idx = hppvi_index(cs); | 64 | + return qdev_realize_and_unref(dev, &bus->parent_obj, errp); |
47 | trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx); | 65 | +} |
48 | @@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs) | 66 | + |
49 | 67 | DeviceState *ssi_create_slave(SSIBus *bus, const char *name) | |
50 | qemu_set_irq(cs->parent_vfiq, fiqlevel); | 68 | { |
51 | qemu_set_irq(cs->parent_virq, irqlevel); | 69 | DeviceState *dev = qdev_new(name); |
52 | - qemu_set_irq(cs->maintenance_irq, maintlevel); | 70 | |
53 | + qemu_set_irq(cpu->gicv3_maintenance_interrupt, maintlevel); | 71 | - qdev_realize_and_unref(dev, &bus->parent_obj, &error_fatal); |
72 | + ssi_realize_and_unref(dev, bus, &error_fatal); | ||
73 | return dev; | ||
54 | } | 74 | } |
55 | 75 | ||
56 | static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
57 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s) | ||
58 | && cpu->gic_num_lrs) { | ||
59 | int j; | ||
60 | |||
61 | - cs->maintenance_irq = cpu->gicv3_maintenance_interrupt; | ||
62 | - | ||
63 | cs->num_list_regs = cpu->gic_num_lrs; | ||
64 | cs->vpribits = cpu->gic_vpribits; | ||
65 | cs->vprebits = cpu->gic_vprebits; | ||
66 | -- | 76 | -- |
67 | 2.20.1 | 77 | 2.20.1 |
68 | 78 | ||
69 | 79 | diff view generated by jsdifflib |
1 | On some hosts (eg Ubuntu Bionic) pkg-config returns a set of | 1 | Use the new max111x qdev properties to set the initial input |
---|---|---|---|
2 | libraries for gio-2.0 which don't actually work when compiling | 2 | values rather than calling max111x_set_input(); this means that |
3 | statically. (Specifically, the returned library string includes | 3 | on system reset the inputs will correctly return to their initial |
4 | -lmount, but not -lblkid which -lmount depends upon, so linking | 4 | values. |
5 | fails due to missing symbols.) | ||
6 | |||
7 | Check that the libraries work, and don't enable gio if they don't, | ||
8 | in the same way we do for gnutls. | ||
9 | 5 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Message-id: 20200628142429.17111-10-peter.maydell@linaro.org |
13 | Message-id: 20200928160402.7961-1-peter.maydell@linaro.org | ||
14 | --- | 9 | --- |
15 | configure | 10 +++++++++- | 10 | hw/arm/spitz.c | 11 +++++++---- |
16 | 1 file changed, 9 insertions(+), 1 deletion(-) | 11 | 1 file changed, 7 insertions(+), 4 deletions(-) |
17 | 12 | ||
18 | diff --git a/configure b/configure | 13 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
19 | index XXXXXXX..XXXXXXX 100755 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/configure | 15 | --- a/hw/arm/spitz.c |
21 | +++ b/configure | 16 | +++ b/hw/arm/spitz.c |
22 | @@ -XXX,XX +XXX,XX @@ if test "$static" = yes && test "$mingw32" = yes; then | 17 | @@ -XXX,XX +XXX,XX @@ static void spitz_ssp_attach(SpitzMachineState *sms) |
23 | fi | 18 | qdev_get_gpio_in(sms->mpu->gpio, SPITZ_GPIO_TP_INT)); |
24 | 19 | ||
25 | if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then | 20 | bus = qdev_get_child_bus(sms->mux, "ssi2"); |
26 | - gio=yes | 21 | - sms->max1111 = ssi_create_slave(bus, "max1111"); |
27 | gio_cflags=$($pkg_config --cflags gio-2.0) | 22 | + sms->max1111 = qdev_new("max1111"); |
28 | gio_libs=$($pkg_config --libs gio-2.0) | 23 | max1111 = sms->max1111; |
29 | gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) | 24 | - max111x_set_input(sms->max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT); |
30 | if [ ! -x "$gdbus_codegen" ]; then | 25 | - max111x_set_input(sms->max1111, MAX1111_BATT_TEMP, 0); |
31 | gdbus_codegen= | 26 | - max111x_set_input(sms->max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN); |
32 | fi | 27 | + qdev_prop_set_uint8(sms->max1111, "input1" /* BATT_VOLT */, |
33 | + # Check that the libraries actually work -- Ubuntu 18.04 ships | 28 | + SPITZ_BATTERY_VOLT); |
34 | + # with pkg-config --static --libs data for gio-2.0 that is missing | 29 | + qdev_prop_set_uint8(sms->max1111, "input2" /* BATT_TEMP */, 0); |
35 | + # -lblkid and will give a link error. | 30 | + qdev_prop_set_uint8(sms->max1111, "input3" /* ACIN_VOLT */, |
36 | + write_c_skeleton | 31 | + SPITZ_CHARGEON_ACIN); |
37 | + if compile_prog "" "gio_libs" ; then | 32 | + ssi_realize_and_unref(sms->max1111, bus, &error_fatal); |
38 | + gio=yes | 33 | |
39 | + else | 34 | qdev_connect_gpio_out(sms->mpu->gpio, SPITZ_GPIO_LCDCON_CS, |
40 | + gio=no | 35 | qdev_get_gpio_in(sms->mux, 0)); |
41 | + fi | ||
42 | else | ||
43 | gio=no | ||
44 | fi | ||
45 | -- | 36 | -- |
46 | 2.20.1 | 37 | 2.20.1 |
47 | 38 | ||
48 | 39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The max111x ADC device model allows other code to set the level on |
---|---|---|---|
2 | the 8 ADC inputs using the max111x_set_input() function. Replace | ||
3 | this with generic qdev GPIO inputs, which also allow inputs to be set | ||
4 | to arbitrary values. | ||
2 | 5 | ||
3 | This will shortly have users outside of translate-neon.c.inc. | 6 | Using GPIO lines will make it easier for board code to wire things |
7 | up, so that if device A wants to set the ADC input it doesn't need to | ||
8 | have a direct pointer to the max111x but can just set that value on | ||
9 | its output GPIO, which is then wired up by the board to the | ||
10 | appropriate max111x input. | ||
4 | 11 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20201030022618.785675-3-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Message-id: 20200628142429.17111-11-peter.maydell@linaro.org | ||
9 | --- | 15 | --- |
10 | target/arm/translate.c | 20 ++++++++++++++++++++ | 16 | include/hw/ssi/ssi.h | 3 --- |
11 | target/arm/translate-neon.c.inc | 19 ------------------- | 17 | hw/arm/spitz.c | 9 +++++---- |
12 | 2 files changed, 20 insertions(+), 19 deletions(-) | 18 | hw/misc/max111x.c | 16 +++++++++------- |
19 | 3 files changed, 14 insertions(+), 14 deletions(-) | ||
13 | 20 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 21 | diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 23 | --- a/include/hw/ssi/ssi.h |
17 | +++ b/target/arm/translate.c | 24 | +++ b/include/hw/ssi/ssi.h |
18 | @@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg) | 25 | @@ -XXX,XX +XXX,XX @@ SSIBus *ssi_create_bus(DeviceState *parent, const char *name); |
19 | return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); | 26 | |
27 | uint32_t ssi_transfer(SSIBus *bus, uint32_t val); | ||
28 | |||
29 | -/* max111x.c */ | ||
30 | -void max111x_set_input(DeviceState *dev, int line, uint8_t value); | ||
31 | - | ||
32 | #endif | ||
33 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/arm/spitz.c | ||
36 | +++ b/hw/arm/spitz.c | ||
37 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_gpio_cs(void *opaque, int line, int level) | ||
38 | |||
39 | static void spitz_adc_temp_on(void *opaque, int line, int level) | ||
40 | { | ||
41 | + int batt_temp; | ||
42 | + | ||
43 | if (!max1111) | ||
44 | return; | ||
45 | |||
46 | - if (level) | ||
47 | - max111x_set_input(max1111, MAX1111_BATT_TEMP, SPITZ_BATTERY_TEMP); | ||
48 | - else | ||
49 | - max111x_set_input(max1111, MAX1111_BATT_TEMP, 0); | ||
50 | + batt_temp = level ? SPITZ_BATTERY_TEMP : 0; | ||
51 | + | ||
52 | + qemu_set_irq(qdev_get_gpio_in(max1111, MAX1111_BATT_TEMP), batt_temp); | ||
20 | } | 53 | } |
21 | 54 | ||
22 | +/* | 55 | static void corgi_ssp_realize(SSISlave *d, Error **errp) |
23 | + * Return the offset of a 2**SIZE piece of a NEON register, at index ELE, | 56 | diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c |
24 | + * where 0 is the least significant end of the register. | 57 | index XXXXXXX..XXXXXXX 100644 |
25 | + */ | 58 | --- a/hw/misc/max111x.c |
26 | +static long neon_element_offset(int reg, int element, MemOp size) | 59 | +++ b/hw/misc/max111x.c |
60 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_max111x = { | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | +static void max111x_input_set(void *opaque, int line, int value) | ||
27 | +{ | 65 | +{ |
28 | + int element_size = 1 << size; | 66 | + MAX111xState *s = MAX_111X(opaque); |
29 | + int ofs = element * element_size; | 67 | + |
30 | +#ifdef HOST_WORDS_BIGENDIAN | 68 | + assert(line >= 0 && line < s->inputs); |
31 | + /* | 69 | + s->input[line] = value; |
32 | + * Calculate the offset assuming fully little-endian, | ||
33 | + * then XOR to account for the order of the 8-byte units. | ||
34 | + */ | ||
35 | + if (element_size < 8) { | ||
36 | + ofs ^= 8 - element_size; | ||
37 | + } | ||
38 | +#endif | ||
39 | + return neon_full_reg_offset(reg) + ofs; | ||
40 | +} | 70 | +} |
41 | + | 71 | + |
42 | static inline long vfp_reg_offset(bool dp, unsigned reg) | 72 | static int max111x_init(SSISlave *d, int inputs) |
43 | { | 73 | { |
44 | if (dp) { | 74 | DeviceState *dev = DEVICE(d); |
45 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 75 | MAX111xState *s = MAX_111X(dev); |
46 | index XXXXXXX..XXXXXXX 100644 | 76 | |
47 | --- a/target/arm/translate-neon.c.inc | 77 | qdev_init_gpio_out(dev, &s->interrupt, 1); |
48 | +++ b/target/arm/translate-neon.c.inc | 78 | + qdev_init_gpio_in(dev, max111x_input_set, inputs); |
49 | @@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x) | 79 | |
50 | #include "decode-neon-ls.c.inc" | 80 | s->inputs = inputs; |
51 | #include "decode-neon-shared.c.inc" | 81 | |
52 | 82 | @@ -XXX,XX +XXX,XX @@ static void max1111_realize(SSISlave *dev, Error **errp) | |
53 | -/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, | 83 | max111x_init(dev, 4); |
54 | - * where 0 is the least significant end of the register. | 84 | } |
55 | - */ | 85 | |
56 | -static inline long | 86 | -void max111x_set_input(DeviceState *dev, int line, uint8_t value) |
57 | -neon_element_offset(int reg, int element, MemOp size) | ||
58 | -{ | 87 | -{ |
59 | - int element_size = 1 << size; | 88 | - MAX111xState *s = MAX_111X(dev); |
60 | - int ofs = element * element_size; | 89 | - assert(line >= 0 && line < s->inputs); |
61 | -#ifdef HOST_WORDS_BIGENDIAN | 90 | - s->input[line] = value; |
62 | - /* Calculate the offset assuming fully little-endian, | ||
63 | - * then XOR to account for the order of the 8-byte units. | ||
64 | - */ | ||
65 | - if (element_size < 8) { | ||
66 | - ofs ^= 8 - element_size; | ||
67 | - } | ||
68 | -#endif | ||
69 | - return neon_full_reg_offset(reg) + ofs; | ||
70 | -} | 91 | -} |
71 | - | 92 | - |
72 | static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) | 93 | static void max111x_reset(DeviceState *dev) |
73 | { | 94 | { |
74 | long offset = neon_element_offset(reg, ele, mop & MO_SIZE); | 95 | MAX111xState *s = MAX_111X(dev); |
75 | -- | 96 | -- |
76 | 2.20.1 | 97 | 2.20.1 |
77 | 98 | ||
78 | 99 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | Create a header file for the hw/misc/max111x device, in the |
---|---|---|---|
2 | usual modern style for QOM devices: | ||
3 | * definition of the TYPE_ constants and macros | ||
4 | * definition of the device's state struct so that it can | ||
5 | be embedded in other structs if desired | ||
6 | * documentation of the interface | ||
2 | 7 | ||
3 | Use the BIT_ULL() macro to ensure we use 64-bit arithmetic. | 8 | This allows us to use TYPE_MAX_1111 in the spitz.c code rather |
4 | This fixes the following Coverity issue (OVERFLOW_BEFORE_WIDEN): | 9 | than the string "max1111". |
5 | 10 | ||
6 | CID 1432363 (#1 of 1): Unintentional integer overflow: | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20200628142429.17111-12-peter.maydell@linaro.org | ||
14 | --- | ||
15 | include/hw/misc/max111x.h | 56 +++++++++++++++++++++++++++++++++++++++ | ||
16 | hw/arm/spitz.c | 3 ++- | ||
17 | hw/misc/max111x.c | 24 +---------------- | ||
18 | MAINTAINERS | 1 + | ||
19 | 4 files changed, 60 insertions(+), 24 deletions(-) | ||
20 | create mode 100644 include/hw/misc/max111x.h | ||
7 | 21 | ||
8 | overflow_before_widen: | 22 | diff --git a/include/hw/misc/max111x.h b/include/hw/misc/max111x.h |
9 | Potentially overflowing expression 1 << scale with type int | 23 | new file mode 100644 |
10 | (32 bits, signed) is evaluated using 32-bit arithmetic, and | 24 | index XXXXXXX..XXXXXXX |
11 | then used in a context that expects an expression of type | 25 | --- /dev/null |
12 | hwaddr (64 bits, unsigned). | 26 | +++ b/include/hw/misc/max111x.h |
13 | 27 | @@ -XXX,XX +XXX,XX @@ | |
14 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 28 | +/* |
15 | Acked-by: Eric Auger <eric.auger@redhat.com> | 29 | + * Maxim MAX1110/1111 ADC chip emulation. |
16 | Message-id: 20201030144617.1535064-1-philmd@redhat.com | 30 | + * |
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 31 | + * Copyright (c) 2006 Openedhand Ltd. |
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | + * Written by Andrzej Zaborowski <balrog@zabor.org> |
19 | --- | 33 | + * |
20 | hw/arm/smmuv3.c | 3 ++- | 34 | + * This code is licensed under the GNU GPLv2. |
21 | 1 file changed, 2 insertions(+), 1 deletion(-) | 35 | + * |
22 | 36 | + * Contributions after 2012-01-13 are licensed under the terms of the | |
23 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 37 | + * GNU GPL, version 2 or (at your option) any later version. |
38 | + */ | ||
39 | + | ||
40 | +#ifndef HW_MISC_MAX111X_H | ||
41 | +#define HW_MISC_MAX111X_H | ||
42 | + | ||
43 | +#include "hw/ssi/ssi.h" | ||
44 | + | ||
45 | +/* | ||
46 | + * This is a model of the Maxim MAX1110/1111 ADC chip, which for QEMU | ||
47 | + * is an SSI slave device. It has either 4 (max1110) or 8 (max1111) | ||
48 | + * 8-bit ADC channels. | ||
49 | + * | ||
50 | + * QEMU interface: | ||
51 | + * + GPIO inputs 0..3 (for max1110) or 0..7 (for max1111): set the value | ||
52 | + * of each ADC input, as an unsigned 8-bit value | ||
53 | + * + GPIO output 0: interrupt line | ||
54 | + * + Properties "input0" to "input3" (max1110) or "input0" to "input7" | ||
55 | + * (max1111): initial reset values for ADC inputs. | ||
56 | + * | ||
57 | + * Known bugs: | ||
58 | + * + the interrupt line is not correctly implemented, and will never | ||
59 | + * be lowered once it has been asserted. | ||
60 | + */ | ||
61 | +typedef struct { | ||
62 | + SSISlave parent_obj; | ||
63 | + | ||
64 | + qemu_irq interrupt; | ||
65 | + /* Values of inputs at system reset (settable by QOM property) */ | ||
66 | + uint8_t reset_input[8]; | ||
67 | + | ||
68 | + uint8_t tb1, rb2, rb3; | ||
69 | + int cycle; | ||
70 | + | ||
71 | + uint8_t input[8]; | ||
72 | + int inputs, com; | ||
73 | +} MAX111xState; | ||
74 | + | ||
75 | +#define TYPE_MAX_111X "max111x" | ||
76 | + | ||
77 | +#define MAX_111X(obj) \ | ||
78 | + OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X) | ||
79 | + | ||
80 | +#define TYPE_MAX_1110 "max1110" | ||
81 | +#define TYPE_MAX_1111 "max1111" | ||
82 | + | ||
83 | +#endif | ||
84 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | 85 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/arm/smmuv3.c | 86 | --- a/hw/arm/spitz.c |
26 | +++ b/hw/arm/smmuv3.c | 87 | +++ b/hw/arm/spitz.c |
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | #include "audio/audio.h" | ||
90 | #include "hw/boards.h" | ||
91 | #include "hw/sysbus.h" | ||
92 | +#include "hw/misc/max111x.h" | ||
93 | #include "migration/vmstate.h" | ||
94 | #include "exec/address-spaces.h" | ||
95 | #include "cpu.h" | ||
96 | @@ -XXX,XX +XXX,XX @@ static void spitz_ssp_attach(SpitzMachineState *sms) | ||
97 | qdev_get_gpio_in(sms->mpu->gpio, SPITZ_GPIO_TP_INT)); | ||
98 | |||
99 | bus = qdev_get_child_bus(sms->mux, "ssi2"); | ||
100 | - sms->max1111 = qdev_new("max1111"); | ||
101 | + sms->max1111 = qdev_new(TYPE_MAX_1111); | ||
102 | max1111 = sms->max1111; | ||
103 | qdev_prop_set_uint8(sms->max1111, "input1" /* BATT_VOLT */, | ||
104 | SPITZ_BATTERY_VOLT); | ||
105 | diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/hw/misc/max111x.c | ||
108 | +++ b/hw/misc/max111x.c | ||
27 | @@ -XXX,XX +XXX,XX @@ | 109 | @@ -XXX,XX +XXX,XX @@ |
28 | */ | 110 | */ |
29 | 111 | ||
30 | #include "qemu/osdep.h" | 112 | #include "qemu/osdep.h" |
31 | +#include "qemu/bitops.h" | 113 | +#include "hw/misc/max111x.h" |
32 | #include "hw/irq.h" | 114 | #include "hw/irq.h" |
33 | #include "hw/sysbus.h" | 115 | -#include "hw/ssi/ssi.h" |
34 | #include "migration/vmstate.h" | 116 | #include "migration/vmstate.h" |
35 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd) | 117 | #include "qemu/module.h" |
36 | scale = CMD_SCALE(cmd); | 118 | #include "hw/qdev-properties.h" |
37 | num = CMD_NUM(cmd); | 119 | |
38 | ttl = CMD_TTL(cmd); | 120 | -typedef struct { |
39 | - num_pages = (num + 1) * (1 << (scale)); | 121 | - SSISlave parent_obj; |
40 | + num_pages = (num + 1) * BIT_ULL(scale); | 122 | - |
41 | } | 123 | - qemu_irq interrupt; |
42 | 124 | - /* Values of inputs at system reset (settable by QOM property) */ | |
43 | if (type == SMMU_CMD_TLBI_NH_VA) { | 125 | - uint8_t reset_input[8]; |
126 | - | ||
127 | - uint8_t tb1, rb2, rb3; | ||
128 | - int cycle; | ||
129 | - | ||
130 | - uint8_t input[8]; | ||
131 | - int inputs, com; | ||
132 | -} MAX111xState; | ||
133 | - | ||
134 | -#define TYPE_MAX_111X "max111x" | ||
135 | - | ||
136 | -#define MAX_111X(obj) \ | ||
137 | - OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X) | ||
138 | - | ||
139 | -#define TYPE_MAX_1110 "max1110" | ||
140 | -#define TYPE_MAX_1111 "max1111" | ||
141 | - | ||
142 | /* Control-byte bitfields */ | ||
143 | #define CB_PD0 (1 << 0) | ||
144 | #define CB_PD1 (1 << 1) | ||
145 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
146 | index XXXXXXX..XXXXXXX 100644 | ||
147 | --- a/MAINTAINERS | ||
148 | +++ b/MAINTAINERS | ||
149 | @@ -XXX,XX +XXX,XX @@ F: hw/gpio/max7310.c | ||
150 | F: hw/gpio/zaurus.c | ||
151 | F: hw/misc/mst_fpga.c | ||
152 | F: hw/misc/max111x.c | ||
153 | +F: include/hw/misc/max111x.h | ||
154 | F: include/hw/arm/pxa.h | ||
155 | F: include/hw/arm/sharpsl.h | ||
156 | F: include/hw/display/tc6393xb.h | ||
44 | -- | 157 | -- |
45 | 2.20.1 | 158 | 2.20.1 |
46 | 159 | ||
47 | 160 | diff view generated by jsdifflib |
1 | In arm_v7m_mmu_idx_for_secstate() we get the 'priv' level to pass to | 1 | Currently we have a free-floating set of IRQs and a function |
---|---|---|---|
2 | armv7m_mmu_idx_for_secstate_and_priv() by calling arm_current_el(). | 2 | spitz_out_switch() which handle some miscellaneous GPIO lines for the |
3 | This is incorrect when the security state being queried is not the | 3 | spitz board. Encapsulate this behaviour in a simple QOM device. |
4 | current one, because arm_current_el() uses the current security state | 4 | |
5 | to determine which of the banked CONTROL.nPRIV bits to look at. | 5 | At this point we can finally remove the 'max1111' global, because the |
6 | The effect was that if (for instance) Secure state was in privileged | 6 | ADC battery-temperature value is now handled by the misc-gpio device |
7 | mode but Non-Secure was not then we would return the wrong MMU index. | 7 | writing the value to its outbound "adc-temp" GPIO, which the board |
8 | 8 | code wires up to the appropriate inbound GPIO line on the max1111. | |
9 | The only places where we are using this function in a way that could | 9 | |
10 | trigger this bug are for the stack loads during a v8M function-return | 10 | This commit also fixes Coverity issue CID 1421913 (which pointed out |
11 | and for the instruction fetch of a v8M SG insn. | 11 | that the 'outsignals' in spitz_scoop_gpio_setup() were leaked), |
12 | 12 | because it removes the use of the qemu_allocate_irqs() API from this | |
13 | Fix the bug by expanding out the M-profile version of the | 13 | code entirely. |
14 | arm_current_el() logic inline so it can use the passed in secstate | ||
15 | rather than env->v7m.secure. | ||
16 | 14 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
19 | Message-id: 20201022164408.13214-1-peter.maydell@linaro.org | 17 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
18 | Message-id: 20200628142429.17111-13-peter.maydell@linaro.org | ||
20 | --- | 19 | --- |
21 | target/arm/m_helper.c | 3 ++- | 20 | hw/arm/spitz.c | 129 +++++++++++++++++++++++++++++++++---------------- |
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | 21 | 1 file changed, 87 insertions(+), 42 deletions(-) |
23 | 22 | ||
24 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | 23 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
25 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/m_helper.c | 25 | --- a/hw/arm/spitz.c |
27 | +++ b/target/arm/m_helper.c | 26 | +++ b/hw/arm/spitz.c |
28 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | 27 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
29 | /* Return the MMU index for a v7M CPU in the specified security state */ | 28 | DeviceState *max1111; |
30 | ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) | 29 | DeviceState *scp0; |
31 | { | 30 | DeviceState *scp1; |
32 | - bool priv = arm_current_el(env) != 0; | 31 | + DeviceState *misc_gpio; |
33 | + bool priv = arm_v7m_is_handler_mode(env) || | 32 | } SpitzMachineState; |
34 | + !(env->v7m.control[secstate] & 1); | 33 | |
35 | 34 | #define TYPE_SPITZ_MACHINE "spitz-common" | |
36 | return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv); | 35 | @@ -XXX,XX +XXX,XX @@ static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) |
36 | #define SPITZ_GPIO_MAX1111_CS 20 | ||
37 | #define SPITZ_GPIO_TP_INT 11 | ||
38 | |||
39 | -static DeviceState *max1111; | ||
40 | - | ||
41 | /* "Demux" the signal based on current chipselect */ | ||
42 | typedef struct { | ||
43 | SSISlave ssidev; | ||
44 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_gpio_cs(void *opaque, int line, int level) | ||
45 | #define SPITZ_BATTERY_VOLT 0xd0 /* About 4.0V */ | ||
46 | #define SPITZ_CHARGEON_ACIN 0x80 /* About 5.0V */ | ||
47 | |||
48 | -static void spitz_adc_temp_on(void *opaque, int line, int level) | ||
49 | -{ | ||
50 | - int batt_temp; | ||
51 | - | ||
52 | - if (!max1111) | ||
53 | - return; | ||
54 | - | ||
55 | - batt_temp = level ? SPITZ_BATTERY_TEMP : 0; | ||
56 | - | ||
57 | - qemu_set_irq(qdev_get_gpio_in(max1111, MAX1111_BATT_TEMP), batt_temp); | ||
58 | -} | ||
59 | - | ||
60 | static void corgi_ssp_realize(SSISlave *d, Error **errp) | ||
61 | { | ||
62 | DeviceState *dev = DEVICE(d); | ||
63 | @@ -XXX,XX +XXX,XX @@ static void spitz_ssp_attach(SpitzMachineState *sms) | ||
64 | |||
65 | bus = qdev_get_child_bus(sms->mux, "ssi2"); | ||
66 | sms->max1111 = qdev_new(TYPE_MAX_1111); | ||
67 | - max1111 = sms->max1111; | ||
68 | qdev_prop_set_uint8(sms->max1111, "input1" /* BATT_VOLT */, | ||
69 | SPITZ_BATTERY_VOLT); | ||
70 | qdev_prop_set_uint8(sms->max1111, "input2" /* BATT_TEMP */, 0); | ||
71 | @@ -XXX,XX +XXX,XX @@ static void spitz_akita_i2c_setup(PXA2xxState *cpu) | ||
72 | |||
73 | /* Other peripherals */ | ||
74 | |||
75 | -static void spitz_out_switch(void *opaque, int line, int level) | ||
76 | +/* | ||
77 | + * Encapsulation of some miscellaneous GPIO line behaviour for the Spitz boards. | ||
78 | + * | ||
79 | + * QEMU interface: | ||
80 | + * + named GPIO inputs "green-led", "orange-led", "charging", "discharging": | ||
81 | + * these currently just print messages that the line has been signalled | ||
82 | + * + named GPIO input "adc-temp-on": set to cause the battery-temperature | ||
83 | + * value to be passed to the max111x ADC | ||
84 | + * + named GPIO output "adc-temp": the ADC value, to be wired up to the max111x | ||
85 | + */ | ||
86 | +#define TYPE_SPITZ_MISC_GPIO "spitz-misc-gpio" | ||
87 | +#define SPITZ_MISC_GPIO(obj) \ | ||
88 | + OBJECT_CHECK(SpitzMiscGPIOState, (obj), TYPE_SPITZ_MISC_GPIO) | ||
89 | + | ||
90 | +typedef struct SpitzMiscGPIOState { | ||
91 | + SysBusDevice parent_obj; | ||
92 | + | ||
93 | + qemu_irq adc_value; | ||
94 | +} SpitzMiscGPIOState; | ||
95 | + | ||
96 | +static void spitz_misc_charging(void *opaque, int n, int level) | ||
97 | { | ||
98 | - switch (line) { | ||
99 | - case 0: | ||
100 | - zaurus_printf("Charging %s.\n", level ? "off" : "on"); | ||
101 | - break; | ||
102 | - case 1: | ||
103 | - zaurus_printf("Discharging %s.\n", level ? "on" : "off"); | ||
104 | - break; | ||
105 | - case 2: | ||
106 | - zaurus_printf("Green LED %s.\n", level ? "on" : "off"); | ||
107 | - break; | ||
108 | - case 3: | ||
109 | - zaurus_printf("Orange LED %s.\n", level ? "on" : "off"); | ||
110 | - break; | ||
111 | - case 6: | ||
112 | - spitz_adc_temp_on(opaque, line, level); | ||
113 | - break; | ||
114 | - default: | ||
115 | - g_assert_not_reached(); | ||
116 | - } | ||
117 | + zaurus_printf("Charging %s.\n", level ? "off" : "on"); | ||
118 | +} | ||
119 | + | ||
120 | +static void spitz_misc_discharging(void *opaque, int n, int level) | ||
121 | +{ | ||
122 | + zaurus_printf("Discharging %s.\n", level ? "off" : "on"); | ||
123 | +} | ||
124 | + | ||
125 | +static void spitz_misc_green_led(void *opaque, int n, int level) | ||
126 | +{ | ||
127 | + zaurus_printf("Green LED %s.\n", level ? "off" : "on"); | ||
128 | +} | ||
129 | + | ||
130 | +static void spitz_misc_orange_led(void *opaque, int n, int level) | ||
131 | +{ | ||
132 | + zaurus_printf("Orange LED %s.\n", level ? "off" : "on"); | ||
133 | +} | ||
134 | + | ||
135 | +static void spitz_misc_adc_temp(void *opaque, int n, int level) | ||
136 | +{ | ||
137 | + SpitzMiscGPIOState *s = SPITZ_MISC_GPIO(opaque); | ||
138 | + int batt_temp = level ? SPITZ_BATTERY_TEMP : 0; | ||
139 | + | ||
140 | + qemu_set_irq(s->adc_value, batt_temp); | ||
141 | +} | ||
142 | + | ||
143 | +static void spitz_misc_gpio_init(Object *obj) | ||
144 | +{ | ||
145 | + SpitzMiscGPIOState *s = SPITZ_MISC_GPIO(obj); | ||
146 | + DeviceState *dev = DEVICE(obj); | ||
147 | + | ||
148 | + qdev_init_gpio_in_named(dev, spitz_misc_charging, "charging", 1); | ||
149 | + qdev_init_gpio_in_named(dev, spitz_misc_discharging, "discharging", 1); | ||
150 | + qdev_init_gpio_in_named(dev, spitz_misc_green_led, "green-led", 1); | ||
151 | + qdev_init_gpio_in_named(dev, spitz_misc_orange_led, "orange-led", 1); | ||
152 | + qdev_init_gpio_in_named(dev, spitz_misc_adc_temp, "adc-temp-on", 1); | ||
153 | + | ||
154 | + qdev_init_gpio_out_named(dev, &s->adc_value, "adc-temp", 1); | ||
37 | } | 155 | } |
156 | |||
157 | #define SPITZ_SCP_LED_GREEN 1 | ||
158 | @@ -XXX,XX +XXX,XX @@ static void spitz_out_switch(void *opaque, int line, int level) | ||
159 | |||
160 | static void spitz_scoop_gpio_setup(SpitzMachineState *sms) | ||
161 | { | ||
162 | - qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, sms->mpu, 8); | ||
163 | + DeviceState *miscdev = sysbus_create_simple(TYPE_SPITZ_MISC_GPIO, -1, NULL); | ||
164 | |||
165 | - qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_CHRG_ON, outsignals[0]); | ||
166 | - qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_JK_B, outsignals[1]); | ||
167 | - qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_GREEN, outsignals[2]); | ||
168 | - qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]); | ||
169 | + sms->misc_gpio = miscdev; | ||
170 | + | ||
171 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_CHRG_ON, | ||
172 | + qdev_get_gpio_in_named(miscdev, "charging", 0)); | ||
173 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_JK_B, | ||
174 | + qdev_get_gpio_in_named(miscdev, "discharging", 0)); | ||
175 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_GREEN, | ||
176 | + qdev_get_gpio_in_named(miscdev, "green-led", 0)); | ||
177 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_LED_ORANGE, | ||
178 | + qdev_get_gpio_in_named(miscdev, "orange-led", 0)); | ||
179 | + qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_ADC_TEMP_ON, | ||
180 | + qdev_get_gpio_in_named(miscdev, "adc-temp-on", 0)); | ||
181 | + qdev_connect_gpio_out_named(miscdev, "adc-temp", 0, | ||
182 | + qdev_get_gpio_in(sms->max1111, MAX1111_BATT_TEMP)); | ||
183 | |||
184 | if (sms->scp1) { | ||
185 | qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_CONT, | ||
186 | @@ -XXX,XX +XXX,XX @@ static void spitz_scoop_gpio_setup(SpitzMachineState *sms) | ||
187 | qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_ON, | ||
188 | qdev_get_gpio_in_named(sms->lcdtg, "bl_power", 0)); | ||
189 | } | ||
190 | - | ||
191 | - qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); | ||
192 | } | ||
193 | |||
194 | #define SPITZ_GPIO_HSYNC 22 | ||
195 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo spitz_lcdtg_info = { | ||
196 | .class_init = spitz_lcdtg_class_init, | ||
197 | }; | ||
198 | |||
199 | +static const TypeInfo spitz_misc_gpio_info = { | ||
200 | + .name = TYPE_SPITZ_MISC_GPIO, | ||
201 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
202 | + .instance_size = sizeof(SpitzMiscGPIOState), | ||
203 | + .instance_init = spitz_misc_gpio_init, | ||
204 | + /* | ||
205 | + * No class_init required: device has no internal state so does not | ||
206 | + * need to set up reset or vmstate, and does not have a realize method. | ||
207 | + */ | ||
208 | +}; | ||
209 | + | ||
210 | static void spitz_register_types(void) | ||
211 | { | ||
212 | type_register_static(&corgi_ssp_info); | ||
213 | type_register_static(&spitz_lcdtg_info); | ||
214 | type_register_static(&spitz_keyboard_info); | ||
215 | type_register_static(&sl_nand_info); | ||
216 | + type_register_static(&spitz_misc_gpio_info); | ||
217 | } | ||
218 | |||
219 | type_init(spitz_register_types) | ||
38 | -- | 220 | -- |
39 | 2.20.1 | 221 | 2.20.1 |
40 | 222 | ||
41 | 223 | diff view generated by jsdifflib |
1 | Sphinx 3.2 is pickier than earlier versions about the option:: markup, | 1 | Instead of logging guest accesses to invalid register offsets in this |
---|---|---|---|
2 | and complains about our usage in qemu-option-trace.rst: | 2 | device using zaurus_printf() (which just prints to stderr), use the |
3 | usual qemu_log_mask(LOG_GUEST_ERROR,...). | ||
3 | 4 | ||
4 | ../../docs/qemu-option-trace.rst.inc:4:Malformed option description | 5 | Since this was the only use of the zaurus_printf() macro outside |
5 | '[enable=]PATTERN', should look like "opt", "-opt args", "--opt args", | 6 | spitz.c, we can move the definition of that macro from sharpsl.h |
6 | "/opt args" or "+opt args" | 7 | to spitz.c. |
7 | |||
8 | In this file, we're really trying to document the different parts of | ||
9 | the top-level --trace option, which qemu-nbd.rst and qemu-img.rst | ||
10 | have already introduced with an option:: markup. So it's not right | ||
11 | to use option:: here anyway. Switch to a different markup | ||
12 | (definition lists) which gives about the same formatted output. | ||
13 | |||
14 | (Unlike option::, this markup doesn't produce index entries; but | ||
15 | at the moment we don't do anything much with indexes anyway, and | ||
16 | in any case I think it doesn't make much sense to have individual | ||
17 | index entries for the sub-parts of the --trace option.) | ||
18 | 8 | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
21 | Tested-by: Stefan Hajnoczi <stefanha@redhat.com> | 11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
22 | Message-id: 20201030174700.7204-3-peter.maydell@linaro.org | 12 | Message-id: 20200628142429.17111-14-peter.maydell@linaro.org |
23 | --- | 13 | --- |
24 | docs/qemu-option-trace.rst.inc | 6 +++--- | 14 | include/hw/arm/sharpsl.h | 3 --- |
25 | 1 file changed, 3 insertions(+), 3 deletions(-) | 15 | hw/arm/spitz.c | 3 +++ |
16 | hw/gpio/zaurus.c | 12 +++++++----- | ||
17 | 3 files changed, 10 insertions(+), 8 deletions(-) | ||
26 | 18 | ||
27 | diff --git a/docs/qemu-option-trace.rst.inc b/docs/qemu-option-trace.rst.inc | 19 | diff --git a/include/hw/arm/sharpsl.h b/include/hw/arm/sharpsl.h |
28 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/docs/qemu-option-trace.rst.inc | 21 | --- a/include/hw/arm/sharpsl.h |
30 | +++ b/docs/qemu-option-trace.rst.inc | 22 | +++ b/include/hw/arm/sharpsl.h |
31 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ |
32 | 24 | ||
33 | Specify tracing options. | 25 | #include "exec/hwaddr.h" |
34 | 26 | ||
35 | -.. option:: [enable=]PATTERN | 27 | -#define zaurus_printf(format, ...) \ |
36 | +``[enable=]PATTERN`` | 28 | - fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) |
37 | 29 | - | |
38 | Immediately enable events matching *PATTERN* | 30 | /* zaurus.c */ |
39 | (either event name or a globbing pattern). This option is only | 31 | |
40 | @@ -XXX,XX +XXX,XX @@ Specify tracing options. | 32 | #define SL_PXA_PARAM_BASE 0xa0000a00 |
41 | 33 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | |
42 | Use :option:`-trace help` to print a list of names of trace points. | 34 | index XXXXXXX..XXXXXXX 100644 |
43 | 35 | --- a/hw/arm/spitz.c | |
44 | -.. option:: events=FILE | 36 | +++ b/hw/arm/spitz.c |
45 | +``events=FILE`` | 37 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
46 | 38 | #define SPITZ_MACHINE_CLASS(klass) \ | |
47 | Immediately enable events listed in *FILE*. | 39 | OBJECT_CLASS_CHECK(SpitzMachineClass, klass, TYPE_SPITZ_MACHINE) |
48 | The file must contain one event name (as listed in the ``trace-events-all`` | 40 | |
49 | @@ -XXX,XX +XXX,XX @@ Specify tracing options. | 41 | +#define zaurus_printf(format, ...) \ |
50 | available if QEMU has been compiled with the ``simple``, ``log`` or | 42 | + fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) |
51 | ``ftrace`` tracing backend. | 43 | + |
52 | 44 | #undef REG_FMT | |
53 | -.. option:: file=FILE | 45 | #define REG_FMT "0x%02lx" |
54 | +``file=FILE`` | 46 | |
55 | 47 | diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c | |
56 | Log output traces to *FILE*. | 48 | index XXXXXXX..XXXXXXX 100644 |
57 | This option is only available if QEMU has been compiled with | 49 | --- a/hw/gpio/zaurus.c |
50 | +++ b/hw/gpio/zaurus.c | ||
51 | @@ -XXX,XX +XXX,XX @@ | ||
52 | #include "hw/sysbus.h" | ||
53 | #include "migration/vmstate.h" | ||
54 | #include "qemu/module.h" | ||
55 | - | ||
56 | -#undef REG_FMT | ||
57 | -#define REG_FMT "0x%02lx" | ||
58 | +#include "qemu/log.h" | ||
59 | |||
60 | /* SCOOP devices */ | ||
61 | |||
62 | @@ -XXX,XX +XXX,XX @@ static uint64_t scoop_read(void *opaque, hwaddr addr, | ||
63 | case SCOOP_GPRR: | ||
64 | return s->gpio_level; | ||
65 | default: | ||
66 | - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); | ||
67 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
68 | + "scoop_read: bad register offset 0x%02" HWADDR_PRIx "\n", | ||
69 | + addr); | ||
70 | } | ||
71 | |||
72 | return 0; | ||
73 | @@ -XXX,XX +XXX,XX @@ static void scoop_write(void *opaque, hwaddr addr, | ||
74 | scoop_gpio_handler_update(s); | ||
75 | break; | ||
76 | default: | ||
77 | - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); | ||
78 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
79 | + "scoop_write: bad register offset 0x%02" HWADDR_PRIx "\n", | ||
80 | + addr); | ||
81 | } | ||
82 | } | ||
83 | |||
58 | -- | 84 | -- |
59 | 2.20.1 | 85 | 2.20.1 |
60 | 86 | ||
61 | 87 | diff view generated by jsdifflib |
1 | If we're using the capstone disassembler, disassembly of a run of | 1 | Instead of logging guest accesses to invalid register offsets in the |
---|---|---|---|
2 | instructions more than 32 bytes long disassembles the wrong data for | 2 | Spitz flash device with zaurus_printf() (which just prints to stderr), |
3 | instructions beyond the 32 byte mark: | 3 | use the usual qemu_log_mask(LOG_GUEST_ERROR,...). |
4 | 4 | ||
5 | (qemu) xp /16x 0x100 | ||
6 | 0000000000000100: 0x00000005 0x54410001 0x00000001 0x00001000 | ||
7 | 0000000000000110: 0x00000000 0x00000004 0x54410002 0x3c000000 | ||
8 | 0000000000000120: 0x00000000 0x00000004 0x54410009 0x74736574 | ||
9 | 0000000000000130: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
10 | (qemu) xp /16i 0x100 | ||
11 | 0x00000100: 00000005 andeq r0, r0, r5 | ||
12 | 0x00000104: 54410001 strbpl r0, [r1], #-1 | ||
13 | 0x00000108: 00000001 andeq r0, r0, r1 | ||
14 | 0x0000010c: 00001000 andeq r1, r0, r0 | ||
15 | 0x00000110: 00000000 andeq r0, r0, r0 | ||
16 | 0x00000114: 00000004 andeq r0, r0, r4 | ||
17 | 0x00000118: 54410002 strbpl r0, [r1], #-2 | ||
18 | 0x0000011c: 3c000000 .byte 0x00, 0x00, 0x00, 0x3c | ||
19 | 0x00000120: 54410001 strbpl r0, [r1], #-1 | ||
20 | 0x00000124: 00000001 andeq r0, r0, r1 | ||
21 | 0x00000128: 00001000 andeq r1, r0, r0 | ||
22 | 0x0000012c: 00000000 andeq r0, r0, r0 | ||
23 | 0x00000130: 00000004 andeq r0, r0, r4 | ||
24 | 0x00000134: 54410002 strbpl r0, [r1], #-2 | ||
25 | 0x00000138: 3c000000 .byte 0x00, 0x00, 0x00, 0x3c | ||
26 | 0x0000013c: 00000000 andeq r0, r0, r0 | ||
27 | |||
28 | Here the disassembly of 0x120..0x13f is using the data that is in | ||
29 | 0x104..0x123. | ||
30 | |||
31 | This is caused by passing the wrong value to the read_memory_func(). | ||
32 | The intention is that at this point in the loop the 'cap_buf' buffer | ||
33 | already contains 'csize' bytes of data for the instruction at guest | ||
34 | addr 'pc', and we want to read in an extra 'tsize' bytes. Those | ||
35 | extra bytes are therefore at 'pc + csize', not 'pc'. On the first | ||
36 | time through the loop 'csize' happens to be zero, so the initial read | ||
37 | of 32 bytes into cap_buf is correct and as long as the disassembly | ||
38 | never needs to read more data we return the correct information. | ||
39 | |||
40 | Use the correct guest address in the call to read_memory_func(). | ||
41 | |||
42 | Cc: qemu-stable@nongnu.org | ||
43 | Fixes: https://bugs.launchpad.net/qemu/+bug/1900779 | ||
44 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
45 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
46 | Message-id: 20201022132445.25039-1-peter.maydell@linaro.org | 7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
8 | Message-id: 20200628142429.17111-15-peter.maydell@linaro.org | ||
47 | --- | 9 | --- |
48 | disas/capstone.c | 2 +- | 10 | hw/arm/spitz.c | 12 +++++++----- |
49 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 7 insertions(+), 5 deletions(-) |
50 | 12 | ||
51 | diff --git a/disas/capstone.c b/disas/capstone.c | 13 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
52 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
53 | --- a/disas/capstone.c | 15 | --- a/hw/arm/spitz.c |
54 | +++ b/disas/capstone.c | 16 | +++ b/hw/arm/spitz.c |
55 | @@ -XXX,XX +XXX,XX @@ bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count) | 17 | @@ -XXX,XX +XXX,XX @@ |
56 | 18 | #include "hw/ssi/ssi.h" | |
57 | /* Make certain that we can make progress. */ | 19 | #include "hw/block/flash.h" |
58 | assert(tsize != 0); | 20 | #include "qemu/timer.h" |
59 | - info->read_memory_func(pc, cap_buf + csize, tsize, info); | 21 | +#include "qemu/log.h" |
60 | + info->read_memory_func(pc + csize, cap_buf + csize, tsize, info); | 22 | #include "hw/arm/sharpsl.h" |
61 | csize += tsize; | 23 | #include "ui/console.h" |
62 | 24 | #include "hw/audio/wm8750.h" | |
63 | if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { | 25 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
26 | #define zaurus_printf(format, ...) \ | ||
27 | fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) | ||
28 | |||
29 | -#undef REG_FMT | ||
30 | -#define REG_FMT "0x%02lx" | ||
31 | - | ||
32 | /* Spitz Flash */ | ||
33 | #define FLASH_BASE 0x0c000000 | ||
34 | #define FLASH_ECCLPLB 0x00 /* Line parity 7 - 0 bit */ | ||
35 | @@ -XXX,XX +XXX,XX @@ static uint64_t sl_read(void *opaque, hwaddr addr, unsigned size) | ||
36 | return ecc_digest(&s->ecc, nand_getio(s->nand)); | ||
37 | |||
38 | default: | ||
39 | - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); | ||
40 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
41 | + "sl_read: bad register offset 0x%02" HWADDR_PRIx "\n", | ||
42 | + addr); | ||
43 | } | ||
44 | return 0; | ||
45 | } | ||
46 | @@ -XXX,XX +XXX,XX @@ static void sl_write(void *opaque, hwaddr addr, | ||
47 | break; | ||
48 | |||
49 | default: | ||
50 | - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); | ||
51 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
52 | + "sl_write: bad register offset 0x%02" HWADDR_PRIx "\n", | ||
53 | + addr); | ||
54 | } | ||
55 | } | ||
56 | |||
64 | -- | 57 | -- |
65 | 2.20.1 | 58 | 2.20.1 |
66 | 59 | ||
67 | 60 | diff view generated by jsdifflib |
1 | The helper functions for performing the udot/sdot operations against | 1 | Instead of using printf() for logging guest accesses to invalid |
---|---|---|---|
2 | a scalar were not using an address-swizzling macro when converting | 2 | register offsets in the pxa2xx PIC device, use the usual |
3 | the index of the scalar element into a pointer into the vm array. | 3 | qemu_log_mask(LOG_GUEST_ERROR,...). |
4 | This had no effect on little-endian hosts but meant we generated | ||
5 | incorrect results on big-endian hosts. | ||
6 | 4 | ||
7 | For these insns, the index is indexing over group of 4 8-bit values, | 5 | This was the only user of the REG_FMT macro in pxa.h, so we can |
8 | so 32 bits per indexed entity, and H4() is therefore what we want. | 6 | remove that. |
9 | (For Neon the only possible input indexes are 0 and 1.) | ||
10 | 7 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
14 | Message-id: 20201028191712.4910-3-peter.maydell@linaro.org | 10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
11 | Message-id: 20200628142429.17111-16-peter.maydell@linaro.org | ||
15 | --- | 12 | --- |
16 | target/arm/vec_helper.c | 4 ++-- | 13 | include/hw/arm/pxa.h | 1 - |
17 | 1 file changed, 2 insertions(+), 2 deletions(-) | 14 | hw/arm/pxa2xx_pic.c | 9 +++++++-- |
15 | 2 files changed, 7 insertions(+), 3 deletions(-) | ||
18 | 16 | ||
19 | diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c | 17 | diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/vec_helper.c | 19 | --- a/include/hw/arm/pxa.h |
22 | +++ b/target/arm/vec_helper.c | 20 | +++ b/include/hw/arm/pxa.h |
23 | @@ -XXX,XX +XXX,XX @@ void HELPER(gvec_sdot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc) | 21 | @@ -XXX,XX +XXX,XX @@ struct PXA2xxI2SState { |
24 | intptr_t index = simd_data(desc); | 22 | }; |
25 | uint32_t *d = vd; | 23 | |
26 | int8_t *n = vn; | 24 | # define PA_FMT "0x%08lx" |
27 | - int8_t *m_indexed = (int8_t *)vm + index * 4; | 25 | -# define REG_FMT "0x" TARGET_FMT_plx |
28 | + int8_t *m_indexed = (int8_t *)vm + H4(index) * 4; | 26 | |
29 | 27 | PXA2xxState *pxa270_init(MemoryRegion *address_space, unsigned int sdram_size, | |
30 | /* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd. | 28 | const char *revision); |
31 | * Otherwise opr_sz is a multiple of 16. | 29 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
32 | @@ -XXX,XX +XXX,XX @@ void HELPER(gvec_udot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc) | 30 | index XXXXXXX..XXXXXXX 100644 |
33 | intptr_t index = simd_data(desc); | 31 | --- a/hw/arm/pxa2xx_pic.c |
34 | uint32_t *d = vd; | 32 | +++ b/hw/arm/pxa2xx_pic.c |
35 | uint8_t *n = vn; | 33 | @@ -XXX,XX +XXX,XX @@ |
36 | - uint8_t *m_indexed = (uint8_t *)vm + index * 4; | 34 | #include "qemu/osdep.h" |
37 | + uint8_t *m_indexed = (uint8_t *)vm + H4(index) * 4; | 35 | #include "qapi/error.h" |
38 | 36 | #include "qemu/module.h" | |
39 | /* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd. | 37 | +#include "qemu/log.h" |
40 | * Otherwise opr_sz is a multiple of 16. | 38 | #include "cpu.h" |
39 | #include "hw/arm/pxa.h" | ||
40 | #include "hw/sysbus.h" | ||
41 | @@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_pic_mem_read(void *opaque, hwaddr offset, | ||
42 | case ICHP: /* Highest Priority register */ | ||
43 | return pxa2xx_pic_highest(s); | ||
44 | default: | ||
45 | - printf("%s: Bad register offset " REG_FMT "\n", __func__, offset); | ||
46 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
47 | + "pxa2xx_pic_mem_read: bad register offset 0x%" HWADDR_PRIx | ||
48 | + "\n", offset); | ||
49 | return 0; | ||
50 | } | ||
51 | } | ||
52 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pic_mem_write(void *opaque, hwaddr offset, | ||
53 | s->priority[32 + ((offset - IPR32) >> 2)] = value & 0x8000003f; | ||
54 | break; | ||
55 | default: | ||
56 | - printf("%s: Bad register offset " REG_FMT "\n", __func__, offset); | ||
57 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
58 | + "pxa2xx_pic_mem_write: bad register offset 0x%" | ||
59 | + HWADDR_PRIx "\n", offset); | ||
60 | return; | ||
61 | } | ||
62 | pxa2xx_pic_update(opaque); | ||
41 | -- | 63 | -- |
42 | 2.20.1 | 64 | 2.20.1 |
43 | 65 | ||
44 | 66 | diff view generated by jsdifflib |
1 | From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 1 | The QOM types "spitz-lcdtg" and "corgi-ssp" are missing the |
---|---|---|---|
2 | usual QOM TYPE and casting macros; provide and use them. | ||
2 | 3 | ||
3 | Secure mode is not exempted from checking SCR_EL3.TLOR, and in the | 4 | In particular, we can safely use the QOM cast macros instead of |
4 | future HCR_EL2.TLOR when S-EL2 is enabled. | 5 | FROM_SSI_SLAVE() because in both cases the 'ssidev' field of |
6 | the instance state struct is the first field in it. | ||
5 | 7 | ||
6 | Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | Message-id: 20200628142429.17111-17-peter.maydell@linaro.org | ||
9 | --- | 12 | --- |
10 | target/arm/helper.c | 19 +++++-------------- | 13 | hw/arm/spitz.c | 23 +++++++++++++++-------- |
11 | 1 file changed, 5 insertions(+), 14 deletions(-) | 14 | 1 file changed, 15 insertions(+), 8 deletions(-) |
12 | 15 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 16 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 18 | --- a/hw/arm/spitz.c |
16 | +++ b/target/arm/helper.c | 19 | +++ b/hw/arm/spitz.c |
17 | @@ -XXX,XX +XXX,XX @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) | 20 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_realize(DeviceState *dev, Error **errp) |
18 | #endif | 21 | #define LCDTG_PICTRL 0x06 |
19 | 22 | #define LCDTG_POLCTRL 0x07 | |
20 | /* Shared logic between LORID and the rest of the LOR* registers. | 23 | |
21 | - * Secure state has already been delt with. | 24 | +#define TYPE_SPITZ_LCDTG "spitz-lcdtg" |
22 | + * Secure state exclusion has already been dealt with. | 25 | +#define SPITZ_LCDTG(obj) OBJECT_CHECK(SpitzLCDTG, (obj), TYPE_SPITZ_LCDTG) |
23 | */ | 26 | + |
24 | -static CPAccessResult access_lor_ns(CPUARMState *env) | 27 | typedef struct { |
25 | +static CPAccessResult access_lor_ns(CPUARMState *env, | 28 | SSISlave ssidev; |
26 | + const ARMCPRegInfo *ri, bool isread) | 29 | uint32_t bl_intensity; |
30 | @@ -XXX,XX +XXX,XX @@ static inline void spitz_bl_power(void *opaque, int line, int level) | ||
31 | |||
32 | static uint32_t spitz_lcdtg_transfer(SSISlave *dev, uint32_t value) | ||
27 | { | 33 | { |
28 | int el = arm_current_el(env); | 34 | - SpitzLCDTG *s = FROM_SSI_SLAVE(SpitzLCDTG, dev); |
29 | 35 | + SpitzLCDTG *s = SPITZ_LCDTG(dev); | |
30 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_ns(CPUARMState *env) | 36 | int addr; |
31 | return CP_ACCESS_OK; | 37 | addr = value >> 5; |
38 | value &= 0x1f; | ||
39 | @@ -XXX,XX +XXX,XX @@ static uint32_t spitz_lcdtg_transfer(SSISlave *dev, uint32_t value) | ||
40 | |||
41 | static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) | ||
42 | { | ||
43 | - SpitzLCDTG *s = FROM_SSI_SLAVE(SpitzLCDTG, ssi); | ||
44 | + SpitzLCDTG *s = SPITZ_LCDTG(ssi); | ||
45 | DeviceState *dev = DEVICE(s); | ||
46 | |||
47 | s->bl_power = 0; | ||
48 | @@ -XXX,XX +XXX,XX @@ static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) | ||
49 | #define SPITZ_GPIO_MAX1111_CS 20 | ||
50 | #define SPITZ_GPIO_TP_INT 11 | ||
51 | |||
52 | +#define TYPE_CORGI_SSP "corgi-ssp" | ||
53 | +#define CORGI_SSP(obj) OBJECT_CHECK(CorgiSSPState, (obj), TYPE_CORGI_SSP) | ||
54 | + | ||
55 | /* "Demux" the signal based on current chipselect */ | ||
56 | typedef struct { | ||
57 | SSISlave ssidev; | ||
58 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
59 | |||
60 | static uint32_t corgi_ssp_transfer(SSISlave *dev, uint32_t value) | ||
61 | { | ||
62 | - CorgiSSPState *s = FROM_SSI_SLAVE(CorgiSSPState, dev); | ||
63 | + CorgiSSPState *s = CORGI_SSP(dev); | ||
64 | int i; | ||
65 | |||
66 | for (i = 0; i < 3; i++) { | ||
67 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_gpio_cs(void *opaque, int line, int level) | ||
68 | static void corgi_ssp_realize(SSISlave *d, Error **errp) | ||
69 | { | ||
70 | DeviceState *dev = DEVICE(d); | ||
71 | - CorgiSSPState *s = FROM_SSI_SLAVE(CorgiSSPState, d); | ||
72 | + CorgiSSPState *s = CORGI_SSP(d); | ||
73 | |||
74 | qdev_init_gpio_in(dev, corgi_ssp_gpio_cs, 3); | ||
75 | s->bus[0] = ssi_create_bus(dev, "ssi0"); | ||
76 | @@ -XXX,XX +XXX,XX @@ static void spitz_ssp_attach(SpitzMachineState *sms) | ||
77 | { | ||
78 | void *bus; | ||
79 | |||
80 | - sms->mux = ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], "corgi-ssp"); | ||
81 | + sms->mux = ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], | ||
82 | + TYPE_CORGI_SSP); | ||
83 | |||
84 | bus = qdev_get_child_bus(sms->mux, "ssi0"); | ||
85 | - sms->lcdtg = ssi_create_slave(bus, "spitz-lcdtg"); | ||
86 | + sms->lcdtg = ssi_create_slave(bus, TYPE_SPITZ_LCDTG); | ||
87 | |||
88 | bus = qdev_get_child_bus(sms->mux, "ssi1"); | ||
89 | sms->ads7846 = ssi_create_slave(bus, "ads7846"); | ||
90 | @@ -XXX,XX +XXX,XX @@ static void corgi_ssp_class_init(ObjectClass *klass, void *data) | ||
32 | } | 91 | } |
33 | 92 | ||
34 | -static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri, | 93 | static const TypeInfo corgi_ssp_info = { |
35 | - bool isread) | 94 | - .name = "corgi-ssp", |
36 | -{ | 95 | + .name = TYPE_CORGI_SSP, |
37 | - if (arm_is_secure_below_el3(env)) { | 96 | .parent = TYPE_SSI_SLAVE, |
38 | - /* Access ok in secure mode. */ | 97 | .instance_size = sizeof(CorgiSSPState), |
39 | - return CP_ACCESS_OK; | 98 | .class_init = corgi_ssp_class_init, |
40 | - } | 99 | @@ -XXX,XX +XXX,XX @@ static void spitz_lcdtg_class_init(ObjectClass *klass, void *data) |
41 | - return access_lor_ns(env); | ||
42 | -} | ||
43 | - | ||
44 | static CPAccessResult access_lor_other(CPUARMState *env, | ||
45 | const ARMCPRegInfo *ri, bool isread) | ||
46 | { | ||
47 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_other(CPUARMState *env, | ||
48 | /* Access denied in secure mode. */ | ||
49 | return CP_ACCESS_TRAP; | ||
50 | } | ||
51 | - return access_lor_ns(env); | ||
52 | + return access_lor_ns(env, ri, isread); | ||
53 | } | 100 | } |
54 | 101 | ||
55 | /* | 102 | static const TypeInfo spitz_lcdtg_info = { |
56 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lor_reginfo[] = { | 103 | - .name = "spitz-lcdtg", |
57 | .type = ARM_CP_CONST, .resetvalue = 0 }, | 104 | + .name = TYPE_SPITZ_LCDTG, |
58 | { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | 105 | .parent = TYPE_SSI_SLAVE, |
59 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | 106 | .instance_size = sizeof(SpitzLCDTG), |
60 | - .access = PL1_R, .accessfn = access_lorid, | 107 | .class_init = spitz_lcdtg_class_init, |
61 | + .access = PL1_R, .accessfn = access_lor_ns, | ||
62 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
63 | REGINFO_SENTINEL | ||
64 | }; | ||
65 | -- | 108 | -- |
66 | 2.20.1 | 109 | 2.20.1 |
67 | 110 | ||
68 | 111 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The FROM_SSI_SLAVE() macro predates QOM and is used as a typesafe way |
---|---|---|---|
2 | to cast from an SSISlave* to the instance struct of a subtype of | ||
3 | TYPE_SSI_SLAVE. Switch to using the QOM cast macros instead, which | ||
4 | have the same effect (by writing the QOM macros if the types were | ||
5 | previously missing them.) | ||
2 | 6 | ||
3 | These are the only users of neon_reg_offset, so remove that. | 7 | (The FROM_SSI_SLAVE() macro allows the SSISlave member of the |
8 | subtype's struct to be anywhere as long as it is named "ssidev", | ||
9 | whereas a QOM cast macro insists that it is the first thing in the | ||
10 | subtype's struct. This is true for all the types we convert here.) | ||
4 | 11 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | This removes all the uses of FROM_SSI_SLAVE() so we can delete the |
6 | Message-id: 20201030022618.785675-4-richard.henderson@linaro.org | 13 | definition. |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
18 | Message-id: 20200628142429.17111-18-peter.maydell@linaro.org | ||
9 | --- | 19 | --- |
10 | target/arm/translate.c | 14 ++------------ | 20 | include/hw/ssi/ssi.h | 2 -- |
11 | 1 file changed, 2 insertions(+), 12 deletions(-) | 21 | hw/arm/z2.c | 11 +++++++---- |
22 | hw/display/ads7846.c | 9 ++++++--- | ||
23 | hw/display/ssd0323.c | 10 +++++++--- | ||
24 | hw/sd/ssi-sd.c | 4 ++-- | ||
25 | 5 files changed, 22 insertions(+), 14 deletions(-) | ||
12 | 26 | ||
13 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 27 | diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h |
14 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.c | 29 | --- a/include/hw/ssi/ssi.h |
16 | +++ b/target/arm/translate.c | 30 | +++ b/include/hw/ssi/ssi.h |
17 | @@ -XXX,XX +XXX,XX @@ static inline long vfp_reg_offset(bool dp, unsigned reg) | 31 | @@ -XXX,XX +XXX,XX @@ struct SSISlave { |
18 | } | 32 | bool cs; |
33 | }; | ||
34 | |||
35 | -#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev) | ||
36 | - | ||
37 | extern const VMStateDescription vmstate_ssi_slave; | ||
38 | |||
39 | #define VMSTATE_SSI_SLAVE(_field, _state) { \ | ||
40 | diff --git a/hw/arm/z2.c b/hw/arm/z2.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/arm/z2.c | ||
43 | +++ b/hw/arm/z2.c | ||
44 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
45 | int pos; | ||
46 | } ZipitLCD; | ||
47 | |||
48 | +#define TYPE_ZIPIT_LCD "zipit-lcd" | ||
49 | +#define ZIPIT_LCD(obj) OBJECT_CHECK(ZipitLCD, (obj), TYPE_ZIPIT_LCD) | ||
50 | + | ||
51 | static uint32_t zipit_lcd_transfer(SSISlave *dev, uint32_t value) | ||
52 | { | ||
53 | - ZipitLCD *z = FROM_SSI_SLAVE(ZipitLCD, dev); | ||
54 | + ZipitLCD *z = ZIPIT_LCD(dev); | ||
55 | uint16_t val; | ||
56 | if (z->selected) { | ||
57 | z->buf[z->pos] = value & 0xff; | ||
58 | @@ -XXX,XX +XXX,XX @@ static void z2_lcd_cs(void *opaque, int line, int level) | ||
59 | |||
60 | static void zipit_lcd_realize(SSISlave *dev, Error **errp) | ||
61 | { | ||
62 | - ZipitLCD *z = FROM_SSI_SLAVE(ZipitLCD, dev); | ||
63 | + ZipitLCD *z = ZIPIT_LCD(dev); | ||
64 | z->selected = 0; | ||
65 | z->enabled = 0; | ||
66 | z->pos = 0; | ||
67 | @@ -XXX,XX +XXX,XX @@ static void zipit_lcd_class_init(ObjectClass *klass, void *data) | ||
19 | } | 68 | } |
20 | 69 | ||
21 | -/* Return the offset of a 32-bit piece of a NEON register. | 70 | static const TypeInfo zipit_lcd_info = { |
22 | - zero is the least significant end of the register. */ | 71 | - .name = "zipit-lcd", |
23 | -static inline long | 72 | + .name = TYPE_ZIPIT_LCD, |
24 | -neon_reg_offset (int reg, int n) | 73 | .parent = TYPE_SSI_SLAVE, |
25 | -{ | 74 | .instance_size = sizeof(ZipitLCD), |
26 | - int sreg; | 75 | .class_init = zipit_lcd_class_init, |
27 | - sreg = reg * 2 + n; | 76 | @@ -XXX,XX +XXX,XX @@ static void z2_init(MachineState *machine) |
28 | - return vfp_reg_offset(0, sreg); | 77 | |
29 | -} | 78 | type_register_static(&zipit_lcd_info); |
30 | - | 79 | type_register_static(&aer915_info); |
31 | static TCGv_i32 neon_load_reg(int reg, int pass) | 80 | - z2_lcd = ssi_create_slave(mpu->ssp[1], "zipit-lcd"); |
81 | + z2_lcd = ssi_create_slave(mpu->ssp[1], TYPE_ZIPIT_LCD); | ||
82 | bus = pxa2xx_i2c_bus(mpu->i2c[0]); | ||
83 | i2c_create_slave(bus, TYPE_AER915, 0x55); | ||
84 | wm = i2c_create_slave(bus, TYPE_WM8750, 0x1b); | ||
85 | diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/display/ads7846.c | ||
88 | +++ b/hw/display/ads7846.c | ||
89 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
90 | int output; | ||
91 | } ADS7846State; | ||
92 | |||
93 | +#define TYPE_ADS7846 "ads7846" | ||
94 | +#define ADS7846(obj) OBJECT_CHECK(ADS7846State, (obj), TYPE_ADS7846) | ||
95 | + | ||
96 | /* Control-byte bitfields */ | ||
97 | #define CB_PD0 (1 << 0) | ||
98 | #define CB_PD1 (1 << 1) | ||
99 | @@ -XXX,XX +XXX,XX @@ static void ads7846_int_update(ADS7846State *s) | ||
100 | |||
101 | static uint32_t ads7846_transfer(SSISlave *dev, uint32_t value) | ||
32 | { | 102 | { |
33 | TCGv_i32 tmp = tcg_temp_new_i32(); | 103 | - ADS7846State *s = FROM_SSI_SLAVE(ADS7846State, dev); |
34 | - tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass)); | 104 | + ADS7846State *s = ADS7846(dev); |
35 | + tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32)); | 105 | |
36 | return tmp; | 106 | switch (s->cycle ++) { |
107 | case 0: | ||
108 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_ads7846 = { | ||
109 | static void ads7846_realize(SSISlave *d, Error **errp) | ||
110 | { | ||
111 | DeviceState *dev = DEVICE(d); | ||
112 | - ADS7846State *s = FROM_SSI_SLAVE(ADS7846State, d); | ||
113 | + ADS7846State *s = ADS7846(d); | ||
114 | |||
115 | qdev_init_gpio_out(dev, &s->interrupt, 1); | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ static void ads7846_class_init(ObjectClass *klass, void *data) | ||
37 | } | 118 | } |
38 | 119 | ||
39 | static void neon_store_reg(int reg, int pass, TCGv_i32 var) | 120 | static const TypeInfo ads7846_info = { |
121 | - .name = "ads7846", | ||
122 | + .name = TYPE_ADS7846, | ||
123 | .parent = TYPE_SSI_SLAVE, | ||
124 | .instance_size = sizeof(ADS7846State), | ||
125 | .class_init = ads7846_class_init, | ||
126 | diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/hw/display/ssd0323.c | ||
129 | +++ b/hw/display/ssd0323.c | ||
130 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
131 | uint8_t framebuffer[128 * 80 / 2]; | ||
132 | } ssd0323_state; | ||
133 | |||
134 | +#define TYPE_SSD0323 "ssd0323" | ||
135 | +#define SSD0323(obj) OBJECT_CHECK(ssd0323_state, (obj), TYPE_SSD0323) | ||
136 | + | ||
137 | + | ||
138 | static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data) | ||
40 | { | 139 | { |
41 | - tcg_gen_st_i32(var, cpu_env, neon_reg_offset(reg, pass)); | 140 | - ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev); |
42 | + tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32)); | 141 | + ssd0323_state *s = SSD0323(dev); |
43 | tcg_temp_free_i32(var); | 142 | |
143 | switch (s->mode) { | ||
144 | case SSD0323_DATA: | ||
145 | @@ -XXX,XX +XXX,XX @@ static const GraphicHwOps ssd0323_ops = { | ||
146 | static void ssd0323_realize(SSISlave *d, Error **errp) | ||
147 | { | ||
148 | DeviceState *dev = DEVICE(d); | ||
149 | - ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, d); | ||
150 | + ssd0323_state *s = SSD0323(d); | ||
151 | |||
152 | s->col_end = 63; | ||
153 | s->row_end = 79; | ||
154 | @@ -XXX,XX +XXX,XX @@ static void ssd0323_class_init(ObjectClass *klass, void *data) | ||
44 | } | 155 | } |
45 | 156 | ||
157 | static const TypeInfo ssd0323_info = { | ||
158 | - .name = "ssd0323", | ||
159 | + .name = TYPE_SSD0323, | ||
160 | .parent = TYPE_SSI_SLAVE, | ||
161 | .instance_size = sizeof(ssd0323_state), | ||
162 | .class_init = ssd0323_class_init, | ||
163 | diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/hw/sd/ssi-sd.c | ||
166 | +++ b/hw/sd/ssi-sd.c | ||
167 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
168 | |||
169 | static uint32_t ssi_sd_transfer(SSISlave *dev, uint32_t val) | ||
170 | { | ||
171 | - ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, dev); | ||
172 | + ssi_sd_state *s = SSI_SD(dev); | ||
173 | |||
174 | /* Special case: allow CMD12 (STOP TRANSMISSION) while reading data. */ | ||
175 | if (s->mode == SSI_SD_DATA_READ && val == 0x4d) { | ||
176 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_ssi_sd = { | ||
177 | |||
178 | static void ssi_sd_realize(SSISlave *d, Error **errp) | ||
179 | { | ||
180 | - ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d); | ||
181 | + ssi_sd_state *s = SSI_SD(d); | ||
182 | DeviceState *carddev; | ||
183 | DriveInfo *dinfo; | ||
184 | Error *err = NULL; | ||
46 | -- | 185 | -- |
47 | 2.20.1 | 186 | 2.20.1 |
48 | 187 | ||
49 | 188 | diff view generated by jsdifflib |
1 | The kerneldoc script currently emits Sphinx markup for a macro with | 1 | Deprecate our TileGX target support: |
---|---|---|---|
2 | arguments that uses the c:function directive. This is correct for | 2 | * we have no active maintainer for it |
3 | Sphinx versions earlier than Sphinx 3, where c:macro doesn't allow | 3 | * it has had essentially no contributions (other than tree-wide cleanups |
4 | documentation of macros with arguments and c:function is not picky | 4 | and similar) since it was first added |
5 | about the syntax of what it is passed. However, in Sphinx 3 the | 5 | * the Linux kernel dropped support in 2018, as has glibc |
6 | c:macro directive was enhanced to support macros with arguments, | ||
7 | and c:function was made more picky about what syntax it accepted. | ||
8 | 6 | ||
9 | When kerneldoc is told that it needs to produce output for Sphinx | 7 | Note the deprecation in the manual, but don't try to print a warning |
10 | 3 or later, make it emit c:function only for functions and c:macro | 8 | when QEMU runs -- printing unsuppressable messages is more obtrusive |
11 | for macros with arguments. We assume that anything with a return | 9 | for linux-user mode than it would be for system-emulation mode, and |
12 | type is a function and anything without is a macro. | 10 | it doesn't seem worth trying to invent a new suppressible-error |
13 | 11 | system for linux-user just for this. | |
14 | This fixes the Sphinx error: | ||
15 | |||
16 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/qom/object.h:155:Error in declarator | ||
17 | If declarator-id with parameters (e.g., 'void f(int arg)'): | ||
18 | Invalid C declaration: Expected identifier in nested name. [error at 25] | ||
19 | DECLARE_INSTANCE_CHECKER ( InstanceType, OBJ_NAME, TYPENAME) | ||
20 | -------------------------^ | ||
21 | If parenthesis in noptr-declarator (e.g., 'void (*f(int arg))(double)'): | ||
22 | Error in declarator or parameters | ||
23 | Invalid C declaration: Expecting "(" in parameters. [error at 39] | ||
24 | DECLARE_INSTANCE_CHECKER ( InstanceType, OBJ_NAME, TYPENAME) | ||
25 | ---------------------------------------^ | ||
26 | 12 | ||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | 14 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
29 | Tested-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
30 | Message-id: 20201030174700.7204-2-peter.maydell@linaro.org | 16 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
17 | Message-id: 20200619154831.26319-1-peter.maydell@linaro.org | ||
31 | --- | 18 | --- |
32 | scripts/kernel-doc | 18 +++++++++++++++++- | 19 | docs/system/deprecated.rst | 11 +++++++++++ |
33 | 1 file changed, 17 insertions(+), 1 deletion(-) | 20 | 1 file changed, 11 insertions(+) |
34 | 21 | ||
35 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | 22 | diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst |
36 | index XXXXXXX..XXXXXXX 100755 | 23 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/scripts/kernel-doc | 24 | --- a/docs/system/deprecated.rst |
38 | +++ b/scripts/kernel-doc | 25 | +++ b/docs/system/deprecated.rst |
39 | @@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) { | 26 | @@ -XXX,XX +XXX,XX @@ The above, converted to the current supported format:: |
40 | output_highlight_rst($args{'purpose'}); | 27 | |
41 | $start = "\n\n**Syntax**\n\n ``"; | 28 | json:{"file.driver":"rbd", "file.pool":"rbd", "file.image":"name"} |
42 | } else { | 29 | |
43 | - print ".. c:function:: "; | 30 | +linux-user mode CPUs |
44 | + if ((split(/\./, $sphinx_version))[0] >= 3) { | 31 | +-------------------- |
45 | + # Sphinx 3 and later distinguish macros and functions and | 32 | + |
46 | + # complain if you use c:function with something that's not | 33 | +``tilegx`` CPUs (since 5.1.0) |
47 | + # syntactically valid as a function declaration. | 34 | +''''''''''''''''''''''''''''' |
48 | + # We assume that anything with a return type is a function | 35 | + |
49 | + # and anything without is a macro. | 36 | +The ``tilegx`` guest CPU support (which was only implemented in |
50 | + if ($args{'functiontype'} ne "") { | 37 | +linux-user mode) is deprecated and will be removed in a future version |
51 | + print ".. c:function:: "; | 38 | +of QEMU. Support for this CPU was removed from the upstream Linux |
52 | + } else { | 39 | +kernel in 2018, and has also been dropped from glibc. |
53 | + print ".. c:macro:: "; | 40 | + |
54 | + } | 41 | Related binaries |
55 | + } else { | 42 | ---------------- |
56 | + # Older Sphinx don't support documenting macros that take | 43 | |
57 | + # arguments with c:macro, and don't complain about the use | ||
58 | + # of c:function for this. | ||
59 | + print ".. c:function:: "; | ||
60 | + } | ||
61 | } | ||
62 | if ($args{'functiontype'} ne "") { | ||
63 | $start .= $args{'functiontype'} . " " . $args{'function'} . " ("; | ||
64 | -- | 44 | -- |
65 | 2.20.1 | 45 | 2.20.1 |
66 | 46 | ||
67 | 47 | diff view generated by jsdifflib |