1. 30 3月, 2017 3 次提交
  2. 10 3月, 2017 1 次提交
  3. 09 3月, 2017 2 次提交
    • A
      powerpc/powernv/ioda2: Update iommu table base on ownership change · db08e1d5
      Alexey Kardashevskiy 提交于
      On POWERNV platform, in order to do DMA via IOMMU (i.e. 32bit DMA in
      our case), a device needs an iommu_table pointer set via
      set_iommu_table_base().
      
      The codeflow is:
      - pnv_pci_ioda2_setup_dma_pe()
      	- pnv_pci_ioda2_setup_default_config()
      	- pnv_ioda_setup_bus_dma() [1]
      
      pnv_pci_ioda2_setup_dma_pe() creates IOMMU groups,
      pnv_pci_ioda2_setup_default_config() does default DMA setup,
      pnv_ioda_setup_bus_dma() takes a bus PE (on IODA2, all physical function
      PEs as bus PEs except NPU), walks through all underlying buses and
      devices, adds all devices to an IOMMU group and sets iommu_table.
      
      On IODA2, when VFIO is used, it takes ownership over a PE which means it
      removes all tables and creates new ones (with a possibility of sharing
      them among PEs). So when the ownership is returned from VFIO to
      the kernel, the iommu_table pointer written to a device at [1] is
      stale and needs an update.
      
      This adds an "add_to_group" parameter to pnv_ioda_setup_bus_dma()
      (in fact re-adds as it used to be there a while ago for different
      reasons) to tell the helper if a device needs to be added to
      an IOMMU group with an iommu_table update or just the latter.
      
      This calls pnv_ioda_setup_bus_dma(..., false) from
      pnv_ioda2_release_ownership() so when the ownership is restored,
      32bit DMA can work again for a device. This does the same thing
      on obtaining ownership as the iommu_table point is stale at this point
      anyway and it is safer to have NULL there.
      
      We did not hit this earlier as all tested devices in recent years were
      only using 64bit DMA; the rare exception for this is MPT3 SAS adapter
      which uses both 32bit and 64bit DMA access and it has not been tested
      with VFIO much.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      db08e1d5
    • A
      powerpc/powernv/ioda2: Gracefully fail if too many TCE levels requested · 7aafac11
      Alexey Kardashevskiy 提交于
      The IODA2 specification says that a 64 DMA address cannot use top 4 bits
      (3 are reserved and one is a "TVE select"); bottom page_shift bits
      cannot be used for multilevel table addressing either.
      
      The existing IODA2 table allocation code aligns the minimum TCE table
      size to PAGE_SIZE so in the case of 64K system pages and 4K IOMMU pages,
      we have 64-4-12=48 bits. Since 64K page stores 8192 TCEs, i.e. needs
      13 bits, the maximum number of levels is 48/13 = 3 so we physically
      cannot address more and EEH happens on DMA accesses.
      
      This adds a check that too many levels were requested.
      
      It is still possible to have 5 levels in the case of 4K system page size.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7aafac11
  4. 04 3月, 2017 1 次提交
    • A
      powerpc/powernv: Fix opal tracepoints with JUMP_LABEL=n · 2a9c4f40
      Alexey Kardashevskiy 提交于
      The recent commit to allow calling OPAL calls in real mode, commit
      ab9bad0e ("powerpc/powernv: Remove separate entry for OPAL real mode
      calls"), introduced a bug when CONFIG_JUMP_LABEL=n.
      
      The commit moved the "mfmsr r12" prior to the call to OPAL_BRANCH, but
      we missed that OPAL_BRANCH clobbers r12 when jump labels are disabled.
      This leads to us using the tracepoint refcount as the MSR value,
      typically zero, and saving that into PACASAVEDMSR. When we return from
      OPAL we use that value as the MSR value for rfid, meaning we switch to
      32-bit BE real mode - hilarity ensues.
      
      Fix it by using r11 in OPAL_BRANCH, which is not live at the time the
      macro is used in OPAL_CALL.
      
      Fixes: ab9bad0e ("powerpc/powernv: Remove separate entry for OPAL real mode calls")
      Suggested-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2a9c4f40
  5. 02 3月, 2017 1 次提交
  6. 28 2月, 2017 1 次提交
  7. 20 2月, 2017 1 次提交
  8. 17 2月, 2017 1 次提交
  9. 10 2月, 2017 1 次提交
    • M
      powerpc/powernv: Fix opal_exit tracepoint opcode · a7e0fb6c
      Michael Ellerman 提交于
      Currently the opal_exit tracepoint usually shows the opcode as 0:
      
        <idle>-0     [047] d.h.   635.654292: opal_entry: opcode=63
        <idle>-0     [047] d.h.   635.654296: opal_exit: opcode=0 retval=0
        kopald-1209  [019] d...   636.420943: opal_entry: opcode=10
        kopald-1209  [019] d...   636.420959: opal_exit: opcode=0 retval=0
      
      This is because we incorrectly load the opcode into r0 before calling
      __trace_opal_exit(), whereas it expects the opcode in r3 (first function
      parameter). In fact we are leaving the retval in r3, so opcode and
      retval will always show the same value.
      
      Instead load the opcode into r3, resulting in:
      
        <idle>-0     [040] d.h.   636.618625: opal_entry: opcode=63
        <idle>-0     [040] d.h.   636.618627: opal_exit: opcode=63 retval=0
      
      Fixes: c49f6353 ("powernv: Add OPAL tracepoints")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a7e0fb6c
  10. 09 2月, 2017 4 次提交
  11. 07 2月, 2017 1 次提交
  12. 02 2月, 2017 1 次提交
  13. 31 1月, 2017 4 次提交
  14. 30 1月, 2017 2 次提交
  15. 25 1月, 2017 3 次提交
    • M
      powerpc/powernv/pci: Use kmalloc_array() in two functions · fb37e128
      Markus Elfring 提交于
      Use kmalloc_array(), which checks for overflow of the multiplication,
      rather than doing it by hand.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fb37e128
    • J
      powerpc/powernv: Report size of OPAL memcons log · 14a41d6b
      Joel Stanley 提交于
      The OPAL memory console is reported to be size zero, as we do not
      initialise the struct attr with any size information due to the size
      being variable. This leads users to think that the console is empty.
      
      Instead report the maximum size.
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      14a41d6b
    • B
      treewide: Constify most dma_map_ops structures · 5299709d
      Bart Van Assche 提交于
      Most dma_map_ops structures are never modified. Constify these
      structures such that these can be write-protected. This patch
      has been generated as follows:
      
      git grep -l 'struct dma_map_ops' |
        xargs -d\\n sed -i \
          -e 's/struct dma_map_ops/const struct dma_map_ops/g' \
          -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \
          -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \
          -e 's/const const struct dma_map_ops /const struct dma_map_ops /g';
      sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \
        $(git grep -l 'struct dma_map_ops intel_dma_ops');
      sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \
        $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc);
      sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \
             -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \
             -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \
          drivers/pci/host/*.c
      sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c
      sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c
      sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: x86@kernel.org
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      5299709d
  16. 25 12月, 2016 1 次提交
  17. 09 12月, 2016 1 次提交
    • S
      tracing: Have the reg function allow to fail · 8cf868af
      Steven Rostedt (Red Hat) 提交于
      Some tracepoints have a registration function that gets enabled when the
      tracepoint is enabled. There may be cases that the registraction function
      must fail (for example, can't allocate enough memory). In this case, the
      tracepoint should also fail to register, otherwise the user would not know
      why the tracepoint is not working.
      
      Cc: David Howells <dhowells@redhat.com>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8cf868af
  18. 30 11月, 2016 1 次提交
  19. 23 11月, 2016 1 次提交
  20. 22 11月, 2016 2 次提交
  21. 14 11月, 2016 1 次提交
  22. 04 10月, 2016 4 次提交
  23. 29 9月, 2016 2 次提交