1. 31 8月, 2010 1 次提交
    • K
      x86, iommu: Fix IOMMU_INIT alignment rules · 7ac41ccf
      Konrad Rzeszutek Wilk 提交于
      This boot crash was observed:
      
       DMA-API: preallocated 32768 debug entries
       DMA-API: debugging enabled by kernel config
       BUG: unable to handle kernel paging request at 19da8955
       IP: [<f4ffffff>] 0xf4ffffff
       *pde = 00000000
      
      The crux of the failure was that even if we did not use any
      of the .iommu_table section, the linker would still insert it
      in the vmlinux file. This patch fixes that and also fixes the
      runtime crash where we would try to access the array.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      LKML-Reference: <1283191802-25086-1-git-send-email-konrad.wilk@oracle.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7ac41ccf
  2. 28 8月, 2010 1 次提交
  3. 27 8月, 2010 10 次提交
    • K
      x86, iommu: Utilize the IOMMU_INIT macros functionality. · ee1f284f
      Konrad Rzeszutek Wilk 提交于
      We remove all of the sub-platform detection/init routines and instead
      use on the .iommu_table array of structs to call the .early_init if
      .detect returned a positive value. Also we can stop detecting other
      IOMMUs if the IOMMU used the _FINISH type macro. During the
      'pci_iommu_init' stage, we call .init for the second-stage
      initialization if it was defined. Currently only SWIOTLB has this
      defined and it used to de-allocate the SWIOTLB if the other detected
      IOMMUs have deemed it unnecessary to use SWIOTLB.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-11-git-send-email-konrad.wilk@oracle.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      ee1f284f
    • K
      x86, VT-d: Make Intel VT-d IOMMU use IOMMU_INIT_* macros. · 4db77ff3
      Konrad Rzeszutek Wilk 提交于
      We utilize the IOMMU_INIT macros to create this dependency:
      
                     [null]
                       |
             [pci_xen_swiotlb_detect]
                       |
             [pci_swiotlb_detect_override]
                       |
             [pci_swiotlb_detect_4gb]
                       |
               +-------+--------+---------------------+
              /                  \                     \
      [detect_calgary]    [gart_iommu_hole_init]   [detect_intel_iommu]
                                  |
                          [amd_iommu_detect]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-10-git-send-email-konrad.wilk@oracle.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      CC: David Woodhouse <David.Woodhouse@intel.com>
      CC: Len Brown <len.brown@intel.com>
      CC: Chris Wright <chrisw@sous-sol.org>
      CC: Yinghai Lu <yinghai@kernel.org>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      4db77ff3
    • K
      x86, GART/AMD-VI: Make AMD GART and IOMMU use IOMMU_INIT_* macros. · 22e6daf4
      Konrad Rzeszutek Wilk 提交于
      We utilize the IOMMU_INIT macros to create this dependency:
      
                     [null]
                       |
             [pci_xen_swiotlb_detect]
                       |
             [pci_swiotlb_detect_override]
                       |
             [pci_swiotlb_detect_4gb]
                       |
               +-------+--------+
              /                  \
      [detect_calgary]    [gart_iommu_hole_init]
                                  |
                          [amd_iommu_detect]
      
      Meaning that 'amd_iommu_detect' will be called after
      'gart_iommu_hole_init'.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-9-git-send-email-konrad.wilk@oracle.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      22e6daf4
    • K
      x86, calgary: Make Calgary IOMMU use IOMMU_INIT_* macros. · d2aa232f
      Konrad Rzeszutek Wilk 提交于
      We utilize the IOMMU_INIT macros to create this dependency:
      
           [pci_xen_swiotlb_detect]
               |
           [pci_swiotlb_detect_override]
               |
           [pci_swiotlb_detect_4gb]
               |
            [detect_calgary]
      
      Meaning that 'detect_calgary' is going to be called after
      'pci_swiotlb_detect'.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-8-git-send-email-konrad.wilk@oracle.com>
      CC: Muli Ben-Yehuda <muli@il.ibm.com>
      CC: "Jon D. Mason" <jdmason@kudzu.us>
      CC: "Darrick J. Wong" <djwong@us.ibm.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      d2aa232f
    • K
      x86, xen-swiotlb: Make Xen-SWIOTLB use IOMMU_INIT_* macros. · 5cb3a267
      Konrad Rzeszutek Wilk 提交于
      We utilize the IOMMU_INIT macros to create this dependency:
      
                     [null]
                       |
             [pci_xen_swiotlb_detect]
                       |
             [pci_swiotlb_detect_override]
                       |
             [pci_swiotlb_detect_4gb]
      
      In other words, we set 'pci_xen_swiotlb_detect' to be
      the first detection to be run during start.
      
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-7-git-send-email-konrad.wilk@oracle.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      5cb3a267
    • K
      x86, swiotlb: Make SWIOTLB use IOMMU_INIT_* macros. · c116c545
      Konrad Rzeszutek Wilk 提交于
      We utilize the IOMMU_INIT macros to create this dependency:
      
             [pci_xen_swiotlb_detect]
                       |
             [pci_swiotlb_detect_override]
                       |
             [pci_swiotlb_detect_4gb]
      
      And set the SWIOTLB IOMMU_INIT to utilize 'pci_swiotlb_init'
      for .init and 'pci_swiotlb_late_init' for .late_init.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-6-git-send-email-konrad.wilk@oracle.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      c116c545
    • K
      x86, swiotlb: Simplify SWIOTLB pci_swiotlb_detect routine. · efa631c2
      Konrad Rzeszutek Wilk 提交于
      In 'pci_swiotlb_detect' we used to do two different things:
       a). If user provided 'iommu=soft' or 'swiotlb=force' we
           would set swiotlb=1 and return 1 (and forcing pci-dma.c
           to call pci_swiotlb_init() immediately).
       b). If 4GB or more would be detected and if user did not specify
           iommu=off, we would set 'swiotlb=1' and return whatever 'a)'
           figured out.
      
      We simplify this by splitting a) and b) in two different routines.
      
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-5-git-send-email-konrad.wilk@oracle.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      efa631c2
    • K
      x86, iommu: Add proper dependency sort routine (and sanity check). · 5bef80a4
      Konrad Rzeszutek Wilk 提交于
      We are using a very simple sort routine which sorts the .iommu_table
      array in the order of dependencies. Specifically each structure
      of iommu_table_entry has a field 'depend' which contains the function
      pointer to the IOMMU that MUST be run before us. We sort the array
      of structures so that the struct iommu_table_entry with no
      'depend' field are first, and then the subsequent ones are the
      ones for which the 'depend' function has been already invoked
      (in other words, precede us).
      
      Using the kernel's version 'sort', which is a mergeheap is
      feasible, but would require making the comparison operator
      scan recursivly the array to satisfy the "heapify" process: setting the
      levels properly. The end result would much more complex than it should
      be an it is just much simpler to utilize this simple sort routine.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-4-git-send-email-konrad.wilk@oracle.com>
      CC: H. Peter Anvin <hpa@zytor.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      5bef80a4
    • K
      x86, iommu: Make all IOMMU's detection routines return a value. · 480125ba
      Konrad Rzeszutek Wilk 提交于
      We return 1 if the IOMMU has been detected. Zero or an error number
      if we failed to find it. This is in preperation of using the IOMMU_INIT
      so that we can detect whether an IOMMU is present. I have not
      tested this for regression on Calgary, nor on AMD Vi chipsets as
      I don't have that hardware.
      
      CC: Muli Ben-Yehuda <muli@il.ibm.com>
      CC: "Jon D. Mason" <jdmason@kudzu.us>
      CC: "Darrick J. Wong" <djwong@us.ibm.com>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      CC: David Woodhouse <David.Woodhouse@intel.com>
      CC: Chris Wright <chrisw@sous-sol.org>
      CC: Yinghai Lu <yinghai@kernel.org>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      CC: H. Peter Anvin <hpa@zytor.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-3-git-send-email-konrad.wilk@oracle.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      480125ba
    • K
      x86, iommu: Add IOMMU_INIT macros, .iommu_table section, and iommu_table_entry structure · 0444ad93
      Konrad Rzeszutek Wilk 提交于
      This patch set adds a mechanism to "modularize" the IOMMUs we have
      on X86. Currently the count of IOMMUs is up to six and they have a complex
      relationship that requires careful execution order. 'pci_iommu_alloc'
      does that today, but most folks are unhappy with how it does it.
      This patch set addresses this and also paves a mechanism to jettison
      unused IOMMUs during run-time. For details that sparked this, please
      refer to: http://lkml.org/lkml/2010/8/2/282
      
      The first solution that comes to mind is to convert wholesale
      the IOMMU detection routines to be called during initcall
      time frame. Unfortunately that misses the dependency relationship
      that some of the IOMMUs have (for example: for AMD-Vi IOMMU to work,
      GART detection MUST run first, and before all of that SWIOTLB MUST run).
      
      The second solution would be to introduce a registration call wherein
      the IOMMU would provide its detection/init routines and as well on what
      MUST run before it. That would work, except that the 'pci_iommu_alloc'
      which would run through this list, is called during mem_init. This means we
      don't have any memory allocator, and it is so early that we haven't yet
      started running through the initcall_t list.
      
      This solution borrows concepts from the 2nd idea and from how
      MODULE_INIT works. A macro is provided that each IOMMU uses to define
      it's detect function and early_init (before the memory allocate is
      active), and as well what other IOMMU MUST run before us.  Since most IOMMUs
      depend on having SWIOTLB run first ("pci_swiotlb_detect") a convenience macro
      to depends on that is also provided.
      
      This macro is similar in design to MODULE_PARAM macro wherein
      we setup a .iommu_table section in which we populate it with the values
      that match a struct iommu_table_entry. During bootup we will sort
      through the array so that the IOMMUs that MUST run before us are first
      elements in the array. And then we just iterate through them calling the
      detection routine and if appropiate, the init routines.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      LKML-Reference: <1282845485-8991-2-git-send-email-konrad.wilk@oracle.com>
      CC: H. Peter Anvin <hpa@zytor.com>
      CC: Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      0444ad93
  4. 23 8月, 2010 5 次提交
  5. 22 8月, 2010 11 次提交
  6. 21 8月, 2010 12 次提交