From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.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 8E91D19D071 for ; Thu, 9 Apr 2026 15:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775746896; cv=none; b=StxdSYHK2jRZeIoqdlRyqP+1416oOTFT4wtUtb8csumSeHwxRkUOYw+lA6VaI38i640yrutHJ2DDMRgdjN0OOz0lhCvRoMPpZTulgGtD2vGBs9BahZ8yMjCs+CbMglYi9opwaEx3mRjCBJ2ZLH4mYz2ZFvJFdCo13vd3FtkabY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775746896; c=relaxed/simple; bh=0dUpKuRld0LNuKQNAGx/U+q/AkjRKZGFOUSuzM0yjyg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=VLVtwPf0YbNK9oPtTorvoUhbB20lAZyuku6dW1DHgEMNYEE+TQQxmPg3D2MMbWSqU1cm0MXVit/MCTRVsqbMKQKxi8qrfDO07YXCZemV9wjWrDGaIVw6+bVoU6+9ewwx5HWwyLepmSGPfIs/k7W9WPbS4Xt3Z01RhrfvlKHGlfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jmoroni.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZBTNdObe; arc=none smtp.client-ip=209.85.160.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--jmoroni.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZBTNdObe" Received: by mail-qt1-f201.google.com with SMTP id d75a77b69052e-50da31af14cso25980541cf.1 for ; Thu, 09 Apr 2026 08:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775746894; x=1776351694; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=nO53q0xyW1duF5akyybiEZjbURbECt/Kcb+1zYaiQFk=; b=ZBTNdObePrcllPzujogJs6KgUg3KLikyZxwkHsc0RmzvjxqBML7n7zM9sz536qxupE 3+uWW3fkIXiL3d9mbl4FWCLm9UaWU569js+7UMtt4Gbrx46LxKLkmRnpjnmvc3IByGhK FPJWU/er0IvuPnRNc1jkdCEbH5ySzaJKqZ6dAoXfirXO9vRlzkDVEDs+Yu51mi+A89iF 76laYyoTsBcq6IyMJiC1fY2lC/hkHXSwHMsAhto6RfaDhgkyqKJuXDTE+hVTn3IVlcLt 6D8d1ZWEpwBHuWgf1dsVXXkESvwVZiw8fJnPSK+Yf1QouAct1i1BtT2IQmxH8QWiWgIl yR7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775746894; x=1776351694; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nO53q0xyW1duF5akyybiEZjbURbECt/Kcb+1zYaiQFk=; b=KWybKFfTlSzr3vJD8swXlnJdTaoN2R/JS8wI8HuBtwURFeYt65GvzBVioDxtaRvpTG PhcgWecppANNr09pp64zz1heleOQpmOZqgYC8L3WT/IcvLl9MmJa2eqqKHajhzDiYF7S 1aQyNfwpFLLxQb1grK0drnhfiFcqAKg/wJh7MM4J2OSLOwKN30poA1gsrDXQuqVRI4bD lBIgWtXBaNx4C6pbQ0c0JWQhhNzCL3HIEKypZ2x2L3Z+Cxmniu7OTqeOeJpo6a1AvsRr zBYtD76DRNuZXX/dReNN2SnMnOC57ERZYG1UikelOw87AsV1tUiSdtT47mberw+546XP i2Og== X-Forwarded-Encrypted: i=1; AJvYcCWGh4Ttyu7ZCDEtM9PNvQmZRVLdhLL2fse2PdsbUXkePW53dDygLOMrCiDIlFRSbJ43Ut2qt27kUvuToms=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+qynS73q8hb/lcsud0Z1CLrxBWeYtCqpETvO9pY8iEEp3OqI7 gWMoHhOaQ0RTPaPWO+VapfHiR3o7YhXnCtygB8L0mM/cQkRCExdug2HRVAVx86Az1YVZ6uxJC0j HSzp3hrEilA== X-Received: from qtxl14.prod.google.com ([2002:a05:622a:50e:b0:50b:85bc:e768]) (user=jmoroni job=prod-delivery.src-stubby-dispatcher) by 2002:ac8:6906:0:b0:50b:3d9f:384e with SMTP id d75a77b69052e-50d62cbf981mr369957251cf.44.1775746893057; Thu, 09 Apr 2026 08:01:33 -0700 (PDT) Date: Thu, 9 Apr 2026 15:01:22 +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.53.0.1213.gd9a14994de-goog Message-ID: <20260409150123.3538444-1-jmoroni@google.com> Subject: [PATCH 1/2] PCI/P2PDMA: Allow wildcard device IDs in host bridge list From: Jacob Moroni To: Bjorn Helgaas , Logan Gunthorpe , David Hu Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Moroni Content-Type: text/plain; charset="UTF-8" Currently, the pci_p2pdma_whitelist array requires an exact match for both vendor and device ID. Some hardware vendors support cross bridge p2p across their entire silicon lineup, so add support for wildcard device IDs to avoid the need to continuously update this array. Signed-off-by: Jacob Moroni --- drivers/pci/p2pdma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index e0f546166..25e9358d0 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -530,7 +530,7 @@ static bool cpu_supports_p2pdma(void) static const struct pci_p2pdma_whitelist_entry { unsigned short vendor; - unsigned short device; + int device; enum { REQ_SAME_HOST_BRIDGE = 1 << 0, } flags; @@ -601,8 +601,12 @@ static bool __host_bridge_whitelist(struct pci_host_bridge *host, device = root->device; for (entry = pci_p2pdma_whitelist; entry->vendor; entry++) { - if (vendor != entry->vendor || device != entry->device) + if (vendor != entry->vendor) continue; + + if (entry->device != PCI_ANY_ID && device != entry->device) + continue; + if (entry->flags & REQ_SAME_HOST_BRIDGE && !same_host_bridge) return false; -- 2.53.0.1213.gd9a14994de-goog