1. 24 Nov, 2016 1 commit
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Fix compilation with unusual configurations · e2702871
      Paul Mackerras authored
      This adds the "again" parameter to the dummy version of
      kvmppc_check_passthru(), so that it matches the real version.
      This fixes compilation with CONFIG_BOOK3S_64_HV set but
      CONFIG_KVM_XICS=n.
      
      This includes asm/smp.h in book3s_hv_builtin.c to fix compilation
      with CONFIG_SMP=n.  The explicit inclusion is necessary to provide
      definitions of hard_smp_processor_id() and get_hard_smp_processor_id()
      in UP configs.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      e2702871
  2. 23 Nov, 2016 13 commits
    • Suraj Jitindar Singh's avatar
      KVM: PPC: Book3S HV: Update kvmppc_set_arch_compat() for ISA v3.00 · 2ee13be3
      Suraj Jitindar Singh authored
      The function kvmppc_set_arch_compat() is used to determine the value of the
      processor compatibility register (PCR) for a guest running in a given
      compatibility mode. There is currently no support for v3.00 of the ISA.
      
      Add support for v3.00 of the ISA which adds an ISA v2.07 compatilibity mode
      to the PCR.
      
      We also add a check to ensure the processor we are running on is capable of
      emulating the chosen processor (for example a POWER7 cannot emulate a
      POWER8, similarly with a POWER8 and a POWER9).
      
      Based on work by: Paul Mackerras <paulus@ozlabs.org>
      
      [paulus@ozlabs.org - moved dummy PCR_ARCH_300 definition here; set
       guest_pcr_bit when arch_compat == 0, added comment.]
      Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      2ee13be3
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Treat POWER9 CPU threads as independent subcores · 45c940ba
      Paul Mackerras authored
      With POWER9, each CPU thread has its own MMU context and can be
      in the host or a guest independently of the other threads; there is
      still however a restriction that all threads must use the same type
      of address translation, either radix tree or hashed page table (HPT).
      
      Since we only support HPT guests on a HPT host at this point, we
      can treat the threads as being independent, and avoid all of the
      work of coordinating the CPU threads.  To make this simpler, we
      introduce a new threads_per_vcore() function that returns 1 on
      POWER9 and threads_per_subcore on POWER7/8, and use that instead
      of threads_per_subcore or threads_per_core in various places.
      
      This also changes the value of the KVM_CAP_PPC_SMT capability on
      POWER9 systems from 4 to 1, so that userspace will not try to
      create VMs with multiple vcpus per vcore.  (If userspace did create
      a VM that thought it was in an SMT mode, the VM might try to use
      the msgsndp instruction, which will not work as expected.  In
      future it may be possible to trap and emulate msgsndp in order to
      allow VMs to think they are in an SMT mode, if only for the purpose
      of allowing migration from POWER8 systems.)
      
      With all this, we can now run guests on POWER9 as long as the host
      is running with HPT translation.  Since userspace currently has no
      way to request radix tree translation for the guest, the guest has
      no choice but to use HPT translation.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      45c940ba
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Enable hypervisor virtualization interrupts while in guest · 84f7139c
      Paul Mackerras authored
      The new XIVE interrupt controller on POWER9 can direct external
      interrupts to the hypervisor or the guest.  The interrupts directed to
      the hypervisor are controlled by an LPCR bit called LPCR_HVICE, and
      come in as a "hypervisor virtualization interrupt".  This sets the
      LPCR bit so that hypervisor virtualization interrupts can occur while
      we are in the guest.  We then also need to cope with exiting the guest
      because of a hypervisor virtualization interrupt.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      84f7139c
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Use stop instruction rather than nap on POWER9 · bf53c88e
      Paul Mackerras authored
      POWER9 replaces the various power-saving mode instructions on POWER8
      (doze, nap, sleep and rvwinkle) with a single "stop" instruction, plus
      a register, PSSCR, which controls the depth of the power-saving mode.
      This replaces the use of the nap instruction when threads are idle
      during guest execution with the stop instruction, and adds code to
      set PSSCR to a value which will allow an SMT mode switch while the
      thread is idle (given that the core as a whole won't be idle in these
      cases).
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      bf53c88e
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Use OPAL XICS emulation on POWER9 · f725758b
      Paul Mackerras authored
      POWER9 includes a new interrupt controller, called XIVE, which is
      quite different from the XICS interrupt controller on POWER7 and
      POWER8 machines.  KVM-HV accesses the XICS directly in several places
      in order to send and clear IPIs and handle interrupts from PCI
      devices being passed through to the guest.
      
      In order to make the transition to XIVE easier, OPAL firmware will
      include an emulation of XICS on top of XIVE.  Access to the emulated
      XICS is via OPAL calls.  The one complication is that the EOI
      (end-of-interrupt) function can now return a value indicating that
      another interrupt is pending; in this case, the XIVE will not signal
      an interrupt in hardware to the CPU, and software is supposed to
      acknowledge the new interrupt without waiting for another interrupt
      to be delivered in hardware.
      
      This adapts KVM-HV to use the OPAL calls on machines where there is
      no XICS hardware.  When there is no XICS, we look for a device-tree
      node with "ibm,opal-intc" in its compatible property, which is how
      OPAL indicates that it provides XICS emulation.
      
      In order to handle the EOI return value, kvmppc_read_intr() has
      become kvmppc_read_one_intr(), with a boolean variable passed by
      reference which can be set by the EOI functions to indicate that
      another interrupt is pending.  The new kvmppc_read_intr() keeps
      calling kvmppc_read_one_intr() until there are no more interrupts
      to process.  The return value from kvmppc_read_intr() is the
      largest non-zero value of the returns from kvmppc_read_one_intr().
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      f725758b
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Use msgsnd for IPIs to other cores on POWER9 · 1704a81c
      Paul Mackerras authored
      On POWER9, the msgsnd instruction is able to send interrupts to
      other cores, as well as other threads on the local core.  Since
      msgsnd is generally simpler and faster than sending an IPI via the
      XICS, we use msgsnd for all IPIs sent by KVM on POWER9.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      1704a81c
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Adapt TLB invalidations to work on POWER9 · 7c5b06ca
      Paul Mackerras authored
      POWER9 adds new capabilities to the tlbie (TLB invalidate entry)
      and tlbiel (local tlbie) instructions.  Both instructions get a
      set of new parameters (RIC, PRS and R) which appear as bits in the
      instruction word.  The tlbiel instruction now has a second register
      operand, which contains a PID and/or LPID value if needed, and
      should otherwise contain 0.
      
      This adapts KVM-HV's usage of tlbie and tlbiel to work on POWER9
      as well as older processors.  Since we only handle HPT guests so
      far, we need RIC=0 PRS=0 R=0, which ends up with the same instruction
      word as on previous processors, so we don't need to conditionally
      execute different instructions depending on the processor.
      
      The local flush on first entry to a guest in book3s_hv_rmhandlers.S
      is a loop which depends on the number of TLB sets.  Rather than
      using feature sections to set the number of iterations based on
      which CPU we're on, we now work out this number at VM creation time
      and store it in the kvm_arch struct.  That will make it possible to
      get the number from the device tree in future, which will help with
      compatibility with future processors.
      
      Since mmu_partition_table_set_entry() does a global flush of the
      whole LPID, we don't need to do the TLB flush on first entry to the
      guest on each processor.  Therefore we don't set all bits in the
      tlb_need_flush bitmap on VM startup on POWER9.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      7c5b06ca
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Add new POWER9 guest-accessible SPRs · e9cf1e08
      Paul Mackerras authored
      This adds code to handle two new guest-accessible special-purpose
      registers on POWER9: TIDR (thread ID register) and PSSCR (processor
      stop status and control register).  They are context-switched
      between host and guest, and the guest values can be read and set
      via the one_reg interface.
      
      The PSSCR contains some fields which are guest-accessible and some
      which are only accessible in hypervisor mode.  We only allow the
      guest-accessible fields to be read or set by userspace.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      e9cf1e08
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Adjust host/guest context switch for POWER9 · 83677f55
      Paul Mackerras authored
      Some special-purpose registers that were present and accessible
      by guests on POWER8 no longer exist on POWER9, so this adds
      feature sections to ensure that we don't try to context-switch
      them when going into or out of a guest on POWER9.  These are
      all relatively obscure, rarely-used registers, but we had to
      context-switch them on POWER8 to avoid creating a covert channel.
      They are: SPMC1, SPMC2, MMCRS, CSIGR, TACR, TCSCR, and ACOP.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      83677f55
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Set partition table rather than SDR1 on POWER9 · 7a84084c
      Paul Mackerras authored
      On POWER9, the SDR1 register (hashed page table base address) is no
      longer used, and instead the hardware reads the HPT base address
      and size from the partition table.  The partition table entry also
      contains the bits that specify the page size for the VRMA mapping,
      which were previously in the LPCR.  The VPM0 bit of the LPCR is
      now reserved; the processor now always uses the VRMA (virtual
      real-mode area) mechanism for guest real-mode accesses in HPT mode,
      and the RMO (real-mode offset) mechanism has been dropped.
      
      When entering or exiting the guest, we now only have to set the
      LPIDR (logical partition ID register), not the SDR1 register.
      There is also no requirement now to transition via a reserved
      LPID value.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      7a84084c
    • Paul Mackerras's avatar
      KVM: PPC: Book3S HV: Adapt to new HPTE format on POWER9 · abb7c7dd
      Paul Mackerras authored
      This adapts the KVM-HV hashed page table (HPT) code to read and write
      HPT entries in the new format defined in Power ISA v3.00 on POWER9
      machines.  The new format moves the B (segment size) field from the
      first doubleword to the second, and trims some bits from the AVA
      (abbreviated virtual address) and ARPN (abbreviated real page number)
      fields.  As far as possible, the conversion is done when reading or
      writing the HPT entries, and the rest of the code continues to use
      the old format.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      abb7c7dd
    • Paul Mackerras's avatar
      Merge remote-tracking branch 'remotes/powerpc/topic/ppc-kvm' into kvm-ppc-next · bc33b1fc
      Paul Mackerras authored
      This merges in the ppc-kvm topic branch to get changes to
      arch/powerpc code that are necessary for adding POWER9 KVM support.
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      bc33b1fc
    • Michael Neuling's avatar
      powerpc/powernv: Define and set POWER9 HFSCR doorbell bit · 02ed21ae
      Michael Neuling authored
      Define and set the POWER9 HFSCR doorbell bit so that guests can use
      msgsndp.
      
      ISA 3.0 calls this MSGP, so name it accordingly in the code.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      02ed21ae
  3. 22 Nov, 2016 4 commits
  4. 21 Nov, 2016 9 commits
  5. 16 Nov, 2016 4 commits
  6. 13 Nov, 2016 9 commits
    • Linus Torvalds's avatar
      Linux 4.9-rc5 · a25f0944
      Linus Torvalds authored
      a25f0944
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · e234832a
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "ARM fixes.  There are a couple pending x86 patches but they'll have to
        wait for next week"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
        KVM: arm/arm64: vgic: Prevent access to invalid SPIs
        arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU
      e234832a
    • Linus Torvalds's avatar
      Merge branch 'media-fixes' (patches from Mauro) · e861d890
      Linus Torvalds authored
      Merge media fixes from Mauro Carvalho Chehab:
       "This contains two patches fixing problems with my patch series meant
        to make USB drivers to work again after the DMA on stack changes.
      
        The last patch on this series is actually not related to DMA on stack.
        It solves a longstanding bug affecting module unload, causing
        module_put() to be called twice. It was reported by the user who
        reported and tested the issues with the gp8psk driver with the DMA
        fixup patches. As we're late at -rc cycle, maybe you prefer to not
        apply it right now. If this is the case, I'll add to the pile of
        patches for 4.10.
      
        Exceptionally this time, I'm sending the patches via e-mail, because
        I'm on another trip, and won't be able to use the usual procedure
        until Monday. Also, it is only three patches, and you followed already
        the discussions about the first one"
      
      * emailed patches from Mauro Carvalho Chehab <mchehab@osg.samsung.com>:
        gp8psk: Fix DVB frontend attach
        gp8psk: fix gp8psk_usb_in_op() logic
        dvb-usb: move data_mutex to struct dvb_usb_device
      e861d890
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · acb57b75
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Here are three small driver fixes for some reported issues for
        4.9-rc5.
      
        One for the hyper-v subsystem, fixing up a naming issue that showed up
        in 4.9-rc1, one mei driver fix, and one fix for parallel ports,
        resolving a reported regression.
      
        All have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        ppdev: fix double-free of pp->pdev->name
        vmbus: make sysfs names consistent with PCI
        mei: bus: fix received data size check in NFC fixup
      acb57b75
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · cf2b191c
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are two driver core fixes for 4.9-rc5.
      
        The first resolves an issue with some drivers not liking to be unbound
        and bound again (if CONFIG_DEBUG_TEST_DRIVER_REMOVE is enabled), which
        solves some reported problems with graphics and storage drivers. The
        other resolves a smatch error with the 4.9-rc1 driver core changes
        around this feature.
      
        Both have been in linux-next with no reported issues"
      
      * tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        driver core: fix smatch warning on dev->bus check
        driver core: skip removal test for non-removable drivers
      cf2b191c
    • Linus Torvalds's avatar
      Merge tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 85b9df7a
      Linus Torvalds authored
      Pull staging/IIO fixes from Grek KH:
       "Here are a few small staging and iio driver fixes for reported issues.
      
        The last one was cherry-picked from my -next branch to resolve a build
        warning that Arnd fixed, in his quest to be able to turn
        -Wmaybe-uninitialized back on again. That patch, and all of the
        others, have been in linux-next for a while with no reported issues"
      
      * tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        iio: maxim_thermocouple: detect invalid storage size in read()
        staging: nvec: remove managed resource from PS2 driver
        Revert "staging: nvec: ps2: change serio type to passthrough"
        drivers: staging: nvec: remove bogus reset command for PS/2 interface
        staging: greybus: arche-platform: fix device reference leak
        staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
        staging: sm750fb: Fix bugs introduced by early commits
        iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
        iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver)
        iio: st_sensors: fix scale configuration for h3lis331dl
        staging: iio: ad5933: avoid uninitialized variable in error case
      85b9df7a
    • Linus Torvalds's avatar
      Merge tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · befdfffd
      Linus Torvalds authored
      Pull USB / PHY fixes from Greg KH:
       "Here are a number of small USB and PHY driver fixes for 4.9-rc5
      
        Nothing major, just small fixes for reported issues, all of these have
        been in linux-next for a while with no reported issues"
      
      * tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        USB: cdc-acm: fix TIOCMIWAIT
        cdc-acm: fix uninitialized variable
        drivers/usb: Skip auto handoff for TI and RENESAS usb controllers
        usb: musb: remove duplicated actions
        usb: musb: da8xx: Don't print phy error on -EPROBE_DEFER
        phy: sun4i: check PMU presence when poking unknown bit of pmu
        phy-rockchip-pcie: remove deassert of phy_rst from exit callback
        phy: da8xx-usb: rename the ohci device to ohci-da8xx
        phy: Add reset callback for not generic phy
        uwb: fix device reference leaks
        usb: gadget: u_ether: remove interrupt throttling
        usb: dwc3: st: add missing <linux/pinctrl/consumer.h> include
        usb: dwc3: Fix error handling for core init
      befdfffd
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 348ce85b
      Linus Torvalds authored
      Pull more block fixes from Jens Axboe:
       "Since I mistakenly left out the lightnvm regression fix yesterday and
        the aoeblk seems adequately tested at this point, might as well send
        out another pull to make -rc5"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        aoe: fix crash in page count manipulation
        lightnvm: invalid offset calculation for lba_shift
      348ce85b
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 980221d1
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "The megaraid_sas patch in here fixes a major regression in the last
        fix set that made all megaraid_sas cards unusable. It turns out no-one
        had actually tested such an "obvious" fix, sigh. The fix for the fix
        has been tested ...
      
        The next most serious is the vmw_pvscsi abort problem which basically
        means that aborts don't work on the vmware paravirt devices and error
        handling always escalates to reset.
      
        The rest are an assortment of missed reference counting in certain
        paths and corner case bugs that show up on some architectures"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
        scsi: qla2xxx: fix invalid DMA access after command aborts in PCI device remove
        scsi: qla2xxx: do not queue commands when unloading
        scsi: libcxgbi: fix incorrect DDP resource cleanup
        scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init
        scsi: scsi_dh_alua: Fix a reference counting bug
        scsi: vmw_pvscsi: return SUCCESS for successful command aborts
        scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk
        scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()
      980221d1