19 Sep, 2016

1 commit


05 Sep, 2016

4 commits

  • Introduce struct iommu_dev_data.use_vapic flag, which IOMMU driver
    uses to determine if it should enable vAPIC support, by setting
    the ga_mode bit in the device's interrupt remapping table entry.

    Currently, it is enabled for all pass-through device if vAPIC mode
    is enabled.

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • This patch adds support to detect and initialize IOMMU Guest vAPIC log
    (GALOG). By default, it also enable GALog interrupt to notify IOMMU driver
    when GA Log entry is created.

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • This patch enables support for the new 128-bit IOMMU IRTE format,
    which can be used for both legacy and vapic interrupt remapping modes.
    It replaces the existing operations on IRTE, which can only support
    the older 32-bit IRTE format, with calls to the new struct amd_irt_ops.

    It also provides helper functions for setting up, accessing, and
    updating interrupt remapping table entries in different mode.

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • This patch introduces a new IOMMU driver parameter, amd_iommu_guest_ir,
    which can be used to specify different interrupt remapping mode for
    passthrough devices to VM guest:
    * legacy: Legacy interrupt remapping (w/ 32-bit IRTE)
    * vapic : Guest vAPIC interrupt remapping (w/ GA mode 128-bit IRTE)

    Note that in vapic mode, it can also supports legacy interrupt remapping
    for non-passthrough devices with the 128-bit IRTE.

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     

07 Jul, 2016

1 commit

  • There is a race condition in the AMD IOMMU init code that
    causes requested unity mappings to be blocked by the IOMMU
    for a short period of time. This results on boot failures
    and IO_PAGE_FAULTs on some machines.

    Fix this by making sure the unity mappings are installed
    before all other DMA is blocked.

    Fixes: aafd8ba0ca74 ('iommu/amd: Implement add_device and remove_device')
    Cc: stable@vger.kernel.org # v4.2+
    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

27 Jun, 2016

