1 | target-arm queue: a smallish set of patches for rc1 tomorrow. | 1 | Handful of arm fixes for the rc. |
---|---|---|---|
2 | I've included the tcg patches because RTH has no others that | ||
3 | would merit a pullreq. | ||
4 | 2 | ||
5 | I haven't included Thomas Huth's 17-patch set to deal with | 3 | The following changes since commit 555249a59e9cdd6b58da103aba5cf3a2d45c899f: |
6 | the introspection crashes, to give that a little more time | ||
7 | on-list for review. | ||
8 | 4 | ||
9 | thanks | 5 | Merge remote-tracking branch 'remotes/ehabkost-gl/tags/x86-next-pull-request' into staging (2021-04-10 16:58:56 +0100) |
10 | -- PMM | ||
11 | |||
12 | The following changes since commit 102ad0a80f5110483efd06877c29c4236be267f9: | ||
13 | |||
14 | Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging (2018-07-16 15:34:38 +0100) | ||
15 | 6 | ||
16 | are available in the Git repository at: | 7 | are available in the Git repository at: |
17 | 8 | ||
18 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180716 | 9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210412 |
19 | 10 | ||
20 | for you to fetch changes up to 3474c98a2a2afcefa7c665f02ad2bed2a43ab0f7: | 11 | for you to fetch changes up to 52c01ada86611136e3122dd139788dbcbc292d86: |
21 | 12 | ||
22 | accel/tcg: Assert that tlb fill gave us a valid TLB entry (2018-07-16 17:26:01 +0100) | 13 | exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1 (2021-04-12 11:06:24 +0100) |
23 | 14 | ||
24 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
25 | target-arm queue: | 16 | target-arm queue: |
26 | * accel/tcg: Use correct test when looking in victim TLB for code | 17 | * hw/arm/virt-acpi-build: Fix GSIV values of the {GERR, Sync} interrupts |
27 | * bcm2835_aux: Swap RX and TX interrupt assignments | 18 | * hw/arm/smmuv3: Emulate CFGI_STE_RANGE for an aligned range of StreamIDs |
28 | * hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false | 19 | * accel/tcg: Preserve PAGE_ANON when changing page permissions |
29 | * hw/intc/arm_gic: Fix handling of GICD_ITARGETSR | 20 | * target/arm: Check PAGE_WRITE_ORG for MTE writeability |
30 | * hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq() | 21 | * exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1 |
31 | * aspeed: Implement write-1-{set, clear} for AST2500 strapping | ||
32 | * target/arm: Fix LD1W and LDFF1W (scalar plus vector) | ||
33 | 22 | ||
34 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
35 | Andrew Jeffery (1): | 24 | Richard Henderson (3): |
36 | aspeed: Implement write-1-{set, clear} for AST2500 strapping | 25 | accel/tcg: Preserve PAGE_ANON when changing page permissions |
26 | target/arm: Check PAGE_WRITE_ORG for MTE writeability | ||
27 | exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1 | ||
37 | 28 | ||
38 | Guenter Roeck (1): | 29 | Zenghui Yu (2): |
39 | bcm2835_aux: Swap RX and TX interrupt assignments | 30 | hw/arm/virt-acpi-build: Fix GSIV values of the {GERR, Sync} interrupts |
31 | hw/arm/smmuv3: Emulate CFGI_STE_RANGE for an aligned range of StreamIDs | ||
40 | 32 | ||
41 | Peter Maydell (4): | 33 | include/exec/cpu-all.h | 4 ++-- |
42 | hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq() | 34 | tests/tcg/aarch64/mte.h | 3 ++- |
43 | hw/intc/arm_gic: Fix handling of GICD_ITARGETSR | 35 | accel/tcg/translate-all.c | 9 ++++++-- |
44 | accel/tcg: Use correct test when looking in victim TLB for code | 36 | hw/arm/smmuv3.c | 12 +++++++---- |
45 | accel/tcg: Assert that tlb fill gave us a valid TLB entry | 37 | hw/arm/virt-acpi-build.c | 4 ++-- |
38 | target/arm/mte_helper.c | 2 +- | ||
39 | tests/tcg/aarch64/mte-6.c | 43 +++++++++++++++++++++++++++++++++++++++ | ||
40 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
41 | 8 files changed, 66 insertions(+), 13 deletions(-) | ||
42 | create mode 100644 tests/tcg/aarch64/mte-6.c | ||
46 | 43 | ||
47 | Richard Henderson (1): | ||
48 | target/arm: Fix LD1W and LDFF1W (scalar plus vector) | ||
49 | |||
50 | Thomas Huth (1): | ||
51 | hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false | ||
52 | |||
53 | include/hw/misc/aspeed_scu.h | 2 ++ | ||
54 | accel/tcg/cputlb.c | 6 +++--- | ||
55 | hw/arm/bcm2836.c | 2 ++ | ||
56 | hw/char/bcm2835_aux.c | 4 ++-- | ||
57 | hw/intc/arm_gic.c | 22 +++++++++++++++++++--- | ||
58 | hw/misc/aspeed_scu.c | 19 +++++++++++++++++-- | ||
59 | target/arm/sve_helper.c | 4 ++-- | ||
60 | 7 files changed, 47 insertions(+), 12 deletions(-) | ||
61 | diff view generated by jsdifflib |
1 | In commit 4b1a3e1e34ad97 we added a check for whether the TLB entry | 1 | From: Zenghui Yu <yuzenghui@huawei.com> |
---|---|---|---|
2 | we had following a tlb_fill had the INVALID bit set. This could | ||
3 | happen in some circumstances because a stale or wrong TLB entry was | ||
4 | pulled out of the victim cache. However, after commit | ||
5 | 68fea038553039e (which prevents stale entries being in the victim | ||
6 | cache) and the previous commit (which ensures we don't incorrectly | ||
7 | hit in the victim cache)) this should never be possible. | ||
8 | 2 | ||
9 | Drop the check on TLB_INVALID_MASK from the "is this a TLB_RECHECK?" | 3 | The GSIV values in SMMUv3 IORT node are not correct as they don't match |
10 | condition, and instead assert that the tlb fill procedure has given | 4 | the SMMUIrq enumeration, which describes the IRQ<->PIN mapping used by |
11 | us a valid TLB entry (or longjumped out with a guest exception). | 5 | our emulated vSMMU. |
12 | 6 | ||
7 | Fixes: a703b4f6c1ee ("hw/arm/virt-acpi-build: Add smmuv3 node in IORT table") | ||
8 | Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> | ||
9 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Message-id: 20210402084731.93-1-yuzenghui@huawei.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20180713141636.18665-3-peter.maydell@linaro.org | ||
16 | --- | 12 | --- |
17 | accel/tcg/cputlb.c | 4 ++-- | 13 | hw/arm/virt-acpi-build.c | 4 ++-- |
18 | 1 file changed, 2 insertions(+), 2 deletions(-) | 14 | 1 file changed, 2 insertions(+), 2 deletions(-) |
19 | 15 | ||
20 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | 16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
21 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/accel/tcg/cputlb.c | 18 | --- a/hw/arm/virt-acpi-build.c |
23 | +++ b/accel/tcg/cputlb.c | 19 | +++ b/hw/arm/virt-acpi-build.c |
24 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | 20 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) |
25 | if (!VICTIM_TLB_HIT(addr_code, addr)) { | 21 | smmu->flags = cpu_to_le32(ACPI_IORT_SMMU_V3_COHACC_OVERRIDE); |
26 | tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0); | 22 | smmu->event_gsiv = cpu_to_le32(irq); |
27 | } | 23 | smmu->pri_gsiv = cpu_to_le32(irq + 1); |
28 | + assert(tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr)); | 24 | - smmu->gerr_gsiv = cpu_to_le32(irq + 2); |
29 | } | 25 | - smmu->sync_gsiv = cpu_to_le32(irq + 3); |
30 | 26 | + smmu->sync_gsiv = cpu_to_le32(irq + 2); | |
31 | - if (unlikely((env->tlb_table[mmu_idx][index].addr_code & | 27 | + smmu->gerr_gsiv = cpu_to_le32(irq + 3); |
32 | - (TLB_RECHECK | TLB_INVALID_MASK)) == TLB_RECHECK)) { | 28 | |
33 | + if (unlikely(env->tlb_table[mmu_idx][index].addr_code & TLB_RECHECK)) { | 29 | /* Identity RID mapping covering the whole input RID range */ |
34 | /* | 30 | idmap = &smmu->id_mapping_array[0]; |
35 | * This is a TLB_RECHECK access, where the MMU protection | ||
36 | * covers a smaller range than a target page, and we must | ||
37 | -- | 31 | -- |
38 | 2.17.1 | 32 | 2.20.1 |
39 | 33 | ||
40 | 34 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Zenghui Yu <yuzenghui@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The AST2500 SoC family changes the runtime behaviour of the hardware | 3 | In emulation of the CFGI_STE_RANGE command, we now take StreamID as the |
4 | strapping register (SCU70) to write-1-set/write-1-clear, with | 4 | start of the invalidation range, regardless of whatever the Range is, |
5 | write-1-clear implemented on the "read-only" SoC revision register | 5 | whilst the spec clearly states that |
6 | (SCU7C). For the the AST2400, the hardware strapping is | ||
7 | runtime-configured with read-modify-write semantics. | ||
8 | 6 | ||
9 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 7 | - "Invalidation is performed for an *aligned* range of 2^(Range+1) |
10 | Reviewed-by: Joel Stanley <joel@jms.id.au> | 8 | StreamIDs." |
11 | Message-id: 20180709143524.17480-1-andrew@aj.id.au | 9 | |
10 | - "The bottom Range+1 bits of the StreamID parameter are IGNORED, | ||
11 | aligning the range to its size." | ||
12 | |||
13 | Take CFGI_ALL (where Range == 31) as an example, if there are some random | ||
14 | bits in the StreamID field, we'll fail to perform the full invalidation but | ||
15 | get a strange range (e.g., SMMUSIDRange={.start=1, .end=0}) instead. Rework | ||
16 | the emulation a bit to get rid of the discrepancy with the spec. | ||
17 | |||
18 | Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> | ||
19 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
20 | Message-id: 20210402100449.528-1-yuzenghui@huawei.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 22 | --- |
14 | include/hw/misc/aspeed_scu.h | 2 ++ | 23 | hw/arm/smmuv3.c | 12 ++++++++---- |
15 | hw/misc/aspeed_scu.c | 19 +++++++++++++++++-- | 24 | 1 file changed, 8 insertions(+), 4 deletions(-) |
16 | 2 files changed, 19 insertions(+), 2 deletions(-) | ||
17 | 25 | ||
18 | diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h | 26 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c |
19 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/misc/aspeed_scu.h | 28 | --- a/hw/arm/smmuv3.c |
21 | +++ b/include/hw/misc/aspeed_scu.h | 29 | +++ b/hw/arm/smmuv3.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedSCUState { | 30 | @@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s) |
23 | #define AST2500_A0_SILICON_REV 0x04000303U | 31 | } |
24 | #define AST2500_A1_SILICON_REV 0x04010303U | 32 | case SMMU_CMD_CFGI_STE_RANGE: /* same as SMMU_CMD_CFGI_ALL */ |
25 | 33 | { | |
26 | +#define ASPEED_IS_AST2500(si_rev) ((((si_rev) >> 24) & 0xff) == 0x04) | 34 | - uint32_t start = CMD_SID(&cmd); |
35 | + uint32_t sid = CMD_SID(&cmd), mask; | ||
36 | uint8_t range = CMD_STE_RANGE(&cmd); | ||
37 | - uint64_t end = start + (1ULL << (range + 1)) - 1; | ||
38 | - SMMUSIDRange sid_range = {start, end}; | ||
39 | + SMMUSIDRange sid_range; | ||
40 | |||
41 | if (CMD_SSEC(&cmd)) { | ||
42 | cmd_error = SMMU_CERROR_ILL; | ||
43 | break; | ||
44 | } | ||
45 | - trace_smmuv3_cmdq_cfgi_ste_range(start, end); | ||
27 | + | 46 | + |
28 | extern bool is_supported_silicon_rev(uint32_t silicon_rev); | 47 | + mask = (1ULL << (range + 1)) - 1; |
29 | 48 | + sid_range.start = sid & ~mask; | |
30 | #define ASPEED_SCU_PROT_KEY 0x1688A8A8 | 49 | + sid_range.end = sid_range.start + mask; |
31 | diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c | 50 | + |
32 | index XXXXXXX..XXXXXXX 100644 | 51 | + trace_smmuv3_cmdq_cfgi_ste_range(sid_range.start, sid_range.end); |
33 | --- a/hw/misc/aspeed_scu.c | 52 | g_hash_table_foreach_remove(bs->configs, smmuv3_invalidate_ste, |
34 | +++ b/hw/misc/aspeed_scu.c | 53 | &sid_range); |
35 | @@ -XXX,XX +XXX,XX @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data, | 54 | break; |
36 | s->regs[reg] = data; | ||
37 | aspeed_scu_set_apb_freq(s); | ||
38 | break; | ||
39 | - | ||
40 | + case HW_STRAP1: | ||
41 | + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { | ||
42 | + s->regs[HW_STRAP1] |= data; | ||
43 | + return; | ||
44 | + } | ||
45 | + /* Jump to assignment below */ | ||
46 | + break; | ||
47 | + case SILICON_REV: | ||
48 | + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { | ||
49 | + s->regs[HW_STRAP1] &= ~data; | ||
50 | + } else { | ||
51 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
52 | + "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n", | ||
53 | + __func__, offset); | ||
54 | + } | ||
55 | + /* Avoid assignment below, we've handled everything */ | ||
56 | + return; | ||
57 | case FREQ_CNTR_EVAL: | ||
58 | case VGA_SCRATCH1 ... VGA_SCRATCH8: | ||
59 | case RNG_DATA: | ||
60 | - case SILICON_REV: | ||
61 | case FREE_CNTR4: | ||
62 | case FREE_CNTR4_EXT: | ||
63 | qemu_log_mask(LOG_GUEST_ERROR, | ||
64 | -- | 55 | -- |
65 | 2.17.1 | 56 | 2.20.1 |
66 | 57 | ||
67 | 58 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | These devices are currently causing some problems when a user is trying | 3 | Using mprotect() to change PROT_* does not change the MAP_ANON |
4 | to hot-plug or introspect them during runtime. Since these devices can | 4 | previously set with mmap(). Our linux-user version of MTE only |
5 | not be instantiated by the user at all (they need to be wired up in code | 5 | works with MAP_ANON pages, so losing PAGE_ANON caused MTE to |
6 | instead), we should mark them with user_creatable = false anyway, then we | 6 | stop working. |
7 | avoid at least the crashes with the hot-plugging. The introspection problem | ||
8 | will be handled by a separate patch. | ||
9 | 7 | ||
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 8 | Reported-by: Stephen Long <steplong@quicinc.com> |
11 | Message-id: 1531415537-26037-1-git-send-email-thuth@redhat.com | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
13 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 11 | Tested-by: Alex Bennée <alex.bennee@linaro.org> |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 13 | --- |
16 | hw/arm/bcm2836.c | 2 ++ | 14 | tests/tcg/aarch64/mte.h | 3 ++- |
17 | 1 file changed, 2 insertions(+) | 15 | accel/tcg/translate-all.c | 9 +++++-- |
16 | tests/tcg/aarch64/mte-6.c | 43 +++++++++++++++++++++++++++++++ | ||
17 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
18 | 4 files changed, 53 insertions(+), 4 deletions(-) | ||
19 | create mode 100644 tests/tcg/aarch64/mte-6.c | ||
18 | 20 | ||
19 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | 21 | diff --git a/tests/tcg/aarch64/mte.h b/tests/tcg/aarch64/mte.h |
20 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/bcm2836.c | 23 | --- a/tests/tcg/aarch64/mte.h |
22 | +++ b/hw/arm/bcm2836.c | 24 | +++ b/tests/tcg/aarch64/mte.h |
23 | @@ -XXX,XX +XXX,XX @@ static void bcm283x_class_init(ObjectClass *oc, void *data) | 25 | @@ -XXX,XX +XXX,XX @@ static void enable_mte(int tcf) |
24 | bc->info = data; | 26 | } |
25 | dc->realize = bcm2836_realize; | ||
26 | dc->props = bcm2836_props; | ||
27 | + /* Reason: Must be wired up in code (see raspi_init() function) */ | ||
28 | + dc->user_creatable = false; | ||
29 | } | 27 | } |
30 | 28 | ||
31 | static const TypeInfo bcm283x_type_info = { | 29 | -static void *alloc_mte_mem(size_t size) |
30 | +static void * alloc_mte_mem(size_t size) __attribute__((unused)); | ||
31 | +static void * alloc_mte_mem(size_t size) | ||
32 | { | ||
33 | void *p = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_MTE, | ||
34 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | ||
35 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/accel/tcg/translate-all.c | ||
38 | +++ b/accel/tcg/translate-all.c | ||
39 | @@ -XXX,XX +XXX,XX @@ void page_set_flags(target_ulong start, target_ulong end, int flags) | ||
40 | a missing call to h2g_valid. */ | ||
41 | assert(end - 1 <= GUEST_ADDR_MAX); | ||
42 | assert(start < end); | ||
43 | + /* Only set PAGE_ANON with new mappings. */ | ||
44 | + assert(!(flags & PAGE_ANON) || (flags & PAGE_RESET)); | ||
45 | assert_memory_lock(); | ||
46 | |||
47 | start = start & TARGET_PAGE_MASK; | ||
48 | @@ -XXX,XX +XXX,XX @@ void page_set_flags(target_ulong start, target_ulong end, int flags) | ||
49 | p->first_tb) { | ||
50 | tb_invalidate_phys_page(addr, 0); | ||
51 | } | ||
52 | - if (reset_target_data && p->target_data) { | ||
53 | + if (reset_target_data) { | ||
54 | g_free(p->target_data); | ||
55 | p->target_data = NULL; | ||
56 | + p->flags = flags; | ||
57 | + } else { | ||
58 | + /* Using mprotect on a page does not change MAP_ANON. */ | ||
59 | + p->flags = (p->flags & PAGE_ANON) | flags; | ||
60 | } | ||
61 | - p->flags = flags; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | diff --git a/tests/tcg/aarch64/mte-6.c b/tests/tcg/aarch64/mte-6.c | ||
66 | new file mode 100644 | ||
67 | index XXXXXXX..XXXXXXX | ||
68 | --- /dev/null | ||
69 | +++ b/tests/tcg/aarch64/mte-6.c | ||
70 | @@ -XXX,XX +XXX,XX @@ | ||
71 | +#include "mte.h" | ||
72 | + | ||
73 | +void pass(int sig, siginfo_t *info, void *uc) | ||
74 | +{ | ||
75 | + assert(info->si_code == SEGV_MTESERR); | ||
76 | + exit(0); | ||
77 | +} | ||
78 | + | ||
79 | +int main(void) | ||
80 | +{ | ||
81 | + enable_mte(PR_MTE_TCF_SYNC); | ||
82 | + | ||
83 | + void *brk = sbrk(16); | ||
84 | + if (brk == (void *)-1) { | ||
85 | + perror("sbrk"); | ||
86 | + return 2; | ||
87 | + } | ||
88 | + | ||
89 | + if (mprotect(brk, 16, PROT_READ | PROT_WRITE | PROT_MTE)) { | ||
90 | + perror("mprotect"); | ||
91 | + return 2; | ||
92 | + } | ||
93 | + | ||
94 | + int *p1, *p2; | ||
95 | + long excl = 1; | ||
96 | + | ||
97 | + asm("irg %0,%1,%2" : "=r"(p1) : "r"(brk), "r"(excl)); | ||
98 | + asm("gmi %0,%1,%0" : "+r"(excl) : "r"(p1)); | ||
99 | + asm("irg %0,%1,%2" : "=r"(p2) : "r"(brk), "r"(excl)); | ||
100 | + asm("stg %0,[%0]" : : "r"(p1)); | ||
101 | + | ||
102 | + *p1 = 0; | ||
103 | + | ||
104 | + struct sigaction sa; | ||
105 | + memset(&sa, 0, sizeof(sa)); | ||
106 | + sa.sa_sigaction = pass; | ||
107 | + sa.sa_flags = SA_SIGINFO; | ||
108 | + sigaction(SIGSEGV, &sa, NULL); | ||
109 | + | ||
110 | + *p2 = 0; | ||
111 | + | ||
112 | + abort(); | ||
113 | +} | ||
114 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
115 | index XXXXXXX..XXXXXXX 100644 | ||
116 | --- a/tests/tcg/aarch64/Makefile.target | ||
117 | +++ b/tests/tcg/aarch64/Makefile.target | ||
118 | @@ -XXX,XX +XXX,XX @@ AARCH64_TESTS += bti-2 | ||
119 | |||
120 | # MTE Tests | ||
121 | ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_MTE),) | ||
122 | -AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 | ||
123 | +AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-6 | ||
124 | mte-%: CFLAGS += -march=armv8.5-a+memtag | ||
125 | endif | ||
126 | |||
32 | -- | 127 | -- |
33 | 2.17.1 | 128 | 2.20.1 |
34 | 129 | ||
35 | 130 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | 'I' was being double-incremented; correctly within the inner loop | 3 | We can remove PAGE_WRITE when (internally) marking a page |
4 | and incorrectly within the outer loop. | 4 | read-only because it contains translated code. |
5 | |||
6 | This can be triggered by tests/tcg/aarch64/bti-2, after | ||
7 | having serviced SIGILL trampolines on the stack. | ||
5 | 8 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
9 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Message-id: 20180711103957.3040-1-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 12 | --- |
13 | target/arm/sve_helper.c | 4 ++-- | 13 | target/arm/mte_helper.c | 2 +- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 15 | ||
16 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | 16 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/sve_helper.c | 18 | --- a/target/arm/mte_helper.c |
19 | +++ b/target/arm/sve_helper.c | 19 | +++ b/target/arm/mte_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \ | 20 | @@ -XXX,XX +XXX,XX @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, |
21 | intptr_t i, oprsz = simd_oprsz(desc); \ | 21 | uint8_t *tags; |
22 | unsigned scale = simd_data(desc); \ | 22 | uintptr_t index; |
23 | uintptr_t ra = GETPC(); \ | 23 | |
24 | - for (i = 0; i < oprsz; i++) { \ | 24 | - if (!(flags & (ptr_access == MMU_DATA_STORE ? PAGE_WRITE : PAGE_READ))) { |
25 | + for (i = 0; i < oprsz; ) { \ | 25 | + if (!(flags & (ptr_access == MMU_DATA_STORE ? PAGE_WRITE_ORG : PAGE_READ))) { |
26 | uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ | 26 | /* SIGSEGV */ |
27 | do { \ | 27 | arm_cpu_tlb_fill(env_cpu(env), ptr, ptr_size, ptr_access, |
28 | TYPEM m = 0; \ | 28 | ptr_mmu_idx, false, ra); |
29 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \ | ||
30 | uintptr_t ra = GETPC(); \ | ||
31 | bool first = true; \ | ||
32 | mmap_lock(); \ | ||
33 | - for (i = 0; i < oprsz; i++) { \ | ||
34 | + for (i = 0; i < oprsz; ) { \ | ||
35 | uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ | ||
36 | do { \ | ||
37 | TYPEM m = 0; \ | ||
38 | -- | 29 | -- |
39 | 2.17.1 | 30 | 2.20.1 |
40 | 31 | ||
41 | 32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In gic_deactivate_irq() the interrupt number comes from the guest | ||
2 | (on a write to the GICC_DIR register), so we need to sanity check | ||
3 | that it isn't out of range before we use it as an array index. | ||
4 | Handle this in a similar manner to the check we do in | ||
5 | gic_complete_irq() for the GICC_EOI register. | ||
6 | 1 | ||
7 | The array overrun is not disastrous because the calling code | ||
8 | uses (value & 0x3ff) to extract the interrupt field, so the | ||
9 | only out-of-range values possible are 1020..1023, which allow | ||
10 | overrunning only from irq_state[] into the following | ||
11 | irq_target[] array which the guest can already manipulate. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
16 | Message-id: 20180712154152.32183-2-peter.maydell@linaro.org | ||
17 | --- | ||
18 | hw/intc/arm_gic.c | 16 +++++++++++++++- | ||
19 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/intc/arm_gic.c | ||
24 | +++ b/hw/intc/arm_gic.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static bool gic_eoi_split(GICState *s, int cpu, MemTxAttrs attrs) | ||
26 | static void gic_deactivate_irq(GICState *s, int cpu, int irq, MemTxAttrs attrs) | ||
27 | { | ||
28 | int cm = 1 << cpu; | ||
29 | - int group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); | ||
30 | + int group; | ||
31 | + | ||
32 | + if (irq >= s->num_irq) { | ||
33 | + /* | ||
34 | + * This handles two cases: | ||
35 | + * 1. If software writes the ID of a spurious interrupt [ie 1023] | ||
36 | + * to the GICC_DIR, the GIC ignores that write. | ||
37 | + * 2. If software writes the number of a non-existent interrupt | ||
38 | + * this must be a subcase of "value written is not an active interrupt" | ||
39 | + * and so this is UNPREDICTABLE. We choose to ignore it. | ||
40 | + */ | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); | ||
45 | |||
46 | if (!gic_eoi_split(s, cpu, attrs)) { | ||
47 | /* This is UNPREDICTABLE; we choose to ignore it */ | ||
48 | -- | ||
49 | 2.17.1 | ||
50 | |||
51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The GICD_ITARGETSR implementation still has some 11MPCore behaviour | ||
2 | that we were incorrectly using in our GICv1 and GICv2 implementations | ||
3 | for the case where the interrupt number is less than GIC_INTERNAL. | ||
4 | The desired behaviour here is: | ||
5 | * for 11MPCore: RAZ/WI for irqs 0..28; read a number matching the | ||
6 | CPU doing the read for irqs 29..31 | ||
7 | * for GICv1 and v2: RAZ/WI if uniprocessor; otherwise read a | ||
8 | number matching the CPU doing the read for all irqs < 32 | ||
9 | 1 | ||
10 | Stop squashing GICD_ITARGETSR to 0 for IRQs 0..28 unless this | ||
11 | is an 11MPCore GIC. | ||
12 | |||
13 | Reported-by: Jan Kiszka <jan.kiszka@web.de> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
17 | Message-id: 20180712154152.32183-3-peter.maydell@linaro.org | ||
18 | --- | ||
19 | hw/intc/arm_gic.c | 6 ++++-- | ||
20 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/hw/intc/arm_gic.c | ||
25 | +++ b/hw/intc/arm_gic.c | ||
26 | @@ -XXX,XX +XXX,XX @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs) | ||
27 | if (irq >= s->num_irq) { | ||
28 | goto bad_reg; | ||
29 | } | ||
30 | - if (irq >= 29 && irq <= 31) { | ||
31 | + if (irq < 29 && s->revision == REV_11MPCORE) { | ||
32 | + res = 0; | ||
33 | + } else if (irq < GIC_INTERNAL) { | ||
34 | res = cm; | ||
35 | } else { | ||
36 | res = GIC_TARGET(irq); | ||
37 | @@ -XXX,XX +XXX,XX @@ static void gic_dist_writeb(void *opaque, hwaddr offset, | ||
38 | if (irq >= s->num_irq) { | ||
39 | goto bad_reg; | ||
40 | } | ||
41 | - if (irq < 29) { | ||
42 | + if (irq < 29 && s->revision == REV_11MPCORE) { | ||
43 | value = 0; | ||
44 | } else if (irq < GIC_INTERNAL) { | ||
45 | value = ALL_CPU_MASK; | ||
46 | -- | ||
47 | 2.17.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | RX and TX interrupt bits were reversed, resulting in an endless sequence | 3 | Unfortuately, the elements of PAGE_* were not in numerical |
4 | of serial interupts in the emulated system and the following repeated | 4 | order and so PAGE_ANON was added to an "unused" bit. |
5 | error message when booting Linux. | 5 | As an arbitrary choice, move PAGE_TARGET_{1,2} together. |
6 | 6 | ||
7 | serial8250: too much work for irq61 | 7 | Cc: Laurent Vivier <laurent@vivier.eu> |
8 | 8 | Fixes: 26bab757d41b ("linux-user: Introduce PAGE_ANON") | |
9 | This results in a boot failure most of the time. | 9 | Buglink: https://bugs.launchpad.net/bugs/1922617 |
10 | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
11 | Qemu command line used to reproduce the problem: | 11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
12 | 12 | Reviewed-by: Laurent Vivier <laurent@vivier.eu> | |
13 | qemu-system-aarch64 -M raspi3 -m 1024 \ | 13 | Tested-by: Laurent Vivier <laurent@vivier.eu> |
14 | -kernel arch/arm64/boot/Image \ | 14 | Tested-by: Nathan Chancellor <nathan@kernel.org> |
15 | --append "rdinit=/sbin/init console=ttyS1,115200" | ||
16 | -initrd rootfs.cpio \ | ||
17 | -dtb arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb \ | ||
18 | -nographic -monitor null -serial null -serial stdio | ||
19 | |||
20 | This is with arm64:defconfig. The root file system was generated using | ||
21 | buildroot. | ||
22 | |||
23 | NB that this error likely arises from an erratum in the | ||
24 | BCM2835 datasheet where the TX and RX bits were swapped | ||
25 | in the AU_MU_IER_REG description (but correct for IIR): | ||
26 | https://elinux.org/BCM2835_datasheet_errata#p12 | ||
27 | |||
28 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
29 | Message-id: 1529355846-25102-1-git-send-email-linux@roeck-us.net | ||
30 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
31 | [PMM: added NB about datasheet] | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 16 | --- |
34 | hw/char/bcm2835_aux.c | 4 ++-- | 17 | include/exec/cpu-all.h | 4 ++-- |
35 | 1 file changed, 2 insertions(+), 2 deletions(-) | 18 | 1 file changed, 2 insertions(+), 2 deletions(-) |
36 | 19 | ||
37 | diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c | 20 | diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h |
38 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/hw/char/bcm2835_aux.c | 22 | --- a/include/exec/cpu-all.h |
40 | +++ b/hw/char/bcm2835_aux.c | 23 | +++ b/include/exec/cpu-all.h |
41 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ extern intptr_t qemu_host_page_mask; |
42 | #define AUX_MU_BAUD_REG 0x68 | 25 | #define PAGE_RESERVED 0x0100 |
43 | 26 | #endif | |
44 | /* bits in IER/IIR registers */ | 27 | /* Target-specific bits that will be used via page_get_flags(). */ |
45 | -#define TX_INT 0x1 | 28 | -#define PAGE_TARGET_1 0x0080 |
46 | -#define RX_INT 0x2 | 29 | -#define PAGE_TARGET_2 0x0200 |
47 | +#define RX_INT 0x1 | 30 | +#define PAGE_TARGET_1 0x0200 |
48 | +#define TX_INT 0x2 | 31 | +#define PAGE_TARGET_2 0x0400 |
49 | 32 | ||
50 | static void bcm2835_aux_update(BCM2835AuxState *s) | 33 | #if defined(CONFIG_USER_ONLY) |
51 | { | 34 | void page_dump(FILE *f); |
52 | -- | 35 | -- |
53 | 2.17.1 | 36 | 2.20.1 |
54 | 37 | ||
55 | 38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In get_page_addr_code(), we were incorrectly looking in the victim | ||
2 | TLB for an entry which matched the target address for reads, not | ||
3 | for code accesses. This meant that we could hit on a victim TLB | ||
4 | entry that indicated that the address was readable but not | ||
5 | executable, and incorrectly bypass the call to tlb_fill() which | ||
6 | should generate the guest MMU exception. Fix this bug. | ||
7 | 1 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20180713141636.18665-2-peter.maydell@linaro.org | ||
11 | --- | ||
12 | accel/tcg/cputlb.c | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/accel/tcg/cputlb.c | ||
18 | +++ b/accel/tcg/cputlb.c | ||
19 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | ||
20 | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); | ||
21 | mmu_idx = cpu_mmu_index(env, true); | ||
22 | if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))) { | ||
23 | - if (!VICTIM_TLB_HIT(addr_read, addr)) { | ||
24 | + if (!VICTIM_TLB_HIT(addr_code, addr)) { | ||
25 | tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0); | ||
26 | } | ||
27 | } | ||
28 | -- | ||
29 | 2.17.1 | ||
30 | |||
31 | diff view generated by jsdifflib |