From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 4CAD4481640 for ; Wed, 30 Sep 2026 10:30:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790764244; cv=none; b=h0F9/csWYiO3wQmMWY1hoZt6av5yZYQbDjsY/UuPSkIkZRzLFI4GEeMMxspAL1jG75BN9KFVQrCo1nZt3pn4QntfUs3FpVcwlkw12MtAUot0wPssq6ix/yY3k45HbcU+DhCD5Zx6QUjE3+cx5++I9B8Bz5bE+T0LUPwvTZ877X4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790764244; c=relaxed/simple; bh=LvyR5aGpyQZdCZNpTx7fGAilDs3BJHm6Q/QEFgtp4uc=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=ojLMkDhVtU4oSgXgps4SfVERaJZJ0dAH6teIAmKwiWhXr/FXi+/lsiWHdvpXIcGkULKSZmUeXg9mWSYjp06Kd1QLWnz3jZRS0yMR3TU6TzplhRKERVCpXfqbaH0YWbSs7xDrU4hnqFOkhKR5z324J6veeGXz0QAzsm8ssgJocGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=eTbEdnKZ; arc=none smtp.client-ip=209.85.128.69 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--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eTbEdnKZ" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49e6862e924so42193245e9.0 for ; Wed, 30 Sep 2026 03:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1790764240; x=1791369040; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:from:to:cc:subject:date:message-id :reply-to:content-type; bh=1+PuJJ3wOS6tvZ0KUVb7bT/lnQfHxZnC8edrNXWJcYA=; b=eTbEdnKZjpZN3yKYkTA9kM0B+OmM4Uq2YO/ETfFg+FOW1xDCpdkeD2Tytw15oSBfm0 burlbD0At5eIOey/Jb0AHx8XooGRK//7a7bfQAdWpCNwM67683F6x4o1af5ceUaKxq5E odILRVm0toT/7MMIkxS7Q+5ccRkTL9pErVGSPkIjWuZnJ1qHVDk0nEpnK2F7vEWKyIAE 3I/LplNo7n6/Iqnp0XkCFmIhBG7AnvTwoIJrs0lHknTPxDPM9HyajIEgg8H1s9p+5VKK Hq2dN9BAKM7ciXPTYl0+q3j+XFGwimyYHZGW7fufQ74MyF4TTzisEEz1hp+GHwErx+4f dvoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790764240; x=1791369040; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1+PuJJ3wOS6tvZ0KUVb7bT/lnQfHxZnC8edrNXWJcYA=; b=s3nZvsFiyuucwwvtHerzuzgS5HtdmTKCwDAxZm14aAIbDLWKbzYzIS7YrqPK8PbAuU q2RMA+mpWandjNHd8g2eifQiEdYjLbMbjNaixGCOGrnQiKQmdQCsjgy987/b5uVJM9qp 1iwWzRmu+6wk40PSqkKaDIhwTY/SLBCGTePLCBPOg7vnJGtROkuAOwvMN8WEAFYZVG/J 7k4LOEp5xo4oxxlwVLekgZbOKa1epw/Uj+OYaO3opGz1LUEsps+MDg203tdRL83dInDY cAqsSDsR02nQHjOdUOEcf+NFYQiBFbUEbxd0/hG6KL5OXfS6I3u3P0BTw7WHs8PC4A2+ 5kww== X-Gm-Message-State: AFuF++kd8VWRWHZ6KppbcEHaUOaY/cdoLcWFnCkliy5e0pkag9U8N7Vr B37hDPq4viBRBYsLmkuE/TrQbTJEB2OgcC7H4G10fzLbnsPfOqOBoj64m7DkuhnVwlofSPMrNQ= = X-Received: from wmpo20.prod.google.com ([2002:a05:600c:3394:b0:49f:fc29:a959]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c162:b0:49e:7a00:b9a5 with SMTP id 5b1f17b1804b1-4a01ad907efmr16095195e9.4.1790764240209; Wed, 30 Sep 2026 03:30:40 -0700 (PDT) Date: Wed, 30 Sep 2026 12:30:30 +0200 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.56.0.rc1.315.gc6ed9934b7-goog Message-ID: <20260930103036.248989-4-ardb+git@google.com> Subject: [PATCH v3 0/2] PCI: Allow non-prefetchable BARs in prefetchable windows From: Ard Biesheuvel To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Bjorn Helgaas , "=?UTF-8?q?Ilpo=20J=C3=A4rvinen?=" , Lorenzo Pieralisi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: Ard Biesheuvel (v2 never made it to linux-pci@ - please disregard it if you did get it) The non-prefetchable window of a PCI-to-PCI bridge can only decode 32-bit addresses, and so even 64-bit non-prefetchable BARs of devices below a bridge compete for the scarce MMIO space below 4 GB. The PCIe spec notes that marking such a BAR prefetchable still permits correct operation as long as the entire path from the host to the device is PCIe (PCIe r7.0, sec 7.5.1.2.1). The same applies when the OS places a non-prefetchable BAR in a prefetchable bridge window, and so this series permits that unless there is a bridge on the path to the root bus that is not a PCIe Root Port or Switch Port, allowing 64-bit non-prefetchable BARs to be placed above 4 GB. So add a new bus flag PCI_BUS_FLAGS_NO_NP_BARS_IN_P_WINDOWS, and wire it up so that it is only set on buses where this relaxed placement is not permitted. Then, use the flag to to decide whether to treat 64-bit NP BARs as prefetchable only for the purpose of resource allocation (but not for mapping the MMIO region or other reporting its properties) Patch #1 is a preparatory refactor of pci_bus_alloc_resource() with no functional change, and patch #2 implements the relaxation. (based on v7.3-rc4) Cc: Bjorn Helgaas Cc: "Ilpo J=C3=A4rvinen" Cc: Lorenzo Pieralisi Link: https://lore.kernel.org/linux-pci/20260910143440.3865663-2-ardb+git@g= oogle.com/ Ard Biesheuvel (2): PCI: Add __pci_bus_alloc_resource() to allocate with explicit flags PCI: Allow 64-bit non-prefetchable BARs in prefetchable windows drivers/pci/bus.c | 70 ++++++++++++++------ drivers/pci/pci.c | 43 +++++++++++- drivers/pci/pci.h | 7 ++ drivers/pci/probe.c | 35 ++++++++++ drivers/pci/setup-bus.c | 23 +++++-- drivers/pci/setup-res.c | 30 ++++++--- include/linux/pci.h | 1 + 7 files changed, 169 insertions(+), 40 deletions(-) --=20 2.56.0.rc1.315.gc6ed9934b7-goog