From: Bjorn Helgaas <helgaas@kernel.org>
To: Oliver <oohall@gmail.com>
Cc: Shawn Anastasio <shawn@anastas.io>,
linux-pci@vger.kernel.org,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Sam Bobroff <sbobroff@linux.ibm.com>,
xyjxie@linux.vnet.ibm.com, rppt@linux.ibm.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] PCI: Introduce pcibios_ignore_alignment_request
Date: Wed, 29 May 2019 09:00:58 -0500 [thread overview]
Message-ID: <20190529140058.GB28250@google.com> (raw)
In-Reply-To: <CAOSf1CEFfbmwfvmdqT1xdt8SFb=tYdYXLfXeyZ8=iRnhg4a3Pg@mail.gmail.com>
On Tue, May 28, 2019 at 03:36:34PM +1000, Oliver wrote:
> On Tue, May 28, 2019 at 2:03 PM Shawn Anastasio <shawn@anastas.io> wrote:
> >
> > Introduce a new pcibios function pcibios_ignore_alignment_request
> > which allows the PCI core to defer to platform-specific code to
> > determine whether or not to ignore alignment requests for PCI resources.
> >
> > The existing behavior is to simply ignore alignment requests when
> > PCI_PROBE_ONLY is set. This is behavior is maintained by the
> > default implementation of pcibios_ignore_alignment_request.
> >
> > Signed-off-by: Shawn Anastasio <shawn@anastas.io>
> > ---
> > drivers/pci/pci.c | 9 +++++++--
> > include/linux/pci.h | 1 +
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index 8abc843b1615..8207a09085d1 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> > @@ -5882,6 +5882,11 @@ resource_size_t __weak pcibios_default_alignment(void)
> > return 0;
> > }
> >
> > +int __weak pcibios_ignore_alignment_request(void)
> > +{
> > + return pci_has_flag(PCI_PROBE_ONLY);
> > +}
> > +
> > #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE
> > static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0};
> > static DEFINE_SPINLOCK(resource_alignment_lock);
> > @@ -5906,9 +5911,9 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev,
> > p = resource_alignment_param;
> > if (!*p && !align)
> > goto out;
> > - if (pci_has_flag(PCI_PROBE_ONLY)) {
> > + if (pcibios_ignore_alignment_request()) {
> > align = 0;
> > - pr_info_once("PCI: Ignoring requested alignments (PCI_PROBE_ONLY)\n");
> > + pr_info_once("PCI: Ignoring requested alignments\n");
> > goto out;
> > }
>
> I think the logic here is questionable to begin with. If the user has
> explicitly requested re-aligning a resource via the command line then
> we should probably do it even if PCI_PROBE_ONLY is set. When it breaks
> they get to keep the pieces.
I agree. I don't like PCI_PROBE_ONLY in the first place. It's a
sledgehammer approach that doesn't tell us which resource assignments
need to be preserved or why. I'd rather use IORESOURCE_PCI_FIXED and
set it for the BARs where there's actually some sort of
hypervisor/firmware/OS dependency.
If there's a way to avoid another pciobios_*() weak function, that
would also be better.
Bjorn
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: Oliver <oohall@gmail.com>
Cc: Shawn Anastasio <shawn@anastas.io>,
Sam Bobroff <sbobroff@linux.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
rppt@linux.ibm.com, Paul Mackerras <paulus@samba.org>,
linux-pci@vger.kernel.org, xyjxie@linux.vnet.ibm.com,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v3 1/3] PCI: Introduce pcibios_ignore_alignment_request
Date: Wed, 29 May 2019 09:00:58 -0500 [thread overview]
Message-ID: <20190529140058.GB28250@google.com> (raw)
In-Reply-To: <CAOSf1CEFfbmwfvmdqT1xdt8SFb=tYdYXLfXeyZ8=iRnhg4a3Pg@mail.gmail.com>
On Tue, May 28, 2019 at 03:36:34PM +1000, Oliver wrote:
> On Tue, May 28, 2019 at 2:03 PM Shawn Anastasio <shawn@anastas.io> wrote:
> >
> > Introduce a new pcibios function pcibios_ignore_alignment_request
> > which allows the PCI core to defer to platform-specific code to
> > determine whether or not to ignore alignment requests for PCI resources.
> >
> > The existing behavior is to simply ignore alignment requests when
> > PCI_PROBE_ONLY is set. This is behavior is maintained by the
> > default implementation of pcibios_ignore_alignment_request.
> >
> > Signed-off-by: Shawn Anastasio <shawn@anastas.io>
> > ---
> > drivers/pci/pci.c | 9 +++++++--
> > include/linux/pci.h | 1 +
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index 8abc843b1615..8207a09085d1 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> > @@ -5882,6 +5882,11 @@ resource_size_t __weak pcibios_default_alignment(void)
> > return 0;
> > }
> >
> > +int __weak pcibios_ignore_alignment_request(void)
> > +{
> > + return pci_has_flag(PCI_PROBE_ONLY);
> > +}
> > +
> > #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE
> > static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0};
> > static DEFINE_SPINLOCK(resource_alignment_lock);
> > @@ -5906,9 +5911,9 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev,
> > p = resource_alignment_param;
> > if (!*p && !align)
> > goto out;
> > - if (pci_has_flag(PCI_PROBE_ONLY)) {
> > + if (pcibios_ignore_alignment_request()) {
> > align = 0;
> > - pr_info_once("PCI: Ignoring requested alignments (PCI_PROBE_ONLY)\n");
> > + pr_info_once("PCI: Ignoring requested alignments\n");
> > goto out;
> > }
>
> I think the logic here is questionable to begin with. If the user has
> explicitly requested re-aligning a resource via the command line then
> we should probably do it even if PCI_PROBE_ONLY is set. When it breaks
> they get to keep the pieces.
I agree. I don't like PCI_PROBE_ONLY in the first place. It's a
sledgehammer approach that doesn't tell us which resource assignments
need to be preserved or why. I'd rather use IORESOURCE_PCI_FIXED and
set it for the BARs where there's actually some sort of
hypervisor/firmware/OS dependency.
If there's a way to avoid another pciobios_*() weak function, that
would also be better.
Bjorn
next prev parent reply other threads:[~2019-05-29 14:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 4:03 [PATCH v3 0/3] Allow custom PCI resource alignment on pseries Shawn Anastasio
2019-05-28 4:03 ` Shawn Anastasio
2019-05-28 4:03 ` [PATCH v3 1/3] PCI: Introduce pcibios_ignore_alignment_request Shawn Anastasio
2019-05-28 4:03 ` Shawn Anastasio
2019-05-28 5:36 ` Oliver
2019-05-28 5:36 ` Oliver
2019-05-28 5:50 ` Shawn Anastasio
2019-05-28 6:27 ` Alexey Kardashevskiy
2019-05-28 6:27 ` Alexey Kardashevskiy
2019-05-28 7:39 ` Shawn Anastasio
2019-05-30 3:39 ` Alexey Kardashevskiy
2019-05-30 22:49 ` Shawn Anastasio
2019-05-31 3:56 ` Alexey Kardashevskiy
2019-06-03 2:23 ` Shawn Anastasio
2019-06-03 5:02 ` Alexey Kardashevskiy
2019-06-03 8:35 ` Alexey Kardashevskiy
2019-06-03 8:35 ` Alexey Kardashevskiy
2019-06-03 9:12 ` Shawn Anastasio
2019-06-03 9:12 ` Shawn Anastasio
2019-05-29 14:00 ` Bjorn Helgaas [this message]
2019-05-29 14:00 ` Bjorn Helgaas
2019-05-30 6:55 ` [EXTERNAL] " Sam Bobroff
2019-05-30 22:33 ` Shawn Anastasio
2019-05-30 22:33 ` Shawn Anastasio
2019-05-28 4:03 ` [PATCH v3 2/3] powerpc/64: Enable pcibios_after_init hook on ppc64 Shawn Anastasio
2019-05-28 4:03 ` Shawn Anastasio
2019-05-28 4:03 ` [PATCH v3 3/3] powerpc/pseries: Allow user-specified PCI resource alignment after init Shawn Anastasio
2019-05-28 4:03 ` Shawn Anastasio
2019-05-29 14:02 ` Bjorn Helgaas
2019-05-29 14:02 ` Bjorn Helgaas
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=20190529140058.GB28250@google.com \
--to=helgaas@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=rppt@linux.ibm.com \
--cc=sbobroff@linux.ibm.com \
--cc=shawn@anastas.io \
--cc=xyjxie@linux.vnet.ibm.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 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.