20 Jan, 2021

3 commits

  • commit 2d6ffc63f12417b979955a5b22ad9a76d2af5de9 upstream.

    The VT-d hardware will ignore those Addr bits which have been masked by
    the AM field in the PASID-based-IOTLB invalidation descriptor. As the
    result, if the starting address in the descriptor is not aligned with
    the address mask, some IOTLB caches might not invalidate. Hence people
    will see below errors.

    [ 1093.704661] dmar_fault: 29 callbacks suppressed
    [ 1093.704664] DMAR: DRHD: handling fault status reg 3
    [ 1093.712738] DMAR: [DMA Read] Request device [7a:02.0] PASID 2
    fault addr 7f81c968d000 [fault reason 113]
    SM: Present bit in first-level paging entry is clear

    Fix this by using aligned address for PASID-based-IOTLB invalidation.

    Fixes: 1c4f88b7f1f9 ("iommu/vt-d: Shared virtual address in scalable mode")
    Reported-and-tested-by: Guo Kaijie
    Signed-off-by: Lu Baolu
    Link: https://lore.kernel.org/r/20201231005323.2178523-2-baolu.lu@linux.intel.com
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Lu Baolu
     
  • [ Upstream commit c062db039f40e868c371c36afe8d0fac64305b5d ]

    The iommu-dma constrains IOVA allocation based on the domain geometry
    that the driver reports. Update domain geometry everytime a domain is
    attached to or detached from a device.

    Signed-off-by: Lu Baolu
    Tested-by: Logan Gunthorpe
    Link: https://lore.kernel.org/r/20201124082057.2614359-6-baolu.lu@linux.intel.com
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin

    Lu Baolu
     
  • [ Upstream commit 420d42f6f9db27d88bc4f83e3e668fcdacbf7e29 ]

    Lock(&iommu->lock) without disabling irq causes lockdep warnings.

    ========================================================
    WARNING: possible irq lock inversion dependency detected
    5.11.0-rc1+ #828 Not tainted
    --------------------------------------------------------
    kworker/0:1H/120 just changed the state of lock:
    ffffffffad9ea1b8 (device_domain_lock){..-.}-{2:2}, at:
    iommu_flush_dev_iotlb.part.0+0x32/0x120
    but this lock took another, SOFTIRQ-unsafe lock in the past:
    (&iommu->lock){+.+.}-{2:2}

    and interrupts could create inverse lock ordering between them.

    other info that might help us debug this:
    Possible interrupt unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(&iommu->lock);
    local_irq_disable();
    lock(device_domain_lock);
    lock(&iommu->lock);

    lock(device_domain_lock);

    *** DEADLOCK ***

    Signed-off-by: Lu Baolu
    Link: https://lore.kernel.org/r/20201231005323.2178523-5-baolu.lu@linux.intel.com
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin

    Lu Baolu
     

17 Jan, 2021

3 commits

  • commit ff2b46d7cff80d27d82f7f3252711f4ca1666129 upstream.

    When irq_domain_get_irq_data() or irqd_cfg() fails
    at i == 0, data allocated by kzalloc() has not been
    freed before returning, which leads to memleak.

    Fixes: b106ee63abcc ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains")
    Signed-off-by: Dinghao Liu
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/20210105051837.32118-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Dinghao Liu
     
  • commit 1efd17e7acb6692bffc6c58718f41f27fdfd62f5 upstream.

    Use IS_ALIGNED() instead. Otherwise, an unaligned address will be ignored.

    Fixes: 33cd6e642d6a ("iommu/vt-d: Flush PASID-based iotlb for iova over first level")
    Signed-off-by: Lu Baolu
    Link: https://lore.kernel.org/r/20201231005323.2178523-1-baolu.lu@linux.intel.com
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Lu Baolu
     
  • [ Upstream commit aded8c7c2b72f846a07a2c736b8e75bb8cf50a87 ]

    On SM8150 it's occasionally observed that the boot hangs in between the
    writing of SMEs and context banks in arm_smmu_device_reset().

    The problem seems to coincide with a display refresh happening after
    updating the stream mapping, but before clearing - and there by
    disabling translation - the context bank picked to emulate translation
    bypass.

    Resolve this by explicitly disabling the bypass context already in
    cfg_probe.

    Fixes: f9081b8ff593 ("iommu/arm-smmu-qcom: Implement S2CR quirk")
    Signed-off-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20210106005038.4152731-1-bjorn.andersson@linaro.org
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin

    Bjorn Andersson
     

13 Jan, 2021

1 commit

  • commit 9ad9f45b3b91162b33abfe175ae75ab65718dbf5 upstream.

    'struct intel_svm' is shared by all devices bound to a give process,
    but records only a single pointer to a 'struct intel_iommu'. Consequently,
    cache invalidations may only be applied to a single DMAR unit, and are
    erroneously skipped for the other devices.

    In preparation for fixing this, rework the structures so that the iommu
    pointer resides in 'struct intel_svm_dev', allowing 'struct intel_svm'
    to track them in its device list.

    Fixes: 1c4f88b7f1f9 ("iommu/vt-d: Shared virtual address in scalable mode")
    Cc: Lu Baolu
    Cc: Jacob Pan
    Cc: Raj Ashok
    Cc: David Woodhouse
    Reported-by: Guo Kaijie
    Reported-by: Xin Zeng
    Signed-off-by: Guo Kaijie
    Signed-off-by: Xin Zeng
    Signed-off-by: Liu Yi L
    Tested-by: Guo Kaijie
    Cc: stable@vger.kernel.org # v5.0+
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/1609949037-25291-2-git-send-email-yi.l.liu@intel.com
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Liu Yi L
     

