11 Jan, 2012

1 commit

  • * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (53 commits)
    iommu/amd: Set IOTLB invalidation timeout
    iommu/amd: Init stats for iommu=pt
    iommu/amd: Remove unnecessary cache flushes in amd_iommu_resume
    iommu/amd: Add invalidate-context call-back
    iommu/amd: Add amd_iommu_device_info() function
    iommu/amd: Adapt IOMMU driver to PCI register name changes
    iommu/amd: Add invalid_ppr callback
    iommu/amd: Implement notifiers for IOMMUv2
    iommu/amd: Implement IO page-fault handler
    iommu/amd: Add routines to bind/unbind a pasid
    iommu/amd: Implement device aquisition code for IOMMUv2
    iommu/amd: Add driver stub for AMD IOMMUv2 support
    iommu/amd: Add stat counter for IOMMUv2 events
    iommu/amd: Add device errata handling
    iommu/amd: Add function to get IOMMUv2 domain for pdev
    iommu/amd: Implement function to send PPR completions
    iommu/amd: Implement functions to manage GCR3 table
    iommu/amd: Implement IOMMUv2 TLB flushing routines
    iommu/amd: Add support for IOMMUv2 domain mode
    iommu/amd: Add amd_iommu_domain_direct_map function
    ...

    Linus Torvalds
     

09 Jan, 2012

2 commits


20 Dec, 2011

1 commit


17 Dec, 2011

2 commits

  • * 'drm-intel-fixes' of git://people.freedesktop.org/~keithp/linux:
    drm/i915/dp: Dither down to 6bpc if it makes the mode fit
    drm/i915: enable semaphores on per-device defaults
    drm/i915: don't set unpin_work if vblank_get fails
    drm/i915: By default, enable RC6 on IVB and SNB when reasonable
    iommu: Export intel_iommu_enabled to signal when iommu is in use
    drm/i915/sdvo: Include LVDS panels for the IS_DIGITAL check
    drm/i915: prevent division by zero when asking for chipset power
    drm/i915: add PCH info to i915_capabilities
    drm/i915: set the right SDVO transcoder for CPT
    drm/i915: no-lvds quirk for ASUS AT5NM10T-I
    drm/i915: Treat pre-gen4 backlight duty cycle value consistently
    drm/i915: Hook up Ivybridge eDP
    drm/i915: add multi-threaded forcewake support

    Linus Torvalds
     
  • In i915 driver, we do not enable either rc6 or semaphores on SNB when dmar
    is enabled. The new 'intel_iommu_enabled' variable signals when the
    iommu code is in operation.

    Cc: Ted Phelps
    Cc: Peter
    Cc: Lukas Hejtmanek
    Cc: Andrew Lutomirski
    CC: Daniel Vetter
    Cc: Eugeni Dodonov
    Signed-off-by: Keith Packard

    Eugeni Dodonov
     

14 Dec, 2011

1 commit


09 Dec, 2011

1 commit

  • Now all ARCH_POPULATES_NODE_MAP archs select HAVE_MEBLOCK_NODE_MAP -
    there's no user of early_node_map[] left. Kill early_node_map[] and
    replace ARCH_POPULATES_NODE_MAP with HAVE_MEMBLOCK_NODE_MAP. Also,
    relocate for_each_mem_pfn_range() and helper from mm.h to memblock.h
    as page_alloc.c would no longer host an alternative implementation.

    This change is ultimately one to one mapping and shouldn't cause any
    observable difference; however, after the recent changes, there are
    some functions which now would fit memblock.c better than page_alloc.c
    and dependency on HAVE_MEMBLOCK_NODE_MAP instead of HAVE_MEMBLOCK
    doesn't make much sense on some of them. Further cleanups for
    functions inside HAVE_MEMBLOCK_NODE_MAP in mm.h would be nice.

    -v2: Fix compile bug introduced by mis-spelling
    CONFIG_HAVE_MEMBLOCK_NODE_MAP to CONFIG_MEMBLOCK_HAVE_NODE_MAP in
    mmzone.h. Reported by Stephen Rothwell.

    Signed-off-by: Tejun Heo
    Cc: Stephen Rothwell
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Tony Luck
    Cc: Ralf Baechle
    Cc: Martin Schwidefsky
    Cc: Chen Liqin
    Cc: Paul Mundt
    Cc: "David S. Miller"
    Cc: "H. Peter Anvin"

    Tejun Heo
     

06 Dec, 2011

