1
Small pile of bug fixes for rc1. I've included my patches to get
1
A grab-bag of minor stuff for the end of the year. My to-review
2
our docs building with Sphinx 3, just for convenience...
2
queue is not empty, but it it at least in single figures...
3
3
4
-- PMM
4
-- PMM
5
5
6
The following changes since commit b149dea55cce97cb226683d06af61984a1c11e96:
6
The following changes since commit 5bfbd8170ce7acb98a1834ff49ed7340b0837144:
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/vivier2/tags/trivial-branch-for-6.0-pull-request' into staging (2020-12-14 20:32:38 +0000)
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-20201215
13
13
14
for you to fetch changes up to ffb4fbf90a2f63c9cb33e4bb9f854c79bf04ca4a:
14
for you to fetch changes up to 23af268566069183285bebbdf95b1b37cb7c0942:
15
15
16
tests/qtest/npcm7xx_rng-test: Disable randomness tests (2020-11-02 16:52:18 +0000)
16
hw/block/m25p80: Fix Numonyx fast read dummy cycle count (2020-12-15 13:39:30 +0000)
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
target-arm queue:
19
target-arm queue:
20
* target/arm: Fix Neon emulation bugs on big-endian hosts
20
* gdbstub: Correct misparsing of vCont C/S requests
21
* target/arm: fix handling of HCR.FB
21
* openrisc: Move pic_cpu code into CPU object proper
22
* target/arm: fix LORID_EL1 access check
22
* nios2: Move IIC code into CPU object proper
23
* disas/capstone: Fix monitor disassembly of >32 bytes
23
* Improve reporting of ROM overlap errors
24
* hw/arm/smmuv3: Fix potential integer overflow (CID 1432363)
24
* xlnx-versal: Add USB support
25
* hw/arm/boot: fix SVE for EL3 direct kernel boot
25
* hw/misc/zynq_slcr: Avoid #DIV/0! error
26
* hw/display/omap_lcdc: Fix potential NULL pointer dereference
26
* Numonyx: Fix dummy cycles and check for SPI mode on cmds
27
* hw/display/exynos4210_fimd: Fix potential NULL pointer dereference
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
27
34
----------------------------------------------------------------
28
----------------------------------------------------------------
35
AlexChen (2):
29
Joe Komlodi (4):
36
hw/display/omap_lcdc: Fix potential NULL pointer dereference
30
hw/block/m25p80: Make Numonyx config field names more accurate
37
hw/display/exynos4210_fimd: Fix potential NULL pointer dereference
31
hw/block/m25p80: Fix when VCFG XIP bit is set for Numonyx
32
hw/block/m25p80: Check SPI mode before running some Numonyx commands
33
hw/block/m25p80: Fix Numonyx fast read dummy cycle count
38
34
39
Peter Maydell (9):
35
Peter Maydell (11):
40
target/arm: Fix float16 pairwise Neon ops on big-endian hosts
36
gdbstub: Correct misparsing of vCont C/S requests
41
target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts
37
hw/openrisc/openrisc_sim: Use IRQ splitter when connecting IRQ to multiple CPUs
42
disas/capstone: Fix monitor disassembly of >32 bytes
38
hw/openrisc/openrisc_sim: Abstract out "get IRQ x of CPU y"
43
target/arm: Get correct MMU index for other-security-state
39
target/openrisc: Move pic_cpu code into CPU object proper
44
configure: Test that gio libs from pkg-config work
40
target/nios2: Move IIC code into CPU object proper
45
hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work
41
target/nios2: Move nios2_check_interrupts() into target/nios2
46
scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments
42
target/nios2: Use deposit32() to update ipending register
47
qemu-option-trace.rst.inc: Don't use option:: markup
43
hw/core/loader.c: Track last-seen ROM in rom_check_and_register_reset()
48
tests/qtest/npcm7xx_rng-test: Disable randomness tests
44
hw/core/loader.c: Improve reporting of ROM overlap errors
45
elf_ops.h: Don't truncate name of the ROM blobs we create
46
elf_ops.h: Be more verbose with ROM blob names
49
47
50
Philippe Mathieu-Daudé (1):
48
Philippe Mathieu-Daudé (1):
51
hw/arm/smmuv3: Fix potential integer overflow (CID 1432363)
49
hw/misc/zynq_slcr: Avoid #DIV/0! error
52
50
53
Richard Henderson (11):
51
Sai Pavan Boddu (2):
54
target/arm: Introduce neon_full_reg_offset
52
usb: Add versal-usb2-ctrl-regs module
55
target/arm: Move neon_element_offset to translate.c
53
usb: xlnx-usb-subsystem: Add xilinx usb subsystem
56
target/arm: Use neon_element_offset in neon_load/store_reg
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
54
66
Rémi Denis-Courmont (3):
55
Vikram Garhwal (2):
67
target/arm: fix handling of HCR.FB
56
usb: Add DWC3 model
68
target/arm: fix LORID_EL1 access check
57
arm: xlnx-versal: Connect usb to virt-versal
69
hw/arm/boot: fix SVE for EL3 direct kernel boot
70
58
71
docs/qemu-option-trace.rst.inc | 6 +-
59
include/hw/arm/xlnx-versal.h | 9 +
72
configure | 10 +-
60
include/hw/elf_ops.h | 5 +-
73
include/hw/intc/arm_gicv3_common.h | 1 -
61
include/hw/usb/hcd-dwc3.h | 55 +++
74
disas/capstone.c | 2 +-
62
include/hw/usb/xlnx-usb-subsystem.h | 45 ++
75
hw/arm/boot.c | 3 +
63
include/hw/usb/xlnx-versal-usb2-ctrl-regs.h | 45 ++
76
hw/arm/smmuv3.c | 3 +-
64
target/nios2/cpu.h | 3 -
77
hw/display/exynos4210_fimd.c | 4 +-
65
target/openrisc/cpu.h | 1 -
78
hw/display/omap_lcdc.c | 10 +-
66
gdbstub.c | 2 +-
79
hw/intc/arm_gicv3_cpuif.c | 5 +-
67
hw/arm/xlnx-versal-virt.c | 55 +++
80
target/arm/helper.c | 24 +-
68
hw/arm/xlnx-versal.c | 26 ++
81
target/arm/m_helper.c | 3 +-
69
hw/block/m25p80.c | 158 +++++--
82
target/arm/translate.c | 153 +++++++++---
70
hw/core/loader.c | 67 ++-
83
target/arm/vec_helper.c | 12 +-
71
hw/intc/nios2_iic.c | 95 ----
84
tests/qtest/npcm7xx_rng-test.c | 14 +-
72
hw/misc/zynq_slcr.c | 5 +
85
scripts/kernel-doc | 18 +-
73
hw/nios2/10m50_devboard.c | 13 +-
86
target/arm/translate-neon.c.inc | 472 ++++++++++++++++++++-----------------
74
hw/nios2/cpu_pic.c | 67 ---
87
target/arm/translate-vfp.c.inc | 341 +++++++++++----------------
75
hw/openrisc/openrisc_sim.c | 46 +-
88
17 files changed, 588 insertions(+), 493 deletions(-)
76
hw/openrisc/pic_cpu.c | 61 ---
77
hw/usb/hcd-dwc3.c | 689 ++++++++++++++++++++++++++++
78
hw/usb/xlnx-usb-subsystem.c | 94 ++++
79
hw/usb/xlnx-versal-usb2-ctrl-regs.c | 229 +++++++++
80
softmmu/vl.c | 1 -
81
target/nios2/cpu.c | 29 ++
82
target/nios2/op_helper.c | 9 +
83
target/openrisc/cpu.c | 32 ++
84
MAINTAINERS | 1 -
85
hw/intc/meson.build | 1 -
86
hw/nios2/meson.build | 2 +-
87
hw/openrisc/Kconfig | 1 +
88
hw/openrisc/meson.build | 2 +-
89
hw/usb/Kconfig | 10 +
90
hw/usb/meson.build | 3 +
91
32 files changed, 1557 insertions(+), 304 deletions(-)
92
create mode 100644 include/hw/usb/hcd-dwc3.h
93
create mode 100644 include/hw/usb/xlnx-usb-subsystem.h
94
create mode 100644 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
95
delete mode 100644 hw/intc/nios2_iic.c
96
delete mode 100644 hw/nios2/cpu_pic.c
97
delete mode 100644 hw/openrisc/pic_cpu.c
98
create mode 100644 hw/usb/hcd-dwc3.c
99
create mode 100644 hw/usb/xlnx-usb-subsystem.c
100
create mode 100644 hw/usb/xlnx-versal-usb2-ctrl-regs.c
89
101
diff view generated by jsdifflib
1
The randomness tests in the NPCM7xx RNG test fail intermittently
1
In the vCont packet, two of the command actions (C and S) take an
2
but fairly frequently. On my machine running the test in a loop:
2
argument specifying the signal to be sent to the process/thread, which is
3
while QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/npcm7xx_rng-test; do true; done
3
sent as an ASCII string of two hex digits which immediately follow the
4
'C' or 'S' character.
4
5
5
will fail in less than a minute with an error like:
6
Our code for parsing this packet accidentally skipped the first of the
6
ERROR:../../tests/qtest/npcm7xx_rng-test.c:256:test_first_byte_runs:
7
two bytes of the signal value, because it started parsing the hex string
7
assertion failed (calc_runs_p(buf.l, sizeof(buf) * BITS_PER_BYTE) > 0.01): (0.00286205989 > 0.01)
8
at 'p + 1' when the preceding code had already moved past the 'C' or
9
'S' with "cur_action = *p++".
8
10
9
(Failures have been observed on all 4 of the randomness tests,
11
This meant that we would only do the right thing for signals below
10
not just first_byte_runs.)
12
10, and would misinterpret the rest. For instance, when the debugger
13
wants to send the process a SIGPROF (27 on x86-64) we mangle this into
14
a SIGSEGV (11).
11
15
12
It's not clear why these tests are failing like this, but intermittent
16
Remove the accidental double increment.
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
17
18
Fixes: https://bugs.launchpad.net/qemu/+bug/1773743
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
20
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
19
Message-id: 20201102152454.8287-1-peter.maydell@linaro.org
21
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
20
Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
22
Message-id: 20201121210342.10089-1-peter.maydell@linaro.org
21
---
23
---
22
tests/qtest/npcm7xx_rng-test.c | 14 ++++++++++----
24
gdbstub.c | 2 +-
23
1 file changed, 10 insertions(+), 4 deletions(-)
25
1 file changed, 1 insertion(+), 1 deletion(-)
24
26
25
diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c
27
diff --git a/gdbstub.c b/gdbstub.c
26
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
27
--- a/tests/qtest/npcm7xx_rng-test.c
29
--- a/gdbstub.c
28
+++ b/tests/qtest/npcm7xx_rng-test.c
30
+++ b/gdbstub.c
29
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
31
@@ -XXX,XX +XXX,XX @@ static int gdb_handle_vcont(const char *p)
30
32
cur_action = *p++;
31
qtest_add_func("npcm7xx_rng/enable_disable", test_enable_disable);
33
if (cur_action == 'C' || cur_action == 'S') {
32
qtest_add_func("npcm7xx_rng/rosel", test_rosel);
34
cur_action = qemu_tolower(cur_action);
33
- qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit);
35
- res = qemu_strtoul(p + 1, &p, 16, &tmp);
34
- qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs);
36
+ res = qemu_strtoul(p, &p, 16, &tmp);
35
- qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit);
37
if (res) {
36
- qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs);
38
goto out;
37
+ /*
39
}
38
+ * These tests fail intermittently; only run them on explicit
39
+ * request until we figure out why.
40
+ */
41
+ if (getenv("QEMU_TEST_FLAKY_RNG_TESTS")) {
42
+ qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit);
43
+ qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs);
44
+ qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit);
45
+ qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs);
46
+ }
47
48
qtest_start("-machine npcm750-evb");
49
ret = g_test_run();
50
--
40
--
51
2.20.1
41
2.20.1
52
42
53
43
diff view generated by jsdifflib
1
Sphinx 3.2 is pickier than earlier versions about the option:: markup,
1
openrisc_sim_net_init() attempts to connect the IRQ line from the
2
and complains about our usage in qemu-option-trace.rst:
2
ethernet device to both CPUs in an SMP configuration by simply caling
3
sysbus_connect_irq() for it twice. This doesn't work, because the
4
second connection simply overrides the first.
3
5
4
../../docs/qemu-option-trace.rst.inc:4:Malformed option description
6
Fix this by creating a TYPE_SPLIT_IRQ to split the IRQ in the SMP
5
'[enable=]PATTERN', should look like "opt", "-opt args", "--opt args",
7
case.
6
"/opt args" or "+opt args"
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: Stafford Horne <shorne@gmail.com>
21
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
11
Message-id: 20201127225127.14770-2-peter.maydell@linaro.org
22
Message-id: 20201030174700.7204-3-peter.maydell@linaro.org
23
---
12
---
24
docs/qemu-option-trace.rst.inc | 6 +++---
13
hw/openrisc/openrisc_sim.c | 13 +++++++++++--
25
1 file changed, 3 insertions(+), 3 deletions(-)
14
hw/openrisc/Kconfig | 1 +
15
2 files changed, 12 insertions(+), 2 deletions(-)
26
16
27
diff --git a/docs/qemu-option-trace.rst.inc b/docs/qemu-option-trace.rst.inc
17
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
28
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/qemu-option-trace.rst.inc
19
--- a/hw/openrisc/openrisc_sim.c
30
+++ b/docs/qemu-option-trace.rst.inc
20
+++ b/hw/openrisc/openrisc_sim.c
31
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@
32
22
#include "hw/sysbus.h"
33
Specify tracing options.
23
#include "sysemu/qtest.h"
34
24
#include "sysemu/reset.h"
35
-.. option:: [enable=]PATTERN
25
+#include "hw/core/split-irq.h"
36
+``[enable=]PATTERN``
26
37
27
#define KERNEL_LOAD_ADDR 0x100
38
Immediately enable events matching *PATTERN*
28
39
(either event name or a globbing pattern). This option is only
29
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_net_init(hwaddr base, hwaddr descriptors,
40
@@ -XXX,XX +XXX,XX @@ Specify tracing options.
30
41
31
s = SYS_BUS_DEVICE(dev);
42
Use :option:`-trace help` to print a list of names of trace points.
32
sysbus_realize_and_unref(s, &error_fatal);
43
33
- for (i = 0; i < num_cpus; i++) {
44
-.. option:: events=FILE
34
- sysbus_connect_irq(s, 0, cpu_irqs[i][irq_pin]);
45
+``events=FILE``
35
+ if (num_cpus > 1) {
46
36
+ DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
47
Immediately enable events listed in *FILE*.
37
+ qdev_prop_set_uint32(splitter, "num-lines", num_cpus);
48
The file must contain one event name (as listed in the ``trace-events-all``
38
+ qdev_realize_and_unref(splitter, NULL, &error_fatal);
49
@@ -XXX,XX +XXX,XX @@ Specify tracing options.
39
+ for (i = 0; i < num_cpus; i++) {
50
available if QEMU has been compiled with the ``simple``, ``log`` or
40
+ qdev_connect_gpio_out(splitter, i, cpu_irqs[i][irq_pin]);
51
``ftrace`` tracing backend.
41
+ }
52
42
+ sysbus_connect_irq(s, 0, qdev_get_gpio_in(splitter, 0));
53
-.. option:: file=FILE
43
+ } else {
54
+``file=FILE``
44
+ sysbus_connect_irq(s, 0, cpu_irqs[0][irq_pin]);
55
45
}
56
Log output traces to *FILE*.
46
sysbus_mmio_map(s, 0, base);
57
This option is only available if QEMU has been compiled with
47
sysbus_mmio_map(s, 1, descriptors);
48
diff --git a/hw/openrisc/Kconfig b/hw/openrisc/Kconfig
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/openrisc/Kconfig
51
+++ b/hw/openrisc/Kconfig
52
@@ -XXX,XX +XXX,XX @@ config OR1K_SIM
53
select SERIAL
54
select OPENCORES_ETH
55
select OMPIC
56
+ select SPLIT_IRQ
58
--
57
--
59
2.20.1
58
2.20.1
60
59
61
60
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
We're about to refactor the OpenRISC pic_cpu code in a way that means
2
that just grabbing the whole qemu_irq[] array of inbound IRQs for a
3
CPU won't be possible any more. Abstract out a function for "return
4
the qemu_irq for IRQ x input of CPU y" so we can more easily replace
5
the implementation.
2
6
3
This function makes it clear that we're talking about the whole
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
register, and not the 32-bit piece at index 0. This fixes a bug
8
Reviewed-by: Stafford Horne <shorne@gmail.com>
5
when running on a big-endian host.
9
Message-id: 20201127225127.14770-3-peter.maydell@linaro.org
10
---
11
hw/openrisc/openrisc_sim.c | 38 +++++++++++++++++++++-----------------
12
1 file changed, 21 insertions(+), 17 deletions(-)
6
13
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
8
Message-id: 20201030022618.785675-2-richard.henderson@linaro.org
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/translate.c | 8 ++++++
13
target/arm/translate-neon.c.inc | 44 ++++++++++++++++-----------------
14
target/arm/translate-vfp.c.inc | 2 +-
15
3 files changed, 31 insertions(+), 23 deletions(-)
16
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate.c
16
--- a/hw/openrisc/openrisc_sim.c
20
+++ b/target/arm/translate.c
17
+++ b/hw/openrisc/openrisc_sim.c
21
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
18
@@ -XXX,XX +XXX,XX @@ static void main_cpu_reset(void *opaque)
22
unallocated_encoding(s);
19
cpu_set_pc(cs, boot_info.bootstrap_pc);
23
}
20
}
24
21
25
+/*
22
+static qemu_irq get_cpu_irq(OpenRISCCPU *cpus[], int cpunum, int irq_pin)
26
+ * Return the offset of a "full" NEON Dreg.
27
+ */
28
+static long neon_full_reg_offset(unsigned reg)
29
+{
23
+{
30
+ return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
24
+ return cpus[cpunum]->env.irq[irq_pin];
31
+}
25
+}
32
+
26
+
33
static inline long vfp_reg_offset(bool dp, unsigned reg)
27
static void openrisc_sim_net_init(hwaddr base, hwaddr descriptors,
28
- int num_cpus, qemu_irq **cpu_irqs,
29
+ int num_cpus, OpenRISCCPU *cpus[],
30
int irq_pin, NICInfo *nd)
34
{
31
{
35
if (dp) {
32
DeviceState *dev;
36
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
33
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_net_init(hwaddr base, hwaddr descriptors,
37
index XXXXXXX..XXXXXXX 100644
34
qdev_prop_set_uint32(splitter, "num-lines", num_cpus);
38
--- a/target/arm/translate-neon.c.inc
35
qdev_realize_and_unref(splitter, NULL, &error_fatal);
39
+++ b/target/arm/translate-neon.c.inc
36
for (i = 0; i < num_cpus; i++) {
40
@@ -XXX,XX +XXX,XX @@ neon_element_offset(int reg, int element, MemOp size)
37
- qdev_connect_gpio_out(splitter, i, cpu_irqs[i][irq_pin]);
41
ofs ^= 8 - element_size;
38
+ qdev_connect_gpio_out(splitter, i, get_cpu_irq(cpus, i, irq_pin));
39
}
40
sysbus_connect_irq(s, 0, qdev_get_gpio_in(splitter, 0));
41
} else {
42
- sysbus_connect_irq(s, 0, cpu_irqs[0][irq_pin]);
43
+ sysbus_connect_irq(s, 0, get_cpu_irq(cpus, 0, irq_pin));
42
}
44
}
43
#endif
45
sysbus_mmio_map(s, 0, base);
44
- return neon_reg_offset(reg, 0) + ofs;
46
sysbus_mmio_map(s, 1, descriptors);
45
+ return neon_full_reg_offset(reg) + ofs;
46
}
47
}
47
48
48
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
49
static void openrisc_sim_ompic_init(hwaddr base, int num_cpus,
49
@@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
50
- qemu_irq **cpu_irqs, int irq_pin)
50
* We cannot write 16 bytes at once because the
51
+ OpenRISCCPU *cpus[], int irq_pin)
51
* destination is unaligned.
52
{
52
*/
53
DeviceState *dev;
53
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
54
SysBusDevice *s;
54
+ tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd),
55
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_ompic_init(hwaddr base, int num_cpus,
55
8, 8, tmp);
56
s = SYS_BUS_DEVICE(dev);
56
- tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0),
57
sysbus_realize_and_unref(s, &error_fatal);
57
- neon_reg_offset(vd, 0), 8, 8);
58
for (i = 0; i < num_cpus; i++) {
58
+ tcg_gen_gvec_mov(0, neon_full_reg_offset(vd + 1),
59
- sysbus_connect_irq(s, i, cpu_irqs[i][irq_pin]);
59
+ neon_full_reg_offset(vd), 8, 8);
60
+ sysbus_connect_irq(s, i, get_cpu_irq(cpus, i, irq_pin));
60
} else {
61
}
61
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
62
sysbus_mmio_map(s, 0, base);
62
+ tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd),
63
}
63
vec_size, vec_size, tmp);
64
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_init(MachineState *machine)
65
{
66
ram_addr_t ram_size = machine->ram_size;
67
const char *kernel_filename = machine->kernel_filename;
68
- OpenRISCCPU *cpu = NULL;
69
+ OpenRISCCPU *cpus[2] = {};
70
MemoryRegion *ram;
71
- qemu_irq *cpu_irqs[2];
72
qemu_irq serial_irq;
73
int n;
74
unsigned int smp_cpus = machine->smp.cpus;
75
76
assert(smp_cpus >= 1 && smp_cpus <= 2);
77
for (n = 0; n < smp_cpus; n++) {
78
- cpu = OPENRISC_CPU(cpu_create(machine->cpu_type));
79
- if (cpu == NULL) {
80
+ cpus[n] = OPENRISC_CPU(cpu_create(machine->cpu_type));
81
+ if (cpus[n] == NULL) {
82
fprintf(stderr, "Unable to find CPU definition!\n");
83
exit(1);
64
}
84
}
65
tcg_gen_addi_i32(addr, addr, 1 << size);
85
- cpu_openrisc_pic_init(cpu);
66
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
86
- cpu_irqs[n] = (qemu_irq *) cpu->env.irq;
67
static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
87
+ cpu_openrisc_pic_init(cpus[n]);
68
{
88
69
int vec_size = a->q ? 16 : 8;
89
- cpu_openrisc_clock_init(cpu);
70
- int rd_ofs = neon_reg_offset(a->vd, 0);
90
+ cpu_openrisc_clock_init(cpus[n]);
71
- int rn_ofs = neon_reg_offset(a->vn, 0);
91
72
- int rm_ofs = neon_reg_offset(a->vm, 0);
92
- qemu_register_reset(main_cpu_reset, cpu);
73
+ int rd_ofs = neon_full_reg_offset(a->vd);
93
+ qemu_register_reset(main_cpu_reset, cpus[n]);
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
}
94
}
104
95
105
- reg_ofs = neon_reg_offset(a->vd, 0);
96
ram = g_malloc(sizeof(*ram));
106
+ reg_ofs = neon_full_reg_offset(a->vd);
97
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_init(MachineState *machine)
107
vec_size = a->q ? 16 : 8;
98
108
imm = asimd_imm_const(a->imm, a->cmode, a->op);
99
if (nd_table[0].used) {
109
100
openrisc_sim_net_init(0x92000000, 0x92000400, smp_cpus,
110
@@ -XXX,XX +XXX,XX @@ static bool trans_VMULL_P_3d(DisasContext *s, arg_3diff *a)
101
- cpu_irqs, 4, nd_table);
111
return true;
102
+ cpus, 4, nd_table);
112
}
103
}
113
104
114
- tcg_gen_gvec_3_ool(neon_reg_offset(a->vd, 0),
105
if (smp_cpus > 1) {
115
- neon_reg_offset(a->vn, 0),
106
- openrisc_sim_ompic_init(0x98000000, smp_cpus, cpu_irqs, 1);
116
- neon_reg_offset(a->vm, 0),
107
+ openrisc_sim_ompic_init(0x98000000, smp_cpus, cpus, 1);
117
+ tcg_gen_gvec_3_ool(neon_full_reg_offset(a->vd),
108
118
+ neon_full_reg_offset(a->vn),
109
- serial_irq = qemu_irq_split(cpu_irqs[0][2], cpu_irqs[1][2]);
119
+ neon_full_reg_offset(a->vm),
110
+ serial_irq = qemu_irq_split(get_cpu_irq(cpus, 0, 2),
120
16, 16, 0, fn_gvec);
111
+ get_cpu_irq(cpus, 1, 2));
121
return true;
112
} else {
122
}
113
- serial_irq = cpu_irqs[0][2];
123
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_fp_vec(DisasContext *s, arg_2scalar *a,
114
+ serial_irq = get_cpu_irq(cpus, 0, 2);
124
{
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
}
115
}
146
116
147
- tcg_gen_gvec_dup_mem(a->size, neon_reg_offset(a->vd, 0),
117
serial_mm_init(get_system_memory(), 0x90000000, 0, serial_irq,
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
--
118
--
177
2.20.1
119
2.20.1
178
120
179
121
diff view generated by jsdifflib
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
1
The openrisc code uses an old style of interrupt handling, where a
2
separate standalone set of qemu_irqs invoke a function
3
openrisc_pic_cpu_handler() which signals the interrupt to the CPU
4
proper by directly calling cpu_interrupt() and cpu_reset_interrupt().
5
Because CPU objects now inherit (indirectly) from TYPE_DEVICE, they
6
can have GPIO input lines themselves, and the neater modern way to
7
implement this is to simply have the CPU object itself provide the
8
input IRQ lines.
2
9
3
Secure mode is not exempted from checking SCR_EL3.TLOR, and in the
10
Create GPIO inputs to the OpenRISC CPU object, and make the only user
4
future HCR_EL2.TLOR when S-EL2 is enabled.
11
of cpu_openrisc_pic_init() wire up directly to those instead.
5
12
6
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
13
This allows us to delete the hw/openrisc/pic_cpu.c file entirely.
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
15
This fixes a trivial memory leak reported by Coverity of the IRQs
16
allocated in cpu_openrisc_pic_init().
17
18
Fixes: Coverity CID 1421934
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Stafford Horne <shorne@gmail.com>
21
Message-id: 20201127225127.14770-4-peter.maydell@linaro.org
9
---
22
---
10
target/arm/helper.c | 19 +++++--------------
23
target/openrisc/cpu.h | 1 -
11
1 file changed, 5 insertions(+), 14 deletions(-)
24
hw/openrisc/openrisc_sim.c | 3 +-
25
hw/openrisc/pic_cpu.c | 61 --------------------------------------
26
target/openrisc/cpu.c | 32 ++++++++++++++++++++
27
hw/openrisc/meson.build | 2 +-
28
5 files changed, 34 insertions(+), 65 deletions(-)
29
delete mode 100644 hw/openrisc/pic_cpu.c
12
30
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
31
diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h
14
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
33
--- a/target/openrisc/cpu.h
16
+++ b/target/arm/helper.c
34
+++ b/target/openrisc/cpu.h
17
@@ -XXX,XX +XXX,XX @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
35
@@ -XXX,XX +XXX,XX @@ typedef struct CPUOpenRISCState {
36
uint32_t picmr; /* Interrupt mask register */
37
uint32_t picsr; /* Interrupt contrl register*/
18
#endif
38
#endif
19
39
- void *irq[32]; /* Interrupt irq input */
20
/* Shared logic between LORID and the rest of the LOR* registers.
40
} CPUOpenRISCState;
21
- * Secure state has already been delt with.
41
22
+ * Secure state exclusion has already been dealt with.
42
/**
23
*/
43
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
24
-static CPAccessResult access_lor_ns(CPUARMState *env)
44
index XXXXXXX..XXXXXXX 100644
25
+static CPAccessResult access_lor_ns(CPUARMState *env,
45
--- a/hw/openrisc/openrisc_sim.c
26
+ const ARMCPRegInfo *ri, bool isread)
46
+++ b/hw/openrisc/openrisc_sim.c
47
@@ -XXX,XX +XXX,XX @@ static void main_cpu_reset(void *opaque)
48
49
static qemu_irq get_cpu_irq(OpenRISCCPU *cpus[], int cpunum, int irq_pin)
27
{
50
{
28
int el = arm_current_el(env);
51
- return cpus[cpunum]->env.irq[irq_pin];
29
52
+ return qdev_get_gpio_in_named(DEVICE(cpus[cpunum]), "IRQ", irq_pin);
30
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_ns(CPUARMState *env)
31
return CP_ACCESS_OK;
32
}
53
}
33
54
34
-static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri,
55
static void openrisc_sim_net_init(hwaddr base, hwaddr descriptors,
35
- bool isread)
56
@@ -XXX,XX +XXX,XX @@ static void openrisc_sim_init(MachineState *machine)
57
fprintf(stderr, "Unable to find CPU definition!\n");
58
exit(1);
59
}
60
- cpu_openrisc_pic_init(cpus[n]);
61
62
cpu_openrisc_clock_init(cpus[n]);
63
64
diff --git a/hw/openrisc/pic_cpu.c b/hw/openrisc/pic_cpu.c
65
deleted file mode 100644
66
index XXXXXXX..XXXXXXX
67
--- a/hw/openrisc/pic_cpu.c
68
+++ /dev/null
69
@@ -XXX,XX +XXX,XX @@
70
-/*
71
- * OpenRISC Programmable Interrupt Controller support.
72
- *
73
- * Copyright (c) 2011-2012 Jia Liu <proljc@gmail.com>
74
- * Feng Gao <gf91597@gmail.com>
75
- *
76
- * This library is free software; you can redistribute it and/or
77
- * modify it under the terms of the GNU Lesser General Public
78
- * License as published by the Free Software Foundation; either
79
- * version 2.1 of the License, or (at your option) any later version.
80
- *
81
- * This library is distributed in the hope that it will be useful,
82
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
83
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84
- * Lesser General Public License for more details.
85
- *
86
- * You should have received a copy of the GNU Lesser General Public
87
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
88
- */
89
-
90
-#include "qemu/osdep.h"
91
-#include "hw/irq.h"
92
-#include "cpu.h"
93
-
94
-/* OpenRISC pic handler */
95
-static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
36
-{
96
-{
37
- if (arm_is_secure_below_el3(env)) {
97
- OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
38
- /* Access ok in secure mode. */
98
- CPUState *cs = CPU(cpu);
39
- return CP_ACCESS_OK;
99
- uint32_t irq_bit;
100
-
101
- if (irq > 31 || irq < 0) {
102
- return;
40
- }
103
- }
41
- return access_lor_ns(env);
104
-
105
- irq_bit = 1U << irq;
106
-
107
- if (level) {
108
- cpu->env.picsr |= irq_bit;
109
- } else {
110
- cpu->env.picsr &= ~irq_bit;
111
- }
112
-
113
- if (cpu->env.picsr & cpu->env.picmr) {
114
- cpu_interrupt(cs, CPU_INTERRUPT_HARD);
115
- } else {
116
- cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
117
- cpu->env.picsr = 0;
118
- }
42
-}
119
-}
43
-
120
-
44
static CPAccessResult access_lor_other(CPUARMState *env,
121
-void cpu_openrisc_pic_init(OpenRISCCPU *cpu)
45
const ARMCPRegInfo *ri, bool isread)
122
-{
123
- int i;
124
- qemu_irq *qi;
125
- qi = qemu_allocate_irqs(openrisc_pic_cpu_handler, cpu, NR_IRQS);
126
-
127
- for (i = 0; i < NR_IRQS; i++) {
128
- cpu->env.irq[i] = qi[i];
129
- }
130
-}
131
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
132
index XXXXXXX..XXXXXXX 100644
133
--- a/target/openrisc/cpu.c
134
+++ b/target/openrisc/cpu.c
135
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_reset(DeviceState *dev)
136
#endif
137
}
138
139
+#ifndef CONFIG_USER_ONLY
140
+static void openrisc_cpu_set_irq(void *opaque, int irq, int level)
141
+{
142
+ OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
143
+ CPUState *cs = CPU(cpu);
144
+ uint32_t irq_bit;
145
+
146
+ if (irq > 31 || irq < 0) {
147
+ return;
148
+ }
149
+
150
+ irq_bit = 1U << irq;
151
+
152
+ if (level) {
153
+ cpu->env.picsr |= irq_bit;
154
+ } else {
155
+ cpu->env.picsr &= ~irq_bit;
156
+ }
157
+
158
+ if (cpu->env.picsr & cpu->env.picmr) {
159
+ cpu_interrupt(cs, CPU_INTERRUPT_HARD);
160
+ } else {
161
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
162
+ cpu->env.picsr = 0;
163
+ }
164
+}
165
+#endif
166
+
167
static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp)
46
{
168
{
47
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_other(CPUARMState *env,
169
CPUState *cs = CPU(dev);
48
/* Access denied in secure mode. */
170
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_initfn(Object *obj)
49
return CP_ACCESS_TRAP;
171
OpenRISCCPU *cpu = OPENRISC_CPU(obj);
50
}
172
51
- return access_lor_ns(env);
173
cpu_set_cpustate_pointers(cpu);
52
+ return access_lor_ns(env, ri, isread);
174
+
175
+#ifndef CONFIG_USER_ONLY
176
+ qdev_init_gpio_in_named(DEVICE(cpu), openrisc_cpu_set_irq, "IRQ", NR_IRQS);
177
+#endif
53
}
178
}
54
179
55
/*
180
/* CPU models */
56
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lor_reginfo[] = {
181
diff --git a/hw/openrisc/meson.build b/hw/openrisc/meson.build
57
.type = ARM_CP_CONST, .resetvalue = 0 },
182
index XXXXXXX..XXXXXXX 100644
58
{ .name = "LORID_EL1", .state = ARM_CP_STATE_AA64,
183
--- a/hw/openrisc/meson.build
59
.opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7,
184
+++ b/hw/openrisc/meson.build
60
- .access = PL1_R, .accessfn = access_lorid,
185
@@ -XXX,XX +XXX,XX @@
61
+ .access = PL1_R, .accessfn = access_lor_ns,
186
openrisc_ss = ss.source_set()
62
.type = ARM_CP_CONST, .resetvalue = 0 },
187
-openrisc_ss.add(files('pic_cpu.c', 'cputimer.c'))
63
REGINFO_SENTINEL
188
+openrisc_ss.add(files('cputimer.c'))
64
};
189
openrisc_ss.add(when: 'CONFIG_OR1K_SIM', if_true: files('openrisc_sim.c'))
190
191
hw_arch += {'openrisc': openrisc_ss}
65
--
192
--
66
2.20.1
193
2.20.1
67
194
68
195
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The Nios2 architecture supports two different interrupt controller
2
2
options:
3
We can then use this to improve VMOV (scalar to gp) and
3
4
VMOV (gp to scalar) so that we simply perform the memory
4
* The IIC (Internal Interrupt Controller) is part of the CPU itself;
5
operation that we wanted, rather than inserting or
5
it has 32 IRQ input lines and no NMI support. Interrupt status is
6
extracting from a 32-bit quantity.
6
queried and controlled via the CPU's ipending and istatus
7
7
registers.
8
These were the last uses of neon_load/store_reg, so remove them.
8
9
9
* The EIC (External Interrupt Controller) interface allows the CPU
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
to connect to an external interrupt controller. The interface
11
Message-id: 20201030022618.785675-7-richard.henderson@linaro.org
11
allows the interrupt controller to present a packet of information
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
containing:
13
- handler address
14
- interrupt level
15
- register set
16
- NMI mode
17
18
QEMU does not model an EIC currently. We do model the IIC, but its
19
implementation is split across code in hw/nios2/cpu_pic.c and
20
hw/intc/nios2_iic.c. The code in those two files has no state of its
21
own -- the IIC state is in the Nios2CPU state struct.
22
23
Because CPU objects now inherit (indirectly) from TYPE_DEVICE, they
24
can have GPIO input lines themselves, so we can implement the IIC
25
directly in the CPU object the same way that real hardware does.
26
27
Create named "IRQ" GPIO inputs to the Nios2 CPU object, and make the
28
only user of the IIC wire up directly to those instead.
29
30
Note that the old code had an "NMI" concept which was entirely unused
31
and also as far as I can see not architecturally correct, since only
32
the EIC has a concept of an NMI.
33
34
This fixes a Coverity-reported trivial memory leak of the IRQ array
35
allocated in nios2_cpu_pic_init().
36
37
Fixes: Coverity CID 1421916
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
38
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
39
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
40
Message-id: 20201129174022.26530-2-peter.maydell@linaro.org
41
Reviewed-by: Wentong Wu <wentong.wu@intel.com>
42
Tested-by: Wentong Wu <wentong.wu@intel.com>
14
---
43
---
15
target/arm/translate.c | 50 +++++++++++++-----------
44
target/nios2/cpu.h | 1 -
16
target/arm/translate-vfp.c.inc | 71 +++++-----------------------------
45
hw/intc/nios2_iic.c | 95 ---------------------------------------
17
2 files changed, 37 insertions(+), 84 deletions(-)
46
hw/nios2/10m50_devboard.c | 13 +-----
18
47
hw/nios2/cpu_pic.c | 31 -------------
19
diff --git a/target/arm/translate.c b/target/arm/translate.c
48
target/nios2/cpu.c | 30 +++++++++++++
20
index XXXXXXX..XXXXXXX 100644
49
MAINTAINERS | 1 -
21
--- a/target/arm/translate.c
50
hw/intc/meson.build | 1 -
22
+++ b/target/arm/translate.c
51
7 files changed, 32 insertions(+), 140 deletions(-)
23
@@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg)
52
delete mode 100644 hw/intc/nios2_iic.c
24
* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
53
25
* where 0 is the least significant end of the register.
54
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
26
*/
55
index XXXXXXX..XXXXXXX 100644
27
-static long neon_element_offset(int reg, int element, MemOp size)
56
--- a/target/nios2/cpu.h
28
+static long neon_element_offset(int reg, int element, MemOp memop)
57
+++ b/target/nios2/cpu.h
58
@@ -XXX,XX +XXX,XX @@ void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
59
MMUAccessType access_type,
60
int mmu_idx, uintptr_t retaddr);
61
62
-qemu_irq *nios2_cpu_pic_init(Nios2CPU *cpu);
63
void nios2_check_interrupts(CPUNios2State *env);
64
65
void do_nios2_semihosting(CPUNios2State *env);
66
diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c
67
deleted file mode 100644
68
index XXXXXXX..XXXXXXX
69
--- a/hw/intc/nios2_iic.c
70
+++ /dev/null
71
@@ -XXX,XX +XXX,XX @@
72
-/*
73
- * QEMU Altera Internal Interrupt Controller.
74
- *
75
- * Copyright (c) 2012 Chris Wulff <crwulff@gmail.com>
76
- *
77
- * This library is free software; you can redistribute it and/or
78
- * modify it under the terms of the GNU Lesser General Public
79
- * License as published by the Free Software Foundation; either
80
- * version 2.1 of the License, or (at your option) any later version.
81
- *
82
- * This library is distributed in the hope that it will be useful,
83
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
84
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85
- * Lesser General Public License for more details.
86
- *
87
- * You should have received a copy of the GNU Lesser General Public
88
- * License along with this library; if not, see
89
- * <http://www.gnu.org/licenses/lgpl-2.1.html>
90
- */
91
-
92
-#include "qemu/osdep.h"
93
-#include "qemu/module.h"
94
-#include "qapi/error.h"
95
-
96
-#include "hw/irq.h"
97
-#include "hw/sysbus.h"
98
-#include "cpu.h"
99
-#include "qom/object.h"
100
-
101
-#define TYPE_ALTERA_IIC "altera,iic"
102
-OBJECT_DECLARE_SIMPLE_TYPE(AlteraIIC, ALTERA_IIC)
103
-
104
-struct AlteraIIC {
105
- SysBusDevice parent_obj;
106
- void *cpu;
107
- qemu_irq parent_irq;
108
-};
109
-
110
-static void update_irq(AlteraIIC *pv)
111
-{
112
- CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
113
-
114
- qemu_set_irq(pv->parent_irq,
115
- env->regs[CR_IPENDING] & env->regs[CR_IENABLE]);
116
-}
117
-
118
-static void irq_handler(void *opaque, int irq, int level)
119
-{
120
- AlteraIIC *pv = opaque;
121
- CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
122
-
123
- env->regs[CR_IPENDING] &= ~(1 << irq);
124
- env->regs[CR_IPENDING] |= !!level << irq;
125
-
126
- update_irq(pv);
127
-}
128
-
129
-static void altera_iic_init(Object *obj)
130
-{
131
- AlteraIIC *pv = ALTERA_IIC(obj);
132
-
133
- qdev_init_gpio_in(DEVICE(pv), irq_handler, 32);
134
- sysbus_init_irq(SYS_BUS_DEVICE(obj), &pv->parent_irq);
135
-}
136
-
137
-static void altera_iic_realize(DeviceState *dev, Error **errp)
138
-{
139
- struct AlteraIIC *pv = ALTERA_IIC(dev);
140
-
141
- pv->cpu = object_property_get_link(OBJECT(dev), "cpu", &error_abort);
142
-}
143
-
144
-static void altera_iic_class_init(ObjectClass *klass, void *data)
145
-{
146
- DeviceClass *dc = DEVICE_CLASS(klass);
147
-
148
- /* Reason: needs to be wired up, e.g. by nios2_10m50_ghrd_init() */
149
- dc->user_creatable = false;
150
- dc->realize = altera_iic_realize;
151
-}
152
-
153
-static TypeInfo altera_iic_info = {
154
- .name = TYPE_ALTERA_IIC,
155
- .parent = TYPE_SYS_BUS_DEVICE,
156
- .instance_size = sizeof(AlteraIIC),
157
- .instance_init = altera_iic_init,
158
- .class_init = altera_iic_class_init,
159
-};
160
-
161
-static void altera_iic_register(void)
162
-{
163
- type_register_static(&altera_iic_info);
164
-}
165
-
166
-type_init(altera_iic_register)
167
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
168
index XXXXXXX..XXXXXXX 100644
169
--- a/hw/nios2/10m50_devboard.c
170
+++ b/hw/nios2/10m50_devboard.c
171
@@ -XXX,XX +XXX,XX @@ static void nios2_10m50_ghrd_init(MachineState *machine)
172
ram_addr_t tcm_size = 0x1000; /* 1 kiB, but QEMU limit is 4 kiB */
173
ram_addr_t ram_base = 0x08000000;
174
ram_addr_t ram_size = 0x08000000;
175
- qemu_irq *cpu_irq, irq[32];
176
+ qemu_irq irq[32];
177
int i;
178
179
/* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */
180
@@ -XXX,XX +XXX,XX @@ static void nios2_10m50_ghrd_init(MachineState *machine)
181
182
/* Create CPU -- FIXME */
183
cpu = NIOS2_CPU(cpu_create(TYPE_NIOS2_CPU));
184
-
185
- /* Register: CPU interrupt controller (PIC) */
186
- cpu_irq = nios2_cpu_pic_init(cpu);
187
-
188
- /* Register: Internal Interrupt Controller (IIC) */
189
- dev = qdev_new("altera,iic");
190
- object_property_add_const_link(OBJECT(dev), "cpu", OBJECT(cpu));
191
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
192
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);
193
for (i = 0; i < 32; i++) {
194
- irq[i] = qdev_get_gpio_in(dev, i);
195
+ irq[i] = qdev_get_gpio_in_named(DEVICE(cpu), "IRQ", i);
196
}
197
198
/* Register: Altera 16550 UART */
199
diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c
200
index XXXXXXX..XXXXXXX 100644
201
--- a/hw/nios2/cpu_pic.c
202
+++ b/hw/nios2/cpu_pic.c
203
@@ -XXX,XX +XXX,XX @@
204
205
#include "boot.h"
206
207
-static void nios2_pic_cpu_handler(void *opaque, int irq, int level)
208
-{
209
- Nios2CPU *cpu = opaque;
210
- CPUNios2State *env = &cpu->env;
211
- CPUState *cs = CPU(cpu);
212
- int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
213
-
214
- if (type == CPU_INTERRUPT_HARD) {
215
- env->irq_pending = level;
216
-
217
- if (level && (env->regs[CR_STATUS] & CR_STATUS_PIE)) {
218
- env->irq_pending = 0;
219
- cpu_interrupt(cs, type);
220
- } else if (!level) {
221
- env->irq_pending = 0;
222
- cpu_reset_interrupt(cs, type);
223
- }
224
- } else {
225
- if (level) {
226
- cpu_interrupt(cs, type);
227
- } else {
228
- cpu_reset_interrupt(cs, type);
229
- }
230
- }
231
-}
232
-
233
void nios2_check_interrupts(CPUNios2State *env)
29
{
234
{
30
- int element_size = 1 << size;
235
if (env->irq_pending &&
31
+ int element_size = 1 << (memop & MO_SIZE);
236
@@ -XXX,XX +XXX,XX @@ void nios2_check_interrupts(CPUNios2State *env)
32
int ofs = element * element_size;
237
cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
33
#ifdef HOST_WORDS_BIGENDIAN
34
/*
35
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
36
}
238
}
37
}
239
}
38
240
-
39
-static TCGv_i32 neon_load_reg(int reg, int pass)
241
-qemu_irq *nios2_cpu_pic_init(Nios2CPU *cpu)
40
-{
242
-{
41
- TCGv_i32 tmp = tcg_temp_new_i32();
243
- return qemu_allocate_irqs(nios2_pic_cpu_handler, cpu, 2);
42
- tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32));
244
-}
43
- return tmp;
245
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
44
-}
246
index XXXXXXX..XXXXXXX 100644
45
-
247
--- a/target/nios2/cpu.c
46
-static void neon_store_reg(int reg, int pass, TCGv_i32 var)
248
+++ b/target/nios2/cpu.c
47
-{
249
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_reset(DeviceState *dev)
48
- tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32));
250
#endif
49
- tcg_temp_free_i32(var);
251
}
50
-}
252
51
-
253
+#ifndef CONFIG_USER_ONLY
52
static inline void neon_load_reg64(TCGv_i64 var, int reg)
254
+static void nios2_cpu_set_irq(void *opaque, int irq, int level)
255
+{
256
+ Nios2CPU *cpu = opaque;
257
+ CPUNios2State *env = &cpu->env;
258
+ CPUState *cs = CPU(cpu);
259
+
260
+ env->regs[CR_IPENDING] &= ~(1 << irq);
261
+ env->regs[CR_IPENDING] |= !!level << irq;
262
+
263
+ env->irq_pending = env->regs[CR_IPENDING] & env->regs[CR_IENABLE];
264
+
265
+ if (env->irq_pending && (env->regs[CR_STATUS] & CR_STATUS_PIE)) {
266
+ env->irq_pending = 0;
267
+ cpu_interrupt(cs, CPU_INTERRUPT_HARD);
268
+ } else if (!env->irq_pending) {
269
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
270
+ }
271
+}
272
+#endif
273
+
274
static void nios2_cpu_initfn(Object *obj)
53
{
275
{
54
tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg));
276
Nios2CPU *cpu = NIOS2_CPU(obj);
55
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg)
277
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_initfn(Object *obj)
56
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
278
279
#if !defined(CONFIG_USER_ONLY)
280
mmu_init(&cpu->env);
281
+
282
+ /*
283
+ * These interrupt lines model the IIC (internal interrupt
284
+ * controller). QEMU does not currently support the EIC
285
+ * (external interrupt controller) -- if we did it would be
286
+ * a separate device in hw/intc with a custom interface to
287
+ * the CPU, and boards using it would not wire up these IRQ lines.
288
+ */
289
+ qdev_init_gpio_in_named(DEVICE(cpu), nios2_cpu_set_irq, "IRQ", 32);
290
#endif
57
}
291
}
58
292
59
-static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
293
diff --git a/MAINTAINERS b/MAINTAINERS
60
+static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
294
index XXXXXXX..XXXXXXX 100644
61
{
295
--- a/MAINTAINERS
62
- long off = neon_element_offset(reg, ele, size);
296
+++ b/MAINTAINERS
63
+ long off = neon_element_offset(reg, ele, memop);
297
@@ -XXX,XX +XXX,XX @@ M: Marek Vasut <marex@denx.de>
64
298
S: Maintained
65
- switch (size) {
299
F: target/nios2/
66
- case MO_32:
300
F: hw/nios2/
67
+ switch (memop) {
301
-F: hw/intc/nios2_iic.c
68
+ case MO_SB:
302
F: disas/nios2.c
69
+ tcg_gen_ld8s_i32(dest, cpu_env, off);
303
F: default-configs/nios2-softmmu.mak
70
+ break;
304
71
+ case MO_UB:
305
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
72
+ tcg_gen_ld8u_i32(dest, cpu_env, off);
306
index XXXXXXX..XXXXXXX 100644
73
+ break;
307
--- a/hw/intc/meson.build
74
+ case MO_SW:
308
+++ b/hw/intc/meson.build
75
+ tcg_gen_ld16s_i32(dest, cpu_env, off);
309
@@ -XXX,XX +XXX,XX @@ specific_ss.add(when: 'CONFIG_IBEX', if_true: files('ibex_plic.c'))
76
+ break;
310
specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))
77
+ case MO_UW:
311
specific_ss.add(when: 'CONFIG_LOONGSON_LIOINTC', if_true: files('loongson_liointc.c'))
78
+ tcg_gen_ld16u_i32(dest, cpu_env, off);
312
specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gic.c'))
79
+ break;
313
-specific_ss.add(when: 'CONFIG_NIOS2', if_true: files('nios2_iic.c'))
80
+ case MO_UL:
314
specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_intc.c'))
81
+ case MO_SL:
315
specific_ss.add(when: 'CONFIG_OMPIC', if_true: files('ompic.c'))
82
tcg_gen_ld_i32(dest, cpu_env, off);
316
specific_ss.add(when: 'CONFIG_OPENPIC_KVM', if_true: files('openpic_kvm.c'))
83
break;
84
default:
85
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
86
}
87
}
88
89
-static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size)
90
+static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
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
--
317
--
221
2.20.1
318
2.20.1
222
319
223
320
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The function nios2_check_interrupts)() looks only at CPU-internal
2
state; it belongs in target/nios2, not hw/nios2. Move it into the
3
same file as its only caller, so it can just be local to that file.
2
4
3
Replace all uses of neon_load/store_reg64 within translate-neon.c.inc.
5
This removes the only remaining code from cpu_pic.c, so we can delete
6
that file entirely.
4
7
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20201030022618.785675-9-richard.henderson@linaro.org
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
Message-id: 20201129174022.26530-3-peter.maydell@linaro.org
11
Reviewed-by: Wentong Wu <wentong.wu@intel.com>
12
Tested-by: Wentong Wu <wentong.wu@intel.com>
9
---
13
---
10
target/arm/translate.c | 26 +++++++++
14
target/nios2/cpu.h | 2 --
11
target/arm/translate-neon.c.inc | 94 ++++++++++++++++-----------------
15
hw/nios2/cpu_pic.c | 36 ------------------------------------
12
2 files changed, 73 insertions(+), 47 deletions(-)
16
target/nios2/op_helper.c | 9 +++++++++
17
hw/nios2/meson.build | 2 +-
18
4 files changed, 10 insertions(+), 39 deletions(-)
19
delete mode 100644 hw/nios2/cpu_pic.c
13
20
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
21
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
15
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
23
--- a/target/nios2/cpu.h
17
+++ b/target/arm/translate.c
24
+++ b/target/nios2/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
25
@@ -XXX,XX +XXX,XX @@ void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
19
}
26
MMUAccessType access_type,
27
int mmu_idx, uintptr_t retaddr);
28
29
-void nios2_check_interrupts(CPUNios2State *env);
30
-
31
void do_nios2_semihosting(CPUNios2State *env);
32
33
#define CPU_RESOLVING_TYPE TYPE_NIOS2_CPU
34
diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c
35
deleted file mode 100644
36
index XXXXXXX..XXXXXXX
37
--- a/hw/nios2/cpu_pic.c
38
+++ /dev/null
39
@@ -XXX,XX +XXX,XX @@
40
-/*
41
- * Altera Nios2 CPU PIC
42
- *
43
- * Copyright (c) 2016 Marek Vasut <marek.vasut@gmail.com>
44
- *
45
- * This library is free software; you can redistribute it and/or
46
- * modify it under the terms of the GNU Lesser General Public
47
- * License as published by the Free Software Foundation; either
48
- * version 2.1 of the License, or (at your option) any later version.
49
- *
50
- * This library is distributed in the hope that it will be useful,
51
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
52
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
53
- * Lesser General Public License for more details.
54
- *
55
- * You should have received a copy of the GNU Lesser General Public
56
- * License along with this library; if not, see
57
- * <http://www.gnu.org/licenses/lgpl-2.1.html>
58
- */
59
-
60
-#include "qemu/osdep.h"
61
-#include "cpu.h"
62
-#include "hw/irq.h"
63
-
64
-#include "qemu/config-file.h"
65
-
66
-#include "boot.h"
67
-
68
-void nios2_check_interrupts(CPUNios2State *env)
69
-{
70
- if (env->irq_pending &&
71
- (env->regs[CR_STATUS] & CR_STATUS_PIE)) {
72
- env->irq_pending = 0;
73
- cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
74
- }
75
-}
76
diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/nios2/op_helper.c
79
+++ b/target/nios2/op_helper.c
80
@@ -XXX,XX +XXX,XX @@ void helper_mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v)
81
mmu_write(env, rn, v);
20
}
82
}
21
83
22
+static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
84
+static void nios2_check_interrupts(CPUNios2State *env)
23
+{
85
+{
24
+ long off = neon_element_offset(reg, ele, memop);
86
+ if (env->irq_pending &&
25
+
87
+ (env->regs[CR_STATUS] & CR_STATUS_PIE)) {
26
+ switch (memop) {
88
+ env->irq_pending = 0;
27
+ case MO_Q:
89
+ cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
28
+ tcg_gen_ld_i64(dest, cpu_env, off);
29
+ break;
30
+ default:
31
+ g_assert_not_reached();
32
+ }
90
+ }
33
+}
91
+}
34
+
92
+
35
static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
93
void helper_check_interrupts(CPUNios2State *env)
36
{
94
{
37
long off = neon_element_offset(reg, ele, memop);
95
qemu_mutex_lock_iothread();
38
@@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
96
diff --git a/hw/nios2/meson.build b/hw/nios2/meson.build
39
}
40
}
41
42
+static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
43
+{
44
+ long off = neon_element_offset(reg, ele, memop);
45
+
46
+ switch (memop) {
47
+ case MO_64:
48
+ tcg_gen_st_i64(src, cpu_env, off);
49
+ break;
50
+ default:
51
+ g_assert_not_reached();
52
+ }
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
97
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/translate-neon.c.inc
98
--- a/hw/nios2/meson.build
61
+++ b/target/arm/translate-neon.c.inc
99
+++ b/hw/nios2/meson.build
62
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a,
100
@@ -XXX,XX +XXX,XX @@
63
for (pass = 0; pass < a->q + 1; pass++) {
101
nios2_ss = ss.source_set()
64
TCGv_i64 tmp = tcg_temp_new_i64();
102
-nios2_ss.add(files('boot.c', 'cpu_pic.c'))
65
103
+nios2_ss.add(files('boot.c'))
66
- neon_load_reg64(tmp, a->vm + pass);
104
nios2_ss.add(when: 'CONFIG_NIOS2_10M50', if_true: files('10m50_devboard.c'))
67
+ read_neon_element64(tmp, a->vm, pass, MO_64);
105
nios2_ss.add(when: 'CONFIG_NIOS2_GENERIC_NOMMU', if_true: files('generic_nommu.c'))
68
fn(tmp, cpu_env, tmp, constimm);
106
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
--
107
--
301
2.20.1
108
2.20.1
302
109
303
110
diff view generated by jsdifflib
1
The kerneldoc script currently emits Sphinx markup for a macro with
1
In nios2_cpu_set_irq(), use deposit32() rather than raw shift-and-mask
2
arguments that uses the c:function directive. This is correct for
2
operations to set the appropriate bit in the ipending register.
3
Sphinx versions earlier than Sphinx 3, where c:macro doesn't allow
4
documentation of macros with arguments and c:function is not picky
5
about the syntax of what it is passed. However, in Sphinx 3 the
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
9
When kerneldoc is told that it needs to produce output for Sphinx
10
3 or later, make it emit c:function only for functions and c:macro
11
for macros with arguments. We assume that anything with a return
12
type is a function and anything without is a macro.
13
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
3
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Message-id: 20201129174022.26530-4-peter.maydell@linaro.org
30
Message-id: 20201030174700.7204-2-peter.maydell@linaro.org
31
---
7
---
32
scripts/kernel-doc | 18 +++++++++++++++++-
8
target/nios2/cpu.c | 3 +--
33
1 file changed, 17 insertions(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 2 deletions(-)
34
10
35
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
11
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
36
index XXXXXXX..XXXXXXX 100755
12
index XXXXXXX..XXXXXXX 100644
37
--- a/scripts/kernel-doc
13
--- a/target/nios2/cpu.c
38
+++ b/scripts/kernel-doc
14
+++ b/target/nios2/cpu.c
39
@@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) {
15
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_set_irq(void *opaque, int irq, int level)
40
    output_highlight_rst($args{'purpose'});
16
CPUNios2State *env = &cpu->env;
41
    $start = "\n\n**Syntax**\n\n ``";
17
CPUState *cs = CPU(cpu);
42
} else {
18
43
-    print ".. c:function:: ";
19
- env->regs[CR_IPENDING] &= ~(1 << irq);
44
+ if ((split(/\./, $sphinx_version))[0] >= 3) {
20
- env->regs[CR_IPENDING] |= !!level << irq;
45
+ # Sphinx 3 and later distinguish macros and functions and
21
+ env->regs[CR_IPENDING] = deposit32(env->regs[CR_IPENDING], irq, 1, !!level);
46
+ # complain if you use c:function with something that's not
22
47
+ # syntactically valid as a function declaration.
23
env->irq_pending = env->regs[CR_IPENDING] & env->regs[CR_IENABLE];
48
+ # We assume that anything with a return type is a function
24
49
+ # and anything without is a macro.
50
+ if ($args{'functiontype'} ne "") {
51
+ print ".. c:function:: ";
52
+ } else {
53
+ print ".. c:macro:: ";
54
+ }
55
+ } else {
56
+ # Older Sphinx don't support documenting macros that take
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
--
25
--
65
2.20.1
26
2.20.1
66
27
67
28
diff view generated by jsdifflib
1
In the neon_padd/pmax/pmin helpers for float16, a cut-and-paste error
1
In rom_check_and_register_reset() we detect overlaps by looking at
2
meant we were using the H4() address swizzler macro rather than the
2
whether the ROM blob we're currently examining is in the same address
3
H2() which is required for 2-byte data. This had no effect on
3
space and starts before the previous ROM blob ends. (This works
4
little-endian hosts but meant we put the result data into the
4
because the ROM list is kept sorted in order by AddressSpace and then
5
destination Dreg in the wrong order on big-endian hosts.
5
by address.)
6
7
Instead of keeping the AddressSpace and last address of the previous ROM
8
blob in local variables, just keep a pointer to it.
9
10
This will allow us to print more useful information when we do detect
11
an overlap.
6
12
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20201129203923.10622-2-peter.maydell@linaro.org
10
Message-id: 20201028191712.4910-2-peter.maydell@linaro.org
11
---
16
---
12
target/arm/vec_helper.c | 8 ++++----
17
hw/core/loader.c | 23 +++++++++++++++--------
13
1 file changed, 4 insertions(+), 4 deletions(-)
18
1 file changed, 15 insertions(+), 8 deletions(-)
14
19
15
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
20
diff --git a/hw/core/loader.c b/hw/core/loader.c
16
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/vec_helper.c
22
--- a/hw/core/loader.c
18
+++ b/target/arm/vec_helper.c
23
+++ b/hw/core/loader.c
19
@@ -XXX,XX +XXX,XX @@ DO_ABA(gvec_uaba_d, uint64_t)
24
@@ -XXX,XX +XXX,XX @@ static void rom_reset(void *unused)
20
r2 = float16_##OP(m[H2(0)], m[H2(1)], fpst); \
21
r3 = float16_##OP(m[H2(2)], m[H2(3)], fpst); \
22
\
23
- d[H4(0)] = r0; \
24
- d[H4(1)] = r1; \
25
- d[H4(2)] = r2; \
26
- d[H4(3)] = r3; \
27
+ d[H2(0)] = r0; \
28
+ d[H2(1)] = r1; \
29
+ d[H2(2)] = r2; \
30
+ d[H2(3)] = r3; \
31
}
25
}
32
26
}
33
DO_NEON_PAIRWISE(neon_padd, add)
27
28
+/* Return true if two consecutive ROMs in the ROM list overlap */
29
+static bool roms_overlap(Rom *last_rom, Rom *this_rom)
30
+{
31
+ if (!last_rom) {
32
+ return false;
33
+ }
34
+ return last_rom->as == this_rom->as &&
35
+ last_rom->addr + last_rom->romsize > this_rom->addr;
36
+}
37
+
38
int rom_check_and_register_reset(void)
39
{
40
- hwaddr addr = 0;
41
MemoryRegionSection section;
42
- Rom *rom;
43
- AddressSpace *as = NULL;
44
+ Rom *rom, *last_rom = NULL;
45
46
QTAILQ_FOREACH(rom, &roms, next) {
47
if (rom->fw_file) {
48
continue;
49
}
50
if (!rom->mr) {
51
- if ((addr > rom->addr) && (as == rom->as)) {
52
+ if (roms_overlap(last_rom, rom)) {
53
fprintf(stderr, "rom: requested regions overlap "
54
"(rom %s. free=0x" TARGET_FMT_plx
55
", addr=0x" TARGET_FMT_plx ")\n",
56
- rom->name, addr, rom->addr);
57
+ rom->name, last_rom->addr + last_rom->romsize,
58
+ rom->addr);
59
return -1;
60
}
61
- addr = rom->addr;
62
- addr += rom->romsize;
63
- as = rom->as;
64
+ last_rom = rom;
65
}
66
section = memory_region_find(rom->mr ? rom->mr : get_system_memory(),
67
rom->addr, 1);
34
--
68
--
35
2.20.1
69
2.20.1
36
70
37
71
diff view generated by jsdifflib
1
From: AlexChen <alex.chen@huawei.com>
1
In rom_check_and_register_reset() we report to the user if there is
2
a "ROM region overlap". This has a couple of problems:
3
* the reported information is not very easy to intepret
4
* the function just prints the overlap to stderr (and relies on
5
its single callsite in vl.c to do an error_report() and exit)
6
* only the first overlap encountered is diagnosed
2
7
3
In omap_lcd_interrupts(), the pointer omap_lcd is dereferinced before
8
Make this function use error_report() and error_printf() and
4
being check if it is valid, which may lead to NULL pointer dereference.
9
report a more user-friendly report with all the overlaps
5
So move the assignment to surface after checking that the omap_lcd is valid
10
diagnosed.
6
and move surface_bits_per_pixel(surface) to after the surface assignment.
7
11
8
Reported-by: Euler Robot <euler.robot@huawei.com>
12
Sample old output:
9
Signed-off-by: AlexChen <alex.chen@huawei.com>
13
10
Message-id: 5F9CDB8A.9000001@huawei.com
14
rom: requested regions overlap (rom dtb. free=0x0000000000008000, addr=0x0000000000000000)
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
qemu-system-aarch64: rom check and register reset failed
16
17
Sample new output:
18
19
qemu-system-aarch64: Some ROM regions are overlapping
20
These ROM regions might have been loaded by direct user request or by default.
21
They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
22
Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.
23
24
The following two regions overlap (in the cpu-memory-0 address space):
25
phdr #0: /home/petmay01/linaro/qemu-misc-tests/ldmia-fault.axf (addresses 0x0000000000000000 - 0x0000000000008000)
26
dtb (addresses 0x0000000000000000 - 0x0000000000100000)
27
28
The following two regions overlap (in the cpu-memory-0 address space):
29
phdr #1: /home/petmay01/linaro/qemu-misc-tests/bad-psci-call.axf (addresses 0x0000000040000000 - 0x0000000040000010)
30
phdr #0: /home/petmay01/linaro/qemu-misc-tests/bp-test.elf (addresses 0x0000000040000000 - 0x0000000040000020)
31
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
34
Message-id: 20201129203923.10622-3-peter.maydell@linaro.org
13
---
35
---
14
hw/display/omap_lcdc.c | 10 +++++++---
36
hw/core/loader.c | 48 ++++++++++++++++++++++++++++++++++++++++++------
15
1 file changed, 7 insertions(+), 3 deletions(-)
37
softmmu/vl.c | 1 -
38
2 files changed, 42 insertions(+), 7 deletions(-)
16
39
17
diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c
40
diff --git a/hw/core/loader.c b/hw/core/loader.c
18
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/display/omap_lcdc.c
42
--- a/hw/core/loader.c
20
+++ b/hw/display/omap_lcdc.c
43
+++ b/hw/core/loader.c
21
@@ -XXX,XX +XXX,XX @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s)
44
@@ -XXX,XX +XXX,XX @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom)
22
static void omap_update_display(void *opaque)
45
last_rom->addr + last_rom->romsize > this_rom->addr;
46
}
47
48
+static const char *rom_as_name(Rom *rom)
49
+{
50
+ const char *name = rom->as ? rom->as->name : NULL;
51
+ return name ?: "anonymous";
52
+}
53
+
54
+static void rom_print_overlap_error_header(void)
55
+{
56
+ error_report("Some ROM regions are overlapping");
57
+ error_printf(
58
+ "These ROM regions might have been loaded by "
59
+ "direct user request or by default.\n"
60
+ "They could be BIOS/firmware images, a guest kernel, "
61
+ "initrd or some other file loaded into guest memory.\n"
62
+ "Check whether you intended to load all this guest code, and "
63
+ "whether it has been built to load to the correct addresses.\n");
64
+}
65
+
66
+static void rom_print_one_overlap_error(Rom *last_rom, Rom *rom)
67
+{
68
+ error_printf(
69
+ "\nThe following two regions overlap (in the %s address space):\n",
70
+ rom_as_name(rom));
71
+ error_printf(
72
+ " %s (addresses 0x" TARGET_FMT_plx " - 0x" TARGET_FMT_plx ")\n",
73
+ last_rom->name, last_rom->addr, last_rom->addr + last_rom->romsize);
74
+ error_printf(
75
+ " %s (addresses 0x" TARGET_FMT_plx " - 0x" TARGET_FMT_plx ")\n",
76
+ rom->name, rom->addr, rom->addr + rom->romsize);
77
+}
78
+
79
int rom_check_and_register_reset(void)
23
{
80
{
24
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque;
81
MemoryRegionSection section;
25
- DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
82
Rom *rom, *last_rom = NULL;
26
+ DisplaySurface *surface;
83
+ bool found_overlap = false;
27
draw_line_func draw_line;
84
28
int size, height, first, last;
85
QTAILQ_FOREACH(rom, &roms, next) {
29
int width, linesize, step, bpp, frame_offset;
86
if (rom->fw_file) {
30
hwaddr frame_base;
87
@@ -XXX,XX +XXX,XX @@ int rom_check_and_register_reset(void)
31
88
}
32
- if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
89
if (!rom->mr) {
33
- !surface_bits_per_pixel(surface)) {
90
if (roms_overlap(last_rom, rom)) {
34
+ if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable) {
91
- fprintf(stderr, "rom: requested regions overlap "
35
+ return;
92
- "(rom %s. free=0x" TARGET_FMT_plx
93
- ", addr=0x" TARGET_FMT_plx ")\n",
94
- rom->name, last_rom->addr + last_rom->romsize,
95
- rom->addr);
96
- return -1;
97
+ if (!found_overlap) {
98
+ found_overlap = true;
99
+ rom_print_overlap_error_header();
100
+ }
101
+ rom_print_one_overlap_error(last_rom, rom);
102
+ /* Keep going through the list so we report all overlaps */
103
}
104
last_rom = rom;
105
}
106
@@ -XXX,XX +XXX,XX @@ int rom_check_and_register_reset(void)
107
rom->isrom = int128_nz(section.size) && memory_region_is_rom(section.mr);
108
memory_region_unref(section.mr);
109
}
110
+ if (found_overlap) {
111
+ return -1;
36
+ }
112
+ }
37
+
113
+
38
+ surface = qemu_console_surface(omap_lcd->con);
114
qemu_register_reset(rom_reset, NULL);
39
+ if (!surface_bits_per_pixel(surface)) {
115
roms_loaded = 1;
40
return;
116
return 0;
117
diff --git a/softmmu/vl.c b/softmmu/vl.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/softmmu/vl.c
120
+++ b/softmmu/vl.c
121
@@ -XXX,XX +XXX,XX @@ static void qemu_machine_creation_done(void)
122
qemu_run_machine_init_done_notifiers();
123
124
if (rom_check_and_register_reset() != 0) {
125
- error_report("rom check and register reset failed");
126
exit(1);
41
}
127
}
42
128
43
--
129
--
44
2.20.1
130
2.20.1
45
131
46
132
diff view generated by jsdifflib
1
The helper functions for performing the udot/sdot operations against
1
Currently the load_elf code assembles the ROM blob name into a
2
a scalar were not using an address-swizzling macro when converting
2
local 128 byte fixed-size array. Use g_strdup_printf() instead so
3
the index of the scalar element into a pointer into the vm array.
3
that we don't truncate the pathname if it happens to be long.
4
This had no effect on little-endian hosts but meant we generated
4
(This matters mostly for monitor 'info roms' output and for the
5
incorrect results on big-endian hosts.
5
error messages if ROM blobs overlap.)
6
7
For these insns, the index is indexing over group of 4 8-bit values,
8
so 32 bits per indexed entity, and H4() is therefore what we want.
9
(For Neon the only possible input indexes are 0 and 1.)
10
6
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20201129203923.10622-4-peter.maydell@linaro.org
14
Message-id: 20201028191712.4910-3-peter.maydell@linaro.org
15
---
10
---
16
target/arm/vec_helper.c | 4 ++--
11
include/hw/elf_ops.h | 4 ++--
17
1 file changed, 2 insertions(+), 2 deletions(-)
12
1 file changed, 2 insertions(+), 2 deletions(-)
18
13
19
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
14
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
20
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/vec_helper.c
16
--- a/include/hw/elf_ops.h
22
+++ b/target/arm/vec_helper.c
17
+++ b/include/hw/elf_ops.h
23
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_sdot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc)
18
@@ -XXX,XX +XXX,XX @@ static int glue(load_elf, SZ)(const char *name, int fd,
24
intptr_t index = simd_data(desc);
19
uint64_t addr, low = (uint64_t)-1, high = 0;
25
uint32_t *d = vd;
20
GMappedFile *mapped_file = NULL;
26
int8_t *n = vn;
21
uint8_t *data = NULL;
27
- int8_t *m_indexed = (int8_t *)vm + index * 4;
22
- char label[128];
28
+ int8_t *m_indexed = (int8_t *)vm + H4(index) * 4;
23
int ret = ELF_LOAD_FAILED;
29
24
30
/* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd.
25
if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr))
31
* Otherwise opr_sz is a multiple of 16.
26
@@ -XXX,XX +XXX,XX @@ static int glue(load_elf, SZ)(const char *name, int fd,
32
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_udot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc)
27
*/
33
intptr_t index = simd_data(desc);
28
if (mem_size != 0) {
34
uint32_t *d = vd;
29
if (load_rom) {
35
uint8_t *n = vn;
30
- snprintf(label, sizeof(label), "phdr #%d: %s", i, name);
36
- uint8_t *m_indexed = (uint8_t *)vm + index * 4;
31
+ g_autofree char *label =
37
+ uint8_t *m_indexed = (uint8_t *)vm + H4(index) * 4;
32
+ g_strdup_printf("phdr #%d: %s", i, name);
38
33
39
/* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd.
34
/*
40
* Otherwise opr_sz is a multiple of 16.
35
* rom_add_elf_program() takes its own reference to
41
--
36
--
42
2.20.1
37
2.20.1
43
38
44
39
diff view generated by jsdifflib
1
In arm_v7m_mmu_idx_for_secstate() we get the 'priv' level to pass to
1
Instead of making the ROM blob name something like:
2
armv7m_mmu_idx_for_secstate_and_priv() by calling arm_current_el().
2
phdr #0: /home/petmay01/linaro/qemu-misc-tests/ldmia-fault.axf
3
This is incorrect when the security state being queried is not the
3
make it a little more self-explanatory for people who don't know
4
current one, because arm_current_el() uses the current security state
4
ELF format details:
5
to determine which of the banked CONTROL.nPRIV bits to look at.
5
/home/petmay01/linaro/qemu-misc-tests/ldmia-fault.axf ELF program header segment 0
6
The effect was that if (for instance) Secure state was in privileged
7
mode but Non-Secure was not then we would return the wrong MMU index.
8
9
The only places where we are using this function in a way that could
10
trigger this bug are for the stack loads during a v8M function-return
11
and for the instruction fetch of a v8M SG insn.
12
13
Fix the bug by expanding out the M-profile version of the
14
arm_current_el() logic inline so it can use the passed in secstate
15
rather than env->v7m.secure.
16
6
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Message-id: 20201022164408.13214-1-peter.maydell@linaro.org
9
Message-id: 20201129203923.10622-5-peter.maydell@linaro.org
20
---
10
---
21
target/arm/m_helper.c | 3 ++-
11
include/hw/elf_ops.h | 3 ++-
22
1 file changed, 2 insertions(+), 1 deletion(-)
12
1 file changed, 2 insertions(+), 1 deletion(-)
23
13
24
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
14
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
25
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/m_helper.c
16
--- a/include/hw/elf_ops.h
27
+++ b/target/arm/m_helper.c
17
+++ b/include/hw/elf_ops.h
28
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
18
@@ -XXX,XX +XXX,XX @@ static int glue(load_elf, SZ)(const char *name, int fd,
29
/* Return the MMU index for a v7M CPU in the specified security state */
19
if (mem_size != 0) {
30
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
20
if (load_rom) {
31
{
21
g_autofree char *label =
32
- bool priv = arm_current_el(env) != 0;
22
- g_strdup_printf("phdr #%d: %s", i, name);
33
+ bool priv = arm_v7m_is_handler_mode(env) ||
23
+ g_strdup_printf("%s ELF program header segment %d",
34
+ !(env->v7m.control[secstate] & 1);
24
+ name, i);
35
25
36
return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
26
/*
37
}
27
* rom_add_elf_program() takes its own reference to
38
--
28
--
39
2.20.1
29
2.20.1
40
30
41
31
diff view generated by jsdifflib
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
2
2
3
HCR should be applied when NS is set, not when it is cleared.
3
This module emulates control registers of versal usb2 controller, this is added
4
4
just to make guest happy. In general this module would control the phy-reset
5
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
5
signal from usb controller, data coherency of the transactions, signals
6
the host system errors received from controller.
7
8
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
9
Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 1607023357-5096-2-git-send-email-sai.pavan.boddu@xilinx.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
14
---
9
target/arm/helper.c | 5 ++---
15
include/hw/usb/xlnx-versal-usb2-ctrl-regs.h | 45 ++++
10
1 file changed, 2 insertions(+), 3 deletions(-)
16
hw/usb/xlnx-versal-usb2-ctrl-regs.c | 229 ++++++++++++++++++++
11
17
hw/usb/meson.build | 1 +
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
3 files changed, 275 insertions(+)
19
create mode 100644 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
20
create mode 100644 hw/usb/xlnx-versal-usb2-ctrl-regs.c
21
22
diff --git a/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
23
new file mode 100644
24
index XXXXXXX..XXXXXXX
25
--- /dev/null
26
+++ b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
27
@@ -XXX,XX +XXX,XX @@
28
+/*
29
+ * QEMU model of the VersalUsb2CtrlRegs Register control/Status block for
30
+ * USB2.0 controller
31
+ *
32
+ * Copyright (c) 2020 Xilinx Inc. Vikram Garhwal <fnu.vikram@xilinx.com>
33
+ *
34
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
35
+ * of this software and associated documentation files (the "Software"), to deal
36
+ * in the Software without restriction, including without limitation the rights
37
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38
+ * copies of the Software, and to permit persons to whom the Software is
39
+ * furnished to do so, subject to the following conditions:
40
+ *
41
+ * The above copyright notice and this permission notice shall be included in
42
+ * all copies or substantial portions of the Software.
43
+ *
44
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
47
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50
+ * THE SOFTWARE.
51
+ */
52
+
53
+#ifndef _XLNX_USB2_REGS_H_
54
+#define _XLNX_USB2_REGS_H_
55
+
56
+#define TYPE_XILINX_VERSAL_USB2_CTRL_REGS "xlnx.versal-usb2-ctrl-regs"
57
+
58
+#define XILINX_VERSAL_USB2_CTRL_REGS(obj) \
59
+ OBJECT_CHECK(VersalUsb2CtrlRegs, (obj), TYPE_XILINX_VERSAL_USB2_CTRL_REGS)
60
+
61
+#define USB2_REGS_R_MAX ((0x78 / 4) + 1)
62
+
63
+typedef struct VersalUsb2CtrlRegs {
64
+ SysBusDevice parent_obj;
65
+ MemoryRegion iomem;
66
+ qemu_irq irq_ir;
67
+
68
+ uint32_t regs[USB2_REGS_R_MAX];
69
+ RegisterInfo regs_info[USB2_REGS_R_MAX];
70
+} VersalUsb2CtrlRegs;
71
+
72
+#endif
73
diff --git a/hw/usb/xlnx-versal-usb2-ctrl-regs.c b/hw/usb/xlnx-versal-usb2-ctrl-regs.c
74
new file mode 100644
75
index XXXXXXX..XXXXXXX
76
--- /dev/null
77
+++ b/hw/usb/xlnx-versal-usb2-ctrl-regs.c
78
@@ -XXX,XX +XXX,XX @@
79
+/*
80
+ * QEMU model of the VersalUsb2CtrlRegs Register control/Status block for
81
+ * USB2.0 controller
82
+ *
83
+ * This module should control phy_reset, permanent device plugs, frame length
84
+ * time adjust & setting of coherency paths. None of which are emulated in
85
+ * present model.
86
+ *
87
+ * Copyright (c) 2020 Xilinx Inc. Vikram Garhwal <fnu.vikram@xilinx.com>
88
+ *
89
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
90
+ * of this software and associated documentation files (the "Software"), to deal
91
+ * in the Software without restriction, including without limitation the rights
92
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
93
+ * copies of the Software, and to permit persons to whom the Software is
94
+ * furnished to do so, subject to the following conditions:
95
+ *
96
+ * The above copyright notice and this permission notice shall be included in
97
+ * all copies or substantial portions of the Software.
98
+ *
99
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
102
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
104
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
105
+ * THE SOFTWARE.
106
+ */
107
+
108
+#include "qemu/osdep.h"
109
+#include "hw/sysbus.h"
110
+#include "hw/irq.h"
111
+#include "hw/register.h"
112
+#include "qemu/bitops.h"
113
+#include "qemu/log.h"
114
+#include "qom/object.h"
115
+#include "migration/vmstate.h"
116
+#include "hw/usb/xlnx-versal-usb2-ctrl-regs.h"
117
+
118
+#ifndef XILINX_VERSAL_USB2_CTRL_REGS_ERR_DEBUG
119
+#define XILINX_VERSAL_USB2_CTRL_REGS_ERR_DEBUG 0
120
+#endif
121
+
122
+REG32(BUS_FILTER, 0x30)
123
+ FIELD(BUS_FILTER, BYPASS, 0, 4)
124
+REG32(PORT, 0x34)
125
+ FIELD(PORT, HOST_SMI_BAR_WR, 4, 1)
126
+ FIELD(PORT, HOST_SMI_PCI_CMD_REG_WR, 3, 1)
127
+ FIELD(PORT, HOST_MSI_ENABLE, 2, 1)
128
+ FIELD(PORT, PWR_CTRL_PRSNT, 1, 1)
129
+ FIELD(PORT, HUB_PERM_ATTACH, 0, 1)
130
+REG32(JITTER_ADJUST, 0x38)
131
+ FIELD(JITTER_ADJUST, FLADJ, 0, 6)
132
+REG32(BIGENDIAN, 0x40)
133
+ FIELD(BIGENDIAN, ENDIAN_GS, 0, 1)
134
+REG32(COHERENCY, 0x44)
135
+ FIELD(COHERENCY, USB_COHERENCY, 0, 1)
136
+REG32(XHC_BME, 0x48)
137
+ FIELD(XHC_BME, XHC_BME, 0, 1)
138
+REG32(REG_CTRL, 0x60)
139
+ FIELD(REG_CTRL, SLVERR_ENABLE, 0, 1)
140
+REG32(IR_STATUS, 0x64)
141
+ FIELD(IR_STATUS, HOST_SYS_ERR, 1, 1)
142
+ FIELD(IR_STATUS, ADDR_DEC_ERR, 0, 1)
143
+REG32(IR_MASK, 0x68)
144
+ FIELD(IR_MASK, HOST_SYS_ERR, 1, 1)
145
+ FIELD(IR_MASK, ADDR_DEC_ERR, 0, 1)
146
+REG32(IR_ENABLE, 0x6c)
147
+ FIELD(IR_ENABLE, HOST_SYS_ERR, 1, 1)
148
+ FIELD(IR_ENABLE, ADDR_DEC_ERR, 0, 1)
149
+REG32(IR_DISABLE, 0x70)
150
+ FIELD(IR_DISABLE, HOST_SYS_ERR, 1, 1)
151
+ FIELD(IR_DISABLE, ADDR_DEC_ERR, 0, 1)
152
+REG32(USB3, 0x78)
153
+
154
+static void ir_update_irq(VersalUsb2CtrlRegs *s)
155
+{
156
+ bool pending = s->regs[R_IR_STATUS] & ~s->regs[R_IR_MASK];
157
+ qemu_set_irq(s->irq_ir, pending);
158
+}
159
+
160
+static void ir_status_postw(RegisterInfo *reg, uint64_t val64)
161
+{
162
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(reg->opaque);
163
+ /*
164
+ * TODO: This should also clear USBSTS.HSE field in USB XHCI register.
165
+ * May be combine both the modules.
166
+ */
167
+ ir_update_irq(s);
168
+}
169
+
170
+static uint64_t ir_enable_prew(RegisterInfo *reg, uint64_t val64)
171
+{
172
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(reg->opaque);
173
+ uint32_t val = val64;
174
+
175
+ s->regs[R_IR_MASK] &= ~val;
176
+ ir_update_irq(s);
177
+ return 0;
178
+}
179
+
180
+static uint64_t ir_disable_prew(RegisterInfo *reg, uint64_t val64)
181
+{
182
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(reg->opaque);
183
+ uint32_t val = val64;
184
+
185
+ s->regs[R_IR_MASK] |= val;
186
+ ir_update_irq(s);
187
+ return 0;
188
+}
189
+
190
+static const RegisterAccessInfo usb2_ctrl_regs_regs_info[] = {
191
+ { .name = "BUS_FILTER", .addr = A_BUS_FILTER,
192
+ .rsvd = 0xfffffff0,
193
+ },{ .name = "PORT", .addr = A_PORT,
194
+ .rsvd = 0xffffffe0,
195
+ },{ .name = "JITTER_ADJUST", .addr = A_JITTER_ADJUST,
196
+ .reset = 0x20,
197
+ .rsvd = 0xffffffc0,
198
+ },{ .name = "BIGENDIAN", .addr = A_BIGENDIAN,
199
+ .rsvd = 0xfffffffe,
200
+ },{ .name = "COHERENCY", .addr = A_COHERENCY,
201
+ .rsvd = 0xfffffffe,
202
+ },{ .name = "XHC_BME", .addr = A_XHC_BME,
203
+ .reset = 0x1,
204
+ .rsvd = 0xfffffffe,
205
+ },{ .name = "REG_CTRL", .addr = A_REG_CTRL,
206
+ .rsvd = 0xfffffffe,
207
+ },{ .name = "IR_STATUS", .addr = A_IR_STATUS,
208
+ .rsvd = 0xfffffffc,
209
+ .w1c = 0x3,
210
+ .post_write = ir_status_postw,
211
+ },{ .name = "IR_MASK", .addr = A_IR_MASK,
212
+ .reset = 0x3,
213
+ .rsvd = 0xfffffffc,
214
+ .ro = 0x3,
215
+ },{ .name = "IR_ENABLE", .addr = A_IR_ENABLE,
216
+ .rsvd = 0xfffffffc,
217
+ .pre_write = ir_enable_prew,
218
+ },{ .name = "IR_DISABLE", .addr = A_IR_DISABLE,
219
+ .rsvd = 0xfffffffc,
220
+ .pre_write = ir_disable_prew,
221
+ },{ .name = "USB3", .addr = A_USB3,
222
+ }
223
+};
224
+
225
+static void usb2_ctrl_regs_reset_init(Object *obj, ResetType type)
226
+{
227
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(obj);
228
+ unsigned int i;
229
+
230
+ for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
231
+ register_reset(&s->regs_info[i]);
232
+ }
233
+}
234
+
235
+static void usb2_ctrl_regs_reset_hold(Object *obj)
236
+{
237
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(obj);
238
+
239
+ ir_update_irq(s);
240
+}
241
+
242
+static const MemoryRegionOps usb2_ctrl_regs_ops = {
243
+ .read = register_read_memory,
244
+ .write = register_write_memory,
245
+ .endianness = DEVICE_LITTLE_ENDIAN,
246
+ .valid = {
247
+ .min_access_size = 4,
248
+ .max_access_size = 4,
249
+ },
250
+};
251
+
252
+static void usb2_ctrl_regs_init(Object *obj)
253
+{
254
+ VersalUsb2CtrlRegs *s = XILINX_VERSAL_USB2_CTRL_REGS(obj);
255
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
256
+ RegisterInfoArray *reg_array;
257
+
258
+ memory_region_init(&s->iomem, obj, TYPE_XILINX_VERSAL_USB2_CTRL_REGS,
259
+ USB2_REGS_R_MAX * 4);
260
+ reg_array =
261
+ register_init_block32(DEVICE(obj), usb2_ctrl_regs_regs_info,
262
+ ARRAY_SIZE(usb2_ctrl_regs_regs_info),
263
+ s->regs_info, s->regs,
264
+ &usb2_ctrl_regs_ops,
265
+ XILINX_VERSAL_USB2_CTRL_REGS_ERR_DEBUG,
266
+ USB2_REGS_R_MAX * 4);
267
+ memory_region_add_subregion(&s->iomem,
268
+ 0x0,
269
+ &reg_array->mem);
270
+ sysbus_init_mmio(sbd, &s->iomem);
271
+ sysbus_init_irq(sbd, &s->irq_ir);
272
+}
273
+
274
+static const VMStateDescription vmstate_usb2_ctrl_regs = {
275
+ .name = TYPE_XILINX_VERSAL_USB2_CTRL_REGS,
276
+ .version_id = 1,
277
+ .minimum_version_id = 1,
278
+ .fields = (VMStateField[]) {
279
+ VMSTATE_UINT32_ARRAY(regs, VersalUsb2CtrlRegs, USB2_REGS_R_MAX),
280
+ VMSTATE_END_OF_LIST(),
281
+ }
282
+};
283
+
284
+static void usb2_ctrl_regs_class_init(ObjectClass *klass, void *data)
285
+{
286
+ DeviceClass *dc = DEVICE_CLASS(klass);
287
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
288
+
289
+ rc->phases.enter = usb2_ctrl_regs_reset_init;
290
+ rc->phases.hold = usb2_ctrl_regs_reset_hold;
291
+ dc->vmsd = &vmstate_usb2_ctrl_regs;
292
+}
293
+
294
+static const TypeInfo usb2_ctrl_regs_info = {
295
+ .name = TYPE_XILINX_VERSAL_USB2_CTRL_REGS,
296
+ .parent = TYPE_SYS_BUS_DEVICE,
297
+ .instance_size = sizeof(VersalUsb2CtrlRegs),
298
+ .class_init = usb2_ctrl_regs_class_init,
299
+ .instance_init = usb2_ctrl_regs_init,
300
+};
301
+
302
+static void usb2_ctrl_regs_register_types(void)
303
+{
304
+ type_register_static(&usb2_ctrl_regs_info);
305
+}
306
+
307
+type_init(usb2_ctrl_regs_register_types)
308
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
13
index XXXXXXX..XXXXXXX 100644
309
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
310
--- a/hw/usb/meson.build
15
+++ b/target/arm/helper.c
311
+++ b/hw/usb/meson.build
16
@@ -XXX,XX +XXX,XX @@ static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
312
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_USB_DWC2', if_true: files('hcd-dwc2.c'))
17
313
softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c'))
18
/*
314
softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c'))
19
* Non-IS variants of TLB operations are upgraded to
315
softmmu_ss.add(when: 'CONFIG_IMX_USBPHY', if_true: files('imx-usb-phy.c'))
20
- * IS versions if we are at NS EL1 and HCR_EL2.FB is set to
316
+specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-usb2-ctrl-regs.c'))
21
+ * IS versions if we are at EL1 and HCR_EL2.FB is effectively set to
317
22
* force broadcast of these operations.
318
# emulated usb devices
23
*/
319
softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hub.c'))
24
static bool tlb_force_broadcast(CPUARMState *env)
25
{
26
- return (env->cp15.hcr_el2 & HCR_FB) &&
27
- arm_current_el(env) == 1 && arm_is_secure_below_el3(env);
28
+ return arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_FB);
29
}
30
31
static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,
32
--
320
--
33
2.20.1
321
2.20.1
34
322
35
323
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Vikram Garhwal <fnu.vikram@xilinx.com>
2
2
3
Model these off the aa64 read/write_vec_element functions.
3
This patch adds skeleton model of dwc3 usb controller attached to
4
Use it within translate-neon.c.inc. The new functions do
4
xhci-sysbus device. It defines global register space of DWC3 controller,
5
not allocate or free temps, so this rearranges the calling
5
global registers control the AXI/AHB interfaces properties, external FIFO
6
code a bit.
6
support and event count support. All of which are unimplemented at
7
present,we are only supporting core reset and read of ID register.
7
8
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
9
Message-id: 20201030022618.785675-6-richard.henderson@linaro.org
10
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
12
Message-id: 1607023357-5096-3-git-send-email-sai.pavan.boddu@xilinx.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
14
---
13
target/arm/translate.c | 26 ++++
15
include/hw/usb/hcd-dwc3.h | 55 +++
14
target/arm/translate-neon.c.inc | 256 ++++++++++++++++++++------------
16
hw/usb/hcd-dwc3.c | 689 ++++++++++++++++++++++++++++++++++++++
15
2 files changed, 183 insertions(+), 99 deletions(-)
17
hw/usb/Kconfig | 5 +
18
hw/usb/meson.build | 1 +
19
4 files changed, 750 insertions(+)
20
create mode 100644 include/hw/usb/hcd-dwc3.h
21
create mode 100644 hw/usb/hcd-dwc3.c
16
22
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
23
diff --git a/include/hw/usb/hcd-dwc3.h b/include/hw/usb/hcd-dwc3.h
18
index XXXXXXX..XXXXXXX 100644
24
new file mode 100644
19
--- a/target/arm/translate.c
25
index XXXXXXX..XXXXXXX
20
+++ b/target/arm/translate.c
26
--- /dev/null
21
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg)
27
+++ b/include/hw/usb/hcd-dwc3.h
22
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
28
@@ -XXX,XX +XXX,XX @@
23
}
29
+/*
24
30
+ * QEMU model of the USB DWC3 host controller emulation.
25
+static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
31
+ *
32
+ * Copyright (c) 2020 Xilinx Inc.
33
+ *
34
+ * Written by Vikram Garhwal<fnu.vikram@xilinx.com>
35
+ *
36
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ * of this software and associated documentation files (the "Software"), to deal
38
+ * in the Software without restriction, including without limitation the rights
39
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ * copies of the Software, and to permit persons to whom the Software is
41
+ * furnished to do so, subject to the following conditions:
42
+ *
43
+ * The above copyright notice and this permission notice shall be included in
44
+ * all copies or substantial portions of the Software.
45
+ *
46
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
49
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
52
+ * THE SOFTWARE.
53
+ */
54
+#ifndef HCD_DWC3_H
55
+#define HCD_DWC3_H
56
+
57
+#include "hw/usb/hcd-xhci.h"
58
+#include "hw/usb/hcd-xhci-sysbus.h"
59
+
60
+#define TYPE_USB_DWC3 "usb_dwc3"
61
+
62
+#define USB_DWC3(obj) \
63
+ OBJECT_CHECK(USBDWC3, (obj), TYPE_USB_DWC3)
64
+
65
+#define USB_DWC3_R_MAX ((0x530 / 4) + 1)
66
+#define DWC3_SIZE 0x10000
67
+
68
+typedef struct USBDWC3 {
69
+ SysBusDevice parent_obj;
70
+ MemoryRegion iomem;
71
+ XHCISysbusState sysbus_xhci;
72
+
73
+ uint32_t regs[USB_DWC3_R_MAX];
74
+ RegisterInfo regs_info[USB_DWC3_R_MAX];
75
+
76
+ struct {
77
+ uint8_t mode;
78
+ uint32_t dwc_usb3_user;
79
+ } cfg;
80
+
81
+} USBDWC3;
82
+
83
+#endif
84
diff --git a/hw/usb/hcd-dwc3.c b/hw/usb/hcd-dwc3.c
85
new file mode 100644
86
index XXXXXXX..XXXXXXX
87
--- /dev/null
88
+++ b/hw/usb/hcd-dwc3.c
89
@@ -XXX,XX +XXX,XX @@
90
+/*
91
+ * QEMU model of the USB DWC3 host controller emulation.
92
+ *
93
+ * This model defines global register space of DWC3 controller. Global
94
+ * registers control the AXI/AHB interfaces properties, external FIFO support
95
+ * and event count support. All of which are unimplemented at present. We are
96
+ * only supporting core reset and read of ID register.
97
+ *
98
+ * Copyright (c) 2020 Xilinx Inc. Vikram Garhwal<fnu.vikram@xilinx.com>
99
+ *
100
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
101
+ * of this software and associated documentation files (the "Software"), to deal
102
+ * in the Software without restriction, including without limitation the rights
103
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
104
+ * copies of the Software, and to permit persons to whom the Software is
105
+ * furnished to do so, subject to the following conditions:
106
+ *
107
+ * The above copyright notice and this permission notice shall be included in
108
+ * all copies or substantial portions of the Software.
109
+ *
110
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
111
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
112
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
113
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
114
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
115
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
116
+ * THE SOFTWARE.
117
+ */
118
+
119
+#include "qemu/osdep.h"
120
+#include "hw/sysbus.h"
121
+#include "hw/register.h"
122
+#include "qemu/bitops.h"
123
+#include "qemu/log.h"
124
+#include "qom/object.h"
125
+#include "migration/vmstate.h"
126
+#include "hw/qdev-properties.h"
127
+#include "hw/usb/hcd-dwc3.h"
128
+#include "qapi/error.h"
129
+
130
+#ifndef USB_DWC3_ERR_DEBUG
131
+#define USB_DWC3_ERR_DEBUG 0
132
+#endif
133
+
134
+#define HOST_MODE 1
135
+#define FIFO_LEN 0x1000
136
+
137
+REG32(GSBUSCFG0, 0x00)
138
+ FIELD(GSBUSCFG0, DATRDREQINFO, 28, 4)
139
+ FIELD(GSBUSCFG0, DESRDREQINFO, 24, 4)
140
+ FIELD(GSBUSCFG0, DATWRREQINFO, 20, 4)
141
+ FIELD(GSBUSCFG0, DESWRREQINFO, 16, 4)
142
+ FIELD(GSBUSCFG0, RESERVED_15_12, 12, 4)
143
+ FIELD(GSBUSCFG0, DATBIGEND, 11, 1)
144
+ FIELD(GSBUSCFG0, DESBIGEND, 10, 1)
145
+ FIELD(GSBUSCFG0, RESERVED_9_8, 8, 2)
146
+ FIELD(GSBUSCFG0, INCR256BRSTENA, 7, 1)
147
+ FIELD(GSBUSCFG0, INCR128BRSTENA, 6, 1)
148
+ FIELD(GSBUSCFG0, INCR64BRSTENA, 5, 1)
149
+ FIELD(GSBUSCFG0, INCR32BRSTENA, 4, 1)
150
+ FIELD(GSBUSCFG0, INCR16BRSTENA, 3, 1)
151
+ FIELD(GSBUSCFG0, INCR8BRSTENA, 2, 1)
152
+ FIELD(GSBUSCFG0, INCR4BRSTENA, 1, 1)
153
+ FIELD(GSBUSCFG0, INCRBRSTENA, 0, 1)
154
+REG32(GSBUSCFG1, 0x04)
155
+ FIELD(GSBUSCFG1, RESERVED_31_13, 13, 19)
156
+ FIELD(GSBUSCFG1, EN1KPAGE, 12, 1)
157
+ FIELD(GSBUSCFG1, PIPETRANSLIMIT, 8, 4)
158
+ FIELD(GSBUSCFG1, RESERVED_7_0, 0, 8)
159
+REG32(GTXTHRCFG, 0x08)
160
+ FIELD(GTXTHRCFG, RESERVED_31, 31, 1)
161
+ FIELD(GTXTHRCFG, RESERVED_30, 30, 1)
162
+ FIELD(GTXTHRCFG, USBTXPKTCNTSEL, 29, 1)
163
+ FIELD(GTXTHRCFG, RESERVED_28, 28, 1)
164
+ FIELD(GTXTHRCFG, USBTXPKTCNT, 24, 4)
165
+ FIELD(GTXTHRCFG, USBMAXTXBURSTSIZE, 16, 8)
166
+ FIELD(GTXTHRCFG, RESERVED_15, 15, 1)
167
+ FIELD(GTXTHRCFG, RESERVED_14, 14, 1)
168
+ FIELD(GTXTHRCFG, RESERVED_13_11, 11, 3)
169
+ FIELD(GTXTHRCFG, RESERVED_10_0, 0, 11)
170
+REG32(GRXTHRCFG, 0x0c)
171
+ FIELD(GRXTHRCFG, RESERVED_31_30, 30, 2)
172
+ FIELD(GRXTHRCFG, USBRXPKTCNTSEL, 29, 1)
173
+ FIELD(GRXTHRCFG, RESERVED_28, 28, 1)
174
+ FIELD(GRXTHRCFG, USBRXPKTCNT, 24, 4)
175
+ FIELD(GRXTHRCFG, USBMAXRXBURSTSIZE, 19, 5)
176
+ FIELD(GRXTHRCFG, RESERVED_18_16, 16, 3)
177
+ FIELD(GRXTHRCFG, RESERVED_15, 15, 1)
178
+ FIELD(GRXTHRCFG, RESERVED_14_13, 13, 2)
179
+ FIELD(GRXTHRCFG, RESVISOCOUTSPC, 0, 13)
180
+REG32(GCTL, 0x10)
181
+ FIELD(GCTL, PWRDNSCALE, 19, 13)
182
+ FIELD(GCTL, MASTERFILTBYPASS, 18, 1)
183
+ FIELD(GCTL, BYPSSETADDR, 17, 1)
184
+ FIELD(GCTL, U2RSTECN, 16, 1)
185
+ FIELD(GCTL, FRMSCLDWN, 14, 2)
186
+ FIELD(GCTL, PRTCAPDIR, 12, 2)
187
+ FIELD(GCTL, CORESOFTRESET, 11, 1)
188
+ FIELD(GCTL, U1U2TIMERSCALE, 9, 1)
189
+ FIELD(GCTL, DEBUGATTACH, 8, 1)
190
+ FIELD(GCTL, RAMCLKSEL, 6, 2)
191
+ FIELD(GCTL, SCALEDOWN, 4, 2)
192
+ FIELD(GCTL, DISSCRAMBLE, 3, 1)
193
+ FIELD(GCTL, U2EXIT_LFPS, 2, 1)
194
+ FIELD(GCTL, GBLHIBERNATIONEN, 1, 1)
195
+ FIELD(GCTL, DSBLCLKGTNG, 0, 1)
196
+REG32(GPMSTS, 0x14)
197
+REG32(GSTS, 0x18)
198
+ FIELD(GSTS, CBELT, 20, 12)
199
+ FIELD(GSTS, RESERVED_19_12, 12, 8)
200
+ FIELD(GSTS, SSIC_IP, 11, 1)
201
+ FIELD(GSTS, OTG_IP, 10, 1)
202
+ FIELD(GSTS, BC_IP, 9, 1)
203
+ FIELD(GSTS, ADP_IP, 8, 1)
204
+ FIELD(GSTS, HOST_IP, 7, 1)
205
+ FIELD(GSTS, DEVICE_IP, 6, 1)
206
+ FIELD(GSTS, CSRTIMEOUT, 5, 1)
207
+ FIELD(GSTS, BUSERRADDRVLD, 4, 1)
208
+ FIELD(GSTS, RESERVED_3_2, 2, 2)
209
+ FIELD(GSTS, CURMOD, 0, 2)
210
+REG32(GUCTL1, 0x1c)
211
+ FIELD(GUCTL1, RESUME_OPMODE_HS_HOST, 10, 1)
212
+REG32(GSNPSID, 0x20)
213
+REG32(GGPIO, 0x24)
214
+ FIELD(GGPIO, GPO, 16, 16)
215
+ FIELD(GGPIO, GPI, 0, 16)
216
+REG32(GUID, 0x28)
217
+REG32(GUCTL, 0x2c)
218
+ FIELD(GUCTL, REFCLKPER, 22, 10)
219
+ FIELD(GUCTL, NOEXTRDL, 21, 1)
220
+ FIELD(GUCTL, RESERVED_20_18, 18, 3)
221
+ FIELD(GUCTL, SPRSCTRLTRANSEN, 17, 1)
222
+ FIELD(GUCTL, RESBWHSEPS, 16, 1)
223
+ FIELD(GUCTL, RESERVED_15, 15, 1)
224
+ FIELD(GUCTL, USBHSTINAUTORETRYEN, 14, 1)
225
+ FIELD(GUCTL, ENOVERLAPCHK, 13, 1)
226
+ FIELD(GUCTL, EXTCAPSUPPTEN, 12, 1)
227
+ FIELD(GUCTL, INSRTEXTRFSBODI, 11, 1)
228
+ FIELD(GUCTL, DTCT, 9, 2)
229
+ FIELD(GUCTL, DTFT, 0, 9)
230
+REG32(GBUSERRADDRLO, 0x30)
231
+REG32(GBUSERRADDRHI, 0x34)
232
+REG32(GHWPARAMS0, 0x40)
233
+ FIELD(GHWPARAMS0, GHWPARAMS0_31_24, 24, 8)
234
+ FIELD(GHWPARAMS0, GHWPARAMS0_23_16, 16, 8)
235
+ FIELD(GHWPARAMS0, GHWPARAMS0_15_8, 8, 8)
236
+ FIELD(GHWPARAMS0, GHWPARAMS0_7_6, 6, 2)
237
+ FIELD(GHWPARAMS0, GHWPARAMS0_5_3, 3, 3)
238
+ FIELD(GHWPARAMS0, GHWPARAMS0_2_0, 0, 3)
239
+REG32(GHWPARAMS1, 0x44)
240
+ FIELD(GHWPARAMS1, GHWPARAMS1_31, 31, 1)
241
+ FIELD(GHWPARAMS1, GHWPARAMS1_30, 30, 1)
242
+ FIELD(GHWPARAMS1, GHWPARAMS1_29, 29, 1)
243
+ FIELD(GHWPARAMS1, GHWPARAMS1_28, 28, 1)
244
+ FIELD(GHWPARAMS1, GHWPARAMS1_27, 27, 1)
245
+ FIELD(GHWPARAMS1, GHWPARAMS1_26, 26, 1)
246
+ FIELD(GHWPARAMS1, GHWPARAMS1_25_24, 24, 2)
247
+ FIELD(GHWPARAMS1, GHWPARAMS1_23, 23, 1)
248
+ FIELD(GHWPARAMS1, GHWPARAMS1_22_21, 21, 2)
249
+ FIELD(GHWPARAMS1, GHWPARAMS1_20_15, 15, 6)
250
+ FIELD(GHWPARAMS1, GHWPARAMS1_14_12, 12, 3)
251
+ FIELD(GHWPARAMS1, GHWPARAMS1_11_9, 9, 3)
252
+ FIELD(GHWPARAMS1, GHWPARAMS1_8_6, 6, 3)
253
+ FIELD(GHWPARAMS1, GHWPARAMS1_5_3, 3, 3)
254
+ FIELD(GHWPARAMS1, GHWPARAMS1_2_0, 0, 3)
255
+REG32(GHWPARAMS2, 0x48)
256
+REG32(GHWPARAMS3, 0x4c)
257
+ FIELD(GHWPARAMS3, GHWPARAMS3_31, 31, 1)
258
+ FIELD(GHWPARAMS3, GHWPARAMS3_30_23, 23, 8)
259
+ FIELD(GHWPARAMS3, GHWPARAMS3_22_18, 18, 5)
260
+ FIELD(GHWPARAMS3, GHWPARAMS3_17_12, 12, 6)
261
+ FIELD(GHWPARAMS3, GHWPARAMS3_11, 11, 1)
262
+ FIELD(GHWPARAMS3, GHWPARAMS3_10, 10, 1)
263
+ FIELD(GHWPARAMS3, GHWPARAMS3_9_8, 8, 2)
264
+ FIELD(GHWPARAMS3, GHWPARAMS3_7_6, 6, 2)
265
+ FIELD(GHWPARAMS3, GHWPARAMS3_5_4, 4, 2)
266
+ FIELD(GHWPARAMS3, GHWPARAMS3_3_2, 2, 2)
267
+ FIELD(GHWPARAMS3, GHWPARAMS3_1_0, 0, 2)
268
+REG32(GHWPARAMS4, 0x50)
269
+ FIELD(GHWPARAMS4, GHWPARAMS4_31_28, 28, 4)
270
+ FIELD(GHWPARAMS4, GHWPARAMS4_27_24, 24, 4)
271
+ FIELD(GHWPARAMS4, GHWPARAMS4_23, 23, 1)
272
+ FIELD(GHWPARAMS4, GHWPARAMS4_22, 22, 1)
273
+ FIELD(GHWPARAMS4, GHWPARAMS4_21, 21, 1)
274
+ FIELD(GHWPARAMS4, GHWPARAMS4_20_17, 17, 4)
275
+ FIELD(GHWPARAMS4, GHWPARAMS4_16_13, 13, 4)
276
+ FIELD(GHWPARAMS4, GHWPARAMS4_12, 12, 1)
277
+ FIELD(GHWPARAMS4, GHWPARAMS4_11, 11, 1)
278
+ FIELD(GHWPARAMS4, GHWPARAMS4_10_9, 9, 2)
279
+ FIELD(GHWPARAMS4, GHWPARAMS4_8_7, 7, 2)
280
+ FIELD(GHWPARAMS4, GHWPARAMS4_6, 6, 1)
281
+ FIELD(GHWPARAMS4, GHWPARAMS4_5_0, 0, 6)
282
+REG32(GHWPARAMS5, 0x54)
283
+ FIELD(GHWPARAMS5, GHWPARAMS5_31_28, 28, 4)
284
+ FIELD(GHWPARAMS5, GHWPARAMS5_27_22, 22, 6)
285
+ FIELD(GHWPARAMS5, GHWPARAMS5_21_16, 16, 6)
286
+ FIELD(GHWPARAMS5, GHWPARAMS5_15_10, 10, 6)
287
+ FIELD(GHWPARAMS5, GHWPARAMS5_9_4, 4, 6)
288
+ FIELD(GHWPARAMS5, GHWPARAMS5_3_0, 0, 4)
289
+REG32(GHWPARAMS6, 0x58)
290
+ FIELD(GHWPARAMS6, GHWPARAMS6_31_16, 16, 16)
291
+ FIELD(GHWPARAMS6, BUSFLTRSSUPPORT, 15, 1)
292
+ FIELD(GHWPARAMS6, BCSUPPORT, 14, 1)
293
+ FIELD(GHWPARAMS6, OTG_SS_SUPPORT, 13, 1)
294
+ FIELD(GHWPARAMS6, ADPSUPPORT, 12, 1)
295
+ FIELD(GHWPARAMS6, HNPSUPPORT, 11, 1)
296
+ FIELD(GHWPARAMS6, SRPSUPPORT, 10, 1)
297
+ FIELD(GHWPARAMS6, GHWPARAMS6_9_8, 8, 2)
298
+ FIELD(GHWPARAMS6, GHWPARAMS6_7, 7, 1)
299
+ FIELD(GHWPARAMS6, GHWPARAMS6_6, 6, 1)
300
+ FIELD(GHWPARAMS6, GHWPARAMS6_5_0, 0, 6)
301
+REG32(GHWPARAMS7, 0x5c)
302
+ FIELD(GHWPARAMS7, GHWPARAMS7_31_16, 16, 16)
303
+ FIELD(GHWPARAMS7, GHWPARAMS7_15_0, 0, 16)
304
+REG32(GDBGFIFOSPACE, 0x60)
305
+ FIELD(GDBGFIFOSPACE, SPACE_AVAILABLE, 16, 16)
306
+ FIELD(GDBGFIFOSPACE, RESERVED_15_9, 9, 7)
307
+ FIELD(GDBGFIFOSPACE, FIFO_QUEUE_SELECT, 0, 9)
308
+REG32(GUCTL2, 0x9c)
309
+ FIELD(GUCTL2, RESERVED_31_26, 26, 6)
310
+ FIELD(GUCTL2, EN_HP_PM_TIMER, 19, 7)
311
+ FIELD(GUCTL2, NOLOWPWRDUR, 15, 4)
312
+ FIELD(GUCTL2, RST_ACTBITLATER, 14, 1)
313
+ FIELD(GUCTL2, RESERVED_13, 13, 1)
314
+ FIELD(GUCTL2, DISABLECFC, 11, 1)
315
+REG32(GUSB2PHYCFG, 0x100)
316
+ FIELD(GUSB2PHYCFG, U2_FREECLK_EXISTS, 30, 1)
317
+ FIELD(GUSB2PHYCFG, ULPI_LPM_WITH_OPMODE_CHK, 29, 1)
318
+ FIELD(GUSB2PHYCFG, RESERVED_25, 25, 1)
319
+ FIELD(GUSB2PHYCFG, LSTRD, 22, 3)
320
+ FIELD(GUSB2PHYCFG, LSIPD, 19, 3)
321
+ FIELD(GUSB2PHYCFG, ULPIEXTVBUSINDIACTOR, 18, 1)
322
+ FIELD(GUSB2PHYCFG, ULPIEXTVBUSDRV, 17, 1)
323
+ FIELD(GUSB2PHYCFG, RESERVED_16, 16, 1)
324
+ FIELD(GUSB2PHYCFG, ULPIAUTORES, 15, 1)
325
+ FIELD(GUSB2PHYCFG, RESERVED_14, 14, 1)
326
+ FIELD(GUSB2PHYCFG, USBTRDTIM, 10, 4)
327
+ FIELD(GUSB2PHYCFG, XCVRDLY, 9, 1)
328
+ FIELD(GUSB2PHYCFG, ENBLSLPM, 8, 1)
329
+ FIELD(GUSB2PHYCFG, PHYSEL, 7, 1)
330
+ FIELD(GUSB2PHYCFG, SUSPENDUSB20, 6, 1)
331
+ FIELD(GUSB2PHYCFG, FSINTF, 5, 1)
332
+ FIELD(GUSB2PHYCFG, ULPI_UTMI_SEL, 4, 1)
333
+ FIELD(GUSB2PHYCFG, PHYIF, 3, 1)
334
+ FIELD(GUSB2PHYCFG, TOUTCAL, 0, 3)
335
+REG32(GUSB2I2CCTL, 0x140)
336
+REG32(GUSB2PHYACC_ULPI, 0x180)
337
+ FIELD(GUSB2PHYACC_ULPI, RESERVED_31_27, 27, 5)
338
+ FIELD(GUSB2PHYACC_ULPI, DISUIPIDRVR, 26, 1)
339
+ FIELD(GUSB2PHYACC_ULPI, NEWREGREQ, 25, 1)
340
+ FIELD(GUSB2PHYACC_ULPI, VSTSDONE, 24, 1)
341
+ FIELD(GUSB2PHYACC_ULPI, VSTSBSY, 23, 1)
342
+ FIELD(GUSB2PHYACC_ULPI, REGWR, 22, 1)
343
+ FIELD(GUSB2PHYACC_ULPI, REGADDR, 16, 6)
344
+ FIELD(GUSB2PHYACC_ULPI, EXTREGADDR, 8, 8)
345
+ FIELD(GUSB2PHYACC_ULPI, REGDATA, 0, 8)
346
+REG32(GTXFIFOSIZ0, 0x200)
347
+ FIELD(GTXFIFOSIZ0, TXFSTADDR_N, 16, 16)
348
+ FIELD(GTXFIFOSIZ0, TXFDEP_N, 0, 16)
349
+REG32(GTXFIFOSIZ1, 0x204)
350
+ FIELD(GTXFIFOSIZ1, TXFSTADDR_N, 16, 16)
351
+ FIELD(GTXFIFOSIZ1, TXFDEP_N, 0, 16)
352
+REG32(GTXFIFOSIZ2, 0x208)
353
+ FIELD(GTXFIFOSIZ2, TXFSTADDR_N, 16, 16)
354
+ FIELD(GTXFIFOSIZ2, TXFDEP_N, 0, 16)
355
+REG32(GTXFIFOSIZ3, 0x20c)
356
+ FIELD(GTXFIFOSIZ3, TXFSTADDR_N, 16, 16)
357
+ FIELD(GTXFIFOSIZ3, TXFDEP_N, 0, 16)
358
+REG32(GTXFIFOSIZ4, 0x210)
359
+ FIELD(GTXFIFOSIZ4, TXFSTADDR_N, 16, 16)
360
+ FIELD(GTXFIFOSIZ4, TXFDEP_N, 0, 16)
361
+REG32(GTXFIFOSIZ5, 0x214)
362
+ FIELD(GTXFIFOSIZ5, TXFSTADDR_N, 16, 16)
363
+ FIELD(GTXFIFOSIZ5, TXFDEP_N, 0, 16)
364
+REG32(GRXFIFOSIZ0, 0x280)
365
+ FIELD(GRXFIFOSIZ0, RXFSTADDR_N, 16, 16)
366
+ FIELD(GRXFIFOSIZ0, RXFDEP_N, 0, 16)
367
+REG32(GRXFIFOSIZ1, 0x284)
368
+ FIELD(GRXFIFOSIZ1, RXFSTADDR_N, 16, 16)
369
+ FIELD(GRXFIFOSIZ1, RXFDEP_N, 0, 16)
370
+REG32(GRXFIFOSIZ2, 0x288)
371
+ FIELD(GRXFIFOSIZ2, RXFSTADDR_N, 16, 16)
372
+ FIELD(GRXFIFOSIZ2, RXFDEP_N, 0, 16)
373
+REG32(GEVNTADRLO_0, 0x300)
374
+REG32(GEVNTADRHI_0, 0x304)
375
+REG32(GEVNTSIZ_0, 0x308)
376
+ FIELD(GEVNTSIZ_0, EVNTINTRPTMASK, 31, 1)
377
+ FIELD(GEVNTSIZ_0, RESERVED_30_16, 16, 15)
378
+ FIELD(GEVNTSIZ_0, EVENTSIZ, 0, 16)
379
+REG32(GEVNTCOUNT_0, 0x30c)
380
+ FIELD(GEVNTCOUNT_0, EVNT_HANDLER_BUSY, 31, 1)
381
+ FIELD(GEVNTCOUNT_0, RESERVED_30_16, 16, 15)
382
+ FIELD(GEVNTCOUNT_0, EVNTCOUNT, 0, 16)
383
+REG32(GEVNTADRLO_1, 0x310)
384
+REG32(GEVNTADRHI_1, 0x314)
385
+REG32(GEVNTSIZ_1, 0x318)
386
+ FIELD(GEVNTSIZ_1, EVNTINTRPTMASK, 31, 1)
387
+ FIELD(GEVNTSIZ_1, RESERVED_30_16, 16, 15)
388
+ FIELD(GEVNTSIZ_1, EVENTSIZ, 0, 16)
389
+REG32(GEVNTCOUNT_1, 0x31c)
390
+ FIELD(GEVNTCOUNT_1, EVNT_HANDLER_BUSY, 31, 1)
391
+ FIELD(GEVNTCOUNT_1, RESERVED_30_16, 16, 15)
392
+ FIELD(GEVNTCOUNT_1, EVNTCOUNT, 0, 16)
393
+REG32(GEVNTADRLO_2, 0x320)
394
+REG32(GEVNTADRHI_2, 0x324)
395
+REG32(GEVNTSIZ_2, 0x328)
396
+ FIELD(GEVNTSIZ_2, EVNTINTRPTMASK, 31, 1)
397
+ FIELD(GEVNTSIZ_2, RESERVED_30_16, 16, 15)
398
+ FIELD(GEVNTSIZ_2, EVENTSIZ, 0, 16)
399
+REG32(GEVNTCOUNT_2, 0x32c)
400
+ FIELD(GEVNTCOUNT_2, EVNT_HANDLER_BUSY, 31, 1)
401
+ FIELD(GEVNTCOUNT_2, RESERVED_30_16, 16, 15)
402
+ FIELD(GEVNTCOUNT_2, EVNTCOUNT, 0, 16)
403
+REG32(GEVNTADRLO_3, 0x330)
404
+REG32(GEVNTADRHI_3, 0x334)
405
+REG32(GEVNTSIZ_3, 0x338)
406
+ FIELD(GEVNTSIZ_3, EVNTINTRPTMASK, 31, 1)
407
+ FIELD(GEVNTSIZ_3, RESERVED_30_16, 16, 15)
408
+ FIELD(GEVNTSIZ_3, EVENTSIZ, 0, 16)
409
+REG32(GEVNTCOUNT_3, 0x33c)
410
+ FIELD(GEVNTCOUNT_3, EVNT_HANDLER_BUSY, 31, 1)
411
+ FIELD(GEVNTCOUNT_3, RESERVED_30_16, 16, 15)
412
+ FIELD(GEVNTCOUNT_3, EVNTCOUNT, 0, 16)
413
+REG32(GHWPARAMS8, 0x500)
414
+REG32(GTXFIFOPRIDEV, 0x510)
415
+ FIELD(GTXFIFOPRIDEV, RESERVED_31_N, 6, 26)
416
+ FIELD(GTXFIFOPRIDEV, GTXFIFOPRIDEV, 0, 6)
417
+REG32(GTXFIFOPRIHST, 0x518)
418
+ FIELD(GTXFIFOPRIHST, RESERVED_31_16, 3, 29)
419
+ FIELD(GTXFIFOPRIHST, GTXFIFOPRIHST, 0, 3)
420
+REG32(GRXFIFOPRIHST, 0x51c)
421
+ FIELD(GRXFIFOPRIHST, RESERVED_31_16, 3, 29)
422
+ FIELD(GRXFIFOPRIHST, GRXFIFOPRIHST, 0, 3)
423
+REG32(GDMAHLRATIO, 0x524)
424
+ FIELD(GDMAHLRATIO, RESERVED_31_13, 13, 19)
425
+ FIELD(GDMAHLRATIO, HSTRXFIFO, 8, 5)
426
+ FIELD(GDMAHLRATIO, RESERVED_7_5, 5, 3)
427
+ FIELD(GDMAHLRATIO, HSTTXFIFO, 0, 5)
428
+REG32(GFLADJ, 0x530)
429
+ FIELD(GFLADJ, GFLADJ_REFCLK_240MHZDECR_PLS1, 31, 1)
430
+ FIELD(GFLADJ, GFLADJ_REFCLK_240MHZ_DECR, 24, 7)
431
+ FIELD(GFLADJ, GFLADJ_REFCLK_LPM_SEL, 23, 1)
432
+ FIELD(GFLADJ, RESERVED_22, 22, 1)
433
+ FIELD(GFLADJ, GFLADJ_REFCLK_FLADJ, 8, 14)
434
+ FIELD(GFLADJ, GFLADJ_30MHZ_SDBND_SEL, 7, 1)
435
+ FIELD(GFLADJ, GFLADJ_30MHZ, 0, 6)
436
+
437
+#define DWC3_GLOBAL_OFFSET 0xC100
438
+static void reset_csr(USBDWC3 * s)
26
+{
439
+{
27
+ long off = neon_element_offset(reg, ele, size);
440
+ int i = 0;
28
+
441
+ /*
29
+ switch (size) {
442
+ * We reset all CSR regs except GCTL, GUCTL, GSTS, GSNPSID, GGPIO, GUID,
30
+ case MO_32:
443
+ * GUSB2PHYCFGn registers and GUSB3PIPECTLn registers. We will skip PHY
31
+ tcg_gen_ld_i32(dest, cpu_env, off);
444
+ * register as we don't implement them.
32
+ break;
445
+ */
33
+ default:
446
+ for (i = 0; i < USB_DWC3_R_MAX; i++) {
34
+ g_assert_not_reached();
447
+ switch (i) {
448
+ case R_GCTL:
449
+ break;
450
+ case R_GSTS:
451
+ break;
452
+ case R_GSNPSID:
453
+ break;
454
+ case R_GGPIO:
455
+ break;
456
+ case R_GUID:
457
+ break;
458
+ case R_GUCTL:
459
+ break;
460
+ case R_GHWPARAMS0...R_GHWPARAMS7:
461
+ break;
462
+ case R_GHWPARAMS8:
463
+ break;
464
+ default:
465
+ register_reset(&s->regs_info[i]);
466
+ break;
467
+ }
468
+ }
469
+
470
+ xhci_sysbus_reset(DEVICE(&s->sysbus_xhci));
471
+}
472
+
473
+static void usb_dwc3_gctl_postw(RegisterInfo *reg, uint64_t val64)
474
+{
475
+ USBDWC3 *s = USB_DWC3(reg->opaque);
476
+
477
+ if (ARRAY_FIELD_EX32(s->regs, GCTL, CORESOFTRESET)) {
478
+ reset_csr(s);
35
+ }
479
+ }
36
+}
480
+}
37
+
481
+
38
+static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size)
482
+static void usb_dwc3_guid_postw(RegisterInfo *reg, uint64_t val64)
39
+{
483
+{
40
+ long off = neon_element_offset(reg, ele, size);
484
+ USBDWC3 *s = USB_DWC3(reg->opaque);
41
+
485
+
42
+ switch (size) {
486
+ s->regs[R_GUID] = s->cfg.dwc_usb3_user;
43
+ case MO_32:
487
+}
44
+ tcg_gen_st_i32(src, cpu_env, off);
488
+
45
+ break;
489
+static const RegisterAccessInfo usb_dwc3_regs_info[] = {
46
+ default:
490
+ { .name = "GSBUSCFG0", .addr = A_GSBUSCFG0,
47
+ g_assert_not_reached();
491
+ .ro = 0xf300,
492
+ .unimp = 0xffffffff,
493
+ },{ .name = "GSBUSCFG1", .addr = A_GSBUSCFG1,
494
+ .reset = 0x300,
495
+ .ro = 0xffffe0ff,
496
+ .unimp = 0xffffffff,
497
+ },{ .name = "GTXTHRCFG", .addr = A_GTXTHRCFG,
498
+ .ro = 0xd000ffff,
499
+ .unimp = 0xffffffff,
500
+ },{ .name = "GRXTHRCFG", .addr = A_GRXTHRCFG,
501
+ .ro = 0xd007e000,
502
+ .unimp = 0xffffffff,
503
+ },{ .name = "GCTL", .addr = A_GCTL,
504
+ .reset = 0x30c13004, .post_write = usb_dwc3_gctl_postw,
505
+ },{ .name = "GPMSTS", .addr = A_GPMSTS,
506
+ .ro = 0xfffffff,
507
+ .unimp = 0xffffffff,
508
+ },{ .name = "GSTS", .addr = A_GSTS,
509
+ .reset = 0x7e800000,
510
+ .ro = 0xffffffcf,
511
+ .w1c = 0x30,
512
+ .unimp = 0xffffffff,
513
+ },{ .name = "GUCTL1", .addr = A_GUCTL1,
514
+ .reset = 0x198a,
515
+ .ro = 0x7800,
516
+ .unimp = 0xffffffff,
517
+ },{ .name = "GSNPSID", .addr = A_GSNPSID,
518
+ .reset = 0x5533330a,
519
+ .ro = 0xffffffff,
520
+ },{ .name = "GGPIO", .addr = A_GGPIO,
521
+ .ro = 0xffff,
522
+ .unimp = 0xffffffff,
523
+ },{ .name = "GUID", .addr = A_GUID,
524
+ .reset = 0x12345678, .post_write = usb_dwc3_guid_postw,
525
+ },{ .name = "GUCTL", .addr = A_GUCTL,
526
+ .reset = 0x0c808010,
527
+ .ro = 0x1c8000,
528
+ .unimp = 0xffffffff,
529
+ },{ .name = "GBUSERRADDRLO", .addr = A_GBUSERRADDRLO,
530
+ .ro = 0xffffffff,
531
+ },{ .name = "GBUSERRADDRHI", .addr = A_GBUSERRADDRHI,
532
+ .ro = 0xffffffff,
533
+ },{ .name = "GHWPARAMS0", .addr = A_GHWPARAMS0,
534
+ .ro = 0xffffffff,
535
+ },{ .name = "GHWPARAMS1", .addr = A_GHWPARAMS1,
536
+ .ro = 0xffffffff,
537
+ },{ .name = "GHWPARAMS2", .addr = A_GHWPARAMS2,
538
+ .ro = 0xffffffff,
539
+ },{ .name = "GHWPARAMS3", .addr = A_GHWPARAMS3,
540
+ .ro = 0xffffffff,
541
+ },{ .name = "GHWPARAMS4", .addr = A_GHWPARAMS4,
542
+ .ro = 0xffffffff,
543
+ },{ .name = "GHWPARAMS5", .addr = A_GHWPARAMS5,
544
+ .ro = 0xffffffff,
545
+ },{ .name = "GHWPARAMS6", .addr = A_GHWPARAMS6,
546
+ .ro = 0xffffffff,
547
+ },{ .name = "GHWPARAMS7", .addr = A_GHWPARAMS7,
548
+ .ro = 0xffffffff,
549
+ },{ .name = "GDBGFIFOSPACE", .addr = A_GDBGFIFOSPACE,
550
+ .reset = 0xa0000,
551
+ .ro = 0xfffffe00,
552
+ .unimp = 0xffffffff,
553
+ },{ .name = "GUCTL2", .addr = A_GUCTL2,
554
+ .reset = 0x40d,
555
+ .ro = 0x2000,
556
+ .unimp = 0xffffffff,
557
+ },{ .name = "GUSB2PHYCFG", .addr = A_GUSB2PHYCFG,
558
+ .reset = 0x40102410,
559
+ .ro = 0x1e014030,
560
+ .unimp = 0xffffffff,
561
+ },{ .name = "GUSB2I2CCTL", .addr = A_GUSB2I2CCTL,
562
+ .ro = 0xffffffff,
563
+ .unimp = 0xffffffff,
564
+ },{ .name = "GUSB2PHYACC_ULPI", .addr = A_GUSB2PHYACC_ULPI,
565
+ .ro = 0xfd000000,
566
+ .unimp = 0xffffffff,
567
+ },{ .name = "GTXFIFOSIZ0", .addr = A_GTXFIFOSIZ0,
568
+ .reset = 0x2c7000a,
569
+ .unimp = 0xffffffff,
570
+ },{ .name = "GTXFIFOSIZ1", .addr = A_GTXFIFOSIZ1,
571
+ .reset = 0x2d10103,
572
+ .unimp = 0xffffffff,
573
+ },{ .name = "GTXFIFOSIZ2", .addr = A_GTXFIFOSIZ2,
574
+ .reset = 0x3d40103,
575
+ .unimp = 0xffffffff,
576
+ },{ .name = "GTXFIFOSIZ3", .addr = A_GTXFIFOSIZ3,
577
+ .reset = 0x4d70083,
578
+ .unimp = 0xffffffff,
579
+ },{ .name = "GTXFIFOSIZ4", .addr = A_GTXFIFOSIZ4,
580
+ .reset = 0x55a0083,
581
+ .unimp = 0xffffffff,
582
+ },{ .name = "GTXFIFOSIZ5", .addr = A_GTXFIFOSIZ5,
583
+ .reset = 0x5dd0083,
584
+ .unimp = 0xffffffff,
585
+ },{ .name = "GRXFIFOSIZ0", .addr = A_GRXFIFOSIZ0,
586
+ .reset = 0x1c20105,
587
+ .unimp = 0xffffffff,
588
+ },{ .name = "GRXFIFOSIZ1", .addr = A_GRXFIFOSIZ1,
589
+ .reset = 0x2c70000,
590
+ .unimp = 0xffffffff,
591
+ },{ .name = "GRXFIFOSIZ2", .addr = A_GRXFIFOSIZ2,
592
+ .reset = 0x2c70000,
593
+ .unimp = 0xffffffff,
594
+ },{ .name = "GEVNTADRLO_0", .addr = A_GEVNTADRLO_0,
595
+ .unimp = 0xffffffff,
596
+ },{ .name = "GEVNTADRHI_0", .addr = A_GEVNTADRHI_0,
597
+ .unimp = 0xffffffff,
598
+ },{ .name = "GEVNTSIZ_0", .addr = A_GEVNTSIZ_0,
599
+ .ro = 0x7fff0000,
600
+ .unimp = 0xffffffff,
601
+ },{ .name = "GEVNTCOUNT_0", .addr = A_GEVNTCOUNT_0,
602
+ .ro = 0x7fff0000,
603
+ .unimp = 0xffffffff,
604
+ },{ .name = "GEVNTADRLO_1", .addr = A_GEVNTADRLO_1,
605
+ .unimp = 0xffffffff,
606
+ },{ .name = "GEVNTADRHI_1", .addr = A_GEVNTADRHI_1,
607
+ .unimp = 0xffffffff,
608
+ },{ .name = "GEVNTSIZ_1", .addr = A_GEVNTSIZ_1,
609
+ .ro = 0x7fff0000,
610
+ .unimp = 0xffffffff,
611
+ },{ .name = "GEVNTCOUNT_1", .addr = A_GEVNTCOUNT_1,
612
+ .ro = 0x7fff0000,
613
+ .unimp = 0xffffffff,
614
+ },{ .name = "GEVNTADRLO_2", .addr = A_GEVNTADRLO_2,
615
+ .unimp = 0xffffffff,
616
+ },{ .name = "GEVNTADRHI_2", .addr = A_GEVNTADRHI_2,
617
+ .unimp = 0xffffffff,
618
+ },{ .name = "GEVNTSIZ_2", .addr = A_GEVNTSIZ_2,
619
+ .ro = 0x7fff0000,
620
+ .unimp = 0xffffffff,
621
+ },{ .name = "GEVNTCOUNT_2", .addr = A_GEVNTCOUNT_2,
622
+ .ro = 0x7fff0000,
623
+ .unimp = 0xffffffff,
624
+ },{ .name = "GEVNTADRLO_3", .addr = A_GEVNTADRLO_3,
625
+ .unimp = 0xffffffff,
626
+ },{ .name = "GEVNTADRHI_3", .addr = A_GEVNTADRHI_3,
627
+ .unimp = 0xffffffff,
628
+ },{ .name = "GEVNTSIZ_3", .addr = A_GEVNTSIZ_3,
629
+ .ro = 0x7fff0000,
630
+ .unimp = 0xffffffff,
631
+ },{ .name = "GEVNTCOUNT_3", .addr = A_GEVNTCOUNT_3,
632
+ .ro = 0x7fff0000,
633
+ .unimp = 0xffffffff,
634
+ },{ .name = "GHWPARAMS8", .addr = A_GHWPARAMS8,
635
+ .ro = 0xffffffff,
636
+ },{ .name = "GTXFIFOPRIDEV", .addr = A_GTXFIFOPRIDEV,
637
+ .ro = 0xffffffc0,
638
+ .unimp = 0xffffffff,
639
+ },{ .name = "GTXFIFOPRIHST", .addr = A_GTXFIFOPRIHST,
640
+ .ro = 0xfffffff8,
641
+ .unimp = 0xffffffff,
642
+ },{ .name = "GRXFIFOPRIHST", .addr = A_GRXFIFOPRIHST,
643
+ .ro = 0xfffffff8,
644
+ .unimp = 0xffffffff,
645
+ },{ .name = "GDMAHLRATIO", .addr = A_GDMAHLRATIO,
646
+ .ro = 0xffffe0e0,
647
+ .unimp = 0xffffffff,
648
+ },{ .name = "GFLADJ", .addr = A_GFLADJ,
649
+ .reset = 0xc83f020,
650
+ .rsvd = 0x40,
651
+ .ro = 0x400040,
652
+ .unimp = 0xffffffff,
48
+ }
653
+ }
654
+};
655
+
656
+static void usb_dwc3_reset(DeviceState *dev)
657
+{
658
+ USBDWC3 *s = USB_DWC3(dev);
659
+ unsigned int i;
660
+
661
+ for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
662
+ switch (i) {
663
+ case R_GHWPARAMS0...R_GHWPARAMS7:
664
+ break;
665
+ case R_GHWPARAMS8:
666
+ break;
667
+ default:
668
+ register_reset(&s->regs_info[i]);
669
+ };
670
+ }
671
+
672
+ xhci_sysbus_reset(DEVICE(&s->sysbus_xhci));
49
+}
673
+}
50
+
674
+
51
static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
675
+static const MemoryRegionOps usb_dwc3_ops = {
52
{
676
+ .read = register_read_memory,
53
TCGv_ptr ret = tcg_temp_new_ptr();
677
+ .write = register_write_memory,
54
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
678
+ .endianness = DEVICE_LITTLE_ENDIAN,
679
+ .valid = {
680
+ .min_access_size = 4,
681
+ .max_access_size = 4,
682
+ },
683
+};
684
+
685
+static void usb_dwc3_realize(DeviceState *dev, Error **errp)
686
+{
687
+ USBDWC3 *s = USB_DWC3(dev);
688
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
689
+ Error *err = NULL;
690
+
691
+ sysbus_realize(SYS_BUS_DEVICE(&s->sysbus_xhci), &err);
692
+ if (err) {
693
+ error_propagate(errp, err);
694
+ return;
695
+ }
696
+
697
+ memory_region_add_subregion(&s->iomem, 0,
698
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sysbus_xhci), 0));
699
+ sysbus_init_mmio(sbd, &s->iomem);
700
+
701
+ /*
702
+ * Device Configuration
703
+ */
704
+ s->regs[R_GHWPARAMS0] = 0x40204048 | s->cfg.mode;
705
+ s->regs[R_GHWPARAMS1] = 0x222493b;
706
+ s->regs[R_GHWPARAMS2] = 0x12345678;
707
+ s->regs[R_GHWPARAMS3] = 0x618c088;
708
+ s->regs[R_GHWPARAMS4] = 0x47822004;
709
+ s->regs[R_GHWPARAMS5] = 0x4202088;
710
+ s->regs[R_GHWPARAMS6] = 0x7850c20;
711
+ s->regs[R_GHWPARAMS7] = 0x0;
712
+ s->regs[R_GHWPARAMS8] = 0x478;
713
+}
714
+
715
+static void usb_dwc3_init(Object *obj)
716
+{
717
+ USBDWC3 *s = USB_DWC3(obj);
718
+ RegisterInfoArray *reg_array;
719
+
720
+ memory_region_init(&s->iomem, obj, TYPE_USB_DWC3, DWC3_SIZE);
721
+ reg_array =
722
+ register_init_block32(DEVICE(obj), usb_dwc3_regs_info,
723
+ ARRAY_SIZE(usb_dwc3_regs_info),
724
+ s->regs_info, s->regs,
725
+ &usb_dwc3_ops,
726
+ USB_DWC3_ERR_DEBUG,
727
+ USB_DWC3_R_MAX * 4);
728
+ memory_region_add_subregion(&s->iomem,
729
+ DWC3_GLOBAL_OFFSET,
730
+ &reg_array->mem);
731
+ object_initialize_child(obj, "dwc3-xhci", &s->sysbus_xhci,
732
+ TYPE_XHCI_SYSBUS);
733
+ qdev_alias_all_properties(DEVICE(&s->sysbus_xhci), obj);
734
+
735
+ s->cfg.mode = HOST_MODE;
736
+}
737
+
738
+static const VMStateDescription vmstate_usb_dwc3 = {
739
+ .name = "usb-dwc3",
740
+ .version_id = 1,
741
+ .fields = (VMStateField[]) {
742
+ VMSTATE_UINT32_ARRAY(regs, USBDWC3, USB_DWC3_R_MAX),
743
+ VMSTATE_UINT8(cfg.mode, USBDWC3),
744
+ VMSTATE_UINT32(cfg.dwc_usb3_user, USBDWC3),
745
+ VMSTATE_END_OF_LIST()
746
+ }
747
+};
748
+
749
+static Property usb_dwc3_properties[] = {
750
+ DEFINE_PROP_UINT32("DWC_USB3_USERID", USBDWC3, cfg.dwc_usb3_user,
751
+ 0x12345678),
752
+ DEFINE_PROP_END_OF_LIST(),
753
+};
754
+
755
+static void usb_dwc3_class_init(ObjectClass *klass, void *data)
756
+{
757
+ DeviceClass *dc = DEVICE_CLASS(klass);
758
+
759
+ dc->reset = usb_dwc3_reset;
760
+ dc->realize = usb_dwc3_realize;
761
+ dc->vmsd = &vmstate_usb_dwc3;
762
+ device_class_set_props(dc, usb_dwc3_properties);
763
+}
764
+
765
+static const TypeInfo usb_dwc3_info = {
766
+ .name = TYPE_USB_DWC3,
767
+ .parent = TYPE_SYS_BUS_DEVICE,
768
+ .instance_size = sizeof(USBDWC3),
769
+ .class_init = usb_dwc3_class_init,
770
+ .instance_init = usb_dwc3_init,
771
+};
772
+
773
+static void usb_dwc3_register_types(void)
774
+{
775
+ type_register_static(&usb_dwc3_info);
776
+}
777
+
778
+type_init(usb_dwc3_register_types)
779
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
55
index XXXXXXX..XXXXXXX 100644
780
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/translate-neon.c.inc
781
--- a/hw/usb/Kconfig
57
+++ b/target/arm/translate-neon.c.inc
782
+++ b/hw/usb/Kconfig
58
@@ -XXX,XX +XXX,XX @@ static bool do_3same_pair(DisasContext *s, arg_3same *a, NeonGenTwoOpFn *fn)
783
@@ -XXX,XX +XXX,XX @@ config IMX_USBPHY
59
* early. Since Q is 0 there are always just two passes, so instead
784
bool
60
* of a complicated loop over each pass we just unroll.
785
default y
61
*/
786
depends on USB
62
- tmp = neon_load_reg(a->vn, 0);
787
+
63
- tmp2 = neon_load_reg(a->vn, 1);
788
+config USB_DWC3
64
+ tmp = tcg_temp_new_i32();
789
+ bool
65
+ tmp2 = tcg_temp_new_i32();
790
+ select USB_XHCI_SYSBUS
66
+ tmp3 = tcg_temp_new_i32();
791
+ select REGISTER
67
+
792
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
68
+ read_neon_element32(tmp, a->vn, 0, MO_32);
793
index XXXXXXX..XXXXXXX 100644
69
+ read_neon_element32(tmp2, a->vn, 1, MO_32);
794
--- a/hw/usb/meson.build
70
fn(tmp, tmp, tmp2);
795
+++ b/hw/usb/meson.build
71
- tcg_temp_free_i32(tmp2);
796
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_USB_XHCI_SYSBUS', if_true: files('hcd-xhci-sysbus.c
72
797
softmmu_ss.add(when: 'CONFIG_USB_XHCI_NEC', if_true: files('hcd-xhci-nec.c'))
73
- tmp3 = neon_load_reg(a->vm, 0);
798
softmmu_ss.add(when: 'CONFIG_USB_MUSB', if_true: files('hcd-musb.c'))
74
- tmp2 = neon_load_reg(a->vm, 1);
799
softmmu_ss.add(when: 'CONFIG_USB_DWC2', if_true: files('hcd-dwc2.c'))
75
+ read_neon_element32(tmp3, a->vm, 0, MO_32);
800
+softmmu_ss.add(when: 'CONFIG_USB_DWC3', if_true: files('hcd-dwc3.c'))
76
+ read_neon_element32(tmp2, a->vm, 1, MO_32);
801
77
fn(tmp3, tmp3, tmp2);
802
softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c'))
78
- tcg_temp_free_i32(tmp2);
803
softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c'))
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
}
90
91
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a,
92
* 2-reg-and-shift operations, size < 3 case, where the
93
* helper needs to be passed cpu_env.
94
*/
95
- TCGv_i32 constimm;
96
+ TCGv_i32 constimm, tmp;
97
int pass;
98
99
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
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
}
117
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a,
118
constimm = tcg_const_i64(-a->shift);
119
rm1 = tcg_temp_new_i64();
120
rm2 = tcg_temp_new_i64();
121
+ rd = tcg_temp_new_i32();
122
123
/* Load both inputs first to avoid potential overwrite if rm == rd */
124
neon_load_reg64(rm1, a->vm);
125
neon_load_reg64(rm2, a->vm + 1);
126
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
}
181
182
@@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a,
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
--
804
--
623
2.20.1
805
2.20.1
624
806
625
807
diff view generated by jsdifflib
1
From: AlexChen <alex.chen@huawei.com>
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
2
2
3
In exynos4210_fimd_update(), the pointer s is dereferinced before
3
This model is a top level integration wrapper for hcd-dwc3 and
4
being check if it is valid, which may lead to NULL pointer dereference.
4
versal-usb2-ctrl-regs modules, this is used by xilinx versal soc's and
5
So move the assignment to global_width after checking that the s is valid.
5
future xilinx usb subsystems would also be part of it.
6
6
7
Reported-by: Euler Robot <euler.robot@huawei.com>
7
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
8
Signed-off-by: Alex Chen <alex.chen@huawei.com>
8
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 5F9F8D88.9030102@huawei.com
10
Message-id: 1607023357-5096-4-git-send-email-sai.pavan.boddu@xilinx.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
12
---
13
hw/display/exynos4210_fimd.c | 4 +++-
13
include/hw/usb/xlnx-usb-subsystem.h | 45 ++++++++++++++
14
1 file changed, 3 insertions(+), 1 deletion(-)
14
hw/usb/xlnx-usb-subsystem.c | 94 +++++++++++++++++++++++++++++
15
15
hw/usb/Kconfig | 5 ++
16
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
16
hw/usb/meson.build | 1 +
17
4 files changed, 145 insertions(+)
18
create mode 100644 include/hw/usb/xlnx-usb-subsystem.h
19
create mode 100644 hw/usb/xlnx-usb-subsystem.c
20
21
diff --git a/include/hw/usb/xlnx-usb-subsystem.h b/include/hw/usb/xlnx-usb-subsystem.h
22
new file mode 100644
23
index XXXXXXX..XXXXXXX
24
--- /dev/null
25
+++ b/include/hw/usb/xlnx-usb-subsystem.h
26
@@ -XXX,XX +XXX,XX @@
27
+/*
28
+ * QEMU model of the Xilinx usb subsystem
29
+ *
30
+ * Copyright (c) 2020 Xilinx Inc. Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
31
+ *
32
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ * of this software and associated documentation files (the "Software"), to deal
34
+ * in the Software without restriction, including without limitation the rights
35
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ * copies of the Software, and to permit persons to whom the Software is
37
+ * furnished to do so, subject to the following conditions:
38
+ *
39
+ * The above copyright notice and this permission notice shall be included in
40
+ * all copies or substantial portions of the Software.
41
+ *
42
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
48
+ * THE SOFTWARE.
49
+ */
50
+
51
+#ifndef _XLNX_VERSAL_USB_SUBSYSTEM_H_
52
+#define _XLNX_VERSAL_USB_SUBSYSTEM_H_
53
+
54
+#include "hw/usb/xlnx-versal-usb2-ctrl-regs.h"
55
+#include "hw/usb/hcd-dwc3.h"
56
+
57
+#define TYPE_XILINX_VERSAL_USB2 "xlnx.versal-usb2"
58
+
59
+#define VERSAL_USB2(obj) \
60
+ OBJECT_CHECK(VersalUsb2, (obj), TYPE_XILINX_VERSAL_USB2)
61
+
62
+typedef struct VersalUsb2 {
63
+ SysBusDevice parent_obj;
64
+ MemoryRegion dwc3_mr;
65
+ MemoryRegion usb2Ctrl_mr;
66
+
67
+ VersalUsb2CtrlRegs usb2Ctrl;
68
+ USBDWC3 dwc3;
69
+} VersalUsb2;
70
+
71
+#endif
72
diff --git a/hw/usb/xlnx-usb-subsystem.c b/hw/usb/xlnx-usb-subsystem.c
73
new file mode 100644
74
index XXXXXXX..XXXXXXX
75
--- /dev/null
76
+++ b/hw/usb/xlnx-usb-subsystem.c
77
@@ -XXX,XX +XXX,XX @@
78
+/*
79
+ * QEMU model of the Xilinx usb subsystem
80
+ *
81
+ * Copyright (c) 2020 Xilinx Inc. Sai Pavan Boddu <sai.pava.boddu@xilinx.com>
82
+ *
83
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
84
+ * of this software and associated documentation files (the "Software"), to deal
85
+ * in the Software without restriction, including without limitation the rights
86
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
87
+ * copies of the Software, and to permit persons to whom the Software is
88
+ * furnished to do so, subject to the following conditions:
89
+ *
90
+ * The above copyright notice and this permission notice shall be included in
91
+ * all copies or substantial portions of the Software.
92
+ *
93
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
94
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
95
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
96
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
97
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
98
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
99
+ * THE SOFTWARE.
100
+ */
101
+
102
+#include "qemu/osdep.h"
103
+#include "hw/sysbus.h"
104
+#include "hw/irq.h"
105
+#include "hw/register.h"
106
+#include "qemu/bitops.h"
107
+#include "qemu/log.h"
108
+#include "qom/object.h"
109
+#include "qapi/error.h"
110
+#include "hw/qdev-properties.h"
111
+#include "hw/usb/xlnx-usb-subsystem.h"
112
+
113
+static void versal_usb2_realize(DeviceState *dev, Error **errp)
114
+{
115
+ VersalUsb2 *s = VERSAL_USB2(dev);
116
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
117
+ Error *err = NULL;
118
+
119
+ sysbus_realize(SYS_BUS_DEVICE(&s->dwc3), &err);
120
+ if (err) {
121
+ error_propagate(errp, err);
122
+ return;
123
+ }
124
+ sysbus_realize(SYS_BUS_DEVICE(&s->usb2Ctrl), &err);
125
+ if (err) {
126
+ error_propagate(errp, err);
127
+ return;
128
+ }
129
+ sysbus_init_mmio(sbd, &s->dwc3_mr);
130
+ sysbus_init_mmio(sbd, &s->usb2Ctrl_mr);
131
+ qdev_pass_gpios(DEVICE(&s->dwc3.sysbus_xhci), dev, SYSBUS_DEVICE_GPIO_IRQ);
132
+}
133
+
134
+static void versal_usb2_init(Object *obj)
135
+{
136
+ VersalUsb2 *s = VERSAL_USB2(obj);
137
+
138
+ object_initialize_child(obj, "versal.dwc3", &s->dwc3,
139
+ TYPE_USB_DWC3);
140
+ object_initialize_child(obj, "versal.usb2-ctrl", &s->usb2Ctrl,
141
+ TYPE_XILINX_VERSAL_USB2_CTRL_REGS);
142
+ memory_region_init_alias(&s->dwc3_mr, obj, "versal.dwc3_alias",
143
+ &s->dwc3.iomem, 0, DWC3_SIZE);
144
+ memory_region_init_alias(&s->usb2Ctrl_mr, obj, "versal.usb2Ctrl_alias",
145
+ &s->usb2Ctrl.iomem, 0, USB2_REGS_R_MAX * 4);
146
+ qdev_alias_all_properties(DEVICE(&s->dwc3), obj);
147
+ qdev_alias_all_properties(DEVICE(&s->dwc3.sysbus_xhci), obj);
148
+ object_property_add_alias(obj, "dma", OBJECT(&s->dwc3.sysbus_xhci), "dma");
149
+}
150
+
151
+static void versal_usb2_class_init(ObjectClass *klass, void *data)
152
+{
153
+ DeviceClass *dc = DEVICE_CLASS(klass);
154
+
155
+ dc->realize = versal_usb2_realize;
156
+}
157
+
158
+static const TypeInfo versal_usb2_info = {
159
+ .name = TYPE_XILINX_VERSAL_USB2,
160
+ .parent = TYPE_SYS_BUS_DEVICE,
161
+ .instance_size = sizeof(VersalUsb2),
162
+ .class_init = versal_usb2_class_init,
163
+ .instance_init = versal_usb2_init,
164
+};
165
+
166
+static void versal_usb_types(void)
167
+{
168
+ type_register_static(&versal_usb2_info);
169
+}
170
+
171
+type_init(versal_usb_types)
172
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
17
index XXXXXXX..XXXXXXX 100644
173
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/display/exynos4210_fimd.c
174
--- a/hw/usb/Kconfig
19
+++ b/hw/display/exynos4210_fimd.c
175
+++ b/hw/usb/Kconfig
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_fimd_update(void *opaque)
176
@@ -XXX,XX +XXX,XX @@ config USB_DWC3
21
bool blend = false;
177
bool
22
uint8_t *host_fb_addr;
178
select USB_XHCI_SYSBUS
23
bool is_dirty = false;
179
select REGISTER
24
- const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
180
+
25
+ int global_width;
181
+config XLNX_USB_SUBSYS
26
182
+ bool
27
if (!s || !s->console || !s->enabled ||
183
+ default y if XLNX_VERSAL
28
surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) {
184
+ select USB_DWC3
29
return;
185
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
30
}
186
index XXXXXXX..XXXXXXX 100644
31
+
187
--- a/hw/usb/meson.build
32
+ global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
188
+++ b/hw/usb/meson.build
33
exynos4210_update_resolution(s);
189
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c'))
34
surface = qemu_console_surface(s->console);
190
softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c'))
35
191
softmmu_ss.add(when: 'CONFIG_IMX_USBPHY', if_true: files('imx-usb-phy.c'))
192
specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-usb2-ctrl-regs.c'))
193
+specific_ss.add(when: 'CONFIG_XLNX_USB_SUBSYS', if_true: files('xlnx-usb-subsystem.c'))
194
195
# emulated usb devices
196
softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hub.c'))
36
--
197
--
37
2.20.1
198
2.20.1
38
199
39
200
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Vikram Garhwal <fnu.vikram@xilinx.com>
2
2
3
This seems a bit more readable than using offsetof CPU_DoubleU.
3
Connect VersalUsb2 subsystem to xlnx-versal SOC, its placed
4
in iou of lpd domain and configure it as dual port host controller.
5
Add the respective guest dts nodes for "xlnx-versal-virt" machine.
4
6
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
6
Message-id: 20201030022618.785675-5-richard.henderson@linaro.org
8
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Message-id: 1607023357-5096-5-git-send-email-sai.pavan.boddu@xilinx.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
12
---
10
target/arm/translate.c | 13 ++++---------
13
include/hw/arm/xlnx-versal.h | 9 ++++++
11
1 file changed, 4 insertions(+), 9 deletions(-)
14
hw/arm/xlnx-versal-virt.c | 55 ++++++++++++++++++++++++++++++++++++
15
hw/arm/xlnx-versal.c | 26 +++++++++++++++++
16
3 files changed, 90 insertions(+)
12
17
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
18
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
14
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate.c
20
--- a/include/hw/arm/xlnx-versal.h
16
+++ b/target/arm/translate.c
21
+++ b/include/hw/arm/xlnx-versal.h
17
@@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp size)
22
@@ -XXX,XX +XXX,XX @@
18
return neon_full_reg_offset(reg) + ofs;
23
#include "hw/net/cadence_gem.h"
24
#include "hw/rtc/xlnx-zynqmp-rtc.h"
25
#include "qom/object.h"
26
+#include "hw/usb/xlnx-usb-subsystem.h"
27
28
#define TYPE_XLNX_VERSAL "xlnx-versal"
29
OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
30
@@ -XXX,XX +XXX,XX @@ struct Versal {
31
PL011State uart[XLNX_VERSAL_NR_UARTS];
32
CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
33
XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
34
+ VersalUsb2 usb;
35
} iou;
36
} lpd;
37
38
@@ -XXX,XX +XXX,XX @@ struct Versal {
39
40
#define VERSAL_UART0_IRQ_0 18
41
#define VERSAL_UART1_IRQ_0 19
42
+#define VERSAL_USB0_IRQ_0 22
43
#define VERSAL_GEM0_IRQ_0 56
44
#define VERSAL_GEM0_WAKE_IRQ_0 57
45
#define VERSAL_GEM1_IRQ_0 58
46
@@ -XXX,XX +XXX,XX @@ struct Versal {
47
#define MM_OCM 0xfffc0000U
48
#define MM_OCM_SIZE 0x40000
49
50
+#define MM_USB2_CTRL_REGS 0xFF9D0000
51
+#define MM_USB2_CTRL_REGS_SIZE 0x10000
52
+
53
+#define MM_USB_0 0xFE200000
54
+#define MM_USB_0_SIZE 0x10000
55
+
56
#define MM_TOP_DDR 0x0
57
#define MM_TOP_DDR_SIZE 0x80000000U
58
#define MM_TOP_DDR_2 0x800000000ULL
59
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/hw/arm/xlnx-versal-virt.c
62
+++ b/hw/arm/xlnx-versal-virt.c
63
@@ -XXX,XX +XXX,XX @@ struct VersalVirt {
64
uint32_t ethernet_phy[2];
65
uint32_t clk_125Mhz;
66
uint32_t clk_25Mhz;
67
+ uint32_t usb;
68
+ uint32_t dwc;
69
} phandle;
70
struct arm_boot_info binfo;
71
72
@@ -XXX,XX +XXX,XX @@ static void fdt_create(VersalVirt *s)
73
s->phandle.clk_25Mhz = qemu_fdt_alloc_phandle(s->fdt);
74
s->phandle.clk_125Mhz = qemu_fdt_alloc_phandle(s->fdt);
75
76
+ s->phandle.usb = qemu_fdt_alloc_phandle(s->fdt);
77
+ s->phandle.dwc = qemu_fdt_alloc_phandle(s->fdt);
78
/* Create /chosen node for load_dtb. */
79
qemu_fdt_add_subnode(s->fdt, "/chosen");
80
81
@@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(VersalVirt *s)
82
compat, sizeof(compat));
19
}
83
}
20
84
21
-static inline long vfp_reg_offset(bool dp, unsigned reg)
85
+static void fdt_add_usb_xhci_nodes(VersalVirt *s)
22
+/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */
86
+{
23
+static long vfp_reg_offset(bool dp, unsigned reg)
87
+ const char clocknames[] = "bus_clk\0ref_clk";
88
+ const char irq_name[] = "dwc_usb3";
89
+ const char compatVersalDWC3[] = "xlnx,versal-dwc3";
90
+ const char compatDWC3[] = "snps,dwc3";
91
+ char *name = g_strdup_printf("/usb@%" PRIx32, MM_USB2_CTRL_REGS);
92
+
93
+ qemu_fdt_add_subnode(s->fdt, name);
94
+ qemu_fdt_setprop(s->fdt, name, "compatible",
95
+ compatVersalDWC3, sizeof(compatVersalDWC3));
96
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
97
+ 2, MM_USB2_CTRL_REGS,
98
+ 2, MM_USB2_CTRL_REGS_SIZE);
99
+ qemu_fdt_setprop(s->fdt, name, "clock-names",
100
+ clocknames, sizeof(clocknames));
101
+ qemu_fdt_setprop_cells(s->fdt, name, "clocks",
102
+ s->phandle.clk_25Mhz, s->phandle.clk_125Mhz);
103
+ qemu_fdt_setprop(s->fdt, name, "ranges", NULL, 0);
104
+ qemu_fdt_setprop_cell(s->fdt, name, "#address-cells", 2);
105
+ qemu_fdt_setprop_cell(s->fdt, name, "#size-cells", 2);
106
+ qemu_fdt_setprop_cell(s->fdt, name, "phandle", s->phandle.usb);
107
+ g_free(name);
108
+
109
+ name = g_strdup_printf("/usb@%" PRIx32 "/dwc3@%" PRIx32,
110
+ MM_USB2_CTRL_REGS, MM_USB_0);
111
+ qemu_fdt_add_subnode(s->fdt, name);
112
+ qemu_fdt_setprop(s->fdt, name, "compatible",
113
+ compatDWC3, sizeof(compatDWC3));
114
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
115
+ 2, MM_USB_0, 2, MM_USB_0_SIZE);
116
+ qemu_fdt_setprop(s->fdt, name, "interrupt-names",
117
+ irq_name, sizeof(irq_name));
118
+ qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
119
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_USB0_IRQ_0,
120
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI);
121
+ qemu_fdt_setprop_cell(s->fdt, name,
122
+ "snps,quirk-frame-length-adjustment", 0x20);
123
+ qemu_fdt_setprop_cells(s->fdt, name, "#stream-id-cells", 1);
124
+ qemu_fdt_setprop_string(s->fdt, name, "dr_mode", "host");
125
+ qemu_fdt_setprop_string(s->fdt, name, "phy-names", "usb3-phy");
126
+ qemu_fdt_setprop(s->fdt, name, "snps,dis_u2_susphy_quirk", NULL, 0);
127
+ qemu_fdt_setprop(s->fdt, name, "snps,dis_u3_susphy_quirk", NULL, 0);
128
+ qemu_fdt_setprop(s->fdt, name, "snps,refclk_fladj", NULL, 0);
129
+ qemu_fdt_setprop(s->fdt, name, "snps,mask_phy_reset", NULL, 0);
130
+ qemu_fdt_setprop_cell(s->fdt, name, "phandle", s->phandle.dwc);
131
+ qemu_fdt_setprop_string(s->fdt, name, "maximum-speed", "high-speed");
132
+ g_free(name);
133
+}
134
+
135
static void fdt_add_uart_nodes(VersalVirt *s)
24
{
136
{
25
if (dp) {
137
uint64_t addrs[] = { MM_UART1, MM_UART0 };
26
- return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
138
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
27
+ return neon_element_offset(reg, 0, MO_64);
139
fdt_add_gic_nodes(s);
28
} else {
140
fdt_add_timer_nodes(s);
29
- long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]);
141
fdt_add_zdma_nodes(s);
30
- if (reg & 1) {
142
+ fdt_add_usb_xhci_nodes(s);
31
- ofs += offsetof(CPU_DoubleU, l.upper);
143
fdt_add_sd_nodes(s);
32
- } else {
144
fdt_add_rtc_node(s);
33
- ofs += offsetof(CPU_DoubleU, l.lower);
145
fdt_add_cpu_nodes(s, psci_conduit);
34
- }
146
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
35
- return ofs;
147
index XXXXXXX..XXXXXXX 100644
36
+ return neon_element_offset(reg >> 1, reg & 1, MO_32);
148
--- a/hw/arm/xlnx-versal.c
149
+++ b/hw/arm/xlnx-versal.c
150
@@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
37
}
151
}
38
}
152
}
39
153
154
+static void versal_create_usbs(Versal *s, qemu_irq *pic)
155
+{
156
+ DeviceState *dev;
157
+ MemoryRegion *mr;
158
+
159
+ object_initialize_child(OBJECT(s), "usb2", &s->lpd.iou.usb,
160
+ TYPE_XILINX_VERSAL_USB2);
161
+ dev = DEVICE(&s->lpd.iou.usb);
162
+
163
+ object_property_set_link(OBJECT(dev), "dma", OBJECT(&s->mr_ps),
164
+ &error_abort);
165
+ qdev_prop_set_uint32(dev, "intrs", 1);
166
+ qdev_prop_set_uint32(dev, "slots", 2);
167
+
168
+ sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
169
+
170
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
171
+ memory_region_add_subregion(&s->mr_ps, MM_USB_0, mr);
172
+
173
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_USB0_IRQ_0]);
174
+
175
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1);
176
+ memory_region_add_subregion(&s->mr_ps, MM_USB2_CTRL_REGS, mr);
177
+}
178
+
179
static void versal_create_gems(Versal *s, qemu_irq *pic)
180
{
181
int i;
182
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
183
versal_create_apu_cpus(s);
184
versal_create_apu_gic(s, pic);
185
versal_create_uarts(s, pic);
186
+ versal_create_usbs(s, pic);
187
versal_create_gems(s, pic);
188
versal_create_admas(s, pic);
189
versal_create_sds(s, pic);
40
--
190
--
41
2.20.1
191
2.20.1
42
192
43
193
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Use the BIT_ULL() macro to ensure we use 64-bit arithmetic.
3
Malicious user can set the feedback divisor for the PLLs
4
This fixes the following Coverity issue (OVERFLOW_BEFORE_WIDEN):
4
to zero, triggering a floating-point exception (SIGFPE).
5
5
6
CID 1432363 (#1 of 1): Unintentional integer overflow:
6
As the datasheet [*] is not clear how hardware behaves
7
when these bits are zeroes, use the maximum divisor
8
possible (128) to avoid the software FPE.
7
9
8
overflow_before_widen:
10
[*] Zynq-7000 TRM, UG585 (v1.12.2)
9
Potentially overflowing expression 1 << scale with type int
11
B.28 System Level Control Registers (slcr)
10
(32 bits, signed) is evaluated using 32-bit arithmetic, and
12
-> "Register (slcr) ARM_PLL_CTRL"
11
then used in a context that expects an expression of type
13
25.10.4 PLLs
12
hwaddr (64 bits, unsigned).
14
-> "Software-Controlled PLL Update"
13
15
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Fixes: 38867cb7ec9 ("hw/misc/zynq_slcr: add clock generation for uarts")
15
Acked-by: Eric Auger <eric.auger@redhat.com>
17
Reported-by: Gaoning Pan <pgn@zju.edu.cn>
16
Message-id: 20201030144617.1535064-1-philmd@redhat.com
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
21
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
22
Message-id: 20201210141610.884600-1-f4bug@amsat.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
24
---
20
hw/arm/smmuv3.c | 3 ++-
25
hw/misc/zynq_slcr.c | 5 +++++
21
1 file changed, 2 insertions(+), 1 deletion(-)
26
1 file changed, 5 insertions(+)
22
27
23
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
28
diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c
24
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/arm/smmuv3.c
30
--- a/hw/misc/zynq_slcr.c
26
+++ b/hw/arm/smmuv3.c
31
+++ b/hw/misc/zynq_slcr.c
27
@@ -XXX,XX +XXX,XX @@
32
@@ -XXX,XX +XXX,XX @@ static uint64_t zynq_slcr_compute_pll(uint64_t input, uint32_t ctrl_reg)
28
*/
33
return 0;
29
30
#include "qemu/osdep.h"
31
+#include "qemu/bitops.h"
32
#include "hw/irq.h"
33
#include "hw/sysbus.h"
34
#include "migration/vmstate.h"
35
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
36
scale = CMD_SCALE(cmd);
37
num = CMD_NUM(cmd);
38
ttl = CMD_TTL(cmd);
39
- num_pages = (num + 1) * (1 << (scale));
40
+ num_pages = (num + 1) * BIT_ULL(scale);
41
}
34
}
42
35
43
if (type == SMMU_CMD_TLBI_NH_VA) {
36
+ /* Consider zero feedback as maximum divide ratio possible */
37
+ if (!mult) {
38
+ mult = 1 << R_xxx_PLL_CTRL_PLL_FPDIV_LENGTH;
39
+ }
40
+
41
/* frequency multiplier -> period division */
42
return input / mult;
43
}
44
--
44
--
45
2.20.1
45
2.20.1
46
46
47
47
diff view generated by jsdifflib
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
1
From: Joe Komlodi <joe.komlodi@xilinx.com>
2
2
3
When booting a CPU with EL3 using the -kernel flag, set up CPTR_EL3 so
3
The previous naming of the configuration registers made it sound like that if
4
that SVE will not trap to EL3.
4
the bits were set the settings would be enabled, while the opposite is true.
5
5
6
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
6
Signed-off-by: Joe Komlodi <komlodi@xilinx.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
8
Message-id: 20201030151541.11976-1-remi@remlab.net
8
Message-id: 1605568264-26376-2-git-send-email-komlodi@xilinx.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
hw/arm/boot.c | 3 +++
11
hw/block/m25p80.c | 12 ++++++------
12
1 file changed, 3 insertions(+)
12
1 file changed, 6 insertions(+), 6 deletions(-)
13
13
14
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
14
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/boot.c
16
--- a/hw/block/m25p80.c
17
+++ b/hw/arm/boot.c
17
+++ b/hw/block/m25p80.c
18
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
18
@@ -XXX,XX +XXX,XX @@ typedef struct FlashPartInfo {
19
if (cpu_isar_feature(aa64_mte, cpu)) {
19
#define VCFG_WRAP_SEQUENTIAL 0x2
20
env->cp15.scr_el3 |= SCR_ATA;
20
#define NVCFG_XIP_MODE_DISABLED (7 << 9)
21
}
21
#define NVCFG_XIP_MODE_MASK (7 << 9)
22
+ if (cpu_isar_feature(aa64_sve, cpu)) {
22
-#define VCFG_XIP_MODE_ENABLED (1 << 3)
23
+ env->cp15.cptr_el[3] |= CPTR_EZ;
23
+#define VCFG_XIP_MODE_DISABLED (1 << 3)
24
+ }
24
#define CFG_DUMMY_CLK_LEN 4
25
/* AArch64 kernels never boot in secure mode */
25
#define NVCFG_DUMMY_CLK_POS 12
26
assert(!info->secure_boot);
26
#define VCFG_DUMMY_CLK_POS 4
27
/* This hook is only supported for AArch32 currently:
27
@@ -XXX,XX +XXX,XX @@ typedef struct FlashPartInfo {
28
#define EVCFG_VPP_ACCELERATOR (1 << 3)
29
#define EVCFG_RESET_HOLD_ENABLED (1 << 4)
30
#define NVCFG_DUAL_IO_MASK (1 << 2)
31
-#define EVCFG_DUAL_IO_ENABLED (1 << 6)
32
+#define EVCFG_DUAL_IO_DISABLED (1 << 6)
33
#define NVCFG_QUAD_IO_MASK (1 << 3)
34
-#define EVCFG_QUAD_IO_ENABLED (1 << 7)
35
+#define EVCFG_QUAD_IO_DISABLED (1 << 7)
36
#define NVCFG_4BYTE_ADDR_MASK (1 << 0)
37
#define NVCFG_LOWER_SEGMENT_MASK (1 << 1)
38
39
@@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s)
40
s->volatile_cfg |= VCFG_WRAP_SEQUENTIAL;
41
if ((s->nonvolatile_cfg & NVCFG_XIP_MODE_MASK)
42
!= NVCFG_XIP_MODE_DISABLED) {
43
- s->volatile_cfg |= VCFG_XIP_MODE_ENABLED;
44
+ s->volatile_cfg |= VCFG_XIP_MODE_DISABLED;
45
}
46
s->volatile_cfg |= deposit32(s->volatile_cfg,
47
VCFG_DUMMY_CLK_POS,
48
@@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s)
49
s->enh_volatile_cfg |= EVCFG_VPP_ACCELERATOR;
50
s->enh_volatile_cfg |= EVCFG_RESET_HOLD_ENABLED;
51
if (s->nonvolatile_cfg & NVCFG_DUAL_IO_MASK) {
52
- s->enh_volatile_cfg |= EVCFG_DUAL_IO_ENABLED;
53
+ s->enh_volatile_cfg |= EVCFG_DUAL_IO_DISABLED;
54
}
55
if (s->nonvolatile_cfg & NVCFG_QUAD_IO_MASK) {
56
- s->enh_volatile_cfg |= EVCFG_QUAD_IO_ENABLED;
57
+ s->enh_volatile_cfg |= EVCFG_QUAD_IO_DISABLED;
58
}
59
if (!(s->nonvolatile_cfg & NVCFG_4BYTE_ADDR_MASK)) {
60
s->four_bytes_address_mode = true;
28
--
61
--
29
2.20.1
62
2.20.1
30
63
31
64
diff view generated by jsdifflib
1
If we're using the capstone disassembler, disassembly of a run of
1
From: Joe Komlodi <joe.komlodi@xilinx.com>
2
instructions more than 32 bytes long disassembles the wrong data for
3
instructions beyond the 32 byte mark:
4
2
5
(qemu) xp /16x 0x100
3
VCFG XIP is set (disabled) when the NVCFG XIP bits are all set (disabled).
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
4
28
Here the disassembly of 0x120..0x13f is using the data that is in
5
Signed-off-by: Joe Komlodi <komlodi@xilinx.com>
29
0x104..0x123.
6
Reviewed-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
30
7
Message-id: 1605568264-26376-3-git-send-email-komlodi@xilinx.com
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>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
45
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
46
Message-id: 20201022132445.25039-1-peter.maydell@linaro.org
47
---
9
---
48
disas/capstone.c | 2 +-
10
hw/block/m25p80.c | 2 +-
49
1 file changed, 1 insertion(+), 1 deletion(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
50
12
51
diff --git a/disas/capstone.c b/disas/capstone.c
13
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
52
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
53
--- a/disas/capstone.c
15
--- a/hw/block/m25p80.c
54
+++ b/disas/capstone.c
16
+++ b/hw/block/m25p80.c
55
@@ -XXX,XX +XXX,XX @@ bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count)
17
@@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s)
56
18
s->volatile_cfg |= VCFG_DUMMY;
57
/* Make certain that we can make progress. */
19
s->volatile_cfg |= VCFG_WRAP_SEQUENTIAL;
58
assert(tsize != 0);
20
if ((s->nonvolatile_cfg & NVCFG_XIP_MODE_MASK)
59
- info->read_memory_func(pc, cap_buf + csize, tsize, info);
21
- != NVCFG_XIP_MODE_DISABLED) {
60
+ info->read_memory_func(pc + csize, cap_buf + csize, tsize, info);
22
+ == NVCFG_XIP_MODE_DISABLED) {
61
csize += tsize;
23
s->volatile_cfg |= VCFG_XIP_MODE_DISABLED;
62
24
}
63
if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
25
s->volatile_cfg |= deposit32(s->volatile_cfg,
64
--
26
--
65
2.20.1
27
2.20.1
66
28
67
29
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Joe Komlodi <joe.komlodi@xilinx.com>
2
2
3
This will shortly have users outside of translate-neon.c.inc.
3
Some Numonyx flash commands cannot be executed in DIO and QIO mode, such as
4
trying to do DPP or DOR when in QIO mode.
4
5
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Joe Komlodi <komlodi@xilinx.com>
6
Message-id: 20201030022618.785675-3-richard.henderson@linaro.org
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 1605568264-26376-4-git-send-email-komlodi@xilinx.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
target/arm/translate.c | 20 ++++++++++++++++++++
11
hw/block/m25p80.c | 114 ++++++++++++++++++++++++++++++++++++++--------
11
target/arm/translate-neon.c.inc | 19 -------------------
12
1 file changed, 95 insertions(+), 19 deletions(-)
12
2 files changed, 20 insertions(+), 19 deletions(-)
13
13
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
14
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
16
--- a/hw/block/m25p80.c
17
+++ b/target/arm/translate.c
17
+++ b/hw/block/m25p80.c
18
@@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg)
18
@@ -XXX,XX +XXX,XX @@ typedef enum {
19
return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
19
MAN_GENERIC,
20
} Manufacturer;
21
22
+typedef enum {
23
+ MODE_STD = 0,
24
+ MODE_DIO = 1,
25
+ MODE_QIO = 2
26
+} SPIMode;
27
+
28
#define M25P80_INTERNAL_DATA_BUFFER_SZ 16
29
30
struct Flash {
31
@@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s)
32
trace_m25p80_reset_done(s);
20
}
33
}
21
34
22
+/*
35
+static uint8_t numonyx_mode(Flash *s)
23
+ * Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
24
+ * where 0 is the least significant end of the register.
25
+ */
26
+static long neon_element_offset(int reg, int element, MemOp size)
27
+{
36
+{
28
+ int element_size = 1 << size;
37
+ if (!(s->enh_volatile_cfg & EVCFG_QUAD_IO_DISABLED)) {
29
+ int ofs = element * element_size;
38
+ return MODE_QIO;
30
+#ifdef HOST_WORDS_BIGENDIAN
39
+ } else if (!(s->enh_volatile_cfg & EVCFG_DUAL_IO_DISABLED)) {
31
+ /*
40
+ return MODE_DIO;
32
+ * Calculate the offset assuming fully little-endian,
41
+ } else {
33
+ * then XOR to account for the order of the 8-byte units.
42
+ return MODE_STD;
34
+ */
35
+ if (element_size < 8) {
36
+ ofs ^= 8 - element_size;
37
+ }
43
+ }
38
+#endif
39
+ return neon_full_reg_offset(reg) + ofs;
40
+}
44
+}
41
+
45
+
42
static inline long vfp_reg_offset(bool dp, unsigned reg)
46
static void decode_fast_read_cmd(Flash *s)
43
{
47
{
44
if (dp) {
48
s->needed_bytes = get_addr_length(s);
45
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
49
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
46
index XXXXXXX..XXXXXXX 100644
50
case ERASE4_32K:
47
--- a/target/arm/translate-neon.c.inc
51
case ERASE_SECTOR:
48
+++ b/target/arm/translate-neon.c.inc
52
case ERASE4_SECTOR:
49
@@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x)
53
- case READ:
50
#include "decode-neon-ls.c.inc"
54
- case READ4:
51
#include "decode-neon-shared.c.inc"
55
- case DPP:
52
56
- case QPP:
53
-/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
57
- case QPP_4:
54
- * where 0 is the least significant end of the register.
58
case PP:
55
- */
59
case PP4:
56
-static inline long
60
- case PP4_4:
57
-neon_element_offset(int reg, int element, MemOp size)
61
case DIE_ERASE:
58
-{
62
case RDID_90:
59
- int element_size = 1 << size;
63
case RDID_AB:
60
- int ofs = element * element_size;
64
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
61
-#ifdef HOST_WORDS_BIGENDIAN
65
s->len = 0;
62
- /* Calculate the offset assuming fully little-endian,
66
s->state = STATE_COLLECTING_DATA;
63
- * then XOR to account for the order of the 8-byte units.
67
break;
64
- */
68
+ case READ:
65
- if (element_size < 8) {
69
+ case READ4:
66
- ofs ^= 8 - element_size;
70
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) == MODE_STD) {
67
- }
71
+ s->needed_bytes = get_addr_length(s);
68
-#endif
72
+ s->pos = 0;
69
- return neon_full_reg_offset(reg) + ofs;
73
+ s->len = 0;
70
-}
74
+ s->state = STATE_COLLECTING_DATA;
71
-
75
+ } else {
72
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
76
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
73
{
77
+ "DIO or QIO mode\n", s->cmd_in_progress);
74
long offset = neon_element_offset(reg, ele, mop & MO_SIZE);
78
+ }
79
+ break;
80
+ case DPP:
81
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_QIO) {
82
+ s->needed_bytes = get_addr_length(s);
83
+ s->pos = 0;
84
+ s->len = 0;
85
+ s->state = STATE_COLLECTING_DATA;
86
+ } else {
87
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
88
+ "QIO mode\n", s->cmd_in_progress);
89
+ }
90
+ break;
91
+ case QPP:
92
+ case QPP_4:
93
+ case PP4_4:
94
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_DIO) {
95
+ s->needed_bytes = get_addr_length(s);
96
+ s->pos = 0;
97
+ s->len = 0;
98
+ s->state = STATE_COLLECTING_DATA;
99
+ } else {
100
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
101
+ "DIO mode\n", s->cmd_in_progress);
102
+ }
103
+ break;
104
105
case FAST_READ:
106
case FAST_READ4:
107
+ decode_fast_read_cmd(s);
108
+ break;
109
case DOR:
110
case DOR4:
111
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_QIO) {
112
+ decode_fast_read_cmd(s);
113
+ } else {
114
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
115
+ "QIO mode\n", s->cmd_in_progress);
116
+ }
117
+ break;
118
case QOR:
119
case QOR4:
120
- decode_fast_read_cmd(s);
121
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_DIO) {
122
+ decode_fast_read_cmd(s);
123
+ } else {
124
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
125
+ "DIO mode\n", s->cmd_in_progress);
126
+ }
127
break;
128
129
case DIOR:
130
case DIOR4:
131
- decode_dio_read_cmd(s);
132
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_QIO) {
133
+ decode_dio_read_cmd(s);
134
+ } else {
135
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
136
+ "QIO mode\n", s->cmd_in_progress);
137
+ }
138
break;
139
140
case QIOR:
141
case QIOR4:
142
- decode_qio_read_cmd(s);
143
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_DIO) {
144
+ decode_qio_read_cmd(s);
145
+ } else {
146
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute cmd %x in "
147
+ "DIO mode\n", s->cmd_in_progress);
148
+ }
149
break;
150
151
case WRSR:
152
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
153
break;
154
155
case JEDEC_READ:
156
- trace_m25p80_populated_jedec(s);
157
- for (i = 0; i < s->pi->id_len; i++) {
158
- s->data[i] = s->pi->id[i];
159
- }
160
- for (; i < SPI_NOR_MAX_ID_LEN; i++) {
161
- s->data[i] = 0;
162
- }
163
+ if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) == MODE_STD) {
164
+ trace_m25p80_populated_jedec(s);
165
+ for (i = 0; i < s->pi->id_len; i++) {
166
+ s->data[i] = s->pi->id[i];
167
+ }
168
+ for (; i < SPI_NOR_MAX_ID_LEN; i++) {
169
+ s->data[i] = 0;
170
+ }
171
172
- s->len = SPI_NOR_MAX_ID_LEN;
173
- s->pos = 0;
174
- s->state = STATE_READING_DATA;
175
+ s->len = SPI_NOR_MAX_ID_LEN;
176
+ s->pos = 0;
177
+ s->state = STATE_READING_DATA;
178
+ } else {
179
+ qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Cannot execute JEDEC read "
180
+ "in DIO or QIO mode\n");
181
+ }
182
break;
183
184
case RDCR:
75
--
185
--
76
2.20.1
186
2.20.1
77
187
78
188
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
These are the only users of neon_reg_offset, so remove that.
4
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20201030022618.785675-4-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/translate.c | 14 ++------------
11
1 file changed, 2 insertions(+), 12 deletions(-)
12
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate.c
16
+++ b/target/arm/translate.c
17
@@ -XXX,XX +XXX,XX @@ static inline long vfp_reg_offset(bool dp, unsigned reg)
18
}
19
}
20
21
-/* Return the offset of a 32-bit piece of a NEON register.
22
- zero is the least significant end of the register. */
23
-static inline long
24
-neon_reg_offset (int reg, int n)
25
-{
26
- int sreg;
27
- sreg = reg * 2 + n;
28
- return vfp_reg_offset(0, sreg);
29
-}
30
-
31
static TCGv_i32 neon_load_reg(int reg, int pass)
32
{
33
TCGv_i32 tmp = tcg_temp_new_i32();
34
- tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass));
35
+ tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32));
36
return tmp;
37
}
38
39
static void neon_store_reg(int reg, int pass, TCGv_i32 var)
40
{
41
- tcg_gen_st_i32(var, cpu_env, neon_reg_offset(reg, pass));
42
+ tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32));
43
tcg_temp_free_i32(var);
44
}
45
46
--
47
2.20.1
48
49
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
The only uses of this function are for loading VFP
4
single-precision values, and nothing to do with NEON.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201030022618.785675-8-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate.c | 4 +-
12
target/arm/translate-vfp.c.inc | 184 ++++++++++++++++-----------------
13
2 files changed, 94 insertions(+), 94 deletions(-)
14
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate.c
18
+++ b/target/arm/translate.c
19
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg64(TCGv_i64 var, int reg)
20
tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg));
21
}
22
23
-static inline void neon_load_reg32(TCGv_i32 var, int reg)
24
+static inline void vfp_load_reg32(TCGv_i32 var, int reg)
25
{
26
tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
27
}
28
29
-static inline void neon_store_reg32(TCGv_i32 var, int reg)
30
+static inline void vfp_store_reg32(TCGv_i32 var, int reg)
31
{
32
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
33
}
34
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/translate-vfp.c.inc
37
+++ b/target/arm/translate-vfp.c.inc
38
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
39
frn = tcg_temp_new_i32();
40
frm = tcg_temp_new_i32();
41
dest = tcg_temp_new_i32();
42
- neon_load_reg32(frn, rn);
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
--
693
2.20.1
694
695
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Joe Komlodi <joe.komlodi@xilinx.com>
2
2
3
The only uses of this function are for loading VFP
3
Numonyx chips determine the number of cycles to wait based on bits 7:4
4
double-precision values, and nothing to do with NEON.
4
in the volatile configuration register.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
However, if these bits are 0x0 or 0xF, the number of dummy cycles to
7
Message-id: 20201030022618.785675-10-richard.henderson@linaro.org
7
wait is 10 for QIOR and QIOR4 commands or when in QIO mode, and otherwise 8 for
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
the currently supported fast read commands. [1]
9
10
[1]
11
https://www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/mt25q/die-rev-b/mt25q_qlkt_u_02g_cbb_0.pdf?rev=9b167fbf2b3645efba6385949a72e453
12
13
Signed-off-by: Joe Komlodi <komlodi@xilinx.com>
14
Reviewed-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
15
Message-id: 1605568264-26376-5-git-send-email-komlodi@xilinx.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
17
---
11
target/arm/translate.c | 8 ++--
18
hw/block/m25p80.c | 30 +++++++++++++++++++++++++++---
12
target/arm/translate-vfp.c.inc | 84 +++++++++++++++++-----------------
19
1 file changed, 27 insertions(+), 3 deletions(-)
13
2 files changed, 46 insertions(+), 46 deletions(-)
14
20
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
21
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate.c
23
--- a/hw/block/m25p80.c
18
+++ b/target/arm/translate.c
24
+++ b/hw/block/m25p80.c
19
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
25
@@ -XXX,XX +XXX,XX @@ static uint8_t numonyx_mode(Flash *s)
20
}
26
}
21
}
27
}
22
28
23
-static inline void neon_load_reg64(TCGv_i64 var, int reg)
29
+static uint8_t numonyx_extract_cfg_num_dummies(Flash *s)
24
+static inline void vfp_load_reg64(TCGv_i64 var, int reg)
30
+{
31
+ uint8_t num_dummies;
32
+ uint8_t mode;
33
+ assert(get_man(s) == MAN_NUMONYX);
34
+
35
+ mode = numonyx_mode(s);
36
+ num_dummies = extract32(s->volatile_cfg, 4, 4);
37
+
38
+ if (num_dummies == 0x0 || num_dummies == 0xf) {
39
+ switch (s->cmd_in_progress) {
40
+ case QIOR:
41
+ case QIOR4:
42
+ num_dummies = 10;
43
+ break;
44
+ default:
45
+ num_dummies = (mode == MODE_QIO) ? 10 : 8;
46
+ break;
47
+ }
48
+ }
49
+
50
+ return num_dummies;
51
+}
52
+
53
static void decode_fast_read_cmd(Flash *s)
25
{
54
{
26
- tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg));
55
s->needed_bytes = get_addr_length(s);
27
+ tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
56
@@ -XXX,XX +XXX,XX @@ static void decode_fast_read_cmd(Flash *s)
28
}
57
s->needed_bytes += 8;
29
58
break;
30
-static inline void neon_store_reg64(TCGv_i64 var, int reg)
59
case MAN_NUMONYX:
31
+static inline void vfp_store_reg64(TCGv_i64 var, int reg)
60
- s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
32
{
61
+ s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
33
- tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg));
62
break;
34
+ tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
63
case MAN_MACRONIX:
35
}
64
if (extract32(s->volatile_cfg, 6, 2) == 1) {
36
65
@@ -XXX,XX +XXX,XX @@ static void decode_dio_read_cmd(Flash *s)
37
static inline void vfp_load_reg32(TCGv_i32 var, int reg)
66
);
38
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
67
break;
39
index XXXXXXX..XXXXXXX 100644
68
case MAN_NUMONYX:
40
--- a/target/arm/translate-vfp.c.inc
69
- s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
41
+++ b/target/arm/translate-vfp.c.inc
70
+ s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
42
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
71
break;
43
tcg_gen_ext_i32_i64(nf, cpu_NF);
72
case MAN_MACRONIX:
44
tcg_gen_ext_i32_i64(vf, cpu_VF);
73
switch (extract32(s->volatile_cfg, 6, 2)) {
45
74
@@ -XXX,XX +XXX,XX @@ static void decode_qio_read_cmd(Flash *s)
46
- neon_load_reg64(frn, rn);
75
);
47
- neon_load_reg64(frm, rm);
76
break;
48
+ vfp_load_reg64(frn, rn);
77
case MAN_NUMONYX:
49
+ vfp_load_reg64(frm, rm);
78
- s->needed_bytes += extract32(s->volatile_cfg, 4, 4);
50
switch (a->cc) {
79
+ s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
51
case 0: /* eq: Z */
80
break;
52
tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero,
81
case MAN_MACRONIX:
53
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
82
switch (extract32(s->volatile_cfg, 6, 2)) {
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
--
83
--
345
2.20.1
84
2.20.1
346
85
347
86
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
In both cases, we can sink the write-back and perform
4
the accumulate into the normal destination temps.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201030022618.785675-11-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-neon.c.inc | 23 +++++++++--------------
12
1 file changed, 9 insertions(+), 14 deletions(-)
13
14
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-neon.c.inc
17
+++ b/target/arm/translate-neon.c.inc
18
@@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a,
19
if (accfn) {
20
tmp = tcg_temp_new_i64();
21
read_neon_element64(tmp, a->vd, 0, MO_64);
22
- accfn(tmp, tmp, rd0);
23
- write_neon_element64(tmp, a->vd, 0, MO_64);
24
+ accfn(rd0, tmp, rd0);
25
read_neon_element64(tmp, a->vd, 1, MO_64);
26
- accfn(tmp, tmp, rd1);
27
- write_neon_element64(tmp, a->vd, 1, MO_64);
28
+ accfn(rd1, tmp, rd1);
29
tcg_temp_free_i64(tmp);
30
- } else {
31
- write_neon_element64(rd0, a->vd, 0, MO_64);
32
- write_neon_element64(rd1, a->vd, 1, MO_64);
33
}
34
35
+ write_neon_element64(rd0, a->vd, 0, MO_64);
36
+ write_neon_element64(rd1, a->vd, 1, MO_64);
37
tcg_temp_free_i64(rd0);
38
tcg_temp_free_i64(rd1);
39
40
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a,
41
if (accfn) {
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
}
56
+
57
+ write_neon_element64(rn0_64, a->vd, 0, MO_64);
58
+ write_neon_element64(rn1_64, a->vd, 1, MO_64);
59
tcg_temp_free_i64(rn0_64);
60
tcg_temp_free_i64(rn1_64);
61
return true;
62
--
63
2.20.1
64
65
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
We can use proper widening loads to extend 32-bit inputs,
4
and skip the "widenfn" step.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201030022618.785675-12-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate.c | 6 +++
12
target/arm/translate-neon.c.inc | 66 ++++++++++++++++++---------------
13
2 files changed, 43 insertions(+), 29 deletions(-)
14
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate.c
18
+++ b/target/arm/translate.c
19
@@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
20
long off = neon_element_offset(reg, ele, memop);
21
22
switch (memop) {
23
+ case MO_SL:
24
+ tcg_gen_ld32s_i64(dest, cpu_env, off);
25
+ break;
26
+ case MO_UL:
27
+ tcg_gen_ld32u_i64(dest, cpu_env, off);
28
+ break;
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
}
52
53
- if (!widenfn || !opfn) {
54
+ if (!opfn) {
55
/* size == 3 case, which is an entirely different insn group */
56
return false;
57
}
58
59
- if ((a->vd & 1) || (src1_wide && (a->vn & 1))) {
60
+ if ((a->vd & 1) || (src1_mop == MO_Q && (a->vn & 1))) {
61
return false;
62
}
63
64
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
65
rn1_64 = tcg_temp_new_i64();
66
rm_64 = tcg_temp_new_i64();
67
68
- if (src1_wide) {
69
- read_neon_element64(rn0_64, a->vn, 0, MO_64);
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
+ }
88
89
- widenfn(rm_64, rm);
90
- tcg_temp_free_i32(rm);
91
opfn(rn0_64, rn0_64, rm_64);
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
--
174
2.20.1
175
176
diff view generated by jsdifflib
Deleted patch
1
On some hosts (eg Ubuntu Bionic) pkg-config returns a set of
2
libraries for gio-2.0 which don't actually work when compiling
3
statically. (Specifically, the returned library string includes
4
-lmount, but not -lblkid which -lmount depends upon, so linking
5
fails due to missing symbols.)
6
1
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
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20200928160402.7961-1-peter.maydell@linaro.org
14
---
15
configure | 10 +++++++++-
16
1 file changed, 9 insertions(+), 1 deletion(-)
17
18
diff --git a/configure b/configure
19
index XXXXXXX..XXXXXXX 100755
20
--- a/configure
21
+++ b/configure
22
@@ -XXX,XX +XXX,XX @@ if test "$static" = yes && test "$mingw32" = yes; then
23
fi
24
25
if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
26
- gio=yes
27
gio_cflags=$($pkg_config --cflags gio-2.0)
28
gio_libs=$($pkg_config --libs gio-2.0)
29
gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
30
if [ ! -x "$gdbus_codegen" ]; then
31
gdbus_codegen=
32
fi
33
+ # Check that the libraries actually work -- Ubuntu 18.04 ships
34
+ # with pkg-config --static --libs data for gio-2.0 that is missing
35
+ # -lblkid and will give a link error.
36
+ write_c_skeleton
37
+ if compile_prog "" "gio_libs" ; then
38
+ gio=yes
39
+ else
40
+ gio=no
41
+ fi
42
else
43
gio=no
44
fi
45
--
46
2.20.1
47
48
diff view generated by jsdifflib
Deleted patch
1
In gicv3_init_cpuif() we copy the ARMCPU gicv3_maintenance_interrupt
2
into the GICv3CPUState struct's maintenance_irq field. This will
3
only work if the board happens to have already wired up the CPU
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
1
10
Instead, since the GICv3CPUState has a pointer to the CPUState, make
11
the dereference at the point where we want to raise the interrupt, to
12
avoid an implicit requirement on board code to wire things up in a
13
particular order.
14
15
Reported-by: Jose Martins <josemartins90@gmail.com>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Message-id: 20201009153904.28529-1-peter.maydell@linaro.org
18
Reviewed-by: Luc Michel <luc@lmichel.fr>
19
---
20
include/hw/intc/arm_gicv3_common.h | 1 -
21
hw/intc/arm_gicv3_cpuif.c | 5 ++---
22
2 files changed, 2 insertions(+), 4 deletions(-)
23
24
diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/intc/arm_gicv3_common.h
27
+++ b/include/hw/intc/arm_gicv3_common.h
28
@@ -XXX,XX +XXX,XX @@ struct GICv3CPUState {
29
qemu_irq parent_fiq;
30
qemu_irq parent_virq;
31
qemu_irq parent_vfiq;
32
- qemu_irq maintenance_irq;
33
34
/* Redistributor */
35
uint32_t level; /* Current IRQ level */
36
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/intc/arm_gicv3_cpuif.c
39
+++ b/hw/intc/arm_gicv3_cpuif.c
40
@@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs)
41
int irqlevel = 0;
42
int fiqlevel = 0;
43
int maintlevel = 0;
44
+ ARMCPU *cpu = ARM_CPU(cs->cpu);
45
46
idx = hppvi_index(cs);
47
trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx);
48
@@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs)
49
50
qemu_set_irq(cs->parent_vfiq, fiqlevel);
51
qemu_set_irq(cs->parent_virq, irqlevel);
52
- qemu_set_irq(cs->maintenance_irq, maintlevel);
53
+ qemu_set_irq(cpu->gicv3_maintenance_interrupt, maintlevel);
54
}
55
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
--
67
2.20.1
68
69
diff view generated by jsdifflib