1 | target-arm queue. This has the "plumb txattrs through various | 1 | Nothing much exciting here, but it's 37 patches worth... |
---|---|---|---|
2 | bits of exec.c" patches, and a collection of bug fixes from | ||
3 | various people. | ||
4 | 2 | ||
5 | thanks | 3 | thanks |
6 | -- PMM | 4 | -- PMM |
7 | 5 | ||
6 | The following changes since commit e64a62df378a746c0b257105959613c9f8122e59: | ||
8 | 7 | ||
9 | 8 | Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-040320-1' into staging (2020-03-05 12:13:51 +0000) | |
10 | The following changes since commit a3ac12fba028df90f7b3dbec924995c126c41022: | ||
11 | |||
12 | Merge remote-tracking branch 'remotes/ehabkost/tags/numa-next-pull-request' into staging (2018-05-31 11:12:36 +0100) | ||
13 | 9 | ||
14 | are available in the Git repository at: | 10 | are available in the Git repository at: |
15 | 11 | ||
16 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180531 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200305 |
17 | 13 | ||
18 | for you to fetch changes up to 49d1dca0520ea71bc21867fab6647f474fcf857b: | 14 | for you to fetch changes up to 597d61a3b1f94c53a3aaa77671697c0c5f797dbf: |
19 | 15 | ||
20 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice (2018-05-31 14:52:53 +0100) | 16 | target/arm: Clean address for DC ZVA (2020-03-05 16:09:21 +0000) |
21 | 17 | ||
22 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
23 | target-arm queue: | 19 | * versal: Implement ADMA |
24 | * target/arm: Honour FPCR.FZ in FRECPX | 20 | * Implement (trivially) ARMv8.2-TTCNP |
25 | * MAINTAINERS: Add entries for newer MPS2 boards and devices | 21 | * hw/arm/smmu-common: a fix to smmu_find_smmu_pcibus |
26 | * hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 22 | * Remove unnecessary endianness-handling on some boards |
27 | * arm_gicv3_kvm: fix bug in writing zero bits back to the in-kernel | 23 | * Avoid minor memory leaks from timer_new in some devices |
28 | GIC state | 24 | * Honour more of the HCR_EL2 trap bits |
29 | * tcg: Fix helper function vs host abi for float16 | 25 | * Complain rather than ignoring bad command line options for cubieboard |
30 | * arm: fix qemu crash on startup with -bios option | 26 | * Honour TBI for DC ZVA and exception return |
31 | * arm: fix malloc type mismatch | ||
32 | * xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | ||
33 | * Correct CPACR reset value for v7 cores | ||
34 | * memory.h: Improve IOMMU related documentation | ||
35 | * exec: Plumb transaction attributes through various functions in | ||
36 | preparation for allowing IOMMUs to see them | ||
37 | * vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY | ||
38 | * ARM: ACPI: Fix use-after-free due to memory realloc | ||
39 | * KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | ||
40 | 27 | ||
41 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
42 | Francisco Iglesias (1): | 29 | Edgar E. Iglesias (2): |
43 | xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | 30 | hw/arm: versal: Add support for the LPD ADMAs |
31 | hw/arm: versal: Generate xlnx-versal-virt zdma FDT nodes | ||
44 | 32 | ||
45 | Igor Mammedov (1): | 33 | Eric Auger (1): |
46 | arm: fix qemu crash on startup with -bios option | 34 | hw/arm/smmu-common: a fix to smmu_find_smmu_pcibus |
47 | 35 | ||
48 | Jan Kiszka (1): | 36 | Niek Linnenbank (4): |
49 | hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 37 | hw/arm/cubieboard: use ARM Cortex-A8 as the default CPU in machine definition |
38 | hw/arm/cubieboard: restrict allowed CPU type to ARM Cortex-A8 | ||
39 | hw/arm/cubieboard: restrict allowed RAM size to 512MiB and 1GiB | ||
40 | hw/arm/cubieboard: report error when using unsupported -bios argument | ||
50 | 41 | ||
51 | Paolo Bonzini (1): | 42 | Pan Nengyuan (4): |
52 | arm: fix malloc type mismatch | 43 | hw/arm/pxa2xx: move timer_new from init() into realize() to avoid memleaks |
44 | hw/arm/spitz: move timer_new from init() into realize() to avoid memleaks | ||
45 | hw/arm/strongarm: move timer_new from init() into realize() to avoid memleaks | ||
46 | hw/timer/cadence_ttc: move timer_new from init() into realize() to avoid memleaks | ||
53 | 47 | ||
54 | Peter Maydell (17): | 48 | Peter Maydell (1): |
55 | target/arm: Honour FPCR.FZ in FRECPX | 49 | target/arm: Implement (trivially) ARMv8.2-TTCNP |
56 | MAINTAINERS: Add entries for newer MPS2 boards and devices | ||
57 | Correct CPACR reset value for v7 cores | ||
58 | memory.h: Improve IOMMU related documentation | ||
59 | Make tb_invalidate_phys_addr() take a MemTxAttrs argument | ||
60 | Make address_space_translate{, _cached}() take a MemTxAttrs argument | ||
61 | Make address_space_map() take a MemTxAttrs argument | ||
62 | Make address_space_access_valid() take a MemTxAttrs argument | ||
63 | Make flatview_extend_translation() take a MemTxAttrs argument | ||
64 | Make memory_region_access_valid() take a MemTxAttrs argument | ||
65 | Make MemoryRegion valid.accepts callback take a MemTxAttrs argument | ||
66 | Make flatview_access_valid() take a MemTxAttrs argument | ||
67 | Make flatview_translate() take a MemTxAttrs argument | ||
68 | Make address_space_get_iotlb_entry() take a MemTxAttrs argument | ||
69 | Make flatview_do_translate() take a MemTxAttrs argument | ||
70 | Make address_space_translate_iommu take a MemTxAttrs argument | ||
71 | vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY | ||
72 | 50 | ||
73 | Richard Henderson (1): | 51 | Philippe Mathieu-Daudé (6): |
74 | tcg: Fix helper function vs host abi for float16 | 52 | hw/arm/smmu-common: Simplify smmu_find_smmu_pcibus() logic |
53 | hw/arm/gumstix: Simplify since the machines are little-endian only | ||
54 | hw/arm/mainstone: Simplify since the machines are little-endian only | ||
55 | hw/arm/omap_sx1: Simplify since the machines are little-endian only | ||
56 | hw/arm/z2: Simplify since the machines are little-endian only | ||
57 | hw/arm/musicpal: Simplify since the machines are little-endian only | ||
75 | 58 | ||
76 | Shannon Zhao (3): | 59 | Richard Henderson (19): |
77 | arm_gicv3_kvm: increase clroffset accordingly | 60 | target/arm: Improve masking of HCR/HCR2 RES0 bits |
78 | ARM: ACPI: Fix use-after-free due to memory realloc | 61 | target/arm: Add HCR_EL2 bit definitions from ARMv8.6 |
79 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | 62 | target/arm: Disable has_el2 and has_el3 for user-only |
63 | target/arm: Remove EL2 and EL3 setup from user-only | ||
64 | target/arm: Improve masking in arm_hcr_el2_eff | ||
65 | target/arm: Honor the HCR_EL2.{TVM,TRVM} bits | ||
66 | target/arm: Honor the HCR_EL2.TSW bit | ||
67 | target/arm: Honor the HCR_EL2.TACR bit | ||
68 | target/arm: Honor the HCR_EL2.TPCP bit | ||
69 | target/arm: Honor the HCR_EL2.TPU bit | ||
70 | target/arm: Honor the HCR_EL2.TTLB bit | ||
71 | tests/tcg/aarch64: Add newline in pauth-1 printf | ||
72 | target/arm: Replicate TBI/TBID bits for single range regimes | ||
73 | target/arm: Optimize cpu_mmu_index | ||
74 | target/arm: Introduce core_to_aa64_mmu_idx | ||
75 | target/arm: Apply TBI to ESR_ELx in helper_exception_return | ||
76 | target/arm: Move helper_dc_zva to helper-a64.c | ||
77 | target/arm: Use DEF_HELPER_FLAGS for helper_dc_zva | ||
78 | target/arm: Clean address for DC ZVA | ||
80 | 79 | ||
81 | include/exec/exec-all.h | 5 +- | 80 | include/hw/arm/xlnx-versal.h | 6 + |
82 | include/exec/helper-head.h | 2 +- | 81 | target/arm/cpu.h | 30 ++-- |
83 | include/exec/memory-internal.h | 3 +- | 82 | target/arm/helper-a64.h | 1 + |
84 | include/exec/memory.h | 128 +++++++++++++++++++++++++++++++++++------ | 83 | target/arm/helper.h | 1 - |
85 | include/migration/vmstate.h | 3 + | 84 | target/arm/internals.h | 6 + |
86 | include/sysemu/dma.h | 6 +- | 85 | hw/arm/cubieboard.c | 29 +++- |
87 | accel/tcg/translate-all.c | 4 +- | 86 | hw/arm/gumstix.c | 16 +- |
88 | exec.c | 95 ++++++++++++++++++------------ | 87 | hw/arm/mainstone.c | 8 +- |
89 | hw/arm/boot.c | 18 +++--- | 88 | hw/arm/musicpal.c | 10 -- |
90 | hw/arm/virt-acpi-build.c | 20 +++++-- | 89 | hw/arm/omap_sx1.c | 11 +- |
91 | hw/dma/xlnx-zdma.c | 10 +++- | 90 | hw/arm/pxa2xx.c | 17 +- |
92 | hw/hppa/dino.c | 3 +- | 91 | hw/arm/smmu-common.c | 20 +-- |
93 | hw/intc/arm_gic_kvm.c | 1 - | 92 | hw/arm/spitz.c | 8 +- |
94 | hw/intc/arm_gicv3_cpuif.c | 12 ++-- | 93 | hw/arm/strongarm.c | 18 ++- |
95 | hw/intc/arm_gicv3_kvm.c | 2 +- | 94 | hw/arm/xlnx-versal-virt.c | 28 ++++ |
96 | hw/nvram/fw_cfg.c | 12 ++-- | 95 | hw/arm/xlnx-versal.c | 24 +++ |
97 | hw/s390x/s390-pci-inst.c | 3 +- | 96 | hw/arm/z2.c | 8 +- |
98 | hw/scsi/esp.c | 3 +- | 97 | hw/timer/cadence_ttc.c | 18 ++- |
99 | hw/vfio/common.c | 3 +- | 98 | target/arm/cpu.c | 13 +- |
100 | hw/virtio/vhost.c | 3 +- | 99 | target/arm/cpu64.c | 2 + |
101 | hw/xen/xen_pt_msi.c | 3 +- | 100 | target/arm/helper-a64.c | 114 ++++++++++++- |
102 | memory.c | 12 ++-- | 101 | target/arm/helper.c | 373 ++++++++++++++++++++++++++++++------------- |
103 | memory_ldst.inc.c | 18 +++--- | 102 | target/arm/op_helper.c | 93 ----------- |
104 | target/arm/gdbstub.c | 3 +- | 103 | target/arm/translate-a64.c | 4 +- |
105 | target/arm/helper-a64.c | 41 +++++++------ | 104 | tests/tcg/aarch64/pauth-1.c | 2 +- |
106 | target/arm/helper.c | 90 ++++++++++++++++------------- | 105 | 25 files changed, 551 insertions(+), 309 deletions(-) |
107 | target/ppc/mmu-hash64.c | 3 +- | ||
108 | target/riscv/helper.c | 2 +- | ||
109 | target/s390x/diag.c | 6 +- | ||
110 | target/s390x/excp_helper.c | 3 +- | ||
111 | target/s390x/mmu_helper.c | 3 +- | ||
112 | target/s390x/sigp.c | 3 +- | ||
113 | target/xtensa/op_helper.c | 3 +- | ||
114 | MAINTAINERS | 9 ++- | ||
115 | 34 files changed, 353 insertions(+), 182 deletions(-) | ||
116 | 106 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
3 | Add support for the Versal LPD ADMAs. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
7 | Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/xlnx-versal.h | 6 ++++++ | ||
12 | hw/arm/xlnx-versal.c | 24 ++++++++++++++++++++++++ | ||
13 | 2 files changed, 30 insertions(+) | ||
14 | |||
15 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/xlnx-versal.h | ||
18 | +++ b/include/hw/arm/xlnx-versal.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #define XLNX_VERSAL_NR_ACPUS 2 | ||
21 | #define XLNX_VERSAL_NR_UARTS 2 | ||
22 | #define XLNX_VERSAL_NR_GEMS 2 | ||
23 | +#define XLNX_VERSAL_NR_ADMAS 8 | ||
24 | #define XLNX_VERSAL_NR_IRQS 192 | ||
25 | |||
26 | typedef struct Versal { | ||
27 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
28 | struct { | ||
29 | SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | ||
30 | SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | ||
31 | + SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
32 | } iou; | ||
33 | } lpd; | ||
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
36 | #define VERSAL_GEM0_WAKE_IRQ_0 57 | ||
37 | #define VERSAL_GEM1_IRQ_0 58 | ||
38 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
39 | +#define VERSAL_ADMA_IRQ_0 60 | ||
40 | |||
41 | /* Architecturally reserved IRQs suitable for virtualization. */ | ||
42 | #define VERSAL_RSVD_IRQ_FIRST 111 | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
44 | #define MM_GEM1 0xff0d0000U | ||
45 | #define MM_GEM1_SIZE 0x10000 | ||
46 | |||
47 | +#define MM_ADMA_CH0 0xffa80000U | ||
48 | +#define MM_ADMA_CH0_SIZE 0x10000 | ||
49 | + | ||
50 | #define MM_OCM 0xfffc0000U | ||
51 | #define MM_OCM_SIZE 0x40000 | ||
52 | |||
53 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/arm/xlnx-versal.c | ||
56 | +++ b/hw/arm/xlnx-versal.c | ||
57 | @@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic) | ||
58 | } | ||
59 | } | ||
60 | |||
61 | +static void versal_create_admas(Versal *s, qemu_irq *pic) | ||
62 | +{ | ||
63 | + int i; | ||
64 | + | ||
65 | + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.adma); i++) { | ||
66 | + char *name = g_strdup_printf("adma%d", i); | ||
67 | + DeviceState *dev; | ||
68 | + MemoryRegion *mr; | ||
69 | + | ||
70 | + dev = qdev_create(NULL, "xlnx.zdma"); | ||
71 | + s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev); | ||
72 | + object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
73 | + qdev_init_nofail(dev); | ||
74 | + | ||
75 | + mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0); | ||
76 | + memory_region_add_subregion(&s->mr_ps, | ||
77 | + MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr); | ||
78 | + | ||
79 | + sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
80 | + g_free(name); | ||
81 | + } | ||
82 | +} | ||
83 | + | ||
84 | /* This takes the board allocated linear DDR memory and creates aliases | ||
85 | * for each split DDR range/aperture on the Versal address map. | ||
86 | */ | ||
87 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
88 | versal_create_apu_gic(s, pic); | ||
89 | versal_create_uarts(s, pic); | ||
90 | versal_create_gems(s, pic); | ||
91 | + versal_create_admas(s, pic); | ||
92 | versal_map_ddr(s); | ||
93 | versal_unimp(s); | ||
94 | |||
95 | -- | ||
96 | 2.20.1 | ||
97 | |||
98 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
3 | Generate xlnx-versal-virt zdma FDT nodes. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
7 | Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/xlnx-versal-virt.c | 28 ++++++++++++++++++++++++++++ | ||
12 | 1 file changed, 28 insertions(+) | ||
13 | |||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/xlnx-versal-virt.c | ||
17 | +++ b/hw/arm/xlnx-versal-virt.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_gem_nodes(VersalVirt *s) | ||
19 | } | ||
20 | } | ||
21 | |||
22 | +static void fdt_add_zdma_nodes(VersalVirt *s) | ||
23 | +{ | ||
24 | + const char clocknames[] = "clk_main\0clk_apb"; | ||
25 | + const char compat[] = "xlnx,zynqmp-dma-1.0"; | ||
26 | + int i; | ||
27 | + | ||
28 | + for (i = XLNX_VERSAL_NR_ADMAS - 1; i >= 0; i--) { | ||
29 | + uint64_t addr = MM_ADMA_CH0 + MM_ADMA_CH0_SIZE * i; | ||
30 | + char *name = g_strdup_printf("/dma@%" PRIx64, addr); | ||
31 | + | ||
32 | + qemu_fdt_add_subnode(s->fdt, name); | ||
33 | + | ||
34 | + qemu_fdt_setprop_cell(s->fdt, name, "xlnx,bus-width", 64); | ||
35 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | ||
36 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | ||
37 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | ||
38 | + clocknames, sizeof(clocknames)); | ||
39 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
40 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_ADMA_IRQ_0 + i, | ||
41 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
42 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
43 | + 2, addr, 2, 0x1000); | ||
44 | + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); | ||
45 | + g_free(name); | ||
46 | + } | ||
47 | +} | ||
48 | + | ||
49 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | ||
50 | { | ||
51 | Error *err = NULL; | ||
52 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
53 | fdt_add_uart_nodes(s); | ||
54 | fdt_add_gic_nodes(s); | ||
55 | fdt_add_timer_nodes(s); | ||
56 | + fdt_add_zdma_nodes(s); | ||
57 | fdt_add_cpu_nodes(s, psci_conduit); | ||
58 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | ||
59 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | ||
60 | -- | ||
61 | 2.20.1 | ||
62 | |||
63 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | The ARMv8.2-TTCNP extension allows an implementation to optimize by |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_do_translate(). | 2 | sharing TLB entries between multiple cores, provided that software |
3 | declares that it's ready to deal with this by setting a CnP bit in | ||
4 | the TTBRn_ELx. It is mandatory from ARMv8.2 onward. | ||
5 | |||
6 | For QEMU's TLB implementation, sharing TLB entries between different | ||
7 | cores would not really benefit us and would be a lot of work to | ||
8 | implement. So we implement this extension in the "trivial" manner: | ||
9 | we allow the guest to set and read back the CnP bit, but don't change | ||
10 | our behaviour (this is an architecturally valid implementation | ||
11 | choice). | ||
12 | |||
13 | The only code path which looks at the TTBRn_ELx values for the | ||
14 | long-descriptor format where the CnP bit is defined is already doing | ||
15 | enough masking to not get confused when the CnP bit at the bottom of | ||
16 | the register is set, so we can simply add a comment noting why we're | ||
17 | relying on that mask. | ||
3 | 18 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180521140402.23318-13-peter.maydell@linaro.org | 21 | Message-id: 20200225193822.18874-1-peter.maydell@linaro.org |
8 | --- | 22 | --- |
9 | exec.c | 9 ++++++--- | 23 | target/arm/cpu.c | 1 + |
10 | 1 file changed, 6 insertions(+), 3 deletions(-) | 24 | target/arm/cpu64.c | 2 ++ |
25 | target/arm/helper.c | 4 ++++ | ||
26 | 3 files changed, 7 insertions(+) | ||
11 | 27 | ||
12 | diff --git a/exec.c b/exec.c | 28 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
13 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 30 | --- a/target/arm/cpu.c |
15 | +++ b/exec.c | 31 | +++ b/target/arm/cpu.c |
16 | @@ -XXX,XX +XXX,XX @@ unassigned: | 32 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) |
17 | * @is_write: whether the translation operation is for write | 33 | t = cpu->isar.id_mmfr4; |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 34 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ |
19 | * @target_as: the address space targeted by the IOMMU | 35 | t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ |
20 | + * @attrs: memory transaction attributes | 36 | + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ |
21 | * | 37 | cpu->isar.id_mmfr4 = t; |
22 | * This function is called from RCU critical section | 38 | } |
23 | */ | 39 | #endif |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 40 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
25 | hwaddr *page_mask_out, | 41 | index XXXXXXX..XXXXXXX 100644 |
26 | bool is_write, | 42 | --- a/target/arm/cpu64.c |
27 | bool is_mmio, | 43 | +++ b/target/arm/cpu64.c |
28 | - AddressSpace **target_as) | 44 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
29 | + AddressSpace **target_as, | 45 | |
30 | + MemTxAttrs attrs) | 46 | t = cpu->isar.id_aa64mmfr2; |
31 | { | 47 | t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); |
32 | MemoryRegionSection *section; | 48 | + t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ |
33 | IOMMUMemoryRegion *iommu_mr; | 49 | cpu->isar.id_aa64mmfr2 = t; |
34 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 50 | |
35 | * but page mask. | 51 | /* Replicate the same data to the 32-bit id registers. */ |
36 | */ | 52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
37 | section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat, | 53 | u = cpu->isar.id_mmfr4; |
38 | - NULL, &page_mask, is_write, false, &as); | 54 | u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ |
39 | + NULL, &page_mask, is_write, false, &as, | 55 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ |
40 | + attrs); | 56 | + u = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ |
41 | 57 | cpu->isar.id_mmfr4 = u; | |
42 | /* Illegal translation */ | 58 | |
43 | if (section.mr == &io_mem_unassigned) { | 59 | u = cpu->isar.id_aa64dfr0; |
44 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 60 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
45 | 61 | index XXXXXXX..XXXXXXX 100644 | |
46 | /* This can be MMIO, so setup MMIO bit. */ | 62 | --- a/target/arm/helper.c |
47 | section = flatview_do_translate(fv, addr, xlat, plen, NULL, | 63 | +++ b/target/arm/helper.c |
48 | - is_write, true, &as); | 64 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, |
49 | + is_write, true, &as, attrs); | 65 | |
50 | mr = section.mr; | 66 | /* Now we can extract the actual base address from the TTBR */ |
51 | 67 | descaddr = extract64(ttbr, 0, 48); | |
52 | if (xen_enabled() && memory_access_is_direct(mr, is_write)) { | 68 | + /* |
69 | + * We rely on this masking to clear the RES0 bits at the bottom of the TTBR | ||
70 | + * and also to mask out CnP (bit 0) which could validly be non-zero. | ||
71 | + */ | ||
72 | descaddr &= ~indexmask; | ||
73 | |||
74 | /* The address field in the descriptor goes up to bit 39 for ARMv7 | ||
53 | -- | 75 | -- |
54 | 2.17.1 | 76 | 2.20.1 |
55 | 77 | ||
56 | 78 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Eric Auger <eric.auger@redhat.com> | ||
1 | 2 | ||
3 | Make sure a null SMMUPciBus is returned in case we were | ||
4 | not able to identify a pci bus matching the @bus_num. | ||
5 | |||
6 | This matches the fix done on intel iommu in commit: | ||
7 | a2e1cd41ccfe796529abfd1b6aeb1dd4393762a2 | ||
8 | |||
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Reviewed-by: Peter Xu <peterx@redhat.com> | ||
11 | Message-Id: <20200226172628.17449-1-eric.auger@redhat.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/arm/smmu-common.c | 1 + | ||
17 | 1 file changed, 1 insertion(+) | ||
18 | |||
19 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/smmu-common.c | ||
22 | +++ b/hw/arm/smmu-common.c | ||
23 | @@ -XXX,XX +XXX,XX @@ SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num) | ||
24 | return smmu_pci_bus; | ||
25 | } | ||
26 | } | ||
27 | + smmu_pci_bus = NULL; | ||
28 | } | ||
29 | return smmu_pci_bus; | ||
30 | } | ||
31 | -- | ||
32 | 2.20.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | The smmu_find_smmu_pcibus() function was introduced (in commit | ||
4 | cac994ef43b) in a code format that could return an incorrect | ||
5 | pointer, which was then fixed by the previous commit. | ||
6 | We could have avoided this by writing the if() statement | ||
7 | differently. Do it now, in case this function is re-used. | ||
8 | The code is easier to review (harder to miss bugs). | ||
9 | |||
10 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Reviewed-by: Peter Xu <peterx@redhat.com> | ||
12 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/arm/smmu-common.c | 25 +++++++++++++------------ | ||
16 | 1 file changed, 13 insertions(+), 12 deletions(-) | ||
17 | |||
18 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/arm/smmu-common.c | ||
21 | +++ b/hw/arm/smmu-common.c | ||
22 | @@ -XXX,XX +XXX,XX @@ inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm, | ||
23 | SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num) | ||
24 | { | ||
25 | SMMUPciBus *smmu_pci_bus = s->smmu_pcibus_by_bus_num[bus_num]; | ||
26 | + GHashTableIter iter; | ||
27 | |||
28 | - if (!smmu_pci_bus) { | ||
29 | - GHashTableIter iter; | ||
30 | - | ||
31 | - g_hash_table_iter_init(&iter, s->smmu_pcibus_by_busptr); | ||
32 | - while (g_hash_table_iter_next(&iter, NULL, (void **)&smmu_pci_bus)) { | ||
33 | - if (pci_bus_num(smmu_pci_bus->bus) == bus_num) { | ||
34 | - s->smmu_pcibus_by_bus_num[bus_num] = smmu_pci_bus; | ||
35 | - return smmu_pci_bus; | ||
36 | - } | ||
37 | - } | ||
38 | - smmu_pci_bus = NULL; | ||
39 | + if (smmu_pci_bus) { | ||
40 | + return smmu_pci_bus; | ||
41 | } | ||
42 | - return smmu_pci_bus; | ||
43 | + | ||
44 | + g_hash_table_iter_init(&iter, s->smmu_pcibus_by_busptr); | ||
45 | + while (g_hash_table_iter_next(&iter, NULL, (void **)&smmu_pci_bus)) { | ||
46 | + if (pci_bus_num(smmu_pci_bus->bus) == bus_num) { | ||
47 | + s->smmu_pcibus_by_bus_num[bus_num] = smmu_pci_bus; | ||
48 | + return smmu_pci_bus; | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + return NULL; | ||
53 | } | ||
54 | |||
55 | static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn) | ||
56 | -- | ||
57 | 2.20.1 | ||
58 | |||
59 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_map(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | As the Connex and Verdex machines only boot in little-endian, | ||
4 | we can simplify the code. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-5-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | include/exec/memory.h | 3 ++- | 11 | hw/arm/gumstix.c | 16 ++-------------- |
12 | include/sysemu/dma.h | 3 ++- | 12 | 1 file changed, 2 insertions(+), 14 deletions(-) |
13 | exec.c | 6 ++++-- | ||
14 | target/ppc/mmu-hash64.c | 3 ++- | ||
15 | 4 files changed, 10 insertions(+), 5 deletions(-) | ||
16 | 13 | ||
17 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 14 | diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/memory.h | 16 | --- a/hw/arm/gumstix.c |
20 | +++ b/include/exec/memory.h | 17 | +++ b/hw/arm/gumstix.c |
21 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_ | 18 | @@ -XXX,XX +XXX,XX @@ static void connex_init(MachineState *machine) |
22 | * @addr: address within that address space | ||
23 | * @plen: pointer to length of buffer; updated on return | ||
24 | * @is_write: indicates the transfer direction | ||
25 | + * @attrs: memory attributes | ||
26 | */ | ||
27 | void *address_space_map(AddressSpace *as, hwaddr addr, | ||
28 | - hwaddr *plen, bool is_write); | ||
29 | + hwaddr *plen, bool is_write, MemTxAttrs attrs); | ||
30 | |||
31 | /* address_space_unmap: Unmaps a memory region previously mapped by address_space_map() | ||
32 | * | ||
33 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/include/sysemu/dma.h | ||
36 | +++ b/include/sysemu/dma.h | ||
37 | @@ -XXX,XX +XXX,XX @@ static inline void *dma_memory_map(AddressSpace *as, | ||
38 | hwaddr xlen = *len; | ||
39 | void *p; | ||
40 | |||
41 | - p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); | ||
42 | + p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE, | ||
43 | + MEMTXATTRS_UNSPECIFIED); | ||
44 | *len = xlen; | ||
45 | return p; | ||
46 | } | ||
47 | diff --git a/exec.c b/exec.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/exec.c | ||
50 | +++ b/exec.c | ||
51 | @@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr, | ||
52 | void *address_space_map(AddressSpace *as, | ||
53 | hwaddr addr, | ||
54 | hwaddr *plen, | ||
55 | - bool is_write) | ||
56 | + bool is_write, | ||
57 | + MemTxAttrs attrs) | ||
58 | { | 19 | { |
59 | hwaddr len = *plen; | 20 | PXA2xxState *cpu; |
60 | hwaddr l, xlat; | 21 | DriveInfo *dinfo; |
61 | @@ -XXX,XX +XXX,XX @@ void *cpu_physical_memory_map(hwaddr addr, | 22 | - int be; |
62 | hwaddr *plen, | 23 | MemoryRegion *address_space_mem = get_system_memory(); |
63 | int is_write) | 24 | |
25 | uint32_t connex_rom = 0x01000000; | ||
26 | @@ -XXX,XX +XXX,XX @@ static void connex_init(MachineState *machine) | ||
27 | exit(1); | ||
28 | } | ||
29 | |||
30 | -#ifdef TARGET_WORDS_BIGENDIAN | ||
31 | - be = 1; | ||
32 | -#else | ||
33 | - be = 0; | ||
34 | -#endif | ||
35 | if (!pflash_cfi01_register(0x00000000, "connext.rom", connex_rom, | ||
36 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, | ||
37 | - sector_len, 2, 0, 0, 0, 0, be)) { | ||
38 | + sector_len, 2, 0, 0, 0, 0, 0)) { | ||
39 | error_report("Error registering flash memory"); | ||
40 | exit(1); | ||
41 | } | ||
42 | @@ -XXX,XX +XXX,XX @@ static void verdex_init(MachineState *machine) | ||
64 | { | 43 | { |
65 | - return address_space_map(&address_space_memory, addr, plen, is_write); | 44 | PXA2xxState *cpu; |
66 | + return address_space_map(&address_space_memory, addr, plen, is_write, | 45 | DriveInfo *dinfo; |
67 | + MEMTXATTRS_UNSPECIFIED); | 46 | - int be; |
68 | } | 47 | MemoryRegion *address_space_mem = get_system_memory(); |
69 | 48 | ||
70 | void cpu_physical_memory_unmap(void *buffer, hwaddr len, | 49 | uint32_t verdex_rom = 0x02000000; |
71 | diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c | 50 | @@ -XXX,XX +XXX,XX @@ static void verdex_init(MachineState *machine) |
72 | index XXXXXXX..XXXXXXX 100644 | 51 | exit(1); |
73 | --- a/target/ppc/mmu-hash64.c | ||
74 | +++ b/target/ppc/mmu-hash64.c | ||
75 | @@ -XXX,XX +XXX,XX @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu, | ||
76 | return NULL; | ||
77 | } | 52 | } |
78 | 53 | ||
79 | - hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false); | 54 | -#ifdef TARGET_WORDS_BIGENDIAN |
80 | + hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false, | 55 | - be = 1; |
81 | + MEMTXATTRS_UNSPECIFIED); | 56 | -#else |
82 | if (plen < (n * HASH_PTE_SIZE_64)) { | 57 | - be = 0; |
83 | hw_error("%s: Unable to map all requested HPTEs\n", __func__); | 58 | -#endif |
59 | if (!pflash_cfi01_register(0x00000000, "verdex.rom", verdex_rom, | ||
60 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, | ||
61 | - sector_len, 2, 0, 0, 0, 0, be)) { | ||
62 | + sector_len, 2, 0, 0, 0, 0, 0)) { | ||
63 | error_report("Error registering flash memory"); | ||
64 | exit(1); | ||
84 | } | 65 | } |
85 | -- | 66 | -- |
86 | 2.17.1 | 67 | 2.20.1 |
87 | 68 | ||
88 | 69 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | We only build the little-endian softmmu configurations. Checking | ||
4 | for big endian is pointless, remove the unused code. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/mainstone.c | 8 +------- | ||
11 | 1 file changed, 1 insertion(+), 7 deletions(-) | ||
12 | |||
13 | diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/mainstone.c | ||
16 | +++ b/hw/arm/mainstone.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void mainstone_common_init(MemoryRegion *address_space_mem, | ||
18 | DeviceState *mst_irq; | ||
19 | DriveInfo *dinfo; | ||
20 | int i; | ||
21 | - int be; | ||
22 | MemoryRegion *rom = g_new(MemoryRegion, 1); | ||
23 | |||
24 | /* Setup CPU & memory */ | ||
25 | @@ -XXX,XX +XXX,XX @@ static void mainstone_common_init(MemoryRegion *address_space_mem, | ||
26 | memory_region_set_readonly(rom, true); | ||
27 | memory_region_add_subregion(address_space_mem, 0, rom); | ||
28 | |||
29 | -#ifdef TARGET_WORDS_BIGENDIAN | ||
30 | - be = 1; | ||
31 | -#else | ||
32 | - be = 0; | ||
33 | -#endif | ||
34 | /* There are two 32MiB flash devices on the board */ | ||
35 | for (i = 0; i < 2; i ++) { | ||
36 | dinfo = drive_get(IF_PFLASH, 0, i); | ||
37 | @@ -XXX,XX +XXX,XX @@ static void mainstone_common_init(MemoryRegion *address_space_mem, | ||
38 | i ? "mainstone.flash1" : "mainstone.flash0", | ||
39 | MAINSTONE_FLASH, | ||
40 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, | ||
41 | - sector_len, 4, 0, 0, 0, 0, be)) { | ||
42 | + sector_len, 4, 0, 0, 0, 0, 0)) { | ||
43 | error_report("Error registering flash memory"); | ||
44 | exit(1); | ||
45 | } | ||
46 | -- | ||
47 | 2.20.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | We only build the little-endian softmmu configurations. Checking | ||
4 | for big endian is pointless, remove the unused code. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/omap_sx1.c | 11 ++--------- | ||
11 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
12 | |||
13 | diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/omap_sx1.c | ||
16 | +++ b/hw/arm/omap_sx1.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version) | ||
18 | DriveInfo *dinfo; | ||
19 | int fl_idx; | ||
20 | uint32_t flash_size = flash0_size; | ||
21 | - int be; | ||
22 | |||
23 | if (machine->ram_size != mc->default_ram_size) { | ||
24 | char *sz = size_to_str(mc->default_ram_size); | ||
25 | @@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version) | ||
26 | OMAP_CS2_BASE, &cs[3]); | ||
27 | |||
28 | fl_idx = 0; | ||
29 | -#ifdef TARGET_WORDS_BIGENDIAN | ||
30 | - be = 1; | ||
31 | -#else | ||
32 | - be = 0; | ||
33 | -#endif | ||
34 | - | ||
35 | if ((dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) { | ||
36 | if (!pflash_cfi01_register(OMAP_CS0_BASE, | ||
37 | "omap_sx1.flash0-1", flash_size, | ||
38 | blk_by_legacy_dinfo(dinfo), | ||
39 | - sector_size, 4, 0, 0, 0, 0, be)) { | ||
40 | + sector_size, 4, 0, 0, 0, 0, 0)) { | ||
41 | fprintf(stderr, "qemu: Error registering flash memory %d.\n", | ||
42 | fl_idx); | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version) | ||
45 | if (!pflash_cfi01_register(OMAP_CS1_BASE, | ||
46 | "omap_sx1.flash1-1", flash1_size, | ||
47 | blk_by_legacy_dinfo(dinfo), | ||
48 | - sector_size, 4, 0, 0, 0, 0, be)) { | ||
49 | + sector_size, 4, 0, 0, 0, 0, 0)) { | ||
50 | fprintf(stderr, "qemu: Error registering flash memory %d.\n", | ||
51 | fl_idx); | ||
52 | } | ||
53 | -- | ||
54 | 2.20.1 | ||
55 | |||
56 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to memory_region_access_valid(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
6 | The callsite in flatview_access_valid() is part of a recursive | 3 | We only build the little-endian softmmu configurations. Checking |
7 | loop flatview_access_valid() -> memory_region_access_valid() -> | 4 | for big endian is pointless, remove the unused code. |
8 | subpage_accepts() -> flatview_access_valid(); we make it pass | ||
9 | MEMTXATTRS_UNSPECIFIED for now, until the next several commits | ||
10 | have plumbed an attrs parameter through the rest of the loop | ||
11 | and we can add an attrs parameter to flatview_access_valid(). | ||
12 | 5 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20180521140402.23318-8-peter.maydell@linaro.org | ||
17 | --- | 9 | --- |
18 | include/exec/memory-internal.h | 3 ++- | 10 | hw/arm/z2.c | 8 +------- |
19 | exec.c | 4 +++- | 11 | 1 file changed, 1 insertion(+), 7 deletions(-) |
20 | hw/s390x/s390-pci-inst.c | 3 ++- | ||
21 | memory.c | 7 ++++--- | ||
22 | 4 files changed, 11 insertions(+), 6 deletions(-) | ||
23 | 12 | ||
24 | diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h | 13 | diff --git a/hw/arm/z2.c b/hw/arm/z2.c |
25 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/exec/memory-internal.h | 15 | --- a/hw/arm/z2.c |
27 | +++ b/include/exec/memory-internal.h | 16 | +++ b/hw/arm/z2.c |
28 | @@ -XXX,XX +XXX,XX @@ void flatview_unref(FlatView *view); | 17 | @@ -XXX,XX +XXX,XX @@ static void z2_init(MachineState *machine) |
29 | extern const MemoryRegionOps unassigned_mem_ops; | 18 | uint32_t sector_len = 0x10000; |
30 | 19 | PXA2xxState *mpu; | |
31 | bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr, | 20 | DriveInfo *dinfo; |
32 | - unsigned size, bool is_write); | 21 | - int be; |
33 | + unsigned size, bool is_write, | 22 | void *z2_lcd; |
34 | + MemTxAttrs attrs); | 23 | I2CBus *bus; |
35 | 24 | DeviceState *wm; | |
36 | void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section); | 25 | @@ -XXX,XX +XXX,XX @@ static void z2_init(MachineState *machine) |
37 | AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); | 26 | /* Setup CPU & memory */ |
38 | diff --git a/exec.c b/exec.c | 27 | mpu = pxa270_init(address_space_mem, z2_binfo.ram_size, machine->cpu_type); |
39 | index XXXXXXX..XXXXXXX 100644 | 28 | |
40 | --- a/exec.c | 29 | -#ifdef TARGET_WORDS_BIGENDIAN |
41 | +++ b/exec.c | 30 | - be = 1; |
42 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 31 | -#else |
43 | mr = flatview_translate(fv, addr, &xlat, &l, is_write); | 32 | - be = 0; |
44 | if (!memory_access_is_direct(mr, is_write)) { | 33 | -#endif |
45 | l = memory_access_size(mr, l, addr); | 34 | dinfo = drive_get(IF_PFLASH, 0, 0); |
46 | - if (!memory_region_access_valid(mr, xlat, l, is_write)) { | 35 | if (!pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE, |
47 | + /* When our callers all have attrs we'll pass them through here */ | 36 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, |
48 | + if (!memory_region_access_valid(mr, xlat, l, is_write, | 37 | - sector_len, 4, 0, 0, 0, 0, be)) { |
49 | + MEMTXATTRS_UNSPECIFIED)) { | 38 | + sector_len, 4, 0, 0, 0, 0, 0)) { |
50 | return false; | 39 | error_report("Error registering flash memory"); |
51 | } | 40 | exit(1); |
52 | } | ||
53 | diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/s390x/s390-pci-inst.c | ||
56 | +++ b/hw/s390x/s390-pci-inst.c | ||
57 | @@ -XXX,XX +XXX,XX @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, | ||
58 | mr = s390_get_subregion(mr, offset, len); | ||
59 | offset -= mr->addr; | ||
60 | |||
61 | - if (!memory_region_access_valid(mr, offset, len, true)) { | ||
62 | + if (!memory_region_access_valid(mr, offset, len, true, | ||
63 | + MEMTXATTRS_UNSPECIFIED)) { | ||
64 | s390_program_interrupt(env, PGM_OPERAND, 6, ra); | ||
65 | return 0; | ||
66 | } | ||
67 | diff --git a/memory.c b/memory.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/memory.c | ||
70 | +++ b/memory.c | ||
71 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ram_device_mem_ops = { | ||
72 | bool memory_region_access_valid(MemoryRegion *mr, | ||
73 | hwaddr addr, | ||
74 | unsigned size, | ||
75 | - bool is_write) | ||
76 | + bool is_write, | ||
77 | + MemTxAttrs attrs) | ||
78 | { | ||
79 | int access_size_min, access_size_max; | ||
80 | int access_size, i; | ||
81 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr, | ||
82 | { | ||
83 | MemTxResult r; | ||
84 | |||
85 | - if (!memory_region_access_valid(mr, addr, size, false)) { | ||
86 | + if (!memory_region_access_valid(mr, addr, size, false, attrs)) { | ||
87 | *pval = unassigned_mem_read(mr, addr, size); | ||
88 | return MEMTX_DECODE_ERROR; | ||
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr, | ||
91 | unsigned size, | ||
92 | MemTxAttrs attrs) | ||
93 | { | ||
94 | - if (!memory_region_access_valid(mr, addr, size, true)) { | ||
95 | + if (!memory_region_access_valid(mr, addr, size, true, attrs)) { | ||
96 | unassigned_mem_write(mr, addr, data, size); | ||
97 | return MEMTX_DECODE_ERROR; | ||
98 | } | 41 | } |
99 | -- | 42 | -- |
100 | 2.17.1 | 43 | 2.20.1 |
101 | 44 | ||
102 | 45 | diff view generated by jsdifflib |
1 | Provide a VMSTATE_BOOL_SUB_ARRAY to go with VMSTATE_UINT8_SUB_ARRAY | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | and friends. | ||
3 | 2 | ||
3 | We only build the little-endian softmmu configurations. Checking | ||
4 | for big endian is pointless, remove the unused code. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Message-id: 20180521140402.23318-23-peter.maydell@linaro.org | ||
7 | --- | 9 | --- |
8 | include/migration/vmstate.h | 3 +++ | 10 | hw/arm/musicpal.c | 10 ---------- |
9 | 1 file changed, 3 insertions(+) | 11 | 1 file changed, 10 deletions(-) |
10 | 12 | ||
11 | diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h | 13 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
12 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/migration/vmstate.h | 15 | --- a/hw/arm/musicpal.c |
14 | +++ b/include/migration/vmstate.h | 16 | +++ b/hw/arm/musicpal.c |
15 | @@ -XXX,XX +XXX,XX @@ extern const VMStateInfo vmstate_info_qtailq; | 17 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) |
16 | #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ | 18 | * 0xFF800000 (if there is 8 MB flash). So remap flash access if the |
17 | VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0) | 19 | * image is smaller than 32 MB. |
18 | 20 | */ | |
19 | +#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \ | 21 | -#ifdef TARGET_WORDS_BIGENDIAN |
20 | + VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool) | 22 | - pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, |
21 | + | 23 | - "musicpal.flash", flash_size, |
22 | #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \ | 24 | - blk, 0x10000, |
23 | VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t) | 25 | - MP_FLASH_SIZE_MAX / flash_size, |
26 | - 2, 0x00BF, 0x236D, 0x0000, 0x0000, | ||
27 | - 0x5555, 0x2AAA, 1); | ||
28 | -#else | ||
29 | pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, | ||
30 | "musicpal.flash", flash_size, | ||
31 | blk, 0x10000, | ||
32 | MP_FLASH_SIZE_MAX / flash_size, | ||
33 | 2, 0x00BF, 0x236D, 0x0000, 0x0000, | ||
34 | 0x5555, 0x2AAA, 0); | ||
35 | -#endif | ||
36 | - | ||
37 | } | ||
38 | sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL); | ||
24 | 39 | ||
25 | -- | 40 | -- |
26 | 2.17.1 | 41 | 2.20.1 |
27 | 42 | ||
28 | 43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Pan Nengyuan <pannengyuan@huawei.com> | ||
1 | 2 | ||
3 | There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. | ||
4 | |||
5 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
6 | Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> | ||
7 | Message-id: 20200227025055.14341-3-pannengyuan@huawei.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/pxa2xx.c | 17 +++++++++++------ | ||
12 | 1 file changed, 11 insertions(+), 6 deletions(-) | ||
13 | |||
14 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/pxa2xx.c | ||
17 | +++ b/hw/arm/pxa2xx.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_rtc_init(Object *obj) | ||
19 | s->last_rtcpicr = 0; | ||
20 | s->last_hz = s->last_sw = s->last_pi = qemu_clock_get_ms(rtc_clock); | ||
21 | |||
22 | + sysbus_init_irq(dev, &s->rtc_irq); | ||
23 | + | ||
24 | + memory_region_init_io(&s->iomem, obj, &pxa2xx_rtc_ops, s, | ||
25 | + "pxa2xx-rtc", 0x10000); | ||
26 | + sysbus_init_mmio(dev, &s->iomem); | ||
27 | +} | ||
28 | + | ||
29 | +static void pxa2xx_rtc_realize(DeviceState *dev, Error **errp) | ||
30 | +{ | ||
31 | + PXA2xxRTCState *s = PXA2XX_RTC(dev); | ||
32 | s->rtc_hz = timer_new_ms(rtc_clock, pxa2xx_rtc_hz_tick, s); | ||
33 | s->rtc_rdal1 = timer_new_ms(rtc_clock, pxa2xx_rtc_rdal1_tick, s); | ||
34 | s->rtc_rdal2 = timer_new_ms(rtc_clock, pxa2xx_rtc_rdal2_tick, s); | ||
35 | s->rtc_swal1 = timer_new_ms(rtc_clock, pxa2xx_rtc_swal1_tick, s); | ||
36 | s->rtc_swal2 = timer_new_ms(rtc_clock, pxa2xx_rtc_swal2_tick, s); | ||
37 | s->rtc_pi = timer_new_ms(rtc_clock, pxa2xx_rtc_pi_tick, s); | ||
38 | - | ||
39 | - sysbus_init_irq(dev, &s->rtc_irq); | ||
40 | - | ||
41 | - memory_region_init_io(&s->iomem, obj, &pxa2xx_rtc_ops, s, | ||
42 | - "pxa2xx-rtc", 0x10000); | ||
43 | - sysbus_init_mmio(dev, &s->iomem); | ||
44 | } | ||
45 | |||
46 | static int pxa2xx_rtc_pre_save(void *opaque) | ||
47 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_rtc_sysbus_class_init(ObjectClass *klass, void *data) | ||
48 | |||
49 | dc->desc = "PXA2xx RTC Controller"; | ||
50 | dc->vmsd = &vmstate_pxa2xx_rtc_regs; | ||
51 | + dc->realize = pxa2xx_rtc_realize; | ||
52 | } | ||
53 | |||
54 | static const TypeInfo pxa2xx_rtc_sysbus_info = { | ||
55 | -- | ||
56 | 2.20.1 | ||
57 | |||
58 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Pan Nengyuan <pannengyuan@huawei.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_access_valid(). | ||
3 | Its callers now all have an attrs value to hand, so we can | ||
4 | correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. | ||
4 | |||
5 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
6 | Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> | ||
7 | Message-id: 20200227025055.14341-4-pannengyuan@huawei.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-10-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | exec.c | 12 +++++------- | 11 | hw/arm/spitz.c | 8 +++++++- |
12 | 1 file changed, 5 insertions(+), 7 deletions(-) | 12 | 1 file changed, 7 insertions(+), 1 deletion(-) |
13 | 13 | ||
14 | diff --git a/exec.c b/exec.c | 14 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 16 | --- a/hw/arm/spitz.c |
17 | +++ b/exec.c | 17 | +++ b/hw/arm/spitz.c |
18 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | 18 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_init(Object *obj) |
19 | static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | 19 | |
20 | const uint8_t *buf, int len); | 20 | spitz_keyboard_pre_map(s); |
21 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 21 | |
22 | - bool is_write); | 22 | - s->kbdtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL, spitz_keyboard_tick, s); |
23 | + bool is_write, MemTxAttrs attrs); | 23 | qdev_init_gpio_in(dev, spitz_keyboard_strobe, SPITZ_KEY_STROBE_NUM); |
24 | 24 | qdev_init_gpio_out(dev, s->sense, SPITZ_KEY_SENSE_NUM); | |
25 | static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, | ||
26 | unsigned len, MemTxAttrs attrs) | ||
27 | @@ -XXX,XX +XXX,XX @@ static bool subpage_accepts(void *opaque, hwaddr addr, | ||
28 | #endif | ||
29 | |||
30 | return flatview_access_valid(subpage->fv, addr + subpage->base, | ||
31 | - len, is_write); | ||
32 | + len, is_write, attrs); | ||
33 | } | 25 | } |
34 | 26 | ||
35 | static const MemoryRegionOps subpage_ops = { | 27 | +static void spitz_keyboard_realize(DeviceState *dev, Error **errp) |
36 | @@ -XXX,XX +XXX,XX @@ static void cpu_notify_map_clients(void) | 28 | +{ |
29 | + SpitzKeyboardState *s = SPITZ_KEYBOARD(dev); | ||
30 | + s->kbdtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL, spitz_keyboard_tick, s); | ||
31 | +} | ||
32 | + | ||
33 | /* LCD backlight controller */ | ||
34 | |||
35 | #define LCDTG_RESCTL 0x00 | ||
36 | @@ -XXX,XX +XXX,XX @@ static void spitz_keyboard_class_init(ObjectClass *klass, void *data) | ||
37 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
38 | |||
39 | dc->vmsd = &vmstate_spitz_kbd; | ||
40 | + dc->realize = spitz_keyboard_realize; | ||
37 | } | 41 | } |
38 | 42 | ||
39 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 43 | static const TypeInfo spitz_keyboard_info = { |
40 | - bool is_write) | ||
41 | + bool is_write, MemTxAttrs attrs) | ||
42 | { | ||
43 | MemoryRegion *mr; | ||
44 | hwaddr l, xlat; | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | ||
46 | mr = flatview_translate(fv, addr, &xlat, &l, is_write); | ||
47 | if (!memory_access_is_direct(mr, is_write)) { | ||
48 | l = memory_access_size(mr, l, addr); | ||
49 | - /* When our callers all have attrs we'll pass them through here */ | ||
50 | - if (!memory_region_access_valid(mr, xlat, l, is_write, | ||
51 | - MEMTXATTRS_UNSPECIFIED)) { | ||
52 | + if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) { | ||
53 | return false; | ||
54 | } | ||
55 | } | ||
56 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | ||
57 | |||
58 | rcu_read_lock(); | ||
59 | fv = address_space_to_flatview(as); | ||
60 | - result = flatview_access_valid(fv, addr, len, is_write); | ||
61 | + result = flatview_access_valid(fv, addr, len, is_write, attrs); | ||
62 | rcu_read_unlock(); | ||
63 | return result; | ||
64 | } | ||
65 | -- | 44 | -- |
66 | 2.17.1 | 45 | 2.20.1 |
67 | 46 | ||
68 | 47 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Pan Nengyuan <pannengyuan@huawei.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to the MemoryRegion valid.accepts | ||
3 | callback. We'll need this for subpage_accepts(). | ||
4 | 2 | ||
5 | We could take the approach we used with the read and write | 3 | There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. |
6 | callbacks and add new a new _with_attrs version, but since there | ||
7 | are so few implementations of the accepts hook we just change | ||
8 | them all. | ||
9 | 4 | ||
5 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
6 | Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> | ||
7 | Message-id: 20200227025055.14341-5-pannengyuan@huawei.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20180521140402.23318-9-peter.maydell@linaro.org | ||
14 | --- | 10 | --- |
15 | include/exec/memory.h | 3 ++- | 11 | hw/arm/strongarm.c | 18 ++++++++++++------ |
16 | exec.c | 9 ++++++--- | 12 | 1 file changed, 12 insertions(+), 6 deletions(-) |
17 | hw/hppa/dino.c | 3 ++- | ||
18 | hw/nvram/fw_cfg.c | 12 ++++++++---- | ||
19 | hw/scsi/esp.c | 3 ++- | ||
20 | hw/xen/xen_pt_msi.c | 3 ++- | ||
21 | memory.c | 5 +++-- | ||
22 | 7 files changed, 25 insertions(+), 13 deletions(-) | ||
23 | 13 | ||
24 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 14 | diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c |
25 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/exec/memory.h | 16 | --- a/hw/arm/strongarm.c |
27 | +++ b/include/exec/memory.h | 17 | +++ b/hw/arm/strongarm.c |
28 | @@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps { | 18 | @@ -XXX,XX +XXX,XX @@ static void strongarm_rtc_init(Object *obj) |
29 | * as a machine check exception). | 19 | s->last_rcnr = (uint32_t) mktimegm(&tm); |
30 | */ | 20 | s->last_hz = qemu_clock_get_ms(rtc_clock); |
31 | bool (*accepts)(void *opaque, hwaddr addr, | 21 | |
32 | - unsigned size, bool is_write); | 22 | - s->rtc_alarm = timer_new_ms(rtc_clock, strongarm_rtc_alarm_tick, s); |
33 | + unsigned size, bool is_write, | 23 | - s->rtc_hz = timer_new_ms(rtc_clock, strongarm_rtc_hz_tick, s); |
34 | + MemTxAttrs attrs); | 24 | - |
35 | } valid; | 25 | sysbus_init_irq(dev, &s->rtc_irq); |
36 | /* Internal implementation constraints: */ | 26 | sysbus_init_irq(dev, &s->rtc_hz_irq); |
37 | struct { | 27 | |
38 | diff --git a/exec.c b/exec.c | 28 | @@ -XXX,XX +XXX,XX @@ static void strongarm_rtc_init(Object *obj) |
39 | index XXXXXXX..XXXXXXX 100644 | 29 | sysbus_init_mmio(dev, &s->iomem); |
40 | --- a/exec.c | ||
41 | +++ b/exec.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, | ||
43 | } | 30 | } |
44 | 31 | ||
45 | static bool notdirty_mem_accepts(void *opaque, hwaddr addr, | 32 | +static void strongarm_rtc_realize(DeviceState *dev, Error **errp) |
46 | - unsigned size, bool is_write) | 33 | +{ |
47 | + unsigned size, bool is_write, | 34 | + StrongARMRTCState *s = STRONGARM_RTC(dev); |
48 | + MemTxAttrs attrs) | 35 | + s->rtc_alarm = timer_new_ms(rtc_clock, strongarm_rtc_alarm_tick, s); |
36 | + s->rtc_hz = timer_new_ms(rtc_clock, strongarm_rtc_hz_tick, s); | ||
37 | +} | ||
38 | + | ||
39 | static int strongarm_rtc_pre_save(void *opaque) | ||
49 | { | 40 | { |
50 | return is_write; | 41 | StrongARMRTCState *s = opaque; |
42 | @@ -XXX,XX +XXX,XX @@ static void strongarm_rtc_sysbus_class_init(ObjectClass *klass, void *data) | ||
43 | |||
44 | dc->desc = "StrongARM RTC Controller"; | ||
45 | dc->vmsd = &vmstate_strongarm_rtc_regs; | ||
46 | + dc->realize = strongarm_rtc_realize; | ||
51 | } | 47 | } |
52 | @@ -XXX,XX +XXX,XX @@ static MemTxResult subpage_write(void *opaque, hwaddr addr, | 48 | |
49 | static const TypeInfo strongarm_rtc_sysbus_info = { | ||
50 | @@ -XXX,XX +XXX,XX @@ static void strongarm_uart_init(Object *obj) | ||
51 | "uart", 0x10000); | ||
52 | sysbus_init_mmio(dev, &s->iomem); | ||
53 | sysbus_init_irq(dev, &s->irq); | ||
54 | - | ||
55 | - s->rx_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, strongarm_uart_rx_to, s); | ||
56 | - s->tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, strongarm_uart_tx, s); | ||
53 | } | 57 | } |
54 | 58 | ||
55 | static bool subpage_accepts(void *opaque, hwaddr addr, | 59 | static void strongarm_uart_realize(DeviceState *dev, Error **errp) |
56 | - unsigned len, bool is_write) | ||
57 | + unsigned len, bool is_write, | ||
58 | + MemTxAttrs attrs) | ||
59 | { | 60 | { |
60 | subpage_t *subpage = opaque; | 61 | StrongARMUARTState *s = STRONGARM_UART(dev); |
61 | #if defined(DEBUG_SUBPAGE) | 62 | |
62 | @@ -XXX,XX +XXX,XX @@ static void readonly_mem_write(void *opaque, hwaddr addr, | 63 | + s->rx_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, |
63 | } | 64 | + strongarm_uart_rx_to, |
64 | 65 | + s); | |
65 | static bool readonly_mem_accepts(void *opaque, hwaddr addr, | 66 | + s->tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, strongarm_uart_tx, s); |
66 | - unsigned size, bool is_write) | 67 | qemu_chr_fe_set_handlers(&s->chr, |
67 | + unsigned size, bool is_write, | 68 | strongarm_uart_can_receive, |
68 | + MemTxAttrs attrs) | 69 | strongarm_uart_receive, |
69 | { | ||
70 | return is_write; | ||
71 | } | ||
72 | diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/hppa/dino.c | ||
75 | +++ b/hw/hppa/dino.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static void gsc_to_pci_forwarding(DinoState *s) | ||
77 | } | ||
78 | |||
79 | static bool dino_chip_mem_valid(void *opaque, hwaddr addr, | ||
80 | - unsigned size, bool is_write) | ||
81 | + unsigned size, bool is_write, | ||
82 | + MemTxAttrs attrs) | ||
83 | { | ||
84 | switch (addr) { | ||
85 | case DINO_IAR0: | ||
86 | diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/nvram/fw_cfg.c | ||
89 | +++ b/hw/nvram/fw_cfg.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_dma_mem_write(void *opaque, hwaddr addr, | ||
91 | } | ||
92 | |||
93 | static bool fw_cfg_dma_mem_valid(void *opaque, hwaddr addr, | ||
94 | - unsigned size, bool is_write) | ||
95 | + unsigned size, bool is_write, | ||
96 | + MemTxAttrs attrs) | ||
97 | { | ||
98 | return !is_write || ((size == 4 && (addr == 0 || addr == 4)) || | ||
99 | (size == 8 && addr == 0)); | ||
100 | } | ||
101 | |||
102 | static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr, | ||
103 | - unsigned size, bool is_write) | ||
104 | + unsigned size, bool is_write, | ||
105 | + MemTxAttrs attrs) | ||
106 | { | ||
107 | return addr == 0; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_ctl_mem_write(void *opaque, hwaddr addr, | ||
110 | } | ||
111 | |||
112 | static bool fw_cfg_ctl_mem_valid(void *opaque, hwaddr addr, | ||
113 | - unsigned size, bool is_write) | ||
114 | + unsigned size, bool is_write, | ||
115 | + MemTxAttrs attrs) | ||
116 | { | ||
117 | return is_write && size == 2; | ||
118 | } | ||
119 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_comb_write(void *opaque, hwaddr addr, | ||
120 | } | ||
121 | |||
122 | static bool fw_cfg_comb_valid(void *opaque, hwaddr addr, | ||
123 | - unsigned size, bool is_write) | ||
124 | + unsigned size, bool is_write, | ||
125 | + MemTxAttrs attrs) | ||
126 | { | ||
127 | return (size == 1) || (is_write && size == 2); | ||
128 | } | ||
129 | diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/hw/scsi/esp.c | ||
132 | +++ b/hw/scsi/esp.c | ||
133 | @@ -XXX,XX +XXX,XX @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | ||
134 | } | ||
135 | |||
136 | static bool esp_mem_accepts(void *opaque, hwaddr addr, | ||
137 | - unsigned size, bool is_write) | ||
138 | + unsigned size, bool is_write, | ||
139 | + MemTxAttrs attrs) | ||
140 | { | ||
141 | return (size == 1) || (is_write && size == 4); | ||
142 | } | ||
143 | diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c | ||
144 | index XXXXXXX..XXXXXXX 100644 | ||
145 | --- a/hw/xen/xen_pt_msi.c | ||
146 | +++ b/hw/xen/xen_pt_msi.c | ||
147 | @@ -XXX,XX +XXX,XX @@ static uint64_t pci_msix_read(void *opaque, hwaddr addr, | ||
148 | } | ||
149 | |||
150 | static bool pci_msix_accepts(void *opaque, hwaddr addr, | ||
151 | - unsigned size, bool is_write) | ||
152 | + unsigned size, bool is_write, | ||
153 | + MemTxAttrs attrs) | ||
154 | { | ||
155 | return !(addr & (size - 1)); | ||
156 | } | ||
157 | diff --git a/memory.c b/memory.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/memory.c | ||
160 | +++ b/memory.c | ||
161 | @@ -XXX,XX +XXX,XX @@ static void unassigned_mem_write(void *opaque, hwaddr addr, | ||
162 | } | ||
163 | |||
164 | static bool unassigned_mem_accepts(void *opaque, hwaddr addr, | ||
165 | - unsigned size, bool is_write) | ||
166 | + unsigned size, bool is_write, | ||
167 | + MemTxAttrs attrs) | ||
168 | { | ||
169 | return false; | ||
170 | } | ||
171 | @@ -XXX,XX +XXX,XX @@ bool memory_region_access_valid(MemoryRegion *mr, | ||
172 | access_size = MAX(MIN(size, access_size_max), access_size_min); | ||
173 | for (i = 0; i < size; i += access_size) { | ||
174 | if (!mr->ops->valid.accepts(mr->opaque, addr + i, access_size, | ||
175 | - is_write)) { | ||
176 | + is_write, attrs)) { | ||
177 | return false; | ||
178 | } | ||
179 | } | ||
180 | -- | 70 | -- |
181 | 2.17.1 | 71 | 2.20.1 |
182 | 72 | ||
183 | 73 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Pan Nengyuan <pannengyuan@huawei.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_access_valid(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. | ||
4 | |||
5 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
6 | Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20200227025055.14341-7-pannengyuan@huawei.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-6-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | include/exec/memory.h | 4 +++- | 12 | hw/timer/cadence_ttc.c | 18 ++++++++++++------ |
12 | include/sysemu/dma.h | 3 ++- | 13 | 1 file changed, 12 insertions(+), 6 deletions(-) |
13 | exec.c | 3 ++- | ||
14 | target/s390x/diag.c | 6 ++++-- | ||
15 | target/s390x/excp_helper.c | 3 ++- | ||
16 | target/s390x/mmu_helper.c | 3 ++- | ||
17 | target/s390x/sigp.c | 3 ++- | ||
18 | 7 files changed, 17 insertions(+), 8 deletions(-) | ||
19 | 14 | ||
20 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 15 | diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/exec/memory.h | 17 | --- a/hw/timer/cadence_ttc.c |
23 | +++ b/include/exec/memory.h | 18 | +++ b/hw/timer/cadence_ttc.c |
24 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | 19 | @@ -XXX,XX +XXX,XX @@ static void cadence_timer_init(uint32_t freq, CadenceTimerState *s) |
25 | * @addr: address within that address space | 20 | static void cadence_ttc_init(Object *obj) |
26 | * @len: length of the area to be checked | ||
27 | * @is_write: indicates the transfer direction | ||
28 | + * @attrs: memory attributes | ||
29 | */ | ||
30 | -bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write); | ||
31 | +bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, | ||
32 | + bool is_write, MemTxAttrs attrs); | ||
33 | |||
34 | /* address_space_map: map a physical memory region into a host virtual address | ||
35 | * | ||
36 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/include/sysemu/dma.h | ||
39 | +++ b/include/sysemu/dma.h | ||
40 | @@ -XXX,XX +XXX,XX @@ static inline bool dma_memory_valid(AddressSpace *as, | ||
41 | DMADirection dir) | ||
42 | { | 21 | { |
43 | return address_space_access_valid(as, addr, len, | 22 | CadenceTTCState *s = CADENCE_TTC(obj); |
44 | - dir == DMA_DIRECTION_FROM_DEVICE); | 23 | - int i; |
45 | + dir == DMA_DIRECTION_FROM_DEVICE, | 24 | - |
46 | + MEMTXATTRS_UNSPECIFIED); | 25 | - for (i = 0; i < 3; ++i) { |
26 | - cadence_timer_init(133000000, &s->timer[i]); | ||
27 | - sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->timer[i].irq); | ||
28 | - } | ||
29 | |||
30 | memory_region_init_io(&s->iomem, obj, &cadence_ttc_ops, s, | ||
31 | "timer", 0x1000); | ||
32 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); | ||
47 | } | 33 | } |
48 | 34 | ||
49 | static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, | 35 | +static void cadence_ttc_realize(DeviceState *dev, Error **errp) |
50 | diff --git a/exec.c b/exec.c | 36 | +{ |
51 | index XXXXXXX..XXXXXXX 100644 | 37 | + CadenceTTCState *s = CADENCE_TTC(dev); |
52 | --- a/exec.c | 38 | + int i; |
53 | +++ b/exec.c | 39 | + |
54 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 40 | + for (i = 0; i < 3; ++i) { |
41 | + cadence_timer_init(133000000, &s->timer[i]); | ||
42 | + sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->timer[i].irq); | ||
43 | + } | ||
44 | +} | ||
45 | + | ||
46 | static int cadence_timer_pre_save(void *opaque) | ||
47 | { | ||
48 | cadence_timer_sync((CadenceTimerState *)opaque); | ||
49 | @@ -XXX,XX +XXX,XX @@ static void cadence_ttc_class_init(ObjectClass *klass, void *data) | ||
50 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
51 | |||
52 | dc->vmsd = &vmstate_cadence_ttc; | ||
53 | + dc->realize = cadence_ttc_realize; | ||
55 | } | 54 | } |
56 | 55 | ||
57 | bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 56 | static const TypeInfo cadence_ttc_info = { |
58 | - int len, bool is_write) | ||
59 | + int len, bool is_write, | ||
60 | + MemTxAttrs attrs) | ||
61 | { | ||
62 | FlatView *fv; | ||
63 | bool result; | ||
64 | diff --git a/target/s390x/diag.c b/target/s390x/diag.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/s390x/diag.c | ||
67 | +++ b/target/s390x/diag.c | ||
68 | @@ -XXX,XX +XXX,XX @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) | ||
69 | return; | ||
70 | } | ||
71 | if (!address_space_access_valid(&address_space_memory, addr, | ||
72 | - sizeof(IplParameterBlock), false)) { | ||
73 | + sizeof(IplParameterBlock), false, | ||
74 | + MEMTXATTRS_UNSPECIFIED)) { | ||
75 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | ||
76 | return; | ||
77 | } | ||
78 | @@ -XXX,XX +XXX,XX @@ out: | ||
79 | return; | ||
80 | } | ||
81 | if (!address_space_access_valid(&address_space_memory, addr, | ||
82 | - sizeof(IplParameterBlock), true)) { | ||
83 | + sizeof(IplParameterBlock), true, | ||
84 | + MEMTXATTRS_UNSPECIFIED)) { | ||
85 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | ||
86 | return; | ||
87 | } | ||
88 | diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | ||
90 | --- a/target/s390x/excp_helper.c | ||
91 | +++ b/target/s390x/excp_helper.c | ||
92 | @@ -XXX,XX +XXX,XX @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int size, | ||
93 | |||
94 | /* check out of RAM access */ | ||
95 | if (!address_space_access_valid(&address_space_memory, raddr, | ||
96 | - TARGET_PAGE_SIZE, rw)) { | ||
97 | + TARGET_PAGE_SIZE, rw, | ||
98 | + MEMTXATTRS_UNSPECIFIED)) { | ||
99 | DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__, | ||
100 | (uint64_t)raddr, (uint64_t)ram_size); | ||
101 | trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO); | ||
102 | diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/target/s390x/mmu_helper.c | ||
105 | +++ b/target/s390x/mmu_helper.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, | ||
107 | return ret; | ||
108 | } | ||
109 | if (!address_space_access_valid(&address_space_memory, pages[i], | ||
110 | - TARGET_PAGE_SIZE, is_write)) { | ||
111 | + TARGET_PAGE_SIZE, is_write, | ||
112 | + MEMTXATTRS_UNSPECIFIED)) { | ||
113 | trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); | ||
114 | return -EFAULT; | ||
115 | } | ||
116 | diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/target/s390x/sigp.c | ||
119 | +++ b/target/s390x/sigp.c | ||
120 | @@ -XXX,XX +XXX,XX @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg) | ||
121 | cpu_synchronize_state(cs); | ||
122 | |||
123 | if (!address_space_access_valid(&address_space_memory, addr, | ||
124 | - sizeof(struct LowCore), false)) { | ||
125 | + sizeof(struct LowCore), false, | ||
126 | + MEMTXATTRS_UNSPECIFIED)) { | ||
127 | set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); | ||
128 | return; | ||
129 | } | ||
130 | -- | 57 | -- |
131 | 2.17.1 | 58 | 2.20.1 |
132 | 59 | ||
133 | 60 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Depending on the host abi, float16, aka uint16_t, values are | 3 | Don't merely start with v8.0, handle v7VE as well. Ensure that writes |
4 | passed and returned either zero-extended in the host register | 4 | from aarch32 mode do not change bits in the other half of the register. |
5 | or with garbage at the top of the host register. | 5 | Protect reads of aa64 id registers with ARM_FEATURE_AARCH64. |
6 | 6 | ||
7 | The tcg code generator has so far been assuming garbage, as that | 7 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
8 | matches the x86 abi, but this is incorrect for other host abis. | ||
9 | Further, target/arm has so far been assuming zero-extended results, | ||
10 | so that it may store the 16-bit value into a 32-bit slot with the | ||
11 | high 16-bits already clear. | ||
12 | |||
13 | Rectify both problems by mapping "f16" in the helper definition | ||
14 | to uint32_t instead of (a typedef for) uint16_t. This forces | ||
15 | the host compiler to assume garbage in the upper 16 bits on input | ||
16 | and to zero-extend the result on output. | ||
17 | |||
18 | Cc: qemu-stable@nongnu.org | ||
19 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Message-id: 20200229012811.24129-2-richard.henderson@linaro.org |
21 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
22 | Message-id: 20180522175629.24932-1-richard.henderson@linaro.org | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 12 | --- |
26 | include/exec/helper-head.h | 2 +- | 13 | target/arm/helper.c | 38 +++++++++++++++++++++++++------------- |
27 | target/arm/helper-a64.c | 35 +++++++++-------- | 14 | 1 file changed, 25 insertions(+), 13 deletions(-) |
28 | target/arm/helper.c | 80 +++++++++++++++++++------------------- | ||
29 | 3 files changed, 59 insertions(+), 58 deletions(-) | ||
30 | 15 | ||
31 | diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/include/exec/helper-head.h | ||
34 | +++ b/include/exec/helper-head.h | ||
35 | @@ -XXX,XX +XXX,XX @@ | ||
36 | #define dh_ctype_int int | ||
37 | #define dh_ctype_i64 uint64_t | ||
38 | #define dh_ctype_s64 int64_t | ||
39 | -#define dh_ctype_f16 float16 | ||
40 | +#define dh_ctype_f16 uint32_t | ||
41 | #define dh_ctype_f32 float32 | ||
42 | #define dh_ctype_f64 float64 | ||
43 | #define dh_ctype_ptr void * | ||
44 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/helper-a64.c | ||
47 | +++ b/target/arm/helper-a64.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res) | ||
49 | return flags; | ||
50 | } | ||
51 | |||
52 | -uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status) | ||
53 | +uint64_t HELPER(vfp_cmph_a64)(uint32_t x, uint32_t y, void *fp_status) | ||
54 | { | ||
55 | return float_rel_to_flags(float16_compare_quiet(x, y, fp_status)); | ||
56 | } | ||
57 | |||
58 | -uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status) | ||
59 | +uint64_t HELPER(vfp_cmpeh_a64)(uint32_t x, uint32_t y, void *fp_status) | ||
60 | { | ||
61 | return float_rel_to_flags(float16_compare(x, y, fp_status)); | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, void *fpstp) | ||
64 | #define float64_three make_float64(0x4008000000000000ULL) | ||
65 | #define float64_one_point_five make_float64(0x3FF8000000000000ULL) | ||
66 | |||
67 | -float16 HELPER(recpsf_f16)(float16 a, float16 b, void *fpstp) | ||
68 | +uint32_t HELPER(recpsf_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
69 | { | ||
70 | float_status *fpst = fpstp; | ||
71 | |||
72 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(recpsf_f64)(float64 a, float64 b, void *fpstp) | ||
73 | return float64_muladd(a, b, float64_two, 0, fpst); | ||
74 | } | ||
75 | |||
76 | -float16 HELPER(rsqrtsf_f16)(float16 a, float16 b, void *fpstp) | ||
77 | +uint32_t HELPER(rsqrtsf_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
78 | { | ||
79 | float_status *fpst = fpstp; | ||
80 | |||
81 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_addlp_u16)(uint64_t a) | ||
82 | } | ||
83 | |||
84 | /* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ | ||
85 | -float16 HELPER(frecpx_f16)(float16 a, void *fpstp) | ||
86 | +uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp) | ||
87 | { | ||
88 | float_status *fpst = fpstp; | ||
89 | uint16_t val16, sbit; | ||
90 | @@ -XXX,XX +XXX,XX @@ void HELPER(casp_be_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, | ||
91 | #define ADVSIMD_HELPER(name, suffix) HELPER(glue(glue(advsimd_, name), suffix)) | ||
92 | |||
93 | #define ADVSIMD_HALFOP(name) \ | ||
94 | -float16 ADVSIMD_HELPER(name, h)(float16 a, float16 b, void *fpstp) \ | ||
95 | +uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, void *fpstp) \ | ||
96 | { \ | ||
97 | float_status *fpst = fpstp; \ | ||
98 | return float16_ ## name(a, b, fpst); \ | ||
99 | @@ -XXX,XX +XXX,XX @@ ADVSIMD_HALFOP(mulx) | ||
100 | ADVSIMD_TWOHALFOP(mulx) | ||
101 | |||
102 | /* fused multiply-accumulate */ | ||
103 | -float16 HELPER(advsimd_muladdh)(float16 a, float16 b, float16 c, void *fpstp) | ||
104 | +uint32_t HELPER(advsimd_muladdh)(uint32_t a, uint32_t b, uint32_t c, | ||
105 | + void *fpstp) | ||
106 | { | ||
107 | float_status *fpst = fpstp; | ||
108 | return float16_muladd(a, b, c, 0, fpst); | ||
109 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_muladd2h)(uint32_t two_a, uint32_t two_b, | ||
110 | |||
111 | #define ADVSIMD_CMPRES(test) (test) ? 0xffff : 0 | ||
112 | |||
113 | -uint32_t HELPER(advsimd_ceq_f16)(float16 a, float16 b, void *fpstp) | ||
114 | +uint32_t HELPER(advsimd_ceq_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
115 | { | ||
116 | float_status *fpst = fpstp; | ||
117 | int compare = float16_compare_quiet(a, b, fpst); | ||
118 | return ADVSIMD_CMPRES(compare == float_relation_equal); | ||
119 | } | ||
120 | |||
121 | -uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp) | ||
122 | +uint32_t HELPER(advsimd_cge_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
123 | { | ||
124 | float_status *fpst = fpstp; | ||
125 | int compare = float16_compare(a, b, fpst); | ||
126 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp) | ||
127 | compare == float_relation_equal); | ||
128 | } | ||
129 | |||
130 | -uint32_t HELPER(advsimd_cgt_f16)(float16 a, float16 b, void *fpstp) | ||
131 | +uint32_t HELPER(advsimd_cgt_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
132 | { | ||
133 | float_status *fpst = fpstp; | ||
134 | int compare = float16_compare(a, b, fpst); | ||
135 | return ADVSIMD_CMPRES(compare == float_relation_greater); | ||
136 | } | ||
137 | |||
138 | -uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp) | ||
139 | +uint32_t HELPER(advsimd_acge_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
140 | { | ||
141 | float_status *fpst = fpstp; | ||
142 | float16 f0 = float16_abs(a); | ||
143 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp) | ||
144 | compare == float_relation_equal); | ||
145 | } | ||
146 | |||
147 | -uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) | ||
148 | +uint32_t HELPER(advsimd_acgt_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
149 | { | ||
150 | float_status *fpst = fpstp; | ||
151 | float16 f0 = float16_abs(a); | ||
152 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) | ||
153 | } | ||
154 | |||
155 | /* round to integral */ | ||
156 | -float16 HELPER(advsimd_rinth_exact)(float16 x, void *fp_status) | ||
157 | +uint32_t HELPER(advsimd_rinth_exact)(uint32_t x, void *fp_status) | ||
158 | { | ||
159 | return float16_round_to_int(x, fp_status); | ||
160 | } | ||
161 | |||
162 | -float16 HELPER(advsimd_rinth)(float16 x, void *fp_status) | ||
163 | +uint32_t HELPER(advsimd_rinth)(uint32_t x, void *fp_status) | ||
164 | { | ||
165 | int old_flags = get_float_exception_flags(fp_status), new_flags; | ||
166 | float16 ret; | ||
167 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(advsimd_rinth)(float16 x, void *fp_status) | ||
168 | * setting the mode appropriately before calling the helper. | ||
169 | */ | ||
170 | |||
171 | -uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp) | ||
172 | +uint32_t HELPER(advsimd_f16tosinth)(uint32_t a, void *fpstp) | ||
173 | { | ||
174 | float_status *fpst = fpstp; | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp) | ||
177 | return float16_to_int16(a, fpst); | ||
178 | } | ||
179 | |||
180 | -uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp) | ||
181 | +uint32_t HELPER(advsimd_f16touinth)(uint32_t a, void *fpstp) | ||
182 | { | ||
183 | float_status *fpst = fpstp; | ||
184 | |||
185 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp) | ||
186 | * Square Root and Reciprocal square root | ||
187 | */ | ||
188 | |||
189 | -float16 HELPER(sqrt_f16)(float16 a, void *fpstp) | ||
190 | +uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp) | ||
191 | { | ||
192 | float_status *s = fpstp; | ||
193 | |||
194 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 16 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
195 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
196 | --- a/target/arm/helper.c | 18 | --- a/target/arm/helper.c |
197 | +++ b/target/arm/helper.c | 19 | +++ b/target/arm/helper.c |
198 | @@ -XXX,XX +XXX,XX @@ DO_VFP_cmp(d, float64) | 20 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { |
199 | 21 | REGINFO_SENTINEL | |
200 | /* Integer to float and float to integer conversions */ | 22 | }; |
201 | 23 | ||
202 | -#define CONV_ITOF(name, fsz, sign) \ | 24 | -static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) |
203 | - float##fsz HELPER(name)(uint32_t x, void *fpstp) \ | 25 | +static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) |
204 | -{ \ | 26 | { |
205 | - float_status *fpst = fpstp; \ | 27 | ARMCPU *cpu = env_archcpu(env); |
206 | - return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \ | 28 | - /* Begin with bits defined in base ARMv8.0. */ |
207 | +#define CONV_ITOF(name, ftype, fsz, sign) \ | 29 | - uint64_t valid_mask = MAKE_64BIT_MASK(0, 34); |
208 | +ftype HELPER(name)(uint32_t x, void *fpstp) \ | 30 | + |
209 | +{ \ | 31 | + if (arm_feature(env, ARM_FEATURE_V8)) { |
210 | + float_status *fpst = fpstp; \ | 32 | + valid_mask |= MAKE_64BIT_MASK(0, 34); /* ARMv8.0 */ |
211 | + return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \ | 33 | + } else { |
34 | + valid_mask |= MAKE_64BIT_MASK(0, 28); /* ARMv7VE */ | ||
35 | + } | ||
36 | |||
37 | if (arm_feature(env, ARM_FEATURE_EL3)) { | ||
38 | valid_mask &= ~HCR_HCD; | ||
39 | @@ -XXX,XX +XXX,XX @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
40 | */ | ||
41 | valid_mask &= ~HCR_TSC; | ||
42 | } | ||
43 | - if (cpu_isar_feature(aa64_vh, cpu)) { | ||
44 | - valid_mask |= HCR_E2H; | ||
45 | - } | ||
46 | - if (cpu_isar_feature(aa64_lor, cpu)) { | ||
47 | - valid_mask |= HCR_TLOR; | ||
48 | - } | ||
49 | - if (cpu_isar_feature(aa64_pauth, cpu)) { | ||
50 | - valid_mask |= HCR_API | HCR_APK; | ||
51 | + | ||
52 | + if (arm_feature(env, ARM_FEATURE_AARCH64)) { | ||
53 | + if (cpu_isar_feature(aa64_vh, cpu)) { | ||
54 | + valid_mask |= HCR_E2H; | ||
55 | + } | ||
56 | + if (cpu_isar_feature(aa64_lor, cpu)) { | ||
57 | + valid_mask |= HCR_TLOR; | ||
58 | + } | ||
59 | + if (cpu_isar_feature(aa64_pauth, cpu)) { | ||
60 | + valid_mask |= HCR_API | HCR_APK; | ||
61 | + } | ||
62 | } | ||
63 | |||
64 | /* Clear RES0 bits. */ | ||
65 | @@ -XXX,XX +XXX,XX @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
66 | arm_cpu_update_vfiq(cpu); | ||
212 | } | 67 | } |
213 | 68 | ||
214 | -#define CONV_FTOI(name, fsz, sign, round) \ | 69 | +static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) |
215 | -uint32_t HELPER(name)(float##fsz x, void *fpstp) \ | 70 | +{ |
216 | -{ \ | 71 | + do_hcr_write(env, value, 0); |
217 | - float_status *fpst = fpstp; \ | 72 | +} |
218 | - if (float##fsz##_is_any_nan(x)) { \ | 73 | + |
219 | - float_raise(float_flag_invalid, fpst); \ | 74 | static void hcr_writehigh(CPUARMState *env, const ARMCPRegInfo *ri, |
220 | - return 0; \ | 75 | uint64_t value) |
221 | - } \ | 76 | { |
222 | - return float##fsz##_to_##sign##int32##round(x, fpst); \ | 77 | /* Handle HCR2 write, i.e. write to high half of HCR_EL2 */ |
223 | +#define CONV_FTOI(name, ftype, fsz, sign, round) \ | 78 | value = deposit64(env->cp15.hcr_el2, 32, 32, value); |
224 | +uint32_t HELPER(name)(ftype x, void *fpstp) \ | 79 | - hcr_write(env, NULL, value); |
225 | +{ \ | 80 | + do_hcr_write(env, value, MAKE_64BIT_MASK(0, 32)); |
226 | + float_status *fpst = fpstp; \ | ||
227 | + if (float##fsz##_is_any_nan(x)) { \ | ||
228 | + float_raise(float_flag_invalid, fpst); \ | ||
229 | + return 0; \ | ||
230 | + } \ | ||
231 | + return float##fsz##_to_##sign##int32##round(x, fpst); \ | ||
232 | } | 81 | } |
233 | 82 | ||
234 | -#define FLOAT_CONVS(name, p, fsz, sign) \ | 83 | static void hcr_writelow(CPUARMState *env, const ARMCPRegInfo *ri, |
235 | -CONV_ITOF(vfp_##name##to##p, fsz, sign) \ | 84 | @@ -XXX,XX +XXX,XX @@ static void hcr_writelow(CPUARMState *env, const ARMCPRegInfo *ri, |
236 | -CONV_FTOI(vfp_to##name##p, fsz, sign, ) \ | 85 | { |
237 | -CONV_FTOI(vfp_to##name##z##p, fsz, sign, _round_to_zero) | 86 | /* Handle HCR write, i.e. write to low half of HCR_EL2 */ |
238 | +#define FLOAT_CONVS(name, p, ftype, fsz, sign) \ | 87 | value = deposit64(env->cp15.hcr_el2, 0, 32, value); |
239 | + CONV_ITOF(vfp_##name##to##p, ftype, fsz, sign) \ | 88 | - hcr_write(env, NULL, value); |
240 | + CONV_FTOI(vfp_to##name##p, ftype, fsz, sign, ) \ | 89 | + do_hcr_write(env, value, MAKE_64BIT_MASK(32, 32)); |
241 | + CONV_FTOI(vfp_to##name##z##p, ftype, fsz, sign, _round_to_zero) | ||
242 | |||
243 | -FLOAT_CONVS(si, h, 16, ) | ||
244 | -FLOAT_CONVS(si, s, 32, ) | ||
245 | -FLOAT_CONVS(si, d, 64, ) | ||
246 | -FLOAT_CONVS(ui, h, 16, u) | ||
247 | -FLOAT_CONVS(ui, s, 32, u) | ||
248 | -FLOAT_CONVS(ui, d, 64, u) | ||
249 | +FLOAT_CONVS(si, h, uint32_t, 16, ) | ||
250 | +FLOAT_CONVS(si, s, float32, 32, ) | ||
251 | +FLOAT_CONVS(si, d, float64, 64, ) | ||
252 | +FLOAT_CONVS(ui, h, uint32_t, 16, u) | ||
253 | +FLOAT_CONVS(ui, s, float32, 32, u) | ||
254 | +FLOAT_CONVS(ui, d, float64, 64, u) | ||
255 | |||
256 | #undef CONV_ITOF | ||
257 | #undef CONV_FTOI | ||
258 | @@ -XXX,XX +XXX,XX @@ static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) | ||
259 | return float64_to_float16(float64_scalbn(f, -shift, fpst), true, fpst); | ||
260 | } | 90 | } |
261 | 91 | ||
262 | -float16 HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) | 92 | /* |
263 | +uint32_t HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) | ||
264 | { | ||
265 | return do_postscale_fp16(int32_to_float64(x, fpst), shift, fpst); | ||
266 | } | ||
267 | |||
268 | -float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | ||
269 | +uint32_t HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | ||
270 | { | ||
271 | return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); | ||
272 | } | ||
273 | |||
274 | -float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
275 | +uint32_t HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
276 | { | ||
277 | return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst); | ||
278 | } | ||
279 | |||
280 | -float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
281 | +uint32_t HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
282 | { | ||
283 | return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst); | ||
284 | } | ||
285 | @@ -XXX,XX +XXX,XX @@ static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst) | ||
286 | } | ||
287 | } | ||
288 | |||
289 | -uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst) | ||
290 | +uint32_t HELPER(vfp_toshh)(uint32_t x, uint32_t shift, void *fpst) | ||
291 | { | ||
292 | return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst); | ||
293 | } | ||
294 | |||
295 | -uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst) | ||
296 | +uint32_t HELPER(vfp_touhh)(uint32_t x, uint32_t shift, void *fpst) | ||
297 | { | ||
298 | return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); | ||
299 | } | ||
300 | |||
301 | -uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst) | ||
302 | +uint32_t HELPER(vfp_toslh)(uint32_t x, uint32_t shift, void *fpst) | ||
303 | { | ||
304 | return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst); | ||
305 | } | ||
306 | |||
307 | -uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst) | ||
308 | +uint32_t HELPER(vfp_toulh)(uint32_t x, uint32_t shift, void *fpst) | ||
309 | { | ||
310 | return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst); | ||
311 | } | ||
312 | |||
313 | -uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst) | ||
314 | +uint64_t HELPER(vfp_tosqh)(uint32_t x, uint32_t shift, void *fpst) | ||
315 | { | ||
316 | return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst); | ||
317 | } | ||
318 | |||
319 | -uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst) | ||
320 | +uint64_t HELPER(vfp_touqh)(uint32_t x, uint32_t shift, void *fpst) | ||
321 | { | ||
322 | return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst); | ||
323 | } | ||
324 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env) | ||
325 | } | ||
326 | |||
327 | /* Half precision conversions. */ | ||
328 | -float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
329 | +float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
330 | { | ||
331 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
332 | * it would affect flushing input denormals. | ||
333 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
334 | return r; | ||
335 | } | ||
336 | |||
337 | -float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
338 | +uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
339 | { | ||
340 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
341 | * it would affect flushing output denormals. | ||
342 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
343 | return r; | ||
344 | } | ||
345 | |||
346 | -float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
347 | +float64 HELPER(vfp_fcvt_f16_to_f64)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
348 | { | ||
349 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
350 | * it would affect flushing input denormals. | ||
351 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
352 | return r; | ||
353 | } | ||
354 | |||
355 | -float16 HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
356 | +uint32_t HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
357 | { | ||
358 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
359 | * it would affect flushing output denormals. | ||
360 | @@ -XXX,XX +XXX,XX @@ static bool round_to_inf(float_status *fpst, bool sign_bit) | ||
361 | g_assert_not_reached(); | ||
362 | } | ||
363 | |||
364 | -float16 HELPER(recpe_f16)(float16 input, void *fpstp) | ||
365 | +uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp) | ||
366 | { | ||
367 | float_status *fpst = fpstp; | ||
368 | float16 f16 = float16_squash_input_denormal(input, fpst); | ||
369 | @@ -XXX,XX +XXX,XX @@ static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac) | ||
370 | return extract64(estimate, 0, 8) << 44; | ||
371 | } | ||
372 | |||
373 | -float16 HELPER(rsqrte_f16)(float16 input, void *fpstp) | ||
374 | +uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp) | ||
375 | { | ||
376 | float_status *s = fpstp; | ||
377 | float16 f16 = float16_squash_input_denormal(input, s); | ||
378 | -- | 93 | -- |
379 | 2.17.1 | 94 | 2.20.1 |
380 | 95 | ||
381 | 96 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20200229012811.24129-3-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/cpu.h | 7 +++++++ | ||
9 | 1 file changed, 7 insertions(+) | ||
10 | |||
11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/cpu.h | ||
14 | +++ b/target/arm/cpu.h | ||
15 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
16 | #define HCR_TERR (1ULL << 36) | ||
17 | #define HCR_TEA (1ULL << 37) | ||
18 | #define HCR_MIOCNCE (1ULL << 38) | ||
19 | +/* RES0 bit 39 */ | ||
20 | #define HCR_APK (1ULL << 40) | ||
21 | #define HCR_API (1ULL << 41) | ||
22 | #define HCR_NV (1ULL << 42) | ||
23 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
24 | #define HCR_NV2 (1ULL << 45) | ||
25 | #define HCR_FWB (1ULL << 46) | ||
26 | #define HCR_FIEN (1ULL << 47) | ||
27 | +/* RES0 bit 48 */ | ||
28 | #define HCR_TID4 (1ULL << 49) | ||
29 | #define HCR_TICAB (1ULL << 50) | ||
30 | +#define HCR_AMVOFFEN (1ULL << 51) | ||
31 | #define HCR_TOCU (1ULL << 52) | ||
32 | +#define HCR_ENSCXT (1ULL << 53) | ||
33 | #define HCR_TTLBIS (1ULL << 54) | ||
34 | #define HCR_TTLBOS (1ULL << 55) | ||
35 | #define HCR_ATA (1ULL << 56) | ||
36 | #define HCR_DCT (1ULL << 57) | ||
37 | +#define HCR_TID5 (1ULL << 58) | ||
38 | +#define HCR_TWEDEN (1ULL << 59) | ||
39 | +#define HCR_TWEDEL MAKE_64BIT_MASK(60, 4) | ||
40 | |||
41 | #define SCR_NS (1U << 0) | ||
42 | #define SCR_IRQ (1U << 1) | ||
43 | -- | ||
44 | 2.20.1 | ||
45 | |||
46 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | acpi_data_push uses g_array_set_size to resize the memory size. If there | 3 | In arm_cpu_reset, we configure many system registers so that user-only |
4 | is no enough contiguous memory, the address will be changed. So previous | 4 | behaves as it should with a minimum of ifdefs. However, we do not set |
5 | pointer could not be used any more. It must update the pointer and use | 5 | all of the system registers as required for a cpu with EL2 and EL3. |
6 | the new one. | ||
7 | 6 | ||
8 | Also, previous codes wrongly use le32 conversion of iort->node_offset | 7 | Disabling EL2 and EL3 mean that we will not look at those registers, |
9 | for subsequent computations that will result incorrect value if host is | 8 | which means that we don't have to worry about configuring them. |
10 | not litlle endian. So use the non-converted one instead. | ||
11 | 9 | ||
12 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 11 | Message-id: 20200229012811.24129-4-richard.henderson@linaro.org |
14 | Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com | 12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 14 | --- |
17 | hw/arm/virt-acpi-build.c | 20 +++++++++++++++----- | 15 | target/arm/cpu.c | 6 ++++-- |
18 | 1 file changed, 15 insertions(+), 5 deletions(-) | 16 | 1 file changed, 4 insertions(+), 2 deletions(-) |
19 | 17 | ||
20 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 18 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/virt-acpi-build.c | 20 | --- a/target/arm/cpu.c |
23 | +++ b/hw/arm/virt-acpi-build.c | 21 | +++ b/target/arm/cpu.c |
24 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 22 | @@ -XXX,XX +XXX,XX @@ static Property arm_cpu_reset_hivecs_property = |
25 | AcpiIortItsGroup *its; | 23 | static Property arm_cpu_rvbar_property = |
26 | AcpiIortTable *iort; | 24 | DEFINE_PROP_UINT64("rvbar", ARMCPU, rvbar, 0); |
27 | AcpiIortSmmu3 *smmu; | 25 | |
28 | - size_t node_size, iort_length, smmu_offset = 0; | 26 | +#ifndef CONFIG_USER_ONLY |
29 | + size_t node_size, iort_node_offset, iort_length, smmu_offset = 0; | 27 | static Property arm_cpu_has_el2_property = |
30 | AcpiIortRC *rc; | 28 | DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, true); |
31 | 29 | ||
32 | iort = acpi_data_push(table_data, sizeof(*iort)); | 30 | static Property arm_cpu_has_el3_property = |
33 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 31 | DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true); |
34 | 32 | +#endif | |
35 | iort_length = sizeof(*iort); | 33 | |
36 | iort->node_count = cpu_to_le32(nb_nodes); | 34 | static Property arm_cpu_cfgend_property = |
37 | - iort->node_offset = cpu_to_le32(sizeof(*iort)); | 35 | DEFINE_PROP_BOOL("cfgend", ARMCPU, cfgend, false); |
38 | + /* | 36 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj) |
39 | + * Use a copy in case table_data->data moves during acpi_data_push | 37 | qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property); |
40 | + * operations. | ||
41 | + */ | ||
42 | + iort_node_offset = sizeof(*iort); | ||
43 | + iort->node_offset = cpu_to_le32(iort_node_offset); | ||
44 | |||
45 | /* ITS group node */ | ||
46 | node_size = sizeof(*its) + sizeof(uint32_t); | ||
47 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
48 | int irq = vms->irqmap[VIRT_SMMU]; | ||
49 | |||
50 | /* SMMUv3 node */ | ||
51 | - smmu_offset = iort->node_offset + node_size; | ||
52 | + smmu_offset = iort_node_offset + node_size; | ||
53 | node_size = sizeof(*smmu) + sizeof(*idmap); | ||
54 | iort_length += node_size; | ||
55 | smmu = acpi_data_push(table_data, node_size); | ||
56 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
57 | idmap->id_count = cpu_to_le32(0xFFFF); | ||
58 | idmap->output_base = 0; | ||
59 | /* output IORT node is the ITS group node (the first node) */ | ||
60 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | ||
61 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | ||
62 | } | 38 | } |
63 | 39 | ||
64 | /* Root Complex Node */ | 40 | +#ifndef CONFIG_USER_ONLY |
65 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 41 | if (arm_feature(&cpu->env, ARM_FEATURE_EL3)) { |
66 | idmap->output_reference = cpu_to_le32(smmu_offset); | 42 | /* Add the has_el3 state CPU property only if EL3 is allowed. This will |
67 | } else { | 43 | * prevent "has_el3" from existing on CPUs which cannot support EL3. |
68 | /* output IORT node is the ITS group node (the first node) */ | 44 | */ |
69 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | 45 | qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property); |
70 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | 46 | |
47 | -#ifndef CONFIG_USER_ONLY | ||
48 | object_property_add_link(obj, "secure-memory", | ||
49 | TYPE_MEMORY_REGION, | ||
50 | (Object **)&cpu->secure_memory, | ||
51 | qdev_prop_allow_set_link_before_realize, | ||
52 | OBJ_PROP_LINK_STRONG, | ||
53 | &error_abort); | ||
54 | -#endif | ||
71 | } | 55 | } |
72 | 56 | ||
73 | + /* | 57 | if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { |
74 | + * Update the pointer address in case table_data->data moves during above | 58 | qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property); |
75 | + * acpi_data_push operations. | 59 | } |
76 | + */ | 60 | +#endif |
77 | + iort = (AcpiIortTable *)(table_data->data + iort_start); | 61 | |
78 | iort->length = cpu_to_le32(iort_length); | 62 | if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { |
79 | 63 | cpu->has_pmu = true; | |
80 | build_header(linker, table_data, (void *)(table_data->data + iort_start), | ||
81 | -- | 64 | -- |
82 | 2.17.1 | 65 | 2.20.1 |
83 | 66 | ||
84 | 67 | diff view generated by jsdifflib |
1 | From: Francisco Iglesias <frasse.iglesias@gmail.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Coverity found that the string return by 'object_get_canonical_path' was not | 3 | We have disabled EL2 and EL3 for user-only, which means that these |
4 | being freed at two locations in the model (CID 1391294 and CID 1391293) and | 4 | registers "don't exist" and should not be set. |
5 | also that a memset was being called with a value greater than the max of a byte | ||
6 | on the second argument (CID 1391286). This patch corrects this by adding the | ||
7 | freeing of the strings and also changing to memset to zero instead on | ||
8 | descriptor unaligned errors. | ||
9 | 5 | ||
10 | Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Message-id: 20200229012811.24129-5-richard.henderson@linaro.org |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180528184859.3530-1-frasse.iglesias@gmail.com | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 10 | --- |
17 | hw/dma/xlnx-zdma.c | 10 +++++++--- | 11 | target/arm/cpu.c | 6 ------ |
18 | 1 file changed, 7 insertions(+), 3 deletions(-) | 12 | 1 file changed, 6 deletions(-) |
19 | 13 | ||
20 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/dma/xlnx-zdma.c | 16 | --- a/target/arm/cpu.c |
23 | +++ b/hw/dma/xlnx-zdma.c | 17 | +++ b/target/arm/cpu.c |
24 | @@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf) | 18 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) |
25 | qemu_log_mask(LOG_GUEST_ERROR, | 19 | /* Enable all PAC keys. */ |
26 | "zdma: unaligned descriptor at %" PRIx64, | 20 | env->cp15.sctlr_el[1] |= (SCTLR_EnIA | SCTLR_EnIB | |
27 | addr); | 21 | SCTLR_EnDA | SCTLR_EnDB); |
28 | - memset(buf, 0xdeadbeef, sizeof(XlnxZDMADescr)); | 22 | - /* Enable all PAC instructions */ |
29 | + memset(buf, 0x0, sizeof(XlnxZDMADescr)); | 23 | - env->cp15.hcr_el2 |= HCR_API; |
30 | s->error = true; | 24 | - env->cp15.scr_el3 |= SCR_API; |
31 | return false; | 25 | /* and to the FP/Neon instructions */ |
32 | } | 26 | env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 20, 2, 3); |
33 | @@ -XXX,XX +XXX,XX @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size) | 27 | /* and to the SVE instructions */ |
34 | RegisterInfo *r = &s->regs_info[addr / 4]; | 28 | env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); |
35 | 29 | - env->cp15.cptr_el[3] |= CPTR_EZ; | |
36 | if (!r->data) { | 30 | /* with maximum vector length */ |
37 | + gchar *path = object_get_canonical_path(OBJECT(s)); | 31 | env->vfp.zcr_el[1] = cpu_isar_feature(aa64_sve, cpu) ? |
38 | qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n", | 32 | cpu->sve_max_vq - 1 : 0; |
39 | - object_get_canonical_path(OBJECT(s)), | 33 | - env->vfp.zcr_el[2] = env->vfp.zcr_el[1]; |
40 | + path, | 34 | - env->vfp.zcr_el[3] = env->vfp.zcr_el[1]; |
41 | addr); | 35 | /* |
42 | + g_free(path); | 36 | * Enable TBI0 and TBI1. While the real kernel only enables TBI0, |
43 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | 37 | * turning on both here will produce smaller code and otherwise |
44 | zdma_ch_imr_update_irq(s); | ||
45 | return 0; | ||
46 | @@ -XXX,XX +XXX,XX @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value, | ||
47 | RegisterInfo *r = &s->regs_info[addr / 4]; | ||
48 | |||
49 | if (!r->data) { | ||
50 | + gchar *path = object_get_canonical_path(OBJECT(s)); | ||
51 | qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n", | ||
52 | - object_get_canonical_path(OBJECT(s)), | ||
53 | + path, | ||
54 | addr, value); | ||
55 | + g_free(path); | ||
56 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | ||
57 | zdma_ch_imr_update_irq(s); | ||
58 | return; | ||
59 | -- | 38 | -- |
60 | 2.17.1 | 39 | 2.20.1 |
61 | 40 | ||
62 | 41 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to | 3 | Update the {TGE,E2H} == '11' masking to ARMv8.6. |
4 | initialize global capability variables. If we call kvm_init_irq_routing in | 4 | If EL2 is configured for aarch32, disable all of |
5 | GIC realize function, previous allocated memory will leak. | 5 | the bits that are RES0 in aarch32 mode. |
6 | 6 | ||
7 | Fix this by deleting the unnecessary call. | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | 8 | Message-id: 20200229012811.24129-6-richard.henderson@linaro.org | |
9 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Message-id: 1527750994-14360-1-git-send-email-zhaoshenglong@huawei.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 11 | --- |
14 | hw/intc/arm_gic_kvm.c | 1 - | 12 | target/arm/helper.c | 31 +++++++++++++++++++++++++++---- |
15 | hw/intc/arm_gicv3_kvm.c | 1 - | 13 | 1 file changed, 27 insertions(+), 4 deletions(-) |
16 | 2 files changed, 2 deletions(-) | ||
17 | 14 | ||
18 | diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/intc/arm_gic_kvm.c | 17 | --- a/target/arm/helper.c |
21 | +++ b/hw/intc/arm_gic_kvm.c | 18 | +++ b/target/arm/helper.c |
22 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) | 19 | @@ -XXX,XX +XXX,XX @@ uint64_t arm_hcr_el2_eff(CPUARMState *env) |
23 | 20 | * Since the v8.4 language applies to the entire register, and | |
24 | if (kvm_has_gsi_routing()) { | 21 | * appears to be backward compatible, use that. |
25 | /* set up irq routing */ | 22 | */ |
26 | - kvm_init_irq_routing(kvm_state); | 23 | - ret = 0; |
27 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 24 | - } else if (ret & HCR_TGE) { |
28 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 25 | - /* These bits are up-to-date as of ARMv8.4. */ |
29 | } | 26 | + return 0; |
30 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 27 | + } |
31 | index XXXXXXX..XXXXXXX 100644 | 28 | + |
32 | --- a/hw/intc/arm_gicv3_kvm.c | 29 | + /* |
33 | +++ b/hw/intc/arm_gicv3_kvm.c | 30 | + * For a cpu that supports both aarch64 and aarch32, we can set bits |
34 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | 31 | + * in HCR_EL2 (e.g. via EL3) that are RES0 when we enter EL2 as aa32. |
35 | 32 | + * Ignore all of the bits in HCR+HCR2 that are not valid for aarch32. | |
36 | if (kvm_has_gsi_routing()) { | 33 | + */ |
37 | /* set up irq routing */ | 34 | + if (!arm_el_is_aa64(env, 2)) { |
38 | - kvm_init_irq_routing(kvm_state); | 35 | + uint64_t aa32_valid; |
39 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 36 | + |
40 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 37 | + /* |
38 | + * These bits are up-to-date as of ARMv8.6. | ||
39 | + * For HCR, it's easiest to list just the 2 bits that are invalid. | ||
40 | + * For HCR2, list those that are valid. | ||
41 | + */ | ||
42 | + aa32_valid = MAKE_64BIT_MASK(0, 32) & ~(HCR_RW | HCR_TDZ); | ||
43 | + aa32_valid |= (HCR_CD | HCR_ID | HCR_TERR | HCR_TEA | HCR_MIOCNCE | | ||
44 | + HCR_TID4 | HCR_TICAB | HCR_TOCU | HCR_TTLBIS); | ||
45 | + ret &= aa32_valid; | ||
46 | + } | ||
47 | + | ||
48 | + if (ret & HCR_TGE) { | ||
49 | + /* These bits are up-to-date as of ARMv8.6. */ | ||
50 | if (ret & HCR_E2H) { | ||
51 | ret &= ~(HCR_VM | HCR_FMO | HCR_IMO | HCR_AMO | | ||
52 | HCR_BSU_MASK | HCR_DC | HCR_TWI | HCR_TWE | | ||
53 | HCR_TID0 | HCR_TID2 | HCR_TPCP | HCR_TPU | | ||
54 | - HCR_TDZ | HCR_CD | HCR_ID | HCR_MIOCNCE); | ||
55 | + HCR_TDZ | HCR_CD | HCR_ID | HCR_MIOCNCE | | ||
56 | + HCR_TID4 | HCR_TICAB | HCR_TOCU | HCR_ENSCXT | | ||
57 | + HCR_TTLBIS | HCR_TTLBOS | HCR_TID5); | ||
58 | } else { | ||
59 | ret |= HCR_FMO | HCR_IMO | HCR_AMO; | ||
41 | } | 60 | } |
42 | -- | 61 | -- |
43 | 2.17.1 | 62 | 2.20.1 |
44 | 63 | ||
45 | 64 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | These bits trap EL1 access to various virtual memory controls. | ||
4 | |||
5 | Buglink: https://bugs.launchpad.net/bugs/1855072 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200229012811.24129-7-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/helper.c | 82 ++++++++++++++++++++++++++++++--------------- | ||
12 | 1 file changed, 55 insertions(+), 27 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/helper.c | ||
17 | +++ b/target/arm/helper.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tpm(CPUARMState *env, const ARMCPRegInfo *ri, | ||
19 | return CP_ACCESS_OK; | ||
20 | } | ||
21 | |||
22 | +/* Check for traps from EL1 due to HCR_EL2.TVM and HCR_EL2.TRVM. */ | ||
23 | +static CPAccessResult access_tvm_trvm(CPUARMState *env, const ARMCPRegInfo *ri, | ||
24 | + bool isread) | ||
25 | +{ | ||
26 | + if (arm_current_el(env) == 1) { | ||
27 | + uint64_t trap = isread ? HCR_TRVM : HCR_TVM; | ||
28 | + if (arm_hcr_el2_eff(env) & trap) { | ||
29 | + return CP_ACCESS_TRAP_EL2; | ||
30 | + } | ||
31 | + } | ||
32 | + return CP_ACCESS_OK; | ||
33 | +} | ||
34 | + | ||
35 | static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
36 | { | ||
37 | ARMCPU *cpu = env_archcpu(env); | ||
38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cp_reginfo[] = { | ||
39 | */ | ||
40 | { .name = "CONTEXTIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
41 | .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, | ||
42 | - .access = PL1_RW, .secure = ARM_CP_SECSTATE_NS, | ||
43 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
44 | + .secure = ARM_CP_SECSTATE_NS, | ||
45 | .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[1]), | ||
46 | .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, | ||
47 | { .name = "CONTEXTIDR_S", .state = ARM_CP_STATE_AA32, | ||
48 | .cp = 15, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, | ||
49 | - .access = PL1_RW, .secure = ARM_CP_SECSTATE_S, | ||
50 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
51 | + .secure = ARM_CP_SECSTATE_S, | ||
52 | .fieldoffset = offsetof(CPUARMState, cp15.contextidr_s), | ||
53 | .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, | ||
54 | REGINFO_SENTINEL | ||
55 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = { | ||
56 | /* MMU Domain access control / MPU write buffer control */ | ||
57 | { .name = "DACR", | ||
58 | .cp = 15, .opc1 = CP_ANY, .crn = 3, .crm = CP_ANY, .opc2 = CP_ANY, | ||
59 | - .access = PL1_RW, .resetvalue = 0, | ||
60 | + .access = PL1_RW, .accessfn = access_tvm_trvm, .resetvalue = 0, | ||
61 | .writefn = dacr_write, .raw_writefn = raw_write, | ||
62 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dacr_s), | ||
63 | offsetoflow32(CPUARMState, cp15.dacr_ns) } }, | ||
64 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { | ||
65 | { .name = "DMB", .cp = 15, .crn = 7, .crm = 10, .opc1 = 0, .opc2 = 5, | ||
66 | .access = PL0_W, .type = ARM_CP_NOP }, | ||
67 | { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 2, | ||
68 | - .access = PL1_RW, | ||
69 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
70 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ifar_s), | ||
71 | offsetof(CPUARMState, cp15.ifar_ns) }, | ||
72 | .resetvalue = 0, }, | ||
73 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
74 | */ | ||
75 | { .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH, | ||
76 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 0, | ||
77 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
78 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
79 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
80 | { .name = "AFSR1_EL1", .state = ARM_CP_STATE_BOTH, | ||
81 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1, | ||
82 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
83 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
84 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
85 | /* MAIR can just read-as-written because we don't implement caches | ||
86 | * and so don't need to care about memory attributes. | ||
87 | */ | ||
88 | { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, | ||
89 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, | ||
90 | - .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), | ||
91 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
92 | + .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), | ||
93 | .resetvalue = 0 }, | ||
94 | { .name = "MAIR_EL3", .state = ARM_CP_STATE_AA64, | ||
95 | .opc0 = 3, .opc1 = 6, .crn = 10, .crm = 2, .opc2 = 0, | ||
96 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
97 | * handled in the field definitions. | ||
98 | */ | ||
99 | { .name = "MAIR0", .state = ARM_CP_STATE_AA32, | ||
100 | - .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, .access = PL1_RW, | ||
101 | + .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, | ||
102 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
103 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair0_s), | ||
104 | offsetof(CPUARMState, cp15.mair0_ns) }, | ||
105 | .resetfn = arm_cp_reset_ignore }, | ||
106 | { .name = "MAIR1", .state = ARM_CP_STATE_AA32, | ||
107 | - .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 1, .access = PL1_RW, | ||
108 | + .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 1, | ||
109 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
110 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair1_s), | ||
111 | offsetof(CPUARMState, cp15.mair1_ns) }, | ||
112 | .resetfn = arm_cp_reset_ignore }, | ||
113 | @@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
114 | |||
115 | static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { | ||
116 | { .name = "DFSR", .cp = 15, .crn = 5, .crm = 0, .opc1 = 0, .opc2 = 0, | ||
117 | - .access = PL1_RW, .type = ARM_CP_ALIAS, | ||
118 | + .access = PL1_RW, .accessfn = access_tvm_trvm, .type = ARM_CP_ALIAS, | ||
119 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dfsr_s), | ||
120 | offsetoflow32(CPUARMState, cp15.dfsr_ns) }, }, | ||
121 | { .name = "IFSR", .cp = 15, .crn = 5, .crm = 0, .opc1 = 0, .opc2 = 1, | ||
122 | - .access = PL1_RW, .resetvalue = 0, | ||
123 | + .access = PL1_RW, .accessfn = access_tvm_trvm, .resetvalue = 0, | ||
124 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.ifsr_s), | ||
125 | offsetoflow32(CPUARMState, cp15.ifsr_ns) } }, | ||
126 | { .name = "DFAR", .cp = 15, .opc1 = 0, .crn = 6, .crm = 0, .opc2 = 0, | ||
127 | - .access = PL1_RW, .resetvalue = 0, | ||
128 | + .access = PL1_RW, .accessfn = access_tvm_trvm, .resetvalue = 0, | ||
129 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.dfar_s), | ||
130 | offsetof(CPUARMState, cp15.dfar_ns) } }, | ||
131 | { .name = "FAR_EL1", .state = ARM_CP_STATE_AA64, | ||
132 | .opc0 = 3, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 0, | ||
133 | - .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), | ||
134 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
135 | + .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), | ||
136 | .resetvalue = 0, }, | ||
137 | REGINFO_SENTINEL | ||
138 | }; | ||
139 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { | ||
140 | static const ARMCPRegInfo vmsa_cp_reginfo[] = { | ||
141 | { .name = "ESR_EL1", .state = ARM_CP_STATE_AA64, | ||
142 | .opc0 = 3, .crn = 5, .crm = 2, .opc1 = 0, .opc2 = 0, | ||
143 | - .access = PL1_RW, | ||
144 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
145 | .fieldoffset = offsetof(CPUARMState, cp15.esr_el[1]), .resetvalue = 0, }, | ||
146 | { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, | ||
147 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, | ||
148 | - .access = PL1_RW, .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
149 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
150 | + .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
151 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), | ||
152 | offsetof(CPUARMState, cp15.ttbr0_ns) } }, | ||
153 | { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, | ||
154 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, | ||
155 | - .access = PL1_RW, .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
156 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
157 | + .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
158 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), | ||
159 | offsetof(CPUARMState, cp15.ttbr1_ns) } }, | ||
160 | { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64, | ||
161 | .opc0 = 3, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 2, | ||
162 | - .access = PL1_RW, .writefn = vmsa_tcr_el12_write, | ||
163 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
164 | + .writefn = vmsa_tcr_el12_write, | ||
165 | .resetfn = vmsa_ttbcr_reset, .raw_writefn = raw_write, | ||
166 | .fieldoffset = offsetof(CPUARMState, cp15.tcr_el[1]) }, | ||
167 | { .name = "TTBCR", .cp = 15, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 2, | ||
168 | - .access = PL1_RW, .type = ARM_CP_ALIAS, .writefn = vmsa_ttbcr_write, | ||
169 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
170 | + .type = ARM_CP_ALIAS, .writefn = vmsa_ttbcr_write, | ||
171 | .raw_writefn = vmsa_ttbcr_raw_write, | ||
172 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tcr_el[3]), | ||
173 | offsetoflow32(CPUARMState, cp15.tcr_el[1])} }, | ||
174 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { | ||
175 | */ | ||
176 | static const ARMCPRegInfo ttbcr2_reginfo = { | ||
177 | .name = "TTBCR2", .cp = 15, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 3, | ||
178 | - .access = PL1_RW, .type = ARM_CP_ALIAS, | ||
179 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
180 | + .type = ARM_CP_ALIAS, | ||
181 | .bank_fieldoffsets = { offsetofhigh32(CPUARMState, cp15.tcr_el[3]), | ||
182 | offsetofhigh32(CPUARMState, cp15.tcr_el[1]) }, | ||
183 | }; | ||
184 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { | ||
185 | /* NOP AMAIR0/1 */ | ||
186 | { .name = "AMAIR0", .state = ARM_CP_STATE_BOTH, | ||
187 | .opc0 = 3, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 0, | ||
188 | - .access = PL1_RW, .type = ARM_CP_CONST, | ||
189 | - .resetvalue = 0 }, | ||
190 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
191 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
192 | /* AMAIR1 is mapped to AMAIR_EL1[63:32] */ | ||
193 | { .name = "AMAIR1", .cp = 15, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 1, | ||
194 | - .access = PL1_RW, .type = ARM_CP_CONST, | ||
195 | - .resetvalue = 0 }, | ||
196 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
197 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
198 | { .name = "PAR", .cp = 15, .crm = 7, .opc1 = 0, | ||
199 | .access = PL1_RW, .type = ARM_CP_64BIT, .resetvalue = 0, | ||
200 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.par_s), | ||
201 | offsetof(CPUARMState, cp15.par_ns)} }, | ||
202 | { .name = "TTBR0", .cp = 15, .crm = 2, .opc1 = 0, | ||
203 | - .access = PL1_RW, .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
204 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
205 | + .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
206 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), | ||
207 | offsetof(CPUARMState, cp15.ttbr0_ns) }, | ||
208 | .writefn = vmsa_ttbr_write, }, | ||
209 | { .name = "TTBR1", .cp = 15, .crm = 2, .opc1 = 1, | ||
210 | - .access = PL1_RW, .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
211 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
212 | + .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
213 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), | ||
214 | offsetof(CPUARMState, cp15.ttbr1_ns) }, | ||
215 | .writefn = vmsa_ttbr_write, }, | ||
216 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
217 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
218 | /* MMU Domain access control / MPU write buffer control */ | ||
219 | { .name = "DACR", .cp = 15, .opc1 = 0, .crn = 3, .crm = 0, .opc2 = 0, | ||
220 | - .access = PL1_RW, .resetvalue = 0, | ||
221 | + .access = PL1_RW, .accessfn = access_tvm_trvm, .resetvalue = 0, | ||
222 | .writefn = dacr_write, .raw_writefn = raw_write, | ||
223 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dacr_s), | ||
224 | offsetoflow32(CPUARMState, cp15.dacr_ns) } }, | ||
225 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
226 | ARMCPRegInfo sctlr = { | ||
227 | .name = "SCTLR", .state = ARM_CP_STATE_BOTH, | ||
228 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 0, | ||
229 | - .access = PL1_RW, | ||
230 | + .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
231 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.sctlr_s), | ||
232 | offsetof(CPUARMState, cp15.sctlr_ns) }, | ||
233 | .writefn = sctlr_write, .resetvalue = cpu->reset_sctlr, | ||
234 | -- | ||
235 | 2.20.1 | ||
236 | |||
237 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | These bits trap EL1 access to set/way cache maintenance insns. | ||
4 | |||
5 | Buglink: https://bugs.launchpad.net/bugs/1863685 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200229012811.24129-8-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/helper.c | 22 ++++++++++++++++------ | ||
12 | 1 file changed, 16 insertions(+), 6 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/helper.c | ||
17 | +++ b/target/arm/helper.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tvm_trvm(CPUARMState *env, const ARMCPRegInfo *ri, | ||
19 | return CP_ACCESS_OK; | ||
20 | } | ||
21 | |||
22 | +/* Check for traps from EL1 due to HCR_EL2.TSW. */ | ||
23 | +static CPAccessResult access_tsw(CPUARMState *env, const ARMCPRegInfo *ri, | ||
24 | + bool isread) | ||
25 | +{ | ||
26 | + if (arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_TSW)) { | ||
27 | + return CP_ACCESS_TRAP_EL2; | ||
28 | + } | ||
29 | + return CP_ACCESS_OK; | ||
30 | +} | ||
31 | + | ||
32 | static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
33 | { | ||
34 | ARMCPU *cpu = env_archcpu(env); | ||
35 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
36 | .access = PL1_W, .type = ARM_CP_NOP }, | ||
37 | { .name = "DC_ISW", .state = ARM_CP_STATE_AA64, | ||
38 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, | ||
39 | - .access = PL1_W, .type = ARM_CP_NOP }, | ||
40 | + .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
41 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, | ||
42 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, | ||
43 | .access = PL0_W, .type = ARM_CP_NOP, | ||
44 | .accessfn = aa64_cacheop_access }, | ||
45 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, | ||
46 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, | ||
47 | - .access = PL1_W, .type = ARM_CP_NOP }, | ||
48 | + .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
49 | { .name = "DC_CVAU", .state = ARM_CP_STATE_AA64, | ||
50 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1, | ||
51 | .access = PL0_W, .type = ARM_CP_NOP, | ||
52 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
53 | .accessfn = aa64_cacheop_access }, | ||
54 | { .name = "DC_CISW", .state = ARM_CP_STATE_AA64, | ||
55 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | ||
56 | - .access = PL1_W, .type = ARM_CP_NOP }, | ||
57 | + .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, | ||
58 | /* TLBI operations */ | ||
59 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, | ||
60 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, | ||
61 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
62 | { .name = "DCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, | ||
63 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
64 | { .name = "DCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, | ||
65 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
66 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
67 | { .name = "DCCMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 1, | ||
68 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
69 | { .name = "DCCSW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, | ||
70 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
71 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
72 | { .name = "DCCMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 11, .opc2 = 1, | ||
73 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
74 | { .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1, | ||
75 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
76 | { .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | ||
77 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
78 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
79 | /* MMU Domain access control / MPU write buffer control */ | ||
80 | { .name = "DACR", .cp = 15, .opc1 = 0, .crn = 3, .crm = 0, .opc2 = 0, | ||
81 | .access = PL1_RW, .accessfn = access_tvm_trvm, .resetvalue = 0, | ||
82 | -- | ||
83 | 2.20.1 | ||
84 | |||
85 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This bit traps EL1 access to the auxiliary control registers. | ||
4 | |||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20200229012811.24129-9-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/helper.c | 18 ++++++++++++++---- | ||
11 | 1 file changed, 14 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/helper.c | ||
16 | +++ b/target/arm/helper.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tsw(CPUARMState *env, const ARMCPRegInfo *ri, | ||
18 | return CP_ACCESS_OK; | ||
19 | } | ||
20 | |||
21 | +/* Check for traps from EL1 due to HCR_EL2.TACR. */ | ||
22 | +static CPAccessResult access_tacr(CPUARMState *env, const ARMCPRegInfo *ri, | ||
23 | + bool isread) | ||
24 | +{ | ||
25 | + if (arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_TACR)) { | ||
26 | + return CP_ACCESS_TRAP_EL2; | ||
27 | + } | ||
28 | + return CP_ACCESS_OK; | ||
29 | +} | ||
30 | + | ||
31 | static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
32 | { | ||
33 | ARMCPU *cpu = env_archcpu(env); | ||
34 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo ats1cp_reginfo[] = { | ||
35 | static const ARMCPRegInfo actlr2_hactlr2_reginfo[] = { | ||
36 | { .name = "ACTLR2", .state = ARM_CP_STATE_AA32, | ||
37 | .cp = 15, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 3, | ||
38 | - .access = PL1_RW, .type = ARM_CP_CONST, | ||
39 | - .resetvalue = 0 }, | ||
40 | + .access = PL1_RW, .accessfn = access_tacr, | ||
41 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
42 | { .name = "HACTLR2", .state = ARM_CP_STATE_AA32, | ||
43 | .cp = 15, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 3, | ||
44 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
45 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
46 | ARMCPRegInfo auxcr_reginfo[] = { | ||
47 | { .name = "ACTLR_EL1", .state = ARM_CP_STATE_BOTH, | ||
48 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 1, | ||
49 | - .access = PL1_RW, .type = ARM_CP_CONST, | ||
50 | - .resetvalue = cpu->reset_auxcr }, | ||
51 | + .access = PL1_RW, .accessfn = access_tacr, | ||
52 | + .type = ARM_CP_CONST, .resetvalue = cpu->reset_auxcr }, | ||
53 | { .name = "ACTLR_EL2", .state = ARM_CP_STATE_BOTH, | ||
54 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 1, | ||
55 | .access = PL2_RW, .type = ARM_CP_CONST, | ||
56 | -- | ||
57 | 2.20.1 | ||
58 | |||
59 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_get_iotlb_entry(). | ||
3 | 2 | ||
3 | This bit traps EL1 access to cache maintenance insns that operate | ||
4 | to the point of coherency or persistence. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200229012811.24129-10-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180521140402.23318-12-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | include/exec/memory.h | 2 +- | 11 | target/arm/helper.c | 39 +++++++++++++++++++++++++++++++-------- |
10 | exec.c | 2 +- | 12 | 1 file changed, 31 insertions(+), 8 deletions(-) |
11 | hw/virtio/vhost.c | 3 ++- | ||
12 | 3 files changed, 4 insertions(+), 3 deletions(-) | ||
13 | 13 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 14 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 16 | --- a/target/arm/helper.c |
17 | +++ b/include/exec/memory.h | 17 | +++ b/target/arm/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache); | 18 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult aa64_cacheop_access(CPUARMState *env, |
19 | * entry. Should be called from an RCU critical section. | 19 | return CP_ACCESS_OK; |
20 | } | ||
21 | |||
22 | +static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env, | ||
23 | + const ARMCPRegInfo *ri, | ||
24 | + bool isread) | ||
25 | +{ | ||
26 | + /* Cache invalidate/clean to Point of Coherency or Persistence... */ | ||
27 | + switch (arm_current_el(env)) { | ||
28 | + case 0: | ||
29 | + /* ... EL0 must UNDEF unless SCTLR_EL1.UCI is set. */ | ||
30 | + if (!(arm_sctlr(env, 0) & SCTLR_UCI)) { | ||
31 | + return CP_ACCESS_TRAP; | ||
32 | + } | ||
33 | + /* fall through */ | ||
34 | + case 1: | ||
35 | + /* ... EL1 must trap to EL2 if HCR_EL2.TPCP is set. */ | ||
36 | + if (arm_hcr_el2_eff(env) & HCR_TPCP) { | ||
37 | + return CP_ACCESS_TRAP_EL2; | ||
38 | + } | ||
39 | + break; | ||
40 | + } | ||
41 | + return CP_ACCESS_OK; | ||
42 | +} | ||
43 | + | ||
44 | /* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions | ||
45 | * Page D4-1736 (DDI0487A.b) | ||
20 | */ | 46 | */ |
21 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 47 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
22 | - bool is_write); | 48 | .accessfn = aa64_cacheop_access }, |
23 | + bool is_write, MemTxAttrs attrs); | 49 | { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, |
24 | 50 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, | |
25 | /* address_space_translate: translate an address range into an address space | 51 | - .access = PL1_W, .type = ARM_CP_NOP }, |
26 | * into a MemoryRegion and an address range into that section. Should be | 52 | + .access = PL1_W, .accessfn = aa64_cacheop_poc_access, |
27 | diff --git a/exec.c b/exec.c | 53 | + .type = ARM_CP_NOP }, |
28 | index XXXXXXX..XXXXXXX 100644 | 54 | { .name = "DC_ISW", .state = ARM_CP_STATE_AA64, |
29 | --- a/exec.c | 55 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, |
30 | +++ b/exec.c | 56 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
31 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 57 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, |
32 | 58 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, | |
33 | /* Called from RCU critical section */ | 59 | .access = PL0_W, .type = ARM_CP_NOP, |
34 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 60 | - .accessfn = aa64_cacheop_access }, |
35 | - bool is_write) | 61 | + .accessfn = aa64_cacheop_poc_access }, |
36 | + bool is_write, MemTxAttrs attrs) | 62 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, |
37 | { | 63 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, |
38 | MemoryRegionSection section; | 64 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
39 | hwaddr xlat, page_mask; | 65 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
40 | diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c | 66 | { .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64, |
41 | index XXXXXXX..XXXXXXX 100644 | 67 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1, |
42 | --- a/hw/virtio/vhost.c | 68 | .access = PL0_W, .type = ARM_CP_NOP, |
43 | +++ b/hw/virtio/vhost.c | 69 | - .accessfn = aa64_cacheop_access }, |
44 | @@ -XXX,XX +XXX,XX @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write) | 70 | + .accessfn = aa64_cacheop_poc_access }, |
45 | trace_vhost_iotlb_miss(dev, 1); | 71 | { .name = "DC_CISW", .state = ARM_CP_STATE_AA64, |
46 | 72 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | |
47 | iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as, | 73 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
48 | - iova, write); | 74 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
49 | + iova, write, | 75 | { .name = "BPIMVA", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 7, |
50 | + MEMTXATTRS_UNSPECIFIED); | 76 | .type = ARM_CP_NOP, .access = PL1_W }, |
51 | if (iotlb.target_as != NULL) { | 77 | { .name = "DCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, |
52 | ret = vhost_memory_region_lookup(dev, iotlb.translated_addr, | 78 | - .type = ARM_CP_NOP, .access = PL1_W }, |
53 | &uaddr, &len); | 79 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access }, |
80 | { .name = "DCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, | ||
81 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
82 | { .name = "DCCMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 1, | ||
83 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
84 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access }, | ||
85 | { .name = "DCCSW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, | ||
86 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
87 | { .name = "DCCMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 11, .opc2 = 1, | ||
88 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
89 | { .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1, | ||
90 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
91 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access }, | ||
92 | { .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | ||
93 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
94 | /* MMU Domain access control / MPU write buffer control */ | ||
95 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpop_reg[] = { | ||
96 | { .name = "DC_CVAP", .state = ARM_CP_STATE_AA64, | ||
97 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1, | ||
98 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, | ||
99 | - .accessfn = aa64_cacheop_access, .writefn = dccvap_writefn }, | ||
100 | + .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, | ||
101 | REGINFO_SENTINEL | ||
102 | }; | ||
103 | |||
104 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpodp_reg[] = { | ||
105 | { .name = "DC_CVADP", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1, | ||
107 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, | ||
108 | - .accessfn = aa64_cacheop_access, .writefn = dccvap_writefn }, | ||
109 | + .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, | ||
110 | REGINFO_SENTINEL | ||
111 | }; | ||
112 | #endif /*CONFIG_USER_ONLY*/ | ||
54 | -- | 113 | -- |
55 | 2.17.1 | 114 | 2.20.1 |
56 | 115 | ||
57 | 116 | diff view generated by jsdifflib |
1 | Add more detail to the documentation for memory_region_init_iommu() | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | and other IOMMU-related functions and data structures. | ||
3 | 2 | ||
3 | This bit traps EL1 access to cache maintenance insns that operate | ||
4 | to the point of unification. There are no longer any references to | ||
5 | plain aa64_cacheop_access, so remove it. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200229012811.24129-11-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Message-id: 20180521140402.23318-2-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | include/exec/memory.h | 105 ++++++++++++++++++++++++++++++++++++++---- | 12 | target/arm/helper.c | 53 +++++++++++++++++++++++++++------------------ |
11 | 1 file changed, 95 insertions(+), 10 deletions(-) | 13 | 1 file changed, 32 insertions(+), 21 deletions(-) |
12 | 14 | ||
13 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/exec/memory.h | 17 | --- a/target/arm/helper.c |
16 | +++ b/include/exec/memory.h | 18 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ enum IOMMUMemoryRegionAttr { | 19 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo uao_reginfo = { |
18 | IOMMU_ATTR_SPAPR_TCE_FD | 20 | .readfn = aa64_uao_read, .writefn = aa64_uao_write |
19 | }; | 21 | }; |
20 | 22 | ||
21 | +/** | 23 | -static CPAccessResult aa64_cacheop_access(CPUARMState *env, |
22 | + * IOMMUMemoryRegionClass: | 24 | - const ARMCPRegInfo *ri, |
23 | + * | 25 | - bool isread) |
24 | + * All IOMMU implementations need to subclass TYPE_IOMMU_MEMORY_REGION | 26 | -{ |
25 | + * and provide an implementation of at least the @translate method here | 27 | - /* Cache invalidate/clean: NOP, but EL0 must UNDEF unless |
26 | + * to handle requests to the memory region. Other methods are optional. | 28 | - * SCTLR_EL1.UCI is set. |
27 | + * | 29 | - */ |
28 | + * The IOMMU implementation must use the IOMMU notifier infrastructure | 30 | - if (arm_current_el(env) == 0 && !(arm_sctlr(env, 0) & SCTLR_UCI)) { |
29 | + * to report whenever mappings are changed, by calling | 31 | - return CP_ACCESS_TRAP; |
30 | + * memory_region_notify_iommu() (or, if necessary, by calling | 32 | - } |
31 | + * memory_region_notify_one() for each registered notifier). | 33 | - return CP_ACCESS_OK; |
32 | + */ | 34 | -} |
33 | typedef struct IOMMUMemoryRegionClass { | 35 | - |
34 | /* private */ | 36 | static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env, |
35 | struct DeviceClass parent_class; | 37 | const ARMCPRegInfo *ri, |
36 | 38 | bool isread) | |
37 | /* | 39 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env, |
38 | - * Return a TLB entry that contains a given address. Flag should | 40 | return CP_ACCESS_OK; |
39 | - * be the access permission of this translation operation. We can | 41 | } |
40 | - * set flag to IOMMU_NONE to mean that we don't need any | 42 | |
41 | - * read/write permission checks, like, when for region replay. | 43 | +static CPAccessResult aa64_cacheop_pou_access(CPUARMState *env, |
42 | + * Return a TLB entry that contains a given address. | 44 | + const ARMCPRegInfo *ri, |
43 | + * | 45 | + bool isread) |
44 | + * The IOMMUAccessFlags indicated via @flag are optional and may | 46 | +{ |
45 | + * be specified as IOMMU_NONE to indicate that the caller needs | 47 | + /* Cache invalidate/clean to Point of Unification... */ |
46 | + * the full translation information for both reads and writes. If | 48 | + switch (arm_current_el(env)) { |
47 | + * the access flags are specified then the IOMMU implementation | 49 | + case 0: |
48 | + * may use this as an optimization, to stop doing a page table | 50 | + /* ... EL0 must UNDEF unless SCTLR_EL1.UCI is set. */ |
49 | + * walk as soon as it knows that the requested permissions are not | 51 | + if (!(arm_sctlr(env, 0) & SCTLR_UCI)) { |
50 | + * allowed. If IOMMU_NONE is passed then the IOMMU must do the | 52 | + return CP_ACCESS_TRAP; |
51 | + * full page table walk and report the permissions in the returned | 53 | + } |
52 | + * IOMMUTLBEntry. (Note that this implies that an IOMMU may not | 54 | + /* fall through */ |
53 | + * return different mappings for reads and writes.) | 55 | + case 1: |
54 | + * | 56 | + /* ... EL1 must trap to EL2 if HCR_EL2.TPU is set. */ |
55 | + * The returned information remains valid while the caller is | 57 | + if (arm_hcr_el2_eff(env) & HCR_TPU) { |
56 | + * holding the big QEMU lock or is inside an RCU critical section; | 58 | + return CP_ACCESS_TRAP_EL2; |
57 | + * if the caller wishes to cache the mapping beyond that it must | 59 | + } |
58 | + * register an IOMMU notifier so it can invalidate its cached | 60 | + break; |
59 | + * information when the IOMMU mapping changes. | 61 | + } |
60 | + * | 62 | + return CP_ACCESS_OK; |
61 | + * @iommu: the IOMMUMemoryRegion | 63 | +} |
62 | + * @hwaddr: address to be translated within the memory region | 64 | + |
63 | + * @flag: requested access permissions | 65 | /* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions |
64 | */ | 66 | * Page D4-1736 (DDI0487A.b) |
65 | IOMMUTLBEntry (*translate)(IOMMUMemoryRegion *iommu, hwaddr addr, | ||
66 | IOMMUAccessFlags flag); | ||
67 | - /* Returns minimum supported page size */ | ||
68 | + /* Returns minimum supported page size in bytes. | ||
69 | + * If this method is not provided then the minimum is assumed to | ||
70 | + * be TARGET_PAGE_SIZE. | ||
71 | + * | ||
72 | + * @iommu: the IOMMUMemoryRegion | ||
73 | + */ | ||
74 | uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu); | ||
75 | - /* Called when IOMMU Notifier flag changed */ | ||
76 | + /* Called when IOMMU Notifier flag changes (ie when the set of | ||
77 | + * events which IOMMU users are requesting notification for changes). | ||
78 | + * Optional method -- need not be provided if the IOMMU does not | ||
79 | + * need to know exactly which events must be notified. | ||
80 | + * | ||
81 | + * @iommu: the IOMMUMemoryRegion | ||
82 | + * @old_flags: events which previously needed to be notified | ||
83 | + * @new_flags: events which now need to be notified | ||
84 | + */ | ||
85 | void (*notify_flag_changed)(IOMMUMemoryRegion *iommu, | ||
86 | IOMMUNotifierFlag old_flags, | ||
87 | IOMMUNotifierFlag new_flags); | ||
88 | - /* Set this up to provide customized IOMMU replay function */ | ||
89 | + /* Called to handle memory_region_iommu_replay(). | ||
90 | + * | ||
91 | + * The default implementation of memory_region_iommu_replay() is to | ||
92 | + * call the IOMMU translate method for every page in the address space | ||
93 | + * with flag == IOMMU_NONE and then call the notifier if translate | ||
94 | + * returns a valid mapping. If this method is implemented then it | ||
95 | + * overrides the default behaviour, and must provide the full semantics | ||
96 | + * of memory_region_iommu_replay(), by calling @notifier for every | ||
97 | + * translation present in the IOMMU. | ||
98 | + * | ||
99 | + * Optional method -- an IOMMU only needs to provide this method | ||
100 | + * if the default is inefficient or produces undesirable side effects. | ||
101 | + * | ||
102 | + * Note: this is not related to record-and-replay functionality. | ||
103 | + */ | ||
104 | void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier); | ||
105 | |||
106 | - /* Get IOMMU misc attributes */ | ||
107 | - int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr, | ||
108 | + /* Get IOMMU misc attributes. This is an optional method that | ||
109 | + * can be used to allow users of the IOMMU to get implementation-specific | ||
110 | + * information. The IOMMU implements this method to handle calls | ||
111 | + * by IOMMU users to memory_region_iommu_get_attr() by filling in | ||
112 | + * the arbitrary data pointer for any IOMMUMemoryRegionAttr values that | ||
113 | + * the IOMMU supports. If the method is unimplemented then | ||
114 | + * memory_region_iommu_get_attr() will always return -EINVAL. | ||
115 | + * | ||
116 | + * @iommu: the IOMMUMemoryRegion | ||
117 | + * @attr: attribute being queried | ||
118 | + * @data: memory to fill in with the attribute data | ||
119 | + * | ||
120 | + * Returns 0 on success, or a negative errno; in particular | ||
121 | + * returns -EINVAL for unrecognized or unimplemented attribute types. | ||
122 | + */ | ||
123 | + int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr, | ||
124 | void *data); | ||
125 | } IOMMUMemoryRegionClass; | ||
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static inline void memory_region_init_reservation(MemoryRegion *mr, | ||
128 | * An IOMMU region translates addresses and forwards accesses to a target | ||
129 | * memory region. | ||
130 | * | ||
131 | + * The IOMMU implementation must define a subclass of TYPE_IOMMU_MEMORY_REGION. | ||
132 | + * @_iommu_mr should be a pointer to enough memory for an instance of | ||
133 | + * that subclass, @instance_size is the size of that subclass, and | ||
134 | + * @mrtypename is its name. This function will initialize @_iommu_mr as an | ||
135 | + * instance of the subclass, and its methods will then be called to handle | ||
136 | + * accesses to the memory region. See the documentation of | ||
137 | + * #IOMMUMemoryRegionClass for further details. | ||
138 | + * | ||
139 | * @_iommu_mr: the #IOMMUMemoryRegion to be initialized | ||
140 | * @instance_size: the IOMMUMemoryRegion subclass instance size | ||
141 | * @mrtypename: the type name of the #IOMMUMemoryRegion | ||
142 | @@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, | ||
143 | * a notifier with the minimum page granularity returned by | ||
144 | * mr->iommu_ops->get_page_size(). | ||
145 | * | ||
146 | + * Note: this is not related to record-and-replay functionality. | ||
147 | + * | ||
148 | * @iommu_mr: the memory region to observe | ||
149 | * @n: the notifier to which to replay iommu mappings | ||
150 | */ | 67 | */ |
151 | @@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n); | 68 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
152 | * memory_region_iommu_replay_all: replay existing IOMMU translations | 69 | /* Cache ops: all NOPs since we don't emulate caches */ |
153 | * to all the notifiers registered. | 70 | { .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64, |
154 | * | 71 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, |
155 | + * Note: this is not related to record-and-replay functionality. | 72 | - .access = PL1_W, .type = ARM_CP_NOP }, |
156 | + * | 73 | + .access = PL1_W, .type = ARM_CP_NOP, |
157 | * @iommu_mr: the memory region to observe | 74 | + .accessfn = aa64_cacheop_pou_access }, |
158 | */ | 75 | { .name = "IC_IALLU", .state = ARM_CP_STATE_AA64, |
159 | void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr); | 76 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0, |
160 | @@ -XXX,XX +XXX,XX @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, | 77 | - .access = PL1_W, .type = ARM_CP_NOP }, |
161 | * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is | 78 | + .access = PL1_W, .type = ARM_CP_NOP, |
162 | * defined on the IOMMU. | 79 | + .accessfn = aa64_cacheop_pou_access }, |
163 | * | 80 | { .name = "IC_IVAU", .state = ARM_CP_STATE_AA64, |
164 | - * Returns 0 if succeded, error code otherwise. | 81 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1, |
165 | + * Returns 0 on success, or a negative errno otherwise. In particular, | 82 | .access = PL0_W, .type = ARM_CP_NOP, |
166 | + * -EINVAL indicates that the IOMMU does not support the requested | 83 | - .accessfn = aa64_cacheop_access }, |
167 | + * attribute. | 84 | + .accessfn = aa64_cacheop_pou_access }, |
168 | * | 85 | { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, |
169 | * @iommu_mr: the memory region | 86 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, |
170 | * @attr: the requested attribute | 87 | .access = PL1_W, .accessfn = aa64_cacheop_poc_access, |
88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
89 | { .name = "DC_CVAU", .state = ARM_CP_STATE_AA64, | ||
90 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1, | ||
91 | .access = PL0_W, .type = ARM_CP_NOP, | ||
92 | - .accessfn = aa64_cacheop_access }, | ||
93 | + .accessfn = aa64_cacheop_pou_access }, | ||
94 | { .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64, | ||
95 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1, | ||
96 | .access = PL0_W, .type = ARM_CP_NOP, | ||
97 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
98 | .writefn = tlbiipas2_is_write }, | ||
99 | /* 32 bit cache operations */ | ||
100 | { .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | ||
101 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
102 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
103 | { .name = "BPIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 6, | ||
104 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
105 | { .name = "ICIALLU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0, | ||
106 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
107 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
108 | { .name = "ICIMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 1, | ||
109 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
110 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
111 | { .name = "BPIALL", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 6, | ||
112 | .type = ARM_CP_NOP, .access = PL1_W }, | ||
113 | { .name = "BPIMVA", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 7, | ||
114 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
115 | { .name = "DCCSW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, | ||
116 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
117 | { .name = "DCCMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 11, .opc2 = 1, | ||
118 | - .type = ARM_CP_NOP, .access = PL1_W }, | ||
119 | + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
120 | { .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1, | ||
121 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access }, | ||
122 | { .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, | ||
171 | -- | 123 | -- |
172 | 2.17.1 | 124 | 2.20.1 |
173 | 125 | ||
174 | 126 | diff view generated by jsdifflib |
1 | In commit f0aff255700 we made cpacr_write() enforce that some CPACR | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately | ||
3 | we forgot to also update the register's reset value. The effect | ||
4 | was that (a) a guest that read CPACR on reset would not see ones in | ||
5 | the RAO bits, and (b) if you did a migration before the guest did | ||
6 | a write to the CPACR then the migration would fail because the | ||
7 | destination would enforce the RAO bits and then complain that they | ||
8 | didn't match the zero value from the source. | ||
9 | 2 | ||
10 | Implement reset for the CPACR using a custom reset function | 3 | This bit traps EL1 access to tlb maintenance insns. |
11 | that just calls cpacr_write(), to avoid having to duplicate | ||
12 | the logic for which bits are RAO. | ||
13 | 4 | ||
14 | This bug would affect migration for TCG CPUs which are ARMv7 | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | with VFP but without one of Neon or VFPv3. | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
16 | 7 | Message-id: 20200229012811.24129-12-richard.henderson@linaro.org | |
17 | Reported-by: Cédric Le Goater <clg@kaod.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
20 | Message-id: 20180522173713.26282-1-peter.maydell@linaro.org | ||
21 | --- | 9 | --- |
22 | target/arm/helper.c | 10 +++++++++- | 10 | target/arm/helper.c | 85 +++++++++++++++++++++++++++++---------------- |
23 | 1 file changed, 9 insertions(+), 1 deletion(-) | 11 | 1 file changed, 55 insertions(+), 30 deletions(-) |
24 | 12 | ||
25 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
26 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/helper.c | 15 | --- a/target/arm/helper.c |
28 | +++ b/target/arm/helper.c | 16 | +++ b/target/arm/helper.c |
29 | @@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 17 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tacr(CPUARMState *env, const ARMCPRegInfo *ri, |
30 | env->cp15.cpacr_el1 = value; | 18 | return CP_ACCESS_OK; |
31 | } | 19 | } |
32 | 20 | ||
33 | +static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri) | 21 | +/* Check for traps from EL1 due to HCR_EL2.TTLB. */ |
22 | +static CPAccessResult access_ttlb(CPUARMState *env, const ARMCPRegInfo *ri, | ||
23 | + bool isread) | ||
34 | +{ | 24 | +{ |
35 | + /* Call cpacr_write() so that we reset with the correct RAO bits set | 25 | + if (arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_TTLB)) { |
36 | + * for our CPU features. | 26 | + return CP_ACCESS_TRAP_EL2; |
37 | + */ | 27 | + } |
38 | + cpacr_write(env, ri, 0); | 28 | + return CP_ACCESS_OK; |
39 | +} | 29 | +} |
40 | + | 30 | + |
41 | static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 31 | static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) |
42 | bool isread) | ||
43 | { | 32 | { |
44 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { | 33 | ARMCPU *cpu = env_archcpu(env); |
45 | { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, | 34 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
46 | .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, | 35 | .type = ARM_CP_NO_RAW, .access = PL1_R, .readfn = isr_read }, |
47 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), | 36 | /* 32 bit ITLB invalidates */ |
48 | - .resetvalue = 0, .writefn = cpacr_write }, | 37 | { .name = "ITLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 0, |
49 | + .resetfn = cpacr_reset, .writefn = cpacr_write }, | 38 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiall_write }, |
39 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
40 | + .writefn = tlbiall_write }, | ||
41 | { .name = "ITLBIMVA", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1, | ||
42 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_write }, | ||
43 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
44 | + .writefn = tlbimva_write }, | ||
45 | { .name = "ITLBIASID", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 2, | ||
46 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiasid_write }, | ||
47 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
48 | + .writefn = tlbiasid_write }, | ||
49 | /* 32 bit DTLB invalidates */ | ||
50 | { .name = "DTLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 0, | ||
51 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiall_write }, | ||
52 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
53 | + .writefn = tlbiall_write }, | ||
54 | { .name = "DTLBIMVA", .cp = 15, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 1, | ||
55 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_write }, | ||
56 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
57 | + .writefn = tlbimva_write }, | ||
58 | { .name = "DTLBIASID", .cp = 15, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 2, | ||
59 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiasid_write }, | ||
60 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
61 | + .writefn = tlbiasid_write }, | ||
62 | /* 32 bit TLB invalidates */ | ||
63 | { .name = "TLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0, | ||
64 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiall_write }, | ||
65 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
66 | + .writefn = tlbiall_write }, | ||
67 | { .name = "TLBIMVA", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 1, | ||
68 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_write }, | ||
69 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
70 | + .writefn = tlbimva_write }, | ||
71 | { .name = "TLBIASID", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 2, | ||
72 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiasid_write }, | ||
73 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
74 | + .writefn = tlbiasid_write }, | ||
75 | { .name = "TLBIMVAA", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, | ||
76 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimvaa_write }, | ||
77 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
78 | + .writefn = tlbimvaa_write }, | ||
50 | REGINFO_SENTINEL | 79 | REGINFO_SENTINEL |
51 | }; | 80 | }; |
52 | 81 | ||
82 | static const ARMCPRegInfo v7mp_cp_reginfo[] = { | ||
83 | /* 32 bit TLB invalidates, Inner Shareable */ | ||
84 | { .name = "TLBIALLIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, | ||
85 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbiall_is_write }, | ||
86 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
87 | + .writefn = tlbiall_is_write }, | ||
88 | { .name = "TLBIMVAIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1, | ||
89 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_is_write }, | ||
90 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
91 | + .writefn = tlbimva_is_write }, | ||
92 | { .name = "TLBIASIDIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2, | ||
93 | - .type = ARM_CP_NO_RAW, .access = PL1_W, | ||
94 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
95 | .writefn = tlbiasid_is_write }, | ||
96 | { .name = "TLBIMVAAIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, | ||
97 | - .type = ARM_CP_NO_RAW, .access = PL1_W, | ||
98 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
99 | .writefn = tlbimvaa_is_write }, | ||
100 | REGINFO_SENTINEL | ||
101 | }; | ||
102 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
103 | /* TLBI operations */ | ||
104 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, | ||
105 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, | ||
106 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
107 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
108 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
109 | { .name = "TLBI_VAE1IS", .state = ARM_CP_STATE_AA64, | ||
110 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1, | ||
111 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
112 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
113 | .writefn = tlbi_aa64_vae1is_write }, | ||
114 | { .name = "TLBI_ASIDE1IS", .state = ARM_CP_STATE_AA64, | ||
115 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2, | ||
116 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
117 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
118 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
119 | { .name = "TLBI_VAAE1IS", .state = ARM_CP_STATE_AA64, | ||
120 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, | ||
121 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
122 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
123 | .writefn = tlbi_aa64_vae1is_write }, | ||
124 | { .name = "TLBI_VALE1IS", .state = ARM_CP_STATE_AA64, | ||
125 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5, | ||
126 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
127 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
128 | .writefn = tlbi_aa64_vae1is_write }, | ||
129 | { .name = "TLBI_VAALE1IS", .state = ARM_CP_STATE_AA64, | ||
130 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7, | ||
131 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
132 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
133 | .writefn = tlbi_aa64_vae1is_write }, | ||
134 | { .name = "TLBI_VMALLE1", .state = ARM_CP_STATE_AA64, | ||
135 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0, | ||
136 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
137 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
138 | .writefn = tlbi_aa64_vmalle1_write }, | ||
139 | { .name = "TLBI_VAE1", .state = ARM_CP_STATE_AA64, | ||
140 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 1, | ||
141 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
142 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
143 | .writefn = tlbi_aa64_vae1_write }, | ||
144 | { .name = "TLBI_ASIDE1", .state = ARM_CP_STATE_AA64, | ||
145 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 2, | ||
146 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
147 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
148 | .writefn = tlbi_aa64_vmalle1_write }, | ||
149 | { .name = "TLBI_VAAE1", .state = ARM_CP_STATE_AA64, | ||
150 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, | ||
151 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
152 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
153 | .writefn = tlbi_aa64_vae1_write }, | ||
154 | { .name = "TLBI_VALE1", .state = ARM_CP_STATE_AA64, | ||
155 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5, | ||
156 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
157 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
158 | .writefn = tlbi_aa64_vae1_write }, | ||
159 | { .name = "TLBI_VAALE1", .state = ARM_CP_STATE_AA64, | ||
160 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 7, | ||
161 | - .access = PL1_W, .type = ARM_CP_NO_RAW, | ||
162 | + .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
163 | .writefn = tlbi_aa64_vae1_write }, | ||
164 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | ||
165 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | ||
166 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
167 | #endif | ||
168 | /* TLB invalidate last level of translation table walk */ | ||
169 | { .name = "TLBIMVALIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5, | ||
170 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_is_write }, | ||
171 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
172 | + .writefn = tlbimva_is_write }, | ||
173 | { .name = "TLBIMVAALIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7, | ||
174 | - .type = ARM_CP_NO_RAW, .access = PL1_W, | ||
175 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
176 | .writefn = tlbimvaa_is_write }, | ||
177 | { .name = "TLBIMVAL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5, | ||
178 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimva_write }, | ||
179 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
180 | + .writefn = tlbimva_write }, | ||
181 | { .name = "TLBIMVAAL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 7, | ||
182 | - .type = ARM_CP_NO_RAW, .access = PL1_W, .writefn = tlbimvaa_write }, | ||
183 | + .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, | ||
184 | + .writefn = tlbimvaa_write }, | ||
185 | { .name = "TLBIMVALH", .cp = 15, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 5, | ||
186 | .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
187 | .writefn = tlbimva_hyp_write }, | ||
53 | -- | 188 | -- |
54 | 2.17.1 | 189 | 2.20.1 |
55 | 190 | ||
56 | 191 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | It forgot to increase clroffset during the loop. So it only clear the | 3 | Make the output just a bit prettier when running by hand. |
4 | first 4 bytes. | ||
5 | 4 | ||
6 | Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920 | 5 | Cc: Alex Bennée <alex.bennee@linaro.org> |
7 | Cc: qemu-stable@nongnu.org | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | 7 | Message-id: 20200229012811.24129-13-richard.henderson@linaro.org |
9 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Message-id: 1527047633-12368-1-git-send-email-zhaoshenglong@huawei.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 10 | --- |
14 | hw/intc/arm_gicv3_kvm.c | 1 + | 11 | tests/tcg/aarch64/pauth-1.c | 2 +- |
15 | 1 file changed, 1 insertion(+) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | 13 | ||
17 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 14 | diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/intc/arm_gicv3_kvm.c | 16 | --- a/tests/tcg/aarch64/pauth-1.c |
20 | +++ b/hw/intc/arm_gicv3_kvm.c | 17 | +++ b/tests/tcg/aarch64/pauth-1.c |
21 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset, | 18 | @@ -XXX,XX +XXX,XX @@ int main() |
22 | if (clroffset != 0) { | 19 | } |
23 | reg = 0; | 20 | |
24 | kvm_gicd_access(s, clroffset, ®, true); | 21 | perc = (float) count / (float) (TESTS * 2); |
25 | + clroffset += 4; | 22 | - printf("Ptr Check: %0.2f%%", perc * 100.0); |
26 | } | 23 | + printf("Ptr Check: %0.2f%%\n", perc * 100.0); |
27 | reg = *gic_bmp_ptr32(bmp, irq); | 24 | assert(perc > 0.95); |
28 | kvm_gicd_access(s, offset, ®, true); | 25 | return 0; |
26 | } | ||
29 | -- | 27 | -- |
30 | 2.17.1 | 28 | 2.20.1 |
31 | 29 | ||
32 | 30 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_extend_translation(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | The Cubieboard is a singleboard computer with an Allwinner A10 System-on-Chip [1]. | ||
4 | As documented in the Allwinner A10 User Manual V1.5 [2], the SoC has an ARM | ||
5 | Cortex-A8 processor. Currently the Cubieboard machine definition specifies the | ||
6 | ARM Cortex-A9 in its description and as the default CPU. | ||
7 | |||
8 | This patch corrects the Cubieboard machine definition to use the ARM Cortex-A8. | ||
9 | |||
10 | The only user-visible effect is that our textual description of the | ||
11 | machine was wrong, because hw/arm/allwinner-a10.c always creates a | ||
12 | Cortex-A8 CPU regardless of the default value in the MachineClass struct. | ||
13 | |||
14 | [1] http://docs.cubieboard.org/products/start#cubieboard1 | ||
15 | [2] https://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf | ||
16 | |||
17 | Fixes: 8a863c8120994981a099 | ||
18 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
19 | Message-id: 20200227220149.6845-2-nieklinnenbank@gmail.com | ||
20 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | [note in commit message that the bug didn't have much visible effect] | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-7-peter.maydell@linaro.org | ||
10 | --- | 24 | --- |
11 | exec.c | 15 ++++++++++----- | 25 | hw/arm/cubieboard.c | 4 ++-- |
12 | 1 file changed, 10 insertions(+), 5 deletions(-) | 26 | 1 file changed, 2 insertions(+), 2 deletions(-) |
13 | 27 | ||
14 | diff --git a/exec.c b/exec.c | 28 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
15 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 30 | --- a/hw/arm/cubieboard.c |
17 | +++ b/exec.c | 31 | +++ b/hw/arm/cubieboard.c |
18 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 32 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine) |
19 | 33 | ||
20 | static hwaddr | 34 | static void cubieboard_machine_init(MachineClass *mc) |
21 | flatview_extend_translation(FlatView *fv, hwaddr addr, | ||
22 | - hwaddr target_len, | ||
23 | - MemoryRegion *mr, hwaddr base, hwaddr len, | ||
24 | - bool is_write) | ||
25 | + hwaddr target_len, | ||
26 | + MemoryRegion *mr, hwaddr base, hwaddr len, | ||
27 | + bool is_write, MemTxAttrs attrs) | ||
28 | { | 35 | { |
29 | hwaddr done = 0; | 36 | - mc->desc = "cubietech cubieboard (Cortex-A9)"; |
30 | hwaddr xlat; | 37 | - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); |
31 | @@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as, | 38 | + mc->desc = "cubietech cubieboard (Cortex-A8)"; |
32 | 39 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); | |
33 | memory_region_ref(mr); | 40 | mc->init = cubieboard_init; |
34 | *plen = flatview_extend_translation(fv, addr, len, mr, xlat, | 41 | mc->block_default_type = IF_IDE; |
35 | - l, is_write); | 42 | mc->units_per_default_bus = 1; |
36 | + l, is_write, attrs); | ||
37 | ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); | ||
38 | rcu_read_unlock(); | ||
39 | |||
40 | @@ -XXX,XX +XXX,XX @@ int64_t address_space_cache_init(MemoryRegionCache *cache, | ||
41 | mr = cache->mrs.mr; | ||
42 | memory_region_ref(mr); | ||
43 | if (memory_access_is_direct(mr, is_write)) { | ||
44 | + /* We don't care about the memory attributes here as we're only | ||
45 | + * doing this if we found actual RAM, which behaves the same | ||
46 | + * regardless of attributes; so UNSPECIFIED is fine. | ||
47 | + */ | ||
48 | l = flatview_extend_translation(cache->fv, addr, len, mr, | ||
49 | - cache->xlat, l, is_write); | ||
50 | + cache->xlat, l, is_write, | ||
51 | + MEMTXATTRS_UNSPECIFIED); | ||
52 | cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); | ||
53 | } else { | ||
54 | cache->ptr = NULL; | ||
55 | -- | 43 | -- |
56 | 2.17.1 | 44 | 2.20.1 |
57 | 45 | ||
58 | 46 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate() | ||
3 | and address_space_translate_cached(). Callers either have an | ||
4 | attrs value to hand, or don't care and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | The Cubieboard has an ARM Cortex-A8. Instead of simply ignoring a | ||
4 | bogus -cpu option provided by the user, give them an error message so | ||
5 | they know their command line is wrong. | ||
6 | |||
7 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
8 | Message-id: 20200227220149.6845-3-nieklinnenbank@gmail.com | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | [PMM: tweaked commit message] | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-4-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | include/exec/memory.h | 4 +++- | 14 | hw/arm/cubieboard.c | 10 +++++++++- |
12 | accel/tcg/translate-all.c | 2 +- | 15 | 1 file changed, 9 insertions(+), 1 deletion(-) |
13 | exec.c | 14 +++++++++----- | ||
14 | hw/vfio/common.c | 3 ++- | ||
15 | memory_ldst.inc.c | 18 +++++++++--------- | ||
16 | target/riscv/helper.c | 2 +- | ||
17 | 6 files changed, 25 insertions(+), 18 deletions(-) | ||
18 | 16 | ||
19 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 17 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/exec/memory.h | 19 | --- a/hw/arm/cubieboard.c |
22 | +++ b/include/exec/memory.h | 20 | +++ b/hw/arm/cubieboard.c |
23 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 21 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info cubieboard_binfo = { |
24 | * #MemoryRegion. | 22 | |
25 | * @len: pointer to length | 23 | static void cubieboard_init(MachineState *machine) |
26 | * @is_write: indicates the transfer direction | ||
27 | + * @attrs: memory attributes | ||
28 | */ | ||
29 | MemoryRegion *flatview_translate(FlatView *fv, | ||
30 | hwaddr addr, hwaddr *xlat, | ||
31 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, | ||
32 | |||
33 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | ||
34 | hwaddr addr, hwaddr *xlat, | ||
35 | - hwaddr *len, bool is_write) | ||
36 | + hwaddr *len, bool is_write, | ||
37 | + MemTxAttrs attrs) | ||
38 | { | 24 | { |
39 | return flatview_translate(address_space_to_flatview(as), | 25 | - AwA10State *a10 = AW_A10(object_new(TYPE_AW_A10)); |
40 | addr, xlat, len, is_write); | 26 | + AwA10State *a10; |
41 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | 27 | Error *err = NULL; |
42 | index XXXXXXX..XXXXXXX 100644 | 28 | |
43 | --- a/accel/tcg/translate-all.c | 29 | + /* Only allow Cortex-A8 for this board */ |
44 | +++ b/accel/tcg/translate-all.c | 30 | + if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a8")) != 0) { |
45 | @@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | 31 | + error_report("This board can only be used with cortex-a8 CPU"); |
46 | hwaddr l = 1; | 32 | + exit(1); |
47 | 33 | + } | |
48 | rcu_read_lock(); | 34 | + |
49 | - mr = address_space_translate(as, addr, &addr, &l, false); | 35 | + a10 = AW_A10(object_new(TYPE_AW_A10)); |
50 | + mr = address_space_translate(as, addr, &addr, &l, false, attrs); | 36 | + |
51 | if (!(memory_region_is_ram(mr) | 37 | object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err); |
52 | || memory_region_is_romd(mr))) { | 38 | if (err != NULL) { |
53 | rcu_read_unlock(); | 39 | error_reportf_err(err, "Couldn't set phy address: "); |
54 | diff --git a/exec.c b/exec.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/exec.c | ||
57 | +++ b/exec.c | ||
58 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as, | ||
59 | rcu_read_lock(); | ||
60 | while (len > 0) { | ||
61 | l = len; | ||
62 | - mr = address_space_translate(as, addr, &addr1, &l, true); | ||
63 | + mr = address_space_translate(as, addr, &addr1, &l, true, | ||
64 | + MEMTXATTRS_UNSPECIFIED); | ||
65 | |||
66 | if (!(memory_region_is_ram(mr) || | ||
67 | memory_region_is_romd(mr))) { | ||
68 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache) | ||
69 | */ | ||
70 | static inline MemoryRegion *address_space_translate_cached( | ||
71 | MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat, | ||
72 | - hwaddr *plen, bool is_write) | ||
73 | + hwaddr *plen, bool is_write, MemTxAttrs attrs) | ||
74 | { | ||
75 | MemoryRegionSection section; | ||
76 | MemoryRegion *mr; | ||
77 | @@ -XXX,XX +XXX,XX @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr, | ||
78 | MemoryRegion *mr; | ||
79 | |||
80 | l = len; | ||
81 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, false); | ||
82 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, false, | ||
83 | + MEMTXATTRS_UNSPECIFIED); | ||
84 | flatview_read_continue(cache->fv, | ||
85 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | ||
86 | addr1, l, mr); | ||
87 | @@ -XXX,XX +XXX,XX @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr, | ||
88 | MemoryRegion *mr; | ||
89 | |||
90 | l = len; | ||
91 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, true); | ||
92 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, true, | ||
93 | + MEMTXATTRS_UNSPECIFIED); | ||
94 | flatview_write_continue(cache->fv, | ||
95 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | ||
96 | addr1, l, mr); | ||
97 | @@ -XXX,XX +XXX,XX @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) | ||
98 | |||
99 | rcu_read_lock(); | ||
100 | mr = address_space_translate(&address_space_memory, | ||
101 | - phys_addr, &phys_addr, &l, false); | ||
102 | + phys_addr, &phys_addr, &l, false, | ||
103 | + MEMTXATTRS_UNSPECIFIED); | ||
104 | |||
105 | res = !(memory_region_is_ram(mr) || memory_region_is_romd(mr)); | ||
106 | rcu_read_unlock(); | ||
107 | diff --git a/hw/vfio/common.c b/hw/vfio/common.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/hw/vfio/common.c | ||
110 | +++ b/hw/vfio/common.c | ||
111 | @@ -XXX,XX +XXX,XX @@ static bool vfio_get_vaddr(IOMMUTLBEntry *iotlb, void **vaddr, | ||
112 | */ | ||
113 | mr = address_space_translate(&address_space_memory, | ||
114 | iotlb->translated_addr, | ||
115 | - &xlat, &len, writable); | ||
116 | + &xlat, &len, writable, | ||
117 | + MEMTXATTRS_UNSPECIFIED); | ||
118 | if (!memory_region_is_ram(mr)) { | ||
119 | error_report("iommu map to non memory area %"HWADDR_PRIx"", | ||
120 | xlat); | ||
121 | diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c | ||
122 | index XXXXXXX..XXXXXXX 100644 | ||
123 | --- a/memory_ldst.inc.c | ||
124 | +++ b/memory_ldst.inc.c | ||
125 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, | ||
126 | bool release_lock = false; | ||
127 | |||
128 | RCU_READ_LOCK(); | ||
129 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
130 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
131 | if (l < 4 || !IS_DIRECT(mr, false)) { | ||
132 | release_lock |= prepare_mmio_access(mr); | ||
133 | |||
134 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, | ||
135 | bool release_lock = false; | ||
136 | |||
137 | RCU_READ_LOCK(); | ||
138 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
139 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
140 | if (l < 8 || !IS_DIRECT(mr, false)) { | ||
141 | release_lock |= prepare_mmio_access(mr); | ||
142 | |||
143 | @@ -XXX,XX +XXX,XX @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, | ||
144 | bool release_lock = false; | ||
145 | |||
146 | RCU_READ_LOCK(); | ||
147 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
148 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
149 | if (!IS_DIRECT(mr, false)) { | ||
150 | release_lock |= prepare_mmio_access(mr); | ||
151 | |||
152 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, | ||
153 | bool release_lock = false; | ||
154 | |||
155 | RCU_READ_LOCK(); | ||
156 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
157 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
158 | if (l < 2 || !IS_DIRECT(mr, false)) { | ||
159 | release_lock |= prepare_mmio_access(mr); | ||
160 | |||
161 | @@ -XXX,XX +XXX,XX @@ void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, | ||
162 | bool release_lock = false; | ||
163 | |||
164 | RCU_READ_LOCK(); | ||
165 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
166 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
167 | if (l < 4 || !IS_DIRECT(mr, true)) { | ||
168 | release_lock |= prepare_mmio_access(mr); | ||
169 | |||
170 | @@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, | ||
171 | bool release_lock = false; | ||
172 | |||
173 | RCU_READ_LOCK(); | ||
174 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
175 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
176 | if (l < 4 || !IS_DIRECT(mr, true)) { | ||
177 | release_lock |= prepare_mmio_access(mr); | ||
178 | |||
179 | @@ -XXX,XX +XXX,XX @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL, | ||
180 | bool release_lock = false; | ||
181 | |||
182 | RCU_READ_LOCK(); | ||
183 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
184 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
185 | if (!IS_DIRECT(mr, true)) { | ||
186 | release_lock |= prepare_mmio_access(mr); | ||
187 | r = memory_region_dispatch_write(mr, addr1, val, 1, attrs); | ||
188 | @@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, | ||
189 | bool release_lock = false; | ||
190 | |||
191 | RCU_READ_LOCK(); | ||
192 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
193 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
194 | if (l < 2 || !IS_DIRECT(mr, true)) { | ||
195 | release_lock |= prepare_mmio_access(mr); | ||
196 | |||
197 | @@ -XXX,XX +XXX,XX @@ static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, | ||
198 | bool release_lock = false; | ||
199 | |||
200 | RCU_READ_LOCK(); | ||
201 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
202 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
203 | if (l < 8 || !IS_DIRECT(mr, true)) { | ||
204 | release_lock |= prepare_mmio_access(mr); | ||
205 | |||
206 | diff --git a/target/riscv/helper.c b/target/riscv/helper.c | ||
207 | index XXXXXXX..XXXXXXX 100644 | ||
208 | --- a/target/riscv/helper.c | ||
209 | +++ b/target/riscv/helper.c | ||
210 | @@ -XXX,XX +XXX,XX @@ restart: | ||
211 | MemoryRegion *mr; | ||
212 | hwaddr l = sizeof(target_ulong), addr1; | ||
213 | mr = address_space_translate(cs->as, pte_addr, | ||
214 | - &addr1, &l, false); | ||
215 | + &addr1, &l, false, MEMTXATTRS_UNSPECIFIED); | ||
216 | if (memory_access_is_direct(mr, true)) { | ||
217 | target_ulong *pte_pa = | ||
218 | qemu_map_ram_ptr(mr->ram_block, addr1); | ||
219 | -- | 40 | -- |
220 | 2.17.1 | 41 | 2.20.1 |
221 | 42 | ||
222 | 43 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | When QEMU is started with following CLI | 3 | The Cubieboard contains either 512MiB or 1GiB of onboard RAM [1]. |
4 | -machine virt,gic-version=3,accel=kvm -cpu host -bios AAVMF_CODE.fd | 4 | Prevent changing RAM to a different size which could break user programs. |
5 | it crashes with abort at | ||
6 | accel/kvm/kvm-all.c:2164: | ||
7 | KVM_SET_DEVICE_ATTR failed: Group 6 attr 0x000000000000c665: Invalid argument | ||
8 | 5 | ||
9 | Which is caused by implicit dependency of kvm_arm_gicv3_reset() on | 6 | [1] http://linux-sunxi.org/Cubieboard |
10 | arm_gicv3_icc_reset() where the later is called by CPU reset | ||
11 | reset callback. | ||
12 | 7 | ||
13 | However commit: | 8 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> |
14 | 3b77f6c arm/boot: split load_dtb() from arm_load_kernel() | 9 | Message-id: 20200227220149.6845-4-nieklinnenbank@gmail.com |
15 | broke CPU reset callback registration in case | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
16 | |||
17 | arm_load_kernel() | ||
18 | ... | ||
19 | if (!info->kernel_filename || info->firmware_loaded) | ||
20 | |||
21 | branch is taken, i.e. it's sufficient to provide a firmware | ||
22 | or do not provide kernel on CLI to skip cpu reset callback | ||
23 | registration, where before offending commit the callback | ||
24 | has been registered unconditionally. | ||
25 | |||
26 | Fix it by registering the callback right at the beginning of | ||
27 | arm_load_kernel() unconditionally instead of doing it at the end. | ||
28 | |||
29 | NOTE: | ||
30 | we probably should eliminate that dependency anyways as well as | ||
31 | separate arch CPU reset parts from arm_load_kernel() into CPU | ||
32 | itself, but that refactoring that I probably would have to do | ||
33 | anyways later for CPU hotplug to work. | ||
34 | |||
35 | Reported-by: Auger Eric <eric.auger@redhat.com> | ||
36 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | ||
37 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
38 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
39 | Message-id: 1527070950-208350-1-git-send-email-imammedo@redhat.com | ||
40 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | --- | 13 | --- |
43 | hw/arm/boot.c | 18 +++++++++--------- | 14 | hw/arm/cubieboard.c | 8 ++++++++ |
44 | 1 file changed, 9 insertions(+), 9 deletions(-) | 15 | 1 file changed, 8 insertions(+) |
45 | 16 | ||
46 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 17 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
47 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/hw/arm/boot.c | 19 | --- a/hw/arm/cubieboard.c |
49 | +++ b/hw/arm/boot.c | 20 | +++ b/hw/arm/cubieboard.c |
50 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 21 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine) |
51 | static const ARMInsnFixup *primary_loader; | 22 | AwA10State *a10; |
52 | AddressSpace *as = arm_boot_address_space(cpu, info); | 23 | Error *err = NULL; |
53 | 24 | ||
54 | + /* CPU objects (unlike devices) are not automatically reset on system | 25 | + /* This board has fixed size RAM (512MiB or 1GiB) */ |
55 | + * reset, so we must always register a handler to do so. If we're | 26 | + if (machine->ram_size != 512 * MiB && |
56 | + * actually loading a kernel, the handler is also responsible for | 27 | + machine->ram_size != 1 * GiB) { |
57 | + * arranging that we start it correctly. | 28 | + error_report("This machine can only be used with 512MiB or 1GiB RAM"); |
58 | + */ | 29 | + exit(1); |
59 | + for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | ||
60 | + qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | ||
61 | + } | 30 | + } |
62 | + | 31 | + |
63 | /* The board code is not supposed to set secure_board_setup unless | 32 | /* Only allow Cortex-A8 for this board */ |
64 | * running its code in secure mode is actually possible, and KVM | 33 | if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a8")) != 0) { |
65 | * doesn't support secure. | 34 | error_report("This board can only be used with cortex-a8 CPU"); |
66 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 35 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_machine_init(MachineClass *mc) |
67 | ARM_CPU(cs)->env.boot_info = info; | 36 | { |
68 | } | 37 | mc->desc = "cubietech cubieboard (Cortex-A8)"; |
69 | 38 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); | |
70 | - /* CPU objects (unlike devices) are not automatically reset on system | 39 | + mc->default_ram_size = 1 * GiB; |
71 | - * reset, so we must always register a handler to do so. If we're | 40 | mc->init = cubieboard_init; |
72 | - * actually loading a kernel, the handler is also responsible for | 41 | mc->block_default_type = IF_IDE; |
73 | - * arranging that we start it correctly. | 42 | mc->units_per_default_bus = 1; |
74 | - */ | ||
75 | - for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | ||
76 | - qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | ||
77 | - } | ||
78 | - | ||
79 | if (!info->skip_dtb_autoload && have_dtb(info)) { | ||
80 | if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) { | ||
81 | exit(1); | ||
82 | -- | 43 | -- |
83 | 2.17.1 | 44 | 2.20.1 |
84 | 45 | ||
85 | 46 | diff view generated by jsdifflib |
1 | From: Jan Kiszka <jan.kiszka@siemens.com> | 1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | There was a nasty flip in identifying which register group an access is | 3 | The Cubieboard machine does not support the -bios argument. |
4 | targeting. The issue caused spuriously raised priorities of the guest | 4 | Report an error when -bios is used and exit immediately. |
5 | when handing CPUs over in the Jailhouse hypervisor. | ||
6 | 5 | ||
7 | Cc: qemu-stable@nongnu.org | 6 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> |
8 | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> | 7 | Message-id: 20200227220149.6845-5-nieklinnenbank@gmail.com |
9 | Message-id: 28b927d3-da58-bce4-cc13-bfec7f9b1cb9@siemens.com | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | hw/intc/arm_gicv3_cpuif.c | 12 ++++++------ | 12 | hw/arm/cubieboard.c | 7 +++++++ |
14 | 1 file changed, 6 insertions(+), 6 deletions(-) | 13 | 1 file changed, 7 insertions(+) |
15 | 14 | ||
16 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 15 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/intc/arm_gicv3_cpuif.c | 17 | --- a/hw/arm/cubieboard.c |
19 | +++ b/hw/intc/arm_gicv3_cpuif.c | 18 | +++ b/hw/arm/cubieboard.c |
20 | @@ -XXX,XX +XXX,XX @@ static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 19 | @@ -XXX,XX +XXX,XX @@ |
21 | { | 20 | #include "exec/address-spaces.h" |
22 | GICv3CPUState *cs = icc_cs_from_env(env); | 21 | #include "qapi/error.h" |
23 | int regno = ri->opc2 & 3; | 22 | #include "cpu.h" |
24 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 23 | +#include "sysemu/sysemu.h" |
25 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 24 | #include "hw/sysbus.h" |
26 | uint64_t value = cs->ich_apr[grp][regno]; | 25 | #include "hw/boards.h" |
27 | 26 | #include "hw/arm/allwinner-a10.h" | |
28 | trace_gicv3_icv_ap_read(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 27 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine) |
29 | @@ -XXX,XX +XXX,XX @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | 28 | AwA10State *a10; |
30 | { | 29 | Error *err = NULL; |
31 | GICv3CPUState *cs = icc_cs_from_env(env); | 30 | |
32 | int regno = ri->opc2 & 3; | 31 | + /* BIOS is not supported by this board */ |
33 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 32 | + if (bios_name) { |
34 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 33 | + error_report("BIOS not supported for this machine"); |
35 | 34 | + exit(1); | |
36 | trace_gicv3_icv_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 35 | + } |
37 | 36 | + | |
38 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 37 | /* This board has fixed size RAM (512MiB or 1GiB) */ |
39 | uint64_t value; | 38 | if (machine->ram_size != 512 * MiB && |
40 | 39 | machine->ram_size != 1 * GiB) { | |
41 | int regno = ri->opc2 & 3; | ||
42 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | ||
43 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | ||
44 | |||
45 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | ||
46 | return icv_ap_read(env, ri); | ||
47 | @@ -XXX,XX +XXX,XX @@ static void icc_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
48 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
49 | |||
50 | int regno = ri->opc2 & 3; | ||
51 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | ||
52 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | ||
53 | |||
54 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | ||
55 | icv_ap_write(env, ri, value); | ||
56 | @@ -XXX,XX +XXX,XX @@ static uint64_t ich_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
57 | { | ||
58 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
59 | int regno = ri->opc2 & 3; | ||
60 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | ||
61 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | ||
62 | uint64_t value; | ||
63 | |||
64 | value = cs->ich_apr[grp][regno]; | ||
65 | @@ -XXX,XX +XXX,XX @@ static void ich_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
66 | { | ||
67 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
68 | int regno = ri->opc2 & 3; | ||
69 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | ||
70 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | ||
71 | |||
72 | trace_gicv3_ich_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | ||
73 | |||
74 | -- | 40 | -- |
75 | 2.17.1 | 41 | 2.20.1 |
76 | 42 | ||
77 | 43 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to tb_invalidate_phys_addr(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | Replicate the single TBI bit from TCR_EL2 and TCR_EL3 so that | ||
4 | we can unconditionally use pointer bit 55 to index into our | ||
5 | composite TBI1:TBI0 field. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20200302175829.2183-2-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20180521140402.23318-3-peter.maydell@linaro.org | ||
10 | --- | 12 | --- |
11 | include/exec/exec-all.h | 5 +++-- | 13 | target/arm/helper.c | 6 ++++-- |
12 | accel/tcg/translate-all.c | 2 +- | 14 | 1 file changed, 4 insertions(+), 2 deletions(-) |
13 | exec.c | 2 +- | ||
14 | target/xtensa/op_helper.c | 3 ++- | ||
15 | 4 files changed, 7 insertions(+), 5 deletions(-) | ||
16 | 15 | ||
17 | diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h | 16 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/exec-all.h | 18 | --- a/target/arm/helper.c |
20 | +++ b/include/exec/exec-all.h | 19 | +++ b/target/arm/helper.c |
21 | @@ -XXX,XX +XXX,XX @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, | 20 | @@ -XXX,XX +XXX,XX @@ static int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx) |
22 | void tlb_set_page(CPUState *cpu, target_ulong vaddr, | 21 | } else if (mmu_idx == ARMMMUIdx_Stage2) { |
23 | hwaddr paddr, int prot, | 22 | return 0; /* VTCR_EL2 */ |
24 | int mmu_idx, target_ulong size); | 23 | } else { |
25 | -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr); | 24 | - return extract32(tcr, 20, 1); |
26 | +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); | 25 | + /* Replicate the single TBI bit so we always have 2 bits. */ |
27 | void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, | 26 | + return extract32(tcr, 20, 1) * 3; |
28 | uintptr_t retaddr); | ||
29 | #else | ||
30 | @@ -XXX,XX +XXX,XX @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu, | ||
31 | uint16_t idxmap) | ||
32 | { | ||
33 | } | ||
34 | -static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) | ||
35 | +static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, | ||
36 | + MemTxAttrs attrs) | ||
37 | { | ||
38 | } | ||
39 | #endif | ||
40 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/accel/tcg/translate-all.c | ||
43 | +++ b/accel/tcg/translate-all.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static TranslationBlock *tb_find_pc(uintptr_t tc_ptr) | ||
45 | } | ||
46 | |||
47 | #if !defined(CONFIG_USER_ONLY) | ||
48 | -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) | ||
49 | +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | ||
50 | { | ||
51 | ram_addr_t ram_addr; | ||
52 | MemoryRegion *mr; | ||
53 | diff --git a/exec.c b/exec.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/exec.c | ||
56 | +++ b/exec.c | ||
57 | @@ -XXX,XX +XXX,XX @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) | ||
58 | if (phys != -1) { | ||
59 | /* Locks grabbed by tb_invalidate_phys_addr */ | ||
60 | tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, | ||
61 | - phys | (pc & ~TARGET_PAGE_MASK)); | ||
62 | + phys | (pc & ~TARGET_PAGE_MASK), attrs); | ||
63 | } | 27 | } |
64 | } | 28 | } |
65 | #endif | 29 | |
66 | diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c | 30 | @@ -XXX,XX +XXX,XX @@ static int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx) |
67 | index XXXXXXX..XXXXXXX 100644 | 31 | } else if (mmu_idx == ARMMMUIdx_Stage2) { |
68 | --- a/target/xtensa/op_helper.c | 32 | return 0; /* VTCR_EL2 */ |
69 | +++ b/target/xtensa/op_helper.c | 33 | } else { |
70 | @@ -XXX,XX +XXX,XX @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr) | 34 | - return extract32(tcr, 29, 1); |
71 | int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0, | 35 | + /* Replicate the single TBID bit so we always have 2 bits. */ |
72 | &paddr, &page_size, &access); | 36 | + return extract32(tcr, 29, 1) * 3; |
73 | if (ret == 0) { | ||
74 | - tb_invalidate_phys_addr(&address_space_memory, paddr); | ||
75 | + tb_invalidate_phys_addr(&address_space_memory, paddr, | ||
76 | + MEMTXATTRS_UNSPECIFIED); | ||
77 | } | 37 | } |
78 | } | 38 | } |
79 | 39 | ||
80 | -- | 40 | -- |
81 | 2.17.1 | 41 | 2.20.1 |
82 | 42 | ||
83 | 43 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate_iommu(). | ||
3 | 2 | ||
3 | We now cache the core mmu_idx in env->hflags. Rather than recompute | ||
4 | from scratch, extract the field. All of the uses of cpu_mmu_index | ||
5 | within target/arm are within helpers, and env->hflags is always stable | ||
6 | within a translation block from whence helpers are called. | ||
7 | |||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Message-id: 20200302175829.2183-3-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180521140402.23318-14-peter.maydell@linaro.org | ||
8 | --- | 12 | --- |
9 | exec.c | 8 +++++--- | 13 | target/arm/cpu.h | 23 +++++++++++++---------- |
10 | 1 file changed, 5 insertions(+), 3 deletions(-) | 14 | target/arm/helper.c | 5 ----- |
15 | 2 files changed, 13 insertions(+), 15 deletions(-) | ||
11 | 16 | ||
12 | diff --git a/exec.c b/exec.c | 17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
13 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 19 | --- a/target/arm/cpu.h |
15 | +++ b/exec.c | 20 | +++ b/target/arm/cpu.h |
16 | @@ -XXX,XX +XXX,XX @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x | 21 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit { |
17 | * @is_write: whether the translation operation is for write | 22 | |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 23 | #define MMU_USER_IDX 0 |
19 | * @target_as: the address space targeted by the IOMMU | 24 | |
20 | + * @attrs: transaction attributes | 25 | -/** |
21 | * | 26 | - * cpu_mmu_index: |
22 | * This function is called from RCU critical section. It is the common | 27 | - * @env: The cpu environment |
23 | * part of flatview_do_translate and address_space_translate_cached. | 28 | - * @ifetch: True for code access, false for data access. |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iomm | 29 | - * |
25 | hwaddr *page_mask_out, | 30 | - * Return the core mmu index for the current translation regime. |
26 | bool is_write, | 31 | - * This function is used by generic TCG code paths. |
27 | bool is_mmio, | 32 | - */ |
28 | - AddressSpace **target_as) | 33 | -int cpu_mmu_index(CPUARMState *env, bool ifetch); |
29 | + AddressSpace **target_as, | 34 | - |
30 | + MemTxAttrs attrs) | 35 | /* Indexes used when registering address spaces with cpu_address_space_init */ |
36 | typedef enum ARMASIdx { | ||
37 | ARMASIdx_NS = 0, | ||
38 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */ | ||
39 | FIELD(TBFLAG_A64, TBID, 12, 2) | ||
40 | FIELD(TBFLAG_A64, UNPRIV, 14, 1) | ||
41 | |||
42 | +/** | ||
43 | + * cpu_mmu_index: | ||
44 | + * @env: The cpu environment | ||
45 | + * @ifetch: True for code access, false for data access. | ||
46 | + * | ||
47 | + * Return the core mmu index for the current translation regime. | ||
48 | + * This function is used by generic TCG code paths. | ||
49 | + */ | ||
50 | +static inline int cpu_mmu_index(CPUARMState *env, bool ifetch) | ||
51 | +{ | ||
52 | + return FIELD_EX32(env->hflags, TBFLAG_ANY, MMUIDX); | ||
53 | +} | ||
54 | + | ||
55 | static inline bool bswap_code(bool sctlr_b) | ||
31 | { | 56 | { |
32 | MemoryRegionSection *section; | 57 | #ifdef CONFIG_USER_ONLY |
33 | hwaddr page_mask = (hwaddr)-1; | 58 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
34 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 59 | index XXXXXXX..XXXXXXX 100644 |
35 | return address_space_translate_iommu(iommu_mr, xlat, | 60 | --- a/target/arm/helper.c |
36 | plen_out, page_mask_out, | 61 | +++ b/target/arm/helper.c |
37 | is_write, is_mmio, | 62 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) |
38 | - target_as); | 63 | return arm_mmu_idx_el(env, arm_current_el(env)); |
39 | + target_as, attrs); | ||
40 | } | ||
41 | if (page_mask_out) { | ||
42 | /* Not behind an IOMMU, use default page size. */ | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate_cached( | ||
44 | |||
45 | section = address_space_translate_iommu(iommu_mr, xlat, plen, | ||
46 | NULL, is_write, true, | ||
47 | - &target_as); | ||
48 | + &target_as, attrs); | ||
49 | return section.mr; | ||
50 | } | 64 | } |
51 | 65 | ||
66 | -int cpu_mmu_index(CPUARMState *env, bool ifetch) | ||
67 | -{ | ||
68 | - return arm_to_core_mmu_idx(arm_mmu_idx(env)); | ||
69 | -} | ||
70 | - | ||
71 | #ifndef CONFIG_USER_ONLY | ||
72 | ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) | ||
73 | { | ||
52 | -- | 74 | -- |
53 | 2.17.1 | 75 | 2.20.1 |
54 | 76 | ||
55 | 77 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_translate(); all its | ||
3 | callers now have attrs available. | ||
4 | 2 | ||
3 | If by context we know that we're in AArch64 mode, we need not | ||
4 | test for M-profile when reconstructing the full ARMMMUIdx. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Message-id: 20200302175829.2183-4-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20180521140402.23318-11-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | include/exec/memory.h | 7 ++++--- | 12 | target/arm/internals.h | 6 ++++++ |
11 | exec.c | 17 +++++++++-------- | 13 | target/arm/translate-a64.c | 2 +- |
12 | 2 files changed, 13 insertions(+), 11 deletions(-) | 14 | 2 files changed, 7 insertions(+), 1 deletion(-) |
13 | 15 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 16 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 18 | --- a/target/arm/internals.h |
17 | +++ b/include/exec/memory.h | 19 | +++ b/target/arm/internals.h |
18 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 20 | @@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_arm_mmu_idx(CPUARMState *env, int mmu_idx) |
19 | */ | 21 | } |
20 | MemoryRegion *flatview_translate(FlatView *fv, | ||
21 | hwaddr addr, hwaddr *xlat, | ||
22 | - hwaddr *len, bool is_write); | ||
23 | + hwaddr *len, bool is_write, | ||
24 | + MemTxAttrs attrs); | ||
25 | |||
26 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | ||
27 | hwaddr addr, hwaddr *xlat, | ||
28 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | ||
29 | MemTxAttrs attrs) | ||
30 | { | ||
31 | return flatview_translate(address_space_to_flatview(as), | ||
32 | - addr, xlat, len, is_write); | ||
33 | + addr, xlat, len, is_write, attrs); | ||
34 | } | 22 | } |
35 | 23 | ||
36 | /* address_space_access_valid: check for validity of accessing an address | 24 | +static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx) |
37 | @@ -XXX,XX +XXX,XX @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr, | 25 | +{ |
38 | rcu_read_lock(); | 26 | + /* AArch64 is always a-profile. */ |
39 | fv = address_space_to_flatview(as); | 27 | + return mmu_idx | ARM_MMU_IDX_A; |
40 | l = len; | 28 | +} |
41 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | 29 | + |
42 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | 30 | int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx); |
43 | if (len == l && memory_access_is_direct(mr, false)) { | 31 | |
44 | ptr = qemu_map_ram_ptr(mr->ram_block, addr1); | 32 | /* |
45 | memcpy(buf, ptr, len); | 33 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
46 | diff --git a/exec.c b/exec.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/exec.c | 35 | --- a/target/arm/translate-a64.c |
49 | +++ b/exec.c | 36 | +++ b/target/arm/translate-a64.c |
50 | @@ -XXX,XX +XXX,XX @@ iotlb_fail: | 37 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, |
51 | 38 | dc->condexec_mask = 0; | |
52 | /* Called from RCU critical section */ | 39 | dc->condexec_cond = 0; |
53 | MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 40 | core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX); |
54 | - hwaddr *plen, bool is_write) | 41 | - dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx); |
55 | + hwaddr *plen, bool is_write, | 42 | + dc->mmu_idx = core_to_aa64_mmu_idx(core_mmu_idx); |
56 | + MemTxAttrs attrs) | 43 | dc->tbii = FIELD_EX32(tb_flags, TBFLAG_A64, TBII); |
57 | { | 44 | dc->tbid = FIELD_EX32(tb_flags, TBFLAG_A64, TBID); |
58 | MemoryRegion *mr; | 45 | dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); |
59 | MemoryRegionSection section; | ||
60 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr, | ||
61 | } | ||
62 | |||
63 | l = len; | ||
64 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | ||
65 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | ||
66 | } | ||
67 | |||
68 | return result; | ||
69 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | ||
70 | MemTxResult result = MEMTX_OK; | ||
71 | |||
72 | l = len; | ||
73 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | ||
74 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | ||
75 | result = flatview_write_continue(fv, addr, attrs, buf, len, | ||
76 | addr1, l, mr); | ||
77 | |||
78 | @@ -XXX,XX +XXX,XX @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr, | ||
79 | } | ||
80 | |||
81 | l = len; | ||
82 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | ||
83 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | ||
84 | } | ||
85 | |||
86 | return result; | ||
87 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | ||
88 | MemoryRegion *mr; | ||
89 | |||
90 | l = len; | ||
91 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | ||
92 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | ||
93 | return flatview_read_continue(fv, addr, attrs, buf, len, | ||
94 | addr1, l, mr); | ||
95 | } | ||
96 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | ||
97 | |||
98 | while (len > 0) { | ||
99 | l = len; | ||
100 | - mr = flatview_translate(fv, addr, &xlat, &l, is_write); | ||
101 | + mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs); | ||
102 | if (!memory_access_is_direct(mr, is_write)) { | ||
103 | l = memory_access_size(mr, l, addr); | ||
104 | if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) { | ||
105 | @@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr, | ||
106 | |||
107 | len = target_len; | ||
108 | this_mr = flatview_translate(fv, addr, &xlat, | ||
109 | - &len, is_write); | ||
110 | + &len, is_write, attrs); | ||
111 | if (this_mr != mr || xlat != base + done) { | ||
112 | return done; | ||
113 | } | ||
114 | @@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as, | ||
115 | l = len; | ||
116 | rcu_read_lock(); | ||
117 | fv = address_space_to_flatview(as); | ||
118 | - mr = flatview_translate(fv, addr, &xlat, &l, is_write); | ||
119 | + mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs); | ||
120 | |||
121 | if (!memory_access_is_direct(mr, is_write)) { | ||
122 | if (atomic_xchg(&bounce.in_use, true)) { | ||
123 | -- | 46 | -- |
124 | 2.17.1 | 47 | 2.20.1 |
125 | 48 | ||
126 | 49 | diff view generated by jsdifflib |
1 | The FRECPX instructions should (like most other floating point operations) | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | honour the FPCR.FZ bit which specifies whether input denormals should | ||
3 | be flushed to zero (or FZ16 for the half-precision version). | ||
4 | We forgot to implement this, which doesn't affect the results (since | ||
5 | the calculation doesn't actually care about the mantissa bits) but did | ||
6 | mean we were failing to set the FPSR.IDC bit. | ||
7 | 2 | ||
3 | We missed this case within AArch64.ExceptionReturn. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Message-id: 20200302175829.2183-5-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20180521172712.19930-1-peter.maydell@linaro.org | ||
11 | --- | 9 | --- |
12 | target/arm/helper-a64.c | 6 ++++++ | 10 | target/arm/helper-a64.c | 23 ++++++++++++++++++++++- |
13 | 1 file changed, 6 insertions(+) | 11 | 1 file changed, 22 insertions(+), 1 deletion(-) |
14 | 12 | ||
15 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 13 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-a64.c | 15 | --- a/target/arm/helper-a64.c |
18 | +++ b/target/arm/helper-a64.c | 16 | +++ b/target/arm/helper-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(frecpx_f16)(float16 a, void *fpstp) | 17 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) |
20 | return nan; | 18 | "AArch32 EL%d PC 0x%" PRIx32 "\n", |
21 | } | 19 | cur_el, new_el, env->regs[15]); |
22 | 20 | } else { | |
23 | + a = float16_squash_input_denormal(a, fpst); | 21 | + int tbii; |
24 | + | 22 | + |
25 | val16 = float16_val(a); | 23 | env->aarch64 = 1; |
26 | sbit = 0x8000 & val16; | 24 | spsr &= aarch64_pstate_valid_mask(&env_archcpu(env)->isar); |
27 | exp = extract32(val16, 10, 5); | 25 | pstate_write(env, spsr); |
28 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp) | 26 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) |
29 | return nan; | 27 | env->pstate &= ~PSTATE_SS; |
30 | } | 28 | } |
31 | 29 | aarch64_restore_sp(env, new_el); | |
32 | + a = float32_squash_input_denormal(a, fpst); | 30 | - env->pc = new_pc; |
31 | helper_rebuild_hflags_a64(env, new_el); | ||
33 | + | 32 | + |
34 | val32 = float32_val(a); | 33 | + /* |
35 | sbit = 0x80000000ULL & val32; | 34 | + * Apply TBI to the exception return address. We had to delay this |
36 | exp = extract32(val32, 23, 8); | 35 | + * until after we selected the new EL, so that we could select the |
37 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp) | 36 | + * correct TBI+TBID bits. This is made easier by waiting until after |
38 | return nan; | 37 | + * the hflags rebuild, since we can pull the composite TBII field |
39 | } | 38 | + * from there. |
40 | 39 | + */ | |
41 | + a = float64_squash_input_denormal(a, fpst); | 40 | + tbii = FIELD_EX32(env->hflags, TBFLAG_A64, TBII); |
41 | + if ((tbii >> extract64(new_pc, 55, 1)) & 1) { | ||
42 | + /* TBI is enabled. */ | ||
43 | + int core_mmu_idx = cpu_mmu_index(env, false); | ||
44 | + if (regime_has_2_ranges(core_to_aa64_mmu_idx(core_mmu_idx))) { | ||
45 | + new_pc = sextract64(new_pc, 0, 56); | ||
46 | + } else { | ||
47 | + new_pc = extract64(new_pc, 0, 56); | ||
48 | + } | ||
49 | + } | ||
50 | + env->pc = new_pc; | ||
42 | + | 51 | + |
43 | val64 = float64_val(a); | 52 | qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " |
44 | sbit = 0x8000000000000000ULL & val64; | 53 | "AArch64 EL%d PC 0x%" PRIx64 "\n", |
45 | exp = extract64(float64_val(a), 52, 11); | 54 | cur_el, new_el, env->pc); |
46 | -- | 55 | -- |
47 | 2.17.1 | 56 | 2.20.1 |
48 | 57 | ||
49 | 58 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | This is an aarch64-only function. Move it out of the shared file. | ||
4 | This patch is code movement only. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20200302175829.2183-6-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/helper-a64.h | 1 + | ||
13 | target/arm/helper.h | 1 - | ||
14 | target/arm/helper-a64.c | 91 ++++++++++++++++++++++++++++++++++++++++ | ||
15 | target/arm/op_helper.c | 93 ----------------------------------------- | ||
16 | 4 files changed, 92 insertions(+), 94 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/helper-a64.h | ||
21 | +++ b/target/arm/helper-a64.h | ||
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(advsimd_f16touinth, i32, f16, ptr) | ||
23 | DEF_HELPER_2(sqrt_f16, f16, f16, ptr) | ||
24 | |||
25 | DEF_HELPER_2(exception_return, void, env, i64) | ||
26 | +DEF_HELPER_2(dc_zva, void, env, i64) | ||
27 | |||
28 | DEF_HELPER_FLAGS_3(pacia, TCG_CALL_NO_WG, i64, env, i64, i64) | ||
29 | DEF_HELPER_FLAGS_3(pacib, TCG_CALL_NO_WG, i64, env, i64, i64) | ||
30 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/helper.h | ||
33 | +++ b/target/arm/helper.h | ||
34 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(crypto_sm4ekey, TCG_CALL_NO_RWG, void, ptr, ptr, ptr) | ||
35 | |||
36 | DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) | ||
37 | DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) | ||
38 | -DEF_HELPER_2(dc_zva, void, env, i64) | ||
39 | |||
40 | DEF_HELPER_FLAGS_5(gvec_qrdmlah_s16, TCG_CALL_NO_RWG, | ||
41 | void, ptr, ptr, ptr, ptr, i32) | ||
42 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/target/arm/helper-a64.c | ||
45 | +++ b/target/arm/helper-a64.c | ||
46 | @@ -XXX,XX +XXX,XX @@ | ||
47 | */ | ||
48 | |||
49 | #include "qemu/osdep.h" | ||
50 | +#include "qemu/units.h" | ||
51 | #include "cpu.h" | ||
52 | #include "exec/gdbstub.h" | ||
53 | #include "exec/helper-proto.h" | ||
54 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp) | ||
55 | return float16_sqrt(a, s); | ||
56 | } | ||
57 | |||
58 | +void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) | ||
59 | +{ | ||
60 | + /* | ||
61 | + * Implement DC ZVA, which zeroes a fixed-length block of memory. | ||
62 | + * Note that we do not implement the (architecturally mandated) | ||
63 | + * alignment fault for attempts to use this on Device memory | ||
64 | + * (which matches the usual QEMU behaviour of not implementing either | ||
65 | + * alignment faults or any memory attribute handling). | ||
66 | + */ | ||
67 | |||
68 | + ARMCPU *cpu = env_archcpu(env); | ||
69 | + uint64_t blocklen = 4 << cpu->dcz_blocksize; | ||
70 | + uint64_t vaddr = vaddr_in & ~(blocklen - 1); | ||
71 | + | ||
72 | +#ifndef CONFIG_USER_ONLY | ||
73 | + { | ||
74 | + /* | ||
75 | + * Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than | ||
76 | + * the block size so we might have to do more than one TLB lookup. | ||
77 | + * We know that in fact for any v8 CPU the page size is at least 4K | ||
78 | + * and the block size must be 2K or less, but TARGET_PAGE_SIZE is only | ||
79 | + * 1K as an artefact of legacy v5 subpage support being present in the | ||
80 | + * same QEMU executable. So in practice the hostaddr[] array has | ||
81 | + * two entries, given the current setting of TARGET_PAGE_BITS_MIN. | ||
82 | + */ | ||
83 | + int maxidx = DIV_ROUND_UP(blocklen, TARGET_PAGE_SIZE); | ||
84 | + void *hostaddr[DIV_ROUND_UP(2 * KiB, 1 << TARGET_PAGE_BITS_MIN)]; | ||
85 | + int try, i; | ||
86 | + unsigned mmu_idx = cpu_mmu_index(env, false); | ||
87 | + TCGMemOpIdx oi = make_memop_idx(MO_UB, mmu_idx); | ||
88 | + | ||
89 | + assert(maxidx <= ARRAY_SIZE(hostaddr)); | ||
90 | + | ||
91 | + for (try = 0; try < 2; try++) { | ||
92 | + | ||
93 | + for (i = 0; i < maxidx; i++) { | ||
94 | + hostaddr[i] = tlb_vaddr_to_host(env, | ||
95 | + vaddr + TARGET_PAGE_SIZE * i, | ||
96 | + 1, mmu_idx); | ||
97 | + if (!hostaddr[i]) { | ||
98 | + break; | ||
99 | + } | ||
100 | + } | ||
101 | + if (i == maxidx) { | ||
102 | + /* | ||
103 | + * If it's all in the TLB it's fair game for just writing to; | ||
104 | + * we know we don't need to update dirty status, etc. | ||
105 | + */ | ||
106 | + for (i = 0; i < maxidx - 1; i++) { | ||
107 | + memset(hostaddr[i], 0, TARGET_PAGE_SIZE); | ||
108 | + } | ||
109 | + memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE)); | ||
110 | + return; | ||
111 | + } | ||
112 | + /* | ||
113 | + * OK, try a store and see if we can populate the tlb. This | ||
114 | + * might cause an exception if the memory isn't writable, | ||
115 | + * in which case we will longjmp out of here. We must for | ||
116 | + * this purpose use the actual register value passed to us | ||
117 | + * so that we get the fault address right. | ||
118 | + */ | ||
119 | + helper_ret_stb_mmu(env, vaddr_in, 0, oi, GETPC()); | ||
120 | + /* Now we can populate the other TLB entries, if any */ | ||
121 | + for (i = 0; i < maxidx; i++) { | ||
122 | + uint64_t va = vaddr + TARGET_PAGE_SIZE * i; | ||
123 | + if (va != (vaddr_in & TARGET_PAGE_MASK)) { | ||
124 | + helper_ret_stb_mmu(env, va, 0, oi, GETPC()); | ||
125 | + } | ||
126 | + } | ||
127 | + } | ||
128 | + | ||
129 | + /* | ||
130 | + * Slow path (probably attempt to do this to an I/O device or | ||
131 | + * similar, or clearing of a block of code we have translations | ||
132 | + * cached for). Just do a series of byte writes as the architecture | ||
133 | + * demands. It's not worth trying to use a cpu_physical_memory_map(), | ||
134 | + * memset(), unmap() sequence here because: | ||
135 | + * + we'd need to account for the blocksize being larger than a page | ||
136 | + * + the direct-RAM access case is almost always going to be dealt | ||
137 | + * with in the fastpath code above, so there's no speed benefit | ||
138 | + * + we would have to deal with the map returning NULL because the | ||
139 | + * bounce buffer was in use | ||
140 | + */ | ||
141 | + for (i = 0; i < blocklen; i++) { | ||
142 | + helper_ret_stb_mmu(env, vaddr + i, 0, oi, GETPC()); | ||
143 | + } | ||
144 | + } | ||
145 | +#else | ||
146 | + memset(g2h(vaddr), 0, blocklen); | ||
147 | +#endif | ||
148 | +} | ||
149 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/target/arm/op_helper.c | ||
152 | +++ b/target/arm/op_helper.c | ||
153 | @@ -XXX,XX +XXX,XX @@ | ||
154 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
155 | */ | ||
156 | #include "qemu/osdep.h" | ||
157 | -#include "qemu/units.h" | ||
158 | #include "qemu/log.h" | ||
159 | #include "qemu/main-loop.h" | ||
160 | #include "cpu.h" | ||
161 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i) | ||
162 | return ((uint32_t)x >> shift) | (x << (32 - shift)); | ||
163 | } | ||
164 | } | ||
165 | - | ||
166 | -void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) | ||
167 | -{ | ||
168 | - /* | ||
169 | - * Implement DC ZVA, which zeroes a fixed-length block of memory. | ||
170 | - * Note that we do not implement the (architecturally mandated) | ||
171 | - * alignment fault for attempts to use this on Device memory | ||
172 | - * (which matches the usual QEMU behaviour of not implementing either | ||
173 | - * alignment faults or any memory attribute handling). | ||
174 | - */ | ||
175 | - | ||
176 | - ARMCPU *cpu = env_archcpu(env); | ||
177 | - uint64_t blocklen = 4 << cpu->dcz_blocksize; | ||
178 | - uint64_t vaddr = vaddr_in & ~(blocklen - 1); | ||
179 | - | ||
180 | -#ifndef CONFIG_USER_ONLY | ||
181 | - { | ||
182 | - /* | ||
183 | - * Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than | ||
184 | - * the block size so we might have to do more than one TLB lookup. | ||
185 | - * We know that in fact for any v8 CPU the page size is at least 4K | ||
186 | - * and the block size must be 2K or less, but TARGET_PAGE_SIZE is only | ||
187 | - * 1K as an artefact of legacy v5 subpage support being present in the | ||
188 | - * same QEMU executable. So in practice the hostaddr[] array has | ||
189 | - * two entries, given the current setting of TARGET_PAGE_BITS_MIN. | ||
190 | - */ | ||
191 | - int maxidx = DIV_ROUND_UP(blocklen, TARGET_PAGE_SIZE); | ||
192 | - void *hostaddr[DIV_ROUND_UP(2 * KiB, 1 << TARGET_PAGE_BITS_MIN)]; | ||
193 | - int try, i; | ||
194 | - unsigned mmu_idx = cpu_mmu_index(env, false); | ||
195 | - TCGMemOpIdx oi = make_memop_idx(MO_UB, mmu_idx); | ||
196 | - | ||
197 | - assert(maxidx <= ARRAY_SIZE(hostaddr)); | ||
198 | - | ||
199 | - for (try = 0; try < 2; try++) { | ||
200 | - | ||
201 | - for (i = 0; i < maxidx; i++) { | ||
202 | - hostaddr[i] = tlb_vaddr_to_host(env, | ||
203 | - vaddr + TARGET_PAGE_SIZE * i, | ||
204 | - 1, mmu_idx); | ||
205 | - if (!hostaddr[i]) { | ||
206 | - break; | ||
207 | - } | ||
208 | - } | ||
209 | - if (i == maxidx) { | ||
210 | - /* | ||
211 | - * If it's all in the TLB it's fair game for just writing to; | ||
212 | - * we know we don't need to update dirty status, etc. | ||
213 | - */ | ||
214 | - for (i = 0; i < maxidx - 1; i++) { | ||
215 | - memset(hostaddr[i], 0, TARGET_PAGE_SIZE); | ||
216 | - } | ||
217 | - memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE)); | ||
218 | - return; | ||
219 | - } | ||
220 | - /* | ||
221 | - * OK, try a store and see if we can populate the tlb. This | ||
222 | - * might cause an exception if the memory isn't writable, | ||
223 | - * in which case we will longjmp out of here. We must for | ||
224 | - * this purpose use the actual register value passed to us | ||
225 | - * so that we get the fault address right. | ||
226 | - */ | ||
227 | - helper_ret_stb_mmu(env, vaddr_in, 0, oi, GETPC()); | ||
228 | - /* Now we can populate the other TLB entries, if any */ | ||
229 | - for (i = 0; i < maxidx; i++) { | ||
230 | - uint64_t va = vaddr + TARGET_PAGE_SIZE * i; | ||
231 | - if (va != (vaddr_in & TARGET_PAGE_MASK)) { | ||
232 | - helper_ret_stb_mmu(env, va, 0, oi, GETPC()); | ||
233 | - } | ||
234 | - } | ||
235 | - } | ||
236 | - | ||
237 | - /* | ||
238 | - * Slow path (probably attempt to do this to an I/O device or | ||
239 | - * similar, or clearing of a block of code we have translations | ||
240 | - * cached for). Just do a series of byte writes as the architecture | ||
241 | - * demands. It's not worth trying to use a cpu_physical_memory_map(), | ||
242 | - * memset(), unmap() sequence here because: | ||
243 | - * + we'd need to account for the blocksize being larger than a page | ||
244 | - * + the direct-RAM access case is almost always going to be dealt | ||
245 | - * with in the fastpath code above, so there's no speed benefit | ||
246 | - * + we would have to deal with the map returning NULL because the | ||
247 | - * bounce buffer was in use | ||
248 | - */ | ||
249 | - for (i = 0; i < blocklen; i++) { | ||
250 | - helper_ret_stb_mmu(env, vaddr + i, 0, oi, GETPC()); | ||
251 | - } | ||
252 | - } | ||
253 | -#else | ||
254 | - memset(g2h(vaddr), 0, blocklen); | ||
255 | -#endif | ||
256 | -} | ||
257 | -- | ||
258 | 2.20.1 | ||
259 | |||
260 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | cpregs_keys is an uint32_t* so the allocation should use uint32_t. | 3 | The function does not write registers, and only reads them by |
4 | g_new is even better because it is type-safe. | 4 | implication via the exception path. |
5 | 5 | ||
6 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20200302175829.2183-7-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | target/arm/gdbstub.c | 3 +-- | 12 | target/arm/helper-a64.h | 2 +- |
12 | 1 file changed, 1 insertion(+), 2 deletions(-) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 14 | ||
14 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | 15 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/gdbstub.c | 17 | --- a/target/arm/helper-a64.h |
17 | +++ b/target/arm/gdbstub.c | 18 | +++ b/target/arm/helper-a64.h |
18 | @@ -XXX,XX +XXX,XX @@ int arm_gen_dynamic_xml(CPUState *cs) | 19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(advsimd_f16touinth, i32, f16, ptr) |
19 | RegisterSysregXmlParam param = {cs, s}; | 20 | DEF_HELPER_2(sqrt_f16, f16, f16, ptr) |
20 | 21 | ||
21 | cpu->dyn_xml.num_cpregs = 0; | 22 | DEF_HELPER_2(exception_return, void, env, i64) |
22 | - cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) * | 23 | -DEF_HELPER_2(dc_zva, void, env, i64) |
23 | - g_hash_table_size(cpu->cp_regs)); | 24 | +DEF_HELPER_FLAGS_2(dc_zva, TCG_CALL_NO_WG, void, env, i64) |
24 | + cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs)); | 25 | |
25 | g_string_printf(s, "<?xml version=\"1.0\"?>"); | 26 | DEF_HELPER_FLAGS_3(pacia, TCG_CALL_NO_WG, i64, env, i64, i64) |
26 | g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">"); | 27 | DEF_HELPER_FLAGS_3(pacib, TCG_CALL_NO_WG, i64, env, i64, i64) |
27 | g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">"); | ||
28 | -- | 28 | -- |
29 | 2.17.1 | 29 | 2.20.1 |
30 | 30 | ||
31 | 31 | diff view generated by jsdifflib |
1 | Add entries to MAINTAINERS to cover the newer MPS2 boards and | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the new devices they use. | ||
3 | 2 | ||
3 | This data access was forgotten when we added support for cleaning | ||
4 | addresses of TBI information. | ||
5 | |||
6 | Fixes: 3a471103ac1823ba | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200302175829.2183-8-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20180518153157.14899-1-peter.maydell@linaro.org | ||
6 | --- | 11 | --- |
7 | MAINTAINERS | 9 +++++++-- | 12 | target/arm/translate-a64.c | 2 +- |
8 | 1 file changed, 7 insertions(+), 2 deletions(-) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
9 | 14 | ||
10 | diff --git a/MAINTAINERS b/MAINTAINERS | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
11 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/MAINTAINERS | 17 | --- a/target/arm/translate-a64.c |
13 | +++ b/MAINTAINERS | 18 | +++ b/target/arm/translate-a64.c |
14 | @@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c | 19 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, |
15 | F: include/hw/timer/cmsdk-apb-timer.h | 20 | return; |
16 | F: hw/char/cmsdk-apb-uart.c | 21 | case ARM_CP_DC_ZVA: |
17 | F: include/hw/char/cmsdk-apb-uart.h | 22 | /* Writes clear the aligned block of memory which rt points into. */ |
18 | +F: hw/misc/tz-ppc.c | 23 | - tcg_rt = cpu_reg(s, rt); |
19 | +F: include/hw/misc/tz-ppc.h | 24 | + tcg_rt = clean_data_tbi(s, cpu_reg(s, rt)); |
20 | 25 | gen_helper_dc_zva(cpu_env, tcg_rt); | |
21 | ARM cores | 26 | return; |
22 | M: Peter Maydell <peter.maydell@linaro.org> | 27 | default: |
23 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | ||
24 | L: qemu-arm@nongnu.org | ||
25 | S: Maintained | ||
26 | F: hw/arm/mps2.c | ||
27 | -F: hw/misc/mps2-scc.c | ||
28 | -F: include/hw/misc/mps2-scc.h | ||
29 | +F: hw/arm/mps2-tz.c | ||
30 | +F: hw/misc/mps2-*.c | ||
31 | +F: include/hw/misc/mps2-*.h | ||
32 | +F: hw/arm/iotkit.c | ||
33 | +F: include/hw/arm/iotkit.h | ||
34 | |||
35 | Musicpal | ||
36 | M: Jan Kiszka <jan.kiszka@web.de> | ||
37 | -- | 28 | -- |
38 | 2.17.1 | 29 | 2.20.1 |
39 | 30 | ||
40 | 31 | diff view generated by jsdifflib |