Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame] | 1 | /* |
Andrew Walbran | 692b325 | 2019-03-07 15:51:31 +0000 | [diff] [blame] | 2 | * Copyright 2018 The Hafnium Authors. |
Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 17 | #include <stdnoreturn.h> |
| 18 | |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 19 | #include "hf/arch/barriers.h" |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 20 | #include "hf/arch/init.h" |
David Brazdil | 851948e | 2019-08-09 12:02:12 +0100 | [diff] [blame] | 21 | #include "hf/arch/mm.h" |
Andrew Scull | 07b6bd3 | 2019-12-12 17:19:55 +0000 | [diff] [blame] | 22 | #include "hf/arch/plat/smc.h" |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 23 | |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 24 | #include "hf/api.h" |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 25 | #include "hf/check.h" |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 26 | #include "hf/cpu.h" |
| 27 | #include "hf/dlog.h" |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 28 | #include "hf/ffa.h" |
Andrew Scull | a9c172d | 2019-04-03 14:10:00 +0100 | [diff] [blame] | 29 | #include "hf/panic.h" |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 30 | #include "hf/vm.h" |
| 31 | |
Andrew Scull | f35a5c9 | 2018-08-07 18:09:46 +0100 | [diff] [blame] | 32 | #include "vmapi/hf/call.h" |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 33 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 34 | #include "debug_el1.h" |
Fuad Tabba | 77a4b01 | 2019-11-15 12:13:08 +0000 | [diff] [blame] | 35 | #include "feature_id.h" |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 36 | #include "msr.h" |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 37 | #include "perfmon.h" |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 38 | #include "psci.h" |
Andrew Walbran | 3364565 | 2019-04-15 12:29:31 +0100 | [diff] [blame] | 39 | #include "psci_handler.h" |
Andrew Scull | 7fd4bb7 | 2018-12-08 23:40:12 +0000 | [diff] [blame] | 40 | #include "smc.h" |
Fuad Tabba | ba8c44d | 2019-09-23 14:38:58 +0100 | [diff] [blame] | 41 | #include "sysregs.h" |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 42 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 43 | /** |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 44 | * Gets the value to increment for the next PC. |
| 45 | * The ESR encodes whether the instruction is 2 bytes or 4 bytes long. |
| 46 | */ |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 47 | #define GET_NEXT_PC_INC(esr) (GET_ESR_IL(esr) ? 4 : 2) |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 48 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 49 | /** |
Andrew Walbran | 0dd67ff | 2019-09-12 16:38:50 +0100 | [diff] [blame] | 50 | * The Client ID field within X7 for an SMC64 call. |
| 51 | */ |
| 52 | #define CLIENT_ID_MASK UINT64_C(0xffff) |
| 53 | |
| 54 | /** |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 55 | * Returns a reference to the currently executing vCPU. |
| 56 | */ |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 57 | static struct vcpu *current(void) |
Andrew Walbran | 3d84a26 | 2018-12-13 14:41:19 +0000 | [diff] [blame] | 58 | { |
| 59 | return (struct vcpu *)read_msr(tpidr_el2); |
| 60 | } |
| 61 | |
Andrew Walbran | 1f8d487 | 2018-12-20 11:21:32 +0000 | [diff] [blame] | 62 | /** |
| 63 | * Saves the state of per-vCPU peripherals, such as the virtual timer, and |
| 64 | * informs the arch-independent sections that registers have been saved. |
| 65 | */ |
| 66 | void complete_saving_state(struct vcpu *vcpu) |
| 67 | { |
Andrew Walbran | 6480f8f | 2019-06-05 17:39:14 +0100 | [diff] [blame] | 68 | vcpu->regs.peripherals.cntv_cval_el0 = read_msr(cntv_cval_el0); |
| 69 | vcpu->regs.peripherals.cntv_ctl_el0 = read_msr(cntv_ctl_el0); |
Andrew Walbran | 1f8d487 | 2018-12-20 11:21:32 +0000 | [diff] [blame] | 70 | |
| 71 | api_regs_state_saved(vcpu); |
| 72 | |
| 73 | /* |
| 74 | * If switching away from the primary, copy the current EL0 virtual |
| 75 | * timer registers to the corresponding EL2 physical timer registers. |
| 76 | * This is used to emulate the virtual timer for the primary in case it |
| 77 | * should fire while the secondary is running. |
| 78 | */ |
| 79 | if (vcpu->vm->id == HF_PRIMARY_VM_ID) { |
| 80 | /* |
| 81 | * Clear timer control register before copying compare value, to |
| 82 | * avoid a spurious timer interrupt. This could be a problem if |
| 83 | * the interrupt is configured as edge-triggered, as it would |
| 84 | * then be latched in. |
| 85 | */ |
| 86 | write_msr(cnthp_ctl_el2, 0); |
| 87 | write_msr(cnthp_cval_el2, read_msr(cntv_cval_el0)); |
| 88 | write_msr(cnthp_ctl_el2, read_msr(cntv_ctl_el0)); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Restores the state of per-vCPU peripherals, such as the virtual timer. |
| 94 | */ |
| 95 | void begin_restoring_state(struct vcpu *vcpu) |
| 96 | { |
| 97 | /* |
| 98 | * Clear timer control register before restoring compare value, to avoid |
| 99 | * a spurious timer interrupt. This could be a problem if the interrupt |
| 100 | * is configured as edge-triggered, as it would then be latched in. |
| 101 | */ |
| 102 | write_msr(cntv_ctl_el0, 0); |
Andrew Walbran | 6480f8f | 2019-06-05 17:39:14 +0100 | [diff] [blame] | 103 | write_msr(cntv_cval_el0, vcpu->regs.peripherals.cntv_cval_el0); |
| 104 | write_msr(cntv_ctl_el0, vcpu->regs.peripherals.cntv_ctl_el0); |
Andrew Walbran | 1f8d487 | 2018-12-20 11:21:32 +0000 | [diff] [blame] | 105 | |
| 106 | /* |
| 107 | * If we are switching (back) to the primary, disable the EL2 physical |
| 108 | * timer which was being used to emulate the EL0 virtual timer, as the |
| 109 | * virtual timer is now running for the primary again. |
| 110 | */ |
| 111 | if (vcpu->vm->id == HF_PRIMARY_VM_ID) { |
| 112 | write_msr(cnthp_ctl_el2, 0); |
| 113 | write_msr(cnthp_cval_el2, 0); |
| 114 | } |
| 115 | } |
| 116 | |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 117 | /** |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 118 | * Invalidate all stage 1 TLB entries on the current (physical) CPU for the |
| 119 | * current VMID. |
| 120 | */ |
| 121 | static void invalidate_vm_tlb(void) |
| 122 | { |
Andrew Walbran | cff1f68 | 2019-07-04 14:52:45 +0100 | [diff] [blame] | 123 | /* |
| 124 | * Ensure that the last VTTBR write has taken effect so we invalidate |
| 125 | * the right set of TLB entries. |
| 126 | */ |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 127 | isb(); |
Andrew Walbran | cff1f68 | 2019-07-04 14:52:45 +0100 | [diff] [blame] | 128 | |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 129 | __asm__ volatile("tlbi vmalle1"); |
Andrew Walbran | cff1f68 | 2019-07-04 14:52:45 +0100 | [diff] [blame] | 130 | |
| 131 | /* |
| 132 | * Ensure that no instructions are fetched for the VM until after the |
| 133 | * TLB invalidation has taken effect. |
| 134 | */ |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 135 | isb(); |
Andrew Walbran | cff1f68 | 2019-07-04 14:52:45 +0100 | [diff] [blame] | 136 | |
| 137 | /* |
| 138 | * Ensure that no data reads or writes for the VM happen until after the |
Fuad Tabba | 77a4b01 | 2019-11-15 12:13:08 +0000 | [diff] [blame] | 139 | * TLB invalidation has taken effect. Non-shareable is enough because |
| 140 | * the TLB is local to the CPU. |
Andrew Walbran | cff1f68 | 2019-07-04 14:52:45 +0100 | [diff] [blame] | 141 | */ |
David Brazdil | 851948e | 2019-08-09 12:02:12 +0100 | [diff] [blame] | 142 | dsb(nsh); |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Invalidates the TLB if a different vCPU is being run than the last vCPU of |
| 147 | * the same VM which was run on the current pCPU. |
| 148 | * |
| 149 | * This is necessary because VMs may (contrary to the architecture |
| 150 | * specification) use inconsistent ASIDs across vCPUs. c.f. KVM's similar |
| 151 | * workaround: |
| 152 | * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=94d0e5980d6791b9 |
| 153 | */ |
| 154 | void maybe_invalidate_tlb(struct vcpu *vcpu) |
| 155 | { |
| 156 | size_t current_cpu_index = cpu_index(vcpu->cpu); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 157 | ffa_vcpu_index_t new_vcpu_index = vcpu_index(vcpu); |
Andrew Walbran | 1f32e72 | 2019-06-07 17:57:26 +0100 | [diff] [blame] | 158 | |
| 159 | if (vcpu->vm->arch.last_vcpu_on_cpu[current_cpu_index] != |
| 160 | new_vcpu_index) { |
| 161 | /* |
| 162 | * The vCPU has changed since the last time this VM was run on |
| 163 | * this pCPU, so we need to invalidate the TLB. |
| 164 | */ |
| 165 | invalidate_vm_tlb(); |
| 166 | |
| 167 | /* Record the fact that this vCPU is now running on this CPU. */ |
| 168 | vcpu->vm->arch.last_vcpu_on_cpu[current_cpu_index] = |
| 169 | new_vcpu_index; |
| 170 | } |
| 171 | } |
| 172 | |
David Brazdil | 768f69c | 2019-12-19 15:46:12 +0000 | [diff] [blame] | 173 | noreturn void irq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr) |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 174 | { |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 175 | (void)elr; |
| 176 | (void)spsr; |
| 177 | |
Fuad Tabba | d1d6798 | 2020-01-08 11:28:29 +0000 | [diff] [blame] | 178 | panic("IRQ from current exception level."); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 179 | } |
| 180 | |
David Brazdil | 768f69c | 2019-12-19 15:46:12 +0000 | [diff] [blame] | 181 | noreturn void fiq_current_exception_noreturn(uintreg_t elr, uintreg_t spsr) |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 182 | { |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 183 | (void)elr; |
| 184 | (void)spsr; |
| 185 | |
Fuad Tabba | d1d6798 | 2020-01-08 11:28:29 +0000 | [diff] [blame] | 186 | panic("FIQ from current exception level."); |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 187 | } |
| 188 | |
David Brazdil | 768f69c | 2019-12-19 15:46:12 +0000 | [diff] [blame] | 189 | noreturn void serr_current_exception_noreturn(uintreg_t elr, uintreg_t spsr) |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 190 | { |
| 191 | (void)elr; |
| 192 | (void)spsr; |
| 193 | |
Fuad Tabba | d1d6798 | 2020-01-08 11:28:29 +0000 | [diff] [blame] | 194 | panic("SError from current exception level."); |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 195 | } |
| 196 | |
David Brazdil | 768f69c | 2019-12-19 15:46:12 +0000 | [diff] [blame] | 197 | noreturn void sync_current_exception_noreturn(uintreg_t elr, uintreg_t spsr) |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 198 | { |
| 199 | uintreg_t esr = read_msr(esr_el2); |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 200 | uintreg_t ec = GET_ESR_EC(esr); |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 201 | |
| 202 | (void)spsr; |
| 203 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 204 | switch (ec) { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 205 | case EC_DATA_ABORT_SAME_EL: |
Andrew Walbran | e52006c | 2019-10-22 18:01:28 +0100 | [diff] [blame] | 206 | if (!(esr & (1U << 10))) { /* Check FnV bit. */ |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 207 | dlog_error( |
| 208 | "Data abort: pc=%#x, esr=%#x, ec=%#x, " |
| 209 | "far=%#x\n", |
| 210 | elr, esr, ec, read_msr(far_el2)); |
Andrew Scull | 7364a8e | 2018-07-19 15:39:29 +0100 | [diff] [blame] | 211 | } else { |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 212 | dlog_error( |
| 213 | "Data abort: pc=%#x, esr=%#x, ec=%#x, " |
| 214 | "far=invalid\n", |
| 215 | elr, esr, ec); |
Andrew Scull | 7364a8e | 2018-07-19 15:39:29 +0100 | [diff] [blame] | 216 | } |
Wedson Almeida Filho | fed6902 | 2018-07-11 15:39:12 +0100 | [diff] [blame] | 217 | |
Wedson Almeida Filho | 81568c4 | 2019-01-04 13:33:02 +0000 | [diff] [blame] | 218 | break; |
Wedson Almeida Filho | fed6902 | 2018-07-11 15:39:12 +0100 | [diff] [blame] | 219 | |
| 220 | default: |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 221 | dlog_error( |
| 222 | "Unknown current sync exception pc=%#x, esr=%#x, " |
| 223 | "ec=%#x\n", |
| 224 | elr, esr, ec); |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 225 | break; |
Wedson Almeida Filho | fed6902 | 2018-07-11 15:39:12 +0100 | [diff] [blame] | 226 | } |
Wedson Almeida Filho | 81568c4 | 2019-01-04 13:33:02 +0000 | [diff] [blame] | 227 | |
Andrew Scull | a9c172d | 2019-04-03 14:10:00 +0100 | [diff] [blame] | 228 | panic("EL2 exception"); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 229 | } |
| 230 | |
Wedson Almeida Filho | 03e767a | 2018-07-30 15:32:03 +0100 | [diff] [blame] | 231 | /** |
Andrew Walbran | 3d84a26 | 2018-12-13 14:41:19 +0000 | [diff] [blame] | 232 | * Sets or clears the VI bit in the HCR_EL2 register saved in the given |
| 233 | * arch_regs. |
| 234 | */ |
| 235 | static void set_virtual_interrupt(struct arch_regs *r, bool enable) |
| 236 | { |
| 237 | if (enable) { |
| 238 | r->lazy.hcr_el2 |= HCR_EL2_VI; |
| 239 | } else { |
| 240 | r->lazy.hcr_el2 &= ~HCR_EL2_VI; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Sets or clears the VI bit in the HCR_EL2 register. |
| 246 | */ |
| 247 | static void set_virtual_interrupt_current(bool enable) |
| 248 | { |
| 249 | uintreg_t hcr_el2 = read_msr(hcr_el2); |
Wedson Almeida Filho | 81568c4 | 2019-01-04 13:33:02 +0000 | [diff] [blame] | 250 | |
Andrew Walbran | 3d84a26 | 2018-12-13 14:41:19 +0000 | [diff] [blame] | 251 | if (enable) { |
| 252 | hcr_el2 |= HCR_EL2_VI; |
| 253 | } else { |
| 254 | hcr_el2 &= ~HCR_EL2_VI; |
| 255 | } |
| 256 | write_msr(hcr_el2, hcr_el2); |
| 257 | } |
| 258 | |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 259 | /** |
| 260 | * Checks whether to block an SMC being forwarded from a VM. |
| 261 | */ |
| 262 | static bool smc_is_blocked(const struct vm *vm, uint32_t func) |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 263 | { |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 264 | bool block_by_default = !vm->smc_whitelist.permissive; |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 265 | |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 266 | for (size_t i = 0; i < vm->smc_whitelist.smc_count; ++i) { |
| 267 | if (func == vm->smc_whitelist.smcs[i]) { |
| 268 | return false; |
| 269 | } |
| 270 | } |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 271 | |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 272 | dlog_notice("SMC %#010x attempted from VM %d, blocked=%d\n", func, |
| 273 | vm->id, block_by_default); |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 274 | |
| 275 | /* Access is still allowed in permissive mode. */ |
| 276 | return block_by_default; |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | /** |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 280 | * Applies SMC access control according to manifest and forwards the call if |
| 281 | * access is granted. |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 282 | */ |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 283 | static void smc_forwarder(const struct vm *vm, struct ffa_value *args) |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 284 | { |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 285 | struct ffa_value ret; |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 286 | uint32_t client_id = vm->id; |
| 287 | uintreg_t arg7 = args->arg7; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 288 | |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 289 | if (smc_is_blocked(vm, args->func)) { |
| 290 | args->func = SMCCC_ERROR_UNKNOWN; |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 291 | return; |
| 292 | } |
| 293 | |
Andrew Walbran | 0dd67ff | 2019-09-12 16:38:50 +0100 | [diff] [blame] | 294 | /* |
| 295 | * Set the Client ID but keep the existing Secure OS ID and anything |
| 296 | * else (currently unspecified) that the client may have passed in the |
| 297 | * upper bits. |
| 298 | */ |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 299 | args->arg7 = client_id | (arg7 & ~CLIENT_ID_MASK); |
Andrew Scull | 07b6bd3 | 2019-12-12 17:19:55 +0000 | [diff] [blame] | 300 | ret = smc_forward(args->func, args->arg1, args->arg2, args->arg3, |
| 301 | args->arg4, args->arg5, args->arg6, args->arg7); |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 302 | |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 303 | /* |
Fuad Tabba | b0ef2a4 | 2019-12-19 11:19:25 +0000 | [diff] [blame] | 304 | * Preserve the value passed by the caller, rather than the generated |
| 305 | * client_id. Note that this would also overwrite any return value that |
Andrew Scull | ae9962e | 2019-10-03 16:51:16 +0100 | [diff] [blame] | 306 | * may be in x7, but the SMCs that we are forwarding are legacy calls |
| 307 | * from before SMCCC 1.2 so won't have more than 4 return values anyway. |
| 308 | */ |
Andrew Scull | 07b6bd3 | 2019-12-12 17:19:55 +0000 | [diff] [blame] | 309 | ret.arg7 = arg7; |
| 310 | |
| 311 | plat_smc_post_forward(*args, &ret); |
| 312 | |
| 313 | *args = ret; |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 314 | } |
| 315 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 316 | static bool ffa_handler(struct ffa_value *args, struct vcpu **next) |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 317 | { |
Andrew Walbran | e7ad3c0 | 2019-12-24 17:03:04 +0000 | [diff] [blame] | 318 | uint32_t func = args->func & ~SMCCC_CONVENTION_MASK; |
| 319 | |
Jose Marinho | c0f4ff2 | 2019-10-09 10:37:42 +0100 | [diff] [blame] | 320 | /* |
| 321 | * NOTE: When adding new methods to this handler update |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 322 | * api_ffa_features accordingly. |
Jose Marinho | c0f4ff2 | 2019-10-09 10:37:42 +0100 | [diff] [blame] | 323 | */ |
Andrew Walbran | e7ad3c0 | 2019-12-24 17:03:04 +0000 | [diff] [blame] | 324 | switch (func) { |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 325 | case FFA_VERSION_32: |
| 326 | *args = api_ffa_version(args->arg1); |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 327 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 328 | case FFA_ID_GET_32: |
| 329 | *args = api_ffa_id_get(current()); |
Andrew Walbran | d230f66 | 2019-10-07 18:03:36 +0100 | [diff] [blame] | 330 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 331 | case FFA_FEATURES_32: |
| 332 | *args = api_ffa_features(args->arg1); |
Jose Marinho | c0f4ff2 | 2019-10-09 10:37:42 +0100 | [diff] [blame] | 333 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 334 | case FFA_RX_RELEASE_32: |
| 335 | *args = api_ffa_rx_release(current(), next); |
Andrew Walbran | 8a0f5ca | 2019-11-05 13:12:23 +0000 | [diff] [blame] | 336 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 337 | case FFA_RXTX_MAP_32: |
| 338 | *args = api_ffa_rxtx_map(ipa_init(args->arg1), |
| 339 | ipa_init(args->arg2), args->arg3, |
| 340 | current(), next); |
Andrew Walbran | bfffb0f | 2019-11-05 14:02:34 +0000 | [diff] [blame] | 341 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 342 | case FFA_YIELD_32: |
Andrew Walbran | 16075b6 | 2019-09-03 17:11:07 +0100 | [diff] [blame] | 343 | api_yield(current(), next); |
| 344 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 345 | /* FFA_YIELD always returns FFA_SUCCESS. */ |
| 346 | *args = (struct ffa_value){.func = FFA_SUCCESS_32}; |
Andrew Walbran | 16075b6 | 2019-09-03 17:11:07 +0100 | [diff] [blame] | 347 | |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 348 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 349 | case FFA_MSG_SEND_32: |
| 350 | *args = api_ffa_msg_send( |
| 351 | ffa_msg_send_sender(*args), |
| 352 | ffa_msg_send_receiver(*args), ffa_msg_send_size(*args), |
| 353 | ffa_msg_send_attributes(*args), current(), next); |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 354 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 355 | case FFA_MSG_WAIT_32: |
| 356 | *args = api_ffa_msg_recv(true, current(), next); |
Andrew Walbran | 0de4f16 | 2019-09-03 16:44:20 +0100 | [diff] [blame] | 357 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 358 | case FFA_MSG_POLL_32: |
| 359 | *args = api_ffa_msg_recv(false, current(), next); |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 360 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 361 | case FFA_RUN_32: |
| 362 | *args = api_ffa_run(ffa_vm_id(*args), ffa_vcpu_index(*args), |
| 363 | current(), next); |
Andrew Walbran | f0c314d | 2019-10-02 14:24:26 +0100 | [diff] [blame] | 364 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 365 | case FFA_MEM_DONATE_32: |
| 366 | case FFA_MEM_LEND_32: |
| 367 | case FFA_MEM_SHARE_32: |
| 368 | *args = api_ffa_mem_send(func, args->arg1, args->arg2, |
| 369 | ipa_init(args->arg3), args->arg4, |
| 370 | current(), next); |
Andrew Walbran | 82d6d15 | 2019-12-24 15:02:06 +0000 | [diff] [blame] | 371 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 372 | case FFA_MEM_RETRIEVE_REQ_32: |
| 373 | *args = api_ffa_mem_retrieve_req(args->arg1, args->arg2, |
| 374 | ipa_init(args->arg3), |
| 375 | args->arg4, current()); |
Andrew Walbran | 5de9c3d | 2020-02-10 13:35:29 +0000 | [diff] [blame] | 376 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 377 | case FFA_MEM_RELINQUISH_32: |
| 378 | *args = api_ffa_mem_relinquish(current()); |
Andrew Walbran | 5de9c3d | 2020-02-10 13:35:29 +0000 | [diff] [blame] | 379 | return true; |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 380 | case FFA_MEM_RECLAIM_32: |
| 381 | *args = api_ffa_mem_reclaim( |
Andrew Walbran | 1bbe940 | 2020-04-30 16:47:13 +0100 | [diff] [blame] | 382 | ffa_assemble_handle(args->arg1, args->arg2), args->arg3, |
| 383 | current()); |
Andrew Walbran | 5de9c3d | 2020-02-10 13:35:29 +0000 | [diff] [blame] | 384 | return true; |
Andrew Walbran | f0c314d | 2019-10-02 14:24:26 +0100 | [diff] [blame] | 385 | } |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 386 | |
| 387 | return false; |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Set or clear VI bit according to pending interrupts. |
| 392 | */ |
| 393 | static void update_vi(struct vcpu *next) |
| 394 | { |
| 395 | if (next == NULL) { |
| 396 | /* |
| 397 | * Not switching vCPUs, set the bit for the current vCPU |
| 398 | * directly in the register. |
| 399 | */ |
| 400 | struct vcpu *vcpu = current(); |
| 401 | |
| 402 | sl_lock(&vcpu->lock); |
| 403 | set_virtual_interrupt_current( |
| 404 | vcpu->interrupts.enabled_and_pending_count > 0); |
| 405 | sl_unlock(&vcpu->lock); |
| 406 | } else { |
| 407 | /* |
| 408 | * About to switch vCPUs, set the bit for the vCPU to which we |
| 409 | * are switching in the saved copy of the register. |
| 410 | */ |
| 411 | sl_lock(&next->lock); |
| 412 | set_virtual_interrupt( |
| 413 | &next->regs, |
| 414 | next->interrupts.enabled_and_pending_count > 0); |
| 415 | sl_unlock(&next->lock); |
| 416 | } |
| 417 | } |
| 418 | |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 419 | /** |
| 420 | * Processes SMC instruction calls. |
| 421 | */ |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 422 | static struct vcpu *smc_handler(struct vcpu *vcpu) |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 423 | { |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 424 | struct ffa_value args = { |
Andrew Walbran | 85c3766 | 2019-12-05 16:29:33 +0000 | [diff] [blame] | 425 | .func = vcpu->regs.r[0], |
| 426 | .arg1 = vcpu->regs.r[1], |
| 427 | .arg2 = vcpu->regs.r[2], |
| 428 | .arg3 = vcpu->regs.r[3], |
| 429 | .arg4 = vcpu->regs.r[4], |
| 430 | .arg5 = vcpu->regs.r[5], |
| 431 | .arg6 = vcpu->regs.r[6], |
| 432 | .arg7 = vcpu->regs.r[7], |
| 433 | }; |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 434 | struct vcpu *next = NULL; |
Fuad Tabba | 8176e3e | 2019-08-01 10:40:36 +0100 | [diff] [blame] | 435 | |
Andrew Walbran | 85c3766 | 2019-12-05 16:29:33 +0000 | [diff] [blame] | 436 | if (psci_handler(vcpu, args.func, args.arg1, args.arg2, args.arg3, |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 437 | &vcpu->regs.r[0], &next)) { |
| 438 | return next; |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 439 | } |
| 440 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 441 | if (ffa_handler(&args, &next)) { |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 442 | arch_regs_set_retval(&vcpu->regs, args); |
| 443 | update_vi(next); |
| 444 | return next; |
Andrew Walbran | 4579f700 | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 445 | } |
| 446 | |
Andrew Walbran | 85c3766 | 2019-12-05 16:29:33 +0000 | [diff] [blame] | 447 | switch (args.func & ~SMCCC_CONVENTION_MASK) { |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 448 | case HF_DEBUG_LOG: |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 449 | vcpu->regs.r[0] = api_debug_log(args.arg1, vcpu); |
Andrew Scull | 07b6bd3 | 2019-12-12 17:19:55 +0000 | [diff] [blame] | 450 | return NULL; |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 451 | } |
| 452 | |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 453 | smc_forwarder(vcpu->vm, &args); |
| 454 | arch_regs_set_retval(&vcpu->regs, args); |
Andrew Scull | 07b6bd3 | 2019-12-12 17:19:55 +0000 | [diff] [blame] | 455 | return NULL; |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 456 | } |
| 457 | |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 458 | /* |
| 459 | * Exception vector offsets. |
| 460 | * See Arm Architecture Reference Manual Armv8-A, D1.10.2. |
| 461 | */ |
| 462 | |
| 463 | /** |
| 464 | * Offset for synchronous exceptions at current EL with SPx. |
| 465 | */ |
| 466 | #define OFFSET_CURRENT_SPX UINT64_C(0x200) |
| 467 | |
| 468 | /** |
| 469 | * Offset for synchronous exceptions at lower EL using AArch64. |
| 470 | */ |
| 471 | #define OFFSET_LOWER_EL_64 UINT64_C(0x400) |
| 472 | |
| 473 | /** |
| 474 | * Offset for synchronous exceptions at lower EL using AArch32. |
| 475 | */ |
| 476 | #define OFFSET_LOWER_EL_32 UINT64_C(0x600) |
| 477 | |
| 478 | /** |
| 479 | * Returns the address for the exception handler at EL1. |
| 480 | */ |
| 481 | static uintreg_t get_el1_exception_handler_addr(const struct vcpu *vcpu) |
| 482 | { |
| 483 | uintreg_t base_addr = read_msr(vbar_el1); |
| 484 | uintreg_t pe_mode = vcpu->regs.spsr & PSR_PE_MODE_MASK; |
| 485 | bool is_arch32 = vcpu->regs.spsr & PSR_ARCH_MODE_32; |
| 486 | |
| 487 | if (pe_mode == PSR_PE_MODE_EL0T) { |
| 488 | if (is_arch32) { |
| 489 | base_addr += OFFSET_LOWER_EL_32; |
| 490 | } else { |
| 491 | base_addr += OFFSET_LOWER_EL_64; |
| 492 | } |
| 493 | } else { |
| 494 | CHECK(!is_arch32); |
| 495 | base_addr += OFFSET_CURRENT_SPX; |
| 496 | } |
| 497 | |
| 498 | return base_addr; |
| 499 | } |
| 500 | |
| 501 | /** |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 502 | * Injects an exception with the specified Exception Syndrom Register value into |
| 503 | * the EL1. |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 504 | * See Arm Architecture Reference Manual Armv8-A, page D13-2924. |
| 505 | * |
| 506 | * NOTE: This function assumes that the lazy registers haven't been saved, and |
| 507 | * writes to the lazy registers of the CPU directly instead of the vCPU. |
| 508 | */ |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 509 | static void inject_el1_exception(struct vcpu *vcpu, uintreg_t esr_el1_value) |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 510 | { |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 511 | uintreg_t handler_address = get_el1_exception_handler_addr(vcpu); |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 512 | |
| 513 | /* Update the CPU state to inject the exception. */ |
| 514 | write_msr(esr_el1, esr_el1_value); |
| 515 | write_msr(elr_el1, vcpu->regs.pc); |
| 516 | write_msr(spsr_el1, vcpu->regs.spsr); |
| 517 | |
| 518 | /* |
| 519 | * Mask (disable) interrupts and run in EL1h mode. |
| 520 | * EL1h mode is used because by default, taking an exception selects the |
| 521 | * stack pointer for the target Exception level. The software can change |
| 522 | * that later in the handler if needed. |
| 523 | * See Arm Architecture Reference Manual Armv8-A, page D13-2924 |
| 524 | */ |
| 525 | vcpu->regs.spsr = PSR_D | PSR_A | PSR_I | PSR_F | PSR_PE_MODE_EL1H; |
| 526 | |
| 527 | /* Transfer control to the exception hander. */ |
| 528 | vcpu->regs.pc = handler_address; |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 529 | } |
| 530 | |
| 531 | /** |
| 532 | * Injects a Data Abort exception (same exception level). |
| 533 | */ |
| 534 | static void inject_el1_data_abort_exception(struct vcpu *vcpu, |
| 535 | uintreg_t esr_el2) |
| 536 | { |
| 537 | /* |
| 538 | * ISS encoding remains the same, but the EC is changed to reflect |
| 539 | * where the exception came from. |
| 540 | * See Arm Architecture Reference Manual Armv8-A, pages D13-2943/2982. |
| 541 | */ |
| 542 | uintreg_t esr_el1_value = GET_ESR_ISS(esr_el2) | GET_ESR_IL(esr_el2) | |
| 543 | (EC_DATA_ABORT_SAME_EL << ESR_EC_OFFSET); |
| 544 | |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 545 | dlog_notice("Injecting Data Abort exception into VM%d.\n", |
| 546 | vcpu->vm->id); |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 547 | |
| 548 | inject_el1_exception(vcpu, esr_el1_value); |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * Injects a Data Abort exception (same exception level). |
| 553 | */ |
| 554 | static void inject_el1_instruction_abort_exception(struct vcpu *vcpu, |
| 555 | uintreg_t esr_el2) |
| 556 | { |
| 557 | /* |
| 558 | * ISS encoding remains the same, but the EC is changed to reflect |
| 559 | * where the exception came from. |
| 560 | * See Arm Architecture Reference Manual Armv8-A, pages D13-2941/2980. |
| 561 | */ |
| 562 | uintreg_t esr_el1_value = |
| 563 | GET_ESR_ISS(esr_el2) | GET_ESR_IL(esr_el2) | |
| 564 | (EC_INSTRUCTION_ABORT_SAME_EL << ESR_EC_OFFSET); |
| 565 | |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 566 | dlog_notice("Injecting Instruction Abort exception into VM%d.\n", |
| 567 | vcpu->vm->id); |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 568 | |
| 569 | inject_el1_exception(vcpu, esr_el1_value); |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * Injects an exception with an unknown reason into the EL1. |
| 574 | */ |
| 575 | static void inject_el1_unknown_exception(struct vcpu *vcpu, uintreg_t esr_el2) |
| 576 | { |
| 577 | uintreg_t esr_el1_value = |
| 578 | GET_ESR_IL(esr_el2) | (EC_UNKNOWN << ESR_EC_OFFSET); |
| 579 | char *direction_str; |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 580 | |
| 581 | direction_str = ISS_IS_READ(esr_el2) ? "read" : "write"; |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 582 | dlog_notice( |
| 583 | "Trapped access to system register %s: op0=%d, op1=%d, crn=%d, " |
| 584 | "crm=%d, op2=%d, rt=%d.\n", |
| 585 | direction_str, GET_ISS_OP0(esr_el2), GET_ISS_OP1(esr_el2), |
| 586 | GET_ISS_CRN(esr_el2), GET_ISS_CRM(esr_el2), |
| 587 | GET_ISS_OP2(esr_el2), GET_ISS_RT(esr_el2)); |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 588 | |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 589 | dlog_notice("Injecting Unknown Reason exception into VM%d.\n", |
| 590 | vcpu->vm->id); |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 591 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 592 | inject_el1_exception(vcpu, esr_el1_value); |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 593 | } |
| 594 | |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 595 | struct vcpu *hvc_handler(struct vcpu *vcpu) |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 596 | { |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 597 | struct ffa_value args = { |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 598 | .func = vcpu->regs.r[0], |
| 599 | .arg1 = vcpu->regs.r[1], |
| 600 | .arg2 = vcpu->regs.r[2], |
| 601 | .arg3 = vcpu->regs.r[3], |
| 602 | .arg4 = vcpu->regs.r[4], |
| 603 | .arg5 = vcpu->regs.r[5], |
| 604 | .arg6 = vcpu->regs.r[6], |
| 605 | .arg7 = vcpu->regs.r[7], |
| 606 | }; |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 607 | struct vcpu *next = NULL; |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 608 | |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 609 | if (psci_handler(vcpu, args.func, args.arg1, args.arg2, args.arg3, |
| 610 | &vcpu->regs.r[0], &next)) { |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 611 | return next; |
Wedson Almeida Filho | 03e767a | 2018-07-30 15:32:03 +0100 | [diff] [blame] | 612 | } |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 613 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 614 | if (ffa_handler(&args, &next)) { |
Andrew Walbran | 6f56d7b | 2019-12-05 16:27:34 +0000 | [diff] [blame] | 615 | arch_regs_set_retval(&vcpu->regs, args); |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 616 | update_vi(next); |
| 617 | return next; |
Andrew Walbran | 7d28d9a | 2019-08-30 16:24:58 +0100 | [diff] [blame] | 618 | } |
Jose Marinho | fc0b2b6 | 2019-06-06 11:18:45 +0100 | [diff] [blame] | 619 | |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 620 | switch (args.func) { |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 621 | case HF_VM_GET_COUNT: |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 622 | vcpu->regs.r[0] = api_vm_get_count(); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 623 | break; |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 624 | |
| 625 | case HF_VCPU_GET_COUNT: |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 626 | vcpu->regs.r[0] = api_vcpu_get_count(args.arg1, vcpu); |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 627 | break; |
| 628 | |
Wedson Almeida Filho | ea62e2e | 2019-01-09 19:14:59 +0000 | [diff] [blame] | 629 | case HF_MAILBOX_WRITABLE_GET: |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 630 | vcpu->regs.r[0] = api_mailbox_writable_get(vcpu); |
Wedson Almeida Filho | ea62e2e | 2019-01-09 19:14:59 +0000 | [diff] [blame] | 631 | break; |
| 632 | |
| 633 | case HF_MAILBOX_WAITER_GET: |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 634 | vcpu->regs.r[0] = api_mailbox_waiter_get(args.arg1, vcpu); |
Wedson Almeida Filho | 2f94ec1 | 2018-07-26 16:00:48 +0100 | [diff] [blame] | 635 | break; |
| 636 | |
Wedson Almeida Filho | c559d13 | 2019-01-09 19:33:40 +0000 | [diff] [blame] | 637 | case HF_INTERRUPT_ENABLE: |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 638 | vcpu->regs.r[0] = |
| 639 | api_interrupt_enable(args.arg1, args.arg2, vcpu); |
Andrew Walbran | 318f573 | 2018-11-20 16:23:42 +0000 | [diff] [blame] | 640 | break; |
| 641 | |
Wedson Almeida Filho | c559d13 | 2019-01-09 19:33:40 +0000 | [diff] [blame] | 642 | case HF_INTERRUPT_GET: |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 643 | vcpu->regs.r[0] = api_interrupt_get(vcpu); |
Andrew Walbran | 318f573 | 2018-11-20 16:23:42 +0000 | [diff] [blame] | 644 | break; |
| 645 | |
Wedson Almeida Filho | c559d13 | 2019-01-09 19:33:40 +0000 | [diff] [blame] | 646 | case HF_INTERRUPT_INJECT: |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 647 | vcpu->regs.r[0] = api_interrupt_inject(args.arg1, args.arg2, |
| 648 | args.arg3, vcpu, &next); |
Andrew Walbran | 318f573 | 2018-11-20 16:23:42 +0000 | [diff] [blame] | 649 | break; |
| 650 | |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 651 | case HF_DEBUG_LOG: |
Andrew Walbran | 7f920af | 2019-09-03 17:09:30 +0100 | [diff] [blame] | 652 | vcpu->regs.r[0] = api_debug_log(args.arg1, vcpu); |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 653 | break; |
| 654 | |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 655 | default: |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 656 | vcpu->regs.r[0] = SMCCC_ERROR_UNKNOWN; |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 657 | } |
| 658 | |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 659 | update_vi(next); |
Andrew Walbran | 3d84a26 | 2018-12-13 14:41:19 +0000 | [diff] [blame] | 660 | |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 661 | return next; |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 662 | } |
| 663 | |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 664 | struct vcpu *irq_lower(void) |
| 665 | { |
Andrew Scull | 9726c25 | 2019-01-23 13:44:19 +0000 | [diff] [blame] | 666 | /* |
| 667 | * Switch back to primary VM, interrupts will be handled there. |
| 668 | * |
| 669 | * If the VM has aborted, this vCPU will be aborted when the scheduler |
| 670 | * tries to run it again. This means the interrupt will not be delayed |
| 671 | * by the aborted VM. |
| 672 | * |
| 673 | * TODO: Only switch when the interrupt isn't for the current VM. |
| 674 | */ |
Andrew Scull | 33fecd3 | 2019-01-08 14:48:27 +0000 | [diff] [blame] | 675 | return api_preempt(current()); |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 676 | } |
| 677 | |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 678 | struct vcpu *fiq_lower(void) |
| 679 | { |
| 680 | return irq_lower(); |
| 681 | } |
| 682 | |
Fuad Tabba | d1d6798 | 2020-01-08 11:28:29 +0000 | [diff] [blame] | 683 | noreturn struct vcpu *serr_lower(void) |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 684 | { |
Fuad Tabba | d1d6798 | 2020-01-08 11:28:29 +0000 | [diff] [blame] | 685 | /* |
| 686 | * SError exceptions should be isolated and handled by the responsible |
| 687 | * VM/exception level. Getting here indicates a bug, that isolation is |
| 688 | * not working, or a processor that does not support ARMv8.2-IESB, in |
| 689 | * which case Hafnium routes SError exceptions to EL2 (here). |
| 690 | */ |
| 691 | panic("SError from a lower exception level."); |
Wedson Almeida Filho | 9d5040f | 2018-10-29 08:41:27 +0000 | [diff] [blame] | 692 | } |
| 693 | |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 694 | /** |
| 695 | * Initialises a fault info structure. It assumes that an FnV bit exists at |
| 696 | * bit offset 10 of the ESR, and that it is only valid when the bottom 6 bits of |
| 697 | * the ESR (the fault status code) are 010000; this is the case for both |
| 698 | * instruction and data aborts, but not necessarily for other exception reasons. |
| 699 | */ |
| 700 | static struct vcpu_fault_info fault_info_init(uintreg_t esr, |
Andrew Walbran | 1281ed4 | 2019-10-22 17:23:40 +0100 | [diff] [blame] | 701 | const struct vcpu *vcpu, |
| 702 | uint32_t mode) |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 703 | { |
| 704 | uint32_t fsc = esr & 0x3f; |
| 705 | struct vcpu_fault_info r; |
| 706 | |
| 707 | r.mode = mode; |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 708 | r.pc = va_init(vcpu->regs.pc); |
| 709 | |
| 710 | /* |
| 711 | * Check the FnV bit, which is only valid if dfsc/ifsc is 010000. It |
| 712 | * indicates that we cannot rely on far_el2. |
| 713 | */ |
Andrew Walbran | e52006c | 2019-10-22 18:01:28 +0100 | [diff] [blame] | 714 | if (fsc == 0x10 && esr & (1U << 10)) { |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 715 | r.vaddr = va_init(0); |
| 716 | r.ipaddr = ipa_init(read_msr(hpfar_el2) << 8); |
| 717 | } else { |
| 718 | r.vaddr = va_init(read_msr(far_el2)); |
| 719 | r.ipaddr = ipa_init((read_msr(hpfar_el2) << 8) | |
| 720 | (read_msr(far_el2) & (PAGE_SIZE - 1))); |
| 721 | } |
| 722 | |
| 723 | return r; |
| 724 | } |
| 725 | |
Andrew Scull | 3740287 | 2018-10-24 14:23:06 +0100 | [diff] [blame] | 726 | struct vcpu *sync_lower_exception(uintreg_t esr) |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 727 | { |
Wedson Almeida Filho | 00df6c7 | 2018-10-18 11:19:24 +0100 | [diff] [blame] | 728 | struct vcpu *vcpu = current(); |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 729 | struct vcpu_fault_info info; |
Jose Marinho | 135dff3 | 2019-02-28 10:25:57 +0000 | [diff] [blame] | 730 | struct vcpu *new_vcpu; |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 731 | uintreg_t ec = GET_ESR_EC(esr); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 732 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 733 | switch (ec) { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 734 | case EC_WFI_WFE: |
Andrew Walbran | 48196eb | 2019-03-04 14:56:24 +0000 | [diff] [blame] | 735 | /* Skip the instruction. */ |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 736 | vcpu->regs.pc += GET_NEXT_PC_INC(esr); |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 737 | /* Check TI bit of ISS, 0 = WFI, 1 = WFE. */ |
Andrew Scull | 7364a8e | 2018-07-19 15:39:29 +0100 | [diff] [blame] | 738 | if (esr & 1) { |
Andrew Walbran | 48196eb | 2019-03-04 14:56:24 +0000 | [diff] [blame] | 739 | /* WFE */ |
| 740 | /* |
| 741 | * TODO: consider giving the scheduler more context, |
| 742 | * somehow. |
| 743 | */ |
Andrew Walbran | 16075b6 | 2019-09-03 17:11:07 +0100 | [diff] [blame] | 744 | api_yield(vcpu, &new_vcpu); |
Jose Marinho | 135dff3 | 2019-02-28 10:25:57 +0000 | [diff] [blame] | 745 | return new_vcpu; |
Andrew Scull | 7364a8e | 2018-07-19 15:39:29 +0100 | [diff] [blame] | 746 | } |
Andrew Walbran | 48196eb | 2019-03-04 14:56:24 +0000 | [diff] [blame] | 747 | /* WFI */ |
Andrew Scull | 9726c25 | 2019-01-23 13:44:19 +0000 | [diff] [blame] | 748 | return api_wait_for_interrupt(vcpu); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 749 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 750 | case EC_DATA_ABORT_LOWER_EL: |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 751 | info = fault_info_init( |
Andrew Walbran | e52006c | 2019-10-22 18:01:28 +0100 | [diff] [blame] | 752 | esr, vcpu, (esr & (1U << 6)) ? MM_MODE_W : MM_MODE_R); |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 753 | if (vcpu_handle_page_fault(vcpu, &info)) { |
| 754 | return NULL; |
| 755 | } |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 756 | /* Inform the EL1 of the data abort. */ |
| 757 | inject_el1_data_abort_exception(vcpu, esr); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 758 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 759 | /* Schedule the same VM to continue running. */ |
| 760 | return NULL; |
| 761 | |
| 762 | case EC_INSTRUCTION_ABORT_LOWER_EL: |
Andrew Scull | d3cfaad | 2019-04-04 11:34:10 +0100 | [diff] [blame] | 763 | info = fault_info_init(esr, vcpu, MM_MODE_X); |
Wedson Almeida Filho | 99d2d4c | 2019-02-14 12:53:46 +0000 | [diff] [blame] | 764 | if (vcpu_handle_page_fault(vcpu, &info)) { |
| 765 | return NULL; |
| 766 | } |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 767 | /* Inform the EL1 of the instruction abort. */ |
| 768 | inject_el1_instruction_abort_exception(vcpu, esr); |
Wedson Almeida Filho | 2f94ec1 | 2018-07-26 16:00:48 +0100 | [diff] [blame] | 769 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 770 | /* Schedule the same VM to continue running. */ |
| 771 | return NULL; |
| 772 | |
| 773 | case EC_HVC: |
Andrew Walbran | 59182d5 | 2019-09-23 17:55:39 +0100 | [diff] [blame] | 774 | return hvc_handler(vcpu); |
| 775 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 776 | case EC_SMC: { |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 777 | uintreg_t smc_pc = vcpu->regs.pc; |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 778 | struct vcpu *next = smc_handler(vcpu); |
Wedson Almeida Filho | 03e767a | 2018-07-30 15:32:03 +0100 | [diff] [blame] | 779 | |
| 780 | /* Skip the SMC instruction. */ |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 781 | vcpu->regs.pc = smc_pc + GET_NEXT_PC_INC(esr); |
Andrew Walbran | 9dadaf2 | 2019-12-05 16:50:55 +0000 | [diff] [blame] | 782 | |
Andrew Walbran | 3364565 | 2019-04-15 12:29:31 +0100 | [diff] [blame] | 783 | return next; |
Andrew Scull | c960c03 | 2018-10-24 15:13:35 +0100 | [diff] [blame] | 784 | } |
Wedson Almeida Filho | 03e767a | 2018-07-30 15:32:03 +0100 | [diff] [blame] | 785 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 786 | case EC_MSR: |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 787 | /* |
| 788 | * NOTE: This should never be reached because it goes through a |
| 789 | * separate path handled by handle_system_register_access(). |
| 790 | */ |
| 791 | panic("Handled by handle_system_register_access()."); |
| 792 | |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 793 | default: |
Andrew Walbran | 17eebf9 | 2020-02-05 16:35:49 +0000 | [diff] [blame] | 794 | dlog_notice( |
| 795 | "Unknown lower sync exception pc=%#x, esr=%#x, " |
| 796 | "ec=%#x\n", |
| 797 | vcpu->regs.pc, esr, ec); |
Andrew Scull | 9726c25 | 2019-01-23 13:44:19 +0000 | [diff] [blame] | 798 | break; |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 799 | } |
| 800 | |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 801 | /* |
Fuad Tabba | a48d122 | 2019-12-09 15:42:32 +0000 | [diff] [blame] | 802 | * The exception wasn't handled. Inject to the VM to give it chance to |
| 803 | * handle as an unknown exception. |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 804 | */ |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 805 | inject_el1_unknown_exception(vcpu, esr); |
| 806 | |
| 807 | /* Schedule the same VM to continue running. */ |
| 808 | return NULL; |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 809 | } |
| 810 | |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 811 | /** |
Fuad Tabba | b0ef2a4 | 2019-12-19 11:19:25 +0000 | [diff] [blame] | 812 | * Handles EC = 011000, MSR, MRS instruction traps. |
Fuad Tabba | ed294af | 2019-12-20 10:43:01 +0000 | [diff] [blame] | 813 | * Returns non-null ONLY if the access failed and the vCPU is changing. |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 814 | */ |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 815 | void handle_system_register_access(uintreg_t esr_el2) |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 816 | { |
| 817 | struct vcpu *vcpu = current(); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 818 | ffa_vm_id_t vm_id = vcpu->vm->id; |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 819 | uintreg_t ec = GET_ESR_EC(esr_el2); |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 820 | |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 821 | CHECK(ec == EC_MSR); |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 822 | /* |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 823 | * Handle accesses to debug and performance monitor registers. |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 824 | * Inject an exception for unhandled/unsupported registers. |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 825 | */ |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 826 | if (debug_el1_is_register_access(esr_el2)) { |
| 827 | if (!debug_el1_process_access(vcpu, vm_id, esr_el2)) { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 828 | inject_el1_unknown_exception(vcpu, esr_el2); |
| 829 | return; |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 830 | } |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 831 | } else if (perfmon_is_register_access(esr_el2)) { |
| 832 | if (!perfmon_process_access(vcpu, vm_id, esr_el2)) { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 833 | inject_el1_unknown_exception(vcpu, esr_el2); |
| 834 | return; |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 835 | } |
Fuad Tabba | 77a4b01 | 2019-11-15 12:13:08 +0000 | [diff] [blame] | 836 | } else if (feature_id_is_register_access(esr_el2)) { |
| 837 | if (!feature_id_process_access(vcpu, esr_el2)) { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 838 | inject_el1_unknown_exception(vcpu, esr_el2); |
| 839 | return; |
Fuad Tabba | 77a4b01 | 2019-11-15 12:13:08 +0000 | [diff] [blame] | 840 | } |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 841 | } else { |
Fuad Tabba | b86325a | 2020-01-10 13:38:15 +0000 | [diff] [blame] | 842 | inject_el1_unknown_exception(vcpu, esr_el2); |
| 843 | return; |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 844 | } |
| 845 | |
Fuad Tabba | f1d6dc5 | 2019-09-18 17:33:14 +0100 | [diff] [blame] | 846 | /* Instruction was fulfilled. Skip it and run the next one. */ |
Fuad Tabba | 3e9b022 | 2019-11-11 16:47:50 +0000 | [diff] [blame] | 847 | vcpu->regs.pc += GET_NEXT_PC_INC(esr_el2); |
Fuad Tabba | c76466d | 2019-09-06 10:42:12 +0100 | [diff] [blame] | 848 | } |