All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Scull <ascull@google.com>
To: u-boot@lists.denx.de
Cc: sjg@chromium.org, bmeng.cn@gmail.com, adelva@google.com,
	keirf@google.com,  ptosi@google.com,
	Andrew Scull <ascull@google.com>
Subject: [PATCH v2 09/18] pci: Add config for Enhanced Allocation
Date: Tue, 29 Mar 2022 16:58:51 +0000	[thread overview]
Message-ID: <20220329165900.1139885-10-ascull@google.com> (raw)
In-Reply-To: <20220329165900.1139885-1-ascull@google.com>

Add a config to control whether Enhanced Allocation is supported by the
driver.

Signed-off-by: Andrew Scull <ascull@google.com>
---
 drivers/pci/Kconfig      |  7 +++++++
 drivers/pci/pci-uclass.c | 25 +++++++++++++++----------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 47cd074aa1..fd2203420c 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -67,6 +67,13 @@ config PCI_SRIOV
 	  if available on a PCI Physical Function device and probe for
 	  applicable drivers.
 
+config PCI_ENHANCED_ALLOCATION
+	bool "Enable support for Enhanced Allocation of resources"
+	default y
+	help
+	  Enable support for Enhanced Allocation which can be used by supported
+	  devices in place of traditional BARS for allocation of resources.
+
 config PCI_ARID
         bool "Enable Alternate Routing-ID support for PCI"
         help
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 8bbeb62f2e..719656eb3a 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -645,7 +645,11 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
 		return log_msg_ret("probe", -EINVAL);
 	}
 
-	ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+	if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION))
+		ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+	else
+		ea_pos = 0;
+
 	if (ea_pos) {
 		dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),
 				    &reg);
@@ -1600,15 +1604,16 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags)
 			udev = pdata->pfdev;
 	}
 
-	/*
-	 * if the function supports Enhanced Allocation use that instead of
-	 * BARs
-	 * Incase of virtual functions, pdata will help read VF BEI
-	 * and EA entry size.
-	 */
-	ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
-	if (ea_off)
-		return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
+	if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION)) {
+		/*
+		 * If the function supports Enhanced Allocation use that
+		 * instead of BARs. Incase of virtual functions, pdata will
+		 * help read VF BEI and EA entry size.
+		 */
+		ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
+		if (ea_off)
+			return dm_pci_map_ea_bar(udev, bar, ea_off, pdata);
+	}
 
 	/* read BAR address */
 	dm_pci_read_config32(udev, bar, &bar_response);
-- 
2.35.1.1021.g381101b075-goog


  parent reply	other threads:[~2022-03-29 17:01 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 16:58 [PATCH v2 00/18] virtio: pci: Add and fix consistency checks Andrew Scull
2022-03-29 16:58 ` [PATCH v2 01/18] virtio: pci: Allow exclusion of legacy driver Andrew Scull
2022-03-29 16:58 ` [PATCH v2 02/18] virtio: pci: Fix discovery of device config length Andrew Scull
2022-03-29 16:58 ` [PATCH v2 03/18] virtio: pci: Bounds check device config access Andrew Scull
2022-03-29 16:58 ` [PATCH v2 04/18] virtio: pci: Bounds check notification writes Andrew Scull
2022-03-29 16:58 ` [PATCH v2 05/18] virtio: pci: Check virtio common config size Andrew Scull
2022-03-29 16:58 ` [PATCH v2 06/18] virtio: pci: Check virtio capability is in bounds Andrew Scull
2022-04-13 13:14   ` Bin Meng
2022-03-29 16:58 ` [PATCH v2 07/18] virtio: pci: Read entire capability into memory Andrew Scull
2022-04-13 13:14   ` Bin Meng
2022-03-29 16:58 ` [PATCH v2 08/18] pci: Fix use of flags in dm_pci_map_bar() Andrew Scull
2022-04-13 13:11   ` Bin Meng
2022-04-13 16:23     ` Andrew Scull
2022-03-29 16:58 ` Andrew Scull [this message]
2022-04-13 13:14   ` [PATCH v2 09/18] pci: Add config for Enhanced Allocation Bin Meng
2022-04-13 16:30     ` Andrew Scull
2022-04-14  0:42       ` Bin Meng
2022-04-14  7:58         ` Andrew Scull
2022-04-14  9:39           ` Andrew Scull
2022-04-22  7:44           ` Bin Meng
2022-03-29 16:58 ` [PATCH v2 10/18] pci: Check region ranges are addressable Andrew Scull
2023-04-24 14:06   ` Stefan Agner
2022-03-29 16:58 ` [PATCH v2 11/18] pci: Range check address conversions Andrew Scull
2022-04-13 14:02   ` Bin Meng
2022-03-29 16:58 ` [PATCH v2 12/18] test: pci: Test PCI address conversion functions Andrew Scull
2022-04-13 14:03   ` Bin Meng
2022-04-13 16:44     ` Andrew Scull
2022-03-29 16:58 ` [PATCH v2 13/18] pci: Map bars with offset and length Andrew Scull
2022-04-12 16:42   ` Tom Rini
2022-04-12 22:54     ` Andrew Scull
2022-04-12 23:11       ` Tom Rini
2022-04-13 14:05   ` Bin Meng
2022-04-13 16:48     ` Andrew Scull
2022-03-29 16:58 ` [PATCH v2 14/18] pci: Match region flags using a mask Andrew Scull
2022-04-13 14:59   ` Bin Meng
2022-03-29 16:58 ` [PATCH v2 15/18] pci: Update dm_pci_bus_to_virt() parameters Andrew Scull
2022-04-13 15:03   ` Bin Meng
2022-04-14  7:44     ` Andrew Scull
2022-03-29 16:58 ` [PATCH v2 16/18] pci: Add mask parameter to dm_pci_map_bar() Andrew Scull
2022-04-13 15:10   ` Bin Meng
2022-04-14  7:46     ` Andrew Scull
2022-03-29 16:58 ` [PATCH v2 17/18] virtio: pci: Check virtio configs are mapped Andrew Scull
2022-04-13 15:12   ` Bin Meng
2022-03-29 16:59 ` [PATCH v2 18/18] virtio: pci: Make use of dm_pci_map_bar() Andrew Scull
2022-04-13 15:14   ` Bin Meng
2022-08-25  8:01     ` Felix Yan
2022-08-28 16:49       ` Xiang W
2022-08-28 17:21         ` Felix Yan
2022-04-13 15:17 ` [PATCH v2 00/18] virtio: pci: Add and fix consistency checks Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329165900.1139885-10-ascull@google.com \
    --to=ascull@google.com \
    --cc=adelva@google.com \
    --cc=bmeng.cn@gmail.com \
    --cc=keirf@google.com \
    --cc=ptosi@google.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.