1. 24 Jun, 2021 2 commits
    • Hou Wenlong's avatar
      KVM: selftests: fix triple fault if ept=0 in dirty_log_test · e5830fb1
      Hou Wenlong authored
      Commit 22f232d1 ("KVM: selftests: x86: Set supported CPUIDs on
      default VM") moved vcpu_set_cpuid into vm_create_with_vcpus, but
      dirty_log_test doesn't use it to create vm. So vcpu's CPUIDs is
      not set, the guest's pa_bits in kvm would be smaller than the
      value queried by userspace.
      
      However, the dirty track memory slot is in the highest GPA, the
      reserved bits in gpte would be set with wrong pa_bits.
      For shadow paging, page fault would fail in permission_fault and
      be injected into guest. Since guest doesn't have idt, it finally
      leads to vm_exit for triple fault.
      
      Move vcpu_set_cpuid into vm_vcpu_add_default to set supported
      CPUIDs on default vcpu, since almost all tests need it.
      
      Fixes: 22f232d1 ("KVM: selftests: x86: Set supported CPUIDs on default VM")
      Signed-off-by: default avatarHou Wenlong <houwenlong93@linux.alibaba.com>
      Message-Id: <411ea2173f89abce56fc1fca5af913ed9c5a89c9.1624351343.git.houwenlong93@linux.alibaba.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e5830fb1
    • Jim Mattson's avatar
      KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB · 18f63b15
      Jim Mattson authored
      Failed VM-entry is often due to a faulty core. To help identify bad
      cores, print the id of the last logical processor that attempted
      VM-entry whenever dumping a VMCS or VMCB.
      Signed-off-by: default avatarJim Mattson <jmattson@google.com>
      Message-Id: <20210621221648.1833148-1-jmattson@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      18f63b15
  2. 23 Jun, 2021 1 commit
  3. 22 Jun, 2021 4 commits
  4. 21 Jun, 2021 5 commits
    • Sean Christopherson's avatar
      KVM: nVMX: Dynamically compute max VMCS index for vmcs12 · ba1f8245
      Sean Christopherson authored
      Calculate the max VMCS index for vmcs12 by walking the array to find the
      actual max index.  Hardcoding the index is prone to bitrot, and the
      calculation is only done on KVM bringup (albeit on every CPU, but there
      aren't _that_ many null entries in the array).
      
      Fixes: 3c0f9936 ("KVM: nVMX: Add a TSC multiplier field in VMCS12")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20210618214658.2700765-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ba1f8245
    • Jim Mattson's avatar
      KVM: VMX: Skip #PF(RSVD) intercepts when emulating smaller maxphyaddr · 5140bc7d
      Jim Mattson authored
      As part of smaller maxphyaddr emulation, kvm needs to intercept
      present page faults to see if it needs to add the RSVD flag (bit 3) to
      the error code. However, there is no need to intercept page faults
      that already have the RSVD flag set. When setting up the page fault
      intercept, add the RSVD flag into the #PF error code mask field (but
      not the #PF error code match field) to skip the intercept when the
      RSVD flag is already set.
      Signed-off-by: default avatarJim Mattson <jmattson@google.com>
      Message-Id: <20210618235941.1041604-1-jmattson@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5140bc7d
    • Bharata B Rao's avatar
      KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE · f0c6fbbb
      Bharata B Rao authored
      H_RPT_INVALIDATE does two types of TLB invalidations:
      
      1. Process-scoped invalidations for guests when LPCR[GTSE]=0.
         This is currently not used in KVM as GTSE is not usually
         disabled in KVM.
      2. Partition-scoped invalidations that an L1 hypervisor does on
         behalf of an L2 guest. This is currently handled
         by H_TLB_INVALIDATE hcall and this new replaces the old that.
      
      This commit enables process-scoped invalidations for L1 guests.
      Support for process-scoped and partition-scoped invalidations
      from/for nested guests will be added separately.
      
      Process scoped tlbie invalidations from L1 and nested guests
      need RS register for TLBIE instruction to contain both PID and
      LPID.  This patch introduces primitives that execute tlbie
      instruction with both PID and LPID set in prepartion for
      H_RPT_INVALIDATE hcall.
      
      A description of H_RPT_INVALIDATE follows:
      
      int64   /* H_Success: Return code on successful completion */
              /* H_Busy - repeat the call with the same */
              /* H_Parameter, H_P2, H_P3, H_P4, H_P5 : Invalid
      	   parameters */
      hcall(const uint64 H_RPT_INVALIDATE, /* Invalidate RPT
      					translation
      					lookaside information */
            uint64 id,        /* PID/LPID to invalidate */
            uint64 target,    /* Invalidation target */
            uint64 type,      /* Type of lookaside information */
            uint64 pg_sizes,  /* Page sizes */
            uint64 start,     /* Start of Effective Address (EA)
      			   range (inclusive) */
            uint64 end)       /* End of EA range (exclusive) */
      
      Invalidation targets (target)
      -----------------------------
      Core MMU        0x01 /* All virtual processors in the
      			partition */
      Core local MMU  0x02 /* Current virtual processor */
      Nest MMU        0x04 /* All nest/accelerator agents
      			in use by the partition */
      
      A combination of the above can be specified,
      except core and core local.
      
      Type of translation to invalidate (type)
      ---------------------------------------
      NESTED       0x0001  /* invalidate nested guest partition-scope */
      TLB          0x0002  /* Invalidate TLB */
      PWC          0x0004  /* Invalidate Page Walk Cache */
      PRT          0x0008  /* Invalidate caching of Process Table
      			Entries if NESTED is clear */
      PAT          0x0008  /* Invalidate caching of Partition Table
      			Entries if NESTED is set */
      
      A combination of the above can be specified.
      
      Page size mask (pages)
      ----------------------
      4K              0x01
      64K             0x02
      2M              0x04
      1G              0x08
      All sizes       (-1UL)
      
      A combination of the above can be specified.
      All page sizes can be selected with -1.
      
      Semantics: Invalidate radix tree lookaside information
                 matching the parameters given.
      * Return H_P2, H_P3 or H_P4 if target, type, or pageSizes parameters
        are different from the defined values.
      * Return H_PARAMETER if NESTED is set and pid is not a valid nested
        LPID allocated to this partition
      * Return H_P5 if (start, end) doesn't form a valid range. Start and
        end should be a valid Quadrant address and  end > start.
      * Return H_NotSupported if the partition is not in running in radix
        translation mode.
      * May invalidate more translation information than requested.
      * If start = 0 and end = -1, set the range to cover all valid
        addresses. Else start and end should be aligned to 4kB (lower 11
        bits clear).
      * If NESTED is clear, then invalidate process scoped lookaside
        information. Else pid specifies a nested LPID, and the invalidation
        is performed   on nested guest partition table and nested guest
        partition scope real addresses.
      * If pid = 0 and NESTED is clear, then valid addresses are quadrant 3
        and quadrant 0 spaces, Else valid addresses are quadrant 0.
      * Pages which are fully covered by the range are to be invalidated.
        Those which are partially covered are considered outside
        invalidation range, which allows a caller to optimally invalidate
        ranges that may   contain mixed page sizes.
      * Return H_SUCCESS on success.
      Signed-off-by: default avatarBharata B Rao <bharata@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210621085003.904767-4-bharata@linux.ibm.com
      f0c6fbbb
    • Bharata B Rao's avatar
      powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def · d6265cb3
      Bharata B Rao authored
      Add a field to mmu_psize_def to store the page size encodings
      of H_RPT_INVALIDATE hcall. Initialize this while scanning the radix
      AP encodings. This will be used when invalidating with required
      page size encoding in the hcall.
      Signed-off-by: default avatarBharata B Rao <bharata@linux.ibm.com>
      Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210621085003.904767-3-bharata@linux.ibm.com
      d6265cb3
    • Aneesh Kumar K.V's avatar
      KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments · f09216a1
      Aneesh Kumar K.V authored
      The type values H_RPTI_TYPE_PRT and H_RPTI_TYPE_PAT indicate
      invalidating the caching of process and partition scoped entries
      respectively.
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarBharata B Rao <bharata@linux.ibm.com>
      Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210621085003.904767-2-bharata@linux.ibm.com
      f09216a1
  5. 20 Jun, 2021 1 commit
  6. 18 Jun, 2021 8 commits
  7. 17 Jun, 2021 19 commits