1. 27 8月, 2010 7 次提交
    • 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
  2. 23 8月, 2010 5 次提交
  3. 22 8月, 2010 11 次提交
  4. 21 8月, 2010 17 次提交