30 Dec, 2020

4 commits

  • commit f9081b8ff5934b8d69c748d0200e844cadd2c667 upstream.

    The firmware found in some Qualcomm platforms intercepts writes to S2CR
    in order to replace bypass type streams with fault; and ignore S2CR
    updates of type fault.

    Detect this behavior and implement a custom write_s2cr function in order
    to trick the firmware into supporting bypass streams by the means of
    configuring the stream for translation using a reserved and disabled
    context bank.

    Also circumvent the problem of configuring faulting streams by
    configuring the stream as bypass.

    Cc:
    Signed-off-by: Bjorn Andersson
    Tested-by: Steev Klimaszewski
    Acked-by: Robin Murphy
    Link: https://lore.kernel.org/r/20201019182323.3162386-4-bjorn.andersson@linaro.org
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     
  • commit 07a7f2caaa5a2619934491bab3c47b261c554fb0 upstream.

    The Qualcomm boot loader configures stream mapping for the peripherals
    that it accesses and in particular it sets up the stream mapping for the
    display controller to be allowed to scan out a splash screen or EFI
    framebuffer.

    Read back the stream mappings during initialization and make the
    arm-smmu driver maintain the streams in bypass mode.

    Cc:
    Signed-off-by: Bjorn Andersson
    Tested-by: Steev Klimaszewski
    Acked-by: Robin Murphy
    Link: https://lore.kernel.org/r/20201019182323.3162386-3-bjorn.andersson@linaro.org
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     
  • commit 56b75b51ed6d5e7bffda59440404409bca2dff00 upstream.

    The firmware found in some Qualcomm platforms intercepts writes to the
    S2CR register in order to replace the BYPASS type with FAULT. Further
    more it treats faults at this level as catastrophic and restarts the
    device.

    Add support for providing implementation specific versions of the S2CR
    write function, to allow the Qualcomm driver to work around this
    behavior.

    Cc:
    Signed-off-by: Bjorn Andersson
    Tested-by: Steev Klimaszewski
    Reviewed-by: Robin Murphy
    Link: https://lore.kernel.org/r/20201019182323.3162386-2-bjorn.andersson@linaro.org
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     
  • [ Upstream commit 68dd9d89eaf56dfab8d46bf25610aa4650247617 ]

    Commit 6ee1b77ba3ac ("iommu/vt-d: Add svm/sva invalidate function")
    introduced intel_iommu_sva_invalidate() when CONFIG_INTEL_IOMMU_SVM.
    This function uses the dedicated static variable inv_type_granu_table
    and functions to_vtd_granularity() and to_vtd_size().

    These parts are unused when !CONFIG_INTEL_IOMMU_SVM, and hence,
    make CC=clang W=1 warns with an -Wunused-function warning.

    Include these parts conditionally on CONFIG_INTEL_IOMMU_SVM.

    Fixes: 6ee1b77ba3ac ("iommu/vt-d: Add svm/sva invalidate function")
    Signed-off-by: Lukas Bulwahn
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/20201115205951.20698-1-lukas.bulwahn@gmail.com
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin

    Lukas Bulwahn
     

10 Dec, 2020

1 commit


07 Dec, 2020

1 commit

  • According to the AMD IOMMU spec, the commit 73db2fc595f3
    ("iommu/amd: Increase interrupt remapping table limit to 512 entries")
    also requires the interrupt table length (IntTabLen) to be set to 9
    (power of 2) in the device table mapping entry (DTE).

    Fixes: 73db2fc595f3 ("iommu/amd: Increase interrupt remapping table limit to 512 entries")
    Reported-by: Jerry Snitselaar
    Signed-off-by: Suravee Suthikulpanit
    Reviewed-by: Jerry Snitselaar
    Link: https://lore.kernel.org/r/20201207091920.3052-1-suravee.suthikulpanit@amd.com
    Signed-off-by: Will Deacon

    Suravee Suthikulpanit
     

28 Nov, 2020

1 commit

  • Pull iommu fixes from Will Deacon:
    "Here's another round of IOMMU fixes for -rc6 consisting mainly of a
    bunch of independent driver fixes. Thomas agreed for me to take the
    x86 'tboot' fix here, as it fixes a regression introduced by a vt-d
    change.

    - Fix intel iommu driver when running on devices without VCCAP_REG

    - Fix swiotlb and "iommu=pt" interaction under TXT (tboot)

    - Fix missing return value check during device probe()

    - Fix probe ordering for Qualcomm SMMU implementation

    - Ensure page-sized mappings are used for AMD IOMMU buffers with SNP
    RMP"

    * tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    iommu/vt-d: Don't read VCCAP register unless it exists
    x86/tboot: Don't disable swiotlb when iommu is forced on
    iommu: Check return of __iommu_attach_device()
    arm-smmu-qcom: Ensure the qcom_scm driver has finished probing
    iommu/amd: Enforce 4k mapping for certain IOMMU data structures

    Linus Torvalds
     

