linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: linux-pci@vger.kernel.org, bhelgaas@google.com
Cc: "Christian König" <christian.koenig@amd.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/3] PCI: Skip reassigning bridge resources if reducing BAR size
Date: Tue, 16 Aug 2022 13:40:30 -0600	[thread overview]
Message-ID: <166067880991.1885802.3339740933334886723.stgit@omen> (raw)
In-Reply-To: <166067824399.1885802.12557332818208187324.stgit@omen>

More work is probably necessary here, pci_reassign_bridge_resources()
has heavy weight requirements that the aperture windows are unused,
without even testing if the requested resize is possible in the
existing aperture.  One case we can clearly skip is when reducing the
size of a BAR.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/setup-res.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 439ac5f5907a..7a8e1e4f4d33 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -450,7 +450,7 @@ int pci_resize_resource(struct pci_dev *dev, int resno, int size)
 	res->end = res->start + pci_rebar_size_to_bytes(size) - 1;
 
 	/* Check if the new config works by trying to assign everything. */
-	if (dev->bus->self) {
+	if (size > old && dev->bus->self) {
 		ret = pci_reassign_bridge_resources(dev->bus->self, res->flags);
 		if (ret)
 			goto error_resize;



  parent reply	other threads:[~2022-08-16 19:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 19:39 [PATCH 0/3] PCI: Expose resource resizing through sysfs Alex Williamson
2022-08-16 19:40 ` [PATCH 1/3] PCI: Fix double-free in resource attribute error path Alex Williamson
2022-08-16 19:40 ` Alex Williamson [this message]
2022-08-16 19:41 ` [RFC PATCH 3/3] PCI: Expose PCIe Resizable BAR support via sysfs Alex Williamson
2022-08-17 10:10 ` [PATCH 0/3] PCI: Expose resource resizing through sysfs Christian König
2022-08-17 14:02   ` Alex Williamson
2022-08-18 11:16     ` Christian König

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=166067880991.1885802.3339740933334886723.stgit@omen \
    --to=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).