1. 14 Jul, 2022 18 commits
  2. 12 Jul, 2022 5 commits
  3. 08 Jul, 2022 7 commits
  4. 25 Jun, 2022 2 commits
  5. 24 Jun, 2022 8 commits
    • Paolo Bonzini's avatar
      KVM: SEV-ES: reuse advance_sev_es_emulated_ins for OUT too · db209369
      Paolo Bonzini authored
      complete_emulator_pio_in() only has to be called by
      complete_sev_es_emulated_ins() now; therefore, all that the function does
      now is adjust sev_pio_count and sev_pio_data.  Which is the same for
      both IN and OUT.
      
      No functional change intended.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      db209369
    • Paolo Bonzini's avatar
      KVM: x86: de-underscorify __emulator_pio_in · f35cee4a
      Paolo Bonzini authored
      Now all callers except emulator_pio_in_emulated are using
      __emulator_pio_in/complete_emulator_pio_in explicitly.
      Move the "either copy the result or attempt PIO" logic in
      emulator_pio_in_emulated, and rename __emulator_pio_in to
      just emulator_pio_in.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f35cee4a
    • Paolo Bonzini's avatar
      KVM: x86: wean fast IN from emulator_pio_in · dc7a4bfd
      Paolo Bonzini authored
      Use __emulator_pio_in() directly for fast PIO instead of bouncing through
      emulator_pio_in() now that __emulator_pio_in() fills "val" when handling
      in-kernel PIO.  vcpu->arch.pio.count is guaranteed to be '0', so this a
      pure nop.
      
      emulator_pio_in_emulated is now the last caller of emulator_pio_in.
      
      No functional change intended.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      dc7a4bfd
    • Paolo Bonzini's avatar
      KVM: x86: wean in-kernel PIO from vcpu->arch.pio* · 0c05e10b
      Paolo Bonzini authored
      Make emulator_pio_in_out operate directly on the provided buffer
      as long as PIO is handled inside KVM.
      
      For input operations, this means that, in the case of in-kernel
      PIO, __emulator_pio_in() does not have to be always followed
      by complete_emulator_pio_in().  This affects emulator_pio_in() and
      kvm_sev_es_ins(); for the latter, that is why the call moves from
      advance_sev_es_emulated_ins() to complete_sev_es_emulated_ins().
      
      For output, it means that vcpu->pio.count is never set unnecessarily
      and there is no need to clear it; but also vcpu->pio.size must not
      be used in kvm_sev_es_outs(), because it will not be updated for
      in-kernel OUT.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0c05e10b
    • Paolo Bonzini's avatar
      KVM: x86: move all vcpu->arch.pio* setup in emulator_pio_in_out() · 30d583fd
      Paolo Bonzini authored
      For now, this is basically an excuse to add back the void* argument to
      the function, while removing some knowledge of vcpu->arch.pio* from
      its callers.  The WARN that vcpu->arch.pio.count is zero is also
      extended to OUT operations.
      
      The vcpu->arch.pio* fields still need to be filled even when the PIO is
      handled in-kernel as __emulator_pio_in() is always followed by
      complete_emulator_pio_in().  But after fixing that, it will be possible to
      to only populate the vcpu->arch.pio* fields on userspace exits.
      
      No functional change intended.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      30d583fd
    • Paolo Bonzini's avatar
      KVM: x86: drop PIO from unregistered devices · 35ab3b77
      Paolo Bonzini authored
      KVM protects the device list with SRCU, and therefore different calls
      to kvm_io_bus_read()/kvm_io_bus_write() can very well see different
      incarnations of kvm->buses.  If userspace unregisters a device while
      vCPUs are running there is no well-defined result.  This patch applies
      a safe fallback by returning early from emulator_pio_in_out().  This
      corresponds to returning zeroes from IN, and dropping the writes on
      the floor for OUT.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      35ab3b77
    • Paolo Bonzini's avatar
      KVM: x86: inline kernel_pio into its sole caller · 0f87ac23
      Paolo Bonzini authored
      The caller of kernel_pio already has arguments for most of what kernel_pio
      fishes out of vcpu->arch.pio.  This is the first step towards ensuring that
      vcpu->arch.pio.* is only used when exiting to userspace.
      
      No functional change intended.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0f87ac23
    • Paolo Bonzini's avatar
      KVM: x86: complete fast IN directly with complete_emulator_pio_in() · 7a6177d6
      Paolo Bonzini authored
      Use complete_emulator_pio_in() directly when completing fast PIO, there's
      no need to bounce through emulator_pio_in(): the comment about ECX
      changing doesn't apply to fast PIO, which isn't used for string I/O.
      
      No functional change intended.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7a6177d6