1. 09 Oct, 2013 1 commit
  2. 10 Oct, 2013 1 commit
    • Stefano Stabellini's avatar
      xen/arm,arm64: enable SWIOTLB_XEN · 83862ccf
      Stefano Stabellini authored
      Xen on arm and arm64 needs SWIOTLB_XEN: when running on Xen we need to
      program the hardware with mfns rather than pfns for dma addresses.
      Remove SWIOTLB_XEN dependency on X86 and PCI and make XEN select
      SWIOTLB_XEN on arm and arm64.
      
      At the moment always rely on swiotlb-xen, but when Xen starts supporting
      hardware IOMMUs we'll be able to avoid it conditionally on the presence
      of an IOMMU on the platform.
      
      Implement xen_create_contiguous_region on arm and arm64: for the moment
      we assume that dom0 has been mapped 1:1 (physical addresses == machine
      addresses) therefore we don't need to call XENMEM_exchange. Simply
      return the physical address as dma address.
      
      Initialize the xen-swiotlb from xen_early_init (before the native
      dma_ops are initialized), set xen_dma_ops to &xen_swiotlb_dma_ops.
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      
      
      Changes in v8:
      - assume dom0 is mapped 1:1, no need to call XENMEM_exchange.
      
      Changes in v7:
      - call __set_phys_to_machine_multi from xen_create_contiguous_region and
      xen_destroy_contiguous_region to update the P2M;
      - don't call XENMEM_unpin, it has been removed;
      - call XENMEM_exchange instead of XENMEM_exchange_and_pin;
      - set nr_exchanged to 0 before calling the hypercall.
      
      Changes in v6:
      - introduce and export xen_dma_ops;
      - call xen_mm_init from as arch_initcall.
      
      Changes in v4:
      - remove redefinition of DMA_ERROR_CODE;
      - update the code to use XENMEM_exchange_and_pin and XENMEM_unpin;
      - add a note about hardware IOMMU in the commit message.
      
      Changes in v3:
      - code style changes;
      - warn on XENMEM_put_dma_buf failures.
      83862ccf
  3. 09 Oct, 2013 1 commit
  4. 09 Aug, 2013 1 commit
  5. 28 Jun, 2013 1 commit
    • Joe Perches's avatar
      xen: Convert printks to pr_<level> · 283c0972
      Joe Perches authored
      Convert printks to pr_<level> (excludes printk(KERN_DEBUG...)
      to be more consistent throughout the xen subsystem.
      
      Add pr_fmt with KBUILD_MODNAME or "xen:" KBUILD_MODNAME
      Coalesce formats and add missing word spaces
      Add missing newlines
      Align arguments and reflow to 80 columns
      Remove DRV_NAME from formats as pr_fmt adds the same content
      
      This does change some of the prefixes of these messages
      but it also does make them more consistent.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      283c0972
  6. 30 Jan, 2013 1 commit
    • Yinghai Lu's avatar
      x86: Don't panic if can not alloc buffer for swiotlb · ac2cbab2
      Yinghai Lu authored
      Normal boot path on system with iommu support:
      swiotlb buffer will be allocated early at first and then try to initialize
      iommu, if iommu for intel or AMD could setup properly, swiotlb buffer
      will be freed.
      
      The early allocating is with bootmem, and could panic when we try to use
      kdump with buffer above 4G only, or with memmap to limit mem under 4G.
      for example: memmap=4095M$1M to remove memory under 4G.
      
      According to Eric, add _nopanic version and no_iotlb_memory to fail
      map single later if swiotlb is still needed.
      
      -v2: don't pass nopanic, and use -ENOMEM return value according to Eric.
           panic early instead of using swiotlb_full to panic...according to Eric/Konrad.
      -v3: make swiotlb_init to be notpanic, but will affect:
           arm64, ia64, powerpc, tile, unicore32, x86.
      -v4: cleanup swiotlb_init by removing swiotlb_init_with_default_size.
      Suggested-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Link: http://lkml.kernel.org/r/1359058816-7615-36-git-send-email-yinghai@kernel.orgReviewed-and-tested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
      Cc: linux-mips@linux-mips.org
      Cc: xen-devel@lists.xensource.com
      Cc: virtualization@lists.linux-foundation.org
      Cc: Shuah Khan <shuahkhan@gmail.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      ac2cbab2
  7. 30 Oct, 2012 3 commits
    • Alexander Duyck's avatar
      swiotlb: Use physical addresses instead of virtual in swiotlb_tbl_sync_single · fbfda893
      Alexander Duyck authored
      This change makes it so that the sync functionality also uses physical
      addresses.  This helps to further reduce the use of virt_to_phys and
      phys_to_virt functions.
      
      In order to clarify things since we now have 2 physical addresses in use
      inside of swiotlb_tbl_sync_single I am renaming phys to orig_addr, and
      dma_addr to tlb_addr.  This way is should be clear that orig_addr is
      contained within io_orig_addr and tlb_addr is an address within the
      io_tlb_addr buffer.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      fbfda893
    • Alexander Duyck's avatar
      swiotlb: Use physical addresses for swiotlb_tbl_unmap_single · 61ca08c3
      Alexander Duyck authored
      This change makes it so that the unmap functionality also uses physical
      addresses.  This helps to further reduce the use of virt_to_phys and
      phys_to_virt functions.
      
      In order to clarify things since we now have 2 physical addresses in use
      inside of swiotlb_tbl_unmap_single I am renaming phys to orig_addr, and
      dma_addr to tlb_addr.  This way is should be clear that orig_addr is
      contained within io_orig_addr and tlb_addr is an address within the
      io_tlb_addr buffer.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      61ca08c3
    • Alexander Duyck's avatar
      swiotlb: Return physical addresses when calling swiotlb_tbl_map_single · e05ed4d1
      Alexander Duyck authored
      This change makes it so that swiotlb_tbl_map_single will return a physical
      address instead of a virtual address when called.  The advantage to this once
      again is that we are avoiding a number of virt_to_phys and phys_to_virt
      translations by working with everything as a physical address.
      
      One change I had to make in order to support using physical addresses is that
      I could no longer trust 0 to be a invalid physical address on all platforms.
      So instead I made it so that ~0 is returned on error.  This should never be a
      valid return value as it implies that only one byte would be available for
      use.
      
      In order to clarify things since we now have 2 physical addresses in use
      inside of swiotlb_tbl_map_single I am renaming phys to orig_addr, and
      dma_addr to tlb_addr.  This way is should be clear that orig_addr is
      contained within io_orig_addr and tlb_addr is an address within the
      io_tlb_addr buffer.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      e05ed4d1
  8. 17 Sep, 2012 5 commits
  9. 05 Sep, 2012 1 commit
  10. 23 Aug, 2012 1 commit
  11. 21 Aug, 2012 1 commit
  12. 28 Mar, 2012 1 commit
  13. 15 Dec, 2011 1 commit
    • Konrad Rzeszutek Wilk's avatar
      xen/swiotlb: Use page alignment for early buffer allocation. · 63a74175
      Konrad Rzeszutek Wilk authored
      This fixes an odd bug found on a Dell PowerEdge 1850/0RC130
      (BIOS A05 01/09/2006) where all of the modules doing pci_set_dma_mask
      would fail with:
      
      ata_piix 0000:00:1f.1: enabling device (0005 -> 0007)
      ata_piix 0000:00:1f.1: can't derive routing for PCI INT A
      ata_piix 0000:00:1f.1: BMDMA: failed to set dma mask, falling back to PIO
      
      The issue was the Xen-SWIOTLB was allocated such as that the end of
      buffer was stradling a page (and also above 4GB). The fix was
      spotted by Kalev Leonid  which was to piggyback on git commit
      e79f86b2 "swiotlb: Use page alignment
      for early buffer allocation" which:
      
      	We could call free_bootmem_late() if swiotlb is not used, and
      	it will shrink to page alignment.
      
      	So alloc them with page alignment at first, to avoid lose two pages
      
      And doing that fixes the outstanding issue.
      
      CC: stable@kernel.org
      Suggested-by: default avatar"Kalev, Leonid" <Leonid.Kalev@ca.com>
      Reported-and-Tested-by: default avatar"Taylor, Neal E" <Neal.Taylor@ca.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      63a74175
  14. 06 Dec, 2011 1 commit
  15. 31 Oct, 2011 1 commit
  16. 26 Aug, 2011 4 commits
  17. 06 Jun, 2011 1 commit
    • FUJITA Tomonori's avatar
      swiotlb: Export swioltb_nr_tbl and utilize it as appropiate. · 5f98ecdb
      FUJITA Tomonori authored
      By default the io_tlb_nslabs is set to zero, and gets set to
      whatever value is passed in via swiotlb_init_with_tbl function.
      The default value passed in is 64MB. However, if the user provides
      the 'swiotlb=<nslabs>' the default value is ignored and
      the value provided by the user is used... Except when the SWIOTLB
      is used under Xen - there the default value of 64MB is used and
      the Xen-SWIOTLB has no mechanism to get the 'io_tlb_nslabs' filled
      out by setup_io_tlb_npages functions. This patch provides a function
      for the Xen-SWIOTLB to call to see if the io_tlb_nslabs is set
      and if so use that value.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      5f98ecdb
  18. 10 Apr, 2011 1 commit
  19. 27 Jul, 2010 1 commit
    • Konrad Rzeszutek Wilk's avatar
      swiotlb-xen: SWIOTLB library for Xen PV guest with PCI passthrough. · b097186f
      Konrad Rzeszutek Wilk authored
      This patchset:
      
      PV guests under Xen are running in an non-contiguous memory architecture.
      
      When PCI pass-through is utilized, this necessitates an IOMMU for
      translating bus (DMA) to virtual and vice-versa and also providing a
      mechanism to have contiguous pages for device drivers operations (say DMA
      operations).
      
      Specifically, under Xen the Linux idea of pages is an illusion. It
      assumes that pages start at zero and go up to the available memory. To
      help with that, the Linux Xen MMU provides a lookup mechanism to
      translate the page frame numbers (PFN) to machine frame numbers (MFN)
      and vice-versa. The MFN are the "real" frame numbers. Furthermore
      memory is not contiguous. Xen hypervisor stitches memory for guests
      from different pools, which means there is no guarantee that PFN==MFN
      and PFN+1==MFN+1. Lastly with Xen 4.0, pages (in debug mode) are
      allocated in descending order (high to low), meaning the guest might
      never get any MFN's under the 4GB mark.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Albert Herranz <albert_herranz@yahoo.es>
      Cc: Ian Campbell <Ian.Campbell@citrix.com>
      b097186f