1. 17 7月, 2020 1 次提交
  2. 11 7月, 2020 3 次提交
    • R
      i386: hvf: Move Guest LMA reset to macvm_set_cr0() · 82695a1b
      Roman Bolshakov 提交于
      The only useful purpose of hvf_reset_vcpu() is to clear "IA-32e mode
      guest" (LMA) VM-Entry control. But it can be moved to macvm_set_cr0()
      which is indirectly used by post-init and post-reset to flush emulator
      state. That enables clean removal of hvf_reset_vcpu().
      
      LMA is set only if IA32_EFER.LME = 1, according to Intel SDM "9.8.5
      Initializing IA-32e Mode" and "9.8.5.4 Switching Out of IA-32e Mode
      Operation", otherwise the entry control can be safely cleared.
      
      Cc: Cameron Esfahani <dirty@apple.com>
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      Message-Id: <20200630102824.77604-7-r.bolshakov@yadro.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      82695a1b
    • C
      i386: hvf: Make long mode enter and exit clearer · a4e26fa8
      Cameron Esfahani 提交于
      Intel SDM "9.8.5 Initializing IA-32e Mode" and "9.8.5.4 Switching Out of
      IA-32e Mode Operation" define activation and deactivation of long mode
      only upon a change of CR0.PG but current code invokes exit_long_mode()
      unconditionally until LME is cleared.
      Signed-off-by: NCameron Esfahani <dirty@apple.com>
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      Message-Id: <20200630102824.77604-6-r.bolshakov@yadro.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a4e26fa8
    • R
      i386: hvf: Set env->eip in macvm_set_rip() · b8d864f6
      Roman Bolshakov 提交于
      cpu_synchronize_state() is currently no-op for hvf but BIOS will hang in
      vAPIC option ROM when cpu_synchronize_state() is wired to
      hvf_cpu_synchronize_state().
      
      cpu_synchronize_state() state is called from vapic_write() during option
      ROM initialization. It sets dirty flag on the cpu. macvm_set_rip() is
      then invoked to advance IP after the I/O write to vAPIC port.
      
      macvm_set_rip() only modifies VMCS, it doesn't change env->eip.
      Therefore on the next iteration of vCPU loop, vcpu_dirty flag is checked
      and hvf_put_registers() overwrites correct RIP in VMCS with the value of
      env->eip that points to the I/O write instruction. Execution of the CPU
      gets stuck on the instruction.
      
      The issue can be avoided if eip doesn't contain stale value when dirty
      flag is set on cpu.
      
      Cc: Cameron Esfahani <dirty@apple.com>
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      Message-Id: <20200630102824.77604-2-r.bolshakov@yadro.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b8d864f6
  3. 03 4月, 2020 1 次提交
    • R
      i386: hvf: Reset IRQ inhibition after moving RIP · ddd31732
      Roman Bolshakov 提交于
      The sequence of instructions exposes an issue:
        sti
        hlt
      
      Interrupts cannot be delivered to hvf after hlt instruction cpu because
      HF_INHIBIT_IRQ_MASK is set just before hlt is handled and never reset
      after moving instruction pointer beyond hlt.
      
      So, after hvf_vcpu_exec() returns, CPU thread gets locked up forever in
      qemu_wait_io_event() (cpu_thread_is_idle() evaluates inhibition
      flag and considers the CPU idle if the flag is set).
      
      Cc: Cameron Esfahani <dirty@apple.com>
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      Message-Id: <20200328174411.51491-1-r.bolshakov@yadro.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ddd31732
  4. 20 2月, 2020 3 次提交
  5. 26 11月, 2019 1 次提交
  6. 09 2月, 2018 1 次提交
  7. 06 2月, 2018 1 次提交
  8. 22 12月, 2017 5 次提交
    • P
      6701d81d
    • P
      i386: hvf: move all hvf files in the same directory · 69e0a03c
      Paolo Bonzini 提交于
      Just call it hvf/, no need for the "utils" suffix.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      69e0a03c
    • S
      i386: hvf: refactor event injection code for hvf · b7394c83
      Sergio Andres Gomez Del Real 提交于
      This patch refactors the event-injection code for hvf by using the
      appropriate fields already provided by CPUX86State. At vmexit, it fills
      these fields so that hvf_inject_interrupts can just retrieve them without
      calling into hvf.
      Signed-off-by: NSergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-14-Sergio.G.DelReal@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b7394c83
    • S
      i386: hvf: fix licensing issues; isolate task handling code (GPL v2-only) · 996feed4
      Sergio Andres Gomez Del Real 提交于
      This patch replaces the license header for those files that were either
      GPL v2-or-v3, or GPL v2-only; the replacing license is GPL v2-or-later.
      The code for task switching/handling, which is derived from KVM and
      hence is GPL v2-only, is isolated in the new files (with this license)
      x86_task.c/.h, and the corresponding compilation rule is added to
      target/i386/hvf-utils/Makefile.objs.
      Signed-off-by: NSergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-4-Sergio.G.DelReal@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      996feed4
    • S
      i386: hvf: add code base from Google's QEMU repository · c97d6d2c
      Sergio Andres Gomez Del Real 提交于
      This file begins tracking the files that will be the code base for HVF
      support in QEMU. This code base is part of Google's QEMU version of
      their Android emulator, and can be found at
      https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
      
      This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
      Hypervisor), found at https://github.com/veertuinc/vdhh. Everything is
      appropriately licensed under GPL v2-or-later, except for the code inside
      x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
      is licensed GPL v2-only.
      
      This code base already implements a very great deal of functionality,
      although Google's version removed from Vertuu's the support for APIC
      page and hyperv-related stuff. According to the Android Emulator Release
      Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
      enabled by default on macOS for 32-bit x86 images to improve performance
      and macOS compatibility", although we better use with caution for, as the
      same Revision warns us, "If you experience issues with it specifically,
      please file a bug report...". The code hasn't seen much update in the
      last 5 months, so I think that we can further develop the code with
      occasional visiting Google's repository to see if there has been any
      update.
      
      On top of Google's code, the following changes were made:
      
      - add code to the configure script to support the --enable-hvf argument.
      If the OS is Darwin, it checks for presence of HVF in the system. The
      patch also adds strings related to HVF in the file qemu-options.hx.
      QEMU will only support the modern syntax style '-M accel=hvf' no enable
      hvf; the legacy '-enable-hvf' will not be supported.
      
      - fix styling issues
      
      - add glue code to cpus.c
      
      - move HVFX86EmulatorState field to CPUX86State, changing the
      the emulation functions to have a parameter with signature 'CPUX86State *'
      instead of 'CPUState *' so we don't have to get the 'env'.
      Signed-off-by: NSergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c97d6d2c