1 | target-arm queue for softfreeze: | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | This has all the big stuff I want to get in for softfreeze; | ||
3 | there may be one or two smaller patches I pick up later in | ||
4 | the week. | ||
5 | 2 | ||
6 | thanks | 3 | thanks |
7 | -- PMM | 4 | -- PMM |
8 | 5 | ||
9 | The following changes since commit 0984a157c1c053394adbf64ed7de97f1aebe6a2d: | 6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: |
10 | 7 | ||
11 | Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2019-03-05 09:33:20 +0000) | 8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) |
12 | 9 | ||
13 | are available in the Git repository at: | 10 | are available in the Git repository at: |
14 | 11 | ||
15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190305 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
16 | 13 | ||
17 | for you to fetch changes up to 566528f823d1a2e9eb2d7b2ed839547cb31bfc34: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
18 | 15 | ||
19 | hw/arm/stellaris: Implement watchdog timer (2019-03-05 15:55:09 +0000) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
20 | 17 | ||
21 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
22 | target-arm queue: | 19 | target-arm queue: |
23 | * Fix PC test for LDM (exception return) | 20 | * ITS: error reporting cleanup |
24 | * Implement ARMv8.0-SB | 21 | * aspeed: improve documentation |
25 | * Implement ARMv8.0-PredInv | 22 | * Fix STM32F2XX USART data register readout |
26 | * Implement ARMv8.4-CondM | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
27 | * Implement ARMv8.5-CondM | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
28 | * Implement ARMv8.5-FRINT | 25 | * Correct calculation of tlb range invalidate length |
29 | * hw/arm/stellaris: Implement watchdog timer | 26 | * npcm7xx_emc: fix missing queue_flush |
30 | * virt: support more than 255GB of RAM | 27 | * virt: Add VIOT ACPI table for virtio-iommu |
28 | * target/i386: Use assert() to sanity-check b1 in SSE decode | ||
29 | * Don't include qemu-common unnecessarily | ||
31 | 30 | ||
32 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
33 | Eric Auger (9): | 32 | Alex Bennée (1): |
34 | hw/arm/virt: Rename highmem IO regions | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
35 | hw/arm/virt: Split the memory map description | ||
36 | hw/boards: Add a MachineState parameter to kvm_type callback | ||
37 | kvm: add kvm_arm_get_max_vm_ipa_size | ||
38 | vl: Set machine ram_size, maxram_size and ram_slots earlier | ||
39 | hw/arm/virt: Dynamic memory map depending on RAM requirements | ||
40 | hw/arm/virt: Implement kvm_type function for 4.0 machine | ||
41 | hw/arm/virt: Check the VCPU PA range in TCG mode | ||
42 | hw/arm/virt: Bump the 255GB initial RAM limit | ||
43 | 34 | ||
44 | Michel Heily (1): | 35 | Jean-Philippe Brucker (8): |
45 | hw/arm/stellaris: Implement watchdog timer | 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 | ||
46 | 44 | ||
47 | Richard Henderson (11): | 45 | Joel Stanley (4): |
48 | target/arm: Fix PC test for LDM (exception return) | 46 | docs: aspeed: Add new boards |
49 | target/arm: Split out arm_sctlr | 47 | docs: aspeed: Update OpenBMC image URL |
50 | target/arm: Implement ARMv8.0-SB | 48 | docs: aspeed: Give an example of booting a kernel |
51 | target/arm: Implement ARMv8.0-PredInv | 49 | docs: aspeed: ADC is now modelled |
52 | target/arm: Split helper_msr_i_pstate into 3 | ||
53 | target/arm: Add set/clear_pstate_bits, share gen_ss_advance | ||
54 | target/arm: Rearrange disas_data_proc_reg | ||
55 | target/arm: Implement ARMv8.4-CondM | ||
56 | target/arm: Implement ARMv8.5-CondM | ||
57 | target/arm: Restructure handle_fp_1src_{single, double} | ||
58 | target/arm: Implement ARMv8.5-FRINT | ||
59 | 50 | ||
60 | Shameer Kolothum (1): | 51 | Olivier Hériveaux (1): |
61 | hw/arm/boot: introduce fdt_add_memory_node helper | 52 | Fix STM32F2XX USART data register readout |
62 | 53 | ||
63 | include/hw/arm/virt.h | 16 +- | 54 | Patrick Venture (1): |
64 | include/hw/boards.h | 5 +- | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
65 | include/hw/watchdog/cmsdk-apb-watchdog.h | 8 + | ||
66 | target/arm/cpu.h | 64 ++++- | ||
67 | target/arm/helper-a64.h | 3 + | ||
68 | target/arm/helper.h | 8 +- | ||
69 | target/arm/internals.h | 15 + | ||
70 | target/arm/kvm_arm.h | 13 + | ||
71 | target/arm/translate.h | 34 +++ | ||
72 | accel/kvm/kvm-all.c | 2 +- | ||
73 | hw/arm/boot.c | 54 ++-- | ||
74 | hw/arm/stellaris.c | 22 +- | ||
75 | hw/arm/virt-acpi-build.c | 10 +- | ||
76 | hw/arm/virt.c | 196 ++++++++++--- | ||
77 | hw/ppc/mac_newworld.c | 3 +- | ||
78 | hw/ppc/mac_oldworld.c | 2 +- | ||
79 | hw/ppc/spapr.c | 2 +- | ||
80 | hw/watchdog/cmsdk-apb-watchdog.c | 74 ++++- | ||
81 | linux-user/elfload.c | 2 + | ||
82 | target/arm/cpu.c | 2 + | ||
83 | target/arm/cpu64.c | 6 + | ||
84 | target/arm/helper-a64.c | 30 ++ | ||
85 | target/arm/helper.c | 63 +++- | ||
86 | target/arm/kvm.c | 10 + | ||
87 | target/arm/op_helper.c | 47 --- | ||
88 | target/arm/translate-a64.c | 478 +++++++++++++++++++++++-------- | ||
89 | target/arm/translate.c | 35 ++- | ||
90 | target/arm/vfp_helper.c | 96 +++++++ | ||
91 | vl.c | 6 +- | ||
92 | 29 files changed, 1032 insertions(+), 274 deletions(-) | ||
93 | 56 | ||
57 | Peter Maydell (6): | ||
58 | target/i386: Use assert() to sanity-check b1 in SSE decode | ||
59 | include/hw/i386: Don't include qemu-common.h in .h files | ||
60 | target/hexagon/cpu.h: don't include qemu-common.h | ||
61 | target/rx/cpu.h: Don't include qemu-common.h | ||
62 | hw/arm: Don't include qemu-common.h unnecessarily | ||
63 | target/arm: Correct calculation of tlb range invalidate length | ||
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 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Up to now the memory map has been static and the high IO region | 3 | While trying to debug a GIC ITS failure I saw some guest errors that |
4 | base has always been 256GiB. | 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. | ||
5 | 8 | ||
6 | This patch modifies the virt_set_memmap() function, which freezes | 9 | I still get a failure with the current kvm-unit-tests but at least I |
7 | the memory map, so that the high IO range base becomes floating, | 10 | know (partially) why now: |
8 | located after the initial RAM and the device memory. | ||
9 | 11 | ||
10 | The function computes | 12 | Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 |
11 | - the base of the device memory, | 13 | PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI |
12 | - the size of the device memory, | 14 | ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 |
13 | - the high IO region base | 15 | INT dev_id=2 event_id=20 |
14 | - the highest GPA used in the memory map. | 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 | ||
15 | 19 | ||
16 | Entries of the high IO region are assigned a base address. The | 20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
17 | device memory is initialized. | 21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
18 | 22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | |
19 | The highest GPA used in the memory map will be used at VM creation | 23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> |
20 | to choose the requested IPA size. | 24 | Cc: Peter Maydell <peter.maydell@linaro.org> |
21 | |||
22 | Setting all the existing highmem IO regions beyond the RAM | ||
23 | allows to have a single contiguous RAM region (initial RAM and | ||
24 | possible hotpluggable device memory). That way we do not need | ||
25 | to do invasive changes in the EDK2 FW to support a dynamic | ||
26 | RAM base. | ||
27 | |||
28 | Still the user cannot request an initial RAM size greater than 255GB. | ||
29 | |||
30 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
31 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
32 | Message-id: 20190304101339.25970-8-eric.auger@redhat.com | ||
33 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
34 | --- | 26 | --- |
35 | include/hw/arm/virt.h | 1 + | 27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ |
36 | hw/arm/virt.c | 52 ++++++++++++++++++++++++++++++++++++++----- | 28 | 1 file changed, 27 insertions(+), 12 deletions(-) |
37 | 2 files changed, 47 insertions(+), 6 deletions(-) | ||
38 | 29 | ||
39 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | 30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c |
40 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/include/hw/arm/virt.h | 32 | --- a/hw/intc/arm_gicv3_its.c |
42 | +++ b/include/hw/arm/virt.h | 33 | +++ b/hw/intc/arm_gicv3_its.c |
43 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, |
44 | uint32_t msi_phandle; | 35 | if (res != MEMTX_OK) { |
45 | uint32_t iommu_phandle; | 36 | return result; |
46 | int psci_conduit; | 37 | } |
47 | + hwaddr highest_gpa; | 38 | + } else { |
48 | } VirtMachineState; | 39 | + qemu_log_mask(LOG_GUEST_ERROR, |
49 | 40 | + "%s: invalid command attributes: " | |
50 | #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) | 41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", |
51 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 42 | + __func__, dte, devid, res); |
52 | index XXXXXXX..XXXXXXX 100644 | 43 | + return result; |
53 | --- a/hw/arm/virt.c | ||
54 | +++ b/hw/arm/virt.c | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | #include "qapi/visitor.h" | ||
57 | #include "standard-headers/linux/input.h" | ||
58 | #include "hw/arm/smmuv3.h" | ||
59 | +#include "hw/acpi/acpi.h" | ||
60 | |||
61 | #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ | ||
62 | static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | * of a terabyte of RAM will be doing it on a host with more than a | ||
65 | * terabyte of physical address space.) | ||
66 | */ | ||
67 | -#define RAMLIMIT_GB 255 | ||
68 | -#define RAMLIMIT_BYTES (RAMLIMIT_GB * 1024ULL * 1024 * 1024) | ||
69 | +#define LEGACY_RAMLIMIT_GB 255 | ||
70 | +#define LEGACY_RAMLIMIT_BYTES (LEGACY_RAMLIMIT_GB * GiB) | ||
71 | |||
72 | /* Addresses and sizes of our components. | ||
73 | * 0..128MB is space for a flash device so we can run bootrom code such as UEFI. | ||
74 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry base_memmap[] = { | ||
75 | [VIRT_PCIE_MMIO] = { 0x10000000, 0x2eff0000 }, | ||
76 | [VIRT_PCIE_PIO] = { 0x3eff0000, 0x00010000 }, | ||
77 | [VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 }, | ||
78 | - [VIRT_MEM] = { 0x40000000, RAMLIMIT_BYTES }, | ||
79 | + /* Actual RAM size depends on initial RAM and device memory settings */ | ||
80 | + [VIRT_MEM] = { GiB, LEGACY_RAMLIMIT_BYTES }, | ||
81 | }; | ||
82 | |||
83 | /* | ||
84 | @@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx) | ||
85 | |||
86 | static void virt_set_memmap(VirtMachineState *vms) | ||
87 | { | ||
88 | - hwaddr base; | ||
89 | + MachineState *ms = MACHINE(vms); | ||
90 | + hwaddr base, device_memory_base, device_memory_size; | ||
91 | int i; | ||
92 | |||
93 | vms->memmap = extended_memmap; | ||
94 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms) | ||
95 | vms->memmap[i] = base_memmap[i]; | ||
96 | } | 44 | } |
97 | 45 | ||
98 | - base = 256 * GiB; /* Top of the legacy initial RAM region */ | 46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || |
99 | + if (ms->ram_slots > ACPI_MAX_RAM_SLOTS) { | 47 | - !cte_valid || (eventid > max_eventid)) { |
100 | + error_report("unsupported number of memory slots: %"PRIu64, | ||
101 | + ms->ram_slots); | ||
102 | + exit(EXIT_FAILURE); | ||
103 | + } | ||
104 | + | 48 | + |
105 | + /* | 49 | + /* |
106 | + * We compute the base of the high IO region depending on the | 50 | + * In this implementation, in case of guest errors we ignore the |
107 | + * amount of initial and device memory. The device memory start/size | 51 | + * command and move onto the next command in the queue. |
108 | + * is aligned on 1GiB. We never put the high IO region below 256GiB | ||
109 | + * so that if maxram_size is < 255GiB we keep the legacy memory map. | ||
110 | + * The device region size assumes 1GiB page max alignment per slot. | ||
111 | + */ | 52 | + */ |
112 | + device_memory_base = | 53 | + if (devid > s->dt.maxids.max_devids) { |
113 | + ROUND_UP(vms->memmap[VIRT_MEM].base + ms->ram_size, GiB); | 54 | qemu_log_mask(LOG_GUEST_ERROR, |
114 | + device_memory_size = ms->maxram_size - ms->ram_size + ms->ram_slots * GiB; | 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); | ||
115 | + | 67 | + |
116 | + /* Base address of the high IO region */ | 68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { |
117 | + base = device_memory_base + ROUND_UP(device_memory_size, GiB); | 69 | + qemu_log_mask(LOG_GUEST_ERROR, |
118 | + if (base < device_memory_base) { | 70 | + "%s: invalid command attributes: " |
119 | + error_report("maxmem/slots too huge"); | 71 | + "dte: %s, ite: %s, cte: %s\n", |
120 | + exit(EXIT_FAILURE); | 72 | + __func__, |
121 | + } | 73 | + dte_valid ? "valid" : "invalid", |
122 | + if (base < vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES) { | 74 | + ite_valid ? "valid" : "invalid", |
123 | + base = vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES; | 75 | + cte_valid ? "valid" : "invalid"); |
124 | + } | 76 | + } else if (eventid > max_eventid) { |
125 | 77 | + qemu_log_mask(LOG_GUEST_ERROR, | |
126 | for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { | 78 | + "%s: invalid command attributes: eventid %d > %d\n", |
127 | hwaddr size = extended_memmap[i].size; | 79 | + __func__, eventid, max_eventid); |
128 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms) | 80 | } else { |
129 | vms->memmap[i].size = size; | 81 | /* |
130 | base += size; | 82 | * Current implementation only supports rdbase == procnum |
131 | } | ||
132 | + vms->highest_gpa = base - 1; | ||
133 | + if (device_memory_size > 0) { | ||
134 | + ms->device_memory = g_malloc0(sizeof(*ms->device_memory)); | ||
135 | + ms->device_memory->base = device_memory_base; | ||
136 | + memory_region_init(&ms->device_memory->mr, OBJECT(vms), | ||
137 | + "device-memory", device_memory_size); | ||
138 | + } | ||
139 | } | ||
140 | |||
141 | static void machvirt_init(MachineState *machine) | ||
142 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
143 | vms->smp_cpus = smp_cpus; | ||
144 | |||
145 | if (machine->ram_size > vms->memmap[VIRT_MEM].size) { | ||
146 | - error_report("mach-virt: cannot model more than %dGB RAM", RAMLIMIT_GB); | ||
147 | + error_report("mach-virt: cannot model more than %dGB RAM", | ||
148 | + LEGACY_RAMLIMIT_GB); | ||
149 | exit(1); | ||
150 | } | ||
151 | |||
152 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
153 | memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", | ||
154 | machine->ram_size); | ||
155 | memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); | ||
156 | + if (machine->device_memory) { | ||
157 | + memory_region_add_subregion(sysmem, machine->device_memory->base, | ||
158 | + &machine->device_memory->mr); | ||
159 | + } | ||
160 | |||
161 | create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); | ||
162 | |||
163 | -- | 83 | -- |
164 | 2.20.1 | 84 | 2.25.1 |
165 | 85 | ||
166 | 86 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 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 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 7 ++++++- | ||
12 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : | ||
19 | |||
20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC | ||
21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC | ||
22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC | ||
23 | |||
24 | AST2500 SoC based machines : | ||
25 | |||
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 | ----------------- | ||
44 | -- | ||
45 | 2.25.1 | ||
46 | |||
47 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 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 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to | ||
19 | load a Linux kernel or from a firmware. Images can be downloaded from | ||
20 | the OpenBMC jenkins : | ||
21 | |||
22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder | ||
23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | ||
24 | |||
25 | or directly from the OpenBMC GitHub release repository : | ||
26 | |||
27 | -- | ||
28 | 2.25.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | A common use case for the ASPEED machine is to boot a Linux kernel. | ||
4 | Provide a full example command line. | ||
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-4-joel@jms.id.au | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- | ||
12 | 1 file changed, 12 insertions(+), 3 deletions(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ Missing devices | ||
19 | Boot options | ||
20 | ------------ | ||
21 | |||
22 | -The Aspeed machines can be started using the ``-kernel`` option to | ||
23 | -load a Linux kernel or from a firmware. Images can be downloaded from | ||
24 | -the OpenBMC jenkins : | ||
25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options | ||
26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the | ||
27 | +OpenBMC jenkins : | ||
28 | |||
29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : | ||
32 | |||
33 | https://github.com/openbmc/openbmc/releases | ||
34 | |||
35 | +To boot a kernel directly from a Linux build tree: | ||
36 | + | ||
37 | +.. code-block:: bash | ||
38 | + | ||
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 | ||
47 | -- | ||
48 | 2.25.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | Move it to the supported list. | ||
4 | |||
5 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | docs/system/arm/aspeed.rst | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/docs/system/arm/aspeed.rst | ||
15 | +++ b/docs/system/arm/aspeed.rst | ||
16 | @@ -XXX,XX +XXX,XX @@ Supported devices | ||
17 | * Front LEDs (PCA9552 on I2C bus) | ||
18 | * LPC Peripheral Controller (a subset of subdevices are supported) | ||
19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | ||
20 | + * ADC | ||
21 | |||
22 | |||
23 | Missing devices | ||
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 | ||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | ||
1 | 2 | ||
3 | Fix issue where the data register may be overwritten by next character | ||
4 | reception before being read and returned. | ||
5 | |||
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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/char/stm32f2xx_usart.c | 3 ++- | ||
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/char/stm32f2xx_usart.c | ||
18 | +++ b/hw/char/stm32f2xx_usart.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, | ||
20 | return retvalue; | ||
21 | case USART_DR: | ||
22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | ||
23 | + retvalue = s->usart_dr & 0x3FF; | ||
24 | s->usart_sr &= ~USART_SR_RXNE; | ||
25 | qemu_chr_fe_accept_input(&s->chr); | ||
26 | qemu_set_irq(s->irq, 0); | ||
27 | - return s->usart_dr & 0x3FF; | ||
28 | + return retvalue; | ||
29 | case USART_BRR: | ||
30 | return s->usart_brr; | ||
31 | case USART_CR1: | ||
32 | -- | ||
33 | 2.25.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in | ||
4 | arm_gicv3_common_realize(). Since we want to restrict | ||
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". | ||
8 | |||
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- | ||
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 | ||
19 | |||
20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
23 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | /* | ||
26 | - * ARM Generic Interrupt Controller v3 | ||
27 | + * ARM Generic Interrupt Controller v3 (emulation) | ||
28 | * | ||
29 | * Copyright (c) 2016 Linaro Limited | ||
30 | * Written by Peter Maydell | ||
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 | + */ | ||
62 | + | ||
63 | +#include "qemu/osdep.h" | ||
64 | +#include "gicv3_internal.h" | ||
65 | +#include "cpu.h" | ||
66 | + | ||
67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | ||
68 | +{ | ||
69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
70 | + CPUARMState *env = &arm_cpu->env; | ||
71 | + | ||
72 | + env->gicv3state = (void *)s; | ||
73 | +}; | ||
74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/hw/intc/meson.build | ||
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')) | ||
86 | -- | ||
87 | 2.25.1 | ||
88 | |||
89 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | The TYPE_ARM_GICV3 device is an emulated one. When using | ||
4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device | ||
5 | (which uses in-kernel support). | ||
6 | |||
7 | When using --with-devices-FOO, it is possible to build a | ||
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. | ||
11 | |||
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 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/intc/arm_gicv3.c | 2 +- | ||
22 | hw/intc/Kconfig | 5 +++++ | ||
23 | hw/intc/meson.build | 10 ++++++---- | ||
24 | 3 files changed, 12 insertions(+), 5 deletions(-) | ||
25 | |||
26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/hw/intc/arm_gicv3.c | ||
29 | +++ b/hw/intc/arm_gicv3.c | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | /* | ||
32 | - * ARM Generic Interrupt Controller v3 | ||
33 | + * ARM Generic Interrupt Controller v3 (emulation) | ||
34 | * | ||
35 | * Copyright (c) 2015 Huawei. | ||
36 | * Copyright (c) 2016 Linaro Limited | ||
37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/intc/Kconfig | ||
40 | +++ b/hw/intc/Kconfig | ||
41 | @@ -XXX,XX +XXX,XX @@ config APIC | ||
42 | select MSI_NONBROKEN | ||
43 | select I8259 | ||
44 | |||
45 | +config ARM_GIC_TCG | ||
46 | + bool | ||
47 | + default y | ||
48 | + depends on ARM_GIC && TCG | ||
49 | + | ||
50 | config ARM_GIC_KVM | ||
51 | bool | ||
52 | default y | ||
53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/intc/meson.build | ||
56 | +++ b/hw/intc/meson.build | ||
57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( | ||
58 | 'arm_gic.c', | ||
59 | 'arm_gic_common.c', | ||
60 | 'arm_gicv2m.c', | ||
61 | - 'arm_gicv3.c', | ||
62 | 'arm_gicv3_common.c', | ||
63 | - 'arm_gicv3_dist.c', | ||
64 | 'arm_gicv3_its_common.c', | ||
65 | - 'arm_gicv3_redist.c', | ||
66 | +)) | ||
67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( | ||
68 | + 'arm_gicv3.c', | ||
69 | + 'arm_gicv3_dist.c', | ||
70 | 'arm_gicv3_its.c', | ||
71 | + 'arm_gicv3_redist.c', | ||
72 | )) | ||
73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) | ||
74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) | ||
75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) | ||
81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) | ||
84 | -- | ||
85 | 2.25.1 | ||
86 | |||
87 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This will allow sharing code that adjusts rmode beyond | ||
4 | the existing users. | ||
5 | |||
6 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20190301200501.16533-10-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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 | --- | 6 | --- |
12 | target/arm/translate-a64.c | 90 +++++++++++++++++++++----------------- | 7 | target/arm/translate-a64.c | 7 ++++--- |
13 | 1 file changed, 49 insertions(+), 41 deletions(-) | 8 | 1 file changed, 4 insertions(+), 3 deletions(-) |
14 | 9 | ||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.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/target/arm/translate-a64.c | 12 | --- a/target/arm/translate-a64.c |
18 | +++ b/target/arm/translate-a64.c | 13 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) | 14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
20 | /* Floating-point data-processing (1 source) - single precision */ | ||
21 | static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) | ||
22 | { | 15 | { |
23 | + void (*gen_fpst)(TCGv_i32, TCGv_i32, TCGv_ptr); | 16 | DisasContext *s = container_of(dcbase, DisasContext, base); |
24 | + TCGv_i32 tcg_op, tcg_res; | 17 | CPUARMState *env = cpu->env_ptr; |
25 | TCGv_ptr fpst; | 18 | + uint64_t pc = s->base.pc_next; |
26 | - TCGv_i32 tcg_op; | 19 | uint32_t insn; |
27 | - TCGv_i32 tcg_res; | 20 | |
28 | + int rmode = -1; | 21 | if (s->ss_active && !s->pstate_ss) { |
29 | 22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | |
30 | - fpst = get_fpstatus_ptr(false); | ||
31 | tcg_op = read_fp_sreg(s, rn); | ||
32 | tcg_res = tcg_temp_new_i32(); | ||
33 | |||
34 | switch (opcode) { | ||
35 | case 0x0: /* FMOV */ | ||
36 | tcg_gen_mov_i32(tcg_res, tcg_op); | ||
37 | - break; | ||
38 | + goto done; | ||
39 | case 0x1: /* FABS */ | ||
40 | gen_helper_vfp_abss(tcg_res, tcg_op); | ||
41 | - break; | ||
42 | + goto done; | ||
43 | case 0x2: /* FNEG */ | ||
44 | gen_helper_vfp_negs(tcg_res, tcg_op); | ||
45 | - break; | ||
46 | + goto done; | ||
47 | case 0x3: /* FSQRT */ | ||
48 | gen_helper_vfp_sqrts(tcg_res, tcg_op, cpu_env); | ||
49 | - break; | ||
50 | + goto done; | ||
51 | case 0x8: /* FRINTN */ | ||
52 | case 0x9: /* FRINTP */ | ||
53 | case 0xa: /* FRINTM */ | ||
54 | case 0xb: /* FRINTZ */ | ||
55 | case 0xc: /* FRINTA */ | ||
56 | - { | ||
57 | - TCGv_i32 tcg_rmode = tcg_const_i32(arm_rmode_to_sf(opcode & 7)); | ||
58 | - | ||
59 | - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
60 | - gen_helper_rints(tcg_res, tcg_op, fpst); | ||
61 | - | ||
62 | - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
63 | - tcg_temp_free_i32(tcg_rmode); | ||
64 | + rmode = arm_rmode_to_sf(opcode & 7); | ||
65 | + gen_fpst = gen_helper_rints; | ||
66 | break; | ||
67 | - } | ||
68 | case 0xe: /* FRINTX */ | ||
69 | - gen_helper_rints_exact(tcg_res, tcg_op, fpst); | ||
70 | + gen_fpst = gen_helper_rints_exact; | ||
71 | break; | ||
72 | case 0xf: /* FRINTI */ | ||
73 | - gen_helper_rints(tcg_res, tcg_op, fpst); | ||
74 | + gen_fpst = gen_helper_rints; | ||
75 | break; | ||
76 | default: | ||
77 | - abort(); | ||
78 | + g_assert_not_reached(); | ||
79 | } | ||
80 | |||
81 | - write_fp_sreg(s, rd, tcg_res); | ||
82 | - | ||
83 | + fpst = get_fpstatus_ptr(false); | ||
84 | + if (rmode >= 0) { | ||
85 | + TCGv_i32 tcg_rmode = tcg_const_i32(rmode); | ||
86 | + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
87 | + gen_fpst(tcg_res, tcg_op, fpst); | ||
88 | + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
89 | + tcg_temp_free_i32(tcg_rmode); | ||
90 | + } else { | ||
91 | + gen_fpst(tcg_res, tcg_op, fpst); | ||
92 | + } | ||
93 | tcg_temp_free_ptr(fpst); | ||
94 | + | ||
95 | + done: | ||
96 | + write_fp_sreg(s, rd, tcg_res); | ||
97 | tcg_temp_free_i32(tcg_op); | ||
98 | tcg_temp_free_i32(tcg_res); | ||
99 | } | ||
100 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) | ||
101 | /* Floating-point data-processing (1 source) - double precision */ | ||
102 | static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) | ||
103 | { | ||
104 | + void (*gen_fpst)(TCGv_i64, TCGv_i64, TCGv_ptr); | ||
105 | + TCGv_i64 tcg_op, tcg_res; | ||
106 | TCGv_ptr fpst; | ||
107 | - TCGv_i64 tcg_op; | ||
108 | - TCGv_i64 tcg_res; | ||
109 | + int rmode = -1; | ||
110 | |||
111 | switch (opcode) { | ||
112 | case 0x0: /* FMOV */ | ||
113 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) | ||
114 | return; | 23 | return; |
115 | } | 24 | } |
116 | 25 | ||
117 | - fpst = get_fpstatus_ptr(false); | 26 | - s->pc_curr = s->base.pc_next; |
118 | tcg_op = read_fp_dreg(s, rn); | 27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); |
119 | tcg_res = tcg_temp_new_i64(); | 28 | + s->pc_curr = pc; |
120 | 29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | |
121 | switch (opcode) { | 30 | s->insn = insn; |
122 | case 0x1: /* FABS */ | 31 | - s->base.pc_next += 4; |
123 | gen_helper_vfp_absd(tcg_res, tcg_op); | 32 | + s->base.pc_next = pc + 4; |
124 | - break; | 33 | |
125 | + goto done; | 34 | s->fp_access_checked = false; |
126 | case 0x2: /* FNEG */ | 35 | s->sve_access_checked = false; |
127 | gen_helper_vfp_negd(tcg_res, tcg_op); | ||
128 | - break; | ||
129 | + goto done; | ||
130 | case 0x3: /* FSQRT */ | ||
131 | gen_helper_vfp_sqrtd(tcg_res, tcg_op, cpu_env); | ||
132 | - break; | ||
133 | + goto done; | ||
134 | case 0x8: /* FRINTN */ | ||
135 | case 0x9: /* FRINTP */ | ||
136 | case 0xa: /* FRINTM */ | ||
137 | case 0xb: /* FRINTZ */ | ||
138 | case 0xc: /* FRINTA */ | ||
139 | - { | ||
140 | - TCGv_i32 tcg_rmode = tcg_const_i32(arm_rmode_to_sf(opcode & 7)); | ||
141 | - | ||
142 | - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
143 | - gen_helper_rintd(tcg_res, tcg_op, fpst); | ||
144 | - | ||
145 | - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
146 | - tcg_temp_free_i32(tcg_rmode); | ||
147 | + rmode = arm_rmode_to_sf(opcode & 7); | ||
148 | + gen_fpst = gen_helper_rintd; | ||
149 | break; | ||
150 | - } | ||
151 | case 0xe: /* FRINTX */ | ||
152 | - gen_helper_rintd_exact(tcg_res, tcg_op, fpst); | ||
153 | + gen_fpst = gen_helper_rintd_exact; | ||
154 | break; | ||
155 | case 0xf: /* FRINTI */ | ||
156 | - gen_helper_rintd(tcg_res, tcg_op, fpst); | ||
157 | + gen_fpst = gen_helper_rintd; | ||
158 | break; | ||
159 | default: | ||
160 | - abort(); | ||
161 | + g_assert_not_reached(); | ||
162 | } | ||
163 | |||
164 | - write_fp_dreg(s, rd, tcg_res); | ||
165 | - | ||
166 | + fpst = get_fpstatus_ptr(false); | ||
167 | + if (rmode >= 0) { | ||
168 | + TCGv_i32 tcg_rmode = tcg_const_i32(rmode); | ||
169 | + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
170 | + gen_fpst(tcg_res, tcg_op, fpst); | ||
171 | + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); | ||
172 | + tcg_temp_free_i32(tcg_rmode); | ||
173 | + } else { | ||
174 | + gen_fpst(tcg_res, tcg_op, fpst); | ||
175 | + } | ||
176 | tcg_temp_free_ptr(fpst); | ||
177 | + | ||
178 | + done: | ||
179 | + write_fp_dreg(s, rd, tcg_res); | ||
180 | tcg_temp_free_i64(tcg_op); | ||
181 | tcg_temp_free_i64(tcg_res); | ||
182 | } | ||
183 | -- | 36 | -- |
184 | 2.20.1 | 37 | 2.25.1 |
185 | 38 | ||
186 | 39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Found by inspection: Rn is the base register against which the | ||
4 | load began; I is the register within the mask being processed. | ||
5 | The exception return should of course be processed from the loaded PC. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20190301202921.21209-1-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 6 | --- |
12 | target/arm/translate.c | 2 +- | 7 | target/arm/translate.c | 9 +++++---- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 8 | 1 file changed, 5 insertions(+), 4 deletions(-) |
14 | 9 | ||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
16 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
18 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
19 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
20 | } else if (i == rn) { | 15 | { |
21 | loaded_var = tmp; | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
22 | loaded_base = 1; | 17 | CPUARMState *env = cpu->env_ptr; |
23 | - } else if (rn == 15 && exc_return) { | 18 | + uint32_t pc = dc->base.pc_next; |
24 | + } else if (i == 15 && exc_return) { | 19 | unsigned int insn; |
25 | store_pc_exc_ret(s, tmp); | 20 | |
26 | } else { | 21 | if (arm_pre_translate_insn(dc)) { |
27 | store_reg_from_load(s, i, tmp); | 22 | - dc->base.pc_next += 4; |
23 | + dc->base.pc_next = pc + 4; | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | - dc->pc_curr = dc->base.pc_next; | ||
28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | ||
29 | + dc->pc_curr = pc; | ||
30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); | ||
31 | dc->insn = insn; | ||
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); | ||
28 | -- | 37 | -- |
29 | 2.20.1 | 38 | 2.25.1 |
30 | 39 | ||
31 | 40 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Message-id: 20190301200501.16533-3-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 6 | --- |
8 | target/arm/cpu.h | 10 ++++++++++ | 7 | target/arm/translate.c | 16 ++++++++-------- |
9 | linux-user/elfload.c | 1 + | 8 | 1 file changed, 8 insertions(+), 8 deletions(-) |
10 | target/arm/cpu.c | 1 + | ||
11 | target/arm/cpu64.c | 2 ++ | ||
12 | target/arm/translate-a64.c | 14 ++++++++++++++ | ||
13 | target/arm/translate.c | 22 ++++++++++++++++++++++ | ||
14 | 6 files changed, 50 insertions(+) | ||
15 | 9 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/cpu.h | ||
19 | +++ b/target/arm/cpu.h | ||
20 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) | ||
21 | return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; | ||
22 | } | ||
23 | |||
24 | +static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | ||
25 | +{ | ||
26 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | ||
27 | +} | ||
28 | + | ||
29 | static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
30 | { | ||
31 | /* | ||
32 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) | ||
33 | FIELD_DP64(0, ID_AA64ISAR1, GPI, 0xf))) != 0; | ||
34 | } | ||
35 | |||
36 | +static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
37 | +{ | ||
38 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
39 | +} | ||
40 | + | ||
41 | static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | ||
42 | { | ||
43 | /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
44 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/linux-user/elfload.c | ||
47 | +++ b/linux-user/elfload.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) | ||
49 | GET_FEATURE_ID(aa64_pauth, ARM_HWCAP_A64_PACA | ARM_HWCAP_A64_PACG); | ||
50 | GET_FEATURE_ID(aa64_fhm, ARM_HWCAP_A64_ASIMDFHM); | ||
51 | GET_FEATURE_ID(aa64_jscvt, ARM_HWCAP_A64_JSCVT); | ||
52 | + GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); | ||
53 | |||
54 | #undef GET_FEATURE_ID | ||
55 | |||
56 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/cpu.c | ||
59 | +++ b/target/arm/cpu.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | ||
61 | t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); | ||
62 | t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
63 | t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | ||
64 | + t = FIELD_DP32(t, ID_ISAR6, SB, 1); | ||
65 | cpu->isar.id_isar6 = t; | ||
66 | |||
67 | t = cpu->id_mmfr4; | ||
68 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/target/arm/cpu64.c | ||
71 | +++ b/target/arm/cpu64.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
73 | t = FIELD_DP64(t, ID_AA64ISAR1, API, 0); | ||
74 | t = FIELD_DP64(t, ID_AA64ISAR1, GPA, 1); | ||
75 | t = FIELD_DP64(t, ID_AA64ISAR1, GPI, 0); | ||
76 | + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
77 | cpu->isar.id_aa64isar1 = t; | ||
78 | |||
79 | t = cpu->isar.id_aa64pfr0; | ||
80 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
81 | u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
82 | u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
83 | u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
84 | + u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
85 | cpu->isar.id_isar6 = u; | ||
86 | |||
87 | /* | ||
88 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | ||
90 | --- a/target/arm/translate-a64.c | ||
91 | +++ b/target/arm/translate-a64.c | ||
92 | @@ -XXX,XX +XXX,XX @@ static void handle_sync(DisasContext *s, uint32_t insn, | ||
93 | reset_btype(s); | ||
94 | gen_goto_tb(s, 0, s->pc); | ||
95 | return; | ||
96 | + | ||
97 | + case 7: /* SB */ | ||
98 | + if (crm != 0 || !dc_isar_feature(aa64_sb, s)) { | ||
99 | + goto do_unallocated; | ||
100 | + } | ||
101 | + /* | ||
102 | + * TODO: There is no speculation barrier opcode for TCG; | ||
103 | + * MB and end the TB instead. | ||
104 | + */ | ||
105 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
106 | + gen_goto_tb(s, 0, s->pc); | ||
107 | + return; | ||
108 | + | ||
109 | default: | ||
110 | + do_unallocated: | ||
111 | unallocated_encoding(s); | ||
112 | return; | ||
113 | } | ||
114 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
115 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
116 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
117 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
118 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
119 | */ | 15 | { |
120 | gen_goto_tb(s, 0, s->pc & ~1); | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
121 | return; | 17 | CPUARMState *env = cpu->env_ptr; |
122 | + case 7: /* sb */ | 18 | + uint32_t pc = dc->base.pc_next; |
123 | + if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | 19 | uint32_t insn; |
124 | + goto illegal_op; | 20 | bool is_16bit; |
125 | + } | 21 | |
126 | + /* | 22 | if (arm_pre_translate_insn(dc)) { |
127 | + * TODO: There is no speculation barrier opcode | 23 | - dc->base.pc_next += 2; |
128 | + * for TCG; MB and end the TB instead. | 24 | + dc->base.pc_next = pc + 2; |
129 | + */ | 25 | return; |
130 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | 26 | } |
131 | + gen_goto_tb(s, 0, s->pc & ~1); | 27 | |
132 | + return; | 28 | - dc->pc_curr = dc->base.pc_next; |
133 | default: | 29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
134 | goto illegal_op; | 30 | + dc->pc_curr = pc; |
135 | } | 31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); |
136 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); |
137 | */ | 33 | - dc->base.pc_next += 2; |
138 | gen_goto_tb(s, 0, s->pc & ~1); | 34 | + pc += 2; |
139 | break; | 35 | if (!is_16bit) { |
140 | + case 7: /* sb */ | 36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, |
141 | + if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | 37 | - dc->sctlr_b); |
142 | + goto illegal_op; | 38 | - |
143 | + } | 39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); |
144 | + /* | 40 | insn = insn << 16 | insn2; |
145 | + * TODO: There is no speculation barrier opcode | 41 | - dc->base.pc_next += 2; |
146 | + * for TCG; MB and end the TB instead. | 42 | + pc += 2; |
147 | + */ | 43 | } |
148 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | 44 | + dc->base.pc_next = pc; |
149 | + gen_goto_tb(s, 0, s->pc & ~1); | 45 | dc->insn = insn; |
150 | + break; | 46 | |
151 | default: | 47 | if (dc->pstate_il) { |
152 | goto illegal_op; | ||
153 | } | ||
154 | -- | 48 | -- |
155 | 2.20.1 | 49 | 2.25.1 |
156 | 50 | ||
157 | 51 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This decoding more closely matches the ARMv8.4 Table C4-6, | 3 | Create arm_check_ss_active and arm_check_kernelpage. |
4 | Encoding table for Data Processing - Register Group. | ||
5 | 4 | ||
6 | In particular, op2 == 0 is now more than just Add/sub (with carry). | 5 | Reverse the order of the tests. While it doesn't matter in practice, |
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. | ||
7 | 9 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20190301200501.16533-7-richard.henderson@linaro.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 13 | --- |
13 | target/arm/translate-a64.c | 98 ++++++++++++++++++++++---------------- | 14 | target/arm/translate.c | 10 +++++++--- |
14 | 1 file changed, 57 insertions(+), 41 deletions(-) | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
15 | 16 | ||
16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-a64.c | 19 | --- a/target/arm/translate.c |
19 | +++ b/target/arm/translate-a64.c | 20 | +++ b/target/arm/translate.c |
20 | @@ -XXX,XX +XXX,XX @@ static void disas_data_proc_3src(DisasContext *s, uint32_t insn) | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
22 | dc->insn_start = tcg_last_op(); | ||
21 | } | 23 | } |
22 | 24 | ||
23 | /* Add/subtract (with carry) | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
24 | - * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0 | 26 | +static bool arm_check_kernelpage(DisasContext *dc) |
25 | - * +--+--+--+------------------------+------+---------+------+-----+ | 27 | { |
26 | - * |sf|op| S| 1 1 0 1 0 0 0 0 | rm | opcode2 | Rn | Rd | | 28 | #ifdef CONFIG_USER_ONLY |
27 | - * +--+--+--+------------------------+------+---------+------+-----+ | 29 | /* Intercept jump to the magic kernel page. */ |
28 | - * [000000] | 30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) |
29 | + * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0 | 31 | return true; |
30 | + * +--+--+--+------------------------+------+-------------+------+-----+ | ||
31 | + * |sf|op| S| 1 1 0 1 0 0 0 0 | rm | 0 0 0 0 0 0 | Rn | Rd | | ||
32 | + * +--+--+--+------------------------+------+-------------+------+-----+ | ||
33 | */ | ||
34 | |||
35 | static void disas_adc_sbc(DisasContext *s, uint32_t insn) | ||
36 | @@ -XXX,XX +XXX,XX @@ static void disas_adc_sbc(DisasContext *s, uint32_t insn) | ||
37 | unsigned int sf, op, setflags, rm, rn, rd; | ||
38 | TCGv_i64 tcg_y, tcg_rn, tcg_rd; | ||
39 | |||
40 | - if (extract32(insn, 10, 6) != 0) { | ||
41 | - unallocated_encoding(s); | ||
42 | - return; | ||
43 | - } | ||
44 | - | ||
45 | sf = extract32(insn, 31, 1); | ||
46 | op = extract32(insn, 30, 1); | ||
47 | setflags = extract32(insn, 29, 1); | ||
48 | @@ -XXX,XX +XXX,XX @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) | ||
49 | } | 32 | } |
50 | } | 33 | #endif |
51 | 34 | + return false; | |
52 | -/* Data processing - register */ | 35 | +} |
53 | +/* | 36 | |
54 | + * Data processing - register | 37 | +static bool arm_check_ss_active(DisasContext *dc) |
55 | + * 31 30 29 28 25 21 20 16 10 0 | 38 | +{ |
56 | + * +--+---+--+---+-------+-----+-------+-------+---------+ | 39 | if (dc->ss_active && !dc->pstate_ss) { |
57 | + * | |op0| |op1| 1 0 1 | op2 | | op3 | | | 40 | /* Singlestep state is Active-pending. |
58 | + * +--+---+--+---+-------+-----+-------+-------+---------+ | 41 | * If we're in this state at the start of a TB then either |
59 | + */ | 42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
60 | static void disas_data_proc_reg(DisasContext *s, uint32_t insn) | 43 | uint32_t pc = dc->base.pc_next; |
61 | { | 44 | unsigned int insn; |
62 | - switch (extract32(insn, 24, 5)) { | 45 | |
63 | - case 0x0a: /* Logical (shifted register) */ | 46 | - if (arm_pre_translate_insn(dc)) { |
64 | - disas_logic_reg(s, insn); | 47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
65 | - break; | 48 | dc->base.pc_next = pc + 4; |
66 | - case 0x0b: /* Add/subtract */ | 49 | return; |
67 | - if (insn & (1 << 21)) { /* (extended register) */ | 50 | } |
68 | - disas_add_sub_ext_reg(s, insn); | 51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
69 | + int op0 = extract32(insn, 30, 1); | 52 | uint32_t insn; |
70 | + int op1 = extract32(insn, 28, 1); | 53 | bool is_16bit; |
71 | + int op2 = extract32(insn, 21, 4); | 54 | |
72 | + int op3 = extract32(insn, 10, 6); | 55 | - if (arm_pre_translate_insn(dc)) { |
73 | + | 56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
74 | + if (!op1) { | 57 | dc->base.pc_next = pc + 2; |
75 | + if (op2 & 8) { | 58 | return; |
76 | + if (op2 & 1) { | ||
77 | + /* Add/sub (extended register) */ | ||
78 | + disas_add_sub_ext_reg(s, insn); | ||
79 | + } else { | ||
80 | + /* Add/sub (shifted register) */ | ||
81 | + disas_add_sub_reg(s, insn); | ||
82 | + } | ||
83 | } else { | ||
84 | - disas_add_sub_reg(s, insn); | ||
85 | + /* Logical (shifted register) */ | ||
86 | + disas_logic_reg(s, insn); | ||
87 | } | ||
88 | - break; | ||
89 | - case 0x1b: /* Data-processing (3 source) */ | ||
90 | - disas_data_proc_3src(s, insn); | ||
91 | - break; | ||
92 | - case 0x1a: | ||
93 | - switch (extract32(insn, 21, 3)) { | ||
94 | - case 0x0: /* Add/subtract (with carry) */ | ||
95 | + return; | ||
96 | + } | ||
97 | + | ||
98 | + switch (op2) { | ||
99 | + case 0x0: | ||
100 | + switch (op3) { | ||
101 | + case 0x00: /* Add/subtract (with carry) */ | ||
102 | disas_adc_sbc(s, insn); | ||
103 | break; | ||
104 | - case 0x2: /* Conditional compare */ | ||
105 | - disas_cc(s, insn); /* both imm and reg forms */ | ||
106 | - break; | ||
107 | - case 0x4: /* Conditional select */ | ||
108 | - disas_cond_select(s, insn); | ||
109 | - break; | ||
110 | - case 0x6: /* Data-processing */ | ||
111 | - if (insn & (1 << 30)) { /* (1 source) */ | ||
112 | - disas_data_proc_1src(s, insn); | ||
113 | - } else { /* (2 source) */ | ||
114 | - disas_data_proc_2src(s, insn); | ||
115 | - } | ||
116 | - break; | ||
117 | + | ||
118 | default: | ||
119 | - unallocated_encoding(s); | ||
120 | - break; | ||
121 | + goto do_unallocated; | ||
122 | } | ||
123 | break; | ||
124 | + | ||
125 | + case 0x2: /* Conditional compare */ | ||
126 | + disas_cc(s, insn); /* both imm and reg forms */ | ||
127 | + break; | ||
128 | + | ||
129 | + case 0x4: /* Conditional select */ | ||
130 | + disas_cond_select(s, insn); | ||
131 | + break; | ||
132 | + | ||
133 | + case 0x6: /* Data-processing */ | ||
134 | + if (op0) { /* (1 source) */ | ||
135 | + disas_data_proc_1src(s, insn); | ||
136 | + } else { /* (2 source) */ | ||
137 | + disas_data_proc_2src(s, insn); | ||
138 | + } | ||
139 | + break; | ||
140 | + case 0x8 ... 0xf: /* (3 source) */ | ||
141 | + disas_data_proc_3src(s, insn); | ||
142 | + break; | ||
143 | + | ||
144 | default: | ||
145 | + do_unallocated: | ||
146 | unallocated_encoding(s); | ||
147 | break; | ||
148 | } | 59 | } |
149 | -- | 60 | -- |
150 | 2.20.1 | 61 | 2.25.1 |
151 | 62 | ||
152 | 63 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The EL0+UMA check is unique to DAIF. While SPSel had avoided the | 3 | The size of the code covered by a TranslationBlock cannot be 0; |
4 | check by nature of already checking EL >= 1, the other post v8.0 | 4 | this is checked via assert in tb_gen_code. |
5 | extensions to MSR (imm) allow EL0 and do not require UMA. Avoid | ||
6 | the unconditional write to pc and use raise_exception_ra to unwind. | ||
7 | 5 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20190301200501.16533-5-richard.henderson@linaro.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | target/arm/helper-a64.h | 3 +++ | 10 | target/arm/translate-a64.c | 1 + |
14 | target/arm/helper.h | 1 - | 11 | 1 file changed, 1 insertion(+) |
15 | target/arm/internals.h | 15 ++++++++++++++ | ||
16 | target/arm/helper-a64.c | 30 +++++++++++++++++++++++++++ | ||
17 | target/arm/op_helper.c | 42 -------------------------------------- | ||
18 | target/arm/translate-a64.c | 41 ++++++++++++++++++++++--------------- | ||
19 | 6 files changed, 73 insertions(+), 59 deletions(-) | ||
20 | 12 | ||
21 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/helper-a64.h | ||
24 | +++ b/target/arm/helper-a64.h | ||
25 | @@ -XXX,XX +XXX,XX @@ | ||
26 | DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64) | ||
27 | DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64) | ||
28 | DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64) | ||
29 | +DEF_HELPER_2(msr_i_spsel, void, env, i32) | ||
30 | +DEF_HELPER_2(msr_i_daifset, void, env, i32) | ||
31 | +DEF_HELPER_2(msr_i_daifclear, void, env, i32) | ||
32 | DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr) | ||
33 | DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr) | ||
34 | DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr) | ||
35 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/helper.h | ||
38 | +++ b/target/arm/helper.h | ||
39 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(get_cp_reg, i32, env, ptr) | ||
40 | DEF_HELPER_3(set_cp_reg64, void, env, ptr, i64) | ||
41 | DEF_HELPER_2(get_cp_reg64, i64, env, ptr) | ||
42 | |||
43 | -DEF_HELPER_3(msr_i_pstate, void, env, i32, i32) | ||
44 | DEF_HELPER_1(clear_pstate_ss, void, env) | ||
45 | |||
46 | DEF_HELPER_2(get_r13_banked, i32, env, i32) | ||
47 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/target/arm/internals.h | ||
50 | +++ b/target/arm/internals.h | ||
51 | @@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va, | ||
52 | ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, | ||
53 | ARMMMUIdx mmu_idx, bool data); | ||
54 | |||
55 | +static inline int exception_target_el(CPUARMState *env) | ||
56 | +{ | ||
57 | + int target_el = MAX(1, arm_current_el(env)); | ||
58 | + | ||
59 | + /* | ||
60 | + * No such thing as secure EL1 if EL3 is aarch32, | ||
61 | + * so update the target EL to EL3 in this case. | ||
62 | + */ | ||
63 | + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) { | ||
64 | + target_el = 3; | ||
65 | + } | ||
66 | + | ||
67 | + return target_el; | ||
68 | +} | ||
69 | + | ||
70 | #endif | ||
71 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/target/arm/helper-a64.c | ||
74 | +++ b/target/arm/helper-a64.c | ||
75 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(rbit64)(uint64_t x) | ||
76 | return revbit64(x); | ||
77 | } | ||
78 | |||
79 | +void HELPER(msr_i_spsel)(CPUARMState *env, uint32_t imm) | ||
80 | +{ | ||
81 | + update_spsel(env, imm); | ||
82 | +} | ||
83 | + | ||
84 | +static void daif_check(CPUARMState *env, uint32_t op, | ||
85 | + uint32_t imm, uintptr_t ra) | ||
86 | +{ | ||
87 | + /* DAIF update to PSTATE. This is OK from EL0 only if UMA is set. */ | ||
88 | + if (arm_current_el(env) == 0 && !(env->cp15.sctlr_el[1] & SCTLR_UMA)) { | ||
89 | + raise_exception_ra(env, EXCP_UDEF, | ||
90 | + syn_aa64_sysregtrap(0, extract32(op, 0, 3), | ||
91 | + extract32(op, 3, 3), 4, | ||
92 | + imm, 0x1f, 0), | ||
93 | + exception_target_el(env), ra); | ||
94 | + } | ||
95 | +} | ||
96 | + | ||
97 | +void HELPER(msr_i_daifset)(CPUARMState *env, uint32_t imm) | ||
98 | +{ | ||
99 | + daif_check(env, 0x1e, imm, GETPC()); | ||
100 | + env->daif |= (imm << 6) & PSTATE_DAIF; | ||
101 | +} | ||
102 | + | ||
103 | +void HELPER(msr_i_daifclear)(CPUARMState *env, uint32_t imm) | ||
104 | +{ | ||
105 | + daif_check(env, 0x1f, imm, GETPC()); | ||
106 | + env->daif &= ~((imm << 6) & PSTATE_DAIF); | ||
107 | +} | ||
108 | + | ||
109 | /* Convert a softfloat float_relation_ (as returned by | ||
110 | * the float*_compare functions) to the correct ARM | ||
111 | * NZCV flag state. | ||
112 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/op_helper.c | ||
115 | +++ b/target/arm/op_helper.c | ||
116 | @@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, | ||
117 | cpu_loop_exit_restore(cs, ra); | ||
118 | } | ||
119 | |||
120 | -static int exception_target_el(CPUARMState *env) | ||
121 | -{ | ||
122 | - int target_el = MAX(1, arm_current_el(env)); | ||
123 | - | ||
124 | - /* No such thing as secure EL1 if EL3 is aarch32, so update the target EL | ||
125 | - * to EL3 in this case. | ||
126 | - */ | ||
127 | - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) { | ||
128 | - target_el = 3; | ||
129 | - } | ||
130 | - | ||
131 | - return target_el; | ||
132 | -} | ||
133 | - | ||
134 | uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn, | ||
135 | uint32_t maxindex) | ||
136 | { | ||
137 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip) | ||
138 | return res; | ||
139 | } | ||
140 | |||
141 | -void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op, uint32_t imm) | ||
142 | -{ | ||
143 | - /* MSR_i to update PSTATE. This is OK from EL0 only if UMA is set. | ||
144 | - * Note that SPSel is never OK from EL0; we rely on handle_msr_i() | ||
145 | - * to catch that case at translate time. | ||
146 | - */ | ||
147 | - if (arm_current_el(env) == 0 && !(env->cp15.sctlr_el[1] & SCTLR_UMA)) { | ||
148 | - uint32_t syndrome = syn_aa64_sysregtrap(0, extract32(op, 0, 3), | ||
149 | - extract32(op, 3, 3), 4, | ||
150 | - imm, 0x1f, 0); | ||
151 | - raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env)); | ||
152 | - } | ||
153 | - | ||
154 | - switch (op) { | ||
155 | - case 0x05: /* SPSel */ | ||
156 | - update_spsel(env, imm); | ||
157 | - break; | ||
158 | - case 0x1e: /* DAIFSet */ | ||
159 | - env->daif |= (imm << 6) & PSTATE_DAIF; | ||
160 | - break; | ||
161 | - case 0x1f: /* DAIFClear */ | ||
162 | - env->daif &= ~((imm << 6) & PSTATE_DAIF); | ||
163 | - break; | ||
164 | - default: | ||
165 | - g_assert_not_reached(); | ||
166 | - } | ||
167 | -} | ||
168 | - | ||
169 | void HELPER(clear_pstate_ss)(CPUARMState *env) | ||
170 | { | ||
171 | env->pstate &= ~PSTATE_SS; | ||
172 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
173 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
174 | --- a/target/arm/translate-a64.c | 15 | --- a/target/arm/translate-a64.c |
175 | +++ b/target/arm/translate-a64.c | 16 | +++ b/target/arm/translate-a64.c |
176 | @@ -XXX,XX +XXX,XX @@ static void handle_sync(DisasContext *s, uint32_t insn, | 17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
177 | static void handle_msr_i(DisasContext *s, uint32_t insn, | 18 | assert(s->base.num_insns == 1); |
178 | unsigned int op1, unsigned int op2, unsigned int crm) | 19 | gen_swstep_exception(s, 0, 0); |
179 | { | 20 | s->base.is_jmp = DISAS_NORETURN; |
180 | + TCGv_i32 t1; | 21 | + s->base.pc_next = pc + 4; |
181 | int op = op1 << 3 | op2; | ||
182 | + | ||
183 | + /* End the TB by default, chaining is ok. */ | ||
184 | + s->base.is_jmp = DISAS_TOO_MANY; | ||
185 | + | ||
186 | switch (op) { | ||
187 | case 0x05: /* SPSel */ | ||
188 | if (s->current_el == 0) { | ||
189 | - unallocated_encoding(s); | ||
190 | - return; | ||
191 | + goto do_unallocated; | ||
192 | } | ||
193 | - /* fall through */ | ||
194 | - case 0x1e: /* DAIFSet */ | ||
195 | - case 0x1f: /* DAIFClear */ | ||
196 | - { | ||
197 | - TCGv_i32 tcg_imm = tcg_const_i32(crm); | ||
198 | - TCGv_i32 tcg_op = tcg_const_i32(op); | ||
199 | - gen_a64_set_pc_im(s->pc - 4); | ||
200 | - gen_helper_msr_i_pstate(cpu_env, tcg_op, tcg_imm); | ||
201 | - tcg_temp_free_i32(tcg_imm); | ||
202 | - tcg_temp_free_i32(tcg_op); | ||
203 | - /* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. */ | ||
204 | - gen_a64_set_pc_im(s->pc); | ||
205 | - s->base.is_jmp = (op == 0x1f ? DISAS_EXIT : DISAS_JUMP); | ||
206 | + t1 = tcg_const_i32(crm & PSTATE_SP); | ||
207 | + gen_helper_msr_i_spsel(cpu_env, t1); | ||
208 | + tcg_temp_free_i32(t1); | ||
209 | break; | ||
210 | - } | ||
211 | + | ||
212 | + case 0x1e: /* DAIFSet */ | ||
213 | + t1 = tcg_const_i32(crm); | ||
214 | + gen_helper_msr_i_daifset(cpu_env, t1); | ||
215 | + tcg_temp_free_i32(t1); | ||
216 | + break; | ||
217 | + | ||
218 | + case 0x1f: /* DAIFClear */ | ||
219 | + t1 = tcg_const_i32(crm); | ||
220 | + gen_helper_msr_i_daifclear(cpu_env, t1); | ||
221 | + tcg_temp_free_i32(t1); | ||
222 | + /* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. */ | ||
223 | + s->base.is_jmp = DISAS_UPDATE; | ||
224 | + break; | ||
225 | + | ||
226 | default: | ||
227 | + do_unallocated: | ||
228 | unallocated_encoding(s); | ||
229 | return; | 22 | return; |
230 | } | 23 | } |
24 | |||
231 | -- | 25 | -- |
232 | 2.20.1 | 26 | 2.25.1 |
233 | 27 | ||
234 | 28 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 3 | We will reuse this section of arm_deliver_fault for |
4 | raising pc alignment faults. | ||
5 | |||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20190301200501.16533-9-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@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 | --- | 9 | --- |
9 | target/arm/cpu.h | 5 ++++ | 10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- |
10 | target/arm/cpu64.c | 2 +- | 11 | 1 file changed, 28 insertions(+), 17 deletions(-) |
11 | target/arm/translate-a64.c | 58 ++++++++++++++++++++++++++++++++++++++ | ||
12 | 3 files changed, 64 insertions(+), 1 deletion(-) | ||
13 | 12 | ||
14 | 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 |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/tlb_helper.c |
17 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/tlb_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | 17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
19 | return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | 18 | return syn; |
20 | } | 19 | } |
21 | 20 | ||
22 | +static inline bool isar_feature_aa64_condm_5(const ARMISARegisters *id) | 21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
23 | +{ | 22 | - MMUAccessType access_type, |
24 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) >= 2; | 23 | - int mmu_idx, ARMMMUFaultInfo *fi) |
24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, | ||
25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) | ||
26 | { | ||
27 | - CPUARMState *env = &cpu->env; | ||
28 | - int target_el; | ||
29 | - bool same_el; | ||
30 | - uint32_t syn, exc, fsr, fsc; | ||
31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | ||
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; | ||
25 | +} | 52 | +} |
26 | + | 53 | + |
27 | static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | 54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
28 | { | 55 | + MMUAccessType access_type, |
29 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | 56 | + int mmu_idx, ARMMMUFaultInfo *fi) |
30 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/cpu64.c | ||
33 | +++ b/target/arm/cpu64.c | ||
34 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
35 | t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
36 | t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
37 | t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
38 | - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 1); | ||
39 | + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
40 | cpu->isar.id_aa64isar0 = t; | ||
41 | |||
42 | t = cpu->isar.id_aa64isar1; | ||
43 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/target/arm/translate-a64.c | ||
46 | +++ b/target/arm/translate-a64.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static void handle_sync(DisasContext *s, uint32_t insn, | ||
48 | } | ||
49 | } | ||
50 | |||
51 | +static void gen_xaflag(void) | ||
52 | +{ | 57 | +{ |
53 | + TCGv_i32 z = tcg_temp_new_i32(); | 58 | + CPUARMState *env = &cpu->env; |
59 | + int target_el; | ||
60 | + bool same_el; | ||
61 | + uint32_t syn, exc, fsr, fsc; | ||
54 | + | 62 | + |
55 | + tcg_gen_setcondi_i32(TCG_COND_EQ, z, cpu_ZF, 0); | 63 | + target_el = exception_target_el(env); |
64 | + if (fi->stage2) { | ||
65 | + target_el = 2; | ||
66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
68 | + env->cp15.hpfar_el2 |= HPFAR_NS; | ||
69 | + } | ||
70 | + } | ||
71 | + same_el = (arm_current_el(env) == target_el); | ||
56 | + | 72 | + |
57 | + /* | 73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); |
58 | + * (!C & !Z) << 31 | ||
59 | + * (!(C | Z)) << 31 | ||
60 | + * ~((C | Z) << 31) | ||
61 | + * ~-(C | Z) | ||
62 | + * (C | Z) - 1 | ||
63 | + */ | ||
64 | + tcg_gen_or_i32(cpu_NF, cpu_CF, z); | ||
65 | + tcg_gen_subi_i32(cpu_NF, cpu_NF, 1); | ||
66 | + | 74 | + |
67 | + /* !(Z & C) */ | 75 | if (access_type == MMU_INST_FETCH) { |
68 | + tcg_gen_and_i32(cpu_ZF, z, cpu_CF); | 76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); |
69 | + tcg_gen_xori_i32(cpu_ZF, cpu_ZF, 1); | 77 | exc = EXCP_PREFETCH_ABORT; |
70 | + | ||
71 | + /* (!C & Z) << 31 -> -(Z & ~C) */ | ||
72 | + tcg_gen_andc_i32(cpu_VF, z, cpu_CF); | ||
73 | + tcg_gen_neg_i32(cpu_VF, cpu_VF); | ||
74 | + | ||
75 | + /* C | Z */ | ||
76 | + tcg_gen_or_i32(cpu_CF, cpu_CF, z); | ||
77 | + | ||
78 | + tcg_temp_free_i32(z); | ||
79 | +} | ||
80 | + | ||
81 | +static void gen_axflag(void) | ||
82 | +{ | ||
83 | + tcg_gen_sari_i32(cpu_VF, cpu_VF, 31); /* V ? -1 : 0 */ | ||
84 | + tcg_gen_andc_i32(cpu_CF, cpu_CF, cpu_VF); /* C & !V */ | ||
85 | + | ||
86 | + /* !(Z | V) -> !(!ZF | V) -> ZF & !V -> ZF & ~VF */ | ||
87 | + tcg_gen_andc_i32(cpu_ZF, cpu_ZF, cpu_VF); | ||
88 | + | ||
89 | + tcg_gen_movi_i32(cpu_NF, 0); | ||
90 | + tcg_gen_movi_i32(cpu_VF, 0); | ||
91 | +} | ||
92 | + | ||
93 | /* MSR (immediate) - move immediate to processor state field */ | ||
94 | static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
95 | unsigned int op1, unsigned int op2, unsigned int crm) | ||
96 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
97 | s->base.is_jmp = DISAS_NEXT; | ||
98 | break; | ||
99 | |||
100 | + case 0x01: /* XAFlag */ | ||
101 | + if (crm != 0 || !dc_isar_feature(aa64_condm_5, s)) { | ||
102 | + goto do_unallocated; | ||
103 | + } | ||
104 | + gen_xaflag(); | ||
105 | + s->base.is_jmp = DISAS_NEXT; | ||
106 | + break; | ||
107 | + | ||
108 | + case 0x02: /* AXFlag */ | ||
109 | + if (crm != 0 || !dc_isar_feature(aa64_condm_5, s)) { | ||
110 | + goto do_unallocated; | ||
111 | + } | ||
112 | + gen_axflag(); | ||
113 | + s->base.is_jmp = DISAS_NEXT; | ||
114 | + break; | ||
115 | + | ||
116 | case 0x05: /* SPSel */ | ||
117 | if (s->current_el == 0) { | ||
118 | goto do_unallocated; | ||
119 | -- | 78 | -- |
120 | 2.20.1 | 79 | 2.25.1 |
121 | 80 | ||
122 | 81 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We do not need an out-of-line helper for manipulating bits in pstate. | 3 | For A64, any input to an indirect branch can cause this. |
4 | While changing things, share the implementation of gen_ss_advance. | 4 | |
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. | ||
5 | 14 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20190301200501.16533-6-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 18 | --- |
11 | target/arm/helper.h | 2 -- | 19 | target/arm/helper.h | 1 + |
12 | target/arm/translate.h | 34 ++++++++++++++++++++++++++++++++++ | 20 | target/arm/syndrome.h | 5 ++++ |
13 | target/arm/op_helper.c | 5 ----- | 21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- |
14 | target/arm/translate-a64.c | 11 ----------- | 22 | target/arm/tlb_helper.c | 18 ++++++++++++++ |
15 | target/arm/translate.c | 11 ----------- | 23 | target/arm/translate-a64.c | 15 ++++++++++++ |
16 | 5 files changed, 34 insertions(+), 29 deletions(-) | 24 | target/arm/translate.c | 22 ++++++++++++++++- |
25 | 6 files changed, 87 insertions(+), 20 deletions(-) | ||
17 | 26 | ||
18 | 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 |
19 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.h | 29 | --- a/target/arm/helper.h |
21 | +++ b/target/arm/helper.h | 30 | +++ b/target/arm/helper.h |
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(get_cp_reg, i32, env, ptr) | 31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, |
23 | DEF_HELPER_3(set_cp_reg64, void, env, ptr, i64) | 32 | DEF_HELPER_2(exception_internal, void, env, i32) |
24 | DEF_HELPER_2(get_cp_reg64, i64, env, ptr) | 33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) |
25 | 34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | |
26 | -DEF_HELPER_1(clear_pstate_ss, void, env) | 35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) |
36 | DEF_HELPER_1(setend, void, env) | ||
37 | DEF_HELPER_2(wfi, void, env, i32) | ||
38 | DEF_HELPER_1(wfe, void, env) | ||
39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/syndrome.h | ||
42 | +++ b/target/arm/syndrome.h | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) | ||
44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
45 | } | ||
46 | |||
47 | +static inline uint32_t syn_pcalignment(void) | ||
48 | +{ | ||
49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
50 | +} | ||
51 | + | ||
52 | #endif /* TARGET_ARM_SYNDROME_H */ | ||
53 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/linux-user/aarch64/cpu_loop.c | ||
56 | +++ b/linux-user/aarch64/cpu_loop.c | ||
57 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | ||
58 | break; | ||
59 | case EXCP_PREFETCH_ABORT: | ||
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); | ||
27 | - | 64 | - |
28 | DEF_HELPER_2(get_r13_banked, i32, env, i32) | 65 | - /* Both EC have the same format for FSC, or close enough. */ |
29 | DEF_HELPER_3(set_r13_banked, void, env, i32, i32) | 66 | - fsc = extract32(env->exception.syndrome, 0, 6); |
30 | 67 | - switch (fsc) { | |
31 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 68 | - case 0x04 ... 0x07: /* Translation fault, level {0-3} */ |
32 | index XXXXXXX..XXXXXXX 100644 | 69 | - si_signo = TARGET_SIGSEGV; |
33 | --- a/target/arm/translate.h | 70 | - si_code = TARGET_SEGV_MAPERR; |
34 | +++ b/target/arm/translate.h | 71 | + switch (ec) { |
35 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 get_ahp_flag(void) | 72 | + case EC_DATAABORT: |
36 | return ret; | 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); | ||
37 | } | 126 | } |
38 | 127 | ||
39 | +/* Set bits within PSTATE. */ | 128 | +void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) |
40 | +static inline void set_pstate_bits(uint32_t bits) | ||
41 | +{ | 129 | +{ |
42 | + TCGv_i32 p = tcg_temp_new_i32(); | 130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; |
43 | + | 131 | + int target_el = exception_target_el(env); |
44 | + tcg_debug_assert(!(bits & CACHED_PSTATE_BITS)); | 132 | + int mmu_idx = cpu_mmu_index(env, true); |
45 | + | 133 | + uint32_t fsc; |
46 | + tcg_gen_ld_i32(p, cpu_env, offsetof(CPUARMState, pstate)); | 134 | + |
47 | + tcg_gen_ori_i32(p, p, bits); | 135 | + env->exception.vaddress = pc; |
48 | + tcg_gen_st_i32(p, cpu_env, offsetof(CPUARMState, pstate)); | 136 | + |
49 | + tcg_temp_free_i32(p); | 137 | + /* |
138 | + * Note that the fsc is not applicable to this exception, | ||
139 | + * since any syndrome is pcalignment not insn_abort. | ||
140 | + */ | ||
141 | + env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc); | ||
142 | + raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el); | ||
50 | +} | 143 | +} |
51 | + | 144 | + |
52 | +/* Clear bits within PSTATE. */ | 145 | #if !defined(CONFIG_USER_ONLY) |
53 | +static inline void clear_pstate_bits(uint32_t bits) | 146 | |
54 | +{ | 147 | /* |
55 | + TCGv_i32 p = tcg_temp_new_i32(); | ||
56 | + | ||
57 | + tcg_debug_assert(!(bits & CACHED_PSTATE_BITS)); | ||
58 | + | ||
59 | + tcg_gen_ld_i32(p, cpu_env, offsetof(CPUARMState, pstate)); | ||
60 | + tcg_gen_andi_i32(p, p, ~bits); | ||
61 | + tcg_gen_st_i32(p, cpu_env, offsetof(CPUARMState, pstate)); | ||
62 | + tcg_temp_free_i32(p); | ||
63 | +} | ||
64 | + | ||
65 | +/* If the singlestep state is Active-not-pending, advance to Active-pending. */ | ||
66 | +static inline void gen_ss_advance(DisasContext *s) | ||
67 | +{ | ||
68 | + if (s->ss_active) { | ||
69 | + s->pstate_ss = 0; | ||
70 | + clear_pstate_bits(PSTATE_SS); | ||
71 | + } | ||
72 | +} | ||
73 | |||
74 | /* Vector operations shared between ARM and AArch64. */ | ||
75 | extern const GVecGen3 bsl_op; | ||
76 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/target/arm/op_helper.c | ||
79 | +++ b/target/arm/op_helper.c | ||
80 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip) | ||
81 | return res; | ||
82 | } | ||
83 | |||
84 | -void HELPER(clear_pstate_ss)(CPUARMState *env) | ||
85 | -{ | ||
86 | - env->pstate &= ~PSTATE_SS; | ||
87 | -} | ||
88 | - | ||
89 | void HELPER(pre_hvc)(CPUARMState *env) | ||
90 | { | ||
91 | ARMCPU *cpu = arm_env_get_cpu(env); | ||
92 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
93 | index XXXXXXX..XXXXXXX 100644 | 149 | index XXXXXXX..XXXXXXX 100644 |
94 | --- a/target/arm/translate-a64.c | 150 | --- a/target/arm/translate-a64.c |
95 | +++ b/target/arm/translate-a64.c | 151 | +++ b/target/arm/translate-a64.c |
96 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, | 152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
97 | s->base.is_jmp = DISAS_NORETURN; | 153 | uint64_t pc = s->base.pc_next; |
98 | } | 154 | uint32_t insn; |
99 | 155 | ||
100 | -static void gen_ss_advance(DisasContext *s) | 156 | + /* Singlestep exceptions have the highest priority. */ |
101 | -{ | 157 | if (s->ss_active && !s->pstate_ss) { |
102 | - /* If the singlestep state is Active-not-pending, advance to | 158 | /* Singlestep state is Active-pending. |
103 | - * Active-pending. | 159 | * If we're in this state at the start of a TB then either |
104 | - */ | 160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
105 | - if (s->ss_active) { | 161 | return; |
106 | - s->pstate_ss = 0; | 162 | } |
107 | - gen_helper_clear_pstate_ss(cpu_env); | 163 | |
108 | - } | 164 | + if (pc & 3) { |
109 | -} | 165 | + /* |
110 | - | 166 | + * PC alignment fault. This has priority over the instruction abort |
111 | static void gen_step_complete_exception(DisasContext *s) | 167 | + * that we would receive from a translation fault via arm_ldl_code. |
112 | { | 168 | + * This should only be possible after an indirect branch, at the |
113 | /* We just completed step of an insn. Move from Active-not-pending | 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; | ||
176 | + } | ||
177 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
114 | 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 |
115 | index XXXXXXX..XXXXXXX 100644 | 182 | index XXXXXXX..XXXXXXX 100644 |
116 | --- a/target/arm/translate.c | 183 | --- a/target/arm/translate.c |
117 | +++ b/target/arm/translate.c | 184 | +++ b/target/arm/translate.c |
118 | @@ -XXX,XX +XXX,XX @@ static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) | 185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
119 | tcg_temp_free_i32(tcg_excp); | 186 | uint32_t pc = dc->base.pc_next; |
120 | } | 187 | unsigned int insn; |
121 | 188 | ||
122 | -static void gen_ss_advance(DisasContext *s) | 189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
123 | -{ | 190 | + /* Singlestep exceptions have the highest priority. */ |
124 | - /* If the singlestep state is Active-not-pending, advance to | 191 | + if (arm_check_ss_active(dc)) { |
125 | - * Active-pending. | 192 | + dc->base.pc_next = pc + 4; |
126 | - */ | 193 | + return; |
127 | - if (s->ss_active) { | 194 | + } |
128 | - s->pstate_ss = 0; | 195 | + |
129 | - gen_helper_clear_pstate_ss(cpu_env); | 196 | + if (pc & 3) { |
130 | - } | 197 | + /* |
131 | -} | 198 | + * PC alignment fault. This has priority over the instruction abort |
132 | - | 199 | + * that we would receive from a translation fault via arm_ldl_code |
133 | static void gen_step_complete_exception(DisasContext *s) | 200 | + * (or the execution of the kernelpage entrypoint). This should only |
134 | { | 201 | + * be possible after an indirect branch, at the start of the TB. |
135 | /* We just completed step of an insn. Move from Active-not-pending | 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; | ||
213 | } | ||
136 | -- | 214 | -- |
137 | 2.20.1 | 215 | 2.25.1 |
138 | 216 | ||
139 | 217 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 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> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20190301200501.16533-11-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 13 | --- |
9 | target/arm/cpu.h | 5 ++ | 14 | target/arm/gdbstub.c | 9 +++++++-- |
10 | target/arm/helper.h | 5 ++ | 15 | target/arm/machine.c | 10 ++++++++++ |
11 | target/arm/cpu64.c | 1 + | 16 | target/arm/translate.c | 3 +++ |
12 | target/arm/translate-a64.c | 71 ++++++++++++++++++++++++++-- | 17 | 3 files changed, 20 insertions(+), 2 deletions(-) |
13 | target/arm/vfp_helper.c | 96 ++++++++++++++++++++++++++++++++++++++ | ||
14 | 5 files changed, 173 insertions(+), 5 deletions(-) | ||
15 | 18 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 21 | --- a/target/arm/gdbstub.c |
19 | +++ b/target/arm/cpu.h | 22 | +++ b/target/arm/gdbstub.c |
20 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | 23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
21 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | 24 | |
22 | } | 25 | tmp = ldl_p(mem_buf); |
23 | 26 | ||
24 | +static inline bool isar_feature_aa64_frint(const ARMISARegisters *id) | 27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably |
25 | +{ | 28 | - cause problems if we ever implement the Jazelle DBX extensions. */ |
26 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FRINTTS) != 0; | 29 | + /* |
27 | +} | 30 | + * Mask out low bits of PC to workaround gdb bugs. |
28 | + | 31 | + * This avoids an assert in thumb_tr_translate_insn, because it is |
29 | static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | 32 | + * architecturally impossible to misalign the pc. |
30 | { | 33 | + * This will probably cause problems if we ever implement the |
31 | /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | 34 | + * Jazelle DBX extensions. |
32 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 35 | + */ |
36 | if (n == 15) { | ||
37 | tmp &= ~1; | ||
38 | } | ||
39 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/helper.h | 41 | --- a/target/arm/machine.c |
35 | +++ b/target/arm/helper.h | 42 | +++ b/target/arm/machine.c |
36 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_5(gvec_fmlal_idx_a32, TCG_CALL_NO_RWG, | 43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
37 | DEF_HELPER_FLAGS_5(gvec_fmlal_idx_a64, TCG_CALL_NO_RWG, | 44 | return -1; |
38 | void, ptr, ptr, ptr, ptr, i32) | 45 | } |
39 | |||
40 | +DEF_HELPER_FLAGS_2(frint32_s, TCG_CALL_NO_RWG, f32, f32, ptr) | ||
41 | +DEF_HELPER_FLAGS_2(frint64_s, TCG_CALL_NO_RWG, f32, f32, ptr) | ||
42 | +DEF_HELPER_FLAGS_2(frint32_d, TCG_CALL_NO_RWG, f64, f64, ptr) | ||
43 | +DEF_HELPER_FLAGS_2(frint64_d, TCG_CALL_NO_RWG, f64, f64, ptr) | ||
44 | + | ||
45 | #ifdef TARGET_AARCH64 | ||
46 | #include "helper-a64.h" | ||
47 | #include "helper-sve.h" | ||
48 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/target/arm/cpu64.c | ||
51 | +++ b/target/arm/cpu64.c | ||
52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
53 | t = FIELD_DP64(t, ID_AA64ISAR1, GPI, 0); | ||
54 | t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
55 | t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
56 | + t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
57 | cpu->isar.id_aa64isar1 = t; | ||
58 | |||
59 | t = cpu->isar.id_aa64pfr0; | ||
60 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/translate-a64.c | ||
63 | +++ b/target/arm/translate-a64.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_single(DisasContext *s, int opcode, int rd, int rn) | ||
65 | case 0xf: /* FRINTI */ | ||
66 | gen_fpst = gen_helper_rints; | ||
67 | break; | ||
68 | + case 0x10: /* FRINT32Z */ | ||
69 | + rmode = float_round_to_zero; | ||
70 | + gen_fpst = gen_helper_frint32_s; | ||
71 | + break; | ||
72 | + case 0x11: /* FRINT32X */ | ||
73 | + gen_fpst = gen_helper_frint32_s; | ||
74 | + break; | ||
75 | + case 0x12: /* FRINT64Z */ | ||
76 | + rmode = float_round_to_zero; | ||
77 | + gen_fpst = gen_helper_frint64_s; | ||
78 | + break; | ||
79 | + case 0x13: /* FRINT64X */ | ||
80 | + gen_fpst = gen_helper_frint64_s; | ||
81 | + break; | ||
82 | default: | ||
83 | g_assert_not_reached(); | ||
84 | } | ||
85 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_double(DisasContext *s, int opcode, int rd, int rn) | ||
86 | case 0xf: /* FRINTI */ | ||
87 | gen_fpst = gen_helper_rintd; | ||
88 | break; | ||
89 | + case 0x10: /* FRINT32Z */ | ||
90 | + rmode = float_round_to_zero; | ||
91 | + gen_fpst = gen_helper_frint32_d; | ||
92 | + break; | ||
93 | + case 0x11: /* FRINT32X */ | ||
94 | + gen_fpst = gen_helper_frint32_d; | ||
95 | + break; | ||
96 | + case 0x12: /* FRINT64Z */ | ||
97 | + rmode = float_round_to_zero; | ||
98 | + gen_fpst = gen_helper_frint64_d; | ||
99 | + break; | ||
100 | + case 0x13: /* FRINT64X */ | ||
101 | + gen_fpst = gen_helper_frint64_d; | ||
102 | + break; | ||
103 | default: | ||
104 | g_assert_not_reached(); | ||
105 | } | ||
106 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) | ||
107 | handle_fp_fcvt(s, opcode, rd, rn, dtype, type); | ||
108 | break; | ||
109 | } | 46 | } |
110 | + | 47 | + |
111 | + case 0x10 ... 0x13: /* FRINT{32,64}{X,Z} */ | 48 | + /* |
112 | + if (type > 1 || !dc_isar_feature(aa64_frint, s)) { | 49 | + * Misaligned thumb pc is architecturally impossible. |
113 | + unallocated_encoding(s); | 50 | + * We have an assert in thumb_tr_translate_insn to verify this. |
114 | + return; | 51 | + * Fail an incoming migrate to avoid this assert. |
115 | + } | 52 | + */ |
116 | + /* fall through */ | 53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
117 | case 0x0 ... 0x3: | 54 | + return -1; |
118 | case 0x8 ... 0xc: | ||
119 | case 0xe ... 0xf: | ||
120 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) | ||
121 | if (!fp_access_check(s)) { | ||
122 | return; | ||
123 | } | ||
124 | - | ||
125 | handle_fp_1src_single(s, opcode, rd, rn); | ||
126 | break; | ||
127 | case 1: | ||
128 | if (!fp_access_check(s)) { | ||
129 | return; | ||
130 | } | ||
131 | - | ||
132 | handle_fp_1src_double(s, opcode, rd, rn); | ||
133 | break; | ||
134 | case 3: | ||
135 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_1src(DisasContext *s, uint32_t insn) | ||
136 | if (!fp_access_check(s)) { | ||
137 | return; | ||
138 | } | ||
139 | - | ||
140 | handle_fp_1src_half(s, opcode, rd, rn); | ||
141 | break; | ||
142 | default: | ||
143 | unallocated_encoding(s); | ||
144 | } | ||
145 | break; | ||
146 | + | ||
147 | default: | ||
148 | unallocated_encoding(s); | ||
149 | break; | ||
150 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, | ||
151 | case 0x59: /* FRINTX */ | ||
152 | gen_helper_rintd_exact(tcg_rd, tcg_rn, tcg_fpstatus); | ||
153 | break; | ||
154 | + case 0x1e: /* FRINT32Z */ | ||
155 | + case 0x5e: /* FRINT32X */ | ||
156 | + gen_helper_frint32_d(tcg_rd, tcg_rn, tcg_fpstatus); | ||
157 | + break; | ||
158 | + case 0x1f: /* FRINT64Z */ | ||
159 | + case 0x5f: /* FRINT64X */ | ||
160 | + gen_helper_frint64_d(tcg_rd, tcg_rn, tcg_fpstatus); | ||
161 | + break; | ||
162 | default: | ||
163 | g_assert_not_reached(); | ||
164 | } | ||
165 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) | ||
166 | } | ||
167 | break; | ||
168 | case 0xc ... 0xf: | ||
169 | - case 0x16 ... 0x1d: | ||
170 | - case 0x1f: | ||
171 | + case 0x16 ... 0x1f: | ||
172 | { | ||
173 | /* Floating point: U, size[1] and opcode indicate operation; | ||
174 | * size[0] indicates single or double precision. | ||
175 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) | ||
176 | } | ||
177 | need_fpstatus = true; | ||
178 | break; | ||
179 | + case 0x1e: /* FRINT32Z */ | ||
180 | + case 0x1f: /* FRINT64Z */ | ||
181 | + need_rmode = true; | ||
182 | + rmode = FPROUNDING_ZERO; | ||
183 | + /* fall through */ | ||
184 | + case 0x5e: /* FRINT32X */ | ||
185 | + case 0x5f: /* FRINT64X */ | ||
186 | + need_fpstatus = true; | ||
187 | + if ((size == 3 && !is_q) || !dc_isar_feature(aa64_frint, s)) { | ||
188 | + unallocated_encoding(s); | ||
189 | + return; | ||
190 | + } | ||
191 | + break; | ||
192 | default: | ||
193 | unallocated_encoding(s); | ||
194 | return; | ||
195 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) | ||
196 | case 0x7c: /* URSQRTE */ | ||
197 | gen_helper_rsqrte_u32(tcg_res, tcg_op, tcg_fpstatus); | ||
198 | break; | ||
199 | + case 0x1e: /* FRINT32Z */ | ||
200 | + case 0x5e: /* FRINT32X */ | ||
201 | + gen_helper_frint32_s(tcg_res, tcg_op, tcg_fpstatus); | ||
202 | + break; | ||
203 | + case 0x1f: /* FRINT64Z */ | ||
204 | + case 0x5f: /* FRINT64X */ | ||
205 | + gen_helper_frint64_s(tcg_res, tcg_op, tcg_fpstatus); | ||
206 | + break; | ||
207 | default: | ||
208 | g_assert_not_reached(); | ||
209 | } | ||
210 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | ||
211 | index XXXXXXX..XXXXXXX 100644 | ||
212 | --- a/target/arm/vfp_helper.c | ||
213 | +++ b/target/arm/vfp_helper.c | ||
214 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vjcvt)(float64 value, CPUARMState *env) | ||
215 | |||
216 | return result; | ||
217 | } | ||
218 | + | ||
219 | +/* Round a float32 to an integer that fits in int32_t or int64_t. */ | ||
220 | +static float32 frint_s(float32 f, float_status *fpst, int intsize) | ||
221 | +{ | ||
222 | + int old_flags = get_float_exception_flags(fpst); | ||
223 | + uint32_t exp = extract32(f, 23, 8); | ||
224 | + | ||
225 | + if (unlikely(exp == 0xff)) { | ||
226 | + /* NaN or Inf. */ | ||
227 | + goto overflow; | ||
228 | + } | 55 | + } |
229 | + | 56 | + |
230 | + /* Round and re-extract the exponent. */ | 57 | if (!kvm_enabled()) { |
231 | + f = float32_round_to_int(f, fpst); | 58 | pmu_op_finish(&cpu->env); |
232 | + exp = extract32(f, 23, 8); | 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); | ||
233 | + | 70 | + |
234 | + /* Validate the range of the result. */ | 71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
235 | + if (exp < 126 + intsize) { | 72 | dc->base.pc_next = pc + 2; |
236 | + /* abs(F) <= INT{N}_MAX */ | 73 | return; |
237 | + return f; | ||
238 | + } | ||
239 | + if (exp == 126 + intsize) { | ||
240 | + uint32_t sign = extract32(f, 31, 1); | ||
241 | + uint32_t frac = extract32(f, 0, 23); | ||
242 | + if (sign && frac == 0) { | ||
243 | + /* F == INT{N}_MIN */ | ||
244 | + return f; | ||
245 | + } | ||
246 | + } | ||
247 | + | ||
248 | + overflow: | ||
249 | + /* | ||
250 | + * Raise Invalid and return INT{N}_MIN as a float. Revert any | ||
251 | + * inexact exception float32_round_to_int may have raised. | ||
252 | + */ | ||
253 | + set_float_exception_flags(old_flags | float_flag_invalid, fpst); | ||
254 | + return (0x100u + 126u + intsize) << 23; | ||
255 | +} | ||
256 | + | ||
257 | +float32 HELPER(frint32_s)(float32 f, void *fpst) | ||
258 | +{ | ||
259 | + return frint_s(f, fpst, 32); | ||
260 | +} | ||
261 | + | ||
262 | +float32 HELPER(frint64_s)(float32 f, void *fpst) | ||
263 | +{ | ||
264 | + return frint_s(f, fpst, 64); | ||
265 | +} | ||
266 | + | ||
267 | +/* Round a float64 to an integer that fits in int32_t or int64_t. */ | ||
268 | +static float64 frint_d(float64 f, float_status *fpst, int intsize) | ||
269 | +{ | ||
270 | + int old_flags = get_float_exception_flags(fpst); | ||
271 | + uint32_t exp = extract64(f, 52, 11); | ||
272 | + | ||
273 | + if (unlikely(exp == 0x7ff)) { | ||
274 | + /* NaN or Inf. */ | ||
275 | + goto overflow; | ||
276 | + } | ||
277 | + | ||
278 | + /* Round and re-extract the exponent. */ | ||
279 | + f = float64_round_to_int(f, fpst); | ||
280 | + exp = extract64(f, 52, 11); | ||
281 | + | ||
282 | + /* Validate the range of the result. */ | ||
283 | + if (exp < 1022 + intsize) { | ||
284 | + /* abs(F) <= INT{N}_MAX */ | ||
285 | + return f; | ||
286 | + } | ||
287 | + if (exp == 1022 + intsize) { | ||
288 | + uint64_t sign = extract64(f, 63, 1); | ||
289 | + uint64_t frac = extract64(f, 0, 52); | ||
290 | + if (sign && frac == 0) { | ||
291 | + /* F == INT{N}_MIN */ | ||
292 | + return f; | ||
293 | + } | ||
294 | + } | ||
295 | + | ||
296 | + overflow: | ||
297 | + /* | ||
298 | + * Raise Invalid and return INT{N}_MIN as a float. Revert any | ||
299 | + * inexact exception float64_round_to_int may have raised. | ||
300 | + */ | ||
301 | + set_float_exception_flags(old_flags | float_flag_invalid, fpst); | ||
302 | + return (uint64_t)(0x800 + 1022 + intsize) << 52; | ||
303 | +} | ||
304 | + | ||
305 | +float64 HELPER(frint32_d)(float64 f, void *fpst) | ||
306 | +{ | ||
307 | + return frint_d(f, fpst, 32); | ||
308 | +} | ||
309 | + | ||
310 | +float64 HELPER(frint64_d)(float64 f, void *fpst) | ||
311 | +{ | ||
312 | + return frint_d(f, fpst, 64); | ||
313 | +} | ||
314 | -- | 74 | -- |
315 | 2.20.1 | 75 | 2.25.1 |
316 | 76 | ||
317 | 77 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 3 | Both single-step and pc alignment faults have priority over |
4 | breakpoint exceptions. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20190301200501.16533-8-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | [PMM: fixed up block comment style] | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 9 | --- |
10 | target/arm/cpu.h | 5 ++ | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
11 | linux-user/elfload.c | 1 + | 11 | 1 file changed, 23 insertions(+) |
12 | target/arm/cpu64.c | 1 + | ||
13 | target/arm/translate-a64.c | 99 +++++++++++++++++++++++++++++++++++++- | ||
14 | 4 files changed, 105 insertions(+), 1 deletion(-) | ||
15 | 12 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/debug_helper.c |
19 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/debug_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_fhm(const ARMISARegisters *id) | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
21 | return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, FHM) != 0; | ||
22 | } | ||
23 | |||
24 | +static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | ||
25 | +{ | ||
26 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | ||
27 | +} | ||
28 | + | ||
29 | static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | ||
30 | { | 18 | { |
31 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | 19 | ARMCPU *cpu = ARM_CPU(cs); |
32 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | 20 | CPUARMState *env = &cpu->env; |
33 | index XXXXXXX..XXXXXXX 100644 | 21 | + target_ulong pc; |
34 | --- a/linux-user/elfload.c | 22 | int n; |
35 | +++ b/linux-user/elfload.c | 23 | |
36 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) | 24 | /* |
37 | GET_FEATURE_ID(aa64_fhm, ARM_HWCAP_A64_ASIMDFHM); | 25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
38 | GET_FEATURE_ID(aa64_jscvt, ARM_HWCAP_A64_JSCVT); | 26 | return false; |
39 | GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); | ||
40 | + GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM); | ||
41 | |||
42 | #undef GET_FEATURE_ID | ||
43 | |||
44 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/cpu64.c | ||
47 | +++ b/target/arm/cpu64.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
49 | t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
50 | t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
51 | t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
52 | + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 1); | ||
53 | cpu->isar.id_aa64isar0 = t; | ||
54 | |||
55 | t = cpu->isar.id_aa64isar1; | ||
56 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/translate-a64.c | ||
59 | +++ b/target/arm/translate-a64.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
61 | s->base.is_jmp = DISAS_TOO_MANY; | ||
62 | |||
63 | switch (op) { | ||
64 | + case 0x00: /* CFINV */ | ||
65 | + if (crm != 0 || !dc_isar_feature(aa64_condm_4, s)) { | ||
66 | + goto do_unallocated; | ||
67 | + } | ||
68 | + tcg_gen_xori_i32(cpu_CF, cpu_CF, 1); | ||
69 | + s->base.is_jmp = DISAS_NEXT; | ||
70 | + break; | ||
71 | + | ||
72 | case 0x05: /* SPSel */ | ||
73 | if (s->current_el == 0) { | ||
74 | goto do_unallocated; | ||
75 | @@ -XXX,XX +XXX,XX @@ static void gen_get_nzcv(TCGv_i64 tcg_rt) | ||
76 | } | ||
77 | |||
78 | static void gen_set_nzcv(TCGv_i64 tcg_rt) | ||
79 | - | ||
80 | { | ||
81 | TCGv_i32 nzcv = tcg_temp_new_i32(); | ||
82 | |||
83 | @@ -XXX,XX +XXX,XX @@ static void disas_adc_sbc(DisasContext *s, uint32_t insn) | ||
84 | } | 27 | } |
85 | } | 28 | |
86 | 29 | + /* | |
87 | +/* | 30 | + * Single-step exceptions have priority over breakpoint exceptions. |
88 | + * Rotate right into flags | 31 | + * If single-step state is active-pending, suppress the bp. |
89 | + * 31 30 29 21 15 10 5 4 0 | 32 | + */ |
90 | + * +--+--+--+-----------------+--------+-----------+------+--+------+ | 33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { |
91 | + * |sf|op| S| 1 1 0 1 0 0 0 0 | imm6 | 0 0 0 0 1 | Rn |o2| mask | | 34 | + return false; |
92 | + * +--+--+--+-----------------+--------+-----------+------+--+------+ | ||
93 | + */ | ||
94 | +static void disas_rotate_right_into_flags(DisasContext *s, uint32_t insn) | ||
95 | +{ | ||
96 | + int mask = extract32(insn, 0, 4); | ||
97 | + int o2 = extract32(insn, 4, 1); | ||
98 | + int rn = extract32(insn, 5, 5); | ||
99 | + int imm6 = extract32(insn, 15, 6); | ||
100 | + int sf_op_s = extract32(insn, 29, 3); | ||
101 | + TCGv_i64 tcg_rn; | ||
102 | + TCGv_i32 nzcv; | ||
103 | + | ||
104 | + if (sf_op_s != 5 || o2 != 0 || !dc_isar_feature(aa64_condm_4, s)) { | ||
105 | + unallocated_encoding(s); | ||
106 | + return; | ||
107 | + } | 35 | + } |
108 | + | 36 | + |
109 | + tcg_rn = read_cpu_reg(s, rn, 1); | 37 | + /* |
110 | + tcg_gen_rotri_i64(tcg_rn, tcg_rn, imm6); | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
111 | + | 39 | + */ |
112 | + nzcv = tcg_temp_new_i32(); | 40 | + pc = is_a64(env) ? env->pc : env->regs[15]; |
113 | + tcg_gen_extrl_i64_i32(nzcv, tcg_rn); | 41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { |
114 | + | 42 | + return false; |
115 | + if (mask & 8) { /* N */ | ||
116 | + tcg_gen_shli_i32(cpu_NF, nzcv, 31 - 3); | ||
117 | + } | ||
118 | + if (mask & 4) { /* Z */ | ||
119 | + tcg_gen_not_i32(cpu_ZF, nzcv); | ||
120 | + tcg_gen_andi_i32(cpu_ZF, cpu_ZF, 4); | ||
121 | + } | ||
122 | + if (mask & 2) { /* C */ | ||
123 | + tcg_gen_extract_i32(cpu_CF, nzcv, 1, 1); | ||
124 | + } | ||
125 | + if (mask & 1) { /* V */ | ||
126 | + tcg_gen_shli_i32(cpu_VF, nzcv, 31 - 0); | ||
127 | + } | 43 | + } |
128 | + | 44 | + |
129 | + tcg_temp_free_i32(nzcv); | 45 | + /* |
130 | +} | 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 | + */ | ||
131 | + | 50 | + |
132 | +/* | 51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { |
133 | + * Evaluate into flags | 52 | if (bp_wp_matches(cpu, n, false)) { |
134 | + * 31 30 29 21 15 14 10 5 4 0 | 53 | return true; |
135 | + * +--+--+--+-----------------+---------+----+---------+------+--+------+ | ||
136 | + * |sf|op| S| 1 1 0 1 0 0 0 0 | opcode2 | sz | 0 0 1 0 | Rn |o3| mask | | ||
137 | + * +--+--+--+-----------------+---------+----+---------+------+--+------+ | ||
138 | + */ | ||
139 | +static void disas_evaluate_into_flags(DisasContext *s, uint32_t insn) | ||
140 | +{ | ||
141 | + int o3_mask = extract32(insn, 0, 5); | ||
142 | + int rn = extract32(insn, 5, 5); | ||
143 | + int o2 = extract32(insn, 15, 6); | ||
144 | + int sz = extract32(insn, 14, 1); | ||
145 | + int sf_op_s = extract32(insn, 29, 3); | ||
146 | + TCGv_i32 tmp; | ||
147 | + int shift; | ||
148 | + | ||
149 | + if (sf_op_s != 1 || o2 != 0 || o3_mask != 0xd || | ||
150 | + !dc_isar_feature(aa64_condm_4, s)) { | ||
151 | + unallocated_encoding(s); | ||
152 | + return; | ||
153 | + } | ||
154 | + shift = sz ? 16 : 24; /* SETF16 or SETF8 */ | ||
155 | + | ||
156 | + tmp = tcg_temp_new_i32(); | ||
157 | + tcg_gen_extrl_i64_i32(tmp, cpu_reg(s, rn)); | ||
158 | + tcg_gen_shli_i32(cpu_NF, tmp, shift); | ||
159 | + tcg_gen_shli_i32(cpu_VF, tmp, shift - 1); | ||
160 | + tcg_gen_mov_i32(cpu_ZF, cpu_NF); | ||
161 | + tcg_gen_xor_i32(cpu_VF, cpu_VF, cpu_NF); | ||
162 | + tcg_temp_free_i32(tmp); | ||
163 | +} | ||
164 | + | ||
165 | /* Conditional compare (immediate / register) | ||
166 | * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 12 11 10 9 5 4 3 0 | ||
167 | * +--+--+--+------------------------+--------+------+----+--+------+--+-----+ | ||
168 | @@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) | ||
169 | disas_adc_sbc(s, insn); | ||
170 | break; | ||
171 | |||
172 | + case 0x01: /* Rotate right into flags */ | ||
173 | + case 0x21: | ||
174 | + disas_rotate_right_into_flags(s, insn); | ||
175 | + break; | ||
176 | + | ||
177 | + case 0x02: /* Evaluate into flags */ | ||
178 | + case 0x12: | ||
179 | + case 0x22: | ||
180 | + case 0x32: | ||
181 | + disas_evaluate_into_flags(s, insn); | ||
182 | + break; | ||
183 | + | ||
184 | default: | ||
185 | goto do_unallocated; | ||
186 | } | ||
187 | -- | 54 | -- |
188 | 2.20.1 | 55 | 2.25.1 |
189 | 56 | ||
190 | 57 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Message-id: 20190301200501.16533-4-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 6 | --- |
8 | target/arm/cpu.h | 13 ++++++++++- | 7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ |
9 | target/arm/cpu.c | 1 + | 8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ |
10 | target/arm/cpu64.c | 2 ++ | 9 | tests/tcg/aarch64/Makefile.target | 4 +-- |
11 | target/arm/helper.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ | 10 | tests/tcg/arm/Makefile.target | 4 +++ |
12 | 4 files changed, 70 insertions(+), 1 deletion(-) | 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 | ||
13 | 14 | ||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | new file mode 100644 |
16 | --- a/target/arm/cpu.h | 17 | index XXXXXXX..XXXXXXX |
17 | +++ b/target/arm/cpu.h | 18 | --- /dev/null |
18 | @@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu); | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
19 | #define SCTLR_R (1U << 9) /* up to v6; RAZ in v7 */ | 20 | @@ -XXX,XX +XXX,XX @@ |
20 | #define SCTLR_UMA (1U << 9) /* v8 onward, AArch64 only */ | 21 | +/* Test PC misalignment exception */ |
21 | #define SCTLR_F (1U << 10) /* up to v6 */ | 22 | + |
22 | -#define SCTLR_SW (1U << 10) /* v7, RES0 in v8 */ | 23 | +#include <assert.h> |
23 | +#define SCTLR_SW (1U << 10) /* v7 */ | 24 | +#include <signal.h> |
24 | +#define SCTLR_EnRCTX (1U << 10) /* in v8.0-PredInv */ | 25 | +#include <stdlib.h> |
25 | #define SCTLR_Z (1U << 11) /* in v7, RES1 in v8 */ | 26 | +#include <stdio.h> |
26 | #define SCTLR_EOS (1U << 11) /* v8.5-ExS */ | 27 | + |
27 | #define SCTLR_I (1U << 12) | 28 | +static void *expected; |
28 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | 29 | + |
29 | return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | 30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
30 | } | ||
31 | |||
32 | +static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id) | ||
33 | +{ | 31 | +{ |
34 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0; | 32 | + assert(info->si_code == BUS_ADRALN); |
33 | + assert(info->si_addr == expected); | ||
34 | + exit(EXIT_SUCCESS); | ||
35 | +} | 35 | +} |
36 | + | 36 | + |
37 | static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | 37 | +int main() |
38 | { | ||
39 | /* | ||
40 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
41 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
42 | } | ||
43 | |||
44 | +static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | ||
45 | +{ | 38 | +{ |
46 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | 39 | + void *tmp; |
40 | + | ||
41 | + struct sigaction sa = { | ||
42 | + .sa_sigaction = sigbus, | ||
43 | + .sa_flags = SA_SIGINFO | ||
44 | + }; | ||
45 | + | ||
46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | ||
47 | + perror("sigaction"); | ||
48 | + return EXIT_FAILURE; | ||
49 | + } | ||
50 | + | ||
51 | + asm volatile("adr %0, 1f + 1\n\t" | ||
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 | + | ||
66 | +#ifdef __thumb__ | ||
67 | +#error "This test must be compiled for ARM" | ||
68 | +#endif | ||
69 | + | ||
70 | +#include <assert.h> | ||
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
74 | + | ||
75 | +static void *expected; | ||
76 | + | ||
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); | ||
47 | +} | 82 | +} |
48 | + | 83 | + |
49 | static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | 84 | +int main() |
50 | { | ||
51 | /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
52 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/target/arm/cpu.c | ||
55 | +++ b/target/arm/cpu.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | ||
57 | t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
58 | t = FIELD_DP32(t, ID_ISAR6, FHM, 1); | ||
59 | t = FIELD_DP32(t, ID_ISAR6, SB, 1); | ||
60 | + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); | ||
61 | cpu->isar.id_isar6 = t; | ||
62 | |||
63 | t = cpu->id_mmfr4; | ||
64 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/arm/cpu64.c | ||
67 | +++ b/target/arm/cpu64.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
69 | t = FIELD_DP64(t, ID_AA64ISAR1, GPA, 1); | ||
70 | t = FIELD_DP64(t, ID_AA64ISAR1, GPI, 0); | ||
71 | t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
72 | + t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
73 | cpu->isar.id_aa64isar1 = t; | ||
74 | |||
75 | t = cpu->isar.id_aa64pfr0; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
77 | u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
78 | u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
79 | u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
80 | + u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
81 | cpu->isar.id_isar6 = u; | ||
82 | |||
83 | /* | ||
84 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/target/arm/helper.c | ||
87 | +++ b/target/arm/helper.c | ||
88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pauth_reginfo[] = { | ||
89 | }; | ||
90 | #endif | ||
91 | |||
92 | +static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, | ||
93 | + bool isread) | ||
94 | +{ | 85 | +{ |
95 | + int el = arm_current_el(env); | 86 | + void *tmp; |
96 | + | 87 | + |
97 | + if (el == 0) { | 88 | + struct sigaction sa = { |
98 | + uint64_t sctlr = arm_sctlr(env, el); | 89 | + .sa_sigaction = sigbus, |
99 | + if (!(sctlr & SCTLR_EnRCTX)) { | 90 | + .sa_flags = SA_SIGINFO |
100 | + return CP_ACCESS_TRAP; | 91 | + }; |
101 | + } | 92 | + |
102 | + } else if (el == 1) { | 93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
103 | + uint64_t hcr = arm_hcr_el2_eff(env); | 94 | + perror("sigaction"); |
104 | + if (hcr & HCR_NV) { | 95 | + return EXIT_FAILURE; |
105 | + return CP_ACCESS_TRAP_EL2; | ||
106 | + } | ||
107 | + } | 96 | + } |
108 | + return CP_ACCESS_OK; | ||
109 | +} | ||
110 | + | 97 | + |
111 | +static const ARMCPRegInfo predinv_reginfo[] = { | 98 | + asm volatile("adr %0, 1f + 2\n\t" |
112 | + { .name = "CFP_RCTX", .state = ARM_CP_STATE_AA64, | 99 | + "str %0, %1\n\t" |
113 | + .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 4, | 100 | + "bx %0\n" |
114 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | 101 | + "1:" |
115 | + { .name = "DVP_RCTX", .state = ARM_CP_STATE_AA64, | 102 | + : "=&r"(tmp), "=m"(expected)); |
116 | + .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 5, | ||
117 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
118 | + { .name = "CPP_RCTX", .state = ARM_CP_STATE_AA64, | ||
119 | + .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 7, | ||
120 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
121 | + /* | ||
122 | + * Note the AArch32 opcodes have a different OPC1. | ||
123 | + */ | ||
124 | + { .name = "CFPRCTX", .state = ARM_CP_STATE_AA32, | ||
125 | + .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 4, | ||
126 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
127 | + { .name = "DVPRCTX", .state = ARM_CP_STATE_AA32, | ||
128 | + .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 5, | ||
129 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
130 | + { .name = "CPPRCTX", .state = ARM_CP_STATE_AA32, | ||
131 | + .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 7, | ||
132 | + .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
133 | + REGINFO_SENTINEL | ||
134 | +}; | ||
135 | + | ||
136 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
137 | { | ||
138 | /* Register all the coprocessor registers based on feature bits */ | ||
139 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
140 | define_arm_cp_regs(cpu, pauth_reginfo); | ||
141 | } | ||
142 | #endif | ||
143 | + | 103 | + |
144 | + /* | 104 | + /* |
145 | + * While all v8.0 cpus support aarch64, QEMU does have configurations | 105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns |
146 | + * that do not set ID_AA64ISAR1, e.g. user-only qemu-arm -cpu max, | 106 | + * the address or not. If so, we can legitimately fall through. |
147 | + * which will set ID_ISAR6. | ||
148 | + */ | 107 | + */ |
149 | + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) | 108 | + return EXIT_SUCCESS; |
150 | + ? cpu_isar_feature(aa64_predinv, cpu) | 109 | +} |
151 | + : cpu_isar_feature(aa32_predinv, cpu)) { | 110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target |
152 | + define_arm_cp_regs(cpu, predinv_reginfo); | 111 | index XXXXXXX..XXXXXXX 100644 |
153 | + } | 112 | --- a/tests/tcg/aarch64/Makefile.target |
154 | } | 113 | +++ b/tests/tcg/aarch64/Makefile.target |
155 | 114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) | |
156 | void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) | 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 | ||
136 | + | ||
137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) | ||
138 | |||
139 | # Semihosting smoke test for linux-user | ||
157 | -- | 140 | -- |
158 | 2.20.1 | 141 | 2.25.1 |
159 | 142 | ||
160 | 143 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In the SSE decode function gen_sse(), we combine a byte | ||
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 | } | ||
1 | 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 | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
30 | --- | ||
31 | target/i386/tcg/translate.c | 12 +++--------- | ||
32 | 1 file changed, 3 insertions(+), 9 deletions(-) | ||
33 | |||
34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/i386/tcg/translate.c | ||
37 | +++ b/target/i386/tcg/translate.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
39 | case 0x171: /* shift xmm, im */ | ||
40 | case 0x172: | ||
41 | case 0x173: | ||
42 | - if (b1 >= 2) { | ||
43 | - goto unknown_op; | ||
44 | - } | ||
45 | val = x86_ldub_code(env, s); | ||
46 | if (is_xmm) { | ||
47 | tcg_gen_movi_tl(s->T0, val); | ||
48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); | ||
50 | op1_offset = offsetof(CPUX86State,mmx_t0); | ||
51 | } | ||
52 | + assert(b1 < 2); | ||
53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + | ||
54 | (((modrm >> 3)) & 7)][b1]; | ||
55 | if (!sse_fn_epp) { | ||
56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
57 | rm = modrm & 7; | ||
58 | reg = ((modrm >> 3) & 7) | REX_R(s); | ||
59 | mod = (modrm >> 6) & 3; | ||
60 | - if (b1 >= 2) { | ||
61 | - goto unknown_op; | ||
62 | - } | ||
63 | |||
64 | + assert(b1 < 2); | ||
65 | sse_fn_epp = sse_op_table6[b].op[b1]; | ||
66 | if (!sse_fn_epp) { | ||
67 | goto unknown_op; | ||
68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
69 | rm = modrm & 7; | ||
70 | reg = ((modrm >> 3) & 7) | REX_R(s); | ||
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; | ||
80 | -- | ||
81 | 2.25.1 | ||
82 | |||
83 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The qemu-common.h header is not supposed to be included from any | ||
2 | other header files, only from .c files (as documented in a comment at | ||
3 | the start of it). | ||
1 | 4 | ||
5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. | ||
6 | In fact, the include is not required at all, so we can just drop it | ||
7 | from both files. | ||
8 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | ||
13 | --- | ||
14 | include/hw/i386/microvm.h | 1 - | ||
15 | include/hw/i386/x86.h | 1 - | ||
16 | 2 files changed, 2 deletions(-) | ||
17 | |||
18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/include/hw/i386/microvm.h | ||
21 | +++ b/include/hw/i386/microvm.h | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #ifndef HW_I386_MICROVM_H | ||
24 | #define HW_I386_MICROVM_H | ||
25 | |||
26 | -#include "qemu-common.h" | ||
27 | #include "exec/hwaddr.h" | ||
28 | #include "qemu/notify.h" | ||
29 | |||
30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/include/hw/i386/x86.h | ||
33 | +++ b/include/hw/i386/x86.h | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | #ifndef HW_I386_X86_H | ||
36 | #define HW_I386_X86_H | ||
37 | |||
38 | -#include "qemu-common.h" | ||
39 | #include "exec/hwaddr.h" | ||
40 | #include "qemu/notify.h" | ||
41 | |||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
1 | From: Michel Heily <michelheily@gmail.com> | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | ||
3 | the start of it). | ||
2 | 4 | ||
3 | Implement the watchdog timer for the stellaris boards. | 5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for |
4 | This device is a close variant of the CMSDK APB watchdog | 6 | the declaration of cpu_exec_step_atomic(). |
5 | device, so we can model it by subclassing that device and | ||
6 | tweaking the behaviour of some of its registers. | ||
7 | 7 | ||
8 | Signed-off-by: Michel Heily <michelheily@gmail.com> | ||
9 | Reviewed-by: Peter Maydell <petser.maydell@linaro.org> | ||
10 | [PMM: rewrote commit message, fixed a few checkpatch nits, | ||
11 | added comment giving the URL of the spec for the Stellaris | ||
12 | variant of the watchdog device] | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
14 | --- | 13 | --- |
15 | include/hw/watchdog/cmsdk-apb-watchdog.h | 8 +++ | 14 | target/hexagon/cpu.h | 1 - |
16 | hw/arm/stellaris.c | 22 ++++++- | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
17 | hw/watchdog/cmsdk-apb-watchdog.c | 74 +++++++++++++++++++++++- | 16 | 2 files changed, 1 insertion(+), 1 deletion(-) |
18 | 3 files changed, 100 insertions(+), 4 deletions(-) | ||
19 | 17 | ||
20 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/watchdog/cmsdk-apb-watchdog.h | 20 | --- a/target/hexagon/cpu.h |
23 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | 21 | +++ b/target/hexagon/cpu.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; | ||
23 | |||
24 | #include "fpu/softfloat-types.h" | ||
25 | |||
26 | -#include "qemu-common.h" | ||
27 | #include "exec/cpu-defs.h" | ||
28 | #include "hex_regs.h" | ||
29 | #include "mmvec/mmvec.h" | ||
30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/linux-user/hexagon/cpu_loop.c | ||
33 | +++ b/linux-user/hexagon/cpu_loop.c | ||
24 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ |
25 | #define CMSDK_APB_WATCHDOG(obj) OBJECT_CHECK(CMSDKAPBWatchdog, (obj), \ | ||
26 | TYPE_CMSDK_APB_WATCHDOG) | ||
27 | |||
28 | +/* | ||
29 | + * This shares the same struct (and cast macro) as the base | ||
30 | + * cmsdk-apb-watchdog device. | ||
31 | + */ | ||
32 | +#define TYPE_LUMINARY_WATCHDOG "luminary-watchdog" | ||
33 | + | ||
34 | typedef struct CMSDKAPBWatchdog { | ||
35 | /*< private >*/ | ||
36 | SysBusDevice parent_obj; | ||
37 | @@ -XXX,XX +XXX,XX @@ typedef struct CMSDKAPBWatchdog { | ||
38 | MemoryRegion iomem; | ||
39 | qemu_irq wdogint; | ||
40 | uint32_t wdogclk_frq; | ||
41 | + bool is_luminary; | ||
42 | struct ptimer_state *timer; | ||
43 | |||
44 | uint32_t control; | ||
45 | @@ -XXX,XX +XXX,XX @@ typedef struct CMSDKAPBWatchdog { | ||
46 | uint32_t itcr; | ||
47 | uint32_t itop; | ||
48 | uint32_t resetstatus; | ||
49 | + const uint32_t *id; | ||
50 | } CMSDKAPBWatchdog; | ||
51 | |||
52 | #endif | ||
53 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/arm/stellaris.c | ||
56 | +++ b/hw/arm/stellaris.c | ||
57 | @@ -XXX,XX +XXX,XX @@ | ||
58 | #include "sysemu/sysemu.h" | ||
59 | #include "hw/arm/armv7m.h" | ||
60 | #include "hw/char/pl011.h" | ||
61 | +#include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
62 | #include "hw/misc/unimp.h" | ||
63 | #include "cpu.h" | ||
64 | |||
65 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
66 | * Stellaris LM3S6965 Microcontroller Data Sheet (rev I) | ||
67 | * http://www.ti.com/lit/ds/symlink/lm3s6965.pdf | ||
68 | * | ||
69 | - * 40000000 wdtimer (unimplemented) | ||
70 | + * 40000000 wdtimer | ||
71 | * 40002000 i2c (unimplemented) | ||
72 | * 40004000 GPIO | ||
73 | * 40005000 GPIO | ||
74 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
75 | stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), | ||
76 | board, nd_table[0].macaddr.a); | ||
77 | |||
78 | + | ||
79 | + if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
80 | + dev = qdev_create(NULL, TYPE_LUMINARY_WATCHDOG); | ||
81 | + | ||
82 | + /* system_clock_scale is valid now */ | ||
83 | + uint32_t mainclk = NANOSECONDS_PER_SECOND / system_clock_scale; | ||
84 | + qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); | ||
85 | + | ||
86 | + qdev_init_nofail(dev); | ||
87 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), | ||
88 | + 0, | ||
89 | + 0x40000000u); | ||
90 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), | ||
91 | + 0, | ||
92 | + qdev_get_gpio_in(nvic, 18)); | ||
93 | + } | ||
94 | + | ||
95 | + | ||
96 | for (i = 0; i < 7; i++) { | ||
97 | if (board->dc4 & (1 << i)) { | ||
98 | gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i], | ||
99 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
100 | /* Add dummy regions for the devices we don't implement yet, | ||
101 | * so guest accesses don't cause unlogged crashes. | ||
102 | */ | ||
103 | - create_unimplemented_device("wdtimer", 0x40000000, 0x1000); | ||
104 | create_unimplemented_device("i2c-0", 0x40002000, 0x1000); | ||
105 | create_unimplemented_device("i2c-2", 0x40021000, 0x1000); | ||
106 | create_unimplemented_device("PWM", 0x40028000, 0x1000); | ||
107 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | ||
110 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
111 | @@ -XXX,XX +XXX,XX @@ | ||
112 | * System Design Kit (CMSDK) and documented in the Cortex-M System | ||
113 | * Design Kit Technical Reference Manual (ARM DDI0479C): | ||
114 | * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
115 | + * | ||
116 | + * We also support the variant of this device found in the TI | ||
117 | + * Stellaris/Luminary boards and documented in: | ||
118 | + * http://www.ti.com/lit/ds/symlink/lm3s6965.pdf | ||
119 | */ | 35 | */ |
120 | 36 | ||
121 | #include "qemu/osdep.h" | 37 | #include "qemu/osdep.h" |
122 | @@ -XXX,XX +XXX,XX @@ REG32(WDOGINTCLR, 0xc) | 38 | +#include "qemu-common.h" |
123 | REG32(WDOGRIS, 0x10) | 39 | #include "qemu.h" |
124 | FIELD(WDOGRIS, INT, 0, 1) | 40 | #include "user-internals.h" |
125 | REG32(WDOGMIS, 0x14) | 41 | #include "cpu_loop-common.h" |
126 | +REG32(WDOGTEST, 0x418) /* only in Stellaris/Luminary version of the device */ | ||
127 | REG32(WDOGLOCK, 0xc00) | ||
128 | #define WDOG_UNLOCK_VALUE 0x1ACCE551 | ||
129 | REG32(WDOGITCR, 0xf00) | ||
130 | @@ -XXX,XX +XXX,XX @@ REG32(CID2, 0xff8) | ||
131 | REG32(CID3, 0xffc) | ||
132 | |||
133 | /* PID/CID values */ | ||
134 | -static const int watchdog_id[] = { | ||
135 | +static const uint32_t cmsdk_apb_watchdog_id[] = { | ||
136 | 0x04, 0x00, 0x00, 0x00, /* PID4..PID7 */ | ||
137 | 0x24, 0xb8, 0x1b, 0x00, /* PID0..PID3 */ | ||
138 | 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ | ||
139 | }; | ||
140 | |||
141 | +static const uint32_t luminary_watchdog_id[] = { | ||
142 | + 0x00, 0x00, 0x00, 0x00, /* PID4..PID7 */ | ||
143 | + 0x05, 0x18, 0x18, 0x01, /* PID0..PID3 */ | ||
144 | + 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ | ||
145 | +}; | ||
146 | + | ||
147 | static bool cmsdk_apb_watchdog_intstatus(CMSDKAPBWatchdog *s) | ||
148 | { | ||
149 | /* Return masked interrupt status */ | ||
150 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_update(CMSDKAPBWatchdog *s) | ||
151 | bool wdogres; | ||
152 | |||
153 | if (s->itcr) { | ||
154 | + /* | ||
155 | + * Not checking that !s->is_luminary since s->itcr can't be written | ||
156 | + * when s->is_luminary in the first place. | ||
157 | + */ | ||
158 | wdogint = s->itop & R_WDOGITOP_WDOGINT_MASK; | ||
159 | wdogres = s->itop & R_WDOGITOP_WDOGRES_MASK; | ||
160 | } else { | ||
161 | @@ -XXX,XX +XXX,XX @@ static uint64_t cmsdk_apb_watchdog_read(void *opaque, hwaddr offset, | ||
162 | r = s->lock; | ||
163 | break; | ||
164 | case A_WDOGITCR: | ||
165 | + if (s->is_luminary) { | ||
166 | + goto bad_offset; | ||
167 | + } | ||
168 | r = s->itcr; | ||
169 | break; | ||
170 | case A_PID4 ... A_CID3: | ||
171 | - r = watchdog_id[(offset - A_PID4) / 4]; | ||
172 | + r = s->id[(offset - A_PID4) / 4]; | ||
173 | break; | ||
174 | case A_WDOGINTCLR: | ||
175 | case A_WDOGITOP: | ||
176 | + if (s->is_luminary) { | ||
177 | + goto bad_offset; | ||
178 | + } | ||
179 | qemu_log_mask(LOG_GUEST_ERROR, | ||
180 | "CMSDK APB watchdog read: read of WO offset %x\n", | ||
181 | (int)offset); | ||
182 | r = 0; | ||
183 | break; | ||
184 | + case A_WDOGTEST: | ||
185 | + if (!s->is_luminary) { | ||
186 | + goto bad_offset; | ||
187 | + } | ||
188 | + qemu_log_mask(LOG_UNIMP, | ||
189 | + "Luminary watchdog read: stall not implemented\n"); | ||
190 | + r = 0; | ||
191 | + break; | ||
192 | default: | ||
193 | +bad_offset: | ||
194 | qemu_log_mask(LOG_GUEST_ERROR, | ||
195 | "CMSDK APB watchdog read: bad offset %x\n", (int)offset); | ||
196 | r = 0; | ||
197 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset, | ||
198 | ptimer_run(s->timer, 0); | ||
199 | break; | ||
200 | case A_WDOGCONTROL: | ||
201 | + if (s->is_luminary && 0 != (R_WDOGCONTROL_INTEN_MASK & s->control)) { | ||
202 | + /* | ||
203 | + * The Luminary version of this device ignores writes to | ||
204 | + * this register after the guest has enabled interrupts | ||
205 | + * (so they can only be disabled again via reset). | ||
206 | + */ | ||
207 | + break; | ||
208 | + } | ||
209 | s->control = value & R_WDOGCONTROL_VALID_MASK; | ||
210 | cmsdk_apb_watchdog_update(s); | ||
211 | break; | ||
212 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset, | ||
213 | s->lock = (value != WDOG_UNLOCK_VALUE); | ||
214 | break; | ||
215 | case A_WDOGITCR: | ||
216 | + if (s->is_luminary) { | ||
217 | + goto bad_offset; | ||
218 | + } | ||
219 | s->itcr = value & R_WDOGITCR_VALID_MASK; | ||
220 | cmsdk_apb_watchdog_update(s); | ||
221 | break; | ||
222 | case A_WDOGITOP: | ||
223 | + if (s->is_luminary) { | ||
224 | + goto bad_offset; | ||
225 | + } | ||
226 | s->itop = value & R_WDOGITOP_VALID_MASK; | ||
227 | cmsdk_apb_watchdog_update(s); | ||
228 | break; | ||
229 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset, | ||
230 | "CMSDK APB watchdog write: write to RO offset 0x%x\n", | ||
231 | (int)offset); | ||
232 | break; | ||
233 | + case A_WDOGTEST: | ||
234 | + if (!s->is_luminary) { | ||
235 | + goto bad_offset; | ||
236 | + } | ||
237 | + qemu_log_mask(LOG_UNIMP, | ||
238 | + "Luminary watchdog write: stall not implemented\n"); | ||
239 | + break; | ||
240 | default: | ||
241 | +bad_offset: | ||
242 | qemu_log_mask(LOG_GUEST_ERROR, | ||
243 | "CMSDK APB watchdog write: bad offset 0x%x\n", | ||
244 | (int)offset); | ||
245 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_init(Object *obj) | ||
246 | s, "cmsdk-apb-watchdog", 0x1000); | ||
247 | sysbus_init_mmio(sbd, &s->iomem); | ||
248 | sysbus_init_irq(sbd, &s->wdogint); | ||
249 | + | ||
250 | + s->is_luminary = false; | ||
251 | + s->id = cmsdk_apb_watchdog_id; | ||
252 | } | ||
253 | |||
254 | static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | ||
255 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo cmsdk_apb_watchdog_info = { | ||
256 | .class_init = cmsdk_apb_watchdog_class_init, | ||
257 | }; | ||
258 | |||
259 | +static void luminary_watchdog_init(Object *obj) | ||
260 | +{ | ||
261 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(obj); | ||
262 | + | ||
263 | + s->is_luminary = true; | ||
264 | + s->id = luminary_watchdog_id; | ||
265 | +} | ||
266 | + | ||
267 | +static const TypeInfo luminary_watchdog_info = { | ||
268 | + .name = TYPE_LUMINARY_WATCHDOG, | ||
269 | + .parent = TYPE_CMSDK_APB_WATCHDOG, | ||
270 | + .instance_init = luminary_watchdog_init | ||
271 | +}; | ||
272 | + | ||
273 | static void cmsdk_apb_watchdog_register_types(void) | ||
274 | { | ||
275 | type_register_static(&cmsdk_apb_watchdog_info); | ||
276 | + type_register_static(&luminary_watchdog_info); | ||
277 | } | ||
278 | |||
279 | type_init(cmsdk_apb_watchdog_register_types); | ||
280 | -- | 42 | -- |
281 | 2.20.1 | 43 | 2.25.1 |
282 | 44 | ||
283 | 45 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The qemu-common.h header is not supposed to be included from any | ||
2 | other header files, only from .c files (as documented in a comment at | ||
3 | the start of it). | ||
1 | 4 | ||
5 | Nothing actually relies on target/rx/cpu.h including it, so we can | ||
6 | just drop the include. | ||
7 | |||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.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 | ||
14 | --- | ||
15 | target/rx/cpu.h | 1 - | ||
16 | 1 file changed, 1 deletion(-) | ||
17 | |||
18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/rx/cpu.h | ||
21 | +++ b/target/rx/cpu.h | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #define RX_CPU_H | ||
24 | |||
25 | #include "qemu/bitops.h" | ||
26 | -#include "qemu-common.h" | ||
27 | #include "hw/registerfields.h" | ||
28 | #include "cpu-qom.h" | ||
29 | |||
30 | -- | ||
31 | 2.25.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | A lot of C files in hw/arm include qemu-common.h when they don't |
---|---|---|---|
2 | need anything from it. Drop the include lines. | ||
2 | 3 | ||
3 | In the prospect to introduce an extended memory map supporting more | 4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they |
4 | RAM, let's split the memory map array into two parts: | 5 | use it for the prototype of qemu_get_timedate(). |
5 | 6 | ||
6 | - the former a15memmap, renamed base_memmap, contains regions below | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | and including the RAM. MemMapEntries initialized in this array | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | have a static size and base address. | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | - extended_memmap, only initialized with entries located after the | 10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
10 | RAM. MemMapEntries initialized in this array only get their size | 11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> |
11 | initialized. Their base address is dynamically computed depending | 12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org |
12 | on the the top of the RAM, with same alignment as their size. | 13 | --- |
14 | hw/arm/boot.c | 1 - | ||
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(-) | ||
13 | 23 | ||
14 | Eventually base_memmap entries are copied into the extended_memmap | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
15 | array. Using two separate arrays however clarifies which entries | ||
16 | are statically allocated and those which are dynamically allocated. | ||
17 | |||
18 | This new split will allow to grow the RAM size without changing the | ||
19 | description of the high IO entries. | ||
20 | |||
21 | We introduce a new virt_set_memmap() helper function which | ||
22 | "freezes" the memory map. We call it in machvirt_init as | ||
23 | memory attributes of the machine are not yet set when | ||
24 | virt_instance_init() gets called. | ||
25 | |||
26 | The memory map is unchanged (the top of the initial RAM still is | ||
27 | 256GiB). Then come the high IO regions with same layout as before. | ||
28 | |||
29 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
30 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
31 | Message-id: 20190304101339.25970-4-eric.auger@redhat.com | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
33 | --- | ||
34 | include/hw/arm/virt.h | 13 +++++++---- | ||
35 | hw/arm/virt.c | 50 +++++++++++++++++++++++++++++++++++++------ | ||
36 | 2 files changed, 53 insertions(+), 10 deletions(-) | ||
37 | |||
38 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/include/hw/arm/virt.h | 26 | --- a/hw/arm/boot.c |
41 | +++ b/include/hw/arm/virt.h | 27 | +++ b/hw/arm/boot.c |
42 | @@ -XXX,XX +XXX,XX @@ enum { | 28 | @@ -XXX,XX +XXX,XX @@ |
43 | VIRT_GIC_VCPU, | 29 | */ |
44 | VIRT_GIC_ITS, | 30 | |
45 | VIRT_GIC_REDIST, | 31 | #include "qemu/osdep.h" |
46 | - VIRT_HIGH_GIC_REDIST2, | 32 | -#include "qemu-common.h" |
47 | VIRT_SMMU, | 33 | #include "qemu/datadir.h" |
48 | VIRT_UART, | 34 | #include "qemu/error-report.h" |
49 | VIRT_MMIO, | 35 | #include "qapi/error.h" |
50 | @@ -XXX,XX +XXX,XX @@ enum { | 36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c |
51 | VIRT_PCIE_MMIO, | 37 | index XXXXXXX..XXXXXXX 100644 |
52 | VIRT_PCIE_PIO, | 38 | --- a/hw/arm/digic_boards.c |
53 | VIRT_PCIE_ECAM, | 39 | +++ b/hw/arm/digic_boards.c |
54 | - VIRT_HIGH_PCIE_ECAM, | 40 | @@ -XXX,XX +XXX,XX @@ |
55 | VIRT_PLATFORM_BUS, | 41 | |
56 | - VIRT_HIGH_PCIE_MMIO, | 42 | #include "qemu/osdep.h" |
57 | VIRT_GPIO, | 43 | #include "qapi/error.h" |
58 | VIRT_SECURE_UART, | 44 | -#include "qemu-common.h" |
59 | VIRT_SECURE_MEM, | 45 | #include "qemu/datadir.h" |
60 | + VIRT_LOWMEMMAP_LAST, | 46 | #include "hw/boards.h" |
61 | +}; | 47 | #include "qemu/error-report.h" |
62 | + | 48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c |
63 | +/* indices of IO regions located after the RAM */ | 49 | index XXXXXXX..XXXXXXX 100644 |
64 | +enum { | 50 | --- a/hw/arm/highbank.c |
65 | + VIRT_HIGH_GIC_REDIST2 = VIRT_LOWMEMMAP_LAST, | 51 | +++ b/hw/arm/highbank.c |
66 | + VIRT_HIGH_PCIE_ECAM, | 52 | @@ -XXX,XX +XXX,XX @@ |
67 | + VIRT_HIGH_PCIE_MMIO, | 53 | */ |
68 | }; | 54 | |
69 | 55 | #include "qemu/osdep.h" | |
70 | typedef enum VirtIOMMUType { | 56 | -#include "qemu-common.h" |
71 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 57 | #include "qemu/datadir.h" |
72 | int32_t gic_version; | 58 | #include "qapi/error.h" |
73 | VirtIOMMUType iommu; | 59 | #include "hw/sysbus.h" |
74 | struct arm_boot_info bootinfo; | 60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
75 | - const MemMapEntry *memmap; | 61 | index XXXXXXX..XXXXXXX 100644 |
76 | + MemMapEntry *memmap; | 62 | --- a/hw/arm/npcm7xx_boards.c |
77 | const int *irqmap; | 63 | +++ b/hw/arm/npcm7xx_boards.c |
78 | int smp_cpus; | 64 | @@ -XXX,XX +XXX,XX @@ |
79 | void *fdt; | 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" | ||
80 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
81 | index XXXXXXX..XXXXXXX 100644 | 109 | index XXXXXXX..XXXXXXX 100644 |
82 | --- a/hw/arm/virt.c | 110 | --- a/hw/arm/virt.c |
83 | +++ b/hw/arm/virt.c | 111 | +++ b/hw/arm/virt.c |
84 | @@ -XXX,XX +XXX,XX @@ | 112 | @@ -XXX,XX +XXX,XX @@ |
85 | */ | 113 | */ |
86 | 114 | ||
87 | #include "qemu/osdep.h" | 115 | #include "qemu/osdep.h" |
88 | +#include "qemu/units.h" | 116 | -#include "qemu-common.h" |
89 | #include "qapi/error.h" | 117 | #include "qemu/datadir.h" |
90 | #include "hw/sysbus.h" | 118 | #include "qemu/units.h" |
91 | #include "hw/arm/arm.h" | 119 | #include "qemu/option.h" |
92 | @@ -XXX,XX +XXX,XX @@ | ||
93 | * Note that devices should generally be placed at multiples of 0x10000, | ||
94 | * to accommodate guests using 64K pages. | ||
95 | */ | ||
96 | -static const MemMapEntry a15memmap[] = { | ||
97 | +static const MemMapEntry base_memmap[] = { | ||
98 | /* Space up to 0x8000000 is reserved for a boot ROM */ | ||
99 | [VIRT_FLASH] = { 0, 0x08000000 }, | ||
100 | [VIRT_CPUPERIPHS] = { 0x08000000, 0x00020000 }, | ||
101 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry a15memmap[] = { | ||
102 | [VIRT_PCIE_PIO] = { 0x3eff0000, 0x00010000 }, | ||
103 | [VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 }, | ||
104 | [VIRT_MEM] = { 0x40000000, RAMLIMIT_BYTES }, | ||
105 | +}; | ||
106 | + | ||
107 | +/* | ||
108 | + * Highmem IO Regions: This memory map is floating, located after the RAM. | ||
109 | + * Each MemMapEntry base (GPA) will be dynamically computed, depending on the | ||
110 | + * top of the RAM, so that its base get the same alignment as the size, | ||
111 | + * ie. a 512GiB entry will be aligned on a 512GiB boundary. If there is | ||
112 | + * less than 256GiB of RAM, the floating area starts at the 256GiB mark. | ||
113 | + * Note the extended_memmap is sized so that it eventually also includes the | ||
114 | + * base_memmap entries (VIRT_HIGH_GIC_REDIST2 index is greater than the last | ||
115 | + * index of base_memmap). | ||
116 | + */ | ||
117 | +static MemMapEntry extended_memmap[] = { | ||
118 | /* Additional 64 MB redist region (can contain up to 512 redistributors) */ | ||
119 | - [VIRT_HIGH_GIC_REDIST2] = { 0x4000000000ULL, 0x4000000 }, | ||
120 | - [VIRT_HIGH_PCIE_ECAM] = { 0x4010000000ULL, 0x10000000 }, | ||
121 | - /* Second PCIe window, 512GB wide at the 512GB boundary */ | ||
122 | - [VIRT_HIGH_PCIE_MMIO] = { 0x8000000000ULL, 0x8000000000ULL }, | ||
123 | + [VIRT_HIGH_GIC_REDIST2] = { 0x0, 64 * MiB }, | ||
124 | + [VIRT_HIGH_PCIE_ECAM] = { 0x0, 256 * MiB }, | ||
125 | + /* Second PCIe window */ | ||
126 | + [VIRT_HIGH_PCIE_MMIO] = { 0x0, 512 * GiB }, | ||
127 | }; | ||
128 | |||
129 | static const int a15irqmap[] = { | ||
130 | @@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx) | ||
131 | return arm_cpu_mp_affinity(idx, clustersz); | ||
132 | } | ||
133 | |||
134 | +static void virt_set_memmap(VirtMachineState *vms) | ||
135 | +{ | ||
136 | + hwaddr base; | ||
137 | + int i; | ||
138 | + | ||
139 | + vms->memmap = extended_memmap; | ||
140 | + | ||
141 | + for (i = 0; i < ARRAY_SIZE(base_memmap); i++) { | ||
142 | + vms->memmap[i] = base_memmap[i]; | ||
143 | + } | ||
144 | + | ||
145 | + base = 256 * GiB; /* Top of the legacy initial RAM region */ | ||
146 | + | ||
147 | + for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { | ||
148 | + hwaddr size = extended_memmap[i].size; | ||
149 | + | ||
150 | + base = ROUND_UP(base, size); | ||
151 | + vms->memmap[i].base = base; | ||
152 | + vms->memmap[i].size = size; | ||
153 | + base += size; | ||
154 | + } | ||
155 | +} | ||
156 | + | ||
157 | static void machvirt_init(MachineState *machine) | ||
158 | { | ||
159 | VirtMachineState *vms = VIRT_MACHINE(machine); | ||
160 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
161 | bool firmware_loaded = bios_name || drive_get(IF_PFLASH, 0, 0); | ||
162 | bool aarch64 = true; | ||
163 | |||
164 | + virt_set_memmap(vms); | ||
165 | + | ||
166 | /* We can probe only here because during property set | ||
167 | * KVM is not available yet | ||
168 | */ | ||
169 | @@ -XXX,XX +XXX,XX @@ static void virt_instance_init(Object *obj) | ||
170 | "Valid values are none and smmuv3", | ||
171 | NULL); | ||
172 | |||
173 | - vms->memmap = a15memmap; | ||
174 | vms->irqmap = a15irqmap; | ||
175 | } | ||
176 | |||
177 | -- | 120 | -- |
178 | 2.20.1 | 121 | 2.25.1 |
179 | 122 | ||
180 | 123 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The calculation of the length of TLB range invalidate operations |
---|---|---|---|
2 | in tlbi_aa64_range_get_length() is incorrect in two ways: | ||
3 | * the NUM field is 5 bits, but we read only 4 bits | ||
4 | * we miscalculate the page_shift value, because of an | ||
5 | off-by-one error: | ||
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 | ||
2 | 11 | ||
3 | Minimize the number of places that will need updating when | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
4 | the virtual host extensions are added. | 13 | both these errors. |
5 | 14 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") |
7 | Message-id: 20190301200501.16533-2-richard.henderson@linaro.org | 16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
10 | --- | 22 | --- |
11 | target/arm/cpu.h | 26 ++++++++++++++++---------- | 23 | target/arm/helper.c | 6 +++--- |
12 | target/arm/helper.c | 8 ++------ | 24 | 1 file changed, 3 insertions(+), 3 deletions(-) |
13 | 2 files changed, 18 insertions(+), 16 deletions(-) | ||
14 | 25 | ||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/cpu.h | ||
18 | +++ b/target/arm/cpu.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_sctlr_b(CPUARMState *env) | ||
20 | (env->cp15.sctlr_el[1] & SCTLR_B) != 0; | ||
21 | } | ||
22 | |||
23 | +static inline uint64_t arm_sctlr(CPUARMState *env, int el) | ||
24 | +{ | ||
25 | + if (el == 0) { | ||
26 | + /* FIXME: ARMv8.1-VHE S2 translation regime. */ | ||
27 | + return env->cp15.sctlr_el[1]; | ||
28 | + } else { | ||
29 | + return env->cp15.sctlr_el[el]; | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | + | ||
34 | /* Return true if the processor is in big-endian mode. */ | ||
35 | static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) | ||
36 | { | ||
37 | - int cur_el; | ||
38 | - | ||
39 | /* In 32bit endianness is determined by looking at CPSR's E bit */ | ||
40 | if (!is_a64(env)) { | ||
41 | return | ||
42 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) | ||
43 | arm_sctlr_b(env) || | ||
44 | #endif | ||
45 | ((env->uncached_cpsr & CPSR_E) ? 1 : 0); | ||
46 | + } else { | ||
47 | + int cur_el = arm_current_el(env); | ||
48 | + uint64_t sctlr = arm_sctlr(env, cur_el); | ||
49 | + | ||
50 | + return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) != 0; | ||
51 | } | ||
52 | - | ||
53 | - cur_el = arm_current_el(env); | ||
54 | - | ||
55 | - if (cur_el == 0) { | ||
56 | - return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0; | ||
57 | - } | ||
58 | - | ||
59 | - return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0; | ||
60 | } | ||
61 | |||
62 | #include "exec/cpu-all.h" | ||
63 | 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 |
64 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
65 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
66 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
67 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, |
68 | flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); | 31 | uint64_t exponent; |
69 | } | 32 | uint64_t length; |
70 | 33 | ||
71 | - if (current_el == 0) { | 34 | - num = extract64(value, 39, 4); |
72 | - /* FIXME: ARMv8.1-VHE S2 translation regime. */ | 35 | + num = extract64(value, 39, 5); |
73 | - sctlr = env->cp15.sctlr_el[1]; | 36 | scale = extract64(value, 44, 2); |
74 | - } else { | 37 | page_size_granule = extract64(value, 46, 2); |
75 | - sctlr = env->cp15.sctlr_el[current_el]; | 38 | |
76 | - } | 39 | - page_shift = page_size_granule * 2 + 12; |
77 | + sctlr = arm_sctlr(env, current_el); | 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; | ||
45 | } | ||
46 | |||
47 | + page_shift = (page_size_granule - 1) * 2 + 12; | ||
78 | + | 48 | + |
79 | if (cpu_isar_feature(aa64_pauth, cpu)) { | 49 | exponent = (5 * scale) + 1; |
80 | /* | 50 | length = (num + 1) << (exponent + page_shift); |
81 | * In order to save space in flags, we record only whether | 51 | |
82 | -- | 52 | -- |
83 | 2.20.1 | 53 | 2.25.1 |
84 | 54 | ||
85 | 55 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Add the kvm_arm_get_max_vm_ipa_size() helper that returns the | 3 | The rx_active boolean change to true should always trigger a try_read |
4 | number of bits in the IPA address space supported by KVM. | 4 | call that flushes the queue. |
5 | 5 | ||
6 | This capability needs to be known to create the VM with a | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
7 | specific IPA max size (kvm_type passed along KVM_CREATE_VM ioctl. | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | 8 | Message-id: 20211203221002.1719306-1-venture@google.com | |
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
11 | Message-id: 20190304101339.25970-6-eric.auger@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 10 | --- |
14 | target/arm/kvm_arm.h | 13 +++++++++++++ | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
15 | target/arm/kvm.c | 10 ++++++++++ | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
16 | 2 files changed, 23 insertions(+) | ||
17 | 13 | ||
18 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/kvm_arm.h | 16 | --- a/hw/net/npcm7xx_emc.c |
21 | +++ b/target/arm/kvm_arm.h | 17 | +++ b/hw/net/npcm7xx_emc.c |
22 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf); | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
23 | */ | 19 | emc_set_mista(emc, mista_flag); |
24 | void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu); | ||
25 | |||
26 | +/** | ||
27 | + * kvm_arm_get_max_vm_ipa_size - Returns the number of bits in the | ||
28 | + * IPA address space supported by KVM | ||
29 | + * | ||
30 | + * @ms: Machine state handle | ||
31 | + */ | ||
32 | +int kvm_arm_get_max_vm_ipa_size(MachineState *ms); | ||
33 | + | ||
34 | /** | ||
35 | * kvm_arm_sync_mpstate_to_kvm | ||
36 | * @cpu: ARMCPU | ||
37 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) | ||
38 | cpu->host_cpu_probe_failed = true; | ||
39 | } | 20 | } |
40 | 21 | ||
41 | +static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms) | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
42 | +{ | 23 | +{ |
43 | + return -ENOENT; | 24 | + emc->rx_active = true; |
25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
44 | +} | 26 | +} |
45 | + | 27 | + |
46 | static inline int kvm_arm_vgic_probe(void) | 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) | ||
47 | { | 43 | { |
48 | return 0; | 44 | NPCM7xxEMCState *emc = opaque; |
49 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | 45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
50 | index XXXXXXX..XXXXXXX 100644 | 46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; |
51 | --- a/target/arm/kvm.c | 47 | } |
52 | +++ b/target/arm/kvm.c | 48 | if (value & REG_MCMDR_RXON) { |
53 | @@ -XXX,XX +XXX,XX @@ | 49 | - emc->rx_active = true; |
54 | #include "qemu/error-report.h" | 50 | + emc_enable_rx_and_flush(emc); |
55 | #include "sysemu/sysemu.h" | 51 | } else { |
56 | #include "sysemu/kvm.h" | 52 | emc_halt_rx(emc, 0); |
57 | +#include "sysemu/kvm_int.h" | 53 | } |
58 | #include "kvm_arm.h" | 54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
59 | #include "cpu.h" | 55 | break; |
60 | #include "trace.h" | 56 | case REG_RSDR: |
61 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) | 57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { |
62 | env->features = arm_host_cpu_features.features; | 58 | - emc->rx_active = true; |
63 | } | 59 | - emc_try_receive_next_packet(emc); |
64 | 60 | + emc_enable_rx_and_flush(emc); | |
65 | +int kvm_arm_get_max_vm_ipa_size(MachineState *ms) | 61 | } |
66 | +{ | 62 | break; |
67 | + KVMState *s = KVM_STATE(ms->accelerator); | 63 | case REG_MIIDA: |
68 | + int ret; | ||
69 | + | ||
70 | + ret = kvm_check_extension(s, KVM_CAP_ARM_VM_IPA_SIZE); | ||
71 | + return ret > 0 ? ret : 40; | ||
72 | +} | ||
73 | + | ||
74 | int kvm_arch_init(MachineState *ms, KVMState *s) | ||
75 | { | ||
76 | /* For ARM interrupt delivery is always asynchronous, | ||
77 | -- | 64 | -- |
78 | 2.20.1 | 65 | 2.25.1 |
79 | 66 | ||
80 | 67 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In preparation for a split of the memory map into a static | 3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT |
4 | part and a dynamic part floating after the RAM, let's rename the | 4 | table. |
5 | regions located after the RAM | ||
6 | 5 | ||
7 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 6 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
10 | Message-id: 20190304101339.25970-3-eric.auger@redhat.com | 9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | include/hw/arm/virt.h | 8 ++++---- | 12 | hw/arm/virt-acpi-build.c | 7 +++++++ |
14 | hw/arm/virt-acpi-build.c | 10 ++++++---- | 13 | hw/arm/Kconfig | 1 + |
15 | hw/arm/virt.c | 33 ++++++++++++++++++--------------- | 14 | 2 files changed, 8 insertions(+) |
16 | 3 files changed, 28 insertions(+), 23 deletions(-) | ||
17 | 15 | ||
18 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/include/hw/arm/virt.h | ||
21 | +++ b/include/hw/arm/virt.h | ||
22 | @@ -XXX,XX +XXX,XX @@ enum { | ||
23 | VIRT_GIC_VCPU, | ||
24 | VIRT_GIC_ITS, | ||
25 | VIRT_GIC_REDIST, | ||
26 | - VIRT_GIC_REDIST2, | ||
27 | + VIRT_HIGH_GIC_REDIST2, | ||
28 | VIRT_SMMU, | ||
29 | VIRT_UART, | ||
30 | VIRT_MMIO, | ||
31 | @@ -XXX,XX +XXX,XX @@ enum { | ||
32 | VIRT_PCIE_MMIO, | ||
33 | VIRT_PCIE_PIO, | ||
34 | VIRT_PCIE_ECAM, | ||
35 | - VIRT_PCIE_ECAM_HIGH, | ||
36 | + VIRT_HIGH_PCIE_ECAM, | ||
37 | VIRT_PLATFORM_BUS, | ||
38 | - VIRT_PCIE_MMIO_HIGH, | ||
39 | + VIRT_HIGH_PCIE_MMIO, | ||
40 | VIRT_GPIO, | ||
41 | VIRT_SECURE_UART, | ||
42 | VIRT_SECURE_MEM, | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
44 | int psci_conduit; | ||
45 | } VirtMachineState; | ||
46 | |||
47 | -#define VIRT_ECAM_ID(high) (high ? VIRT_PCIE_ECAM_HIGH : VIRT_PCIE_ECAM) | ||
48 | +#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) | ||
49 | |||
50 | #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt") | ||
51 | #define VIRT_MACHINE(obj) \ | ||
52 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
53 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/hw/arm/virt-acpi-build.c | 18 | --- a/hw/arm/virt-acpi-build.c |
55 | +++ b/hw/arm/virt-acpi-build.c | 19 | +++ b/hw/arm/virt-acpi-build.c |
56 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, | 20 | @@ -XXX,XX +XXX,XX @@ |
57 | size_pio)); | 21 | #include "kvm_arm.h" |
58 | 22 | #include "migration/vmstate.h" | |
59 | if (use_highmem) { | 23 | #include "hw/acpi/ghes.h" |
60 | - hwaddr base_mmio_high = memmap[VIRT_PCIE_MMIO_HIGH].base; | 24 | +#include "hw/acpi/viot.h" |
61 | - hwaddr size_mmio_high = memmap[VIRT_PCIE_MMIO_HIGH].size; | 25 | |
62 | + hwaddr base_mmio_high = memmap[VIRT_HIGH_PCIE_MMIO].base; | 26 | #define ARM_SPI_BASE 32 |
63 | + hwaddr size_mmio_high = memmap[VIRT_HIGH_PCIE_MMIO].size; | 27 | |
64 | 28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) | |
65 | aml_append(rbuf, | 29 | } |
66 | aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, | 30 | #endif |
67 | @@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 31 | |
68 | gicr = acpi_data_push(table_data, sizeof(*gicr)); | 32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { |
69 | gicr->type = ACPI_APIC_GENERIC_REDISTRIBUTOR; | 33 | + acpi_add_table(table_offsets, tables_blob); |
70 | gicr->length = sizeof(*gicr); | 34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, |
71 | - gicr->base_address = cpu_to_le64(memmap[VIRT_GIC_REDIST2].base); | 35 | + vms->oem_id, vms->oem_table_id); |
72 | - gicr->range_length = cpu_to_le32(memmap[VIRT_GIC_REDIST2].size); | 36 | + } |
73 | + gicr->base_address = | 37 | + |
74 | + cpu_to_le64(memmap[VIRT_HIGH_GIC_REDIST2].base); | 38 | /* XSDT is pointed to by RSDP */ |
75 | + gicr->range_length = | 39 | xsdt = tables_blob->len; |
76 | + cpu_to_le32(memmap[VIRT_HIGH_GIC_REDIST2].size); | 40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, |
77 | } | 41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
78 | |||
79 | if (its_class_name() && !vmc->no_its) { | ||
80 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
82 | --- a/hw/arm/virt.c | 43 | --- a/hw/arm/Kconfig |
83 | +++ b/hw/arm/virt.c | 44 | +++ b/hw/arm/Kconfig |
84 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry a15memmap[] = { | 45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
85 | [VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 }, | 46 | select DIMM |
86 | [VIRT_MEM] = { 0x40000000, RAMLIMIT_BYTES }, | 47 | select ACPI_HW_REDUCED |
87 | /* Additional 64 MB redist region (can contain up to 512 redistributors) */ | 48 | select ACPI_APEI |
88 | - [VIRT_GIC_REDIST2] = { 0x4000000000ULL, 0x4000000 }, | 49 | + select ACPI_VIOT |
89 | - [VIRT_PCIE_ECAM_HIGH] = { 0x4010000000ULL, 0x10000000 }, | 50 | |
90 | + [VIRT_HIGH_GIC_REDIST2] = { 0x4000000000ULL, 0x4000000 }, | 51 | config CHEETAH |
91 | + [VIRT_HIGH_PCIE_ECAM] = { 0x4010000000ULL, 0x10000000 }, | 52 | bool |
92 | /* Second PCIe window, 512GB wide at the 512GB boundary */ | ||
93 | - [VIRT_PCIE_MMIO_HIGH] = { 0x8000000000ULL, 0x8000000000ULL }, | ||
94 | + [VIRT_HIGH_PCIE_MMIO] = { 0x8000000000ULL, 0x8000000000ULL }, | ||
95 | }; | ||
96 | |||
97 | static const int a15irqmap[] = { | ||
98 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_gic_node(VirtMachineState *vms) | ||
99 | 2, vms->memmap[VIRT_GIC_REDIST].size); | ||
100 | } else { | ||
101 | qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", | ||
102 | - 2, vms->memmap[VIRT_GIC_DIST].base, | ||
103 | - 2, vms->memmap[VIRT_GIC_DIST].size, | ||
104 | - 2, vms->memmap[VIRT_GIC_REDIST].base, | ||
105 | - 2, vms->memmap[VIRT_GIC_REDIST].size, | ||
106 | - 2, vms->memmap[VIRT_GIC_REDIST2].base, | ||
107 | - 2, vms->memmap[VIRT_GIC_REDIST2].size); | ||
108 | + 2, vms->memmap[VIRT_GIC_DIST].base, | ||
109 | + 2, vms->memmap[VIRT_GIC_DIST].size, | ||
110 | + 2, vms->memmap[VIRT_GIC_REDIST].base, | ||
111 | + 2, vms->memmap[VIRT_GIC_REDIST].size, | ||
112 | + 2, vms->memmap[VIRT_HIGH_GIC_REDIST2].base, | ||
113 | + 2, vms->memmap[VIRT_HIGH_GIC_REDIST2].size); | ||
114 | } | ||
115 | |||
116 | if (vms->virt) { | ||
117 | @@ -XXX,XX +XXX,XX @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) | ||
118 | |||
119 | if (nb_redist_regions == 2) { | ||
120 | uint32_t redist1_capacity = | ||
121 | - vms->memmap[VIRT_GIC_REDIST2].size / GICV3_REDIST_SIZE; | ||
122 | + vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; | ||
123 | |||
124 | qdev_prop_set_uint32(gicdev, "redist-region-count[1]", | ||
125 | MIN(smp_cpus - redist0_count, redist1_capacity)); | ||
126 | @@ -XXX,XX +XXX,XX @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) | ||
127 | if (type == 3) { | ||
128 | sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_REDIST].base); | ||
129 | if (nb_redist_regions == 2) { | ||
130 | - sysbus_mmio_map(gicbusdev, 2, vms->memmap[VIRT_GIC_REDIST2].base); | ||
131 | + sysbus_mmio_map(gicbusdev, 2, | ||
132 | + vms->memmap[VIRT_HIGH_GIC_REDIST2].base); | ||
133 | } | ||
134 | } else { | ||
135 | sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_CPU].base); | ||
136 | @@ -XXX,XX +XXX,XX @@ static void create_pcie(VirtMachineState *vms, qemu_irq *pic) | ||
137 | { | ||
138 | hwaddr base_mmio = vms->memmap[VIRT_PCIE_MMIO].base; | ||
139 | hwaddr size_mmio = vms->memmap[VIRT_PCIE_MMIO].size; | ||
140 | - hwaddr base_mmio_high = vms->memmap[VIRT_PCIE_MMIO_HIGH].base; | ||
141 | - hwaddr size_mmio_high = vms->memmap[VIRT_PCIE_MMIO_HIGH].size; | ||
142 | + hwaddr base_mmio_high = vms->memmap[VIRT_HIGH_PCIE_MMIO].base; | ||
143 | + hwaddr size_mmio_high = vms->memmap[VIRT_HIGH_PCIE_MMIO].size; | ||
144 | hwaddr base_pio = vms->memmap[VIRT_PCIE_PIO].base; | ||
145 | hwaddr size_pio = vms->memmap[VIRT_PCIE_PIO].size; | ||
146 | hwaddr base_ecam, size_ecam; | ||
147 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
148 | * many redistributors we can fit into the memory map. | ||
149 | */ | ||
150 | if (vms->gic_version == 3) { | ||
151 | - virt_max_cpus = vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; | ||
152 | - virt_max_cpus += vms->memmap[VIRT_GIC_REDIST2].size / GICV3_REDIST_SIZE; | ||
153 | + virt_max_cpus = | ||
154 | + vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; | ||
155 | + virt_max_cpus += | ||
156 | + vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; | ||
157 | } else { | ||
158 | virt_max_cpus = GIC_NCPU; | ||
159 | } | ||
160 | -- | 53 | -- |
161 | 2.20.1 | 54 | 2.25.1 |
162 | 55 | ||
163 | 56 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This patch implements the machine class kvm_type() callback. | 3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. |
4 | It returns the number of bits requested to implement the whole GPA | 4 | Remove the restriction that prevents from instantiating a virtio-iommu |
5 | range including the RAM and IO regions located beyond. | 5 | device under ACPI. |
6 | The returned value is passed though the KVM_CREATE_VM ioctl and | ||
7 | this allows KVM to set the stage2 tables dynamically. | ||
8 | 6 | ||
9 | To compute the highest GPA used in the memory map, kvm_type() | 7 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
10 | must freeze the memory map by calling virt_set_memmap(). | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
11 | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
12 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org |
13 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
14 | Message-id: 20190304101339.25970-9-eric.auger@redhat.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 12 | --- |
17 | hw/arm/virt.c | 39 ++++++++++++++++++++++++++++++++++++++- | 13 | hw/arm/virt.c | 10 ++-------- |
18 | 1 file changed, 38 insertions(+), 1 deletion(-) | 14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | ||
19 | 16 | ||
20 | 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 |
21 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/virt.c | 19 | --- a/hw/arm/virt.c |
23 | +++ b/hw/arm/virt.c | 20 | +++ b/hw/arm/virt.c |
24 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
25 | bool firmware_loaded = bios_name || drive_get(IF_PFLASH, 0, 0); | ||
26 | bool aarch64 = true; | ||
27 | |||
28 | - virt_set_memmap(vms); | ||
29 | + /* | ||
30 | + * In accelerated mode, the memory map is computed earlier in kvm_type() | ||
31 | + * to create a VM with the right number of IPA bits. | ||
32 | + */ | ||
33 | + if (!vms->memmap) { | ||
34 | + virt_set_memmap(vms); | ||
35 | + } | ||
36 | |||
37 | /* We can probe only here because during property set | ||
38 | * KVM is not available yet | ||
39 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
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); | ||
29 | } | ||
30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | ||
31 | - VirtMachineState *vms = VIRT_MACHINE(machine); | ||
32 | - | ||
33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { | ||
34 | - return HOTPLUG_HANDLER(machine); | ||
35 | - } | ||
36 | - } | ||
40 | return NULL; | 37 | return NULL; |
41 | } | 38 | } |
42 | 39 | ||
43 | +/* | 40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c |
44 | + * for arm64 kvm_type [7-0] encodes the requested number of bits | 41 | index XXXXXXX..XXXXXXX 100644 |
45 | + * in the IPA address space | 42 | --- a/hw/virtio/virtio-iommu-pci.c |
46 | + */ | 43 | +++ b/hw/virtio/virtio-iommu-pci.c |
47 | +static int virt_kvm_type(MachineState *ms, const char *type_str) | 44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) |
48 | +{ | 45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); |
49 | + VirtMachineState *vms = VIRT_MACHINE(ms); | 46 | |
50 | + int max_vm_pa_size = kvm_arm_get_max_vm_ipa_size(ms); | 47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { |
51 | + int requested_pa_size; | 48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); |
52 | + | 49 | - |
53 | + /* we freeze the memory map to compute the highest gpa */ | 50 | - error_setg(errp, |
54 | + virt_set_memmap(vms); | 51 | - "%s machine fails to create iommu-map device tree bindings", |
55 | + | 52 | - mc->name); |
56 | + requested_pa_size = 64 - clz64(vms->highest_gpa); | 53 | - error_append_hint(errp, |
57 | + | 54 | - "Check your machine implements a hotplug handler " |
58 | + if (requested_pa_size > max_vm_pa_size) { | 55 | - "for the virtio-iommu-pci device\n"); |
59 | + error_report("-m and ,maxmem option values " | 56 | - error_append_hint(errp, "Check the guest is booted without FW or with " |
60 | + "require an IPA range (%d bits) larger than " | 57 | - "-no-acpi\n"); |
61 | + "the one supported by the host (%d bits)", | 58 | + error_setg(errp, "Check your machine implements a hotplug handler " |
62 | + requested_pa_size, max_vm_pa_size); | 59 | + "for the virtio-iommu-pci device"); |
63 | + exit(1); | 60 | return; |
64 | + } | 61 | } |
65 | + /* | 62 | for (int i = 0; i < s->nb_reserved_regions; i++) { |
66 | + * By default we return 0 which corresponds to an implicit legacy | ||
67 | + * 40b IPA setting. Otherwise we return the actual requested PA | ||
68 | + * logsize | ||
69 | + */ | ||
70 | + return requested_pa_size > 40 ? requested_pa_size : 0; | ||
71 | +} | ||
72 | + | ||
73 | static void virt_machine_class_init(ObjectClass *oc, void *data) | ||
74 | { | ||
75 | MachineClass *mc = MACHINE_CLASS(oc); | ||
76 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) | ||
77 | mc->cpu_index_to_instance_props = virt_cpu_index_to_props; | ||
78 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | ||
79 | mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; | ||
80 | + mc->kvm_type = virt_kvm_type; | ||
81 | assert(!mc->get_hotplug_handler); | ||
82 | mc->get_hotplug_handler = virt_machine_get_hotplug_handler; | ||
83 | hc->plug = virt_machine_device_plug_cb; | ||
84 | -- | 63 | -- |
85 | 2.20.1 | 64 | 2.25.1 |
86 | 65 | ||
87 | 66 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Now we have the extended memory map (high IO regions beyond the | 3 | We do not support instantiating multiple IOMMUs. Before adding a |
4 | scalable RAM) and dynamic IPA range support at KVM/ARM level | 4 | virtio-iommu, check that no other IOMMU is present. This will detect |
5 | we can bump the legacy 255GB initial RAM limit. The actual maximum | 5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. |
6 | RAM size now depends on the physical CPU and host kernel, in | ||
7 | accelerated mode. In TCG mode, it depends on the VCPU | ||
8 | AA64MMFR0.PARANGE. | ||
9 | 6 | ||
10 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
12 | Message-id: 20190304101339.25970-11-eric.auger@redhat.com | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 13 | --- |
15 | hw/arm/virt.c | 21 +-------------------- | 14 | hw/arm/virt.c | 5 +++++ |
16 | 1 file changed, 1 insertion(+), 20 deletions(-) | 15 | 1 file changed, 5 insertions(+) |
17 | 16 | ||
18 | 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 |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/virt.c | 19 | --- a/hw/arm/virt.c |
21 | +++ b/hw/arm/virt.c | 20 | +++ b/hw/arm/virt.c |
22 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
23 | 22 | hwaddr db_start = 0, db_end = 0; | |
24 | #define PLATFORM_BUS_NUM_IRQS 64 | 23 | char *resv_prop_str; |
25 | 24 | ||
26 | -/* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means | 25 | + if (vms->iommu != VIRT_IOMMU_NONE) { |
27 | - * RAM can go up to the 256GB mark, leaving 256GB of the physical | 26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); |
28 | - * address space unallocated and free for future use between 256G and 512G. | 27 | + return; |
29 | - * If we need to provide more RAM to VMs in the future then we need to: | 28 | + } |
30 | - * * allocate a second bank of RAM starting at 2TB and working up | 29 | + |
31 | - * * fix the DT and ACPI table generation code in QEMU to correctly | 30 | switch (vms->msi_controller) { |
32 | - * report two split lumps of RAM to the guest | 31 | case VIRT_MSI_CTRL_NONE: |
33 | - * * fix KVM in the host kernel to allow guests with >40 bit address spaces | 32 | return; |
34 | - * (We don't want to fill all the way up to 512GB with RAM because | ||
35 | - * we might want it for non-RAM purposes later. Conversely it seems | ||
36 | - * reasonable to assume that anybody configuring a VM with a quarter | ||
37 | - * of a terabyte of RAM will be doing it on a host with more than a | ||
38 | - * terabyte of physical address space.) | ||
39 | - */ | ||
40 | +/* Legacy RAM limit in GB (< version 4.0) */ | ||
41 | #define LEGACY_RAMLIMIT_GB 255 | ||
42 | #define LEGACY_RAMLIMIT_BYTES (LEGACY_RAMLIMIT_GB * GiB) | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
45 | |||
46 | vms->smp_cpus = smp_cpus; | ||
47 | |||
48 | - if (machine->ram_size > vms->memmap[VIRT_MEM].size) { | ||
49 | - error_report("mach-virt: cannot model more than %dGB RAM", | ||
50 | - LEGACY_RAMLIMIT_GB); | ||
51 | - exit(1); | ||
52 | - } | ||
53 | - | ||
54 | if (vms->virt && kvm_enabled()) { | ||
55 | error_report("mach-virt: KVM does not support providing " | ||
56 | "Virtualization extensions to the guest CPU"); | ||
57 | -- | 33 | -- |
58 | 2.20.1 | 34 | 2.25.1 |
59 | 35 | ||
60 | 36 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We are about to allow the memory map to grow beyond 1TB and | 3 | To propagate errors to the caller of the pre_plug callback, use the |
4 | potentially overshoot the VCPU AA64MMFR0.PARANGE. | 4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() |
5 | helpers. | ||
5 | 6 | ||
6 | In aarch64 mode and when highmem is set, let's check the VCPU | 7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> |
7 | PA range is sufficient to address the highest GPA of the memory | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | map. | ||
9 | |||
10 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
12 | Message-id: 20190304101339.25970-10-eric.auger@redhat.com | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | Message-id: 20211210170415.583179-5-jean-philippe@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 13 | --- |
15 | hw/arm/virt.c | 17 +++++++++++++++++ | 14 | hw/arm/virt.c | 5 +++-- |
16 | 1 file changed, 17 insertions(+) | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
17 | 16 | ||
18 | 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 |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/virt.c | 19 | --- a/hw/arm/virt.c |
21 | +++ b/hw/arm/virt.c | 20 | +++ b/hw/arm/virt.c |
22 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
23 | #include "standard-headers/linux/input.h" | 22 | db_start, db_end, |
24 | #include "hw/arm/smmuv3.h" | 23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); |
25 | #include "hw/acpi/acpi.h" | 24 | |
26 | +#include "target/arm/internals.h" | 25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); |
27 | 26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); | |
28 | #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ | 27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); |
29 | static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ | 28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", |
30 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 29 | + resv_prop_str, errp); |
31 | fdt_add_timer_nodes(vms); | 30 | g_free(resv_prop_str); |
32 | fdt_add_cpu_nodes(vms); | 31 | } |
33 | 32 | } | |
34 | + if (!kvm_enabled()) { | ||
35 | + ARMCPU *cpu = ARM_CPU(first_cpu); | ||
36 | + bool aarch64 = object_property_get_bool(OBJECT(cpu), "aarch64", NULL); | ||
37 | + | ||
38 | + if (aarch64 && vms->highmem) { | ||
39 | + int requested_pa_size, pamax = arm_pamax(cpu); | ||
40 | + | ||
41 | + requested_pa_size = 64 - clz64(vms->highest_gpa); | ||
42 | + if (pamax < requested_pa_size) { | ||
43 | + error_report("VCPU supports less PA bits (%d) than requested " | ||
44 | + "by the memory map (%d)", pamax, requested_pa_size); | ||
45 | + exit(1); | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", | ||
51 | machine->ram_size); | ||
52 | memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); | ||
53 | -- | 33 | -- |
54 | 2.20.1 | 34 | 2.25.1 |
55 | 35 | ||
56 | 36 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The machine RAM attributes will need to be analyzed during the | 3 | Create empty data files and allow updates for the upcoming VIOT tests. |
4 | configure_accelerator() process. especially kvm_type() arm64 | ||
5 | machine callback will use them to know how many IPA/GPA bits are | ||
6 | needed to model the whole RAM range. So let's assign those machine | ||
7 | state fields before calling configure_accelerator. | ||
8 | 4 | ||
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 5 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
11 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
12 | Message-id: 20190304101339.25970-7-eric.auger@redhat.com | 8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org |
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 10 | --- |
15 | vl.c | 6 +++--- | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
16 | 1 file changed, 3 insertions(+), 3 deletions(-) | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
13 | tests/data/acpi/q35/VIOT.viot | 0 | ||
14 | tests/data/acpi/virt/VIOT | 0 | ||
15 | 4 files changed, 3 insertions(+) | ||
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 | ||
17 | 19 | ||
18 | diff --git a/vl.c b/vl.c | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
19 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/vl.c | 22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
21 | +++ b/vl.c | 23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
22 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp) | 24 | @@ -1 +1,4 @@ |
23 | machine_opts = qemu_get_machine_opts(); | 25 | /* List of comma-separated changed AML files to ignore */ |
24 | qemu_opt_foreach(machine_opts, machine_set_property, current_machine, | 26 | +"tests/data/acpi/virt/VIOT", |
25 | &error_fatal); | 27 | +"tests/data/acpi/q35/DSDT.viot", |
26 | + current_machine->ram_size = ram_size; | 28 | +"tests/data/acpi/q35/VIOT.viot", |
27 | + current_machine->maxram_size = maxram_size; | 29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
28 | + current_machine->ram_slots = ram_slots; | 30 | new file mode 100644 |
29 | 31 | index XXXXXXX..XXXXXXX | |
30 | configure_accelerator(current_machine, argv[0]); | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
31 | 33 | new file mode 100644 | |
32 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp) | 34 | index XXXXXXX..XXXXXXX |
33 | replay_checkpoint(CHECKPOINT_INIT); | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
34 | qdev_machine_init(); | 36 | new file mode 100644 |
35 | 37 | index XXXXXXX..XXXXXXX | |
36 | - current_machine->ram_size = ram_size; | ||
37 | - current_machine->maxram_size = maxram_size; | ||
38 | - current_machine->ram_slots = ram_slots; | ||
39 | current_machine->boot_order = boot_order; | ||
40 | |||
41 | /* parse features once if machine provides default cpu_type */ | ||
42 | -- | 38 | -- |
43 | 2.20.1 | 39 | 2.25.1 |
44 | 40 | ||
45 | 41 | diff view generated by jsdifflib |
1 | From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We introduce an helper to create a memory node. | 3 | Add two test cases for VIOT, one on the q35 machine and the other on |
4 | virt. To test complex topologies the q35 test has two PCIe buses that | ||
5 | bypass the IOMMU (and are therefore not described by VIOT), and two | ||
6 | buses that are translated by virtio-iommu. | ||
4 | 7 | ||
5 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
6 | Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> | ||
7 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
9 | Message-id: 20190304101339.25970-2-eric.auger@redhat.com | 11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | hw/arm/boot.c | 54 ++++++++++++++++++++++++++++++++------------------- | 14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ |
13 | 1 file changed, 34 insertions(+), 20 deletions(-) | 15 | 1 file changed, 38 insertions(+) |
14 | 16 | ||
15 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/boot.c | 19 | --- a/tests/qtest/bios-tables-test.c |
18 | +++ b/hw/arm/boot.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
19 | @@ -XXX,XX +XXX,XX @@ static void set_kernel_args_old(const struct arm_boot_info *info, | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
20 | } | 22 | free_test_data(&data); |
21 | } | 23 | } |
22 | 24 | ||
23 | +static int fdt_add_memory_node(void *fdt, uint32_t acells, hwaddr mem_base, | 25 | +static void test_acpi_q35_viot(void) |
24 | + uint32_t scells, hwaddr mem_len, | ||
25 | + int numa_node_id) | ||
26 | +{ | 26 | +{ |
27 | + char *nodename; | 27 | + test_data data = { |
28 | + int ret; | 28 | + .machine = MACHINE_Q35, |
29 | + .variant = ".viot", | ||
30 | + }; | ||
29 | + | 31 | + |
30 | + nodename = g_strdup_printf("/memory@%" PRIx64, mem_base); | 32 | + /* |
31 | + qemu_fdt_add_subnode(fdt, nodename); | 33 | + * To keep things interesting, two buses bypass the IOMMU. |
32 | + qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory"); | 34 | + * VIOT should only describes the other two buses. |
33 | + ret = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg", acells, mem_base, | 35 | + */ |
34 | + scells, mem_len); | 36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " |
35 | + if (ret < 0) { | 37 | + "-device virtio-iommu-pci " |
36 | + goto out; | 38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " |
37 | + } | 39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " |
38 | + | 40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", |
39 | + /* only set the NUMA ID if it is specified */ | 41 | + &data); |
40 | + if (numa_node_id >= 0) { | 42 | + free_test_data(&data); |
41 | + ret = qemu_fdt_setprop_cell(fdt, nodename, | ||
42 | + "numa-node-id", numa_node_id); | ||
43 | + } | ||
44 | +out: | ||
45 | + g_free(nodename); | ||
46 | + return ret; | ||
47 | +} | 43 | +} |
48 | + | 44 | + |
49 | static void fdt_add_psci_node(void *fdt) | 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) | ||
50 | { | 62 | { |
51 | uint32_t cpu_suspend_fn; | 63 | int i; |
52 | @@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | 64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
53 | void *fdt = NULL; | 65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); |
54 | int size, rc, n = 0; | 66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); |
55 | uint32_t acells, scells; | ||
56 | - char *nodename; | ||
57 | unsigned int i; | ||
58 | hwaddr mem_base, mem_len; | ||
59 | char **node_path; | ||
60 | @@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
61 | mem_base = binfo->loader_start; | ||
62 | for (i = 0; i < nb_numa_nodes; i++) { | ||
63 | mem_len = numa_info[i].node_mem; | ||
64 | - nodename = g_strdup_printf("/memory@%" PRIx64, mem_base); | ||
65 | - qemu_fdt_add_subnode(fdt, nodename); | ||
66 | - qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory"); | ||
67 | - rc = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg", | ||
68 | - acells, mem_base, | ||
69 | - scells, mem_len); | ||
70 | + rc = fdt_add_memory_node(fdt, acells, mem_base, | ||
71 | + scells, mem_len, i); | ||
72 | if (rc < 0) { | ||
73 | - fprintf(stderr, "couldn't set %s/reg for node %d\n", nodename, | ||
74 | - i); | ||
75 | + fprintf(stderr, "couldn't add /memory@%"PRIx64" node\n", | ||
76 | + mem_base); | ||
77 | goto fail; | ||
78 | } | ||
79 | |||
80 | - qemu_fdt_setprop_cell(fdt, nodename, "numa-node-id", i); | ||
81 | mem_base += mem_len; | ||
82 | - g_free(nodename); | ||
83 | } | 67 | } |
84 | } else { | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); |
85 | - nodename = g_strdup_printf("/memory@%" PRIx64, binfo->loader_start); | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
86 | - qemu_fdt_add_subnode(fdt, nodename); | 70 | if (has_tcg) { |
87 | - qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory"); | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
88 | - | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
89 | - rc = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg", | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); |
90 | - acells, binfo->loader_start, | 74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); |
91 | - scells, binfo->ram_size); | 75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); |
92 | + rc = fdt_add_memory_node(fdt, acells, binfo->loader_start, | 76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); |
93 | + scells, binfo->ram_size, -1); | ||
94 | if (rc < 0) { | ||
95 | - fprintf(stderr, "couldn't set %s reg\n", nodename); | ||
96 | + fprintf(stderr, "couldn't add /memory@%"PRIx64" node\n", | ||
97 | + binfo->loader_start); | ||
98 | goto fail; | ||
99 | } | 77 | } |
100 | - g_free(nodename); | ||
101 | } | 78 | } |
102 | 79 | ret = g_test_run(); | |
103 | rc = fdt_path_offset(fdt, "/chosen"); | ||
104 | -- | 80 | -- |
105 | 2.20.1 | 81 | 2.25.1 |
106 | 82 | ||
107 | 83 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
2 | |||
3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the | ||
4 | q35 machine. | ||
5 | |||
6 | Since the test instantiates a virtio device and two PCIe expander | ||
7 | bridges, DSDT.viot has more blocks than the base DSDT. | ||
8 | |||
9 | The VIOT table generated for the q35 test is: | ||
10 | |||
11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | ||
12 | [004h 0004 4] Table Length : 00000070 | ||
13 | [008h 0008 1] Revision : 00 | ||
14 | [009h 0009 1] Checksum : 3D | ||
15 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
16 | [010h 0016 8] Oem Table ID : "BXPC " | ||
17 | [018h 0024 4] Oem Revision : 00000001 | ||
18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
19 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
20 | |||
21 | [024h 0036 2] Node count : 0003 | ||
22 | [026h 0038 2] Node offset : 0030 | ||
23 | [028h 0040 8] Reserved : 0000000000000000 | ||
24 | |||
25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
26 | [031h 0049 1] Reserved : 00 | ||
27 | [032h 0050 2] Length : 0010 | ||
28 | |||
29 | [034h 0052 2] PCI Segment : 0000 | ||
30 | [036h 0054 2] PCI BDF number : 0010 | ||
31 | [038h 0056 8] Reserved : 0000000000000000 | ||
32 | |||
33 | [040h 0064 1] Type : 01 [PCI Range] | ||
34 | [041h 0065 1] Reserved : 00 | ||
35 | [042h 0066 2] Length : 0018 | ||
36 | |||
37 | [044h 0068 4] Endpoint start : 00003000 | ||
38 | [048h 0072 2] PCI Segment start : 0000 | ||
39 | [04Ah 0074 2] PCI Segment end : 0000 | ||
40 | [04Ch 0076 2] PCI BDF start : 3000 | ||
41 | [04Eh 0078 2] PCI BDF end : 30FF | ||
42 | [050h 0080 2] Output node : 0030 | ||
43 | [052h 0082 6] Reserved : 000000000000 | ||
44 | |||
45 | [058h 0088 1] Type : 01 [PCI Range] | ||
46 | [059h 0089 1] Reserved : 00 | ||
47 | [05Ah 0090 2] Length : 0018 | ||
48 | |||
49 | [05Ch 0092 4] Endpoint start : 00001000 | ||
50 | [060h 0096 2] PCI Segment start : 0000 | ||
51 | [062h 0098 2] PCI Segment end : 0000 | ||
52 | [064h 0100 2] PCI BDF start : 1000 | ||
53 | [066h 0102 2] PCI BDF end : 10FF | ||
54 | [068h 0104 2] Output node : 0030 | ||
55 | [06Ah 0106 6] Reserved : 000000000000 | ||
56 | |||
57 | And the DSDT diff is: | ||
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | * | ||
61 | * Disassembling to symbolic ASL+ operators | ||
62 | * | ||
63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 | ||
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 | } | ||
78 | } | ||
79 | |||
80 | + Scope (\_SB) | ||
81 | + { | ||
82 | + Device (PC30) | ||
83 | + { | ||
84 | + Name (_UID, 0x30) // _UID: Unique ID | ||
85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number | ||
86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
89 | + { | ||
90 | + CreateDWordField (Arg3, Zero, CDW1) | ||
91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
92 | + { | ||
93 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
94 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
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 | + }) | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + Scope (\_SB) | ||
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 | + }) | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
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 | + } | ||
411 | + } | ||
412 | + | ||
413 | Scope (\_SB.PCI0) | ||
414 | { | ||
415 | Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
416 | @@ -XXX,XX +XXX,XX @@ | ||
417 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
418 | 0x0000, // Granularity | ||
419 | 0x0000, // Range Minimum | ||
420 | - 0x00FF, // Range Maximum | ||
421 | + 0x000F, // Range Maximum | ||
422 | 0x0000, // Translation Offset | ||
423 | - 0x0100, // Length | ||
424 | + 0x0010, // Length | ||
425 | ,, ) | ||
426 | IO (Decode16, | ||
427 | 0x0CF8, // Range Minimum | ||
428 | @@ -XXX,XX +XXX,XX @@ | ||
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 | |||
558 | -- | ||
559 | 2.25.1 | ||
560 | |||
561 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | On ARM, the kvm_type will be resolved by querying the KVMState. | 3 | The VIOT blob contains the following: |
4 | Let's add the MachineState handle to the callback so that we | ||
5 | can retrieve the KVMState handle. in kvm_init, when the callback | ||
6 | is called, the kvm_state variable is not yet set. | ||
7 | 4 | ||
8 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
9 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | 6 | [004h 0004 4] Table Length : 00000058 |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | [008h 0008 1] Revision : 00 |
11 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | [009h 0009 1] Checksum : 66 |
12 | Message-id: 20190304101339.25970-5-eric.auger@redhat.com | 9 | [00Ah 0010 6] Oem ID : "BOCHS " |
13 | [ppc parts] | 10 | [010h 0016 8] Oem Table ID : "BXPC " |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | [018h 0024 4] Oem Revision : 00000001 |
15 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 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 | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 44 | --- |
18 | include/hw/boards.h | 5 ++++- | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
19 | accel/kvm/kvm-all.c | 2 +- | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
20 | hw/ppc/mac_newworld.c | 3 +-- | 47 | 2 files changed, 1 deletion(-) |
21 | hw/ppc/mac_oldworld.c | 2 +- | ||
22 | hw/ppc/spapr.c | 2 +- | ||
23 | 5 files changed, 8 insertions(+), 6 deletions(-) | ||
24 | 48 | ||
25 | diff --git a/include/hw/boards.h b/include/hw/boards.h | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
26 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/include/hw/boards.h | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
28 | +++ b/include/hw/boards.h | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 53 | @@ -1,2 +1 @@ |
30 | * should instead use "unimplemented-device" for all memory ranges where | 54 | /* List of comma-separated changed AML files to ignore */ |
31 | * the guest will attempt to probe for a device that QEMU doesn't | 55 | -"tests/data/acpi/virt/VIOT", |
32 | * implement and a stub device is required. | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
33 | + * @kvm_type: | ||
34 | + * Return the type of KVM corresponding to the kvm-type string option or | ||
35 | + * computed based on other criteria such as the host kernel capabilities. | ||
36 | */ | ||
37 | struct MachineClass { | ||
38 | /*< private >*/ | ||
39 | @@ -XXX,XX +XXX,XX @@ struct MachineClass { | ||
40 | void (*init)(MachineState *state); | ||
41 | void (*reset)(void); | ||
42 | void (*hot_add_cpu)(const int64_t id, Error **errp); | ||
43 | - int (*kvm_type)(const char *arg); | ||
44 | + int (*kvm_type)(MachineState *machine, const char *arg); | ||
45 | |||
46 | BlockInterfaceType block_default_type; | ||
47 | int units_per_default_bus; | ||
48 | diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/accel/kvm/kvm-all.c | 58 | GIT binary patch |
51 | +++ b/accel/kvm/kvm-all.c | 59 | literal 88 |
52 | @@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms) | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX |
53 | 61 | I{D-Rq0Q5fy0RR91 | |
54 | kvm_type = qemu_opt_get(qemu_get_machine_opts(), "kvm-type"); | 62 | |
55 | if (mc->kvm_type) { | 63 | literal 0 |
56 | - type = mc->kvm_type(kvm_type); | 64 | HcmV?d00001 |
57 | + type = mc->kvm_type(ms, kvm_type); | 65 | |
58 | } else if (kvm_type) { | ||
59 | ret = -EINVAL; | ||
60 | fprintf(stderr, "Invalid argument kvm-type=%s\n", kvm_type); | ||
61 | diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/hw/ppc/mac_newworld.c | ||
64 | +++ b/hw/ppc/mac_newworld.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static char *core99_fw_dev_path(FWPathProvider *p, BusState *bus, | ||
66 | |||
67 | return NULL; | ||
68 | } | ||
69 | - | ||
70 | -static int core99_kvm_type(const char *arg) | ||
71 | +static int core99_kvm_type(MachineState *machine, const char *arg) | ||
72 | { | ||
73 | /* Always force PR KVM */ | ||
74 | return 2; | ||
75 | diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c | ||
76 | index XXXXXXX..XXXXXXX 100644 | ||
77 | --- a/hw/ppc/mac_oldworld.c | ||
78 | +++ b/hw/ppc/mac_oldworld.c | ||
79 | @@ -XXX,XX +XXX,XX @@ static char *heathrow_fw_dev_path(FWPathProvider *p, BusState *bus, | ||
80 | return NULL; | ||
81 | } | ||
82 | |||
83 | -static int heathrow_kvm_type(const char *arg) | ||
84 | +static int heathrow_kvm_type(MachineState *machine, const char *arg) | ||
85 | { | ||
86 | /* Always force PR KVM */ | ||
87 | return 2; | ||
88 | diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | ||
90 | --- a/hw/ppc/spapr.c | ||
91 | +++ b/hw/ppc/spapr.c | ||
92 | @@ -XXX,XX +XXX,XX @@ static void spapr_machine_init(MachineState *machine) | ||
93 | } | ||
94 | } | ||
95 | |||
96 | -static int spapr_kvm_type(const char *vm_type) | ||
97 | +static int spapr_kvm_type(MachineState *machine, const char *vm_type) | ||
98 | { | ||
99 | if (!vm_type) { | ||
100 | return 0; | ||
101 | -- | 66 | -- |
102 | 2.20.1 | 67 | 2.25.1 |
103 | 68 | ||
104 | 69 | diff view generated by jsdifflib |