From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 7FCB33630BA for ; Mon, 25 May 2026 18:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779734633; cv=none; b=LZv5stpccZFS7cfkx20Ad83xbYug7LYvEky3YzsjeL/Rmi7X2dAp3CnaHnj+k0O0SV8fxYaV8pasYMe0iwkGDCbzF/UUbfaIuIlQFXYa0EhCh0dA/z+mry8XaLDuiIQ6VxAO0YeW98lsPkXtYyPOi2gXCeQ8/XGyfiBKiFdLBo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779734633; c=relaxed/simple; bh=S3WwxYOwTFTGOXsA16goqVxlrACGQO7go6i+UDqPF0o=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=ovYUWdH+UZQdp8ucmyyj3dXX3ehy9q0CPYbEXi6iiXARmzpHWJmWeIscDsynFqxybDVvP6oJB6sLYYZSkYdfkLx/T+0Ap/Z45bTXttFdn4a+/k3gmmYg5Lc9/oX35iiD1MjSTsF5EebPqJLfIFBWAsDZxnjj7HUhcrDzjoXg1Kg= 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=nI9nOH6H; arc=none smtp.client-ip=209.85.214.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="nI9nOH6H" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2bc7f9b2213so71211215ad.0 for ; Mon, 25 May 2026 11:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779734631; x=1780339431; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=hKucAVRhiN094mFuCmSJPl9Zvf4iz9kVDYBn+OIoEcY=; b=nI9nOH6Hb5w4Ev2GVjE+wmr32ovZMkiw17u+bnTW7mpTFkLgLvWG6kxzDVfsD20pQz e4OW5CJVTY3i3Hbwc/G8vs6xogiHuMHfWdp3cNLwzhDJfttjjvZl7o2a7zZzQmxZ894C RQkixTdB37ZZuibrIqwTEuVyoldHtdcUncfSxp9OfblwwYQ1ObOD0Eeg+HTOzt4IkR/D BClF2Lk26IYTTtbnRrIVBNeXKI6RaSdirrMoR4/J/+NkEFkZVvL2gZ8j2WhDxw1I2qaF W9xiljRgcjtvfnnfRkPBu8AqsXEwOL6RRBFXHeYzqp8wN9S7GYyQ68MQt7omydl3G/1+ qdjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779734631; x=1780339431; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hKucAVRhiN094mFuCmSJPl9Zvf4iz9kVDYBn+OIoEcY=; b=fZ8wXcfAp87mMPBOS02S5sdSxgvlfk2/nl4wpOLB7bjvdMPMjbPYya7yYeIJ/r2t02 FwLAi8kf7YslmbXcyvWeaMdQWvikCKfwp0xEONxWxW3jt3h8HAqkEVlg4TVf7BU5UYci mUTQrxxpqf3L2NhOk6fZCWwBjkvLtpXnDZZqQeBZoithfZa2Ib1+BJgtCuQS5s5RNfCE T9shs4V9RYkqPNPqpPn5+IKUfVT4+IG6JqutOUF1M6SoD21oI7DSgLCed5v/e6sQ1e+O xy3r8uPSDKCO5Q16dEjgFaEZV92aeXrrUvZS8piNvgLUx9PDdsMiFuosESGBMlCxloSE K3Vw== X-Forwarded-Encrypted: i=1; AFNElJ+s/5DAbO0+Z18fe4k5LEsmDXJldOxa6VqJ0h5/jwfhB9g1S7un1Y+Rw7TpSyXBt5EP3ISDcOiQLKk+L8g=@vger.kernel.org X-Gm-Message-State: AOJu0Ywu/5BD9G41aEB3Nh/X8nbgN7PCx4zmFJRqX8pFqCApXI8tz8I1 5LGiY5kyxGH4lr3ZHkt9kDmEqsZUoZJiC4ky4yWNepdmnPlr9rqZO9Xm8gqDuBfZkgM8RcDjzdm Ptg== X-Received: from pllo21.prod.google.com ([2002:a17:902:7795:b0:2b7:882d:6a56]) (user=praan job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d50c:b0:2bc:78ec:54cf with SMTP id d9443c01a7336-2beb035a83bmr182353345ad.9.1779734630658; Mon, 25 May 2026 11:43:50 -0700 (PDT) Date: Mon, 25 May 2026 18:43:42 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.746.g67dd491aae-goog Message-ID: <20260525184347.4059549-1-praan@google.com> Subject: [PATCH v4 0/5] 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 and 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 & reported via WARN(). This series standardizes this pattern across ARM SMMUv3, Intel VT-d, & AMD IOMMU drivers. [1] https://lore.kernel.org/linux-pci/20260403222750.1215002-1-dmatlack@google.com/ [v4] - 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 (5): PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs PCI/ATS: Validate STU for VFs in pci_prepare_ats() iommu/arm-smmu-v3: Fix ATS state tracking iommu/vt-d: Fail probe on ATS configuration failure iommu/amd: Fail probe on ATS configuration failure drivers/iommu/amd/iommu.c | 27 ++++++++++++++++----- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 +++++++++++++--- drivers/iommu/intel/iommu.c | 15 +++++++++--- drivers/pci/ats.c | 14 ++++++++--- 4 files changed, 61 insertions(+), 16 deletions(-) -- 2.54.0.746.g67dd491aae-goog