1 commit

  • Commit 2a0cb4e2d423 ("iommu/amd: Add new map for storing IVHD dev entry
    type HID") added a call to DUMP_printk in init_iommu_from_acpi() which
    used the value of devid before this variable was initialized.

    Fixes: 2a0cb4e2d423 ('iommu/amd: Add new map for storing IVHD dev entry type HID')
    Signed-off-by: Nicolas Iooss
    Signed-off-by: Joerg Roedel

    Nicolas Iooss
     

07 Apr, 2016

5 commits

  • This patch introduces a new kernel parameter, ivrs_acpihid.
    This is used to override existing ACPI-HID IVHD device entry,
    or add an entry in case it is missing in the IVHD.

    Signed-off-by: Wan Zongshun
    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • This patch introduces acpihid_map, which is used to store
    the new IVHD device entry extracted from BIOS IVRS table.

    It also provides a utility function add_acpi_hid_device(),
    to add this types of devices to the map.

    Signed-off-by: Wan Zongshun
    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Wan Zongshun
     
  • The IVRS in more recent AMD system usually contains multiple
    IVHD block types (e.g. 0x10, 0x11, and 0x40) for each IOMMU.
    The newer IVHD types provide more information (e.g. new features
    specified in the IOMMU spec), while maintain compatibility with
    the older IVHD type.

    Having multiple IVHD type allows older IOMMU drivers to still function
    (e.g. using the older IVHD type 0x10) while the newer IOMMU driver can use
    the newer IVHD types (e.g. 0x11 and 0x40). Therefore, the IOMMU driver
    should only make use of the newest IVHD type that it can support.

    This patch adds new logic to determine the highest level of IVHD type
    it can support, and use it throughout the to initialize the driver.
    This requires adding another pass to the IVRS parsing to determine
    appropriate IVHD type (see function get_highest_supported_ivhd_type())
    before parsing the contents.

    [Vincent: fix the build error of IVHD_DEV_ACPI_HID flag not found]

    Signed-off-by: Wan Zongshun
    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • This patch modifies the existing struct ivhd_header,
    which currently only support IVHD type 0x10, to add
    new fields from IVHD type 11h and 40h.

    It also modifies the pointer calculation to allow
    support for IVHD type 11h and 40h

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     
  • The IVHD header type 11h and 40h introduce the PCSup bit in
    the EFR Register Image bit fileds. This should be used to
    determine the IOMMU performance support instead of relying
    on the PNCounters and PNBanks.

    Note also that the PNCouters and PNBanks bits in the IOMMU
    attributes field of IVHD headers type 11h are incorrectly
    programmed on some systems.

    So, we should not rely on it to determine the performance
    counter/banks size. Instead, these values should be read
    from the MMIO Offset 0030h IOMMU Extended Feature Register.

    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     

25 Feb, 2016

2 commits

  • The AMD Family 15h Models 30h-3Fh (Kaveri) BIOS and Kernel Developer's
    Guide omitted part of the BIOS IOMMU L2 register setup specification.
    Without this setup the IOMMU L2 does not fully respect write permissions
    when handling an ATS translation request.

    The IOMMU L2 will set PTE dirty bit when handling an ATS translation with
    write permission request, even when PTE RW bit is clear. This may occur by
    direct translation (which would cause a PPR) or by prefetch request from
    the ATC.

    This is observed in practice when the IOMMU L2 modifies a PTE which maps a
    pagecache page. The ext4 filesystem driver BUGs when asked to writeback
    these (non-modified) pages.

    Enable ATS write permission check in the Kaveri IOMMU L2 if BIOS has not.

    Signed-off-by: Jay Cornwall
    Cc: # v3.19+
    Signed-off-by: Joerg Roedel

    Jay Cornwall
     
  • The setup code for the performance counters in the AMD IOMMU driver
    tests whether the counters can be written. It tests to setup a counter
    for device 00:00.0, which fails on systems where this particular device
    is not covered by the IOMMU.

    Fix this by not relying on device 00:00.0 but only on the IOMMU being
    present.

    Cc: stable@vger.kernel.org
    Signed-off-by: Suravee Suthikulpanit
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     

06 Nov, 2015

1 commit

  • Pull iommu updates from Joerg Roedel:
    "This time including:

    - A new IOMMU driver for s390 pci devices

    - Common dma-ops support based on iommu-api for ARM64. The plan is
    to use this as a basis for ARM32 and hopefully other architectures
    as well in the future.

    - MSI support for ARM-SMMUv3

    - Cleanups and dead code removal in the AMD IOMMU driver

    - Better RMRR handling for the Intel VT-d driver

    - Various other cleanups and small fixes"

    * tag 'iommu-updates-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (41 commits)
    iommu/vt-d: Fix return value check of parse_ioapics_under_ir()
    iommu/vt-d: Propagate error-value from ir_parse_ioapic_hpet_scope()
    iommu/vt-d: Adjust the return value of the parse_ioapics_under_ir
    iommu: Move default domain allocation to iommu_group_get_for_dev()
    iommu: Remove is_pci_dev() fall-back from iommu_group_get_for_dev
    iommu/arm-smmu: Switch to device_group call-back
    iommu/fsl: Convert to device_group call-back
    iommu: Add device_group call-back to x86 iommu drivers
    iommu: Add generic_device_group() function
    iommu: Export and rename iommu_group_get_for_pci_dev()
    iommu: Revive device_group iommu-ops call-back
    iommu/amd: Remove find_last_devid_on_pci()
    iommu/amd: Remove first/last_device handling
    iommu/amd: Initialize amd_iommu_last_bdf for DEV_ALL
    iommu/amd: Cleanup buffer allocation
    iommu/amd: Remove cmd_buf_size and evt_buf_size from struct amd_iommu
    iommu/amd: Align DTE flag definitions
    iommu/amd: Remove old alias handling code
    iommu/amd: Set alias DTE in do_attach/do_detach
    iommu/amd: WARN when __[attach|detach]_device are called with irqs enabled
    ...

    Linus Torvalds
     

05 Nov, 2015

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the "big" driver core updates for 4.4-rc1. Primarily a bunch
    of debugfs updates, with a smattering of minor driver core fixes and
    updates as well.

    All have been in linux-next for a long time"

    * tag 'driver-core-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    debugfs: Add debugfs_create_ulong()
    of: to support binding numa node to specified device in devicetree
    debugfs: Add read-only/write-only bool file ops
    debugfs: Add read-only/write-only size_t file ops
    debugfs: Add read-only/write-only x64 file ops
    debugfs: Consolidate file mode checks in debugfs_create_*()
    Revert "mm: Check if section present during memory block (un)registering"
    driver-core: platform: Provide helpers for multi-driver modules
    mm: Check if section present during memory block (un)registering
    devres: fix a for loop bounds check
    CMA: fix CONFIG_CMA_SIZE_MBYTES overflow in 64bit
    base/platform: assert that dev_pm_domain callbacks are called unconditionally
    sysfs: correctly handle short reads on PREALLOC attrs.
    base: soc: siplify ida usage
    kobject: move EXPORT_SYMBOL() macros next to corresponding definitions
    kobject: explain what kobject's sd field is
    debugfs: document that debugfs_remove*() accepts NULL and error values
    debugfs: Pass bool pointer to debugfs_create_bool()
    ACPI / EC: Fix broken 64bit big-endian users of 'global_lock'

    Linus Torvalds
     

02 Nov, 2015

1 commit


21 Oct, 2015

5 commits


09 Oct, 2015

1 commit

  • AMD IOMMU driver makes use of IOMMU PCI devices, so prevent binding other
    PCI drivers to IOMMU PCI devices.

    This fixes a bug reported by Boris that system suspend/resume gets broken
    on AMD platforms. For more information, please refer to:
    https://lkml.org/lkml/2015/9/26/89

    Fixes: 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()")
    Signed-off-by: Jiang Liu
    Cc: Borislav Petkov
    Signed-off-by: Joerg Roedel

    Jiang Liu
     

04 Oct, 2015

1 commit

  • Its a bit odd that debugfs_create_bool() takes 'u32 *' as an argument,
    when all it needs is a boolean pointer.

    It would be better to update this API to make it accept 'bool *'
    instead, as that will make it more consistent and often more convenient.
    Over that bool takes just a byte.

    That required updates to all user sites as well, in the same commit
    updating the API. regmap core was also using
    debugfs_{read|write}_file_bool(), directly and variable types were
    updated for that to be bool as well.

    Signed-off-by: Viresh Kumar
    Acked-by: Mark Brown
    Acked-by: Charles Keepax
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

29 Sep, 2015

1 commit

  • Remove unneeded NULL test.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@ expression x; @@
    -if (x != NULL) {
    \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
    x = NULL;
    -}
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Joerg Roedel

    Julia Lawall
     

24 Sep, 2015

1 commit

  • Fix amd_iommu_detect() to return positive value on success, like
    intended, and not zero. This will not change anything in the end
    as AMD IOMMU disable swiotlb and properly associate itself with
    devices even if detect() doesn't return a positive value.

    Signed-off-by: Jérôme Glisse
    Cc: Joerg Roedel
    Cc: iommu@lists.linux-foundation.org

    Jérôme Glisse
     

14 Aug, 2015

1 commit


30 Jul, 2015

1 commit


24 Jun, 2015

1 commit

  • Pull IOMMU updates from Joerg Roedel:
    "This time with bigger changes than usual:

    - A new IOMMU driver for the ARM SMMUv3.

    This IOMMU is pretty different from SMMUv1 and v2 in that it is
    configured through in-memory structures and not through the MMIO
    register region. The ARM SMMUv3 also supports IO demand paging for
    PCI devices with PRI/PASID capabilities, but this is not
    implemented in the driver yet.

    - Lots of cleanups and device-tree support for the Exynos IOMMU
    driver. This is part of the effort to bring Exynos DRM support
    upstream.

    - Introduction of default domains into the IOMMU core code.

    The rationale behind this is to move functionalily out of the IOMMU
    drivers to common code to get to a unified behavior between
    different drivers. The patches here introduce a default domain for
    iommu-groups (isolation groups).

    A device will now always be attached to a domain, either the
    default domain or another domain handled by the device driver. The
    IOMMU drivers have to be modified to make use of that feature. So
    long the AMD IOMMU driver is converted, with others to follow.

    - Patches for the Intel VT-d drvier to fix DMAR faults that happen
    when a kdump kernel boots.

    When the kdump kernel boots it re-initializes the IOMMU hardware,
    which destroys all mappings from the crashed kernel. As this
    happens before the endpoint devices are re-initialized, any
    in-flight DMA causes a DMAR fault. These faults cause PCI master
    aborts, which some devices can't handle properly and go into an
    undefined state, so that the device driver in the kdump kernel
    fails to initialize them and the dump fails.

    This is now fixed by copying over the mapping structures (only
    context tables and interrupt remapping tables) from the old kernel
    and keep the old mappings in place until the device driver of the
    new kernel takes over. This emulates the the behavior without an
    IOMMU to the best degree possible.

    - A couple of other small fixes and cleanups"

    * tag 'iommu-updates-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (69 commits)
    iommu/amd: Handle large pages correctly in free_pagetable
    iommu/vt-d: Don't disable IR when it was previously enabled
    iommu/vt-d: Make sure copied over IR entries are not reused
    iommu/vt-d: Copy IR table from old kernel when in kdump mode
    iommu/vt-d: Set IRTA in intel_setup_irq_remapping
    iommu/vt-d: Disable IRQ remapping in intel_prepare_irq_remapping
    iommu/vt-d: Move QI initializationt to intel_setup_irq_remapping
    iommu/vt-d: Move EIM detection to intel_prepare_irq_remapping
    iommu/vt-d: Enable Translation only if it was previously disabled
    iommu/vt-d: Don't disable translation prior to OS handover
    iommu/vt-d: Don't copy translation tables if RTT bit needs to be changed
    iommu/vt-d: Don't do early domain assignment if kdump kernel
    iommu/vt-d: Allocate si_domain in init_dmars()
    iommu/vt-d: Mark copied context entries
    iommu/vt-d: Do not re-use domain-ids from the old kernel
    iommu/vt-d: Copy translation tables from old kernel
    iommu/vt-d: Detect pre enabled translation
    iommu/vt-d: Make root entry visible for hardware right after allocation
    iommu/vt-d: Init QI before root entry is allocated
    iommu/vt-d: Cleanup log messages
    ...

    Linus Torvalds
     

11 Jun, 2015

2 commits


24 Apr, 2015

1 commit

  • Signed-off-by: Jiang Liu
    Acked-by: Joerg Roedel
    Cc: Konrad Rzeszutek Wilk
    Cc: David Cohen
    Cc: Sander Eikelenboom
    Cc: David Vrabel
    Cc: Tony Luck
    Cc: Greg Kroah-Hartman
    Cc: iommu@lists.linux-foundation.org
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Rafael J. Wysocki
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Dimitri Sivanich
    Cc: Joerg Roedel
    Link: http://lkml.kernel.org/r/1428905519-23704-12-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

13 Feb, 2015

1 commit

  • Pull IOMMU updates from Joerg Roedel:
    "This time with:

    - Generic page-table framework for ARM IOMMUs using the LPAE
    page-table format, ARM-SMMU and Renesas IPMMU make use of it
    already.

    - Break out the IO virtual address allocator from the Intel IOMMU so
    that it can be used by other DMA-API implementations too. The
    first user will be the ARM64 common DMA-API implementation for
    IOMMUs

    - Device tree support for Renesas IPMMU

    - Various fixes and cleanups all over the place"

    * tag 'iommu-updates-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (36 commits)
    iommu/amd: Convert non-returned local variable to boolean when relevant
    iommu: Update my email address
    iommu/amd: Use wait_event in put_pasid_state_wait
    iommu/amd: Fix amd_iommu_free_device()
    iommu/arm-smmu: Avoid build warning
    iommu/fsl: Various cleanups
    iommu/fsl: Use %pa to print phys_addr_t
    iommu/omap: Print phys_addr_t using %pa
    iommu: Make more drivers depend on COMPILE_TEST
    iommu/ipmmu-vmsa: Fix IOMMU lookup when multiple IOMMUs are registered
    iommu: Disable on !MMU builds
    iommu/fsl: Remove unused fsl_of_pamu_ids[]
    iommu/fsl: Fix section mismatch
    iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator
    iommu: Fix trace_map() to report original iova and original size
    iommu/arm-smmu: add support for iova_to_phys through ATS1PR
    iopoll: Introduce memory-mapped IO polling macros
    iommu/arm-smmu: don't touch the secure STLBIALL register
    iommu/arm-smmu: make use of generic LPAE allocator
    iommu: io-pgtable-arm: add non-secure quirk
    ...

    Linus Torvalds
     

04 Feb, 2015

1 commit


23 Jan, 2015

1 commit

  • Commit 7fa1c842caca "iommu/irq_remapping: Change variable
    disable_irq_remap to be static" returns unconditionally success from
    the irq remapping prepare callback if the iommu can be initialized.

    The change assumed that iommu_go_to_state(IOMMU_ACPI_FINISHED) returns
    a failure if irq remapping is not enabled, but thats not the case.

    The function returns success when the iommu is initialized to the
    point which is required for remapping to work. The actual state of the
    irq remapping feature is reflected in the status variable
    amd_iommu_irq_remap, which is not considered in the return value.

    The fix is simple: If the iommu_go_to_state() returns success,
    evaluate the remapping state amd_iommu_irq_remap and reflect it in the
    return value.

    Fixes: 7fa1c842caca iommu/irq_remapping: Change variable disable_irq_remap to be static
    Reported-and-tested-by: Borislav Petkov
    Signed-off-by: Thomas Gleixner
    Cc: Jiang Liu
    Cc: Joerg Roedel

    Thomas Gleixner
     

15 Jan, 2015

3 commits

  • Change variable disable_irq_remap to be static and simplify the code.

    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-16-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Simplify irq_remapping code by killing irq_remapping_supported() and
    related interfaces.

    Joerg posted a similar patch at https://lkml.org/lkml/2014/12/15/490,
    so assume an signed-off from Joerg.

    Signed-off-by: Jiang Liu
    Signed-off-by: Joerg Roedel
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-14-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • This allows to get rid of the irq_remapping_supported() function and
    all its call-backs into the Intel and AMD IOMMU drivers.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-13-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Joerg Roedel
     

26 Sep, 2014

1 commit


04 Jul, 2014

1 commit

  • AMD-Vi support for IOMMU sysfs. This allows us to associate devices
    with a specific IOMMU device and examine the capabilities and features
    of that IOMMU. The AMD IOMMU is hosted on and actual PCI device, so
    we make that device the parent for the IOMMU class device. This
    initial implementaiton exposes only the capability header and extended
    features register for the IOMMU.

    # find /sys | grep ivhd
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:00.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:02.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:04.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:09.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:11.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:12.0
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:12.2
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:13.0
    ...
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/power
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/power/control
    ...
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/device
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/subsystem
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu/cap
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu/features
    /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/uevent
    /sys/class/iommu/ivhd0

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

    Alex Williamson