public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	bhelgaas@google.com, lorenzo.pieralisi@arm.com,
	benh@kernel.crashing.org
Subject: Re: [PATCH] PCI: decline to resize resources if boot config must be preserved
Date: Tue, 12 Jan 2021 16:49:19 -0600	[thread overview]
Message-ID: <20210112224919.GA1859692@bjorn-Precision-5520> (raw)
In-Reply-To: <20210109095353.13417-1-ardb@kernel.org>

On Sat, Jan 09, 2021 at 10:53:53AM +0100, Ard Biesheuvel wrote:
> The _DSM #5 method in the ACPI host bridge object tells us whether the
> OS is permitted to deviate from the resource assignment configured by
> the firmware. If this is not the case, we should not permit drivers to
> resize BARs on the fly. So make pci_resize_resource() take this into
> account.
> 
> Cc: <stable@vger.kernel.org> # v5.4+
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Capitalized subject to match convention and applied to pci/resource
for v5.11, thanks!

Is there an email, bug report, etc that prompted this change?

> ---
>  drivers/pci/setup-res.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
> index 43eda101fcf4..3b38be081e93 100644
> --- a/drivers/pci/setup-res.c
> +++ b/drivers/pci/setup-res.c
> @@ -410,10 +410,16 @@ EXPORT_SYMBOL(pci_release_resource);
>  int pci_resize_resource(struct pci_dev *dev, int resno, int size)
>  {
>  	struct resource *res = dev->resource + resno;
> +	struct pci_host_bridge *host;
>  	int old, ret;
>  	u32 sizes;
>  	u16 cmd;
>  
> +	/* Check if we must preserve the firmware's resource assignment */
> +	host = pci_find_host_bridge(dev->bus);
> +	if (host->preserve_config)
> +		return -ENOTSUPP;
> +
>  	/* Make sure the resource isn't assigned before resizing it. */
>  	if (!(res->flags & IORESOURCE_UNSET))
>  		return -EBUSY;
> -- 
> 2.17.1
> 

  reply	other threads:[~2021-01-12 22:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  9:53 [PATCH] PCI: decline to resize resources if boot config must be preserved Ard Biesheuvel
2021-01-12 22:49 ` Bjorn Helgaas [this message]
2021-01-13  9:55   ` Ard Biesheuvel

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=20210112224919.GA1859692@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=ardb@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    /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