1 commit

  • dmar_parse_rmrr_atsr_dev() calls rmrr_parse_dev() and
    atsr_parse_dev() which are both marked as __init.

    Section mismatch in reference from the function
    dmar_parse_rmrr_atsr_dev() to the function
    .init.text:dmar_parse_dev_scope() The function
    dmar_parse_rmrr_atsr_dev() references the function __init
    dmar_parse_dev_scope().

    Section mismatch in reference from the function
    dmar_parse_rmrr_atsr_dev() to the function
    .init.text:dmar_parse_dev_scope() The function
    dmar_parse_rmrr_atsr_dev() references the function __init
    dmar_parse_dev_scope().

    Signed-off-by: Sergey Senozhatsky
    Cc: David Woodhouse
    Cc: iommu@lists.linux-foundation.org
    Cc: Joerg Roedel
    Cc: Ohad Ben-Cohen
    Link: http://lkml.kernel.org/r/20111026154539.GA10103@swordfish
    Signed-off-by: Ingo Molnar

    Sergey Senozhatsky
     

29 Nov, 2011

1 commit

  • Conflicts & resolutions:

    * arch/x86/xen/setup.c

    dc91c728fd "xen: allow extra memory to be in multiple regions"
    24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..."

    conflicted on xen_add_extra_mem() updates. The resolution is
    trivial as the latter just want to replace
    memblock_x86_reserve_range() with memblock_reserve().

    * drivers/pci/intel-iommu.c

    166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/"
    5dfe8660a3d "bootmem: Replace work_with_active_regions() with..."

    conflicted as the former moved the file under drivers/iommu/.
    Resolved by applying the chnages from the latter on the moved
    file.

    * mm/Kconfig

    6661672053a "memblock: add NO_BOOTMEM config symbol"
    c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option"

    conflicted trivially. Both added config options. Just
    letting both add their own options resolves the conflict.

    * mm/memblock.c

    d1f0ece6cdc "mm/memblock.c: small function definition fixes"
    ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()"

    confliected. The former updates function removed by the
    latter. Resolution is trivial.

    Signed-off-by: Tejun Heo

    Tejun Heo
     

15 Nov, 2011

2 commits

  • The option iommu=group_mf indicates the that the iommu driver should
    expose all functions of a multi-function PCI device as the same
    iommu_device_group. This is useful for disallowing individual functions
    being exposed as independent devices to userspace as there are often
    hidden dependencies. Virtual functions are not affected by this option.

    Signed-off-by: Alex Williamson
    Signed-off-by: Joerg Roedel

    Alex Williamson
     
  • We generally have BDF granularity for devices, so we just need
    to make sure devices aren't hidden behind PCIe-to-PCI bridges.
    We can then make up a group number that's simply the concatenated
    seg|bus|dev|fn so we don't have to track them (not that users
    should depend on that).

    Signed-off-by: Alex Williamson
    Acked-By: David Woodhouse
    Signed-off-by: Joerg Roedel

    Alex Williamson
     

10 Nov, 2011