26 Nov, 2020

1 commit

  • My virtual IOMMU implementation is whining that the guest is reading a
    register that doesn't exist. Only read the VCCAP_REG if the corresponding
    capability is set in ECAP_REG to indicate that it actually exists.

    Fixes: 3375303e8287 ("iommu/vt-d: Add custom allocator for IOASID")
    Signed-off-by: David Woodhouse
    Reviewed-by: Liu Yi L
    Cc: stable@vger.kernel.org # v5.7+
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/de32b150ffaa752e0cff8571b17dfb1213fbe71c.camel@infradead.org
    Signed-off-by: Will Deacon

    David Woodhouse
     

23 Nov, 2020

3 commits

  • Currently iommu_create_device_direct_mappings() is called
    without checking the return of __iommu_attach_device(). This
    may result in failures in iommu driver if dev attach returns
    error.

    Fixes: ce574c27ae27 ("iommu: Move iommu_group_create_direct_mappings() out of iommu_group_add_device()")
    Signed-off-by: Shameer Kolothum
    Link: https://lore.kernel.org/r/20201119165846.34180-1-shameerali.kolothum.thodi@huawei.com
    Signed-off-by: Will Deacon

    Shameer Kolothum
     
  • Robin Murphy pointed out that if the arm-smmu driver probes before
    the qcom_scm driver, we may call qcom_scm_qsmmu500_wait_safe_toggle()
    before the __scm is initialized.

    Now, getting this to happen is a bit contrived, as in my efforts it
    required enabling asynchronous probing for both drivers, moving the
    firmware dts node to the end of the dtsi file, as well as forcing a
    long delay in the qcom_scm_probe function.

    With those tweaks we ran into the following crash:
    [ 2.631040] arm-smmu 15000000.iommu: Stage-1: 48-bit VA -> 48-bit IPA
    [ 2.633372] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    ...
    [ 2.633402] [0000000000000000] user address but active_mm is swapper
    [ 2.633409] Internal error: Oops: 96000005 [#1] PREEMPT SMP
    [ 2.633415] Modules linked in:
    [ 2.633427] CPU: 5 PID: 117 Comm: kworker/u16:2 Tainted: G W 5.10.0-rc1-mainline-00025-g272a618fc36-dirty #3971
    [ 2.633430] Hardware name: Thundercomm Dragonboard 845c (DT)
    [ 2.633448] Workqueue: events_unbound async_run_entry_fn
    [ 2.633456] pstate: 80c00005 (Nzcv daif +PAN +UAO -TCO BTYPE=--)
    [ 2.633465] pc : qcom_scm_qsmmu500_wait_safe_toggle+0x78/0xb0
    [ 2.633473] lr : qcom_smmu500_reset+0x58/0x78
    [ 2.633476] sp : ffffffc0105a3b60
    ...
    [ 2.633567] Call trace:
    [ 2.633572] qcom_scm_qsmmu500_wait_safe_toggle+0x78/0xb0
    [ 2.633576] qcom_smmu500_reset+0x58/0x78
    [ 2.633581] arm_smmu_device_reset+0x194/0x270
    [ 2.633585] arm_smmu_device_probe+0xc94/0xeb8
    [ 2.633592] platform_drv_probe+0x58/0xa8
    [ 2.633597] really_probe+0xec/0x398
    [ 2.633601] driver_probe_device+0x5c/0xb8
    [ 2.633606] __driver_attach_async_helper+0x64/0x88
    [ 2.633610] async_run_entry_fn+0x4c/0x118
    [ 2.633617] process_one_work+0x20c/0x4b0
    [ 2.633621] worker_thread+0x48/0x460
    [ 2.633628] kthread+0x14c/0x158
    [ 2.633634] ret_from_fork+0x10/0x18
    [ 2.633642] Code: a9034fa0 d0007f73 29107fa0 91342273 (f9400020)

    To avoid this, this patch adds a check on qcom_scm_is_available() in
    the qcom_smmu_impl_init() function, returning -EPROBE_DEFER if its
    not ready.

    This allows the driver to try to probe again later after qcom_scm has
    finished probing.

    Reported-by: Robin Murphy
    Signed-off-by: John Stultz
    Reviewed-by: Robin Murphy
    Cc: Robin Murphy
    Cc: Will Deacon
    Cc: Andy Gross
    Cc: Maulik Shah
    Cc: Bjorn Andersson
    Cc: Saravana Kannan
    Cc: Marc Zyngier
    Cc: Lina Iyer
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-arm-msm
    Link: https://lore.kernel.org/r/20201112220520.48159-1-john.stultz@linaro.org
    Signed-off-by: Will Deacon

    John Stultz
     
  • AMD IOMMU requires 4k-aligned pages for the event log, the PPR log,
    and the completion wait write-back regions. However, when allocating
    the pages, they could be part of large mapping (e.g. 2M) page.
    This causes #PF due to the SNP RMP hardware enforces the check based
    on the page level for these data structures.

    So, fix by calling set_memory_4k() on the allocated pages.

    Fixes: c69d89aff393 ("iommu/amd: Use 4K page for completion wait write-back semaphore")
    Signed-off-by: Suravee Suthikulpanit
    Cc: Brijesh Singh
    Link: https://lore.kernel.org/r/20201105145832.3065-1-suravee.suthikulpanit@amd.com
    Signed-off-by: Will Deacon

    Suravee Suthikulpanit
     

21 Nov, 2020

1 commit

  • Pull iommu fixes from Will Deacon:
    "Two straightforward vt-d fixes:

    - Fix boot when intel iommu initialisation fails under TXT (tboot)

    - Fix intel iommu compilation error when DMAR is enabled without ATS

    and temporarily update IOMMU MAINTAINERs entry"

    * tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    MAINTAINERS: Temporarily add myself to the IOMMU entry
    iommu/vt-d: Fix compile error with CONFIG_PCI_ATS not set
    iommu/vt-d: Avoid panic if iommu init fails in tboot system

    Linus Torvalds
     

19 Nov, 2020

2 commits

  • Fix the compile error below (CONFIG_PCI_ATS not set):

    drivers/iommu/intel/dmar.c: In function ‘vf_inherit_msi_domain’:
    drivers/iommu/intel/dmar.c:338:59: error: ‘struct pci_dev’ has no member named ‘physfn’; did you mean ‘is_physfn’?
    338 | dev_set_msi_domain(&pdev->dev, dev_get_msi_domain(&pdev->physfn->dev));
    | ^~~~~~
    | is_physfn

    Fixes: ff828729be44 ("iommu/vt-d: Cure VF irqdomain hickup")
    Reported-by: Geert Uytterhoeven
    Signed-off-by: Lu Baolu
    Cc: Thomas Gleixner
    Link: https://lore.kernel.org/linux-iommu/CAMuHMdXA7wfJovmfSH2nbAhN0cPyCiFHodTvg4a8Hm9rx5Dj-w@mail.gmail.com/
    Link: https://lore.kernel.org/r/20201119055119.2862701-1-baolu.lu@linux.intel.com
    Signed-off-by: Will Deacon

    Lu Baolu
     
  • …it/tip/tip into for-next/iommu/fixes

    Pull in x86 fixes from Thomas, as they include a change to the Intel DMAR
    code on which we depend:

    * tag 'x86-urgent-2020-11-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    iommu/vt-d: Cure VF irqdomain hickup
    x86/platform/uv: Fix copied UV5 output archtype
    x86/platform/uv: Drop last traces of uv_flush_tlb_others

    Will Deacon
     

18 Nov, 2020

1 commit

  • "intel_iommu=off" command line is used to disable iommu but iommu is force
    enabled in a tboot system for security reason.

    However for better performance on high speed network device, a new option
    "intel_iommu=tboot_noforce" is introduced to disable the force on.

    By default kernel should panic if iommu init fail in tboot for security
    reason, but it's unnecessory if we use "intel_iommu=tboot_noforce,off".

    Fix the code setting force_on and move intel_iommu_tboot_noforce
    from tboot code to intel iommu code.

    Fixes: 7304e8f28bb2 ("iommu/vt-d: Correctly disable Intel IOMMU force on")
    Signed-off-by: Zhenzhong Duan
    Tested-by: Lukasz Hawrylko
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/20201110071908.3133-1-zhenzhong.duan@gmail.com
    Signed-off-by: Will Deacon

    Zhenzhong Duan
     

16 Nov, 2020

1 commit

  • Pull x86 fixes from Thomas Gleixner:
    "A small set of fixes for x86:

    - Cure the fallout from the MSI irqdomain overhaul which missed that
    the Intel IOMMU does not register virtual function devices and
    therefore never reaches the point where the MSI interrupt domain is
    assigned. This made the VF devices use the non-remapped MSI domain
    which is trapped by the IOMMU/remap unit

    - Remove an extra space in the SGI_UV architecture type procfs output
    for UV5

    - Remove a unused function which was missed when removing the UV BAU
    TLB shootdown handler"

    * tag 'x86-urgent-2020-11-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    iommu/vt-d: Cure VF irqdomain hickup
    x86/platform/uv: Fix copied UV5 output archtype
    x86/platform/uv: Drop last traces of uv_flush_tlb_others

    Linus Torvalds
     

13 Nov, 2020

1 commit

  • The recent changes to store the MSI irqdomain pointer in struct device
    missed that Intel DMAR does not register virtual function devices. Due to
    that a VF device gets the plain PCI-MSI domain assigned and then issues
    compat MSI messages which get caught by the interrupt remapping unit.

    Cure that by inheriting the irq domain from the physical function
    device.

    Ideally the irqdomain would be associated to the bus, but DMAR can have
    multiple units and therefore irqdomains on a single bus. The VF 'bus' could
    of course inherit the domain from the PF, but that'd be yet another x86
    oddity.

    Fixes: 85a8dfc57a0b ("iommm/vt-d: Store irq domain in struct device")
    Reported-by: Jason Gunthorpe
    Signed-off-by: Thomas Gleixner
    Acked-by: Lu Baolu
    Cc: Joerg Roedel
    Cc: Bjorn Helgaas
    Cc: Marc Zyngier
    Cc: David Woodhouse
    Link: https://lore.kernel.org/r/draft-87eekymlpz.fsf@nanos.tec.linutronix.de

    Thomas Gleixner
     

12 Nov, 2020

1 commit


03 Nov, 2020

5 commits

  • The "data->flags" variable is a u64 so if one of the high 32 bits is
    set the original code will allow it, but it should be rejected. The
    fix is to declare "mask" as a u64 instead of a u32.

    Fixes: d90573812eea ("iommu/uapi: Handle data and argsz filled by users")
    Signed-off-by: Dan Carpenter
    Link: https://lore.kernel.org/r/20201103101623.GA1127762@mwanda
    Signed-off-by: Joerg Roedel

    Dan Carpenter
     
  • In prq_event_thread(), the QI_PGRP_PDP is wrongly set by
    'req->pasid_present' which should be replaced to
    'req->priv_data_present'.

    Fixes: 5b438f4ba315 ("iommu/vt-d: Support page request in scalable mode")
    Signed-off-by: Liu, Yi L
    Signed-off-by: Yi Sun
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/1604025444-6954-3-git-send-email-yi.y.sun@linux.intel.com
    Signed-off-by: Joerg Roedel

    Liu, Yi L
     
  • Should get correct sid and set it into sdev. Because we execute
    'sdev->sid != req->rid' in the loop of prq_event_thread().

    Fixes: eb8d93ea3c1d ("iommu/vt-d: Report page request faults for guest SVA")
    Signed-off-by: Liu Yi L
    Signed-off-by: Yi Sun
    Acked-by: Lu Baolu
    Link: https://lore.kernel.org/r/1604025444-6954-2-git-send-email-yi.y.sun@linux.intel.com
    Signed-off-by: Joerg Roedel

    Liu Yi L
     
  • If calling find_domain() for a device which hasn't been probed by the
    iommu core, below kernel NULL pointer dereference issue happens.

    [ 362.736947] BUG: kernel NULL pointer dereference, address: 0000000000000038
    [ 362.743953] #PF: supervisor read access in kernel mode
    [ 362.749115] #PF: error_code(0x0000) - not-present page
    [ 362.754278] PGD 0 P4D 0
    [ 362.756843] Oops: 0000 [#1] SMP NOPTI
    [ 362.760528] CPU: 0 PID: 844 Comm: cat Not tainted 5.9.0-rc4-intel-next+ #1
    [ 362.767428] Hardware name: Intel Corporation Ice Lake Client Platform/IceLake
    U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3384.A02.1909200816
    09/20/2019
    [ 362.781109] RIP: 0010:find_domain+0xd/0x40
    [ 362.785234] Code: 48 81 fb 60 28 d9 b2 75 de 5b 41 5c 41 5d 5d c3 0f 1f 00 66
    2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 87 e0 02 00
    00 55 8b 40 38 48 89 e5 48 83 f8 fe 0f 94 c1 48 85 ff
    0f 94 c2 08 d1
    [ 362.804041] RSP: 0018:ffffb09cc1f0bd38 EFLAGS: 00010046
    [ 362.809292] RAX: 0000000000000000 RBX: ffff905b98e4fac8 RCX: 0000000000000000
    [ 362.816452] RDX: 0000000000000001 RSI: ffff905b98e4fac8 RDI: ffff905b9ccd40d0
    [ 362.823617] RBP: ffffb09cc1f0bda0 R08: ffffb09cc1f0bd48 R09: 000000000000000f
    [ 362.830778] R10: ffffffffb266c080 R11: ffff905b9042602d R12: ffff905b98e4fac8
    [ 362.837944] R13: ffffb09cc1f0bd48 R14: ffff905b9ccd40d0 R15: ffff905b98e4fac8
    [ 362.845108] FS: 00007f8485460740(0000) GS:ffff905b9fc00000(0000)
    knlGS:0000000000000000
    [ 362.853227] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 362.858996] CR2: 0000000000000038 CR3: 00000004627a6003 CR4: 0000000000770ef0
    [ 362.866161] PKRU: fffffffc
    [ 362.868890] Call Trace:
    [ 362.871363] ? show_device_domain_translation+0x32/0x100
    [ 362.876700] ? bind_store+0x110/0x110
    [ 362.880387] ? klist_next+0x91/0x120
    [ 362.883987] ? domain_translation_struct_show+0x50/0x50
    [ 362.889237] bus_for_each_dev+0x79/0xc0
    [ 362.893121] domain_translation_struct_show+0x36/0x50
    [ 362.898204] seq_read+0x135/0x410
    [ 362.901545] ? handle_mm_fault+0xeb8/0x1750
    [ 362.905755] full_proxy_read+0x5c/0x90
    [ 362.909526] vfs_read+0xa6/0x190
    [ 362.912782] ksys_read+0x61/0xe0
    [ 362.916037] __x64_sys_read+0x1a/0x20
    [ 362.919725] do_syscall_64+0x37/0x80
    [ 362.923329] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 362.928405] RIP: 0033:0x7f84855c5e95

    Filter out those devices to avoid such error.

    Fixes: e2726daea583d ("iommu/vt-d: debugfs: Add support to show page table internals")
    Reported-and-tested-by: Xu Pengfei
    Signed-off-by: Lu Baolu
    Cc: stable@vger.kernel.org#v5.6+
    Link: https://lore.kernel.org/r/20201028070725.24979-1-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel

    Lu Baolu
     
  • Certain device drivers allocate IO queues on a per-cpu basis.
    On AMD EPYC platform, which can support up-to 256 cpu threads,
    this can exceed the current MAX_IRQ_PER_TABLE limit of 256,
    and result in the error message:

    AMD-Vi: Failed to allocate IRTE

    This has been observed with certain NVME devices.

    AMD IOMMU hardware can actually support upto 512 interrupt
    remapping table entries. Therefore, update the driver to
    match the hardware limit.

    Please note that this also increases the size of interrupt remapping
    table to 8KB per device when using the 128-bit IRTE format.

    Signed-off-by: Suravee Suthikulpanit
    Link: https://lore.kernel.org/r/20201015025002.87997-1-suravee.suthikulpanit@amd.com
    Signed-off-by: Joerg Roedel

    Suravee Suthikulpanit
     

