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 B5A723BED7D for ; Mon, 1 Jun 2026 14:36:49 +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=1780324611; cv=none; b=N8wrRXhwjAgPT0NPM1AU9gp08bttOi58o2eZutj5m2O8NGyLECarkN8hSiAtQgmx424iDHOlDyF7e7E+M50pxhttPCkifIpEXGxYYLdWXKEWKEZNRfLNX45Q/tUfPIHQLVfpPpV3PA1DbIRYTVXxe+3foMeL87qrgyGoAlX/vDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780324611; c=relaxed/simple; bh=zLhKJQfxvv+d9aNsqJrU4irOe5OKs7/A2799Tf2JNWI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qF3d4aDu95wK4FzArqeBwq3LIcJcPE5LsfgpNfiysAsifNhK+4J5bcIKgotO6q12H8meBEHV7/tcpfQGO8rLOk6KM3SvBObHqzj854rCetpAwt8XU5n6XfS4NEn9UkuYVRPwL1vJQA4Hx42/jbrLX/f5EVb15TXaxebCBexhX2g= 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=o86A/2+d; 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="o86A/2+d" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2bf243973c2so22512785ad.1 for ; Mon, 01 Jun 2026 07:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780324609; x=1780929409; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=H1WHbQ1I/exyopX3p7b75ehhnkD9ODb3Bve7jByn9iQ=; b=o86A/2+dhHNysWMSV7dnGUt4JeucHi4nygMBcNXIqvXfXlfoAYu9/S/s3fTM+qSFCV ouKaVInfWoUqTa5pX8xVCQw26ij7C2GvzLmVjI01salrBw9moknHYqAo3l3vIByMpKEj qcNmu8neQpGrx2FrIhpKWSa/xLnig5q0Ww5AznQIDkscL386Vz+lE2Tv+JM+vHBasT3Y NbSRCdnlvTACMNf2nDtAnWj8Gxubk68Y6LeTdysdRE2YEV1+DivNm0uhyJQ2ZkFcMDgp xB1RuUKBPHqCzAsNwudeJ83ad0tuLFZNsPUpmlA4nj71+TAU0VHBB1f15ovtZVzQKqIv T3sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780324609; x=1780929409; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H1WHbQ1I/exyopX3p7b75ehhnkD9ODb3Bve7jByn9iQ=; b=PKyX2xSFalLoyvs+F0rnhfQeuIREfclTPvQgAnrAARWIujnKdV+RrFl+uKPKOnhibh ZhNDxsbcChbDYhGkePo8wkwZZtTckMyXpxVWQ8hfR7F7T+we6zs9tHdJBxA06BMq6ap0 alqIXm/U7nqEZJry+XnEXjoQiHg9aUHoeNgRuhv1jE2nBtKwuF4WJBbKWaIq8hxfYqFB dkAHqLfPP7zHexSZAvkAGHjyaBpjBF9Pq9BxTbmOrb+QCpxnia2piamIlxWmxUGURlqO 03qjrUQ/1zoygA0TSsFRGleAp042vJsq69O3/8UQwZet3M+jR8Tpoqk2+YhgyHkl1mQT npeQ== X-Forwarded-Encrypted: i=1; AFNElJ/Wj4fCaiIRbQpWSE3pIM4Jv2uvnX8zX6QjX9VqqXeS3wDHbdDiSVmmDAYqAcMxEvOga3qfrdlXr4fJiXQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+Wj13JC6/9F3PstG7ZAi4a9Or+PsCjMi1+hFI/75v2L+2uzFa h94M49nnT33OrSjE/6lF4ynCLxqDqOXdJLK5eBxxPdRP7cw12m4eRVLFc2CDifEWxh5U0XZkoRb iRg== X-Received: from pldy13.prod.google.com ([2002:a17:902:cacd:b0:2b2:a70b:98ea]) (user=praan job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:4b07:b0:2c0:b6c7:2273 with SMTP id d9443c01a7336-2c0b6c7267emr92934605ad.3.1780324608765; Mon, 01 Jun 2026 07:36:48 -0700 (PDT) Date: Mon, 1 Jun 2026 14:36:40 +0000 In-Reply-To: <20260601143644.2358771-1-praan@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260601143644.2358771-1-praan@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260601143644.2358771-2-praan@google.com> Subject: [PATCH v7 1/5] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs From: Pranjal Shrivastava To: iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joerg Roedel , Will Deacon , Robin Murphy , Baolu Lu , Jason Gunthorpe , Kevin Tian , Bjorn Helgaas , Samiullah Khawaja , Pranjal Shrivastava , Nicolin Chen Content-Type: text/plain; charset="UTF-8" Update pci_ats_supported() to additionally check the associated PF's status when called on a VF. This ensures that PF-level quirks and untrusted status are correctly propagated to VFs, providing a robust support check that aligns with the kernel's PF-centric ATS configuration model and is immune to the timing of VF-specific fixups. Reviewed-by: Jason Gunthorpe Reviewed-by: Samiullah Khawaja Reviewed-by: Nicolin Chen Reviewed-by: Lu Baolu Signed-off-by: Pranjal Shrivastava --- drivers/pci/ats.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c index 96efa00d9743..679a3c3c1d54 100644 --- a/drivers/pci/ats.c +++ b/drivers/pci/ats.c @@ -40,10 +40,13 @@ void pci_ats_init(struct pci_dev *dev) */ bool pci_ats_supported(struct pci_dev *dev) { - if (!dev->ats_cap) + if (!dev->ats_cap || dev->untrusted) return false; - return (dev->untrusted == 0); + if (dev->is_virtfn) + return pci_ats_supported(pci_physfn(dev)); + + return true; } EXPORT_SYMBOL_GPL(pci_ats_supported); -- 2.54.0.823.g6e5bcc1fc9-goog