2 commits

  • Let the IOMMU core know we support arbitrary page sizes (as long as
    they're an order of 4KiB).

    This way the IOMMU core will retain the existing behavior we're used to;
    it will let us map regions that:
    - their size is an order of 4KiB
    - they are naturally aligned

    Note: Intel IOMMU hardware doesn't support arbitrary page sizes,
    but the driver does (it splits arbitrary-sized mappings into
    the pages supported by the hardware).

    To make everything simpler for now, though, this patch effectively tells
    the IOMMU core to keep giving this driver the same memory regions it did
    before, so nothing is changed as far as it's concerned.

    At this point, the page sizes announced remain static within the IOMMU
    core. To correctly utilize the pgsize-splitting of the IOMMU core by
    this driver, it seems that some core changes should still be done,
    because Intel's IOMMU page size capabilities seem to have the potential
    to be different between different DMA remapping devices.

    Signed-off-by: Ohad Ben-Cohen
    Cc: David Woodhouse
    Signed-off-by: Joerg Roedel

    Ohad Ben-Cohen
     
  • Express sizes in bytes rather than in page order, to eliminate the
    size->order->size conversions we have whenever the IOMMU API is calling
    the low level drivers' map/unmap methods.

    Adopt all existing drivers.

    Signed-off-by: Ohad Ben-Cohen
    Cc: David Brown
    Cc: David Woodhouse
    Cc: Joerg Roedel
    Cc: Stepan Moskovchenko
    Cc: KyongHo Cho
    Cc: Hiroshi DOYU
    Cc: Laurent Pinchart
    Signed-off-by: Joerg Roedel

    Ohad Ben-Cohen
     

01 Nov, 2011

1 commit


31 Oct, 2011

1 commit

  • * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (33 commits)
    iommu/core: Remove global iommu_ops and register_iommu
    iommu/msm: Use bus_set_iommu instead of register_iommu
    iommu/omap: Use bus_set_iommu instead of register_iommu
    iommu/vt-d: Use bus_set_iommu instead of register_iommu
    iommu/amd: Use bus_set_iommu instead of register_iommu
    iommu/core: Use bus->iommu_ops in the iommu-api
    iommu/core: Convert iommu_found to iommu_present
    iommu/core: Add bus_type parameter to iommu_domain_alloc
    Driver core: Add iommu_ops to bus_type
    iommu/core: Define iommu_ops and register_iommu only with CONFIG_IOMMU_API
    iommu/amd: Fix wrong shift direction
    iommu/omap: always provide iommu debug code
    iommu/core: let drivers know if an iommu fault handler isn't installed
    iommu/core: export iommu_set_fault_handler()
    iommu/omap: Fix build error with !IOMMU_SUPPORT
    iommu/omap: Migrate to the generic fault report mechanism
    iommu/core: Add fault reporting mechanism
    iommu/core: Use PAGE_SIZE instead of hard-coded value
    iommu/core: use the existing IS_ALIGNED macro
    iommu/msm: ->unmap() should return order of unmapped page
    ...

    Fixup trivial conflicts in drivers/iommu/Makefile: "move omap iommu to
    dedicated iommu folder" vs "Rename the DMAR and INTR_REMAP config
    options" just happened to touch lines next to each other.

    Linus Torvalds
     

26 Oct, 2011

2 commits

  • * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
    rtmutex: Add missing rcu_read_unlock() in debug_rt_mutex_print_deadlock()
    lockdep: Comment all warnings
    lib: atomic64: Change the type of local lock to raw_spinlock_t
    locking, lib/atomic64: Annotate atomic64_lock::lock as raw
    locking, x86, iommu: Annotate qi->q_lock as raw
    locking, x86, iommu: Annotate irq_2_ir_lock as raw
    locking, x86, iommu: Annotate iommu->register_lock as raw
    locking, dma, ipu: Annotate bank_lock as raw
    locking, ARM: Annotate low level hw locks as raw
    locking, drivers/dca: Annotate dca_lock as raw
    locking, powerpc: Annotate uic->lock as raw
    locking, x86: mce: Annotate cmci_discover_lock as raw
    locking, ACPI: Annotate c3_lock as raw
    locking, oprofile: Annotate oprofilefs lock as raw
    locking, video: Annotate vga console lock as raw
    locking, latencytop: Annotate latency_lock as raw
    locking, timer_stats: Annotate table_lock as raw
    locking, rwsem: Annotate inner lock as raw
    locking, semaphores: Annotate inner lock as raw
    locking, sched: Annotate thread_group_cputimer as raw
    ...

    Fix up conflicts in kernel/posix-cpu-timers.c manually: making
    cputimer->cputime a raw lock conflicted with the ABBA fix in commit
    bcd5cff7216f ("cputimer: Cure lock inversion").

    Linus Torvalds
     
  • * 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86, ioapic: Consolidate the explicit EOI code
    x86, ioapic: Restore the mask bit correctly in eoi_ioapic_irq()
    x86, kdump, ioapic: Reset remote-IRR in clear_IO_APIC
    iommu: Rename the DMAR and INTR_REMAP config options
    x86, ioapic: Define irq_remap_modify_chip_defaults()
    x86, msi, intr-remap: Use the ioapic set affinity routine
    iommu: Cleanup ifdefs in detect_intel_iommu()
    iommu: No need to set dmar_disabled in check_zero_address()
    iommu: Move IOMMU specific code to intel-iommu.c
    intr_remap: Call dmar_dev_scope_init() explicitly
    x86, x2apic: Enable the bios request for x2apic optout

    Linus Torvalds
     

21 Oct, 2011

1 commit


19 Oct, 2011

3 commits


15 Oct, 2011

2 commits

  • We really don't want this to work in the general case; device drivers
    *shouldn't* care whether they are behind an IOMMU or not. But the
    integrated graphics is a special case, because the IOMMU and the GTT are
    all kind of smashed into one and generally horrifically buggy, so it's
    reasonable for the graphics driver to want to know when the IOMMU is
    active for the graphics hardware.

    Signed-off-by: David Woodhouse

    David Woodhouse
     
  • To work around a hardware issue, we have to submit IOTLB flushes while
    the graphics engine is idle. The graphics driver will (we hope) go to
    great lengths to ensure that it gets that right on the affected
    chipset(s)... so let's not screw it over by deferring the unmap and
    doing it later. That wouldn't be very helpful.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

11 Oct, 2011

1 commit

  • When unbinding a device so that I could pass it through to a KVM VM, I
    got the lockdep report below. It looks like a legitimate lock
    ordering problem:

    - domain_context_mapping_one() takes iommu->lock and calls
    iommu_support_dev_iotlb(), which takes device_domain_lock (inside
    iommu->lock).

    - domain_remove_one_dev_info() starts by taking device_domain_lock
    then takes iommu->lock inside it (near the end of the function).

    So this is the classic AB-BA deadlock. It looks like a safe fix is to
    simply release device_domain_lock a bit earlier, since as far as I can
    tell, it doesn't protect any of the stuff accessed at the end of
    domain_remove_one_dev_info() anyway.

    BTW, the use of device_domain_lock looks a bit unsafe to me... it's
    at least not obvious to me why we aren't vulnerable to the race below:

    iommu_support_dev_iotlb()
    domain_remove_dev_info()

    lock device_domain_lock
    find info
    unlock device_domain_lock

    lock device_domain_lock
    find same info
    unlock device_domain_lock

    free_devinfo_mem(info)

    do stuff with info after it's free

    However I don't understand the locking here well enough to know if
    this is a real problem, let alone what the best fix is.

    Anyway here's the full lockdep output that prompted all of this:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.39.1+ #1
    -------------------------------------------------------
    bash/13954 is trying to acquire lock:
    (&(&iommu->lock)->rlock){......}, at: [] domain_remove_one_dev_info+0x121/0x230

    but task is already holding lock:
    (device_domain_lock){-.-...}, at: [] domain_remove_one_dev_info+0x208/0x230

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (device_domain_lock){-.-...}:
    [] lock_acquire+0x9d/0x130
    [] _raw_spin_lock_irqsave+0x55/0xa0
    [] domain_context_mapping_one+0x600/0x750
    [] domain_context_mapping+0x3f/0x120
    [] iommu_prepare_identity_map+0x1c5/0x1e0
    [] intel_iommu_init+0x88e/0xb5e
    [] pci_iommu_init+0x16/0x41
    [] do_one_initcall+0x45/0x190
    [] kernel_init+0xe3/0x168
    [] kernel_thread_helper+0x4/0x10

    -> #0 (&(&iommu->lock)->rlock){......}:
    [] __lock_acquire+0x195e/0x1e10
    [] lock_acquire+0x9d/0x130
    [] _raw_spin_lock_irqsave+0x55/0xa0
    [] domain_remove_one_dev_info+0x121/0x230
    [] device_notifier+0x72/0x90
    [] notifier_call_chain+0x8c/0xc0
    [] __blocking_notifier_call_chain+0x78/0xb0
    [] blocking_notifier_call_chain+0x16/0x20
    [] __device_release_driver+0xbc/0xe0
    [] device_release_driver+0x2f/0x50
    [] driver_unbind+0xa3/0xc0
    [] drv_attr_store+0x2c/0x30
    [] sysfs_write_file+0xe6/0x170
    [] vfs_write+0xce/0x190
    [] sys_write+0x54/0xa0
    [] system_call_fastpath+0x16/0x1b

    other info that might help us debug this:

    6 locks held by bash/13954:
    #0: (&buffer->mutex){+.+.+.}, at: [] sysfs_write_file+0x44/0x170
    #1: (s_active#3){++++.+}, at: [] sysfs_write_file+0xcd/0x170
    #2: (&__lockdep_no_validate__){+.+.+.}, at: [] driver_unbind+0x9b/0xc0
    #3: (&__lockdep_no_validate__){+.+.+.}, at: [] device_release_driver+0x27/0x50
    #4: (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [] __blocking_notifier_call_chain+0x5f/0xb0
    #5: (device_domain_lock){-.-...}, at: [] domain_remove_one_dev_info+0x208/0x230

    stack backtrace:
    Pid: 13954, comm: bash Not tainted 2.6.39.1+ #1
    Call Trace:
    [] print_circular_bug+0xf7/0x100
    [] __lock_acquire+0x195e/0x1e10
    [] ? trace_hardirqs_off+0xd/0x10
    [] ? trace_hardirqs_on_caller+0x13d/0x180
    [] lock_acquire+0x9d/0x130
    [] ? domain_remove_one_dev_info+0x121/0x230
    [] _raw_spin_lock_irqsave+0x55/0xa0
    [] ? domain_remove_one_dev_info+0x121/0x230
    [] ? trace_hardirqs_off+0xd/0x10
    [] domain_remove_one_dev_info+0x121/0x230
    [] device_notifier+0x72/0x90
    [] notifier_call_chain+0x8c/0xc0
    [] __blocking_notifier_call_chain+0x78/0xb0
    [] blocking_notifier_call_chain+0x16/0x20
    [] __device_release_driver+0xbc/0xe0
    [] device_release_driver+0x2f/0x50
    [] driver_unbind+0xa3/0xc0
    [] drv_attr_store+0x2c/0x30
    [] sysfs_write_file+0xe6/0x170
    [] vfs_write+0xce/0x190
    [] sys_write+0x54/0xa0
    [] system_call_fastpath+0x16/0x1b

    Signed-off-by: Roland Dreier
    Signed-off-by: David Woodhouse

    Roland Dreier
     

21 Sep, 2011

3 commits

  • Change the CONFIG_DMAR to CONFIG_INTEL_IOMMU to be consistent
    with the other IOMMU options.

    Rename the CONFIG_INTR_REMAP to CONFIG_IRQ_REMAP to match the
    irq subsystem name.

    And define the CONFIG_DMAR_TABLE for the common ACPI DMAR
    routines shared by both CONFIG_INTEL_IOMMU and CONFIG_IRQ_REMAP.

    Signed-off-by: Suresh Siddha
    Cc: yinghai@kernel.org
    Cc: youquan.song@intel.com
    Cc: joerg.roedel@amd.com
    Cc: tony.luck@intel.com
    Cc: dwmw2@infradead.org
    Link: http://lkml.kernel.org/r/20110824001456.558630224@sbsiddha-desk.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     
  • Move the IOMMU specific routines to intel-iommu.c leaving the
    dmar.c to the common ACPI dmar code shared between DMA-remapping
    and Interrupt-remapping.

    Signed-off-by: Suresh Siddha
    Cc: yinghai@kernel.org
    Cc: youquan.song@intel.com
    Cc: joerg.roedel@amd.com
    Cc: tony.luck@intel.com
    Cc: dwmw2@infradead.org
    Link: http://lkml.kernel.org/r/20110824001456.282401285@sbsiddha-desk.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     
  • Both DMA-remapping aswell as Interrupt-remapping depend on the
    dmar dev scope to be initialized. When both DMA and
    IRQ-remapping are enabled, we depend on DMA-remapping init code
    to call dmar_dev_scope_init(). This resulted in not doing this
    init when DMA-remapping was turned off but interrupt-remapping
    turned on in the kernel config.

    This caused interrupt routing to break with CONFIG_INTR_REMAP=y
    and CONFIG_DMAR=n.

    This issue was introduced by this commit:

    | commit 9d5ce73a64be2be8112147a3e0b551ad9cd1247b
    | Author: FUJITA Tomonori
    | Date: Tue Nov 10 19:46:16 2009 +0900
    |
    | x86: intel-iommu: Convert detect_intel_iommu to use iommu_init hook

    Fix this by calling dmar_dev_scope_init() explicitly from the
    interrupt remapping code too.

    Reported-by: Andrew Vasquez
    Signed-off-by: Suresh Siddha
    Cc: yinghai@kernel.org
    Cc: youquan.song@intel.com
    Cc: joerg.roedel@amd.com
    Cc: tony.luck@intel.com
    Cc: dwmw2@infradead.org
    Link: http://lkml.kernel.org/r/20110824001456.229207526@sbsiddha-desk.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     

13 Sep, 2011

1 commit

  • The iommu->register_lock can be taken in atomic context and therefore
    must not be preempted on -rt - annotate it.

    In mainline this change documents the low level nature of
    the lock - otherwise there's no functional difference. Lockdep
    and Sparse checking will work as usual.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

21 Jun, 2011

1 commit

  • This should ease finding similarities with different platforms,
    with the intention of solving problems once in a generic framework
    which everyone can use.

    Note: to move intel-iommu.c, the declaration of pci_find_upstream_pcie_bridge()
    has to move from drivers/pci/pci.h to include/linux/pci.h. This is handled
    in this patch, too.

    As suggested, also drop DMAR's EXPERIMENTAL tag while we're at it.

    Compile-tested on x86_64.

    Signed-off-by: Ohad Ben-Cohen
    Signed-off-by: Joerg Roedel

    Ohad Ben-Cohen