1. Mar 18, 2021
    • Maximilian Luz's avatar
      platform/surface: dtx: Add support for native SSAM devices · e893d45f
      Maximilian Luz authored
      
      
      Add support for native SSAM devices to the DTX driver. This allows
      support for the Surface Book 3, on which the DTX device is not present
      in ACPI.
      
      Signed-off-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Link: https://lore.kernel.org/r/20210308184819.437438-3-luzmaximilian@gmail.com
      
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      e893d45f
    • Maximilian Luz's avatar
      platform/surface: Add DTX driver · 1d609992
      Maximilian Luz authored
      The Microsoft Surface Book series devices consist of a so-called
      clipboard part (containing the CPU, touchscreen, and primary battery)
      and a base part (containing keyboard, secondary battery, and optional
      discrete GPU). These parts can be separated, i.e. the clipboard can be
      detached and used as tablet.
      
      This detachment process is initiated by pressing a button. On the
      Surface Book 2 and 3 (targeted with this commit), the Surface Aggregator
      Module (i.e. the embedded controller on those devices) attempts to send
      a notification to any listening client driver and waits for further
      instructions (i.e. whether the detachment process should continue or be
      aborted). If it does not receive a response in a certain time-frame, the
      detachment process (by default) continues and the clipboard can be
      physically separated. In other words, (by default and) without a driver,
      the detachment process takes about 10 seconds to complete.
      
      This commit introduces a driver for this detachment system (called DTX).
      This driver allows a user-space daemon to control and influence the
      detachment behavior. Specifically, it forwards any detachment requests
      to user-space, allows user-space to make such requests itself, and
      allows handling of those requests. Requests can be handled by either
      aborting, continuing/allowing, or delaying (i.e. resetting the timeout
      via a heartbeat commend). The user-space API is implemented via the
      /dev/surface/dtx miscdevice.
      
      In addition, user-space can change the default behavior on timeout from
      allowing detachment to disallowing it, which is useful if the (optional)
      discrete GPU is in use.
      
      Furthermore, this driver allows user-space to receive notifications
      about the state of the base, specifically when it is physically removed
      (as opposed to detachment requested), in what manner it is connected
      (i.e. in reverse-/tent-/studio- or laptop-mode), and what type of base
      is connected. Based on this information, the driver also provides a
      simple tablet-mode switch (aliasing all modes without keyboard access,
      i.e. tablet-mode and studio-mode to its reported tablet-mode).
      
      An implementation of such a user-space daemon, allowing configuration of
      detachment behavior via scripts (e.g. safely unmounting USB devices
      connected to the base before continuing) can be found at [1].
      
      [1]: https://github.com/linux-surface/surface-dtx-daemon
      
      
      
      Signed-off-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Link: https://lore.kernel.org/r/20210308184819.437438-2-luzmaximilian@gmail.com
      
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      1d609992
  2. Mar 08, 2021
  3. Mar 06, 2021
  4. Mar 05, 2021
    • Jens Axboe's avatar
      io_uring: make SQPOLL thread parking saner · 86e0d676
      Jens Axboe authored
      
      
      We have this weird true/false return from parking, and then some of the
      callers decide to look at that. It can lead to unbalanced parks and
      sqd locking. Have the callers check the thread status once it's parked.
      We know we have the lock at that point, so it's either valid or it's NULL.
      
      Fix race with parking on thread exit. We need to be careful here with
      ordering of the sdq->lock and the IO_SQ_THREAD_SHOULD_PARK bit.
      
      Rename sqd->completion to sqd->parked to reflect that this is the only
      thing this completion event doesn.
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      86e0d676
    • Jens Axboe's avatar
      io-wq: kill hashed waitqueue before manager exits · 09ca6c40
      Jens Axboe authored
      If we race with shutting down the io-wq context and someone queueing
      a hashed entry, then we can exit the manager with it armed. If it then
      triggers after the manager has exited, we can have a use-after-free where
      io_wqe_hash_wake() attempts to wake a now gone manager process.
      
      Move the killing of the hashed write queue into the manager itself, so
      that we know we've killed it before the task exits.
      
      Fixes: e941894e
      
       ("io-wq: make buffered file write hashed work map per-ctx")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      09ca6c40
    • Jens Axboe's avatar
      io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return · b5b0ecb7
      Jens Axboe authored
      
      
      The callback can only be armed, if we get -EIOCBQUEUED returned. It's
      important that we clear the WAITQ bit for other cases, otherwise we can
      queue for async retry and filemap will assume that we're armed and
      return -EAGAIN instead of just blocking for the IO.
      
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b5b0ecb7