1. 10 Jul, 2024 1 commit
    • Jason Gunthorpe's avatar
      iommufd: Require drivers to supply the cache_invalidate_user ops · a11dda72
      Jason Gunthorpe authored
      If drivers don't do this then iommufd will oops invalidation ioctls with
      something like:
      
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
        Mem abort info:
          ESR = 0x0000000086000004
          EC = 0x21: IABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
          FSC = 0x04: level 0 translation fault
        user pgtable: 4k pages, 48-bit VAs, pgdp=0000000101059000
        [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
        Internal error: Oops: 0000000086000004 [#1] PREEMPT SMP
        Modules linked in:
        CPU: 2 PID: 371 Comm: qemu-system-aar Not tainted 6.8.0-rc7-gde77230ac23a #9
        Hardware name: linux,dummy-virt (DT)
        pstate: 81400809 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=-c)
        pc : 0x0
        lr : iommufd_hwpt_invalidate+0xa4/0x204
        sp : ffff800080f3bcc0
        x29: ffff800080f3bcf0 x28: ffff0000c369b300 x27: 0000000000000000
        x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
        x23: 0000000000000000 x22: 00000000c1e334a0 x21: ffff0000c1e334a0
        x20: ffff800080f3bd38 x19: ffff800080f3bd58 x18: 0000000000000000
        x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffff8240d6d8
        x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
        x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
        x8 : 0000001000000002 x7 : 0000fffeac1ec950 x6 : 0000000000000000
        x5 : ffff800080f3bd78 x4 : 0000000000000003 x3 : 0000000000000002
        x2 : 0000000000000000 x1 : ffff800080f3bcc8 x0 : ffff0000c6034d80
        Call trace:
         0x0
         iommufd_fops_ioctl+0x154/0x274
         __arm64_sys_ioctl+0xac/0xf0
         invoke_syscall+0x48/0x110
         el0_svc_common.constprop.0+0x40/0xe0
         do_el0_svc+0x1c/0x28
         el0_svc+0x34/0xb4
         el0t_64_sync_handler+0x120/0x12c
         el0t_64_sync+0x190/0x194
      
      All existing drivers implement this op for nesting, this is mostly a
      bisection aid.
      
      Fixes: 8c6eabae ("iommufd: Add IOMMU_HWPT_INVALIDATE")
      Link: https://lore.kernel.org/r/0-v1-e153859bd707+61-iommufd_check_ops_jgg@nvidia.comReviewed-by: default avatarNicolin Chen <nicolinc@nvidia.com>
      Reviewed-by: default avatarYi Liu <yi.l.liu@intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      a11dda72
  2. 09 Jul, 2024 7 commits
    • Jason Gunthorpe's avatar
      Merge branch 'iommufd_pri' into iommufd for-next · 18dcca24
      Jason Gunthorpe authored
      Lu Baolu says:
      
      ====================
      This series implements the functionality of delivering IO page faults to
      user space through the IOMMUFD framework. One feasible use case is the
      nested translation. Nested translation is a hardware feature that supports
      two-stage translation tables for IOMMU. The second-stage translation table
      is managed by the host VMM, while the first-stage translation table is
      owned by user space. This allows user space to control the IOMMU mappings
      for its devices.
      
      When an IO page fault occurs on the first-stage translation table, the
      IOMMU hardware can deliver the page fault to user space through the
      IOMMUFD framework. User space can then handle the page fault and respond
      to the device top-down through the IOMMUFD. This allows user space to
      implement its own IO page fault handling policies.
      
      User space application that is capable of handling IO page faults should
      allocate a fault object, and bind the fault object to any domain that it
      is willing to handle the fault generatd for them. On a successful return
      of fault object allocation, the user can retrieve and respond to page
      faults by reading or writing to the file descriptor (FD) returned.
      
      The iommu selftest framework has been updated to test the IO page fault
      delivery and response functionality.
      ====================
      
      * iommufd_pri:
        iommufd/selftest: Add coverage for IOPF test
        iommufd/selftest: Add IOPF support for mock device
        iommufd: Associate fault object with iommufd_hw_pgtable
        iommufd: Fault-capable hwpt attach/detach/replace
        iommufd: Add iommufd fault object
        iommufd: Add fault and response message definitions
        iommu: Extend domain attach group with handle support
        iommu: Add attach handle to struct iopf_group
        iommu: Remove sva handle list
        iommu: Introduce domain attachment handle
      
      Link: https://lore.kernel.org/all/20240702063444.105814-1-baolu.lu@linux.intel.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      18dcca24
    • Lu Baolu's avatar
      iommufd/selftest: Add coverage for IOPF test · d1211768
      Lu Baolu authored
      Extend the selftest tool to add coverage of testing IOPF handling. This
      would include the following tests:
      
      - Allocating and destroying an iommufd fault object.
      - Allocating and destroying an IOPF-capable HWPT.
      - Attaching/detaching/replacing an IOPF-capable HWPT on a device.
      - Triggering an IOPF on the mock device.
      - Retrieving and responding to the IOPF through the file interface.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-11-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      d1211768
    • Lu Baolu's avatar
      iommufd/selftest: Add IOPF support for mock device · ddee1997
      Lu Baolu authored
      Extend the selftest mock device to support generating and responding to
      an IOPF. Also add an ioctl interface to userspace applications to trigger
      the IOPF on the mock device. This would allow userspace applications to
      test the IOMMUFD's handling of IOPFs without having to rely on any real
      hardware.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-10-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      ddee1997
    • Lu Baolu's avatar
      iommufd: Associate fault object with iommufd_hw_pgtable · 34765cbc
      Lu Baolu authored
      When allocating a user iommufd_hw_pagetable, the user space is allowed to
      associate a fault object with the hw_pagetable by specifying the fault
      object ID in the page table allocation data and setting the
      IOMMU_HWPT_FAULT_ID_VALID flag bit.
      
      On a successful return of hwpt allocation, the user can retrieve and
      respond to page faults by reading and writing the file interface of the
      fault object.
      
      Once a fault object has been associated with a hwpt, the hwpt is
      iopf-capable, indicated by hwpt->fault is non NULL. Attaching,
      detaching, or replacing an iopf-capable hwpt to an RID or PASID will
      differ from those that are not iopf-capable.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-9-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      34765cbc
    • Lu Baolu's avatar
      iommufd: Fault-capable hwpt attach/detach/replace · b7d88336
      Lu Baolu authored
      Add iopf-capable hw page table attach/detach/replace helpers. The pointer
      to iommufd_device is stored in the domain attachment handle, so that it
      can be echo'ed back in the iopf_group.
      
      The iopf-capable hw page tables can only be attached to devices that
      support the IOMMU_DEV_FEAT_IOPF feature. On the first attachment of an
      iopf-capable hw_pagetable to the device, the IOPF feature is enabled on
      the device. Similarly, after the last iopf-capable hwpt is detached from
      the device, the IOPF feature is disabled on the device.
      
      The current implementation allows a replacement between iopf-capable and
      non-iopf-capable hw page tables. This matches the nested translation use
      case, where a parent domain is attached by default and can then be
      replaced with a nested user domain with iopf support.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-8-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      b7d88336
    • Lu Baolu's avatar
      iommufd: Add iommufd fault object · 07838f7f
      Lu Baolu authored
      An iommufd fault object provides an interface for delivering I/O page
      faults to user space. These objects are created and destroyed by user
      space, and they can be associated with or dissociated from hardware page
      table objects during page table allocation or destruction.
      
      User space interacts with the fault object through a file interface. This
      interface offers a straightforward and efficient way for user space to
      handle page faults. It allows user space to read fault messages
      sequentially and respond to them by writing to the same file. The file
      interface supports reading messages in poll mode, so it's recommended that
      user space applications use io_uring to enhance read and write efficiency.
      
      A fault object can be associated with any iopf-capable iommufd_hw_pgtable
      during the pgtable's allocation. All I/O page faults triggered by devices
      when accessing the I/O addresses of an iommufd_hw_pgtable are routed
      through the fault object to user space. Similarly, user space's responses
      to these page faults are routed back to the iommu device driver through
      the same fault object.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-7-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      07838f7f
    • Lu Baolu's avatar
      iommufd: Add fault and response message definitions · c714f158
      Lu Baolu authored
      iommu_hwpt_pgfaults represent fault messages that the userspace can
      retrieve. Multiple iommu_hwpt_pgfaults might be put in an iopf group,
      with the IOMMU_PGFAULT_FLAGS_LAST_PAGE flag set only for the last
      iommu_hwpt_pgfault.
      
      An iommu_hwpt_page_response is a response message that the userspace
      should send to the kernel after finishing handling a group of fault
      messages. The @dev_id, @pasid, and @grpid fields in the message
      identify an outstanding iopf group for a device. The @cookie field,
      which matches the cookie field of the last fault in the group, will
      be used by the kernel to look up the pending message.
      
      Link: https://lore.kernel.org/r/20240702063444.105814-6-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      c714f158
  3. 04 Jul, 2024 4 commits
  4. 28 Jun, 2024 11 commits
  5. 23 Jun, 2024 8 commits
  6. 22 Jun, 2024 9 commits
    • Linus Torvalds's avatar
      Merge tag 'rust-fixes-6.10' of https://github.com/Rust-for-Linux/linux · 5f583a31
      Linus Torvalds authored
      Pull rust fix from Miguel Ojeda:
      
       - Avoid unused import warning in 'rusttest'.
      
      * tag 'rust-fixes-6.10' of https://github.com/Rust-for-Linux/linux:
        rust: avoid unused import warning in `rusttest`
      5f583a31
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v6.10-rc4' of... · 2765de94
      Linus Torvalds authored
      Merge tag 'regulator-fix-v6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "A few driver specific fixes for incorrect device descriptions, plus a
        fix for a missing symbol export which causes build failures for some
        newly added drivers in other trees"
      
      * tag 'regulator-fix-v6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: axp20x: AXP717: fix LDO supply rails and off-by-ones
        regulator: bd71815: fix ramp values
        regulator: core: Fix modpost error "regulator_get_regmap" undefined
        regulator: tps6594-regulator: Fix the number of irqs for TPS65224 and TPS6594
      2765de94
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · e24638af
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A number of fixes that have built up for SPI, a bunch of driver
        specific ones including an unfortunate revert of an optimisation for
        the i.MX driver which was causing issues with some configurations,
        plus a couple of core fixes for the rarely used octal mode and for a
        bad interaction between multi-CS support and target mode"
      
      * tag 'spi-fix-v6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-imx: imx51: revert burst length calculation back to bits_per_word
        spi: Fix SPI slave probe failure
        spi: Fix OCTAL mode support
        spi: stm32: qspi: Clamp stm32_qspi_get_mode() output to CCR_BUSWIDTH_4
        spi: stm32: qspi: Fix dual flash mode sanity test in stm32_qspi_setup()
        spi: cs42l43: Drop cs35l56 SPI speed down to 11MHz
        spi: cs42l43: Correct SPI root clock speed
      e24638af
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · c2fc9462
      Linus Torvalds authored
      Pull nfsd fixes from Chuck Lever:
      
       - Fix crashes triggered by administrative operations on the server
      
      * tag 'nfsd-6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
        NFSD: grab nfsd_mutex in nfsd_nl_rpc_status_get_dumpit()
        nfsd: fix oops when reading pool_stats before server is started
      c2fc9462
    • Linus Torvalds's avatar
      Merge tag 'xfs-6.10-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 563a5067
      Linus Torvalds authored
      Pull xfs fix from Chandan Babu:
      
       - Fix assertion failure due to a race between unlink and cluster buffer
         instantiation.
      
      * tag 'xfs-6.10-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: fix unlink vs cluster buffer instantiation race
      563a5067
    • Linus Torvalds's avatar
      Merge tag 'bcachefs-2024-06-22' of https://evilpiepirate.org/git/bcachefs · c3de9b57
      Linus Torvalds authored
      Pull bcachefs fixes from Kent Overstreet:
       "Lots of (mostly boring) fixes for syzbot bugs and rare(r) CI bugs.
      
        The LRU_TIME_BITS fix was slightly more involved; we only have 48 bits
        for the LRU position (we would prefer 64), so wraparound is possible
        for the cached data LRUs on a filesystem that has done sufficient
        (petabytes) reads; this is now handled.
      
        One notable user reported bugfix, where we were forgetting to
        correctly set the bucket data type, which should have been
        BCH_DATA_need_gc_gens instead of BCH_DATA_free; this was causing us to
        go emergency read-only on a filesystem that had seen heavy enough use
        to see bucket gen wraparoud.
      
        We're now starting to fix simple (safe) errors without requiring user
        intervention - i.e. a small incremental step towards full self
        healing.
      
        This is currently limited to just certain allocation information
        counters, and the error is still logged in the superblock; see that
        patch for more information. ("bcachefs: Fix safe errors by default")"
      
      * tag 'bcachefs-2024-06-22' of https://evilpiepirate.org/git/bcachefs: (22 commits)
        bcachefs: Move the ei_flags setting to after initialization
        bcachefs: Fix a UAF after write_super()
        bcachefs: Use bch2_print_string_as_lines for long err
        bcachefs: Fix I_NEW warning in race path in bch2_inode_insert()
        bcachefs: Replace bare EEXIST with private error codes
        bcachefs: Fix missing alloc_data_type_set()
        closures: Change BUG_ON() to WARN_ON()
        bcachefs: fix alignment of VMA for memory mapped files on THP
        bcachefs: Fix safe errors by default
        bcachefs: Fix bch2_trans_put()
        bcachefs: set_worker_desc() for delete_dead_snapshots
        bcachefs: Fix bch2_sb_downgrade_update()
        bcachefs: Handle cached data LRU wraparound
        bcachefs: Guard against overflowing LRU_TIME_BITS
        bcachefs: delete_dead_snapshots() doesn't need to go RW
        bcachefs: Fix early init error path in journal code
        bcachefs: Check for invalid btree IDs
        bcachefs: Fix btree ID bitmasks
        bcachefs: Fix shift overflow in read_one_super()
        bcachefs: Fix a locking bug in the do_discard_fast() path
        ...
      c3de9b57
    • Linus Torvalds's avatar
      Merge tag 'ata-6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux · da3b6ef1
      Linus Torvalds authored
      Pull ata fix from Niklas Cassel:
      
       - We currently enable DIPM (device initiated power management) in the
         device (using a SET FEATURES call to the device), regardless if the
         HBA supports any LPM states or not. It seems counter intuitive, and
         potentially dangerous to enable a device side feature, when the HBA
         does not have the corresponding support. Thus, make sure that we do
         not enable DIPM if the HBA does not support any LPM states.
      
      * tag 'ata-6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
        ata: ahci: Do not enable LPM if no LPM states are supported by the HBA
      da3b6ef1
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-6.10-rc5-fixes-take2' of... · 1f5c5371
      Linus Torvalds authored
      Merge tag 'pwm/for-6.10-rc5-fixes-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
      
      Pull pwm fixes from Uwe Kleine-König:
       "Three fixes for the pwm-stm32 driver.
      
        The first patch prevents an integer wrap-around for small periods. In
        the second patch the calculation of the prescaler is fixed which
        resulted in values for the ARR register that don't fit into the
        corresponding register bit field. The last commit improves an error
        message that was wrongly copied from another error path"
      
      * tag 'pwm/for-6.10-rc5-fixes-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
        pwm: stm32: Fix error message to not describe the previous error path
        pwm: stm32: Fix calculation of prescaler
        pwm: stm32: Refuse too small period requests
      1f5c5371
    • Linus Torvalds's avatar
      Merge tag 'arm-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 56bf7334
      Linus Torvalds authored
      Pull SoC fixes from Arnd Bergmann:
       "There are seven oneline patches that each address a distinct problem
        on the NXP i.MX platform, mostly the popular i.MX8M variant.
      
        The only other two fixes are for error handling on the psci firmware
        driver and SD card support on the milkv duo riscv board"
      
      * tag 'arm-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        firmware: psci: Fix return value from psci_system_suspend()
        riscv: dts: sophgo: disable write-protection for milkv duo
        arm64: dts: imx8qm-mek: fix gpio number for reg_usdhc2_vmmc
        arm64: dts: freescale: imx8mm-verdin: enable hysteresis on slow input pin
        arm64: dts: imx93-11x11-evk: Remove the 'no-sdio' property
        arm64: dts: freescale: imx8mp-venice-gw73xx-2x: fix BT shutdown GPIO
        arm: dts: imx53-qsb-hdmi: Disable panel instead of deleting node
        arm64: dts: imx8mp: Fix TC9595 input clock on DH i.MX8M Plus DHCOM SoM
        arm64: dts: freescale: imx8mm-verdin: Fix GPU speed
      56bf7334