1 | target-arm queue: the big stuff here is the final part of | 1 | Hi; here's the latest target-arm queue. Mostly this is refactoring |
---|---|---|---|
2 | rth's patches for Cortex-A76 and Neoverse-N1 support; | 2 | and cleanup type patches. |
3 | also present are Gavin's NUMA series and a few other things. | ||
4 | 3 | ||
5 | thanks | 4 | thanks |
6 | -- PMM | 5 | -- PMM |
7 | 6 | ||
8 | The following changes since commit 554623226f800acf48a2ed568900c1c968ec9a8b: | 7 | The following changes since commit c60be6e3e38cb36dc66129e757ec4b34152232be: |
9 | 8 | ||
10 | Merge tag 'qemu-sparc-20220508' of https://github.com/mcayland/qemu into staging (2022-05-08 17:03:26 -0500) | 9 | Merge tag 'pull-sp-20231025' of https://gitlab.com/rth7680/qemu into staging (2023-10-27 09:43:53 +0900) |
11 | 10 | ||
12 | are available in the Git repository at: | 11 | are available in the Git repository at: |
13 | 12 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220509 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20231027 |
15 | 14 | ||
16 | for you to fetch changes up to ae9141d4a3265553503bf07d3574b40f84615a34: | 15 | for you to fetch changes up to df93de987f423a0ed918c425f5dbd9a25d3c6229: |
17 | 16 | ||
18 | hw/acpi/aml-build: Use existing CPU topology to build PPTT table (2022-05-09 11:47:55 +0100) | 17 | hw/net/cadence_gem: enforce 32 bits variable size for CRC (2023-10-27 15:27:06 +0100) |
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | target-arm queue: | 20 | target-arm queue: |
22 | * MAINTAINERS/.mailmap: update email for Leif Lindholm | 21 | * Correct minor errors in Cortex-A710 definition |
23 | * hw/arm: add version information to sbsa-ref machine DT | 22 | * Implement Neoverse N2 CPU model |
24 | * Enable new features for -cpu max: | 23 | * Refactor feature test functions out into separate header |
25 | FEAT_Debugv8p2, FEAT_Debugv8p4, FEAT_RAS (minimal version only), | 24 | * Fix syndrome for FGT traps on ERET |
26 | FEAT_IESB, FEAT_CSV2, FEAT_CSV2_2, FEAT_CSV3, FEAT_DGH | 25 | * Remove 'hw/arm/boot.h' includes from various header files |
27 | * Emulate Cortex-A76 | 26 | * pxa2xx: Refactoring/cleanup |
28 | * Emulate Neoverse-N1 | 27 | * Avoid using 'first_cpu' when first ARM CPU is reachable |
29 | * Fix the virt board default NUMA topology | 28 | * misc/led: LED state is set opposite of what is expected |
29 | * hw/net/cadence_gen: clean up to use FIELD macros | ||
30 | * hw/net/cadence_gem: perform PHY access on write only | ||
31 | * hw/net/cadence_gem: enforce 32 bits variable size for CRC | ||
30 | 32 | ||
31 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
32 | Gavin Shan (6): | 34 | Glenn Miles (1): |
33 | qapi/machine.json: Add cluster-id | 35 | misc/led: LED state is set opposite of what is expected |
34 | qtest/numa-test: Specify CPU topology in aarch64_numa_cpu() | ||
35 | hw/arm/virt: Consider SMP configuration in CPU topology | ||
36 | qtest/numa-test: Correct CPU and NUMA association in aarch64_numa_cpu() | ||
37 | hw/arm/virt: Fix CPU's default NUMA node ID | ||
38 | hw/acpi/aml-build: Use existing CPU topology to build PPTT table | ||
39 | 36 | ||
40 | Leif Lindholm (2): | 37 | Luc Michel (11): |
41 | MAINTAINERS/.mailmap: update email for Leif Lindholm | 38 | hw/net/cadence_gem: use REG32 macro for register definitions |
42 | hw/arm: add versioning to sbsa-ref machine DT | 39 | hw/net/cadence_gem: use FIELD for screening registers |
40 | hw/net/cadence_gem: use FIELD to describe NWCTRL register fields | ||
41 | hw/net/cadence_gem: use FIELD to describe NWCFG register fields | ||
42 | hw/net/cadence_gem: use FIELD to describe DMACFG register fields | ||
43 | hw/net/cadence_gem: use FIELD to describe [TX|RX]STATUS register fields | ||
44 | hw/net/cadence_gem: use FIELD to describe IRQ register fields | ||
45 | hw/net/cadence_gem: use FIELD to describe DESCONF6 register fields | ||
46 | hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields | ||
47 | hw/net/cadence_gem: perform PHY access on write only | ||
48 | hw/net/cadence_gem: enforce 32 bits variable size for CRC | ||
43 | 49 | ||
44 | Richard Henderson (24): | 50 | Peter Maydell (9): |
45 | target/arm: Handle cpreg registration for missing EL | 51 | target/arm: Correct minor errors in Cortex-A710 definition |
46 | target/arm: Drop EL3 no EL2 fallbacks | 52 | target/arm: Implement Neoverse N2 CPU model |
47 | target/arm: Merge zcr reginfo | 53 | target/arm: Move feature test functions to their own header |
48 | target/arm: Adjust definition of CONTEXTIDR_EL2 | 54 | target/arm: Move ID_AA64MMFR1 and ID_AA64MMFR2 tests together |
49 | target/arm: Move cortex impdef sysregs to cpu_tcg.c | 55 | target/arm: Move ID_AA64MMFR0 tests up to before MMFR1 and MMFR2 |
50 | target/arm: Update qemu-system-arm -cpu max to cortex-a57 | 56 | target/arm: Move ID_AA64ISAR* test functions together |
51 | target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max | 57 | target/arm: Move ID_AA64PFR* tests together |
52 | target/arm: Split out aa32_max_features | 58 | target/arm: Move ID_AA64DFR* feature tests together |
53 | target/arm: Annotate arm_max_initfn with FEAT identifiers | 59 | target/arm: Fix syndrome for FGT traps on ERET |
54 | target/arm: Use field names for manipulating EL2 and EL3 modes | ||
55 | target/arm: Enable FEAT_Debugv8p2 for -cpu max | ||
56 | target/arm: Enable FEAT_Debugv8p4 for -cpu max | ||
57 | target/arm: Add minimal RAS registers | ||
58 | target/arm: Enable SCR and HCR bits for RAS | ||
59 | target/arm: Implement virtual SError exceptions | ||
60 | target/arm: Implement ESB instruction | ||
61 | target/arm: Enable FEAT_RAS for -cpu max | ||
62 | target/arm: Enable FEAT_IESB for -cpu max | ||
63 | target/arm: Enable FEAT_CSV2 for -cpu max | ||
64 | target/arm: Enable FEAT_CSV2_2 for -cpu max | ||
65 | target/arm: Enable FEAT_CSV3 for -cpu max | ||
66 | target/arm: Enable FEAT_DGH for -cpu max | ||
67 | target/arm: Define cortex-a76 | ||
68 | target/arm: Define neoverse-n1 | ||
69 | 60 | ||
70 | docs/system/arm/emulation.rst | 10 + | 61 | Philippe Mathieu-Daudé (20): |
71 | docs/system/arm/virt.rst | 2 + | 62 | hw/arm/allwinner-a10: Remove 'hw/arm/boot.h' from header |
72 | qapi/machine.json | 6 +- | 63 | hw/arm/allwinner-h3: Remove 'hw/arm/boot.h' from header |
73 | target/arm/cpregs.h | 11 + | 64 | hw/arm/allwinner-r40: Remove 'hw/arm/boot.h' from header |
74 | target/arm/cpu.h | 23 ++ | 65 | hw/arm/fsl-imx25: Remove 'hw/arm/boot.h' from header |
75 | target/arm/helper.h | 1 + | 66 | hw/arm/fsl-imx31: Remove 'hw/arm/boot.h' from header |
76 | target/arm/internals.h | 16 ++ | 67 | hw/arm/fsl-imx6: Remove 'hw/arm/boot.h' from header |
77 | target/arm/syndrome.h | 5 + | 68 | hw/arm/fsl-imx6ul: Remove 'hw/arm/boot.h' from header |
78 | target/arm/a32.decode | 16 +- | 69 | hw/arm/fsl-imx7: Remove 'hw/arm/boot.h' from header |
79 | target/arm/t32.decode | 18 +- | 70 | hw/arm/xlnx-versal: Remove 'hw/arm/boot.h' from header |
80 | hw/acpi/aml-build.c | 111 ++++---- | 71 | hw/arm/xlnx-zynqmp: Remove 'hw/arm/boot.h' from header |
81 | hw/arm/sbsa-ref.c | 16 ++ | 72 | hw/sd/pxa2xx: Realize sysbus device before accessing it |
82 | hw/arm/virt.c | 21 +- | 73 | hw/sd/pxa2xx: Do not open-code sysbus_create_simple() |
83 | hw/core/machine-hmp-cmds.c | 4 + | 74 | hw/pcmcia/pxa2xx: Realize sysbus device before accessing it |
84 | hw/core/machine.c | 16 ++ | 75 | hw/pcmcia/pxa2xx: Do not open-code sysbus_create_simple() |
85 | target/arm/cpu.c | 66 ++++- | 76 | hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() |
86 | target/arm/cpu64.c | 353 ++++++++++++++----------- | 77 | hw/intc/pxa2xx: Convert to Resettable interface |
87 | target/arm/cpu_tcg.c | 227 +++++++++++----- | 78 | hw/intc/pxa2xx: Pass CPU reference using QOM link property |
88 | target/arm/helper.c | 600 +++++++++++++++++++++++++----------------- | 79 | hw/intc/pxa2xx: Factor pxa2xx_pic_realize() out of pxa2xx_pic_init() |
89 | target/arm/op_helper.c | 43 +++ | 80 | hw/arm/pxa2xx: Realize PXA2XX_I2C device before accessing it |
90 | target/arm/translate-a64.c | 18 ++ | 81 | hw/arm: Avoid using 'first_cpu' when first ARM CPU is reachable |
91 | target/arm/translate.c | 23 ++ | 82 | |
92 | tests/qtest/numa-test.c | 19 +- | 83 | docs/system/arm/virt.rst | 1 + |
93 | .mailmap | 3 +- | 84 | bsd-user/arm/target_arch.h | 1 + |
94 | MAINTAINERS | 2 +- | 85 | include/hw/arm/allwinner-a10.h | 1 - |
95 | 25 files changed, 1068 insertions(+), 562 deletions(-) | 86 | include/hw/arm/allwinner-h3.h | 1 - |
87 | include/hw/arm/allwinner-r40.h | 1 - | ||
88 | include/hw/arm/fsl-imx25.h | 1 - | ||
89 | include/hw/arm/fsl-imx31.h | 1 - | ||
90 | include/hw/arm/fsl-imx6.h | 1 - | ||
91 | include/hw/arm/fsl-imx6ul.h | 1 - | ||
92 | include/hw/arm/fsl-imx7.h | 1 - | ||
93 | include/hw/arm/pxa.h | 2 - | ||
94 | include/hw/arm/xlnx-versal.h | 1 - | ||
95 | include/hw/arm/xlnx-zynqmp.h | 1 - | ||
96 | linux-user/aarch64/target_prctl.h | 2 + | ||
97 | target/arm/cpu-features.h | 994 ++++++++++++++++++++++++++++++++++++++ | ||
98 | target/arm/cpu.h | 971 ------------------------------------- | ||
99 | target/arm/internals.h | 1 + | ||
100 | target/arm/tcg/translate.h | 2 +- | ||
101 | hw/arm/armv7m.c | 1 + | ||
102 | hw/arm/bananapi_m2u.c | 3 +- | ||
103 | hw/arm/cubieboard.c | 1 + | ||
104 | hw/arm/exynos4_boards.c | 7 +- | ||
105 | hw/arm/imx25_pdk.c | 1 + | ||
106 | hw/arm/kzm.c | 1 + | ||
107 | hw/arm/mcimx6ul-evk.c | 1 + | ||
108 | hw/arm/mcimx7d-sabre.c | 1 + | ||
109 | hw/arm/orangepi.c | 3 +- | ||
110 | hw/arm/pxa2xx.c | 17 +- | ||
111 | hw/arm/pxa2xx_pic.c | 38 +- | ||
112 | hw/arm/realview.c | 2 +- | ||
113 | hw/arm/sabrelite.c | 1 + | ||
114 | hw/arm/sbsa-ref.c | 1 + | ||
115 | hw/arm/virt.c | 1 + | ||
116 | hw/arm/xilinx_zynq.c | 2 +- | ||
117 | hw/arm/xlnx-versal-virt.c | 1 + | ||
118 | hw/arm/xlnx-zcu102.c | 1 + | ||
119 | hw/intc/armv7m_nvic.c | 1 + | ||
120 | hw/misc/led.c | 2 +- | ||
121 | hw/net/cadence_gem.c | 884 ++++++++++++++++++--------------- | ||
122 | hw/pcmcia/pxa2xx.c | 15 - | ||
123 | hw/sd/pxa2xx_mmci.c | 7 +- | ||
124 | linux-user/aarch64/cpu_loop.c | 1 + | ||
125 | linux-user/aarch64/signal.c | 1 + | ||
126 | linux-user/arm/signal.c | 1 + | ||
127 | linux-user/elfload.c | 4 + | ||
128 | linux-user/mmap.c | 4 + | ||
129 | target/arm/arch_dump.c | 1 + | ||
130 | target/arm/cpu.c | 1 + | ||
131 | target/arm/cpu64.c | 1 + | ||
132 | target/arm/debug_helper.c | 1 + | ||
133 | target/arm/gdbstub.c | 1 + | ||
134 | target/arm/helper.c | 1 + | ||
135 | target/arm/kvm64.c | 1 + | ||
136 | target/arm/machine.c | 1 + | ||
137 | target/arm/ptw.c | 1 + | ||
138 | target/arm/tcg/cpu64.c | 115 ++++- | ||
139 | target/arm/tcg/hflags.c | 1 + | ||
140 | target/arm/tcg/m_helper.c | 1 + | ||
141 | target/arm/tcg/op_helper.c | 1 + | ||
142 | target/arm/tcg/pauth_helper.c | 1 + | ||
143 | target/arm/tcg/tlb_helper.c | 1 + | ||
144 | target/arm/tcg/translate-a64.c | 4 +- | ||
145 | target/arm/vfp_helper.c | 1 + | ||
146 | 63 files changed, 1702 insertions(+), 1419 deletions(-) | ||
147 | create mode 100644 target/arm/cpu-features.h | ||
148 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Correct a couple of minor errors in the Cortex-A710 definition: | ||
2 | * ID_AA64DFR0_EL1.DebugVer is 9 (indicating Armv8.4 debug architecture) | ||
3 | * ID_AA64ISAR1_EL1.APA is 5 (indicating more PAuth support) | ||
4 | * there is an IMPDEF CPUCFR_EL1, like that on the Neoverse-N1 | ||
1 | 5 | ||
6 | Fixes: e3d45c0a89576 ("target/arm: Implement cortex-a710") | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
9 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Message-id: 20230915185453.1871167-2-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/tcg/cpu64.c | 11 +++++++++-- | ||
13 | 1 file changed, 9 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/tcg/cpu64.c | ||
18 | +++ b/target/arm/tcg/cpu64.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cortex_a710_cp_reginfo[] = { | ||
20 | { .name = "CPUPFR_EL3", .state = ARM_CP_STATE_AA64, | ||
21 | .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 6, | ||
22 | .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
23 | + /* | ||
24 | + * Report CPUCFR_EL1.SCU as 1, as we do not implement the DSU | ||
25 | + * (and in particular its system registers). | ||
26 | + */ | ||
27 | + { .name = "CPUCFR_EL1", .state = ARM_CP_STATE_AA64, | ||
28 | + .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0, | ||
29 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 4 }, | ||
30 | |||
31 | /* | ||
32 | * Stub RAMINDEX, as we don't actually implement caches, BTB, | ||
33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a710_initfn(Object *obj) | ||
34 | cpu->isar.id_aa64pfr0 = 0x1201111120111112ull; /* GIC filled in later */ | ||
35 | cpu->isar.id_aa64pfr1 = 0x0000000000000221ull; | ||
36 | cpu->isar.id_aa64zfr0 = 0x0000110100110021ull; /* with Crypto */ | ||
37 | - cpu->isar.id_aa64dfr0 = 0x000011f010305611ull; | ||
38 | + cpu->isar.id_aa64dfr0 = 0x000011f010305619ull; | ||
39 | cpu->isar.id_aa64dfr1 = 0; | ||
40 | cpu->id_aa64afr0 = 0; | ||
41 | cpu->id_aa64afr1 = 0; | ||
42 | cpu->isar.id_aa64isar0 = 0x0221111110212120ull; /* with Crypto */ | ||
43 | - cpu->isar.id_aa64isar1 = 0x0010111101211032ull; | ||
44 | + cpu->isar.id_aa64isar1 = 0x0010111101211052ull; | ||
45 | cpu->isar.id_aa64mmfr0 = 0x0000022200101122ull; | ||
46 | cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
47 | cpu->isar.id_aa64mmfr2 = 0x1221011110101011ull; | ||
48 | -- | ||
49 | 2.34.1 | ||
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Implement a model of the Neoverse N2 CPU. This is an Armv9.0-A |
---|---|---|---|
2 | processor very similar to the Cortex-A710. The differences are: | ||
3 | * no FEAT_EVT | ||
4 | * FEAT_DGH (data gathering hint) | ||
5 | * FEAT_NV (not yet implemented in QEMU) | ||
6 | * Statistical Profiling Extension (not implemented in QEMU) | ||
7 | * 48 bit physical address range, not 40 | ||
8 | * CTR_EL0.DIC = 1 (no explicit icache cleaning needed) | ||
9 | * PMCR_EL0.N = 6 (always 6 PMU counters, not 20) | ||
2 | 10 | ||
3 | Enable the n1 for virt and sbsa board use. | 11 | Because it has 48-bit physical address support, we can use |
12 | this CPU in the sbsa-ref board as well as the virt board. | ||
4 | 13 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220506180242.216785-25-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
16 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
17 | Message-id: 20230915185453.1871167-3-peter.maydell@linaro.org | ||
9 | --- | 18 | --- |
10 | docs/system/arm/virt.rst | 1 + | 19 | docs/system/arm/virt.rst | 1 + |
11 | hw/arm/sbsa-ref.c | 1 + | 20 | hw/arm/sbsa-ref.c | 1 + |
12 | hw/arm/virt.c | 1 + | 21 | hw/arm/virt.c | 1 + |
13 | target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++ | 22 | target/arm/tcg/cpu64.c | 103 +++++++++++++++++++++++++++++++++++++++ |
14 | 4 files changed, 69 insertions(+) | 23 | 4 files changed, 106 insertions(+) |
15 | 24 | ||
16 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst | 25 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/docs/system/arm/virt.rst | 27 | --- a/docs/system/arm/virt.rst |
19 | +++ b/docs/system/arm/virt.rst | 28 | +++ b/docs/system/arm/virt.rst |
20 | @@ -XXX,XX +XXX,XX @@ Supported guest CPU types: | 29 | @@ -XXX,XX +XXX,XX @@ Supported guest CPU types: |
21 | - ``cortex-a76`` (64-bit) | ||
22 | - ``a64fx`` (64-bit) | ||
23 | - ``host`` (with KVM only) | 30 | - ``host`` (with KVM only) |
24 | +- ``neoverse-n1`` (64-bit) | 31 | - ``neoverse-n1`` (64-bit) |
32 | - ``neoverse-v1`` (64-bit) | ||
33 | +- ``neoverse-n2`` (64-bit) | ||
25 | - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) | 34 | - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) |
26 | 35 | ||
27 | Note that the default is ``cortex-a15``, so for an AArch64 guest you must | 36 | Note that the default is ``cortex-a15``, so for an AArch64 guest you must |
28 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | 37 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
29 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/hw/arm/sbsa-ref.c | 39 | --- a/hw/arm/sbsa-ref.c |
31 | +++ b/hw/arm/sbsa-ref.c | 40 | +++ b/hw/arm/sbsa-ref.c |
32 | @@ -XXX,XX +XXX,XX @@ static const char * const valid_cpus[] = { | 41 | @@ -XXX,XX +XXX,XX @@ static const char * const valid_cpus[] = { |
33 | ARM_CPU_TYPE_NAME("cortex-a57"), | ||
34 | ARM_CPU_TYPE_NAME("cortex-a72"), | 42 | ARM_CPU_TYPE_NAME("cortex-a72"), |
35 | ARM_CPU_TYPE_NAME("cortex-a76"), | 43 | ARM_CPU_TYPE_NAME("neoverse-n1"), |
36 | + ARM_CPU_TYPE_NAME("neoverse-n1"), | 44 | ARM_CPU_TYPE_NAME("neoverse-v1"), |
45 | + ARM_CPU_TYPE_NAME("neoverse-n2"), | ||
37 | ARM_CPU_TYPE_NAME("max"), | 46 | ARM_CPU_TYPE_NAME("max"), |
38 | }; | 47 | }; |
39 | 48 | ||
40 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 49 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
41 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/arm/virt.c | 51 | --- a/hw/arm/virt.c |
43 | +++ b/hw/arm/virt.c | 52 | +++ b/hw/arm/virt.c |
44 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { | 53 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { |
45 | ARM_CPU_TYPE_NAME("cortex-a72"), | ||
46 | ARM_CPU_TYPE_NAME("cortex-a76"), | ||
47 | ARM_CPU_TYPE_NAME("a64fx"), | 54 | ARM_CPU_TYPE_NAME("a64fx"), |
48 | + ARM_CPU_TYPE_NAME("neoverse-n1"), | 55 | ARM_CPU_TYPE_NAME("neoverse-n1"), |
49 | ARM_CPU_TYPE_NAME("host"), | 56 | ARM_CPU_TYPE_NAME("neoverse-v1"), |
50 | ARM_CPU_TYPE_NAME("max"), | 57 | + ARM_CPU_TYPE_NAME("neoverse-n2"), |
51 | }; | 58 | #endif |
52 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 59 | ARM_CPU_TYPE_NAME("cortex-a53"), |
60 | ARM_CPU_TYPE_NAME("cortex-a57"), | ||
61 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/target/arm/cpu64.c | 63 | --- a/target/arm/tcg/cpu64.c |
55 | +++ b/target/arm/cpu64.c | 64 | +++ b/target/arm/tcg/cpu64.c |
56 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a76_initfn(Object *obj) | 65 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a710_initfn(Object *obj) |
57 | cpu->isar.mvfr2 = 0x00000043; | 66 | aarch64_add_sve_properties(obj); |
58 | } | 67 | } |
59 | 68 | ||
60 | +static void aarch64_neoverse_n1_initfn(Object *obj) | 69 | +/* Extra IMPDEF regs in the N2 beyond those in the A710 */ |
70 | +static const ARMCPRegInfo neoverse_n2_cp_reginfo[] = { | ||
71 | + { .name = "CPURNDBR_EL3", .state = ARM_CP_STATE_AA64, | ||
72 | + .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 3, .opc2 = 0, | ||
73 | + .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
74 | + { .name = "CPURNDPEID_EL3", .state = ARM_CP_STATE_AA64, | ||
75 | + .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 3, .opc2 = 1, | ||
76 | + .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
77 | +}; | ||
78 | + | ||
79 | +static void aarch64_neoverse_n2_initfn(Object *obj) | ||
61 | +{ | 80 | +{ |
62 | + ARMCPU *cpu = ARM_CPU(obj); | 81 | + ARMCPU *cpu = ARM_CPU(obj); |
63 | + | 82 | + |
64 | + cpu->dtb_compatible = "arm,neoverse-n1"; | 83 | + cpu->dtb_compatible = "arm,neoverse-n2"; |
65 | + set_feature(&cpu->env, ARM_FEATURE_V8); | 84 | + set_feature(&cpu->env, ARM_FEATURE_V8); |
66 | + set_feature(&cpu->env, ARM_FEATURE_NEON); | 85 | + set_feature(&cpu->env, ARM_FEATURE_NEON); |
67 | + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | 86 | + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); |
68 | + set_feature(&cpu->env, ARM_FEATURE_AARCH64); | 87 | + set_feature(&cpu->env, ARM_FEATURE_AARCH64); |
69 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | 88 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); |
70 | + set_feature(&cpu->env, ARM_FEATURE_EL2); | 89 | + set_feature(&cpu->env, ARM_FEATURE_EL2); |
71 | + set_feature(&cpu->env, ARM_FEATURE_EL3); | 90 | + set_feature(&cpu->env, ARM_FEATURE_EL3); |
72 | + set_feature(&cpu->env, ARM_FEATURE_PMU); | 91 | + set_feature(&cpu->env, ARM_FEATURE_PMU); |
73 | + | 92 | + |
74 | + /* Ordered by B2.4 AArch64 registers by functional group */ | 93 | + /* Ordered by Section B.5: AArch64 ID registers */ |
75 | + cpu->clidr = 0x82000023; | 94 | + cpu->midr = 0x410FD493; /* r0p3 */ |
76 | + cpu->ctr = 0x8444c004; | 95 | + cpu->revidr = 0; |
77 | + cpu->dcz_blocksize = 4; | 96 | + cpu->isar.id_pfr0 = 0x21110131; |
78 | + cpu->isar.id_aa64dfr0 = 0x0000000110305408ull; | 97 | + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ |
79 | + cpu->isar.id_aa64isar0 = 0x0000100010211120ull; | 98 | + cpu->isar.id_dfr0 = 0x16011099; |
80 | + cpu->isar.id_aa64isar1 = 0x0000000000100001ull; | 99 | + cpu->id_afr0 = 0; |
81 | + cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull; | 100 | + cpu->isar.id_mmfr0 = 0x10201105; |
82 | + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | 101 | + cpu->isar.id_mmfr1 = 0x40000000; |
83 | + cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; | 102 | + cpu->isar.id_mmfr2 = 0x01260000; |
84 | + cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ | 103 | + cpu->isar.id_mmfr3 = 0x02122211; |
85 | + cpu->isar.id_aa64pfr1 = 0x0000000000000020ull; | ||
86 | + cpu->id_afr0 = 0x00000000; | ||
87 | + cpu->isar.id_dfr0 = 0x04010088; | ||
88 | + cpu->isar.id_isar0 = 0x02101110; | 104 | + cpu->isar.id_isar0 = 0x02101110; |
89 | + cpu->isar.id_isar1 = 0x13112111; | 105 | + cpu->isar.id_isar1 = 0x13112111; |
90 | + cpu->isar.id_isar2 = 0x21232042; | 106 | + cpu->isar.id_isar2 = 0x21232042; |
91 | + cpu->isar.id_isar3 = 0x01112131; | 107 | + cpu->isar.id_isar3 = 0x01112131; |
92 | + cpu->isar.id_isar4 = 0x00010142; | 108 | + cpu->isar.id_isar4 = 0x00010142; |
93 | + cpu->isar.id_isar5 = 0x01011121; | 109 | + cpu->isar.id_isar5 = 0x11011121; /* with Crypto */ |
94 | + cpu->isar.id_isar6 = 0x00000010; | 110 | + cpu->isar.id_mmfr4 = 0x01021110; |
95 | + cpu->isar.id_mmfr0 = 0x10201105; | 111 | + cpu->isar.id_isar6 = 0x01111111; |
96 | + cpu->isar.id_mmfr1 = 0x40000000; | 112 | + cpu->isar.mvfr0 = 0x10110222; |
97 | + cpu->isar.id_mmfr2 = 0x01260000; | 113 | + cpu->isar.mvfr1 = 0x13211111; |
98 | + cpu->isar.id_mmfr3 = 0x02122211; | 114 | + cpu->isar.mvfr2 = 0x00000043; |
99 | + cpu->isar.id_mmfr4 = 0x00021110; | ||
100 | + cpu->isar.id_pfr0 = 0x10010131; | ||
101 | + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ | ||
102 | + cpu->isar.id_pfr2 = 0x00000011; | 115 | + cpu->isar.id_pfr2 = 0x00000011; |
103 | + cpu->midr = 0x414fd0c1; /* r4p1 */ | 116 | + cpu->isar.id_aa64pfr0 = 0x1201111120111112ull; /* GIC filled in later */ |
104 | + cpu->revidr = 0; | 117 | + cpu->isar.id_aa64pfr1 = 0x0000000000000221ull; |
118 | + cpu->isar.id_aa64zfr0 = 0x0000110100110021ull; /* with Crypto */ | ||
119 | + cpu->isar.id_aa64dfr0 = 0x000011f210305619ull; | ||
120 | + cpu->isar.id_aa64dfr1 = 0; | ||
121 | + cpu->id_aa64afr0 = 0; | ||
122 | + cpu->id_aa64afr1 = 0; | ||
123 | + cpu->isar.id_aa64isar0 = 0x0221111110212120ull; /* with Crypto */ | ||
124 | + cpu->isar.id_aa64isar1 = 0x0011111101211052ull; | ||
125 | + cpu->isar.id_aa64mmfr0 = 0x0000022200101125ull; | ||
126 | + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
127 | + cpu->isar.id_aa64mmfr2 = 0x1221011112101011ull; | ||
128 | + cpu->clidr = 0x0000001482000023ull; | ||
129 | + cpu->gm_blocksize = 4; | ||
130 | + cpu->ctr = 0x00000004b444c004ull; | ||
131 | + cpu->dcz_blocksize = 4; | ||
132 | + /* TODO FEAT_MPAM: mpamidr_el1 = 0x0000_0001_001e_01ff */ | ||
105 | + | 133 | + |
106 | + /* From B2.23 CCSIDR_EL1 */ | 134 | + /* Section B.7.2: PMCR_EL0 */ |
107 | + cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ | 135 | + cpu->isar.reset_pmcr_el0 = 0x3000; /* with 6 counters */ |
108 | + cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ | ||
109 | + cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */ | ||
110 | + | 136 | + |
111 | + /* From B2.98 SCTLR_EL3 */ | 137 | + /* Section B.8.9: ICH_VTR_EL2 */ |
112 | + cpu->reset_sctlr = 0x30c50838; | ||
113 | + | ||
114 | + /* From B4.23 ICH_VTR_EL2 */ | ||
115 | + cpu->gic_num_lrs = 4; | 138 | + cpu->gic_num_lrs = 4; |
116 | + cpu->gic_vpribits = 5; | 139 | + cpu->gic_vpribits = 5; |
117 | + cpu->gic_vprebits = 5; | 140 | + cpu->gic_vprebits = 5; |
141 | + cpu->gic_pribits = 5; | ||
118 | + | 142 | + |
119 | + /* From B5.1 AdvSIMD AArch64 register summary */ | 143 | + /* Section 14: Scalable Vector Extensions support */ |
120 | + cpu->isar.mvfr0 = 0x10110222; | 144 | + cpu->sve_vq.supported = 1 << 0; /* 128bit */ |
121 | + cpu->isar.mvfr1 = 0x13211111; | 145 | + |
122 | + cpu->isar.mvfr2 = 0x00000043; | 146 | + /* |
147 | + * The Neoverse N2 TRM does not list CCSIDR values. The layout of | ||
148 | + * the caches are in text in Table 7-1, Table 8-1, and Table 9-1. | ||
149 | + * | ||
150 | + * L1: 4-way set associative 64-byte line size, total 64K. | ||
151 | + * L2: 8-way set associative 64 byte line size, total either 512K or 1024K. | ||
152 | + */ | ||
153 | + cpu->ccsidr[0] = make_ccsidr64(4, 64, 64 * KiB); /* L1 dcache */ | ||
154 | + cpu->ccsidr[1] = cpu->ccsidr[0]; /* L1 icache */ | ||
155 | + cpu->ccsidr[2] = make_ccsidr64(8, 64, 512 * KiB); /* L2 cache */ | ||
156 | + | ||
157 | + /* FIXME: Not documented -- copied from neoverse-v1 */ | ||
158 | + cpu->reset_sctlr = 0x30c50838; | ||
159 | + | ||
160 | + /* | ||
161 | + * The Neoverse N2 has all of the Cortex-A710 IMPDEF registers, | ||
162 | + * and a few more RNG related ones. | ||
163 | + */ | ||
164 | + define_arm_cp_regs(cpu, cortex_a710_cp_reginfo); | ||
165 | + define_arm_cp_regs(cpu, neoverse_n2_cp_reginfo); | ||
166 | + | ||
167 | + aarch64_add_pauth_properties(obj); | ||
168 | + aarch64_add_sve_properties(obj); | ||
123 | +} | 169 | +} |
124 | + | 170 | + |
125 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 171 | /* |
126 | { | 172 | * -cpu max: a CPU with as many features enabled as our emulation supports. |
127 | /* | 173 | * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c; |
128 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { | 174 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { |
129 | { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | ||
130 | { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, | ||
131 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | 175 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, |
132 | + { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, | 176 | { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, |
133 | { .name = "max", .initfn = aarch64_max_initfn }, | 177 | { .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn }, |
134 | #if defined(CONFIG_KVM) || defined(CONFIG_HVF) | 178 | + { .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn }, |
135 | { .name = "host", .initfn = aarch64_host_initfn }, | 179 | }; |
180 | |||
181 | static void aarch64_cpu_register_types(void) | ||
136 | -- | 182 | -- |
137 | 2.25.1 | 183 | 2.34.1 |
184 | |||
185 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The feature test functions isar_feature_*() now take up nearly |
---|---|---|---|
2 | a thousand lines in target/arm/cpu.h. This header file is included | ||
3 | by a lot of source files, most of which don't need these functions. | ||
4 | Move the feature test functions to their own header file. | ||
2 | 5 | ||
3 | There is no branch prediction in TCG, therefore there is no | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | need to actually include the context number into the predictor. | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Therefore all we need to do is add the state for SCXTNUM_ELx. | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20231024163510.2972081-2-peter.maydell@linaro.org | ||
10 | --- | ||
11 | bsd-user/arm/target_arch.h | 1 + | ||
12 | linux-user/aarch64/target_prctl.h | 2 + | ||
13 | target/arm/cpu-features.h | 994 ++++++++++++++++++++++++++++++ | ||
14 | target/arm/cpu.h | 971 ----------------------------- | ||
15 | target/arm/internals.h | 1 + | ||
16 | target/arm/tcg/translate.h | 2 +- | ||
17 | hw/arm/armv7m.c | 1 + | ||
18 | hw/intc/armv7m_nvic.c | 1 + | ||
19 | linux-user/aarch64/cpu_loop.c | 1 + | ||
20 | linux-user/aarch64/signal.c | 1 + | ||
21 | linux-user/arm/signal.c | 1 + | ||
22 | linux-user/elfload.c | 4 + | ||
23 | linux-user/mmap.c | 4 + | ||
24 | target/arm/arch_dump.c | 1 + | ||
25 | target/arm/cpu.c | 1 + | ||
26 | target/arm/cpu64.c | 1 + | ||
27 | target/arm/debug_helper.c | 1 + | ||
28 | target/arm/gdbstub.c | 1 + | ||
29 | target/arm/helper.c | 1 + | ||
30 | target/arm/kvm64.c | 1 + | ||
31 | target/arm/machine.c | 1 + | ||
32 | target/arm/ptw.c | 1 + | ||
33 | target/arm/tcg/cpu64.c | 1 + | ||
34 | target/arm/tcg/hflags.c | 1 + | ||
35 | target/arm/tcg/m_helper.c | 1 + | ||
36 | target/arm/tcg/op_helper.c | 1 + | ||
37 | target/arm/tcg/pauth_helper.c | 1 + | ||
38 | target/arm/tcg/tlb_helper.c | 1 + | ||
39 | target/arm/vfp_helper.c | 1 + | ||
40 | 29 files changed, 1028 insertions(+), 972 deletions(-) | ||
41 | create mode 100644 target/arm/cpu-features.h | ||
6 | 42 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 43 | diff --git a/bsd-user/arm/target_arch.h b/bsd-user/arm/target_arch.h |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 44 | index XXXXXXX..XXXXXXX 100644 |
9 | Message-id: 20220506180242.216785-21-richard.henderson@linaro.org | 45 | --- a/bsd-user/arm/target_arch.h |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 46 | +++ b/bsd-user/arm/target_arch.h |
11 | --- | 47 | @@ -XXX,XX +XXX,XX @@ |
12 | docs/system/arm/emulation.rst | 3 ++ | 48 | #define TARGET_ARCH_H |
13 | target/arm/cpu.h | 16 +++++++++ | 49 | |
14 | target/arm/cpu.c | 5 +++ | 50 | #include "qemu.h" |
15 | target/arm/cpu64.c | 3 +- | 51 | +#include "target/arm/cpu-features.h" |
16 | target/arm/helper.c | 61 ++++++++++++++++++++++++++++++++++- | 52 | |
17 | 5 files changed, 86 insertions(+), 2 deletions(-) | 53 | void target_cpu_set_tls(CPUARMState *env, target_ulong newtls); |
18 | 54 | target_ulong target_cpu_get_tls(CPUARMState *env); | |
19 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 55 | diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h |
20 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/docs/system/arm/emulation.rst | 57 | --- a/linux-user/aarch64/target_prctl.h |
22 | +++ b/docs/system/arm/emulation.rst | 58 | +++ b/linux-user/aarch64/target_prctl.h |
23 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 59 | @@ -XXX,XX +XXX,XX @@ |
24 | - FEAT_BF16 (AArch64 BFloat16 instructions) | 60 | #ifndef AARCH64_TARGET_PRCTL_H |
25 | - FEAT_BTI (Branch Target Identification) | 61 | #define AARCH64_TARGET_PRCTL_H |
26 | - FEAT_CSV2 (Cache speculation variant 2) | 62 | |
27 | +- FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1) | 63 | +#include "target/arm/cpu-features.h" |
28 | +- FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) | 64 | + |
29 | +- FEAT_CSV2_2 (Cache speculation variant 2, version 2) | 65 | static abi_long do_prctl_sve_get_vl(CPUArchState *env) |
30 | - FEAT_DIT (Data Independent Timing instructions) | 66 | { |
31 | - FEAT_DPB (DC CVAP instruction) | 67 | ARMCPU *cpu = env_archcpu(env); |
32 | - FEAT_Debugv8p2 (Debug changes for v8.2) | 68 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
33 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 69 | new file mode 100644 |
34 | index XXXXXXX..XXXXXXX 100644 | 70 | index XXXXXXX..XXXXXXX |
35 | --- a/target/arm/cpu.h | 71 | --- /dev/null |
36 | +++ b/target/arm/cpu.h | 72 | +++ b/target/arm/cpu-features.h |
37 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | 73 | @@ -XXX,XX +XXX,XX @@ |
38 | ARMPACKey apdb; | 74 | +/* |
39 | ARMPACKey apga; | 75 | + * QEMU Arm CPU -- feature test functions |
40 | } keys; | 76 | + * |
41 | + | 77 | + * Copyright (c) 2023 Linaro Ltd |
42 | + uint64_t scxtnum_el[4]; | 78 | + * |
43 | #endif | 79 | + * This library is free software; you can redistribute it and/or |
44 | 80 | + * modify it under the terms of the GNU Lesser General Public | |
45 | #if defined(CONFIG_USER_ONLY) | 81 | + * License as published by the Free Software Foundation; either |
46 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 82 | + * version 2.1 of the License, or (at your option) any later version. |
47 | #define SCTLR_WXN (1U << 19) | 83 | + * |
48 | #define SCTLR_ST (1U << 20) /* up to ??, RAZ in v6 */ | 84 | + * This library is distributed in the hope that it will be useful, |
49 | #define SCTLR_UWXN (1U << 20) /* v7 onward, AArch32 only */ | 85 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
50 | +#define SCTLR_TSCXT (1U << 20) /* FEAT_CSV2_1p2, AArch64 only */ | 86 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
51 | #define SCTLR_FI (1U << 21) /* up to v7, v8 RES0 */ | 87 | + * Lesser General Public License for more details. |
52 | #define SCTLR_IESB (1U << 21) /* v8.2-IESB, AArch64 only */ | 88 | + * |
53 | #define SCTLR_U (1U << 22) /* up to v6, RAO in v7 */ | 89 | + * You should have received a copy of the GNU Lesser General Public |
54 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | 90 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
55 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | 91 | + */ |
56 | } | 92 | + |
57 | 93 | +#ifndef TARGET_ARM_FEATURES_H | |
94 | +#define TARGET_ARM_FEATURES_H | ||
95 | + | ||
96 | +/* | ||
97 | + * Naming convention for isar_feature functions: | ||
98 | + * Functions which test 32-bit ID registers should have _aa32_ in | ||
99 | + * their name. Functions which test 64-bit ID registers should have | ||
100 | + * _aa64_ in their name. These must only be used in code where we | ||
101 | + * know for certain that the CPU has AArch32 or AArch64 respectively | ||
102 | + * or where the correct answer for a CPU which doesn't implement that | ||
103 | + * CPU state is "false" (eg when generating A32 or A64 code, if adding | ||
104 | + * system registers that are specific to that CPU state, for "should | ||
105 | + * we let this system register bit be set" tests where the 32-bit | ||
106 | + * flavour of the register doesn't have the bit, and so on). | ||
107 | + * Functions which simply ask "does this feature exist at all" have | ||
108 | + * _any_ in their name, and always return the logical OR of the _aa64_ | ||
109 | + * and the _aa32_ function. | ||
110 | + */ | ||
111 | + | ||
112 | +/* | ||
113 | + * 32-bit feature tests via id registers. | ||
114 | + */ | ||
115 | +static inline bool isar_feature_aa32_thumb_div(const ARMISARegisters *id) | ||
116 | +{ | ||
117 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0; | ||
118 | +} | ||
119 | + | ||
120 | +static inline bool isar_feature_aa32_arm_div(const ARMISARegisters *id) | ||
121 | +{ | ||
122 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; | ||
123 | +} | ||
124 | + | ||
125 | +static inline bool isar_feature_aa32_lob(const ARMISARegisters *id) | ||
126 | +{ | ||
127 | + /* (M-profile) low-overhead loops and branch future */ | ||
128 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, CMPBRANCH) >= 3; | ||
129 | +} | ||
130 | + | ||
131 | +static inline bool isar_feature_aa32_jazelle(const ARMISARegisters *id) | ||
132 | +{ | ||
133 | + return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) != 0; | ||
134 | +} | ||
135 | + | ||
136 | +static inline bool isar_feature_aa32_aes(const ARMISARegisters *id) | ||
137 | +{ | ||
138 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) != 0; | ||
139 | +} | ||
140 | + | ||
141 | +static inline bool isar_feature_aa32_pmull(const ARMISARegisters *id) | ||
142 | +{ | ||
143 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) > 1; | ||
144 | +} | ||
145 | + | ||
146 | +static inline bool isar_feature_aa32_sha1(const ARMISARegisters *id) | ||
147 | +{ | ||
148 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA1) != 0; | ||
149 | +} | ||
150 | + | ||
151 | +static inline bool isar_feature_aa32_sha2(const ARMISARegisters *id) | ||
152 | +{ | ||
153 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA2) != 0; | ||
154 | +} | ||
155 | + | ||
156 | +static inline bool isar_feature_aa32_crc32(const ARMISARegisters *id) | ||
157 | +{ | ||
158 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, CRC32) != 0; | ||
159 | +} | ||
160 | + | ||
161 | +static inline bool isar_feature_aa32_rdm(const ARMISARegisters *id) | ||
162 | +{ | ||
163 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, RDM) != 0; | ||
164 | +} | ||
165 | + | ||
166 | +static inline bool isar_feature_aa32_vcma(const ARMISARegisters *id) | ||
167 | +{ | ||
168 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, VCMA) != 0; | ||
169 | +} | ||
170 | + | ||
171 | +static inline bool isar_feature_aa32_jscvt(const ARMISARegisters *id) | ||
172 | +{ | ||
173 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, JSCVT) != 0; | ||
174 | +} | ||
175 | + | ||
176 | +static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) | ||
177 | +{ | ||
178 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; | ||
179 | +} | ||
180 | + | ||
181 | +static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) | ||
182 | +{ | ||
183 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; | ||
184 | +} | ||
185 | + | ||
186 | +static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | ||
187 | +{ | ||
188 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | ||
189 | +} | ||
190 | + | ||
191 | +static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id) | ||
192 | +{ | ||
193 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0; | ||
194 | +} | ||
195 | + | ||
196 | +static inline bool isar_feature_aa32_bf16(const ARMISARegisters *id) | ||
197 | +{ | ||
198 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, BF16) != 0; | ||
199 | +} | ||
200 | + | ||
201 | +static inline bool isar_feature_aa32_i8mm(const ARMISARegisters *id) | ||
202 | +{ | ||
203 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, I8MM) != 0; | ||
204 | +} | ||
205 | + | ||
206 | +static inline bool isar_feature_aa32_ras(const ARMISARegisters *id) | ||
207 | +{ | ||
208 | + return FIELD_EX32(id->id_pfr0, ID_PFR0, RAS) != 0; | ||
209 | +} | ||
210 | + | ||
211 | +static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id) | ||
212 | +{ | ||
213 | + return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0; | ||
214 | +} | ||
215 | + | ||
216 | +static inline bool isar_feature_aa32_m_sec_state(const ARMISARegisters *id) | ||
217 | +{ | ||
218 | + /* | ||
219 | + * Return true if M-profile state handling insns | ||
220 | + * (VSCCLRM, CLRM, FPCTX access insns) are implemented | ||
221 | + */ | ||
222 | + return FIELD_EX32(id->id_pfr1, ID_PFR1, SECURITY) >= 3; | ||
223 | +} | ||
224 | + | ||
225 | +static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
226 | +{ | ||
227 | + /* Sadly this is encoded differently for A-profile and M-profile */ | ||
228 | + if (isar_feature_aa32_mprofile(id)) { | ||
229 | + return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0; | ||
230 | + } else { | ||
231 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3; | ||
232 | + } | ||
233 | +} | ||
234 | + | ||
235 | +static inline bool isar_feature_aa32_mve(const ARMISARegisters *id) | ||
236 | +{ | ||
237 | + /* | ||
238 | + * Return true if MVE is supported (either integer or floating point). | ||
239 | + * We must check for M-profile as the MVFR1 field means something | ||
240 | + * else for A-profile. | ||
241 | + */ | ||
242 | + return isar_feature_aa32_mprofile(id) && | ||
243 | + FIELD_EX32(id->mvfr1, MVFR1, MVE) > 0; | ||
244 | +} | ||
245 | + | ||
246 | +static inline bool isar_feature_aa32_mve_fp(const ARMISARegisters *id) | ||
247 | +{ | ||
248 | + /* | ||
249 | + * Return true if MVE is supported (either integer or floating point). | ||
250 | + * We must check for M-profile as the MVFR1 field means something | ||
251 | + * else for A-profile. | ||
252 | + */ | ||
253 | + return isar_feature_aa32_mprofile(id) && | ||
254 | + FIELD_EX32(id->mvfr1, MVFR1, MVE) >= 2; | ||
255 | +} | ||
256 | + | ||
257 | +static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id) | ||
258 | +{ | ||
259 | + /* | ||
260 | + * Return true if either VFP or SIMD is implemented. | ||
261 | + * In this case, a minimum of VFP w/ D0-D15. | ||
262 | + */ | ||
263 | + return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0; | ||
264 | +} | ||
265 | + | ||
266 | +static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id) | ||
267 | +{ | ||
268 | + /* Return true if D16-D31 are implemented */ | ||
269 | + return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) >= 2; | ||
270 | +} | ||
271 | + | ||
272 | +static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) | ||
273 | +{ | ||
274 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; | ||
275 | +} | ||
276 | + | ||
277 | +static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id) | ||
278 | +{ | ||
279 | + /* Return true if CPU supports single precision floating point, VFPv2 */ | ||
280 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0; | ||
281 | +} | ||
282 | + | ||
283 | +static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id) | ||
284 | +{ | ||
285 | + /* Return true if CPU supports single precision floating point, VFPv3 */ | ||
286 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2; | ||
287 | +} | ||
288 | + | ||
289 | +static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) | ||
290 | +{ | ||
291 | + /* Return true if CPU supports double precision floating point, VFPv2 */ | ||
292 | + return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; | ||
293 | +} | ||
294 | + | ||
295 | +static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) | ||
296 | +{ | ||
297 | + /* Return true if CPU supports double precision floating point, VFPv3 */ | ||
298 | + return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; | ||
299 | +} | ||
300 | + | ||
301 | +static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id) | ||
302 | +{ | ||
303 | + return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id); | ||
304 | +} | ||
305 | + | ||
306 | +/* | ||
307 | + * We always set the FP and SIMD FP16 fields to indicate identical | ||
308 | + * levels of support (assuming SIMD is implemented at all), so | ||
309 | + * we only need one set of accessors. | ||
310 | + */ | ||
311 | +static inline bool isar_feature_aa32_fp16_spconv(const ARMISARegisters *id) | ||
312 | +{ | ||
313 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 0; | ||
314 | +} | ||
315 | + | ||
316 | +static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) | ||
317 | +{ | ||
318 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; | ||
319 | +} | ||
320 | + | ||
321 | +/* | ||
322 | + * Note that this ID register field covers both VFP and Neon FMAC, | ||
323 | + * so should usually be tested in combination with some other | ||
324 | + * check that confirms the presence of whichever of VFP or Neon is | ||
325 | + * relevant, to avoid accidentally enabling a Neon feature on | ||
326 | + * a VFP-no-Neon core or vice-versa. | ||
327 | + */ | ||
328 | +static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) | ||
329 | +{ | ||
330 | + return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; | ||
331 | +} | ||
332 | + | ||
333 | +static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) | ||
334 | +{ | ||
335 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; | ||
336 | +} | ||
337 | + | ||
338 | +static inline bool isar_feature_aa32_vcvt_dr(const ARMISARegisters *id) | ||
339 | +{ | ||
340 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 2; | ||
341 | +} | ||
342 | + | ||
343 | +static inline bool isar_feature_aa32_vrint(const ARMISARegisters *id) | ||
344 | +{ | ||
345 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 3; | ||
346 | +} | ||
347 | + | ||
348 | +static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) | ||
349 | +{ | ||
350 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 4; | ||
351 | +} | ||
352 | + | ||
353 | +static inline bool isar_feature_aa32_pxn(const ARMISARegisters *id) | ||
354 | +{ | ||
355 | + return FIELD_EX32(id->id_mmfr0, ID_MMFR0, VMSA) >= 4; | ||
356 | +} | ||
357 | + | ||
358 | +static inline bool isar_feature_aa32_pan(const ARMISARegisters *id) | ||
359 | +{ | ||
360 | + return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) != 0; | ||
361 | +} | ||
362 | + | ||
363 | +static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id) | ||
364 | +{ | ||
365 | + return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) >= 2; | ||
366 | +} | ||
367 | + | ||
368 | +static inline bool isar_feature_aa32_pmuv3p1(const ARMISARegisters *id) | ||
369 | +{ | ||
370 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
371 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 4 && | ||
372 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
373 | +} | ||
374 | + | ||
375 | +static inline bool isar_feature_aa32_pmuv3p4(const ARMISARegisters *id) | ||
376 | +{ | ||
377 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
378 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 5 && | ||
379 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
380 | +} | ||
381 | + | ||
382 | +static inline bool isar_feature_aa32_pmuv3p5(const ARMISARegisters *id) | ||
383 | +{ | ||
384 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
385 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 6 && | ||
386 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
387 | +} | ||
388 | + | ||
389 | +static inline bool isar_feature_aa32_hpd(const ARMISARegisters *id) | ||
390 | +{ | ||
391 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, HPDS) != 0; | ||
392 | +} | ||
393 | + | ||
394 | +static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id) | ||
395 | +{ | ||
396 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0; | ||
397 | +} | ||
398 | + | ||
399 | +static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | ||
400 | +{ | ||
401 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | ||
402 | +} | ||
403 | + | ||
404 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | ||
405 | +{ | ||
406 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | ||
407 | +} | ||
408 | + | ||
409 | +static inline bool isar_feature_aa32_half_evt(const ARMISARegisters *id) | ||
410 | +{ | ||
411 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 1; | ||
412 | +} | ||
413 | + | ||
414 | +static inline bool isar_feature_aa32_evt(const ARMISARegisters *id) | ||
415 | +{ | ||
416 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 2; | ||
417 | +} | ||
418 | + | ||
419 | +static inline bool isar_feature_aa32_dit(const ARMISARegisters *id) | ||
420 | +{ | ||
421 | + return FIELD_EX32(id->id_pfr0, ID_PFR0, DIT) != 0; | ||
422 | +} | ||
423 | + | ||
424 | +static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id) | ||
425 | +{ | ||
426 | + return FIELD_EX32(id->id_pfr2, ID_PFR2, SSBS) != 0; | ||
427 | +} | ||
428 | + | ||
429 | +static inline bool isar_feature_aa32_debugv7p1(const ARMISARegisters *id) | ||
430 | +{ | ||
431 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 5; | ||
432 | +} | ||
433 | + | ||
434 | +static inline bool isar_feature_aa32_debugv8p2(const ARMISARegisters *id) | ||
435 | +{ | ||
436 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 8; | ||
437 | +} | ||
438 | + | ||
439 | +static inline bool isar_feature_aa32_doublelock(const ARMISARegisters *id) | ||
440 | +{ | ||
441 | + return FIELD_EX32(id->dbgdevid, DBGDEVID, DOUBLELOCK) > 0; | ||
442 | +} | ||
443 | + | ||
444 | +/* | ||
445 | + * 64-bit feature tests via id registers. | ||
446 | + */ | ||
447 | +static inline bool isar_feature_aa64_aes(const ARMISARegisters *id) | ||
448 | +{ | ||
449 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) != 0; | ||
450 | +} | ||
451 | + | ||
452 | +static inline bool isar_feature_aa64_pmull(const ARMISARegisters *id) | ||
453 | +{ | ||
454 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) > 1; | ||
455 | +} | ||
456 | + | ||
457 | +static inline bool isar_feature_aa64_sha1(const ARMISARegisters *id) | ||
458 | +{ | ||
459 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA1) != 0; | ||
460 | +} | ||
461 | + | ||
462 | +static inline bool isar_feature_aa64_sha256(const ARMISARegisters *id) | ||
463 | +{ | ||
464 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) != 0; | ||
465 | +} | ||
466 | + | ||
467 | +static inline bool isar_feature_aa64_sha512(const ARMISARegisters *id) | ||
468 | +{ | ||
469 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) > 1; | ||
470 | +} | ||
471 | + | ||
472 | +static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id) | ||
473 | +{ | ||
474 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, CRC32) != 0; | ||
475 | +} | ||
476 | + | ||
477 | +static inline bool isar_feature_aa64_atomics(const ARMISARegisters *id) | ||
478 | +{ | ||
479 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, ATOMIC) != 0; | ||
480 | +} | ||
481 | + | ||
482 | +static inline bool isar_feature_aa64_rdm(const ARMISARegisters *id) | ||
483 | +{ | ||
484 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RDM) != 0; | ||
485 | +} | ||
486 | + | ||
487 | +static inline bool isar_feature_aa64_sha3(const ARMISARegisters *id) | ||
488 | +{ | ||
489 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA3) != 0; | ||
490 | +} | ||
491 | + | ||
492 | +static inline bool isar_feature_aa64_sm3(const ARMISARegisters *id) | ||
493 | +{ | ||
494 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM3) != 0; | ||
495 | +} | ||
496 | + | ||
497 | +static inline bool isar_feature_aa64_sm4(const ARMISARegisters *id) | ||
498 | +{ | ||
499 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM4) != 0; | ||
500 | +} | ||
501 | + | ||
502 | +static inline bool isar_feature_aa64_dp(const ARMISARegisters *id) | ||
503 | +{ | ||
504 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, DP) != 0; | ||
505 | +} | ||
506 | + | ||
507 | +static inline bool isar_feature_aa64_fhm(const ARMISARegisters *id) | ||
508 | +{ | ||
509 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, FHM) != 0; | ||
510 | +} | ||
511 | + | ||
512 | +static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | ||
513 | +{ | ||
514 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | ||
515 | +} | ||
516 | + | ||
517 | +static inline bool isar_feature_aa64_condm_5(const ARMISARegisters *id) | ||
518 | +{ | ||
519 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) >= 2; | ||
520 | +} | ||
521 | + | ||
522 | +static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) | ||
523 | +{ | ||
524 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; | ||
525 | +} | ||
526 | + | ||
527 | +static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | ||
528 | +{ | ||
529 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | ||
530 | +} | ||
531 | + | ||
532 | +static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id) | ||
533 | +{ | ||
534 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0; | ||
535 | +} | ||
536 | + | ||
537 | +/* | ||
538 | + * These are the values from APA/API/APA3. | ||
539 | + * In general these must be compared '>=', per the normal Arm ARM | ||
540 | + * treatment of fields in ID registers. | ||
541 | + */ | ||
542 | +typedef enum { | ||
543 | + PauthFeat_None = 0, | ||
544 | + PauthFeat_1 = 1, | ||
545 | + PauthFeat_EPAC = 2, | ||
546 | + PauthFeat_2 = 3, | ||
547 | + PauthFeat_FPAC = 4, | ||
548 | + PauthFeat_FPACCOMBINED = 5, | ||
549 | +} ARMPauthFeature; | ||
550 | + | ||
551 | +static inline ARMPauthFeature | ||
552 | +isar_feature_pauth_feature(const ARMISARegisters *id) | ||
553 | +{ | ||
554 | + /* | ||
555 | + * Architecturally, only one of {APA,API,APA3} may be active (non-zero) | ||
556 | + * and the other two must be zero. Thus we may avoid conditionals. | ||
557 | + */ | ||
558 | + return (FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) | | ||
559 | + FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API) | | ||
560 | + FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3)); | ||
561 | +} | ||
562 | + | ||
563 | +static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) | ||
564 | +{ | ||
565 | + /* | ||
566 | + * Return true if any form of pauth is enabled, as this | ||
567 | + * predicate controls migration of the 128-bit keys. | ||
568 | + */ | ||
569 | + return isar_feature_pauth_feature(id) != PauthFeat_None; | ||
570 | +} | ||
571 | + | ||
572 | +static inline bool isar_feature_aa64_pauth_qarma5(const ARMISARegisters *id) | ||
573 | +{ | ||
574 | + /* | ||
575 | + * Return true if pauth is enabled with the architected QARMA5 algorithm. | ||
576 | + * QEMU will always enable or disable both APA and GPA. | ||
577 | + */ | ||
578 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) != 0; | ||
579 | +} | ||
580 | + | ||
581 | +static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) | ||
582 | +{ | ||
583 | + /* | ||
584 | + * Return true if pauth is enabled with the architected QARMA3 algorithm. | ||
585 | + * QEMU will always enable or disable both APA3 and GPA3. | ||
586 | + */ | ||
587 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; | ||
588 | +} | ||
589 | + | ||
590 | +static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) | ||
591 | +{ | ||
592 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
593 | +} | ||
594 | + | ||
595 | +static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
596 | +{ | ||
597 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
598 | +} | ||
599 | + | ||
600 | +static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
601 | +{ | ||
602 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
603 | +} | ||
604 | + | ||
605 | +static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | ||
606 | +{ | ||
607 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | ||
608 | +} | ||
609 | + | ||
610 | +static inline bool isar_feature_aa64_frint(const ARMISARegisters *id) | ||
611 | +{ | ||
612 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FRINTTS) != 0; | ||
613 | +} | ||
614 | + | ||
615 | +static inline bool isar_feature_aa64_dcpop(const ARMISARegisters *id) | ||
616 | +{ | ||
617 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) != 0; | ||
618 | +} | ||
619 | + | ||
620 | +static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id) | ||
621 | +{ | ||
622 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2; | ||
623 | +} | ||
624 | + | ||
625 | +static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
626 | +{ | ||
627 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
628 | +} | ||
629 | + | ||
630 | +static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) | ||
631 | +{ | ||
632 | + /* We always set the AdvSIMD and FP fields identically. */ | ||
633 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf; | ||
634 | +} | ||
635 | + | ||
636 | +static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | ||
637 | +{ | ||
638 | + /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
639 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; | ||
640 | +} | ||
641 | + | ||
642 | +static inline bool isar_feature_aa64_aa32(const ARMISARegisters *id) | ||
643 | +{ | ||
644 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL0) >= 2; | ||
645 | +} | ||
646 | + | ||
647 | +static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id) | ||
648 | +{ | ||
649 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2; | ||
650 | +} | ||
651 | + | ||
652 | +static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id) | ||
653 | +{ | ||
654 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >= 2; | ||
655 | +} | ||
656 | + | ||
657 | +static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) | ||
658 | +{ | ||
659 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0; | ||
660 | +} | ||
661 | + | ||
662 | +static inline bool isar_feature_aa64_doublefault(const ARMISARegisters *id) | ||
663 | +{ | ||
664 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) >= 2; | ||
665 | +} | ||
666 | + | ||
667 | +static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | ||
668 | +{ | ||
669 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | ||
670 | +} | ||
671 | + | ||
672 | +static inline bool isar_feature_aa64_sel2(const ARMISARegisters *id) | ||
673 | +{ | ||
674 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SEL2) != 0; | ||
675 | +} | ||
676 | + | ||
677 | +static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) | ||
678 | +{ | ||
679 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; | ||
680 | +} | ||
681 | + | ||
682 | +static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
683 | +{ | ||
684 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
685 | +} | ||
686 | + | ||
687 | +static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | ||
688 | +{ | ||
689 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | ||
690 | +} | ||
691 | + | ||
692 | +static inline bool isar_feature_aa64_pan(const ARMISARegisters *id) | ||
693 | +{ | ||
694 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) != 0; | ||
695 | +} | ||
696 | + | ||
697 | +static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | ||
698 | +{ | ||
699 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | ||
700 | +} | ||
701 | + | ||
702 | +static inline bool isar_feature_aa64_pan3(const ARMISARegisters *id) | ||
703 | +{ | ||
704 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 3; | ||
705 | +} | ||
706 | + | ||
707 | +static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) | ||
708 | +{ | ||
709 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0; | ||
710 | +} | ||
711 | + | ||
712 | +static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) | ||
713 | +{ | ||
714 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; | ||
715 | +} | ||
716 | + | ||
717 | +static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | ||
718 | +{ | ||
719 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | ||
720 | +} | ||
721 | + | ||
722 | +static inline bool isar_feature_aa64_st(const ARMISARegisters *id) | ||
723 | +{ | ||
724 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) != 0; | ||
725 | +} | ||
726 | + | ||
727 | +static inline bool isar_feature_aa64_lse2(const ARMISARegisters *id) | ||
728 | +{ | ||
729 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, AT) != 0; | ||
730 | +} | ||
731 | + | ||
732 | +static inline bool isar_feature_aa64_fwb(const ARMISARegisters *id) | ||
733 | +{ | ||
734 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, FWB) != 0; | ||
735 | +} | ||
736 | + | ||
737 | +static inline bool isar_feature_aa64_ids(const ARMISARegisters *id) | ||
738 | +{ | ||
739 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, IDS) != 0; | ||
740 | +} | ||
741 | + | ||
742 | +static inline bool isar_feature_aa64_half_evt(const ARMISARegisters *id) | ||
743 | +{ | ||
744 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 1; | ||
745 | +} | ||
746 | + | ||
747 | +static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) | ||
748 | +{ | ||
749 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; | ||
750 | +} | ||
751 | + | ||
752 | +static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
753 | +{ | ||
754 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
755 | +} | ||
756 | + | ||
757 | +static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
758 | +{ | ||
759 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
760 | +} | ||
761 | + | ||
762 | +static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
763 | +{ | ||
764 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
765 | +} | ||
766 | + | ||
767 | +static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
768 | +{ | ||
769 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
770 | +} | ||
771 | + | ||
772 | +static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
773 | +{ | ||
774 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && | ||
775 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
776 | +} | ||
777 | + | ||
778 | +static inline bool isar_feature_aa64_pmuv3p4(const ARMISARegisters *id) | ||
779 | +{ | ||
780 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && | ||
781 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
782 | +} | ||
783 | + | ||
784 | +static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
785 | +{ | ||
786 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 6 && | ||
787 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
788 | +} | ||
789 | + | ||
790 | +static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
791 | +{ | ||
792 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
793 | +} | ||
794 | + | ||
795 | +static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
796 | +{ | ||
797 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
798 | +} | ||
799 | + | ||
800 | +static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) | ||
801 | +{ | ||
802 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
803 | +} | ||
804 | + | ||
805 | +static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
806 | +{ | ||
807 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
808 | +} | ||
809 | + | ||
810 | +static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
811 | +{ | ||
812 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
813 | +} | ||
814 | + | ||
815 | +static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
816 | +{ | ||
817 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
818 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
819 | +} | ||
820 | + | ||
821 | +static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
822 | +{ | ||
823 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
824 | +} | ||
825 | + | ||
826 | +static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
827 | +{ | ||
828 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
829 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
830 | +} | ||
831 | + | ||
832 | +static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
833 | +{ | ||
834 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
835 | +} | ||
836 | + | ||
837 | +static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
838 | +{ | ||
839 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
840 | +} | ||
841 | + | ||
842 | +static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
843 | +{ | ||
844 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
845 | +} | ||
846 | + | ||
847 | +static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
848 | +{ | ||
849 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
850 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
851 | +} | ||
852 | + | ||
853 | +static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
854 | +{ | ||
855 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
856 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
857 | +} | ||
858 | + | ||
859 | +static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
860 | +{ | ||
861 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
862 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
863 | +} | ||
864 | + | ||
865 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
866 | +{ | ||
867 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
868 | +} | ||
869 | + | ||
870 | +static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
871 | +{ | ||
872 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
873 | +} | ||
874 | + | ||
875 | +static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
876 | +{ | ||
877 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
878 | +} | ||
879 | + | ||
880 | +static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
881 | +{ | ||
882 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
883 | +} | ||
884 | + | ||
885 | +static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
886 | +{ | ||
887 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
888 | +} | ||
889 | + | ||
890 | +static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
891 | +{ | ||
892 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
893 | +} | ||
894 | + | ||
895 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
896 | +{ | ||
897 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
898 | +} | ||
899 | + | ||
900 | +static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
901 | +{ | ||
902 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
903 | +} | ||
904 | + | ||
58 | +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) | 905 | +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) |
59 | +{ | 906 | +{ |
60 | + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); | 907 | + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); |
61 | + if (key >= 2) { | 908 | + if (key >= 2) { |
62 | + return true; /* FEAT_CSV2_2 */ | 909 | + return true; /* FEAT_CSV2_2 */ |
... | ... | ||
66 | + return key >= 2; /* FEAT_CSV2_1p2 */ | 913 | + return key >= 2; /* FEAT_CSV2_1p2 */ |
67 | + } | 914 | + } |
68 | + return false; | 915 | + return false; |
69 | +} | 916 | +} |
70 | + | 917 | + |
71 | static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) | 918 | +static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) |
72 | { | 919 | +{ |
73 | return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; | 920 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; |
921 | +} | ||
922 | + | ||
923 | +static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) | ||
924 | +{ | ||
925 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; | ||
926 | +} | ||
927 | + | ||
928 | +static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) | ||
929 | +{ | ||
930 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; | ||
931 | +} | ||
932 | + | ||
933 | +static inline bool isar_feature_aa64_sve2_aes(const ARMISARegisters *id) | ||
934 | +{ | ||
935 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) != 0; | ||
936 | +} | ||
937 | + | ||
938 | +static inline bool isar_feature_aa64_sve2_pmull128(const ARMISARegisters *id) | ||
939 | +{ | ||
940 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) >= 2; | ||
941 | +} | ||
942 | + | ||
943 | +static inline bool isar_feature_aa64_sve2_bitperm(const ARMISARegisters *id) | ||
944 | +{ | ||
945 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BITPERM) != 0; | ||
946 | +} | ||
947 | + | ||
948 | +static inline bool isar_feature_aa64_sve_bf16(const ARMISARegisters *id) | ||
949 | +{ | ||
950 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BFLOAT16) != 0; | ||
951 | +} | ||
952 | + | ||
953 | +static inline bool isar_feature_aa64_sve2_sha3(const ARMISARegisters *id) | ||
954 | +{ | ||
955 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SHA3) != 0; | ||
956 | +} | ||
957 | + | ||
958 | +static inline bool isar_feature_aa64_sve2_sm4(const ARMISARegisters *id) | ||
959 | +{ | ||
960 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; | ||
961 | +} | ||
962 | + | ||
963 | +static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id) | ||
964 | +{ | ||
965 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, I8MM) != 0; | ||
966 | +} | ||
967 | + | ||
968 | +static inline bool isar_feature_aa64_sve_f32mm(const ARMISARegisters *id) | ||
969 | +{ | ||
970 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F32MM) != 0; | ||
971 | +} | ||
972 | + | ||
973 | +static inline bool isar_feature_aa64_sve_f64mm(const ARMISARegisters *id) | ||
974 | +{ | ||
975 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F64MM) != 0; | ||
976 | +} | ||
977 | + | ||
978 | +static inline bool isar_feature_aa64_sme_f64f64(const ARMISARegisters *id) | ||
979 | +{ | ||
980 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, F64F64); | ||
981 | +} | ||
982 | + | ||
983 | +static inline bool isar_feature_aa64_sme_i16i64(const ARMISARegisters *id) | ||
984 | +{ | ||
985 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, I16I64) == 0xf; | ||
986 | +} | ||
987 | + | ||
988 | +static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) | ||
989 | +{ | ||
990 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | ||
991 | +} | ||
992 | + | ||
993 | +static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
994 | +{ | ||
995 | + return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
996 | +} | ||
997 | + | ||
998 | +static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | ||
999 | +{ | ||
1000 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
1001 | +} | ||
1002 | + | ||
1003 | +/* | ||
1004 | + * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
1005 | + */ | ||
1006 | +static inline bool isar_feature_any_fp16(const ARMISARegisters *id) | ||
1007 | +{ | ||
1008 | + return isar_feature_aa64_fp16(id) || isar_feature_aa32_fp16_arith(id); | ||
1009 | +} | ||
1010 | + | ||
1011 | +static inline bool isar_feature_any_predinv(const ARMISARegisters *id) | ||
1012 | +{ | ||
1013 | + return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id); | ||
1014 | +} | ||
1015 | + | ||
1016 | +static inline bool isar_feature_any_pmuv3p1(const ARMISARegisters *id) | ||
1017 | +{ | ||
1018 | + return isar_feature_aa64_pmuv3p1(id) || isar_feature_aa32_pmuv3p1(id); | ||
1019 | +} | ||
1020 | + | ||
1021 | +static inline bool isar_feature_any_pmuv3p4(const ARMISARegisters *id) | ||
1022 | +{ | ||
1023 | + return isar_feature_aa64_pmuv3p4(id) || isar_feature_aa32_pmuv3p4(id); | ||
1024 | +} | ||
1025 | + | ||
1026 | +static inline bool isar_feature_any_pmuv3p5(const ARMISARegisters *id) | ||
1027 | +{ | ||
1028 | + return isar_feature_aa64_pmuv3p5(id) || isar_feature_aa32_pmuv3p5(id); | ||
1029 | +} | ||
1030 | + | ||
1031 | +static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
1032 | +{ | ||
1033 | + return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
1034 | +} | ||
1035 | + | ||
1036 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | ||
1037 | +{ | ||
1038 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | ||
1039 | +} | ||
1040 | + | ||
1041 | +static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) | ||
1042 | +{ | ||
1043 | + return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); | ||
1044 | +} | ||
1045 | + | ||
1046 | +static inline bool isar_feature_any_ras(const ARMISARegisters *id) | ||
1047 | +{ | ||
1048 | + return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id); | ||
1049 | +} | ||
1050 | + | ||
1051 | +static inline bool isar_feature_any_half_evt(const ARMISARegisters *id) | ||
1052 | +{ | ||
1053 | + return isar_feature_aa64_half_evt(id) || isar_feature_aa32_half_evt(id); | ||
1054 | +} | ||
1055 | + | ||
1056 | +static inline bool isar_feature_any_evt(const ARMISARegisters *id) | ||
1057 | +{ | ||
1058 | + return isar_feature_aa64_evt(id) || isar_feature_aa32_evt(id); | ||
1059 | +} | ||
1060 | + | ||
1061 | +/* | ||
1062 | + * Forward to the above feature tests given an ARMCPU pointer. | ||
1063 | + */ | ||
1064 | +#define cpu_isar_feature(name, cpu) \ | ||
1065 | + ({ ARMCPU *cpu_ = (cpu); isar_feature_##name(&cpu_->isar); }) | ||
1066 | + | ||
1067 | +#endif | ||
1068 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
1069 | index XXXXXXX..XXXXXXX 100644 | ||
1070 | --- a/target/arm/cpu.h | ||
1071 | +++ b/target/arm/cpu.h | ||
1072 | @@ -XXX,XX +XXX,XX @@ static inline target_ulong cpu_untagged_addr(CPUState *cs, target_ulong x) | ||
1073 | } | ||
1074 | #endif | ||
1075 | |||
1076 | -/* | ||
1077 | - * Naming convention for isar_feature functions: | ||
1078 | - * Functions which test 32-bit ID registers should have _aa32_ in | ||
1079 | - * their name. Functions which test 64-bit ID registers should have | ||
1080 | - * _aa64_ in their name. These must only be used in code where we | ||
1081 | - * know for certain that the CPU has AArch32 or AArch64 respectively | ||
1082 | - * or where the correct answer for a CPU which doesn't implement that | ||
1083 | - * CPU state is "false" (eg when generating A32 or A64 code, if adding | ||
1084 | - * system registers that are specific to that CPU state, for "should | ||
1085 | - * we let this system register bit be set" tests where the 32-bit | ||
1086 | - * flavour of the register doesn't have the bit, and so on). | ||
1087 | - * Functions which simply ask "does this feature exist at all" have | ||
1088 | - * _any_ in their name, and always return the logical OR of the _aa64_ | ||
1089 | - * and the _aa32_ function. | ||
1090 | - */ | ||
1091 | - | ||
1092 | -/* | ||
1093 | - * 32-bit feature tests via id registers. | ||
1094 | - */ | ||
1095 | -static inline bool isar_feature_aa32_thumb_div(const ARMISARegisters *id) | ||
1096 | -{ | ||
1097 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0; | ||
1098 | -} | ||
1099 | - | ||
1100 | -static inline bool isar_feature_aa32_arm_div(const ARMISARegisters *id) | ||
1101 | -{ | ||
1102 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; | ||
1103 | -} | ||
1104 | - | ||
1105 | -static inline bool isar_feature_aa32_lob(const ARMISARegisters *id) | ||
1106 | -{ | ||
1107 | - /* (M-profile) low-overhead loops and branch future */ | ||
1108 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, CMPBRANCH) >= 3; | ||
1109 | -} | ||
1110 | - | ||
1111 | -static inline bool isar_feature_aa32_jazelle(const ARMISARegisters *id) | ||
1112 | -{ | ||
1113 | - return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) != 0; | ||
1114 | -} | ||
1115 | - | ||
1116 | -static inline bool isar_feature_aa32_aes(const ARMISARegisters *id) | ||
1117 | -{ | ||
1118 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) != 0; | ||
1119 | -} | ||
1120 | - | ||
1121 | -static inline bool isar_feature_aa32_pmull(const ARMISARegisters *id) | ||
1122 | -{ | ||
1123 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) > 1; | ||
1124 | -} | ||
1125 | - | ||
1126 | -static inline bool isar_feature_aa32_sha1(const ARMISARegisters *id) | ||
1127 | -{ | ||
1128 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA1) != 0; | ||
1129 | -} | ||
1130 | - | ||
1131 | -static inline bool isar_feature_aa32_sha2(const ARMISARegisters *id) | ||
1132 | -{ | ||
1133 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA2) != 0; | ||
1134 | -} | ||
1135 | - | ||
1136 | -static inline bool isar_feature_aa32_crc32(const ARMISARegisters *id) | ||
1137 | -{ | ||
1138 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, CRC32) != 0; | ||
1139 | -} | ||
1140 | - | ||
1141 | -static inline bool isar_feature_aa32_rdm(const ARMISARegisters *id) | ||
1142 | -{ | ||
1143 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, RDM) != 0; | ||
1144 | -} | ||
1145 | - | ||
1146 | -static inline bool isar_feature_aa32_vcma(const ARMISARegisters *id) | ||
1147 | -{ | ||
1148 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, VCMA) != 0; | ||
1149 | -} | ||
1150 | - | ||
1151 | -static inline bool isar_feature_aa32_jscvt(const ARMISARegisters *id) | ||
1152 | -{ | ||
1153 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, JSCVT) != 0; | ||
1154 | -} | ||
1155 | - | ||
1156 | -static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) | ||
1157 | -{ | ||
1158 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; | ||
1159 | -} | ||
1160 | - | ||
1161 | -static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) | ||
1162 | -{ | ||
1163 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; | ||
1164 | -} | ||
1165 | - | ||
1166 | -static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | ||
1167 | -{ | ||
1168 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | ||
1169 | -} | ||
1170 | - | ||
1171 | -static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id) | ||
1172 | -{ | ||
1173 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0; | ||
1174 | -} | ||
1175 | - | ||
1176 | -static inline bool isar_feature_aa32_bf16(const ARMISARegisters *id) | ||
1177 | -{ | ||
1178 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, BF16) != 0; | ||
1179 | -} | ||
1180 | - | ||
1181 | -static inline bool isar_feature_aa32_i8mm(const ARMISARegisters *id) | ||
1182 | -{ | ||
1183 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, I8MM) != 0; | ||
1184 | -} | ||
1185 | - | ||
1186 | -static inline bool isar_feature_aa32_ras(const ARMISARegisters *id) | ||
1187 | -{ | ||
1188 | - return FIELD_EX32(id->id_pfr0, ID_PFR0, RAS) != 0; | ||
1189 | -} | ||
1190 | - | ||
1191 | -static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id) | ||
1192 | -{ | ||
1193 | - return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0; | ||
1194 | -} | ||
1195 | - | ||
1196 | -static inline bool isar_feature_aa32_m_sec_state(const ARMISARegisters *id) | ||
1197 | -{ | ||
1198 | - /* | ||
1199 | - * Return true if M-profile state handling insns | ||
1200 | - * (VSCCLRM, CLRM, FPCTX access insns) are implemented | ||
1201 | - */ | ||
1202 | - return FIELD_EX32(id->id_pfr1, ID_PFR1, SECURITY) >= 3; | ||
1203 | -} | ||
1204 | - | ||
1205 | -static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
1206 | -{ | ||
1207 | - /* Sadly this is encoded differently for A-profile and M-profile */ | ||
1208 | - if (isar_feature_aa32_mprofile(id)) { | ||
1209 | - return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0; | ||
1210 | - } else { | ||
1211 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3; | ||
1212 | - } | ||
1213 | -} | ||
1214 | - | ||
1215 | -static inline bool isar_feature_aa32_mve(const ARMISARegisters *id) | ||
1216 | -{ | ||
1217 | - /* | ||
1218 | - * Return true if MVE is supported (either integer or floating point). | ||
1219 | - * We must check for M-profile as the MVFR1 field means something | ||
1220 | - * else for A-profile. | ||
1221 | - */ | ||
1222 | - return isar_feature_aa32_mprofile(id) && | ||
1223 | - FIELD_EX32(id->mvfr1, MVFR1, MVE) > 0; | ||
1224 | -} | ||
1225 | - | ||
1226 | -static inline bool isar_feature_aa32_mve_fp(const ARMISARegisters *id) | ||
1227 | -{ | ||
1228 | - /* | ||
1229 | - * Return true if MVE is supported (either integer or floating point). | ||
1230 | - * We must check for M-profile as the MVFR1 field means something | ||
1231 | - * else for A-profile. | ||
1232 | - */ | ||
1233 | - return isar_feature_aa32_mprofile(id) && | ||
1234 | - FIELD_EX32(id->mvfr1, MVFR1, MVE) >= 2; | ||
1235 | -} | ||
1236 | - | ||
1237 | -static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id) | ||
1238 | -{ | ||
1239 | - /* | ||
1240 | - * Return true if either VFP or SIMD is implemented. | ||
1241 | - * In this case, a minimum of VFP w/ D0-D15. | ||
1242 | - */ | ||
1243 | - return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0; | ||
1244 | -} | ||
1245 | - | ||
1246 | -static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id) | ||
1247 | -{ | ||
1248 | - /* Return true if D16-D31 are implemented */ | ||
1249 | - return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) >= 2; | ||
1250 | -} | ||
1251 | - | ||
1252 | -static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) | ||
1253 | -{ | ||
1254 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; | ||
1255 | -} | ||
1256 | - | ||
1257 | -static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id) | ||
1258 | -{ | ||
1259 | - /* Return true if CPU supports single precision floating point, VFPv2 */ | ||
1260 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0; | ||
1261 | -} | ||
1262 | - | ||
1263 | -static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id) | ||
1264 | -{ | ||
1265 | - /* Return true if CPU supports single precision floating point, VFPv3 */ | ||
1266 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2; | ||
1267 | -} | ||
1268 | - | ||
1269 | -static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) | ||
1270 | -{ | ||
1271 | - /* Return true if CPU supports double precision floating point, VFPv2 */ | ||
1272 | - return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; | ||
1273 | -} | ||
1274 | - | ||
1275 | -static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) | ||
1276 | -{ | ||
1277 | - /* Return true if CPU supports double precision floating point, VFPv3 */ | ||
1278 | - return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; | ||
1279 | -} | ||
1280 | - | ||
1281 | -static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id) | ||
1282 | -{ | ||
1283 | - return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id); | ||
1284 | -} | ||
1285 | - | ||
1286 | -/* | ||
1287 | - * We always set the FP and SIMD FP16 fields to indicate identical | ||
1288 | - * levels of support (assuming SIMD is implemented at all), so | ||
1289 | - * we only need one set of accessors. | ||
1290 | - */ | ||
1291 | -static inline bool isar_feature_aa32_fp16_spconv(const ARMISARegisters *id) | ||
1292 | -{ | ||
1293 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 0; | ||
1294 | -} | ||
1295 | - | ||
1296 | -static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) | ||
1297 | -{ | ||
1298 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; | ||
1299 | -} | ||
1300 | - | ||
1301 | -/* | ||
1302 | - * Note that this ID register field covers both VFP and Neon FMAC, | ||
1303 | - * so should usually be tested in combination with some other | ||
1304 | - * check that confirms the presence of whichever of VFP or Neon is | ||
1305 | - * relevant, to avoid accidentally enabling a Neon feature on | ||
1306 | - * a VFP-no-Neon core or vice-versa. | ||
1307 | - */ | ||
1308 | -static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) | ||
1309 | -{ | ||
1310 | - return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; | ||
1311 | -} | ||
1312 | - | ||
1313 | -static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) | ||
1314 | -{ | ||
1315 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; | ||
1316 | -} | ||
1317 | - | ||
1318 | -static inline bool isar_feature_aa32_vcvt_dr(const ARMISARegisters *id) | ||
1319 | -{ | ||
1320 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 2; | ||
1321 | -} | ||
1322 | - | ||
1323 | -static inline bool isar_feature_aa32_vrint(const ARMISARegisters *id) | ||
1324 | -{ | ||
1325 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 3; | ||
1326 | -} | ||
1327 | - | ||
1328 | -static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) | ||
1329 | -{ | ||
1330 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 4; | ||
1331 | -} | ||
1332 | - | ||
1333 | -static inline bool isar_feature_aa32_pxn(const ARMISARegisters *id) | ||
1334 | -{ | ||
1335 | - return FIELD_EX32(id->id_mmfr0, ID_MMFR0, VMSA) >= 4; | ||
1336 | -} | ||
1337 | - | ||
1338 | -static inline bool isar_feature_aa32_pan(const ARMISARegisters *id) | ||
1339 | -{ | ||
1340 | - return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) != 0; | ||
1341 | -} | ||
1342 | - | ||
1343 | -static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id) | ||
1344 | -{ | ||
1345 | - return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) >= 2; | ||
1346 | -} | ||
1347 | - | ||
1348 | -static inline bool isar_feature_aa32_pmuv3p1(const ARMISARegisters *id) | ||
1349 | -{ | ||
1350 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1351 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 4 && | ||
1352 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1353 | -} | ||
1354 | - | ||
1355 | -static inline bool isar_feature_aa32_pmuv3p4(const ARMISARegisters *id) | ||
1356 | -{ | ||
1357 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1358 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 5 && | ||
1359 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1360 | -} | ||
1361 | - | ||
1362 | -static inline bool isar_feature_aa32_pmuv3p5(const ARMISARegisters *id) | ||
1363 | -{ | ||
1364 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1365 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 6 && | ||
1366 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1367 | -} | ||
1368 | - | ||
1369 | -static inline bool isar_feature_aa32_hpd(const ARMISARegisters *id) | ||
1370 | -{ | ||
1371 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, HPDS) != 0; | ||
1372 | -} | ||
1373 | - | ||
1374 | -static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id) | ||
1375 | -{ | ||
1376 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0; | ||
1377 | -} | ||
1378 | - | ||
1379 | -static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | ||
1380 | -{ | ||
1381 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | ||
1382 | -} | ||
1383 | - | ||
1384 | -static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | ||
1385 | -{ | ||
1386 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | ||
1387 | -} | ||
1388 | - | ||
1389 | -static inline bool isar_feature_aa32_half_evt(const ARMISARegisters *id) | ||
1390 | -{ | ||
1391 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 1; | ||
1392 | -} | ||
1393 | - | ||
1394 | -static inline bool isar_feature_aa32_evt(const ARMISARegisters *id) | ||
1395 | -{ | ||
1396 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 2; | ||
1397 | -} | ||
1398 | - | ||
1399 | -static inline bool isar_feature_aa32_dit(const ARMISARegisters *id) | ||
1400 | -{ | ||
1401 | - return FIELD_EX32(id->id_pfr0, ID_PFR0, DIT) != 0; | ||
1402 | -} | ||
1403 | - | ||
1404 | -static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id) | ||
1405 | -{ | ||
1406 | - return FIELD_EX32(id->id_pfr2, ID_PFR2, SSBS) != 0; | ||
1407 | -} | ||
1408 | - | ||
1409 | -static inline bool isar_feature_aa32_debugv7p1(const ARMISARegisters *id) | ||
1410 | -{ | ||
1411 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 5; | ||
1412 | -} | ||
1413 | - | ||
1414 | -static inline bool isar_feature_aa32_debugv8p2(const ARMISARegisters *id) | ||
1415 | -{ | ||
1416 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 8; | ||
1417 | -} | ||
1418 | - | ||
1419 | -static inline bool isar_feature_aa32_doublelock(const ARMISARegisters *id) | ||
1420 | -{ | ||
1421 | - return FIELD_EX32(id->dbgdevid, DBGDEVID, DOUBLELOCK) > 0; | ||
1422 | -} | ||
1423 | - | ||
1424 | -/* | ||
1425 | - * 64-bit feature tests via id registers. | ||
1426 | - */ | ||
1427 | -static inline bool isar_feature_aa64_aes(const ARMISARegisters *id) | ||
1428 | -{ | ||
1429 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) != 0; | ||
1430 | -} | ||
1431 | - | ||
1432 | -static inline bool isar_feature_aa64_pmull(const ARMISARegisters *id) | ||
1433 | -{ | ||
1434 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) > 1; | ||
1435 | -} | ||
1436 | - | ||
1437 | -static inline bool isar_feature_aa64_sha1(const ARMISARegisters *id) | ||
1438 | -{ | ||
1439 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA1) != 0; | ||
1440 | -} | ||
1441 | - | ||
1442 | -static inline bool isar_feature_aa64_sha256(const ARMISARegisters *id) | ||
1443 | -{ | ||
1444 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) != 0; | ||
1445 | -} | ||
1446 | - | ||
1447 | -static inline bool isar_feature_aa64_sha512(const ARMISARegisters *id) | ||
1448 | -{ | ||
1449 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) > 1; | ||
1450 | -} | ||
1451 | - | ||
1452 | -static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id) | ||
1453 | -{ | ||
1454 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, CRC32) != 0; | ||
1455 | -} | ||
1456 | - | ||
1457 | -static inline bool isar_feature_aa64_atomics(const ARMISARegisters *id) | ||
1458 | -{ | ||
1459 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, ATOMIC) != 0; | ||
1460 | -} | ||
1461 | - | ||
1462 | -static inline bool isar_feature_aa64_rdm(const ARMISARegisters *id) | ||
1463 | -{ | ||
1464 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RDM) != 0; | ||
1465 | -} | ||
1466 | - | ||
1467 | -static inline bool isar_feature_aa64_sha3(const ARMISARegisters *id) | ||
1468 | -{ | ||
1469 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA3) != 0; | ||
1470 | -} | ||
1471 | - | ||
1472 | -static inline bool isar_feature_aa64_sm3(const ARMISARegisters *id) | ||
1473 | -{ | ||
1474 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM3) != 0; | ||
1475 | -} | ||
1476 | - | ||
1477 | -static inline bool isar_feature_aa64_sm4(const ARMISARegisters *id) | ||
1478 | -{ | ||
1479 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM4) != 0; | ||
1480 | -} | ||
1481 | - | ||
1482 | -static inline bool isar_feature_aa64_dp(const ARMISARegisters *id) | ||
1483 | -{ | ||
1484 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, DP) != 0; | ||
1485 | -} | ||
1486 | - | ||
1487 | -static inline bool isar_feature_aa64_fhm(const ARMISARegisters *id) | ||
1488 | -{ | ||
1489 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, FHM) != 0; | ||
1490 | -} | ||
1491 | - | ||
1492 | -static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | ||
1493 | -{ | ||
1494 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | ||
1495 | -} | ||
1496 | - | ||
1497 | -static inline bool isar_feature_aa64_condm_5(const ARMISARegisters *id) | ||
1498 | -{ | ||
1499 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) >= 2; | ||
1500 | -} | ||
1501 | - | ||
1502 | -static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) | ||
1503 | -{ | ||
1504 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; | ||
1505 | -} | ||
1506 | - | ||
1507 | -static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | ||
1508 | -{ | ||
1509 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | ||
1510 | -} | ||
1511 | - | ||
1512 | -static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id) | ||
1513 | -{ | ||
1514 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0; | ||
1515 | -} | ||
1516 | - | ||
1517 | -/* | ||
1518 | - * These are the values from APA/API/APA3. | ||
1519 | - * In general these must be compared '>=', per the normal Arm ARM | ||
1520 | - * treatment of fields in ID registers. | ||
1521 | - */ | ||
1522 | -typedef enum { | ||
1523 | - PauthFeat_None = 0, | ||
1524 | - PauthFeat_1 = 1, | ||
1525 | - PauthFeat_EPAC = 2, | ||
1526 | - PauthFeat_2 = 3, | ||
1527 | - PauthFeat_FPAC = 4, | ||
1528 | - PauthFeat_FPACCOMBINED = 5, | ||
1529 | -} ARMPauthFeature; | ||
1530 | - | ||
1531 | -static inline ARMPauthFeature | ||
1532 | -isar_feature_pauth_feature(const ARMISARegisters *id) | ||
1533 | -{ | ||
1534 | - /* | ||
1535 | - * Architecturally, only one of {APA,API,APA3} may be active (non-zero) | ||
1536 | - * and the other two must be zero. Thus we may avoid conditionals. | ||
1537 | - */ | ||
1538 | - return (FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) | | ||
1539 | - FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API) | | ||
1540 | - FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3)); | ||
1541 | -} | ||
1542 | - | ||
1543 | -static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) | ||
1544 | -{ | ||
1545 | - /* | ||
1546 | - * Return true if any form of pauth is enabled, as this | ||
1547 | - * predicate controls migration of the 128-bit keys. | ||
1548 | - */ | ||
1549 | - return isar_feature_pauth_feature(id) != PauthFeat_None; | ||
1550 | -} | ||
1551 | - | ||
1552 | -static inline bool isar_feature_aa64_pauth_qarma5(const ARMISARegisters *id) | ||
1553 | -{ | ||
1554 | - /* | ||
1555 | - * Return true if pauth is enabled with the architected QARMA5 algorithm. | ||
1556 | - * QEMU will always enable or disable both APA and GPA. | ||
1557 | - */ | ||
1558 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) != 0; | ||
1559 | -} | ||
1560 | - | ||
1561 | -static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) | ||
1562 | -{ | ||
1563 | - /* | ||
1564 | - * Return true if pauth is enabled with the architected QARMA3 algorithm. | ||
1565 | - * QEMU will always enable or disable both APA3 and GPA3. | ||
1566 | - */ | ||
1567 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; | ||
1568 | -} | ||
1569 | - | ||
1570 | -static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) | ||
1571 | -{ | ||
1572 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
1573 | -} | ||
1574 | - | ||
1575 | -static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
1576 | -{ | ||
1577 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
1578 | -} | ||
1579 | - | ||
1580 | -static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
1581 | -{ | ||
1582 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
1583 | -} | ||
1584 | - | ||
1585 | -static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | ||
1586 | -{ | ||
1587 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | ||
1588 | -} | ||
1589 | - | ||
1590 | -static inline bool isar_feature_aa64_frint(const ARMISARegisters *id) | ||
1591 | -{ | ||
1592 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FRINTTS) != 0; | ||
1593 | -} | ||
1594 | - | ||
1595 | -static inline bool isar_feature_aa64_dcpop(const ARMISARegisters *id) | ||
1596 | -{ | ||
1597 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) != 0; | ||
1598 | -} | ||
1599 | - | ||
1600 | -static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id) | ||
1601 | -{ | ||
1602 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2; | ||
1603 | -} | ||
1604 | - | ||
1605 | -static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
1606 | -{ | ||
1607 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
1608 | -} | ||
1609 | - | ||
1610 | -static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) | ||
1611 | -{ | ||
1612 | - /* We always set the AdvSIMD and FP fields identically. */ | ||
1613 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf; | ||
1614 | -} | ||
1615 | - | ||
1616 | -static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | ||
1617 | -{ | ||
1618 | - /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
1619 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; | ||
1620 | -} | ||
1621 | - | ||
1622 | -static inline bool isar_feature_aa64_aa32(const ARMISARegisters *id) | ||
1623 | -{ | ||
1624 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL0) >= 2; | ||
1625 | -} | ||
1626 | - | ||
1627 | -static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id) | ||
1628 | -{ | ||
1629 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2; | ||
1630 | -} | ||
1631 | - | ||
1632 | -static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id) | ||
1633 | -{ | ||
1634 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >= 2; | ||
1635 | -} | ||
1636 | - | ||
1637 | -static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) | ||
1638 | -{ | ||
1639 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0; | ||
1640 | -} | ||
1641 | - | ||
1642 | -static inline bool isar_feature_aa64_doublefault(const ARMISARegisters *id) | ||
1643 | -{ | ||
1644 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) >= 2; | ||
1645 | -} | ||
1646 | - | ||
1647 | -static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | ||
1648 | -{ | ||
1649 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | ||
1650 | -} | ||
1651 | - | ||
1652 | -static inline bool isar_feature_aa64_sel2(const ARMISARegisters *id) | ||
1653 | -{ | ||
1654 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SEL2) != 0; | ||
1655 | -} | ||
1656 | - | ||
1657 | -static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) | ||
1658 | -{ | ||
1659 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; | ||
1660 | -} | ||
1661 | - | ||
1662 | -static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
1663 | -{ | ||
1664 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
1665 | -} | ||
1666 | - | ||
1667 | -static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | ||
1668 | -{ | ||
1669 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | ||
1670 | -} | ||
1671 | - | ||
1672 | -static inline bool isar_feature_aa64_pan(const ARMISARegisters *id) | ||
1673 | -{ | ||
1674 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) != 0; | ||
1675 | -} | ||
1676 | - | ||
1677 | -static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | ||
1678 | -{ | ||
1679 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | ||
1680 | -} | ||
1681 | - | ||
1682 | -static inline bool isar_feature_aa64_pan3(const ARMISARegisters *id) | ||
1683 | -{ | ||
1684 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 3; | ||
1685 | -} | ||
1686 | - | ||
1687 | -static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) | ||
1688 | -{ | ||
1689 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0; | ||
1690 | -} | ||
1691 | - | ||
1692 | -static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) | ||
1693 | -{ | ||
1694 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; | ||
1695 | -} | ||
1696 | - | ||
1697 | -static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | ||
1698 | -{ | ||
1699 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | ||
1700 | -} | ||
1701 | - | ||
1702 | -static inline bool isar_feature_aa64_st(const ARMISARegisters *id) | ||
1703 | -{ | ||
1704 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) != 0; | ||
1705 | -} | ||
1706 | - | ||
1707 | -static inline bool isar_feature_aa64_lse2(const ARMISARegisters *id) | ||
1708 | -{ | ||
1709 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, AT) != 0; | ||
1710 | -} | ||
1711 | - | ||
1712 | -static inline bool isar_feature_aa64_fwb(const ARMISARegisters *id) | ||
1713 | -{ | ||
1714 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, FWB) != 0; | ||
1715 | -} | ||
1716 | - | ||
1717 | -static inline bool isar_feature_aa64_ids(const ARMISARegisters *id) | ||
1718 | -{ | ||
1719 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, IDS) != 0; | ||
1720 | -} | ||
1721 | - | ||
1722 | -static inline bool isar_feature_aa64_half_evt(const ARMISARegisters *id) | ||
1723 | -{ | ||
1724 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 1; | ||
1725 | -} | ||
1726 | - | ||
1727 | -static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) | ||
1728 | -{ | ||
1729 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; | ||
1730 | -} | ||
1731 | - | ||
1732 | -static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
1733 | -{ | ||
1734 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
1735 | -} | ||
1736 | - | ||
1737 | -static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
1738 | -{ | ||
1739 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
1740 | -} | ||
1741 | - | ||
1742 | -static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
1743 | -{ | ||
1744 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
1745 | -} | ||
1746 | - | ||
1747 | -static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
1748 | -{ | ||
1749 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
1750 | -} | ||
1751 | - | ||
1752 | -static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
1753 | -{ | ||
1754 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && | ||
1755 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1756 | -} | ||
1757 | - | ||
1758 | -static inline bool isar_feature_aa64_pmuv3p4(const ARMISARegisters *id) | ||
1759 | -{ | ||
1760 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && | ||
1761 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1762 | -} | ||
1763 | - | ||
1764 | -static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
1765 | -{ | ||
1766 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 6 && | ||
1767 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1768 | -} | ||
1769 | - | ||
1770 | -static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
1771 | -{ | ||
1772 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
1773 | -} | ||
1774 | - | ||
1775 | -static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
1776 | -{ | ||
1777 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
1778 | -} | ||
1779 | - | ||
1780 | -static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) | ||
1781 | -{ | ||
1782 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
1783 | -} | ||
1784 | - | ||
1785 | -static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
1786 | -{ | ||
1787 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
1788 | -} | ||
1789 | - | ||
1790 | -static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
1791 | -{ | ||
1792 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
1793 | -} | ||
1794 | - | ||
1795 | -static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
1796 | -{ | ||
1797 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
1798 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
1799 | -} | ||
1800 | - | ||
1801 | -static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
1802 | -{ | ||
1803 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
1804 | -} | ||
1805 | - | ||
1806 | -static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
1807 | -{ | ||
1808 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
1809 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
1810 | -} | ||
1811 | - | ||
1812 | -static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
1813 | -{ | ||
1814 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
1815 | -} | ||
1816 | - | ||
1817 | -static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
1818 | -{ | ||
1819 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
1820 | -} | ||
1821 | - | ||
1822 | -static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
1823 | -{ | ||
1824 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
1825 | -} | ||
1826 | - | ||
1827 | -static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
1828 | -{ | ||
1829 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
1830 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
1831 | -} | ||
1832 | - | ||
1833 | -static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
1834 | -{ | ||
1835 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
1836 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
1837 | -} | ||
1838 | - | ||
1839 | -static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
1840 | -{ | ||
1841 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
1842 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
1843 | -} | ||
1844 | - | ||
1845 | -static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
1846 | -{ | ||
1847 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
1848 | -} | ||
1849 | - | ||
1850 | -static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
1851 | -{ | ||
1852 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
1853 | -} | ||
1854 | - | ||
1855 | -static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
1856 | -{ | ||
1857 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
1858 | -} | ||
1859 | - | ||
1860 | -static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
1861 | -{ | ||
1862 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
1863 | -} | ||
1864 | - | ||
1865 | -static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
1866 | -{ | ||
1867 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
1868 | -} | ||
1869 | - | ||
1870 | -static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
1871 | -{ | ||
1872 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
1873 | -} | ||
1874 | - | ||
1875 | -static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
1876 | -{ | ||
1877 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
1878 | -} | ||
1879 | - | ||
1880 | -static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
1881 | -{ | ||
1882 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
1883 | -} | ||
1884 | - | ||
1885 | -static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) | ||
1886 | -{ | ||
1887 | - int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); | ||
1888 | - if (key >= 2) { | ||
1889 | - return true; /* FEAT_CSV2_2 */ | ||
1890 | - } | ||
1891 | - if (key == 1) { | ||
1892 | - key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); | ||
1893 | - return key >= 2; /* FEAT_CSV2_1p2 */ | ||
1894 | - } | ||
1895 | - return false; | ||
1896 | -} | ||
1897 | - | ||
1898 | -static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) | ||
1899 | -{ | ||
1900 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; | ||
1901 | -} | ||
1902 | - | ||
1903 | -static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) | ||
1904 | -{ | ||
1905 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; | ||
1906 | -} | ||
1907 | - | ||
1908 | -static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) | ||
1909 | -{ | ||
1910 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; | ||
1911 | -} | ||
1912 | - | ||
1913 | -static inline bool isar_feature_aa64_sve2_aes(const ARMISARegisters *id) | ||
1914 | -{ | ||
1915 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) != 0; | ||
1916 | -} | ||
1917 | - | ||
1918 | -static inline bool isar_feature_aa64_sve2_pmull128(const ARMISARegisters *id) | ||
1919 | -{ | ||
1920 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) >= 2; | ||
1921 | -} | ||
1922 | - | ||
1923 | -static inline bool isar_feature_aa64_sve2_bitperm(const ARMISARegisters *id) | ||
1924 | -{ | ||
1925 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BITPERM) != 0; | ||
1926 | -} | ||
1927 | - | ||
1928 | -static inline bool isar_feature_aa64_sve_bf16(const ARMISARegisters *id) | ||
1929 | -{ | ||
1930 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BFLOAT16) != 0; | ||
1931 | -} | ||
1932 | - | ||
1933 | -static inline bool isar_feature_aa64_sve2_sha3(const ARMISARegisters *id) | ||
1934 | -{ | ||
1935 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SHA3) != 0; | ||
1936 | -} | ||
1937 | - | ||
1938 | -static inline bool isar_feature_aa64_sve2_sm4(const ARMISARegisters *id) | ||
1939 | -{ | ||
1940 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; | ||
1941 | -} | ||
1942 | - | ||
1943 | -static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id) | ||
1944 | -{ | ||
1945 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, I8MM) != 0; | ||
1946 | -} | ||
1947 | - | ||
1948 | -static inline bool isar_feature_aa64_sve_f32mm(const ARMISARegisters *id) | ||
1949 | -{ | ||
1950 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F32MM) != 0; | ||
1951 | -} | ||
1952 | - | ||
1953 | -static inline bool isar_feature_aa64_sve_f64mm(const ARMISARegisters *id) | ||
1954 | -{ | ||
1955 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F64MM) != 0; | ||
1956 | -} | ||
1957 | - | ||
1958 | -static inline bool isar_feature_aa64_sme_f64f64(const ARMISARegisters *id) | ||
1959 | -{ | ||
1960 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, F64F64); | ||
1961 | -} | ||
1962 | - | ||
1963 | -static inline bool isar_feature_aa64_sme_i16i64(const ARMISARegisters *id) | ||
1964 | -{ | ||
1965 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, I16I64) == 0xf; | ||
1966 | -} | ||
1967 | - | ||
1968 | -static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) | ||
1969 | -{ | ||
1970 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | ||
1971 | -} | ||
1972 | - | ||
1973 | -static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
1974 | -{ | ||
1975 | - return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
1976 | -} | ||
1977 | - | ||
1978 | -static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | ||
1979 | -{ | ||
1980 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
1981 | -} | ||
1982 | - | ||
1983 | -/* | ||
1984 | - * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
1985 | - */ | ||
1986 | -static inline bool isar_feature_any_fp16(const ARMISARegisters *id) | ||
1987 | -{ | ||
1988 | - return isar_feature_aa64_fp16(id) || isar_feature_aa32_fp16_arith(id); | ||
1989 | -} | ||
1990 | - | ||
1991 | -static inline bool isar_feature_any_predinv(const ARMISARegisters *id) | ||
1992 | -{ | ||
1993 | - return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id); | ||
1994 | -} | ||
1995 | - | ||
1996 | -static inline bool isar_feature_any_pmuv3p1(const ARMISARegisters *id) | ||
1997 | -{ | ||
1998 | - return isar_feature_aa64_pmuv3p1(id) || isar_feature_aa32_pmuv3p1(id); | ||
1999 | -} | ||
2000 | - | ||
2001 | -static inline bool isar_feature_any_pmuv3p4(const ARMISARegisters *id) | ||
2002 | -{ | ||
2003 | - return isar_feature_aa64_pmuv3p4(id) || isar_feature_aa32_pmuv3p4(id); | ||
2004 | -} | ||
2005 | - | ||
2006 | -static inline bool isar_feature_any_pmuv3p5(const ARMISARegisters *id) | ||
2007 | -{ | ||
2008 | - return isar_feature_aa64_pmuv3p5(id) || isar_feature_aa32_pmuv3p5(id); | ||
2009 | -} | ||
2010 | - | ||
2011 | -static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
2012 | -{ | ||
2013 | - return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
2014 | -} | ||
2015 | - | ||
2016 | -static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | ||
2017 | -{ | ||
2018 | - return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | ||
2019 | -} | ||
2020 | - | ||
2021 | -static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) | ||
2022 | -{ | ||
2023 | - return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); | ||
2024 | -} | ||
2025 | - | ||
2026 | -static inline bool isar_feature_any_ras(const ARMISARegisters *id) | ||
2027 | -{ | ||
2028 | - return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id); | ||
2029 | -} | ||
2030 | - | ||
2031 | -static inline bool isar_feature_any_half_evt(const ARMISARegisters *id) | ||
2032 | -{ | ||
2033 | - return isar_feature_aa64_half_evt(id) || isar_feature_aa32_half_evt(id); | ||
2034 | -} | ||
2035 | - | ||
2036 | -static inline bool isar_feature_any_evt(const ARMISARegisters *id) | ||
2037 | -{ | ||
2038 | - return isar_feature_aa64_evt(id) || isar_feature_aa32_evt(id); | ||
2039 | -} | ||
2040 | - | ||
2041 | -/* | ||
2042 | - * Forward to the above feature tests given an ARMCPU pointer. | ||
2043 | - */ | ||
2044 | -#define cpu_isar_feature(name, cpu) \ | ||
2045 | - ({ ARMCPU *cpu_ = (cpu); isar_feature_##name(&cpu_->isar); }) | ||
2046 | - | ||
2047 | #endif | ||
2048 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
2049 | index XXXXXXX..XXXXXXX 100644 | ||
2050 | --- a/target/arm/internals.h | ||
2051 | +++ b/target/arm/internals.h | ||
2052 | @@ -XXX,XX +XXX,XX @@ | ||
2053 | #include "hw/registerfields.h" | ||
2054 | #include "tcg/tcg-gvec-desc.h" | ||
2055 | #include "syndrome.h" | ||
2056 | +#include "cpu-features.h" | ||
2057 | |||
2058 | /* register banks for CPU modes */ | ||
2059 | #define BANK_USRSYS 0 | ||
2060 | diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h | ||
2061 | index XXXXXXX..XXXXXXX 100644 | ||
2062 | --- a/target/arm/tcg/translate.h | ||
2063 | +++ b/target/arm/tcg/translate.h | ||
2064 | @@ -XXX,XX +XXX,XX @@ | ||
2065 | #include "exec/translator.h" | ||
2066 | #include "exec/helper-gen.h" | ||
2067 | #include "internals.h" | ||
2068 | - | ||
2069 | +#include "cpu-features.h" | ||
2070 | |||
2071 | /* internal defines */ | ||
2072 | |||
2073 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | ||
2074 | index XXXXXXX..XXXXXXX 100644 | ||
2075 | --- a/hw/arm/armv7m.c | ||
2076 | +++ b/hw/arm/armv7m.c | ||
2077 | @@ -XXX,XX +XXX,XX @@ | ||
2078 | #include "qemu/module.h" | ||
2079 | #include "qemu/log.h" | ||
2080 | #include "target/arm/idau.h" | ||
2081 | +#include "target/arm/cpu-features.h" | ||
2082 | #include "migration/vmstate.h" | ||
2083 | |||
2084 | /* Bitbanded IO. Each word corresponds to a single bit. */ | ||
2085 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
2086 | index XXXXXXX..XXXXXXX 100644 | ||
2087 | --- a/hw/intc/armv7m_nvic.c | ||
2088 | +++ b/hw/intc/armv7m_nvic.c | ||
2089 | @@ -XXX,XX +XXX,XX @@ | ||
2090 | #include "sysemu/tcg.h" | ||
2091 | #include "sysemu/runstate.h" | ||
2092 | #include "target/arm/cpu.h" | ||
2093 | +#include "target/arm/cpu-features.h" | ||
2094 | #include "exec/exec-all.h" | ||
2095 | #include "exec/memop.h" | ||
2096 | #include "qemu/log.h" | ||
2097 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | ||
2098 | index XXXXXXX..XXXXXXX 100644 | ||
2099 | --- a/linux-user/aarch64/cpu_loop.c | ||
2100 | +++ b/linux-user/aarch64/cpu_loop.c | ||
2101 | @@ -XXX,XX +XXX,XX @@ | ||
2102 | #include "qemu/guest-random.h" | ||
2103 | #include "semihosting/common-semi.h" | ||
2104 | #include "target/arm/syndrome.h" | ||
2105 | +#include "target/arm/cpu-features.h" | ||
2106 | |||
2107 | #define get_user_code_u32(x, gaddr, env) \ | ||
2108 | ({ abi_long __r = get_user_u32((x), (gaddr)); \ | ||
2109 | diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c | ||
2110 | index XXXXXXX..XXXXXXX 100644 | ||
2111 | --- a/linux-user/aarch64/signal.c | ||
2112 | +++ b/linux-user/aarch64/signal.c | ||
2113 | @@ -XXX,XX +XXX,XX @@ | ||
2114 | #include "user-internals.h" | ||
2115 | #include "signal-common.h" | ||
2116 | #include "linux-user/trace.h" | ||
2117 | +#include "target/arm/cpu-features.h" | ||
2118 | |||
2119 | struct target_sigcontext { | ||
2120 | uint64_t fault_address; | ||
2121 | diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c | ||
2122 | index XXXXXXX..XXXXXXX 100644 | ||
2123 | --- a/linux-user/arm/signal.c | ||
2124 | +++ b/linux-user/arm/signal.c | ||
2125 | @@ -XXX,XX +XXX,XX @@ | ||
2126 | #include "user-internals.h" | ||
2127 | #include "signal-common.h" | ||
2128 | #include "linux-user/trace.h" | ||
2129 | +#include "target/arm/cpu-features.h" | ||
2130 | |||
2131 | struct target_sigcontext { | ||
2132 | abi_ulong trap_no; | ||
2133 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | ||
2134 | index XXXXXXX..XXXXXXX 100644 | ||
2135 | --- a/linux-user/elfload.c | ||
2136 | +++ b/linux-user/elfload.c | ||
2137 | @@ -XXX,XX +XXX,XX @@ | ||
2138 | #include "target_signal.h" | ||
2139 | #include "accel/tcg/debuginfo.h" | ||
2140 | |||
2141 | +#ifdef TARGET_ARM | ||
2142 | +#include "target/arm/cpu-features.h" | ||
2143 | +#endif | ||
2144 | + | ||
2145 | #ifdef _ARCH_PPC64 | ||
2146 | #undef ARCH_DLINFO | ||
2147 | #undef ELF_PLATFORM | ||
2148 | diff --git a/linux-user/mmap.c b/linux-user/mmap.c | ||
2149 | index XXXXXXX..XXXXXXX 100644 | ||
2150 | --- a/linux-user/mmap.c | ||
2151 | +++ b/linux-user/mmap.c | ||
2152 | @@ -XXX,XX +XXX,XX @@ | ||
2153 | #include "target_mman.h" | ||
2154 | #include "qemu/interval-tree.h" | ||
2155 | |||
2156 | +#ifdef TARGET_ARM | ||
2157 | +#include "target/arm/cpu-features.h" | ||
2158 | +#endif | ||
2159 | + | ||
2160 | static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; | ||
2161 | static __thread int mmap_lock_count; | ||
2162 | |||
2163 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c | ||
2164 | index XXXXXXX..XXXXXXX 100644 | ||
2165 | --- a/target/arm/arch_dump.c | ||
2166 | +++ b/target/arm/arch_dump.c | ||
2167 | @@ -XXX,XX +XXX,XX @@ | ||
2168 | #include "cpu.h" | ||
2169 | #include "elf.h" | ||
2170 | #include "sysemu/dump.h" | ||
2171 | +#include "cpu-features.h" | ||
2172 | |||
2173 | /* struct user_pt_regs from arch/arm64/include/uapi/asm/ptrace.h */ | ||
2174 | struct aarch64_user_regs { | ||
74 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 2175 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
75 | index XXXXXXX..XXXXXXX 100644 | 2176 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/target/arm/cpu.c | 2177 | --- a/target/arm/cpu.c |
77 | +++ b/target/arm/cpu.c | 2178 | +++ b/target/arm/cpu.c |
78 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev) | 2179 | @@ -XXX,XX +XXX,XX @@ |
79 | */ | 2180 | #include "hw/core/tcg-cpu-ops.h" |
80 | env->cp15.gcr_el1 = 0x1ffff; | 2181 | #endif /* CONFIG_TCG */ |
81 | } | 2182 | #include "internals.h" |
82 | + /* | 2183 | +#include "cpu-features.h" |
83 | + * Disable access to SCXTNUM_EL0 from CSV2_1p2. | 2184 | #include "exec/exec-all.h" |
84 | + * This is not yet exposed from the Linux kernel in any way. | 2185 | #include "hw/qdev-properties.h" |
85 | + */ | 2186 | #if !defined(CONFIG_USER_ONLY) |
86 | + env->cp15.sctlr_el[1] |= SCTLR_TSCXT; | ||
87 | #else | ||
88 | /* Reset into the highest available EL */ | ||
89 | if (arm_feature(env, ARM_FEATURE_EL3)) { | ||
90 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 2187 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
91 | index XXXXXXX..XXXXXXX 100644 | 2188 | index XXXXXXX..XXXXXXX 100644 |
92 | --- a/target/arm/cpu64.c | 2189 | --- a/target/arm/cpu64.c |
93 | +++ b/target/arm/cpu64.c | 2190 | +++ b/target/arm/cpu64.c |
94 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 2191 | @@ -XXX,XX +XXX,XX @@ |
95 | t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | 2192 | #include "qapi/visitor.h" |
96 | t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | 2193 | #include "hw/qdev-properties.h" |
97 | t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | 2194 | #include "internals.h" |
98 | - t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */ | 2195 | +#include "cpu-features.h" |
99 | + t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */ | 2196 | #include "cpregs.h" |
100 | cpu->isar.id_aa64pfr0 = t; | 2197 | |
101 | 2198 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | |
102 | t = cpu->isar.id_aa64pfr1; | 2199 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
103 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 2200 | index XXXXXXX..XXXXXXX 100644 |
104 | * we do for EL2 with the virtualization=on property. | 2201 | --- a/target/arm/debug_helper.c |
105 | */ | 2202 | +++ b/target/arm/debug_helper.c |
106 | t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ | 2203 | @@ -XXX,XX +XXX,XX @@ |
107 | + t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */ | 2204 | #include "qemu/log.h" |
108 | cpu->isar.id_aa64pfr1 = t; | 2205 | #include "cpu.h" |
109 | 2206 | #include "internals.h" | |
110 | t = cpu->isar.id_aa64mmfr0; | 2207 | +#include "cpu-features.h" |
2208 | #include "cpregs.h" | ||
2209 | #include "exec/exec-all.h" | ||
2210 | #include "exec/helper-proto.h" | ||
2211 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
2212 | index XXXXXXX..XXXXXXX 100644 | ||
2213 | --- a/target/arm/gdbstub.c | ||
2214 | +++ b/target/arm/gdbstub.c | ||
2215 | @@ -XXX,XX +XXX,XX @@ | ||
2216 | #include "gdbstub/helpers.h" | ||
2217 | #include "sysemu/tcg.h" | ||
2218 | #include "internals.h" | ||
2219 | +#include "cpu-features.h" | ||
2220 | #include "cpregs.h" | ||
2221 | |||
2222 | typedef struct RegisterSysregXmlParam { | ||
111 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 2223 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
112 | index XXXXXXX..XXXXXXX 100644 | 2224 | index XXXXXXX..XXXXXXX 100644 |
113 | --- a/target/arm/helper.c | 2225 | --- a/target/arm/helper.c |
114 | +++ b/target/arm/helper.c | 2226 | +++ b/target/arm/helper.c |
115 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 2227 | @@ -XXX,XX +XXX,XX @@ |
116 | if (cpu_isar_feature(aa64_mte, cpu)) { | 2228 | #include "trace.h" |
117 | valid_mask |= SCR_ATA; | 2229 | #include "cpu.h" |
118 | } | 2230 | #include "internals.h" |
119 | + if (cpu_isar_feature(aa64_scxtnum, cpu)) { | 2231 | +#include "cpu-features.h" |
120 | + valid_mask |= SCR_ENSCXT; | 2232 | #include "exec/helper-proto.h" |
121 | + } | 2233 | #include "qemu/main-loop.h" |
122 | } else { | 2234 | #include "qemu/timer.h" |
123 | valid_mask &= ~(SCR_RW | SCR_ST); | 2235 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
124 | if (cpu_isar_feature(aa32_ras, cpu)) { | 2236 | index XXXXXXX..XXXXXXX 100644 |
125 | @@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) | 2237 | --- a/target/arm/kvm64.c |
126 | if (cpu_isar_feature(aa64_mte, cpu)) { | 2238 | +++ b/target/arm/kvm64.c |
127 | valid_mask |= HCR_ATA | HCR_DCT | HCR_TID5; | 2239 | @@ -XXX,XX +XXX,XX @@ |
128 | } | 2240 | #include "sysemu/kvm_int.h" |
129 | + if (cpu_isar_feature(aa64_scxtnum, cpu)) { | 2241 | #include "kvm_arm.h" |
130 | + valid_mask |= HCR_ENSCXT; | 2242 | #include "internals.h" |
131 | + } | 2243 | +#include "cpu-features.h" |
132 | } | 2244 | #include "hw/acpi/acpi.h" |
133 | 2245 | #include "hw/acpi/ghes.h" | |
134 | /* Clear RES0 bits. */ | 2246 | |
135 | @@ -XXX,XX +XXX,XX @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) | 2247 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
136 | { K(3, 0, 5, 6, 0), K(3, 4, 5, 6, 0), K(3, 5, 5, 6, 0), | 2248 | index XXXXXXX..XXXXXXX 100644 |
137 | "TFSR_EL1", "TFSR_EL2", "TFSR_EL12", isar_feature_aa64_mte }, | 2249 | --- a/target/arm/machine.c |
138 | 2250 | +++ b/target/arm/machine.c | |
139 | + { K(3, 0, 13, 0, 7), K(3, 4, 13, 0, 7), K(3, 5, 13, 0, 7), | 2251 | @@ -XXX,XX +XXX,XX @@ |
140 | + "SCXTNUM_EL1", "SCXTNUM_EL2", "SCXTNUM_EL12", | 2252 | #include "sysemu/tcg.h" |
141 | + isar_feature_aa64_scxtnum }, | 2253 | #include "kvm_arm.h" |
142 | + | 2254 | #include "internals.h" |
143 | /* TODO: ARMv8.2-SPE -- PMSCR_EL2 */ | 2255 | +#include "cpu-features.h" |
144 | /* TODO: ARMv8.4-Trace -- TRFCR_EL2 */ | 2256 | #include "migration/cpu.h" |
145 | }; | 2257 | |
146 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | 2258 | static bool vfp_needed(void *opaque) |
147 | }, | 2259 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
148 | }; | 2260 | index XXXXXXX..XXXXXXX 100644 |
149 | 2261 | --- a/target/arm/ptw.c | |
150 | -#endif | 2262 | +++ b/target/arm/ptw.c |
151 | +static CPAccessResult access_scxtnum(CPUARMState *env, const ARMCPRegInfo *ri, | 2263 | @@ -XXX,XX +XXX,XX @@ |
152 | + bool isread) | 2264 | #include "exec/exec-all.h" |
153 | +{ | 2265 | #include "cpu.h" |
154 | + uint64_t hcr = arm_hcr_el2_eff(env); | 2266 | #include "internals.h" |
155 | + int el = arm_current_el(env); | 2267 | +#include "cpu-features.h" |
156 | + | 2268 | #include "idau.h" |
157 | + if (el == 0 && !((hcr & HCR_E2H) && (hcr & HCR_TGE))) { | 2269 | #ifdef CONFIG_TCG |
158 | + if (env->cp15.sctlr_el[1] & SCTLR_TSCXT) { | 2270 | # include "tcg/oversized-guest.h" |
159 | + if (hcr & HCR_TGE) { | 2271 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c |
160 | + return CP_ACCESS_TRAP_EL2; | 2272 | index XXXXXXX..XXXXXXX 100644 |
161 | + } | 2273 | --- a/target/arm/tcg/cpu64.c |
162 | + return CP_ACCESS_TRAP; | 2274 | +++ b/target/arm/tcg/cpu64.c |
163 | + } | 2275 | @@ -XXX,XX +XXX,XX @@ |
164 | + } else if (el < 2 && (env->cp15.sctlr_el[2] & SCTLR_TSCXT)) { | 2276 | #include "hw/qdev-properties.h" |
165 | + return CP_ACCESS_TRAP_EL2; | 2277 | #include "qemu/units.h" |
166 | + } | 2278 | #include "internals.h" |
167 | + if (el < 2 && arm_is_el2_enabled(env) && !(hcr & HCR_ENSCXT)) { | 2279 | +#include "cpu-features.h" |
168 | + return CP_ACCESS_TRAP_EL2; | 2280 | #include "cpregs.h" |
169 | + } | 2281 | |
170 | + if (el < 3 | 2282 | static uint64_t make_ccsidr64(unsigned assoc, unsigned linesize, |
171 | + && arm_feature(env, ARM_FEATURE_EL3) | 2283 | diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c |
172 | + && !(env->cp15.scr_el3 & SCR_ENSCXT)) { | 2284 | index XXXXXXX..XXXXXXX 100644 |
173 | + return CP_ACCESS_TRAP_EL3; | 2285 | --- a/target/arm/tcg/hflags.c |
174 | + } | 2286 | +++ b/target/arm/tcg/hflags.c |
175 | + return CP_ACCESS_OK; | 2287 | @@ -XXX,XX +XXX,XX @@ |
176 | +} | 2288 | #include "qemu/osdep.h" |
177 | + | 2289 | #include "cpu.h" |
178 | +static const ARMCPRegInfo scxtnum_reginfo[] = { | 2290 | #include "internals.h" |
179 | + { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64, | 2291 | +#include "cpu-features.h" |
180 | + .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7, | 2292 | #include "exec/helper-proto.h" |
181 | + .access = PL0_RW, .accessfn = access_scxtnum, | 2293 | #include "cpregs.h" |
182 | + .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) }, | 2294 | |
183 | + { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64, | 2295 | diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c |
184 | + .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7, | 2296 | index XXXXXXX..XXXXXXX 100644 |
185 | + .access = PL1_RW, .accessfn = access_scxtnum, | 2297 | --- a/target/arm/tcg/m_helper.c |
186 | + .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) }, | 2298 | +++ b/target/arm/tcg/m_helper.c |
187 | + { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64, | 2299 | @@ -XXX,XX +XXX,XX @@ |
188 | + .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7, | 2300 | #include "qemu/osdep.h" |
189 | + .access = PL2_RW, .accessfn = access_scxtnum, | 2301 | #include "cpu.h" |
190 | + .fieldoffset = offsetof(CPUARMState, scxtnum_el[2]) }, | 2302 | #include "internals.h" |
191 | + { .name = "SCXTNUM_EL3", .state = ARM_CP_STATE_AA64, | 2303 | +#include "cpu-features.h" |
192 | + .opc0 = 3, .opc1 = 6, .crn = 13, .crm = 0, .opc2 = 7, | 2304 | #include "gdbstub/helpers.h" |
193 | + .access = PL3_RW, | 2305 | #include "exec/helper-proto.h" |
194 | + .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) }, | 2306 | #include "qemu/main-loop.h" |
195 | +}; | 2307 | diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c |
196 | +#endif /* TARGET_AARCH64 */ | 2308 | index XXXXXXX..XXXXXXX 100644 |
197 | 2309 | --- a/target/arm/tcg/op_helper.c | |
198 | static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, | 2310 | +++ b/target/arm/tcg/op_helper.c |
199 | bool isread) | 2311 | @@ -XXX,XX +XXX,XX @@ |
200 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 2312 | #include "cpu.h" |
201 | define_arm_cp_regs(cpu, mte_tco_ro_reginfo); | 2313 | #include "exec/helper-proto.h" |
202 | define_arm_cp_regs(cpu, mte_el0_cacheop_reginfo); | 2314 | #include "internals.h" |
203 | } | 2315 | +#include "cpu-features.h" |
204 | + | 2316 | #include "exec/exec-all.h" |
205 | + if (cpu_isar_feature(aa64_scxtnum, cpu)) { | 2317 | #include "exec/cpu_ldst.h" |
206 | + define_arm_cp_regs(cpu, scxtnum_reginfo); | 2318 | #include "cpregs.h" |
207 | + } | 2319 | diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c |
208 | #endif | 2320 | index XXXXXXX..XXXXXXX 100644 |
209 | 2321 | --- a/target/arm/tcg/pauth_helper.c | |
210 | if (cpu_isar_feature(any_predinv, cpu)) { | 2322 | +++ b/target/arm/tcg/pauth_helper.c |
2323 | @@ -XXX,XX +XXX,XX @@ | ||
2324 | #include "qemu/osdep.h" | ||
2325 | #include "cpu.h" | ||
2326 | #include "internals.h" | ||
2327 | +#include "cpu-features.h" | ||
2328 | #include "exec/exec-all.h" | ||
2329 | #include "exec/cpu_ldst.h" | ||
2330 | #include "exec/helper-proto.h" | ||
2331 | diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c | ||
2332 | index XXXXXXX..XXXXXXX 100644 | ||
2333 | --- a/target/arm/tcg/tlb_helper.c | ||
2334 | +++ b/target/arm/tcg/tlb_helper.c | ||
2335 | @@ -XXX,XX +XXX,XX @@ | ||
2336 | #include "qemu/osdep.h" | ||
2337 | #include "cpu.h" | ||
2338 | #include "internals.h" | ||
2339 | +#include "cpu-features.h" | ||
2340 | #include "exec/exec-all.h" | ||
2341 | #include "exec/helper-proto.h" | ||
2342 | |||
2343 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | ||
2344 | index XXXXXXX..XXXXXXX 100644 | ||
2345 | --- a/target/arm/vfp_helper.c | ||
2346 | +++ b/target/arm/vfp_helper.c | ||
2347 | @@ -XXX,XX +XXX,XX @@ | ||
2348 | #include "cpu.h" | ||
2349 | #include "exec/helper-proto.h" | ||
2350 | #include "internals.h" | ||
2351 | +#include "cpu-features.h" | ||
2352 | #ifdef CONFIG_TCG | ||
2353 | #include "qemu/log.h" | ||
2354 | #include "fpu/softfloat.h" | ||
211 | -- | 2355 | -- |
212 | 2.25.1 | 2356 | 2.34.1 |
2357 | |||
2358 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Our list of isar_feature functions is not in any particular order, | ||
2 | but tests on fields of the same ID register tend to be grouped | ||
3 | together. A few functions that are tests of fields in ID_AA64MMFR1 | ||
4 | and ID_AA64MMFR2 are not in the same place as the rest; move them | ||
5 | into their groups. | ||
1 | 6 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20231024163510.2972081-3-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/cpu-features.h | 60 +++++++++++++++++++-------------------- | ||
13 | 1 file changed, 30 insertions(+), 30 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/cpu-features.h | ||
18 | +++ b/target/arm/cpu-features.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) | ||
20 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; | ||
21 | } | ||
22 | |||
23 | +static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
24 | +{ | ||
25 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
26 | +} | ||
27 | + | ||
28 | +static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
29 | +{ | ||
30 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
31 | +} | ||
32 | + | ||
33 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
34 | +{ | ||
35 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
36 | +} | ||
37 | + | ||
38 | static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | ||
39 | { | ||
40 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | ||
41 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) | ||
42 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; | ||
43 | } | ||
44 | |||
45 | +static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
46 | +{ | ||
47 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
48 | +} | ||
49 | + | ||
50 | +static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
51 | +{ | ||
52 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
53 | +} | ||
54 | + | ||
55 | +static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
56 | +{ | ||
57 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
58 | +} | ||
59 | + | ||
60 | static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
61 | { | ||
62 | return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
63 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
64 | return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
65 | } | ||
66 | |||
67 | -static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
68 | -{ | ||
69 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
70 | -} | ||
71 | - | ||
72 | -static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
73 | -{ | ||
74 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
75 | -} | ||
76 | - | ||
77 | -static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
78 | -{ | ||
79 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
80 | -} | ||
81 | - | ||
82 | -static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
83 | -{ | ||
84 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
85 | -} | ||
86 | - | ||
87 | -static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
88 | -{ | ||
89 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
90 | -} | ||
91 | - | ||
92 | -static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
93 | -{ | ||
94 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
95 | -} | ||
96 | - | ||
97 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
98 | { | ||
99 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
100 | -- | ||
101 | 2.34.1 | ||
102 | |||
103 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Move the ID_AA64MMFR0 feature test functions up so they are | ||
2 | before the ones for ID_AA64MMFR1 and ID_AA64MMFR2. | ||
1 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20231024163510.2972081-4-peter.maydell@linaro.org | ||
8 | --- | ||
9 | target/arm/cpu-features.h | 120 +++++++++++++++++++------------------- | ||
10 | 1 file changed, 60 insertions(+), 60 deletions(-) | ||
11 | |||
12 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/cpu-features.h | ||
15 | +++ b/target/arm/cpu-features.h | ||
16 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) | ||
17 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; | ||
18 | } | ||
19 | |||
20 | +static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
21 | +{ | ||
22 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
23 | +} | ||
24 | + | ||
25 | +static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
26 | +{ | ||
27 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
28 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
29 | +} | ||
30 | + | ||
31 | +static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
32 | +{ | ||
33 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
34 | +} | ||
35 | + | ||
36 | +static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
37 | +{ | ||
38 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
39 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
40 | +} | ||
41 | + | ||
42 | +static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
43 | +{ | ||
44 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
45 | +} | ||
46 | + | ||
47 | +static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
48 | +{ | ||
49 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
50 | +} | ||
51 | + | ||
52 | +static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
53 | +{ | ||
54 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
55 | +} | ||
56 | + | ||
57 | +static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
58 | +{ | ||
59 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
60 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
61 | +} | ||
62 | + | ||
63 | +static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
64 | +{ | ||
65 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
66 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
67 | +} | ||
68 | + | ||
69 | +static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
70 | +{ | ||
71 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
72 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
73 | +} | ||
74 | + | ||
75 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
76 | +{ | ||
77 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
78 | +} | ||
79 | + | ||
80 | static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
81 | { | ||
82 | return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
83 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
84 | return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
85 | } | ||
86 | |||
87 | -static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
88 | -{ | ||
89 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
90 | -} | ||
91 | - | ||
92 | -static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
93 | -{ | ||
94 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
95 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
96 | -} | ||
97 | - | ||
98 | -static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
99 | -{ | ||
100 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
101 | -} | ||
102 | - | ||
103 | -static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
104 | -{ | ||
105 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
106 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
107 | -} | ||
108 | - | ||
109 | -static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
110 | -{ | ||
111 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
112 | -} | ||
113 | - | ||
114 | -static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
115 | -{ | ||
116 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
117 | -} | ||
118 | - | ||
119 | -static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
120 | -{ | ||
121 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
122 | -} | ||
123 | - | ||
124 | -static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
125 | -{ | ||
126 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
127 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
128 | -} | ||
129 | - | ||
130 | -static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
131 | -{ | ||
132 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
133 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
134 | -} | ||
135 | - | ||
136 | -static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
137 | -{ | ||
138 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
139 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
140 | -} | ||
141 | - | ||
142 | -static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
143 | -{ | ||
144 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
145 | -} | ||
146 | - | ||
147 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
148 | { | ||
149 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
150 | -- | ||
151 | 2.34.1 | ||
152 | |||
153 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Move the feature test functions that test ID_AA64ISAR* fields |
---|---|---|---|
2 | together. | ||
2 | 3 | ||
3 | Add only the system registers required to implement zero error | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | records. This means that all values for ERRSELR are out of range, | 5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | which means that it and all of the indexed error record registers | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | need not be implemented. | 7 | Message-id: 20231024163510.2972081-5-peter.maydell@linaro.org |
8 | --- | ||
9 | target/arm/cpu-features.h | 70 +++++++++++++++++++-------------------- | ||
10 | 1 file changed, 35 insertions(+), 35 deletions(-) | ||
7 | 11 | ||
8 | Add the EL2 registers required for injecting virtual SError. | 12 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20220506180242.216785-14-richard.henderson@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | target/arm/cpu.h | 5 +++ | ||
16 | target/arm/helper.c | 84 +++++++++++++++++++++++++++++++++++++++++++++ | ||
17 | 2 files changed, 89 insertions(+) | ||
18 | |||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/cpu.h | 14 | --- a/target/arm/cpu-features.h |
22 | +++ b/target/arm/cpu.h | 15 | +++ b/target/arm/cpu-features.h |
23 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | 16 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) |
24 | uint64_t tfsr_el[4]; /* tfsre0_el1 is index 0. */ | 17 | return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; |
25 | uint64_t gcr_el1; | 18 | } |
26 | uint64_t rgsr_el1; | 19 | |
27 | + | 20 | +static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) |
28 | + /* Minimal RAS registers */ | ||
29 | + uint64_t disr_el1; | ||
30 | + uint64_t vdisr_el2; | ||
31 | + uint64_t vsesr_el2; | ||
32 | } cp15; | ||
33 | |||
34 | struct { | ||
35 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/helper.c | ||
38 | +++ b/target/arm/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { | ||
40 | .access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .resetvalue = 0 }, | ||
41 | }; | ||
42 | |||
43 | +/* | ||
44 | + * Check for traps to RAS registers, which are controlled | ||
45 | + * by HCR_EL2.TERR and SCR_EL3.TERR. | ||
46 | + */ | ||
47 | +static CPAccessResult access_terr(CPUARMState *env, const ARMCPRegInfo *ri, | ||
48 | + bool isread) | ||
49 | +{ | 21 | +{ |
50 | + int el = arm_current_el(env); | 22 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; |
51 | + | ||
52 | + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_TERR)) { | ||
53 | + return CP_ACCESS_TRAP_EL2; | ||
54 | + } | ||
55 | + if (el < 3 && (env->cp15.scr_el3 & SCR_TERR)) { | ||
56 | + return CP_ACCESS_TRAP_EL3; | ||
57 | + } | ||
58 | + return CP_ACCESS_OK; | ||
59 | +} | 23 | +} |
60 | + | 24 | + |
61 | +static uint64_t disr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 25 | +static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) |
62 | +{ | 26 | +{ |
63 | + int el = arm_current_el(env); | 27 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; |
64 | + | ||
65 | + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) { | ||
66 | + return env->cp15.vdisr_el2; | ||
67 | + } | ||
68 | + if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) { | ||
69 | + return 0; /* RAZ/WI */ | ||
70 | + } | ||
71 | + return env->cp15.disr_el1; | ||
72 | +} | 28 | +} |
73 | + | 29 | + |
74 | +static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val) | 30 | static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) |
31 | { | ||
32 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | ||
33 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) | ||
34 | return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; | ||
35 | } | ||
36 | |||
37 | -static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) | ||
38 | -{ | ||
39 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
40 | -} | ||
41 | - | ||
42 | -static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
43 | -{ | ||
44 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
45 | -} | ||
46 | - | ||
47 | static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
48 | { | ||
49 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
50 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
51 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
52 | } | ||
53 | |||
54 | +static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
75 | +{ | 55 | +{ |
76 | + int el = arm_current_el(env); | 56 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; |
77 | + | ||
78 | + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) { | ||
79 | + env->cp15.vdisr_el2 = val; | ||
80 | + return; | ||
81 | + } | ||
82 | + if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) { | ||
83 | + return; /* RAZ/WI */ | ||
84 | + } | ||
85 | + env->cp15.disr_el1 = val; | ||
86 | +} | 57 | +} |
87 | + | 58 | + |
88 | +/* | 59 | +static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) |
89 | + * Minimal RAS implementation with no Error Records. | 60 | +{ |
90 | + * Which means that all of the Error Record registers: | 61 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; |
91 | + * ERXADDR_EL1 | 62 | +} |
92 | + * ERXCTLR_EL1 | ||
93 | + * ERXFR_EL1 | ||
94 | + * ERXMISC0_EL1 | ||
95 | + * ERXMISC1_EL1 | ||
96 | + * ERXMISC2_EL1 | ||
97 | + * ERXMISC3_EL1 | ||
98 | + * ERXPFGCDN_EL1 (RASv1p1) | ||
99 | + * ERXPFGCTL_EL1 (RASv1p1) | ||
100 | + * ERXPFGF_EL1 (RASv1p1) | ||
101 | + * ERXSTATUS_EL1 | ||
102 | + * and | ||
103 | + * ERRSELR_EL1 | ||
104 | + * may generate UNDEFINED, which is the effect we get by not | ||
105 | + * listing them at all. | ||
106 | + */ | ||
107 | +static const ARMCPRegInfo minimal_ras_reginfo[] = { | ||
108 | + { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH, | ||
109 | + .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 1, | ||
110 | + .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.disr_el1), | ||
111 | + .readfn = disr_read, .writefn = disr_write, .raw_writefn = raw_write }, | ||
112 | + { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
113 | + .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0, | ||
114 | + .access = PL1_R, .accessfn = access_terr, | ||
115 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
116 | + { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH, | ||
117 | + .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1, | ||
118 | + .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vdisr_el2) }, | ||
119 | + { .name = "VSESR_EL2", .state = ARM_CP_STATE_BOTH, | ||
120 | + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 3, | ||
121 | + .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vsesr_el2) }, | ||
122 | +}; | ||
123 | + | 63 | + |
124 | /* Return the exception level to which exceptions should be taken | 64 | +static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) |
125 | * via SVEAccessTrap. If an exception should be routed through | 65 | +{ |
126 | * AArch64.AdvSIMDFPAccessTrap, return 0; fp_exception_el should | 66 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; |
127 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 67 | +} |
128 | if (cpu_isar_feature(aa64_ssbs, cpu)) { | 68 | + |
129 | define_one_arm_cp_reg(cpu, &ssbs_reginfo); | 69 | +static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) |
130 | } | 70 | +{ |
131 | + if (cpu_isar_feature(any_ras, cpu)) { | 71 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; |
132 | + define_arm_cp_regs(cpu, minimal_ras_reginfo); | 72 | +} |
133 | + } | 73 | + |
134 | 74 | +static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | |
135 | if (cpu_isar_feature(aa64_vh, cpu) || | 75 | +{ |
136 | cpu_isar_feature(aa64_debugv8p2, cpu)) { | 76 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); |
77 | +} | ||
78 | + | ||
79 | static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) | ||
80 | { | ||
81 | /* We always set the AdvSIMD and FP fields identically. */ | ||
82 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
83 | FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
84 | } | ||
85 | |||
86 | -static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
87 | -{ | ||
88 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
89 | -} | ||
90 | - | ||
91 | -static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
92 | -{ | ||
93 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
94 | -} | ||
95 | - | ||
96 | -static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) | ||
97 | -{ | ||
98 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
99 | -} | ||
100 | - | ||
101 | -static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
102 | -{ | ||
103 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
104 | -} | ||
105 | - | ||
106 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
107 | { | ||
108 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
109 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
110 | return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
111 | } | ||
112 | |||
113 | -static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | ||
114 | -{ | ||
115 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
116 | -} | ||
117 | - | ||
118 | /* | ||
119 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
120 | */ | ||
137 | -- | 121 | -- |
138 | 2.25.1 | 122 | 2.34.1 |
123 | |||
124 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Move all the ID_AA64PFR* feature test functions together. |
---|---|---|---|
2 | 2 | ||
3 | Virtual SError exceptions are raised by setting HCR_EL2.VSE, | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | and are routed to EL1 just like other virtual exceptions. | 4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20231024163510.2972081-6-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/cpu-features.h | 86 +++++++++++++++++++-------------------- | ||
9 | 1 file changed, 43 insertions(+), 43 deletions(-) | ||
5 | 10 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220506180242.216785-16-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/cpu.h | 2 ++ | ||
12 | target/arm/internals.h | 8 ++++++++ | ||
13 | target/arm/syndrome.h | 5 +++++ | ||
14 | target/arm/cpu.c | 38 +++++++++++++++++++++++++++++++++++++- | ||
15 | target/arm/helper.c | 40 +++++++++++++++++++++++++++++++++++++++- | ||
16 | 5 files changed, 91 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 13 | --- a/target/arm/cpu-features.h |
21 | +++ b/target/arm/cpu.h | 14 | +++ b/target/arm/cpu-features.h |
22 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) |
23 | #define EXCP_LSERR 21 /* v8M LSERR SecureFault */ | 16 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; |
24 | #define EXCP_UNALIGNED 22 /* v7M UNALIGNED UsageFault */ | ||
25 | #define EXCP_DIVBYZERO 23 /* v7M DIVBYZERO UsageFault */ | ||
26 | +#define EXCP_VSERR 24 | ||
27 | /* NB: add new EXCP_ defines to the array in arm_log_exception() too */ | ||
28 | |||
29 | #define ARMV7M_EXCP_RESET 1 | ||
30 | @@ -XXX,XX +XXX,XX @@ enum { | ||
31 | #define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1 | ||
32 | #define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2 | ||
33 | #define CPU_INTERRUPT_VFIQ CPU_INTERRUPT_TGT_EXT_3 | ||
34 | +#define CPU_INTERRUPT_VSERR CPU_INTERRUPT_TGT_INT_0 | ||
35 | |||
36 | /* The usual mapping for an AArch64 system register to its AArch32 | ||
37 | * counterpart is for the 32 bit world to have access to the lower | ||
38 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/internals.h | ||
41 | +++ b/target/arm/internals.h | ||
42 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_update_virq(ARMCPU *cpu); | ||
43 | */ | ||
44 | void arm_cpu_update_vfiq(ARMCPU *cpu); | ||
45 | |||
46 | +/** | ||
47 | + * arm_cpu_update_vserr: Update CPU_INTERRUPT_VSERR bit | ||
48 | + * | ||
49 | + * Update the CPU_INTERRUPT_VSERR bit in cs->interrupt_request, | ||
50 | + * following a change to the HCR_EL2.VSE bit. | ||
51 | + */ | ||
52 | +void arm_cpu_update_vserr(ARMCPU *cpu); | ||
53 | + | ||
54 | /** | ||
55 | * arm_mmu_idx_el: | ||
56 | * @env: The cpu environment | ||
57 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/target/arm/syndrome.h | ||
60 | +++ b/target/arm/syndrome.h | ||
61 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_pcalignment(void) | ||
62 | return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
63 | } | 17 | } |
64 | 18 | ||
65 | +static inline uint32_t syn_serror(uint32_t extra) | 19 | +static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
66 | +{ | 20 | +{ |
67 | + return (EC_SERROR << ARM_EL_EC_SHIFT) | ARM_EL_IL | extra; | 21 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
68 | +} | 22 | +} |
69 | + | 23 | + |
70 | #endif /* TARGET_ARM_SYNDROME_H */ | 24 | +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) |
71 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 25 | +{ |
72 | index XXXXXXX..XXXXXXX 100644 | 26 | + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); |
73 | --- a/target/arm/cpu.c | 27 | + if (key >= 2) { |
74 | +++ b/target/arm/cpu.c | 28 | + return true; /* FEAT_CSV2_2 */ |
75 | @@ -XXX,XX +XXX,XX @@ static bool arm_cpu_has_work(CPUState *cs) | ||
76 | return (cpu->power_state != PSCI_OFF) | ||
77 | && cs->interrupt_request & | ||
78 | (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | ||
79 | - | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | ||
80 | + | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR | ||
81 | | CPU_INTERRUPT_EXITTB); | ||
82 | } | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
85 | return false; | ||
86 | } | ||
87 | return !(env->daif & PSTATE_I); | ||
88 | + case EXCP_VSERR: | ||
89 | + if (!(hcr_el2 & HCR_AMO) || (hcr_el2 & HCR_TGE)) { | ||
90 | + /* VIRQs are only taken when hypervized. */ | ||
91 | + return false; | ||
92 | + } | ||
93 | + return !(env->daif & PSTATE_A); | ||
94 | default: | ||
95 | g_assert_not_reached(); | ||
96 | } | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
98 | goto found; | ||
99 | } | ||
100 | } | ||
101 | + if (interrupt_request & CPU_INTERRUPT_VSERR) { | ||
102 | + excp_idx = EXCP_VSERR; | ||
103 | + target_el = 1; | ||
104 | + if (arm_excp_unmasked(cs, excp_idx, target_el, | ||
105 | + cur_el, secure, hcr_el2)) { | ||
106 | + /* Taking a virtual abort clears HCR_EL2.VSE */ | ||
107 | + env->cp15.hcr_el2 &= ~HCR_VSE; | ||
108 | + cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR); | ||
109 | + goto found; | ||
110 | + } | ||
111 | + } | 29 | + } |
112 | return false; | 30 | + if (key == 1) { |
113 | 31 | + key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); | |
114 | found: | 32 | + return key >= 2; /* FEAT_CSV2_1p2 */ |
115 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_update_vfiq(ARMCPU *cpu) | ||
116 | } | ||
117 | } | ||
118 | |||
119 | +void arm_cpu_update_vserr(ARMCPU *cpu) | ||
120 | +{ | ||
121 | + /* | ||
122 | + * Update the interrupt level for VSERR, which is the HCR_EL2.VSE bit. | ||
123 | + */ | ||
124 | + CPUARMState *env = &cpu->env; | ||
125 | + CPUState *cs = CPU(cpu); | ||
126 | + | ||
127 | + bool new_state = env->cp15.hcr_el2 & HCR_VSE; | ||
128 | + | ||
129 | + if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VSERR) != 0)) { | ||
130 | + if (new_state) { | ||
131 | + cpu_interrupt(cs, CPU_INTERRUPT_VSERR); | ||
132 | + } else { | ||
133 | + cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR); | ||
134 | + } | ||
135 | + } | 33 | + } |
34 | + return false; | ||
136 | +} | 35 | +} |
137 | + | 36 | + |
138 | #ifndef CONFIG_USER_ONLY | 37 | +static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) |
139 | static void arm_cpu_set_irq(void *opaque, int irq, int level) | 38 | +{ |
39 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; | ||
40 | +} | ||
41 | + | ||
42 | +static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
43 | +{ | ||
44 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
45 | +} | ||
46 | + | ||
47 | +static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
48 | +{ | ||
49 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
50 | +} | ||
51 | + | ||
52 | +static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
53 | +{ | ||
54 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
55 | +} | ||
56 | + | ||
57 | +static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
58 | +{ | ||
59 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
60 | +} | ||
61 | + | ||
62 | static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
140 | { | 63 | { |
141 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 64 | return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; |
142 | index XXXXXXX..XXXXXXX 100644 | 65 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) |
143 | --- a/target/arm/helper.c | 66 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; |
144 | +++ b/target/arm/helper.c | ||
145 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
146 | } | ||
147 | } | ||
148 | |||
149 | - /* External aborts are not possible in QEMU so A bit is always clear */ | ||
150 | + if (hcr_el2 & HCR_AMO) { | ||
151 | + if (cs->interrupt_request & CPU_INTERRUPT_VSERR) { | ||
152 | + ret |= CPSR_A; | ||
153 | + } | ||
154 | + } | ||
155 | + | ||
156 | return ret; | ||
157 | } | 67 | } |
158 | 68 | ||
159 | @@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) | 69 | -static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) |
160 | g_assert(qemu_mutex_iothread_locked()); | 70 | -{ |
161 | arm_cpu_update_virq(cpu); | 71 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; |
162 | arm_cpu_update_vfiq(cpu); | 72 | -} |
163 | + arm_cpu_update_vserr(cpu); | 73 | - |
74 | -static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
75 | -{ | ||
76 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
77 | -} | ||
78 | - | ||
79 | -static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
80 | -{ | ||
81 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
82 | -} | ||
83 | - | ||
84 | -static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
85 | -{ | ||
86 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
87 | -} | ||
88 | - | ||
89 | static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
90 | { | ||
91 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && | ||
92 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
93 | FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
164 | } | 94 | } |
165 | 95 | ||
166 | static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 96 | -static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
167 | @@ -XXX,XX +XXX,XX @@ void arm_log_exception(CPUState *cs) | 97 | -{ |
168 | [EXCP_LSERR] = "v8M LSERR UsageFault", | 98 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
169 | [EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault", | 99 | -} |
170 | [EXCP_DIVBYZERO] = "v7M DIVBYZERO UsageFault", | 100 | - |
171 | + [EXCP_VSERR] = "Virtual SERR", | 101 | -static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) |
172 | }; | 102 | -{ |
173 | 103 | - int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); | |
174 | if (idx >= 0 && idx < ARRAY_SIZE(excnames)) { | 104 | - if (key >= 2) { |
175 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) | 105 | - return true; /* FEAT_CSV2_2 */ |
176 | mask = CPSR_A | CPSR_I | CPSR_F; | 106 | - } |
177 | offset = 4; | 107 | - if (key == 1) { |
178 | break; | 108 | - key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); |
179 | + case EXCP_VSERR: | 109 | - return key >= 2; /* FEAT_CSV2_1p2 */ |
180 | + { | 110 | - } |
181 | + /* | 111 | - return false; |
182 | + * Note that this is reported as a data abort, but the DFAR | 112 | -} |
183 | + * has an UNKNOWN value. Construct the SError syndrome from | 113 | - |
184 | + * AET and ExT fields. | 114 | -static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) |
185 | + */ | 115 | -{ |
186 | + ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal, }; | 116 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; |
187 | + | 117 | -} |
188 | + if (extended_addresses_enabled(env)) { | 118 | - |
189 | + env->exception.fsr = arm_fi_to_lfsc(&fi); | 119 | static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) |
190 | + } else { | 120 | { |
191 | + env->exception.fsr = arm_fi_to_sfsc(&fi); | 121 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; |
192 | + } | ||
193 | + env->exception.fsr |= env->cp15.vsesr_el2 & 0xd000; | ||
194 | + A32_BANKED_CURRENT_REG_SET(env, dfsr, env->exception.fsr); | ||
195 | + qemu_log_mask(CPU_LOG_INT, "...with IFSR 0x%x\n", | ||
196 | + env->exception.fsr); | ||
197 | + | ||
198 | + new_mode = ARM_CPU_MODE_ABT; | ||
199 | + addr = 0x10; | ||
200 | + mask = CPSR_A | CPSR_I; | ||
201 | + offset = 8; | ||
202 | + } | ||
203 | + break; | ||
204 | case EXCP_SMC: | ||
205 | new_mode = ARM_CPU_MODE_MON; | ||
206 | addr = 0x08; | ||
207 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) | ||
208 | case EXCP_VFIQ: | ||
209 | addr += 0x100; | ||
210 | break; | ||
211 | + case EXCP_VSERR: | ||
212 | + addr += 0x180; | ||
213 | + /* Construct the SError syndrome from IDS and ISS fields. */ | ||
214 | + env->exception.syndrome = syn_serror(env->cp15.vsesr_el2 & 0x1ffffff); | ||
215 | + env->cp15.esr_el[new_el] = env->exception.syndrome; | ||
216 | + break; | ||
217 | default: | ||
218 | cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); | ||
219 | } | ||
220 | -- | 122 | -- |
221 | 2.25.1 | 123 | 2.34.1 |
124 | |||
125 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Move all the ID_AA64DFR* feature test functions together. | ||
1 | 2 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20231024163510.2972081-7-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/cpu-features.h | 10 +++++----- | ||
9 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/cpu-features.h | ||
14 | +++ b/target/arm/cpu-features.h | ||
15 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) | ||
16 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; | ||
17 | } | ||
18 | |||
19 | +static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
20 | +{ | ||
21 | + return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
22 | +} | ||
23 | + | ||
24 | static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) | ||
25 | { | ||
26 | return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; | ||
27 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) | ||
28 | return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | ||
29 | } | ||
30 | |||
31 | -static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
32 | -{ | ||
33 | - return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
34 | -} | ||
35 | - | ||
36 | /* | ||
37 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
38 | */ | ||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In commit 442c9d682c94fc2 when we converted the ERET, ERETAA, ERETAB | ||
2 | instructions to decodetree, the conversion accidentally lost the | ||
3 | correct setting of the syndrome register when taking a trap because | ||
4 | of the FEAT_FGT HFGITR_EL1.ERET bit. Instead of reporting a correct | ||
5 | full syndrome value with the EC and IL bits, we only reported the low | ||
6 | two bits of the syndrome, because the call to syn_erettrap() got | ||
7 | dropped. | ||
1 | 8 | ||
9 | Fix the syndrome values for these traps by reinstating the | ||
10 | syn_erettrap() calls. | ||
11 | |||
12 | Fixes: 442c9d682c94fc2 ("target/arm: Convert ERET, ERETAA, ERETAB to decodetree") | ||
13 | Cc: qemu-stable@nongnu.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20231024172438.2990945-1-peter.maydell@linaro.org | ||
17 | --- | ||
18 | target/arm/tcg/translate-a64.c | 4 ++-- | ||
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/tcg/translate-a64.c | ||
24 | +++ b/target/arm/tcg/translate-a64.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) | ||
26 | return false; | ||
27 | } | ||
28 | if (s->fgt_eret) { | ||
29 | - gen_exception_insn_el(s, 0, EXCP_UDEF, 0, 2); | ||
30 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(0), 2); | ||
31 | return true; | ||
32 | } | ||
33 | dst = tcg_temp_new_i64(); | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool trans_ERETA(DisasContext *s, arg_reta *a) | ||
35 | } | ||
36 | /* The FGT trap takes precedence over an auth trap. */ | ||
37 | if (s->fgt_eret) { | ||
38 | - gen_exception_insn_el(s, 0, EXCP_UDEF, a->m ? 3 : 2, 2); | ||
39 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(a->m ? 3 : 2), 2); | ||
40 | return true; | ||
41 | } | ||
42 | dst = tcg_temp_new_i64(); | ||
43 | -- | ||
44 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Currently, the SMP configuration isn't considered when the CPU | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | topology is populated. In this case, it's impossible to provide | ||
5 | the default CPU-to-NUMA mapping or association based on the socket | ||
6 | ID of the given CPU. | ||
7 | 4 | ||
8 | This takes account of SMP configuration when the CPU topology | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | is populated. The die ID for the given CPU isn't assigned since | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | it's not supported on arm/virt machine. Besides, the used SMP | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
11 | configuration in qtest/numa-test/aarch64_numa_cpu() is corrcted | 8 | Message-id: 20231025065316.56817-2-philmd@linaro.org |
12 | to avoid testing failure | ||
13 | |||
14 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
15 | Reviewed-by: Yanan Wang <wangyanan55@huawei.com> | ||
16 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
17 | Message-id: 20220503140304.855514-4-gshan@redhat.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 10 | --- |
20 | hw/arm/virt.c | 15 ++++++++++++++- | 11 | include/hw/arm/allwinner-a10.h | 1 - |
21 | 1 file changed, 14 insertions(+), 1 deletion(-) | 12 | hw/arm/cubieboard.c | 1 + |
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
22 | 14 | ||
23 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 15 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h |
24 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/arm/virt.c | 17 | --- a/include/hw/arm/allwinner-a10.h |
26 | +++ b/hw/arm/virt.c | 18 | +++ b/include/hw/arm/allwinner-a10.h |
27 | @@ -XXX,XX +XXX,XX @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) | 19 | @@ -XXX,XX +XXX,XX @@ |
28 | int n; | 20 | #ifndef HW_ARM_ALLWINNER_A10_H |
29 | unsigned int max_cpus = ms->smp.max_cpus; | 21 | #define HW_ARM_ALLWINNER_A10_H |
30 | VirtMachineState *vms = VIRT_MACHINE(ms); | 22 | |
31 | + MachineClass *mc = MACHINE_GET_CLASS(vms); | 23 | -#include "hw/arm/boot.h" |
32 | 24 | #include "hw/timer/allwinner-a10-pit.h" | |
33 | if (ms->possible_cpus) { | 25 | #include "hw/intc/allwinner-a10-pic.h" |
34 | assert(ms->possible_cpus->len == max_cpus); | 26 | #include "hw/net/allwinner_emac.h" |
35 | @@ -XXX,XX +XXX,XX @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) | 27 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
36 | ms->possible_cpus->cpus[n].type = ms->cpu_type; | 28 | index XXXXXXX..XXXXXXX 100644 |
37 | ms->possible_cpus->cpus[n].arch_id = | 29 | --- a/hw/arm/cubieboard.c |
38 | virt_cpu_mp_affinity(vms, n); | 30 | +++ b/hw/arm/cubieboard.c |
39 | + | 31 | @@ -XXX,XX +XXX,XX @@ |
40 | + assert(!mc->smp_props.dies_supported); | 32 | #include "hw/boards.h" |
41 | + ms->possible_cpus->cpus[n].props.has_socket_id = true; | 33 | #include "hw/qdev-properties.h" |
42 | + ms->possible_cpus->cpus[n].props.socket_id = | 34 | #include "hw/arm/allwinner-a10.h" |
43 | + n / (ms->smp.clusters * ms->smp.cores * ms->smp.threads); | 35 | +#include "hw/arm/boot.h" |
44 | + ms->possible_cpus->cpus[n].props.has_cluster_id = true; | 36 | #include "hw/i2c/i2c.h" |
45 | + ms->possible_cpus->cpus[n].props.cluster_id = | 37 | |
46 | + (n / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters; | 38 | static struct arm_boot_info cubieboard_binfo = { |
47 | + ms->possible_cpus->cpus[n].props.has_core_id = true; | ||
48 | + ms->possible_cpus->cpus[n].props.core_id = | ||
49 | + (n / ms->smp.threads) % ms->smp.cores; | ||
50 | ms->possible_cpus->cpus[n].props.has_thread_id = true; | ||
51 | - ms->possible_cpus->cpus[n].props.thread_id = n; | ||
52 | + ms->possible_cpus->cpus[n].props.thread_id = | ||
53 | + n % ms->smp.threads; | ||
54 | } | ||
55 | return ms->possible_cpus; | ||
56 | } | ||
57 | -- | 39 | -- |
58 | 2.25.1 | 40 | 2.34.1 |
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-3-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/allwinner-h3.h | 1 - | ||
12 | hw/arm/orangepi.c | 1 + | ||
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/allwinner-h3.h | ||
18 | +++ b/include/hw/arm/allwinner-h3.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #define HW_ARM_ALLWINNER_H3_H | ||
21 | |||
22 | #include "qom/object.h" | ||
23 | -#include "hw/arm/boot.h" | ||
24 | #include "hw/timer/allwinner-a10-pit.h" | ||
25 | #include "hw/intc/arm_gic.h" | ||
26 | #include "hw/misc/allwinner-h3-ccu.h" | ||
27 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/orangepi.c | ||
30 | +++ b/hw/arm/orangepi.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "hw/boards.h" | ||
33 | #include "hw/qdev-properties.h" | ||
34 | #include "hw/arm/allwinner-h3.h" | ||
35 | +#include "hw/arm/boot.h" | ||
36 | |||
37 | static struct arm_boot_info orangepi_binfo; | ||
38 | |||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-4-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/allwinner-r40.h | 1 - | ||
12 | hw/arm/bananapi_m2u.c | 1 + | ||
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/allwinner-r40.h | ||
18 | +++ b/include/hw/arm/allwinner-r40.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #define HW_ARM_ALLWINNER_R40_H | ||
21 | |||
22 | #include "qom/object.h" | ||
23 | -#include "hw/arm/boot.h" | ||
24 | #include "hw/timer/allwinner-a10-pit.h" | ||
25 | #include "hw/intc/arm_gic.h" | ||
26 | #include "hw/sd/allwinner-sdhost.h" | ||
27 | diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/bananapi_m2u.c | ||
30 | +++ b/hw/arm/bananapi_m2u.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "hw/i2c/i2c.h" | ||
33 | #include "hw/qdev-properties.h" | ||
34 | #include "hw/arm/allwinner-r40.h" | ||
35 | +#include "hw/arm/boot.h" | ||
36 | |||
37 | static struct arm_boot_info bpim2u_binfo; | ||
38 | |||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-5-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/fsl-imx25.h | 1 - | ||
12 | hw/arm/imx25_pdk.c | 1 + | ||
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/fsl-imx25.h | ||
18 | +++ b/include/hw/arm/fsl-imx25.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #ifndef FSL_IMX25_H | ||
21 | #define FSL_IMX25_H | ||
22 | |||
23 | -#include "hw/arm/boot.h" | ||
24 | #include "hw/intc/imx_avic.h" | ||
25 | #include "hw/misc/imx25_ccm.h" | ||
26 | #include "hw/char/imx_serial.h" | ||
27 | diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/imx25_pdk.c | ||
30 | +++ b/hw/arm/imx25_pdk.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "qapi/error.h" | ||
33 | #include "hw/qdev-properties.h" | ||
34 | #include "hw/arm/fsl-imx25.h" | ||
35 | +#include "hw/arm/boot.h" | ||
36 | #include "hw/boards.h" | ||
37 | #include "qemu/error-report.h" | ||
38 | #include "sysemu/qtest.h" | ||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-6-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/fsl-imx31.h | 1 - | ||
12 | hw/arm/kzm.c | 1 + | ||
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/fsl-imx31.h | ||
18 | +++ b/include/hw/arm/fsl-imx31.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #ifndef FSL_IMX31_H | ||
21 | #define FSL_IMX31_H | ||
22 | |||
23 | -#include "hw/arm/boot.h" | ||
24 | #include "hw/intc/imx_avic.h" | ||
25 | #include "hw/misc/imx31_ccm.h" | ||
26 | #include "hw/char/imx_serial.h" | ||
27 | diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/kzm.c | ||
30 | +++ b/hw/arm/kzm.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "qemu/osdep.h" | ||
33 | #include "qapi/error.h" | ||
34 | #include "hw/arm/fsl-imx31.h" | ||
35 | +#include "hw/arm/boot.h" | ||
36 | #include "hw/boards.h" | ||
37 | #include "qemu/error-report.h" | ||
38 | #include "exec/address-spaces.h" | ||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In aarch64_numa_cpu(), the CPU and NUMA association is something | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | like below. Two threads in the same core/cluster/socket are | ||
5 | associated with two individual NUMA nodes, which is unreal as | ||
6 | Igor Mammedov mentioned. We don't expect the association to break | ||
7 | NUMA-to-socket boundary, which matches with the real world. | ||
8 | 4 | ||
9 | NUMA-node socket cluster core thread | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | ------------------------------------------ | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | 0 0 0 0 0 | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
12 | 1 0 0 0 1 | 8 | Message-id: 20231025065316.56817-7-philmd@linaro.org |
13 | |||
14 | This corrects the topology for CPUs and their association with | ||
15 | NUMA nodes. After this patch is applied, the CPU and NUMA | ||
16 | association becomes something like below, which looks real. | ||
17 | Besides, socket/cluster/core/thread IDs are all checked when | ||
18 | the NUMA node IDs are verified. It helps to check if the CPU | ||
19 | topology is properly populated or not. | ||
20 | |||
21 | NUMA-node socket cluster core thread | ||
22 | ------------------------------------------ | ||
23 | 0 1 0 0 0 | ||
24 | 1 0 0 0 0 | ||
25 | |||
26 | Suggested-by: Igor Mammedov <imammedo@redhat.com> | ||
27 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
28 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
29 | Message-id: 20220503140304.855514-5-gshan@redhat.com | ||
30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
31 | --- | 10 | --- |
32 | tests/qtest/numa-test.c | 18 ++++++++++++------ | 11 | include/hw/arm/fsl-imx6.h | 1 - |
33 | 1 file changed, 12 insertions(+), 6 deletions(-) | 12 | hw/arm/sabrelite.c | 1 + |
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
34 | 14 | ||
35 | diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c | 15 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h |
36 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/tests/qtest/numa-test.c | 17 | --- a/include/hw/arm/fsl-imx6.h |
38 | +++ b/tests/qtest/numa-test.c | 18 | +++ b/include/hw/arm/fsl-imx6.h |
39 | @@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data) | 19 | @@ -XXX,XX +XXX,XX @@ |
40 | g_autofree char *cli = NULL; | 20 | #ifndef FSL_IMX6_H |
41 | 21 | #define FSL_IMX6_H | |
42 | cli = make_cli(data, "-machine " | 22 | |
43 | - "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 " | 23 | -#include "hw/arm/boot.h" |
44 | + "smp.cpus=2,smp.sockets=2,smp.clusters=1,smp.cores=1,smp.threads=1 " | 24 | #include "hw/cpu/a9mpcore.h" |
45 | "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 " | 25 | #include "hw/misc/imx6_ccm.h" |
46 | - "-numa cpu,node-id=1,thread-id=0 " | 26 | #include "hw/misc/imx6_src.h" |
47 | - "-numa cpu,node-id=0,thread-id=1"); | 27 | diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c |
48 | + "-numa cpu,node-id=0,socket-id=1,cluster-id=0,core-id=0,thread-id=0 " | 28 | index XXXXXXX..XXXXXXX 100644 |
49 | + "-numa cpu,node-id=1,socket-id=0,cluster-id=0,core-id=0,thread-id=0"); | 29 | --- a/hw/arm/sabrelite.c |
50 | qts = qtest_init(cli); | 30 | +++ b/hw/arm/sabrelite.c |
51 | cpus = get_cpus(qts, &resp); | 31 | @@ -XXX,XX +XXX,XX @@ |
52 | g_assert(cpus); | 32 | #include "qemu/osdep.h" |
53 | 33 | #include "qapi/error.h" | |
54 | while ((e = qlist_pop(cpus))) { | 34 | #include "hw/arm/fsl-imx6.h" |
55 | QDict *cpu, *props; | 35 | +#include "hw/arm/boot.h" |
56 | - int64_t thread, node; | 36 | #include "hw/boards.h" |
57 | + int64_t socket, cluster, core, thread, node; | 37 | #include "hw/qdev-properties.h" |
58 | 38 | #include "qemu/error-report.h" | |
59 | cpu = qobject_to(QDict, e); | ||
60 | g_assert(qdict_haskey(cpu, "props")); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data) | ||
62 | |||
63 | g_assert(qdict_haskey(props, "node-id")); | ||
64 | node = qdict_get_int(props, "node-id"); | ||
65 | + g_assert(qdict_haskey(props, "socket-id")); | ||
66 | + socket = qdict_get_int(props, "socket-id"); | ||
67 | + g_assert(qdict_haskey(props, "cluster-id")); | ||
68 | + cluster = qdict_get_int(props, "cluster-id"); | ||
69 | + g_assert(qdict_haskey(props, "core-id")); | ||
70 | + core = qdict_get_int(props, "core-id"); | ||
71 | g_assert(qdict_haskey(props, "thread-id")); | ||
72 | thread = qdict_get_int(props, "thread-id"); | ||
73 | |||
74 | - if (thread == 0) { | ||
75 | + if (socket == 0 && cluster == 0 && core == 0 && thread == 0) { | ||
76 | g_assert_cmpint(node, ==, 1); | ||
77 | - } else if (thread == 1) { | ||
78 | + } else if (socket == 1 && cluster == 0 && core == 0 && thread == 0) { | ||
79 | g_assert_cmpint(node, ==, 0); | ||
80 | } else { | ||
81 | g_assert(false); | ||
82 | -- | 39 | -- |
83 | 2.25.1 | 40 | 2.34.1 |
41 | |||
42 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The CPU topology isn't enabled on arm/virt machine yet, but we're | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | going to do it in next patch. After the CPU topology is enabled by | ||
5 | next patch, "thread-id=1" becomes invalid because the CPU core is | ||
6 | preferred on arm/virt machine. It means these two CPUs have 0/1 | ||
7 | as their core IDs, but their thread IDs are all 0. It will trigger | ||
8 | test failure as the following message indicates: | ||
9 | 4 | ||
10 | [14/21 qemu:qtest+qtest-aarch64 / qtest-aarch64/numa-test ERROR | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | 1.48s killed by signal 6 SIGABRT | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | >>> G_TEST_DBUS_DAEMON=/home/gavin/sandbox/qemu.main/tests/dbus-vmstate-daemon.sh \ | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
13 | QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon \ | 8 | Message-id: 20231025065316.56817-8-philmd@linaro.org |
14 | QTEST_QEMU_BINARY=./qemu-system-aarch64 \ | ||
15 | QTEST_QEMU_IMG=./qemu-img MALLOC_PERTURB_=83 \ | ||
16 | /home/gavin/sandbox/qemu.main/build/tests/qtest/numa-test --tap -k | ||
17 | ―――――――――――――――――――――――――――――――――――――――――――――― | ||
18 | stderr: | ||
19 | qemu-system-aarch64: -numa cpu,node-id=0,thread-id=1: no match found | ||
20 | |||
21 | This fixes the issue by providing comprehensive SMP configurations | ||
22 | in aarch64_numa_cpu(). The SMP configurations aren't used before | ||
23 | the CPU topology is enabled in next patch. | ||
24 | |||
25 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
26 | Reviewed-by: Yanan Wang <wangyanan55@huawei.com> | ||
27 | Message-id: 20220503140304.855514-3-gshan@redhat.com | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | --- | 10 | --- |
30 | tests/qtest/numa-test.c | 3 ++- | 11 | include/hw/arm/fsl-imx6ul.h | 1 - |
31 | 1 file changed, 2 insertions(+), 1 deletion(-) | 12 | hw/arm/mcimx6ul-evk.c | 1 + |
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
32 | 14 | ||
33 | diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c | 15 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h |
34 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/tests/qtest/numa-test.c | 17 | --- a/include/hw/arm/fsl-imx6ul.h |
36 | +++ b/tests/qtest/numa-test.c | 18 | +++ b/include/hw/arm/fsl-imx6ul.h |
37 | @@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data) | 19 | @@ -XXX,XX +XXX,XX @@ |
38 | QTestState *qts; | 20 | #ifndef FSL_IMX6UL_H |
39 | g_autofree char *cli = NULL; | 21 | #define FSL_IMX6UL_H |
40 | 22 | ||
41 | - cli = make_cli(data, "-machine smp.cpus=2 " | 23 | -#include "hw/arm/boot.h" |
42 | + cli = make_cli(data, "-machine " | 24 | #include "hw/cpu/a15mpcore.h" |
43 | + "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 " | 25 | #include "hw/misc/imx6ul_ccm.h" |
44 | "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 " | 26 | #include "hw/misc/imx6_src.h" |
45 | "-numa cpu,node-id=1,thread-id=0 " | 27 | diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c |
46 | "-numa cpu,node-id=0,thread-id=1"); | 28 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/hw/arm/mcimx6ul-evk.c | ||
30 | +++ b/hw/arm/mcimx6ul-evk.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "qemu/osdep.h" | ||
33 | #include "qapi/error.h" | ||
34 | #include "hw/arm/fsl-imx6ul.h" | ||
35 | +#include "hw/arm/boot.h" | ||
36 | #include "hw/boards.h" | ||
37 | #include "hw/qdev-properties.h" | ||
38 | #include "qemu/error-report.h" | ||
47 | -- | 39 | -- |
48 | 2.25.1 | 40 | 2.34.1 |
49 | 41 | ||
50 | 42 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This adds cluster-id in CPU instance properties, which will be used | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | by arm/virt machine. Besides, the cluster-id is also verified or | ||
5 | dumped in various spots: | ||
6 | 4 | ||
7 | * hw/core/machine.c::machine_set_cpu_numa_node() to associate | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | CPU with its NUMA node. | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | |
10 | * hw/core/machine.c::machine_numa_finish_cpu_init() to record | 8 | Message-id: 20231025065316.56817-9-philmd@linaro.org |
11 | CPU slots with no NUMA mapping set. | ||
12 | |||
13 | * hw/core/machine-hmp-cmds.c::hmp_hotpluggable_cpus() to dump | ||
14 | cluster-id. | ||
15 | |||
16 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
17 | Reviewed-by: Yanan Wang <wangyanan55@huawei.com> | ||
18 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
19 | Message-id: 20220503140304.855514-2-gshan@redhat.com | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | --- | 10 | --- |
22 | qapi/machine.json | 6 ++++-- | 11 | include/hw/arm/fsl-imx7.h | 1 - |
23 | hw/core/machine-hmp-cmds.c | 4 ++++ | 12 | hw/arm/mcimx7d-sabre.c | 1 + |
24 | hw/core/machine.c | 16 ++++++++++++++++ | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
25 | 3 files changed, 24 insertions(+), 2 deletions(-) | ||
26 | 14 | ||
27 | diff --git a/qapi/machine.json b/qapi/machine.json | 15 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h |
28 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/qapi/machine.json | 17 | --- a/include/hw/arm/fsl-imx7.h |
30 | +++ b/qapi/machine.json | 18 | +++ b/include/hw/arm/fsl-imx7.h |
31 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
32 | # @node-id: NUMA node ID the CPU belongs to | 20 | #ifndef FSL_IMX7_H |
33 | # @socket-id: socket number within node/board the CPU belongs to | 21 | #define FSL_IMX7_H |
34 | # @die-id: die number within socket the CPU belongs to (since 4.1) | 22 | |
35 | -# @core-id: core number within die the CPU belongs to | 23 | -#include "hw/arm/boot.h" |
36 | +# @cluster-id: cluster number within die the CPU belongs to (since 7.1) | 24 | #include "hw/cpu/a15mpcore.h" |
37 | +# @core-id: core number within cluster the CPU belongs to | 25 | #include "hw/intc/imx_gpcv2.h" |
38 | # @thread-id: thread number within core the CPU belongs to | 26 | #include "hw/misc/imx7_ccm.h" |
39 | # | 27 | diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c |
40 | -# Note: currently there are 5 properties that could be present | 28 | index XXXXXXX..XXXXXXX 100644 |
41 | +# Note: currently there are 6 properties that could be present | 29 | --- a/hw/arm/mcimx7d-sabre.c |
42 | # but management should be prepared to pass through other | 30 | +++ b/hw/arm/mcimx7d-sabre.c |
43 | # properties with device_add command to allow for future | ||
44 | # interface extension. This also requires the filed names to be kept in | ||
45 | @@ -XXX,XX +XXX,XX @@ | 31 | @@ -XXX,XX +XXX,XX @@ |
46 | 'data': { '*node-id': 'int', | 32 | #include "qemu/osdep.h" |
47 | '*socket-id': 'int', | 33 | #include "qapi/error.h" |
48 | '*die-id': 'int', | 34 | #include "hw/arm/fsl-imx7.h" |
49 | + '*cluster-id': 'int', | 35 | +#include "hw/arm/boot.h" |
50 | '*core-id': 'int', | 36 | #include "hw/boards.h" |
51 | '*thread-id': 'int' | 37 | #include "hw/qdev-properties.h" |
52 | } | 38 | #include "qemu/error-report.h" |
53 | diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/core/machine-hmp-cmds.c | ||
56 | +++ b/hw/core/machine-hmp-cmds.c | ||
57 | @@ -XXX,XX +XXX,XX @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) | ||
58 | if (c->has_die_id) { | ||
59 | monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id); | ||
60 | } | ||
61 | + if (c->has_cluster_id) { | ||
62 | + monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n", | ||
63 | + c->cluster_id); | ||
64 | + } | ||
65 | if (c->has_core_id) { | ||
66 | monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); | ||
67 | } | ||
68 | diff --git a/hw/core/machine.c b/hw/core/machine.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/hw/core/machine.c | ||
71 | +++ b/hw/core/machine.c | ||
72 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | + if (props->has_cluster_id && !slot->props.has_cluster_id) { | ||
77 | + error_setg(errp, "cluster-id is not supported"); | ||
78 | + return; | ||
79 | + } | ||
80 | + | ||
81 | if (props->has_socket_id && !slot->props.has_socket_id) { | ||
82 | error_setg(errp, "socket-id is not supported"); | ||
83 | return; | ||
84 | @@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine, | ||
85 | continue; | ||
86 | } | ||
87 | |||
88 | + if (props->has_cluster_id && | ||
89 | + props->cluster_id != slot->props.cluster_id) { | ||
90 | + continue; | ||
91 | + } | ||
92 | + | ||
93 | if (props->has_die_id && props->die_id != slot->props.die_id) { | ||
94 | continue; | ||
95 | } | ||
96 | @@ -XXX,XX +XXX,XX @@ static char *cpu_slot_to_string(const CPUArchId *cpu) | ||
97 | } | ||
98 | g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id); | ||
99 | } | ||
100 | + if (cpu->props.has_cluster_id) { | ||
101 | + if (s->len) { | ||
102 | + g_string_append_printf(s, ", "); | ||
103 | + } | ||
104 | + g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id); | ||
105 | + } | ||
106 | if (cpu->props.has_core_id) { | ||
107 | if (s->len) { | ||
108 | g_string_append_printf(s, ", "); | ||
109 | -- | 39 | -- |
110 | 2.25.1 | 40 | 2.34.1 |
41 | |||
42 | diff view generated by jsdifflib |
1 | From: Leif Lindholm <quic_llindhol@quicinc.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The sbsa-ref machine is continuously evolving. Some of the changes we | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | want to make in the near future, to align with real components (e.g. | ||
5 | the GIC-700), will break compatibility for existing firmware. | ||
6 | 4 | ||
7 | Introduce two new properties to the DT generated on machine generation: | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | - machine-version-major | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | To be incremented when a platform change makes the machine | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
10 | incompatible with existing firmware. | 8 | Message-id: 20231025065316.56817-10-philmd@linaro.org |
11 | - machine-version-minor | ||
12 | To be incremented when functionality is added to the machine | ||
13 | without causing incompatibility with existing firmware. | ||
14 | to be reset to 0 when machine-version-major is incremented. | ||
15 | |||
16 | This versioning scheme is *neither*: | ||
17 | - A QEMU versioned machine type; a given version of QEMU will emulate | ||
18 | a given version of the platform. | ||
19 | - A reflection of level of SBSA (now SystemReady SR) support provided. | ||
20 | |||
21 | The version will increment on guest-visible functional changes only, | ||
22 | akin to a revision ID register found on a physical platform. | ||
23 | |||
24 | These properties are both introduced with the value 0. | ||
25 | (Hence, a machine where the DT is lacking these nodes is equivalent | ||
26 | to version 0.0.) | ||
27 | |||
28 | Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> | ||
29 | Message-id: 20220505113947.75714-1-quic_llindhol@quicinc.com | ||
30 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
31 | Cc: Radoslaw Biernacki <rad@semihalf.com> | ||
32 | Cc: Cédric Le Goater <clg@kaod.org> | ||
33 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
34 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
35 | --- | 10 | --- |
36 | hw/arm/sbsa-ref.c | 14 ++++++++++++++ | 11 | include/hw/arm/xlnx-versal.h | 1 - |
37 | 1 file changed, 14 insertions(+) | 12 | hw/arm/xlnx-versal-virt.c | 1 + |
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
38 | 14 | ||
39 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | 15 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h |
40 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/hw/arm/sbsa-ref.c | 17 | --- a/include/hw/arm/xlnx-versal.h |
42 | +++ b/hw/arm/sbsa-ref.c | 18 | +++ b/include/hw/arm/xlnx-versal.h |
43 | @@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms) | 19 | @@ -XXX,XX +XXX,XX @@ |
44 | qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2); | 20 | #define XLNX_VERSAL_H |
45 | qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); | 21 | |
46 | 22 | #include "hw/sysbus.h" | |
47 | + /* | 23 | -#include "hw/arm/boot.h" |
48 | + * This versioning scheme is for informing platform fw only. It is neither: | 24 | #include "hw/cpu/cluster.h" |
49 | + * - A QEMU versioned machine type; a given version of QEMU will emulate | 25 | #include "hw/or-irq.h" |
50 | + * a given version of the platform. | 26 | #include "hw/sd/sdhci.h" |
51 | + * - A reflection of level of SBSA (now SystemReady SR) support provided. | 27 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c |
52 | + * | 28 | index XXXXXXX..XXXXXXX 100644 |
53 | + * machine-version-major: updated when changes breaking fw compatibility | 29 | --- a/hw/arm/xlnx-versal-virt.c |
54 | + * are introduced. | 30 | +++ b/hw/arm/xlnx-versal-virt.c |
55 | + * machine-version-minor: updated when features are added that don't break | 31 | @@ -XXX,XX +XXX,XX @@ |
56 | + * fw compatibility. | 32 | #include "cpu.h" |
57 | + */ | 33 | #include "hw/qdev-properties.h" |
58 | + qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0); | 34 | #include "hw/arm/xlnx-versal.h" |
59 | + qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0); | 35 | +#include "hw/arm/boot.h" |
60 | + | 36 | #include "qom/object.h" |
61 | if (ms->numa_state->have_numa_distance) { | 37 | |
62 | int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); | 38 | #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") |
63 | uint32_t *matrix = g_malloc0(size); | ||
64 | -- | 39 | -- |
65 | 2.25.1 | 40 | 2.34.1 |
66 | 41 | ||
67 | 42 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This extension concerns not merging memory access, which TCG does | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | not implement. Thus we can trivially enable this feature. | ||
5 | Add a comment to handle_hint for the DGH instruction, but no code. | ||
6 | 4 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20220506180242.216785-23-richard.henderson@linaro.org | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
8 | Message-id: 20231025065316.56817-11-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | docs/system/arm/emulation.rst | 1 + | 11 | include/hw/arm/xlnx-zynqmp.h | 1 - |
13 | target/arm/cpu64.c | 1 + | 12 | hw/arm/xlnx-zcu102.c | 1 + |
14 | target/arm/translate-a64.c | 1 + | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
15 | 3 files changed, 3 insertions(+) | ||
16 | 14 | ||
17 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 15 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/docs/system/arm/emulation.rst | 17 | --- a/include/hw/arm/xlnx-zynqmp.h |
20 | +++ b/docs/system/arm/emulation.rst | 18 | +++ b/include/hw/arm/xlnx-zynqmp.h |
21 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 19 | @@ -XXX,XX +XXX,XX @@ |
22 | - FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) | 20 | #ifndef XLNX_ZYNQMP_H |
23 | - FEAT_CSV2_2 (Cache speculation variant 2, version 2) | 21 | #define XLNX_ZYNQMP_H |
24 | - FEAT_CSV3 (Cache speculation variant 3) | 22 | |
25 | +- FEAT_DGH (Data gathering hint) | 23 | -#include "hw/arm/boot.h" |
26 | - FEAT_DIT (Data Independent Timing instructions) | 24 | #include "hw/intc/arm_gic.h" |
27 | - FEAT_DPB (DC CVAP instruction) | 25 | #include "hw/net/cadence_gem.h" |
28 | - FEAT_Debugv8p2 (Debug changes for v8.2) | 26 | #include "hw/char/cadence_uart.h" |
29 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 27 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c |
30 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/target/arm/cpu64.c | 29 | --- a/hw/arm/xlnx-zcu102.c |
32 | +++ b/target/arm/cpu64.c | 30 | +++ b/hw/arm/xlnx-zcu102.c |
33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 31 | @@ -XXX,XX +XXX,XX @@ |
34 | t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */ | 32 | #include "qemu/osdep.h" |
35 | t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */ | 33 | #include "qapi/error.h" |
36 | t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */ | 34 | #include "hw/arm/xlnx-zynqmp.h" |
37 | + t = FIELD_DP64(t, ID_AA64ISAR1, DGH, 1); /* FEAT_DGH */ | 35 | +#include "hw/arm/boot.h" |
38 | t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */ | 36 | #include "hw/boards.h" |
39 | cpu->isar.id_aa64isar1 = t; | 37 | #include "qemu/error-report.h" |
40 | 38 | #include "qemu/log.h" | |
41 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/target/arm/translate-a64.c | ||
44 | +++ b/target/arm/translate-a64.c | ||
45 | @@ -XXX,XX +XXX,XX @@ static void handle_hint(DisasContext *s, uint32_t insn, | ||
46 | break; | ||
47 | case 0b00100: /* SEV */ | ||
48 | case 0b00101: /* SEVL */ | ||
49 | + case 0b00110: /* DGH */ | ||
50 | /* we treat all as NOP at least for now */ | ||
51 | break; | ||
52 | case 0b00111: /* XPACLRI */ | ||
53 | -- | 39 | -- |
54 | 2.25.1 | 40 | 2.34.1 |
41 | |||
42 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This extension concerns changes to the External Debug interface, | 3 | sysbus_mmio_map() and sysbus_connect_irq() should not be |
4 | with Secure and Non-secure access to the debug registers, and all | 4 | called on unrealized device. |
5 | of it is outside the scope of QEMU. Indicating support for this | ||
6 | is mandatory with FEAT_SEL2, which we do implement. | ||
7 | 5 | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
10 | Message-id: 20220506180242.216785-13-richard.henderson@linaro.org | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20231020130331.50048-2-philmd@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | docs/system/arm/emulation.rst | 1 + | 12 | hw/sd/pxa2xx_mmci.c | 2 +- |
14 | target/arm/cpu64.c | 2 +- | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | target/arm/cpu_tcg.c | 4 ++-- | ||
16 | 3 files changed, 4 insertions(+), 3 deletions(-) | ||
17 | 14 | ||
18 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 15 | diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/docs/system/arm/emulation.rst | 17 | --- a/hw/sd/pxa2xx_mmci.c |
21 | +++ b/docs/system/arm/emulation.rst | 18 | +++ b/hw/sd/pxa2xx_mmci.c |
22 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 19 | @@ -XXX,XX +XXX,XX @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, |
23 | - FEAT_DIT (Data Independent Timing instructions) | 20 | |
24 | - FEAT_DPB (DC CVAP instruction) | 21 | dev = qdev_new(TYPE_PXA2XX_MMCI); |
25 | - FEAT_Debugv8p2 (Debug changes for v8.2) | 22 | sbd = SYS_BUS_DEVICE(dev); |
26 | +- FEAT_Debugv8p4 (Debug changes for v8.4) | 23 | + sysbus_realize_and_unref(sbd, &error_fatal); |
27 | - FEAT_DotProd (Advanced SIMD dot product instructions) | 24 | sysbus_mmio_map(sbd, 0, base); |
28 | - FEAT_FCMA (Floating-point complex number instructions) | 25 | sysbus_connect_irq(sbd, 0, irq); |
29 | - FEAT_FHM (Floating-point half-precision multiplication instructions) | 26 | qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); |
30 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 27 | qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); |
31 | index XXXXXXX..XXXXXXX 100644 | 28 | - sysbus_realize_and_unref(sbd, &error_fatal); |
32 | --- a/target/arm/cpu64.c | 29 | |
33 | +++ b/target/arm/cpu64.c | 30 | return PXA2XX_MMCI(dev); |
34 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
35 | cpu->isar.id_aa64zfr0 = t; | ||
36 | |||
37 | t = cpu->isar.id_aa64dfr0; | ||
38 | - t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */ | ||
39 | + t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */ | ||
40 | t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ | ||
41 | cpu->isar.id_aa64dfr0 = t; | ||
42 | |||
43 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/target/arm/cpu_tcg.c | ||
46 | +++ b/target/arm/cpu_tcg.c | ||
47 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
48 | cpu->isar.id_pfr2 = t; | ||
49 | |||
50 | t = cpu->isar.id_dfr0; | ||
51 | - t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */ | ||
52 | - t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */ | ||
53 | + t = FIELD_DP32(t, ID_DFR0, COPDBG, 9); /* FEAT_Debugv8p4 */ | ||
54 | + t = FIELD_DP32(t, ID_DFR0, COPSDBG, 9); /* FEAT_Debugv8p4 */ | ||
55 | t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ | ||
56 | cpu->isar.id_dfr0 = t; | ||
57 | } | 31 | } |
58 | -- | 32 | -- |
59 | 2.25.1 | 33 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This extension concerns cache speculation, which TCG does | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | not implement. Thus we can trivially enable this feature. | 4 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
5 | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Message-id: 20231020130331.50048-3-philmd@linaro.org |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220506180242.216785-22-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 8 | --- |
11 | docs/system/arm/emulation.rst | 1 + | 9 | hw/sd/pxa2xx_mmci.c | 7 +------ |
12 | target/arm/cpu64.c | 1 + | 10 | 1 file changed, 1 insertion(+), 6 deletions(-) |
13 | target/arm/cpu_tcg.c | 1 + | ||
14 | 3 files changed, 3 insertions(+) | ||
15 | 11 | ||
16 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 12 | diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/docs/system/arm/emulation.rst | 14 | --- a/hw/sd/pxa2xx_mmci.c |
19 | +++ b/docs/system/arm/emulation.rst | 15 | +++ b/hw/sd/pxa2xx_mmci.c |
20 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 16 | @@ -XXX,XX +XXX,XX @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, |
21 | - FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1) | 17 | qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma) |
22 | - FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) | 18 | { |
23 | - FEAT_CSV2_2 (Cache speculation variant 2, version 2) | 19 | DeviceState *dev; |
24 | +- FEAT_CSV3 (Cache speculation variant 3) | 20 | - SysBusDevice *sbd; |
25 | - FEAT_DIT (Data Independent Timing instructions) | 21 | |
26 | - FEAT_DPB (DC CVAP instruction) | 22 | - dev = qdev_new(TYPE_PXA2XX_MMCI); |
27 | - FEAT_Debugv8p2 (Debug changes for v8.2) | 23 | - sbd = SYS_BUS_DEVICE(dev); |
28 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 24 | - sysbus_realize_and_unref(sbd, &error_fatal); |
29 | index XXXXXXX..XXXXXXX 100644 | 25 | - sysbus_mmio_map(sbd, 0, base); |
30 | --- a/target/arm/cpu64.c | 26 | - sysbus_connect_irq(sbd, 0, irq); |
31 | +++ b/target/arm/cpu64.c | 27 | + dev = sysbus_create_simple(TYPE_PXA2XX_MMCI, base, irq); |
32 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 28 | qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); |
33 | t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | 29 | qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); |
34 | t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | ||
35 | t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */ | ||
36 | + t = FIELD_DP64(t, ID_AA64PFR0, CSV3, 1); /* FEAT_CSV3 */ | ||
37 | cpu->isar.id_aa64pfr0 = t; | ||
38 | |||
39 | t = cpu->isar.id_aa64pfr1; | ||
40 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/cpu_tcg.c | ||
43 | +++ b/target/arm/cpu_tcg.c | ||
44 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
45 | cpu->isar.id_pfr0 = t; | ||
46 | |||
47 | t = cpu->isar.id_pfr2; | ||
48 | + t = FIELD_DP32(t, ID_PFR2, CSV3, 1); /* FEAT_CSV3 */ | ||
49 | t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */ | ||
50 | cpu->isar.id_pfr2 = t; | ||
51 | 30 | ||
52 | -- | 31 | -- |
53 | 2.25.1 | 32 | 2.34.1 |
33 | |||
34 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When the PPTT table is built, the CPU topology is re-calculated, but | 3 | sysbus_mmio_map() should not be called on unrealized device. |
4 | it's unecessary because the CPU topology has been populated in | ||
5 | virt_possible_cpu_arch_ids() on arm/virt machine. | ||
6 | 4 | ||
7 | This reworks build_pptt() to avoid by reusing the existing IDs in | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | ms->possible_cpus. Currently, the only user of build_pptt() is | 6 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | arm/virt machine. | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | 8 | Message-id: 20231020130331.50048-4-philmd@linaro.org | |
11 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
12 | Tested-by: Yanan Wang <wangyanan55@huawei.com> | ||
13 | Reviewed-by: Yanan Wang <wangyanan55@huawei.com> | ||
14 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
15 | Acked-by: Michael S. Tsirkin <mst@redhat.com> | ||
16 | Message-id: 20220503140304.855514-7-gshan@redhat.com | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 10 | --- |
19 | hw/acpi/aml-build.c | 111 +++++++++++++++++++------------------------- | 11 | hw/pcmcia/pxa2xx.c | 7 ++----- |
20 | 1 file changed, 48 insertions(+), 63 deletions(-) | 12 | 1 file changed, 2 insertions(+), 5 deletions(-) |
21 | 13 | ||
22 | diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c | 14 | diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/hw/acpi/aml-build.c | 16 | --- a/hw/pcmcia/pxa2xx.c |
25 | +++ b/hw/acpi/aml-build.c | 17 | +++ b/hw/pcmcia/pxa2xx.c |
26 | @@ -XXX,XX +XXX,XX @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, | 18 | @@ -XXX,XX +XXX,XX @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, |
27 | const char *oem_id, const char *oem_table_id) | 19 | hwaddr base) |
28 | { | 20 | { |
29 | MachineClass *mc = MACHINE_GET_CLASS(ms); | 21 | DeviceState *dev; |
30 | - GQueue *list = g_queue_new(); | 22 | - PXA2xxPCMCIAState *s; |
31 | - guint pptt_start = table_data->len; | 23 | |
32 | - guint parent_offset; | 24 | dev = qdev_new(TYPE_PXA2XX_PCMCIA); |
33 | - guint length, i; | 25 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
34 | - int uid = 0; | 26 | - s = PXA2XX_PCMCIA(dev); |
35 | - int socket; | ||
36 | + CPUArchIdList *cpus = ms->possible_cpus; | ||
37 | + int64_t socket_id = -1, cluster_id = -1, core_id = -1; | ||
38 | + uint32_t socket_offset = 0, cluster_offset = 0, core_offset = 0; | ||
39 | + uint32_t pptt_start = table_data->len; | ||
40 | + int n; | ||
41 | AcpiTable table = { .sig = "PPTT", .rev = 2, | ||
42 | .oem_id = oem_id, .oem_table_id = oem_table_id }; | ||
43 | |||
44 | acpi_table_begin(&table, table_data); | ||
45 | |||
46 | - for (socket = 0; socket < ms->smp.sockets; socket++) { | ||
47 | - g_queue_push_tail(list, | ||
48 | - GUINT_TO_POINTER(table_data->len - pptt_start)); | ||
49 | - build_processor_hierarchy_node( | ||
50 | - table_data, | ||
51 | - /* | ||
52 | - * Physical package - represents the boundary | ||
53 | - * of a physical package | ||
54 | - */ | ||
55 | - (1 << 0), | ||
56 | - 0, socket, NULL, 0); | ||
57 | - } | ||
58 | - | 27 | - |
59 | - if (mc->smp_props.clusters_supported) { | 28 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
60 | - length = g_queue_get_length(list); | 29 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
61 | - for (i = 0; i < length; i++) { | 30 | |
62 | - int cluster; | 31 | - return s; |
63 | - | 32 | + return PXA2XX_PCMCIA(dev); |
64 | - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); | ||
65 | - for (cluster = 0; cluster < ms->smp.clusters; cluster++) { | ||
66 | - g_queue_push_tail(list, | ||
67 | - GUINT_TO_POINTER(table_data->len - pptt_start)); | ||
68 | - build_processor_hierarchy_node( | ||
69 | - table_data, | ||
70 | - (0 << 0), /* not a physical package */ | ||
71 | - parent_offset, cluster, NULL, 0); | ||
72 | - } | ||
73 | + /* | ||
74 | + * This works with the assumption that cpus[n].props.*_id has been | ||
75 | + * sorted from top to down levels in mc->possible_cpu_arch_ids(). | ||
76 | + * Otherwise, the unexpected and duplicated containers will be | ||
77 | + * created. | ||
78 | + */ | ||
79 | + for (n = 0; n < cpus->len; n++) { | ||
80 | + if (cpus->cpus[n].props.socket_id != socket_id) { | ||
81 | + assert(cpus->cpus[n].props.socket_id > socket_id); | ||
82 | + socket_id = cpus->cpus[n].props.socket_id; | ||
83 | + cluster_id = -1; | ||
84 | + core_id = -1; | ||
85 | + socket_offset = table_data->len - pptt_start; | ||
86 | + build_processor_hierarchy_node(table_data, | ||
87 | + (1 << 0), /* Physical package */ | ||
88 | + 0, socket_id, NULL, 0); | ||
89 | } | ||
90 | - } | ||
91 | |||
92 | - length = g_queue_get_length(list); | ||
93 | - for (i = 0; i < length; i++) { | ||
94 | - int core; | ||
95 | - | ||
96 | - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); | ||
97 | - for (core = 0; core < ms->smp.cores; core++) { | ||
98 | - if (ms->smp.threads > 1) { | ||
99 | - g_queue_push_tail(list, | ||
100 | - GUINT_TO_POINTER(table_data->len - pptt_start)); | ||
101 | - build_processor_hierarchy_node( | ||
102 | - table_data, | ||
103 | - (0 << 0), /* not a physical package */ | ||
104 | - parent_offset, core, NULL, 0); | ||
105 | - } else { | ||
106 | - build_processor_hierarchy_node( | ||
107 | - table_data, | ||
108 | - (1 << 1) | /* ACPI Processor ID valid */ | ||
109 | - (1 << 3), /* Node is a Leaf */ | ||
110 | - parent_offset, uid++, NULL, 0); | ||
111 | + if (mc->smp_props.clusters_supported) { | ||
112 | + if (cpus->cpus[n].props.cluster_id != cluster_id) { | ||
113 | + assert(cpus->cpus[n].props.cluster_id > cluster_id); | ||
114 | + cluster_id = cpus->cpus[n].props.cluster_id; | ||
115 | + core_id = -1; | ||
116 | + cluster_offset = table_data->len - pptt_start; | ||
117 | + build_processor_hierarchy_node(table_data, | ||
118 | + (0 << 0), /* Not a physical package */ | ||
119 | + socket_offset, cluster_id, NULL, 0); | ||
120 | } | ||
121 | + } else { | ||
122 | + cluster_offset = socket_offset; | ||
123 | } | ||
124 | - } | ||
125 | |||
126 | - length = g_queue_get_length(list); | ||
127 | - for (i = 0; i < length; i++) { | ||
128 | - int thread; | ||
129 | + if (ms->smp.threads == 1) { | ||
130 | + build_processor_hierarchy_node(table_data, | ||
131 | + (1 << 1) | /* ACPI Processor ID valid */ | ||
132 | + (1 << 3), /* Node is a Leaf */ | ||
133 | + cluster_offset, n, NULL, 0); | ||
134 | + } else { | ||
135 | + if (cpus->cpus[n].props.core_id != core_id) { | ||
136 | + assert(cpus->cpus[n].props.core_id > core_id); | ||
137 | + core_id = cpus->cpus[n].props.core_id; | ||
138 | + core_offset = table_data->len - pptt_start; | ||
139 | + build_processor_hierarchy_node(table_data, | ||
140 | + (0 << 0), /* Not a physical package */ | ||
141 | + cluster_offset, core_id, NULL, 0); | ||
142 | + } | ||
143 | |||
144 | - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); | ||
145 | - for (thread = 0; thread < ms->smp.threads; thread++) { | ||
146 | - build_processor_hierarchy_node( | ||
147 | - table_data, | ||
148 | + build_processor_hierarchy_node(table_data, | ||
149 | (1 << 1) | /* ACPI Processor ID valid */ | ||
150 | (1 << 2) | /* Processor is a Thread */ | ||
151 | (1 << 3), /* Node is a Leaf */ | ||
152 | - parent_offset, uid++, NULL, 0); | ||
153 | + core_offset, n, NULL, 0); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | - g_queue_free(list); | ||
158 | acpi_table_end(linker, &table); | ||
159 | } | 33 | } |
160 | 34 | ||
35 | static void pxa2xx_pcmcia_initfn(Object *obj) | ||
161 | -- | 36 | -- |
162 | 2.25.1 | 37 | 2.34.1 |
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The only portion of FEAT_Debugv8p2 that is relevant to QEMU | 3 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
4 | is CONTEXTIDR_EL2, which is also conditionally implemented | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | with FEAT_VHE. The rest of the debug extension concerns the | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | External debug interface, which is outside the scope of QEMU. | 6 | Message-id: 20231020130331.50048-5-philmd@linaro.org |
7 | |||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20220506180242.216785-12-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 8 | --- |
13 | docs/system/arm/emulation.rst | 1 + | 9 | hw/pcmcia/pxa2xx.c | 4 +--- |
14 | target/arm/cpu.c | 1 + | 10 | 1 file changed, 1 insertion(+), 3 deletions(-) |
15 | target/arm/cpu64.c | 1 + | ||
16 | target/arm/cpu_tcg.c | 2 ++ | ||
17 | 4 files changed, 5 insertions(+) | ||
18 | 11 | ||
19 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 12 | diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/docs/system/arm/emulation.rst | 14 | --- a/hw/pcmcia/pxa2xx.c |
22 | +++ b/docs/system/arm/emulation.rst | 15 | +++ b/hw/pcmcia/pxa2xx.c |
23 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 16 | @@ -XXX,XX +XXX,XX @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, |
24 | - FEAT_BTI (Branch Target Identification) | 17 | { |
25 | - FEAT_DIT (Data Independent Timing instructions) | 18 | DeviceState *dev; |
26 | - FEAT_DPB (DC CVAP instruction) | 19 | |
27 | +- FEAT_Debugv8p2 (Debug changes for v8.2) | 20 | - dev = qdev_new(TYPE_PXA2XX_PCMCIA); |
28 | - FEAT_DotProd (Advanced SIMD dot product instructions) | 21 | - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
29 | - FEAT_FCMA (Floating-point complex number instructions) | 22 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
30 | - FEAT_FHM (Floating-point half-precision multiplication instructions) | 23 | + dev = sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL); |
31 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 24 | |
32 | index XXXXXXX..XXXXXXX 100644 | 25 | return PXA2XX_PCMCIA(dev); |
33 | --- a/target/arm/cpu.c | ||
34 | +++ b/target/arm/cpu.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
36 | * feature registers as well. | ||
37 | */ | ||
38 | cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0); | ||
39 | + cpu->isar.id_dfr0 = FIELD_DP32(cpu->isar.id_dfr0, ID_DFR0, COPSDBG, 0); | ||
40 | cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, | ||
41 | ID_AA64PFR0, EL3, 0); | ||
42 | } | ||
43 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/target/arm/cpu64.c | ||
46 | +++ b/target/arm/cpu64.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
48 | cpu->isar.id_aa64zfr0 = t; | ||
49 | |||
50 | t = cpu->isar.id_aa64dfr0; | ||
51 | + t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */ | ||
52 | t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ | ||
53 | cpu->isar.id_aa64dfr0 = t; | ||
54 | |||
55 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/target/arm/cpu_tcg.c | ||
58 | +++ b/target/arm/cpu_tcg.c | ||
59 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
60 | cpu->isar.id_pfr2 = t; | ||
61 | |||
62 | t = cpu->isar.id_dfr0; | ||
63 | + t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */ | ||
64 | + t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */ | ||
65 | t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ | ||
66 | cpu->isar.id_dfr0 = t; | ||
67 | } | 26 | } |
68 | -- | 27 | -- |
69 | 2.25.1 | 28 | 2.34.1 |
29 | |||
30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Update the legacy feature names to the current names. | 3 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
4 | Provide feature names for id changes that were not marked. | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Sort the field updates into increasing bitfield order. | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | 6 | Message-id: 20231020130331.50048-6-philmd@linaro.org | |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220506180242.216785-10-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 8 | --- |
12 | target/arm/cpu64.c | 100 +++++++++++++++++++++---------------------- | 9 | include/hw/arm/pxa.h | 2 -- |
13 | target/arm/cpu_tcg.c | 48 ++++++++++----------- | 10 | hw/arm/pxa2xx.c | 12 ++++++++---- |
14 | 2 files changed, 74 insertions(+), 74 deletions(-) | 11 | hw/pcmcia/pxa2xx.c | 10 ---------- |
12 | 3 files changed, 8 insertions(+), 16 deletions(-) | ||
15 | 13 | ||
16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 14 | diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu64.c | 16 | --- a/include/hw/arm/pxa.h |
19 | +++ b/target/arm/cpu64.c | 17 | +++ b/include/hw/arm/pxa.h |
20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 18 | @@ -XXX,XX +XXX,XX @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly, |
21 | cpu->midr = t; | 19 | #define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia" |
22 | 20 | OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxPCMCIAState, PXA2XX_PCMCIA) | |
23 | t = cpu->isar.id_aa64isar0; | 21 | |
24 | - t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | 22 | -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, |
25 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | 23 | - hwaddr base); |
26 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ | 24 | int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card); |
27 | + t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* FEAT_PMULL */ | 25 | int pxa2xx_pcmcia_detach(void *opaque); |
28 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* FEAT_SHA1 */ | 26 | void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq); |
29 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* FEAT_SHA512 */ | 27 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c |
30 | t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
31 | - t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); | ||
32 | - t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); | ||
33 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); | ||
34 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); | ||
35 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
36 | - t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
37 | - t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
38 | - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
39 | - t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
40 | - t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); | ||
41 | + t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* FEAT_LSE */ | ||
42 | + t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* FEAT_RDM */ | ||
43 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* FEAT_SHA3 */ | ||
44 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* FEAT_SM3 */ | ||
45 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); /* FEAT_SM4 */ | ||
46 | + t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); /* FEAT_DotProd */ | ||
47 | + t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); /* FEAT_FHM */ | ||
48 | + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* FEAT_FlagM2 */ | ||
49 | + t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
50 | + t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); /* FEAT_RNG */ | ||
51 | cpu->isar.id_aa64isar0 = t; | ||
52 | |||
53 | t = cpu->isar.id_aa64isar1; | ||
54 | - t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); | ||
55 | - t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); | ||
56 | - t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); | ||
57 | - t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
58 | - t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
59 | - t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); | ||
60 | - t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
61 | - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | ||
62 | - t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); | ||
63 | + t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); /* FEAT_DPB2 */ | ||
64 | + t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); /* FEAT_JSCVT */ | ||
65 | + t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); /* FEAT_FCMA */ | ||
66 | + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* FEAT_LRCPC2 */ | ||
67 | + t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); /* FEAT_FRINTTS */ | ||
68 | + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */ | ||
69 | + t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */ | ||
70 | + t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */ | ||
71 | + t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */ | ||
72 | cpu->isar.id_aa64isar1 = t; | ||
73 | |||
74 | t = cpu->isar.id_aa64pfr0; | ||
75 | + t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */ | ||
76 | + t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */ | ||
77 | t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
78 | - t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); | ||
79 | - t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | ||
80 | - t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); | ||
81 | - t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); | ||
82 | + t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | ||
83 | + t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | ||
84 | cpu->isar.id_aa64pfr0 = t; | ||
85 | |||
86 | t = cpu->isar.id_aa64pfr1; | ||
87 | - t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); | ||
88 | - t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); | ||
89 | + t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); /* FEAT_BTI */ | ||
90 | + t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); /* FEAT_SSBS2 */ | ||
91 | /* | ||
92 | * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
93 | * during realize if the board provides no tag memory, much like | ||
94 | * we do for EL2 with the virtualization=on property. | ||
95 | */ | ||
96 | - t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); | ||
97 | + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ | ||
98 | cpu->isar.id_aa64pfr1 = t; | ||
99 | |||
100 | t = cpu->isar.id_aa64mmfr0; | ||
101 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
102 | cpu->isar.id_aa64mmfr0 = t; | ||
103 | |||
104 | t = cpu->isar.id_aa64mmfr1; | ||
105 | - t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
106 | - t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
107 | - t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
108 | - t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
109 | - t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
110 | - t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
111 | + t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */ | ||
112 | + t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */ | ||
113 | + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */ | ||
114 | + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */ | ||
115 | + t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* FEAT_PAN2 */ | ||
116 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */ | ||
117 | cpu->isar.id_aa64mmfr1 = t; | ||
118 | |||
119 | t = cpu->isar.id_aa64mmfr2; | ||
120 | - t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | ||
121 | - t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | ||
122 | - t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ | ||
123 | - t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ | ||
124 | - t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ | ||
125 | - t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ | ||
126 | + t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */ | ||
127 | + t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */ | ||
128 | + t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ | ||
129 | + t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ | ||
130 | + t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ | ||
131 | + t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ | ||
132 | cpu->isar.id_aa64mmfr2 = t; | ||
133 | |||
134 | t = cpu->isar.id_aa64zfr0; | ||
135 | t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
136 | - t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ | ||
137 | - t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); | ||
138 | - t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); | ||
139 | - t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); | ||
140 | - t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); | ||
141 | - t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); | ||
142 | - t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); | ||
143 | - t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
144 | + t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* FEAT_SVE_PMULL128 */ | ||
145 | + t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* FEAT_SVE_BitPerm */ | ||
146 | + t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); /* FEAT_BF16 */ | ||
147 | + t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* FEAT_SVE_SHA3 */ | ||
148 | + t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* FEAT_SVE_SM4 */ | ||
149 | + t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* FEAT_I8MM */ | ||
150 | + t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* FEAT_F32MM */ | ||
151 | + t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* FEAT_F64MM */ | ||
152 | cpu->isar.id_aa64zfr0 = t; | ||
153 | |||
154 | t = cpu->isar.id_aa64dfr0; | ||
155 | - t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
156 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ | ||
157 | cpu->isar.id_aa64dfr0 = t; | ||
158 | |||
159 | /* Replicate the same data to the 32-bit id registers. */ | ||
160 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
161 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
162 | --- a/target/arm/cpu_tcg.c | 29 | --- a/hw/arm/pxa2xx.c |
163 | +++ b/target/arm/cpu_tcg.c | 30 | +++ b/hw/arm/pxa2xx.c |
164 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | 31 | @@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *cpu_type) |
165 | 32 | sysbus_create_simple("sysbus-ohci", 0x4c000000, | |
166 | /* Add additional features supported by QEMU */ | 33 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); |
167 | t = cpu->isar.id_isar5; | 34 | |
168 | - t = FIELD_DP32(t, ID_ISAR5, AES, 2); | 35 | - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); |
169 | - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); | 36 | - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); |
170 | - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); | 37 | + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
171 | + t = FIELD_DP32(t, ID_ISAR5, AES, 2); /* FEAT_PMULL */ | 38 | + 0x20000000, NULL)); |
172 | + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); /* FEAT_SHA1 */ | 39 | + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
173 | + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); /* FEAT_SHA256 */ | 40 | + 0x30000000, NULL)); |
174 | t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); | 41 | |
175 | - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); | 42 | sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, |
176 | - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); | 43 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); |
177 | + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); /* FEAT_RDM */ | 44 | @@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa255_init(unsigned int sdram_size) |
178 | + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); /* FEAT_FCMA */ | 45 | s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); |
179 | cpu->isar.id_isar5 = t; | 46 | } |
180 | 47 | ||
181 | t = cpu->isar.id_isar6; | 48 | - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); |
182 | - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | 49 | - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); |
183 | - t = FIELD_DP32(t, ID_ISAR6, DP, 1); | 50 | + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
184 | - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | 51 | + 0x20000000, NULL)); |
185 | - t = FIELD_DP32(t, ID_ISAR6, SB, 1); | 52 | + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
186 | - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | 53 | + 0x30000000, NULL)); |
187 | - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); | 54 | |
188 | - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); | 55 | sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, |
189 | + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); /* FEAT_JSCVT */ | 56 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); |
190 | + t = FIELD_DP32(t, ID_ISAR6, DP, 1); /* Feat_DotProd */ | 57 | diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c |
191 | + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); /* FEAT_FHM */ | 58 | index XXXXXXX..XXXXXXX 100644 |
192 | + t = FIELD_DP32(t, ID_ISAR6, SB, 1); /* FEAT_SB */ | 59 | --- a/hw/pcmcia/pxa2xx.c |
193 | + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); /* FEAT_SPECRES */ | 60 | +++ b/hw/pcmcia/pxa2xx.c |
194 | + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); /* FEAT_AA32BF16 */ | 61 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level) |
195 | + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); /* FEAT_AA32I8MM */ | 62 | qemu_set_irq(s->irq, level); |
196 | cpu->isar.id_isar6 = t; | ||
197 | |||
198 | t = cpu->isar.mvfr1; | ||
199 | - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
200 | - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
201 | + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* FEAT_FP16 */ | ||
202 | + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* FEAT_FP16 */ | ||
203 | cpu->isar.mvfr1 = t; | ||
204 | |||
205 | t = cpu->isar.mvfr2; | ||
206 | - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
207 | - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
208 | + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
209 | + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
210 | cpu->isar.mvfr2 = t; | ||
211 | |||
212 | t = cpu->isar.id_mmfr3; | ||
213 | - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
214 | + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* FEAT_PAN2 */ | ||
215 | cpu->isar.id_mmfr3 = t; | ||
216 | |||
217 | t = cpu->isar.id_mmfr4; | ||
218 | - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
219 | - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
220 | - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
221 | - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
222 | + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* FEAT_AA32HPD */ | ||
223 | + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
224 | + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */ | ||
225 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX*/ | ||
226 | cpu->isar.id_mmfr4 = t; | ||
227 | |||
228 | t = cpu->isar.id_pfr0; | ||
229 | - t = FIELD_DP32(t, ID_PFR0, DIT, 1); | ||
230 | + t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ | ||
231 | cpu->isar.id_pfr0 = t; | ||
232 | |||
233 | t = cpu->isar.id_pfr2; | ||
234 | - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | ||
235 | + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */ | ||
236 | cpu->isar.id_pfr2 = t; | ||
237 | |||
238 | t = cpu->isar.id_dfr0; | ||
239 | - t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
240 | + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ | ||
241 | cpu->isar.id_dfr0 = t; | ||
242 | } | 63 | } |
243 | 64 | ||
65 | -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, | ||
66 | - hwaddr base) | ||
67 | -{ | ||
68 | - DeviceState *dev; | ||
69 | - | ||
70 | - dev = sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL); | ||
71 | - | ||
72 | - return PXA2XX_PCMCIA(dev); | ||
73 | -} | ||
74 | - | ||
75 | static void pxa2xx_pcmcia_initfn(Object *obj) | ||
76 | { | ||
77 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
244 | -- | 78 | -- |
245 | 2.25.1 | 79 | 2.34.1 |
80 | |||
81 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Enable the a76 for virt and sbsa board use. | 3 | Factor reset code out of the DeviceRealize() handler. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20220506180242.216785-24-richard.henderson@linaro.org | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
8 | Message-id: 20231020130331.50048-7-philmd@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | docs/system/arm/virt.rst | 1 + | 11 | hw/arm/pxa2xx_pic.c | 17 ++++++++++++----- |
11 | hw/arm/sbsa-ref.c | 1 + | 12 | 1 file changed, 12 insertions(+), 5 deletions(-) |
12 | hw/arm/virt.c | 1 + | ||
13 | target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++ | ||
14 | 4 files changed, 69 insertions(+) | ||
15 | 13 | ||
16 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst | 14 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/docs/system/arm/virt.rst | 16 | --- a/hw/arm/pxa2xx_pic.c |
19 | +++ b/docs/system/arm/virt.rst | 17 | +++ b/hw/arm/pxa2xx_pic.c |
20 | @@ -XXX,XX +XXX,XX @@ Supported guest CPU types: | 18 | @@ -XXX,XX +XXX,XX @@ static int pxa2xx_pic_post_load(void *opaque, int version_id) |
21 | - ``cortex-a53`` (64-bit) | 19 | return 0; |
22 | - ``cortex-a57`` (64-bit) | ||
23 | - ``cortex-a72`` (64-bit) | ||
24 | +- ``cortex-a76`` (64-bit) | ||
25 | - ``a64fx`` (64-bit) | ||
26 | - ``host`` (with KVM only) | ||
27 | - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) | ||
28 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/sbsa-ref.c | ||
31 | +++ b/hw/arm/sbsa-ref.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = { | ||
33 | static const char * const valid_cpus[] = { | ||
34 | ARM_CPU_TYPE_NAME("cortex-a57"), | ||
35 | ARM_CPU_TYPE_NAME("cortex-a72"), | ||
36 | + ARM_CPU_TYPE_NAME("cortex-a76"), | ||
37 | ARM_CPU_TYPE_NAME("max"), | ||
38 | }; | ||
39 | |||
40 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/arm/virt.c | ||
43 | +++ b/hw/arm/virt.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { | ||
45 | ARM_CPU_TYPE_NAME("cortex-a53"), | ||
46 | ARM_CPU_TYPE_NAME("cortex-a57"), | ||
47 | ARM_CPU_TYPE_NAME("cortex-a72"), | ||
48 | + ARM_CPU_TYPE_NAME("cortex-a76"), | ||
49 | ARM_CPU_TYPE_NAME("a64fx"), | ||
50 | ARM_CPU_TYPE_NAME("host"), | ||
51 | ARM_CPU_TYPE_NAME("max"), | ||
52 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/target/arm/cpu64.c | ||
55 | +++ b/target/arm/cpu64.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | ||
57 | define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
58 | } | 20 | } |
59 | 21 | ||
60 | +static void aarch64_a76_initfn(Object *obj) | 22 | -DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
61 | +{ | 23 | +static void pxa2xx_pic_reset_hold(Object *obj) |
62 | + ARMCPU *cpu = ARM_CPU(obj); | 24 | { |
63 | + | 25 | - DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); |
64 | + cpu->dtb_compatible = "arm,cortex-a76"; | 26 | - PXA2xxPICState *s = PXA2XX_PIC(dev); |
65 | + set_feature(&cpu->env, ARM_FEATURE_V8); | 27 | - |
66 | + set_feature(&cpu->env, ARM_FEATURE_NEON); | 28 | - s->cpu = cpu; |
67 | + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | 29 | + PXA2xxPICState *s = PXA2XX_PIC(obj); |
68 | + set_feature(&cpu->env, ARM_FEATURE_AARCH64); | 30 | |
69 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | 31 | s->int_pending[0] = 0; |
70 | + set_feature(&cpu->env, ARM_FEATURE_EL2); | 32 | s->int_pending[1] = 0; |
71 | + set_feature(&cpu->env, ARM_FEATURE_EL3); | 33 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
72 | + set_feature(&cpu->env, ARM_FEATURE_PMU); | 34 | s->int_enabled[1] = 0; |
73 | + | 35 | s->is_fiq[0] = 0; |
74 | + /* Ordered by B2.4 AArch64 registers by functional group */ | 36 | s->is_fiq[1] = 0; |
75 | + cpu->clidr = 0x82000023; | ||
76 | + cpu->ctr = 0x8444C004; | ||
77 | + cpu->dcz_blocksize = 4; | ||
78 | + cpu->isar.id_aa64dfr0 = 0x0000000010305408ull; | ||
79 | + cpu->isar.id_aa64isar0 = 0x0000100010211120ull; | ||
80 | + cpu->isar.id_aa64isar1 = 0x0000000000100001ull; | ||
81 | + cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull; | ||
82 | + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
83 | + cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; | ||
84 | + cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ | ||
85 | + cpu->isar.id_aa64pfr1 = 0x0000000000000010ull; | ||
86 | + cpu->id_afr0 = 0x00000000; | ||
87 | + cpu->isar.id_dfr0 = 0x04010088; | ||
88 | + cpu->isar.id_isar0 = 0x02101110; | ||
89 | + cpu->isar.id_isar1 = 0x13112111; | ||
90 | + cpu->isar.id_isar2 = 0x21232042; | ||
91 | + cpu->isar.id_isar3 = 0x01112131; | ||
92 | + cpu->isar.id_isar4 = 0x00010142; | ||
93 | + cpu->isar.id_isar5 = 0x01011121; | ||
94 | + cpu->isar.id_isar6 = 0x00000010; | ||
95 | + cpu->isar.id_mmfr0 = 0x10201105; | ||
96 | + cpu->isar.id_mmfr1 = 0x40000000; | ||
97 | + cpu->isar.id_mmfr2 = 0x01260000; | ||
98 | + cpu->isar.id_mmfr3 = 0x02122211; | ||
99 | + cpu->isar.id_mmfr4 = 0x00021110; | ||
100 | + cpu->isar.id_pfr0 = 0x10010131; | ||
101 | + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ | ||
102 | + cpu->isar.id_pfr2 = 0x00000011; | ||
103 | + cpu->midr = 0x414fd0b1; /* r4p1 */ | ||
104 | + cpu->revidr = 0; | ||
105 | + | ||
106 | + /* From B2.18 CCSIDR_EL1 */ | ||
107 | + cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ | ||
108 | + cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ | ||
109 | + cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */ | ||
110 | + | ||
111 | + /* From B2.93 SCTLR_EL3 */ | ||
112 | + cpu->reset_sctlr = 0x30c50838; | ||
113 | + | ||
114 | + /* From B4.23 ICH_VTR_EL2 */ | ||
115 | + cpu->gic_num_lrs = 4; | ||
116 | + cpu->gic_vpribits = 5; | ||
117 | + cpu->gic_vprebits = 5; | ||
118 | + | ||
119 | + /* From B5.1 AdvSIMD AArch64 register summary */ | ||
120 | + cpu->isar.mvfr0 = 0x10110222; | ||
121 | + cpu->isar.mvfr1 = 0x13211111; | ||
122 | + cpu->isar.mvfr2 = 0x00000043; | ||
123 | +} | 37 | +} |
124 | + | 38 | + |
125 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 39 | +DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
40 | +{ | ||
41 | + DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); | ||
42 | + PXA2xxPICState *s = PXA2XX_PIC(dev); | ||
43 | + | ||
44 | + s->cpu = cpu; | ||
45 | |||
46 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
47 | |||
48 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { | ||
49 | static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) | ||
126 | { | 50 | { |
127 | /* | 51 | DeviceClass *dc = DEVICE_CLASS(klass); |
128 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { | 52 | + ResettableClass *rc = RESETTABLE_CLASS(klass); |
129 | { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, | 53 | |
130 | { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, | 54 | dc->desc = "PXA2xx PIC"; |
131 | { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | 55 | dc->vmsd = &vmstate_pxa2xx_pic_regs; |
132 | + { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, | 56 | + rc->phases.hold = pxa2xx_pic_reset_hold; |
133 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | 57 | } |
134 | { .name = "max", .initfn = aarch64_max_initfn }, | 58 | |
135 | #if defined(CONFIG_KVM) || defined(CONFIG_HVF) | 59 | static const TypeInfo pxa2xx_pic_info = { |
136 | -- | 60 | -- |
137 | 2.25.1 | 61 | 2.34.1 |
62 | |||
63 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This register is present for either VHE or Debugv8p2. | 3 | QOM objects shouldn't access each other internals fields |
4 | except using the QOM API. | ||
4 | 5 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20220506180242.216785-5-richard.henderson@linaro.org | 8 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Message-id: 20231020130331.50048-8-philmd@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | target/arm/helper.c | 15 +++++++++++---- | 12 | hw/arm/pxa2xx_pic.c | 11 ++++++++++- |
11 | 1 file changed, 11 insertions(+), 4 deletions(-) | 13 | 1 file changed, 10 insertions(+), 1 deletion(-) |
12 | 14 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 17 | --- a/hw/arm/pxa2xx_pic.c |
16 | +++ b/target/arm/helper.c | 18 | +++ b/hw/arm/pxa2xx_pic.c |
17 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = { | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 20 | #include "cpu.h" |
21 | #include "hw/arm/pxa.h" | ||
22 | #include "hw/sysbus.h" | ||
23 | +#include "hw/qdev-properties.h" | ||
24 | #include "migration/vmstate.h" | ||
25 | #include "qom/object.h" | ||
26 | #include "target/arm/cpregs.h" | ||
27 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) | ||
28 | DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); | ||
29 | PXA2xxPICState *s = PXA2XX_PIC(dev); | ||
30 | |||
31 | - s->cpu = cpu; | ||
32 | + object_property_set_link(OBJECT(dev), "arm-cpu", | ||
33 | + OBJECT(cpu), &error_abort); | ||
34 | |||
35 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { | ||
38 | }, | ||
19 | }; | 39 | }; |
20 | 40 | ||
21 | +static const ARMCPRegInfo contextidr_el2 = { | 41 | +static Property pxa2xx_pic_properties[] = { |
22 | + .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64, | 42 | + DEFINE_PROP_LINK("arm-cpu", PXA2xxPICState, cpu, |
23 | + .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1, | 43 | + TYPE_ARM_CPU, ARMCPU *), |
24 | + .access = PL2_RW, | 44 | + DEFINE_PROP_END_OF_LIST(), |
25 | + .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2]) | ||
26 | +}; | 45 | +}; |
27 | + | 46 | + |
28 | static const ARMCPRegInfo vhe_reginfo[] = { | 47 | static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) |
29 | - { .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64, | 48 | { |
30 | - .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1, | 49 | DeviceClass *dc = DEVICE_CLASS(klass); |
31 | - .access = PL2_RW, | 50 | ResettableClass *rc = RESETTABLE_CLASS(klass); |
32 | - .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2]) }, | 51 | |
33 | { .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64, | 52 | + device_class_set_props(dc, pxa2xx_pic_properties); |
34 | .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1, | 53 | dc->desc = "PXA2xx PIC"; |
35 | .access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write, | 54 | dc->vmsd = &vmstate_pxa2xx_pic_regs; |
36 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 55 | rc->phases.hold = pxa2xx_pic_reset_hold; |
37 | define_one_arm_cp_reg(cpu, &ssbs_reginfo); | ||
38 | } | ||
39 | |||
40 | + if (cpu_isar_feature(aa64_vh, cpu) || | ||
41 | + cpu_isar_feature(aa64_debugv8p2, cpu)) { | ||
42 | + define_one_arm_cp_reg(cpu, &contextidr_el2); | ||
43 | + } | ||
44 | if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) { | ||
45 | define_arm_cp_regs(cpu, vhe_reginfo); | ||
46 | } | ||
47 | -- | 56 | -- |
48 | 2.25.1 | 57 | 2.34.1 |
58 | |||
59 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Share the code to set AArch32 max features so that we no | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | longer have code drift between qemu{-system,}-{arm,aarch64}. | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | 5 | Reviewed-by: Thomas Huth <thuth@redhat.com> | |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Message-id: 20231020130331.50048-9-philmd@linaro.org |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220506180242.216785-9-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 8 | --- |
11 | target/arm/internals.h | 2 + | 9 | hw/arm/pxa2xx_pic.c | 16 ++++++++++------ |
12 | target/arm/cpu64.c | 50 +----------------- | 10 | 1 file changed, 10 insertions(+), 6 deletions(-) |
13 | target/arm/cpu_tcg.c | 114 ++++++++++++++++++++++------------------- | ||
14 | 3 files changed, 65 insertions(+), 101 deletions(-) | ||
15 | 11 | ||
16 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 12 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/internals.h | 14 | --- a/hw/arm/pxa2xx_pic.c |
19 | +++ b/target/arm/internals.h | 15 | +++ b/hw/arm/pxa2xx_pic.c |
20 | @@ -XXX,XX +XXX,XX @@ static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } | 16 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pic_reset_hold(Object *obj) |
21 | void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); | 17 | DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
22 | #endif | 18 | { |
23 | 19 | DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); | |
24 | +void aa32_max_features(ARMCPU *cpu); | 20 | - PXA2xxPICState *s = PXA2XX_PIC(dev); |
21 | |||
22 | object_property_set_link(OBJECT(dev), "arm-cpu", | ||
23 | OBJECT(cpu), &error_abort); | ||
24 | - | ||
25 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
26 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
25 | + | 27 | + |
26 | #endif | 28 | + return dev; |
27 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/cpu64.c | ||
30 | +++ b/target/arm/cpu64.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
32 | { | ||
33 | ARMCPU *cpu = ARM_CPU(obj); | ||
34 | uint64_t t; | ||
35 | - uint32_t u; | ||
36 | |||
37 | if (kvm_enabled() || hvf_enabled()) { | ||
38 | /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ | ||
39 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
40 | t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
41 | cpu->isar.id_aa64zfr0 = t; | ||
42 | |||
43 | - /* Replicate the same data to the 32-bit id registers. */ | ||
44 | - u = cpu->isar.id_isar5; | ||
45 | - u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
46 | - u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); | ||
47 | - u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); | ||
48 | - u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); | ||
49 | - u = FIELD_DP32(u, ID_ISAR5, RDM, 1); | ||
50 | - u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); | ||
51 | - cpu->isar.id_isar5 = u; | ||
52 | - | ||
53 | - u = cpu->isar.id_isar6; | ||
54 | - u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
55 | - u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
56 | - u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
57 | - u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
58 | - u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
59 | - u = FIELD_DP32(u, ID_ISAR6, BF16, 1); | ||
60 | - u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); | ||
61 | - cpu->isar.id_isar6 = u; | ||
62 | - | ||
63 | - u = cpu->isar.id_pfr0; | ||
64 | - u = FIELD_DP32(u, ID_PFR0, DIT, 1); | ||
65 | - cpu->isar.id_pfr0 = u; | ||
66 | - | ||
67 | - u = cpu->isar.id_pfr2; | ||
68 | - u = FIELD_DP32(u, ID_PFR2, SSBS, 1); | ||
69 | - cpu->isar.id_pfr2 = u; | ||
70 | - | ||
71 | - u = cpu->isar.id_mmfr3; | ||
72 | - u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
73 | - cpu->isar.id_mmfr3 = u; | ||
74 | - | ||
75 | - u = cpu->isar.id_mmfr4; | ||
76 | - u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
77 | - u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
78 | - u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
79 | - u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
80 | - cpu->isar.id_mmfr4 = u; | ||
81 | - | ||
82 | t = cpu->isar.id_aa64dfr0; | ||
83 | t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
84 | cpu->isar.id_aa64dfr0 = t; | ||
85 | |||
86 | - u = cpu->isar.id_dfr0; | ||
87 | - u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
88 | - cpu->isar.id_dfr0 = u; | ||
89 | - | ||
90 | - u = cpu->isar.mvfr1; | ||
91 | - u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
92 | - u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
93 | - cpu->isar.mvfr1 = u; | ||
94 | + /* Replicate the same data to the 32-bit id registers. */ | ||
95 | + aa32_max_features(cpu); | ||
96 | |||
97 | #ifdef CONFIG_USER_ONLY | ||
98 | /* | ||
99 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/target/arm/cpu_tcg.c | ||
102 | +++ b/target/arm/cpu_tcg.c | ||
103 | @@ -XXX,XX +XXX,XX @@ | ||
104 | #endif | ||
105 | #include "cpregs.h" | ||
106 | |||
107 | + | ||
108 | +/* Share AArch32 -cpu max features with AArch64. */ | ||
109 | +void aa32_max_features(ARMCPU *cpu) | ||
110 | +{ | ||
111 | + uint32_t t; | ||
112 | + | ||
113 | + /* Add additional features supported by QEMU */ | ||
114 | + t = cpu->isar.id_isar5; | ||
115 | + t = FIELD_DP32(t, ID_ISAR5, AES, 2); | ||
116 | + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); | ||
117 | + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); | ||
118 | + t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); | ||
119 | + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); | ||
120 | + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); | ||
121 | + cpu->isar.id_isar5 = t; | ||
122 | + | ||
123 | + t = cpu->isar.id_isar6; | ||
124 | + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | ||
125 | + t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
126 | + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | ||
127 | + t = FIELD_DP32(t, ID_ISAR6, SB, 1); | ||
128 | + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | ||
129 | + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); | ||
130 | + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); | ||
131 | + cpu->isar.id_isar6 = t; | ||
132 | + | ||
133 | + t = cpu->isar.mvfr1; | ||
134 | + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
135 | + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
136 | + cpu->isar.mvfr1 = t; | ||
137 | + | ||
138 | + t = cpu->isar.mvfr2; | ||
139 | + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
140 | + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
141 | + cpu->isar.mvfr2 = t; | ||
142 | + | ||
143 | + t = cpu->isar.id_mmfr3; | ||
144 | + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
145 | + cpu->isar.id_mmfr3 = t; | ||
146 | + | ||
147 | + t = cpu->isar.id_mmfr4; | ||
148 | + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
149 | + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
150 | + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
151 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
152 | + cpu->isar.id_mmfr4 = t; | ||
153 | + | ||
154 | + t = cpu->isar.id_pfr0; | ||
155 | + t = FIELD_DP32(t, ID_PFR0, DIT, 1); | ||
156 | + cpu->isar.id_pfr0 = t; | ||
157 | + | ||
158 | + t = cpu->isar.id_pfr2; | ||
159 | + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | ||
160 | + cpu->isar.id_pfr2 = t; | ||
161 | + | ||
162 | + t = cpu->isar.id_dfr0; | ||
163 | + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
164 | + cpu->isar.id_dfr0 = t; | ||
165 | +} | 29 | +} |
166 | + | 30 | + |
167 | #ifndef CONFIG_USER_ONLY | 31 | +static void pxa2xx_pic_realize(DeviceState *dev, Error **errp) |
168 | static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 32 | +{ |
169 | { | 33 | + PXA2xxPICState *s = PXA2XX_PIC(dev); |
170 | @@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data) | 34 | |
171 | static void arm_max_initfn(Object *obj) | 35 | qdev_init_gpio_in(dev, pxa2xx_pic_set_irq, PXA2XX_PIC_SRCS); |
172 | { | 36 | |
173 | ARMCPU *cpu = ARM_CPU(obj); | 37 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
174 | - uint32_t t; | 38 | memory_region_init_io(&s->iomem, OBJECT(s), &pxa2xx_pic_ops, s, |
175 | 39 | "pxa2xx-pic", 0x00100000); | |
176 | /* aarch64_a57_initfn, advertising none of the aarch64 features */ | 40 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); |
177 | cpu->dtb_compatible = "arm,cortex-a57"; | 41 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
178 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 42 | |
179 | cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */ | 43 | /* Enable IC coprocessor access. */ |
180 | define_cortex_a72_a57_a53_cp_reginfo(cpu); | 44 | - define_arm_cp_regs_with_opaque(cpu, pxa_pic_cp_reginfo, s); |
181 | |||
182 | - /* Add additional features supported by QEMU */ | ||
183 | - t = cpu->isar.id_isar5; | ||
184 | - t = FIELD_DP32(t, ID_ISAR5, AES, 2); | ||
185 | - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); | ||
186 | - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); | ||
187 | - t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); | ||
188 | - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); | ||
189 | - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); | ||
190 | - cpu->isar.id_isar5 = t; | ||
191 | - | 45 | - |
192 | - t = cpu->isar.id_isar6; | 46 | - return dev; |
193 | - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | 47 | + define_arm_cp_regs_with_opaque(s->cpu, pxa_pic_cp_reginfo, s); |
194 | - t = FIELD_DP32(t, ID_ISAR6, DP, 1); | 48 | } |
195 | - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | 49 | |
196 | - t = FIELD_DP32(t, ID_ISAR6, SB, 1); | 50 | static const VMStateDescription vmstate_pxa2xx_pic_regs = { |
197 | - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | 51 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) |
198 | - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); | 52 | ResettableClass *rc = RESETTABLE_CLASS(klass); |
199 | - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); | 53 | |
200 | - cpu->isar.id_isar6 = t; | 54 | device_class_set_props(dc, pxa2xx_pic_properties); |
201 | - | 55 | + dc->realize = pxa2xx_pic_realize; |
202 | - t = cpu->isar.mvfr1; | 56 | dc->desc = "PXA2xx PIC"; |
203 | - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ | 57 | dc->vmsd = &vmstate_pxa2xx_pic_regs; |
204 | - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | 58 | rc->phases.hold = pxa2xx_pic_reset_hold; |
205 | - cpu->isar.mvfr1 = t; | ||
206 | - | ||
207 | - t = cpu->isar.mvfr2; | ||
208 | - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
209 | - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
210 | - cpu->isar.mvfr2 = t; | ||
211 | - | ||
212 | - t = cpu->isar.id_mmfr3; | ||
213 | - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
214 | - cpu->isar.id_mmfr3 = t; | ||
215 | - | ||
216 | - t = cpu->isar.id_mmfr4; | ||
217 | - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
218 | - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
219 | - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
220 | - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
221 | - cpu->isar.id_mmfr4 = t; | ||
222 | - | ||
223 | - t = cpu->isar.id_pfr0; | ||
224 | - t = FIELD_DP32(t, ID_PFR0, DIT, 1); | ||
225 | - cpu->isar.id_pfr0 = t; | ||
226 | - | ||
227 | - t = cpu->isar.id_pfr2; | ||
228 | - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | ||
229 | - cpu->isar.id_pfr2 = t; | ||
230 | - | ||
231 | - t = cpu->isar.id_dfr0; | ||
232 | - t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
233 | - cpu->isar.id_dfr0 = t; | ||
234 | + aa32_max_features(cpu); | ||
235 | |||
236 | #ifdef CONFIG_USER_ONLY | ||
237 | /* | ||
238 | -- | 59 | -- |
239 | 2.25.1 | 60 | 2.34.1 |
61 | |||
62 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This extension concerns branch speculation, which TCG does | 3 | qbus_new(), called in i2c_init_bus(), should not be called |
4 | not implement. Thus we can trivially enable this feature. | 4 | on unrealized device. |
5 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20220506180242.216785-20-richard.henderson@linaro.org | 8 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Message-id: 20231020130331.50048-10-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | docs/system/arm/emulation.rst | 1 + | 12 | hw/arm/pxa2xx.c | 5 +++-- |
12 | target/arm/cpu64.c | 1 + | 13 | 1 file changed, 3 insertions(+), 2 deletions(-) |
13 | target/arm/cpu_tcg.c | 1 + | ||
14 | 3 files changed, 3 insertions(+) | ||
15 | 14 | ||
16 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 15 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/docs/system/arm/emulation.rst | 17 | --- a/hw/arm/pxa2xx.c |
19 | +++ b/docs/system/arm/emulation.rst | 18 | +++ b/hw/arm/pxa2xx.c |
20 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 19 | @@ -XXX,XX +XXX,XX @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base, |
21 | - FEAT_BBM at level 2 (Translation table break-before-make levels) | 20 | qdev_prop_set_uint32(dev, "size", region_size + 1); |
22 | - FEAT_BF16 (AArch64 BFloat16 instructions) | 21 | qdev_prop_set_uint32(dev, "offset", base & region_size); |
23 | - FEAT_BTI (Branch Target Identification) | 22 | |
24 | +- FEAT_CSV2 (Cache speculation variant 2) | 23 | + /* FIXME: Should the slave device really be on a separate bus? */ |
25 | - FEAT_DIT (Data Independent Timing instructions) | 24 | + i2cbus = i2c_init_bus(dev, "dummy"); |
26 | - FEAT_DPB (DC CVAP instruction) | 25 | + |
27 | - FEAT_Debugv8p2 (Debug changes for v8.2) | 26 | i2c_dev = SYS_BUS_DEVICE(dev); |
28 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 27 | sysbus_realize_and_unref(i2c_dev, &error_fatal); |
29 | index XXXXXXX..XXXXXXX 100644 | 28 | sysbus_mmio_map(i2c_dev, 0, base & ~region_size); |
30 | --- a/target/arm/cpu64.c | 29 | sysbus_connect_irq(i2c_dev, 0, irq); |
31 | +++ b/target/arm/cpu64.c | 30 | |
32 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 31 | s = PXA2XX_I2C(i2c_dev); |
33 | t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | 32 | - /* FIXME: Should the slave device really be on a separate bus? */ |
34 | t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | 33 | - i2cbus = i2c_init_bus(dev, "dummy"); |
35 | t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | 34 | s->slave = PXA2XX_I2C_SLAVE(i2c_slave_create_simple(i2cbus, |
36 | + t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */ | 35 | TYPE_PXA2XX_I2C_SLAVE, |
37 | cpu->isar.id_aa64pfr0 = t; | 36 | 0)); |
38 | |||
39 | t = cpu->isar.id_aa64pfr1; | ||
40 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/cpu_tcg.c | ||
43 | +++ b/target/arm/cpu_tcg.c | ||
44 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
45 | cpu->isar.id_mmfr4 = t; | ||
46 | |||
47 | t = cpu->isar.id_pfr0; | ||
48 | + t = FIELD_DP32(t, ID_PFR0, CSV2, 2); /* FEAT_CVS2 */ | ||
49 | t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ | ||
50 | t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */ | ||
51 | cpu->isar.id_pfr0 = t; | ||
52 | -- | 37 | -- |
53 | 2.25.1 | 38 | 2.34.1 |
39 | |||
40 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Previously we were defining some of these in user-only mode, | 3 | Prefer using a well known local first CPU rather than a global one. |
4 | but none of them are accessible from user-only, therefore | ||
5 | define them only in system mode. | ||
6 | 4 | ||
7 | This will shortly be used from cpu_tcg.c also. | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Message-id: 20231025065909.57344-1-philmd@linaro.org |
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220506180242.216785-6-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 9 | --- |
14 | target/arm/internals.h | 6 ++++ | 10 | hw/arm/bananapi_m2u.c | 2 +- |
15 | target/arm/cpu64.c | 64 +++--------------------------------------- | 11 | hw/arm/exynos4_boards.c | 7 ++++--- |
16 | target/arm/cpu_tcg.c | 59 ++++++++++++++++++++++++++++++++++++++ | 12 | hw/arm/orangepi.c | 2 +- |
17 | 3 files changed, 69 insertions(+), 60 deletions(-) | 13 | hw/arm/realview.c | 2 +- |
14 | hw/arm/xilinx_zynq.c | 2 +- | ||
15 | 5 files changed, 8 insertions(+), 7 deletions(-) | ||
18 | 16 | ||
19 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 17 | diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/internals.h | 19 | --- a/hw/arm/bananapi_m2u.c |
22 | +++ b/target/arm/internals.h | 20 | +++ b/hw/arm/bananapi_m2u.c |
23 | @@ -XXX,XX +XXX,XX @@ int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg); | 21 | @@ -XXX,XX +XXX,XX @@ static void bpim2u_init(MachineState *machine) |
24 | int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg); | 22 | bpim2u_binfo.loader_start = r40->memmap[AW_R40_DEV_SDRAM]; |
25 | #endif | 23 | bpim2u_binfo.ram_size = machine->ram_size; |
26 | 24 | bpim2u_binfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; | |
27 | +#ifdef CONFIG_USER_ONLY | 25 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &bpim2u_binfo); |
28 | +static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } | 26 | + arm_load_kernel(&r40->cpus[0], machine, &bpim2u_binfo); |
29 | +#else | 27 | } |
30 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); | 28 | |
31 | +#endif | 29 | static void bpim2u_machine_init(MachineClass *mc) |
32 | + | 30 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c |
33 | #endif | ||
34 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu64.c | 32 | --- a/hw/arm/exynos4_boards.c |
37 | +++ b/target/arm/cpu64.c | 33 | +++ b/hw/arm/exynos4_boards.c |
38 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, |
39 | #include "hvf_arm.h" | 35 | |
40 | #include "qapi/visitor.h" | 36 | static void nuri_init(MachineState *machine) |
41 | #include "hw/qdev-properties.h" | ||
42 | -#include "cpregs.h" | ||
43 | +#include "internals.h" | ||
44 | |||
45 | |||
46 | -#ifndef CONFIG_USER_ONLY | ||
47 | -static uint64_t a57_a53_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
48 | -{ | ||
49 | - ARMCPU *cpu = env_archcpu(env); | ||
50 | - | ||
51 | - /* Number of cores is in [25:24]; otherwise we RAZ */ | ||
52 | - return (cpu->core_count - 1) << 24; | ||
53 | -} | ||
54 | -#endif | ||
55 | - | ||
56 | -static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { | ||
57 | -#ifndef CONFIG_USER_ONLY | ||
58 | - { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
59 | - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, | ||
60 | - .access = PL1_RW, .readfn = a57_a53_l2ctlr_read, | ||
61 | - .writefn = arm_cp_write_ignore }, | ||
62 | - { .name = "L2CTLR", | ||
63 | - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, | ||
64 | - .access = PL1_RW, .readfn = a57_a53_l2ctlr_read, | ||
65 | - .writefn = arm_cp_write_ignore }, | ||
66 | -#endif | ||
67 | - { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
68 | - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, | ||
69 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
70 | - { .name = "L2ECTLR", | ||
71 | - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, | ||
72 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
73 | - { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, | ||
74 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, | ||
75 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
76 | - { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
77 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, | ||
78 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
79 | - { .name = "CPUACTLR", | ||
80 | - .cp = 15, .opc1 = 0, .crm = 15, | ||
81 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
82 | - { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
83 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, | ||
84 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
85 | - { .name = "CPUECTLR", | ||
86 | - .cp = 15, .opc1 = 1, .crm = 15, | ||
87 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
88 | - { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
89 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, | ||
90 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
91 | - { .name = "CPUMERRSR", | ||
92 | - .cp = 15, .opc1 = 2, .crm = 15, | ||
93 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
94 | - { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
95 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, | ||
96 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
97 | - { .name = "L2MERRSR", | ||
98 | - .cp = 15, .opc1 = 3, .crm = 15, | ||
99 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
100 | -}; | ||
101 | - | ||
102 | static void aarch64_a57_initfn(Object *obj) | ||
103 | { | 37 | { |
104 | ARMCPU *cpu = ARM_CPU(obj); | 38 | - exynos4_boards_init_common(machine, EXYNOS4_BOARD_NURI); |
105 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) | 39 | + Exynos4BoardState *s = exynos4_boards_init_common(machine, |
106 | cpu->gic_num_lrs = 4; | 40 | + EXYNOS4_BOARD_NURI); |
107 | cpu->gic_vpribits = 5; | 41 | |
108 | cpu->gic_vprebits = 5; | 42 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &exynos4_board_binfo); |
109 | - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | 43 | + arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); |
110 | + define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
111 | } | 44 | } |
112 | 45 | ||
113 | static void aarch64_a53_initfn(Object *obj) | 46 | static void smdkc210_init(MachineState *machine) |
114 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | 47 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_init(MachineState *machine) |
115 | cpu->gic_num_lrs = 4; | 48 | |
116 | cpu->gic_vpribits = 5; | 49 | lan9215_init(SMDK_LAN9118_BASE_ADDR, |
117 | cpu->gic_vprebits = 5; | 50 | qemu_irq_invert(s->soc.irq_table[exynos4210_get_irq(37, 1)])); |
118 | - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | 51 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &exynos4_board_binfo); |
119 | + define_cortex_a72_a57_a53_cp_reginfo(cpu); | 52 | + arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); |
120 | } | 53 | } |
121 | 54 | ||
122 | static void aarch64_a72_initfn(Object *obj) | 55 | static void nuri_class_init(ObjectClass *oc, void *data) |
123 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | 56 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c |
124 | cpu->gic_num_lrs = 4; | 57 | index XXXXXXX..XXXXXXX 100644 |
125 | cpu->gic_vpribits = 5; | 58 | --- a/hw/arm/orangepi.c |
126 | cpu->gic_vprebits = 5; | 59 | +++ b/hw/arm/orangepi.c |
127 | - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | 60 | @@ -XXX,XX +XXX,XX @@ static void orangepi_init(MachineState *machine) |
128 | + define_cortex_a72_a57_a53_cp_reginfo(cpu); | 61 | orangepi_binfo.loader_start = h3->memmap[AW_H3_DEV_SDRAM]; |
62 | orangepi_binfo.ram_size = machine->ram_size; | ||
63 | orangepi_binfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; | ||
64 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &orangepi_binfo); | ||
65 | + arm_load_kernel(&h3->cpus[0], machine, &orangepi_binfo); | ||
129 | } | 66 | } |
130 | 67 | ||
131 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 68 | static void orangepi_machine_init(MachineClass *mc) |
132 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | 69 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c |
133 | index XXXXXXX..XXXXXXX 100644 | 70 | index XXXXXXX..XXXXXXX 100644 |
134 | --- a/target/arm/cpu_tcg.c | 71 | --- a/hw/arm/realview.c |
135 | +++ b/target/arm/cpu_tcg.c | 72 | +++ b/hw/arm/realview.c |
136 | @@ -XXX,XX +XXX,XX @@ | 73 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, |
137 | #endif | 74 | realview_binfo.ram_size = ram_size; |
138 | #include "cpregs.h" | 75 | realview_binfo.board_id = realview_board_id[board_type]; |
139 | 76 | realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0); | |
140 | +#ifndef CONFIG_USER_ONLY | 77 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo); |
141 | +static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 78 | + arm_load_kernel(cpu, machine, &realview_binfo); |
142 | +{ | 79 | } |
143 | + ARMCPU *cpu = env_archcpu(env); | 80 | |
144 | + | 81 | static void realview_eb_init(MachineState *machine) |
145 | + /* Number of cores is in [25:24]; otherwise we RAZ */ | 82 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c |
146 | + return (cpu->core_count - 1) << 24; | 83 | index XXXXXXX..XXXXXXX 100644 |
147 | +} | 84 | --- a/hw/arm/xilinx_zynq.c |
148 | + | 85 | +++ b/hw/arm/xilinx_zynq.c |
149 | +static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { | 86 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) |
150 | + { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, | 87 | zynq_binfo.board_setup_addr = BOARD_SETUP_ADDR; |
151 | + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, | 88 | zynq_binfo.write_board_setup = zynq_write_board_setup; |
152 | + .access = PL1_RW, .readfn = l2ctlr_read, | 89 | |
153 | + .writefn = arm_cp_write_ignore }, | 90 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &zynq_binfo); |
154 | + { .name = "L2CTLR", | 91 | + arm_load_kernel(cpu, machine, &zynq_binfo); |
155 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, | 92 | } |
156 | + .access = PL1_RW, .readfn = l2ctlr_read, | 93 | |
157 | + .writefn = arm_cp_write_ignore }, | 94 | static void zynq_machine_class_init(ObjectClass *oc, void *data) |
158 | + { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
159 | + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, | ||
160 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
161 | + { .name = "L2ECTLR", | ||
162 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, | ||
163 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
164 | + { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, | ||
165 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, | ||
166 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
167 | + { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
168 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, | ||
169 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
170 | + { .name = "CPUACTLR", | ||
171 | + .cp = 15, .opc1 = 0, .crm = 15, | ||
172 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
173 | + { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
174 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, | ||
175 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
176 | + { .name = "CPUECTLR", | ||
177 | + .cp = 15, .opc1 = 1, .crm = 15, | ||
178 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
179 | + { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
180 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, | ||
181 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
182 | + { .name = "CPUMERRSR", | ||
183 | + .cp = 15, .opc1 = 2, .crm = 15, | ||
184 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
185 | + { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
186 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, | ||
187 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
188 | + { .name = "L2MERRSR", | ||
189 | + .cp = 15, .opc1 = 3, .crm = 15, | ||
190 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
191 | +}; | ||
192 | + | ||
193 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) | ||
194 | +{ | ||
195 | + define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
196 | +} | ||
197 | +#endif /* !CONFIG_USER_ONLY */ | ||
198 | + | ||
199 | /* CPU models. These are not needed for the AArch64 linux-user build. */ | ||
200 | #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) | ||
201 | |||
202 | -- | 95 | -- |
203 | 2.25.1 | 96 | 2.34.1 |
97 | |||
98 | diff view generated by jsdifflib |
1 | From: Gavin Shan <gshan@redhat.com> | 1 | From: Glenn Miles <milesg@linux.vnet.ibm.com> |
---|---|---|---|
2 | 2 | ||
3 | When CPU-to-NUMA association isn't explicitly provided by users, | 3 | Testing of the LED state showed that when the LED polarity was |
4 | the default one is given by mc->get_default_cpu_node_id(). However, | 4 | set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on |
5 | the CPU topology isn't fully considered in the default association | 5 | the input GPIO of the LED, the LED was being turn off when it was |
6 | and this causes CPU topology broken warnings on booting Linux guest. | 6 | expected to be turned on. |
7 | 7 | ||
8 | For example, the following warning messages are observed when the | 8 | Fixes: ddb67f6402 ("hw/misc/led: Allow connecting from GPIO output") |
9 | Linux guest is booted with the following command lines. | 9 | Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com> |
10 | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | |
11 | /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ | 11 | Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> |
12 | -accel kvm -machine virt,gic-version=host \ | 12 | Message-id: 20231024191945.4135036-1-milesg@linux.vnet.ibm.com |
13 | -cpu host \ | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
14 | -smp 6,sockets=2,cores=3,threads=1 \ | ||
15 | -m 1024M,slots=16,maxmem=64G \ | ||
16 | -object memory-backend-ram,id=mem0,size=128M \ | ||
17 | -object memory-backend-ram,id=mem1,size=128M \ | ||
18 | -object memory-backend-ram,id=mem2,size=128M \ | ||
19 | -object memory-backend-ram,id=mem3,size=128M \ | ||
20 | -object memory-backend-ram,id=mem4,size=128M \ | ||
21 | -object memory-backend-ram,id=mem4,size=384M \ | ||
22 | -numa node,nodeid=0,memdev=mem0 \ | ||
23 | -numa node,nodeid=1,memdev=mem1 \ | ||
24 | -numa node,nodeid=2,memdev=mem2 \ | ||
25 | -numa node,nodeid=3,memdev=mem3 \ | ||
26 | -numa node,nodeid=4,memdev=mem4 \ | ||
27 | -numa node,nodeid=5,memdev=mem5 | ||
28 | : | ||
29 | alternatives: patching kernel code | ||
30 | BUG: arch topology borken | ||
31 | the CLS domain not a subset of the MC domain | ||
32 | <the above error log repeats> | ||
33 | BUG: arch topology borken | ||
34 | the DIE domain not a subset of the NODE domain | ||
35 | |||
36 | With current implementation of mc->get_default_cpu_node_id(), | ||
37 | CPU#0 to CPU#5 are associated with NODE#0 to NODE#5 separately. | ||
38 | That's incorrect because CPU#0/1/2 should be associated with same | ||
39 | NUMA node because they're seated in same socket. | ||
40 | |||
41 | This fixes the issue by considering the socket ID when the default | ||
42 | CPU-to-NUMA association is provided in virt_possible_cpu_arch_ids(). | ||
43 | With this applied, no more CPU topology broken warnings are seen | ||
44 | from the Linux guest. The 6 CPUs are associated with NODE#0/1, but | ||
45 | there are no CPUs associated with NODE#2/3/4/5. | ||
46 | |||
47 | Signed-off-by: Gavin Shan <gshan@redhat.com> | ||
48 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
49 | Reviewed-by: Yanan Wang <wangyanan55@huawei.com> | ||
50 | Message-id: 20220503140304.855514-6-gshan@redhat.com | ||
51 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
52 | --- | 15 | --- |
53 | hw/arm/virt.c | 4 +++- | 16 | hw/misc/led.c | 2 +- |
54 | 1 file changed, 3 insertions(+), 1 deletion(-) | 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
55 | 18 | ||
56 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 19 | diff --git a/hw/misc/led.c b/hw/misc/led.c |
57 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/hw/arm/virt.c | 21 | --- a/hw/misc/led.c |
59 | +++ b/hw/arm/virt.c | 22 | +++ b/hw/misc/led.c |
60 | @@ -XXX,XX +XXX,XX @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) | 23 | @@ -XXX,XX +XXX,XX @@ static void led_set_state_gpio_handler(void *opaque, int line, int new_state) |
61 | 24 | LEDState *s = LED(opaque); | |
62 | static int64_t virt_get_default_cpu_node_id(const MachineState *ms, int idx) | 25 | |
63 | { | 26 | assert(line == 0); |
64 | - return idx % ms->numa_state->num_nodes; | 27 | - led_set_state(s, !!new_state != s->gpio_active_high); |
65 | + int64_t socket_id = ms->possible_cpus->cpus[idx].props.socket_id; | 28 | + led_set_state(s, !!new_state == s->gpio_active_high); |
66 | + | ||
67 | + return socket_id % ms->numa_state->num_nodes; | ||
68 | } | 29 | } |
69 | 30 | ||
70 | static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) | 31 | static void led_reset(DeviceState *dev) |
71 | -- | 32 | -- |
72 | 2.25.1 | 33 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Check for and defer any pending virtual SError. | 3 | Replace register defines with the REG32 macro from registerfields.h in |
4 | the Cadence GEM device. | ||
4 | 5 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: sai.pavan.boddu@amd.com |
7 | Message-id: 20220506180242.216785-17-richard.henderson@linaro.org | 8 | Message-id: 20231017194422.4124691-2-luc.michel@amd.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/helper.h | 1 + | 11 | hw/net/cadence_gem.c | 527 +++++++++++++++++++++---------------------- |
11 | target/arm/a32.decode | 16 ++++++++------ | 12 | 1 file changed, 261 insertions(+), 266 deletions(-) |
12 | target/arm/t32.decode | 18 ++++++++-------- | ||
13 | target/arm/op_helper.c | 43 ++++++++++++++++++++++++++++++++++++++ | ||
14 | target/arm/translate-a64.c | 17 +++++++++++++++ | ||
15 | target/arm/translate.c | 23 ++++++++++++++++++++ | ||
16 | 6 files changed, 103 insertions(+), 15 deletions(-) | ||
17 | 13 | ||
18 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 14 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.h | 16 | --- a/hw/net/cadence_gem.c |
21 | +++ b/target/arm/helper.h | 17 | +++ b/hw/net/cadence_gem.c |
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_1(wfe, void, env) | 18 | @@ -XXX,XX +XXX,XX @@ |
23 | DEF_HELPER_1(yield, void, env) | 19 | #include "hw/irq.h" |
24 | DEF_HELPER_1(pre_hvc, void, env) | 20 | #include "hw/net/cadence_gem.h" |
25 | DEF_HELPER_2(pre_smc, void, env, i32) | 21 | #include "hw/qdev-properties.h" |
26 | +DEF_HELPER_1(vesb, void, env) | 22 | +#include "hw/registerfields.h" |
27 | 23 | #include "migration/vmstate.h" | |
28 | DEF_HELPER_3(cpsr_write, void, env, i32, i32) | 24 | #include "qapi/error.h" |
29 | DEF_HELPER_2(cpsr_write_eret, void, env, i32) | 25 | #include "qemu/log.h" |
30 | diff --git a/target/arm/a32.decode b/target/arm/a32.decode | 26 | @@ -XXX,XX +XXX,XX @@ |
31 | index XXXXXXX..XXXXXXX 100644 | 27 | } \ |
32 | --- a/target/arm/a32.decode | 28 | } while (0) |
33 | +++ b/target/arm/a32.decode | 29 | |
34 | @@ -XXX,XX +XXX,XX @@ SMULTT .... 0001 0110 .... 0000 .... 1110 .... @rd0mn | 30 | -#define GEM_NWCTRL (0x00000000 / 4) /* Network Control reg */ |
35 | 31 | -#define GEM_NWCFG (0x00000004 / 4) /* Network Config reg */ | |
32 | -#define GEM_NWSTATUS (0x00000008 / 4) /* Network Status reg */ | ||
33 | -#define GEM_USERIO (0x0000000C / 4) /* User IO reg */ | ||
34 | -#define GEM_DMACFG (0x00000010 / 4) /* DMA Control reg */ | ||
35 | -#define GEM_TXSTATUS (0x00000014 / 4) /* TX Status reg */ | ||
36 | -#define GEM_RXQBASE (0x00000018 / 4) /* RX Q Base address reg */ | ||
37 | -#define GEM_TXQBASE (0x0000001C / 4) /* TX Q Base address reg */ | ||
38 | -#define GEM_RXSTATUS (0x00000020 / 4) /* RX Status reg */ | ||
39 | -#define GEM_ISR (0x00000024 / 4) /* Interrupt Status reg */ | ||
40 | -#define GEM_IER (0x00000028 / 4) /* Interrupt Enable reg */ | ||
41 | -#define GEM_IDR (0x0000002C / 4) /* Interrupt Disable reg */ | ||
42 | -#define GEM_IMR (0x00000030 / 4) /* Interrupt Mask reg */ | ||
43 | -#define GEM_PHYMNTNC (0x00000034 / 4) /* Phy Maintenance reg */ | ||
44 | -#define GEM_RXPAUSE (0x00000038 / 4) /* RX Pause Time reg */ | ||
45 | -#define GEM_TXPAUSE (0x0000003C / 4) /* TX Pause Time reg */ | ||
46 | -#define GEM_TXPARTIALSF (0x00000040 / 4) /* TX Partial Store and Forward */ | ||
47 | -#define GEM_RXPARTIALSF (0x00000044 / 4) /* RX Partial Store and Forward */ | ||
48 | -#define GEM_JUMBO_MAX_LEN (0x00000048 / 4) /* Max Jumbo Frame Size */ | ||
49 | -#define GEM_HASHLO (0x00000080 / 4) /* Hash Low address reg */ | ||
50 | -#define GEM_HASHHI (0x00000084 / 4) /* Hash High address reg */ | ||
51 | -#define GEM_SPADDR1LO (0x00000088 / 4) /* Specific addr 1 low reg */ | ||
52 | -#define GEM_SPADDR1HI (0x0000008C / 4) /* Specific addr 1 high reg */ | ||
53 | -#define GEM_SPADDR2LO (0x00000090 / 4) /* Specific addr 2 low reg */ | ||
54 | -#define GEM_SPADDR2HI (0x00000094 / 4) /* Specific addr 2 high reg */ | ||
55 | -#define GEM_SPADDR3LO (0x00000098 / 4) /* Specific addr 3 low reg */ | ||
56 | -#define GEM_SPADDR3HI (0x0000009C / 4) /* Specific addr 3 high reg */ | ||
57 | -#define GEM_SPADDR4LO (0x000000A0 / 4) /* Specific addr 4 low reg */ | ||
58 | -#define GEM_SPADDR4HI (0x000000A4 / 4) /* Specific addr 4 high reg */ | ||
59 | -#define GEM_TIDMATCH1 (0x000000A8 / 4) /* Type ID1 Match reg */ | ||
60 | -#define GEM_TIDMATCH2 (0x000000AC / 4) /* Type ID2 Match reg */ | ||
61 | -#define GEM_TIDMATCH3 (0x000000B0 / 4) /* Type ID3 Match reg */ | ||
62 | -#define GEM_TIDMATCH4 (0x000000B4 / 4) /* Type ID4 Match reg */ | ||
63 | -#define GEM_WOLAN (0x000000B8 / 4) /* Wake on LAN reg */ | ||
64 | -#define GEM_IPGSTRETCH (0x000000BC / 4) /* IPG Stretch reg */ | ||
65 | -#define GEM_SVLAN (0x000000C0 / 4) /* Stacked VLAN reg */ | ||
66 | -#define GEM_MODID (0x000000FC / 4) /* Module ID reg */ | ||
67 | -#define GEM_OCTTXLO (0x00000100 / 4) /* Octets transmitted Low reg */ | ||
68 | -#define GEM_OCTTXHI (0x00000104 / 4) /* Octets transmitted High reg */ | ||
69 | -#define GEM_TXCNT (0x00000108 / 4) /* Error-free Frames transmitted */ | ||
70 | -#define GEM_TXBCNT (0x0000010C / 4) /* Error-free Broadcast Frames */ | ||
71 | -#define GEM_TXMCNT (0x00000110 / 4) /* Error-free Multicast Frame */ | ||
72 | -#define GEM_TXPAUSECNT (0x00000114 / 4) /* Pause Frames Transmitted */ | ||
73 | -#define GEM_TX64CNT (0x00000118 / 4) /* Error-free 64 TX */ | ||
74 | -#define GEM_TX65CNT (0x0000011C / 4) /* Error-free 65-127 TX */ | ||
75 | -#define GEM_TX128CNT (0x00000120 / 4) /* Error-free 128-255 TX */ | ||
76 | -#define GEM_TX256CNT (0x00000124 / 4) /* Error-free 256-511 */ | ||
77 | -#define GEM_TX512CNT (0x00000128 / 4) /* Error-free 512-1023 TX */ | ||
78 | -#define GEM_TX1024CNT (0x0000012C / 4) /* Error-free 1024-1518 TX */ | ||
79 | -#define GEM_TX1519CNT (0x00000130 / 4) /* Error-free larger than 1519 TX */ | ||
80 | -#define GEM_TXURUNCNT (0x00000134 / 4) /* TX under run error counter */ | ||
81 | -#define GEM_SINGLECOLLCNT (0x00000138 / 4) /* Single Collision Frames */ | ||
82 | -#define GEM_MULTCOLLCNT (0x0000013C / 4) /* Multiple Collision Frames */ | ||
83 | -#define GEM_EXCESSCOLLCNT (0x00000140 / 4) /* Excessive Collision Frames */ | ||
84 | -#define GEM_LATECOLLCNT (0x00000144 / 4) /* Late Collision Frames */ | ||
85 | -#define GEM_DEFERTXCNT (0x00000148 / 4) /* Deferred Transmission Frames */ | ||
86 | -#define GEM_CSENSECNT (0x0000014C / 4) /* Carrier Sense Error Counter */ | ||
87 | -#define GEM_OCTRXLO (0x00000150 / 4) /* Octets Received register Low */ | ||
88 | -#define GEM_OCTRXHI (0x00000154 / 4) /* Octets Received register High */ | ||
89 | -#define GEM_RXCNT (0x00000158 / 4) /* Error-free Frames Received */ | ||
90 | -#define GEM_RXBROADCNT (0x0000015C / 4) /* Error-free Broadcast Frames RX */ | ||
91 | -#define GEM_RXMULTICNT (0x00000160 / 4) /* Error-free Multicast Frames RX */ | ||
92 | -#define GEM_RXPAUSECNT (0x00000164 / 4) /* Pause Frames Received Counter */ | ||
93 | -#define GEM_RX64CNT (0x00000168 / 4) /* Error-free 64 byte Frames RX */ | ||
94 | -#define GEM_RX65CNT (0x0000016C / 4) /* Error-free 65-127B Frames RX */ | ||
95 | -#define GEM_RX128CNT (0x00000170 / 4) /* Error-free 128-255B Frames RX */ | ||
96 | -#define GEM_RX256CNT (0x00000174 / 4) /* Error-free 256-512B Frames RX */ | ||
97 | -#define GEM_RX512CNT (0x00000178 / 4) /* Error-free 512-1023B Frames RX */ | ||
98 | -#define GEM_RX1024CNT (0x0000017C / 4) /* Error-free 1024-1518B Frames RX */ | ||
99 | -#define GEM_RX1519CNT (0x00000180 / 4) /* Error-free 1519-max Frames RX */ | ||
100 | -#define GEM_RXUNDERCNT (0x00000184 / 4) /* Undersize Frames Received */ | ||
101 | -#define GEM_RXOVERCNT (0x00000188 / 4) /* Oversize Frames Received */ | ||
102 | -#define GEM_RXJABCNT (0x0000018C / 4) /* Jabbers Received Counter */ | ||
103 | -#define GEM_RXFCSCNT (0x00000190 / 4) /* Frame Check seq. Error Counter */ | ||
104 | -#define GEM_RXLENERRCNT (0x00000194 / 4) /* Length Field Error Counter */ | ||
105 | -#define GEM_RXSYMERRCNT (0x00000198 / 4) /* Symbol Error Counter */ | ||
106 | -#define GEM_RXALIGNERRCNT (0x0000019C / 4) /* Alignment Error Counter */ | ||
107 | -#define GEM_RXRSCERRCNT (0x000001A0 / 4) /* Receive Resource Error Counter */ | ||
108 | -#define GEM_RXORUNCNT (0x000001A4 / 4) /* Receive Overrun Counter */ | ||
109 | -#define GEM_RXIPCSERRCNT (0x000001A8 / 4) /* IP header Checksum Err Counter */ | ||
110 | -#define GEM_RXTCPCCNT (0x000001AC / 4) /* TCP Checksum Error Counter */ | ||
111 | -#define GEM_RXUDPCCNT (0x000001B0 / 4) /* UDP Checksum Error Counter */ | ||
112 | +REG32(NWCTRL, 0x0) /* Network Control reg */ | ||
113 | +REG32(NWCFG, 0x4) /* Network Config reg */ | ||
114 | +REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
115 | +REG32(USERIO, 0xc) /* User IO reg */ | ||
116 | +REG32(DMACFG, 0x10) /* DMA Control reg */ | ||
117 | +REG32(TXSTATUS, 0x14) /* TX Status reg */ | ||
118 | +REG32(RXQBASE, 0x18) /* RX Q Base address reg */ | ||
119 | +REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ | ||
120 | +REG32(RXSTATUS, 0x20) /* RX Status reg */ | ||
121 | +REG32(ISR, 0x24) /* Interrupt Status reg */ | ||
122 | +REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
123 | +REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
124 | +REG32(IMR, 0x30) /* Interrupt Mask reg */ | ||
125 | +REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ | ||
126 | +REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ | ||
127 | +REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ | ||
128 | +REG32(TXPARTIALSF, 0x40) /* TX Partial Store and Forward */ | ||
129 | +REG32(RXPARTIALSF, 0x44) /* RX Partial Store and Forward */ | ||
130 | +REG32(JUMBO_MAX_LEN, 0x48) /* Max Jumbo Frame Size */ | ||
131 | +REG32(HASHLO, 0x80) /* Hash Low address reg */ | ||
132 | +REG32(HASHHI, 0x84) /* Hash High address reg */ | ||
133 | +REG32(SPADDR1LO, 0x88) /* Specific addr 1 low reg */ | ||
134 | +REG32(SPADDR1HI, 0x8c) /* Specific addr 1 high reg */ | ||
135 | +REG32(SPADDR2LO, 0x90) /* Specific addr 2 low reg */ | ||
136 | +REG32(SPADDR2HI, 0x94) /* Specific addr 2 high reg */ | ||
137 | +REG32(SPADDR3LO, 0x98) /* Specific addr 3 low reg */ | ||
138 | +REG32(SPADDR3HI, 0x9c) /* Specific addr 3 high reg */ | ||
139 | +REG32(SPADDR4LO, 0xa0) /* Specific addr 4 low reg */ | ||
140 | +REG32(SPADDR4HI, 0xa4) /* Specific addr 4 high reg */ | ||
141 | +REG32(TIDMATCH1, 0xa8) /* Type ID1 Match reg */ | ||
142 | +REG32(TIDMATCH2, 0xac) /* Type ID2 Match reg */ | ||
143 | +REG32(TIDMATCH3, 0xb0) /* Type ID3 Match reg */ | ||
144 | +REG32(TIDMATCH4, 0xb4) /* Type ID4 Match reg */ | ||
145 | +REG32(WOLAN, 0xb8) /* Wake on LAN reg */ | ||
146 | +REG32(IPGSTRETCH, 0xbc) /* IPG Stretch reg */ | ||
147 | +REG32(SVLAN, 0xc0) /* Stacked VLAN reg */ | ||
148 | +REG32(MODID, 0xfc) /* Module ID reg */ | ||
149 | +REG32(OCTTXLO, 0x100) /* Octects transmitted Low reg */ | ||
150 | +REG32(OCTTXHI, 0x104) /* Octects transmitted High reg */ | ||
151 | +REG32(TXCNT, 0x108) /* Error-free Frames transmitted */ | ||
152 | +REG32(TXBCNT, 0x10c) /* Error-free Broadcast Frames */ | ||
153 | +REG32(TXMCNT, 0x110) /* Error-free Multicast Frame */ | ||
154 | +REG32(TXPAUSECNT, 0x114) /* Pause Frames Transmitted */ | ||
155 | +REG32(TX64CNT, 0x118) /* Error-free 64 TX */ | ||
156 | +REG32(TX65CNT, 0x11c) /* Error-free 65-127 TX */ | ||
157 | +REG32(TX128CNT, 0x120) /* Error-free 128-255 TX */ | ||
158 | +REG32(TX256CNT, 0x124) /* Error-free 256-511 */ | ||
159 | +REG32(TX512CNT, 0x128) /* Error-free 512-1023 TX */ | ||
160 | +REG32(TX1024CNT, 0x12c) /* Error-free 1024-1518 TX */ | ||
161 | +REG32(TX1519CNT, 0x130) /* Error-free larger than 1519 TX */ | ||
162 | +REG32(TXURUNCNT, 0x134) /* TX under run error counter */ | ||
163 | +REG32(SINGLECOLLCNT, 0x138) /* Single Collision Frames */ | ||
164 | +REG32(MULTCOLLCNT, 0x13c) /* Multiple Collision Frames */ | ||
165 | +REG32(EXCESSCOLLCNT, 0x140) /* Excessive Collision Frames */ | ||
166 | +REG32(LATECOLLCNT, 0x144) /* Late Collision Frames */ | ||
167 | +REG32(DEFERTXCNT, 0x148) /* Deferred Transmission Frames */ | ||
168 | +REG32(CSENSECNT, 0x14c) /* Carrier Sense Error Counter */ | ||
169 | +REG32(OCTRXLO, 0x150) /* Octects Received register Low */ | ||
170 | +REG32(OCTRXHI, 0x154) /* Octects Received register High */ | ||
171 | +REG32(RXCNT, 0x158) /* Error-free Frames Received */ | ||
172 | +REG32(RXBROADCNT, 0x15c) /* Error-free Broadcast Frames RX */ | ||
173 | +REG32(RXMULTICNT, 0x160) /* Error-free Multicast Frames RX */ | ||
174 | +REG32(RXPAUSECNT, 0x164) /* Pause Frames Received Counter */ | ||
175 | +REG32(RX64CNT, 0x168) /* Error-free 64 byte Frames RX */ | ||
176 | +REG32(RX65CNT, 0x16c) /* Error-free 65-127B Frames RX */ | ||
177 | +REG32(RX128CNT, 0x170) /* Error-free 128-255B Frames RX */ | ||
178 | +REG32(RX256CNT, 0x174) /* Error-free 256-512B Frames RX */ | ||
179 | +REG32(RX512CNT, 0x178) /* Error-free 512-1023B Frames RX */ | ||
180 | +REG32(RX1024CNT, 0x17c) /* Error-free 1024-1518B Frames RX */ | ||
181 | +REG32(RX1519CNT, 0x180) /* Error-free 1519-max Frames RX */ | ||
182 | +REG32(RXUNDERCNT, 0x184) /* Undersize Frames Received */ | ||
183 | +REG32(RXOVERCNT, 0x188) /* Oversize Frames Received */ | ||
184 | +REG32(RXJABCNT, 0x18c) /* Jabbers Received Counter */ | ||
185 | +REG32(RXFCSCNT, 0x190) /* Frame Check seq. Error Counter */ | ||
186 | +REG32(RXLENERRCNT, 0x194) /* Length Field Error Counter */ | ||
187 | +REG32(RXSYMERRCNT, 0x198) /* Symbol Error Counter */ | ||
188 | +REG32(RXALIGNERRCNT, 0x19c) /* Alignment Error Counter */ | ||
189 | +REG32(RXRSCERRCNT, 0x1a0) /* Receive Resource Error Counter */ | ||
190 | +REG32(RXORUNCNT, 0x1a4) /* Receive Overrun Counter */ | ||
191 | +REG32(RXIPCSERRCNT, 0x1a8) /* IP header Checksum Err Counter */ | ||
192 | +REG32(RXTCPCCNT, 0x1ac) /* TCP Checksum Error Counter */ | ||
193 | +REG32(RXUDPCCNT, 0x1b0) /* UDP Checksum Error Counter */ | ||
194 | |||
195 | -#define GEM_1588S (0x000001D0 / 4) /* 1588 Timer Seconds */ | ||
196 | -#define GEM_1588NS (0x000001D4 / 4) /* 1588 Timer Nanoseconds */ | ||
197 | -#define GEM_1588ADJ (0x000001D8 / 4) /* 1588 Timer Adjust */ | ||
198 | -#define GEM_1588INC (0x000001DC / 4) /* 1588 Timer Increment */ | ||
199 | -#define GEM_PTPETXS (0x000001E0 / 4) /* PTP Event Frame Transmitted (s) */ | ||
200 | -#define GEM_PTPETXNS (0x000001E4 / 4) /* | ||
201 | - * PTP Event Frame Transmitted (ns) | ||
202 | - */ | ||
203 | -#define GEM_PTPERXS (0x000001E8 / 4) /* PTP Event Frame Received (s) */ | ||
204 | -#define GEM_PTPERXNS (0x000001EC / 4) /* PTP Event Frame Received (ns) */ | ||
205 | -#define GEM_PTPPTXS (0x000001E0 / 4) /* PTP Peer Frame Transmitted (s) */ | ||
206 | -#define GEM_PTPPTXNS (0x000001E4 / 4) /* PTP Peer Frame Transmitted (ns) */ | ||
207 | -#define GEM_PTPPRXS (0x000001E8 / 4) /* PTP Peer Frame Received (s) */ | ||
208 | -#define GEM_PTPPRXNS (0x000001EC / 4) /* PTP Peer Frame Received (ns) */ | ||
209 | +REG32(1588S, 0x1d0) /* 1588 Timer Seconds */ | ||
210 | +REG32(1588NS, 0x1d4) /* 1588 Timer Nanoseconds */ | ||
211 | +REG32(1588ADJ, 0x1d8) /* 1588 Timer Adjust */ | ||
212 | +REG32(1588INC, 0x1dc) /* 1588 Timer Increment */ | ||
213 | +REG32(PTPETXS, 0x1e0) /* PTP Event Frame Transmitted (s) */ | ||
214 | +REG32(PTPETXNS, 0x1e4) /* PTP Event Frame Transmitted (ns) */ | ||
215 | +REG32(PTPERXS, 0x1e8) /* PTP Event Frame Received (s) */ | ||
216 | +REG32(PTPERXNS, 0x1ec) /* PTP Event Frame Received (ns) */ | ||
217 | +REG32(PTPPTXS, 0x1e0) /* PTP Peer Frame Transmitted (s) */ | ||
218 | +REG32(PTPPTXNS, 0x1e4) /* PTP Peer Frame Transmitted (ns) */ | ||
219 | +REG32(PTPPRXS, 0x1e8) /* PTP Peer Frame Received (s) */ | ||
220 | +REG32(PTPPRXNS, 0x1ec) /* PTP Peer Frame Received (ns) */ | ||
221 | |||
222 | /* Design Configuration Registers */ | ||
223 | -#define GEM_DESCONF (0x00000280 / 4) | ||
224 | -#define GEM_DESCONF2 (0x00000284 / 4) | ||
225 | -#define GEM_DESCONF3 (0x00000288 / 4) | ||
226 | -#define GEM_DESCONF4 (0x0000028C / 4) | ||
227 | -#define GEM_DESCONF5 (0x00000290 / 4) | ||
228 | -#define GEM_DESCONF6 (0x00000294 / 4) | ||
229 | +REG32(DESCONF, 0x280) | ||
230 | +REG32(DESCONF2, 0x284) | ||
231 | +REG32(DESCONF3, 0x288) | ||
232 | +REG32(DESCONF4, 0x28c) | ||
233 | +REG32(DESCONF5, 0x290) | ||
234 | +REG32(DESCONF6, 0x294) | ||
235 | #define GEM_DESCONF6_64B_MASK (1U << 23) | ||
236 | -#define GEM_DESCONF7 (0x00000298 / 4) | ||
237 | +REG32(DESCONF7, 0x298) | ||
238 | |||
239 | -#define GEM_INT_Q1_STATUS (0x00000400 / 4) | ||
240 | -#define GEM_INT_Q1_MASK (0x00000640 / 4) | ||
241 | +REG32(INT_Q1_STATUS, 0x400) | ||
242 | +REG32(INT_Q1_MASK, 0x640) | ||
243 | |||
244 | -#define GEM_TRANSMIT_Q1_PTR (0x00000440 / 4) | ||
245 | -#define GEM_TRANSMIT_Q7_PTR (GEM_TRANSMIT_Q1_PTR + 6) | ||
246 | +REG32(TRANSMIT_Q1_PTR, 0x440) | ||
247 | +REG32(TRANSMIT_Q7_PTR, 0x458) | ||
248 | |||
249 | -#define GEM_RECEIVE_Q1_PTR (0x00000480 / 4) | ||
250 | -#define GEM_RECEIVE_Q7_PTR (GEM_RECEIVE_Q1_PTR + 6) | ||
251 | +REG32(RECEIVE_Q1_PTR, 0x480) | ||
252 | +REG32(RECEIVE_Q7_PTR, 0x498) | ||
253 | |||
254 | -#define GEM_TBQPH (0x000004C8 / 4) | ||
255 | -#define GEM_RBQPH (0x000004D4 / 4) | ||
256 | +REG32(TBQPH, 0x4c8) | ||
257 | +REG32(RBQPH, 0x4d4) | ||
258 | |||
259 | -#define GEM_INT_Q1_ENABLE (0x00000600 / 4) | ||
260 | -#define GEM_INT_Q7_ENABLE (GEM_INT_Q1_ENABLE + 6) | ||
261 | +REG32(INT_Q1_ENABLE, 0x600) | ||
262 | +REG32(INT_Q7_ENABLE, 0x618) | ||
263 | |||
264 | -#define GEM_INT_Q1_DISABLE (0x00000620 / 4) | ||
265 | -#define GEM_INT_Q7_DISABLE (GEM_INT_Q1_DISABLE + 6) | ||
266 | +REG32(INT_Q1_DISABLE, 0x620) | ||
267 | +REG32(INT_Q7_DISABLE, 0x638) | ||
268 | |||
269 | -#define GEM_INT_Q1_MASK (0x00000640 / 4) | ||
270 | -#define GEM_INT_Q7_MASK (GEM_INT_Q1_MASK + 6) | ||
271 | - | ||
272 | -#define GEM_SCREENING_TYPE1_REGISTER_0 (0x00000500 / 4) | ||
273 | +REG32(SCREENING_TYPE1_REG0, 0x500) | ||
274 | |||
275 | #define GEM_ST1R_UDP_PORT_MATCH_ENABLE (1 << 29) | ||
276 | #define GEM_ST1R_DSTC_ENABLE (1 << 28) | ||
277 | @@ -XXX,XX +XXX,XX @@ | ||
278 | #define GEM_ST1R_QUEUE_SHIFT (0) | ||
279 | #define GEM_ST1R_QUEUE_WIDTH (3 - GEM_ST1R_QUEUE_SHIFT + 1) | ||
280 | |||
281 | -#define GEM_SCREENING_TYPE2_REGISTER_0 (0x00000540 / 4) | ||
282 | +REG32(SCREENING_TYPE2_REG0, 0x540) | ||
283 | |||
284 | #define GEM_ST2R_COMPARE_A_ENABLE (1 << 18) | ||
285 | #define GEM_ST2R_COMPARE_A_SHIFT (13) | ||
286 | @@ -XXX,XX +XXX,XX @@ | ||
287 | #define GEM_ST2R_QUEUE_SHIFT (0) | ||
288 | #define GEM_ST2R_QUEUE_WIDTH (3 - GEM_ST2R_QUEUE_SHIFT + 1) | ||
289 | |||
290 | -#define GEM_SCREENING_TYPE2_ETHERTYPE_REG_0 (0x000006e0 / 4) | ||
291 | -#define GEM_TYPE2_COMPARE_0_WORD_0 (0x00000700 / 4) | ||
292 | +REG32(SCREENING_TYPE2_ETHERTYPE_REG0, 0x6e0) | ||
293 | +REG32(TYPE2_COMPARE_0_WORD_0, 0x700) | ||
294 | |||
295 | #define GEM_T2CW1_COMPARE_OFFSET_SHIFT (7) | ||
296 | #define GEM_T2CW1_COMPARE_OFFSET_WIDTH (8 - GEM_T2CW1_COMPARE_OFFSET_SHIFT + 1) | ||
297 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t tx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
36 | { | 298 | { |
37 | { | 299 | uint64_t ret = desc[0]; |
38 | - YIELD ---- 0011 0010 0000 1111 ---- 0000 0001 | 300 | |
39 | - WFE ---- 0011 0010 0000 1111 ---- 0000 0010 | 301 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { |
40 | - WFI ---- 0011 0010 0000 1111 ---- 0000 0011 | 302 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { |
41 | + [ | 303 | ret |= (uint64_t)desc[2] << 32; |
42 | + YIELD ---- 0011 0010 0000 1111 ---- 0000 0001 | 304 | } |
43 | + WFE ---- 0011 0010 0000 1111 ---- 0000 0010 | 305 | return ret; |
44 | + WFI ---- 0011 0010 0000 1111 ---- 0000 0011 | 306 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t rx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) |
45 | 307 | { | |
46 | - # TODO: Implement SEV, SEVL; may help SMP performance. | 308 | uint64_t ret = desc[0] & ~0x3UL; |
47 | - # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 | 309 | |
48 | - # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 | 310 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { |
49 | + # TODO: Implement SEV, SEVL; may help SMP performance. | 311 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { |
50 | + # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 | 312 | ret |= (uint64_t)desc[2] << 32; |
51 | + # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 | 313 | } |
52 | + | 314 | return ret; |
53 | + ESB ---- 0011 0010 0000 1111 ---- 0001 0000 | 315 | @@ -XXX,XX +XXX,XX @@ static inline int gem_get_desc_len(CadenceGEMState *s, bool rx_n_tx) |
54 | + ] | 316 | { |
55 | 317 | int ret = 2; | |
56 | # The canonical nop ends in 00000000, but the whole of the | 318 | |
57 | # rest of the space executes as nop if otherwise unsupported. | 319 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { |
58 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | 320 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { |
59 | index XXXXXXX..XXXXXXX 100644 | 321 | ret += 2; |
60 | --- a/target/arm/t32.decode | 322 | } |
61 | +++ b/target/arm/t32.decode | 323 | - if (s->regs[GEM_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT |
62 | @@ -XXX,XX +XXX,XX @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .... @rdm | 324 | + if (s->regs[R_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT |
63 | [ | 325 | : GEM_DMACFG_TX_BD_EXT)) { |
64 | # Hints, and CPS | 326 | ret += 2; |
65 | { | 327 | } |
66 | - YIELD 1111 0011 1010 1111 1000 0000 0000 0001 | 328 | @@ -XXX,XX +XXX,XX @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
67 | - WFE 1111 0011 1010 1111 1000 0000 0000 0010 | 329 | static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) |
68 | - WFI 1111 0011 1010 1111 1000 0000 0000 0011 | 330 | { |
69 | + [ | 331 | uint32_t size; |
70 | + YIELD 1111 0011 1010 1111 1000 0000 0000 0001 | 332 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { |
71 | + WFE 1111 0011 1010 1111 1000 0000 0000 0010 | 333 | - size = s->regs[GEM_JUMBO_MAX_LEN]; |
72 | + WFI 1111 0011 1010 1111 1000 0000 0000 0011 | 334 | + if (s->regs[R_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { |
73 | 335 | + size = s->regs[R_JUMBO_MAX_LEN]; | |
74 | - # TODO: Implement SEV, SEVL; may help SMP performance. | 336 | if (size > s->jumbo_max_len) { |
75 | - # SEV 1111 0011 1010 1111 1000 0000 0000 0100 | 337 | size = s->jumbo_max_len; |
76 | - # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 | 338 | qemu_log_mask(LOG_GUEST_ERROR, "GEM_JUMBO_MAX_LEN reg cannot be" |
77 | + # TODO: Implement SEV, SEVL; may help SMP performance. | 339 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) |
78 | + # SEV 1111 0011 1010 1111 1000 0000 0000 0100 | 340 | } else if (tx) { |
79 | + # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 | 341 | size = 1518; |
80 | 342 | } else { | |
81 | - # For M-profile minimal-RAS ESB can be a NOP, which is the | 343 | - size = s->regs[GEM_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; |
82 | - # default behaviour since it is in the hint space. | 344 | + size = s->regs[R_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; |
83 | - # ESB 1111 0011 1010 1111 1000 0000 0001 0000 | 345 | } |
84 | + ESB 1111 0011 1010 1111 1000 0000 0001 0000 | 346 | return size; |
85 | + ] | ||
86 | |||
87 | # The canonical nop ends in 0000 0000, but the whole rest | ||
88 | # of the space is "reserved hint, behaves as nop". | ||
89 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/target/arm/op_helper.c | ||
92 | +++ b/target/arm/op_helper.c | ||
93 | @@ -XXX,XX +XXX,XX @@ void HELPER(probe_access)(CPUARMState *env, target_ulong ptr, | ||
94 | access_type, mmu_idx, ra); | ||
95 | } | ||
96 | } | 347 | } |
97 | + | 348 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) |
98 | +/* | 349 | static void gem_set_isr(CadenceGEMState *s, int q, uint32_t flag) |
99 | + * This function corresponds to AArch64.vESBOperation(). | 350 | { |
100 | + * Note that the AArch32 version is not functionally different. | 351 | if (q == 0) { |
101 | + */ | 352 | - s->regs[GEM_ISR] |= flag & ~(s->regs[GEM_IMR]); |
102 | +void HELPER(vesb)(CPUARMState *env) | 353 | + s->regs[R_ISR] |= flag & ~(s->regs[R_IMR]); |
103 | +{ | 354 | } else { |
104 | + /* | 355 | - s->regs[GEM_INT_Q1_STATUS + q - 1] |= flag & |
105 | + * The EL2Enabled() check is done inside arm_hcr_el2_eff, | 356 | - ~(s->regs[GEM_INT_Q1_MASK + q - 1]); |
106 | + * and will return HCR_EL2.VSE == 0, so nothing happens. | 357 | + s->regs[R_INT_Q1_STATUS + q - 1] |= flag & |
107 | + */ | 358 | + ~(s->regs[R_INT_Q1_MASK + q - 1]); |
108 | + uint64_t hcr = arm_hcr_el2_eff(env); | 359 | } |
109 | + bool enabled = !(hcr & HCR_TGE) && (hcr & HCR_AMO); | 360 | } |
110 | + bool pending = enabled && (hcr & HCR_VSE); | 361 | |
111 | + bool masked = (env->daif & PSTATE_A); | 362 | @@ -XXX,XX +XXX,XX @@ static void gem_init_register_masks(CadenceGEMState *s) |
112 | + | 363 | unsigned int i; |
113 | + /* If VSE pending and masked, defer the exception. */ | 364 | /* Mask of register bits which are read only */ |
114 | + if (pending && masked) { | 365 | memset(&s->regs_ro[0], 0, sizeof(s->regs_ro)); |
115 | + uint32_t syndrome; | 366 | - s->regs_ro[GEM_NWCTRL] = 0xFFF80000; |
116 | + | 367 | - s->regs_ro[GEM_NWSTATUS] = 0xFFFFFFFF; |
117 | + if (arm_el_is_aa64(env, 1)) { | 368 | - s->regs_ro[GEM_DMACFG] = 0x8E00F000; |
118 | + /* Copy across IDS and ISS from VSESR. */ | 369 | - s->regs_ro[GEM_TXSTATUS] = 0xFFFFFE08; |
119 | + syndrome = env->cp15.vsesr_el2 & 0x1ffffff; | 370 | - s->regs_ro[GEM_RXQBASE] = 0x00000003; |
120 | + } else { | 371 | - s->regs_ro[GEM_TXQBASE] = 0x00000003; |
121 | + ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal }; | 372 | - s->regs_ro[GEM_RXSTATUS] = 0xFFFFFFF0; |
122 | + | 373 | - s->regs_ro[GEM_ISR] = 0xFFFFFFFF; |
123 | + if (extended_addresses_enabled(env)) { | 374 | - s->regs_ro[GEM_IMR] = 0xFFFFFFFF; |
124 | + syndrome = arm_fi_to_lfsc(&fi); | 375 | - s->regs_ro[GEM_MODID] = 0xFFFFFFFF; |
125 | + } else { | 376 | + s->regs_ro[R_NWCTRL] = 0xFFF80000; |
126 | + syndrome = arm_fi_to_sfsc(&fi); | 377 | + s->regs_ro[R_NWSTATUS] = 0xFFFFFFFF; |
127 | + } | 378 | + s->regs_ro[R_DMACFG] = 0x8E00F000; |
128 | + /* Copy across AET and ExT from VSESR. */ | 379 | + s->regs_ro[R_TXSTATUS] = 0xFFFFFE08; |
129 | + syndrome |= env->cp15.vsesr_el2 & 0xd000; | 380 | + s->regs_ro[R_RXQBASE] = 0x00000003; |
130 | + } | 381 | + s->regs_ro[R_TXQBASE] = 0x00000003; |
131 | + | 382 | + s->regs_ro[R_RXSTATUS] = 0xFFFFFFF0; |
132 | + /* Set VDISR_EL2.A along with the syndrome. */ | 383 | + s->regs_ro[R_ISR] = 0xFFFFFFFF; |
133 | + env->cp15.vdisr_el2 = syndrome | (1u << 31); | 384 | + s->regs_ro[R_IMR] = 0xFFFFFFFF; |
134 | + | 385 | + s->regs_ro[R_MODID] = 0xFFFFFFFF; |
135 | + /* Clear pending virtual SError */ | 386 | for (i = 0; i < s->num_priority_queues; i++) { |
136 | + env->cp15.hcr_el2 &= ~HCR_VSE; | 387 | - s->regs_ro[GEM_INT_Q1_STATUS + i] = 0xFFFFFFFF; |
137 | + cpu_reset_interrupt(env_cpu(env), CPU_INTERRUPT_VSERR); | 388 | - s->regs_ro[GEM_INT_Q1_ENABLE + i] = 0xFFFFF319; |
138 | + } | 389 | - s->regs_ro[GEM_INT_Q1_DISABLE + i] = 0xFFFFF319; |
139 | +} | 390 | - s->regs_ro[GEM_INT_Q1_MASK + i] = 0xFFFFFFFF; |
140 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 391 | + s->regs_ro[R_INT_Q1_STATUS + i] = 0xFFFFFFFF; |
141 | index XXXXXXX..XXXXXXX 100644 | 392 | + s->regs_ro[R_INT_Q1_ENABLE + i] = 0xFFFFF319; |
142 | --- a/target/arm/translate-a64.c | 393 | + s->regs_ro[R_INT_Q1_DISABLE + i] = 0xFFFFF319; |
143 | +++ b/target/arm/translate-a64.c | 394 | + s->regs_ro[R_INT_Q1_MASK + i] = 0xFFFFFFFF; |
144 | @@ -XXX,XX +XXX,XX @@ static void handle_hint(DisasContext *s, uint32_t insn, | 395 | } |
145 | gen_helper_autib(cpu_X[17], cpu_env, cpu_X[17], cpu_X[16]); | 396 | |
397 | /* Mask of register bits which are clear on read */ | ||
398 | memset(&s->regs_rtc[0], 0, sizeof(s->regs_rtc)); | ||
399 | - s->regs_rtc[GEM_ISR] = 0xFFFFFFFF; | ||
400 | + s->regs_rtc[R_ISR] = 0xFFFFFFFF; | ||
401 | for (i = 0; i < s->num_priority_queues; i++) { | ||
402 | - s->regs_rtc[GEM_INT_Q1_STATUS + i] = 0x00000CE6; | ||
403 | + s->regs_rtc[R_INT_Q1_STATUS + i] = 0x00000CE6; | ||
404 | } | ||
405 | |||
406 | /* Mask of register bits which are write 1 to clear */ | ||
407 | memset(&s->regs_w1c[0], 0, sizeof(s->regs_w1c)); | ||
408 | - s->regs_w1c[GEM_TXSTATUS] = 0x000001F7; | ||
409 | - s->regs_w1c[GEM_RXSTATUS] = 0x0000000F; | ||
410 | + s->regs_w1c[R_TXSTATUS] = 0x000001F7; | ||
411 | + s->regs_w1c[R_RXSTATUS] = 0x0000000F; | ||
412 | |||
413 | /* Mask of register bits which are write only */ | ||
414 | memset(&s->regs_wo[0], 0, sizeof(s->regs_wo)); | ||
415 | - s->regs_wo[GEM_NWCTRL] = 0x00073E60; | ||
416 | - s->regs_wo[GEM_IER] = 0x07FFFFFF; | ||
417 | - s->regs_wo[GEM_IDR] = 0x07FFFFFF; | ||
418 | + s->regs_wo[R_NWCTRL] = 0x00073E60; | ||
419 | + s->regs_wo[R_IER] = 0x07FFFFFF; | ||
420 | + s->regs_wo[R_IDR] = 0x07FFFFFF; | ||
421 | for (i = 0; i < s->num_priority_queues; i++) { | ||
422 | - s->regs_wo[GEM_INT_Q1_ENABLE + i] = 0x00000CE6; | ||
423 | - s->regs_wo[GEM_INT_Q1_DISABLE + i] = 0x00000CE6; | ||
424 | + s->regs_wo[R_INT_Q1_ENABLE + i] = 0x00000CE6; | ||
425 | + s->regs_wo[R_INT_Q1_DISABLE + i] = 0x00000CE6; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | @@ -XXX,XX +XXX,XX @@ static bool gem_can_receive(NetClientState *nc) | ||
430 | s = qemu_get_nic_opaque(nc); | ||
431 | |||
432 | /* Do nothing if receive is not enabled. */ | ||
433 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
434 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
435 | if (s->can_rx_state != 1) { | ||
436 | s->can_rx_state = 1; | ||
437 | DB_PRINT("can't receive - no enable\n"); | ||
438 | @@ -XXX,XX +XXX,XX @@ static void gem_update_int_status(CadenceGEMState *s) | ||
439 | { | ||
440 | int i; | ||
441 | |||
442 | - qemu_set_irq(s->irq[0], !!s->regs[GEM_ISR]); | ||
443 | + qemu_set_irq(s->irq[0], !!s->regs[R_ISR]); | ||
444 | |||
445 | for (i = 1; i < s->num_priority_queues; ++i) { | ||
446 | - qemu_set_irq(s->irq[i], !!s->regs[GEM_INT_Q1_STATUS + i - 1]); | ||
447 | + qemu_set_irq(s->irq[i], !!s->regs[R_INT_Q1_STATUS + i - 1]); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | @@ -XXX,XX +XXX,XX @@ static void gem_receive_updatestats(CadenceGEMState *s, const uint8_t *packet, | ||
452 | uint64_t octets; | ||
453 | |||
454 | /* Total octets (bytes) received */ | ||
455 | - octets = ((uint64_t)(s->regs[GEM_OCTRXLO]) << 32) | | ||
456 | - s->regs[GEM_OCTRXHI]; | ||
457 | + octets = ((uint64_t)(s->regs[R_OCTRXLO]) << 32) | | ||
458 | + s->regs[R_OCTRXHI]; | ||
459 | octets += bytes; | ||
460 | - s->regs[GEM_OCTRXLO] = octets >> 32; | ||
461 | - s->regs[GEM_OCTRXHI] = octets; | ||
462 | + s->regs[R_OCTRXLO] = octets >> 32; | ||
463 | + s->regs[R_OCTRXHI] = octets; | ||
464 | |||
465 | /* Error-free Frames received */ | ||
466 | - s->regs[GEM_RXCNT]++; | ||
467 | + s->regs[R_RXCNT]++; | ||
468 | |||
469 | /* Error-free Broadcast Frames counter */ | ||
470 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
471 | - s->regs[GEM_RXBROADCNT]++; | ||
472 | + s->regs[R_RXBROADCNT]++; | ||
473 | } | ||
474 | |||
475 | /* Error-free Multicast Frames counter */ | ||
476 | if (packet[0] == 0x01) { | ||
477 | - s->regs[GEM_RXMULTICNT]++; | ||
478 | + s->regs[R_RXMULTICNT]++; | ||
479 | } | ||
480 | |||
481 | if (bytes <= 64) { | ||
482 | - s->regs[GEM_RX64CNT]++; | ||
483 | + s->regs[R_RX64CNT]++; | ||
484 | } else if (bytes <= 127) { | ||
485 | - s->regs[GEM_RX65CNT]++; | ||
486 | + s->regs[R_RX65CNT]++; | ||
487 | } else if (bytes <= 255) { | ||
488 | - s->regs[GEM_RX128CNT]++; | ||
489 | + s->regs[R_RX128CNT]++; | ||
490 | } else if (bytes <= 511) { | ||
491 | - s->regs[GEM_RX256CNT]++; | ||
492 | + s->regs[R_RX256CNT]++; | ||
493 | } else if (bytes <= 1023) { | ||
494 | - s->regs[GEM_RX512CNT]++; | ||
495 | + s->regs[R_RX512CNT]++; | ||
496 | } else if (bytes <= 1518) { | ||
497 | - s->regs[GEM_RX1024CNT]++; | ||
498 | + s->regs[R_RX1024CNT]++; | ||
499 | } else { | ||
500 | - s->regs[GEM_RX1519CNT]++; | ||
501 | + s->regs[R_RX1519CNT]++; | ||
502 | } | ||
503 | } | ||
504 | |||
505 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) | ||
506 | int i, is_mc; | ||
507 | |||
508 | /* Promiscuous mode? */ | ||
509 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_PROMISC) { | ||
510 | + if (s->regs[R_NWCFG] & GEM_NWCFG_PROMISC) { | ||
511 | return GEM_RX_PROMISCUOUS_ACCEPT; | ||
512 | } | ||
513 | |||
514 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
515 | /* Reject broadcast packets? */ | ||
516 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_BCAST_REJ) { | ||
517 | + if (s->regs[R_NWCFG] & GEM_NWCFG_BCAST_REJ) { | ||
518 | return GEM_RX_REJECT; | ||
146 | } | 519 | } |
147 | break; | 520 | return GEM_RX_BROADCAST_ACCEPT; |
148 | + case 0b10000: /* ESB */ | 521 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) |
149 | + /* Without RAS, we must implement this as NOP. */ | 522 | |
150 | + if (dc_isar_feature(aa64_ras, s)) { | 523 | /* Accept packets -w- hash match? */ |
151 | + /* | 524 | is_mc = is_multicast_ether_addr(packet); |
152 | + * QEMU does not have a source of physical SErrors, | 525 | - if ((is_mc && (s->regs[GEM_NWCFG] & GEM_NWCFG_MCAST_HASH)) || |
153 | + * so we are only concerned with virtual SErrors. | 526 | - (!is_mc && (s->regs[GEM_NWCFG] & GEM_NWCFG_UCAST_HASH))) { |
154 | + * The pseudocode in the ARM for this case is | 527 | + if ((is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_MCAST_HASH)) || |
155 | + * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then | 528 | + (!is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_UCAST_HASH))) { |
156 | + * AArch64.vESBOperation(); | 529 | uint64_t buckets; |
157 | + * Most of the condition can be evaluated at translation time. | 530 | unsigned hash_index; |
158 | + * Test for EL2 present, and defer test for SEL2 to runtime. | 531 | |
159 | + */ | 532 | hash_index = calc_mac_hash(packet); |
160 | + if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) { | 533 | - buckets = ((uint64_t)s->regs[GEM_HASHHI] << 32) | s->regs[GEM_HASHLO]; |
161 | + gen_helper_vesb(cpu_env); | 534 | + buckets = ((uint64_t)s->regs[R_HASHHI] << 32) | s->regs[R_HASHLO]; |
162 | + } | 535 | if ((buckets >> hash_index) & 1) { |
163 | + } | 536 | return is_mc ? GEM_RX_MULTICAST_HASH_ACCEPT |
164 | + break; | 537 | : GEM_RX_UNICAST_HASH_ACCEPT; |
165 | case 0b11000: /* PACIAZ */ | 538 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) |
166 | if (s->pauth_active) { | 539 | } |
167 | gen_helper_pacia(cpu_X[30], cpu_env, cpu_X[30], | 540 | |
168 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 541 | /* Check all 4 specific addresses */ |
169 | index XXXXXXX..XXXXXXX 100644 | 542 | - gem_spaddr = (uint8_t *)&(s->regs[GEM_SPADDR1LO]); |
170 | --- a/target/arm/translate.c | 543 | + gem_spaddr = (uint8_t *)&(s->regs[R_SPADDR1LO]); |
171 | +++ b/target/arm/translate.c | 544 | for (i = 3; i >= 0; i--) { |
172 | @@ -XXX,XX +XXX,XX @@ static bool trans_WFI(DisasContext *s, arg_WFI *a) | 545 | if (s->sar_active[i] && !memcmp(packet, gem_spaddr + 8 * i, 6)) { |
173 | return true; | 546 | return GEM_RX_SAR_ACCEPT + i; |
547 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
548 | int i, j; | ||
549 | |||
550 | for (i = 0; i < s->num_type1_screeners; i++) { | ||
551 | - reg = s->regs[GEM_SCREENING_TYPE1_REGISTER_0 + i]; | ||
552 | + reg = s->regs[R_SCREENING_TYPE1_REG0 + i]; | ||
553 | matched = false; | ||
554 | mismatched = false; | ||
555 | |||
556 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
557 | } | ||
558 | |||
559 | for (i = 0; i < s->num_type2_screeners; i++) { | ||
560 | - reg = s->regs[GEM_SCREENING_TYPE2_REGISTER_0 + i]; | ||
561 | + reg = s->regs[R_SCREENING_TYPE2_REG0 + i]; | ||
562 | matched = false; | ||
563 | mismatched = false; | ||
564 | |||
565 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
566 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range ethertype " | ||
567 | "register index: %d\n", et_idx); | ||
568 | } | ||
569 | - if (type == s->regs[GEM_SCREENING_TYPE2_ETHERTYPE_REG_0 + | ||
570 | + if (type == s->regs[R_SCREENING_TYPE2_ETHERTYPE_REG0 + | ||
571 | et_idx]) { | ||
572 | matched = true; | ||
573 | } else { | ||
574 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
575 | "register index: %d\n", cr_idx); | ||
576 | } | ||
577 | |||
578 | - cr0 = s->regs[GEM_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; | ||
579 | - cr1 = s->regs[GEM_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; | ||
580 | + cr0 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; | ||
581 | + cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; | ||
582 | offset = extract32(cr1, GEM_T2CW1_OFFSET_VALUE_SHIFT, | ||
583 | GEM_T2CW1_OFFSET_VALUE_WIDTH); | ||
584 | |||
585 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_queue_base_addr(CadenceGEMState *s, bool tx, int q) | ||
586 | |||
587 | switch (q) { | ||
588 | case 0: | ||
589 | - base_addr = s->regs[tx ? GEM_TXQBASE : GEM_RXQBASE]; | ||
590 | + base_addr = s->regs[tx ? R_TXQBASE : R_RXQBASE]; | ||
591 | break; | ||
592 | case 1 ... (MAX_PRIORITY_QUEUES - 1): | ||
593 | - base_addr = s->regs[(tx ? GEM_TRANSMIT_Q1_PTR : | ||
594 | - GEM_RECEIVE_Q1_PTR) + q - 1]; | ||
595 | + base_addr = s->regs[(tx ? R_TRANSMIT_Q1_PTR : | ||
596 | + R_RECEIVE_Q1_PTR) + q - 1]; | ||
597 | break; | ||
598 | default: | ||
599 | g_assert_not_reached(); | ||
600 | @@ -XXX,XX +XXX,XX @@ static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q) | ||
601 | { | ||
602 | hwaddr desc_addr = 0; | ||
603 | |||
604 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
605 | - desc_addr = s->regs[tx ? GEM_TBQPH : GEM_RBQPH]; | ||
606 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
607 | + desc_addr = s->regs[tx ? R_TBQPH : R_RBQPH]; | ||
608 | } | ||
609 | desc_addr <<= 32; | ||
610 | desc_addr |= tx ? s->tx_desc_addr[q] : s->rx_desc_addr[q]; | ||
611 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) | ||
612 | /* Descriptor owned by software ? */ | ||
613 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { | ||
614 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); | ||
615 | - s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_NOBUF; | ||
616 | + s->regs[R_RXSTATUS] |= GEM_RXSTATUS_NOBUF; | ||
617 | gem_set_isr(s, q, GEM_INT_RXUSED); | ||
618 | /* Handle interrupt consequences */ | ||
619 | gem_update_int_status(s); | ||
620 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
621 | } | ||
622 | |||
623 | /* Discard packets with receive length error enabled ? */ | ||
624 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
625 | + if (s->regs[R_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
626 | unsigned type_len; | ||
627 | |||
628 | /* Fish the ethertype / length field out of the RX packet */ | ||
629 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
630 | /* | ||
631 | * Determine configured receive buffer offset (probably 0) | ||
632 | */ | ||
633 | - rxbuf_offset = (s->regs[GEM_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
634 | + rxbuf_offset = (s->regs[R_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
635 | GEM_NWCFG_BUFF_OFST_S; | ||
636 | |||
637 | /* The configure size of each receive buffer. Determines how many | ||
638 | * buffers needed to hold this packet. | ||
639 | */ | ||
640 | - rxbufsize = ((s->regs[GEM_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
641 | + rxbufsize = ((s->regs[R_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
642 | GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; | ||
643 | bytes_to_copy = size; | ||
644 | |||
645 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
646 | } | ||
647 | |||
648 | /* Strip of FCS field ? (usually yes) */ | ||
649 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
650 | + if (s->regs[R_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
651 | rxbuf_ptr = (void *)buf; | ||
652 | } else { | ||
653 | unsigned crc_val; | ||
654 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
655 | /* Count it */ | ||
656 | gem_receive_updatestats(s, buf, size); | ||
657 | |||
658 | - s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; | ||
659 | + s->regs[R_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; | ||
660 | gem_set_isr(s, q, GEM_INT_RXCMPL); | ||
661 | |||
662 | /* Handle interrupt consequences */ | ||
663 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit_updatestats(CadenceGEMState *s, const uint8_t *packet, | ||
664 | uint64_t octets; | ||
665 | |||
666 | /* Total octets (bytes) transmitted */ | ||
667 | - octets = ((uint64_t)(s->regs[GEM_OCTTXLO]) << 32) | | ||
668 | - s->regs[GEM_OCTTXHI]; | ||
669 | + octets = ((uint64_t)(s->regs[R_OCTTXLO]) << 32) | | ||
670 | + s->regs[R_OCTTXHI]; | ||
671 | octets += bytes; | ||
672 | - s->regs[GEM_OCTTXLO] = octets >> 32; | ||
673 | - s->regs[GEM_OCTTXHI] = octets; | ||
674 | + s->regs[R_OCTTXLO] = octets >> 32; | ||
675 | + s->regs[R_OCTTXHI] = octets; | ||
676 | |||
677 | /* Error-free Frames transmitted */ | ||
678 | - s->regs[GEM_TXCNT]++; | ||
679 | + s->regs[R_TXCNT]++; | ||
680 | |||
681 | /* Error-free Broadcast Frames counter */ | ||
682 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
683 | - s->regs[GEM_TXBCNT]++; | ||
684 | + s->regs[R_TXBCNT]++; | ||
685 | } | ||
686 | |||
687 | /* Error-free Multicast Frames counter */ | ||
688 | if (packet[0] == 0x01) { | ||
689 | - s->regs[GEM_TXMCNT]++; | ||
690 | + s->regs[R_TXMCNT]++; | ||
691 | } | ||
692 | |||
693 | if (bytes <= 64) { | ||
694 | - s->regs[GEM_TX64CNT]++; | ||
695 | + s->regs[R_TX64CNT]++; | ||
696 | } else if (bytes <= 127) { | ||
697 | - s->regs[GEM_TX65CNT]++; | ||
698 | + s->regs[R_TX65CNT]++; | ||
699 | } else if (bytes <= 255) { | ||
700 | - s->regs[GEM_TX128CNT]++; | ||
701 | + s->regs[R_TX128CNT]++; | ||
702 | } else if (bytes <= 511) { | ||
703 | - s->regs[GEM_TX256CNT]++; | ||
704 | + s->regs[R_TX256CNT]++; | ||
705 | } else if (bytes <= 1023) { | ||
706 | - s->regs[GEM_TX512CNT]++; | ||
707 | + s->regs[R_TX512CNT]++; | ||
708 | } else if (bytes <= 1518) { | ||
709 | - s->regs[GEM_TX1024CNT]++; | ||
710 | + s->regs[R_TX1024CNT]++; | ||
711 | } else { | ||
712 | - s->regs[GEM_TX1519CNT]++; | ||
713 | + s->regs[R_TX1519CNT]++; | ||
714 | } | ||
174 | } | 715 | } |
175 | 716 | ||
176 | +static bool trans_ESB(DisasContext *s, arg_ESB *a) | 717 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
177 | +{ | 718 | int q = 0; |
178 | + /* | 719 | |
179 | + * For M-profile, minimal-RAS ESB can be a NOP. | 720 | /* Do nothing if transmit is not enabled. */ |
180 | + * Without RAS, we must implement this as NOP. | 721 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { |
181 | + */ | 722 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { |
182 | + if (!arm_dc_feature(s, ARM_FEATURE_M) && dc_isar_feature(aa32_ras, s)) { | 723 | return; |
183 | + /* | 724 | } |
184 | + * QEMU does not have a source of physical SErrors, | 725 | |
185 | + * so we are only concerned with virtual SErrors. | 726 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
186 | + * The pseudocode in the ARM for this case is | 727 | while (tx_desc_get_used(desc) == 0) { |
187 | + * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then | 728 | |
188 | + * AArch32.vESBOperation(); | 729 | /* Do nothing if transmit is not enabled. */ |
189 | + * Most of the condition can be evaluated at translation time. | 730 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { |
190 | + * Test for EL2 present, and defer test for SEL2 to runtime. | 731 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { |
191 | + */ | 732 | return; |
192 | + if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) { | 733 | } |
193 | + gen_helper_vesb(cpu_env); | 734 | print_gem_tx_desc(desc, q); |
194 | + } | 735 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
195 | + } | 736 | } |
196 | + return true; | 737 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); |
197 | +} | 738 | |
198 | + | 739 | - s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; |
199 | static bool trans_NOP(DisasContext *s, arg_NOP *a) | 740 | + s->regs[R_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; |
200 | { | 741 | gem_set_isr(s, q, GEM_INT_TXCMPL); |
201 | return true; | 742 | |
743 | /* Handle interrupt consequences */ | ||
744 | gem_update_int_status(s); | ||
745 | |||
746 | /* Is checksum offload enabled? */ | ||
747 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
748 | + if (s->regs[R_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
749 | net_checksum_calculate(s->tx_packet, total_bytes, CSUM_ALL); | ||
750 | } | ||
751 | |||
752 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
753 | gem_transmit_updatestats(s, s->tx_packet, total_bytes); | ||
754 | |||
755 | /* Send the packet somewhere */ | ||
756 | - if (s->phy_loop || (s->regs[GEM_NWCTRL] & | ||
757 | + if (s->phy_loop || (s->regs[R_NWCTRL] & | ||
758 | GEM_NWCTRL_LOCALLOOP)) { | ||
759 | qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet, | ||
760 | total_bytes); | ||
761 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
762 | |||
763 | /* read next descriptor */ | ||
764 | if (tx_desc_get_wrap(desc)) { | ||
765 | - | ||
766 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
767 | - packet_desc_addr = s->regs[GEM_TBQPH]; | ||
768 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
769 | + packet_desc_addr = s->regs[R_TBQPH]; | ||
770 | packet_desc_addr <<= 32; | ||
771 | } else { | ||
772 | packet_desc_addr = 0; | ||
773 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
774 | } | ||
775 | |||
776 | if (tx_desc_get_used(desc)) { | ||
777 | - s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
778 | + s->regs[R_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
779 | /* IRQ TXUSED is defined only for queue 0 */ | ||
780 | if (q == 0) { | ||
781 | gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
782 | @@ -XXX,XX +XXX,XX @@ static void gem_reset(DeviceState *d) | ||
783 | |||
784 | /* Set post reset register values */ | ||
785 | memset(&s->regs[0], 0, sizeof(s->regs)); | ||
786 | - s->regs[GEM_NWCFG] = 0x00080000; | ||
787 | - s->regs[GEM_NWSTATUS] = 0x00000006; | ||
788 | - s->regs[GEM_DMACFG] = 0x00020784; | ||
789 | - s->regs[GEM_IMR] = 0x07ffffff; | ||
790 | - s->regs[GEM_TXPAUSE] = 0x0000ffff; | ||
791 | - s->regs[GEM_TXPARTIALSF] = 0x000003ff; | ||
792 | - s->regs[GEM_RXPARTIALSF] = 0x000003ff; | ||
793 | - s->regs[GEM_MODID] = s->revision; | ||
794 | - s->regs[GEM_DESCONF] = 0x02D00111; | ||
795 | - s->regs[GEM_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; | ||
796 | - s->regs[GEM_DESCONF5] = 0x002f2045; | ||
797 | - s->regs[GEM_DESCONF6] = GEM_DESCONF6_64B_MASK; | ||
798 | - s->regs[GEM_INT_Q1_MASK] = 0x00000CE6; | ||
799 | - s->regs[GEM_JUMBO_MAX_LEN] = s->jumbo_max_len; | ||
800 | + s->regs[R_NWCFG] = 0x00080000; | ||
801 | + s->regs[R_NWSTATUS] = 0x00000006; | ||
802 | + s->regs[R_DMACFG] = 0x00020784; | ||
803 | + s->regs[R_IMR] = 0x07ffffff; | ||
804 | + s->regs[R_TXPAUSE] = 0x0000ffff; | ||
805 | + s->regs[R_TXPARTIALSF] = 0x000003ff; | ||
806 | + s->regs[R_RXPARTIALSF] = 0x000003ff; | ||
807 | + s->regs[R_MODID] = s->revision; | ||
808 | + s->regs[R_DESCONF] = 0x02D00111; | ||
809 | + s->regs[R_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; | ||
810 | + s->regs[R_DESCONF5] = 0x002f2045; | ||
811 | + s->regs[R_DESCONF6] = GEM_DESCONF6_64B_MASK; | ||
812 | + s->regs[R_INT_Q1_MASK] = 0x00000CE6; | ||
813 | + s->regs[R_JUMBO_MAX_LEN] = s->jumbo_max_len; | ||
814 | |||
815 | if (s->num_priority_queues > 1) { | ||
816 | queues_mask = MAKE_64BIT_MASK(1, s->num_priority_queues - 1); | ||
817 | - s->regs[GEM_DESCONF6] |= queues_mask; | ||
818 | + s->regs[R_DESCONF6] |= queues_mask; | ||
819 | } | ||
820 | |||
821 | /* Set MAC address */ | ||
822 | a = &s->conf.macaddr.a[0]; | ||
823 | - s->regs[GEM_SPADDR1LO] = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24); | ||
824 | - s->regs[GEM_SPADDR1HI] = a[4] | (a[5] << 8); | ||
825 | + s->regs[R_SPADDR1LO] = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24); | ||
826 | + s->regs[R_SPADDR1HI] = a[4] | (a[5] << 8); | ||
827 | |||
828 | for (i = 0; i < 4; i++) { | ||
829 | s->sar_active[i] = false; | ||
830 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) | ||
831 | DB_PRINT("offset: 0x%04x read: 0x%08x\n", (unsigned)offset*4, retval); | ||
832 | |||
833 | switch (offset) { | ||
834 | - case GEM_ISR: | ||
835 | + case R_ISR: | ||
836 | DB_PRINT("lowering irqs on ISR read\n"); | ||
837 | /* The interrupts get updated at the end of the function. */ | ||
838 | break; | ||
839 | - case GEM_PHYMNTNC: | ||
840 | + case R_PHYMNTNC: | ||
841 | if (retval & GEM_PHYMNTNC_OP_R) { | ||
842 | uint32_t phy_addr, reg_num; | ||
843 | |||
844 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
845 | |||
846 | /* Handle register write side effects */ | ||
847 | switch (offset) { | ||
848 | - case GEM_NWCTRL: | ||
849 | + case R_NWCTRL: | ||
850 | if (val & GEM_NWCTRL_RXENA) { | ||
851 | for (i = 0; i < s->num_priority_queues; ++i) { | ||
852 | gem_get_rx_desc(s, i); | ||
853 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
854 | } | ||
855 | break; | ||
856 | |||
857 | - case GEM_TXSTATUS: | ||
858 | + case R_TXSTATUS: | ||
859 | gem_update_int_status(s); | ||
860 | break; | ||
861 | - case GEM_RXQBASE: | ||
862 | + case R_RXQBASE: | ||
863 | s->rx_desc_addr[0] = val; | ||
864 | break; | ||
865 | - case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q7_PTR: | ||
866 | - s->rx_desc_addr[offset - GEM_RECEIVE_Q1_PTR + 1] = val; | ||
867 | + case R_RECEIVE_Q1_PTR ... R_RECEIVE_Q7_PTR: | ||
868 | + s->rx_desc_addr[offset - R_RECEIVE_Q1_PTR + 1] = val; | ||
869 | break; | ||
870 | - case GEM_TXQBASE: | ||
871 | + case R_TXQBASE: | ||
872 | s->tx_desc_addr[0] = val; | ||
873 | break; | ||
874 | - case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q7_PTR: | ||
875 | - s->tx_desc_addr[offset - GEM_TRANSMIT_Q1_PTR + 1] = val; | ||
876 | + case R_TRANSMIT_Q1_PTR ... R_TRANSMIT_Q7_PTR: | ||
877 | + s->tx_desc_addr[offset - R_TRANSMIT_Q1_PTR + 1] = val; | ||
878 | break; | ||
879 | - case GEM_RXSTATUS: | ||
880 | + case R_RXSTATUS: | ||
881 | gem_update_int_status(s); | ||
882 | break; | ||
883 | - case GEM_IER: | ||
884 | - s->regs[GEM_IMR] &= ~val; | ||
885 | + case R_IER: | ||
886 | + s->regs[R_IMR] &= ~val; | ||
887 | gem_update_int_status(s); | ||
888 | break; | ||
889 | - case GEM_JUMBO_MAX_LEN: | ||
890 | - s->regs[GEM_JUMBO_MAX_LEN] = val & MAX_JUMBO_FRAME_SIZE_MASK; | ||
891 | + case R_JUMBO_MAX_LEN: | ||
892 | + s->regs[R_JUMBO_MAX_LEN] = val & MAX_JUMBO_FRAME_SIZE_MASK; | ||
893 | break; | ||
894 | - case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE: | ||
895 | - s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_ENABLE] &= ~val; | ||
896 | + case R_INT_Q1_ENABLE ... R_INT_Q7_ENABLE: | ||
897 | + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_ENABLE] &= ~val; | ||
898 | gem_update_int_status(s); | ||
899 | break; | ||
900 | - case GEM_IDR: | ||
901 | - s->regs[GEM_IMR] |= val; | ||
902 | + case R_IDR: | ||
903 | + s->regs[R_IMR] |= val; | ||
904 | gem_update_int_status(s); | ||
905 | break; | ||
906 | - case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE: | ||
907 | - s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_DISABLE] |= val; | ||
908 | + case R_INT_Q1_DISABLE ... R_INT_Q7_DISABLE: | ||
909 | + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_DISABLE] |= val; | ||
910 | gem_update_int_status(s); | ||
911 | break; | ||
912 | - case GEM_SPADDR1LO: | ||
913 | - case GEM_SPADDR2LO: | ||
914 | - case GEM_SPADDR3LO: | ||
915 | - case GEM_SPADDR4LO: | ||
916 | - s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false; | ||
917 | + case R_SPADDR1LO: | ||
918 | + case R_SPADDR2LO: | ||
919 | + case R_SPADDR3LO: | ||
920 | + case R_SPADDR4LO: | ||
921 | + s->sar_active[(offset - R_SPADDR1LO) / 2] = false; | ||
922 | break; | ||
923 | - case GEM_SPADDR1HI: | ||
924 | - case GEM_SPADDR2HI: | ||
925 | - case GEM_SPADDR3HI: | ||
926 | - case GEM_SPADDR4HI: | ||
927 | - s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true; | ||
928 | + case R_SPADDR1HI: | ||
929 | + case R_SPADDR2HI: | ||
930 | + case R_SPADDR3HI: | ||
931 | + case R_SPADDR4HI: | ||
932 | + s->sar_active[(offset - R_SPADDR1HI) / 2] = true; | ||
933 | break; | ||
934 | - case GEM_PHYMNTNC: | ||
935 | + case R_PHYMNTNC: | ||
936 | if (val & GEM_PHYMNTNC_OP_W) { | ||
937 | uint32_t phy_addr, reg_num; | ||
938 | |||
202 | -- | 939 | -- |
203 | 2.25.1 | 940 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | More gracefully handle cpregs when EL2 and/or EL3 are missing. | 3 | Describe screening registers fields using the FIELD macros. |
4 | If the reg is entirely inaccessible, do not register it at all. | ||
5 | If the reg is for EL2, and EL3 is present but EL2 is not, | ||
6 | either discard, squash to res0, const, or keep unchanged. | ||
7 | 4 | ||
8 | Per rule RJFFP, mark the 4 aarch32 hypervisor access registers | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
9 | with ARM_CP_EL3_NO_EL2_KEEP, and mark all of the EL2 address | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
10 | translation and tlb invalidation "regs" ARM_CP_EL3_NO_EL2_UNDEF. | 7 | Message-id: 20231017194422.4124691-3-luc.michel@amd.com |
11 | Mark the 2 virtualization processor id regs ARM_CP_EL3_NO_EL2_C_NZ. | ||
12 | |||
13 | This will simplify cpreg registration for conditional arm features. | ||
14 | |||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20220506180242.216785-2-richard.henderson@linaro.org | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 9 | --- |
20 | target/arm/cpregs.h | 11 +++ | 10 | hw/net/cadence_gem.c | 94 ++++++++++++++++++++++---------------------- |
21 | target/arm/helper.c | 178 ++++++++++++++++++++++++++++++-------------- | 11 | 1 file changed, 48 insertions(+), 46 deletions(-) |
22 | 2 files changed, 133 insertions(+), 56 deletions(-) | ||
23 | 12 | ||
24 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
25 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/cpregs.h | 15 | --- a/hw/net/cadence_gem.c |
27 | +++ b/target/arm/cpregs.h | 16 | +++ b/hw/net/cadence_gem.c |
28 | @@ -XXX,XX +XXX,XX @@ enum { | 17 | @@ -XXX,XX +XXX,XX @@ REG32(INT_Q1_DISABLE, 0x620) |
29 | ARM_CP_SVE = 1 << 14, | 18 | REG32(INT_Q7_DISABLE, 0x638) |
30 | /* Flag: Do not expose in gdb sysreg xml. */ | 19 | |
31 | ARM_CP_NO_GDB = 1 << 15, | 20 | REG32(SCREENING_TYPE1_REG0, 0x500) |
32 | + /* | 21 | - |
33 | + * Flags: If EL3 but not EL2... | 22 | -#define GEM_ST1R_UDP_PORT_MATCH_ENABLE (1 << 29) |
34 | + * - UNDEF: discard the cpreg, | 23 | -#define GEM_ST1R_DSTC_ENABLE (1 << 28) |
35 | + * - KEEP: retain the cpreg as is, | 24 | -#define GEM_ST1R_UDP_PORT_MATCH_SHIFT (12) |
36 | + * - C_NZ: set const on the cpreg, but retain resetvalue, | 25 | -#define GEM_ST1R_UDP_PORT_MATCH_WIDTH (27 - GEM_ST1R_UDP_PORT_MATCH_SHIFT + 1) |
37 | + * - else: set const on the cpreg, zero resetvalue, aka RES0. | 26 | -#define GEM_ST1R_DSTC_MATCH_SHIFT (4) |
38 | + * See rule RJFFP in section D1.1.3 of DDI0487H.a. | 27 | -#define GEM_ST1R_DSTC_MATCH_WIDTH (11 - GEM_ST1R_DSTC_MATCH_SHIFT + 1) |
39 | + */ | 28 | -#define GEM_ST1R_QUEUE_SHIFT (0) |
40 | + ARM_CP_EL3_NO_EL2_UNDEF = 1 << 16, | 29 | -#define GEM_ST1R_QUEUE_WIDTH (3 - GEM_ST1R_QUEUE_SHIFT + 1) |
41 | + ARM_CP_EL3_NO_EL2_KEEP = 1 << 17, | 30 | + FIELD(SCREENING_TYPE1_REG0, QUEUE_NUM, 0, 4) |
42 | + ARM_CP_EL3_NO_EL2_C_NZ = 1 << 18, | 31 | + FIELD(SCREENING_TYPE1_REG0, DSTC_MATCH, 4, 8) |
43 | }; | 32 | + FIELD(SCREENING_TYPE1_REG0, UDP_PORT_MATCH, 12, 16) |
44 | 33 | + FIELD(SCREENING_TYPE1_REG0, DSTC_ENABLE, 28, 1) | |
45 | /* | 34 | + FIELD(SCREENING_TYPE1_REG0, UDP_PORT_MATCH_EN, 29, 1) |
46 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 35 | + FIELD(SCREENING_TYPE1_REG0, DROP_ON_MATCH, 30, 1) |
47 | index XXXXXXX..XXXXXXX 100644 | 36 | |
48 | --- a/target/arm/helper.c | 37 | REG32(SCREENING_TYPE2_REG0, 0x540) |
49 | +++ b/target/arm/helper.c | 38 | - |
50 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 39 | -#define GEM_ST2R_COMPARE_A_ENABLE (1 << 18) |
51 | .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, | 40 | -#define GEM_ST2R_COMPARE_A_SHIFT (13) |
52 | { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, | 41 | -#define GEM_ST2R_COMPARE_WIDTH (17 - GEM_ST2R_COMPARE_A_SHIFT + 1) |
53 | .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, | 42 | -#define GEM_ST2R_ETHERTYPE_ENABLE (1 << 12) |
54 | - .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_FPU, | 43 | -#define GEM_ST2R_ETHERTYPE_INDEX_SHIFT (9) |
55 | + .access = PL2_RW, | 44 | -#define GEM_ST2R_ETHERTYPE_INDEX_WIDTH (11 - GEM_ST2R_ETHERTYPE_INDEX_SHIFT \ |
56 | + .type = ARM_CP_ALIAS | ARM_CP_FPU | ARM_CP_EL3_NO_EL2_KEEP, | 45 | - + 1) |
57 | .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]) }, | 46 | -#define GEM_ST2R_QUEUE_SHIFT (0) |
58 | { .name = "DACR32_EL2", .state = ARM_CP_STATE_AA64, | 47 | -#define GEM_ST2R_QUEUE_WIDTH (3 - GEM_ST2R_QUEUE_SHIFT + 1) |
59 | .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 0, .opc2 = 0, | 48 | + FIELD(SCREENING_TYPE2_REG0, QUEUE_NUM, 0, 4) |
60 | - .access = PL2_RW, .resetvalue = 0, | 49 | + FIELD(SCREENING_TYPE2_REG0, VLAN_PRIORITY, 4, 3) |
61 | + .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP, | 50 | + FIELD(SCREENING_TYPE2_REG0, VLAN_ENABLE, 8, 1) |
62 | .writefn = dacr_write, .raw_writefn = raw_write, | 51 | + FIELD(SCREENING_TYPE2_REG0, ETHERTYPE_REG_INDEX, 9, 3) |
63 | .fieldoffset = offsetof(CPUARMState, cp15.dacr32_el2) }, | 52 | + FIELD(SCREENING_TYPE2_REG0, ETHERTYPE_ENABLE, 12, 1) |
64 | { .name = "IFSR32_EL2", .state = ARM_CP_STATE_AA64, | 53 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_A, 13, 5) |
65 | .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 0, .opc2 = 1, | 54 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_A_ENABLE, 18, 1) |
66 | - .access = PL2_RW, .resetvalue = 0, | 55 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_B, 19, 5) |
67 | + .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP, | 56 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_B_ENABLE, 24, 1) |
68 | .fieldoffset = offsetof(CPUARMState, cp15.ifsr32_el2) }, | 57 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_C, 25, 5) |
69 | { .name = "SPSR_IRQ", .state = ARM_CP_STATE_AA64, | 58 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_C_ENABLE, 30, 1) |
70 | .type = ARM_CP_ALIAS, | 59 | + FIELD(SCREENING_TYPE2_REG0, DROP_ON_MATCH, 31, 1) |
71 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | 60 | |
72 | .writefn = tlbimva_hyp_is_write }, | 61 | REG32(SCREENING_TYPE2_ETHERTYPE_REG0, 0x6e0) |
73 | { .name = "TLBI_ALLE2", .state = ARM_CP_STATE_AA64, | 62 | -REG32(TYPE2_COMPARE_0_WORD_0, 0x700) |
74 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 0, | 63 | |
75 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 64 | -#define GEM_T2CW1_COMPARE_OFFSET_SHIFT (7) |
76 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 65 | -#define GEM_T2CW1_COMPARE_OFFSET_WIDTH (8 - GEM_T2CW1_COMPARE_OFFSET_SHIFT + 1) |
77 | .writefn = tlbi_aa64_alle2_write }, | 66 | -#define GEM_T2CW1_OFFSET_VALUE_SHIFT (0) |
78 | { .name = "TLBI_VAE2", .state = ARM_CP_STATE_AA64, | 67 | -#define GEM_T2CW1_OFFSET_VALUE_WIDTH (6 - GEM_T2CW1_OFFSET_VALUE_SHIFT + 1) |
79 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 1, | 68 | +REG32(TYPE2_COMPARE_0_WORD_0, 0x700) |
80 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 69 | + FIELD(TYPE2_COMPARE_0_WORD_0, MASK_VALUE, 0, 16) |
81 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 70 | + FIELD(TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE, 16, 16) |
82 | .writefn = tlbi_aa64_vae2_write }, | 71 | + |
83 | { .name = "TLBI_VALE2", .state = ARM_CP_STATE_AA64, | 72 | +REG32(TYPE2_COMPARE_0_WORD_1, 0x704) |
84 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 5, | 73 | + FIELD(TYPE2_COMPARE_0_WORD_1, OFFSET_VALUE, 0, 7) |
85 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 74 | + FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_OFFSET, 7, 2) |
86 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 75 | + FIELD(TYPE2_COMPARE_0_WORD_1, DISABLE_MASK, 9, 1) |
87 | .writefn = tlbi_aa64_vae2_write }, | 76 | + FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) |
88 | { .name = "TLBI_ALLE2IS", .state = ARM_CP_STATE_AA64, | 77 | |
89 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 0, | 78 | /*****************************************/ |
90 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 79 | #define GEM_NWCTRL_TXSTART 0x00000200 /* Transmit Enable */ |
91 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 80 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
92 | .writefn = tlbi_aa64_alle2is_write }, | 81 | mismatched = false; |
93 | { .name = "TLBI_VAE2IS", .state = ARM_CP_STATE_AA64, | 82 | |
94 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 1, | 83 | /* Screening is based on UDP Port */ |
95 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 84 | - if (reg & GEM_ST1R_UDP_PORT_MATCH_ENABLE) { |
96 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 85 | + if (FIELD_EX32(reg, SCREENING_TYPE1_REG0, UDP_PORT_MATCH_EN)) { |
97 | .writefn = tlbi_aa64_vae2is_write }, | 86 | uint16_t udp_port = rxbuf_ptr[14 + 22] << 8 | rxbuf_ptr[14 + 23]; |
98 | { .name = "TLBI_VALE2IS", .state = ARM_CP_STATE_AA64, | 87 | - if (udp_port == extract32(reg, GEM_ST1R_UDP_PORT_MATCH_SHIFT, |
99 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 5, | 88 | - GEM_ST1R_UDP_PORT_MATCH_WIDTH)) { |
100 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 89 | + if (udp_port == FIELD_EX32(reg, SCREENING_TYPE1_REG0, UDP_PORT_MATCH)) { |
101 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | 90 | matched = true; |
102 | .writefn = tlbi_aa64_vae2is_write }, | 91 | } else { |
103 | #ifndef CONFIG_USER_ONLY | 92 | mismatched = true; |
104 | /* Unlike the other EL2-related AT operations, these must | 93 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
105 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | 94 | } |
106 | { .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64, | 95 | |
107 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0, | 96 | /* Screening is based on DS/TC */ |
108 | .access = PL2_W, .accessfn = at_s1e2_access, | 97 | - if (reg & GEM_ST1R_DSTC_ENABLE) { |
109 | - .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, | 98 | + if (FIELD_EX32(reg, SCREENING_TYPE1_REG0, DSTC_ENABLE)) { |
110 | + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF, | 99 | uint8_t dscp = rxbuf_ptr[14 + 1]; |
111 | + .writefn = ats_write64 }, | 100 | - if (dscp == extract32(reg, GEM_ST1R_DSTC_MATCH_SHIFT, |
112 | { .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64, | 101 | - GEM_ST1R_DSTC_MATCH_WIDTH)) { |
113 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1, | 102 | + if (dscp == FIELD_EX32(reg, SCREENING_TYPE1_REG0, DSTC_MATCH)) { |
114 | .access = PL2_W, .accessfn = at_s1e2_access, | 103 | matched = true; |
115 | - .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, | 104 | } else { |
116 | + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF, | 105 | mismatched = true; |
117 | + .writefn = ats_write64 }, | 106 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
118 | /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE | 107 | } |
119 | * if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3 | 108 | |
120 | * with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose | 109 | if (matched && !mismatched) { |
121 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { | 110 | - return extract32(reg, GEM_ST1R_QUEUE_SHIFT, GEM_ST1R_QUEUE_WIDTH); |
122 | { .name = "DBGVCR32_EL2", .state = ARM_CP_STATE_AA64, | 111 | + return FIELD_EX32(reg, SCREENING_TYPE1_REG0, QUEUE_NUM); |
123 | .opc0 = 2, .opc1 = 4, .crn = 0, .crm = 7, .opc2 = 0, | ||
124 | .access = PL2_RW, .accessfn = access_tda, | ||
125 | - .type = ARM_CP_NOP }, | ||
126 | + .type = ARM_CP_NOP | ARM_CP_EL3_NO_EL2_KEEP }, | ||
127 | /* Dummy MDCCINT_EL1, since we don't implement the Debug Communications | ||
128 | * Channel but Linux may try to access this register. The 32-bit | ||
129 | * alias is DBGDCCINT. | ||
130 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = { | ||
131 | .access = PL2_W, .type = ARM_CP_NOP }, | ||
132 | { .name = "TLBI_RVAE2IS", .state = ARM_CP_STATE_AA64, | ||
133 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 1, | ||
134 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
135 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
136 | .writefn = tlbi_aa64_rvae2is_write }, | ||
137 | { .name = "TLBI_RVALE2IS", .state = ARM_CP_STATE_AA64, | ||
138 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 5, | ||
139 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
140 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
141 | .writefn = tlbi_aa64_rvae2is_write }, | ||
142 | { .name = "TLBI_RIPAS2E1", .state = ARM_CP_STATE_AA64, | ||
143 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 2, | ||
144 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = { | ||
145 | .access = PL2_W, .type = ARM_CP_NOP }, | ||
146 | { .name = "TLBI_RVAE2OS", .state = ARM_CP_STATE_AA64, | ||
147 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 1, | ||
148 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
149 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
150 | .writefn = tlbi_aa64_rvae2is_write }, | ||
151 | { .name = "TLBI_RVALE2OS", .state = ARM_CP_STATE_AA64, | ||
152 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 5, | ||
153 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
154 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
155 | .writefn = tlbi_aa64_rvae2is_write }, | ||
156 | { .name = "TLBI_RVAE2", .state = ARM_CP_STATE_AA64, | ||
157 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 1, | ||
158 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
159 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
160 | .writefn = tlbi_aa64_rvae2_write }, | ||
161 | { .name = "TLBI_RVALE2", .state = ARM_CP_STATE_AA64, | ||
162 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 5, | ||
163 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
164 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
165 | .writefn = tlbi_aa64_rvae2_write }, | ||
166 | { .name = "TLBI_RVAE3IS", .state = ARM_CP_STATE_AA64, | ||
167 | .opc0 = 1, .opc1 = 6, .crn = 8, .crm = 2, .opc2 = 1, | ||
168 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = { | ||
169 | .writefn = tlbi_aa64_vae1is_write }, | ||
170 | { .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64, | ||
171 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0, | ||
172 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
173 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
174 | .writefn = tlbi_aa64_alle2is_write }, | ||
175 | { .name = "TLBI_VAE2OS", .state = ARM_CP_STATE_AA64, | ||
176 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 1, | ||
177 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
178 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
179 | .writefn = tlbi_aa64_vae2is_write }, | ||
180 | { .name = "TLBI_ALLE1OS", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 4, | ||
182 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = { | ||
183 | .writefn = tlbi_aa64_alle1is_write }, | ||
184 | { .name = "TLBI_VALE2OS", .state = ARM_CP_STATE_AA64, | ||
185 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 5, | ||
186 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
187 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, | ||
188 | .writefn = tlbi_aa64_vae2is_write }, | ||
189 | { .name = "TLBI_VMALLS12E1OS", .state = ARM_CP_STATE_AA64, | ||
190 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 6, | ||
191 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
192 | { .name = "VPIDR", .state = ARM_CP_STATE_AA32, | ||
193 | .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, | ||
194 | .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
195 | - .resetvalue = cpu->midr, .type = ARM_CP_ALIAS, | ||
196 | + .resetvalue = cpu->midr, | ||
197 | + .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ, | ||
198 | .fieldoffset = offsetoflow32(CPUARMState, cp15.vpidr_el2) }, | ||
199 | { .name = "VPIDR_EL2", .state = ARM_CP_STATE_AA64, | ||
200 | .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, | ||
201 | .access = PL2_RW, .resetvalue = cpu->midr, | ||
202 | + .type = ARM_CP_EL3_NO_EL2_C_NZ, | ||
203 | .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) }, | ||
204 | { .name = "VMPIDR", .state = ARM_CP_STATE_AA32, | ||
205 | .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, | ||
206 | .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
207 | - .resetvalue = vmpidr_def, .type = ARM_CP_ALIAS, | ||
208 | + .resetvalue = vmpidr_def, | ||
209 | + .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ, | ||
210 | .fieldoffset = offsetoflow32(CPUARMState, cp15.vmpidr_el2) }, | ||
211 | { .name = "VMPIDR_EL2", .state = ARM_CP_STATE_AA64, | ||
212 | .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, | ||
213 | - .access = PL2_RW, | ||
214 | - .resetvalue = vmpidr_def, | ||
215 | + .access = PL2_RW, .resetvalue = vmpidr_def, | ||
216 | + .type = ARM_CP_EL3_NO_EL2_C_NZ, | ||
217 | .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, | ||
218 | }; | ||
219 | define_arm_cp_regs(cpu, vpidr_regs); | ||
220 | @@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, | ||
221 | int crm, int opc1, int opc2, | ||
222 | const char *name) | ||
223 | { | ||
224 | + CPUARMState *env = &cpu->env; | ||
225 | uint32_t key; | ||
226 | ARMCPRegInfo *r2; | ||
227 | bool is64 = r->type & ARM_CP_64BIT; | ||
228 | bool ns = secstate & ARM_CP_SECSTATE_NS; | ||
229 | int cp = r->cp; | ||
230 | - bool isbanked; | ||
231 | size_t name_len; | ||
232 | + bool make_const; | ||
233 | |||
234 | switch (state) { | ||
235 | case ARM_CP_STATE_AA32: | ||
236 | @@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, | ||
237 | } | 112 | } |
238 | } | 113 | } |
239 | 114 | ||
240 | + /* | 115 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
241 | + * Eliminate registers that are not present because the EL is missing. | 116 | matched = false; |
242 | + * Doing this here makes it easier to put all registers for a given | 117 | mismatched = false; |
243 | + * feature into the same ARMCPRegInfo array and define them all at once. | 118 | |
244 | + */ | 119 | - if (reg & GEM_ST2R_ETHERTYPE_ENABLE) { |
245 | + make_const = false; | 120 | + if (FIELD_EX32(reg, SCREENING_TYPE2_REG0, ETHERTYPE_ENABLE)) { |
246 | + if (arm_feature(env, ARM_FEATURE_EL3)) { | 121 | uint16_t type = rxbuf_ptr[12] << 8 | rxbuf_ptr[13]; |
247 | + /* | 122 | - int et_idx = extract32(reg, GEM_ST2R_ETHERTYPE_INDEX_SHIFT, |
248 | + * An EL2 register without EL2 but with EL3 is (usually) RES0. | 123 | - GEM_ST2R_ETHERTYPE_INDEX_WIDTH); |
249 | + * See rule RJFFP in section D1.1.3 of DDI0487H.a. | 124 | + int et_idx = FIELD_EX32(reg, SCREENING_TYPE2_REG0, |
250 | + */ | 125 | + ETHERTYPE_REG_INDEX); |
251 | + int min_el = ctz32(r->access) / 2; | 126 | |
252 | + if (min_el == 2 && !arm_feature(env, ARM_FEATURE_EL2)) { | 127 | if (et_idx > s->num_type2_screeners) { |
253 | + if (r->type & ARM_CP_EL3_NO_EL2_UNDEF) { | 128 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range ethertype " |
254 | + return; | 129 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
255 | + } | 130 | |
256 | + make_const = !(r->type & ARM_CP_EL3_NO_EL2_KEEP); | 131 | /* Compare A, B, C */ |
257 | + } | 132 | for (j = 0; j < 3; j++) { |
258 | + } else { | 133 | - uint32_t cr0, cr1, mask; |
259 | + CPAccessRights max_el = (arm_feature(env, ARM_FEATURE_EL2) | 134 | + uint32_t cr0, cr1, mask, compare; |
260 | + ? PL2_RW : PL1_RW); | 135 | uint16_t rx_cmp; |
261 | + if ((r->access & max_el) == 0) { | 136 | int offset; |
262 | + return; | 137 | - int cr_idx = extract32(reg, GEM_ST2R_COMPARE_A_SHIFT + j * 6, |
263 | + } | 138 | - GEM_ST2R_COMPARE_WIDTH); |
264 | + } | 139 | + int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6, |
140 | + R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH); | ||
141 | |||
142 | - if (!(reg & (GEM_ST2R_COMPARE_A_ENABLE << (j * 6)))) { | ||
143 | + if (!extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_ENABLE_SHIFT + j * 6, | ||
144 | + R_SCREENING_TYPE2_REG0_COMPARE_A_ENABLE_LENGTH)) { | ||
145 | continue; | ||
146 | } | ||
265 | + | 147 | + |
266 | /* Combine cpreg and name into one allocation. */ | 148 | if (cr_idx > s->num_type2_screeners) { |
267 | name_len = strlen(name) + 1; | 149 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range compare " |
268 | r2 = g_malloc(sizeof(*r2) + name_len); | 150 | "register index: %d\n", cr_idx); |
269 | @@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, | ||
270 | r2->opaque = opaque; | ||
271 | } | ||
272 | |||
273 | - isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]; | ||
274 | - if (isbanked) { | ||
275 | + if (make_const) { | ||
276 | + /* This should not have been a very special register to begin. */ | ||
277 | + int old_special = r2->type & ARM_CP_SPECIAL_MASK; | ||
278 | + assert(old_special == 0 || old_special == ARM_CP_NOP); | ||
279 | /* | ||
280 | - * Register is banked (using both entries in array). | ||
281 | - * Overwriting fieldoffset as the array is only used to define | ||
282 | - * banked registers but later only fieldoffset is used. | ||
283 | + * Set the special function to CONST, retaining the other flags. | ||
284 | + * This is important for e.g. ARM_CP_SVE so that we still | ||
285 | + * take the SVE trap if CPTR_EL3.EZ == 0. | ||
286 | */ | ||
287 | - r2->fieldoffset = r->bank_fieldoffsets[ns]; | ||
288 | - } | ||
289 | + r2->type = (r2->type & ~ARM_CP_SPECIAL_MASK) | ARM_CP_CONST; | ||
290 | + /* | ||
291 | + * Usually, these registers become RES0, but there are a few | ||
292 | + * special cases like VPIDR_EL2 which have a constant non-zero | ||
293 | + * value with writes ignored. | ||
294 | + */ | ||
295 | + if (!(r->type & ARM_CP_EL3_NO_EL2_C_NZ)) { | ||
296 | + r2->resetvalue = 0; | ||
297 | + } | ||
298 | + /* | ||
299 | + * ARM_CP_CONST has precedence, so removing the callbacks and | ||
300 | + * offsets are not strictly necessary, but it is potentially | ||
301 | + * less confusing to debug later. | ||
302 | + */ | ||
303 | + r2->readfn = NULL; | ||
304 | + r2->writefn = NULL; | ||
305 | + r2->raw_readfn = NULL; | ||
306 | + r2->raw_writefn = NULL; | ||
307 | + r2->resetfn = NULL; | ||
308 | + r2->fieldoffset = 0; | ||
309 | + r2->bank_fieldoffsets[0] = 0; | ||
310 | + r2->bank_fieldoffsets[1] = 0; | ||
311 | + } else { | ||
312 | + bool isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]; | ||
313 | |||
314 | - if (state == ARM_CP_STATE_AA32) { | ||
315 | if (isbanked) { | ||
316 | /* | ||
317 | - * If the register is banked then we don't need to migrate or | ||
318 | - * reset the 32-bit instance in certain cases: | ||
319 | - * | ||
320 | - * 1) If the register has both 32-bit and 64-bit instances then we | ||
321 | - * can count on the 64-bit instance taking care of the | ||
322 | - * non-secure bank. | ||
323 | - * 2) If ARMv8 is enabled then we can count on a 64-bit version | ||
324 | - * taking care of the secure bank. This requires that separate | ||
325 | - * 32 and 64-bit definitions are provided. | ||
326 | + * Register is banked (using both entries in array). | ||
327 | + * Overwriting fieldoffset as the array is only used to define | ||
328 | + * banked registers but later only fieldoffset is used. | ||
329 | */ | ||
330 | - if ((r->state == ARM_CP_STATE_BOTH && ns) || | ||
331 | - (arm_feature(&cpu->env, ARM_FEATURE_V8) && !ns)) { | ||
332 | + r2->fieldoffset = r->bank_fieldoffsets[ns]; | ||
333 | + } | ||
334 | + if (state == ARM_CP_STATE_AA32) { | ||
335 | + if (isbanked) { | ||
336 | + /* | ||
337 | + * If the register is banked then we don't need to migrate or | ||
338 | + * reset the 32-bit instance in certain cases: | ||
339 | + * | ||
340 | + * 1) If the register has both 32-bit and 64-bit instances | ||
341 | + * then we can count on the 64-bit instance taking care | ||
342 | + * of the non-secure bank. | ||
343 | + * 2) If ARMv8 is enabled then we can count on a 64-bit | ||
344 | + * version taking care of the secure bank. This requires | ||
345 | + * that separate 32 and 64-bit definitions are provided. | ||
346 | + */ | ||
347 | + if ((r->state == ARM_CP_STATE_BOTH && ns) || | ||
348 | + (arm_feature(env, ARM_FEATURE_V8) && !ns)) { | ||
349 | + r2->type |= ARM_CP_ALIAS; | ||
350 | + } | ||
351 | + } else if ((secstate != r->secure) && !ns) { | ||
352 | + /* | ||
353 | + * The register is not banked so we only want to allow | ||
354 | + * migration of the non-secure instance. | ||
355 | + */ | ||
356 | r2->type |= ARM_CP_ALIAS; | ||
357 | } | 151 | } |
358 | - } else if ((secstate != r->secure) && !ns) { | 152 | |
359 | - /* | 153 | cr0 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; |
360 | - * The register is not banked so we only want to allow migration | 154 | - cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; |
361 | - * of the non-secure instance. | 155 | - offset = extract32(cr1, GEM_T2CW1_OFFSET_VALUE_SHIFT, |
362 | - */ | 156 | - GEM_T2CW1_OFFSET_VALUE_WIDTH); |
363 | - r2->type |= ARM_CP_ALIAS; | 157 | + cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_1 + cr_idx * 2]; |
364 | - } | 158 | + offset = FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, OFFSET_VALUE); |
365 | 159 | ||
366 | - if (HOST_BIG_ENDIAN && | 160 | - switch (extract32(cr1, GEM_T2CW1_COMPARE_OFFSET_SHIFT, |
367 | - r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) { | 161 | - GEM_T2CW1_COMPARE_OFFSET_WIDTH)) { |
368 | - r2->fieldoffset += sizeof(uint32_t); | 162 | + switch (FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, COMPARE_OFFSET)) { |
369 | + if (HOST_BIG_ENDIAN && | 163 | case 3: /* Skip UDP header */ |
370 | + r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) { | 164 | qemu_log_mask(LOG_UNIMP, "TCP compare offsets" |
371 | + r2->fieldoffset += sizeof(uint32_t); | 165 | "unimplemented - assuming UDP\n"); |
372 | + } | 166 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
167 | } | ||
168 | |||
169 | rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset]; | ||
170 | - mask = extract32(cr0, 0, 16); | ||
171 | + mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); | ||
172 | + compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); | ||
173 | |||
174 | - if ((rx_cmp & mask) == (extract32(cr0, 16, 16) & mask)) { | ||
175 | + if ((rx_cmp & mask) == (compare & mask)) { | ||
176 | matched = true; | ||
177 | } else { | ||
178 | mismatched = true; | ||
179 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
180 | } | ||
181 | |||
182 | if (matched && !mismatched) { | ||
183 | - return extract32(reg, GEM_ST2R_QUEUE_SHIFT, GEM_ST2R_QUEUE_WIDTH); | ||
184 | + return FIELD_EX32(reg, SCREENING_TYPE2_REG0, QUEUE_NUM); | ||
373 | } | 185 | } |
374 | } | 186 | } |
375 | 187 | ||
376 | @@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, | ||
377 | * multiple times. Special registers (ie NOP/WFI) are | ||
378 | * never migratable and not even raw-accessible. | ||
379 | */ | ||
380 | - if (r->type & ARM_CP_SPECIAL_MASK) { | ||
381 | + if (r2->type & ARM_CP_SPECIAL_MASK) { | ||
382 | r2->type |= ARM_CP_NO_RAW; | ||
383 | } | ||
384 | if (((r->crm == CP_ANY) && crm != 0) || | ||
385 | -- | 188 | -- |
386 | 2.25.1 | 189 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | This feature is AArch64 only, and applies to physical SErrors, | 3 | Use the FIELD macro to describe the NWCTRL register fields. |
4 | which QEMU does not implement, thus the feature is a nop. | ||
5 | 4 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
8 | Message-id: 20220506180242.216785-19-richard.henderson@linaro.org | 7 | Message-id: 20231017194422.4124691-4-luc.michel@amd.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 9 | --- |
11 | docs/system/arm/emulation.rst | 1 + | 10 | hw/net/cadence_gem.c | 53 +++++++++++++++++++++++++++++++++----------- |
12 | target/arm/cpu64.c | 1 + | 11 | 1 file changed, 40 insertions(+), 13 deletions(-) |
13 | 2 files changed, 2 insertions(+) | ||
14 | 12 | ||
15 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/docs/system/arm/emulation.rst | 15 | --- a/hw/net/cadence_gem.c |
18 | +++ b/docs/system/arm/emulation.rst | 16 | +++ b/hw/net/cadence_gem.c |
19 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 17 | @@ -XXX,XX +XXX,XX @@ |
20 | - FEAT_FlagM2 (Enhancements to flag manipulation instructions) | 18 | } while (0) |
21 | - FEAT_HPDS (Hierarchical permission disables) | 19 | |
22 | - FEAT_I8MM (AArch64 Int8 matrix multiplication instructions) | 20 | REG32(NWCTRL, 0x0) /* Network Control reg */ |
23 | +- FEAT_IESB (Implicit error synchronization event) | 21 | + FIELD(NWCTRL, LOOPBACK , 0, 1) |
24 | - FEAT_JSCVT (JavaScript conversion instructions) | 22 | + FIELD(NWCTRL, LOOPBACK_LOCAL , 1, 1) |
25 | - FEAT_LOR (Limited ordering regions) | 23 | + FIELD(NWCTRL, ENABLE_RECEIVE, 2, 1) |
26 | - FEAT_LPA (Large Physical Address space) | 24 | + FIELD(NWCTRL, ENABLE_TRANSMIT, 3, 1) |
27 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 25 | + FIELD(NWCTRL, MAN_PORT_EN , 4, 1) |
28 | index XXXXXXX..XXXXXXX 100644 | 26 | + FIELD(NWCTRL, CLEAR_ALL_STATS_REGS , 5, 1) |
29 | --- a/target/arm/cpu64.c | 27 | + FIELD(NWCTRL, INC_ALL_STATS_REGS, 6, 1) |
30 | +++ b/target/arm/cpu64.c | 28 | + FIELD(NWCTRL, STATS_WRITE_EN, 7, 1) |
31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 29 | + FIELD(NWCTRL, BACK_PRESSURE, 8, 1) |
32 | t = cpu->isar.id_aa64mmfr2; | 30 | + FIELD(NWCTRL, TRANSMIT_START , 9, 1) |
33 | t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */ | 31 | + FIELD(NWCTRL, TRANSMIT_HALT, 10, 1) |
34 | t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */ | 32 | + FIELD(NWCTRL, TX_PAUSE_FRAME_RE, 11, 1) |
35 | + t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */ | 33 | + FIELD(NWCTRL, TX_PAUSE_FRAME_ZE, 12, 1) |
36 | t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ | 34 | + FIELD(NWCTRL, STATS_TAKE_SNAP, 13, 1) |
37 | t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ | 35 | + FIELD(NWCTRL, STATS_READ_SNAP, 14, 1) |
38 | t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ | 36 | + FIELD(NWCTRL, STORE_RX_TS, 15, 1) |
37 | + FIELD(NWCTRL, PFC_ENABLE, 16, 1) | ||
38 | + FIELD(NWCTRL, PFC_PRIO_BASED, 17, 1) | ||
39 | + FIELD(NWCTRL, FLUSH_RX_PKT_PCLK , 18, 1) | ||
40 | + FIELD(NWCTRL, TX_LPI_EN, 19, 1) | ||
41 | + FIELD(NWCTRL, PTP_UNICAST_ENA, 20, 1) | ||
42 | + FIELD(NWCTRL, ALT_SGMII_MODE, 21, 1) | ||
43 | + FIELD(NWCTRL, STORE_UDP_OFFSET, 22, 1) | ||
44 | + FIELD(NWCTRL, EXT_TSU_PORT_EN, 23, 1) | ||
45 | + FIELD(NWCTRL, ONE_STEP_SYNC_MO, 24, 1) | ||
46 | + FIELD(NWCTRL, PFC_CTRL , 25, 1) | ||
47 | + FIELD(NWCTRL, EXT_RXQ_SEL_EN , 26, 1) | ||
48 | + FIELD(NWCTRL, OSS_CORRECTION_FIELD, 27, 1) | ||
49 | + FIELD(NWCTRL, SEL_MII_ON_RGMII, 28, 1) | ||
50 | + FIELD(NWCTRL, TWO_PT_FIVE_GIG, 29, 1) | ||
51 | + FIELD(NWCTRL, IFG_EATS_QAV_CREDIT, 30, 1) | ||
52 | + | ||
53 | REG32(NWCFG, 0x4) /* Network Config reg */ | ||
54 | REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
55 | REG32(USERIO, 0xc) /* User IO reg */ | ||
56 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
57 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
58 | |||
59 | /*****************************************/ | ||
60 | -#define GEM_NWCTRL_TXSTART 0x00000200 /* Transmit Enable */ | ||
61 | -#define GEM_NWCTRL_TXENA 0x00000008 /* Transmit Enable */ | ||
62 | -#define GEM_NWCTRL_RXENA 0x00000004 /* Receive Enable */ | ||
63 | -#define GEM_NWCTRL_LOCALLOOP 0x00000002 /* Local Loopback */ | ||
64 | - | ||
65 | #define GEM_NWCFG_STRIP_FCS 0x00020000 /* Strip FCS field */ | ||
66 | #define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with len err */ | ||
67 | #define GEM_NWCFG_BUFF_OFST_M 0x0000C000 /* Receive buffer offset mask */ | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool gem_can_receive(NetClientState *nc) | ||
69 | s = qemu_get_nic_opaque(nc); | ||
70 | |||
71 | /* Do nothing if receive is not enabled. */ | ||
72 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
73 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_RECEIVE)) { | ||
74 | if (s->can_rx_state != 1) { | ||
75 | s->can_rx_state = 1; | ||
76 | DB_PRINT("can't receive - no enable\n"); | ||
77 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
78 | int q = 0; | ||
79 | |||
80 | /* Do nothing if transmit is not enabled. */ | ||
81 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
82 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_TRANSMIT)) { | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
87 | while (tx_desc_get_used(desc) == 0) { | ||
88 | |||
89 | /* Do nothing if transmit is not enabled. */ | ||
90 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
91 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_TRANSMIT)) { | ||
92 | return; | ||
93 | } | ||
94 | print_gem_tx_desc(desc, q); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
96 | gem_transmit_updatestats(s, s->tx_packet, total_bytes); | ||
97 | |||
98 | /* Send the packet somewhere */ | ||
99 | - if (s->phy_loop || (s->regs[R_NWCTRL] & | ||
100 | - GEM_NWCTRL_LOCALLOOP)) { | ||
101 | + if (s->phy_loop || FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, | ||
102 | + LOOPBACK_LOCAL)) { | ||
103 | qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet, | ||
104 | total_bytes); | ||
105 | } else { | ||
106 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
107 | /* Handle register write side effects */ | ||
108 | switch (offset) { | ||
109 | case R_NWCTRL: | ||
110 | - if (val & GEM_NWCTRL_RXENA) { | ||
111 | + if (FIELD_EX32(val, NWCTRL, ENABLE_RECEIVE)) { | ||
112 | for (i = 0; i < s->num_priority_queues; ++i) { | ||
113 | gem_get_rx_desc(s, i); | ||
114 | } | ||
115 | } | ||
116 | - if (val & GEM_NWCTRL_TXSTART) { | ||
117 | + if (FIELD_EX32(val, NWCTRL, TRANSMIT_START)) { | ||
118 | gem_transmit(s); | ||
119 | } | ||
120 | - if (!(val & GEM_NWCTRL_TXENA)) { | ||
121 | + if (!(FIELD_EX32(val, NWCTRL, ENABLE_TRANSMIT))) { | ||
122 | /* Reset to start of Q when transmit disabled. */ | ||
123 | for (i = 0; i < s->num_priority_queues; i++) { | ||
124 | s->tx_desc_addr[i] = gem_get_tx_queue_base_addr(s, i); | ||
39 | -- | 125 | -- |
40 | 2.25.1 | 126 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Use FIELD_DP{32,64} to manipulate id_pfr1 and id_aa64pfr0 | 3 | Use de FIELD macro to describe the NWCFG register fields. |
4 | during arm_cpu_realizefn. | ||
5 | 4 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
8 | Message-id: 20220506180242.216785-11-richard.henderson@linaro.org | 7 | Message-id: 20231017194422.4124691-5-luc.michel@amd.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 9 | --- |
11 | target/arm/cpu.c | 22 +++++++++++++--------- | 10 | hw/net/cadence_gem.c | 60 ++++++++++++++++++++++++++++---------------- |
12 | 1 file changed, 13 insertions(+), 9 deletions(-) | 11 | 1 file changed, 39 insertions(+), 21 deletions(-) |
13 | 12 | ||
14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/cpu.c | 15 | --- a/hw/net/cadence_gem.c |
17 | +++ b/target/arm/cpu.c | 16 | +++ b/hw/net/cadence_gem.c |
18 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 17 | @@ -XXX,XX +XXX,XX @@ REG32(NWCTRL, 0x0) /* Network Control reg */ |
19 | */ | 18 | FIELD(NWCTRL, IFG_EATS_QAV_CREDIT, 30, 1) |
20 | unset_feature(env, ARM_FEATURE_EL3); | 19 | |
21 | 20 | REG32(NWCFG, 0x4) /* Network Config reg */ | |
22 | - /* Disable the security extension feature bits in the processor feature | 21 | + FIELD(NWCFG, SPEED, 0, 1) |
23 | - * registers as well. These are id_pfr1[7:4] and id_aa64pfr0[15:12]. | 22 | + FIELD(NWCFG, FULL_DUPLEX, 1, 1) |
24 | + /* | 23 | + FIELD(NWCFG, DISCARD_NON_VLAN_FRAMES, 2, 1) |
25 | + * Disable the security extension feature bits in the processor | 24 | + FIELD(NWCFG, JUMBO_FRAMES, 3, 1) |
26 | + * feature registers as well. | 25 | + FIELD(NWCFG, PROMISC, 4, 1) |
27 | */ | 26 | + FIELD(NWCFG, NO_BROADCAST, 5, 1) |
28 | - cpu->isar.id_pfr1 &= ~0xf0; | 27 | + FIELD(NWCFG, MULTICAST_HASH_EN, 6, 1) |
29 | - cpu->isar.id_aa64pfr0 &= ~0xf000; | 28 | + FIELD(NWCFG, UNICAST_HASH_EN, 7, 1) |
30 | + cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0); | 29 | + FIELD(NWCFG, RECV_1536_BYTE_FRAMES, 8, 1) |
31 | + cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, | 30 | + FIELD(NWCFG, EXTERNAL_ADDR_MATCH_EN, 9, 1) |
32 | + ID_AA64PFR0, EL3, 0); | 31 | + FIELD(NWCFG, GIGABIT_MODE_ENABLE, 10, 1) |
32 | + FIELD(NWCFG, PCS_SELECT, 11, 1) | ||
33 | + FIELD(NWCFG, RETRY_TEST, 12, 1) | ||
34 | + FIELD(NWCFG, PAUSE_ENABLE, 13, 1) | ||
35 | + FIELD(NWCFG, RECV_BUF_OFFSET, 14, 2) | ||
36 | + FIELD(NWCFG, LEN_ERR_DISCARD, 16, 1) | ||
37 | + FIELD(NWCFG, FCS_REMOVE, 17, 1) | ||
38 | + FIELD(NWCFG, MDC_CLOCK_DIV, 18, 3) | ||
39 | + FIELD(NWCFG, DATA_BUS_WIDTH, 21, 2) | ||
40 | + FIELD(NWCFG, DISABLE_COPY_PAUSE_FRAMES, 23, 1) | ||
41 | + FIELD(NWCFG, RECV_CSUM_OFFLOAD_EN, 24, 1) | ||
42 | + FIELD(NWCFG, EN_HALF_DUPLEX_RX, 25, 1) | ||
43 | + FIELD(NWCFG, IGNORE_RX_FCS, 26, 1) | ||
44 | + FIELD(NWCFG, SGMII_MODE_ENABLE, 27, 1) | ||
45 | + FIELD(NWCFG, IPG_STRETCH_ENABLE, 28, 1) | ||
46 | + FIELD(NWCFG, NSP_ACCEPT, 29, 1) | ||
47 | + FIELD(NWCFG, IGNORE_IPG_RX_ER, 30, 1) | ||
48 | + FIELD(NWCFG, UNI_DIRECTION_ENABLE, 31, 1) | ||
49 | + | ||
50 | REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
51 | REG32(USERIO, 0xc) /* User IO reg */ | ||
52 | REG32(DMACFG, 0x10) /* DMA Control reg */ | ||
53 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
54 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
55 | |||
56 | /*****************************************/ | ||
57 | -#define GEM_NWCFG_STRIP_FCS 0x00020000 /* Strip FCS field */ | ||
58 | -#define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with len err */ | ||
59 | -#define GEM_NWCFG_BUFF_OFST_M 0x0000C000 /* Receive buffer offset mask */ | ||
60 | -#define GEM_NWCFG_BUFF_OFST_S 14 /* Receive buffer offset shift */ | ||
61 | -#define GEM_NWCFG_RCV_1538 0x00000100 /* Receive 1538 bytes frame */ | ||
62 | -#define GEM_NWCFG_UCAST_HASH 0x00000080 /* accept unicast if hash match */ | ||
63 | -#define GEM_NWCFG_MCAST_HASH 0x00000040 /* accept multicast if hash match */ | ||
64 | -#define GEM_NWCFG_BCAST_REJ 0x00000020 /* Reject broadcast packets */ | ||
65 | -#define GEM_NWCFG_PROMISC 0x00000010 /* Accept all packets */ | ||
66 | -#define GEM_NWCFG_JUMBO_FRAME 0x00000008 /* Jumbo Frames enable */ | ||
67 | - | ||
68 | #define GEM_DMACFG_ADDR_64B (1U << 30) | ||
69 | #define GEM_DMACFG_TX_BD_EXT (1U << 29) | ||
70 | #define GEM_DMACFG_RX_BD_EXT (1U << 28) | ||
71 | @@ -XXX,XX +XXX,XX @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | ||
72 | static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
73 | { | ||
74 | uint32_t size; | ||
75 | - if (s->regs[R_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { | ||
76 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, JUMBO_FRAMES)) { | ||
77 | size = s->regs[R_JUMBO_MAX_LEN]; | ||
78 | if (size > s->jumbo_max_len) { | ||
79 | size = s->jumbo_max_len; | ||
80 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
81 | } else if (tx) { | ||
82 | size = 1518; | ||
83 | } else { | ||
84 | - size = s->regs[R_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; | ||
85 | + size = FIELD_EX32(s->regs[R_NWCFG], | ||
86 | + NWCFG, RECV_1536_BYTE_FRAMES) ? 1538 : 1518; | ||
33 | } | 87 | } |
34 | 88 | return size; | |
35 | if (!cpu->has_el2) { | 89 | } |
36 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 90 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) |
91 | int i, is_mc; | ||
92 | |||
93 | /* Promiscuous mode? */ | ||
94 | - if (s->regs[R_NWCFG] & GEM_NWCFG_PROMISC) { | ||
95 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, PROMISC)) { | ||
96 | return GEM_RX_PROMISCUOUS_ACCEPT; | ||
37 | } | 97 | } |
38 | 98 | ||
39 | if (!arm_feature(env, ARM_FEATURE_EL2)) { | 99 | if (!memcmp(packet, broadcast_addr, 6)) { |
40 | - /* Disable the hypervisor feature bits in the processor feature | 100 | /* Reject broadcast packets? */ |
41 | - * registers if we don't have EL2. These are id_pfr1[15:12] and | 101 | - if (s->regs[R_NWCFG] & GEM_NWCFG_BCAST_REJ) { |
42 | - * id_aa64pfr0_el1[11:8]. | 102 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, NO_BROADCAST)) { |
43 | + /* | 103 | return GEM_RX_REJECT; |
44 | + * Disable the hypervisor feature bits in the processor feature | 104 | } |
45 | + * registers if we don't have EL2. | 105 | return GEM_RX_BROADCAST_ACCEPT; |
46 | */ | 106 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) |
47 | - cpu->isar.id_aa64pfr0 &= ~0xf00; | 107 | |
48 | - cpu->isar.id_pfr1 &= ~0xf000; | 108 | /* Accept packets -w- hash match? */ |
49 | + cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, | 109 | is_mc = is_multicast_ether_addr(packet); |
50 | + ID_AA64PFR0, EL2, 0); | 110 | - if ((is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_MCAST_HASH)) || |
51 | + cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, | 111 | - (!is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_UCAST_HASH))) { |
52 | + ID_PFR1, VIRTUALIZATION, 0); | 112 | + if ((is_mc && (FIELD_EX32(s->regs[R_NWCFG], NWCFG, MULTICAST_HASH_EN))) || |
113 | + (!is_mc && FIELD_EX32(s->regs[R_NWCFG], NWCFG, UNICAST_HASH_EN))) { | ||
114 | uint64_t buckets; | ||
115 | unsigned hash_index; | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
53 | } | 118 | } |
54 | 119 | ||
55 | #ifndef CONFIG_USER_ONLY | 120 | /* Discard packets with receive length error enabled ? */ |
121 | - if (s->regs[R_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
122 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, LEN_ERR_DISCARD)) { | ||
123 | unsigned type_len; | ||
124 | |||
125 | /* Fish the ethertype / length field out of the RX packet */ | ||
126 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
127 | /* | ||
128 | * Determine configured receive buffer offset (probably 0) | ||
129 | */ | ||
130 | - rxbuf_offset = (s->regs[R_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
131 | - GEM_NWCFG_BUFF_OFST_S; | ||
132 | + rxbuf_offset = FIELD_EX32(s->regs[R_NWCFG], NWCFG, RECV_BUF_OFFSET); | ||
133 | |||
134 | /* The configure size of each receive buffer. Determines how many | ||
135 | * buffers needed to hold this packet. | ||
136 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
137 | } | ||
138 | |||
139 | /* Strip of FCS field ? (usually yes) */ | ||
140 | - if (s->regs[R_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
141 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, FCS_REMOVE)) { | ||
142 | rxbuf_ptr = (void *)buf; | ||
143 | } else { | ||
144 | unsigned crc_val; | ||
56 | -- | 145 | -- |
57 | 2.25.1 | 146 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Use de FIELD macro to describe the DMACFG register fields. |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | |
5 | Message-id: 20220506180242.216785-18-richard.henderson@linaro.org | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-6-luc.michel@amd.com | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 9 | --- |
8 | docs/system/arm/emulation.rst | 1 + | 10 | hw/net/cadence_gem.c | 48 ++++++++++++++++++++++++++++---------------- |
9 | target/arm/cpu64.c | 1 + | 11 | 1 file changed, 31 insertions(+), 17 deletions(-) |
10 | target/arm/cpu_tcg.c | 1 + | ||
11 | 3 files changed, 3 insertions(+) | ||
12 | 12 | ||
13 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/docs/system/arm/emulation.rst | 15 | --- a/hw/net/cadence_gem.c |
16 | +++ b/docs/system/arm/emulation.rst | 16 | +++ b/hw/net/cadence_gem.c |
17 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | 17 | @@ -XXX,XX +XXX,XX @@ REG32(NWCFG, 0x4) /* Network Config reg */ |
18 | - FEAT_PMULL (PMULL, PMULL2 instructions) | 18 | |
19 | - FEAT_PMUv3p1 (PMU Extensions v3.1) | 19 | REG32(NWSTATUS, 0x8) /* Network Status reg */ |
20 | - FEAT_PMUv3p4 (PMU Extensions v3.4) | 20 | REG32(USERIO, 0xc) /* User IO reg */ |
21 | +- FEAT_RAS (Reliability, availability, and serviceability) | 21 | + |
22 | - FEAT_RDM (Advanced SIMD rounding double multiply accumulate instructions) | 22 | REG32(DMACFG, 0x10) /* DMA Control reg */ |
23 | - FEAT_RNG (Random number generator) | 23 | + FIELD(DMACFG, SEND_BCAST_TO_ALL_QS, 31, 1) |
24 | - FEAT_SB (Speculation Barrier) | 24 | + FIELD(DMACFG, DMA_ADDR_BUS_WIDTH, 30, 1) |
25 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 25 | + FIELD(DMACFG, TX_BD_EXT_MODE_EN , 29, 1) |
26 | index XXXXXXX..XXXXXXX 100644 | 26 | + FIELD(DMACFG, RX_BD_EXT_MODE_EN , 28, 1) |
27 | --- a/target/arm/cpu64.c | 27 | + FIELD(DMACFG, FORCE_MAX_AMBA_BURST_TX, 26, 1) |
28 | +++ b/target/arm/cpu64.c | 28 | + FIELD(DMACFG, FORCE_MAX_AMBA_BURST_RX, 25, 1) |
29 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 29 | + FIELD(DMACFG, FORCE_DISCARD_ON_ERR, 24, 1) |
30 | t = cpu->isar.id_aa64pfr0; | 30 | + FIELD(DMACFG, RX_BUF_SIZE, 16, 8) |
31 | t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */ | 31 | + FIELD(DMACFG, CRC_ERROR_REPORT, 13, 1) |
32 | t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */ | 32 | + FIELD(DMACFG, INF_LAST_DBUF_SIZE_EN, 12, 1) |
33 | + t = FIELD_DP64(t, ID_AA64PFR0, RAS, 1); /* FEAT_RAS */ | 33 | + FIELD(DMACFG, TX_PBUF_CSUM_OFFLOAD, 11, 1) |
34 | t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | 34 | + FIELD(DMACFG, TX_PBUF_SIZE, 10, 1) |
35 | t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | 35 | + FIELD(DMACFG, RX_PBUF_SIZE, 8, 2) |
36 | t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | 36 | + FIELD(DMACFG, ENDIAN_SWAP_PACKET, 7, 1) |
37 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | 37 | + FIELD(DMACFG, ENDIAN_SWAP_MGNT, 6, 1) |
38 | index XXXXXXX..XXXXXXX 100644 | 38 | + FIELD(DMACFG, HDR_DATA_SPLIT_EN, 5, 1) |
39 | --- a/target/arm/cpu_tcg.c | 39 | + FIELD(DMACFG, AMBA_BURST_LEN , 0, 5) |
40 | +++ b/target/arm/cpu_tcg.c | 40 | +#define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ |
41 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | 41 | + |
42 | 42 | REG32(TXSTATUS, 0x14) /* TX Status reg */ | |
43 | t = cpu->isar.id_pfr0; | 43 | REG32(RXQBASE, 0x18) /* RX Q Base address reg */ |
44 | t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ | 44 | REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ |
45 | + t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */ | 45 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) |
46 | cpu->isar.id_pfr0 = t; | 46 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) |
47 | 47 | ||
48 | t = cpu->isar.id_pfr2; | 48 | /*****************************************/ |
49 | -#define GEM_DMACFG_ADDR_64B (1U << 30) | ||
50 | -#define GEM_DMACFG_TX_BD_EXT (1U << 29) | ||
51 | -#define GEM_DMACFG_RX_BD_EXT (1U << 28) | ||
52 | -#define GEM_DMACFG_RBUFSZ_M 0x00FF0000 /* DMA RX Buffer Size mask */ | ||
53 | -#define GEM_DMACFG_RBUFSZ_S 16 /* DMA RX Buffer Size shift */ | ||
54 | -#define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ | ||
55 | -#define GEM_DMACFG_TXCSUM_OFFL 0x00000800 /* Transmit checksum offload */ | ||
56 | |||
57 | #define GEM_TXSTATUS_TXCMPL 0x00000020 /* Transmit Complete */ | ||
58 | #define GEM_TXSTATUS_USED 0x00000001 /* sw owned descriptor encountered */ | ||
59 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t tx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
60 | { | ||
61 | uint64_t ret = desc[0]; | ||
62 | |||
63 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
64 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
65 | ret |= (uint64_t)desc[2] << 32; | ||
66 | } | ||
67 | return ret; | ||
68 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t rx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
69 | { | ||
70 | uint64_t ret = desc[0] & ~0x3UL; | ||
71 | |||
72 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
73 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
74 | ret |= (uint64_t)desc[2] << 32; | ||
75 | } | ||
76 | return ret; | ||
77 | @@ -XXX,XX +XXX,XX @@ static inline int gem_get_desc_len(CadenceGEMState *s, bool rx_n_tx) | ||
78 | { | ||
79 | int ret = 2; | ||
80 | |||
81 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
82 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
83 | ret += 2; | ||
84 | } | ||
85 | - if (s->regs[R_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT | ||
86 | - : GEM_DMACFG_TX_BD_EXT)) { | ||
87 | + if (s->regs[R_DMACFG] & (rx_n_tx ? R_DMACFG_RX_BD_EXT_MODE_EN_MASK | ||
88 | + : R_DMACFG_TX_BD_EXT_MODE_EN_MASK)) { | ||
89 | ret += 2; | ||
90 | } | ||
91 | |||
92 | @@ -XXX,XX +XXX,XX @@ static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q) | ||
93 | { | ||
94 | hwaddr desc_addr = 0; | ||
95 | |||
96 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
97 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
98 | desc_addr = s->regs[tx ? R_TBQPH : R_RBQPH]; | ||
99 | } | ||
100 | desc_addr <<= 32; | ||
101 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
102 | /* The configure size of each receive buffer. Determines how many | ||
103 | * buffers needed to hold this packet. | ||
104 | */ | ||
105 | - rxbufsize = ((s->regs[R_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
106 | - GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; | ||
107 | + rxbufsize = FIELD_EX32(s->regs[R_DMACFG], DMACFG, RX_BUF_SIZE); | ||
108 | + rxbufsize *= GEM_DMACFG_RBUFSZ_MUL; | ||
109 | + | ||
110 | bytes_to_copy = size; | ||
111 | |||
112 | /* Hardware allows a zero value here but warns against it. To avoid QEMU | ||
113 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
114 | gem_update_int_status(s); | ||
115 | |||
116 | /* Is checksum offload enabled? */ | ||
117 | - if (s->regs[R_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
118 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, TX_PBUF_CSUM_OFFLOAD)) { | ||
119 | net_checksum_calculate(s->tx_packet, total_bytes, CSUM_ALL); | ||
120 | } | ||
121 | |||
122 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
123 | |||
124 | /* read next descriptor */ | ||
125 | if (tx_desc_get_wrap(desc)) { | ||
126 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
127 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
128 | packet_desc_addr = s->regs[R_TBQPH]; | ||
129 | packet_desc_addr <<= 32; | ||
130 | } else { | ||
49 | -- | 131 | -- |
50 | 2.25.1 | 132 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | We set this for qemu-system-aarch64, but failed to do so | 3 | Use de FIELD macro to describe the TXSTATUS and RXSTATUS register |
4 | for the strictly 32-bit emulation. | 4 | fields. |
5 | 5 | ||
6 | Fixes: 3bec78447a9 ("target/arm: Provide ARMv8.4-PMU in '-cpu max'") | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: sai.pavan.boddu@amd.com |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Message-id: 20231017194422.4124691-7-luc.michel@amd.com |
9 | Message-id: 20220506180242.216785-8-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | target/arm/cpu_tcg.c | 4 ++++ | 11 | hw/net/cadence_gem.c | 34 +++++++++++++++++++++++++--------- |
13 | 1 file changed, 4 insertions(+) | 12 | 1 file changed, 25 insertions(+), 9 deletions(-) |
14 | 13 | ||
15 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | 14 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/cpu_tcg.c | 16 | --- a/hw/net/cadence_gem.c |
18 | +++ b/target/arm/cpu_tcg.c | 17 | +++ b/hw/net/cadence_gem.c |
19 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 18 | @@ -XXX,XX +XXX,XX @@ REG32(DMACFG, 0x10) /* DMA Control reg */ |
20 | t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | 19 | #define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ |
21 | cpu->isar.id_pfr2 = t; | 20 | |
22 | 21 | REG32(TXSTATUS, 0x14) /* TX Status reg */ | |
23 | + t = cpu->isar.id_dfr0; | 22 | + FIELD(TXSTATUS, TX_USED_BIT_READ_MIDFRAME, 12, 1) |
24 | + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | 23 | + FIELD(TXSTATUS, TX_FRAME_TOO_LARGE, 11, 1) |
25 | + cpu->isar.id_dfr0 = t; | 24 | + FIELD(TXSTATUS, TX_DMA_LOCKUP, 10, 1) |
25 | + FIELD(TXSTATUS, TX_MAC_LOCKUP, 9, 1) | ||
26 | + FIELD(TXSTATUS, RESP_NOT_OK, 8, 1) | ||
27 | + FIELD(TXSTATUS, LATE_COLLISION, 7, 1) | ||
28 | + FIELD(TXSTATUS, TRANSMIT_UNDER_RUN, 6, 1) | ||
29 | + FIELD(TXSTATUS, TRANSMIT_COMPLETE, 5, 1) | ||
30 | + FIELD(TXSTATUS, AMBA_ERROR, 4, 1) | ||
31 | + FIELD(TXSTATUS, TRANSMIT_GO, 3, 1) | ||
32 | + FIELD(TXSTATUS, RETRY_LIMIT, 2, 1) | ||
33 | + FIELD(TXSTATUS, COLLISION, 1, 1) | ||
34 | + FIELD(TXSTATUS, USED_BIT_READ, 0, 1) | ||
26 | + | 35 | + |
27 | #ifdef CONFIG_USER_ONLY | 36 | REG32(RXQBASE, 0x18) /* RX Q Base address reg */ |
28 | /* | 37 | REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ |
29 | * Break with true ARMv8 and add back old-style VFP short-vector support. | 38 | REG32(RXSTATUS, 0x20) /* RX Status reg */ |
39 | + FIELD(RXSTATUS, RX_DMA_LOCKUP, 5, 1) | ||
40 | + FIELD(RXSTATUS, RX_MAC_LOCKUP, 4, 1) | ||
41 | + FIELD(RXSTATUS, RESP_NOT_OK, 3, 1) | ||
42 | + FIELD(RXSTATUS, RECEIVE_OVERRUN, 2, 1) | ||
43 | + FIELD(RXSTATUS, FRAME_RECEIVED, 1, 1) | ||
44 | + FIELD(RXSTATUS, BUF_NOT_AVAILABLE, 0, 1) | ||
45 | + | ||
46 | REG32(ISR, 0x24) /* Interrupt Status reg */ | ||
47 | REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
48 | REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
49 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
50 | |||
51 | /*****************************************/ | ||
52 | |||
53 | -#define GEM_TXSTATUS_TXCMPL 0x00000020 /* Transmit Complete */ | ||
54 | -#define GEM_TXSTATUS_USED 0x00000001 /* sw owned descriptor encountered */ | ||
55 | - | ||
56 | -#define GEM_RXSTATUS_FRMRCVD 0x00000002 /* Frame received */ | ||
57 | -#define GEM_RXSTATUS_NOBUF 0x00000001 /* Buffer unavailable */ | ||
58 | |||
59 | /* GEM_ISR GEM_IER GEM_IDR GEM_IMR */ | ||
60 | #define GEM_INT_TXCMPL 0x00000080 /* Transmit Complete */ | ||
61 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) | ||
62 | /* Descriptor owned by software ? */ | ||
63 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { | ||
64 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); | ||
65 | - s->regs[R_RXSTATUS] |= GEM_RXSTATUS_NOBUF; | ||
66 | + s->regs[R_RXSTATUS] |= R_RXSTATUS_BUF_NOT_AVAILABLE_MASK; | ||
67 | gem_set_isr(s, q, GEM_INT_RXUSED); | ||
68 | /* Handle interrupt consequences */ | ||
69 | gem_update_int_status(s); | ||
70 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
71 | /* Count it */ | ||
72 | gem_receive_updatestats(s, buf, size); | ||
73 | |||
74 | - s->regs[R_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; | ||
75 | + s->regs[R_RXSTATUS] |= R_RXSTATUS_FRAME_RECEIVED_MASK; | ||
76 | gem_set_isr(s, q, GEM_INT_RXCMPL); | ||
77 | |||
78 | /* Handle interrupt consequences */ | ||
79 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
80 | } | ||
81 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); | ||
82 | |||
83 | - s->regs[R_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; | ||
84 | + s->regs[R_TXSTATUS] |= R_TXSTATUS_TRANSMIT_COMPLETE_MASK; | ||
85 | gem_set_isr(s, q, GEM_INT_TXCMPL); | ||
86 | |||
87 | /* Handle interrupt consequences */ | ||
88 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
89 | } | ||
90 | |||
91 | if (tx_desc_get_used(desc)) { | ||
92 | - s->regs[R_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
93 | + s->regs[R_TXSTATUS] |= R_TXSTATUS_USED_BIT_READ_MASK; | ||
94 | /* IRQ TXUSED is defined only for queue 0 */ | ||
95 | if (q == 0) { | ||
96 | gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
30 | -- | 97 | -- |
31 | 2.25.1 | 98 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Drop zcr_no_el2_reginfo and merge the 3 registers into one array, | 3 | Use de FIELD macro to describe the IRQ related register fields. |
4 | now that ZCR_EL2 can be squashed to RES0 and ZCR_EL3 dropped | ||
5 | while registering. | ||
6 | 4 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
9 | Message-id: 20220506180242.216785-4-richard.henderson@linaro.org | 7 | Message-id: 20231017194422.4124691-8-luc.michel@amd.com |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | target/arm/helper.c | 55 ++++++++++++++------------------------------- | 10 | hw/net/cadence_gem.c | 51 +++++++++++++++++++++++++++++++++----------- |
13 | 1 file changed, 17 insertions(+), 38 deletions(-) | 11 | 1 file changed, 39 insertions(+), 12 deletions(-) |
14 | 12 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 15 | --- a/hw/net/cadence_gem.c |
18 | +++ b/target/arm/helper.c | 16 | +++ b/hw/net/cadence_gem.c |
19 | @@ -XXX,XX +XXX,XX @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 17 | @@ -XXX,XX +XXX,XX @@ REG32(RXSTATUS, 0x20) /* RX Status reg */ |
18 | FIELD(RXSTATUS, BUF_NOT_AVAILABLE, 0, 1) | ||
19 | |||
20 | REG32(ISR, 0x24) /* Interrupt Status reg */ | ||
21 | + FIELD(ISR, TX_LOCKUP, 31, 1) | ||
22 | + FIELD(ISR, RX_LOCKUP, 30, 1) | ||
23 | + FIELD(ISR, TSU_TIMER, 29, 1) | ||
24 | + FIELD(ISR, WOL, 28, 1) | ||
25 | + FIELD(ISR, RECV_LPI, 27, 1) | ||
26 | + FIELD(ISR, TSU_SEC_INCR, 26, 1) | ||
27 | + FIELD(ISR, PTP_PDELAY_RESP_XMIT, 25, 1) | ||
28 | + FIELD(ISR, PTP_PDELAY_REQ_XMIT, 24, 1) | ||
29 | + FIELD(ISR, PTP_PDELAY_RESP_RECV, 23, 1) | ||
30 | + FIELD(ISR, PTP_PDELAY_REQ_RECV, 22, 1) | ||
31 | + FIELD(ISR, PTP_SYNC_XMIT, 21, 1) | ||
32 | + FIELD(ISR, PTP_DELAY_REQ_XMIT, 20, 1) | ||
33 | + FIELD(ISR, PTP_SYNC_RECV, 19, 1) | ||
34 | + FIELD(ISR, PTP_DELAY_REQ_RECV, 18, 1) | ||
35 | + FIELD(ISR, PCS_LP_PAGE_RECV, 17, 1) | ||
36 | + FIELD(ISR, PCS_AN_COMPLETE, 16, 1) | ||
37 | + FIELD(ISR, EXT_IRQ, 15, 1) | ||
38 | + FIELD(ISR, PAUSE_FRAME_XMIT, 14, 1) | ||
39 | + FIELD(ISR, PAUSE_TIME_ELAPSED, 13, 1) | ||
40 | + FIELD(ISR, PAUSE_FRAME_RECV, 12, 1) | ||
41 | + FIELD(ISR, RESP_NOT_OK, 11, 1) | ||
42 | + FIELD(ISR, RECV_OVERRUN, 10, 1) | ||
43 | + FIELD(ISR, LINK_CHANGE, 9, 1) | ||
44 | + FIELD(ISR, USXGMII_INT, 8, 1) | ||
45 | + FIELD(ISR, XMIT_COMPLETE, 7, 1) | ||
46 | + FIELD(ISR, AMBA_ERROR, 6, 1) | ||
47 | + FIELD(ISR, RETRY_EXCEEDED, 5, 1) | ||
48 | + FIELD(ISR, XMIT_UNDER_RUN, 4, 1) | ||
49 | + FIELD(ISR, TX_USED, 3, 1) | ||
50 | + FIELD(ISR, RX_USED, 2, 1) | ||
51 | + FIELD(ISR, RECV_COMPLETE, 1, 1) | ||
52 | + FIELD(ISR, MGNT_FRAME_SENT, 0, 1) | ||
53 | REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
54 | REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
55 | REG32(IMR, 0x30) /* Interrupt Mask reg */ | ||
56 | + | ||
57 | REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ | ||
58 | REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ | ||
59 | REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ | ||
60 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
61 | /*****************************************/ | ||
62 | |||
63 | |||
64 | -/* GEM_ISR GEM_IER GEM_IDR GEM_IMR */ | ||
65 | -#define GEM_INT_TXCMPL 0x00000080 /* Transmit Complete */ | ||
66 | -#define GEM_INT_AMBA_ERR 0x00000040 | ||
67 | -#define GEM_INT_TXUSED 0x00000008 | ||
68 | -#define GEM_INT_RXUSED 0x00000004 | ||
69 | -#define GEM_INT_RXCMPL 0x00000002 | ||
70 | |||
71 | #define GEM_PHYMNTNC_OP_R 0x20000000 /* read operation */ | ||
72 | #define GEM_PHYMNTNC_OP_W 0x10000000 /* write operation */ | ||
73 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) | ||
74 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { | ||
75 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); | ||
76 | s->regs[R_RXSTATUS] |= R_RXSTATUS_BUF_NOT_AVAILABLE_MASK; | ||
77 | - gem_set_isr(s, q, GEM_INT_RXUSED); | ||
78 | + gem_set_isr(s, q, R_ISR_RX_USED_MASK); | ||
79 | /* Handle interrupt consequences */ | ||
80 | gem_update_int_status(s); | ||
20 | } | 81 | } |
21 | } | 82 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
22 | 83 | ||
23 | -static const ARMCPRegInfo zcr_el1_reginfo = { | 84 | if (size > gem_get_max_buf_len(s, false)) { |
24 | - .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64, | 85 | qemu_log_mask(LOG_GUEST_ERROR, "rx frame too long\n"); |
25 | - .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0, | 86 | - gem_set_isr(s, q, GEM_INT_AMBA_ERR); |
26 | - .access = PL1_RW, .type = ARM_CP_SVE, | 87 | + gem_set_isr(s, q, R_ISR_AMBA_ERROR_MASK); |
27 | - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]), | 88 | return -1; |
28 | - .writefn = zcr_write, .raw_writefn = raw_write | ||
29 | -}; | ||
30 | - | ||
31 | -static const ARMCPRegInfo zcr_el2_reginfo = { | ||
32 | - .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, | ||
33 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, | ||
34 | - .access = PL2_RW, .type = ARM_CP_SVE, | ||
35 | - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]), | ||
36 | - .writefn = zcr_write, .raw_writefn = raw_write | ||
37 | -}; | ||
38 | - | ||
39 | -static const ARMCPRegInfo zcr_no_el2_reginfo = { | ||
40 | - .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, | ||
41 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, | ||
42 | - .access = PL2_RW, .type = ARM_CP_SVE, | ||
43 | - .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore | ||
44 | -}; | ||
45 | - | ||
46 | -static const ARMCPRegInfo zcr_el3_reginfo = { | ||
47 | - .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64, | ||
48 | - .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0, | ||
49 | - .access = PL3_RW, .type = ARM_CP_SVE, | ||
50 | - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]), | ||
51 | - .writefn = zcr_write, .raw_writefn = raw_write | ||
52 | +static const ARMCPRegInfo zcr_reginfo[] = { | ||
53 | + { .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64, | ||
54 | + .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0, | ||
55 | + .access = PL1_RW, .type = ARM_CP_SVE, | ||
56 | + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]), | ||
57 | + .writefn = zcr_write, .raw_writefn = raw_write }, | ||
58 | + { .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, | ||
59 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, | ||
60 | + .access = PL2_RW, .type = ARM_CP_SVE, | ||
61 | + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]), | ||
62 | + .writefn = zcr_write, .raw_writefn = raw_write }, | ||
63 | + { .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64, | ||
64 | + .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0, | ||
65 | + .access = PL3_RW, .type = ARM_CP_SVE, | ||
66 | + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]), | ||
67 | + .writefn = zcr_write, .raw_writefn = raw_write }, | ||
68 | }; | ||
69 | |||
70 | void hw_watchpoint_update(ARMCPU *cpu, int n) | ||
71 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
72 | } | 89 | } |
73 | 90 | ||
74 | if (cpu_isar_feature(aa64_sve, cpu)) { | 91 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
75 | - define_one_arm_cp_reg(cpu, &zcr_el1_reginfo); | 92 | gem_receive_updatestats(s, buf, size); |
76 | - if (arm_feature(env, ARM_FEATURE_EL2)) { | 93 | |
77 | - define_one_arm_cp_reg(cpu, &zcr_el2_reginfo); | 94 | s->regs[R_RXSTATUS] |= R_RXSTATUS_FRAME_RECEIVED_MASK; |
78 | - } else { | 95 | - gem_set_isr(s, q, GEM_INT_RXCMPL); |
79 | - define_one_arm_cp_reg(cpu, &zcr_no_el2_reginfo); | 96 | + gem_set_isr(s, q, R_ISR_RECV_COMPLETE_MASK); |
80 | - } | 97 | |
81 | - if (arm_feature(env, ARM_FEATURE_EL3)) { | 98 | /* Handle interrupt consequences */ |
82 | - define_one_arm_cp_reg(cpu, &zcr_el3_reginfo); | 99 | gem_update_int_status(s); |
83 | - } | 100 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
84 | + define_arm_cp_regs(cpu, zcr_reginfo); | 101 | HWADDR_PRIx " too large: size 0x%x space 0x%zx\n", |
85 | } | 102 | packet_desc_addr, tx_desc_get_length(desc), |
86 | 103 | gem_get_max_buf_len(s, true) - (p - s->tx_packet)); | |
87 | #ifdef TARGET_AARCH64 | 104 | - gem_set_isr(s, q, GEM_INT_AMBA_ERR); |
105 | + gem_set_isr(s, q, R_ISR_AMBA_ERROR_MASK); | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
110 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); | ||
111 | |||
112 | s->regs[R_TXSTATUS] |= R_TXSTATUS_TRANSMIT_COMPLETE_MASK; | ||
113 | - gem_set_isr(s, q, GEM_INT_TXCMPL); | ||
114 | + gem_set_isr(s, q, R_ISR_XMIT_COMPLETE_MASK); | ||
115 | |||
116 | /* Handle interrupt consequences */ | ||
117 | gem_update_int_status(s); | ||
118 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
119 | s->regs[R_TXSTATUS] |= R_TXSTATUS_USED_BIT_READ_MASK; | ||
120 | /* IRQ TXUSED is defined only for queue 0 */ | ||
121 | if (q == 0) { | ||
122 | - gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
123 | + gem_set_isr(s, 0, R_ISR_TX_USED_MASK); | ||
124 | } | ||
125 | gem_update_int_status(s); | ||
126 | } | ||
88 | -- | 127 | -- |
89 | 2.25.1 | 128 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Instead of starting with cortex-a15 and adding v8 features to | 3 | Use the FIELD macro to describe the DESCONF6 register fields. |
4 | a v7 cpu, begin with a v8 cpu stripped of its aarch64 features. | ||
5 | This fixes the long-standing to-do where we only enabled v8 | ||
6 | features for user-only. | ||
7 | 4 | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Message-id: 20220506180242.216785-7-richard.henderson@linaro.org | 7 | Message-id: 20231017194422.4124691-9-luc.michel@amd.com |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | target/arm/cpu_tcg.c | 151 ++++++++++++++++++++++++++----------------- | 10 | hw/net/cadence_gem.c | 4 ++-- |
14 | 1 file changed, 92 insertions(+), 59 deletions(-) | 11 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 12 | ||
16 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu_tcg.c | 15 | --- a/hw/net/cadence_gem.c |
19 | +++ b/target/arm/cpu_tcg.c | 16 | +++ b/hw/net/cadence_gem.c |
20 | @@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data) | 17 | @@ -XXX,XX +XXX,XX @@ REG32(DESCONF3, 0x288) |
21 | static void arm_max_initfn(Object *obj) | 18 | REG32(DESCONF4, 0x28c) |
22 | { | 19 | REG32(DESCONF5, 0x290) |
23 | ARMCPU *cpu = ARM_CPU(obj); | 20 | REG32(DESCONF6, 0x294) |
24 | + uint32_t t; | 21 | -#define GEM_DESCONF6_64B_MASK (1U << 23) |
25 | 22 | + FIELD(DESCONF6, DMA_ADDR_64B, 23, 1) | |
26 | - cortex_a15_initfn(obj); | 23 | REG32(DESCONF7, 0x298) |
27 | + /* aarch64_a57_initfn, advertising none of the aarch64 features */ | 24 | |
28 | + cpu->dtb_compatible = "arm,cortex-a57"; | 25 | REG32(INT_Q1_STATUS, 0x400) |
29 | + set_feature(&cpu->env, ARM_FEATURE_V8); | 26 | @@ -XXX,XX +XXX,XX @@ static void gem_reset(DeviceState *d) |
30 | + set_feature(&cpu->env, ARM_FEATURE_NEON); | 27 | s->regs[R_DESCONF] = 0x02D00111; |
31 | + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | 28 | s->regs[R_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; |
32 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | 29 | s->regs[R_DESCONF5] = 0x002f2045; |
33 | + set_feature(&cpu->env, ARM_FEATURE_EL2); | 30 | - s->regs[R_DESCONF6] = GEM_DESCONF6_64B_MASK; |
34 | + set_feature(&cpu->env, ARM_FEATURE_EL3); | 31 | + s->regs[R_DESCONF6] = R_DESCONF6_DMA_ADDR_64B_MASK; |
35 | + set_feature(&cpu->env, ARM_FEATURE_PMU); | 32 | s->regs[R_INT_Q1_MASK] = 0x00000CE6; |
36 | + cpu->midr = 0x411fd070; | 33 | s->regs[R_JUMBO_MAX_LEN] = s->jumbo_max_len; |
37 | + cpu->revidr = 0x00000000; | ||
38 | + cpu->reset_fpsid = 0x41034070; | ||
39 | + cpu->isar.mvfr0 = 0x10110222; | ||
40 | + cpu->isar.mvfr1 = 0x12111111; | ||
41 | + cpu->isar.mvfr2 = 0x00000043; | ||
42 | + cpu->ctr = 0x8444c004; | ||
43 | + cpu->reset_sctlr = 0x00c50838; | ||
44 | + cpu->isar.id_pfr0 = 0x00000131; | ||
45 | + cpu->isar.id_pfr1 = 0x00011011; | ||
46 | + cpu->isar.id_dfr0 = 0x03010066; | ||
47 | + cpu->id_afr0 = 0x00000000; | ||
48 | + cpu->isar.id_mmfr0 = 0x10101105; | ||
49 | + cpu->isar.id_mmfr1 = 0x40000000; | ||
50 | + cpu->isar.id_mmfr2 = 0x01260000; | ||
51 | + cpu->isar.id_mmfr3 = 0x02102211; | ||
52 | + cpu->isar.id_isar0 = 0x02101110; | ||
53 | + cpu->isar.id_isar1 = 0x13112111; | ||
54 | + cpu->isar.id_isar2 = 0x21232042; | ||
55 | + cpu->isar.id_isar3 = 0x01112131; | ||
56 | + cpu->isar.id_isar4 = 0x00011142; | ||
57 | + cpu->isar.id_isar5 = 0x00011121; | ||
58 | + cpu->isar.id_isar6 = 0; | ||
59 | + cpu->isar.dbgdidr = 0x3516d000; | ||
60 | + cpu->clidr = 0x0a200023; | ||
61 | + cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ | ||
62 | + cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */ | ||
63 | + cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */ | ||
64 | + define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
65 | |||
66 | - /* old-style VFP short-vector support */ | ||
67 | - cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1); | ||
68 | + /* Add additional features supported by QEMU */ | ||
69 | + t = cpu->isar.id_isar5; | ||
70 | + t = FIELD_DP32(t, ID_ISAR5, AES, 2); | ||
71 | + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); | ||
72 | + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); | ||
73 | + t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); | ||
74 | + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); | ||
75 | + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); | ||
76 | + cpu->isar.id_isar5 = t; | ||
77 | + | ||
78 | + t = cpu->isar.id_isar6; | ||
79 | + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | ||
80 | + t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
81 | + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | ||
82 | + t = FIELD_DP32(t, ID_ISAR6, SB, 1); | ||
83 | + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | ||
84 | + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); | ||
85 | + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); | ||
86 | + cpu->isar.id_isar6 = t; | ||
87 | + | ||
88 | + t = cpu->isar.mvfr1; | ||
89 | + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
90 | + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
91 | + cpu->isar.mvfr1 = t; | ||
92 | + | ||
93 | + t = cpu->isar.mvfr2; | ||
94 | + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
95 | + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
96 | + cpu->isar.mvfr2 = t; | ||
97 | + | ||
98 | + t = cpu->isar.id_mmfr3; | ||
99 | + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
100 | + cpu->isar.id_mmfr3 = t; | ||
101 | + | ||
102 | + t = cpu->isar.id_mmfr4; | ||
103 | + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
104 | + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
105 | + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
106 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
107 | + cpu->isar.id_mmfr4 = t; | ||
108 | + | ||
109 | + t = cpu->isar.id_pfr0; | ||
110 | + t = FIELD_DP32(t, ID_PFR0, DIT, 1); | ||
111 | + cpu->isar.id_pfr0 = t; | ||
112 | + | ||
113 | + t = cpu->isar.id_pfr2; | ||
114 | + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | ||
115 | + cpu->isar.id_pfr2 = t; | ||
116 | |||
117 | #ifdef CONFIG_USER_ONLY | ||
118 | /* | ||
119 | - * We don't set these in system emulation mode for the moment, | ||
120 | - * since we don't correctly set (all of) the ID registers to | ||
121 | - * advertise them. | ||
122 | + * Break with true ARMv8 and add back old-style VFP short-vector support. | ||
123 | + * Only do this for user-mode, where -cpu max is the default, so that | ||
124 | + * older v6 and v7 programs are more likely to work without adjustment. | ||
125 | */ | ||
126 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
127 | - { | ||
128 | - uint32_t t; | ||
129 | - | ||
130 | - t = cpu->isar.id_isar5; | ||
131 | - t = FIELD_DP32(t, ID_ISAR5, AES, 2); | ||
132 | - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); | ||
133 | - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); | ||
134 | - t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); | ||
135 | - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); | ||
136 | - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); | ||
137 | - cpu->isar.id_isar5 = t; | ||
138 | - | ||
139 | - t = cpu->isar.id_isar6; | ||
140 | - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | ||
141 | - t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
142 | - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | ||
143 | - t = FIELD_DP32(t, ID_ISAR6, SB, 1); | ||
144 | - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | ||
145 | - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); | ||
146 | - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); | ||
147 | - cpu->isar.id_isar6 = t; | ||
148 | - | ||
149 | - t = cpu->isar.mvfr1; | ||
150 | - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
151 | - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
152 | - cpu->isar.mvfr1 = t; | ||
153 | - | ||
154 | - t = cpu->isar.mvfr2; | ||
155 | - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ | ||
156 | - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ | ||
157 | - cpu->isar.mvfr2 = t; | ||
158 | - | ||
159 | - t = cpu->isar.id_mmfr3; | ||
160 | - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
161 | - cpu->isar.id_mmfr3 = t; | ||
162 | - | ||
163 | - t = cpu->isar.id_mmfr4; | ||
164 | - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
165 | - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
166 | - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
167 | - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
168 | - cpu->isar.id_mmfr4 = t; | ||
169 | - | ||
170 | - t = cpu->isar.id_pfr0; | ||
171 | - t = FIELD_DP32(t, ID_PFR0, DIT, 1); | ||
172 | - cpu->isar.id_pfr0 = t; | ||
173 | - | ||
174 | - t = cpu->isar.id_pfr2; | ||
175 | - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); | ||
176 | - cpu->isar.id_pfr2 = t; | ||
177 | - } | ||
178 | -#endif /* CONFIG_USER_ONLY */ | ||
179 | + cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1); | ||
180 | +#endif | ||
181 | } | ||
182 | #endif /* !TARGET_AARCH64 */ | ||
183 | 34 | ||
184 | -- | 35 | -- |
185 | 2.25.1 | 36 | 2.34.1 |
37 | |||
38 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Enable writes to the TERR and TEA bits when RAS is enabled. | 3 | Use the FIELD macro to describe the PHYMNTNC register fields. |
4 | These bits are otherwise RES0. | ||
5 | 4 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
8 | Message-id: 20220506180242.216785-15-richard.henderson@linaro.org | 7 | Message-id: 20231017194422.4124691-10-luc.michel@amd.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 9 | --- |
11 | target/arm/helper.c | 9 +++++++++ | 10 | hw/net/cadence_gem.c | 27 ++++++++++++++------------- |
12 | 1 file changed, 9 insertions(+) | 11 | 1 file changed, 14 insertions(+), 13 deletions(-) |
13 | 12 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 15 | --- a/hw/net/cadence_gem.c |
17 | +++ b/target/arm/helper.c | 16 | +++ b/hw/net/cadence_gem.c |
18 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 17 | @@ -XXX,XX +XXX,XX @@ REG32(IDR, 0x2c) /* Interrupt Disable reg */ |
19 | } | 18 | REG32(IMR, 0x30) /* Interrupt Mask reg */ |
20 | valid_mask &= ~SCR_NET; | 19 | |
21 | 20 | REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ | |
22 | + if (cpu_isar_feature(aa64_ras, cpu)) { | 21 | + FIELD(PHYMNTNC, DATA, 0, 16) |
23 | + valid_mask |= SCR_TERR; | 22 | + FIELD(PHYMNTNC, REG_ADDR, 18, 5) |
24 | + } | 23 | + FIELD(PHYMNTNC, PHY_ADDR, 23, 5) |
25 | if (cpu_isar_feature(aa64_lor, cpu)) { | 24 | + FIELD(PHYMNTNC, OP, 28, 2) |
26 | valid_mask |= SCR_TLOR; | 25 | + FIELD(PHYMNTNC, ST, 30, 2) |
27 | } | 26 | +#define MDIO_OP_READ 0x3 |
28 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 27 | +#define MDIO_OP_WRITE 0x2 |
29 | } | 28 | + |
30 | } else { | 29 | REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ |
31 | valid_mask &= ~(SCR_RW | SCR_ST); | 30 | REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ |
32 | + if (cpu_isar_feature(aa32_ras, cpu)) { | 31 | REG32(TXPARTIALSF, 0x40) /* TX Partial Store and Forward */ |
33 | + valid_mask |= SCR_TERR; | 32 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) |
34 | + } | 33 | |
35 | } | 34 | |
36 | 35 | ||
37 | if (!arm_feature(env, ARM_FEATURE_EL2)) { | 36 | -#define GEM_PHYMNTNC_OP_R 0x20000000 /* read operation */ |
38 | @@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) | 37 | -#define GEM_PHYMNTNC_OP_W 0x10000000 /* write operation */ |
39 | if (cpu_isar_feature(aa64_vh, cpu)) { | 38 | -#define GEM_PHYMNTNC_ADDR 0x0F800000 /* Address bits */ |
40 | valid_mask |= HCR_E2H; | 39 | -#define GEM_PHYMNTNC_ADDR_SHFT 23 |
41 | } | 40 | -#define GEM_PHYMNTNC_REG 0x007C0000 /* register bits */ |
42 | + if (cpu_isar_feature(aa64_ras, cpu)) { | 41 | -#define GEM_PHYMNTNC_REG_SHIFT 18 |
43 | + valid_mask |= HCR_TERR | HCR_TEA; | 42 | - |
44 | + } | 43 | /* Marvell PHY definitions */ |
45 | if (cpu_isar_feature(aa64_lor, cpu)) { | 44 | #define BOARD_PHY_ADDRESS 0 /* PHY address we will emulate a device at */ |
46 | valid_mask |= HCR_TLOR; | 45 | |
46 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) | ||
47 | /* The interrupts get updated at the end of the function. */ | ||
48 | break; | ||
49 | case R_PHYMNTNC: | ||
50 | - if (retval & GEM_PHYMNTNC_OP_R) { | ||
51 | + if (FIELD_EX32(retval, PHYMNTNC, OP) == MDIO_OP_READ) { | ||
52 | uint32_t phy_addr, reg_num; | ||
53 | |||
54 | - phy_addr = (retval & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; | ||
55 | + phy_addr = FIELD_EX32(retval, PHYMNTNC, PHY_ADDR); | ||
56 | if (phy_addr == s->phy_addr) { | ||
57 | - reg_num = (retval & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; | ||
58 | + reg_num = FIELD_EX32(retval, PHYMNTNC, REG_ADDR); | ||
59 | retval &= 0xFFFF0000; | ||
60 | retval |= gem_phy_read(s, reg_num); | ||
61 | } else { | ||
62 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
63 | s->sar_active[(offset - R_SPADDR1HI) / 2] = true; | ||
64 | break; | ||
65 | case R_PHYMNTNC: | ||
66 | - if (val & GEM_PHYMNTNC_OP_W) { | ||
67 | + if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_WRITE) { | ||
68 | uint32_t phy_addr, reg_num; | ||
69 | |||
70 | - phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; | ||
71 | + phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); | ||
72 | if (phy_addr == s->phy_addr) { | ||
73 | - reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; | ||
74 | + reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); | ||
75 | gem_phy_write(s, reg_num, val); | ||
76 | } | ||
47 | } | 77 | } |
48 | -- | 78 | -- |
49 | 2.25.1 | 79 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Drop el3_no_el2_cp_reginfo, el3_no_el2_v8_cp_reginfo, and the local | 3 | The MDIO access is done only on a write to the PHYMNTNC register. A |
4 | vpidr_regs definition, and rely on the squashing to ARM_CP_CONST | 4 | subsequent read is used to retrieve the result but does not trigger an |
5 | while registering for v8. | 5 | MDIO access by itself. |
6 | 6 | ||
7 | This is a behavior change for v7 cpus with Security Extensions and | 7 | Refactor the PHY access logic to perform all accesses (MDIO reads and |
8 | without Virtualization Extensions, in that the virtualization cpregs | 8 | writes) at PHYMNTNC write time. |
9 | are now correctly not present. This would be a migration compatibility | ||
10 | break, except that we have an existing bug in which migration of 32-bit | ||
11 | cpus with Security Extensions enabled does not work. | ||
12 | 9 | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
14 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Reviewed-by: sai.pavan.boddu@amd.com |
15 | Message-id: 20220506180242.216785-3-richard.henderson@linaro.org | 12 | Message-id: 20231017194422.4124691-11-luc.michel@amd.com |
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 14 | --- |
18 | target/arm/helper.c | 158 ++++---------------------------------------- | 15 | hw/net/cadence_gem.c | 56 ++++++++++++++++++++++++++------------------ |
19 | 1 file changed, 13 insertions(+), 145 deletions(-) | 16 | 1 file changed, 33 insertions(+), 23 deletions(-) |
20 | 17 | ||
21 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 18 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
22 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/helper.c | 20 | --- a/hw/net/cadence_gem.c |
24 | +++ b/target/arm/helper.c | 21 | +++ b/hw/net/cadence_gem.c |
25 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 22 | @@ -XXX,XX +XXX,XX @@ static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val) |
26 | .fieldoffset = offsetoflow32(CPUARMState, cp15.mdcr_el3) }, | 23 | s->phy_regs[reg_num] = val; |
27 | }; | 24 | } |
28 | 25 | ||
29 | -/* Used to describe the behaviour of EL2 regs when EL2 does not exist. */ | 26 | +static void gem_handle_phy_access(CadenceGEMState *s) |
30 | -static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { | 27 | +{ |
31 | - { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH, | 28 | + uint32_t val = s->regs[R_PHYMNTNC]; |
32 | - .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0, | 29 | + uint32_t phy_addr, reg_num; |
33 | - .access = PL2_RW, | 30 | + |
34 | - .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, | 31 | + phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); |
35 | - { .name = "HCR_EL2", .state = ARM_CP_STATE_BOTH, | 32 | + |
36 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, | 33 | + if (phy_addr != s->phy_addr) { |
37 | - .access = PL2_RW, | 34 | + /* no phy at this address */ |
38 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | 35 | + if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_READ) { |
39 | - { .name = "HACR_EL2", .state = ARM_CP_STATE_BOTH, | 36 | + s->regs[R_PHYMNTNC] = FIELD_DP32(val, PHYMNTNC, DATA, 0xffff); |
40 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 7, | 37 | + } |
41 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 38 | + return; |
42 | - { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH, | 39 | + } |
43 | - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, | 40 | + |
44 | - .access = PL2_RW, | 41 | + reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); |
45 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | 42 | + |
46 | - { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH, | 43 | + switch (FIELD_EX32(val, PHYMNTNC, OP)) { |
47 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2, | 44 | + case MDIO_OP_READ: |
48 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 45 | + s->regs[R_PHYMNTNC] = FIELD_DP32(val, PHYMNTNC, DATA, |
49 | - { .name = "MAIR_EL2", .state = ARM_CP_STATE_BOTH, | 46 | + gem_phy_read(s, reg_num)); |
50 | - .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 0, | 47 | + break; |
51 | - .access = PL2_RW, .type = ARM_CP_CONST, | 48 | + |
52 | - .resetvalue = 0 }, | 49 | + case MDIO_OP_WRITE: |
53 | - { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, | 50 | + gem_phy_write(s, reg_num, val); |
54 | - .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, | 51 | + break; |
55 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | 52 | + |
56 | - { .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH, | 53 | + default: |
57 | - .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0, | 54 | + break; /* only clause 22 operations are supported */ |
58 | - .access = PL2_RW, .type = ARM_CP_CONST, | 55 | + } |
59 | - .resetvalue = 0 }, | 56 | +} |
60 | - { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, | 57 | + |
61 | - .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, | 58 | /* |
62 | - .access = PL2_RW, .type = ARM_CP_CONST, | 59 | * gem_read32: |
63 | - .resetvalue = 0 }, | 60 | * Read a GEM register. |
64 | - { .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH, | 61 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) |
65 | - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 0, | 62 | DB_PRINT("lowering irqs on ISR read\n"); |
66 | - .access = PL2_RW, .type = ARM_CP_CONST, | 63 | /* The interrupts get updated at the end of the function. */ |
67 | - .resetvalue = 0 }, | 64 | break; |
68 | - { .name = "AFSR1_EL2", .state = ARM_CP_STATE_BOTH, | 65 | - case R_PHYMNTNC: |
69 | - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 1, | 66 | - if (FIELD_EX32(retval, PHYMNTNC, OP) == MDIO_OP_READ) { |
70 | - .access = PL2_RW, .type = ARM_CP_CONST, | 67 | - uint32_t phy_addr, reg_num; |
71 | - .resetvalue = 0 }, | ||
72 | - { .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
73 | - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2, | ||
74 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
75 | - { .name = "VTCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
76 | - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2, | ||
77 | - .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
78 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
79 | - { .name = "VTTBR", .state = ARM_CP_STATE_AA32, | ||
80 | - .cp = 15, .opc1 = 6, .crm = 2, | ||
81 | - .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
82 | - .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
83 | - { .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64, | ||
84 | - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0, | ||
85 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
86 | - { .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH, | ||
87 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0, | ||
88 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
89 | - { .name = "TPIDR_EL2", .state = ARM_CP_STATE_BOTH, | ||
90 | - .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 2, | ||
91 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
92 | - { .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64, | ||
93 | - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0, | ||
94 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
95 | - { .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2, | ||
96 | - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, | ||
97 | - .resetvalue = 0 }, | ||
98 | - { .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH, | ||
99 | - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0, | ||
100 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
101 | - { .name = "CNTVOFF_EL2", .state = ARM_CP_STATE_AA64, | ||
102 | - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 0, .opc2 = 3, | ||
103 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
104 | - { .name = "CNTVOFF", .cp = 15, .opc1 = 4, .crm = 14, | ||
105 | - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, | ||
106 | - .resetvalue = 0 }, | ||
107 | - { .name = "CNTHP_CVAL_EL2", .state = ARM_CP_STATE_AA64, | ||
108 | - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 2, | ||
109 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
110 | - { .name = "CNTHP_CVAL", .cp = 15, .opc1 = 6, .crm = 14, | ||
111 | - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, | ||
112 | - .resetvalue = 0 }, | ||
113 | - { .name = "CNTHP_TVAL_EL2", .state = ARM_CP_STATE_BOTH, | ||
114 | - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 0, | ||
115 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
116 | - { .name = "CNTHP_CTL_EL2", .state = ARM_CP_STATE_BOTH, | ||
117 | - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 1, | ||
118 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
119 | - { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
120 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, | ||
121 | - .access = PL2_RW, .accessfn = access_tda, | ||
122 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
123 | - { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, | ||
124 | - .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, | ||
125 | - .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
126 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
127 | - { .name = "HSTR_EL2", .state = ARM_CP_STATE_BOTH, | ||
128 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3, | ||
129 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
130 | - { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH, | ||
131 | - .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0, | ||
132 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
133 | - { .name = "HIFAR", .state = ARM_CP_STATE_AA32, | ||
134 | - .type = ARM_CP_CONST, | ||
135 | - .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2, | ||
136 | - .access = PL2_RW, .resetvalue = 0 }, | ||
137 | -}; | ||
138 | - | 68 | - |
139 | -/* Ditto, but for registers which exist in ARMv8 but not v7 */ | 69 | - phy_addr = FIELD_EX32(retval, PHYMNTNC, PHY_ADDR); |
140 | -static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { | 70 | - if (phy_addr == s->phy_addr) { |
141 | - { .name = "HCR2", .state = ARM_CP_STATE_AA32, | 71 | - reg_num = FIELD_EX32(retval, PHYMNTNC, REG_ADDR); |
142 | - .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, | 72 | - retval &= 0xFFFF0000; |
143 | - .access = PL2_RW, | 73 | - retval |= gem_phy_read(s, reg_num); |
144 | - .type = ARM_CP_CONST, .resetvalue = 0 }, | 74 | - } else { |
145 | -}; | 75 | - retval |= 0xFFFF; /* No device at this address */ |
146 | - | ||
147 | static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) | ||
148 | { | ||
149 | ARMCPU *cpu = env_archcpu(env); | ||
150 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
151 | define_arm_cp_regs(cpu, v8_idregs); | ||
152 | define_arm_cp_regs(cpu, v8_cp_reginfo); | ||
153 | } | ||
154 | - if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
155 | + | ||
156 | + /* | ||
157 | + * Register the base EL2 cpregs. | ||
158 | + * Pre v8, these registers are implemented only as part of the | ||
159 | + * Virtualization Extensions (EL2 present). Beginning with v8, | ||
160 | + * if EL2 is missing but EL3 is enabled, mostly these become | ||
161 | + * RES0 from EL3, with some specific exceptions. | ||
162 | + */ | ||
163 | + if (arm_feature(env, ARM_FEATURE_EL2) | ||
164 | + || (arm_feature(env, ARM_FEATURE_EL3) | ||
165 | + && arm_feature(env, ARM_FEATURE_V8))) { | ||
166 | uint64_t vmpidr_def = mpidr_read_val(env); | ||
167 | ARMCPRegInfo vpidr_regs[] = { | ||
168 | { .name = "VPIDR", .state = ARM_CP_STATE_AA32, | ||
169 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
170 | }; | ||
171 | define_one_arm_cp_reg(cpu, &rvbar); | ||
172 | } | ||
173 | - } else { | ||
174 | - /* If EL2 is missing but higher ELs are enabled, we need to | ||
175 | - * register the no_el2 reginfos. | ||
176 | - */ | ||
177 | - if (arm_feature(env, ARM_FEATURE_EL3)) { | ||
178 | - /* When EL3 exists but not EL2, VPIDR and VMPIDR take the value | ||
179 | - * of MIDR_EL1 and MPIDR_EL1. | ||
180 | - */ | ||
181 | - ARMCPRegInfo vpidr_regs[] = { | ||
182 | - { .name = "VPIDR_EL2", .state = ARM_CP_STATE_BOTH, | ||
183 | - .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, | ||
184 | - .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
185 | - .type = ARM_CP_CONST, .resetvalue = cpu->midr, | ||
186 | - .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) }, | ||
187 | - { .name = "VMPIDR_EL2", .state = ARM_CP_STATE_BOTH, | ||
188 | - .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, | ||
189 | - .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
190 | - .type = ARM_CP_NO_RAW, | ||
191 | - .writefn = arm_cp_write_ignore, .readfn = mpidr_read }, | ||
192 | - }; | ||
193 | - define_arm_cp_regs(cpu, vpidr_regs); | ||
194 | - define_arm_cp_regs(cpu, el3_no_el2_cp_reginfo); | ||
195 | - if (arm_feature(env, ARM_FEATURE_V8)) { | ||
196 | - define_arm_cp_regs(cpu, el3_no_el2_v8_cp_reginfo); | ||
197 | - } | 76 | - } |
198 | - } | 77 | - } |
78 | - break; | ||
199 | } | 79 | } |
200 | + | 80 | |
201 | + /* Register the base EL3 cpregs. */ | 81 | /* Squash read to clear bits */ |
202 | if (arm_feature(env, ARM_FEATURE_EL3)) { | 82 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, |
203 | define_arm_cp_regs(cpu, el3_cp_reginfo); | 83 | s->sar_active[(offset - R_SPADDR1HI) / 2] = true; |
204 | ARMCPRegInfo el3_regs[] = { | 84 | break; |
85 | case R_PHYMNTNC: | ||
86 | - if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_WRITE) { | ||
87 | - uint32_t phy_addr, reg_num; | ||
88 | - | ||
89 | - phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); | ||
90 | - if (phy_addr == s->phy_addr) { | ||
91 | - reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); | ||
92 | - gem_phy_write(s, reg_num, val); | ||
93 | - } | ||
94 | - } | ||
95 | + gem_handle_phy_access(s); | ||
96 | break; | ||
97 | } | ||
98 | |||
205 | -- | 99 | -- |
206 | 2.25.1 | 100 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Leif Lindholm <quic_llindhol@quicinc.com> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | NUVIA was acquired by Qualcomm in March 2021, but kept functioning on | 3 | The CRC was stored in an unsigned variable in gem_receive. Change it for |
4 | separate infrastructure for a transitional period. We've now switched | 4 | a uint32_t to ensure we have the correct variable size here. |
5 | over to contributing as Qualcomm Innovation Center (quicinc), so update | ||
6 | my email address to reflect this. | ||
7 | 5 | ||
8 | Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
9 | Message-id: 20220505113740.75565-1-quic_llindhol@quicinc.com | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Cc: Leif Lindholm <leif@nuviainc.com> | 8 | Reviewed-by: sai.pavan.boddu@amd.com |
11 | Cc: Peter Maydell <peter.maydell@linaro.org> | 9 | Message-id: 20231017194422.4124691-12-luc.michel@amd.com |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | [Fixed commit message typo] | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 11 | --- |
16 | .mailmap | 3 ++- | 12 | hw/net/cadence_gem.c | 2 +- |
17 | MAINTAINERS | 2 +- | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
19 | 14 | ||
20 | diff --git a/.mailmap b/.mailmap | 15 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/.mailmap | 17 | --- a/hw/net/cadence_gem.c |
23 | +++ b/.mailmap | 18 | +++ b/hw/net/cadence_gem.c |
24 | @@ -XXX,XX +XXX,XX @@ Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com> | 19 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
25 | Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com> | 20 | if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, FCS_REMOVE)) { |
26 | Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn> | 21 | rxbuf_ptr = (void *)buf; |
27 | James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com> | 22 | } else { |
28 | -Leif Lindholm <leif@nuviainc.com> <leif.lindholm@linaro.org> | 23 | - unsigned crc_val; |
29 | +Leif Lindholm <quic_llindhol@quicinc.com> <leif.lindholm@linaro.org> | 24 | + uint32_t crc_val; |
30 | +Leif Lindholm <quic_llindhol@quicinc.com> <leif@nuviainc.com> | 25 | |
31 | Radoslaw Biernacki <rad@semihalf.com> <radoslaw.biernacki@linaro.org> | 26 | if (size > MAX_FRAME_SIZE - sizeof(crc_val)) { |
32 | Paul Burton <paulburton@kernel.org> <paul.burton@mips.com> | 27 | size = MAX_FRAME_SIZE - sizeof(crc_val); |
33 | Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com> | ||
34 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/MAINTAINERS | ||
37 | +++ b/MAINTAINERS | ||
38 | @@ -XXX,XX +XXX,XX @@ F: include/hw/ssi/imx_spi.h | ||
39 | SBSA-REF | ||
40 | M: Radoslaw Biernacki <rad@semihalf.com> | ||
41 | M: Peter Maydell <peter.maydell@linaro.org> | ||
42 | -R: Leif Lindholm <leif@nuviainc.com> | ||
43 | +R: Leif Lindholm <quic_llindhol@quicinc.com> | ||
44 | L: qemu-arm@nongnu.org | ||
45 | S: Maintained | ||
46 | F: hw/arm/sbsa-ref.c | ||
47 | -- | 28 | -- |
48 | 2.25.1 | 29 | 2.34.1 |
49 | 30 | ||
50 | 31 | diff view generated by jsdifflib |