From: Bjorn Helgaas <helgaas@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: PCI: Disable not requested resource types in pci_enable_resources
Date: Fri, 10 Jul 2020 16:09:24 -0500 [thread overview]
Message-ID: <20200710210924.GA80868@bjorn-Precision-5520> (raw)
In-Reply-To: <18bb3264-9901-135d-8b40-1ee98dd672f1@gmail.com>
On Thu, May 28, 2020 at 08:47:12PM +0200, Heiner Kallweit wrote:
> Currently, if both resource types are enabled before the call, the mask
> value doesn't matter. Means as of today I wouldn't be able to e.g.
> disable PCI_COMMAND_IO. At least my interpretation is that mask defines
> which resource types are enabled after the call. Therefore change the
> behavior to disable not requested resource types.
>
> At least on my x86 devices this change doesn't have side effects.
Does this have a practical benefit? If it fixes a bug or if there's
something useful we can do because of this patch, I'll push it higher
up the priority list.
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/pci/setup-res.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
> index d21fa04fa..6ef458c10 100644
> --- a/drivers/pci/setup-res.c
> +++ b/drivers/pci/setup-res.c
> @@ -459,8 +459,8 @@ int pci_enable_resources(struct pci_dev *dev, int mask)
> int i;
> struct resource *r;
>
> - pci_read_config_word(dev, PCI_COMMAND, &cmd);
> - old_cmd = cmd;
> + pci_read_config_word(dev, PCI_COMMAND, &old_cmd);
> + cmd = old_cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
>
> for (i = 0; i < PCI_NUM_RESOURCES; i++) {
> if (!(mask & (1 << i)))
> --
> 2.26.2
>
next prev parent reply other threads:[~2020-07-10 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 18:47 PCI: Disable not requested resource types in pci_enable_resources Heiner Kallweit
2020-07-10 21:09 ` Bjorn Helgaas [this message]
2020-07-15 18:22 ` Heiner Kallweit
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=20200710210924.GA80868@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=hkallweit1@gmail.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