1 | A last arm pullreq before rc0. This is mostly bug fixes, | 1 | Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code. |
---|---|---|---|
2 | though you could call adding the missing local timer | ||
3 | support to bcm2836_control a new feature I suppose -- | ||
4 | in any case it's a small and localised change. | ||
5 | 2 | ||
6 | thanks | ||
7 | -- PMM | 3 | -- PMM |
8 | 4 | ||
9 | The following changes since commit 7074ab12c81a1b2b1e0e1c40983f56b2c5ccc494: | 5 | The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236: |
10 | 6 | ||
11 | Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-03-14 16:19:37 +0000) | 7 | Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700) |
12 | 8 | ||
13 | are available in the Git repository at: | 9 | are available in the Git repository at: |
14 | 10 | ||
15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190315 | 11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801 |
16 | 12 | ||
17 | for you to fetch changes up to 5de56742a3c91de3d646326bec43a989bba83ca4: | 13 | for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc: |
18 | 14 | ||
19 | target/arm: Check access permission to ADDVL/ADDPL/RDVL (2019-03-15 11:12:29 +0000) | 15 | target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100) |
20 | 16 | ||
21 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
22 | target-arm queue: | 18 | target-arm queue: |
23 | * Add missing SVE-enabled check to ADDVL/ADDPL/RDVL | 19 | * Fix KVM SVE ID register probe code |
24 | * virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number | ||
25 | * virt-acpi-build: Fix SMMUv3 GSIV values | ||
26 | * Allow EL0 to write to arch timer registers, not just read them | ||
27 | * bcm2836_control: Implement local timer | ||
28 | 20 | ||
29 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
30 | Amir Charif (1): | 22 | Richard Henderson (3): |
31 | target/arm: Check access permission to ADDVL/ADDPL/RDVL | 23 | target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features |
24 | target/arm: Set KVM_ARM_VCPU_SVE while probing the host | ||
25 | target/arm: Move sve probe inside kvm >= 4.15 branch | ||
32 | 26 | ||
33 | Dongjiu Geng (1): | 27 | target/arm/kvm64.c | 45 ++++++++++++++++++++++----------------------- |
34 | target/arm: change arch timer registers access permission | 28 | 1 file changed, 22 insertions(+), 23 deletions(-) |
35 | |||
36 | Eric Auger (1): | ||
37 | hw/arm/virt-acpi-build: Fix SMMUv3 GSIV values | ||
38 | |||
39 | Wei Yang (1): | ||
40 | hw/arm/virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number | ||
41 | |||
42 | Zoltán Baldaszti (1): | ||
43 | hw/intc/bcm2836_control: Implement local timer | ||
44 | |||
45 | include/hw/intc/bcm2836_control.h | 9 ++++ | ||
46 | hw/arm/virt-acpi-build.c | 6 +-- | ||
47 | hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++++++++++- | ||
48 | target/arm/helper.c | 30 +++++------ | ||
49 | target/arm/translate-sve.c | 22 ++++++--- | ||
50 | 5 files changed, 140 insertions(+), 28 deletions(-) | ||
51 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The GSIV numbers of the SPI based interrupts is not correct as | 3 | Indication for support for SVE will not depend on whether we |
4 | ARM_SPI_BASE was not added to the irqmap[VIRT_SMMU] value. So | 4 | perform the query on the main kvm_state or the temp vcpu. |
5 | this may collide with VIRTIO_MMIO irq window. | ||
6 | 5 | ||
7 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20190312091031.5185-1-eric.auger@redhat.com | 7 | Message-id: 20220726045828.53697-2-richard.henderson@linaro.org |
9 | Reviewed-by: Shannon Zhao <shannon.zhaosl@gmail.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 | --- | 10 | --- |
12 | hw/arm/virt-acpi-build.c | 2 +- | 11 | target/arm/kvm64.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 13 | ||
15 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/virt-acpi-build.c | 16 | --- a/target/arm/kvm64.c |
18 | +++ b/hw/arm/virt-acpi-build.c | 17 | +++ b/target/arm/kvm64.c |
19 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
20 | its->identifiers[0] = 0; /* MADT translation_id */ | 19 | } |
21 | 20 | } | |
22 | if (vms->iommu == VIRT_IOMMU_SMMUV3) { | 21 | |
23 | - int irq = vms->irqmap[VIRT_SMMU]; | 22 | - sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; |
24 | + int irq = vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE; | 23 | + sve_supported = kvm_arm_sve_supported(); |
25 | 24 | ||
26 | /* SMMUv3 node */ | 25 | /* Add feature bits that can't appear until after VCPU init. */ |
27 | smmu_offset = iort_node_offset + node_size; | 26 | if (sve_supported) { |
28 | -- | 27 | -- |
29 | 2.20.1 | 28 | 2.25.1 |
30 | |||
31 | diff view generated by jsdifflib |
1 | From: Dongjiu Geng <gengdongjiu@huawei.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Some generic arch timer registers are Config-RW in the EL0, | 3 | Because we weren't setting this flag, our probe of ID_AA64ZFR0 |
4 | which means the EL0 exception level can have write permission | 4 | was always returning zero. This also obviates the adjustment |
5 | if it is appropriately configured. | 5 | of ID_AA64PFR0, which had sanitized the SVE field. |
6 | 6 | ||
7 | When VM access registers, QEMU firstly checks whether they have RW | 7 | The effects of the bug are not visible, because the only thing that |
8 | permission, then check whether it is appropriately configured. | 8 | ID_AA64ZFR0 is used for within qemu at present is tcg translation. |
9 | If they are defined to read only in EL0, even though they have been | 9 | The other tests for SVE within KVM are via ID_AA64PFR0.SVE. |
10 | appropriately configured, they still do not have write permission. | ||
11 | So need to add the write permission according to ARMV8 spec when | ||
12 | define it. | ||
13 | 10 | ||
14 | Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com> | 11 | Reported-by: Zenghui Yu <yuzenghui@huawei.com> |
15 | Message-id: 1552395177-12608-1-git-send-email-gengdongjiu@huawei.com | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Message-id: 20220726045828.53697-3-richard.henderson@linaro.org |
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 16 | --- |
20 | target/arm/helper.c | 30 +++++++++++++++--------------- | 17 | target/arm/kvm64.c | 27 +++++++++++++-------------- |
21 | 1 file changed, 15 insertions(+), 15 deletions(-) | 18 | 1 file changed, 13 insertions(+), 14 deletions(-) |
22 | 19 | ||
23 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 20 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
24 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/helper.c | 22 | --- a/target/arm/kvm64.c |
26 | +++ b/target/arm/helper.c | 23 | +++ b/target/arm/kvm64.c |
27 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 24 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
28 | /* per-timer control */ | 25 | bool sve_supported; |
29 | { .name = "CNTP_CTL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1, | 26 | bool pmu_supported = false; |
30 | .secure = ARM_CP_SECSTATE_NS, | 27 | uint64_t features = 0; |
31 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | 28 | - uint64_t t; |
32 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | 29 | int err; |
33 | .accessfn = gt_ptimer_access, | 30 | |
34 | .fieldoffset = offsetoflow32(CPUARMState, | 31 | /* Old kernels may not know about the PREFERRED_TARGET ioctl: however |
35 | cp15.c14_timer[GTIMER_PHYS].ctl), | 32 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
36 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 33 | struct kvm_vcpu_init init = { .target = -1, }; |
37 | { .name = "CNTP_CTL_S", | 34 | |
38 | .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1, | 35 | /* |
39 | .secure = ARM_CP_SECSTATE_S, | 36 | - * Ask for Pointer Authentication if supported. We can't play the |
40 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | 37 | - * SVE trick of synthesising the ID reg as KVM won't tell us |
41 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | 38 | - * whether we have the architected or IMPDEF version of PAuth, so |
42 | .accessfn = gt_ptimer_access, | 39 | - * we have to use the actual ID regs. |
43 | .fieldoffset = offsetoflow32(CPUARMState, | 40 | + * Ask for SVE if supported, so that we can query ID_AA64ZFR0, |
44 | cp15.c14_timer[GTIMER_SEC].ctl), | 41 | + * which is otherwise RAZ. |
45 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 42 | + */ |
46 | }, | 43 | + sve_supported = kvm_arm_sve_supported(); |
47 | { .name = "CNTP_CTL_EL0", .state = ARM_CP_STATE_AA64, | 44 | + if (sve_supported) { |
48 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 1, | 45 | + init.features[0] |= 1 << KVM_ARM_VCPU_SVE; |
49 | - .type = ARM_CP_IO, .access = PL1_RW | PL0_R, | 46 | + } |
50 | + .type = ARM_CP_IO, .access = PL0_RW, | 47 | + |
51 | .accessfn = gt_ptimer_access, | 48 | + /* |
52 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].ctl), | 49 | + * Ask for Pointer Authentication if supported, so that we get |
53 | .resetvalue = 0, | 50 | + * the unsanitized field values for AA64ISAR1_EL1. |
54 | .writefn = gt_phys_ctl_write, .raw_writefn = raw_write, | 51 | */ |
55 | }, | 52 | if (kvm_arm_pauth_supported()) { |
56 | { .name = "CNTV_CTL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 1, | 53 | init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | |
57 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | 54 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
58 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | 55 | } |
59 | .accessfn = gt_vtimer_access, | 56 | } |
60 | .fieldoffset = offsetoflow32(CPUARMState, | 57 | |
61 | cp15.c14_timer[GTIMER_VIRT].ctl), | 58 | - sve_supported = kvm_arm_sve_supported(); |
62 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 59 | - |
63 | }, | 60 | - /* Add feature bits that can't appear until after VCPU init. */ |
64 | { .name = "CNTV_CTL_EL0", .state = ARM_CP_STATE_AA64, | 61 | if (sve_supported) { |
65 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 1, | 62 | - t = ahcf->isar.id_aa64pfr0; |
66 | - .type = ARM_CP_IO, .access = PL1_RW | PL0_R, | 63 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); |
67 | + .type = ARM_CP_IO, .access = PL0_RW, | 64 | - ahcf->isar.id_aa64pfr0 = t; |
68 | .accessfn = gt_vtimer_access, | 65 | - |
69 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].ctl), | 66 | /* |
70 | .resetvalue = 0, | 67 | * There is a range of kernels between kernel commit 73433762fcae |
71 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 68 | * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
72 | /* TimerValue views: a 32 bit downcounting view of the underlying state */ | 69 | * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
73 | { .name = "CNTP_TVAL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0, | 70 | - * SVE support, so we only read it here, rather than together with all |
74 | .secure = ARM_CP_SECSTATE_NS, | 71 | - * the other ID registers earlier. |
75 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | 72 | + * SVE support, which resulted in an error rather than RAZ. |
76 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | 73 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. |
77 | .accessfn = gt_ptimer_access, | 74 | */ |
78 | .readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write, | 75 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
79 | }, | 76 | ARM64_SYS_REG(3, 0, 0, 4, 4)); |
80 | { .name = "CNTP_TVAL_S", | ||
81 | .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0, | ||
82 | .secure = ARM_CP_SECSTATE_S, | ||
83 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
84 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
85 | .accessfn = gt_ptimer_access, | ||
86 | .readfn = gt_sec_tval_read, .writefn = gt_sec_tval_write, | ||
87 | }, | ||
88 | { .name = "CNTP_TVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
89 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 0, | ||
90 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
91 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
92 | .accessfn = gt_ptimer_access, .resetfn = gt_phys_timer_reset, | ||
93 | .readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write, | ||
94 | }, | ||
95 | { .name = "CNTV_TVAL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 0, | ||
96 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
97 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
98 | .accessfn = gt_vtimer_access, | ||
99 | .readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write, | ||
100 | }, | ||
101 | { .name = "CNTV_TVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
102 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 0, | ||
103 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
104 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
105 | .accessfn = gt_vtimer_access, .resetfn = gt_virt_timer_reset, | ||
106 | .readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write, | ||
107 | }, | ||
108 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
109 | /* Comparison value, indicating when the timer goes off */ | ||
110 | { .name = "CNTP_CVAL", .cp = 15, .crm = 14, .opc1 = 2, | ||
111 | .secure = ARM_CP_SECSTATE_NS, | ||
112 | - .access = PL1_RW | PL0_R, | ||
113 | + .access = PL0_RW, | ||
114 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
115 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval), | ||
116 | .accessfn = gt_ptimer_access, | ||
117 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
118 | }, | ||
119 | { .name = "CNTP_CVAL_S", .cp = 15, .crm = 14, .opc1 = 2, | ||
120 | .secure = ARM_CP_SECSTATE_S, | ||
121 | - .access = PL1_RW | PL0_R, | ||
122 | + .access = PL0_RW, | ||
123 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
124 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC].cval), | ||
125 | .accessfn = gt_ptimer_access, | ||
126 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
127 | }, | ||
128 | { .name = "CNTP_CVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
129 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 2, | ||
130 | - .access = PL1_RW | PL0_R, | ||
131 | + .access = PL0_RW, | ||
132 | .type = ARM_CP_IO, | ||
133 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval), | ||
134 | .resetvalue = 0, .accessfn = gt_ptimer_access, | ||
135 | .writefn = gt_phys_cval_write, .raw_writefn = raw_write, | ||
136 | }, | ||
137 | { .name = "CNTV_CVAL", .cp = 15, .crm = 14, .opc1 = 3, | ||
138 | - .access = PL1_RW | PL0_R, | ||
139 | + .access = PL0_RW, | ||
140 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
141 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval), | ||
142 | .accessfn = gt_vtimer_access, | ||
143 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
144 | }, | ||
145 | { .name = "CNTV_CVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
146 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 2, | ||
147 | - .access = PL1_RW | PL0_R, | ||
148 | + .access = PL0_RW, | ||
149 | .type = ARM_CP_IO, | ||
150 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval), | ||
151 | .resetvalue = 0, .accessfn = gt_vtimer_access, | ||
152 | -- | 77 | -- |
153 | 2.20.1 | 78 | 2.25.1 |
154 | |||
155 | diff view generated by jsdifflib |
1 | From: Zoltán Baldaszti <bztemail@gmail.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The BCM2836 control logic module includes a simple | 3 | The test for the IF block indicates no ID registers are exposed, much |
4 | "local timer" which is a programmable down-counter that | 4 | less host support for SVE. Move the SVE probe into the ELSE block. |
5 | can generates an interrupt. Implement this functionality. | ||
6 | 5 | ||
7 | Signed-off-by: Zoltán Baldaszti <bztemail@gmail.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | [PMM: wrote commit message; wrapped long line; tweaked | 7 | Message-id: 20220726045828.53697-4-richard.henderson@linaro.org |
9 | some comments to match the final version of the code] | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/intc/bcm2836_control.h | 9 +++ | 11 | target/arm/kvm64.c | 22 +++++++++++----------- |
14 | hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++- | 12 | 1 file changed, 11 insertions(+), 11 deletions(-) |
15 | 2 files changed, 108 insertions(+), 2 deletions(-) | ||
16 | 13 | ||
17 | diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/intc/bcm2836_control.h | 16 | --- a/target/arm/kvm64.c |
20 | +++ b/include/hw/intc/bcm2836_control.h | 17 | +++ b/target/arm/kvm64.c |
21 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
22 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | 19 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, |
23 | * Written by Andrew Baumann | 20 | ARM64_SYS_REG(3, 3, 9, 12, 0)); |
24 | * | 21 | } |
25 | + * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti | 22 | - } |
26 | + * Added basic IRQ_TIMER interrupt support | 23 | |
27 | + * | 24 | - if (sve_supported) { |
28 | * This code is licensed under the GNU GPLv2 and later. | 25 | - /* |
29 | */ | 26 | - * There is a range of kernels between kernel commit 73433762fcae |
30 | 27 | - * and f81cb2c3ad41 which have a bug where the kernel doesn't expose | |
31 | @@ -XXX,XX +XXX,XX @@ | 28 | - * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
32 | #define BCM2836_CONTROL_H | 29 | - * SVE support, which resulted in an error rather than RAZ. |
33 | 30 | - * So only read the register if we set KVM_ARM_VCPU_SVE above. | |
34 | #include "hw/sysbus.h" | 31 | - */ |
35 | +#include "qemu/timer.h" | 32 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
36 | 33 | - ARM64_SYS_REG(3, 0, 0, 4, 4)); | |
37 | /* 4 mailboxes per core, for 16 total */ | 34 | + if (sve_supported) { |
38 | #define BCM2836_NCORES 4 | 35 | + /* |
39 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM2836ControlState { | 36 | + * There is a range of kernels between kernel commit 73433762fcae |
40 | bool gpu_irq, gpu_fiq; | 37 | + * and f81cb2c3ad41 which have a bug where the kernel doesn't |
41 | uint8_t timerirqs[BCM2836_NCORES]; | 38 | + * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has |
42 | 39 | + * enabled SVE support, which resulted in an error rather than RAZ. | |
43 | + /* local timer */ | 40 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. |
44 | + QEMUTimer timer; | 41 | + */ |
45 | + uint32_t local_timer_control; | 42 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
46 | + uint8_t route_localtimer; | 43 | + ARM64_SYS_REG(3, 0, 0, 4, 4)); |
47 | + | 44 | + } |
48 | /* interrupt source registers, post-routing (also input-derived; visible) */ | ||
49 | uint32_t irqsrc[BCM2836_NCORES]; | ||
50 | uint32_t fiqsrc[BCM2836_NCORES]; | ||
51 | diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/intc/bcm2836_control.c | ||
54 | +++ b/hw/intc/bcm2836_control.c | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | * This code is licensed under the GNU GPLv2 and later. | ||
57 | * | ||
58 | * At present, only implements interrupt routing, and mailboxes (i.e., | ||
59 | - * not local timer, PMU interrupt, or AXI counters). | ||
60 | + * not PMU interrupt, or AXI counters). | ||
61 | + * | ||
62 | + * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti | ||
63 | * | ||
64 | * Ref: | ||
65 | * https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | #include "qemu/log.h" | ||
68 | |||
69 | #define REG_GPU_ROUTE 0x0c | ||
70 | +#define REG_LOCALTIMERROUTING 0x24 | ||
71 | +#define REG_LOCALTIMERCONTROL 0x34 | ||
72 | +#define REG_LOCALTIMERACK 0x38 | ||
73 | #define REG_TIMERCONTROL 0x40 | ||
74 | #define REG_MBOXCONTROL 0x50 | ||
75 | #define REG_IRQSRC 0x60 | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | #define IRQ_TIMER 11 | ||
78 | #define IRQ_MAX IRQ_TIMER | ||
79 | |||
80 | +#define LOCALTIMER_FREQ 38400000 | ||
81 | +#define LOCALTIMER_INTFLAG (1 << 31) | ||
82 | +#define LOCALTIMER_RELOAD (1 << 30) | ||
83 | +#define LOCALTIMER_INTENABLE (1 << 29) | ||
84 | +#define LOCALTIMER_ENABLE (1 << 28) | ||
85 | +#define LOCALTIMER_VALUE(x) ((x) & 0xfffffff) | ||
86 | + | ||
87 | static void deliver_local(BCM2836ControlState *s, uint8_t core, uint8_t irq, | ||
88 | uint32_t controlreg, uint8_t controlidx) | ||
89 | { | ||
90 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_update(BCM2836ControlState *s) | ||
91 | s->fiqsrc[s->route_gpu_fiq] |= (uint32_t)1 << IRQ_GPU; | ||
92 | } | 45 | } |
93 | 46 | ||
94 | + /* | 47 | kvm_arm_destroy_scratch_host_vcpu(fdarray); |
95 | + * handle the control module 'local timer' interrupt for one of the | ||
96 | + * cores' IRQ/FIQ; this is distinct from the per-CPU timer | ||
97 | + * interrupts handled below. | ||
98 | + */ | ||
99 | + if ((s->local_timer_control & LOCALTIMER_INTENABLE) && | ||
100 | + (s->local_timer_control & LOCALTIMER_INTFLAG)) { | ||
101 | + if (s->route_localtimer & 4) { | ||
102 | + s->fiqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER; | ||
103 | + } else { | ||
104 | + s->irqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER; | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | for (i = 0; i < BCM2836_NCORES; i++) { | ||
109 | /* handle local timer interrupts for this core */ | ||
110 | if (s->timerirqs[i]) { | ||
111 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_set_gpu_fiq(void *opaque, int irq, int level) | ||
112 | bcm2836_control_update(s); | ||
113 | } | ||
114 | |||
115 | +static void bcm2836_control_local_timer_set_next(void *opaque) | ||
116 | +{ | ||
117 | + BCM2836ControlState *s = opaque; | ||
118 | + uint64_t next_event; | ||
119 | + | ||
120 | + assert(LOCALTIMER_VALUE(s->local_timer_control) > 0); | ||
121 | + | ||
122 | + next_event = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + | ||
123 | + muldiv64(LOCALTIMER_VALUE(s->local_timer_control), | ||
124 | + NANOSECONDS_PER_SECOND, LOCALTIMER_FREQ); | ||
125 | + timer_mod(&s->timer, next_event); | ||
126 | +} | ||
127 | + | ||
128 | +static void bcm2836_control_local_timer_tick(void *opaque) | ||
129 | +{ | ||
130 | + BCM2836ControlState *s = opaque; | ||
131 | + | ||
132 | + bcm2836_control_local_timer_set_next(s); | ||
133 | + | ||
134 | + s->local_timer_control |= LOCALTIMER_INTFLAG; | ||
135 | + bcm2836_control_update(s); | ||
136 | +} | ||
137 | + | ||
138 | +static void bcm2836_control_local_timer_control(void *opaque, uint32_t val) | ||
139 | +{ | ||
140 | + BCM2836ControlState *s = opaque; | ||
141 | + | ||
142 | + s->local_timer_control = val; | ||
143 | + if (val & LOCALTIMER_ENABLE) { | ||
144 | + bcm2836_control_local_timer_set_next(s); | ||
145 | + } else { | ||
146 | + timer_del(&s->timer); | ||
147 | + } | ||
148 | +} | ||
149 | + | ||
150 | +static void bcm2836_control_local_timer_ack(void *opaque, uint32_t val) | ||
151 | +{ | ||
152 | + BCM2836ControlState *s = opaque; | ||
153 | + | ||
154 | + if (val & LOCALTIMER_INTFLAG) { | ||
155 | + s->local_timer_control &= ~LOCALTIMER_INTFLAG; | ||
156 | + } | ||
157 | + if ((val & LOCALTIMER_RELOAD) && | ||
158 | + (s->local_timer_control & LOCALTIMER_ENABLE)) { | ||
159 | + bcm2836_control_local_timer_set_next(s); | ||
160 | + } | ||
161 | +} | ||
162 | + | ||
163 | static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size) | ||
164 | { | ||
165 | BCM2836ControlState *s = opaque; | ||
166 | @@ -XXX,XX +XXX,XX @@ static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size) | ||
167 | assert(s->route_gpu_fiq < BCM2836_NCORES | ||
168 | && s->route_gpu_irq < BCM2836_NCORES); | ||
169 | return ((uint32_t)s->route_gpu_fiq << 2) | s->route_gpu_irq; | ||
170 | + } else if (offset == REG_LOCALTIMERROUTING) { | ||
171 | + return s->route_localtimer; | ||
172 | + } else if (offset == REG_LOCALTIMERCONTROL) { | ||
173 | + return s->local_timer_control; | ||
174 | + } else if (offset == REG_LOCALTIMERACK) { | ||
175 | + return 0; | ||
176 | } else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) { | ||
177 | return s->timercontrol[(offset - REG_TIMERCONTROL) >> 2]; | ||
178 | } else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) { | ||
179 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_write(void *opaque, hwaddr offset, | ||
180 | if (offset == REG_GPU_ROUTE) { | ||
181 | s->route_gpu_irq = val & 0x3; | ||
182 | s->route_gpu_fiq = (val >> 2) & 0x3; | ||
183 | + } else if (offset == REG_LOCALTIMERROUTING) { | ||
184 | + s->route_localtimer = val & 7; | ||
185 | + } else if (offset == REG_LOCALTIMERCONTROL) { | ||
186 | + bcm2836_control_local_timer_control(s, val); | ||
187 | + } else if (offset == REG_LOCALTIMERACK) { | ||
188 | + bcm2836_control_local_timer_ack(s, val); | ||
189 | } else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) { | ||
190 | s->timercontrol[(offset - REG_TIMERCONTROL) >> 2] = val & 0xff; | ||
191 | } else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) { | ||
192 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_reset(DeviceState *d) | ||
193 | |||
194 | s->route_gpu_irq = s->route_gpu_fiq = 0; | ||
195 | |||
196 | + timer_del(&s->timer); | ||
197 | + s->route_localtimer = 0; | ||
198 | + s->local_timer_control = 0; | ||
199 | + | ||
200 | for (i = 0; i < BCM2836_NCORES; i++) { | ||
201 | s->timercontrol[i] = 0; | ||
202 | s->mailboxcontrol[i] = 0; | ||
203 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_init(Object *obj) | ||
204 | /* outputs to CPU cores */ | ||
205 | qdev_init_gpio_out_named(dev, s->irq, "irq", BCM2836_NCORES); | ||
206 | qdev_init_gpio_out_named(dev, s->fiq, "fiq", BCM2836_NCORES); | ||
207 | + | ||
208 | + /* create a qemu virtual timer */ | ||
209 | + timer_init_ns(&s->timer, QEMU_CLOCK_VIRTUAL, | ||
210 | + bcm2836_control_local_timer_tick, s); | ||
211 | } | ||
212 | |||
213 | static const VMStateDescription vmstate_bcm2836_control = { | ||
214 | .name = TYPE_BCM2836_CONTROL, | ||
215 | - .version_id = 1, | ||
216 | + .version_id = 2, | ||
217 | .minimum_version_id = 1, | ||
218 | .fields = (VMStateField[]) { | ||
219 | VMSTATE_UINT32_ARRAY(mailboxes, BCM2836ControlState, | ||
220 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_bcm2836_control = { | ||
221 | VMSTATE_UINT32_ARRAY(timercontrol, BCM2836ControlState, BCM2836_NCORES), | ||
222 | VMSTATE_UINT32_ARRAY(mailboxcontrol, BCM2836ControlState, | ||
223 | BCM2836_NCORES), | ||
224 | + VMSTATE_TIMER_V(timer, BCM2836ControlState, 2), | ||
225 | + VMSTATE_UINT32_V(local_timer_control, BCM2836ControlState, 2), | ||
226 | + VMSTATE_UINT8_V(route_localtimer, BCM2836ControlState, 2), | ||
227 | VMSTATE_END_OF_LIST() | ||
228 | } | ||
229 | }; | ||
230 | -- | 48 | -- |
231 | 2.20.1 | 49 | 2.25.1 |
232 | |||
233 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Wei Yang <richardw.yang@linux.intel.com> | ||
2 | 1 | ||
3 | This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number. | ||
4 | |||
5 | Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
8 | Message-id: 20190312074953.16671-1-richardw.yang@linux.intel.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/virt-acpi-build.c | 4 ++-- | ||
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/virt-acpi-build.c | ||
17 | +++ b/hw/arm/virt-acpi-build.c | ||
18 | @@ -XXX,XX +XXX,XX @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
19 | /* Only a single allocation so no need to play with segments */ | ||
20 | mcfg->allocation[0].pci_segment = cpu_to_le16(0); | ||
21 | mcfg->allocation[0].start_bus_number = 0; | ||
22 | - mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size | ||
23 | - / PCIE_MMCFG_SIZE_MIN) - 1; | ||
24 | + mcfg->allocation[0].end_bus_number = | ||
25 | + PCIE_MMCFG_BUS(memmap[ecam_id].size - 1); | ||
26 | |||
27 | build_header(linker, table_data, (void *)(table_data->data + mcfg_start), | ||
28 | "MCFG", table_data->len - mcfg_start, 1, NULL, NULL); | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Amir Charif <amir.charif@cea.fr> | ||
2 | 1 | ||
3 | These instructions do not trap when SVE is disabled in EL0, | ||
4 | causing them to be executed with wrong size information. | ||
5 | |||
6 | Signed-off-by: Amir Charif <amir.charif@cea.fr> | ||
7 | Message-id: 1552579248-31025-1-git-send-email-amir.charif@cea.fr | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | [PMM: added 'target/arm' prefix to subject] | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/translate-sve.c | 22 ++++++++++++++-------- | ||
14 | 1 file changed, 14 insertions(+), 8 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/translate-sve.c | ||
19 | +++ b/target/arm/translate-sve.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | ||
21 | |||
22 | static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a) | ||
23 | { | ||
24 | - TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
25 | - TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
26 | - tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s)); | ||
27 | + if (sve_access_check(s)) { | ||
28 | + TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
29 | + TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
30 | + tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s)); | ||
31 | + } | ||
32 | return true; | ||
33 | } | ||
34 | |||
35 | static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) | ||
36 | { | ||
37 | - TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
38 | - TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
39 | - tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s)); | ||
40 | + if (sve_access_check(s)) { | ||
41 | + TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
42 | + TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
43 | + tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s)); | ||
44 | + } | ||
45 | return true; | ||
46 | } | ||
47 | |||
48 | static bool trans_RDVL(DisasContext *s, arg_RDVL *a) | ||
49 | { | ||
50 | - TCGv_i64 reg = cpu_reg(s, a->rd); | ||
51 | - tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s)); | ||
52 | + if (sve_access_check(s)) { | ||
53 | + TCGv_i64 reg = cpu_reg(s, a->rd); | ||
54 | + tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s)); | ||
55 | + } | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | -- | ||
60 | 2.20.1 | ||
61 | |||
62 | diff view generated by jsdifflib |