02 Nov, 2020

1 commit

  • The tbl_dma_addr argument is used to check the DMA boundary for the
    allocations, and thus needs to be a dma_addr_t. swiotlb-xen instead
    passed a physical address, which could lead to incorrect results for
    strange offsets. Fix this by removing the parameter entirely and hard
    code the DMA address for io_tlb_start instead.

    Fixes: 91ffe4ad534a ("swiotlb-xen: introduce phys_to_dma/dma_to_phys translations")
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Christoph Hellwig
     

21 Oct, 2020

1 commit


19 Oct, 2020

1 commit

  • Since commit c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units
    with no supported address widths") dmar.c needs struct iommu_device to
    be selected. We can drop this dependency by not dereferencing struct
    iommu_device if IOMMU_API is not selected and by reusing the information
    stored in iommu->drhd->ignored instead.

    This fixes the following build error when IOMMU_API is not selected:

    drivers/iommu/intel/dmar.c: In function ‘free_iommu’:
    drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’
    1139 | if (intel_iommu_enabled && iommu->iommu.ops) {
    ^

    Fixes: c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")
    Signed-off-by: Bartosz Golaszewski
    Acked-by: Lu Baolu
    Acked-by: David Woodhouse
    Link: https://lore.kernel.org/r/20201013073055.11262-1-brgl@bgdev.pl
    Signed-off-by: Joerg Roedel

    Bartosz Golaszewski
     

16 Oct, 2020

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - rework the non-coherent DMA allocator

    - move private definitions out of

    - lower CMA_ALIGNMENT (Paul Cercueil)

    - remove the omap1 dma address translation in favor of the common code

    - make dma-direct aware of multiple dma offset ranges (Jim Quinlan)

    - support per-node DMA CMA areas (Barry Song)

    - increase the default seg boundary limit (Nicolin Chen)

    - misc fixes (Robin Murphy, Thomas Tai, Xu Wang)

    - various cleanups

    * tag 'dma-mapping-5.10' of git://git.infradead.org/users/hch/dma-mapping: (63 commits)
    ARM/ixp4xx: add a missing include of dma-map-ops.h
    dma-direct: simplify the DMA_ATTR_NO_KERNEL_MAPPING handling
    dma-direct: factor out a dma_direct_alloc_from_pool helper
    dma-direct check for highmem pages in dma_direct_alloc_pages
    dma-mapping: merge into
    dma-mapping: move large parts of to kernel/dma
    dma-mapping: move dma-debug.h to kernel/dma/
    dma-mapping: remove
    dma-mapping: merge into
    dma-contiguous: remove dma_contiguous_set_default
    dma-contiguous: remove dev_set_cma_area
    dma-contiguous: remove dma_declare_contiguous
    dma-mapping: split
    cma: decrease CMA_ALIGNMENT lower limit to 2
    firewire-ohci: use dma_alloc_pages
    dma-iommu: implement ->alloc_noncoherent
    dma-mapping: add new {alloc,free}_noncoherent dma_map_ops methods
    dma-mapping: add a new dma_alloc_pages API
    dma-mapping: remove dma_cache_sync
    53c700: convert to dma_alloc_noncoherent
    ...

    Linus Torvalds
     

15 Oct, 2020

2 commits

  • Pull iommu updates from Joerg Roedel:

    - ARM-SMMU Updates from Will:

    - Continued SVM enablement, where page-table is shared with CPU

    - Groundwork to support integrated SMMU with Adreno GPU

    - Allow disabling of MSI-based polling on the kernel command-line

    - Minor driver fixes and cleanups (octal permissions, error
    messages, ...)

    - Secure Nested Paging Support for AMD IOMMU. The IOMMU will fault when
    a device tries DMA on memory owned by a guest. This needs new
    fault-types as well as a rewrite of the IOMMU memory semaphore for
    command completions.

    - Allow broken Intel IOMMUs (wrong address widths reported) to still be
    used for interrupt remapping.

    - IOMMU UAPI updates for supporting vSVA, where the IOMMU can access
    address spaces of processes running in a VM.

    - Support for the MT8167 IOMMU in the Mediatek IOMMU driver.

    - Device-tree updates for the Renesas driver to support r8a7742.

    - Several smaller fixes and cleanups all over the place.

    * tag 'iommu-updates-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (57 commits)
    iommu/vt-d: Gracefully handle DMAR units with no supported address widths
    iommu/vt-d: Check UAPI data processed by IOMMU core
    iommu/uapi: Handle data and argsz filled by users
    iommu/uapi: Rename uapi functions
    iommu/uapi: Use named union for user data
    iommu/uapi: Add argsz for user filled data
    docs: IOMMU user API
    iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
    iommu/arm-smmu-v3: Add SVA device feature
    iommu/arm-smmu-v3: Check for SVA features
    iommu/arm-smmu-v3: Seize private ASID
    iommu/arm-smmu-v3: Share process page tables
    iommu/arm-smmu-v3: Move definitions to a header
    iommu/io-pgtable-arm: Move some definitions to a header
    iommu/arm-smmu-v3: Ensure queue is read after updating prod pointer
    iommu/amd: Re-purpose Exclusion range registers to support SNP CWWB
    iommu/amd: Add support for RMP_PAGE_FAULT and RMP_HW_ERR
    iommu/amd: Use 4K page for completion wait write-back semaphore
    iommu/tegra-smmu: Allow to group clients in same swgroup
    iommu/tegra-smmu: Fix iova->phys translation
    ...

    Linus Torvalds
     
  • Pull ACPI updates from Rafael Wysocki:
    "These add support for generic initiator-only proximity domains to the
    ACPI NUMA code and the architectures using it, clean up some
    non-ACPICA code referring to debug facilities from ACPICA, reduce the
    overhead related to accessing GPE registers, add a new DPTF (Dynamic
    Power and Thermal Framework) participant driver, update the ACPICA
    code in the kernel to upstream revision 20200925, add a new ACPI
    backlight whitelist entry, fix a few assorted issues and clean up some
    code.

    Specifics:

    - Add support for generic initiator-only proximity domains to the
    ACPI NUMA code and the architectures using it (Jonathan Cameron)

    - Clean up some non-ACPICA code referring to debug facilities from
    ACPICA that are not actually used in there (Hanjun Guo)

    - Add new DPTF driver for the PCH FIVR participant (Srinivas
    Pandruvada)

    - Reduce overhead related to accessing GPE registers in ACPICA and
    the OS interface layer and make it possible to access GPE registers
    using logical addresses if they are memory-mapped (Rafael Wysocki)

    - Update the ACPICA code in the kernel to upstream revision 20200925
    including changes as follows:
    + Add predefined names from the SMBus sepcification (Bob Moore)
    + Update acpi_help UUID list (Bob Moore)
    + Return exceptions for string-to-integer conversions in iASL (Bob
    Moore)
    + Add a new "ALL " debugger command (Bob Moore)
    + Add support for 64 bit risc-v compilation (Colin Ian King)
    + Do assorted cleanups (Bob Moore, Colin Ian King, Randy Dunlap)

    - Add new ACPI backlight whitelist entry for HP 635 Notebook (Alex
    Hung)

    - Move TPS68470 OpRegion driver to drivers/acpi/pmic/ and split out
    Kconfig and Makefile specific for ACPI PMIC (Andy Shevchenko)

    - Clean up the ACPI SoC driver for AMD SoCs (Hanjun Guo)

    - Add missing config_item_put() to fix refcount leak (Hanjun Guo)

    - Drop lefrover field from struct acpi_memory_device (Hanjun Guo)

    - Make the ACPI extlog driver check for RDMSR failures (Ben
    Hutchings)

    - Fix handling of lid state changes in the ACPI button driver when
    input device is closed (Dmitry Torokhov)

    - Fix several assorted build issues (Barnabás Pőcze, John Garry,
    Nathan Chancellor, Tian Tao)

    - Drop unused inline functions and reduce code duplication by using
    kobj_to_dev() in the NFIT parsing code (YueHaibing, Wang Qing)

    - Serialize tools/power/acpi Makefile (Thomas Renninger)"

    * tag 'acpi-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (64 commits)
    ACPICA: Update version to 20200925 Version 20200925
    ACPICA: Remove unnecessary semicolon
    ACPICA: Debugger: Add a new command: "ALL "
    ACPICA: iASL: Return exceptions for string-to-integer conversions
    ACPICA: acpi_help: Update UUID list
    ACPICA: Add predefined names found in the SMBus sepcification
    ACPICA: Tree-wide: fix various typos and spelling mistakes
    ACPICA: Drop the repeated word "an" in a comment
    ACPICA: Add support for 64 bit risc-v compilation
    ACPI: button: fix handling lid state changes when input device closed
    tools/power/acpi: Serialize Makefile
    ACPI: scan: Replace ACPI_DEBUG_PRINT() with pr_debug()
    ACPI: memhotplug: Remove 'state' from struct acpi_memory_device
    ACPI / extlog: Check for RDMSR failure
    ACPI: Make acpi_evaluate_dsm() prototype consistent
    docs: mm: numaperf.rst Add brief description for access class 1.
    node: Add access1 class to represent CPU to memory characteristics
    ACPI: HMAT: Fix handling of changes from ACPI 6.2 to ACPI 6.3
    ACPI: Let ACPI know we support Generic Initiator Affinity Structures
    x86: Support Generic Initiator only proximity domains
    ...

    Linus Torvalds
     

13 Oct, 2020

3 commits

  • * acpi-numa:
    docs: mm: numaperf.rst Add brief description for access class 1.
    node: Add access1 class to represent CPU to memory characteristics
    ACPI: HMAT: Fix handling of changes from ACPI 6.2 to ACPI 6.3
    ACPI: Let ACPI know we support Generic Initiator Affinity Structures
    x86: Support Generic Initiator only proximity domains
    ACPI: Support Generic Initiator only domains
    ACPI / NUMA: Add stub function for pxm_to_node()
    irq-chip/gic-v3-its: Fix crash if ITS is in a proximity domain without processor or memory
    ACPI: Remove side effect of partly creating a node in acpi_get_node()
    ACPI: Rename acpi_map_pxm_to_online_node() to pxm_to_online_node()
    ACPI: Remove side effect of partly creating a node in acpi_map_pxm_to_online_node()
    ACPI: Do not create new NUMA domains from ACPI static tables that are not SRAT
    ACPI: Add out of bounds and numa_off protections to pxm_to_node()

    Rafael J. Wysocki
     
  • Pull x86 irq updates from Thomas Gleixner:
    "Surgery of the MSI interrupt handling to prepare the support of
    upcoming devices which require non-PCI based MSI handling:

    - Cleanup historical leftovers all over the place

    - Rework the code to utilize more core functionality

    - Wrap XEN PCI/MSI interrupts into an irqdomain to make irqdomain
    assignment to PCI devices possible.

    - Assign irqdomains to PCI devices at initialization time which
    allows to utilize the full functionality of hierarchical
    irqdomains.

    - Remove arch_.*_msi_irq() functions from X86 and utilize the
    irqdomain which is assigned to the device for interrupt management.

    - Make the arch_.*_msi_irq() support conditional on a config switch
    and let the last few users select it"

    * tag 'x86-irq-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (40 commits)
    PCI: MSI: Fix Kconfig dependencies for PCI_MSI_ARCH_FALLBACKS
    x86/apic/msi: Unbreak DMAR and HPET MSI
    iommu/amd: Remove domain search for PCI/MSI
    iommu/vt-d: Remove domain search for PCI/MSI[X]
    x86/irq: Make most MSI ops XEN private
    x86/irq: Cleanup the arch_*_msi_irqs() leftovers
    PCI/MSI: Make arch_.*_msi_irq[s] fallbacks selectable
    x86/pci: Set default irq domain in pcibios_add_device()
    iommm/amd: Store irq domain in struct device
    iommm/vt-d: Store irq domain in struct device
    x86/xen: Wrap XEN MSI management into irqdomain
    irqdomain/msi: Allow to override msi_domain_alloc/free_irqs()
    x86/xen: Consolidate XEN-MSI init
    x86/xen: Rework MSI teardown
    x86/xen: Make xen_msi_init() static and rename it to xen_hvm_msi_init()
    PCI/MSI: Provide pci_dev_has_special_msi_domain() helper
    PCI_vmd_Mark_VMD_irqdomain_with_DOMAIN_BUS_VMD_MSI
    irqdomain/msi: Provide DOMAIN_BUS_VMD_MSI
    x86/irq: Initialize PCI/MSI domain at PCI init time
    x86/pci: Reducde #ifdeffery in PCI init code
    ...

    Linus Torvalds
     
  • Pull x86 PASID updates from Borislav Petkov:
    "Initial support for sharing virtual addresses between the CPU and
    devices which doesn't need pinning of pages for DMA anymore.

    Add support for the command submission to devices using new x86
    instructions like ENQCMD{,S} and MOVDIR64B. In addition, add support
    for process address space identifiers (PASIDs) which are referenced by
    those command submission instructions along with the handling of the
    PASID state on context switch as another extended state.

    Work by Fenghua Yu, Ashok Raj, Yu-cheng Yu and Dave Jiang"

    * tag 'x86_pasid_for_5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/asm: Add an enqcmds() wrapper for the ENQCMDS instruction
    x86/asm: Carve out a generic movdir64b() helper for general usage
    x86/mmu: Allocate/free a PASID
    x86/cpufeatures: Mark ENQCMD as disabled when configured out
    mm: Add a pasid member to struct mm_struct
    x86/msr-index: Define an IA32_PASID MSR
    x86/fpu/xstate: Add supervisor PASID state for ENQCMD
    x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions
    Documentation/x86: Add documentation for SVA (Shared Virtual Addressing)
    iommu/vt-d: Change flags type to unsigned int in binding mm
    drm, iommu: Change type of pasid to u32

    Linus Torvalds
     

07 Oct, 2020

1 commit