1. 10 Nov, 2009 11 commits
    • FUJITA Tomonori's avatar
      x86, 32-bit: Fix swiotlb boot crash · 72d03802
      FUJITA Tomonori authored
      Ingo Molnar reported this boot crash:
      
      [    8.655620] pata_amd 0000:00:06.0: version 0.4.1
      [    8.660286] BUG: unable to handle kernel NULL pointer dereference at 00000034
      [    8.663572] IP: [<c100617b>] dma_supported+0x3b/0xa4
      [    8.663572] *pde = 00000000
      
      Initialize dma_ops properly in the 32-bit case.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      72d03802
    • FUJITA Tomonori's avatar
      x86: Handle HW IOMMU initialization failure gracefully · 75f1cdf1
      FUJITA Tomonori authored
      If HW IOMMU initialization fails (Intel VT-d often does this,
      typically due to BIOS bugs), we fall back to nommu. It doesn't
      work for the majority since nowadays we have more than 4GB
      memory so we must use swiotlb instead of nommu.
      
      The problem is that it's too late to initialize swiotlb when HW
      IOMMU initialization fails. We need to allocate swiotlb memory
      earlier from bootmem allocator. Chris explained the issue in
      detail:
      
        http://marc.info/?l=linux-kernel&m=125657444317079&w=2
      
      The current x86 IOMMU initialization sequence is too complicated
      and handling the above issue makes it more hacky.
      
      This patch changes x86 IOMMU initialization sequence to handle
      the above issue cleanly.
      
      The new x86 IOMMU initialization sequence are:
      
      1. we initialize the swiotlb (and setting swiotlb to 1) in the case
         of (max_pfn > MAX_DMA32_PFN && !no_iommu). dma_ops is set to
         swiotlb_dma_ops or nommu_dma_ops. if swiotlb usage is forced by
         the boot option, we finish here.
      
      2. we call the detection functions of all the IOMMUs
      
      3. the detection function sets x86_init.iommu.iommu_init to the
         IOMMU initialization function (so we can avoid calling the
         initialization functions of all the IOMMUs needlessly).
      
      4. if the IOMMU initialization function doesn't need to swiotlb
         then sets swiotlb to zero (e.g. the initialization is
         sucessful).
      
      5. if we find that swiotlb is set to zero, we free swiotlb
         resource.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-10-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      75f1cdf1
    • FUJITA Tomonori's avatar
      swiotlb: Defer swiotlb init printing, export swiotlb_print_info() · ad32e8cb
      FUJITA Tomonori authored
      This enables us to avoid printing swiotlb memory info when we
      initialize swiotlb. After swiotlb initialization, we could find
      that we don't need swiotlb.
      
      This patch removes the code to print swiotlb memory info in
      swiotlb_init() and exports the function to do that.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      Cc: tony.luck@intel.com
      Cc: benh@kernel.crashing.org
      LKML-Reference: <1257849980-22640-9-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      [ -v2: merge up conflict ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ad32e8cb
    • FUJITA Tomonori's avatar
      swiotlb: Add swiotlb_free() function · 5740afdb
      FUJITA Tomonori authored
      swiotlb_free() function frees all allocated memory for swiotlb.
      
      We need to initialize swiotlb before IOMMU initialization (x86
      and powerpc needs to allocate memory from bootmem allocator). If
      IOMMU initialization is successful, we need to free swiotlb
      resource (don't want to waste 64MB).
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-8-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      [ -v2: build fix for the !CONFIG_SWIOTLB case ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5740afdb
    • FUJITA Tomonori's avatar
      bootmem: Add free_bootmem_late() · 9f993ac3
      FUJITA Tomonori authored
      Add a new function for freeing bootmem after the bootmem
      allocator has been released and the unreserved pages given to
      the page allocator.
      
      This allows us to reserve bootmem and then release it if we
      later discover it was not needed.
      
      ( This new API will be used by the swiotlb code to recover
        a significant amount of RAM (64MB). )
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      Cc: hannes@cmpxchg.org
      Cc: tj@kernel.org
      Cc: akpm@linux-foundation.org
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <1257849980-22640-7-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9f993ac3
    • FUJITA Tomonori's avatar
      x86: intel-iommu: Convert detect_intel_iommu to use iommu_init hook · 9d5ce73a
      FUJITA Tomonori authored
      This changes detect_intel_iommu() to set intel_iommu_init() to
      iommu_init hook if detect_intel_iommu() finds the IOMMU.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-6-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      [ -v2: build fix for the !CONFIG_DMAR case ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9d5ce73a
    • FUJITA Tomonori's avatar
      x86: amd_iommu: Convert amd_iommu_detect() to use iommu_init hook · ea1b0d39
      FUJITA Tomonori authored
      This changes amd_iommu_detect() to set amd_iommu_init to
      iommu_init hook if amd_iommu_detect() finds the AMD IOMMU.
      
      We can kill the code to check if we found the IOMMU in
      amd_iommu_init() since amd_iommu_detect() sets amd_iommu_init()
      only when it found the IOMMU.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-5-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ea1b0d39
    • FUJITA Tomonori's avatar
      x86: GART: Convert gart_iommu_hole_init() to use iommu_init hook · de957628
      FUJITA Tomonori authored
      This changes gart_iommu_hole_init() to set gart_iommu_init() to
      iommu_init hook if gart_iommu_hole_init() finds the GART IOMMU.
      
      We can kill the code to check if we found the IOMMU in
      gart_iommu_init() since gart_iommu_hole_init() sets
      gart_iommu_init() only when it found the IOMMU.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      de957628
    • FUJITA Tomonori's avatar
      x86: Calgary: Convert detect_calgary() to use iommu_init hook · d7b9f7be
      FUJITA Tomonori authored
      This changes detect_calgary() to set init_calgary() to
      iommu_init hook if detect_calgary() finds the Calgary IOMMU.
      
      We can kill the code to check if we found the IOMMU in
      init_calgary() since detect_calgary() sets init_calgary() only
      when it found the IOMMU.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Acked-by: default avatarMuli Ben-Yehuda <muli@il.ibm.com>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      LKML-Reference: <1257849980-22640-3-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d7b9f7be
    • FUJITA Tomonori's avatar
      x86: Add iommu_init to x86_init_ops · d07c1be0
      FUJITA Tomonori authored
      We call the detections functions of all the IOMMUs then all
      their initialization functions. The latter is pointless since we
      don't detect multiple different IOMMUs. What we need to do is
      calling the initialization function of the detected IOMMU.
      
      This adds iommu_init hook to x86_init_ops so if an IOMMU
      detection function can set its initialization function to the
      hook.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: chrisw@sous-sol.org
      Cc: dwmw2@infradead.org
      Cc: joerg.roedel@amd.com
      Cc: muli@il.ibm.com
      LKML-Reference: <1257849980-22640-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d07c1be0
    • Joe Perches's avatar
      x86: GART: pci-gart_64.c: Use correct length in strncmp · 41855b77
      Joe Perches authored
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: <stable@kernel.org> # .3x.x
      LKML-Reference: <1257818330.12852.72.camel@Joe-Laptop.home>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      41855b77
  2. 08 Nov, 2009 2 commits
  3. 05 Nov, 2009 17 commits
  4. 04 Nov, 2009 10 commits