1. 13 12月, 2018 1 次提交
  2. 13 11月, 2018 2 次提交
    • P
      target/arm: Hyp mode R14 is shared with User and System · 593cfa2b
      Peter Maydell 提交于
      Hyp mode is an exception to the general rule that each AArch32
      mode has its own r13, r14 and SPSR -- it has a banked r13 and
      SPSR but shares its r14 with User and System mode. We were
      incorrectly implementing it as banked, which meant that on
      entry to Hyp mode r14 was 0 rather than the USR/SYS r14.
      
      We provide a new function r14_bank_number() which is like
      the existing bank_number() but provides the index into
      env->banked_r14[]; bank_number() provides the index to use
      for env->banked_r13[] and env->banked_cpsr[].
      
      All the points in the code that were using bank_number()
      to index into env->banked_r14[] are updated for consintency:
       * switch_mode() -- this is the only place where we fix
         an actual bug
       * aarch64_sync_32_to_64() and aarch64_sync_64_to_32():
         no behavioural change as we already special-cased Hyp R14
       * kvm32.c: no behavioural change since the guest can't ever
         be in Hyp mode, but conceptually the right thing to do
       * msr_banked()/mrs_banked(): we can never get to the case
         that accesses banked_r14[] with tgtmode == ARM_CPU_MODE_HYP,
         so no behavioural change
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NEdgar E. Iglesias <edgar.iglesias@xilinx.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20181109173553.22341-2-peter.maydell@linaro.org
      593cfa2b
    • P
      target/arm: Correctly implement handling of HCR_EL2.{VI, VF} · 89430fc6
      Peter Maydell 提交于
      In commit 8a0fc3a2 we tried to implement HCR_EL2.{VI,VF},
      but we got it wrong and had to revert it.
      
      In that commit we implemented them as simply tracking whether there
      is a pending virtual IRQ or virtual FIQ. This is not correct -- these
      bits cause a software-generated VIRQ/VFIQ, which is distinct from
      whether there is a hardware-generated VIRQ/VFIQ caused by the
      external interrupt controller. So we need to track separately
      the HCR_EL2 bit state and the external virq/vfiq line state, and
      OR the two together to get the actual pending VIRQ/VFIQ state.
      
      Fixes: 8a0fc3a2Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20181109134731.11605-4-peter.maydell@linaro.org
      89430fc6
  3. 24 10月, 2018 5 次提交
  4. 08 10月, 2018 4 次提交
  5. 26 4月, 2018 2 次提交
  6. 24 3月, 2018 1 次提交
    • P
      target/arm: Factor out code to calculate FSR for debug exceptions · 81621d9a
      Peter Maydell 提交于
      When a debug exception is taken to AArch32, it appears as a Prefetch
      Abort, and the Instruction Fault Status Register (IFSR) must be set.
      The IFSR has two possible formats, depending on whether LPAE is in
      use. Factor out the code in arm_debug_excp_handler() which picks
      an FSR value into its own utility function, update it to use
      arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants,
      and use the correct condition to select long or short format.
      
      In particular this fixes a bug where we could select the short
      format because we're at EL0 and the EL1 translation regime is
      not using LPAE, but then route the debug exception to EL2 because
      of MDCR_EL2.TDE and hand EL2 the wrong format FSR.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180320134114.30418-3-peter.maydell@linaro.org
      81621d9a
  7. 16 2月, 2018 1 次提交
  8. 16 1月, 2018 1 次提交
    • P
      target/arm: Handle page table walk load failures correctly · 3b39d734
      Peter Maydell 提交于
      Instead of ignoring the response from address_space_ld*()
      (indicating an attempt to read a page table descriptor from
      an invalid physical address), use it to report the failure
      correctly.
      
      Since this is another couple of locations where we need to
      decide the value of the ARMMMUFaultInfo ea bit based on a
      MemTxResult, we factor out that operation into a helper
      function.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      3b39d734
  9. 14 12月, 2017 3 次提交
  10. 31 10月, 2017 1 次提交
  11. 12 10月, 2017 2 次提交
  12. 06 10月, 2017 1 次提交
    • P
      target/arm: Implement security attribute lookups for memory accesses · 35337cc3
      Peter Maydell 提交于
      Implement the security attribute lookups for memory accesses
      in the get_phys_addr() functions, causing these to generate
      various kinds of SecureFault for bad accesses.
      
      The major subtlety in this code relates to handling of the
      case when the security attributes the SAU assigns to the
      address don't match the current security state of the CPU.
      
      In the ARM ARM pseudocode for validating instruction
      accesses, the security attributes of the address determine
      whether the Secure or NonSecure MPU state is used. At face
      value, handling this would require us to encode the relevant
      bits of state into mmu_idx for both S and NS at once, which
      would result in our needing 16 mmu indexes. Fortunately we
      don't actually need to do this because a mismatch between
      address attributes and CPU state means either:
       * some kind of fault (usually a SecureFault, but in theory
         perhaps a UserFault for unaligned access to Device memory)
       * execution of the SG instruction in NS state from a
         Secure & NonSecure code region
      
      The purpose of SG is simply to flip the CPU into Secure
      state, so we can handle it by emulating execution of that
      instruction directly in arm_v7m_cpu_do_interrupt(), which
      means we can treat all the mismatch cases as "throw an
      exception" and we don't need to encode the state of the
      other MPU bank into our mmu_idx values.
      
      This commit doesn't include the actual emulation of SG;
      it also doesn't include implementation of the IDAU, which
      is a per-board way to specify hard-coded memory attributes
      for addresses, which override the CPU-internal SAU if they
      specify a more secure setting than the SAU is programmed to.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Message-id: 1506092407-26985-15-git-send-email-peter.maydell@linaro.org
      35337cc3
  13. 15 9月, 2017 2 次提交
  14. 07 9月, 2017 2 次提交
  15. 05 9月, 2017 1 次提交
  16. 04 9月, 2017 1 次提交
  17. 21 4月, 2017 2 次提交
  18. 08 2月, 2017 1 次提交
  19. 27 1月, 2017 1 次提交
    • M
      armv7m: Fix reads of CONTROL register bit 1 · abc24d86
      Michael Davidsaver 提交于
      The v7m CONTROL register bit 1 is SPSEL, which indicates
      the stack being used. We were storing this information
      not in v7m.control but in the separate v7m.other_sp
      structure field. Unfortunately, the code handling reads
      of the CONTROL register didn't take account of this, and
      so if SPSEL was updated by an exception entry or exit then
      a subsequent guest read of CONTROL would get the wrong value.
      
      Using a separate structure field doesn't really gain us
      anything in efficiency, so drop this unnecessary complexity
      in favour of simply storing all the bits in v7m.control.
      
      This is a migration compatibility break for M profile
      CPUs only.
      Signed-off-by: NMichael Davidsaver <mdavidsaver@gmail.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1484937883-1068-6-git-send-email-peter.maydell@linaro.org
      [PMM: rewrote commit message;
       use deposit32(); use FIELD to define constants for
       masking and shifting of CONTROL register fields
      ]
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      abc24d86
  20. 21 12月, 2016 1 次提交
    • T
      Move target-* CPU file into a target/ folder · fcf5ef2a
      Thomas Huth 提交于
      We've currently got 18 architectures in QEMU, and thus 18 target-xxx
      folders in the root folder of the QEMU source tree. More architectures
      (e.g. RISC-V, AVR) are likely to be included soon, too, so the main
      folder of the QEMU sources slowly gets quite overcrowded with the
      target-xxx folders.
      To disburden the main folder a little bit, let's move the target-xxx
      folders into a dedicated target/ folder, so that target-xxx/ simply
      becomes target/xxx/ instead.
      
      Acked-by: Laurent Vivier <laurent@vivier.eu> [m68k part]
      Acked-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> [tricore part]
      Acked-by: Michael Walle <michael@walle.cc> [lm32 part]
      Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x part]
      Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> [s390x part]
      Acked-by: Eduardo Habkost <ehabkost@redhat.com> [i386 part]
      Acked-by: Artyom Tarasenko <atar4qemu@gmail.com> [sparc part]
      Acked-by: Richard Henderson <rth@twiddle.net> [alpha part]
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> [xtensa part]
      Reviewed-by: David Gibson <david@gibson.dropbear.id.au> [ppc part]
      Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> [cris&microblaze part]
      Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> [unicore32 part]
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      fcf5ef2a
  21. 26 10月, 2016 1 次提交
  22. 12 7月, 2016 1 次提交
  23. 17 6月, 2016 1 次提交
  24. 06 6月, 2016 1 次提交
  25. 19 5月, 2016 1 次提交