1. 10 Jan, 2018 2 commits
    • David Gibson's avatar
      KVM: PPC: Book3S HV: Always flush TLB in kvmppc_alloc_reset_hpt() · ecba8297
      David Gibson authored
      The KVM_PPC_ALLOCATE_HTAB ioctl(), implemented by kvmppc_alloc_reset_hpt()
      is supposed to completely clear and reset a guest's Hashed Page Table (HPT)
      allocating or re-allocating it if necessary.
      
      In the case where an HPT of the right size already exists and it just
      zeroes it, it forces a TLB flush on all guest CPUs, to remove any stale TLB
      entries loaded from the old HPT.
      
      However, that situation can arise when the HPT is resizing as well - or
      even when switching from an RPT to HPT - so those cases need a TLB flush as
      well.
      
      So, move the TLB flush to trigger in all cases except for errors.
      
      Cc: stable@vger.kernel.org # v4.10+
      Fixes: f98a8bf9 ("KVM: PPC: Book3S HV: Allow KVM_PPC_ALLOCATE_HTAB ioctl() to change HPT size")
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      ecba8297
    • Alexey Kardashevskiy's avatar
      KVM: PPC: Book3S PR: Fix WIMG handling under pHyp · 6c7d47c3
      Alexey Kardashevskiy authored
      Commit 96df2267 ("KVM: PPC: Book3S PR: Preserve storage control bits")
      added code to preserve WIMG bits but it missed 2 special cases:
      - a magic page in kvmppc_mmu_book3s_64_xlate() and
      - guest real mode in kvmppc_handle_pagefault().
      
      For these ptes, WIMG was 0 and pHyp failed on these causing a guest to
      stop in the very beginning at NIP=0x100 (due to bd9166ff "KVM: PPC:
      Book3S PR: Exit KVM on failed mapping").
      
      According to LoPAPR v1.1 14.5.4.1.2 H_ENTER:
      
       The hypervisor checks that the WIMG bits within the PTE are appropriate
       for the physical page number else H_Parameter return. (For System Memory
       pages WIMG=0010, or, 1110 if the SAO option is enabled, and for IO pages
       WIMG=01**.)
      
      This hence initializes WIMG to non-zero value HPTE_R_M (0x10), as expected
      by pHyp.
      
      [paulus@ozlabs.org - fix compile for 32-bit]
      
      Cc: stable@vger.kernel.org # v4.11+
      Fixes: 96df2267 "KVM: PPC: Book3S PR: Preserve storage control bits"
      Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Tested-by: default avatarRuediger Oertel <ro@suse.de>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Tested-by: default avatarGreg Kurz <groug@kaod.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      6c7d47c3
  2. 06 Dec, 2017 2 commits
    • Serhii Popovych's avatar
      KVM: PPC: Book3S HV: Fix use after free in case of multiple resize requests · 4ed11aee
      Serhii Popovych authored
      When serving multiple resize requests following could happen:
      
          CPU0                                    CPU1
          ----                                    ----
          kvm_vm_ioctl_resize_hpt_prepare(1);
            -> schedule_work()
                                                  /* system_rq might be busy: delay */
          kvm_vm_ioctl_resize_hpt_prepare(2);
            mutex_lock();
            if (resize) {
               ...
               release_hpt_resize();
            }
            ...                                   resize_hpt_prepare_work()
            -> schedule_work()                    {
            mutex_unlock()                           /* resize->kvm could be wrong */
                                                     struct kvm *kvm = resize->kvm;
      
                                                     mutex_lock(&kvm->lock);   <<<< UAF
                                                     ...
                                                  }
      
      i.e. a second resize request with different order could be started by
      kvm_vm_ioctl_resize_hpt_prepare(), causing the previous request to be
      free()d when there's still an active worker thread which will try to
      access it.  This leads to a use after free in point marked with UAF on
      the diagram above.
      
      To prevent this from happening, instead of unconditionally releasing a
      pre-existing resize structure from the prepare ioctl(), we check if
      the existing structure has an in-progress worker.  We do that by
      checking if the resize->error == -EBUSY, which is safe because the
      resize->error field is protected by the kvm->lock.  If there is an
      active worker, instead of releasing, we mark the structure as stale by
      unlinking it from kvm_struct.
      
      In the worker thread we check for a stale structure (with kvm->lock
      held), and in that case abort, releasing the stale structure ourself.
      We make the check both before and the actual allocation.  Strictly,
      only the check afterwards is needed, the check before is an
      optimization: if the structure happens to become stale before the
      worker thread is dispatched, rather than during the allocation, it
      means we can avoid allocating then immediately freeing a potentially
      substantial amount of memory.
      
      This fixes following or similar host kernel crash message:
      
      [  635.277361] Unable to handle kernel paging request for data at address 0x00000000
      [  635.277438] Faulting instruction address: 0xc00000000052f568
      [  635.277446] Oops: Kernel access of bad area, sig: 11 [#1]
      [  635.277451] SMP NR_CPUS=2048 NUMA PowerNV
      [  635.277470] Modules linked in: xt_CHECKSUM iptable_mangle ipt_MASQUERADE
      nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4
      nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc
      ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter nfsv3 nfs_acl nfs
      lockd grace fscache kvm_hv kvm rpcrdma sunrpc ib_isert iscsi_target_mod ib_iser libiscsi
      scsi_transport_iscsi ib_srpt target_core_mod ext4 ib_srp scsi_transport_srp
      ib_ipoib mbcache jbd2 rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ocrdma(T)
      ib_core ses enclosure scsi_transport_sas sg shpchp leds_powernv ibmpowernv i2c_opal
      i2c_core powernv_rng ipmi_powernv ipmi_devintf ipmi_msghandler ip_tables xfs
      libcrc32c sr_mod sd_mod cdrom lpfc nvme_fc(T) nvme_fabrics nvme_core ipr nvmet_fc(T)
      tg3 nvmet libata be2net crc_t10dif crct10dif_generic scsi_transport_fc ptp scsi_tgt
      pps_core crct10dif_common dm_mirror dm_region_hash dm_log dm_mod
      [  635.278687] CPU: 40 PID: 749 Comm: kworker/40:1 Tainted: G
      ------------ T 3.10.0.bz1510771+ #1
      [  635.278782] Workqueue: events resize_hpt_prepare_work [kvm_hv]
      [  635.278851] task: c0000007e6840000 ti: c0000007e9180000 task.ti: c0000007e9180000
      [  635.278919] NIP: c00000000052f568 LR: c0000000009ea310 CTR: c0000000009ea4f0
      [  635.278988] REGS: c0000007e91837f0 TRAP: 0300   Tainted: G
      ------------ T  (3.10.0.bz1510771+)
      [  635.279077] MSR: 9000000100009033 <SF,HV,EE,ME,IR,DR,RI,LE>  CR: 24002022  XER:
      00000000
      [  635.279248] CFAR: c000000000009368 DAR: 0000000000000000 DSISR: 40000000 SOFTE: 1
      GPR00: c0000000009ea310 c0000007e9183a70 c000000001250b00 c0000007e9183b10
      GPR04: 0000000000000000 0000000000000000 c0000007e9183650 0000000000000000
      GPR08: c0000007ffff7b80 00000000ffffffff 0000000080000028 d00000000d2529a0
      GPR12: 0000000000002200 c000000007b56800 c000000000120028 c0000007f135bb40
      GPR16: 0000000000000000 c000000005c1e018 c000000005c1e018 0000000000000000
      GPR20: 0000000000000001 c0000000011bf778 0000000000000001 fffffffffffffef7
      GPR24: 0000000000000000 c000000f1e262e50 0000000000000002 c0000007e9180000
      GPR28: c000000f1e262e4c c000000f1e262e50 0000000000000000 c0000007e9183b10
      [  635.280149] NIP [c00000000052f568] __list_add+0x38/0x110
      [  635.280197] LR [c0000000009ea310] __mutex_lock_slowpath+0xe0/0x2c0
      [  635.280253] Call Trace:
      [  635.280277] [c0000007e9183af0] [c0000000009ea310] __mutex_lock_slowpath+0xe0/0x2c0
      [  635.280356] [c0000007e9183b70] [c0000000009ea554] mutex_lock+0x64/0x70
      [  635.280426] [c0000007e9183ba0] [d00000000d24da04]
      resize_hpt_prepare_work+0xe4/0x1c0 [kvm_hv]
      [  635.280507] [c0000007e9183c40] [c000000000113c0c] process_one_work+0x1dc/0x680
      [  635.280587] [c0000007e9183ce0] [c000000000114250] worker_thread+0x1a0/0x520
      [  635.280655] [c0000007e9183d80] [c00000000012010c] kthread+0xec/0x100
      [  635.280724] [c0000007e9183e30] [c00000000000a4b8] ret_from_kernel_thread+0x5c/0xa4
      [  635.280814] Instruction dump:
      [  635.280880] 7c0802a6 fba1ffe8 fbc1fff0 7cbd2b78 fbe1fff8 7c9e2378 7c7f1b78
      f8010010
      [  635.281099] f821ff81 e8a50008 7fa52040 40de00b8 <e8be0000> 7fbd2840 40de008c
      7fbff040
      [  635.281324] ---[ end trace b628b73449719b9d ]---
      
      Cc: stable@vger.kernel.org # v4.10+
      Fixes: b5baa687 ("KVM: PPC: Book3S HV: KVM-HV HPT resizing implementation")
      Signed-off-by: default avatarSerhii Popovych <spopovyc@redhat.com>
      [dwg: Replaced BUG_ON()s with WARN_ONs() and reworded commit message
       for clarity]
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      4ed11aee
    • Serhii Popovych's avatar
      KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt · 3073774e
      Serhii Popovych authored
      Currently the kvm_resize_hpt structure has two fields relevant to the
      state of an ongoing resize: 'prepare_done', which indicates whether
      the worker thread has completed or not, and 'error' which indicates
      whether it was successful or not.
      
      Since the success/failure isn't known until completion, this is
      confusingly redundant.  This patch consolidates the information into
      just the 'error' value: -EBUSY indicates the worked is still in
      progress, other negative values indicate (completed) failure, 0
      indicates successful completion.
      
      As a bonus this reduces size of struct kvm_resize_hpt by
      __alignof__(struct kvm_hpt_info) and saves few bytes of code.
      
      While there correct comment in struct kvm_resize_hpt which references
      a non-existent semaphore (leftover from an early draft).
      
      Assert with WARN_ON() in case of HPT allocation thread work runs more
      than once for resize request or resize_hpt_allocate() returns -EBUSY
      that is treated specially.
      
      Change comparison against zero to make checkpatch.pl happy.
      
      Cc: stable@vger.kernel.org # v4.10+
      Signed-off-by: default avatarSerhii Popovych <spopovyc@redhat.com>
      [dwg: Changed BUG_ON()s to WARN_ON()s and altered commit message for
       clarity]
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      3073774e
  3. 27 Nov, 2017 7 commits
    • Paolo Bonzini's avatar
      Merge tag 'kvm-ppc-fixes-4.15-1' of... · a63dd748
      Paolo Bonzini authored
      Merge tag 'kvm-ppc-fixes-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into kvm-master
      
      PPC KVM fixes for 4.15
      
      One commit here, that fixes a couple of bugs relating to the patch
      series that enables HPT guests to run on a radix host on POWER9
      systems.  This patch series went upstream in the 4.15 merge window,
      so no stable backport is required.
      a63dd748
    • Jan H. Schönherr's avatar
      KVM: Let KVM_SET_SIGNAL_MASK work as advertised · 20b7035c
      Jan H. Schönherr authored
      KVM API says for the signal mask you set via KVM_SET_SIGNAL_MASK, that
      "any unblocked signal received [...] will cause KVM_RUN to return with
      -EINTR" and that "the signal will only be delivered if not blocked by
      the original signal mask".
      
      This, however, is only true, when the calling task has a signal handler
      registered for a signal. If not, signal evaluation is short-circuited for
      SIG_IGN and SIG_DFL, and the signal is either ignored without KVM_RUN
      returning or the whole process is terminated.
      
      Make KVM_SET_SIGNAL_MASK behave as advertised by utilizing logic similar
      to that in do_sigtimedwait() to avoid short-circuiting of signals.
      Signed-off-by: default avatarJan H. Schönherr <jschoenh@amazon.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      20b7035c
    • Wanpeng Li's avatar
      KVM: VMX: Fix vmx->nested freeing when no SMI handler · b7455825
      Wanpeng Li authored
      Reported by syzkaller:
      
         ------------[ cut here ]------------
         WARNING: CPU: 5 PID: 2939 at arch/x86/kvm/vmx.c:3844 free_loaded_vmcs+0x77/0x80 [kvm_intel]
         CPU: 5 PID: 2939 Comm: repro Not tainted 4.14.0+ #26
         RIP: 0010:free_loaded_vmcs+0x77/0x80 [kvm_intel]
         Call Trace:
          vmx_free_vcpu+0xda/0x130 [kvm_intel]
          kvm_arch_destroy_vm+0x192/0x290 [kvm]
          kvm_put_kvm+0x262/0x560 [kvm]
          kvm_vm_release+0x2c/0x30 [kvm]
          __fput+0x190/0x370
          task_work_run+0xa1/0xd0
          do_exit+0x4d2/0x13e0
          do_group_exit+0x89/0x140
          get_signal+0x318/0xb80
          do_signal+0x8c/0xb40
          exit_to_usermode_loop+0xe4/0x140
          syscall_return_slowpath+0x206/0x230
          entry_SYSCALL_64_fastpath+0x98/0x9a
      
      The syzkaller testcase will execute VMXON/VMLAUCH instructions, so the
      vmx->nested stuff is populated, it will also issue KVM_SMI ioctl. However,
      the testcase is just a simple c program and not be lauched by something
      like seabios which implements smi_handler. Commit 05cade71 (KVM: nSVM:
      fix SMI injection in guest mode) gets out of guest mode and set nested.vmxon
      to false for the duration of SMM according to SDM 34.14.1 "leave VMX
      operation" upon entering SMM. We can't alloc/free the vmx->nested stuff
      each time when entering/exiting SMM since it will induce more overhead. So
      the function vmx_pre_enter_smm() marks nested.vmxon false even if vmx->nested
      stuff is still populated. What it expected is em_rsm() can mark nested.vmxon
      to be true again. However, the smi_handler/rsm will not execute since there
      is no something like seabios in this scenario. The function free_nested()
      fails to free the vmx->nested stuff since the vmx->nested.vmxon is false
      which results in the above warning.
      
      This patch fixes it by also considering the no SMI handler case, luckily
      vmx->nested.smm.vmxon is marked according to the value of vmx->nested.vmxon
      in vmx_pre_enter_smm(), we can take advantage of it and free vmx->nested
      stuff when L1 goes down.
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarLiran Alon <liran.alon@oracle.com>
      Fixes: 05cade71 (KVM: nSVM: fix SMI injection in guest mode)
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b7455825
    • Wanpeng Li's avatar
      KVM: VMX: Fix rflags cache during vCPU reset · c37c2873
      Wanpeng Li authored
      Reported by syzkaller:
      
         *** Guest State ***
         CR0: actual=0x0000000080010031, shadow=0x0000000060000010, gh_mask=fffffffffffffff7
         CR4: actual=0x0000000000002061, shadow=0x0000000000000000, gh_mask=ffffffffffffe8f1
         CR3 = 0x000000002081e000
         RSP = 0x000000000000fffa  RIP = 0x0000000000000000
         RFLAGS=0x00023000         DR7 = 0x00000000000000
                ^^^^^^^^^^
         ------------[ cut here ]------------
         WARNING: CPU: 6 PID: 24431 at /home/kernel/linux/arch/x86/kvm//x86.c:7302 kvm_arch_vcpu_ioctl_run+0x651/0x2ea0 [kvm]
         CPU: 6 PID: 24431 Comm: reprotest Tainted: G        W  OE   4.14.0+ #26
         RIP: 0010:kvm_arch_vcpu_ioctl_run+0x651/0x2ea0 [kvm]
         RSP: 0018:ffff880291d179e0 EFLAGS: 00010202
         Call Trace:
          kvm_vcpu_ioctl+0x479/0x880 [kvm]
          do_vfs_ioctl+0x142/0x9a0
          SyS_ioctl+0x74/0x80
          entry_SYSCALL_64_fastpath+0x23/0x9a
      
      The failed vmentry is triggered by the following beautified testcase:
      
          #include <unistd.h>
          #include <sys/syscall.h>
          #include <string.h>
          #include <stdint.h>
          #include <linux/kvm.h>
          #include <fcntl.h>
          #include <sys/ioctl.h>
      
          long r[5];
          int main()
          {
              struct kvm_debugregs dr = { 0 };
      
              r[2] = open("/dev/kvm", O_RDONLY);
              r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
              r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
              struct kvm_guest_debug debug = {
                      .control = 0xf0403,
                      .arch = {
                              .debugreg[6] = 0x2,
                              .debugreg[7] = 0x2
                      }
              };
              ioctl(r[4], KVM_SET_GUEST_DEBUG, &debug);
              ioctl(r[4], KVM_RUN, 0);
          }
      
      which testcase tries to setup the processor specific debug
      registers and configure vCPU for handling guest debug events through
      KVM_SET_GUEST_DEBUG.  The KVM_SET_GUEST_DEBUG ioctl will get and set
      rflags in order to set TF bit if single step is needed. All regs' caches
      are reset to avail and GUEST_RFLAGS vmcs field is reset to 0x2 during vCPU
      reset. However, the cache of rflags is not reset during vCPU reset. The
      function vmx_get_rflags() returns an unreset rflags cache value since
      the cache is marked avail, it is 0 after boot. Vmentry fails if the
      rflags reserved bit 1 is 0.
      
      This patch fixes it by resetting both the GUEST_RFLAGS vmcs field and
      its cache to 0x2 during vCPU reset.
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c37c2873
    • Wanpeng Li's avatar
      KVM: X86: Fix softlockup when get the current kvmclock · e70b57a6
      Wanpeng Li authored
       watchdog: BUG: soft lockup - CPU#6 stuck for 22s! [qemu-system-x86:10185]
       CPU: 6 PID: 10185 Comm: qemu-system-x86 Tainted: G           OE   4.14.0-rc4+ #4
       RIP: 0010:kvm_get_time_scale+0x4e/0xa0 [kvm]
       Call Trace:
        get_time_ref_counter+0x5a/0x80 [kvm]
        kvm_hv_process_stimers+0x120/0x5f0 [kvm]
        kvm_arch_vcpu_ioctl_run+0x4b4/0x1690 [kvm]
        kvm_vcpu_ioctl+0x33a/0x620 [kvm]
        do_vfs_ioctl+0xa1/0x5d0
        SyS_ioctl+0x79/0x90
        entry_SYSCALL_64_fastpath+0x1e/0xa9
      
      This can be reproduced when running kvm-unit-tests/hyperv_stimer.flat and
      cpu-hotplug stress simultaneously. __this_cpu_read(cpu_tsc_khz) returns 0
      (set in kvmclock_cpu_down_prep()) when the pCPU is unhotplug which results
      in kvm_get_time_scale() gets into an infinite loop.
      
      This patch fixes it by treating the unhotplug pCPU as not using master clock.
      Reviewed-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e70b57a6
    • Dr. David Alan Gilbert's avatar
      KVM: lapic: Fixup LDR on load in x2apic · 12806ba9
      Dr. David Alan Gilbert authored
      In x2apic mode the LDR is fixed based on the ID rather
      than separately loadable like it was before x2.
      When kvm_apic_set_state is called, the base is set, and if
      it has the X2APIC_ENABLE flag set then the LDR is calculated;
      however that value gets overwritten by the memcpy a few lines
      below overwriting it with the value that came from userland.
      
      The symptom is a lack of EOI after loading the state
      (e.g. after a QEMU migration) and is due to the EOI bitmap
      being wrong due to the incorrect LDR.  This was seen with
      a Win2016 guest under Qemu with irqchip=split whose USB mouse
      didn't work after a VM migration.
      
      This corresponds to RH bug:
        https://bugzilla.redhat.com/show_bug.cgi?id=1502591Reported-by: default avatarYiqian Wei <yiwei@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: stable@vger.kernel.org
      [Applied fixup from Liran Alon. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      12806ba9
    • Dr. David Alan Gilbert's avatar
      KVM: lapic: Split out x2apic ldr calculation · e872fa94
      Dr. David Alan Gilbert authored
      Split out the ldr calculation from kvm_apic_set_x2apic_id
      since we're about to reuse it in the following patch.
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e872fa94
  4. 23 Nov, 2017 1 commit
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Fix migration and HPT resizing of HPT guests on radix hosts · ded13fc1
      Paul Mackerras authored
      This fixes two errors that prevent a guest using the HPT MMU from
      successfully migrating to a POWER9 host in radix MMU mode, or resizing
      its HPT when running on a radix host.
      
      The first bug was that commit 8dc6cca5 ("KVM: PPC: Book3S HV:
      Don't rely on host's page size information", 2017-09-11) missed two
      uses of hpte_base_page_size(), one in the HPT rehashing code and
      one in kvm_htab_write() (which is used on the destination side in
      migrating a HPT guest).  Instead we use kvmppc_hpte_base_page_shift().
      Having the shift count means that we can use left and right shifts
      instead of multiplication and division in a few places.
      
      Along the way, this adds a check in kvm_htab_write() to ensure that the
      page size encoding in the incoming HPTEs is recognized, and if not
      return an EINVAL error to userspace.
      
      The second bug was that kvm_htab_write was performing some but not all
      of the functions of kvmhv_setup_mmu(), resulting in the destination VM
      being left in radix mode as far as the hardware is concerned.  The
      simplest fix for now is make kvm_htab_write() call
      kvmppc_setup_partition_table() like kvmppc_hv_setup_htab_rma() does.
      In future it would be better to refactor the code more extensively
      to remove the duplication.
      
      Fixes: 8dc6cca5 ("KVM: PPC: Book3S HV: Don't rely on host's page size information")
      Fixes: 7a84084c ("KVM: PPC: Book3S HV: Set partition table rather than SDR1 on POWER9")
      Reported-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Tested-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      ded13fc1
  5. 17 Nov, 2017 24 commits
  6. 16 Nov, 2017 4 commits
    • Linus Torvalds's avatar
      Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 527d1470
      Linus Torvalds authored
      Pull ARM device-tree updates from Arnd Bergmann:
       "We add device tree files for a couple of additional SoCs in various
        areas:
      
        Allwinner R40/V40 for entertainment, Broadcom Hurricane 2 for
        networking, Amlogic A113D for audio, and Renesas R-Car V3M for
        automotive.
      
        As usual, lots of new boards get added based on those and other SoCs:
      
         - Actions S500 based CubieBoard6 single-board computer
      
         - Amlogic Meson-AXG A113D based development board
         - Amlogic S912 based Khadas VIM2 single-board computer
         - Amlogic S912 based Tronsmart Vega S96 set-top-box
      
         - Allwinner H5 based NanoPi NEO Plus2 single-board computer
         - Allwinner R40 based Banana Pi M2 Ultra and Berry single-board computers
         - Allwinner A83T based TBS A711 Tablet
      
         - Broadcom Hurricane 2 based Ubiquiti UniFi Switch 8
         - Broadcom bcm47xx based Luxul XAP-1440/XAP-810/ABR-4500/XBR-4500
           wireless access points and routers
      
         - NXP i.MX51 based Zodiac Inflight Innovations RDU1 board
         - NXP i.MX53 based GE Healthcare PPD biometric monitor
         - NXP i.MX6 based Pistachio single-board computer
         - NXP i.MX6 based Vining-2000 automotive diagnostic interface
         - NXP i.MX6 based Ka-Ro TX6 Computer-on-Module in additional variants
      
         - Qualcomm MSM8974 (Snapdragon 800) based Fairphone 2 phone
         - Qualcomm MSM8974pro (Snapdragon 801) based Sony Xperia Z2 Tablet
      
         - Realtek RTD1295 based set-top-boxes MeLE V9 and PROBOX2 AVA
      
         - Renesas R-Car V3M (R8A77970) SoC and "Eagle" reference board
         - Renesas H3ULCB and M3ULCB "Kingfisher" extension infotainment boards
         - Renasas r8a7745 based iWave G22D-SODIMM SoM
      
         - Rockchip rk3288 based Amarula Vyasa single-board computer
      
         - Samsung Exynos5800 based Odroid HC1 single-board computer
      
        For existing SoC support, there was a lot of ongoing work, as usual
        most of that concentrated on the Renesas, Rockchip, OMAP, i.MX,
        Amlogic and Allwinner platforms, but others were also active.
      
        Rob Herring and many others worked on reducing the number of issues
        that the latest version of 'dtc' now warns about. Unfortunately there
        is still a lot left to do.
      
        A rework of the ARM foundation model introduced several new files for
        common variations of the model"
      
      * tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (599 commits)
        arm64: dts: uniphier: route on-board device IRQ to GPIO controller for PXs3
        dt-bindings: bus: Add documentation for the Technologic Systems NBUS
        arm64: dts: actions: s900-bubblegum-96: Add fake uart5 clock
        ARM: dts: owl-s500: Add CubieBoard6
        dt-bindings: arm: actions: Add CubieBoard6
        ARM: dts: owl-s500-guitar-bb-rev-b: Add fake uart3 clock
        ARM: dts: owl-s500: Set power domains for CPU2 and CPU3
        arm: dts: mt7623: remove unused compatible string for pio node
        arm: dts: mt7623: update usb related nodes
        arm: dts: mt7623: update crypto node
        ARM: dts: sun8i: a711: Enable USB OTG
        ARM: dts: sun8i: a711: Add regulator support
        ARM: dts: sun8i: a83t: bananapi-m3: Enable AP6212 WiFi on mmc1
        ARM: dts: sun8i: a83t: cubietruck-plus: Enable AP6330 WiFi on mmc1
        ARM: dts: sun8i: a83t: Move mmc1 pinctrl setting to dtsi file
        ARM: dts: sun8i: a83t: allwinner-h8homlet-v2: Add AXP818 regulator nodes
        ARM: dts: sun8i: a83t: bananapi-m3: Add AXP813 regulator nodes
        ARM: dts: sun8i: a83t: cubietruck-plus: Add AXP818 regulator nodes
        ARM: dts: sunxi: Add dtsi for AXP81x PMIC
        arm64: dts: allwinner: H5: Restore EMAC changes
        ...
      527d1470
    • Linus Torvalds's avatar
      Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 8c609698
      Linus Torvalds authored
      Pull ARM SoC platform updates from Arnd Bergmann:
       "Most of the commits are for defconfig changes, to enable newly added
        drivers or features that people have started using. For the changed
        lines lines, we have mostly cleanups, the affected platforms are OMAP,
        Versatile, EP93xx, Samsung, Broadcom, i.MX, and Actions.
      
        The largest single change is the introduction of the TI "sysc" bus
        driver, with the intention of cleaning up more legacy code.
      
        Two new SoC platforms get added this time:
      
         - Allwinner R40 is a modernized version of the A20 chip, now with a
           Quad-Core ARM Cortex-A7. According to the manufacturer, it is
           intended for "Smart Hardware"
      
         - Broadcom Hurricane 2 (Aka Strataconnect BCM5334X) is a family of
           chips meant for managed gigabit ethernet switches, based around a
           Cortex-A9 CPU.
      
        Finally, we gain SMP support for two platforms: Renesas R-Car E2 and
        Amlogic Meson8/8b, which were previously added but only supported
        uniprocessor operation"
      
      * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (118 commits)
        ARM: multi_v7_defconfig: Select RPMSG_VIRTIO as module
        ARM: multi_v7_defconfig: enable CONFIG_GPIO_UNIPHIER
        arm64: defconfig: enable CONFIG_GPIO_UNIPHIER
        ARM: meson: enable MESON_IRQ_GPIO in Kconfig for meson8b
        ARM: meson: Add SMP bringup code for Meson8 and Meson8b
        ARM: smp_scu: allow the platform code to read the SCU CPU status
        ARM: smp_scu: add a helper for powering on a specific CPU
        dt-bindings: Amlogic: Add Meson8 and Meson8b SMP related documentation
        ARM: OMAP3: Delete an unnecessary variable initialisation in omap3xxx_hwmod_init()
        ARM: OMAP3: Use common error handling code in omap3xxx_hwmod_init()
        ARM: defconfig: select the right SX150X driver
        arm64: defconfig: Enable QCOM_IOMMU
        arm64: Add ThunderX drivers to defconfig
        arm64: defconfig: Enable Tegra PCI controller
        cpufreq: imx6q: Move speed grading check to cpufreq driver
        arm64: defconfig: re-enable Qualcomm DB410c USB
        ARM: configs: stm32: Add MDMA support in STM32 defconfig
        ARM: imx: Enable cpuidle for i.MX6DL starting at 1.1
        bus: ti-sysc: Fix unbalanced pm_runtime_enable by adding remove
        bus: ti-sysc: mark PM functions as __maybe_unused
        ...
      8c609698
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 18c83d2c
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
       "Fixes in qemu, vhost and virtio"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        fw_cfg: fix the command line module name
        vhost/vsock: fix uninitialized vhost_vsock->guest_cid
        vhost: fix end of range for access_ok
        vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
        virtio_balloon: fix deadlock on OOM
      18c83d2c
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.15-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 051089a2
      Linus Torvalds authored
      Pull xen updates from Juergen Gross:
       "Xen features and fixes for v4.15-rc1
      
        Apart from several small fixes it contains the following features:
      
         - a series by Joao Martins to add vdso support of the pv clock
           interface
      
         - a series by Juergen Gross to add support for Xen pv guests to be
           able to run on 5 level paging hosts
      
         - a series by Stefano Stabellini adding the Xen pvcalls frontend
           driver using a paravirtualized socket interface"
      
      * tag 'for-linus-4.15-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (34 commits)
        xen/pvcalls: fix potential endless loop in pvcalls-front.c
        xen/pvcalls: Add MODULE_LICENSE()
        MAINTAINERS: xen, kvm: track pvclock-abi.h changes
        x86/xen/time: setup vcpu 0 time info page
        x86/xen/time: set pvclock flags on xen_time_init()
        x86/pvclock: add setter for pvclock_pvti_cpu0_va
        ptp_kvm: probe for kvm guest availability
        xen/privcmd: remove unused variable pageidx
        xen: select grant interface version
        xen: update arch/x86/include/asm/xen/cpuid.h
        xen: add grant interface version dependent constants to gnttab_ops
        xen: limit grant v2 interface to the v1 functionality
        xen: re-introduce support for grant v2 interface
        xen: support priv-mapping in an HVM tools domain
        xen/pvcalls: remove redundant check for irq >= 0
        xen/pvcalls: fix unsigned less than zero error check
        xen/time: Return -ENODEV from xen_get_wallclock()
        xen/pvcalls-front: mark expected switch fall-through
        xen: xenbus_probe_frontend: mark expected switch fall-throughs
        xen/time: do not decrease steal time after live migration on xen
        ...
      051089a2