1 | More accumulated patches from during the freeze... | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9: | 3 | thanks |
4 | -- PMM | ||
4 | 5 | ||
5 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-08-26' into staging (2021-08-26 13:42:34 +0100) | 6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: |
7 | |||
8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) | ||
6 | 9 | ||
7 | are available in the Git repository at: | 10 | are available in the Git repository at: |
8 | 11 | ||
9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210826 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
10 | 13 | ||
11 | for you to fetch changes up to d2e6f370138a7f32bc28b20dcd55374b7a638f39: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
12 | 15 | ||
13 | hw/arm/xlnx-zynqmp: Add unimplemented APU mmio (2021-08-26 17:02:01 +0100) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
16 | target-arm queue: | 19 | target-arm queue: |
17 | * hw/dma/xlnx-zdma, xlnx_csu_dma: Require 'dma' link property to be set | 20 | * ITS: error reporting cleanup |
18 | * hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly | 21 | * aspeed: improve documentation |
19 | * target/arm/cpu: Introduce sve_vq_supported bitmap | 22 | * Fix STM32F2XX USART data register readout |
20 | * docs/specs: Convert ACPI spec docs to rST | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
21 | * arch_init: Clean up and refactoring | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
22 | * hw/core/loader: In gunzip(), check index is in range before use, not after | 25 | * Correct calculation of tlb range invalidate length |
23 | * softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd() | 26 | * npcm7xx_emc: fix missing queue_flush |
24 | * softmmu/physmem.c: Check return value from realpath() | 27 | * virt: Add VIOT ACPI table for virtio-iommu |
25 | * Zero-initialize sockaddr_in structs | 28 | * target/i386: Use assert() to sanity-check b1 in SSE decode |
26 | * raspi: Use error_fatal for SoC realize errors, not error_abort | 29 | * Don't include qemu-common unnecessarily |
27 | * target/arm: Avoid assertion trying to use KVM and multiple ASes | ||
28 | * target/arm: Implement HSTR.TTEE | ||
29 | * target/arm: Implement HSTR.TJDBX | ||
30 | * target/arm: Do hflags rebuild in cpsr_write() | ||
31 | * hw/arm/xlnx-versal, xlnx-zynqmp: Add unimplemented APU mmio | ||
32 | 30 | ||
33 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
34 | Andrew Jones (4): | 32 | Alex Bennée (1): |
35 | target/arm/cpu: Introduce sve_vq_supported bitmap | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
36 | target/arm/kvm64: Ensure sve vls map is completely clear | ||
37 | target/arm/cpu64: Replace kvm_supported with sve_vq_supported | ||
38 | target/arm/cpu64: Validate sve vector lengths are supported | ||
39 | 34 | ||
40 | Ani Sinha (1): | 35 | Jean-Philippe Brucker (8): |
41 | hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly | 36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu |
37 | hw/arm/virt: Remove device tree restriction for virtio-iommu | ||
38 | hw/arm/virt: Reject instantiation of multiple IOMMUs | ||
39 | hw/arm/virt: Use object_property_set instead of qdev_prop_set | ||
40 | tests/acpi: allow updates of VIOT expected data files | ||
41 | tests/acpi: add test case for VIOT | ||
42 | tests/acpi: add expected blobs for VIOT test on q35 machine | ||
43 | tests/acpi: add expected blob for VIOT test on virt machine | ||
42 | 44 | ||
43 | Peter Maydell (26): | 45 | Joel Stanley (4): |
44 | docs/specs/acpu_cpu_hotplug: Convert to rST | 46 | docs: aspeed: Add new boards |
45 | docs/specs/acpi_mem_hotplug: Convert to rST | 47 | docs: aspeed: Update OpenBMC image URL |
46 | docs/specs/acpi_pci_hotplug: Convert to rST | 48 | docs: aspeed: Give an example of booting a kernel |
47 | docs/specs/acpi_nvdimm: Convert to rST | 49 | docs: aspeed: ADC is now modelled |
48 | MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections | ||
49 | softmmu: Use accel_find("xen") instead of xen_available() | ||
50 | monitor: Use accel_find("kvm") instead of kvm_available() | ||
51 | softmmu/arch_init.c: Trim down include list | ||
52 | meson.build: Define QEMU_ARCH in config-target.h | ||
53 | arch_init.h: Add QEMU_ARCH_HEXAGON | ||
54 | arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c | ||
55 | arch_init.h: Don't include arch_init.h unnecessarily | ||
56 | stubs: Remove unused arch_type.c stub | ||
57 | hw/core/loader: In gunzip(), check index is in range before use, not after | ||
58 | softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd() | ||
59 | softmmu/physmem.c: Check return value from realpath() | ||
60 | net: Zero sockaddr_in in parse_host_port() | ||
61 | gdbstub: Zero-initialize sockaddr structs | ||
62 | tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct | ||
63 | tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs | ||
64 | raspi: Use error_fatal for SoC realize errors, not error_abort | ||
65 | target/arm: Avoid assertion trying to use KVM and multiple ASes | ||
66 | hw/arm/virt: Delete EL3 error checksnow provided in CPU realize | ||
67 | target/arm: Implement HSTR.TTEE | ||
68 | target/arm: Implement HSTR.TJDBX | ||
69 | target/arm: Do hflags rebuild in cpsr_write() | ||
70 | 50 | ||
71 | Philippe Mathieu-Daudé (4): | 51 | Olivier Hériveaux (1): |
72 | hw/arm/xlnx-zynqmp: Realize qspi controller *after* qspi_dma | 52 | Fix STM32F2XX USART data register readout |
73 | hw/dma/xlnx_csu_dma: Run trivial checks early in realize() | ||
74 | hw/dma/xlnx_csu_dma: Always expect 'dma' link property to be set | ||
75 | hw/dma/xlnx-zdma Always expect 'dma' link property to be set | ||
76 | 53 | ||
77 | Tong Ho (2): | 54 | Patrick Venture (1): |
78 | hw/arm/xlnx-versal: Add unimplemented APU mmio | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
79 | hw/arm/xlnx-zynqmp: Add unimplemented APU mmio | ||
80 | 56 | ||
81 | docs/specs/acpi_cpu_hotplug.rst | 235 +++++++++++++++++++++ | 57 | Peter Maydell (6): |
82 | docs/specs/acpi_cpu_hotplug.txt | 160 -------------- | 58 | target/i386: Use assert() to sanity-check b1 in SSE decode |
83 | docs/specs/acpi_mem_hotplug.rst | 128 +++++++++++ | 59 | include/hw/i386: Don't include qemu-common.h in .h files |
84 | docs/specs/acpi_mem_hotplug.txt | 94 --------- | 60 | target/hexagon/cpu.h: don't include qemu-common.h |
85 | docs/specs/acpi_nvdimm.rst | 228 ++++++++++++++++++++ | 61 | target/rx/cpu.h: Don't include qemu-common.h |
86 | docs/specs/acpi_nvdimm.txt | 188 ----------------- | 62 | hw/arm: Don't include qemu-common.h unnecessarily |
87 | .../{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++-- | 63 | target/arm: Correct calculation of tlb range invalidate length |
88 | docs/specs/index.rst | 4 + | ||
89 | meson.build | 2 + | ||
90 | include/hw/arm/xlnx-versal.h | 2 + | ||
91 | include/hw/arm/xlnx-zynqmp.h | 7 + | ||
92 | include/hw/dma/xlnx-zdma.h | 2 +- | ||
93 | include/hw/dma/xlnx_csu_dma.h | 2 +- | ||
94 | include/sysemu/arch_init.h | 15 +- | ||
95 | target/arm/cpu.h | 17 +- | ||
96 | target/arm/helper.h | 2 + | ||
97 | target/arm/syndrome.h | 7 + | ||
98 | blockdev.c | 1 - | ||
99 | gdbstub.c | 4 +- | ||
100 | hw/arm/raspi.c | 2 +- | ||
101 | hw/arm/virt.c | 5 - | ||
102 | hw/arm/xlnx-versal.c | 4 + | ||
103 | hw/arm/xlnx-zynqmp.c | 86 ++++++-- | ||
104 | hw/core/loader.c | 35 ++- | ||
105 | hw/dma/xlnx-zdma.c | 24 +-- | ||
106 | hw/dma/xlnx_csu_dma.c | 31 ++- | ||
107 | hw/i386/pc.c | 1 - | ||
108 | hw/i386/pc_piix.c | 1 - | ||
109 | hw/i386/pc_q35.c | 1 - | ||
110 | hw/mips/jazz.c | 1 - | ||
111 | hw/mips/malta.c | 1 - | ||
112 | hw/ppc/prep.c | 1 - | ||
113 | hw/riscv/sifive_e.c | 1 - | ||
114 | hw/riscv/sifive_u.c | 1 - | ||
115 | hw/riscv/spike.c | 1 - | ||
116 | hw/riscv/virt.c | 1 - | ||
117 | linux-user/arm/signal.c | 2 - | ||
118 | monitor/qmp-cmds.c | 3 +- | ||
119 | net/net.c | 2 + | ||
120 | softmmu/arch_init.c | 66 ------ | ||
121 | softmmu/physmem.c | 5 +- | ||
122 | softmmu/qdev-monitor.c | 9 + | ||
123 | softmmu/vl.c | 6 +- | ||
124 | stubs/arch_type.c | 4 - | ||
125 | target/arm/cpu.c | 23 ++ | ||
126 | target/arm/cpu64.c | 118 +++++------ | ||
127 | target/arm/helper.c | 40 +++- | ||
128 | target/arm/kvm64.c | 2 +- | ||
129 | target/arm/op_helper.c | 16 ++ | ||
130 | target/arm/translate.c | 12 ++ | ||
131 | target/ppc/cpu_init.c | 1 - | ||
132 | target/s390x/cpu-sysemu.c | 1 - | ||
133 | tests/qtest/ipmi-bt-test.c | 2 +- | ||
134 | tests/tcg/multiarch/linux-test.c | 4 +- | ||
135 | MAINTAINERS | 5 + | ||
136 | hw/arm/Kconfig | 2 - | ||
137 | stubs/meson.build | 1 - | ||
138 | 57 files changed, 949 insertions(+), 707 deletions(-) | ||
139 | create mode 100644 docs/specs/acpi_cpu_hotplug.rst | ||
140 | delete mode 100644 docs/specs/acpi_cpu_hotplug.txt | ||
141 | create mode 100644 docs/specs/acpi_mem_hotplug.rst | ||
142 | delete mode 100644 docs/specs/acpi_mem_hotplug.txt | ||
143 | create mode 100644 docs/specs/acpi_nvdimm.rst | ||
144 | delete mode 100644 docs/specs/acpi_nvdimm.txt | ||
145 | rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%) | ||
146 | delete mode 100644 stubs/arch_type.c | ||
147 | 64 | ||
65 | Philippe Mathieu-Daudé (2): | ||
66 | hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c | ||
67 | hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector | ||
68 | |||
69 | Richard Henderson (10): | ||
70 | target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn | ||
71 | target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn | ||
72 | target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn | ||
73 | target/arm: Split arm_pre_translate_insn | ||
74 | target/arm: Advance pc for arch single-step exception | ||
75 | target/arm: Split compute_fsr_fsc out of arm_deliver_fault | ||
76 | target/arm: Take an exception if PC is misaligned | ||
77 | target/arm: Assert thumb pc is aligned | ||
78 | target/arm: Suppress bp for exceptions with more priority | ||
79 | tests/tcg: Add arm and aarch64 pc alignment tests | ||
80 | |||
81 | docs/system/arm/aspeed.rst | 26 ++++++++++++---- | ||
82 | include/hw/i386/microvm.h | 1 - | ||
83 | include/hw/i386/x86.h | 1 - | ||
84 | target/arm/helper.h | 1 + | ||
85 | target/arm/syndrome.h | 5 +++ | ||
86 | target/hexagon/cpu.h | 1 - | ||
87 | target/rx/cpu.h | 1 - | ||
88 | hw/arm/boot.c | 1 - | ||
89 | hw/arm/digic_boards.c | 1 - | ||
90 | hw/arm/highbank.c | 1 - | ||
91 | hw/arm/npcm7xx_boards.c | 1 - | ||
92 | hw/arm/sbsa-ref.c | 1 - | ||
93 | hw/arm/stm32f405_soc.c | 1 - | ||
94 | hw/arm/vexpress.c | 1 - | ||
95 | hw/arm/virt-acpi-build.c | 7 +++++ | ||
96 | hw/arm/virt.c | 21 ++++++------- | ||
97 | hw/char/stm32f2xx_usart.c | 3 +- | ||
98 | hw/intc/arm_gicv3.c | 2 +- | ||
99 | hw/intc/arm_gicv3_cpuif.c | 10 +----- | ||
100 | hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++ | ||
101 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++-------- | ||
102 | hw/net/npcm7xx_emc.c | 18 +++++------ | ||
103 | hw/virtio/virtio-iommu-pci.c | 12 ++------ | ||
104 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------ | ||
105 | linux-user/hexagon/cpu_loop.c | 1 + | ||
106 | target/arm/debug_helper.c | 23 ++++++++++++++ | ||
107 | target/arm/gdbstub.c | 9 ++++-- | ||
108 | target/arm/helper.c | 6 ++-- | ||
109 | target/arm/machine.c | 10 ++++++ | ||
110 | target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++---------- | ||
111 | target/arm/translate-a64.c | 23 ++++++++++++-- | ||
112 | target/arm/translate.c | 58 ++++++++++++++++++++++++++--------- | ||
113 | target/i386/tcg/translate.c | 12 ++------ | ||
114 | tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++ | ||
115 | tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++ | ||
116 | tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++ | ||
117 | hw/arm/Kconfig | 1 + | ||
118 | hw/intc/Kconfig | 5 +++ | ||
119 | hw/intc/meson.build | 11 ++++--- | ||
120 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
121 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
122 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | ||
123 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
124 | tests/tcg/arm/Makefile.target | 4 +++ | ||
125 | 44 files changed, 429 insertions(+), 145 deletions(-) | ||
126 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
127 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
128 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
129 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
130 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
131 | create mode 100644 tests/data/acpi/virt/VIOT | ||
132 | diff view generated by jsdifflib |
1 | Zero-initialize sockaddr_in and sockaddr_un structs that we're about | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | to fill in and pass to bind() or connect(), to ensure we don't leave | ||
3 | possible implementation-defined extension fields as uninitialized | ||
4 | garbage. | ||
5 | 2 | ||
3 | While trying to debug a GIC ITS failure I saw some guest errors that | ||
4 | had poor formatting as well as leaving me confused as to what failed. | ||
5 | As most of the checks aren't possible without a valid dte split that | ||
6 | check apart and then check the other conditions in steps. This avoids | ||
7 | us relying on undefined data. | ||
8 | |||
9 | I still get a failure with the current kvm-unit-tests but at least I | ||
10 | know (partially) why now: | ||
11 | |||
12 | Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 | ||
13 | PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI | ||
14 | ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 | ||
15 | INT dev_id=2 event_id=20 | ||
16 | process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0) | ||
17 | PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap | ||
18 | SUMMARY: 6 tests, 1 unexpected failures | ||
19 | |||
20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | ||
23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | Message-id: 20210813150506.7768-5-peter.maydell@linaro.org | ||
9 | --- | 26 | --- |
10 | tests/tcg/multiarch/linux-test.c | 4 ++-- | 27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ |
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | 28 | 1 file changed, 27 insertions(+), 12 deletions(-) |
12 | 29 | ||
13 | diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c | 30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c |
14 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tests/tcg/multiarch/linux-test.c | 32 | --- a/hw/intc/arm_gicv3_its.c |
16 | +++ b/tests/tcg/multiarch/linux-test.c | 33 | +++ b/hw/intc/arm_gicv3_its.c |
17 | @@ -XXX,XX +XXX,XX @@ static void test_time(void) | 34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, |
18 | static int server_socket(void) | 35 | if (res != MEMTX_OK) { |
19 | { | 36 | return result; |
20 | int val, fd; | 37 | } |
21 | - struct sockaddr_in sockaddr; | 38 | + } else { |
22 | + struct sockaddr_in sockaddr = {}; | 39 | + qemu_log_mask(LOG_GUEST_ERROR, |
23 | 40 | + "%s: invalid command attributes: " | |
24 | /* server socket */ | 41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", |
25 | fd = chk_error(socket(PF_INET, SOCK_STREAM, 0)); | 42 | + __func__, dte, devid, res); |
26 | @@ -XXX,XX +XXX,XX @@ static int server_socket(void) | 43 | + return result; |
27 | static int client_socket(uint16_t port) | 44 | } |
28 | { | 45 | |
29 | int fd; | 46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || |
30 | - struct sockaddr_in sockaddr; | 47 | - !cte_valid || (eventid > max_eventid)) { |
31 | + struct sockaddr_in sockaddr = {}; | 48 | + |
32 | 49 | + /* | |
33 | /* server socket */ | 50 | + * In this implementation, in case of guest errors we ignore the |
34 | fd = chk_error(socket(PF_INET, SOCK_STREAM, 0)); | 51 | + * command and move onto the next command in the queue. |
52 | + */ | ||
53 | + if (devid > s->dt.maxids.max_devids) { | ||
54 | qemu_log_mask(LOG_GUEST_ERROR, | ||
55 | - "%s: invalid command attributes " | ||
56 | - "devid %d or eventid %d or invalid dte %d or" | ||
57 | - "invalid cte %d or invalid ite %d\n", | ||
58 | - __func__, devid, eventid, dte_valid, cte_valid, | ||
59 | - ite_valid); | ||
60 | - /* | ||
61 | - * in this implementation, in case of error | ||
62 | - * we ignore this command and move onto the next | ||
63 | - * command in the queue | ||
64 | - */ | ||
65 | + "%s: invalid command attributes: devid %d>%d", | ||
66 | + __func__, devid, s->dt.maxids.max_devids); | ||
67 | + | ||
68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { | ||
69 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
70 | + "%s: invalid command attributes: " | ||
71 | + "dte: %s, ite: %s, cte: %s\n", | ||
72 | + __func__, | ||
73 | + dte_valid ? "valid" : "invalid", | ||
74 | + ite_valid ? "valid" : "invalid", | ||
75 | + cte_valid ? "valid" : "invalid"); | ||
76 | + } else if (eventid > max_eventid) { | ||
77 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
78 | + "%s: invalid command attributes: eventid %d > %d\n", | ||
79 | + __func__, eventid, max_eventid); | ||
80 | } else { | ||
81 | /* | ||
82 | * Current implementation only supports rdbase == procnum | ||
35 | -- | 83 | -- |
36 | 2.20.1 | 84 | 2.25.1 |
37 | 85 | ||
38 | 86 | diff view generated by jsdifflib |
1 | Zero-initialize the sockaddr_in struct that we're about to fill in | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | and pass to bind(), to ensure we don't leave possible | ||
3 | implementation-defined extension fields as uninitialized garbage. | ||
4 | 2 | ||
3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be | ||
4 | removed in v7.0. | ||
5 | |||
6 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Message-id: 20211117065752.330632-2-joel@jms.id.au | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | Reviewed-by: Corey Minyard <cminyard@mvista.com> | ||
8 | Acked-by: Thomas Huth <thuth@redhat.com> | ||
9 | Message-id: 20210813150506.7768-4-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | tests/qtest/ipmi-bt-test.c | 2 +- | 11 | docs/system/arm/aspeed.rst | 7 ++++++- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 6 insertions(+), 1 deletion(-) |
13 | 13 | ||
14 | diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/tests/qtest/ipmi-bt-test.c | 16 | --- a/docs/system/arm/aspeed.rst |
17 | +++ b/tests/qtest/ipmi-bt-test.c | 17 | +++ b/docs/system/arm/aspeed.rst |
18 | @@ -XXX,XX +XXX,XX @@ static void test_enable_irq(void) | 18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : |
19 | */ | 19 | |
20 | static void open_socket(void) | 20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC |
21 | { | 21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC |
22 | - struct sockaddr_in myaddr; | 22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC |
23 | + struct sockaddr_in myaddr = {}; | 23 | |
24 | socklen_t addrlen; | 24 | AST2500 SoC based machines : |
25 | 25 | ||
26 | myaddr.sin_family = AF_INET; | 26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : |
27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC | ||
28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC | ||
29 | - ``sonorapass-bmc`` OCP SonoraPass BMC | ||
30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 | ||
31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) | ||
32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC | ||
33 | +- ``g220a-bmc`` Bytedance G220A BMC | ||
34 | |||
35 | AST2600 SoC based machines : | ||
36 | |||
37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | ||
38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC | ||
39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC | ||
40 | +- ``fuji-bmc`` Facebook Fuji BMC | ||
41 | |||
42 | Supported devices | ||
43 | ----------------- | ||
27 | -- | 44 | -- |
28 | 2.20.1 | 45 | 2.25.1 |
29 | 46 | ||
30 | 47 | diff view generated by jsdifflib |
1 | Zero-initialize sockaddr_in and sockaddr_un structs that we're about | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | to fill in and pass to bind() or connect(), to ensure we don't leave | ||
3 | possible implementation-defined extension fields as uninitialized | ||
4 | garbage. | ||
5 | 2 | ||
3 | This is the latest URL for the OpenBMC CI. The old URL still works, but | ||
4 | redirects. | ||
5 | |||
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20211117065752.330632-3-joel@jms.id.au | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | Message-id: 20210813150506.7768-3-peter.maydell@linaro.org | ||
9 | --- | 10 | --- |
10 | gdbstub.c | 4 ++-- | 11 | docs/system/arm/aspeed.rst | 2 +- |
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 13 | ||
13 | diff --git a/gdbstub.c b/gdbstub.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/gdbstub.c | 16 | --- a/docs/system/arm/aspeed.rst |
16 | +++ b/gdbstub.c | 17 | +++ b/docs/system/arm/aspeed.rst |
17 | @@ -XXX,XX +XXX,XX @@ static bool gdb_accept_socket(int gdb_fd) | 18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to |
18 | 19 | load a Linux kernel or from a firmware. Images can be downloaded from | |
19 | static int gdbserver_open_socket(const char *path) | 20 | the OpenBMC jenkins : |
20 | { | 21 | |
21 | - struct sockaddr_un sockaddr; | 22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder |
22 | + struct sockaddr_un sockaddr = {}; | 23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
23 | int fd, ret; | 24 | |
24 | 25 | or directly from the OpenBMC GitHub release repository : | |
25 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
26 | @@ -XXX,XX +XXX,XX @@ static int gdbserver_open_socket(const char *path) | ||
27 | |||
28 | static bool gdb_accept_tcp(int gdb_fd) | ||
29 | { | ||
30 | - struct sockaddr_in sockaddr; | ||
31 | + struct sockaddr_in sockaddr = {}; | ||
32 | socklen_t len; | ||
33 | int fd; | ||
34 | 26 | ||
35 | -- | 27 | -- |
36 | 2.20.1 | 28 | 2.25.1 |
37 | 29 | ||
38 | 30 | diff view generated by jsdifflib |
1 | From: Tong Ho <tong.ho@xilinx.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Add unimplemented APU mmio region to xlnx-versal for booting | 3 | A common use case for the ASPEED machine is to boot a Linux kernel. |
4 | bare-metal guests built with standalone bsp, which access the | 4 | Provide a full example command line. |
5 | region from one of the following places: | ||
6 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139 | ||
7 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183 | ||
8 | 5 | ||
9 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
11 | Signed-off-by: Tong Ho <tong.ho@xilinx.com> | 8 | Message-id: 20211117065752.330632-4-joel@jms.id.au |
12 | Message-id: 20210823173818.201259-2-tong.ho@xilinx.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 10 | --- |
15 | include/hw/arm/xlnx-versal.h | 2 ++ | 11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- |
16 | hw/arm/xlnx-versal.c | 2 ++ | 12 | 1 file changed, 12 insertions(+), 3 deletions(-) |
17 | 2 files changed, 4 insertions(+) | ||
18 | 13 | ||
19 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/arm/xlnx-versal.h | 16 | --- a/docs/system/arm/aspeed.rst |
22 | +++ b/include/hw/arm/xlnx-versal.h | 17 | +++ b/docs/system/arm/aspeed.rst |
23 | @@ -XXX,XX +XXX,XX @@ struct Versal { | 18 | @@ -XXX,XX +XXX,XX @@ Missing devices |
24 | #define MM_IOU_SCNTRS_SIZE 0x10000 | 19 | Boot options |
25 | #define MM_FPD_CRF 0xfd1a0000U | 20 | ------------ |
26 | #define MM_FPD_CRF_SIZE 0x140000 | 21 | |
27 | +#define MM_FPD_FPD_APU 0xfd5c0000 | 22 | -The Aspeed machines can be started using the ``-kernel`` option to |
28 | +#define MM_FPD_FPD_APU_SIZE 0x100 | 23 | -load a Linux kernel or from a firmware. Images can be downloaded from |
29 | 24 | -the OpenBMC jenkins : | |
30 | #define MM_PMC_SD0 0xf1040000U | 25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options |
31 | #define MM_PMC_SD0_SIZE 0x10000 | 26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the |
32 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 27 | +OpenBMC jenkins : |
33 | index XXXXXXX..XXXXXXX 100644 | 28 | |
34 | --- a/hw/arm/xlnx-versal.c | 29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
35 | +++ b/hw/arm/xlnx-versal.c | 30 | |
36 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | 31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : |
37 | MM_CRL, MM_CRL_SIZE); | 32 | |
38 | versal_unimp_area(s, "crf", &s->mr_ps, | 33 | https://github.com/openbmc/openbmc/releases |
39 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | 34 | |
40 | + versal_unimp_area(s, "apu", &s->mr_ps, | 35 | +To boot a kernel directly from a Linux build tree: |
41 | + MM_FPD_FPD_APU, MM_FPD_FPD_APU_SIZE); | 36 | + |
42 | versal_unimp_area(s, "crp", &s->mr_ps, | 37 | +.. code-block:: bash |
43 | MM_PMC_CRP, MM_PMC_CRP_SIZE); | 38 | + |
44 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | 39 | + $ qemu-system-arm -M ast2600-evb -nographic \ |
40 | + -kernel arch/arm/boot/zImage \ | ||
41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ | ||
42 | + -initrd rootfs.cpio | ||
43 | + | ||
44 | The image should be attached as an MTD drive. Run : | ||
45 | |||
46 | .. code-block:: bash | ||
45 | -- | 47 | -- |
46 | 2.20.1 | 48 | 2.25.1 |
47 | 49 | ||
48 | 50 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | bitmap_clear() only clears the given range. While the given | 3 | Move it to the supported list. |
4 | range should be sufficient in this case we might as well be | ||
5 | 100% sure all bits are zeroed by using bitmap_zero(). | ||
6 | 4 | ||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 5 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 6 | Message-id: 20211117065752.330632-5-joel@jms.id.au |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210823160647.34028-3-drjones@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 8 | --- |
13 | target/arm/kvm64.c | 2 +- | 9 | docs/system/arm/aspeed.rst | 2 +- |
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 11 | ||
16 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/kvm64.c | 14 | --- a/docs/system/arm/aspeed.rst |
19 | +++ b/target/arm/kvm64.c | 15 | +++ b/docs/system/arm/aspeed.rst |
20 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) | 16 | @@ -XXX,XX +XXX,XX @@ Supported devices |
21 | uint32_t vq = 0; | 17 | * Front LEDs (PCA9552 on I2C bus) |
22 | int i, j; | 18 | * LPC Peripheral Controller (a subset of subdevices are supported) |
23 | 19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | |
24 | - bitmap_clear(map, 0, ARM_MAX_VQ); | 20 | + * ADC |
25 | + bitmap_zero(map, ARM_MAX_VQ); | 21 | |
26 | 22 | ||
27 | /* | 23 | Missing devices |
28 | * KVM ensures all host CPUs support the same set of vector lengths. | 24 | --------------- |
25 | |||
26 | * Coprocessor support | ||
27 | - * ADC (out of tree implementation) | ||
28 | * PWM and Fan Controller | ||
29 | * Slave GPIO Controller | ||
30 | * Super I/O Controller | ||
29 | -- | 31 | -- |
30 | 2.20.1 | 32 | 2.25.1 |
31 | 33 | ||
32 | 34 | diff view generated by jsdifflib |
1 | We don't currently zero-initialize the 'struct sockaddr_in' that | 1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> |
---|---|---|---|
2 | parse_host_port() fills in, so any fields we don't explicitly | ||
3 | initialize might be left as random garbage. POSIX states that | ||
4 | implementations may define extensions in sockaddr_in, and that those | ||
5 | extensions must not trigger if zero-initialized. So not zero | ||
6 | initializing might result in inadvertently triggering an impdef | ||
7 | extension. | ||
8 | 2 | ||
9 | memset() the sockaddr_in before we start to fill it in. | 3 | Fix issue where the data register may be overwritten by next character |
4 | reception before being read and returned. | ||
10 | 5 | ||
11 | Fixes: Coverity CID 1005338 | 6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
14 | Message-id: 20210813150506.7768-2-peter.maydell@linaro.org | ||
15 | --- | 11 | --- |
16 | net/net.c | 2 ++ | 12 | hw/char/stm32f2xx_usart.c | 3 ++- |
17 | 1 file changed, 2 insertions(+) | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
18 | 14 | ||
19 | diff --git a/net/net.c b/net/net.c | 15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c |
20 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/net/net.c | 17 | --- a/hw/char/stm32f2xx_usart.c |
22 | +++ b/net/net.c | 18 | +++ b/hw/char/stm32f2xx_usart.c |
23 | @@ -XXX,XX +XXX,XX @@ int parse_host_port(struct sockaddr_in *saddr, const char *str, | 19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, |
24 | const char *addr, *p, *r; | 20 | return retvalue; |
25 | int port, ret = 0; | 21 | case USART_DR: |
26 | 22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | |
27 | + memset(saddr, 0, sizeof(*saddr)); | 23 | + retvalue = s->usart_dr & 0x3FF; |
28 | + | 24 | s->usart_sr &= ~USART_SR_RXNE; |
29 | substrings = g_strsplit(str, ":", 2); | 25 | qemu_chr_fe_accept_input(&s->chr); |
30 | if (!substrings || !substrings[0] || !substrings[1]) { | 26 | qemu_set_irq(s->irq, 0); |
31 | error_setg(errp, "host address '%s' doesn't contain ':' " | 27 | - return s->usart_dr & 0x3FF; |
28 | + return retvalue; | ||
29 | case USART_BRR: | ||
30 | return s->usart_brr; | ||
31 | case USART_CR1: | ||
32 | -- | 32 | -- |
33 | 2.20.1 | 33 | 2.25.1 |
34 | 34 | ||
35 | 35 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | If some property are not set, we'll return indicating a failure, | 3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in |
4 | so it is pointless to allocate / initialize some fields too early. | 4 | arm_gicv3_common_realize(). Since we want to restrict |
5 | Move the trivial checks earlier in realize(). | 5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() |
6 | to a new file. Add this file to the meson 'specific' | ||
7 | source set, since it needs access to "cpu.h". | ||
6 | 8 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20210819163422.2863447-3-philmd@redhat.com | 11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | hw/dma/xlnx_csu_dma.c | 10 +++++----- | 14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- |
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | 15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ |
16 | hw/intc/meson.build | 1 + | ||
17 | 3 files changed, 24 insertions(+), 9 deletions(-) | ||
18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
14 | 19 | ||
15 | diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c | 20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/dma/xlnx_csu_dma.c | 22 | --- a/hw/intc/arm_gicv3_cpuif.c |
18 | +++ b/hw/dma/xlnx_csu_dma.c | 23 | +++ b/hw/intc/arm_gicv3_cpuif.c |
19 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | 24 | @@ -XXX,XX +XXX,XX @@ |
20 | XlnxCSUDMA *s = XLNX_CSU_DMA(dev); | 25 | /* |
21 | RegisterInfoArray *reg_array; | 26 | - * ARM Generic Interrupt Controller v3 |
22 | 27 | + * ARM Generic Interrupt Controller v3 (emulation) | |
23 | + if (!s->is_dst && !s->tx_dev) { | 28 | * |
24 | + error_setg(errp, "zynqmp.csu-dma: Stream not connected"); | 29 | * Copyright (c) 2016 Linaro Limited |
25 | + return; | 30 | * Written by Peter Maydell |
26 | + } | 31 | @@ -XXX,XX +XXX,XX @@ |
32 | #include "hw/irq.h" | ||
33 | #include "cpu.h" | ||
34 | |||
35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | ||
36 | -{ | ||
37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
38 | - CPUARMState *env = &arm_cpu->env; | ||
39 | - | ||
40 | - env->gicv3state = (void *)s; | ||
41 | -}; | ||
42 | - | ||
43 | static GICv3CPUState *icc_cs_from_env(CPUARMState *env) | ||
44 | { | ||
45 | return env->gicv3state; | ||
46 | diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c | ||
47 | new file mode 100644 | ||
48 | index XXXXXXX..XXXXXXX | ||
49 | --- /dev/null | ||
50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c | ||
51 | @@ -XXX,XX +XXX,XX @@ | ||
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
53 | +/* | ||
54 | + * ARM Generic Interrupt Controller v3 | ||
55 | + * | ||
56 | + * Copyright (c) 2016 Linaro Limited | ||
57 | + * Written by Peter Maydell | ||
58 | + * | ||
59 | + * This code is licensed under the GPL, version 2 or (at your option) | ||
60 | + * any later version. | ||
61 | + */ | ||
27 | + | 62 | + |
28 | reg_array = | 63 | +#include "qemu/osdep.h" |
29 | register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], | 64 | +#include "gicv3_internal.h" |
30 | XLNX_CSU_DMA_R_MAX, | 65 | +#include "cpu.h" |
31 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | 66 | + |
32 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | 67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) |
33 | sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); | 68 | +{ |
34 | 69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | |
35 | - if (!s->is_dst && !s->tx_dev) { | 70 | + CPUARMState *env = &arm_cpu->env; |
36 | - error_setg(errp, "zynqmp.csu-dma: Stream not connected"); | 71 | + |
37 | - return; | 72 | + env->gicv3state = (void *)s; |
38 | - } | 73 | +}; |
39 | - | 74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build |
40 | s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit, | 75 | index XXXXXXX..XXXXXXX 100644 |
41 | s, PTIMER_POLICY_DEFAULT); | 76 | --- a/hw/intc/meson.build |
42 | 77 | +++ b/hw/intc/meson.build | |
78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
79 | |||
80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
43 | -- | 86 | -- |
44 | 2.20.1 | 87 | 2.25.1 |
45 | 88 | ||
46 | 89 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Simplify by always passing a MemoryRegion property to the device. | 3 | The TYPE_ARM_GICV3 device is an emulated one. When using |
4 | Doing so we can move the AddressSpace field to the device struct, | 4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device |
5 | removing need for heap allocation. | 5 | (which uses in-kernel support). |
6 | 6 | ||
7 | Update the Xilinx ZynqMP / Versal SoC models to pass the default | 7 | When using --with-devices-FOO, it is possible to build a |
8 | system memory instead of a NULL value. | 8 | binary with a specific set of devices. When this binary is |
9 | restricted to KVM accelerator, the TYPE_ARM_GICV3 device is | ||
10 | irrelevant, and it is desirable to remove it from the binary. | ||
9 | 11 | ||
10 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector |
13 | which select the files required to have the TYPE_ARM_GICV3 | ||
14 | device, but also allowing to de-select this device. | ||
15 | |||
11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Message-id: 20210819163422.2863447-5-philmd@redhat.com | 18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 20 | --- |
16 | include/hw/dma/xlnx-zdma.h | 2 +- | 21 | hw/intc/arm_gicv3.c | 2 +- |
17 | hw/arm/xlnx-versal.c | 2 ++ | 22 | hw/intc/Kconfig | 5 +++++ |
18 | hw/arm/xlnx-zynqmp.c | 8 ++++++++ | 23 | hw/intc/meson.build | 10 ++++++---- |
19 | hw/dma/xlnx-zdma.c | 24 ++++++++++++------------ | 24 | 3 files changed, 12 insertions(+), 5 deletions(-) |
20 | 4 files changed, 23 insertions(+), 13 deletions(-) | ||
21 | 25 | ||
22 | diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h | 26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c |
23 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/dma/xlnx-zdma.h | 28 | --- a/hw/intc/arm_gicv3.c |
25 | +++ b/include/hw/dma/xlnx-zdma.h | 29 | +++ b/hw/intc/arm_gicv3.c |
26 | @@ -XXX,XX +XXX,XX @@ struct XlnxZDMA { | 30 | @@ -XXX,XX +XXX,XX @@ |
27 | MemoryRegion iomem; | 31 | /* |
28 | MemTxAttrs attr; | 32 | - * ARM Generic Interrupt Controller v3 |
29 | MemoryRegion *dma_mr; | 33 | + * ARM Generic Interrupt Controller v3 (emulation) |
30 | - AddressSpace *dma_as; | 34 | * |
31 | + AddressSpace dma_as; | 35 | * Copyright (c) 2015 Huawei. |
32 | qemu_irq irq_zdma_ch_imr; | 36 | * Copyright (c) 2016 Linaro Limited |
33 | 37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig | |
34 | struct { | ||
35 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/hw/arm/xlnx-versal.c | 39 | --- a/hw/intc/Kconfig |
38 | +++ b/hw/arm/xlnx-versal.c | 40 | +++ b/hw/intc/Kconfig |
39 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 41 | @@ -XXX,XX +XXX,XX @@ config APIC |
40 | TYPE_XLNX_ZDMA); | 42 | select MSI_NONBROKEN |
41 | dev = DEVICE(&s->lpd.iou.adma[i]); | 43 | select I8259 |
42 | object_property_set_int(OBJECT(dev), "bus-width", 128, &error_abort); | 44 | |
43 | + object_property_set_link(OBJECT(dev), "dma", | 45 | +config ARM_GIC_TCG |
44 | + OBJECT(get_system_memory()), &error_fatal); | 46 | + bool |
45 | sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); | 47 | + default y |
46 | 48 | + depends on ARM_GIC && TCG | |
47 | mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 49 | + |
48 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 50 | config ARM_GIC_KVM |
51 | bool | ||
52 | default y | ||
53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
49 | index XXXXXXX..XXXXXXX 100644 | 54 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/hw/arm/xlnx-zynqmp.c | 55 | --- a/hw/intc/meson.build |
51 | +++ b/hw/arm/xlnx-zynqmp.c | 56 | +++ b/hw/intc/meson.build |
52 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( |
53 | errp)) { | 58 | 'arm_gic.c', |
54 | return; | 59 | 'arm_gic_common.c', |
55 | } | 60 | 'arm_gicv2m.c', |
56 | + if (!object_property_set_link(OBJECT(&s->gdma[i]), "dma", | 61 | - 'arm_gicv3.c', |
57 | + OBJECT(system_memory), errp)) { | 62 | 'arm_gicv3_common.c', |
58 | + return; | 63 | - 'arm_gicv3_dist.c', |
59 | + } | 64 | 'arm_gicv3_its_common.c', |
60 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->gdma[i]), errp)) { | 65 | - 'arm_gicv3_redist.c', |
61 | return; | 66 | +)) |
62 | } | 67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( |
63 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 68 | + 'arm_gicv3.c', |
64 | } | 69 | + 'arm_gicv3_dist.c', |
65 | 70 | 'arm_gicv3_its.c', | |
66 | for (i = 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) { | 71 | + 'arm_gicv3_redist.c', |
67 | + if (!object_property_set_link(OBJECT(&s->adma[i]), "dma", | 72 | )) |
68 | + OBJECT(system_memory), errp)) { | 73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) |
69 | + return; | 74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) |
70 | + } | 75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in |
71 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->adma[i]), errp)) { | 76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) |
72 | return; | 77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) |
73 | } | 78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) |
74 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) |
75 | index XXXXXXX..XXXXXXX 100644 | 80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) |
76 | --- a/hw/dma/xlnx-zdma.c | 81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) |
77 | +++ b/hw/dma/xlnx-zdma.c | 82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) |
78 | @@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, | 83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) |
79 | return false; | ||
80 | } | ||
81 | |||
82 | - descr->addr = address_space_ldq_le(s->dma_as, addr, s->attr, NULL); | ||
83 | - descr->size = address_space_ldl_le(s->dma_as, addr + 8, s->attr, NULL); | ||
84 | - descr->attr = address_space_ldl_le(s->dma_as, addr + 12, s->attr, NULL); | ||
85 | + descr->addr = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL); | ||
86 | + descr->size = address_space_ldl_le(&s->dma_as, addr + 8, s->attr, NULL); | ||
87 | + descr->attr = address_space_ldl_le(&s->dma_as, addr + 12, s->attr, NULL); | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | @@ -XXX,XX +XXX,XX @@ static void zdma_update_descr_addr(XlnxZDMA *s, bool type, | ||
92 | } else { | ||
93 | addr = zdma_get_regaddr64(s, basereg); | ||
94 | addr += sizeof(s->dsc_dst); | ||
95 | - next = address_space_ldq_le(s->dma_as, addr, s->attr, NULL); | ||
96 | + next = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL); | ||
97 | } | ||
98 | |||
99 | zdma_put_regaddr64(s, basereg, next); | ||
100 | @@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | ||
101 | } | ||
102 | } | ||
103 | |||
104 | - address_space_write(s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen); | ||
105 | + address_space_write(&s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen); | ||
106 | if (burst_type == AXI_BURST_INCR) { | ||
107 | s->dsc_dst.addr += dlen; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | ||
110 | len = s->cfg.bus_width / 8; | ||
111 | } | ||
112 | } else { | ||
113 | - address_space_read(s->dma_as, src_addr, s->attr, s->buf, len); | ||
114 | + address_space_read(&s->dma_as, src_addr, s->attr, s->buf, len); | ||
115 | if (burst_type == AXI_BURST_INCR) { | ||
116 | src_addr += len; | ||
117 | } | ||
118 | @@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp) | ||
119 | XlnxZDMA *s = XLNX_ZDMA(dev); | ||
120 | unsigned int i; | ||
121 | |||
122 | + if (!s->dma_mr) { | ||
123 | + error_setg(errp, TYPE_XLNX_ZDMA " 'dma' link not set"); | ||
124 | + return; | ||
125 | + } | ||
126 | + address_space_init(&s->dma_as, s->dma_mr, "zdma-dma"); | ||
127 | + | ||
128 | for (i = 0; i < ARRAY_SIZE(zdma_regs_info); ++i) { | ||
129 | RegisterInfo *r = &s->regs_info[zdma_regs_info[i].addr / 4]; | ||
130 | |||
131 | @@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp) | ||
132 | }; | ||
133 | } | ||
134 | |||
135 | - if (s->dma_mr) { | ||
136 | - s->dma_as = g_malloc0(sizeof(AddressSpace)); | ||
137 | - address_space_init(s->dma_as, s->dma_mr, NULL); | ||
138 | - } else { | ||
139 | - s->dma_as = &address_space_memory; | ||
140 | - } | ||
141 | s->attr = MEMTXATTRS_UNSPECIFIED; | ||
142 | } | ||
143 | |||
144 | -- | 84 | -- |
145 | 2.20.1 | 85 | 2.25.1 |
146 | 86 | ||
147 | 87 | diff view generated by jsdifflib |
1 | The realpath() function can return NULL on error, so we need to check | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | for it to avoid crashing when we try to strstr() into it. | ||
3 | This can happen if we run out of memory, or if /sys/ is not mounted, | ||
4 | among other situations. | ||
5 | 2 | ||
6 | Fixes: Coverity 1459913, 1460474 | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Fixes: ce317be98db0 ("exec: fetch the alignment of Linux devdax pmem character device nodes") | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> | ||
10 | Message-id: 20210812151525.31456-1-peter.maydell@linaro.org | ||
11 | --- | 6 | --- |
12 | softmmu/physmem.c | 3 +++ | 7 | target/arm/translate-a64.c | 7 ++++--- |
13 | 1 file changed, 3 insertions(+) | 8 | 1 file changed, 4 insertions(+), 3 deletions(-) |
14 | 9 | ||
15 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | 10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/softmmu/physmem.c | 12 | --- a/target/arm/translate-a64.c |
18 | +++ b/softmmu/physmem.c | 13 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ static int64_t get_file_align(int fd) | 14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
20 | path = g_strdup_printf("/sys/dev/char/%d:%d", | 15 | { |
21 | major(st.st_rdev), minor(st.st_rdev)); | 16 | DisasContext *s = container_of(dcbase, DisasContext, base); |
22 | rpath = realpath(path, NULL); | 17 | CPUARMState *env = cpu->env_ptr; |
23 | + if (!rpath) { | 18 | + uint64_t pc = s->base.pc_next; |
24 | + return -errno; | 19 | uint32_t insn; |
25 | + } | 20 | |
26 | 21 | if (s->ss_active && !s->pstate_ss) { | |
27 | rc = daxctl_new(&ctx); | 22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
28 | if (rc) { | 23 | return; |
24 | } | ||
25 | |||
26 | - s->pc_curr = s->base.pc_next; | ||
27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); | ||
28 | + s->pc_curr = pc; | ||
29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
30 | s->insn = insn; | ||
31 | - s->base.pc_next += 4; | ||
32 | + s->base.pc_next = pc + 4; | ||
33 | |||
34 | s->fp_access_checked = false; | ||
35 | s->sve_access_checked = false; | ||
29 | -- | 36 | -- |
30 | 2.20.1 | 37 | 2.25.1 |
31 | 38 | ||
32 | 39 | diff view generated by jsdifflib |
1 | In the alignment check added to qemu_ram_alloc_from_fd() in commit | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | ce317be98db0dfdfa, the condition includes a check that 'mr' is not | ||
3 | NULL. This check is unnecessary because we can assume that the | ||
4 | caller always passes us a valid MemoryRegion, and indeed later in the | ||
5 | function we assume mr is not NULL when we pass it to file_ram_alloc() | ||
6 | as new_block->mr. Remove it. | ||
7 | 2 | ||
8 | Fixes: Coverity 1459867 | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Fixes: ce317be98d ("exec: fetch the alignment of Linux devdax pmem character device nodes") | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> | ||
12 | Message-id: 20210812150624.29139-1-peter.maydell@linaro.org | ||
13 | --- | 6 | --- |
14 | softmmu/physmem.c | 2 +- | 7 | target/arm/translate.c | 9 +++++---- |
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | 8 | 1 file changed, 5 insertions(+), 4 deletions(-) |
16 | 9 | ||
17 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
18 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/softmmu/physmem.c | 12 | --- a/target/arm/translate.c |
20 | +++ b/softmmu/physmem.c | 13 | +++ b/target/arm/translate.c |
21 | @@ -XXX,XX +XXX,XX @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, | 14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
15 | { | ||
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
17 | CPUARMState *env = cpu->env_ptr; | ||
18 | + uint32_t pc = dc->base.pc_next; | ||
19 | unsigned int insn; | ||
20 | |||
21 | if (arm_pre_translate_insn(dc)) { | ||
22 | - dc->base.pc_next += 4; | ||
23 | + dc->base.pc_next = pc + 4; | ||
24 | return; | ||
22 | } | 25 | } |
23 | 26 | ||
24 | file_align = get_file_align(fd); | 27 | - dc->pc_curr = dc->base.pc_next; |
25 | - if (file_align > 0 && mr && file_align > mr->align) { | 28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
26 | + if (file_align > 0 && file_align > mr->align) { | 29 | + dc->pc_curr = pc; |
27 | error_setg(errp, "backing store align 0x%" PRIx64 | 30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); |
28 | " is larger than 'align' option 0x%" PRIx64, | 31 | dc->insn = insn; |
29 | file_align, mr->align); | 32 | - dc->base.pc_next += 4; |
33 | + dc->base.pc_next = pc + 4; | ||
34 | disas_arm_insn(dc, insn); | ||
35 | |||
36 | arm_post_translate_insn(dc); | ||
30 | -- | 37 | -- |
31 | 2.20.1 | 38 | 2.25.1 |
32 | 39 | ||
33 | 40 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Allow CPUs that support SVE to specify which SVE vector lengths they | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | support by setting them in this bitmap. Currently only the 'max' and | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | 'host' CPU types supports SVE and 'host' requires KVM which obtains | ||
6 | its supported bitmap from the host. So, we only need to initialize the | ||
7 | bitmap for 'max' with TCG. And, since 'max' should support all SVE | ||
8 | vector lengths we simply fill the bitmap. Future CPU types may have | ||
9 | less trivial maps though. | ||
10 | |||
11 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20210823160647.34028-2-drjones@redhat.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 6 | --- |
17 | target/arm/cpu.h | 4 ++++ | 7 | target/arm/translate.c | 16 ++++++++-------- |
18 | target/arm/cpu64.c | 2 ++ | 8 | 1 file changed, 8 insertions(+), 8 deletions(-) |
19 | 2 files changed, 6 insertions(+) | ||
20 | 9 | ||
21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
22 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu.h | 12 | --- a/target/arm/translate.c |
24 | +++ b/target/arm/cpu.h | 13 | +++ b/target/arm/translate.c |
25 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
26 | * While processing properties during initialization, corresponding | 15 | { |
27 | * sve_vq_init bits are set for bits in sve_vq_map that have been | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
28 | * set by properties. | 17 | CPUARMState *env = cpu->env_ptr; |
29 | + * | 18 | + uint32_t pc = dc->base.pc_next; |
30 | + * Bits set in sve_vq_supported represent valid vector lengths for | 19 | uint32_t insn; |
31 | + * the CPU type. | 20 | bool is_16bit; |
32 | */ | 21 | |
33 | DECLARE_BITMAP(sve_vq_map, ARM_MAX_VQ); | 22 | if (arm_pre_translate_insn(dc)) { |
34 | DECLARE_BITMAP(sve_vq_init, ARM_MAX_VQ); | 23 | - dc->base.pc_next += 2; |
35 | + DECLARE_BITMAP(sve_vq_supported, ARM_MAX_VQ); | 24 | + dc->base.pc_next = pc + 2; |
36 | 25 | return; | |
37 | /* Generic timer counter frequency, in Hz */ | ||
38 | uint64_t gt_cntfrq_hz; | ||
39 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/cpu64.c | ||
42 | +++ b/target/arm/cpu64.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
44 | /* Default to PAUTH on, with the architected algorithm. */ | ||
45 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); | ||
46 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property); | ||
47 | + | ||
48 | + bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
49 | } | 26 | } |
50 | 27 | ||
51 | aarch64_add_sve_properties(obj); | 28 | - dc->pc_curr = dc->base.pc_next; |
29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | ||
30 | + dc->pc_curr = pc; | ||
31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | ||
33 | - dc->base.pc_next += 2; | ||
34 | + pc += 2; | ||
35 | if (!is_16bit) { | ||
36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, | ||
37 | - dc->sctlr_b); | ||
38 | - | ||
39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
40 | insn = insn << 16 | insn2; | ||
41 | - dc->base.pc_next += 2; | ||
42 | + pc += 2; | ||
43 | } | ||
44 | + dc->base.pc_next = pc; | ||
45 | dc->insn = insn; | ||
46 | |||
47 | if (dc->pstate_il) { | ||
52 | -- | 48 | -- |
53 | 2.20.1 | 49 | 2.25.1 |
54 | 50 | ||
55 | 51 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Simplify by always passing a MemoryRegion property to the device. | 3 | Create arm_check_ss_active and arm_check_kernelpage. |
4 | Doing so we can move the AddressSpace field to the device struct, | ||
5 | removing need for heap allocation. | ||
6 | 4 | ||
7 | Update the Xilinx ZynqMP SoC model to pass the default system | 5 | Reverse the order of the tests. While it doesn't matter in practice, |
8 | memory instead of a NULL value. | 6 | because only user-only has a kernel page and user-only never sets |
7 | ss_active, ss_active has priority over execution exceptions and it | ||
8 | is best to keep them in the proper order. | ||
9 | 9 | ||
10 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Message-id: 20210819163422.2863447-4-philmd@redhat.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 13 | --- |
16 | include/hw/dma/xlnx_csu_dma.h | 2 +- | 14 | target/arm/translate.c | 10 +++++++--- |
17 | hw/arm/xlnx-zynqmp.c | 4 ++++ | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
18 | hw/dma/xlnx_csu_dma.c | 21 ++++++++++----------- | ||
19 | 3 files changed, 15 insertions(+), 12 deletions(-) | ||
20 | 16 | ||
21 | diff --git a/include/hw/dma/xlnx_csu_dma.h b/include/hw/dma/xlnx_csu_dma.h | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
22 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/dma/xlnx_csu_dma.h | 19 | --- a/target/arm/translate.c |
24 | +++ b/include/hw/dma/xlnx_csu_dma.h | 20 | +++ b/target/arm/translate.c |
25 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxCSUDMA { | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
26 | MemoryRegion iomem; | 22 | dc->insn_start = tcg_last_op(); |
27 | MemTxAttrs attr; | 23 | } |
28 | MemoryRegion *dma_mr; | 24 | |
29 | - AddressSpace *dma_as; | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
30 | + AddressSpace dma_as; | 26 | +static bool arm_check_kernelpage(DisasContext *dc) |
31 | qemu_irq irq; | 27 | { |
32 | StreamSink *tx_dev; /* Used as generic StreamSink */ | 28 | #ifdef CONFIG_USER_ONLY |
33 | ptimer_state *src_timer; | 29 | /* Intercept jump to the magic kernel page. */ |
34 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) |
35 | index XXXXXXX..XXXXXXX 100644 | 31 | return true; |
36 | --- a/hw/arm/xlnx-zynqmp.c | ||
37 | +++ b/hw/arm/xlnx-zynqmp.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
39 | gic_spi[adma_ch_intr[i]]); | ||
40 | } | 32 | } |
41 | 33 | #endif | |
42 | + if (!object_property_set_link(OBJECT(&s->qspi_dma), "dma", | 34 | + return false; |
43 | + OBJECT(system_memory), errp)) { | 35 | +} |
44 | + return; | 36 | |
45 | + } | 37 | +static bool arm_check_ss_active(DisasContext *dc) |
46 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi_dma), errp)) { | 38 | +{ |
39 | if (dc->ss_active && !dc->pstate_ss) { | ||
40 | /* Singlestep state is Active-pending. | ||
41 | * If we're in this state at the start of a TB then either | ||
42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
43 | uint32_t pc = dc->base.pc_next; | ||
44 | unsigned int insn; | ||
45 | |||
46 | - if (arm_pre_translate_insn(dc)) { | ||
47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
48 | dc->base.pc_next = pc + 4; | ||
47 | return; | 49 | return; |
48 | } | 50 | } |
49 | diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c | 51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
50 | index XXXXXXX..XXXXXXX 100644 | 52 | uint32_t insn; |
51 | --- a/hw/dma/xlnx_csu_dma.c | 53 | bool is_16bit; |
52 | +++ b/hw/dma/xlnx_csu_dma.c | 54 | |
53 | @@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_read(XlnxCSUDMA *s, uint8_t *buf, uint32_t len) | 55 | - if (arm_pre_translate_insn(dc)) { |
54 | for (i = 0; i < len && (result == MEMTX_OK); i += s->width) { | 56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
55 | uint32_t mlen = MIN(len - i, s->width); | 57 | dc->base.pc_next = pc + 2; |
56 | |||
57 | - result = address_space_rw(s->dma_as, addr, s->attr, | ||
58 | + result = address_space_rw(&s->dma_as, addr, s->attr, | ||
59 | buf + i, mlen, false); | ||
60 | } | ||
61 | } else { | ||
62 | - result = address_space_rw(s->dma_as, addr, s->attr, buf, len, false); | ||
63 | + result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, false); | ||
64 | } | ||
65 | |||
66 | if (result == MEMTX_OK) { | ||
67 | @@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_write(XlnxCSUDMA *s, uint8_t *buf, uint32_t len) | ||
68 | for (i = 0; i < len && (result == MEMTX_OK); i += s->width) { | ||
69 | uint32_t mlen = MIN(len - i, s->width); | ||
70 | |||
71 | - result = address_space_rw(s->dma_as, addr, s->attr, | ||
72 | + result = address_space_rw(&s->dma_as, addr, s->attr, | ||
73 | buf, mlen, true); | ||
74 | buf += mlen; | ||
75 | } | ||
76 | } else { | ||
77 | - result = address_space_rw(s->dma_as, addr, s->attr, buf, len, true); | ||
78 | + result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, true); | ||
79 | } | ||
80 | |||
81 | if (result != MEMTX_OK) { | ||
82 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | ||
83 | return; | 58 | return; |
84 | } | 59 | } |
85 | |||
86 | + if (!s->dma_mr) { | ||
87 | + error_setg(errp, TYPE_XLNX_CSU_DMA " 'dma' link not set"); | ||
88 | + return; | ||
89 | + } | ||
90 | + address_space_init(&s->dma_as, s->dma_mr, "csu-dma"); | ||
91 | + | ||
92 | reg_array = | ||
93 | register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], | ||
94 | XLNX_CSU_DMA_R_MAX, | ||
95 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | ||
96 | s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit, | ||
97 | s, PTIMER_POLICY_DEFAULT); | ||
98 | |||
99 | - if (s->dma_mr) { | ||
100 | - s->dma_as = g_malloc0(sizeof(AddressSpace)); | ||
101 | - address_space_init(s->dma_as, s->dma_mr, NULL); | ||
102 | - } else { | ||
103 | - s->dma_as = &address_space_memory; | ||
104 | - } | ||
105 | - | ||
106 | s->attr = MEMTXATTRS_UNSPECIFIED; | ||
107 | |||
108 | s->r_size_last_word = 0; | ||
109 | -- | 60 | -- |
110 | 2.20.1 | 61 | 2.25.1 |
111 | 62 | ||
112 | 63 | diff view generated by jsdifflib |
1 | When Hexagon was added we forgot to add it to the QEMU_ARCH_* | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | enumeration. This doesn't cause a visible effect because at the | ||
3 | moment Hexagon is linux-user only and the QEMU_ARCH_* constants are | ||
4 | only used in softmmu, but we might as well add it in, since it's the | ||
5 | only architecture currently missing from the list. | ||
6 | 2 | ||
3 | The size of the code covered by a TranslationBlock cannot be 0; | ||
4 | this is checked via assert in tb_gen_code. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
11 | Message-id: 20210730105947.28215-6-peter.maydell@linaro.org | ||
12 | --- | 9 | --- |
13 | include/sysemu/arch_init.h | 1 + | 10 | target/arm/translate-a64.c | 1 + |
14 | 1 file changed, 1 insertion(+) | 11 | 1 file changed, 1 insertion(+) |
15 | 12 | ||
16 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/sysemu/arch_init.h | 15 | --- a/target/arm/translate-a64.c |
19 | +++ b/include/sysemu/arch_init.h | 16 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ enum { | 17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
21 | QEMU_ARCH_RISCV = (1 << 19), | 18 | assert(s->base.num_insns == 1); |
22 | QEMU_ARCH_RX = (1 << 20), | 19 | gen_swstep_exception(s, 0, 0); |
23 | QEMU_ARCH_AVR = (1 << 21), | 20 | s->base.is_jmp = DISAS_NORETURN; |
24 | + QEMU_ARCH_HEXAGON = (1 << 22), | 21 | + s->base.pc_next = pc + 4; |
25 | 22 | return; | |
26 | QEMU_ARCH_NONE = (1 << 31), | 23 | } |
27 | }; | 24 | |
28 | -- | 25 | -- |
29 | 2.20.1 | 26 | 2.25.1 |
30 | 27 | ||
31 | 28 | diff view generated by jsdifflib |
1 | In v7, the HSTR register has a TTEE bit which allows EL0/EL1 accesses | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to the Thumb2EE TEECR and TEEHBR registers to be trapped to the | ||
3 | hypervisor. Implement these traps. | ||
4 | 2 | ||
3 | We will reuse this section of arm_deliver_fault for | ||
4 | raising pc alignment faults. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210816180305.20137-2-peter.maydell@linaro.org | ||
8 | --- | 9 | --- |
9 | target/arm/cpu.h | 2 ++ | 10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- |
10 | target/arm/helper.c | 18 ++++++++++++++++-- | 11 | 1 file changed, 28 insertions(+), 17 deletions(-) |
11 | 2 files changed, 18 insertions(+), 2 deletions(-) | ||
12 | 12 | ||
13 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/tlb_helper.c |
16 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/tlb_helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | 17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
18 | #define SCR_ENSCXT (1U << 25) | 18 | return syn; |
19 | #define SCR_ATA (1U << 26) | ||
20 | |||
21 | +#define HSTR_TTEE (1 << 16) | ||
22 | + | ||
23 | /* Return the current FPSCR value. */ | ||
24 | uint32_t vfp_get_fpscr(CPUARMState *env); | ||
25 | void vfp_set_fpscr(CPUARMState *env, uint32_t val); | ||
26 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/helper.c | ||
29 | +++ b/target/arm/helper.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
31 | env->teecr = value; | ||
32 | } | 19 | } |
33 | 20 | ||
34 | +static CPAccessResult teecr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
35 | + bool isread) | 22 | - MMUAccessType access_type, |
36 | +{ | 23 | - int mmu_idx, ARMMMUFaultInfo *fi) |
37 | + /* | 24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, |
38 | + * HSTR.TTEE only exists in v7A, not v8A, but v8A doesn't have T2EE | 25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) |
39 | + * at all, so we don't need to check whether we're v8A. | 26 | { |
40 | + */ | 27 | - CPUARMState *env = &cpu->env; |
41 | + if (arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) && | 28 | - int target_el; |
42 | + (env->cp15.hstr_el2 & HSTR_TTEE)) { | 29 | - bool same_el; |
43 | + return CP_ACCESS_TRAP_EL2; | 30 | - uint32_t syn, exc, fsr, fsc; |
44 | + } | 31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); |
45 | + return CP_ACCESS_OK; | 32 | - |
33 | - target_el = exception_target_el(env); | ||
34 | - if (fi->stage2) { | ||
35 | - target_el = 2; | ||
36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | ||
39 | - } | ||
40 | - } | ||
41 | - same_el = (arm_current_el(env) == target_el); | ||
42 | + uint32_t fsr, fsc; | ||
43 | |||
44 | if (target_el == 2 || arm_el_is_aa64(env, target_el) || | ||
45 | arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
47 | fsc = 0x3f; | ||
48 | } | ||
49 | |||
50 | + *ret_fsc = fsc; | ||
51 | + return fsr; | ||
46 | +} | 52 | +} |
47 | + | 53 | + |
48 | static CPAccessResult teehbr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
49 | bool isread) | 55 | + MMUAccessType access_type, |
50 | { | 56 | + int mmu_idx, ARMMMUFaultInfo *fi) |
51 | if (arm_current_el(env) == 0 && (env->teecr & 1)) { | 57 | +{ |
52 | return CP_ACCESS_TRAP; | 58 | + CPUARMState *env = &cpu->env; |
53 | } | 59 | + int target_el; |
54 | - return CP_ACCESS_OK; | 60 | + bool same_el; |
55 | + return teecr_access(env, ri, isread); | 61 | + uint32_t syn, exc, fsr, fsc; |
56 | } | 62 | + |
57 | 63 | + target_el = exception_target_el(env); | |
58 | static const ARMCPRegInfo t2ee_cp_reginfo[] = { | 64 | + if (fi->stage2) { |
59 | { .name = "TEECR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 6, .opc2 = 0, | 65 | + target_el = 2; |
60 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, teecr), | 66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; |
61 | .resetvalue = 0, | 67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { |
62 | - .writefn = teecr_write }, | 68 | + env->cp15.hpfar_el2 |= HPFAR_NS; |
63 | + .writefn = teecr_write, .accessfn = teecr_access }, | 69 | + } |
64 | { .name = "TEEHBR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 6, .opc2 = 0, | 70 | + } |
65 | .access = PL0_RW, .fieldoffset = offsetof(CPUARMState, teehbr), | 71 | + same_el = (arm_current_el(env) == target_el); |
66 | .accessfn = teehbr_access, .resetvalue = 0 }, | 72 | + |
73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); | ||
74 | + | ||
75 | if (access_type == MMU_INST_FETCH) { | ||
76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); | ||
77 | exc = EXCP_PREFETCH_ABORT; | ||
67 | -- | 78 | -- |
68 | 2.20.1 | 79 | 2.25.1 |
69 | 80 | ||
70 | 81 | diff view generated by jsdifflib |
1 | In v7A, the HSTR register has a TJDBX bit which traps NS EL0/EL1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | access to the JOSCR and JMCR trivial Jazelle registers, and also BXJ. | 2 | |
3 | Implement these traps. In v8A this HSTR bit doesn't exist, so don't | 3 | For A64, any input to an indirect branch can cause this. |
4 | trap for v8A CPUs. | 4 | |
5 | 5 | For A32, many indirect branch paths force the branch to be aligned, | |
6 | but BXWritePC does not. This includes the BX instruction but also | ||
7 | other interworking changes to PC. Prior to v8, this case is UNDEFINED. | ||
8 | With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an | ||
9 | exception or force align the PC. | ||
10 | |||
11 | We choose to raise an exception because we have the infrastructure, | ||
12 | it makes the generated code for gen_bx simpler, and it has the | ||
13 | possibility of catching more guest bugs. | ||
14 | |||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210816180305.20137-3-peter.maydell@linaro.org | ||
9 | --- | 18 | --- |
10 | target/arm/cpu.h | 1 + | 19 | target/arm/helper.h | 1 + |
11 | target/arm/helper.h | 2 ++ | 20 | target/arm/syndrome.h | 5 ++++ |
12 | target/arm/syndrome.h | 7 +++++++ | 21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- |
13 | target/arm/helper.c | 17 +++++++++++++++++ | 22 | target/arm/tlb_helper.c | 18 ++++++++++++++ |
14 | target/arm/op_helper.c | 16 ++++++++++++++++ | 23 | target/arm/translate-a64.c | 15 ++++++++++++ |
15 | target/arm/translate.c | 12 ++++++++++++ | 24 | target/arm/translate.c | 22 ++++++++++++++++- |
16 | 6 files changed, 55 insertions(+) | 25 | 6 files changed, 87 insertions(+), 20 deletions(-) |
17 | 26 | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/cpu.h | ||
21 | +++ b/target/arm/cpu.h | ||
22 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
23 | #define SCR_ATA (1U << 26) | ||
24 | |||
25 | #define HSTR_TTEE (1 << 16) | ||
26 | +#define HSTR_TJDBX (1 << 17) | ||
27 | |||
28 | /* Return the current FPSCR value. */ | ||
29 | uint32_t vfp_get_fpscr(CPUARMState *env); | ||
30 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 27 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
31 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/target/arm/helper.h | 29 | --- a/target/arm/helper.h |
33 | +++ b/target/arm/helper.h | 30 | +++ b/target/arm/helper.h |
34 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(v7m_vlldm, void, env, i32) | 31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, |
35 | 32 | DEF_HELPER_2(exception_internal, void, env, i32) | |
36 | DEF_HELPER_2(v8m_stackcheck, void, env, i32) | 33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) |
37 | 34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | |
38 | +DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32) | 35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) |
39 | + | 36 | DEF_HELPER_1(setend, void, env) |
40 | DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32) | 37 | DEF_HELPER_2(wfi, void, env, i32) |
41 | DEF_HELPER_3(set_cp_reg, void, env, ptr, i32) | 38 | DEF_HELPER_1(wfe, void, env) |
42 | DEF_HELPER_2(get_cp_reg, i32, env, ptr) | ||
43 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | 39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h |
44 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/target/arm/syndrome.h | 41 | --- a/target/arm/syndrome.h |
46 | +++ b/target/arm/syndrome.h | 42 | +++ b/target/arm/syndrome.h |
47 | @@ -XXX,XX +XXX,XX @@ enum arm_exception_class { | 43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) |
48 | EC_ADVSIMDFPACCESSTRAP = 0x07, | 44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; |
49 | EC_FPIDTRAP = 0x08, | ||
50 | EC_PACTRAP = 0x09, | ||
51 | + EC_BXJTRAP = 0x0a, | ||
52 | EC_CP14RRTTRAP = 0x0c, | ||
53 | EC_BTITRAP = 0x0d, | ||
54 | EC_ILLEGALSTATE = 0x0e, | ||
55 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_btitrap(int btype) | ||
56 | return (EC_BTITRAP << ARM_EL_EC_SHIFT) | btype; | ||
57 | } | 45 | } |
58 | 46 | ||
59 | +static inline uint32_t syn_bxjtrap(int cv, int cond, int rm) | 47 | +static inline uint32_t syn_pcalignment(void) |
60 | +{ | 48 | +{ |
61 | + return (EC_BXJTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | | 49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; |
62 | + (cv << 24) | (cond << 20) | rm; | ||
63 | +} | 50 | +} |
64 | + | 51 | + |
65 | static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc) | 52 | #endif /* TARGET_ARM_SYNDROME_H */ |
66 | { | 53 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c |
67 | return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT) | 54 | index XXXXXXX..XXXXXXX 100644 |
68 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 55 | --- a/linux-user/aarch64/cpu_loop.c |
69 | index XXXXXXX..XXXXXXX 100644 | 56 | +++ b/linux-user/aarch64/cpu_loop.c |
70 | --- a/target/arm/helper.c | 57 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) |
71 | +++ b/target/arm/helper.c | 58 | break; |
72 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_jazelle(CPUARMState *env, const ARMCPRegInfo *ri, | 59 | case EXCP_PREFETCH_ABORT: |
73 | return CP_ACCESS_OK; | 60 | case EXCP_DATA_ABORT: |
61 | - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ | ||
62 | ec = syn_get_ec(env->exception.syndrome); | ||
63 | - assert(ec == EC_DATAABORT || ec == EC_INSNABORT); | ||
64 | - | ||
65 | - /* Both EC have the same format for FSC, or close enough. */ | ||
66 | - fsc = extract32(env->exception.syndrome, 0, 6); | ||
67 | - switch (fsc) { | ||
68 | - case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
69 | - si_signo = TARGET_SIGSEGV; | ||
70 | - si_code = TARGET_SEGV_MAPERR; | ||
71 | + switch (ec) { | ||
72 | + case EC_DATAABORT: | ||
73 | + case EC_INSNABORT: | ||
74 | + /* Both EC have the same format for FSC, or close enough. */ | ||
75 | + fsc = extract32(env->exception.syndrome, 0, 6); | ||
76 | + switch (fsc) { | ||
77 | + case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
78 | + si_signo = TARGET_SIGSEGV; | ||
79 | + si_code = TARGET_SEGV_MAPERR; | ||
80 | + break; | ||
81 | + case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
82 | + case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
83 | + si_signo = TARGET_SIGSEGV; | ||
84 | + si_code = TARGET_SEGV_ACCERR; | ||
85 | + break; | ||
86 | + case 0x11: /* Synchronous Tag Check Fault */ | ||
87 | + si_signo = TARGET_SIGSEGV; | ||
88 | + si_code = TARGET_SEGV_MTESERR; | ||
89 | + break; | ||
90 | + case 0x21: /* Alignment fault */ | ||
91 | + si_signo = TARGET_SIGBUS; | ||
92 | + si_code = TARGET_BUS_ADRALN; | ||
93 | + break; | ||
94 | + default: | ||
95 | + g_assert_not_reached(); | ||
96 | + } | ||
97 | break; | ||
98 | - case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
99 | - case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
100 | - si_signo = TARGET_SIGSEGV; | ||
101 | - si_code = TARGET_SEGV_ACCERR; | ||
102 | - break; | ||
103 | - case 0x11: /* Synchronous Tag Check Fault */ | ||
104 | - si_signo = TARGET_SIGSEGV; | ||
105 | - si_code = TARGET_SEGV_MTESERR; | ||
106 | - break; | ||
107 | - case 0x21: /* Alignment fault */ | ||
108 | + case EC_PCALIGNMENT: | ||
109 | si_signo = TARGET_SIGBUS; | ||
110 | si_code = TARGET_BUS_ADRALN; | ||
111 | break; | ||
112 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/tlb_helper.c | ||
115 | +++ b/target/arm/tlb_helper.c | ||
116 | @@ -XXX,XX +XXX,XX @@ | ||
117 | #include "cpu.h" | ||
118 | #include "internals.h" | ||
119 | #include "exec/exec-all.h" | ||
120 | +#include "exec/helper-proto.h" | ||
121 | |||
122 | static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
123 | unsigned int target_el, | ||
124 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
125 | arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi); | ||
74 | } | 126 | } |
75 | 127 | ||
76 | +static CPAccessResult access_joscr_jmcr(CPUARMState *env, | 128 | +void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) |
77 | + const ARMCPRegInfo *ri, bool isread) | ||
78 | +{ | 129 | +{ |
130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; | ||
131 | + int target_el = exception_target_el(env); | ||
132 | + int mmu_idx = cpu_mmu_index(env, true); | ||
133 | + uint32_t fsc; | ||
134 | + | ||
135 | + env->exception.vaddress = pc; | ||
136 | + | ||
79 | + /* | 137 | + /* |
80 | + * HSTR.TJDBX traps JOSCR and JMCR accesses, but it exists only | 138 | + * Note that the fsc is not applicable to this exception, |
81 | + * in v7A, not in v8A. | 139 | + * since any syndrome is pcalignment not insn_abort. |
82 | + */ | 140 | + */ |
83 | + if (!arm_feature(env, ARM_FEATURE_V8) && | 141 | + env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc); |
84 | + arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) && | 142 | + raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el); |
85 | + (env->cp15.hstr_el2 & HSTR_TJDBX)) { | 143 | +} |
86 | + return CP_ACCESS_TRAP_EL2; | 144 | + |
145 | #if !defined(CONFIG_USER_ONLY) | ||
146 | |||
147 | /* | ||
148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
149 | index XXXXXXX..XXXXXXX 100644 | ||
150 | --- a/target/arm/translate-a64.c | ||
151 | +++ b/target/arm/translate-a64.c | ||
152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
153 | uint64_t pc = s->base.pc_next; | ||
154 | uint32_t insn; | ||
155 | |||
156 | + /* Singlestep exceptions have the highest priority. */ | ||
157 | if (s->ss_active && !s->pstate_ss) { | ||
158 | /* Singlestep state is Active-pending. | ||
159 | * If we're in this state at the start of a TB then either | ||
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
87 | + } | 176 | + } |
88 | + return CP_ACCESS_OK; | 177 | + |
89 | +} | 178 | s->pc_curr = pc; |
90 | + | 179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); |
91 | static const ARMCPRegInfo jazelle_regs[] = { | 180 | s->insn = insn; |
92 | { .name = "JIDR", | ||
93 | .cp = 14, .crn = 0, .crm = 0, .opc1 = 7, .opc2 = 0, | ||
94 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = { | ||
95 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
96 | { .name = "JOSCR", | ||
97 | .cp = 14, .crn = 1, .crm = 0, .opc1 = 7, .opc2 = 0, | ||
98 | + .accessfn = access_joscr_jmcr, | ||
99 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
100 | { .name = "JMCR", | ||
101 | .cp = 14, .crn = 2, .crm = 0, .opc1 = 7, .opc2 = 0, | ||
102 | + .accessfn = access_joscr_jmcr, | ||
103 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
104 | REGINFO_SENTINEL | ||
105 | }; | ||
106 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/target/arm/op_helper.c | ||
109 | +++ b/target/arm/op_helper.c | ||
110 | @@ -XXX,XX +XXX,XX @@ void HELPER(setend)(CPUARMState *env) | ||
111 | arm_rebuild_hflags(env); | ||
112 | } | ||
113 | |||
114 | +void HELPER(check_bxj_trap)(CPUARMState *env, uint32_t rm) | ||
115 | +{ | ||
116 | + /* | ||
117 | + * Only called if in NS EL0 or EL1 for a BXJ for a v7A CPU; | ||
118 | + * check if HSTR.TJDBX means we need to trap to EL2. | ||
119 | + */ | ||
120 | + if (env->cp15.hstr_el2 & HSTR_TJDBX) { | ||
121 | + /* | ||
122 | + * We know the condition code check passed, so take the IMPDEF | ||
123 | + * choice to always report CV=1 COND 0xe | ||
124 | + */ | ||
125 | + uint32_t syn = syn_bxjtrap(1, 0xe, rm); | ||
126 | + raise_exception_ra(env, EXCP_HYP_TRAP, syn, 2, GETPC()); | ||
127 | + } | ||
128 | +} | ||
129 | + | ||
130 | #ifndef CONFIG_USER_ONLY | ||
131 | /* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped. | ||
132 | * The function returns the target EL (1-3) if the instruction is to be trapped; | ||
133 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 181 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
134 | index XXXXXXX..XXXXXXX 100644 | 182 | index XXXXXXX..XXXXXXX 100644 |
135 | --- a/target/arm/translate.c | 183 | --- a/target/arm/translate.c |
136 | +++ b/target/arm/translate.c | 184 | +++ b/target/arm/translate.c |
137 | @@ -XXX,XX +XXX,XX @@ static bool trans_BXJ(DisasContext *s, arg_BXJ *a) | 185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
138 | if (!ENABLE_ARCH_5J || arm_dc_feature(s, ARM_FEATURE_M)) { | 186 | uint32_t pc = dc->base.pc_next; |
139 | return false; | 187 | unsigned int insn; |
188 | |||
189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
190 | + /* Singlestep exceptions have the highest priority. */ | ||
191 | + if (arm_check_ss_active(dc)) { | ||
192 | + dc->base.pc_next = pc + 4; | ||
193 | + return; | ||
194 | + } | ||
195 | + | ||
196 | + if (pc & 3) { | ||
197 | + /* | ||
198 | + * PC alignment fault. This has priority over the instruction abort | ||
199 | + * that we would receive from a translation fault via arm_ldl_code | ||
200 | + * (or the execution of the kernelpage entrypoint). This should only | ||
201 | + * be possible after an indirect branch, at the start of the TB. | ||
202 | + */ | ||
203 | + assert(dc->base.num_insns == 1); | ||
204 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
205 | + dc->base.is_jmp = DISAS_NORETURN; | ||
206 | + dc->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
207 | + return; | ||
208 | + } | ||
209 | + | ||
210 | + if (arm_check_kernelpage(dc)) { | ||
211 | dc->base.pc_next = pc + 4; | ||
212 | return; | ||
140 | } | 213 | } |
141 | + /* | ||
142 | + * v7A allows BXJ to be trapped via HSTR.TJDBX. We don't waste a | ||
143 | + * TBFLAGS bit on a basically-never-happens case, so call a helper | ||
144 | + * function to check for the trap and raise the exception if needed | ||
145 | + * (passing it the register number for the syndrome value). | ||
146 | + * v8A doesn't have this HSTR bit. | ||
147 | + */ | ||
148 | + if (!arm_dc_feature(s, ARM_FEATURE_V8) && | ||
149 | + arm_dc_feature(s, ARM_FEATURE_EL2) && | ||
150 | + s->current_el < 2 && s->ns) { | ||
151 | + gen_helper_check_bxj_trap(cpu_env, tcg_constant_i32(a->rm)); | ||
152 | + } | ||
153 | /* Trivial implementation equivalent to bx. */ | ||
154 | gen_bx(s, load_reg(s, a->rm)); | ||
155 | return true; | ||
156 | -- | 214 | -- |
157 | 2.20.1 | 215 | 2.25.1 |
158 | 216 | ||
159 | 217 | diff view generated by jsdifflib |
1 | We added a stub for the arch_type global in commit 5964ed56d9a1 so | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | that we could compile blockdev.c into the tools. However, in commit | ||
3 | 9db1d3a2be9bf we removed the only use of arch_type from blockdev.c. | ||
4 | The stub is therefore no longer needed, and we can delete it again, | ||
5 | together with the QEMU_ARCH_NONE value that only the stub was using. | ||
6 | 2 | ||
3 | Misaligned thumb PC is architecturally impossible. | ||
4 | Assert is better than proceeding, in case we've missed | ||
5 | something somewhere. | ||
6 | |||
7 | Expand a comment about aligning the pc in gdbstub. | ||
8 | Fail an incoming migrate if a thumb pc is misaligned. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210730105947.28215-9-peter.maydell@linaro.org | ||
11 | --- | 13 | --- |
12 | include/sysemu/arch_init.h | 2 -- | 14 | target/arm/gdbstub.c | 9 +++++++-- |
13 | stubs/arch_type.c | 4 ---- | 15 | target/arm/machine.c | 10 ++++++++++ |
14 | stubs/meson.build | 1 - | 16 | target/arm/translate.c | 3 +++ |
15 | 3 files changed, 7 deletions(-) | 17 | 3 files changed, 20 insertions(+), 2 deletions(-) |
16 | delete mode 100644 stubs/arch_type.c | ||
17 | 18 | ||
18 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/sysemu/arch_init.h | 21 | --- a/target/arm/gdbstub.c |
21 | +++ b/include/sysemu/arch_init.h | 22 | +++ b/target/arm/gdbstub.c |
22 | @@ -XXX,XX +XXX,XX @@ enum { | 23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
23 | QEMU_ARCH_RX = (1 << 20), | 24 | |
24 | QEMU_ARCH_AVR = (1 << 21), | 25 | tmp = ldl_p(mem_buf); |
25 | QEMU_ARCH_HEXAGON = (1 << 22), | 26 | |
26 | - | 27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably |
27 | - QEMU_ARCH_NONE = (1 << 31), | 28 | - cause problems if we ever implement the Jazelle DBX extensions. */ |
28 | }; | 29 | + /* |
29 | 30 | + * Mask out low bits of PC to workaround gdb bugs. | |
30 | extern const uint32_t arch_type; | 31 | + * This avoids an assert in thumb_tr_translate_insn, because it is |
31 | diff --git a/stubs/arch_type.c b/stubs/arch_type.c | 32 | + * architecturally impossible to misalign the pc. |
32 | deleted file mode 100644 | 33 | + * This will probably cause problems if we ever implement the |
33 | index XXXXXXX..XXXXXXX | 34 | + * Jazelle DBX extensions. |
34 | --- a/stubs/arch_type.c | 35 | + */ |
35 | +++ /dev/null | 36 | if (n == 15) { |
36 | @@ -XXX,XX +XXX,XX @@ | 37 | tmp &= ~1; |
37 | -#include "qemu/osdep.h" | 38 | } |
38 | -#include "sysemu/arch_init.h" | 39 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
39 | - | ||
40 | -const uint32_t arch_type = QEMU_ARCH_NONE; | ||
41 | diff --git a/stubs/meson.build b/stubs/meson.build | ||
42 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/stubs/meson.build | 41 | --- a/target/arm/machine.c |
44 | +++ b/stubs/meson.build | 42 | +++ b/target/arm/machine.c |
45 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
46 | -stub_ss.add(files('arch_type.c')) | 44 | return -1; |
47 | stub_ss.add(files('bdrv-next-monitor-owned.c')) | 45 | } |
48 | stub_ss.add(files('blk-commit-all.c')) | 46 | } |
49 | stub_ss.add(files('blk-exp-close-all.c')) | 47 | + |
48 | + /* | ||
49 | + * Misaligned thumb pc is architecturally impossible. | ||
50 | + * We have an assert in thumb_tr_translate_insn to verify this. | ||
51 | + * Fail an incoming migrate to avoid this assert. | ||
52 | + */ | ||
53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
54 | + return -1; | ||
55 | + } | ||
56 | + | ||
57 | if (!kvm_enabled()) { | ||
58 | pmu_op_finish(&cpu->env); | ||
59 | } | ||
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/translate.c | ||
63 | +++ b/target/arm/translate.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
65 | uint32_t insn; | ||
66 | bool is_16bit; | ||
67 | |||
68 | + /* Misaligned thumb PC is architecturally impossible. */ | ||
69 | + assert((dc->base.pc_next & 1) == 0); | ||
70 | + | ||
71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
72 | dc->base.pc_next = pc + 2; | ||
73 | return; | ||
50 | -- | 74 | -- |
51 | 2.20.1 | 75 | 2.25.1 |
52 | 76 | ||
53 | 77 | diff view generated by jsdifflib |
1 | KVM cannot support multiple address spaces per CPU; if you try to | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | create more than one then cpu_address_space_init() will assert. | ||
3 | 2 | ||
4 | In the Arm CPU realize function, detect the configurations which | 3 | Both single-step and pc alignment faults have priority over |
5 | would cause us to need more than one AS, and cleanly fail the | 4 | breakpoint exceptions. |
6 | realize rather than blundering on into the assertion. This | ||
7 | turns this: | ||
8 | $ qemu-system-aarch64 -enable-kvm -display none -cpu max -machine raspi3b | ||
9 | qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed. | ||
10 | Aborted | ||
11 | 5 | ||
12 | into: | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | $ qemu-system-aarch64 -enable-kvm -display none -machine raspi3b | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled | ||
15 | |||
16 | and this: | ||
17 | $ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524 | ||
18 | qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed. | ||
19 | Aborted | ||
20 | |||
21 | into: | ||
22 | $ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524 | ||
23 | qemu-system-aarch64: Cannot enable KVM when using an M-profile guest CPU | ||
24 | |||
25 | Fixes: https://gitlab.com/qemu-project/qemu/-/issues/528 | ||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
29 | Message-id: 20210816135842.25302-3-peter.maydell@linaro.org | ||
30 | --- | 9 | --- |
31 | target/arm/cpu.c | 23 +++++++++++++++++++++++ | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
32 | 1 file changed, 23 insertions(+) | 11 | 1 file changed, 23 insertions(+) |
33 | 12 | ||
34 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
35 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu.c | 15 | --- a/target/arm/debug_helper.c |
37 | +++ b/target/arm/cpu.c | 16 | +++ b/target/arm/debug_helper.c |
38 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
39 | } | 18 | { |
19 | ARMCPU *cpu = ARM_CPU(cs); | ||
20 | CPUARMState *env = &cpu->env; | ||
21 | + target_ulong pc; | ||
22 | int n; | ||
23 | |||
24 | /* | ||
25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | ||
26 | return false; | ||
40 | } | 27 | } |
41 | 28 | ||
42 | + if (kvm_enabled()) { | 29 | + /* |
43 | + /* | 30 | + * Single-step exceptions have priority over breakpoint exceptions. |
44 | + * Catch all the cases which might cause us to create more than one | 31 | + * If single-step state is active-pending, suppress the bp. |
45 | + * address space for the CPU (otherwise we will assert() later in | 32 | + */ |
46 | + * cpu_address_space_init()). | 33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { |
47 | + */ | 34 | + return false; |
48 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
49 | + error_setg(errp, | ||
50 | + "Cannot enable KVM when using an M-profile guest CPU"); | ||
51 | + return; | ||
52 | + } | ||
53 | + if (cpu->has_el3) { | ||
54 | + error_setg(errp, | ||
55 | + "Cannot enable KVM when guest CPU has EL3 enabled"); | ||
56 | + return; | ||
57 | + } | ||
58 | + if (cpu->tag_memory) { | ||
59 | + error_setg(errp, | ||
60 | + "Cannot enable KVM when guest CPUs has MTE enabled"); | ||
61 | + return; | ||
62 | + } | ||
63 | + } | 35 | + } |
64 | + | 36 | + |
65 | { | 37 | + /* |
66 | uint64_t scale; | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
67 | 39 | + */ | |
40 | + pc = is_a64(env) ? env->pc : env->regs[15]; | ||
41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { | ||
42 | + return false; | ||
43 | + } | ||
44 | + | ||
45 | + /* | ||
46 | + * Instruction aborts have priority over breakpoint exceptions. | ||
47 | + * TODO: We would need to look up the page for PC and verify that | ||
48 | + * it is present and executable. | ||
49 | + */ | ||
50 | + | ||
51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { | ||
52 | if (bp_wp_matches(cpu, n, false)) { | ||
53 | return true; | ||
68 | -- | 54 | -- |
69 | 2.20.1 | 55 | 2.25.1 |
70 | 56 | ||
71 | 57 | diff view generated by jsdifflib |
1 | Convert the acpi memory hotplug spec to rST. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Note that this includes converting a lot of weird whitespace | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | characters to plain old spaces (the rST parser does not like | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | whatever the old ones were). | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | ||
7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ | ||
8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ | ||
9 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
10 | tests/tcg/arm/Makefile.target | 4 +++ | ||
11 | 4 files changed, 89 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
13 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
6 | 14 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
8 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
9 | Message-id: 20210727170414.3368-3-peter.maydell@linaro.org | ||
10 | --- | ||
11 | docs/specs/acpi_mem_hotplug.rst | 128 ++++++++++++++++++++++++++++++++ | ||
12 | docs/specs/acpi_mem_hotplug.txt | 94 ----------------------- | ||
13 | docs/specs/index.rst | 1 + | ||
14 | 3 files changed, 129 insertions(+), 94 deletions(-) | ||
15 | create mode 100644 docs/specs/acpi_mem_hotplug.rst | ||
16 | delete mode 100644 docs/specs/acpi_mem_hotplug.txt | ||
17 | |||
18 | diff --git a/docs/specs/acpi_mem_hotplug.rst b/docs/specs/acpi_mem_hotplug.rst | ||
19 | new file mode 100644 | 16 | new file mode 100644 |
20 | index XXXXXXX..XXXXXXX | 17 | index XXXXXXX..XXXXXXX |
21 | --- /dev/null | 18 | --- /dev/null |
22 | +++ b/docs/specs/acpi_mem_hotplug.rst | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
23 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
24 | +QEMU<->ACPI BIOS memory hotplug interface | 21 | +/* Test PC misalignment exception */ |
25 | +========================================= | ||
26 | + | 22 | + |
27 | +ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add | 23 | +#include <assert.h> |
28 | +and hot-remove events. | 24 | +#include <signal.h> |
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
29 | + | 27 | + |
30 | +Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access) | 28 | +static void *expected; |
31 | +---------------------------------------------------------------- | ||
32 | + | 29 | + |
33 | +Read access behavior | 30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
34 | +^^^^^^^^^^^^^^^^^^^^ | 31 | +{ |
32 | + assert(info->si_code == BUS_ADRALN); | ||
33 | + assert(info->si_addr == expected); | ||
34 | + exit(EXIT_SUCCESS); | ||
35 | +} | ||
35 | + | 36 | + |
36 | +[0x0-0x3] | 37 | +int main() |
37 | + Lo part of memory device phys address | 38 | +{ |
38 | +[0x4-0x7] | 39 | + void *tmp; |
39 | + Hi part of memory device phys address | ||
40 | +[0x8-0xb] | ||
41 | + Lo part of memory device size in bytes | ||
42 | +[0xc-0xf] | ||
43 | + Hi part of memory device size in bytes | ||
44 | +[0x10-0x13] | ||
45 | + Memory device proximity domain | ||
46 | +[0x14] | ||
47 | + Memory device status fields | ||
48 | + | 40 | + |
49 | + bits: | 41 | + struct sigaction sa = { |
42 | + .sa_sigaction = sigbus, | ||
43 | + .sa_flags = SA_SIGINFO | ||
44 | + }; | ||
50 | + | 45 | + |
51 | + 0: | 46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
52 | + Device is enabled and may be used by guest | 47 | + perror("sigaction"); |
53 | + 1: | 48 | + return EXIT_FAILURE; |
54 | + Device insert event, used to distinguish device for which | 49 | + } |
55 | + no device check event to OSPM was issued. | ||
56 | + It's valid only when bit 1 is set. | ||
57 | + 2: | ||
58 | + Device remove event, used to distinguish device for which | ||
59 | + no device eject request to OSPM was issued. | ||
60 | + 3-7: | ||
61 | + reserved and should be ignored by OSPM | ||
62 | + | 50 | + |
63 | +[0x15-0x17] | 51 | + asm volatile("adr %0, 1f + 1\n\t" |
64 | + reserved | 52 | + "str %0, %1\n\t" |
53 | + "br %0\n" | ||
54 | + "1:" | ||
55 | + : "=&r"(tmp), "=m"(expected)); | ||
56 | + abort(); | ||
57 | +} | ||
58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/tests/tcg/arm/pcalign-a32.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* Test PC misalignment exception */ | ||
65 | + | 65 | + |
66 | +Write access behavior | 66 | +#ifdef __thumb__ |
67 | +^^^^^^^^^^^^^^^^^^^^^ | 67 | +#error "This test must be compiled for ARM" |
68 | +#endif | ||
68 | + | 69 | + |
70 | +#include <assert.h> | ||
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
69 | + | 74 | + |
70 | +[0x0-0x3] | 75 | +static void *expected; |
71 | + Memory device slot selector, selects active memory device. | ||
72 | + All following accesses to other registers in 0xa00-0xa17 | ||
73 | + region will read/store data from/to selected memory device. | ||
74 | +[0x4-0x7] | ||
75 | + OST event code reported by OSPM | ||
76 | +[0x8-0xb] | ||
77 | + OST status code reported by OSPM | ||
78 | +[0xc-0x13] | ||
79 | + reserved, writes into it are ignored | ||
80 | +[0x14] | ||
81 | + Memory device control fields | ||
82 | + | 76 | + |
83 | + bits: | 77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
78 | +{ | ||
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | ||
84 | + | 83 | + |
85 | + 0: | 84 | +int main() |
86 | + reserved, OSPM must clear it before writing to register. | 85 | +{ |
87 | + Due to BUG in versions prior 2.4 that field isn't cleared | 86 | + void *tmp; |
88 | + when other fields are written. Keep it reserved and don't | ||
89 | + try to reuse it. | ||
90 | + 1: | ||
91 | + if set to 1 clears device insert event, set by OSPM | ||
92 | + after it has emitted device check event for the | ||
93 | + selected memory device | ||
94 | + 2: | ||
95 | + if set to 1 clears device remove event, set by OSPM | ||
96 | + after it has emitted device eject request for the | ||
97 | + selected memory device | ||
98 | + 3: | ||
99 | + if set to 1 initiates device eject, set by OSPM when it | ||
100 | + triggers memory device removal and calls _EJ0 method | ||
101 | + 4-7: | ||
102 | + reserved, OSPM must clear them before writing to register | ||
103 | + | 87 | + |
104 | +Selecting memory device slot beyond present range has no effect on platform: | 88 | + struct sigaction sa = { |
89 | + .sa_sigaction = sigbus, | ||
90 | + .sa_flags = SA_SIGINFO | ||
91 | + }; | ||
105 | + | 92 | + |
106 | +- write accesses to memory hot-plug registers not documented above are ignored | 93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
107 | +- read accesses to memory hot-plug registers not documented above return | 94 | + perror("sigaction"); |
108 | + all bits set to 1. | 95 | + return EXIT_FAILURE; |
96 | + } | ||
109 | + | 97 | + |
110 | +Memory hot remove process diagram | 98 | + asm volatile("adr %0, 1f + 2\n\t" |
111 | +--------------------------------- | 99 | + "str %0, %1\n\t" |
100 | + "bx %0\n" | ||
101 | + "1:" | ||
102 | + : "=&r"(tmp), "=m"(expected)); | ||
112 | + | 103 | + |
113 | +:: | 104 | + /* |
105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns | ||
106 | + * the address or not. If so, we can legitimately fall through. | ||
107 | + */ | ||
108 | + return EXIT_SUCCESS; | ||
109 | +} | ||
110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/tcg/aarch64/Makefile.target | ||
113 | +++ b/tests/tcg/aarch64/Makefile.target | ||
114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) | ||
115 | AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 | ||
116 | VPATH += $(AARCH64_SRC) | ||
117 | |||
118 | -# Float-convert Tests | ||
119 | -AARCH64_TESTS=fcvt | ||
120 | +# Base architecture tests | ||
121 | +AARCH64_TESTS=fcvt pcalign-a64 | ||
122 | |||
123 | fcvt: LDFLAGS+=-lm | ||
124 | |||
125 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/tests/tcg/arm/Makefile.target | ||
128 | +++ b/tests/tcg/arm/Makefile.target | ||
129 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
130 | $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") | ||
131 | $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) | ||
132 | |||
133 | +# PC alignment test | ||
134 | +ARM_TESTS += pcalign-a32 | ||
135 | +pcalign-a32: CFLAGS+=-marm | ||
114 | + | 136 | + |
115 | + +-------------+ +-----------------------+ +------------------+ | 137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) |
116 | + | 1. QEMU | | 2. QEMU | |3. QEMU | | 138 | |
117 | + | device_del +---->+ device unplug request +----->+Send SCI to guest,| | 139 | # Semihosting smoke test for linux-user |
118 | + | | | cb | |return control to | | ||
119 | + | | | | |management | | ||
120 | + +-------------+ +-----------------------+ +------------------+ | ||
121 | + | ||
122 | + +---------------------------------------------------------------------+ | ||
123 | + | ||
124 | + +---------------------+ +-------------------------+ | ||
125 | + | OSPM: | remove event | OSPM: | | ||
126 | + | send Eject Request, | | Scan memory devices | | ||
127 | + | clear remove event +<-------------+ for event flags | | ||
128 | + | | | | | ||
129 | + +---------------------+ +-------------------------+ | ||
130 | + | | ||
131 | + | | ||
132 | + +---------v--------+ +-----------------------+ | ||
133 | + | Guest OS: | success | OSPM: | | ||
134 | + | process Ejection +----------->+ Execute _EJ0 method, | | ||
135 | + | request | | set eject bit in flags| | ||
136 | + +------------------+ +-----------------------+ | ||
137 | + |failure | | ||
138 | + v v | ||
139 | + +------------------------+ +-----------------------+ | ||
140 | + | OSPM: | | QEMU: | | ||
141 | + | set OST event & status | | call device unplug cb | | ||
142 | + | fields | | | | ||
143 | + +------------------------+ +-----------------------+ | ||
144 | + | | | ||
145 | + v v | ||
146 | + +------------------+ +-------------------+ | ||
147 | + |QEMU: | |QEMU: | | ||
148 | + |Send OST QMP event| |Send device deleted| | ||
149 | + | | |QMP event | | ||
150 | + +------------------+ | | | ||
151 | + +-------------------+ | ||
152 | diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt | ||
153 | deleted file mode 100644 | ||
154 | index XXXXXXX..XXXXXXX | ||
155 | --- a/docs/specs/acpi_mem_hotplug.txt | ||
156 | +++ /dev/null | ||
157 | @@ -XXX,XX +XXX,XX @@ | ||
158 | -QEMU<->ACPI BIOS memory hotplug interface | ||
159 | --------------------------------------- | ||
160 | - | ||
161 | -ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add | ||
162 | -and hot-remove events. | ||
163 | - | ||
164 | -Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): | ||
165 | ---------------------------------------------------------------- | ||
166 | -0xa00: | ||
167 | - read access: | ||
168 | - [0x0-0x3] Lo part of memory device phys address | ||
169 | - [0x4-0x7] Hi part of memory device phys address | ||
170 | - [0x8-0xb] Lo part of memory device size in bytes | ||
171 | - [0xc-0xf] Hi part of memory device size in bytes | ||
172 | - [0x10-0x13] Memory device proximity domain | ||
173 | - [0x14] Memory device status fields | ||
174 | - bits: | ||
175 | - 0: Device is enabled and may be used by guest | ||
176 | - 1: Device insert event, used to distinguish device for which | ||
177 | - no device check event to OSPM was issued. | ||
178 | - It's valid only when bit 1 is set. | ||
179 | - 2: Device remove event, used to distinguish device for which | ||
180 | - no device eject request to OSPM was issued. | ||
181 | - 3-7: reserved and should be ignored by OSPM | ||
182 | - [0x15-0x17] reserved | ||
183 | - | ||
184 | - write access: | ||
185 | - [0x0-0x3] Memory device slot selector, selects active memory device. | ||
186 | - All following accesses to other registers in 0xa00-0xa17 | ||
187 | - region will read/store data from/to selected memory device. | ||
188 | - [0x4-0x7] OST event code reported by OSPM | ||
189 | - [0x8-0xb] OST status code reported by OSPM | ||
190 | - [0xc-0x13] reserved, writes into it are ignored | ||
191 | - [0x14] Memory device control fields | ||
192 | - bits: | ||
193 | - 0: reserved, OSPM must clear it before writing to register. | ||
194 | - Due to BUG in versions prior 2.4 that field isn't cleared | ||
195 | - when other fields are written. Keep it reserved and don't | ||
196 | - try to reuse it. | ||
197 | - 1: if set to 1 clears device insert event, set by OSPM | ||
198 | - after it has emitted device check event for the | ||
199 | - selected memory device | ||
200 | - 2: if set to 1 clears device remove event, set by OSPM | ||
201 | - after it has emitted device eject request for the | ||
202 | - selected memory device | ||
203 | - 3: if set to 1 initiates device eject, set by OSPM when it | ||
204 | - triggers memory device removal and calls _EJ0 method | ||
205 | - 4-7: reserved, OSPM must clear them before writing to register | ||
206 | - | ||
207 | -Selecting memory device slot beyond present range has no effect on platform: | ||
208 | - - write accesses to memory hot-plug registers not documented above are | ||
209 | - ignored | ||
210 | - - read accesses to memory hot-plug registers not documented above return | ||
211 | - all bits set to 1. | ||
212 | - | ||
213 | -Memory hot remove process diagram: | ||
214 | ----------------------------------- | ||
215 | - +-------------+ +-----------------------+ +------------------+ | ||
216 | - | 1. QEMU | | 2. QEMU | |3. QEMU | | ||
217 | - | device_del +---->+ device unplug request +----->+Send SCI to guest,| | ||
218 | - | | | cb | |return control to | | ||
219 | - +-------------+ +-----------------------+ |management | | ||
220 | - +------------------+ | ||
221 | - | ||
222 | - +---------------------------------------------------------------------+ | ||
223 | - | ||
224 | - +---------------------+ +-------------------------+ | ||
225 | - | OSPM: | remove event | OSPM: | | ||
226 | - | send Eject Request, | | Scan memory devices | | ||
227 | - | clear remove event +<-------------+ for event flags | | ||
228 | - | | | | | ||
229 | - +---------------------+ +-------------------------+ | ||
230 | - | | ||
231 | - | | ||
232 | - +---------v--------+ +-----------------------+ | ||
233 | - | Guest OS: | success | OSPM: | | ||
234 | - | process Ejection +----------->+ Execute _EJ0 method, | | ||
235 | - | request | | set eject bit in flags| | ||
236 | - +------------------+ +-----------------------+ | ||
237 | - |failure | | ||
238 | - v v | ||
239 | - +------------------------+ +-----------------------+ | ||
240 | - | OSPM: | | QEMU: | | ||
241 | - | set OST event & status | | call device unplug cb | | ||
242 | - | fields | | | | ||
243 | - +------------------------+ +-----------------------+ | ||
244 | - | | | ||
245 | - v v | ||
246 | - +------------------+ +-------------------+ | ||
247 | - |QEMU: | |QEMU: | | ||
248 | - |Send OST QMP event| |Send device deleted| | ||
249 | - | | |QMP event | | ||
250 | - +------------------+ | | | ||
251 | - +-------------------+ | ||
252 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
253 | index XXXXXXX..XXXXXXX 100644 | ||
254 | --- a/docs/specs/index.rst | ||
255 | +++ b/docs/specs/index.rst | ||
256 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | ||
257 | tpm | ||
258 | acpi_hest_ghes | ||
259 | acpi_cpu_hotplug | ||
260 | + acpi_mem_hotplug | ||
261 | -- | 140 | -- |
262 | 2.20.1 | 141 | 2.25.1 |
263 | 142 | ||
264 | 143 | diff view generated by jsdifflib |
1 | The QEMU_ARCH_VIRTIO_* defines are used only in one file, | 1 | In the SSE decode function gen_sse(), we combine a byte |
---|---|---|---|
2 | qdev-monitor.c. Move them to that file. | 2 | 'b' and a value 'b1' which can be [0..3], and switch on them: |
3 | b |= (b1 << 8); | ||
4 | switch (b) { | ||
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
3 | 11 | ||
12 | In three cases inside this switch, we were then also checking for | ||
13 | "if (b1 >= 2) { goto unknown_op; }". | ||
14 | However, this can never happen, because the 'case' values in each place | ||
15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) | ||
16 | cases to the default already. | ||
17 | |||
18 | This check was added in commit c045af25a52e9 in 2010; the added code | ||
19 | was unnecessary then as well, and was apparently intended only to | ||
20 | ensure that we never accidentally ended up indexing off the end | ||
21 | of an sse_op_table with only 2 entries as a result of future bugs | ||
22 | in the decode logic. | ||
23 | |||
24 | Change the checks to assert() instead, and make sure they're always | ||
25 | immediately before the array access they are protecting. | ||
26 | |||
27 | Fixes: Coverity CID 1460207 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
7 | Message-id: 20210730105947.28215-7-peter.maydell@linaro.org | ||
8 | --- | 30 | --- |
9 | include/sysemu/arch_init.h | 9 --------- | 31 | target/i386/tcg/translate.c | 12 +++--------- |
10 | softmmu/qdev-monitor.c | 9 +++++++++ | 32 | 1 file changed, 3 insertions(+), 9 deletions(-) |
11 | 2 files changed, 9 insertions(+), 9 deletions(-) | ||
12 | 33 | ||
13 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c |
14 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/sysemu/arch_init.h | 36 | --- a/target/i386/tcg/translate.c |
16 | +++ b/include/sysemu/arch_init.h | 37 | +++ b/target/i386/tcg/translate.c |
17 | @@ -XXX,XX +XXX,XX @@ enum { | 38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
18 | 39 | case 0x171: /* shift xmm, im */ | |
19 | extern const uint32_t arch_type; | 40 | case 0x172: |
20 | 41 | case 0x173: | |
21 | -/* default virtio transport per architecture */ | 42 | - if (b1 >= 2) { |
22 | -#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 43 | - goto unknown_op; |
23 | - QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | 44 | - } |
24 | - QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ | 45 | val = x86_ldub_code(env, s); |
25 | - QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ | 46 | if (is_xmm) { |
26 | - QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) | 47 | tcg_gen_movi_tl(s->T0, val); |
27 | -#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
28 | -#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) | 49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); |
29 | - | 50 | op1_offset = offsetof(CPUX86State,mmx_t0); |
30 | #endif | 51 | } |
31 | diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c | 52 | + assert(b1 < 2); |
32 | index XXXXXXX..XXXXXXX 100644 | 53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + |
33 | --- a/softmmu/qdev-monitor.c | 54 | (((modrm >> 3)) & 7)][b1]; |
34 | +++ b/softmmu/qdev-monitor.c | 55 | if (!sse_fn_epp) { |
35 | @@ -XXX,XX +XXX,XX @@ typedef struct QDevAlias | 56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
36 | uint32_t arch_mask; | 57 | rm = modrm & 7; |
37 | } QDevAlias; | 58 | reg = ((modrm >> 3) & 7) | REX_R(s); |
38 | 59 | mod = (modrm >> 6) & 3; | |
39 | +/* default virtio transport per architecture */ | 60 | - if (b1 >= 2) { |
40 | +#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 61 | - goto unknown_op; |
41 | + QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | 62 | - } |
42 | + QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ | 63 | |
43 | + QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ | 64 | + assert(b1 < 2); |
44 | + QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) | 65 | sse_fn_epp = sse_op_table6[b].op[b1]; |
45 | +#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) | 66 | if (!sse_fn_epp) { |
46 | +#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) | 67 | goto unknown_op; |
47 | + | 68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
48 | /* Please keep this table sorted by typename. */ | 69 | rm = modrm & 7; |
49 | static const QDevAlias qdev_alias_table[] = { | 70 | reg = ((modrm >> 3) & 7) | REX_R(s); |
50 | { "AC97", "ac97" }, /* -soundhw name */ | 71 | mod = (modrm >> 6) & 3; |
72 | - if (b1 >= 2) { | ||
73 | - goto unknown_op; | ||
74 | - } | ||
75 | |||
76 | + assert(b1 < 2); | ||
77 | sse_fn_eppi = sse_op_table7[b].op[b1]; | ||
78 | if (!sse_fn_eppi) { | ||
79 | goto unknown_op; | ||
51 | -- | 80 | -- |
52 | 2.20.1 | 81 | 2.25.1 |
53 | 82 | ||
54 | 83 | diff view generated by jsdifflib |
1 | The kvm_available() function reports whether KVM support was | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | compiled into the QEMU binary; it returns the value of the | 2 | other header files, only from .c files (as documented in a comment at |
3 | CONFIG_KVM define. | 3 | the start of it). |
4 | 4 | ||
5 | The only place in the codebase where we use this function is | 5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. |
6 | in qmp_query_kvm(). Now that accelerators are based on QOM | 6 | In fact, the include is not required at all, so we can just drop it |
7 | classes we can instead use accel_find("kvm") and remove the | 7 | from both files. |
8 | kvm_available() function. | ||
9 | 8 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20210730105947.28215-3-peter.maydell@linaro.org | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | ||
13 | --- | 13 | --- |
14 | include/sysemu/arch_init.h | 2 -- | 14 | include/hw/i386/microvm.h | 1 - |
15 | monitor/qmp-cmds.c | 2 +- | 15 | include/hw/i386/x86.h | 1 - |
16 | softmmu/arch_init.c | 9 --------- | 16 | 2 files changed, 2 deletions(-) |
17 | 3 files changed, 1 insertion(+), 12 deletions(-) | ||
18 | 17 | ||
19 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h |
20 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/sysemu/arch_init.h | 20 | --- a/include/hw/i386/microvm.h |
22 | +++ b/include/sysemu/arch_init.h | 21 | +++ b/include/hw/i386/microvm.h |
23 | @@ -XXX,XX +XXX,XX @@ enum { | 22 | @@ -XXX,XX +XXX,XX @@ |
24 | 23 | #ifndef HW_I386_MICROVM_H | |
25 | extern const uint32_t arch_type; | 24 | #define HW_I386_MICROVM_H |
26 | 25 | ||
27 | -int kvm_available(void); | 26 | -#include "qemu-common.h" |
28 | - | 27 | #include "exec/hwaddr.h" |
29 | /* default virtio transport per architecture */ | 28 | #include "qemu/notify.h" |
30 | #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 29 | |
31 | QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | 30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h |
32 | diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/monitor/qmp-cmds.c | 32 | --- a/include/hw/i386/x86.h |
35 | +++ b/monitor/qmp-cmds.c | 33 | +++ b/include/hw/i386/x86.h |
36 | @@ -XXX,XX +XXX,XX @@ KvmInfo *qmp_query_kvm(Error **errp) | 34 | @@ -XXX,XX +XXX,XX @@ |
37 | KvmInfo *info = g_malloc0(sizeof(*info)); | 35 | #ifndef HW_I386_X86_H |
38 | 36 | #define HW_I386_X86_H | |
39 | info->enabled = kvm_enabled(); | 37 | |
40 | - info->present = kvm_available(); | 38 | -#include "qemu-common.h" |
41 | + info->present = accel_find("kvm"); | 39 | #include "exec/hwaddr.h" |
42 | 40 | #include "qemu/notify.h" | |
43 | return info; | 41 | |
44 | } | ||
45 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/softmmu/arch_init.c | ||
48 | +++ b/softmmu/arch_init.c | ||
49 | @@ -XXX,XX +XXX,XX @@ int graphic_depth = 32; | ||
50 | #endif | ||
51 | |||
52 | const uint32_t arch_type = QEMU_ARCH; | ||
53 | - | ||
54 | -int kvm_available(void) | ||
55 | -{ | ||
56 | -#ifdef CONFIG_KVM | ||
57 | - return 1; | ||
58 | -#else | ||
59 | - return 0; | ||
60 | -#endif | ||
61 | -} | ||
62 | -- | 42 | -- |
63 | 2.20.1 | 43 | 2.25.1 |
64 | 44 | ||
65 | 45 | diff view generated by jsdifflib |
1 | The xen_available() function is used only to produce an error | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | for some Xen-specific command line options in QEMU binaries where | 2 | other header files, only from .c files (as documented in a comment at |
3 | Xen support was not compiled in: it just returns the value of | 3 | the start of it). |
4 | the CONFIG_XEN define. | ||
5 | 4 | ||
6 | Now that accelerators are QOM classes, we can check for | 5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for |
7 | "does this binary have Xen compiled in" with accel_find("xen"), | 6 | the declaration of cpu_exec_step_atomic(). |
8 | and drop the xen_available() function. | ||
9 | 7 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20210730105947.28215-2-peter.maydell@linaro.org | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
13 | --- | 13 | --- |
14 | include/sysemu/arch_init.h | 1 - | 14 | target/hexagon/cpu.h | 1 - |
15 | softmmu/arch_init.c | 9 --------- | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
16 | softmmu/vl.c | 6 +++--- | 16 | 2 files changed, 1 insertion(+), 1 deletion(-) |
17 | 3 files changed, 3 insertions(+), 13 deletions(-) | ||
18 | 17 | ||
19 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
20 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/sysemu/arch_init.h | 20 | --- a/target/hexagon/cpu.h |
22 | +++ b/include/sysemu/arch_init.h | 21 | +++ b/target/hexagon/cpu.h |
23 | @@ -XXX,XX +XXX,XX @@ enum { | 22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; |
24 | extern const uint32_t arch_type; | 23 | |
25 | 24 | #include "fpu/softfloat-types.h" | |
26 | int kvm_available(void); | 25 | |
27 | -int xen_available(void); | 26 | -#include "qemu-common.h" |
28 | 27 | #include "exec/cpu-defs.h" | |
29 | /* default virtio transport per architecture */ | 28 | #include "hex_regs.h" |
30 | #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 29 | #include "mmvec/mmvec.h" |
31 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | 30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c |
32 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/softmmu/arch_init.c | 32 | --- a/linux-user/hexagon/cpu_loop.c |
34 | +++ b/softmmu/arch_init.c | 33 | +++ b/linux-user/hexagon/cpu_loop.c |
35 | @@ -XXX,XX +XXX,XX @@ int kvm_available(void) | 34 | @@ -XXX,XX +XXX,XX @@ |
36 | return 0; | 35 | */ |
37 | #endif | 36 | |
38 | } | 37 | #include "qemu/osdep.h" |
39 | - | 38 | +#include "qemu-common.h" |
40 | -int xen_available(void) | 39 | #include "qemu.h" |
41 | -{ | 40 | #include "user-internals.h" |
42 | -#ifdef CONFIG_XEN | 41 | #include "cpu_loop-common.h" |
43 | - return 1; | ||
44 | -#else | ||
45 | - return 0; | ||
46 | -#endif | ||
47 | -} | ||
48 | diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/softmmu/vl.c | ||
51 | +++ b/softmmu/vl.c | ||
52 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv, char **envp) | ||
53 | has_defaults = 0; | ||
54 | break; | ||
55 | case QEMU_OPTION_xen_domid: | ||
56 | - if (!(xen_available())) { | ||
57 | + if (!(accel_find("xen"))) { | ||
58 | error_report("Option not supported for this target"); | ||
59 | exit(1); | ||
60 | } | ||
61 | xen_domid = atoi(optarg); | ||
62 | break; | ||
63 | case QEMU_OPTION_xen_attach: | ||
64 | - if (!(xen_available())) { | ||
65 | + if (!(accel_find("xen"))) { | ||
66 | error_report("Option not supported for this target"); | ||
67 | exit(1); | ||
68 | } | ||
69 | xen_mode = XEN_ATTACH; | ||
70 | break; | ||
71 | case QEMU_OPTION_xen_domid_restrict: | ||
72 | - if (!(xen_available())) { | ||
73 | + if (!(accel_find("xen"))) { | ||
74 | error_report("Option not supported for this target"); | ||
75 | exit(1); | ||
76 | } | ||
77 | -- | 42 | -- |
78 | 2.20.1 | 43 | 2.25.1 |
79 | 44 | ||
80 | 45 | diff view generated by jsdifflib |
1 | The SoC realize can fail for legitimate reasons, because it propagates | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | errors up from CPU realize, which in turn can be provoked by user | 2 | other header files, only from .c files (as documented in a comment at |
3 | error in setting commandline options. Use error_fatal so we report | 3 | the start of it). |
4 | the error message to the user and exit, rather than asserting | 4 | |
5 | via error_abort. | 5 | Nothing actually relies on target/rx/cpu.h including it, so we can |
6 | just drop the include. | ||
6 | 7 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Message-id: 20210816135842.25302-2-peter.maydell@linaro.org | 11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
12 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
13 | Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | hw/arm/raspi.c | 2 +- | 15 | target/rx/cpu.h | 1 - |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | 1 file changed, 1 deletion(-) |
14 | 17 | ||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 20 | --- a/target/rx/cpu.h |
18 | +++ b/hw/arm/raspi.c | 21 | +++ b/target/rx/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine) | 22 | @@ -XXX,XX +XXX,XX @@ |
20 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram)); | 23 | #define RX_CPU_H |
21 | object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev, | 24 | |
22 | &error_abort); | 25 | #include "qemu/bitops.h" |
23 | - qdev_realize(DEVICE(&s->soc), NULL, &error_abort); | 26 | -#include "qemu-common.h" |
24 | + qdev_realize(DEVICE(&s->soc), NULL, &error_fatal); | 27 | #include "hw/registerfields.h" |
25 | 28 | #include "cpu-qom.h" | |
26 | /* Create and plug in the SD cards */ | 29 | |
27 | di = drive_get_next(IF_SD); | ||
28 | -- | 30 | -- |
29 | 2.20.1 | 31 | 2.25.1 |
30 | 32 | ||
31 | 33 | diff view generated by jsdifflib |
1 | arch_init.c does very little but has a long list of #include lines. | 1 | A lot of C files in hw/arm include qemu-common.h when they don't |
---|---|---|---|
2 | Remove all the unnecessary ones. | 2 | need anything from it. Drop the include lines. |
3 | |||
4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they | ||
5 | use it for the prototype of qemu_get_timedate(). | ||
3 | 6 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210730105947.28215-4-peter.maydell@linaro.org | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org | ||
7 | --- | 13 | --- |
8 | softmmu/arch_init.c | 7 ------- | 14 | hw/arm/boot.c | 1 - |
9 | 1 file changed, 7 deletions(-) | 15 | hw/arm/digic_boards.c | 1 - |
16 | hw/arm/highbank.c | 1 - | ||
17 | hw/arm/npcm7xx_boards.c | 1 - | ||
18 | hw/arm/sbsa-ref.c | 1 - | ||
19 | hw/arm/stm32f405_soc.c | 1 - | ||
20 | hw/arm/vexpress.c | 1 - | ||
21 | hw/arm/virt.c | 1 - | ||
22 | 8 files changed, 8 deletions(-) | ||
10 | 23 | ||
11 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
12 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/softmmu/arch_init.c | 26 | --- a/hw/arm/boot.c |
14 | +++ b/softmmu/arch_init.c | 27 | +++ b/hw/arm/boot.c |
15 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
16 | */ | 29 | */ |
30 | |||
17 | #include "qemu/osdep.h" | 31 | #include "qemu/osdep.h" |
18 | #include "sysemu/arch_init.h" | 32 | -#include "qemu-common.h" |
19 | -#include "hw/pci/pci.h" | 33 | #include "qemu/datadir.h" |
20 | -#include "hw/audio/soundhw.h" | 34 | #include "qemu/error-report.h" |
21 | -#include "qapi/error.h" | 35 | #include "qapi/error.h" |
22 | -#include "qemu/config-file.h" | 36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c |
23 | -#include "qemu/error-report.h" | 37 | index XXXXXXX..XXXXXXX 100644 |
24 | -#include "hw/acpi/acpi.h" | 38 | --- a/hw/arm/digic_boards.c |
25 | -#include "qemu/help_option.h" | 39 | +++ b/hw/arm/digic_boards.c |
26 | 40 | @@ -XXX,XX +XXX,XX @@ | |
27 | #ifdef TARGET_SPARC | 41 | |
28 | int graphic_width = 1024; | 42 | #include "qemu/osdep.h" |
43 | #include "qapi/error.h" | ||
44 | -#include "qemu-common.h" | ||
45 | #include "qemu/datadir.h" | ||
46 | #include "hw/boards.h" | ||
47 | #include "qemu/error-report.h" | ||
48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
82 | #include "qapi/error.h" | ||
83 | #include "qemu/error-report.h" | ||
84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/arm/stm32f405_soc.c | ||
87 | +++ b/hw/arm/stm32f405_soc.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | |||
90 | #include "qemu/osdep.h" | ||
91 | #include "qapi/error.h" | ||
92 | -#include "qemu-common.h" | ||
93 | #include "exec/address-spaces.h" | ||
94 | #include "sysemu/sysemu.h" | ||
95 | #include "hw/arm/stm32f405_soc.h" | ||
96 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/hw/arm/vexpress.c | ||
99 | +++ b/hw/arm/vexpress.c | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | |||
102 | #include "qemu/osdep.h" | ||
103 | #include "qapi/error.h" | ||
104 | -#include "qemu-common.h" | ||
105 | #include "qemu/datadir.h" | ||
106 | #include "cpu.h" | ||
107 | #include "hw/sysbus.h" | ||
108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
109 | index XXXXXXX..XXXXXXX 100644 | ||
110 | --- a/hw/arm/virt.c | ||
111 | +++ b/hw/arm/virt.c | ||
112 | @@ -XXX,XX +XXX,XX @@ | ||
113 | */ | ||
114 | |||
115 | #include "qemu/osdep.h" | ||
116 | -#include "qemu-common.h" | ||
117 | #include "qemu/datadir.h" | ||
118 | #include "qemu/units.h" | ||
119 | #include "qemu/option.h" | ||
29 | -- | 120 | -- |
30 | 2.20.1 | 121 | 2.25.1 |
31 | 122 | ||
32 | 123 | diff view generated by jsdifflib |
1 | Currently we rely on all the callsites of cpsr_write() to rebuild the | 1 | The calculation of the length of TLB range invalidate operations |
---|---|---|---|
2 | cached hflags if they change one of the CPSR bits which we use as a | 2 | in tlbi_aa64_range_get_length() is incorrect in two ways: |
3 | TB flag and cache in hflags. This is a bit awkward when we want to | 3 | * the NUM field is 5 bits, but we read only 4 bits |
4 | change the set of CPSR bits that we cache, because it means we need | 4 | * we miscalculate the page_shift value, because of an |
5 | to re-audit all the cpsr_write() callsites to see which flags they | 5 | off-by-one error: |
6 | are writing and whether they now need to rebuild the hflags. | 6 | TG 0b00 is invalid |
7 | TG 0b01 is 4K granule size == 4096 == 2^12 | ||
8 | TG 0b10 is 16K granule size == 16384 == 2^14 | ||
9 | TG 0b11 is 64K granule size == 65536 == 2^16 | ||
10 | so page_shift should be (TG - 1) * 2 + 12 | ||
7 | 11 | ||
8 | Switch instead to making cpsr_write() call arm_rebuild_hflags() | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
9 | itself if one of the bits being changed is a cached bit. | 13 | both these errors. |
10 | 14 | ||
11 | We don't do the rebuild for the CPSRWriteRaw write type, because that | 15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") |
12 | kind of write is generally doing something special anyway. For the | 16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 |
13 | CPSRWriteRaw callsites in the KVM code and inbound migration we | ||
14 | definitely don't want to recalculate the hflags; the callsites in | ||
15 | boot.c and arm-powerctl.c have to do a rebuild-hflags call themselves | ||
16 | anyway because of other CPU state changes they make. | ||
17 | |||
18 | This allows us to drop explicit arm_rebuild_hflags() calls in a | ||
19 | couple of places where the only reason we needed to call it was the | ||
20 | CPSR write. | ||
21 | |||
22 | This fixes a bug where we were incorrectly failing to rebuild hflags | ||
23 | in the code path for a gdbstub write to CPSR, which meant that you | ||
24 | could make QEMU assert by breaking into a running guest, altering the | ||
25 | CPSR to change the value of, for example, CPSR.E, and then | ||
26 | continuing. | ||
27 | |||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
30 | Message-id: 20210817201843.3829-1-peter.maydell@linaro.org | 19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org | ||
31 | --- | 22 | --- |
32 | target/arm/cpu.h | 10 ++++++++-- | 23 | target/arm/helper.c | 6 +++--- |
33 | linux-user/arm/signal.c | 2 -- | 24 | 1 file changed, 3 insertions(+), 3 deletions(-) |
34 | target/arm/helper.c | 5 +++++ | ||
35 | 3 files changed, 13 insertions(+), 4 deletions(-) | ||
36 | 25 | ||
37 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/cpu.h | ||
40 | +++ b/target/arm/cpu.h | ||
41 | @@ -XXX,XX +XXX,XX @@ uint32_t cpsr_read(CPUARMState *env); | ||
42 | typedef enum CPSRWriteType { | ||
43 | CPSRWriteByInstr = 0, /* from guest MSR or CPS */ | ||
44 | CPSRWriteExceptionReturn = 1, /* from guest exception return insn */ | ||
45 | - CPSRWriteRaw = 2, /* trust values, do not switch reg banks */ | ||
46 | + CPSRWriteRaw = 2, | ||
47 | + /* trust values, no reg bank switch, no hflags rebuild */ | ||
48 | CPSRWriteByGDBStub = 3, /* from the GDB stub */ | ||
49 | } CPSRWriteType; | ||
50 | |||
51 | -/* Set the CPSR. Note that some bits of mask must be all-set or all-clear.*/ | ||
52 | +/* | ||
53 | + * Set the CPSR. Note that some bits of mask must be all-set or all-clear. | ||
54 | + * This will do an arm_rebuild_hflags() if any of the bits in @mask | ||
55 | + * correspond to TB flags bits cached in the hflags, unless @write_type | ||
56 | + * is CPSRWriteRaw. | ||
57 | + */ | ||
58 | void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | ||
59 | CPSRWriteType write_type); | ||
60 | |||
61 | diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/linux-user/arm/signal.c | ||
64 | +++ b/linux-user/arm/signal.c | ||
65 | @@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka, | ||
66 | env->regs[14] = retcode; | ||
67 | env->regs[15] = handler & (thumb ? ~1 : ~3); | ||
68 | cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr); | ||
69 | - arm_rebuild_hflags(env); | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | @@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) | ||
74 | __get_user(env->regs[15], &sc->arm_pc); | ||
75 | __get_user(cpsr, &sc->arm_cpsr); | ||
76 | cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr); | ||
77 | - arm_rebuild_hflags(env); | ||
78 | |||
79 | err |= !valid_user_regs(env); | ||
80 | |||
81 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 26 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
82 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
83 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
84 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
85 | @@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | 30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, |
86 | CPSRWriteType write_type) | 31 | uint64_t exponent; |
87 | { | 32 | uint64_t length; |
88 | uint32_t changed_daif; | 33 | |
89 | + bool rebuild_hflags = (write_type != CPSRWriteRaw) && | 34 | - num = extract64(value, 39, 4); |
90 | + (mask & (CPSR_M | CPSR_E | CPSR_IL)); | 35 | + num = extract64(value, 39, 5); |
91 | 36 | scale = extract64(value, 44, 2); | |
92 | if (mask & CPSR_NZCV) { | 37 | page_size_granule = extract64(value, 46, 2); |
93 | env->ZF = (~val) & CPSR_Z; | 38 | |
94 | @@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | 39 | - page_shift = page_size_granule * 2 + 12; |
40 | - | ||
41 | if (page_size_granule == 0) { | ||
42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", | ||
43 | page_size_granule); | ||
44 | return 0; | ||
95 | } | 45 | } |
96 | mask &= ~CACHED_CPSR_BITS; | 46 | |
97 | env->uncached_cpsr = (env->uncached_cpsr & ~mask) | (val & mask); | 47 | + page_shift = (page_size_granule - 1) * 2 + 12; |
98 | + if (rebuild_hflags) { | 48 | + |
99 | + arm_rebuild_hflags(env); | 49 | exponent = (5 * scale) + 1; |
100 | + } | 50 | length = (num + 1) << (exponent + page_shift); |
101 | } | 51 | |
102 | |||
103 | /* Sign/zero extend */ | ||
104 | -- | 52 | -- |
105 | 2.20.1 | 53 | 2.25.1 |
106 | 54 | ||
107 | 55 | diff view generated by jsdifflib |
1 | From: Tong Ho <tong.ho@xilinx.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Add unimplemented APU mmio region to xlnx-zynqmp for booting | 3 | The rx_active boolean change to true should always trigger a try_read |
4 | bare-metal guests built with standalone bsp, which access the | 4 | call that flushes the queue. |
5 | region from one of the following places: | ||
6 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139 | ||
7 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183 | ||
8 | 5 | ||
9 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Signed-off-by: Tong Ho <tong.ho@xilinx.com> | 8 | Message-id: 20211203221002.1719306-1-venture@google.com |
12 | Message-id: 20210823173818.201259-3-tong.ho@xilinx.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 10 | --- |
15 | include/hw/arm/xlnx-zynqmp.h | 7 +++++++ | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
16 | hw/arm/xlnx-zynqmp.c | 32 ++++++++++++++++++++++++++++++++ | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
17 | 2 files changed, 39 insertions(+) | ||
18 | 13 | ||
19 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/arm/xlnx-zynqmp.h | 16 | --- a/hw/net/npcm7xx_emc.c |
22 | +++ b/include/hw/arm/xlnx-zynqmp.h | 17 | +++ b/hw/net/npcm7xx_emc.c |
23 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
24 | #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ | 19 | emc_set_mista(emc, mista_flag); |
25 | XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) | ||
26 | |||
27 | +/* | ||
28 | + * Unimplemented mmio regions needed to boot some images. | ||
29 | + */ | ||
30 | +#define XLNX_ZYNQMP_NUM_UNIMP_AREAS 1 | ||
31 | + | ||
32 | struct XlnxZynqMPState { | ||
33 | /*< private >*/ | ||
34 | DeviceState parent_obj; | ||
35 | @@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState { | ||
36 | MemoryRegion *ddr_ram; | ||
37 | MemoryRegion ddr_ram_low, ddr_ram_high; | ||
38 | |||
39 | + MemoryRegion mr_unimp[XLNX_ZYNQMP_NUM_UNIMP_AREAS]; | ||
40 | + | ||
41 | CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; | ||
42 | CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS]; | ||
43 | XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN]; | ||
44 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/hw/arm/xlnx-zynqmp.c | ||
47 | +++ b/hw/arm/xlnx-zynqmp.c | ||
48 | @@ -XXX,XX +XXX,XX @@ | ||
49 | #include "qemu/module.h" | ||
50 | #include "hw/arm/xlnx-zynqmp.h" | ||
51 | #include "hw/intc/arm_gic_common.h" | ||
52 | +#include "hw/misc/unimp.h" | ||
53 | #include "hw/boards.h" | ||
54 | #include "sysemu/kvm.h" | ||
55 | #include "sysemu/sysemu.h" | ||
56 | @@ -XXX,XX +XXX,XX @@ | ||
57 | #define DPDMA_ADDR 0xfd4c0000 | ||
58 | #define DPDMA_IRQ 116 | ||
59 | |||
60 | +#define APU_ADDR 0xfd5c0000 | ||
61 | +#define APU_SIZE 0x100 | ||
62 | + | ||
63 | #define IPI_ADDR 0xFF300000 | ||
64 | #define IPI_IRQ 64 | ||
65 | |||
66 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s, | ||
67 | qdev_realize(DEVICE(&s->rpu_cluster), NULL, &error_fatal); | ||
68 | } | 20 | } |
69 | 21 | ||
70 | +static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s) | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
71 | +{ | 23 | +{ |
72 | + static const struct UnimpInfo { | 24 | + emc->rx_active = true; |
73 | + const char *name; | 25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); |
74 | + hwaddr base; | ||
75 | + hwaddr size; | ||
76 | + } unimp_areas[ARRAY_SIZE(s->mr_unimp)] = { | ||
77 | + { .name = "apu", APU_ADDR, APU_SIZE }, | ||
78 | + }; | ||
79 | + unsigned int nr; | ||
80 | + | ||
81 | + for (nr = 0; nr < ARRAY_SIZE(unimp_areas); nr++) { | ||
82 | + const struct UnimpInfo *info = &unimp_areas[nr]; | ||
83 | + DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE); | ||
84 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
85 | + | ||
86 | + assert(info->name && info->base && info->size > 0); | ||
87 | + qdev_prop_set_string(dev, "name", info->name); | ||
88 | + qdev_prop_set_uint64(dev, "size", info->size); | ||
89 | + object_property_add_child(OBJECT(s), info->name, OBJECT(dev)); | ||
90 | + | ||
91 | + sysbus_realize_and_unref(sbd, &error_fatal); | ||
92 | + sysbus_mmio_map(sbd, 0, info->base); | ||
93 | + } | ||
94 | +} | 26 | +} |
95 | + | 27 | + |
96 | static void xlnx_zynqmp_init(Object *obj) | 28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, |
29 | const NPCM7xxEMCTxDesc *tx_desc, | ||
30 | uint32_t desc_addr) | ||
31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) | ||
32 | return len; | ||
33 | } | ||
34 | |||
35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) | ||
36 | -{ | ||
37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { | ||
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
39 | - } | ||
40 | -} | ||
41 | - | ||
42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) | ||
97 | { | 43 | { |
98 | MachineState *ms = MACHINE(qdev_get_machine()); | 44 | NPCM7xxEMCState *emc = opaque; |
99 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
100 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, RTC_ADDR); | 46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; |
101 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, gic_spi[RTC_IRQ]); | 47 | } |
102 | 48 | if (value & REG_MCMDR_RXON) { | |
103 | + xlnx_zynqmp_create_unimp_mmio(s); | 49 | - emc->rx_active = true; |
104 | + | 50 | + emc_enable_rx_and_flush(emc); |
105 | for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { | 51 | } else { |
106 | if (!object_property_set_uint(OBJECT(&s->gdma[i]), "bus-width", 128, | 52 | emc_halt_rx(emc, 0); |
107 | errp)) { | 53 | } |
54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
55 | break; | ||
56 | case REG_RSDR: | ||
57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { | ||
58 | - emc->rx_active = true; | ||
59 | - emc_try_receive_next_packet(emc); | ||
60 | + emc_enable_rx_and_flush(emc); | ||
61 | } | ||
62 | break; | ||
63 | case REG_MIIDA: | ||
108 | -- | 64 | -- |
109 | 2.20.1 | 65 | 2.25.1 |
110 | 66 | ||
111 | 67 | diff view generated by jsdifflib |
1 | From: Ani Sinha <ani@anisinha.ca> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Since commit | 3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT |
4 | 36b79e3219d ("hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)"), | 4 | table. |
5 | ACPI_MEMORY_HOTPLUG and ACPI_NVDIMM is implicitly turned on when | ||
6 | ACPI_HW_REDUCED is selected. ACPI_HW_REDUCED is already enabled. No need to | ||
7 | turn on ACPI_MEMORY_HOTPLUG or ACPI_NVDIMM explicitly. This is a minor cleanup. | ||
8 | 5 | ||
9 | Signed-off-by: Ani Sinha <ani@anisinha.ca> | 6 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
11 | Message-id: 20210819162637.518507-1-ani@anisinha.ca | 8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 11 | --- |
14 | hw/arm/Kconfig | 2 -- | 12 | hw/arm/virt-acpi-build.c | 7 +++++++ |
15 | 1 file changed, 2 deletions(-) | 13 | hw/arm/Kconfig | 1 + |
14 | 2 files changed, 8 insertions(+) | ||
16 | 15 | ||
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/virt-acpi-build.c | ||
19 | +++ b/hw/arm/virt-acpi-build.c | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #include "kvm_arm.h" | ||
22 | #include "migration/vmstate.h" | ||
23 | #include "hw/acpi/ghes.h" | ||
24 | +#include "hw/acpi/viot.h" | ||
25 | |||
26 | #define ARM_SPI_BASE 32 | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { | ||
33 | + acpi_add_table(table_offsets, tables_blob); | ||
34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | ||
35 | + vms->oem_id, vms->oem_table_id); | ||
36 | + } | ||
37 | + | ||
38 | /* XSDT is pointed to by RSDP */ | ||
39 | xsdt = tables_blob->len; | ||
40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, | ||
17 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
18 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/Kconfig | 43 | --- a/hw/arm/Kconfig |
20 | +++ b/hw/arm/Kconfig | 44 | +++ b/hw/arm/Kconfig |
21 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | 45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
22 | select ACPI_PCI | ||
23 | select MEM_DEVICE | ||
24 | select DIMM | 46 | select DIMM |
25 | - select ACPI_MEMORY_HOTPLUG | ||
26 | select ACPI_HW_REDUCED | 47 | select ACPI_HW_REDUCED |
27 | - select ACPI_NVDIMM | ||
28 | select ACPI_APEI | 48 | select ACPI_APEI |
49 | + select ACPI_VIOT | ||
29 | 50 | ||
30 | config CHEETAH | 51 | config CHEETAH |
52 | bool | ||
31 | -- | 53 | -- |
32 | 2.20.1 | 54 | 2.25.1 |
33 | 55 | ||
34 | 56 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | If we link QOM object (a) as a property of QOM object (b), | 3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. |
4 | we must set the property *before* (b) is realized. | 4 | Remove the restriction that prevents from instantiating a virtio-iommu |
5 | device under ACPI. | ||
5 | 6 | ||
6 | Move QSPI realization *after* QSPI DMA. | 7 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
7 | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | |
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org |
10 | Message-id: 20210819163422.2863447-2-philmd@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 12 | --- |
13 | hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++++---------------------- | 13 | hw/arm/virt.c | 10 ++-------- |
14 | 1 file changed, 20 insertions(+), 22 deletions(-) | 14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | ||
15 | 16 | ||
16 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/xlnx-zynqmp.c | 19 | --- a/hw/arm/virt.c |
19 | +++ b/hw/arm/xlnx-zynqmp.c | 20 | +++ b/hw/arm/virt.c |
20 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
21 | g_free(bus_name); | 22 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
23 | |||
24 | if (device_is_dynamic_sysbus(mc, dev) || | ||
25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { | ||
26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | ||
27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | ||
28 | return HOTPLUG_HANDLER(machine); | ||
22 | } | 29 | } |
23 | 30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | |
24 | - if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) { | 31 | - VirtMachineState *vms = VIRT_MACHINE(machine); |
25 | - return; | 32 | - |
33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { | ||
34 | - return HOTPLUG_HANDLER(machine); | ||
35 | - } | ||
26 | - } | 36 | - } |
27 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR); | 37 | return NULL; |
28 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR); | 38 | } |
29 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]); | 39 | |
40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/virtio/virtio-iommu-pci.c | ||
43 | +++ b/hw/virtio/virtio-iommu-pci.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | ||
45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | ||
46 | |||
47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | ||
48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | ||
30 | - | 49 | - |
31 | - for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) { | 50 | - error_setg(errp, |
32 | - gchar *bus_name; | 51 | - "%s machine fails to create iommu-map device tree bindings", |
33 | - gchar *target_bus; | 52 | - mc->name); |
34 | - | 53 | - error_append_hint(errp, |
35 | - /* Alias controller SPI bus to the SoC itself */ | 54 | - "Check your machine implements a hotplug handler " |
36 | - bus_name = g_strdup_printf("qspi%d", i); | 55 | - "for the virtio-iommu-pci device\n"); |
37 | - target_bus = g_strdup_printf("spi%d", i); | 56 | - error_append_hint(errp, "Check the guest is booted without FW or with " |
38 | - object_property_add_alias(OBJECT(s), bus_name, | 57 | - "-no-acpi\n"); |
39 | - OBJECT(&s->qspi), target_bus); | 58 | + error_setg(errp, "Check your machine implements a hotplug handler " |
40 | - g_free(bus_name); | 59 | + "for the virtio-iommu-pci device"); |
41 | - g_free(target_bus); | ||
42 | - } | ||
43 | - | ||
44 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dp), errp)) { | ||
45 | return; | 60 | return; |
46 | } | 61 | } |
47 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 62 | for (int i = 0; i < s->nb_reserved_regions; i++) { |
48 | |||
49 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi_dma), 0, QSPI_DMA_ADDR); | ||
50 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi_dma), 0, gic_spi[QSPI_IRQ]); | ||
51 | - object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma", | ||
52 | - OBJECT(&s->qspi_dma), errp); | ||
53 | + | ||
54 | + if (!object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma", | ||
55 | + OBJECT(&s->qspi_dma), errp)) { | ||
56 | + return; | ||
57 | + } | ||
58 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) { | ||
59 | + return; | ||
60 | + } | ||
61 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR); | ||
62 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR); | ||
63 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]); | ||
64 | + | ||
65 | + for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) { | ||
66 | + g_autofree gchar *bus_name = g_strdup_printf("qspi%d", i); | ||
67 | + g_autofree gchar *target_bus = g_strdup_printf("spi%d", i); | ||
68 | + | ||
69 | + /* Alias controller SPI bus to the SoC itself */ | ||
70 | + object_property_add_alias(OBJECT(s), bus_name, | ||
71 | + OBJECT(&s->qspi), target_bus); | ||
72 | + } | ||
73 | } | ||
74 | |||
75 | static Property xlnx_zynqmp_props[] = { | ||
76 | -- | 63 | -- |
77 | 2.20.1 | 64 | 2.25.1 |
78 | 65 | ||
79 | 66 | diff view generated by jsdifflib |
1 | Add entries for the ACPI specs documents in docs/specs to | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | appropriate sections of MAINTAINERS. | ||
3 | 2 | ||
3 | We do not support instantiating multiple IOMMUs. Before adding a | ||
4 | virtio-iommu, check that no other IOMMU is present. This will detect | ||
5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. | ||
6 | |||
7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
6 | Message-id: 20210727170414.3368-6-peter.maydell@linaro.org | ||
7 | --- | 13 | --- |
8 | MAINTAINERS | 5 +++++ | 14 | hw/arm/virt.c | 5 +++++ |
9 | 1 file changed, 5 insertions(+) | 15 | 1 file changed, 5 insertions(+) |
10 | 16 | ||
11 | diff --git a/MAINTAINERS b/MAINTAINERS | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/MAINTAINERS | 19 | --- a/hw/arm/virt.c |
14 | +++ b/MAINTAINERS | 20 | +++ b/hw/arm/virt.c |
15 | @@ -XXX,XX +XXX,XX @@ F: qapi/acpi.json | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
16 | F: tests/qtest/bios-tables-test* | 22 | hwaddr db_start = 0, db_end = 0; |
17 | F: tests/qtest/acpi-utils.[hc] | 23 | char *resv_prop_str; |
18 | F: tests/data/acpi/ | 24 | |
19 | +F: docs/specs/acpi_cpu_hotplug.rst | 25 | + if (vms->iommu != VIRT_IOMMU_NONE) { |
20 | +F: docs/specs/acpi_mem_hotplug.rst | 26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); |
21 | +F: docs/specs/acpi_pci_hotplug.rst | 27 | + return; |
22 | +F: docs/specs/acpi_hw_reduced_hotplug.rst | 28 | + } |
23 | 29 | + | |
24 | ACPI/HEST/GHES | 30 | switch (vms->msi_controller) { |
25 | R: Dongjiu Geng <gengdongjiu1@gmail.com> | 31 | case VIRT_MSI_CTRL_NONE: |
26 | @@ -XXX,XX +XXX,XX @@ F: hw/acpi/nvdimm.c | 32 | return; |
27 | F: hw/mem/nvdimm.c | ||
28 | F: include/hw/mem/nvdimm.h | ||
29 | F: docs/nvdimm.txt | ||
30 | +F: docs/specs/acpi_nvdimm.rst | ||
31 | |||
32 | e1000x | ||
33 | M: Dmitry Fleytman <dmitry.fleytman@gmail.com> | ||
34 | -- | 33 | -- |
35 | 2.20.1 | 34 | 2.25.1 |
36 | 35 | ||
37 | 36 | diff view generated by jsdifflib |
1 | Now that the CPU realize function will fail cleanly if we ask for EL3 | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | when KVM is enabled, we don't need to check for errors explicitly in | ||
3 | the virt board code. The reported message is slightly different; | ||
4 | it is now: | ||
5 | qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled | ||
6 | instead of: | ||
7 | qemu-system-aarch64: mach-virt: KVM does not support Security extensions | ||
8 | 2 | ||
9 | We don't delete the MTE check because there the logic is more | 3 | To propagate errors to the caller of the pre_plug callback, use the |
10 | complex; deleting the check would work but makes the error message | 4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() |
11 | less helpful, as it would read: | 5 | helpers. |
12 | qemu-system-aarch64: MTE requested, but not supported by the guest CPU | ||
13 | instead of: | ||
14 | qemu-system-aarch64: mach-virt: KVM does not support providing MTE to the guest CPU | ||
15 | 6 | ||
7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-5-jean-philippe@linaro.org | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Message-id: 20210816135842.25302-4-peter.maydell@linaro.org | ||
20 | --- | 13 | --- |
21 | hw/arm/virt.c | 5 ----- | 14 | hw/arm/virt.c | 5 +++-- |
22 | 1 file changed, 5 deletions(-) | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
23 | 16 | ||
24 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
25 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/virt.c | 19 | --- a/hw/arm/virt.c |
27 | +++ b/hw/arm/virt.c | 20 | +++ b/hw/arm/virt.c |
28 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
22 | db_start, db_end, | ||
23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); | ||
24 | |||
25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); | ||
26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); | ||
27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); | ||
28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", | ||
29 | + resv_prop_str, errp); | ||
30 | g_free(resv_prop_str); | ||
29 | } | 31 | } |
30 | 32 | } | |
31 | if (vms->secure) { | ||
32 | - if (kvm_enabled()) { | ||
33 | - error_report("mach-virt: KVM does not support Security extensions"); | ||
34 | - exit(1); | ||
35 | - } | ||
36 | - | ||
37 | /* | ||
38 | * The Secure view of the world is the same as the NonSecure, | ||
39 | * but with a few extra devices. Create it as a container region | ||
40 | -- | 33 | -- |
41 | 2.20.1 | 34 | 2.25.1 |
42 | 35 | ||
43 | 36 | diff view generated by jsdifflib |
1 | Convert the ACPI NVDIMM spec document to rST. | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Create empty data files and allow updates for the upcoming VIOT tests. | ||
4 | |||
5 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
5 | Message-id: 20210727170414.3368-5-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | docs/specs/acpi_nvdimm.rst | 228 +++++++++++++++++++++++++++++++++++++ | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
8 | docs/specs/acpi_nvdimm.txt | 188 ------------------------------ | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
9 | docs/specs/index.rst | 1 + | 13 | tests/data/acpi/q35/VIOT.viot | 0 |
10 | 3 files changed, 229 insertions(+), 188 deletions(-) | 14 | tests/data/acpi/virt/VIOT | 0 |
11 | create mode 100644 docs/specs/acpi_nvdimm.rst | 15 | 4 files changed, 3 insertions(+) |
12 | delete mode 100644 docs/specs/acpi_nvdimm.txt | 16 | create mode 100644 tests/data/acpi/q35/DSDT.viot |
17 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
18 | create mode 100644 tests/data/acpi/virt/VIOT | ||
13 | 19 | ||
14 | diff --git a/docs/specs/acpi_nvdimm.rst b/docs/specs/acpi_nvdimm.rst | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
24 | @@ -1 +1,4 @@ | ||
25 | /* List of comma-separated changed AML files to ignore */ | ||
26 | +"tests/data/acpi/virt/VIOT", | ||
27 | +"tests/data/acpi/q35/DSDT.viot", | ||
28 | +"tests/data/acpi/q35/VIOT.viot", | ||
29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | ||
15 | new file mode 100644 | 30 | new file mode 100644 |
16 | index XXXXXXX..XXXXXXX | 31 | index XXXXXXX..XXXXXXX |
17 | --- /dev/null | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
18 | +++ b/docs/specs/acpi_nvdimm.rst | 33 | new file mode 100644 |
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | +QEMU<->ACPI BIOS NVDIMM interface | ||
21 | +================================= | ||
22 | + | ||
23 | +QEMU supports NVDIMM via ACPI. This document describes the basic concepts of | ||
24 | +NVDIMM ACPI and the interface between QEMU and the ACPI BIOS. | ||
25 | + | ||
26 | +NVDIMM ACPI Background | ||
27 | +---------------------- | ||
28 | + | ||
29 | +NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under | ||
30 | +_SB scope with a _HID of "ACPI0012". For each NVDIMM present or intended | ||
31 | +to be supported by platform, platform firmware also exposes an ACPI | ||
32 | +Namespace Device under the root device. | ||
33 | + | ||
34 | +The NVDIMM child devices under the NVDIMM root device are defined with _ADR | ||
35 | +corresponding to the NFIT device handle. The NVDIMM root device and the | ||
36 | +NVDIMM devices can have device specific methods (_DSM) to provide additional | ||
37 | +functions specific to a particular NVDIMM implementation. | ||
38 | + | ||
39 | +This is an example from ACPI 6.0, a platform contains one NVDIMM:: | ||
40 | + | ||
41 | + Scope (\_SB){ | ||
42 | + Device (NVDR) // Root device | ||
43 | + { | ||
44 | + Name (_HID, "ACPI0012") | ||
45 | + Method (_STA) {...} | ||
46 | + Method (_FIT) {...} | ||
47 | + Method (_DSM, ...) {...} | ||
48 | + Device (NVD) | ||
49 | + { | ||
50 | + Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM | ||
51 | + Method (_DSM, ...) {...} | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | +Methods supported on both NVDIMM root device and NVDIMM device | ||
57 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
58 | + | ||
59 | +_DSM (Device Specific Method) | ||
60 | + It is a control method that enables devices to provide device specific | ||
61 | + control functions that are consumed by the device driver. | ||
62 | + The NVDIMM DSM specification can be found at | ||
63 | + http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf | ||
64 | + | ||
65 | + Arguments: | ||
66 | + | ||
67 | + Arg0 | ||
68 | + A Buffer containing a UUID (16 Bytes) | ||
69 | + Arg1 | ||
70 | + An Integer containing the Revision ID (4 Bytes) | ||
71 | + Arg2 | ||
72 | + An Integer containing the Function Index (4 Bytes) | ||
73 | + Arg3 | ||
74 | + A package containing parameters for the function specified by the | ||
75 | + UUID, Revision ID, and Function Index | ||
76 | + | ||
77 | + Return Value: | ||
78 | + | ||
79 | + If Function Index = 0, a Buffer containing a function index bitfield. | ||
80 | + Otherwise, the return value and type depends on the UUID, revision ID | ||
81 | + and function index which are described in the DSM specification. | ||
82 | + | ||
83 | +Methods on NVDIMM ROOT Device | ||
84 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
85 | + | ||
86 | +_FIT(Firmware Interface Table) | ||
87 | + It evaluates to a buffer returning data in the format of a series of NFIT | ||
88 | + Type Structure. | ||
89 | + | ||
90 | + Arguments: None | ||
91 | + | ||
92 | + Return Value: | ||
93 | + A Buffer containing a list of NFIT Type structure entries. | ||
94 | + | ||
95 | + The detailed definition of the structure can be found at ACPI 6.0: 5.2.25 | ||
96 | + NVDIMM Firmware Interface Table (NFIT). | ||
97 | + | ||
98 | +QEMU NVDIMM Implementation | ||
99 | +-------------------------- | ||
100 | + | ||
101 | +QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page | ||
102 | +for NVDIMM ACPI. | ||
103 | + | ||
104 | +Memory: | ||
105 | + QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory | ||
106 | + page and dynamically patch its address into an int32 object named "MEMA" | ||
107 | + in ACPI. | ||
108 | + | ||
109 | + This page is RAM-based and it is used to transfer data between _DSM | ||
110 | + method and QEMU. If ACPI has control, this pages is owned by ACPI which | ||
111 | + writes _DSM input data to it, otherwise, it is owned by QEMU which | ||
112 | + emulates _DSM access and writes the output data to it. | ||
113 | + | ||
114 | + ACPI writes _DSM Input Data (based on the offset in the page): | ||
115 | + | ||
116 | + [0x0 - 0x3] | ||
117 | + 4 bytes, NVDIMM Device Handle. | ||
118 | + | ||
119 | + The handle is completely QEMU internal thing, the values in | ||
120 | + range [1, 0xFFFF] indicate nvdimm device. Other values are | ||
121 | + reserved for other purposes. | ||
122 | + | ||
123 | + Reserved handles: | ||
124 | + | ||
125 | + - 0 is reserved for nvdimm root device named NVDR. | ||
126 | + - 0x10000 is reserved for QEMU internal DSM function called on | ||
127 | + the root device. | ||
128 | + | ||
129 | + [0x4 - 0x7] | ||
130 | + 4 bytes, Revision ID, that is the Arg1 of _DSM method. | ||
131 | + | ||
132 | + [0x8 - 0xB] | ||
133 | + 4 bytes. Function Index, that is the Arg2 of _DSM method. | ||
134 | + | ||
135 | + [0xC - 0xFFF] | ||
136 | + 4084 bytes, the Arg3 of _DSM method. | ||
137 | + | ||
138 | + QEMU writes Output Data (based on the offset in the page): | ||
139 | + | ||
140 | + [0x0 - 0x3] | ||
141 | + 4 bytes, the length of result | ||
142 | + | ||
143 | + [0x4 - 0xFFF] | ||
144 | + 4092 bytes, the DSM result filled by QEMU | ||
145 | + | ||
146 | +IO Port 0x0a18 - 0xa1b: | ||
147 | + ACPI writes the address of the memory page allocated by BIOS to this | ||
148 | + port then QEMU gets the control and fills the result in the memory page. | ||
149 | + | ||
150 | + Write Access: | ||
151 | + | ||
152 | + [0x0a18 - 0xa1b] | ||
153 | + 4 bytes, the address of the memory page allocated by BIOS. | ||
154 | + | ||
155 | +_DSM process diagram | ||
156 | +-------------------- | ||
157 | + | ||
158 | +"MEMA" indicates the address of memory page allocated by BIOS. | ||
159 | + | ||
160 | +:: | ||
161 | + | ||
162 | + +----------------------+ +-----------------------+ | ||
163 | + | 1. OSPM | | 2. OSPM | | ||
164 | + | save _DSM input data | | write "MEMA" to | Exit to QEMU | ||
165 | + | to the page +----->| IO port 0x0a18 +------------+ | ||
166 | + | indicated by "MEMA" | | | | | ||
167 | + +----------------------+ +-----------------------+ | | ||
168 | + | | ||
169 | + v | ||
170 | + +--------------------+ +-----------+ +------------------+--------+ | ||
171 | + | 5 QEMU | | 4 QEMU | | 3. QEMU | | ||
172 | + | write _DSM result | | emulate | | get _DSM input data from | | ||
173 | + | to the page +<------+ _DSM +<-----+ the page indicated by the | | ||
174 | + | | | | | value from the IO port | | ||
175 | + +--------+-----------+ +-----------+ +---------------------------+ | ||
176 | + | | ||
177 | + | Enter Guest | ||
178 | + | | ||
179 | + v | ||
180 | + +--------------------------+ +--------------+ | ||
181 | + | 6 OSPM | | 7 OSPM | | ||
182 | + | result size is returned | | _DSM return | | ||
183 | + | by reading DSM +----->+ | | ||
184 | + | result from the page | | | | ||
185 | + +--------------------------+ +--------------+ | ||
186 | + | ||
187 | +NVDIMM hotplug | ||
188 | +-------------- | ||
189 | + | ||
190 | +ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device | ||
191 | +hot-add event. | ||
192 | + | ||
193 | +QEMU internal use only _DSM functions | ||
194 | +------------------------------------- | ||
195 | + | ||
196 | +Read FIT | ||
197 | +^^^^^^^^ | ||
198 | + | ||
199 | +_FIT method uses _DSM method to fetch NFIT structures blob from QEMU | ||
200 | +in 1 page sized increments which are then concatenated and returned | ||
201 | +as _FIT method result. | ||
202 | + | ||
203 | +Input parameters: | ||
204 | + | ||
205 | +Arg0 | ||
206 | + UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62} | ||
207 | +Arg1 | ||
208 | + Revision ID (set to 1) | ||
209 | +Arg2 | ||
210 | + Function Index, 0x1 | ||
211 | +Arg3 | ||
212 | + A package containing a buffer whose layout is as follows: | ||
213 | + | ||
214 | + +----------+--------+--------+-------------------------------------------+ | ||
215 | + | Field | Length | Offset | Description | | ||
216 | + +----------+--------+--------+-------------------------------------------+ | ||
217 | + | offset | 4 | 0 | offset in QEMU's NFIT structures blob to | | ||
218 | + | | | | read from | | ||
219 | + +----------+--------+--------+-------------------------------------------+ | ||
220 | + | ||
221 | +Output layout in the dsm memory page: | ||
222 | + | ||
223 | + +----------+--------+--------+-------------------------------------------+ | ||
224 | + | Field | Length | Offset | Description | | ||
225 | + +----------+--------+--------+-------------------------------------------+ | ||
226 | + | length | 4 | 0 | length of entire returned data | | ||
227 | + | | | | (including this header) | | ||
228 | + +----------+--------+--------+-------------------------------------------+ | ||
229 | + | | | | return status codes | | ||
230 | + | | | | | | ||
231 | + | | | | - 0x0 - success | | ||
232 | + | | | | - 0x100 - error caused by NFIT update | | ||
233 | + | status | 4 | 4 | while read by _FIT wasn't completed | | ||
234 | + | | | | - other codes follow Chapter 3 in | | ||
235 | + | | | | DSM Spec Rev1 | | ||
236 | + +----------+--------+--------+-------------------------------------------+ | ||
237 | + | fit data | Varies | 8 | contains FIT data. This field is present | | ||
238 | + | | | | if status field is 0. | | ||
239 | + +----------+--------+--------+-------------------------------------------+ | ||
240 | + | ||
241 | +The FIT offset is maintained by the OSPM itself, current offset plus | ||
242 | +the size of the fit data returned by the function is the next offset | ||
243 | +OSPM should read. When all FIT data has been read out, zero fit data | ||
244 | +size is returned. | ||
245 | + | ||
246 | +If it returns status code 0x100, OSPM should restart to read FIT (read | ||
247 | +from offset 0 again). | ||
248 | diff --git a/docs/specs/acpi_nvdimm.txt b/docs/specs/acpi_nvdimm.txt | ||
249 | deleted file mode 100644 | ||
250 | index XXXXXXX..XXXXXXX | 34 | index XXXXXXX..XXXXXXX |
251 | --- a/docs/specs/acpi_nvdimm.txt | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
252 | +++ /dev/null | 36 | new file mode 100644 |
253 | @@ -XXX,XX +XXX,XX @@ | 37 | index XXXXXXX..XXXXXXX |
254 | -QEMU<->ACPI BIOS NVDIMM interface | ||
255 | ---------------------------------- | ||
256 | - | ||
257 | -QEMU supports NVDIMM via ACPI. This document describes the basic concepts of | ||
258 | -NVDIMM ACPI and the interface between QEMU and the ACPI BIOS. | ||
259 | - | ||
260 | -NVDIMM ACPI Background | ||
261 | ----------------------- | ||
262 | -NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under | ||
263 | -_SB scope with a _HID of “ACPI0012”. For each NVDIMM present or intended | ||
264 | -to be supported by platform, platform firmware also exposes an ACPI | ||
265 | -Namespace Device under the root device. | ||
266 | - | ||
267 | -The NVDIMM child devices under the NVDIMM root device are defined with _ADR | ||
268 | -corresponding to the NFIT device handle. The NVDIMM root device and the | ||
269 | -NVDIMM devices can have device specific methods (_DSM) to provide additional | ||
270 | -functions specific to a particular NVDIMM implementation. | ||
271 | - | ||
272 | -This is an example from ACPI 6.0, a platform contains one NVDIMM: | ||
273 | - | ||
274 | -Scope (\_SB){ | ||
275 | - Device (NVDR) // Root device | ||
276 | - { | ||
277 | - Name (_HID, “ACPI0012”) | ||
278 | - Method (_STA) {...} | ||
279 | - Method (_FIT) {...} | ||
280 | - Method (_DSM, ...) {...} | ||
281 | - Device (NVD) | ||
282 | - { | ||
283 | - Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM | ||
284 | - Method (_DSM, ...) {...} | ||
285 | - } | ||
286 | - } | ||
287 | -} | ||
288 | - | ||
289 | -Method supported on both NVDIMM root device and NVDIMM device | ||
290 | -_DSM (Device Specific Method) | ||
291 | - It is a control method that enables devices to provide device specific | ||
292 | - control functions that are consumed by the device driver. | ||
293 | - The NVDIMM DSM specification can be found at: | ||
294 | - http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf | ||
295 | - | ||
296 | - Arguments: | ||
297 | - Arg0 – A Buffer containing a UUID (16 Bytes) | ||
298 | - Arg1 – An Integer containing the Revision ID (4 Bytes) | ||
299 | - Arg2 – An Integer containing the Function Index (4 Bytes) | ||
300 | - Arg3 – A package containing parameters for the function specified by the | ||
301 | - UUID, Revision ID, and Function Index | ||
302 | - | ||
303 | - Return Value: | ||
304 | - If Function Index = 0, a Buffer containing a function index bitfield. | ||
305 | - Otherwise, the return value and type depends on the UUID, revision ID | ||
306 | - and function index which are described in the DSM specification. | ||
307 | - | ||
308 | -Methods on NVDIMM ROOT Device | ||
309 | -_FIT(Firmware Interface Table) | ||
310 | - It evaluates to a buffer returning data in the format of a series of NFIT | ||
311 | - Type Structure. | ||
312 | - | ||
313 | - Arguments: None | ||
314 | - | ||
315 | - Return Value: | ||
316 | - A Buffer containing a list of NFIT Type structure entries. | ||
317 | - | ||
318 | - The detailed definition of the structure can be found at ACPI 6.0: 5.2.25 | ||
319 | - NVDIMM Firmware Interface Table (NFIT). | ||
320 | - | ||
321 | -QEMU NVDIMM Implementation | ||
322 | -========================== | ||
323 | -QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page | ||
324 | -for NVDIMM ACPI. | ||
325 | - | ||
326 | -Memory: | ||
327 | - QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory | ||
328 | - page and dynamically patch its address into an int32 object named "MEMA" | ||
329 | - in ACPI. | ||
330 | - | ||
331 | - This page is RAM-based and it is used to transfer data between _DSM | ||
332 | - method and QEMU. If ACPI has control, this pages is owned by ACPI which | ||
333 | - writes _DSM input data to it, otherwise, it is owned by QEMU which | ||
334 | - emulates _DSM access and writes the output data to it. | ||
335 | - | ||
336 | - ACPI writes _DSM Input Data (based on the offset in the page): | ||
337 | - [0x0 - 0x3]: 4 bytes, NVDIMM Device Handle. | ||
338 | - | ||
339 | - The handle is completely QEMU internal thing, the values in | ||
340 | - range [1, 0xFFFF] indicate nvdimm device. Other values are | ||
341 | - reserved for other purposes. | ||
342 | - | ||
343 | - Reserved handles: | ||
344 | - 0 is reserved for nvdimm root device named NVDR. | ||
345 | - 0x10000 is reserved for QEMU internal DSM function called on | ||
346 | - the root device. | ||
347 | - | ||
348 | - [0x4 - 0x7]: 4 bytes, Revision ID, that is the Arg1 of _DSM method. | ||
349 | - [0x8 - 0xB]: 4 bytes. Function Index, that is the Arg2 of _DSM method. | ||
350 | - [0xC - 0xFFF]: 4084 bytes, the Arg3 of _DSM method. | ||
351 | - | ||
352 | - QEMU Writes Output Data (based on the offset in the page): | ||
353 | - [0x0 - 0x3]: 4 bytes, the length of result | ||
354 | - [0x4 - 0xFFF]: 4092 bytes, the DSM result filled by QEMU | ||
355 | - | ||
356 | -IO Port 0x0a18 - 0xa1b: | ||
357 | - ACPI writes the address of the memory page allocated by BIOS to this | ||
358 | - port then QEMU gets the control and fills the result in the memory page. | ||
359 | - | ||
360 | - write Access: | ||
361 | - [0x0a18 - 0xa1b]: 4 bytes, the address of the memory page allocated | ||
362 | - by BIOS. | ||
363 | - | ||
364 | -_DSM process diagram: | ||
365 | ---------------------- | ||
366 | -"MEMA" indicates the address of memory page allocated by BIOS. | ||
367 | - | ||
368 | - +----------------------+ +-----------------------+ | ||
369 | - | 1. OSPM | | 2. OSPM | | ||
370 | - | save _DSM input data | | write "MEMA" to | Exit to QEMU | ||
371 | - | to the page +----->| IO port 0x0a18 +------------+ | ||
372 | - | indicated by "MEMA" | | | | | ||
373 | - +----------------------+ +-----------------------+ | | ||
374 | - | | ||
375 | - v | ||
376 | - +------------- ----+ +-----------+ +------------------+--------+ | ||
377 | - | 5 QEMU | | 4 QEMU | | 3. QEMU | | ||
378 | - | write _DSM result | | emulate | | get _DSM input data from | | ||
379 | - | to the page +<------+ _DSM +<-----+ the page indicated by the | | ||
380 | - | | | | | value from the IO port | | ||
381 | - +--------+-----------+ +-----------+ +---------------------------+ | ||
382 | - | | ||
383 | - | Enter Guest | ||
384 | - | | ||
385 | - v | ||
386 | - +--------------------------+ +--------------+ | ||
387 | - | 6 OSPM | | 7 OSPM | | ||
388 | - | result size is returned | | _DSM return | | ||
389 | - | by reading DSM +----->+ | | ||
390 | - | result from the page | | | | ||
391 | - +--------------------------+ +--------------+ | ||
392 | - | ||
393 | -NVDIMM hotplug | ||
394 | --------------- | ||
395 | -ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device | ||
396 | -hot-add event. | ||
397 | - | ||
398 | -QEMU internal use only _DSM function | ||
399 | ------------------------------------- | ||
400 | -1) Read FIT | ||
401 | - _FIT method uses _DSM method to fetch NFIT structures blob from QEMU | ||
402 | - in 1 page sized increments which are then concatenated and returned | ||
403 | - as _FIT method result. | ||
404 | - | ||
405 | - Input parameters: | ||
406 | - Arg0 – UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62} | ||
407 | - Arg1 – Revision ID (set to 1) | ||
408 | - Arg2 - Function Index, 0x1 | ||
409 | - Arg3 - A package containing a buffer whose layout is as follows: | ||
410 | - | ||
411 | - +----------+--------+--------+-------------------------------------------+ | ||
412 | - | Field | Length | Offset | Description | | ||
413 | - +----------+--------+--------+-------------------------------------------+ | ||
414 | - | offset | 4 | 0 | offset in QEMU's NFIT structures blob to | | ||
415 | - | | | | read from | | ||
416 | - +----------+--------+--------+-------------------------------------------+ | ||
417 | - | ||
418 | - Output layout in the dsm memory page: | ||
419 | - +----------+--------+--------+-------------------------------------------+ | ||
420 | - | Field | Length | Offset | Description | | ||
421 | - +----------+--------+--------+-------------------------------------------+ | ||
422 | - | length | 4 | 0 | length of entire returned data | | ||
423 | - | | | | (including this header) | | ||
424 | - +----------+-----------------+-------------------------------------------+ | ||
425 | - | | | | return status codes | | ||
426 | - | | | | 0x0 - success | | ||
427 | - | | | | 0x100 - error caused by NFIT update while | | ||
428 | - | status | 4 | 4 | read by _FIT wasn't completed, other | | ||
429 | - | | | | codes follow Chapter 3 in DSM Spec Rev1 | | ||
430 | - +----------+-----------------+-------------------------------------------+ | ||
431 | - | fit data | Varies | 8 | contains FIT data, this field is present | | ||
432 | - | | | | if status field is 0; | | ||
433 | - +----------+--------+--------+-------------------------------------------+ | ||
434 | - | ||
435 | - The FIT offset is maintained by the OSPM itself, current offset plus | ||
436 | - the size of the fit data returned by the function is the next offset | ||
437 | - OSPM should read. When all FIT data has been read out, zero fit data | ||
438 | - size is returned. | ||
439 | - | ||
440 | - If it returns status code 0x100, OSPM should restart to read FIT (read | ||
441 | - from offset 0 again). | ||
442 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
443 | index XXXXXXX..XXXXXXX 100644 | ||
444 | --- a/docs/specs/index.rst | ||
445 | +++ b/docs/specs/index.rst | ||
446 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | ||
447 | acpi_cpu_hotplug | ||
448 | acpi_mem_hotplug | ||
449 | acpi_pci_hotplug | ||
450 | + acpi_nvdimm | ||
451 | -- | 38 | -- |
452 | 2.20.1 | 39 | 2.25.1 |
453 | 40 | ||
454 | 41 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Future CPU types may specify which vector lengths are supported. | 3 | Add two test cases for VIOT, one on the q35 machine and the other on |
4 | We can apply nearly the same logic to validate those lengths | 4 | virt. To test complex topologies the q35 test has two PCIe buses that |
5 | as we do for KVM's supported vector lengths. We merge the code | 5 | bypass the IOMMU (and are therefore not described by VIOT), and two |
6 | where we can, but unfortunately can't completely merge it because | 6 | buses that are translated by virtio-iommu. |
7 | KVM requires all vector lengths, power-of-two or not, smaller than | ||
8 | the maximum enabled length to also be enabled. The architecture | ||
9 | only requires all the power-of-two lengths, though, so TCG will | ||
10 | only enforce that. | ||
11 | 7 | ||
12 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
14 | Message-id: 20210823160647.34028-5-drjones@redhat.com | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 13 | --- |
17 | target/arm/cpu64.c | 101 ++++++++++++++++++++------------------------- | 14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ |
18 | 1 file changed, 45 insertions(+), 56 deletions(-) | 15 | 1 file changed, 38 insertions(+) |
19 | 16 | ||
20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
21 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/cpu64.c | 19 | --- a/tests/qtest/bios-tables-test.c |
23 | +++ b/target/arm/cpu64.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
24 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
25 | break; | 22 | free_test_data(&data); |
26 | } | 23 | } |
27 | } | 24 | |
28 | - max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | 25 | +static void test_acpi_q35_viot(void) |
29 | - bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | 26 | +{ |
30 | - cpu->sve_vq_init, max_vq); | 27 | + test_data data = { |
31 | - if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | 28 | + .machine = MACHINE_Q35, |
32 | - error_setg(errp, "cannot disable sve%d", vq * 128); | 29 | + .variant = ".viot", |
33 | - error_append_hint(errp, "Disabling sve%d results in all " | 30 | + }; |
34 | - "vector lengths being disabled.\n", | ||
35 | - vq * 128); | ||
36 | - error_append_hint(errp, "With SVE enabled, at least one " | ||
37 | - "vector length must be enabled.\n"); | ||
38 | - return; | ||
39 | - } | ||
40 | } else { | ||
41 | /* Disabling a power-of-two disables all larger lengths. */ | ||
42 | - if (test_bit(0, cpu->sve_vq_init)) { | ||
43 | - error_setg(errp, "cannot disable sve128"); | ||
44 | - error_append_hint(errp, "Disabling sve128 results in all " | ||
45 | - "vector lengths being disabled.\n"); | ||
46 | - error_append_hint(errp, "With SVE enabled, at least one " | ||
47 | - "vector length must be enabled.\n"); | ||
48 | - return; | ||
49 | - } | ||
50 | - for (vq = 2; vq <= ARM_MAX_VQ; vq <<= 1) { | ||
51 | + for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) { | ||
52 | if (test_bit(vq - 1, cpu->sve_vq_init)) { | ||
53 | break; | ||
54 | } | ||
55 | } | ||
56 | - max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | ||
57 | - bitmap_complement(cpu->sve_vq_map, cpu->sve_vq_init, max_vq); | ||
58 | + } | ||
59 | + | 31 | + |
60 | + max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | 32 | + /* |
61 | + bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | 33 | + * To keep things interesting, two buses bypass the IOMMU. |
62 | + cpu->sve_vq_init, max_vq); | 34 | + * VIOT should only describes the other two buses. |
63 | + if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | 35 | + */ |
64 | + error_setg(errp, "cannot disable sve%d", vq * 128); | 36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " |
65 | + error_append_hint(errp, "Disabling sve%d results in all " | 37 | + "-device virtio-iommu-pci " |
66 | + "vector lengths being disabled.\n", | 38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " |
67 | + vq * 128); | 39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " |
68 | + error_append_hint(errp, "With SVE enabled, at least one " | 40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", |
69 | + "vector length must be enabled.\n"); | 41 | + &data); |
70 | + return; | 42 | + free_test_data(&data); |
43 | +} | ||
44 | + | ||
45 | +static void test_acpi_virt_viot(void) | ||
46 | +{ | ||
47 | + test_data data = { | ||
48 | + .machine = "virt", | ||
49 | + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", | ||
50 | + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", | ||
51 | + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", | ||
52 | + .ram_start = 0x40000000ULL, | ||
53 | + .scan_len = 128ULL * 1024 * 1024, | ||
54 | + }; | ||
55 | + | ||
56 | + test_acpi_one("-cpu cortex-a57 " | ||
57 | + "-device virtio-iommu-pci", &data); | ||
58 | + free_test_data(&data); | ||
59 | +} | ||
60 | + | ||
61 | static void test_oem_fields(test_data *data) | ||
62 | { | ||
63 | int i; | ||
64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | ||
65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); | ||
66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); | ||
71 | } | 67 | } |
72 | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); | |
73 | max_vq = find_last_bit(cpu->sve_vq_map, max_vq) + 1; | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
74 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 70 | if (has_tcg) { |
75 | assert(max_vq != 0); | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
76 | bitmap_clear(cpu->sve_vq_map, max_vq, ARM_MAX_VQ - max_vq); | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
77 | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); | |
78 | - if (kvm_enabled()) { | 74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); |
79 | - /* Ensure the set of lengths matches what KVM supports. */ | 75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); |
80 | - bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | 76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); |
81 | - if (!bitmap_empty(tmp, max_vq)) { | ||
82 | - vq = find_last_bit(tmp, max_vq) + 1; | ||
83 | - if (test_bit(vq - 1, cpu->sve_vq_map)) { | ||
84 | - if (cpu->sve_max_vq) { | ||
85 | - error_setg(errp, "cannot set sve-max-vq=%d", | ||
86 | - cpu->sve_max_vq); | ||
87 | - error_append_hint(errp, "This KVM host does not support " | ||
88 | - "the vector length %d-bits.\n", | ||
89 | - vq * 128); | ||
90 | - error_append_hint(errp, "It may not be possible to use " | ||
91 | - "sve-max-vq with this KVM host. Try " | ||
92 | - "using only sve<N> properties.\n"); | ||
93 | - } else { | ||
94 | - error_setg(errp, "cannot enable sve%d", vq * 128); | ||
95 | - error_append_hint(errp, "This KVM host does not support " | ||
96 | - "the vector length %d-bits.\n", | ||
97 | - vq * 128); | ||
98 | - } | ||
99 | + /* Ensure the set of lengths matches what is supported. */ | ||
100 | + bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | ||
101 | + if (!bitmap_empty(tmp, max_vq)) { | ||
102 | + vq = find_last_bit(tmp, max_vq) + 1; | ||
103 | + if (test_bit(vq - 1, cpu->sve_vq_map)) { | ||
104 | + if (cpu->sve_max_vq) { | ||
105 | + error_setg(errp, "cannot set sve-max-vq=%d", cpu->sve_max_vq); | ||
106 | + error_append_hint(errp, "This CPU does not support " | ||
107 | + "the vector length %d-bits.\n", vq * 128); | ||
108 | + error_append_hint(errp, "It may not be possible to use " | ||
109 | + "sve-max-vq with this CPU. Try " | ||
110 | + "using only sve<N> properties.\n"); | ||
111 | } else { | ||
112 | + error_setg(errp, "cannot enable sve%d", vq * 128); | ||
113 | + error_append_hint(errp, "This CPU does not support " | ||
114 | + "the vector length %d-bits.\n", vq * 128); | ||
115 | + } | ||
116 | + return; | ||
117 | + } else { | ||
118 | + if (kvm_enabled()) { | ||
119 | error_setg(errp, "cannot disable sve%d", vq * 128); | ||
120 | error_append_hint(errp, "The KVM host requires all " | ||
121 | "supported vector lengths smaller " | ||
122 | "than %d bits to also be enabled.\n", | ||
123 | max_vq * 128); | ||
124 | - } | ||
125 | - return; | ||
126 | - } | ||
127 | - } else { | ||
128 | - /* Ensure all required powers-of-two are enabled. */ | ||
129 | - for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) { | ||
130 | - if (!test_bit(vq - 1, cpu->sve_vq_map)) { | ||
131 | - error_setg(errp, "cannot disable sve%d", vq * 128); | ||
132 | - error_append_hint(errp, "sve%d is required as it " | ||
133 | - "is a power-of-two length smaller than " | ||
134 | - "the maximum, sve%d\n", | ||
135 | - vq * 128, max_vq * 128); | ||
136 | return; | ||
137 | + } else { | ||
138 | + /* Ensure all required powers-of-two are enabled. */ | ||
139 | + for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) { | ||
140 | + if (!test_bit(vq - 1, cpu->sve_vq_map)) { | ||
141 | + error_setg(errp, "cannot disable sve%d", vq * 128); | ||
142 | + error_append_hint(errp, "sve%d is required as it " | ||
143 | + "is a power-of-two length smaller " | ||
144 | + "than the maximum, sve%d\n", | ||
145 | + vq * 128, max_vq * 128); | ||
146 | + return; | ||
147 | + } | ||
148 | + } | ||
149 | } | ||
150 | } | 77 | } |
151 | } | 78 | } |
79 | ret = g_test_run(); | ||
152 | -- | 80 | -- |
153 | 2.20.1 | 81 | 2.25.1 |
154 | 82 | ||
155 | 83 | diff view generated by jsdifflib |
1 | The gunzip() function reads various fields from a passed in source | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | buffer in order to skip a header before passing the actual compressed | 2 | |
3 | data to the zlib inflate() function. It does check whether the | 3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the |
4 | passed in buffer is too small, but unfortunately it checks that only | 4 | q35 machine. |
5 | after reading bytes from the src buffer, so it could read off the end | 5 | |
6 | of the buffer. | 6 | Since the test instantiates a virtio device and two PCIe expander |
7 | 7 | bridges, DSDT.viot has more blocks than the base DSDT. | |
8 | You can see this with valgrind: | 8 | |
9 | 9 | The VIOT table generated for the q35 test is: | |
10 | $ printf "%b" '\x1f\x8b' > /tmp/image | 10 | |
11 | $ valgrind qemu-system-aarch64 -display none -M virt -cpu max -kernel /tmp/image | 11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
12 | [...] | 12 | [004h 0004 4] Table Length : 00000070 |
13 | ==19224== Invalid read of size 1 | 13 | [008h 0008 1] Revision : 00 |
14 | ==19224== at 0x67302E: gunzip (loader.c:558) | 14 | [009h 0009 1] Checksum : 3D |
15 | ==19224== by 0x673907: load_image_gzipped_buffer (loader.c:788) | 15 | [00Ah 0010 6] Oem ID : "BOCHS " |
16 | ==19224== by 0xA18032: load_aarch64_image (boot.c:932) | 16 | [010h 0016 8] Oem Table ID : "BXPC " |
17 | ==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063) | 17 | [018h 0024 4] Oem Revision : 00000001 |
18 | ==19224== by 0xA18D90: arm_load_kernel (boot.c:1317) | 18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" |
19 | ==19224== by 0x9F3651: machvirt_init (virt.c:2114) | 19 | [020h 0032 4] Asl Compiler Revision : 00000001 |
20 | ==19224== by 0x794B7A: machine_run_board_init (machine.c:1272) | 20 | |
21 | ==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618) | 21 | [024h 0036 2] Node count : 0003 |
22 | ==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692) | 22 | [026h 0038 2] Node offset : 0030 |
23 | ==19224== by 0xD5F32E: qemu_init (vl.c:3713) | 23 | [028h 0040 8] Reserved : 0000000000000000 |
24 | ==19224== by 0x5ADDB1: main (main.c:49) | 24 | |
25 | ==19224== Address 0x3802a873 is 0 bytes after a block of size 3 alloc'd | 25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] |
26 | ==19224== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) | 26 | [031h 0049 1] Reserved : 00 |
27 | ==19224== by 0x61E7657: g_file_get_contents (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.5600.4) | 27 | [032h 0050 2] Length : 0010 |
28 | ==19224== by 0x673895: load_image_gzipped_buffer (loader.c:771) | 28 | |
29 | ==19224== by 0xA18032: load_aarch64_image (boot.c:932) | 29 | [034h 0052 2] PCI Segment : 0000 |
30 | ==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063) | 30 | [036h 0054 2] PCI BDF number : 0010 |
31 | ==19224== by 0xA18D90: arm_load_kernel (boot.c:1317) | 31 | [038h 0056 8] Reserved : 0000000000000000 |
32 | ==19224== by 0x9F3651: machvirt_init (virt.c:2114) | 32 | |
33 | ==19224== by 0x794B7A: machine_run_board_init (machine.c:1272) | 33 | [040h 0064 1] Type : 01 [PCI Range] |
34 | ==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618) | 34 | [041h 0065 1] Reserved : 00 |
35 | ==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692) | 35 | [042h 0066 2] Length : 0018 |
36 | ==19224== by 0xD5F32E: qemu_init (vl.c:3713) | 36 | |
37 | ==19224== by 0x5ADDB1: main (main.c:49) | 37 | [044h 0068 4] Endpoint start : 00003000 |
38 | 38 | [048h 0072 2] PCI Segment start : 0000 | |
39 | Check that we have enough bytes of data to read the header bytes that | 39 | [04Ah 0074 2] PCI Segment end : 0000 |
40 | we read before we read them. | 40 | [04Ch 0076 2] PCI BDF start : 3000 |
41 | 41 | [04Eh 0078 2] PCI BDF end : 30FF | |
42 | Fixes: Coverity 1458997 | 42 | [050h 0080 2] Output node : 0030 |
43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | [052h 0082 6] Reserved : 000000000000 |
44 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 44 | |
45 | Message-id: 20210812141803.20913-1-peter.maydell@linaro.org | 45 | [058h 0088 1] Type : 01 [PCI Range] |
46 | --- | 46 | [059h 0089 1] Reserved : 00 |
47 | hw/core/loader.c | 35 +++++++++++++++++++++++++---------- | 47 | [05Ah 0090 2] Length : 0018 |
48 | 1 file changed, 25 insertions(+), 10 deletions(-) | 48 | |
49 | 49 | [05Ch 0092 4] Endpoint start : 00001000 | |
50 | diff --git a/hw/core/loader.c b/hw/core/loader.c | 50 | [060h 0096 2] PCI Segment start : 0000 |
51 | index XXXXXXX..XXXXXXX 100644 | 51 | [062h 0098 2] PCI Segment end : 0000 |
52 | --- a/hw/core/loader.c | 52 | [064h 0100 2] PCI BDF start : 1000 |
53 | +++ b/hw/core/loader.c | 53 | [066h 0102 2] PCI BDF end : 10FF |
54 | @@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen) | 54 | [068h 0104 2] Output node : 0030 |
55 | 55 | [06Ah 0106 6] Reserved : 000000000000 | |
56 | /* skip header */ | 56 | |
57 | i = 10; | 57 | And the DSDT diff is: |
58 | + if (srclen < 4) { | 58 | |
59 | + goto toosmall; | 59 | @@ -XXX,XX +XXX,XX @@ |
60 | + } | 60 | * |
61 | flags = src[3]; | 61 | * Disassembling to symbolic ASL+ operators |
62 | if (src[2] != DEFLATED || (flags & RESERVED) != 0) { | 62 | * |
63 | puts ("Error: Bad gzipped data\n"); | 63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 |
64 | return -1; | 64 | + * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021 |
65 | * | ||
66 | * Original Table Header: | ||
67 | * Signature "DSDT" | ||
68 | - * Length 0x00002061 (8289) | ||
69 | + * Length 0x000024B6 (9398) | ||
70 | * Revision 0x01 **** 32-bit table (V1), no 64-bit math support | ||
71 | - * Checksum 0xFA | ||
72 | + * Checksum 0xA7 | ||
73 | * OEM ID "BOCHS " | ||
74 | * OEM Table ID "BXPC " | ||
75 | * OEM Revision 0x00000001 (1) | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | } | ||
65 | } | 78 | } |
66 | - if ((flags & EXTRA_FIELD) != 0) | 79 | |
67 | + if ((flags & EXTRA_FIELD) != 0) { | 80 | + Scope (\_SB) |
68 | + if (srclen < 12) { | 81 | + { |
69 | + goto toosmall; | 82 | + Device (PC30) |
70 | + } | 83 | + { |
71 | i = 12 + src[10] + (src[11] << 8); | 84 | + Name (_UID, 0x30) // _UID: Unique ID |
72 | - if ((flags & ORIG_NAME) != 0) | 85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number |
73 | - while (src[i++] != 0) | 86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID |
74 | - ; | 87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID |
75 | - if ((flags & COMMENT) != 0) | 88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities |
76 | - while (src[i++] != 0) | 89 | + { |
77 | - ; | 90 | + CreateDWordField (Arg3, Zero, CDW1) |
78 | - if ((flags & HEAD_CRC) != 0) | 91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) |
79 | + } | 92 | + { |
80 | + if ((flags & ORIG_NAME) != 0) { | 93 | + CreateDWordField (Arg3, 0x04, CDW2) |
81 | + while (i < srclen && src[i++] != 0) { | 94 | + CreateDWordField (Arg3, 0x08, CDW3) |
82 | + /* do nothing */ | 95 | + Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */ |
96 | + Local0 &= 0x1F | ||
97 | + If ((Arg1 != One)) | ||
98 | + { | ||
99 | + CDW1 |= 0x08 | ||
100 | + } | ||
101 | + | ||
102 | + If ((CDW3 != Local0)) | ||
103 | + { | ||
104 | + CDW1 |= 0x10 | ||
105 | + } | ||
106 | + | ||
107 | + CDW3 = Local0 | ||
108 | + } | ||
109 | + Else | ||
110 | + { | ||
111 | + CDW1 |= 0x04 | ||
112 | + } | ||
113 | + | ||
114 | + Return (Arg3) | ||
115 | + } | ||
116 | + | ||
117 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
118 | + { | ||
119 | + Local0 = Package (0x80){} | ||
120 | + Local1 = Zero | ||
121 | + While ((Local1 < 0x80)) | ||
122 | + { | ||
123 | + Local2 = (Local1 >> 0x02) | ||
124 | + Local3 = ((Local1 + Local2) & 0x03) | ||
125 | + If ((Local3 == Zero)) | ||
126 | + { | ||
127 | + Local4 = Package (0x04) | ||
128 | + { | ||
129 | + Zero, | ||
130 | + Zero, | ||
131 | + LNKD, | ||
132 | + Zero | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + If ((Local3 == One)) | ||
137 | + { | ||
138 | + Local4 = Package (0x04) | ||
139 | + { | ||
140 | + Zero, | ||
141 | + Zero, | ||
142 | + LNKA, | ||
143 | + Zero | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + If ((Local3 == 0x02)) | ||
148 | + { | ||
149 | + Local4 = Package (0x04) | ||
150 | + { | ||
151 | + Zero, | ||
152 | + Zero, | ||
153 | + LNKB, | ||
154 | + Zero | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | + If ((Local3 == 0x03)) | ||
159 | + { | ||
160 | + Local4 = Package (0x04) | ||
161 | + { | ||
162 | + Zero, | ||
163 | + Zero, | ||
164 | + LNKC, | ||
165 | + Zero | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
170 | + Local4 [One] = (Local1 & 0x03) | ||
171 | + Local0 [Local1] = Local4 | ||
172 | + Local1++ | ||
173 | + } | ||
174 | + | ||
175 | + Return (Local0) | ||
176 | + } | ||
177 | + | ||
178 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
179 | + { | ||
180 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
181 | + 0x0000, // Granularity | ||
182 | + 0x0030, // Range Minimum | ||
183 | + 0x0030, // Range Maximum | ||
184 | + 0x0000, // Translation Offset | ||
185 | + 0x0001, // Length | ||
186 | + ,, ) | ||
187 | + }) | ||
83 | + } | 188 | + } |
84 | + } | 189 | + } |
85 | + if ((flags & COMMENT) != 0) { | 190 | + |
86 | + while (i < srclen && src[i++] != 0) { | 191 | + Scope (\_SB) |
87 | + /* do nothing */ | 192 | + { |
193 | + Device (PC20) | ||
194 | + { | ||
195 | + Name (_UID, 0x20) // _UID: Unique ID | ||
196 | + Name (_BBN, 0x20) // _BBN: BIOS Bus Number | ||
197 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
198 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
199 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
200 | + { | ||
201 | + CreateDWordField (Arg3, Zero, CDW1) | ||
202 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
203 | + { | ||
204 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
205 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
206 | + Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */ | ||
207 | + Local0 &= 0x1F | ||
208 | + If ((Arg1 != One)) | ||
209 | + { | ||
210 | + CDW1 |= 0x08 | ||
211 | + } | ||
212 | + | ||
213 | + If ((CDW3 != Local0)) | ||
214 | + { | ||
215 | + CDW1 |= 0x10 | ||
216 | + } | ||
217 | + | ||
218 | + CDW3 = Local0 | ||
219 | + } | ||
220 | + Else | ||
221 | + { | ||
222 | + CDW1 |= 0x04 | ||
223 | + } | ||
224 | + | ||
225 | + Return (Arg3) | ||
226 | + } | ||
227 | + | ||
228 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
229 | + { | ||
230 | + Local0 = Package (0x80){} | ||
231 | + Local1 = Zero | ||
232 | + While ((Local1 < 0x80)) | ||
233 | + { | ||
234 | + Local2 = (Local1 >> 0x02) | ||
235 | + Local3 = ((Local1 + Local2) & 0x03) | ||
236 | + If ((Local3 == Zero)) | ||
237 | + { | ||
238 | + Local4 = Package (0x04) | ||
239 | + { | ||
240 | + Zero, | ||
241 | + Zero, | ||
242 | + LNKD, | ||
243 | + Zero | ||
244 | + } | ||
245 | + } | ||
246 | + | ||
247 | + If ((Local3 == One)) | ||
248 | + { | ||
249 | + Local4 = Package (0x04) | ||
250 | + { | ||
251 | + Zero, | ||
252 | + Zero, | ||
253 | + LNKA, | ||
254 | + Zero | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | + If ((Local3 == 0x02)) | ||
259 | + { | ||
260 | + Local4 = Package (0x04) | ||
261 | + { | ||
262 | + Zero, | ||
263 | + Zero, | ||
264 | + LNKB, | ||
265 | + Zero | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + If ((Local3 == 0x03)) | ||
270 | + { | ||
271 | + Local4 = Package (0x04) | ||
272 | + { | ||
273 | + Zero, | ||
274 | + Zero, | ||
275 | + LNKC, | ||
276 | + Zero | ||
277 | + } | ||
278 | + } | ||
279 | + | ||
280 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
281 | + Local4 [One] = (Local1 & 0x03) | ||
282 | + Local0 [Local1] = Local4 | ||
283 | + Local1++ | ||
284 | + } | ||
285 | + | ||
286 | + Return (Local0) | ||
287 | + } | ||
288 | + | ||
289 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
290 | + { | ||
291 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
292 | + 0x0000, // Granularity | ||
293 | + 0x0020, // Range Minimum | ||
294 | + 0x0020, // Range Maximum | ||
295 | + 0x0000, // Translation Offset | ||
296 | + 0x0001, // Length | ||
297 | + ,, ) | ||
298 | + }) | ||
88 | + } | 299 | + } |
89 | + } | 300 | + } |
90 | + if ((flags & HEAD_CRC) != 0) { | 301 | + |
91 | i += 2; | 302 | + Scope (\_SB) |
303 | + { | ||
304 | + Device (PC10) | ||
305 | + { | ||
306 | + Name (_UID, 0x10) // _UID: Unique ID | ||
307 | + Name (_BBN, 0x10) // _BBN: BIOS Bus Number | ||
308 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
309 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
310 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
311 | + { | ||
312 | + CreateDWordField (Arg3, Zero, CDW1) | ||
313 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
314 | + { | ||
315 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
316 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
317 | + Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */ | ||
318 | + Local0 &= 0x1F | ||
319 | + If ((Arg1 != One)) | ||
320 | + { | ||
321 | + CDW1 |= 0x08 | ||
322 | + } | ||
323 | + | ||
324 | + If ((CDW3 != Local0)) | ||
325 | + { | ||
326 | + CDW1 |= 0x10 | ||
327 | + } | ||
328 | + | ||
329 | + CDW3 = Local0 | ||
330 | + } | ||
331 | + Else | ||
332 | + { | ||
333 | + CDW1 |= 0x04 | ||
334 | + } | ||
335 | + | ||
336 | + Return (Arg3) | ||
337 | + } | ||
338 | + | ||
339 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
340 | + { | ||
341 | + Local0 = Package (0x80){} | ||
342 | + Local1 = Zero | ||
343 | + While ((Local1 < 0x80)) | ||
344 | + { | ||
345 | + Local2 = (Local1 >> 0x02) | ||
346 | + Local3 = ((Local1 + Local2) & 0x03) | ||
347 | + If ((Local3 == Zero)) | ||
348 | + { | ||
349 | + Local4 = Package (0x04) | ||
350 | + { | ||
351 | + Zero, | ||
352 | + Zero, | ||
353 | + LNKD, | ||
354 | + Zero | ||
355 | + } | ||
356 | + } | ||
357 | + | ||
358 | + If ((Local3 == One)) | ||
359 | + { | ||
360 | + Local4 = Package (0x04) | ||
361 | + { | ||
362 | + Zero, | ||
363 | + Zero, | ||
364 | + LNKA, | ||
365 | + Zero | ||
366 | + } | ||
367 | + } | ||
368 | + | ||
369 | + If ((Local3 == 0x02)) | ||
370 | + { | ||
371 | + Local4 = Package (0x04) | ||
372 | + { | ||
373 | + Zero, | ||
374 | + Zero, | ||
375 | + LNKB, | ||
376 | + Zero | ||
377 | + } | ||
378 | + } | ||
379 | + | ||
380 | + If ((Local3 == 0x03)) | ||
381 | + { | ||
382 | + Local4 = Package (0x04) | ||
383 | + { | ||
384 | + Zero, | ||
385 | + Zero, | ||
386 | + LNKC, | ||
387 | + Zero | ||
388 | + } | ||
389 | + } | ||
390 | + | ||
391 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
392 | + Local4 [One] = (Local1 & 0x03) | ||
393 | + Local0 [Local1] = Local4 | ||
394 | + Local1++ | ||
395 | + } | ||
396 | + | ||
397 | + Return (Local0) | ||
398 | + } | ||
399 | + | ||
400 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
401 | + { | ||
402 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
403 | + 0x0000, // Granularity | ||
404 | + 0x0010, // Range Minimum | ||
405 | + 0x0010, // Range Maximum | ||
406 | + 0x0000, // Translation Offset | ||
407 | + 0x0001, // Length | ||
408 | + ,, ) | ||
409 | + }) | ||
410 | + } | ||
92 | + } | 411 | + } |
93 | if (i >= srclen) { | 412 | + |
94 | - puts ("Error: gunzip out of data in header\n"); | 413 | Scope (\_SB.PCI0) |
95 | - return -1; | 414 | { |
96 | + goto toosmall; | 415 | Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings |
97 | } | 416 | @@ -XXX,XX +XXX,XX @@ |
98 | 417 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | |
99 | s.zalloc = zalloc; | 418 | 0x0000, // Granularity |
100 | @@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen) | 419 | 0x0000, // Range Minimum |
101 | inflateEnd(&s); | 420 | - 0x00FF, // Range Maximum |
102 | 421 | + 0x000F, // Range Maximum | |
103 | return dstbytes; | 422 | 0x0000, // Translation Offset |
104 | + | 423 | - 0x0100, // Length |
105 | +toosmall: | 424 | + 0x0010, // Length |
106 | + puts("Error: gunzip out of data in header\n"); | 425 | ,, ) |
107 | + return -1; | 426 | IO (Decode16, |
108 | } | 427 | 0x0CF8, // Range Minimum |
109 | 428 | @@ -XXX,XX +XXX,XX @@ | |
110 | /* Load a U-Boot image. */ | 429 | } |
430 | } | ||
431 | |||
432 | + Device (S10) | ||
433 | + { | ||
434 | + Name (_ADR, 0x00020000) // _ADR: Address | ||
435 | + } | ||
436 | + | ||
437 | + Device (S18) | ||
438 | + { | ||
439 | + Name (_ADR, 0x00030000) // _ADR: Address | ||
440 | + } | ||
441 | + | ||
442 | + Device (S20) | ||
443 | + { | ||
444 | + Name (_ADR, 0x00040000) // _ADR: Address | ||
445 | + } | ||
446 | + | ||
447 | + Device (S28) | ||
448 | + { | ||
449 | + Name (_ADR, 0x00050000) // _ADR: Address | ||
450 | + } | ||
451 | + | ||
452 | Method (PCNT, 0, NotSerialized) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
457 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
458 | Message-id: 20211210170415.583179-8-jean-philippe@linaro.org | ||
459 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
460 | --- | ||
461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- | ||
462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
464 | 3 files changed, 2 deletions(-) | ||
465 | |||
466 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
467 | index XXXXXXX..XXXXXXX 100644 | ||
468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
470 | @@ -XXX,XX +XXX,XX @@ | ||
471 | /* List of comma-separated changed AML files to ignore */ | ||
472 | "tests/data/acpi/virt/VIOT", | ||
473 | -"tests/data/acpi/q35/DSDT.viot", | ||
474 | -"tests/data/acpi/q35/VIOT.viot", | ||
475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | ||
476 | index XXXXXXX..XXXXXXX 100644 | ||
477 | GIT binary patch | ||
478 | literal 9398 | ||
479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ | ||
480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C | ||
481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN | ||
482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 | ||
483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS | ||
484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# | ||
485 | z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW% | ||
486 | z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^ | ||
487 | z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG | ||
488 | z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm | ||
489 | znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8 | ||
490 | zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn | ||
491 | zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l | ||
492 | zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?)) | ||
493 | zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N | ||
494 | zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-< | ||
495 | z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ | ||
496 | z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4 | ||
497 | zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_ | ||
498 | zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^= | ||
499 | zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn>< | ||
500 | zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w} | ||
501 | zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t | ||
502 | zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3 | ||
503 | zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`& | ||
504 | zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V | ||
505 | zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq| | ||
506 | zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO< | ||
507 | zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf | ||
508 | zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb} | ||
509 | zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC | ||
510 | z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_# | ||
511 | zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4 | ||
512 | z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0 | ||
513 | zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T | ||
514 | zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq | ||
515 | zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp | ||
516 | zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a | ||
517 | zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD | ||
518 | zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l | ||
519 | zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5 | ||
520 | z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON | ||
521 | zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P> | ||
522 | zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s | ||
523 | zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q | ||
524 | z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ | ||
525 | zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N | ||
526 | z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D= | ||
527 | zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P | ||
528 | zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF | ||
529 | z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4 | ||
530 | z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6 | ||
531 | zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG | ||
532 | z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi | ||
533 | zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr | ||
534 | zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l? | ||
535 | zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG | ||
536 | zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a | ||
537 | zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl | ||
538 | zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9 | ||
539 | z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y | ||
540 | z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0 | ||
541 | zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM | ||
542 | z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol | ||
543 | Gu>S+TT-130 | ||
544 | |||
545 | literal 0 | ||
546 | HcmV?d00001 | ||
547 | |||
548 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | ||
549 | index XXXXXXX..XXXXXXX 100644 | ||
550 | GIT binary patch | ||
551 | literal 112 | ||
552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj | ||
553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 | ||
554 | |||
555 | literal 0 | ||
556 | HcmV?d00001 | ||
557 | |||
111 | -- | 558 | -- |
112 | 2.20.1 | 559 | 2.25.1 |
113 | 560 | ||
114 | 561 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Now that we have an ARMCPU member sve_vq_supported we no longer | 3 | The VIOT blob contains the following: |
4 | need the local kvm_supported bitmap for KVM's supported vector | ||
5 | lengths. | ||
6 | 4 | ||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 6 | [004h 0004 4] Table Length : 00000058 |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | [008h 0008 1] Revision : 00 |
10 | Message-id: 20210823160647.34028-4-drjones@redhat.com | 8 | [009h 0009 1] Checksum : 66 |
9 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
10 | [010h 0016 8] Oem Table ID : "BXPC " | ||
11 | [018h 0024 4] Oem Revision : 00000001 | ||
12 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
13 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
14 | |||
15 | [024h 0036 2] Node count : 0002 | ||
16 | [026h 0038 2] Node offset : 0030 | ||
17 | [028h 0040 8] Reserved : 0000000000000000 | ||
18 | |||
19 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
20 | [031h 0049 1] Reserved : 00 | ||
21 | [032h 0050 2] Length : 0010 | ||
22 | |||
23 | [034h 0052 2] PCI Segment : 0000 | ||
24 | [036h 0054 2] PCI BDF number : 0008 | ||
25 | [038h 0056 8] Reserved : 0000000000000000 | ||
26 | |||
27 | [040h 0064 1] Type : 01 [PCI Range] | ||
28 | [041h 0065 1] Reserved : 00 | ||
29 | [042h 0066 2] Length : 0018 | ||
30 | |||
31 | [044h 0068 4] Endpoint start : 00000000 | ||
32 | [048h 0072 2] PCI Segment start : 0000 | ||
33 | [04Ah 0074 2] PCI Segment end : 0000 | ||
34 | [04Ch 0076 2] PCI BDF start : 0000 | ||
35 | [04Eh 0078 2] PCI BDF end : 00FF | ||
36 | [050h 0080 2] Output node : 0030 | ||
37 | [052h 0082 6] Reserved : 000000000000 | ||
38 | |||
39 | Acked-by: Ani Sinha <ani@anisinha.ca> | ||
40 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
41 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
42 | Message-id: 20211210170415.583179-9-jean-philippe@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 44 | --- |
13 | target/arm/cpu64.c | 19 +++++++++++-------- | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
14 | 1 file changed, 11 insertions(+), 8 deletions(-) | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
47 | 2 files changed, 1 deletion(-) | ||
15 | 48 | ||
16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
17 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu64.c | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
19 | +++ b/target/arm/cpu64.c | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
20 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 53 | @@ -1,2 +1 @@ |
21 | * any of the above. Finally, if SVE is not disabled, then at least one | 54 | /* List of comma-separated changed AML files to ignore */ |
22 | * vector length must be enabled. | 55 | -"tests/data/acpi/virt/VIOT", |
23 | */ | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
24 | - DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ); | 57 | index XXXXXXX..XXXXXXX 100644 |
25 | DECLARE_BITMAP(tmp, ARM_MAX_VQ); | 58 | GIT binary patch |
26 | uint32_t vq, max_vq = 0; | 59 | literal 88 |
27 | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX | |
28 | - /* Collect the set of vector lengths supported by KVM. */ | 61 | I{D-Rq0Q5fy0RR91 |
29 | - bitmap_zero(kvm_supported, ARM_MAX_VQ); | 62 | |
30 | + /* | 63 | literal 0 |
31 | + * CPU models specify a set of supported vector lengths which are | 64 | HcmV?d00001 |
32 | + * enabled by default. Attempting to enable any vector length not set | 65 | |
33 | + * in the supported bitmap results in an error. When KVM is enabled we | ||
34 | + * fetch the supported bitmap from the host. | ||
35 | + */ | ||
36 | if (kvm_enabled() && kvm_arm_sve_supported()) { | ||
37 | - kvm_arm_sve_get_vls(CPU(cpu), kvm_supported); | ||
38 | + kvm_arm_sve_get_vls(CPU(cpu), cpu->sve_vq_supported); | ||
39 | } else if (kvm_enabled()) { | ||
40 | assert(!cpu_isar_feature(aa64_sve, cpu)); | ||
41 | } | ||
42 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
43 | * For KVM we have to automatically enable all supported unitialized | ||
44 | * lengths, even when the smaller lengths are not all powers-of-two. | ||
45 | */ | ||
46 | - bitmap_andnot(tmp, kvm_supported, cpu->sve_vq_init, max_vq); | ||
47 | + bitmap_andnot(tmp, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq); | ||
48 | bitmap_or(cpu->sve_vq_map, cpu->sve_vq_map, tmp, max_vq); | ||
49 | } else { | ||
50 | /* Propagate enabled bits down through required powers-of-two. */ | ||
51 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
52 | /* Disabling a supported length disables all larger lengths. */ | ||
53 | for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { | ||
54 | if (test_bit(vq - 1, cpu->sve_vq_init) && | ||
55 | - test_bit(vq - 1, kvm_supported)) { | ||
56 | + test_bit(vq - 1, cpu->sve_vq_supported)) { | ||
57 | break; | ||
58 | } | ||
59 | } | ||
60 | max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | ||
61 | - bitmap_andnot(cpu->sve_vq_map, kvm_supported, | ||
62 | + bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | ||
63 | cpu->sve_vq_init, max_vq); | ||
64 | if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | ||
65 | error_setg(errp, "cannot disable sve%d", vq * 128); | ||
66 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
67 | |||
68 | if (kvm_enabled()) { | ||
69 | /* Ensure the set of lengths matches what KVM supports. */ | ||
70 | - bitmap_xor(tmp, cpu->sve_vq_map, kvm_supported, max_vq); | ||
71 | + bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | ||
72 | if (!bitmap_empty(tmp, max_vq)) { | ||
73 | vq = find_last_bit(tmp, max_vq) + 1; | ||
74 | if (test_bit(vq - 1, cpu->sve_vq_map)) { | ||
75 | -- | 66 | -- |
76 | 2.20.1 | 67 | 2.25.1 |
77 | 68 | ||
78 | 69 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Do a basic conversion of the acpi_cpu_hotplug spec document to rST. | ||
2 | 1 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
5 | Message-id: 20210727170414.3368-2-peter.maydell@linaro.org | ||
6 | --- | ||
7 | docs/specs/acpi_cpu_hotplug.rst | 235 ++++++++++++++++++++++++++++++++ | ||
8 | docs/specs/acpi_cpu_hotplug.txt | 160 ---------------------- | ||
9 | docs/specs/index.rst | 1 + | ||
10 | 3 files changed, 236 insertions(+), 160 deletions(-) | ||
11 | create mode 100644 docs/specs/acpi_cpu_hotplug.rst | ||
12 | delete mode 100644 docs/specs/acpi_cpu_hotplug.txt | ||
13 | |||
14 | diff --git a/docs/specs/acpi_cpu_hotplug.rst b/docs/specs/acpi_cpu_hotplug.rst | ||
15 | new file mode 100644 | ||
16 | index XXXXXXX..XXXXXXX | ||
17 | --- /dev/null | ||
18 | +++ b/docs/specs/acpi_cpu_hotplug.rst | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | +QEMU<->ACPI BIOS CPU hotplug interface | ||
21 | +====================================== | ||
22 | + | ||
23 | +QEMU supports CPU hotplug via ACPI. This document | ||
24 | +describes the interface between QEMU and the ACPI BIOS. | ||
25 | + | ||
26 | +ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add | ||
27 | +and hot-remove events. | ||
28 | + | ||
29 | + | ||
30 | +Legacy ACPI CPU hotplug interface registers | ||
31 | +------------------------------------------- | ||
32 | + | ||
33 | +CPU present bitmap for: | ||
34 | + | ||
35 | +- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) | ||
36 | +- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) | ||
37 | +- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. | ||
38 | +- The first DWORD in bitmap is used in write mode to switch from legacy | ||
39 | + to modern CPU hotplug interface, write 0 into it to do switch. | ||
40 | + | ||
41 | +QEMU sets corresponding CPU bit on hot-add event and issues SCI | ||
42 | +with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler | ||
43 | +to notify OS about CPU hot-add events. CPU hot-remove isn't supported. | ||
44 | + | ||
45 | + | ||
46 | +Modern ACPI CPU hotplug interface registers | ||
47 | +------------------------------------------- | ||
48 | + | ||
49 | +Register block base address: | ||
50 | + | ||
51 | +- ICH9-LPC IO port 0x0cd8 | ||
52 | +- PIIX-PM IO port 0xaf00 | ||
53 | + | ||
54 | +Register block size: | ||
55 | + | ||
56 | +- ACPI_CPU_HOTPLUG_REG_LEN = 12 | ||
57 | + | ||
58 | +All accesses to registers described below, imply little-endian byte order. | ||
59 | + | ||
60 | +Reserved registers behavior: | ||
61 | + | ||
62 | +- write accesses are ignored | ||
63 | +- read accesses return all bits set to 0. | ||
64 | + | ||
65 | +The last stored value in 'CPU selector' must refer to a possible CPU, otherwise | ||
66 | + | ||
67 | +- reads from any register return 0 | ||
68 | +- writes to any other register are ignored until valid value is stored into it | ||
69 | + | ||
70 | +On QEMU start, 'CPU selector' is initialized to a valid value, on reset it | ||
71 | +keeps the current value. | ||
72 | + | ||
73 | +Read access behavior | ||
74 | +^^^^^^^^^^^^^^^^^^^^ | ||
75 | + | ||
76 | +offset [0x0-0x3] | ||
77 | + Command data 2: (DWORD access) | ||
78 | + | ||
79 | + If value last stored in 'Command field' is: | ||
80 | + | ||
81 | + 0: | ||
82 | + reads as 0x0 | ||
83 | + 3: | ||
84 | + upper 32 bits of architecture specific CPU ID value | ||
85 | + other values: | ||
86 | + reserved | ||
87 | + | ||
88 | +offset [0x4] | ||
89 | + CPU device status fields: (1 byte access) | ||
90 | + | ||
91 | + bits: | ||
92 | + | ||
93 | + 0: | ||
94 | + Device is enabled and may be used by guest | ||
95 | + 1: | ||
96 | + Device insert event, used to distinguish device for which | ||
97 | + no device check event to OSPM was issued. | ||
98 | + It's valid only when bit 0 is set. | ||
99 | + 2: | ||
100 | + Device remove event, used to distinguish device for which | ||
101 | + no device eject request to OSPM was issued. Firmware must | ||
102 | + ignore this bit. | ||
103 | + 3: | ||
104 | + reserved and should be ignored by OSPM | ||
105 | + 4: | ||
106 | + if set to 1, OSPM requests firmware to perform device eject. | ||
107 | + 5-7: | ||
108 | + reserved and should be ignored by OSPM | ||
109 | + | ||
110 | +offset [0x5-0x7] | ||
111 | + reserved | ||
112 | + | ||
113 | +offset [0x8] | ||
114 | + Command data: (DWORD access) | ||
115 | + | ||
116 | + If value last stored in 'Command field' is one of: | ||
117 | + | ||
118 | + 0: | ||
119 | + contains 'CPU selector' value of a CPU with pending event[s] | ||
120 | + 3: | ||
121 | + lower 32 bits of architecture specific CPU ID value | ||
122 | + (in x86 case: APIC ID) | ||
123 | + otherwise: | ||
124 | + contains 0 | ||
125 | + | ||
126 | +Write access behavior | ||
127 | +^^^^^^^^^^^^^^^^^^^^^ | ||
128 | + | ||
129 | +offset [0x0-0x3] | ||
130 | + CPU selector: (DWORD access) | ||
131 | + | ||
132 | + Selects active CPU device. All following accesses to other | ||
133 | + registers will read/store data from/to selected CPU. | ||
134 | + Valid values: [0 .. max_cpus) | ||
135 | + | ||
136 | +offset [0x4] | ||
137 | + CPU device control fields: (1 byte access) | ||
138 | + | ||
139 | + bits: | ||
140 | + | ||
141 | + 0: | ||
142 | + reserved, OSPM must clear it before writing to register. | ||
143 | + 1: | ||
144 | + if set to 1 clears device insert event, set by OSPM | ||
145 | + after it has emitted device check event for the | ||
146 | + selected CPU device | ||
147 | + 2: | ||
148 | + if set to 1 clears device remove event, set by OSPM | ||
149 | + after it has emitted device eject request for the | ||
150 | + selected CPU device. | ||
151 | + 3: | ||
152 | + if set to 1 initiates device eject, set by OSPM when it | ||
153 | + triggers CPU device removal and calls _EJ0 method or by firmware | ||
154 | + when bit #4 is set. In case bit #4 were set, it's cleared as | ||
155 | + part of device eject. | ||
156 | + 4: | ||
157 | + if set to 1, OSPM hands over device eject to firmware. | ||
158 | + Firmware shall issue device eject request as described above | ||
159 | + (bit #3) and OSPM should not touch device eject bit (#3) in case | ||
160 | + it's asked firmware to perform CPU device eject. | ||
161 | + 5-7: | ||
162 | + reserved, OSPM must clear them before writing to register | ||
163 | + | ||
164 | +offset[0x5] | ||
165 | + Command field: (1 byte access) | ||
166 | + | ||
167 | + value: | ||
168 | + | ||
169 | + 0: | ||
170 | + selects a CPU device with inserting/removing events and | ||
171 | + following reads from 'Command data' register return | ||
172 | + selected CPU ('CPU selector' value). | ||
173 | + If no CPU with events found, the current 'CPU selector' doesn't | ||
174 | + change and corresponding insert/remove event flags are not modified. | ||
175 | + | ||
176 | + 1: | ||
177 | + following writes to 'Command data' register set OST event | ||
178 | + register in QEMU | ||
179 | + 2: | ||
180 | + following writes to 'Command data' register set OST status | ||
181 | + register in QEMU | ||
182 | + 3: | ||
183 | + following reads from 'Command data' and 'Command data 2' return | ||
184 | + architecture specific CPU ID value for currently selected CPU. | ||
185 | + other values: | ||
186 | + reserved | ||
187 | + | ||
188 | +offset [0x6-0x7] | ||
189 | + reserved | ||
190 | + | ||
191 | +offset [0x8] | ||
192 | + Command data: (DWORD access) | ||
193 | + | ||
194 | + If last stored 'Command field' value is: | ||
195 | + | ||
196 | + 1: | ||
197 | + stores value into OST event register | ||
198 | + 2: | ||
199 | + stores value into OST status register, triggers | ||
200 | + ACPI_DEVICE_OST QMP event from QEMU to external applications | ||
201 | + with current values of OST event and status registers. | ||
202 | + other values: | ||
203 | + reserved | ||
204 | + | ||
205 | +Typical usecases | ||
206 | +---------------- | ||
207 | + | ||
208 | +(x86) Detecting and enabling modern CPU hotplug interface | ||
209 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
210 | + | ||
211 | +QEMU starts with legacy CPU hotplug interface enabled. Detecting and | ||
212 | +switching to modern interface is based on the 2 legacy CPU hotplug features: | ||
213 | + | ||
214 | +#. Writes into CPU bitmap are ignored. | ||
215 | +#. CPU bitmap always has bit #0 set, corresponding to boot CPU. | ||
216 | + | ||
217 | +Use following steps to detect and enable modern CPU hotplug interface: | ||
218 | + | ||
219 | +#. Store 0x0 to the 'CPU selector' register, attempting to switch to modern mode | ||
220 | +#. Store 0x0 to the 'CPU selector' register, to ensure valid selector value | ||
221 | +#. Store 0x0 to the 'Command field' register | ||
222 | +#. Read the 'Command data 2' register. | ||
223 | + If read value is 0x0, the modern interface is enabled. | ||
224 | + Otherwise legacy or no CPU hotplug interface available | ||
225 | + | ||
226 | +Get a cpu with pending event | ||
227 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
228 | + | ||
229 | +#. Store 0x0 to the 'CPU selector' register. | ||
230 | +#. Store 0x0 to the 'Command field' register. | ||
231 | +#. Read the 'CPU device status fields' register. | ||
232 | +#. If both bit #1 and bit #2 are clear in the value read, there is no CPU | ||
233 | + with a pending event and selected CPU remains unchanged. | ||
234 | +#. Otherwise, read the 'Command data' register. The value read is the | ||
235 | + selector of the CPU with the pending event (which is already selected). | ||
236 | + | ||
237 | +Enumerate CPUs present/non present CPUs | ||
238 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
239 | + | ||
240 | +#. Set the present CPU count to 0. | ||
241 | +#. Set the iterator to 0. | ||
242 | +#. Store 0x0 to the 'CPU selector' register, to ensure that it's in | ||
243 | + a valid state and that access to other registers won't be ignored. | ||
244 | +#. Store 0x0 to the 'Command field' register to make 'Command data' | ||
245 | + register return 'CPU selector' value of selected CPU | ||
246 | +#. Read the 'CPU device status fields' register. | ||
247 | +#. If bit #0 is set, increment the present CPU count. | ||
248 | +#. Increment the iterator. | ||
249 | +#. Store the iterator to the 'CPU selector' register. | ||
250 | +#. Read the 'Command data' register. | ||
251 | +#. If the value read is not zero, goto 05. | ||
252 | +#. Otherwise store 0x0 to the 'CPU selector' register, to put it | ||
253 | + into a valid state and exit. | ||
254 | + The iterator at this point equals "max_cpus". | ||
255 | diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt | ||
256 | deleted file mode 100644 | ||
257 | index XXXXXXX..XXXXXXX | ||
258 | --- a/docs/specs/acpi_cpu_hotplug.txt | ||
259 | +++ /dev/null | ||
260 | @@ -XXX,XX +XXX,XX @@ | ||
261 | -QEMU<->ACPI BIOS CPU hotplug interface | ||
262 | --------------------------------------- | ||
263 | - | ||
264 | -QEMU supports CPU hotplug via ACPI. This document | ||
265 | -describes the interface between QEMU and the ACPI BIOS. | ||
266 | - | ||
267 | -ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add | ||
268 | -and hot-remove events. | ||
269 | - | ||
270 | -============================================ | ||
271 | -Legacy ACPI CPU hotplug interface registers: | ||
272 | --------------------------------------------- | ||
273 | -CPU present bitmap for: | ||
274 | - ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) | ||
275 | - PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) | ||
276 | - One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. | ||
277 | - The first DWORD in bitmap is used in write mode to switch from legacy | ||
278 | - to modern CPU hotplug interface, write 0 into it to do switch. | ||
279 | ---------------------------------------------------------------- | ||
280 | -QEMU sets corresponding CPU bit on hot-add event and issues SCI | ||
281 | -with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler | ||
282 | -to notify OS about CPU hot-add events. CPU hot-remove isn't supported. | ||
283 | - | ||
284 | -===================================== | ||
285 | -Modern ACPI CPU hotplug interface registers: | ||
286 | -------------------------------------- | ||
287 | -Register block base address: | ||
288 | - ICH9-LPC IO port 0x0cd8 | ||
289 | - PIIX-PM IO port 0xaf00 | ||
290 | -Register block size: | ||
291 | - ACPI_CPU_HOTPLUG_REG_LEN = 12 | ||
292 | - | ||
293 | -All accesses to registers described below, imply little-endian byte order. | ||
294 | - | ||
295 | -Reserved resisters behavior: | ||
296 | - - write accesses are ignored | ||
297 | - - read accesses return all bits set to 0. | ||
298 | - | ||
299 | -The last stored value in 'CPU selector' must refer to a possible CPU, otherwise | ||
300 | - - reads from any register return 0 | ||
301 | - - writes to any other register are ignored until valid value is stored into it | ||
302 | -On QEMU start, 'CPU selector' is initialized to a valid value, on reset it | ||
303 | -keeps the current value. | ||
304 | - | ||
305 | -read access: | ||
306 | - offset: | ||
307 | - [0x0-0x3] Command data 2: (DWORD access) | ||
308 | - if value last stored in 'Command field': | ||
309 | - 0: reads as 0x0 | ||
310 | - 3: upper 32 bits of architecture specific CPU ID value | ||
311 | - other values: reserved | ||
312 | - [0x4] CPU device status fields: (1 byte access) | ||
313 | - bits: | ||
314 | - 0: Device is enabled and may be used by guest | ||
315 | - 1: Device insert event, used to distinguish device for which | ||
316 | - no device check event to OSPM was issued. | ||
317 | - It's valid only when bit 0 is set. | ||
318 | - 2: Device remove event, used to distinguish device for which | ||
319 | - no device eject request to OSPM was issued. Firmware must | ||
320 | - ignore this bit. | ||
321 | - 3: reserved and should be ignored by OSPM | ||
322 | - 4: if set to 1, OSPM requests firmware to perform device eject. | ||
323 | - 5-7: reserved and should be ignored by OSPM | ||
324 | - [0x5-0x7] reserved | ||
325 | - [0x8] Command data: (DWORD access) | ||
326 | - contains 0 unless value last stored in 'Command field' is one of: | ||
327 | - 0: contains 'CPU selector' value of a CPU with pending event[s] | ||
328 | - 3: lower 32 bits of architecture specific CPU ID value | ||
329 | - (in x86 case: APIC ID) | ||
330 | - | ||
331 | -write access: | ||
332 | - offset: | ||
333 | - [0x0-0x3] CPU selector: (DWORD access) | ||
334 | - selects active CPU device. All following accesses to other | ||
335 | - registers will read/store data from/to selected CPU. | ||
336 | - Valid values: [0 .. max_cpus) | ||
337 | - [0x4] CPU device control fields: (1 byte access) | ||
338 | - bits: | ||
339 | - 0: reserved, OSPM must clear it before writing to register. | ||
340 | - 1: if set to 1 clears device insert event, set by OSPM | ||
341 | - after it has emitted device check event for the | ||
342 | - selected CPU device | ||
343 | - 2: if set to 1 clears device remove event, set by OSPM | ||
344 | - after it has emitted device eject request for the | ||
345 | - selected CPU device. | ||
346 | - 3: if set to 1 initiates device eject, set by OSPM when it | ||
347 | - triggers CPU device removal and calls _EJ0 method or by firmware | ||
348 | - when bit #4 is set. In case bit #4 were set, it's cleared as | ||
349 | - part of device eject. | ||
350 | - 4: if set to 1, OSPM hands over device eject to firmware. | ||
351 | - Firmware shall issue device eject request as described above | ||
352 | - (bit #3) and OSPM should not touch device eject bit (#3) in case | ||
353 | - it's asked firmware to perform CPU device eject. | ||
354 | - 5-7: reserved, OSPM must clear them before writing to register | ||
355 | - [0x5] Command field: (1 byte access) | ||
356 | - value: | ||
357 | - 0: selects a CPU device with inserting/removing events and | ||
358 | - following reads from 'Command data' register return | ||
359 | - selected CPU ('CPU selector' value). | ||
360 | - If no CPU with events found, the current 'CPU selector' doesn't | ||
361 | - change and corresponding insert/remove event flags are not modified. | ||
362 | - 1: following writes to 'Command data' register set OST event | ||
363 | - register in QEMU | ||
364 | - 2: following writes to 'Command data' register set OST status | ||
365 | - register in QEMU | ||
366 | - 3: following reads from 'Command data' and 'Command data 2' return | ||
367 | - architecture specific CPU ID value for currently selected CPU. | ||
368 | - other values: reserved | ||
369 | - [0x6-0x7] reserved | ||
370 | - [0x8] Command data: (DWORD access) | ||
371 | - if last stored 'Command field' value: | ||
372 | - 1: stores value into OST event register | ||
373 | - 2: stores value into OST status register, triggers | ||
374 | - ACPI_DEVICE_OST QMP event from QEMU to external applications | ||
375 | - with current values of OST event and status registers. | ||
376 | - other values: reserved | ||
377 | - | ||
378 | -Typical usecases: | ||
379 | - - (x86) Detecting and enabling modern CPU hotplug interface. | ||
380 | - QEMU starts with legacy CPU hotplug interface enabled. Detecting and | ||
381 | - switching to modern interface is based on the 2 legacy CPU hotplug features: | ||
382 | - 1. Writes into CPU bitmap are ignored. | ||
383 | - 2. CPU bitmap always has bit#0 set, corresponding to boot CPU. | ||
384 | - | ||
385 | - Use following steps to detect and enable modern CPU hotplug interface: | ||
386 | - 1. Store 0x0 to the 'CPU selector' register, | ||
387 | - attempting to switch to modern mode | ||
388 | - 2. Store 0x0 to the 'CPU selector' register, | ||
389 | - to ensure valid selector value | ||
390 | - 3. Store 0x0 to the 'Command field' register, | ||
391 | - 4. Read the 'Command data 2' register. | ||
392 | - If read value is 0x0, the modern interface is enabled. | ||
393 | - Otherwise legacy or no CPU hotplug interface available | ||
394 | - | ||
395 | - - Get a cpu with pending event | ||
396 | - 1. Store 0x0 to the 'CPU selector' register. | ||
397 | - 2. Store 0x0 to the 'Command field' register. | ||
398 | - 3. Read the 'CPU device status fields' register. | ||
399 | - 4. If both bit#1 and bit#2 are clear in the value read, there is no CPU | ||
400 | - with a pending event and selected CPU remains unchanged. | ||
401 | - 5. Otherwise, read the 'Command data' register. The value read is the | ||
402 | - selector of the CPU with the pending event (which is already | ||
403 | - selected). | ||
404 | - | ||
405 | - - Enumerate CPUs present/non present CPUs | ||
406 | - 01. Set the present CPU count to 0. | ||
407 | - 02. Set the iterator to 0. | ||
408 | - 03. Store 0x0 to the 'CPU selector' register, to ensure that it's in | ||
409 | - a valid state and that access to other registers won't be ignored. | ||
410 | - 04. Store 0x0 to the 'Command field' register to make 'Command data' | ||
411 | - register return 'CPU selector' value of selected CPU | ||
412 | - 05. Read the 'CPU device status fields' register. | ||
413 | - 06. If bit#0 is set, increment the present CPU count. | ||
414 | - 07. Increment the iterator. | ||
415 | - 08. Store the iterator to the 'CPU selector' register. | ||
416 | - 09. Read the 'Command data' register. | ||
417 | - 10. If the value read is not zero, goto 05. | ||
418 | - 11. Otherwise store 0x0 to the 'CPU selector' register, to put it | ||
419 | - into a valid state and exit. | ||
420 | - The iterator at this point equals "max_cpus". | ||
421 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
422 | index XXXXXXX..XXXXXXX 100644 | ||
423 | --- a/docs/specs/index.rst | ||
424 | +++ b/docs/specs/index.rst | ||
425 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | ||
426 | acpi_hw_reduced_hotplug | ||
427 | tpm | ||
428 | acpi_hest_ghes | ||
429 | + acpi_cpu_hotplug | ||
430 | -- | ||
431 | 2.20.1 | ||
432 | |||
433 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Convert the PCI hotplug spec document to rST. | ||
2 | 1 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
5 | --- | ||
6 | ...i_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++++++++++--------- | ||
7 | docs/specs/index.rst | 1 + | ||
8 | 2 files changed, 21 insertions(+), 17 deletions(-) | ||
9 | rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%) | ||
10 | |||
11 | diff --git a/docs/specs/acpi_pci_hotplug.txt b/docs/specs/acpi_pci_hotplug.rst | ||
12 | similarity index 51% | ||
13 | rename from docs/specs/acpi_pci_hotplug.txt | ||
14 | rename to docs/specs/acpi_pci_hotplug.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/specs/acpi_pci_hotplug.txt | ||
17 | +++ b/docs/specs/acpi_pci_hotplug.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | QEMU<->ACPI BIOS PCI hotplug interface | ||
20 | --------------------------------------- | ||
21 | +====================================== | ||
22 | |||
23 | QEMU supports PCI hotplug via ACPI, for PCI bus 0. This document | ||
24 | describes the interface between QEMU and the ACPI BIOS. | ||
25 | |||
26 | -ACPI GPE block (IO ports 0xafe0-0xafe3, byte access): | ||
27 | ------------------------------------------ | ||
28 | +ACPI GPE block (IO ports 0xafe0-0xafe3, byte access) | ||
29 | +---------------------------------------------------- | ||
30 | |||
31 | Generic ACPI GPE block. Bit 1 (GPE.1) used to notify PCI hotplug/eject | ||
32 | event to ACPI BIOS, via SCI interrupt. | ||
33 | |||
34 | -PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access): | ||
35 | ---------------------------------------------------------------- | ||
36 | +PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access) | ||
37 | +------------------------------------------------------------------------------ | ||
38 | + | ||
39 | Slot injection notification pending. One bit per slot. | ||
40 | |||
41 | Read by ACPI BIOS GPE.1 handler to notify OS of injection | ||
42 | events. Read-only. | ||
43 | |||
44 | -PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access): | ||
45 | ------------------------------------------------------ | ||
46 | +PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access) | ||
47 | +-------------------------------------------------------------------- | ||
48 | + | ||
49 | Slot removal notification pending. One bit per slot. | ||
50 | |||
51 | Read by ACPI BIOS GPE.1 handler to notify OS of removal | ||
52 | events. Read-only. | ||
53 | |||
54 | -PCI device eject (IO port 0xae08-0xae0b, 4-byte access): | ||
55 | ----------------------------------------- | ||
56 | +PCI device eject (IO port 0xae08-0xae0b, 4-byte access) | ||
57 | +------------------------------------------------------- | ||
58 | |||
59 | Write: Used by ACPI BIOS _EJ0 method to request device removal. | ||
60 | One bit per slot. | ||
61 | |||
62 | Read: Hotplug features register. Used by platform to identify features | ||
63 | available. Current base feature set (no bits set): | ||
64 | - - Read-only "up" register @0xae00, 4-byte access, bit per slot | ||
65 | - - Read-only "down" register @0xae04, 4-byte access, bit per slot | ||
66 | - - Read/write "eject" register @0xae08, 4-byte access, | ||
67 | - write: bit per slot eject, read: hotplug feature set | ||
68 | - - Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot | ||
69 | |||
70 | -PCI removability status (IO port 0xae0c-0xae0f, 4-byte access): | ||
71 | ------------------------------------------------ | ||
72 | +- Read-only "up" register @0xae00, 4-byte access, bit per slot | ||
73 | +- Read-only "down" register @0xae04, 4-byte access, bit per slot | ||
74 | +- Read/write "eject" register @0xae08, 4-byte access, | ||
75 | + write: bit per slot eject, read: hotplug feature set | ||
76 | +- Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot | ||
77 | + | ||
78 | +PCI removability status (IO port 0xae0c-0xae0f, 4-byte access) | ||
79 | +-------------------------------------------------------------- | ||
80 | |||
81 | Used by ACPI BIOS _RMV method to indicate removability status to OS. One | ||
82 | -bit per slot. Read-only | ||
83 | +bit per slot. Read-only. | ||
84 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/docs/specs/index.rst | ||
87 | +++ b/docs/specs/index.rst | ||
88 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | ||
89 | acpi_hest_ghes | ||
90 | acpi_cpu_hotplug | ||
91 | acpi_mem_hotplug | ||
92 | + acpi_pci_hotplug | ||
93 | -- | ||
94 | 2.20.1 | ||
95 | |||
96 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of using an ifdef ladder in arch_init.c (which we then have | ||
2 | to manually update every time we add or remove a target | ||
3 | architecture), have meson.build put "#define QEMU_ARCH QEMU_ARCH_FOO" | ||
4 | in the config-target.h file. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20210730105947.28215-5-peter.maydell@linaro.org | ||
10 | --- | ||
11 | meson.build | 2 ++ | ||
12 | softmmu/arch_init.c | 41 ----------------------------------------- | ||
13 | 2 files changed, 2 insertions(+), 41 deletions(-) | ||
14 | |||
15 | diff --git a/meson.build b/meson.build | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/meson.build | ||
18 | +++ b/meson.build | ||
19 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | ||
20 | config_target_data.set(k, v) | ||
21 | endif | ||
22 | endforeach | ||
23 | + config_target_data.set('QEMU_ARCH', | ||
24 | + 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper()) | ||
25 | config_target_h += {target: configure_file(output: target + '-config-target.h', | ||
26 | configuration: config_target_data)} | ||
27 | |||
28 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/softmmu/arch_init.c | ||
31 | +++ b/softmmu/arch_init.c | ||
32 | @@ -XXX,XX +XXX,XX @@ int graphic_height = 600; | ||
33 | int graphic_depth = 32; | ||
34 | #endif | ||
35 | |||
36 | - | ||
37 | -#if defined(TARGET_ALPHA) | ||
38 | -#define QEMU_ARCH QEMU_ARCH_ALPHA | ||
39 | -#elif defined(TARGET_ARM) | ||
40 | -#define QEMU_ARCH QEMU_ARCH_ARM | ||
41 | -#elif defined(TARGET_CRIS) | ||
42 | -#define QEMU_ARCH QEMU_ARCH_CRIS | ||
43 | -#elif defined(TARGET_HPPA) | ||
44 | -#define QEMU_ARCH QEMU_ARCH_HPPA | ||
45 | -#elif defined(TARGET_I386) | ||
46 | -#define QEMU_ARCH QEMU_ARCH_I386 | ||
47 | -#elif defined(TARGET_M68K) | ||
48 | -#define QEMU_ARCH QEMU_ARCH_M68K | ||
49 | -#elif defined(TARGET_MICROBLAZE) | ||
50 | -#define QEMU_ARCH QEMU_ARCH_MICROBLAZE | ||
51 | -#elif defined(TARGET_MIPS) | ||
52 | -#define QEMU_ARCH QEMU_ARCH_MIPS | ||
53 | -#elif defined(TARGET_NIOS2) | ||
54 | -#define QEMU_ARCH QEMU_ARCH_NIOS2 | ||
55 | -#elif defined(TARGET_OPENRISC) | ||
56 | -#define QEMU_ARCH QEMU_ARCH_OPENRISC | ||
57 | -#elif defined(TARGET_PPC) | ||
58 | -#define QEMU_ARCH QEMU_ARCH_PPC | ||
59 | -#elif defined(TARGET_RISCV) | ||
60 | -#define QEMU_ARCH QEMU_ARCH_RISCV | ||
61 | -#elif defined(TARGET_RX) | ||
62 | -#define QEMU_ARCH QEMU_ARCH_RX | ||
63 | -#elif defined(TARGET_S390X) | ||
64 | -#define QEMU_ARCH QEMU_ARCH_S390X | ||
65 | -#elif defined(TARGET_SH4) | ||
66 | -#define QEMU_ARCH QEMU_ARCH_SH4 | ||
67 | -#elif defined(TARGET_SPARC) | ||
68 | -#define QEMU_ARCH QEMU_ARCH_SPARC | ||
69 | -#elif defined(TARGET_TRICORE) | ||
70 | -#define QEMU_ARCH QEMU_ARCH_TRICORE | ||
71 | -#elif defined(TARGET_XTENSA) | ||
72 | -#define QEMU_ARCH QEMU_ARCH_XTENSA | ||
73 | -#elif defined(TARGET_AVR) | ||
74 | -#define QEMU_ARCH QEMU_ARCH_AVR | ||
75 | -#endif | ||
76 | - | ||
77 | const uint32_t arch_type = QEMU_ARCH; | ||
78 | -- | ||
79 | 2.20.1 | ||
80 | |||
81 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | arch_init.h only defines the QEMU_ARCH_* enumeration and the | ||
2 | arch_type global. Don't include it in files that don't use those. | ||
3 | 1 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20210730105947.28215-8-peter.maydell@linaro.org | ||
9 | --- | ||
10 | blockdev.c | 1 - | ||
11 | hw/i386/pc.c | 1 - | ||
12 | hw/i386/pc_piix.c | 1 - | ||
13 | hw/i386/pc_q35.c | 1 - | ||
14 | hw/mips/jazz.c | 1 - | ||
15 | hw/mips/malta.c | 1 - | ||
16 | hw/ppc/prep.c | 1 - | ||
17 | hw/riscv/sifive_e.c | 1 - | ||
18 | hw/riscv/sifive_u.c | 1 - | ||
19 | hw/riscv/spike.c | 1 - | ||
20 | hw/riscv/virt.c | 1 - | ||
21 | monitor/qmp-cmds.c | 1 - | ||
22 | target/ppc/cpu_init.c | 1 - | ||
23 | target/s390x/cpu-sysemu.c | 1 - | ||
24 | 14 files changed, 14 deletions(-) | ||
25 | |||
26 | diff --git a/blockdev.c b/blockdev.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/blockdev.c | ||
29 | +++ b/blockdev.c | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | #include "sysemu/iothread.h" | ||
32 | #include "block/block_int.h" | ||
33 | #include "block/trace.h" | ||
34 | -#include "sysemu/arch_init.h" | ||
35 | #include "sysemu/runstate.h" | ||
36 | #include "sysemu/replay.h" | ||
37 | #include "qemu/cutils.h" | ||
38 | diff --git a/hw/i386/pc.c b/hw/i386/pc.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/i386/pc.c | ||
41 | +++ b/hw/i386/pc.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | #include "hw/xen/start_info.h" | ||
44 | #include "ui/qemu-spice.h" | ||
45 | #include "exec/memory.h" | ||
46 | -#include "sysemu/arch_init.h" | ||
47 | #include "qemu/bitmap.h" | ||
48 | #include "qemu/config-file.h" | ||
49 | #include "qemu/error-report.h" | ||
50 | diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/i386/pc_piix.c | ||
53 | +++ b/hw/i386/pc_piix.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | #include "sysemu/kvm.h" | ||
56 | #include "hw/kvm/clock.h" | ||
57 | #include "hw/sysbus.h" | ||
58 | -#include "sysemu/arch_init.h" | ||
59 | #include "hw/i2c/smbus_eeprom.h" | ||
60 | #include "hw/xen/xen-x86.h" | ||
61 | #include "exec/memory.h" | ||
62 | diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/i386/pc_q35.c | ||
65 | +++ b/hw/i386/pc_q35.c | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | #include "qemu/osdep.h" | ||
68 | #include "qemu/units.h" | ||
69 | #include "hw/loader.h" | ||
70 | -#include "sysemu/arch_init.h" | ||
71 | #include "hw/i2c/smbus_eeprom.h" | ||
72 | #include "hw/rtc/mc146818rtc.h" | ||
73 | #include "sysemu/kvm.h" | ||
74 | diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/hw/mips/jazz.c | ||
77 | +++ b/hw/mips/jazz.c | ||
78 | @@ -XXX,XX +XXX,XX @@ | ||
79 | #include "hw/isa/isa.h" | ||
80 | #include "hw/block/fdc.h" | ||
81 | #include "sysemu/sysemu.h" | ||
82 | -#include "sysemu/arch_init.h" | ||
83 | #include "hw/boards.h" | ||
84 | #include "net/net.h" | ||
85 | #include "hw/scsi/esp.h" | ||
86 | diff --git a/hw/mips/malta.c b/hw/mips/malta.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/mips/malta.c | ||
89 | +++ b/hw/mips/malta.c | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | #include "hw/mips/mips.h" | ||
92 | #include "hw/mips/cpudevs.h" | ||
93 | #include "hw/pci/pci.h" | ||
94 | -#include "sysemu/arch_init.h" | ||
95 | #include "qemu/log.h" | ||
96 | #include "hw/mips/bios.h" | ||
97 | #include "hw/ide.h" | ||
98 | diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/hw/ppc/prep.c | ||
101 | +++ b/hw/ppc/prep.c | ||
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | #include "hw/rtc/mc146818rtc.h" | ||
104 | #include "hw/isa/pc87312.h" | ||
105 | #include "hw/qdev-properties.h" | ||
106 | -#include "sysemu/arch_init.h" | ||
107 | #include "sysemu/kvm.h" | ||
108 | #include "sysemu/reset.h" | ||
109 | #include "trace.h" | ||
110 | diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/hw/riscv/sifive_e.c | ||
113 | +++ b/hw/riscv/sifive_e.c | ||
114 | @@ -XXX,XX +XXX,XX @@ | ||
115 | #include "hw/intc/sifive_plic.h" | ||
116 | #include "hw/misc/sifive_e_prci.h" | ||
117 | #include "chardev/char.h" | ||
118 | -#include "sysemu/arch_init.h" | ||
119 | #include "sysemu/sysemu.h" | ||
120 | |||
121 | static const MemMapEntry sifive_e_memmap[] = { | ||
122 | diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c | ||
123 | index XXXXXXX..XXXXXXX 100644 | ||
124 | --- a/hw/riscv/sifive_u.c | ||
125 | +++ b/hw/riscv/sifive_u.c | ||
126 | @@ -XXX,XX +XXX,XX @@ | ||
127 | #include "hw/intc/sifive_plic.h" | ||
128 | #include "chardev/char.h" | ||
129 | #include "net/eth.h" | ||
130 | -#include "sysemu/arch_init.h" | ||
131 | #include "sysemu/device_tree.h" | ||
132 | #include "sysemu/runstate.h" | ||
133 | #include "sysemu/sysemu.h" | ||
134 | diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/hw/riscv/spike.c | ||
137 | +++ b/hw/riscv/spike.c | ||
138 | @@ -XXX,XX +XXX,XX @@ | ||
139 | #include "hw/char/riscv_htif.h" | ||
140 | #include "hw/intc/sifive_clint.h" | ||
141 | #include "chardev/char.h" | ||
142 | -#include "sysemu/arch_init.h" | ||
143 | #include "sysemu/device_tree.h" | ||
144 | #include "sysemu/sysemu.h" | ||
145 | |||
146 | diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/riscv/virt.c | ||
149 | +++ b/hw/riscv/virt.c | ||
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | #include "hw/intc/sifive_plic.h" | ||
152 | #include "hw/misc/sifive_test.h" | ||
153 | #include "chardev/char.h" | ||
154 | -#include "sysemu/arch_init.h" | ||
155 | #include "sysemu/device_tree.h" | ||
156 | #include "sysemu/sysemu.h" | ||
157 | #include "hw/pci/pci.h" | ||
158 | diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/monitor/qmp-cmds.c | ||
161 | +++ b/monitor/qmp-cmds.c | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | #include "sysemu/kvm.h" | ||
164 | #include "sysemu/runstate.h" | ||
165 | #include "sysemu/runstate-action.h" | ||
166 | -#include "sysemu/arch_init.h" | ||
167 | #include "sysemu/blockdev.h" | ||
168 | #include "sysemu/block-backend.h" | ||
169 | #include "qapi/error.h" | ||
170 | diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c | ||
171 | index XXXXXXX..XXXXXXX 100644 | ||
172 | --- a/target/ppc/cpu_init.c | ||
173 | +++ b/target/ppc/cpu_init.c | ||
174 | @@ -XXX,XX +XXX,XX @@ | ||
175 | #include "disas/dis-asm.h" | ||
176 | #include "exec/gdbstub.h" | ||
177 | #include "kvm_ppc.h" | ||
178 | -#include "sysemu/arch_init.h" | ||
179 | #include "sysemu/cpus.h" | ||
180 | #include "sysemu/hw_accel.h" | ||
181 | #include "sysemu/tcg.h" | ||
182 | diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c | ||
183 | index XXXXXXX..XXXXXXX 100644 | ||
184 | --- a/target/s390x/cpu-sysemu.c | ||
185 | +++ b/target/s390x/cpu-sysemu.c | ||
186 | @@ -XXX,XX +XXX,XX @@ | ||
187 | |||
188 | #include "hw/s390x/pv.h" | ||
189 | #include "hw/boards.h" | ||
190 | -#include "sysemu/arch_init.h" | ||
191 | #include "sysemu/sysemu.h" | ||
192 | #include "sysemu/tcg.h" | ||
193 | #include "hw/core/sysemu-cpu-ops.h" | ||
194 | -- | ||
195 | 2.20.1 | ||
196 | |||
197 | diff view generated by jsdifflib |