1
ARM queue: nothing particularly exciting here, but no
1
Arm patches for rc3 : just a handful of bug fixes.
2
reason to sit on them for another week.
3
2
4
thanks
3
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit 61eedf7aec0e2395aabd628cc055096909a3ea15:
8
6
9
tests/prom-env: Ease time-out problems on slow hosts (2017-02-10 15:44:53 +0000)
7
The following changes since commit 4ecc984210ca1bf508a96a550ec8a93a5f833f6c:
10
8
11
are available in the git repository at:
9
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.2-rc3' into staging (2019-11-26 12:36:40 +0000)
12
10
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170210
11
are available in the Git repository at:
14
12
15
for you to fetch changes up to b4cc583f0285a2e1e78621dfba142f00ca47414a:
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191126
16
14
17
aspeed/smc: use a modulo to check segment limits (2017-02-10 17:40:30 +0000)
15
for you to fetch changes up to 6a4ef4e5d1084ce41fafa7d470a644b0fd3d9317:
16
17
target/arm: Honor HCR_EL2.TID3 trapping requirements (2019-11-26 13:55:37 +0000)
18
18
19
----------------------------------------------------------------
19
----------------------------------------------------------------
20
target-arm queue:
20
target-arm queue:
21
* aspeed: minor fixes
21
* handle FTYPE flag correctly in v7M exception return
22
* virt: declare fwcfg and virtio-mmio as DMA coherent in DT & ACPI
22
for v7M CPUs with an FPU (v8M CPUs were already correct)
23
* arm: enable basic TCG emulation of PMU for AArch64
23
* versal: Add the CRP as unimplemented
24
* Fix ISR_EL1 tracking when executing at EL2
25
* Honor HCR_EL2.TID3 trapping requirements
24
26
25
----------------------------------------------------------------
27
----------------------------------------------------------------
26
Alexander Graf (4):
28
Edgar E. Iglesias (1):
27
target-arm: Declare virtio-mmio as dma-coherent in dt
29
hw/arm: versal: Add the CRP as unimplemented
28
hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI
29
hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI
30
hw/arm/virt: Declare fwcfg as dma cache coherent in dt
31
30
32
Cédric Le Goater (4):
31
Jean-Hugues Deschênes (1):
33
aspeed: check for negative values returned by blk_getlength()
32
target/arm: Fix handling of cortex-m FTYPE flag in EXCRET
34
aspeed: remove useless comment on controller segment size
35
aspeed/smc: handle dummies only in fast read mode
36
aspeed/smc: use a modulo to check segment limits
37
33
38
Wei Huang (4):
34
Marc Zyngier (2):
39
target-arm: Add support for PMU register PMSELR_EL0
35
target/arm: Fix ISR_EL1 tracking when executing at EL2
40
target-arm: Add support for AArch64 PMU register PMXEVTYPER_EL0
36
target/arm: Honor HCR_EL2.TID3 trapping requirements
41
target-arm: Add support for PMU register PMINTENSET_EL1
42
target-arm: Enable vPMU support under TCG mode
43
37
44
target/arm/cpu.h | 4 +--
38
include/hw/arm/xlnx-versal.h | 3 ++
45
hw/arm/aspeed.c | 22 +++++++++-----
39
hw/arm/xlnx-versal.c | 2 ++
46
hw/arm/vexpress.c | 1 +
40
target/arm/helper.c | 83 ++++++++++++++++++++++++++++++++++++++++++--
47
hw/arm/virt-acpi-build.c | 2 ++
41
target/arm/m_helper.c | 7 ++--
48
hw/arm/virt.c | 4 ++-
42
4 files changed, 89 insertions(+), 6 deletions(-)
49
hw/ssi/aspeed_smc.c | 13 +++++----
50
target/arm/cpu.c | 2 +-
51
target/arm/helper.c | 74 ++++++++++++++++++++++++++++++++++++------------
52
8 files changed, 88 insertions(+), 34 deletions(-)
53
43
diff view generated by jsdifflib
Deleted patch
1
From: Wei Huang <wei@redhat.com>
2
1
3
This patch adds support for AArch64 register PMSELR_EL0. The existing
4
PMSELR definition is revised accordingly.
5
6
Signed-off-by: Wei Huang <wei@redhat.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
[PMM: Moved #ifndef CONFIG_USER_ONLY to cover new regdefs]
9
Message-id: 1486504171-26807-2-git-send-email-wei@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/cpu.h | 1 +
13
target/arm/helper.c | 27 +++++++++++++++++++++------
14
2 files changed, 22 insertions(+), 6 deletions(-)
15
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
19
+++ b/target/arm/cpu.h
20
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
21
uint32_t c9_pmovsr; /* perf monitor overflow status */
22
uint32_t c9_pmxevtyper; /* perf monitor event type */
23
uint32_t c9_pmuserenr; /* perf monitor user enable */
24
+ uint64_t c9_pmselr; /* perf monitor counter selection register */
25
uint32_t c9_pminten; /* perf monitor interrupt enables */
26
union { /* Memory attribute redirection */
27
struct {
28
diff --git a/target/arm/helper.c b/target/arm/helper.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/helper.c
31
+++ b/target/arm/helper.c
32
@@ -XXX,XX +XXX,XX @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)
33
return total_ticks - env->cp15.c15_ccnt;
34
}
35
36
+static void pmselr_write(CPUARMState *env, const ARMCPRegInfo *ri,
37
+ uint64_t value)
38
+{
39
+ /* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and
40
+ * PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the
41
+ * meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are
42
+ * accessed.
43
+ */
44
+ env->cp15.c9_pmselr = value & 0x1f;
45
+}
46
+
47
static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri,
48
uint64_t value)
49
{
50
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
51
/* Unimplemented so WI. */
52
{ .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4,
53
.access = PL0_W, .accessfn = pmreg_access, .type = ARM_CP_NOP },
54
- /* Since we don't implement any events, writing to PMSELR is UNPREDICTABLE.
55
- * We choose to RAZ/WI.
56
- */
57
- { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5,
58
- .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
59
- .accessfn = pmreg_access },
60
#ifndef CONFIG_USER_ONLY
61
+ { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5,
62
+ .access = PL0_RW, .type = ARM_CP_ALIAS,
63
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr),
64
+ .accessfn = pmreg_access, .writefn = pmselr_write,
65
+ .raw_writefn = raw_write},
66
+ { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64,
67
+ .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5,
68
+ .access = PL0_RW, .accessfn = pmreg_access,
69
+ .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr),
70
+ .writefn = pmselr_write, .raw_writefn = raw_write, },
71
{ .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0,
72
.access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO,
73
.readfn = pmccntr_read, .writefn = pmccntr_write32,
74
--
75
2.7.4
76
77
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Jean-Hugues Deschênes <Jean-Hugues.Deschenes@ossiaco.com>
2
2
3
write_boot_rom() does not check for negative values. This is more a
3
According to the PushStack() pseudocode in the armv7m RM,
4
problem for coverity than the actual code as the size of the flash
4
bit 4 of the LR should be set to NOT(CONTROL.PFCA) when
5
device is checked when the m25p80 object is created. If there is
5
an FPU is present. Current implementation is doing it for
6
anything wrong with the backing file, we should not even reach that
6
armv8, but not for armv7. This patch makes the existing
7
path.
7
logic applicable to both code paths.
8
8
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes@ossiaco.com>
10
Message-id: 1486648058-520-2-git-send-email-clg@kaod.org
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
hw/arm/aspeed.c | 14 ++++++++++++--
13
target/arm/m_helper.c | 7 +++----
15
1 file changed, 12 insertions(+), 2 deletions(-)
14
1 file changed, 3 insertions(+), 4 deletions(-)
16
15
17
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
16
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/aspeed.c
18
--- a/target/arm/m_helper.c
20
+++ b/hw/arm/aspeed.c
19
+++ b/target/arm/m_helper.c
21
@@ -XXX,XX +XXX,XX @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
20
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
22
{
21
if (env->v7m.secure) {
23
BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
22
lr |= R_V7M_EXCRET_S_MASK;
24
uint8_t *storage;
23
}
25
+ int64_t size;
24
- if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) {
26
25
- lr |= R_V7M_EXCRET_FTYPE_MASK;
27
- if (rom_size > blk_getlength(blk)) {
26
- }
28
- rom_size = blk_getlength(blk);
27
} else {
29
+ /* The block backend size should have already been 'validated' by
28
lr = R_V7M_EXCRET_RES1_MASK |
30
+ * the creation of the m25p80 object.
29
R_V7M_EXCRET_S_MASK |
31
+ */
30
R_V7M_EXCRET_DCRS_MASK |
32
+ size = blk_getlength(blk);
31
- R_V7M_EXCRET_FTYPE_MASK |
33
+ if (size <= 0) {
32
R_V7M_EXCRET_ES_MASK;
34
+ error_setg(errp, "failed to get flash size");
33
if (env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK) {
35
+ return;
34
lr |= R_V7M_EXCRET_SPSEL_MASK;
35
}
36
}
37
+ if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) {
38
+ lr |= R_V7M_EXCRET_FTYPE_MASK;
36
+ }
39
+ }
37
+
40
if (!arm_v7m_is_handler_mode(env)) {
38
+ if (rom_size > size) {
41
lr |= R_V7M_EXCRET_MODE_MASK;
39
+ rom_size = size;
40
}
42
}
41
42
storage = g_new0(uint8_t, rom_size);
43
--
43
--
44
2.7.4
44
2.20.1
45
45
46
46
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
The size of a segment is not necessarily a power of 2.
3
Add the CRP as unimplemented thus avoiding bus errors when
4
guests access these registers.
4
5
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-id: 1486648058-520-5-git-send-email-clg@kaod.org
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20191115154734.26449-2-edgar.iglesias@gmail.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
11
---
10
hw/ssi/aspeed_smc.c | 4 ++--
12
include/hw/arm/xlnx-versal.h | 3 +++
11
1 file changed, 2 insertions(+), 2 deletions(-)
13
hw/arm/xlnx-versal.c | 2 ++
14
2 files changed, 5 insertions(+)
12
15
13
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/ssi/aspeed_smc.c
18
--- a/include/hw/arm/xlnx-versal.h
16
+++ b/hw/ssi/aspeed_smc.c
19
+++ b/include/hw/arm/xlnx-versal.h
17
@@ -XXX,XX +XXX,XX @@ static uint32_t aspeed_smc_check_segment_addr(const AspeedSMCFlash *fl,
20
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
18
AspeedSegments seg;
21
#define MM_IOU_SCNTRS_SIZE 0x10000
19
22
#define MM_FPD_CRF 0xfd1a0000U
20
aspeed_smc_reg_to_segment(s->regs[R_SEG_ADDR0 + fl->id], &seg);
23
#define MM_FPD_CRF_SIZE 0x140000
21
- if ((addr & (seg.size - 1)) != addr) {
24
+
22
+ if ((addr % seg.size) != addr) {
25
+#define MM_PMC_CRP 0xf1260000U
23
qemu_log_mask(LOG_GUEST_ERROR,
26
+#define MM_PMC_CRP_SIZE 0x10000
24
"%s: invalid address 0x%08x for CS%d segment : "
27
#endif
25
"[ 0x%"HWADDR_PRIx" - 0x%"HWADDR_PRIx" ]\n",
28
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
26
s->ctrl->name, addr, fl->id, seg.addr,
29
index XXXXXXX..XXXXXXX 100644
27
seg.addr + seg.size);
30
--- a/hw/arm/xlnx-versal.c
28
+ addr %= seg.size;
31
+++ b/hw/arm/xlnx-versal.c
29
}
32
@@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s)
30
33
MM_CRL, MM_CRL_SIZE);
31
- addr &= seg.size - 1;
34
versal_unimp_area(s, "crf", &s->mr_ps,
32
return addr;
35
MM_FPD_CRF, MM_FPD_CRF_SIZE);
33
}
36
+ versal_unimp_area(s, "crp", &s->mr_ps,
34
37
+ MM_PMC_CRP, MM_PMC_CRP_SIZE);
38
versal_unimp_area(s, "iou-scntr", &s->mr_ps,
39
MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE);
40
versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps,
35
--
41
--
36
2.7.4
42
2.20.1
37
43
38
44
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: Marc Zyngier <maz@kernel.org>
2
2
3
In order to support Linux perf, which uses PMXEVTYPER register,
3
The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1,
4
this patch adds read/write access support for PMXEVTYPER. The access
4
ISR_EL1 shows the pending status of the physical IRQ, FIQ, or
5
is CONSTRAINED UNPREDICTABLE when PMSELR is not 0x1f. Additionally
5
SError interrupts.
6
this patch adds support for PMXEVTYPER_EL0.
7
6
8
Signed-off-by: Wei Huang <wei@redhat.com>
7
Unfortunately, QEMU's implementation only considers the HCR_EL2
9
Message-id: 1486504171-26807-3-git-send-email-wei@redhat.com
8
bits, and ignores the current exception level. This means a hypervisor
9
trying to look at its own interrupt state actually sees the guest
10
state, which is unexpected and breaks KVM as of Linux 5.3.
11
12
Instead, check for the running EL and return the physical bits
13
if not running in a virtualized context.
14
15
Fixes: 636540e9c40b
16
Cc: qemu-stable@nongnu.org
17
Reported-by: Quentin Perret <qperret@google.com>
18
Signed-off-by: Marc Zyngier <maz@kernel.org>
19
Message-id: 20191122135833.28953-1-maz@kernel.org
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
23
---
13
target/arm/cpu.h | 1 -
24
target/arm/helper.c | 7 +++++--
14
target/arm/helper.c | 30 +++++++++++++++++++++++++-----
25
1 file changed, 5 insertions(+), 2 deletions(-)
15
2 files changed, 25 insertions(+), 6 deletions(-)
16
26
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
22
uint64_t c9_pmcr; /* performance monitor control register */
23
uint64_t c9_pmcnten; /* perf monitor counter enables */
24
uint32_t c9_pmovsr; /* perf monitor overflow status */
25
- uint32_t c9_pmxevtyper; /* perf monitor event type */
26
uint32_t c9_pmuserenr; /* perf monitor user enable */
27
uint64_t c9_pmselr; /* perf monitor counter selection register */
28
uint32_t c9_pminten; /* perf monitor interrupt enables */
29
diff --git a/target/arm/helper.c b/target/arm/helper.c
27
diff --git a/target/arm/helper.c b/target/arm/helper.c
30
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/helper.c
29
--- a/target/arm/helper.c
32
+++ b/target/arm/helper.c
30
+++ b/target/arm/helper.c
33
@@ -XXX,XX +XXX,XX @@ static void pmovsr_write(CPUARMState *env, const ARMCPRegInfo *ri,
31
@@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri)
34
static void pmxevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri,
32
CPUState *cs = env_cpu(env);
35
uint64_t value)
33
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
36
{
34
uint64_t ret = 0;
37
- env->cp15.c9_pmxevtyper = value & 0xff;
35
+ bool allow_virt = (arm_current_el(env) == 1 &&
38
+ /* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when
36
+ (!arm_is_secure_below_el3(env) ||
39
+ * PMSELR value is equal to or greater than the number of implemented
37
+ (env->cp15.scr_el3 & SCR_EEL2)));
40
+ * counters, but not equal to 0x1f. We opt to behave as a RAZ/WI.
38
41
+ */
39
- if (hcr_el2 & HCR_IMO) {
42
+ if (env->cp15.c9_pmselr == 0x1f) {
40
+ if (allow_virt && (hcr_el2 & HCR_IMO)) {
43
+ pmccfiltr_write(env, ri, value);
41
if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) {
44
+ }
42
ret |= CPSR_I;
45
+}
43
}
46
+
44
@@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri)
47
+static uint64_t pmxevtyper_read(CPUARMState *env, const ARMCPRegInfo *ri)
45
}
48
+{
46
}
49
+ /* We opt to behave as a RAZ/WI when attempts to access PMXEVTYPER
47
50
+ * are CONSTRAINED UNPREDICTABLE. See comments in pmxevtyper_write().
48
- if (hcr_el2 & HCR_FMO) {
51
+ */
49
+ if (allow_virt && (hcr_el2 & HCR_FMO)) {
52
+ if (env->cp15.c9_pmselr == 0x1f) {
50
if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) {
53
+ return env->cp15.pmccfiltr_el0;
51
ret |= CPSR_F;
54
+ } else {
52
}
55
+ return 0;
56
+ }
57
}
58
59
static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri,
60
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
61
.fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0),
62
.resetvalue = 0, },
63
{ .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1,
64
- .access = PL0_RW,
65
- .fieldoffset = offsetof(CPUARMState, cp15.c9_pmxevtyper),
66
- .accessfn = pmreg_access, .writefn = pmxevtyper_write,
67
- .raw_writefn = raw_write },
68
+ .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access,
69
+ .writefn = pmxevtyper_write, .readfn = pmxevtyper_read },
70
+ { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64,
71
+ .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1,
72
+ .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access,
73
+ .writefn = pmxevtyper_write, .readfn = pmxevtyper_read },
74
/* Unimplemented, RAZ/WI. */
75
{ .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2,
76
.access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
77
--
53
--
78
2.7.4
54
2.20.1
79
55
80
56
diff view generated by jsdifflib
Deleted patch
1
From: Wei Huang <wei@redhat.com>
2
1
3
This patch adds access support for PMINTENSET_EL1.
4
5
Signed-off-by: Wei Huang <wei@redhat.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1486504171-26807-4-git-send-email-wei@redhat.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/cpu.h | 2 +-
11
target/arm/helper.c | 10 +++++++++-
12
2 files changed, 10 insertions(+), 2 deletions(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
19
uint32_t c9_pmovsr; /* perf monitor overflow status */
20
uint32_t c9_pmuserenr; /* perf monitor user enable */
21
uint64_t c9_pmselr; /* perf monitor counter selection register */
22
- uint32_t c9_pminten; /* perf monitor interrupt enables */
23
+ uint64_t c9_pminten; /* perf monitor interrupt enables */
24
union { /* Memory attribute redirection */
25
struct {
26
#ifdef HOST_WORDS_BIGENDIAN
27
diff --git a/target/arm/helper.c b/target/arm/helper.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/helper.c
30
+++ b/target/arm/helper.c
31
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
32
.writefn = pmuserenr_write, .raw_writefn = raw_write },
33
{ .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1,
34
.access = PL1_RW, .accessfn = access_tpm,
35
- .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
36
+ .type = ARM_CP_ALIAS,
37
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten),
38
.resetvalue = 0,
39
.writefn = pmintenset_write, .raw_writefn = raw_write },
40
+ { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64,
41
+ .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1,
42
+ .access = PL1_RW, .accessfn = access_tpm,
43
+ .type = ARM_CP_IO,
44
+ .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
45
+ .writefn = pmintenset_write, .raw_writefn = raw_write,
46
+ .resetvalue = 0x0 },
47
{ .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2,
48
.access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS,
49
.fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
50
--
51
2.7.4
52
53
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: Marc Zyngier <maz@kernel.org>
2
2
3
This patch contains several fixes to enable vPMU under TCG mode. It
3
HCR_EL2.TID3 mandates that access from EL1 to a long list of id
4
first removes the checking of kvm_enabled() while unsetting
4
registers traps to EL2, and QEMU has so far ignored this requirement.
5
ARM_FEATURE_PMU. With it, the .pmu option can be used to turn on/off vPMU
5
6
under TCG mode. Secondly the PMU node of DT table is now created under TCG.
6
This breaks (among other things) KVM guests that have PtrAuth enabled,
7
The last fix is to disable the masking of PMUver field of ID_AA64DFR0_EL1.
7
while the hypervisor doesn't want to expose the feature to its guest.
8
8
To achieve this, KVM traps the ID registers (ID_AA64ISAR1_EL1 in this
9
Signed-off-by: Wei Huang <wei@redhat.com>
9
case), and masks out the unsupported feature.
10
11
QEMU not honoring the trap request means that the guest observes
12
that the feature is present in the HW, starts using it, and dies
13
a horrible death when KVM injects an UNDEF, because the feature
14
*really* isn't supported.
15
16
Do the right thing by trapping to EL2 if HCR_EL2.TID3 is set.
17
18
Note that this change does not include trapping of the MVFR
19
registers from AArch32 (they are accessed via the VMRS
20
instruction and need to be handled in a different way).
21
22
Reported-by: Will Deacon <will@kernel.org>
23
Signed-off-by: Marc Zyngier <maz@kernel.org>
24
Tested-by: Will Deacon <will@kernel.org>
25
Message-id: 20191123115618.29230-1-maz@kernel.org
26
[PMM: added missing accessfn line for ID_AA4PFR2_EL1_RESERVED;
27
changed names of access functions to include _tid3]
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
28
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 1486504171-26807-5-git-send-email-wei@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
30
---
14
hw/arm/virt.c | 2 +-
31
target/arm/helper.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
15
target/arm/cpu.c | 2 +-
32
1 file changed, 76 insertions(+)
16
target/arm/helper.c | 7 +------
33
17
3 files changed, 3 insertions(+), 8 deletions(-)
18
19
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/virt.c
22
+++ b/hw/arm/virt.c
23
@@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
24
CPU_FOREACH(cpu) {
25
armcpu = ARM_CPU(cpu);
26
if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU) ||
27
- !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) {
28
+ (kvm_enabled() && !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ)))) {
29
return;
30
}
31
}
32
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/cpu.c
35
+++ b/target/arm/cpu.c
36
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
37
unset_feature(env, ARM_FEATURE_EL2);
38
}
39
40
- if (!cpu->has_pmu || !kvm_enabled()) {
41
+ if (!cpu->has_pmu) {
42
cpu->has_pmu = false;
43
unset_feature(env, ARM_FEATURE_PMU);
44
}
45
diff --git a/target/arm/helper.c b/target/arm/helper.c
34
diff --git a/target/arm/helper.c b/target/arm/helper.c
46
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
47
--- a/target/arm/helper.c
36
--- a/target/arm/helper.c
48
+++ b/target/arm/helper.c
37
+++ b/target/arm/helper.c
38
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = {
39
REGINFO_SENTINEL
40
};
41
42
+static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
43
+ bool isread)
44
+{
45
+ if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) {
46
+ return CP_ACCESS_TRAP_EL2;
47
+ }
48
+
49
+ return CP_ACCESS_OK;
50
+}
51
+
52
+static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
53
+ bool isread)
54
+{
55
+ if (arm_feature(env, ARM_FEATURE_V8)) {
56
+ return access_aa64_tid3(env, ri, isread);
57
+ }
58
+
59
+ return CP_ACCESS_OK;
60
+}
61
+
62
void register_cp_regs_for_features(ARMCPU *cpu)
63
{
64
/* Register all the coprocessor registers based on feature bits */
49
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
65
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
66
{ .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH,
67
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0,
68
.access = PL1_R, .type = ARM_CP_CONST,
69
+ .accessfn = access_aa32_tid3,
70
.resetvalue = cpu->id_pfr0 },
71
/* ID_PFR1 is not a plain ARM_CP_CONST because we don't know
72
* the value of the GIC field until after we define these regs.
73
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
74
{ .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH,
75
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
76
.access = PL1_R, .type = ARM_CP_NO_RAW,
77
+ .accessfn = access_aa32_tid3,
78
.readfn = id_pfr1_read,
79
.writefn = arm_cp_write_ignore },
80
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
81
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
82
.access = PL1_R, .type = ARM_CP_CONST,
83
+ .accessfn = access_aa32_tid3,
84
.resetvalue = cpu->id_dfr0 },
85
{ .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH,
86
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3,
87
.access = PL1_R, .type = ARM_CP_CONST,
88
+ .accessfn = access_aa32_tid3,
89
.resetvalue = cpu->id_afr0 },
90
{ .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH,
91
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4,
92
.access = PL1_R, .type = ARM_CP_CONST,
93
+ .accessfn = access_aa32_tid3,
94
.resetvalue = cpu->id_mmfr0 },
95
{ .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH,
96
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5,
97
.access = PL1_R, .type = ARM_CP_CONST,
98
+ .accessfn = access_aa32_tid3,
99
.resetvalue = cpu->id_mmfr1 },
100
{ .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH,
101
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6,
102
.access = PL1_R, .type = ARM_CP_CONST,
103
+ .accessfn = access_aa32_tid3,
104
.resetvalue = cpu->id_mmfr2 },
105
{ .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH,
106
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7,
107
.access = PL1_R, .type = ARM_CP_CONST,
108
+ .accessfn = access_aa32_tid3,
109
.resetvalue = cpu->id_mmfr3 },
110
{ .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH,
111
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0,
112
.access = PL1_R, .type = ARM_CP_CONST,
113
+ .accessfn = access_aa32_tid3,
114
.resetvalue = cpu->isar.id_isar0 },
115
{ .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH,
116
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1,
117
.access = PL1_R, .type = ARM_CP_CONST,
118
+ .accessfn = access_aa32_tid3,
119
.resetvalue = cpu->isar.id_isar1 },
120
{ .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH,
121
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2,
122
.access = PL1_R, .type = ARM_CP_CONST,
123
+ .accessfn = access_aa32_tid3,
124
.resetvalue = cpu->isar.id_isar2 },
125
{ .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH,
126
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3,
127
.access = PL1_R, .type = ARM_CP_CONST,
128
+ .accessfn = access_aa32_tid3,
129
.resetvalue = cpu->isar.id_isar3 },
130
{ .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH,
131
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4,
132
.access = PL1_R, .type = ARM_CP_CONST,
133
+ .accessfn = access_aa32_tid3,
134
.resetvalue = cpu->isar.id_isar4 },
135
{ .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH,
136
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5,
137
.access = PL1_R, .type = ARM_CP_CONST,
138
+ .accessfn = access_aa32_tid3,
139
.resetvalue = cpu->isar.id_isar5 },
140
{ .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH,
141
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6,
142
.access = PL1_R, .type = ARM_CP_CONST,
143
+ .accessfn = access_aa32_tid3,
144
.resetvalue = cpu->id_mmfr4 },
145
{ .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH,
146
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7,
147
.access = PL1_R, .type = ARM_CP_CONST,
148
+ .accessfn = access_aa32_tid3,
149
.resetvalue = cpu->isar.id_isar6 },
150
REGINFO_SENTINEL
151
};
152
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
153
{ .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64,
154
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0,
155
.access = PL1_R, .type = ARM_CP_NO_RAW,
156
+ .accessfn = access_aa64_tid3,
157
.readfn = id_aa64pfr0_read,
158
.writefn = arm_cp_write_ignore },
159
{ .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64,
160
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1,
161
.access = PL1_R, .type = ARM_CP_CONST,
162
+ .accessfn = access_aa64_tid3,
163
.resetvalue = cpu->isar.id_aa64pfr1},
164
{ .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
165
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2,
166
.access = PL1_R, .type = ARM_CP_CONST,
167
+ .accessfn = access_aa64_tid3,
168
.resetvalue = 0 },
169
{ .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
170
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3,
171
.access = PL1_R, .type = ARM_CP_CONST,
172
+ .accessfn = access_aa64_tid3,
173
.resetvalue = 0 },
174
{ .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64,
175
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4,
176
.access = PL1_R, .type = ARM_CP_CONST,
177
+ .accessfn = access_aa64_tid3,
178
/* At present, only SVEver == 0 is defined anyway. */
179
.resetvalue = 0 },
180
{ .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
181
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5,
182
.access = PL1_R, .type = ARM_CP_CONST,
183
+ .accessfn = access_aa64_tid3,
184
.resetvalue = 0 },
185
{ .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
186
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6,
187
.access = PL1_R, .type = ARM_CP_CONST,
188
+ .accessfn = access_aa64_tid3,
189
.resetvalue = 0 },
190
{ .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
191
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7,
192
.access = PL1_R, .type = ARM_CP_CONST,
193
+ .accessfn = access_aa64_tid3,
194
.resetvalue = 0 },
50
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64,
195
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64,
51
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
196
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
52
.access = PL1_R, .type = ARM_CP_CONST,
197
.access = PL1_R, .type = ARM_CP_CONST,
53
- /* We mask out the PMUVer field, because we don't currently
198
+ .accessfn = access_aa64_tid3,
54
- * implement the PMU. Not advertising it prevents the guest
199
.resetvalue = cpu->id_aa64dfr0 },
55
- * from trying to use it and getting UNDEFs on registers we
56
- * don't implement.
57
- */
58
- .resetvalue = cpu->id_aa64dfr0 & ~0xf00 },
59
+ .resetvalue = cpu->id_aa64dfr0 },
60
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64,
200
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64,
61
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1,
201
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1,
62
.access = PL1_R, .type = ARM_CP_CONST,
202
.access = PL1_R, .type = ARM_CP_CONST,
203
+ .accessfn = access_aa64_tid3,
204
.resetvalue = cpu->id_aa64dfr1 },
205
{ .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
206
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2,
207
.access = PL1_R, .type = ARM_CP_CONST,
208
+ .accessfn = access_aa64_tid3,
209
.resetvalue = 0 },
210
{ .name = "ID_AA64DFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
211
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 3,
212
.access = PL1_R, .type = ARM_CP_CONST,
213
+ .accessfn = access_aa64_tid3,
214
.resetvalue = 0 },
215
{ .name = "ID_AA64AFR0_EL1", .state = ARM_CP_STATE_AA64,
216
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 4,
217
.access = PL1_R, .type = ARM_CP_CONST,
218
+ .accessfn = access_aa64_tid3,
219
.resetvalue = cpu->id_aa64afr0 },
220
{ .name = "ID_AA64AFR1_EL1", .state = ARM_CP_STATE_AA64,
221
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 5,
222
.access = PL1_R, .type = ARM_CP_CONST,
223
+ .accessfn = access_aa64_tid3,
224
.resetvalue = cpu->id_aa64afr1 },
225
{ .name = "ID_AA64AFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
226
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 6,
227
.access = PL1_R, .type = ARM_CP_CONST,
228
+ .accessfn = access_aa64_tid3,
229
.resetvalue = 0 },
230
{ .name = "ID_AA64AFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
231
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 7,
232
.access = PL1_R, .type = ARM_CP_CONST,
233
+ .accessfn = access_aa64_tid3,
234
.resetvalue = 0 },
235
{ .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64,
236
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0,
237
.access = PL1_R, .type = ARM_CP_CONST,
238
+ .accessfn = access_aa64_tid3,
239
.resetvalue = cpu->isar.id_aa64isar0 },
240
{ .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64,
241
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1,
242
.access = PL1_R, .type = ARM_CP_CONST,
243
+ .accessfn = access_aa64_tid3,
244
.resetvalue = cpu->isar.id_aa64isar1 },
245
{ .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
246
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2,
247
.access = PL1_R, .type = ARM_CP_CONST,
248
+ .accessfn = access_aa64_tid3,
249
.resetvalue = 0 },
250
{ .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
251
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3,
252
.access = PL1_R, .type = ARM_CP_CONST,
253
+ .accessfn = access_aa64_tid3,
254
.resetvalue = 0 },
255
{ .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
256
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4,
257
.access = PL1_R, .type = ARM_CP_CONST,
258
+ .accessfn = access_aa64_tid3,
259
.resetvalue = 0 },
260
{ .name = "ID_AA64ISAR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
261
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 5,
262
.access = PL1_R, .type = ARM_CP_CONST,
263
+ .accessfn = access_aa64_tid3,
264
.resetvalue = 0 },
265
{ .name = "ID_AA64ISAR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
266
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 6,
267
.access = PL1_R, .type = ARM_CP_CONST,
268
+ .accessfn = access_aa64_tid3,
269
.resetvalue = 0 },
270
{ .name = "ID_AA64ISAR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
271
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 7,
272
.access = PL1_R, .type = ARM_CP_CONST,
273
+ .accessfn = access_aa64_tid3,
274
.resetvalue = 0 },
275
{ .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64,
276
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0,
277
.access = PL1_R, .type = ARM_CP_CONST,
278
+ .accessfn = access_aa64_tid3,
279
.resetvalue = cpu->isar.id_aa64mmfr0 },
280
{ .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64,
281
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1,
282
.access = PL1_R, .type = ARM_CP_CONST,
283
+ .accessfn = access_aa64_tid3,
284
.resetvalue = cpu->isar.id_aa64mmfr1 },
285
{ .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
286
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2,
287
.access = PL1_R, .type = ARM_CP_CONST,
288
+ .accessfn = access_aa64_tid3,
289
.resetvalue = 0 },
290
{ .name = "ID_AA64MMFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
291
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3,
292
.access = PL1_R, .type = ARM_CP_CONST,
293
+ .accessfn = access_aa64_tid3,
294
.resetvalue = 0 },
295
{ .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
296
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4,
297
.access = PL1_R, .type = ARM_CP_CONST,
298
+ .accessfn = access_aa64_tid3,
299
.resetvalue = 0 },
300
{ .name = "ID_AA64MMFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
301
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 5,
302
.access = PL1_R, .type = ARM_CP_CONST,
303
+ .accessfn = access_aa64_tid3,
304
.resetvalue = 0 },
305
{ .name = "ID_AA64MMFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
306
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 6,
307
.access = PL1_R, .type = ARM_CP_CONST,
308
+ .accessfn = access_aa64_tid3,
309
.resetvalue = 0 },
310
{ .name = "ID_AA64MMFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
311
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 7,
312
.access = PL1_R, .type = ARM_CP_CONST,
313
+ .accessfn = access_aa64_tid3,
314
.resetvalue = 0 },
315
{ .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64,
316
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0,
317
.access = PL1_R, .type = ARM_CP_CONST,
318
+ .accessfn = access_aa64_tid3,
319
.resetvalue = cpu->isar.mvfr0 },
320
{ .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64,
321
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1,
322
.access = PL1_R, .type = ARM_CP_CONST,
323
+ .accessfn = access_aa64_tid3,
324
.resetvalue = cpu->isar.mvfr1 },
325
{ .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64,
326
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2,
327
.access = PL1_R, .type = ARM_CP_CONST,
328
+ .accessfn = access_aa64_tid3,
329
.resetvalue = cpu->isar.mvfr2 },
330
{ .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
331
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3,
332
.access = PL1_R, .type = ARM_CP_CONST,
333
+ .accessfn = access_aa64_tid3,
334
.resetvalue = 0 },
335
{ .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
336
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4,
337
.access = PL1_R, .type = ARM_CP_CONST,
338
+ .accessfn = access_aa64_tid3,
339
.resetvalue = 0 },
340
{ .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
341
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5,
342
.access = PL1_R, .type = ARM_CP_CONST,
343
+ .accessfn = access_aa64_tid3,
344
.resetvalue = 0 },
345
{ .name = "MVFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
346
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6,
347
.access = PL1_R, .type = ARM_CP_CONST,
348
+ .accessfn = access_aa64_tid3,
349
.resetvalue = 0 },
350
{ .name = "MVFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
351
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7,
352
.access = PL1_R, .type = ARM_CP_CONST,
353
+ .accessfn = access_aa64_tid3,
354
.resetvalue = 0 },
355
{ .name = "PMCEID0", .state = ARM_CP_STATE_AA32,
356
.cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6,
63
--
357
--
64
2.7.4
358
2.20.1
65
359
66
360
diff view generated by jsdifflib
Deleted patch
1
From: Alexander Graf <agraf@suse.de>
2
1
3
QEMU emulated hardware is always dma coherent with its guest. We do
4
annotate that correctly on the PCI host controller, but left out
5
virtio-mmio.
6
7
Recent kernels have started to interpret that flag rather than take
8
dma coherency as granted with virtio-mmio. While that is considered
9
a kernel bug, as it breaks previously working systems, it showed that
10
our dt description is incomplete.
11
12
This patch adds the respective marker that allows guest OSs to evaluate
13
that our virtio-mmio devices are indeed cache coherent.
14
15
Signed-off-by: Alexander Graf <agraf@suse.de>
16
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
17
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
18
Message-id: 1486644810-33181-2-git-send-email-agraf@suse.de
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
hw/arm/vexpress.c | 1 +
22
hw/arm/virt.c | 1 +
23
2 files changed, 2 insertions(+)
24
25
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/arm/vexpress.c
28
+++ b/hw/arm/vexpress.c
29
@@ -XXX,XX +XXX,XX @@ static int add_virtio_mmio_node(void *fdt, uint32_t acells, uint32_t scells,
30
acells, addr, scells, size);
31
qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", intc);
32
qemu_fdt_setprop_cells(fdt, nodename, "interrupts", 0, irq, 1);
33
+ qemu_fdt_setprop(fdt, nodename, "dma-coherent", NULL, 0);
34
g_free(nodename);
35
if (rc) {
36
return -1;
37
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/arm/virt.c
40
+++ b/hw/arm/virt.c
41
@@ -XXX,XX +XXX,XX @@ static void create_virtio_devices(const VirtMachineState *vms, qemu_irq *pic)
42
qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
43
GIC_FDT_IRQ_TYPE_SPI, irq,
44
GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
45
+ qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
46
g_free(nodename);
47
}
48
}
49
--
50
2.7.4
51
52
diff view generated by jsdifflib
Deleted patch
1
From: Alexander Graf <agraf@suse.de>
2
1
3
Virtio-mmio devices can directly access guest memory and do so in cache
4
coherent fashion. Tell the guest about that fact when it's using ACPI.
5
6
Signed-off-by: Alexander Graf <agraf@suse.de>
7
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
9
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
10
Message-id: 1486644810-33181-3-git-send-email-agraf@suse.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/virt-acpi-build.c | 1 +
14
1 file changed, 1 insertion(+)
15
16
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/virt-acpi-build.c
19
+++ b/hw/arm/virt-acpi-build.c
20
@@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_virtio(Aml *scope,
21
Aml *dev = aml_device("VR%02u", i);
22
aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005")));
23
aml_append(dev, aml_name_decl("_UID", aml_int(i)));
24
+ aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
25
26
Aml *crs = aml_resource_template();
27
aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
28
--
29
2.7.4
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Alexander Graf <agraf@suse.de>
2
1
3
Fw-cfg recently learned how to directly access guest memory and does so in
4
cache coherent fashion. Tell the guest about that fact when it's using ACPI.
5
6
Signed-off-by: Alexander Graf <agraf@suse.de>
7
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
9
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
10
Message-id: 1486644810-33181-4-git-send-email-agraf@suse.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/virt-acpi-build.c | 1 +
14
1 file changed, 1 insertion(+)
15
16
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/virt-acpi-build.c
19
+++ b/hw/arm/virt-acpi-build.c
20
@@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMapEntry *fw_cfg_memmap)
21
aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
22
/* device present, functioning, decoding, not shown in UI */
23
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
24
+ aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
25
26
Aml *crs = aml_resource_template();
27
aml_append(crs, aml_memory32_fixed(fw_cfg_memmap->base,
28
--
29
2.7.4
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Alexander Graf <agraf@suse.de>
2
1
3
Fw-cfg recently learned how to directly access guest memory and does so in
4
cache coherent fashion. Tell the guest about that fact when it's using DT.
5
6
Signed-off-by: Alexander Graf <agraf@suse.de>
7
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
8
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
9
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
10
Message-id: 1486644810-33181-5-git-send-email-agraf@suse.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/virt.c | 1 +
14
1 file changed, 1 insertion(+)
15
16
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/virt.c
19
+++ b/hw/arm/virt.c
20
@@ -XXX,XX +XXX,XX @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
21
"compatible", "qemu,fw-cfg-mmio");
22
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
23
2, base, 2, size);
24
+ qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
25
g_free(nodename);
26
return fw_cfg;
27
}
28
--
29
2.7.4
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Cédric Le Goater <clg@kaod.org>
2
1
3
The flash devices used for the FMC controller (BMC firmware) are well
4
defined for each Aspeed machine and are all smaller than the default
5
mapping window size, at least for CE0 which is the chip the SoC boots
6
from.
7
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 1486648058-520-3-git-send-email-clg@kaod.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/aspeed.c | 8 +++-----
14
1 file changed, 3 insertions(+), 5 deletions(-)
15
16
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/aspeed.c
19
+++ b/hw/arm/aspeed.c
20
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
21
DriveInfo *dinfo = drive_get_next(IF_MTD);
22
qemu_irq cs_line;
23
24
- /*
25
- * FIXME: check that we are not using a flash module exceeding
26
- * the controller segment size
27
- */
28
fl->flash = ssi_create_slave_no_init(s->spi, flashtype);
29
if (dinfo) {
30
qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo),
31
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
32
33
/*
34
* create a ROM region using the default mapping window size of
35
- * the flash module.
36
+ * the flash module. The window size is 64MB for the AST2400
37
+ * SoC and 128MB for the AST2500 SoC, which is twice as big as
38
+ * needed by the flash modules of the Aspeed machines.
39
*/
40
memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
41
fl->size, &error_abort);
42
--
43
2.7.4
44
45
diff view generated by jsdifflib
Deleted patch
1
From: Cédric Le Goater <clg@kaod.org>
2
1
3
HW works fine in normal read mode with dummy bytes being set. So let's
4
check this case to not transfer bytes.
5
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Message-id: 1486648058-520-4-git-send-email-clg@kaod.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
hw/ssi/aspeed_smc.c | 9 ++++++---
11
1 file changed, 6 insertions(+), 3 deletions(-)
12
13
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/ssi/aspeed_smc.c
16
+++ b/hw/ssi/aspeed_smc.c
17
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_smc_flash_read(void *opaque, hwaddr addr, unsigned size)
18
/*
19
* Use fake transfers to model dummy bytes. The value should
20
* be configured to some non-zero value in fast read mode and
21
- * zero in read mode.
22
+ * zero in read mode. But, as the HW allows inconsistent
23
+ * settings, let's check for fast read mode.
24
*/
25
- for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) {
26
- ssi_transfer(fl->controller->spi, 0xFF);
27
+ if (aspeed_smc_flash_mode(fl) == CTRL_FREADMODE) {
28
+ for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) {
29
+ ssi_transfer(fl->controller->spi, 0xFF);
30
+ }
31
}
32
33
for (i = 0; i < size; i++) {
34
--
35
2.7.4
36
37
diff view generated by jsdifflib