Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow DSC for DCP #272

Closed
wants to merge 912 commits into from
Closed

Allow DSC for DCP #272

wants to merge 912 commits into from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Nov 20, 2023

  1. wifi: brcmfmac: Handle watchdog properly in newer cores

    On newer cores, we need to explicitly set the subsystems to reset via
    the watchdog. Logic adapted from bcmdhd.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    7daa50b View commit details
    Browse the repository at this point in the history
  2. wifi: brcmfmac: pcie: Access pcie core registers via dedicated window

    Currently the pcie code multiplexes all register accesses through a
    single window. This isn't very efficient, and it creates race conditions
    when we access registers from multiple paths (e.g. in the interrupt
    handler). Since the chip has a dedicated window for the PCIe core
    registers, we can use that instead, avoid all the gratuitous window
    switching, and fix the IRQ race issues.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    d102896 View commit details
    Browse the repository at this point in the history
  3. wifi: brcmfmac: pcie: Initialize IRQs before firmware boot

    Newer firmwares notify the host of boot completion via an MSI, so let's
    make sure that is initialized before booting the firmware.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    5be76c7 View commit details
    Browse the repository at this point in the history
  4. wifi: brcmfmac: Do not set reset vector when signatures are in use

    With secure boot, the vector is not accessible and trying to write it
    triggers PCIe errors. Skip it in that case.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    91f16aa View commit details
    Browse the repository at this point in the history
  5. wifi: brcmfmac: Mask all IRQs before starting firmware

    Make sure the firmware can't get any early notifications by masking all
    IRQs explicitly before loading the firmware.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    3d767c8 View commit details
    Browse the repository at this point in the history
  6. wifi: brcmfmac: Add support for SCAN_V3

    This is essentially identical to SCAN_V2 with an extra field where we
    had a padding byte, so don't bother duplicating the entire structure.
    Just add the field and the logic to set the version properly.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    423b8a4 View commit details
    Browse the repository at this point in the history
  7. wifi: brcmfmac: Implement event_msgs_ext

    This extended command supports bit set/clear operations, but we just use
    it like the old full mask set command.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    50c3005 View commit details
    Browse the repository at this point in the history
  8. wifi: brcmfmac: Support bss_info up to v112

    The structures are compatible and just add fields, so we can just treat
    it as always v112. If we start using new fields, that will have to be
    gated on the version.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    5aa1db0 View commit details
    Browse the repository at this point in the history
  9. wifi: brcmfmac: Extend brcmf_wsec_pmk_le

    New firmware wants extra fields, hopefully old firmware ignores them.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    d4249d7 View commit details
    Browse the repository at this point in the history
  10. wifi: brcmfmac: Add BCM4388 support

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    1a6a955 View commit details
    Browse the repository at this point in the history
  11. brcmfmac: Fix AP mode

    Fix access point mode by bringing firmware into appropriate state before setting up the device.
    
    Signed-off-by: Patrick Blass <patrickblass.dev@gmail.com>
    pblass authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    33d6892 View commit details
    Browse the repository at this point in the history
  12. [brcmfmac] Finish firmware mem map, fix heap start calculation bug.

    This patch fixes the firmware memory map structure to be complete.
    Along the way, we fix a failure to align the heap memory start address,
    which causes failures with the newest apple wifi firmware.
    
    With this patch, we can load the latest (sonoma 14.0 as of right now) apple wifi firmware.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    fbda529 View commit details
    Browse the repository at this point in the history
  13. [brcmfmac] Add support for encoding/decoding 6g chanspecs

    This patch adds support for 6G chanspecs, as part of adding 6G and
    802.11ax support.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    c183ece View commit details
    Browse the repository at this point in the history
  14. [brcmfmac] Dynamically configure VHT settings to match firmware

    1. Correct VHT MCS settings to support as many tx/rx streams as chip
       does.
    
    2. Correct VHT capabilities to support what all chips do.
    
    3. Correct max AMPDU capabilities for VHT.
    
    4. Support LDPC and STBC in VHT where available.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    4c41195 View commit details
    Browse the repository at this point in the history
  15. [brcmfmac] Compute number of available antennas and set it in wiphy s…

    …tructure.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    b993e55 View commit details
    Browse the repository at this point in the history
  16. [brcmfmac] Support GCMP cipher suite, used by WPA3.

    This patch adds support for using GCMP/etc during offload
    where supported by the firmware.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    bb69f62 View commit details
    Browse the repository at this point in the history
  17. [brcmfmac] Don't issue wrong insufficient headroom warning

    We may just have had to clone a packet, and not actually
    have run out of headroom.  Only issue warning about headroom
    when we actually ran out of headroom.
    This removes useless spam about needing 0 more bytes of headroom.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    61db7d5 View commit details
    Browse the repository at this point in the history
  18. [brcmfmac] Support high power/low power/etc scan flags

    This patch adds support for handling the scan flags that come from the
    802.11 stack.  This enables the stack to control whether we are doing
    high/low power scans, as well as other options.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    07aa8d0 View commit details
    Browse the repository at this point in the history
  19. [brcmfmac] Add support for 6G bands and HE

    This patch adds support for 6G bands, along with HE capabilities,
    as they are required to register 6G bands with wiphy.
    This in turn, enables 802.11ax support for the other bands.
    
    Scanning is not updated in this patch, so the bands are unused
    except to be able to process what the firmware tells us.
    
    Existing code is updated to handle all the bands rather than just 2g and
    5g channels.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    0bb189b View commit details
    Browse the repository at this point in the history
  20. [brcmfmac] Fix regulatory domain handling to reset bands properly

    Currently, we ignore the default country in the reg notifier.
    We also register a custom regulatory domain, which is set
    as the default.
    As a result, the chip is likely to be set to the correct country,
    but the regulatory domain will not match it.
    
    When the regulatory notifier is then called, we see the countries
    are the same and do not change anything, even though the domain
    is wrong.
    
    This patch forces us to reset the bands on the first country change
    even if the chip is already set to that country.
    
    We also restore the original band info before reconstructing channel
    info, as the new regdom power limits may be higher than what is
    currently set.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    db18333 View commit details
    Browse the repository at this point in the history
  21. fixup! fix FWIL definition to use SSID length constant

    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    474500e View commit details
    Browse the repository at this point in the history
  22. fixup! define missing event message extension

    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    25fc29b View commit details
    Browse the repository at this point in the history
  23. [brcmfmac] Structurize PNF scan and add support for latest version

    This patch structurizes PNF scan handling, adding support for
    netinfo v3 and PNO v3 structures.
    
    This in turn, enables the chip to tell us about 6G scan results,
    as the results contain chanspecs and not just channels.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    790f0f3 View commit details
    Browse the repository at this point in the history
  24. [brcmfmac] Structurize scan parameter handling

    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    ab266df View commit details
    Browse the repository at this point in the history
  25. [brcmfmac] Support new join parameter structure versions

    To support new join parameter versions, we move to using a function
    pointer structure that knows how to deal with the different versions
    of structures
    
    Drive-by fix: Always count the assoc_params length even if no bssid is
    provided. It doesn't make sense to truncate it off, since we need to set
    the bssid to the broadcast addr anyway in that case.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    marcan authored and dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    55fdad1 View commit details
    Browse the repository at this point in the history
  26. [brcmfmac] Let feature attachment fail, and fail if we can't

    handle the interface versions we find.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    9a9d12e View commit details
    Browse the repository at this point in the history
  27. [brcmfmac] Add support for more auth suites in roaming offload

    This adds support for more authentication types during roaming offload,
    enabling the firmware to handle roaming for ~all authentication types.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    a349ce5 View commit details
    Browse the repository at this point in the history
  28. [brcmfmac] Set chanspec during join.

    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    38b6909 View commit details
    Browse the repository at this point in the history
  29. [brcmfmac] Add support for more rate info in station dumps

    We try to retrieve a newer sta_info structure that has
    both rx and tx ratespecs, but if we don't get the
    structure we are expecting we fall back to tx rate info only.
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    51e2312 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2023

  1. drm/apple: Add missing sound Kconfig dependencies

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    52a7deb View commit details
    Browse the repository at this point in the history
  2. drm: apple: HACK: Do not delete piodma platform device

    of_platform_device_destroy() can trigger several NULL pointer
    dereference which have been elusive so far.
    Comment this for now since the oopses causes the shutdown to hang.
    Since dcp can not be reloaded this leaks the platform device on shutdown
    and reboot.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    75d2274 View commit details
    Browse the repository at this point in the history
  3. drm: apple: afk: Update read pointer before processing message

    Avoids out of order messages and already unmapped buffers while tracing
    with hv/trace_dcp.py.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    f793a67 View commit details
    Browse the repository at this point in the history
  4. drm: apple: Implement D592 callback

    This callback is occasionally seen around (failed) modesets. There seems
    to be no need to handle it so just trace it.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    5c94a14 View commit details
    Browse the repository at this point in the history
  5. drm: apple: Keep information at which swap_id fb are still referenced

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    93070a0 View commit details
    Browse the repository at this point in the history
  6. Revert "drm: apple: iomfb: Do not match/create PMU service for dcpext"

    This reverts commit ab69434.
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    51bd031 View commit details
    Browse the repository at this point in the history
  7. drm: apple: dptx: Implement APCALL_DEACTIVATE and reset the phy

    This mirrors what macOS does and should make reconnections more
    reliable.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    86f1bfc View commit details
    Browse the repository at this point in the history
  8. drm: apple: Disconnect dptx When the CRTC is powered down

    Seems to make disconnect / reconnect more reliable and almost fixes
    suspend/resume. The drm device tries to modeset too early on resume
    which leaves the screen blank.
    This should reduce power consumption after disconnecting the HDMI port.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a9a37de View commit details
    Browse the repository at this point in the history
  9. drm: apple: dptx: Wait for completion of dptx_connect.

    Makes connects more reliable.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b28bc9f View commit details
    Browse the repository at this point in the history
  10. drm: apple: HPD: Only act on connect IRQs

    DCP notices the disconnects on its own and the parallel handling just
    results in confusion (both on DRM and developer side).
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b071ee5 View commit details
    Browse the repository at this point in the history
  11. drm: apple: iomfb: Improve hotplug related logging

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ddd996d View commit details
    Browse the repository at this point in the history
  12. drm: apple: Extract modeset crtc's atomic_flush()

    Triggering modesets from drm_connector_helper_funcs.atomic_check is more
    in line with DRM/KMS' design and allows returning errors from failed
    modesets.
    Ignore hotplug callbacks from DCP during modeset. DCP always does
    disconnected -> connected on (at least the initial) modeset. Shield drm
    helpers from this.
    This improves reliability with externel (dptx based) displays.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    99d7bb8 View commit details
    Browse the repository at this point in the history
  13. drm: apple: dptx: Log connect/disconnect calls

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0d53d6a View commit details
    Browse the repository at this point in the history
  14. phy: apple: atc: support mode switches in atcphy_dpphy_set_mode()

    Required for the DP2HDMI only atc3 port on 14/16 inch Macbook Pros.
    
    Fixes: 9ca3958 ("phy: apple: atc: Support DisplayPort only operation")
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8a3bd9a View commit details
    Browse the repository at this point in the history
  15. fixup! phy: apple: Add DP TX phy driver

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    4931e8e View commit details
    Browse the repository at this point in the history
  16. rust: types: Add Opaque::zeroed()

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a71782f View commit details
    Browse the repository at this point in the history
  17. rust: Use absolute paths to build Rust objects

    We want to use caller_location to uniquely identify callsites, to
    automatically create lockdep classes without macros. The location
    filename in local code uses the relative path passed to the compiler,
    but if that code is generic and instantiated from another crate, the
    path becomes absolute.
    
    To make this work and keep the paths consistent, always pass an absolute
    path to the compiler. Then the Location path is always identical
    regardless of how the code is being compiled.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    bef75c8 View commit details
    Browse the repository at this point in the history
  18. rust: kernel: Add simple siphash abstraction

    This allows Rust code to use the Hasher interface with the kernel
    siphash implementation.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    161d497 View commit details
    Browse the repository at this point in the history
  19. rust: sync: Add dummy LockClassKey implementation for !CONFIG_LOCKDEP

    Lock classes aren't used without lockdep. The C side declares the key
    as an empty struct in that case, but let's make it an explicit ZST in
    Rust, implemented in a separate module. This allows us to more easily
    guarantee that the lockdep code will be trivially optimized out without
    CONFIG_LOCKDEP, including LockClassKey arguments that are passed around.
    
    Depending on whether CONFIG_LOCKDEP is enabled or not, we then import
    the real lockdep implementation or the dummy one.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    487dd2d View commit details
    Browse the repository at this point in the history
  20. rust: sync: Replace static LockClassKey refs with a pointer wrapper

    We want to be able to handle dynamic lock class creation and using
    pointers to things that aren't a real lock_class_key as lock classes.
    Doing this by casting around Rust references is difficult without
    accidentally invoking UB.
    
    Instead, switch LockClassKey to being a raw pointer wrapper around a
    lock_class_key, which means there is no UB possible on the Rust side
    just by creating and consuming these objects. The C code also should
    never actually dereference lock classes, only use their address
    (possibly with an offset).
    
    We still provide a dummy ZST version of this wrapper, to be used when
    lockdep is disabled.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0f6debb View commit details
    Browse the repository at this point in the history
  21. rust: sync: Implement dynamic lockdep class creation

    Using macros to create lock classes all over the place is unergonomic,
    and makes it impossible to add new features that require lock classes to
    code such as Arc<> without changing all callers.
    
    Rust has the ability to track the caller's identity by file/line/column
    number, and we can use that to dynamically generate lock classes
    instead.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    238b213 View commit details
    Browse the repository at this point in the history
  22. rust: sync: Classless Lock::new() and pin_init()

    Use the new automagic lock class code to remove the lock class and name
    parameters from Lock::new() and Lock::pin_init(). The old functions
    are renamed to new_with_class() and pin_init_with_class() respectively.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ac703a3 View commit details
    Browse the repository at this point in the history
  23. rust: init: Update documentation for new mutex init style

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    7a699b0 View commit details
    Browse the repository at this point in the history
  24. rust: sync: Add LockdepMap abstraction

    This allows Rust code to explicitly integrate types with lockdep.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    247b218 View commit details
    Browse the repository at this point in the history
  25. rust: sync: arc: Add lockdep integration

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    373a2e0 View commit details
    Browse the repository at this point in the history
  26. rust: time: New module for timekeeping functions

    This module is intended to contain functions related to kernel
    timekeeping and time. Initially, this just wraps ktime_get() and
    ktime_get_boottime() and returns them as core::time::Duration instances.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    c8cb8a5 View commit details
    Browse the repository at this point in the history
  27. rust: xarray: Add an abstraction for XArray

    The XArray is an abstract data type which behaves like a very large
    array of pointers. Add a Rust abstraction for this data type.
    
    The initial implementation uses explicit locking on get operations and
    returns a guard which blocks mutation, ensuring that the referenced
    object remains alive. To avoid excessive serialization, users are
    expected to use an inner type that can be efficiently cloned (such as
    Arc<T>), and eagerly clone and drop the guard to unblock other users
    after a lookup.
    
    Future variants may support using RCU instead to avoid mutex locking.
    
    This abstraction also introduces a reservation mechanism, which can be
    used by alloc-capable XArrays to reserve a free slot without immediately
    filling it, and then do so at a later time. If the reservation is
    dropped without being filled, the slot is freed again for other users,
    which eliminates the need for explicit cleanup code.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    ---
    
    Hi everyone!
    
    This abstraction is part of the set of dependencies for the drm/asahi
    Apple M1/M2 GPU driver.
    
    The branch at [1] contains the full series of patches rebased on
    upstream leading to the complete driver, for reference on how it is
    intended to be used.
    
    Thank you everyone who helped review this on GitHub [2]! I hope I didn't
    forget any CCs...
    
    Note that I dropped the convenience `Deref` impl for `Guard`, since I
    couldn't figure out how to do it safely. Suggestions welcome, or we can
    leave it for a future improvement ^^
    
    [1] https://github.com/AsahiLinux/linux/tree/gpu/rebase-20230224
    [2] Rust-for-Linux#952
    
    Changes in v3:
    - Updated to the error v2/v3 series API.
    - Renamed `err` to `ret` for consistency with the other instance.
    - Link to v2: https://lore.kernel.org/r/20230224-rust-xarray-v2-1-4eeb0134944c@asahilina.net
    Changes in v2:
    - Added Pin requirement for all XArray operations, to close a
      soundness hole due to the lock in the XArray (locks are not safe to
      move while locked). Creation does not require pinning in place, since
      the lock cannot be acquired at that point.
    - Added safety note to Drop impl about why we don't need to do the lock
      unlock dance to ensure soundness in case of a dropped lock guard.
    - Downstream drm/asahi driver was also rebased on this version to prove
      it works (previously it was still on a pre-v1 version).
    - This still depends on the Error series (v1). v2 of that will need a
      trivial rename of Error::from_kernel_errno -> Error::from_errno. If
      this version of XArray ends up looking good, I'll send a trivial v4 of
      XArray with the rename, after sending the v2 of the Error series.
    - Link to v1: https://lore.kernel.org/r/20230224-rust-xarray-v1-1-80f0904ce5d3@asahilina.net
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    31c42c8 View commit details
    Browse the repository at this point in the history
  28. rust: Add a Sealed trait

    Some traits exposed by the kernel crate may not be intended to be
    implemented by downstream modules. Add a Sealed trait to allow avoiding
    this using the sealed trait pattern.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    cb58819 View commit details
    Browse the repository at this point in the history
  29. rust: device: Add an abstraction for devices

    Add a RawDevice trait which can be implemented by any type representing
    a device class (such as a PlatformDevice), and a Device type which
    represents an owned reference to a generic struct device.
    
    Lina: Rewrote commit message, dropped the Amba bits, and squashed in
    simple changes to the core RawDevice/Device code from latter commits
    in rust-for-linux/rust. Also include the rust_helper_dev_get_drvdata
    helper which will be needed by consumers later on.
    
    Co-developed-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    wedsonaf authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    51bc67b View commit details
    Browse the repository at this point in the history
  30. rust: io_pgtable: Add io_pgtable abstraction

    The io_pgtable subsystem implements page table management for various
    IOMMU page table formats. This abstraction allows Rust drivers for
    devices with an embedded MMU to use this shared code.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    faea7d8 View commit details
    Browse the repository at this point in the history
  31. rust: soc: apple: rtkit: Add Apple RTKit abstraction

    RTKit is Apple's proprietary real-time operating system framework, used
    across many subdevices on Apple Silicon platforms including NVMe, system
    management, GPU, etc. Add Rust abstractions for this subsystem, so that
    it can be used by upcoming Rust drivers.
    
    Note: Although ARM64 support is not yet merged, this can be built on amd64
    with CONFIG_COMPILE_TEST=y.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    54624a9 View commit details
    Browse the repository at this point in the history
  32. rust: Add container_of and offset_of macros

    Add Rust counterparts to these C macros. `container_of` is useful for C
    struct subtyping, to recover the original pointer to the container
    structure. `offset_of` is useful for struct-relative addressing.
    
    Lina: Rewrote commit message and squashed in later changes from
    rust-for-linux/linux, attributed below.
    
    Co-authored-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Co-authored:by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>
    Signed-off-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>
    Co-authored-by: Wedson Almeida Filho <wedsonaf@google.com>
    Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    2 people authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    18999ea View commit details
    Browse the repository at this point in the history
  33. rust: Fix container_of!()

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    66a17ae View commit details
    Browse the repository at this point in the history
  34. *RFL import: kernel::types::Bool

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ac9a8d4 View commit details
    Browse the repository at this point in the history
  35. *RFL import: kernel::io_buffer

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a0d3123 View commit details
    Browse the repository at this point in the history
  36. *RFL import: kernel::user_ptr

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ed12a2c View commit details
    Browse the repository at this point in the history
  37. MISSING SIGNOFFS: rust: Add PAGE_SIZE constant to kernel crate

    Computed based on the PAGE_SHIFT macro from C.
    
    // Co-authored-by: Adam Bratschi-Kaye <ark.email@gmail.com>
    // Co-authored-by: Miguel Ojeda <ojeda@kernel.org>
    // Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    26620b4 View commit details
    Browse the repository at this point in the history
  38. rust: Enable const_mut_refs feature for the kernel crate

    Needed by the rust-for-linux/rust module_param module.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    faa1698 View commit details
    Browse the repository at this point in the history
  39. *RFL import: kernel::module_param

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    bc4e9a7 View commit details
    Browse the repository at this point in the history
  40. rust: module_param: Tolerate a trailing newline when parsing

    This is the same behavior as kstrtol/kstrtoul, and allows simple
    `echo 0 > /sys/module/foo/parameters/bar` commands to work.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b840120 View commit details
    Browse the repository at this point in the history
  41. rust: Add name argument to Module::init()

    Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com>
    Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    e8b160a View commit details
    Browse the repository at this point in the history
  42. *RFL import: kernel::driver

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b3645fa View commit details
    Browse the repository at this point in the history
  43. *RFL import: The rest of kernel::device (minus clk stuff)

    Commit reference: 3dfc5eb
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    61397e1 View commit details
    Browse the repository at this point in the history
  44. *RFL import: kernel::io_mem

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b25e0ba View commit details
    Browse the repository at this point in the history
  45. *RFL import: kernel::of

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    293723f View commit details
    Browse the repository at this point in the history
  46. *RFL import: kernel::platform

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    410d548 View commit details
    Browse the repository at this point in the history
  47. *RFL import: kernel::delay

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    56092c8 View commit details
    Browse the repository at this point in the history
  48. rust: of: Add OF node abstraction

    This abstraction enables Rust drivers to walk Device Tree nodes and
    query their properties.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ca33345 View commit details
    Browse the repository at this point in the history
  49. rust: driver,of: Support passing ID tables to modpost for alias gener…

    …ation
    
    In order for modpost to work and correctly generate module aliases from
    device ID tables, it needs those tables to exist as global symbols with
    a specific name. Additionally, modpost checks the size of the symbol, so
    it cannot contain trailing data.
    
    To support this, split IdArrayIds out of IdArray. The former contains
    just the IDs. Then split out the device table definition macro from the
    macro that defines the device table for a given bus driver, and add
    another macro to declare a device table as a module device table.
    Drivers can now define their ID table once, and then specify that it
    should be used for both the driver and the module:
    
    // Generic OF Device ID table.
    kernel::define_of_id_table! {ASAHI_ID_TABLE, &'static hw::HwConfig, [
        (of::DeviceId::Compatible(b"apple,agx-t8103"), Some(&hw::t8103::HWCONFIG)),
        (of::DeviceId::Compatible(b"apple,agx-t8112"), Some(&hw::t8112::HWCONFIG)),
        // ...
    ]}
    
    /// Platform Driver implementation for `AsahiDriver`.
    impl platform::Driver for AsahiDriver {
        /// Data associated with each hardware ID.
        type IdInfo = &'static hw::HwConfig;
    
        // Assign the above OF ID table to this driver.
        kernel::driver_of_id_table!(ASAHI_ID_TABLE);
    
        // ...
    }
    
    // Export the OF ID table as a module ID table, to make modpost/autoloading work.
    kernel::module_of_id_table!(MOD_TABLE, ASAHI_ID_TABLE);
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    9d4f135 View commit details
    Browse the repository at this point in the history
  50. rust: platform: add ioremap_resource and get_resource methods

    This patch adds a logic similar to `devm_platform_ioremap_resource`
    function adding:
      - `IoResource` enumerated type that groups the `IORESOURCE_*` macros.
      - `get_resource()` method that is a binding of `platform_get_resource`
      - `ioremap_resource` that is newly written method similar to
        `devm_platform_ioremap_resource`.
    
    Lina: Removed `bit` dependency and rebased
    
    Co-developed-by: Asahi Lina <lina@asahilina.net>
    Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
    Maciej Falkowski authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    999c116 View commit details
    Browse the repository at this point in the history
  51. rust: kernel: platform: Add Device.set_dma_masks()

    Allows drivers to configure the DMA masks for a device. Implemented
    here, not in device, because it requires a mutable platform device
    reference this way (device::Device is a safely clonable reference).
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    12ccdf8 View commit details
    Browse the repository at this point in the history
  52. rust: Add ioremap_np support to io_mem & friends

    Apple SoCs require non-posted mappings for MMIO, and this is
    automatically handled by devm_ioremap_resource() and friends via a
    resource flag. Implement the same logic in kernel::io_mem, so it can
    work the same way.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8fdd008 View commit details
    Browse the repository at this point in the history
  53. *RFL import: macros::module params functionality & deps

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a737608 View commit details
    Browse the repository at this point in the history
  54. *RFL import: Rest of kernel::error::code::*

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    1e508ae View commit details
    Browse the repository at this point in the history
  55. rust: bindings: Add resource_size wrapper

    TODO: This isn't abstracted properly yet
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    5b486eb View commit details
    Browse the repository at this point in the history
  56. rust: Allow feature allocator_api

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    bb1c998 View commit details
    Browse the repository at this point in the history
  57. *RFL import: kernel::KParamGuard & friends

    Commit reference: 3dfc5eb
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    979301e View commit details
    Browse the repository at this point in the history
  58. iommu/io-pgtable: Add Apple UAT variant format

    Apple Silicon SoCs (M1, M2, etc.) have a GPU with an ARM64 firmware
    coprocessor. The firmware and the GPU share page tables in the standard
    ARM64 format (the firmware literally sets the base as its TTBR0/1
    registers). TTBR0 covers the low half of the address space and is
    intended to be per-GPU-VM (GPU user mappings and kernel-managed
    buffers), while TTBR1 covers the upper half and is global (firmware
    code, data, management structures shared with the AP, and a few
    GPU-accessible data structures).
    
    In typical Apple fashion, the permissions are interpreted differently
    from traditional ARM PTEs. By default, firmware mappings use Apple SPRR
    permission remapping. The firmware only uses that for its own
    code/data/MMIO mappings, and those pages are not accessible by the GPU
    hardware. We never need to touch/manage these mappings, so this patch
    does not support them.
    
    When a specific bit is set in the PTEs, permissions switch to a
    different scheme which supports various combinations of firmware/GPU
    access. This is the mode intended to be used by AP GPU drivers, and what
    we implement here.
    
    The prot bits are interpreted as follows:
    
    - IOMMU_READ and IOMMU_WRITE have the usual meaning.
    
    - IOMMU_PRIV creates firmware-only mappings (no GPU access)
    - IOMMU_NOEXEC creates GPU-only structures (no FW access)
    - Otherwise structures are accessible by both GPU and FW
    
    - IOMMU_MMIO creates Device mappings for firmware
    - IOMMU_CACHE creates Normal-NC mappings for firmware (cache-coherent
      from the point of view of the AP, but slower)
    - Otherwise creates Normal mappings for firmware (this requires manual
      cache management on the firmware side, as it is not coherent with the
      SoC fabric)
    
    GPU-only mappings (textures/etc) are expected to use IOMMU_CACHE and are
    seemingly coherent with the CPU (or otherwise the firmware/GPU already
    issue the required cache management operations when correctly
    configured).
    
    There is a GPU-RO/FW-RW mode, but it is not currently implemented (it
    doesn't seem to be very useful for the driver). There seems to be no
    real noexec control (i.e. for shaders) on the GPU side. All of these
    mappings are implicitly noexec for the firmware.
    
    Drivers are expected to fully manage per-user (TTBR0) page tables, but
    ownership of shared kernel (TTBR1) page tables is shared between the
    firmware and the AP OS. We handle this by simply using a smaller IAS to
    drop down one level of page tables, so the driver can install a PTE in
    the top-level (firmware-initialized) page table directly and just add an
    offset to the VAs passed into the io_pgtable code. This avoids having to
    have any special handling for this here. The firmware-relevant data
    structures are small, so we do not expect to ever require more VA space
    than one top-level PTE covers (IAS=36 for the next level, 64 GiB).
    
    Only 16K page mode is supported. The coprocessor MMU supports huge pages
    as usual for ARM64, but the GPU MMU does not, so we do not enable them.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    816d2df View commit details
    Browse the repository at this point in the history
  59. iommu/io-pgtable: Hack in FW-RW/GPU-RO mode into UAT io_pgtable

    This is ugly, we need a better way of expressing this.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    aa3ecee View commit details
    Browse the repository at this point in the history
  60. rust: io_pgtable: Add the Apple UAT format abstraction

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    57fc14f View commit details
    Browse the repository at this point in the history
  61. drm/scheduler: Clean up jobs when the scheduler is torn down.

    drm_sched_fini() currently leaves any pending jobs dangling, which
    causes segfaults and other badness when job completion fences are
    signaled after the scheduler is torn down.
    
    Explicitly detach all jobs from their completion callbacks and free
    them. This makes it possible to write a sensible safe abstraction for
    drm_sched, without having to externally duplicate the tracking of
    in-flight jobs.
    
    This shouldn't regress any existing drivers, since calling
    drm_sched_fini() with any pending jobs is broken and this change should
    be a no-op if there are no pending jobs.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    4822ac0 View commit details
    Browse the repository at this point in the history
  62. drm/scheduler: Fix UAF in drm_sched_fence_get_timeline_name

    A signaled scheduler fence can outlive its scheduler, since fences are
    independencly reference counted. Therefore, we can't reference the
    scheduler in the get_timeline_name() implementation.
    
    Fixes oopses on `cat /sys/kernel/debug/dma_buf/bufinfo` when shared
    dma-bufs reference fences from GPU schedulers that no longer exist.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    05c6526 View commit details
    Browse the repository at this point in the history
  63. rust: dma_fence: Add DMA Fence abstraction

    DMA fences are the internal synchronization primitive used for DMA
    operations like GPU rendering, video en/decoding, etc. Add an
    abstraction to allow Rust drivers to interact with this subsystem.
    
    Note: This uses a raw spinlock living next to the fence, since we do
    not interact with it other than for initialization.
    TODO: Expose this to the user at some point with a safe abstraction.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    266a944 View commit details
    Browse the repository at this point in the history
  64. rust: helpers: Add bindings/wrappers for dma_resv

    This is just for basic usage in the DRM shmem abstractions for implied
    locking, not intended as a full DMA Reservation abstraction yet.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    abff9f3 View commit details
    Browse the repository at this point in the history
  65. rust: drm: ioctl: Add DRM ioctl abstraction

    DRM drivers need to be able to declare which driver-specific ioctls they
    support. This abstraction adds the required types and a helper macro to
    generate the ioctl definition inside the DRM driver.
    
    Note that this macro is not usable until further bits of the
    abstraction are in place (but it will not fail to compile on its own, if
    not called).
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    6bf4b0b View commit details
    Browse the repository at this point in the history
  66. rust: drm: Add Device and Driver abstractions

    Add the initial abstractions for DRM drivers and devices. These go
    together in one commit since they are fairly tightly coupled types.
    
    A few things have been stubbed out, to be implemented as further bits of
    the DRM subsystem are introduced.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    df931b7 View commit details
    Browse the repository at this point in the history
  67. rust: drm: file: Add File abstraction

    A DRM File is the DRM counterpart to a kernel file structure,
    representing an open DRM file descriptor. Add a Rust abstraction to
    allow drivers to implement their own File types that implement the
    DriverFile trait.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    5776c1d View commit details
    Browse the repository at this point in the history
  68. rust: drm: device: Convert Device to AlwaysRefCounted

    Switch from being a refcount wrapper itself to a transparent wrapper
    around `bindings::drm_device`. The refcounted type then becomes
    ARef<Device<T>>.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    c304339 View commit details
    Browse the repository at this point in the history
  69. rust: drm: gem: Add GEM object abstraction

    The DRM GEM subsystem is the DRM memory management subsystem used by
    most modern drivers. Add a Rust abstraction to allow Rust DRM driver
    implementations to use it.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0aeeb91 View commit details
    Browse the repository at this point in the history
  70. rust: drm: device: Convert Device to AlwaysRefCounted

    Switch from being a refcount wrapper itself to a transparent wrapper
    around `bindings::drm_device`. The refcounted type then becomes
    ARef<Device<T>>.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    fd75ad4 View commit details
    Browse the repository at this point in the history
  71. rust: drm: gem: Allow pinning GEM object driver data

    This requires type_alias_impl_trait.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    e95eccb View commit details
    Browse the repository at this point in the history
  72. drm/gem-shmem: Export VM ops functions

    There doesn't seem to be a way for the Rust bindings to get a
    compile-time constant reference to drm_gem_shmem_vm_ops, so we need to
    duplicate that structure in Rust... this isn't nice...
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    2ade72f View commit details
    Browse the repository at this point in the history
  73. rust: drm: gem: shmem: Add DRM shmem helper abstraction

    The DRM shmem helper includes common code useful for drivers which
    allocate GEM objects as anonymous shmem. Add a Rust abstraction for
    this. Drivers can choose the raw GEM implementation or the shmem layer,
    depending on their needs.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    2d4d8c8 View commit details
    Browse the repository at this point in the history
  74. rust: drm: device: Convert Device to AlwaysRefCounted

    Switch from being a refcount wrapper itself to a transparent wrapper
    around `bindings::drm_device`. The refcounted type then becomes
    ARef<Device<T>>.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    00dac07 View commit details
    Browse the repository at this point in the history
  75. rust: drm: gem: Allow pinning GEM object driver data

    This requires type_alias_impl_trait.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    3e718a8 View commit details
    Browse the repository at this point in the history
  76. rust: drm: mm: Add DRM MM Range Allocator abstraction

    drm_mm provides a simple range allocator, useful for managing virtual
    address ranges. Add a Rust abstraction to expose this module to Rust
    drivers.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a42e452 View commit details
    Browse the repository at this point in the history
  77. rust: drm: syncobj: Add DRM Sync Object abstraction

    DRM Sync Objects are a container for a DMA fence, and can be waited on
    signaled, exported, and imported from userspace. Add a Rust abstraction
    so Rust DRM drivers can support this functionality.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b22ef72 View commit details
    Browse the repository at this point in the history
  78. rust: drm: sched: Add GPU scheduler abstraction

    The GPU scheduler manages scheduling GPU jobs and dependencies between
    them. This Rust abstraction allows Rust DRM drivers to use this
    functionality.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    92f4fb7 View commit details
    Browse the repository at this point in the history
  79. drm/gem: Add a flag to control whether objects can be exported

    Drivers may want to support driver-private objects, which cannot be
    shared. This allows them to share a single lock and enables other
    optimizations.
    
    Add an `exportable` field to drm_gem_object, which blocks PRIME export
    if set to false. It is initialized to true in
    drm_gem_private_object_init.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    55027ce View commit details
    Browse the repository at this point in the history
  80. rust: drm: gem: Add set_exportable() method

    This allows drivers to control whether a given GEM object is allowed to
    be exported via PRIME to other drivers.
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    7391bd0 View commit details
    Browse the repository at this point in the history
  81. drm/asahi: Add the Asahi driver UAPI

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    27dd993 View commit details
    Browse the repository at this point in the history
  82. rust: bindings: Bind the Asahi DRM UAPI

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    734c97d View commit details
    Browse the repository at this point in the history
  83. rust: macros: Add versions macro

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    2787327 View commit details
    Browse the repository at this point in the history
  84. drm/asahi: Add the Asahi driver for Apple AGX GPUs

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    6941675 View commit details
    Browse the repository at this point in the history
  85. DO NOT MERGE: drm/asahi: Add an experimental UAPI extension

    This lets us play around with unknown stuff from userspace, without
    having to commit to adding it to the UAPI (or knowing whether it's safe
    to expose at all).
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    3be2060 View commit details
    Browse the repository at this point in the history
  86. Configuration menu
    Copy the full SHA
    006df12 View commit details
    Browse the repository at this point in the history
  87. drm/asahi: hw,initdata: Initdata fixes for G14S

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    e8002ce View commit details
    Browse the repository at this point in the history
  88. drm/asahi: hw: Drop max_dies

    This isn't available on t602x, so it was probably a bad guess. Just use
    the known die count for the userspace info, from our HW info tables.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    4e54982 View commit details
    Browse the repository at this point in the history
  89. drm/asahi: initdata: Fix ver_info for G13 V13.5

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    9ba97fb View commit details
    Browse the repository at this point in the history
  90. drm/asahi: fw/channels: Identify subpipe (?) field in tvb ack

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ca47fcd View commit details
    Browse the repository at this point in the history
  91. drm/asahi: fw/channels: Document more message types a bit

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    1e641ed View commit details
    Browse the repository at this point in the history
  92. drm/asahi: initdata: Fix 13.5 field position for G13X

    Only affects unk_534 getting shifted over for G13X.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    fe5f2c9 View commit details
    Browse the repository at this point in the history
  93. drm/asahi: initdata: Document more stuff

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    267655e View commit details
    Browse the repository at this point in the history
  94. drm/asahi: fw/microseq: Document bits of has_attachments

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    6d00005 View commit details
    Browse the repository at this point in the history
  95. drm/asahi: hw/t600x: Expand some mappings

    Seems this changed in 13.5. Probably doesn't matter but should be safe
    to always expand.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8c35aae View commit details
    Browse the repository at this point in the history
  96. drm/asahi: hw/t8112: Make last IOMapping read-only

    This matches 13.5 firmware and t60xx.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    96fb509 View commit details
    Browse the repository at this point in the history
  97. drm/asahi: render: Correct some values for G14

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    3cdc0f7 View commit details
    Browse the repository at this point in the history
  98. drm/asahi: initdata: Initialize GpuStatsFrag properly

    I don't know if this matters, but just in case...
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    2abb1f3 View commit details
    Browse the repository at this point in the history
  99. drm/asahi: slotalloc: Allow initializing empty slots

    These slots can never be used.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0fdc185 View commit details
    Browse the repository at this point in the history
  100. drm/asahi: fw.channels: Add static assertions for message sizes

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    f27388b View commit details
    Browse the repository at this point in the history
  101. drm/asahi: hw.t602x: Fixes for t6022

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    cc5a597 View commit details
    Browse the repository at this point in the history
  102. drm/asahi: regs: Fix cluster count for G14D

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    6a854a1 View commit details
    Browse the repository at this point in the history
  103. drm/asahi: Enable probing for t6022

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    dd4766b View commit details
    Browse the repository at this point in the history
  104. drm/asahi: Increase recursion limit

    We're running into this again with the init macros...
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    b63f5d3 View commit details
    Browse the repository at this point in the history
  105. drm/asahi: initdata: Fixes for G14D

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ad7e428 View commit details
    Browse the repository at this point in the history
  106. drm/asahi: initdata,hw: Identify & set idle_off_standby_timer

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    c4e59c0 View commit details
    Browse the repository at this point in the history
  107. drm/asahi: initdata: Fudge t3 calculation a bit

    This gives exact numbers for G14D on the test machine. It looks like
    a rounding thing, but it's not clear exactly what the original logic
    would be here... I'm guessing the macOS driver uses floats and a
    different order of operations and that's why it comes up with a
    different result sometimes.
    
    Also fix an incorrectly named variable.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    060d748 View commit details
    Browse the repository at this point in the history
  108. drm/asahi: gpu,hw: Fix array IOMappings

    These arrays aren't consecutive, but rather are supposed to have a
    stride and possibly also span multiple dies. This doesn't affect T8xxx,
    but I have no idea how this ever worked for T60xx...
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    89b8f54 View commit details
    Browse the repository at this point in the history
  109. drm/asahi: hw/t602x: Increase meta/preempt sizes for G14D

    meta2,meta3 confirmed, meta4 conservative guess (it's small anyway). Not
    sure yet if max_splits also needs to be doubled.
    
    Compute preempt just conservatively doubled. Since that one is a bit
    larger, use the smaller size for <= G14C.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    1dbae0b View commit details
    Browse the repository at this point in the history
  110. drm/asahi: Expose firmware version to userspace

    Might be useful for something.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ff1b6f7 View commit details
    Browse the repository at this point in the history
  111. drm/asahi: alloc: Support tagging array allocs

    It's hard to tell what a given array buffer is just from the type, so
    add support for explicitly adding a u32 tag. This can help us
    differentiate between allocs in the debug codepaths or when dumping
    memory.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    9a8386f View commit details
    Browse the repository at this point in the history
  112. drm/asahi: alloc: Use tag as the guard marker

    To more easily debug GPU/FW-side overreads, use the alloc tag to fill
    the padding instead of using a constant.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    13e2f6c View commit details
    Browse the repository at this point in the history
  113. drm/asahi: buffer: Add tags to all the buffers

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    ea6a463 View commit details
    Browse the repository at this point in the history
  114. drm/asahi: initdata: Tag more arrays

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8360059 View commit details
    Browse the repository at this point in the history
  115. drm/asahi: queue/compute: Tag preempt buf

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0439041 View commit details
    Browse the repository at this point in the history
  116. drm/asahi: render: Tag AuxFB

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    165c8f3 View commit details
    Browse the repository at this point in the history
  117. drm/asahi: workqueue: Tag GPU buf

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    1f71640 View commit details
    Browse the repository at this point in the history
  118. drm/asahi: buffer,render: Identify and provide layer meta buf

    It looks like one of the "heapmeta" pointers is actually a layer
    metadata pointer, that macOS just allocates contiguously with the
    tilemap headers and heap meta buffers. Size seems to always be 0x100.
    
    Let's allocate it after the heapmeta, which will make debugging easier.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    3761d4f View commit details
    Browse the repository at this point in the history
  119. drm/asahi: compute: Implement bindless samplers

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    393cff6 View commit details
    Browse the repository at this point in the history
  120. drm/asahi: render: Implement bindless samplers

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    cdb5c89 View commit details
    Browse the repository at this point in the history
  121. drm/asahi: fw,queue: Implement helper programs

    Also expose no preemption flag (?) separately.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    4172495 View commit details
    Browse the repository at this point in the history
  122. drm/asahi: render: Identify and set Z/S strides for layered rendering

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    394d357 View commit details
    Browse the repository at this point in the history
  123. drm/asahi: queue: Quieten some debugs

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    7980cd2 View commit details
    Browse the repository at this point in the history
  124. drm/asahi: Add verbose UAPI error reporting

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    06195c6 View commit details
    Browse the repository at this point in the history
  125. drm/asahi: file: Remove sync limit

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    7386228 View commit details
    Browse the repository at this point in the history
  126. drm/asahi: render: Remove sync TVB growth support

    We decided we can't reasonably support this given fence forward progress
    requirements.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    c6a7723 View commit details
    Browse the repository at this point in the history
  127. drm/asahi: buffer: Complain more loudly about sync requests

    This codepath is known broken and we have no plans to fix it. However,
    it works most of the time, and it can work around bugs in the minimum
    TVB size calculation formula. So if that ever happens, we still want it
    to fix the problem, but complain loudly so we can fix the calculation.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    fbfeca1 View commit details
    Browse the repository at this point in the history
  128. Rust 1.72 compat

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    0a4d8da View commit details
    Browse the repository at this point in the history
  129. drm/asahi: Identify & add render VS spills flag

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    03811aa View commit details
    Browse the repository at this point in the history
  130. drm/asahi: Identify and allocate clustered layering metadata buf

    Turns out multi-cluster machines also need a clustered buffer for
    layered rendering.
    
    Fixes layered rendering on G13X with barriers (I guess if you don't
    flush memory this stays in some kind of cache and somehow doesn't
    matter?).
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    887b591 View commit details
    Browse the repository at this point in the history
  131. drm/asahi: Fix Clippy complaints

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    091b530 View commit details
    Browse the repository at this point in the history
  132. drm/asahi: render: Fix layered rendering on G14X

    We were missing one register and one bit.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    47476b1 View commit details
    Browse the repository at this point in the history
  133. rust: Fix x86 build

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8c64975 View commit details
    Browse the repository at this point in the history
  134. rust: Fix x86 build more

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    63cbe11 View commit details
    Browse the repository at this point in the history
  135. drm/asahi: render, buffer: Fix layered rendering on G13X (again)

    The meta1 buffer needs to be multiplied by the layer count. This does
    not seem to be needed on G14X (where even the stride is not specified
    anywhere and no other registers are affected by the layer count).
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    93fd085 View commit details
    Browse the repository at this point in the history
  136. drm/asahi: initdata: New init chain API for rebase

    Not going to split this up into fixups with all the reformatting...
    Lina gets to do that on next rebase.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    6c23cc7 View commit details
    Browse the repository at this point in the history
  137. rust: Add missing impl_trait_in_assoc_type feature

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    8a260f0 View commit details
    Browse the repository at this point in the history
  138. rust: bindgen: Exclude list functions with unsupported ABIs

    CONFIG_LIST_HARDENED causes certain list functions to use what bindgen
    considers an unsupported ABI:
    
    panicked at 'Invalid or unknown abi 14 for function
    "__list_del_entry_valid_or_report" (Function { name:
    "__list_del_entry_valid_or_report", mangled_name:
    Some("__list_del_entry_valid_or_report"), link_name:
    None, signature: TypeId(ItemId(38153)), kind: Function,
    linkage: External })',
    /usr/share/cargo/registry/bindgen-0.68.1/codegen/mod.rs:4195:17
    
    Exclude these, since they are internal functions we don't use directly
    anyway.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    97763ca View commit details
    Browse the repository at this point in the history
  139. drm/shmem-helper: Add lockdep asserts to vmap/vunmap

    Since commit 21aa27d ("drm/shmem-helper: Switch to reservation
    lock"), the drm_gem_shmem_vmap and drm_gem_shmem_vunmap functions
    require that the caller holds the DMA reservation lock for the object.
    Add lockdep assertions to help validate this.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    a4a7598 View commit details
    Browse the repository at this point in the history
  140. rust: alloc: Rust 1.73 compat fixes

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    4a2b4a4 View commit details
    Browse the repository at this point in the history
  141. driver, of: Mangle the device ID machinery further to remove const_tr…

    …ait_impl
    
    This unstable feature is broken/gone in 1.73. To work around this
    without breaking the API, turn IdArray::new() into a macro so that it
    can use concrete types (which can still have const associated
    functions) instead of a trait.
    
    This is quite ugly...
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    71e6c52 View commit details
    Browse the repository at this point in the history
  142. drm/asahi: workqueue: Work around ICE in Rust 1.74

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    d59eeb8 View commit details
    Browse the repository at this point in the history
  143. drm/asahi: queue: Alocate the NotifierList as shared

    macOS does it this way, and the firmware needs it (no cache management!)
    
    Fixes firmware crashes with piglit with high concurrency.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    97c6280 View commit details
    Browse the repository at this point in the history
  144. iommu: apple-dart: Check for fwspec in the device probe path

    We need to check for a fwspec in the probe path, to ensure that the
    driver does not probe as a bus iommu driver. This, along with related
    fixes to the IOMMU core code, fixes races and issues when multiple
    IOMMUs assigned to the same device probe at different times.
    
    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Hector Martin <marcan@marcan.st>
    iommu: apple-dart:
    marcan committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    998fd7c View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2023

  1. drm: apple: Move modeset into drm_crtc's atomic_enable

    squash! drm: apple: Extract modeset crtc's atomic_flush()
    Fixes: 99d7bb8 ("drm: apple: Extract modeset crtc's atomic_flush()")
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    128a7d4 View commit details
    Browse the repository at this point in the history
  2. drm: apple: Fix DPTX hotplug handling

    - Do not trigger an hotplug event from disconnect. DCP/iomfb notices that
      itself.
    - Check HPD status before disconnecting DPTX in the crtc disable
      path.
    - disconnect on suspend to allow an orderly re-connect on resume
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    ba8d4f2 View commit details
    Browse the repository at this point in the history
  3. drm: apple: iomfb: Use drm_kms_helper_connector_hotplug_event

    Avoid device wide hotplugs as DCP knowns the affected connector.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    2cccd35 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2023

  1. fixup! ASoC: tas2764: Add optional 'Apple quirks'

    Fix fallthrough warning and remove stray spaces before tabs for
    indenting.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    2bf9b38 View commit details
    Browse the repository at this point in the history
  2. fixup! drm: apple: Disconnect dptx When the CRTC is powered down

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    0f7a9a2 View commit details
    Browse the repository at this point in the history
  3. fixup! drm/apple: Add support for the macOS 13.2 DCP firmware

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    2302652 View commit details
    Browse the repository at this point in the history
  4. fixup! mux: apple dp crossbar: Support t602x DP cross bar variant

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    b176e77 View commit details
    Browse the repository at this point in the history
  5. fixup! drm: apple: iomfb: Use drm_kms_helper_connector_hotplug_event

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    56a2410 View commit details
    Browse the repository at this point in the history
  6. fixup! drm: apple: Disconnect dptx When the CRTC is powered down

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    e19e19a View commit details
    Browse the repository at this point in the history
  7. drm : apple: iomfb: Handle OOB ASYNC/CB context

    Only observed with dcp/dptx in linux after initialisation and reset in
    m1n1. On the initial startup dcp sends two D576 (hotPlug_notify_gated)
    presumendly due to state confusion due to  the multiple dptx
    connections.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    5f2ac9b View commit details
    Browse the repository at this point in the history
  8. fixup! drm: apple: DCP AFK/EPIC support

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    a0943d4 View commit details
    Browse the repository at this point in the history
  9. drm: apple: iomfb: Extend hotplug/mode parsing logging

    Under unknown but slightly broken conditions dcp sends timing modes
    without linked color modes. Log a warning when this happens and log the
    number of valid modes before emitting HPD events.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    7db5176 View commit details
    Browse the repository at this point in the history
  10. drm: apple: pasrser: Reject high refresh / resolution modes

    DSC setup seems to require extra steps. dcp reports itself a bandwith
    limit of 926484480:
    `IOMFB removing mode: 3840 x 2160 @ 119, bw: 987033600 max: 926484480`
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    741b581 View commit details
    Browse the repository at this point in the history
  11. drm: apple: Adjust startup sequence and timing for dptx

    DPTX setup from an initialized connection and display with sleeping and
    reset dcp is unfortunately quite fragile. The display connection has to
    be stopped and reestablished. Goodbye flicker free boot.
    If the IOMFB endpoint is started too early dcp might provide incomplete
    timing modes which prevent modesets.
    On display standby a HPD is triggered should result in a fully
    initialized dcp. If not a display cable unplug and plug should help.
    MacOS doesn't handle this at all and just gives up.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    2a6c77d View commit details
    Browse the repository at this point in the history
  12. arm64: dts: apple: j474s/j475c: Use dcpext0 for HDMI out

    dcp on t8112 and t602x does not wake up after sleep + reset but dcpext*
    does. Use dcpext0 for sharing the code with M1* devices.
    My interpretation of the tea leaves from Apple's marketing department
    suggests that dcpext is more capable (6k 60Hz vs 5k 60Hz) so use dcpext
    as long as only one is used.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    760ed8e View commit details
    Browse the repository at this point in the history
  13. fixup! arm64: dts: apple: t6022-{j180,j475}: Enable dcpext0/dptx-phy/…

    …dp2hdmi
    
    Prevent m1n1 from enabling the absent dcp node.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    49e2ee8 View commit details
    Browse the repository at this point in the history
  14. arm64: dts: apple: t8112-j473: Use dcpext for HDMI out

    dcp on t8112 and t602x does not wake up after sleep + reset but dcpext*
    does. Use dcpext0 for sharing the code with M1* devices.
    My interpretation of the tea leaves from Apple's marketing department
    suggests that dcpext is more capable (6k 60Hz vs 5k 60Hz) so use dcpext
    as long as only one is used.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    10c3cca View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2023

  1. Configuration menu
    Copy the full SHA
    1f6d945 View commit details
    Browse the repository at this point in the history
  2. drm: apple: dcp: Fix resume with DPTX based display outputs

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    7eaa5f4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    177c899 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2023

  1. Configuration menu
    Copy the full SHA
    7f20eab View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2023

  1. [brcmfmac] Support bandwidth caps for all bands

    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    c6a3acd View commit details
    Browse the repository at this point in the history
  2. [brcmfmac] Clean up and common interface creation handling

    This makes firmware-side interface creation structures private
    to interface creation, and commons out how creation is handled
    
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    cc0f803 View commit details
    Browse the repository at this point in the history
  3. [brcmfmac] Disable partial SAE offload

    Right now, partial SAE offload support is not working with supplicants.
    This patch currently disables it until we figure that out.
    
    We still do full SAE offload.
    Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
    dberlin committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    794d473 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2023

  1. Configuration menu
    Copy the full SHA
    d5e65b9 View commit details
    Browse the repository at this point in the history
  2. HID: transport: spi: Implement GET FEATURE

    This is used for fetching trackpad dimensions.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    7be2d4c View commit details
    Browse the repository at this point in the history
  3. HID: magicmouse: Query device dimensions via HID report

    For SPI/MTP trackpads, query the dimensions via HID report instead of
    hardcoding values.
    
    TODO: Does this work for the USB/BT devices? Maybe we can get rid of the
    hardcoded sizes everywhere?
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    2536456 View commit details
    Browse the repository at this point in the history
  4. macaudio: Set the card name explicitly

    This might fix a udev race, and also makes it possible to switch to a
    more descriptive "AppleJxxx" name (but before that we need to update
    userspace to avoid breaking users).
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    88e53b5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d5081e4 View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2023

  1. macaudio: Change device ID form Jxxx to AppleJxxx

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    c6da2ce View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2023

  1. macaudio: Turn please_blow_up_my_speakers into an int

    1 enables new models, 2 further removes safeties. Mostly so that people
    who set it to 1 for early access and forget don't get stuck without
    safety nets.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    ae55806 View commit details
    Browse the repository at this point in the history
  2. macaudio: Sync all gains with macOS

    We want the extra headroom, and speakersafetyd seems to be reliable. 3dB
    lower gain isn't going to buy us much safety at this point.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    4a77992 View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2023

  1. Configuration menu
    Copy the full SHA
    c545edf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    80b5100 View commit details
    Browse the repository at this point in the history
  3. macaudio: Fix CHECK return condition checking

    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 12, 2023
    Configuration menu
    Copy the full SHA
    aa14d74 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2023

  1. macaudio: Avoid matches against cs42l84's constrols

    On systems with cs42l84 headset codec "* " can't be used as control name
    pattern since it would match "Jack HPF Corner Frequency". Its control is
    not an enum and thus will always return -EINVAL.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    ea38732 View commit details
    Browse the repository at this point in the history
  2. drm: apple: Be less noisy about teardown notifies without service

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    5bfd508 View commit details
    Browse the repository at this point in the history
  3. drm: apple: dptx: Wait for link config on connect

    Should make connect more reliable by avoiding hardcoded waits which are
    either to long or too short. In the second case the display can't be
    brought up since dcp fails to report any modes during start.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    1d26b13 View commit details
    Browse the repository at this point in the history
  4. drm: apple: Prefer RGB SDR modes

    DCP color mode scoring seems to prefer high bit depth color modes even
    when it it would require DSC. For example 12-bit 4k 60 Hz YCbCr 4:4:4
    over a 600 MHz HDMI 2.0 link.
    Prefer 8-/10-bit RGB or YCbCr 4:4:4 modes if available.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    8997bef View commit details
    Browse the repository at this point in the history
  5. drm: apple: iomfb: Always parse DisplayAttributes

    Fixes missing physical display dimensions for HDMI display on Macbook
    Pros.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    6511bd6 View commit details
    Browse the repository at this point in the history
  6. drm: apple: parser: constify parser data

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    3c4e00b View commit details
    Browse the repository at this point in the history
  7. drm: apple: epic: Pass full notfiy/report payload to handler

    The payload is not necessarily epic_std_service_ap_call. The powerlog
    service on the system endpoint passes serialized dictionaries as
    payload.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    b8904df View commit details
    Browse the repository at this point in the history
  8. drm: apple: epic: systemep: Parse "mNits" log events

    The 13.5 firmware has stopped updating the NITS property on backlight
    brightness changes. Parse system log events instead which report
    backlight's brightness in millinits.
    Fixes the backlight device's "actual_brightness" property used by the
    systemd backlight service to save and restore brightness.
    
    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    b07f7c0 View commit details
    Browse the repository at this point in the history
  9. fixup! mux: apple DP xbar: Add Apple silicon DisplayPort crossbar

    Signed-off-by: Janne Grunau <j@jannau.net>
    jannau authored and marcan committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    9c00c62 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2023

  1. ASoC: apple: mca: Add delay after configuring clock

    Right after the early FE setup, ADMAC gets told to start the DMA. This
    can end up in a weird "slip" state with the channels transposed. Waiting
    a bit fixes this; presumably this allows the clock to stabilize.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    cb05ac2 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2023

  1. macaudio: Disable j313 and j274

    We are going to enable these out of band. If you are a distro packager:
    
    ** WARNING: **
    ** YOU ABSOLUTELY NEED THIS PATCH IN YOUR LSP-PLUGINS PACKAGE **
    
    lsp-plugins/lsp-dsp-lib#20
    
    Do NOT enable speakers without that patch, on any model. It can/will
    result in nasty noise that could damage them.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 15, 2023
    Configuration menu
    Copy the full SHA
    a550cfe View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2023

  1. ASoC: apple: mca: Add more delay after configuring clock

    Sigh... hope this works.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 17, 2023
    Configuration menu
    Copy the full SHA
    fa15c0a View commit details
    Browse the repository at this point in the history

Commits on Dec 19, 2023

  1. ASoC: apple: mca: More delay

    ¯\_(ツ)_/¯
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    marcan committed Dec 19, 2023
    1 Configuration menu
    Copy the full SHA
    0e2755f View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. drm/asahi: compute: Allow no preemption flag

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    b99db9d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3b8a0ad View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c6e227f View commit details
    Browse the repository at this point in the history
  4. drm/asahi: Identify and implement helper config register

    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    f8cda1c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9e26996 View commit details
    Browse the repository at this point in the history
  6. drm/asahi: Check command structure sizes

    Eventually this can be used to extend the structure at the end
    backwards-compatibly, for cases where we missed core fields in the UAPI.
    More discrete features should be implemented via extensions.
    
    Signed-off-by: Asahi Lina <lina@asahilina.net>
    asahilina authored and marcan committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    81b2647 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    431da82 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a53291b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e77c48c View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    37a8a14 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    88994b3 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    f43e458 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    f9c3ae7 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    ee67648 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    90bad8d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    8fcf91a View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    1be7a11 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    92d181e View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    6dfd8db View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    a35fbcc View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    74b7031 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    70115ca View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    245a18d View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    a7c4bc4 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    576a82a View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    61779ab View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    71e28dd View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    c492633 View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2024

  1. Revert "drm: apple: pasrser: Reject high refresh / resolution modes"

    DSC setup seems to just work for me when this higher pixel clock limit is
    simply removed again. With the limitation a 6K display is able to work up
    to 30Hz only, whereas with the limit removed, it just works without doing
    anything further in 6K@60Hz-10bit whereas the monitor starts reporting
    that DSC is in use.
    
    This reverts commit 741b581.
    
    Signed-off-by: Mart Raudsepp <leio@gentoo.org>
    leio committed Feb 24, 2024
    Configuration menu
    Copy the full SHA
    cc0d942 View commit details
    Browse the repository at this point in the history