Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D31F62F39B4 for ; Thu, 28 May 2026 20:23:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999838; cv=none; b=LVLXpa4DxGZtWCgsE/RVIW5jSrOd9osyCG6zM9RQcTQ6Pu3yesdLVlskkcfqZSNMcr8bp9MZTVrfuk6aO3r4P3lx3u/dhRnzyCr2U9LPHBCS7a+QCSxWTExUtkonibkERMFwNR+8s8d93WycAOg+8Zs7Ea35Nl0nTn9BkArr6Yw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999838; c=relaxed/simple; bh=hGvy0pHCr8Z9RUIfCnC1sEgi08Pcgdjw5Rm3oBc3hMw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=DYmxxLAadWPRnVyPrUaUCiv7eQfduIPCwlYUUtkjQYPHNrK0neqnhIlAqnALElOp1OFn64PFBdO5xvJZD0h61vDePO1wMXBD4458XaO7uhCwk/JZg+YFQQSLIXoGrQ09zn5s7J/erY72xQfcd+dbTJOr2M1nFSICfWw6j6fjga8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--praan.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dvacliLN; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--praan.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dvacliLN" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c850ff84ddfso10341589a12.2 for ; Thu, 28 May 2026 13:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779999836; x=1780604636; darn=lists.linux.dev; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=OCRry7rxw58KzBu/2DpFLzdj5hBkFn2md8kzREbSj6E=; b=dvacliLNYrVetTGIbR8XaWhViHwhPIQU44sxjvWVyI8SIBcl+Wc9H44n0J2gYve99c QO0YbCd68EW7XFmE6aVEtxXpwAjPHjrjhw1Cen59O2xQNP4G9FuSbScixNIClP9lB6ef OZt/KO+SUNWQK/edFQKmbqFSrQ06H3XmOeqzP3mtb2b5SZj9sjqEsK5SU/uf+CPDcc/T w5qDOHdM2SuzwIHOgxEpKc5V+3KqrgL52B93rJKvNo7jjhFEJP76KIcsFuX0RxV05ud/ A8vJvhSl+4tyzEyoqsZHvuW1/SP4+Z7x2QT29gNK0ddT8SE+BYLC7fnI/bMFSp3ajjME ccfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779999836; x=1780604636; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OCRry7rxw58KzBu/2DpFLzdj5hBkFn2md8kzREbSj6E=; b=fGEQgmEvWjTM77u6wYww7lLm7y2/3fNsWHTdn6hhVmvwMpqx2BnRfGxaRVaL2hfmgS KDD3JRUeFci3DGEGWYhyEbgbjTts+0B+jSyjXSC9wpgplDVEvSmiRfXhrhb1MyVIX2f6 OyizuqULIdkfxMkAAeSxMt/pURIxC6fWu4/C5otXbm1xnsY5Rm1WZj1IrCySLz5Y8XNo YOll/jZzCowhqewOpzsnZv0RClz0RQsudZIq5HPFC0eSQy1tYN10MOvBUZKpRJoGPXmc LpYXKJNFd3d4vWt8EumUbe5D5ePuUZH5bUk+iOb5VYQyw7WQgUqUBfBlZlEDMu/ugl23 v12g== X-Gm-Message-State: AOJu0YzJfeqQLtv+lYJ1UgzqktXDDzwCzKYRWlMuWXbyuw4BhxkZatvj 2kXQNRI8Oi/WRzUZSUG8mirFhQscIFq5Qmb9ctE9Kn5L7eKBHEp1+L0tlY4bqJ0YD7Y2fWZFcQf 21cRJ9lw1ZpGkz/fcfJwVloxOu3/AdXozxcnNLd1FUgSM2GjGviJsvJGnpJke00PJT5rvjEmZ2z wNxUZ/N4T6r65cIZW3IbbdPCBUMaWhOA== X-Received: from pgbo29.prod.google.com ([2002:a63:5a1d:0:b0:c82:2e5b:8f33]) (user=praan job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:6a1a:b0:3b2:924f:70af with SMTP id adf61e73a8af0-3b40e648375mr280209637.45.1779999835891; Thu, 28 May 2026 13:23:55 -0700 (PDT) Date: Thu, 28 May 2026 20:23:46 +0000 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260528202353.3422206-1-praan@google.com> Subject: [PATCH v5 0/7] iommu: Standardize ATS robustness and state tracking From: Pranjal Shrivastava To: iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Joerg Roedel , Will Deacon , Bjorn Helgaas , David Woodhouse , Lu Baolu , Robin Murphy , Suravee Suthikulpanit , Jason Gunthorpe , Nicolin Chen , David Matlack , Samiullah Khawaja , Daniel Mentz , Pasha Tatashin , Mostafa Saleh , Pranjal Shrivastava Content-Type: text/plain; charset="UTF-8" The primary motivation for this series is an ATS state mismatch observed under heavy load (via iova_stress). A failure in pci_enable_ats() leaves IOMMU drivers like arm-smmu-v3 with inconsistent state leading to PCI core warnings during device detach. While David's recent work [1] addressed a discovery race for specific quirked devices by moving them to the HEADER phase, gaps remained regarding how Virtual Functions (VFs) inherit state from their Physical Functions (PFs). Specifically, pci_ats_supported() did not account for PF-level quirked status, and pci_prepare_ats() lacked STU validation for VFs. Based on discussion with Jason in v3 it was decided that IOMMU drivers should explicitly check pci_ats_supported before calling pci_prepare_ats To facilitate this, pci_prepare_ats() has been decoupled from the internal support check. Furthermore, the device probe should fail if pci_prepare_ats() fails. Since these early gates preclude software configuration errors, any remaining failure during pci_enable_ats() is treated as a kernel bug This series standardizes this pattern across ARM SMMUv3, Intel VT-d, & AMD IOMMU drivers, while also hardening the latter two against pre-existing issues found by Sashiko in their probe error paths identified during review. [1] https://lore.kernel.org/linux-pci/20260403222750.1215002-1-dmatlack@google.com/ [v5] - Decoupled pci_ats_supported() from pci_prepare_ats() in the PCI core. - Rebased SMMUv3 support on top of Nicolin's "Always-On ATS" series. - Fixed pre-existing RB-tree corruption in VT-d probe (Baolu/Sashiko). - Addressed the pre-existing UAF in AMD IOMMU probe suggested by Sashiko - Collected R-b tags from Nicolin. [v4] - https://lore.kernel.org/all/20260525184347.4059549-1-praan@google.com/ - Standardized the pattern across Intel VT-d and AMD IOMMU drivers. - Replaced the SMMUv3 ats_prepared gate with a fatal probe-fail logic. - Utilized WARN() macros for runtime enablement failures in all drivers. - Collected R-b tags from Jason and Sami. [v3] https://lore.kernel.org/all/20260519135323.1558777-1-praan@google.com/ [v2] https://lore.kernel.org/all/20260504163842.2692314-1-praan@google.com/ Pranjal Shrivastava (7): PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs PCI/ATS: Validate STU for VFs in pci_prepare_ats() PCI/ATS: Decouple pci_ats_supported() from pci_prepare_ats() iommu/arm-smmu-v3: Standardize ATS enablement failure reporting iommu/vt-d: Fix RB-tree corruption and Use-After-Free in probe iommu/vt-d: Fail probe on ATS configuration failure iommu/amd: Fail probe on ATS configuration failure drivers/iommu/amd/iommu.c | 30 ++++++++++++++++----- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 +++++-- drivers/iommu/intel/iommu.c | 22 ++++++++++++--- drivers/pci/ats.c | 21 ++++++++++----- 4 files changed, 64 insertions(+), 19 deletions(-) -- 2.54.0.823.g6e5bcc1fc9-goog