From: Shawn Anastasio <shawn@anastas.io>
To: Oliver <oohall@gmail.com>
Cc: linux-pci@vger.kernel.org,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Bjorn Helgaas <bhelgaas@google.com>,
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>,
Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [RESEND PATCH 0/3] Allow custom PCI resource alignment on pseries
Date: Mon, 27 May 2019 23:09:43 -0500 [thread overview]
Message-ID: <476555b7-b462-d844-57ea-7ca1c6113d9b@anastas.io> (raw)
In-Reply-To: <CAOSf1CFFyz0YNqdpd5r44MaBV449yoK3WOMBZ1mpgZ=judNfDQ@mail.gmail.com>
On 5/27/19 11:01 PM, Oliver wrote:
> On Tue, May 28, 2019 at 8:56 AM Shawn Anastasio <shawn@anastas.io> wrote:
>>
>> Hello all,
>>
>> This patch set implements support for user-specified PCI resource
>> alignment on the pseries platform for hotplugged PCI devices.
>> Currently on pseries, PCI resource alignments specified with the
>> pci=resource_alignment commandline argument are ignored, since
>> the firmware is in charge of managing the PCI resources. In the
>> case of hotplugged devices, though, the kernel is in charge of
>> configuring the resources and should obey alignment requirements.
>
> Are you using hotplug to work around SLOF (the OF we use under qemu)
> not aligning BARs to 64K? It looks like there is a commit in SLOF to
> fix that (https://git.qemu.org/?p=SLOF.git;a=commit;f=board-qemu/slof/pci-phb.fs;h=1903174472f8800caf50c959b304501b4c01153c).
>
No, my application actually requires PCI hotplug at run-time.
>> The current behavior of ignoring the alignment for hotplugged devices
>> results in sub-page BARs landing between page boundaries and
>> becoming un-mappable from userspace via the VFIO framework.
>> This issue was observed on a pseries KVM guest with hotplugged
>> ivshmem devices.
>
>> With these changes, users can specify an appropriate
>> pci=resource_alignment argument on boot for devices they wish to use
>> with VFIO.
>>
>> In the future, this could be extended to provide page-aligned
>> resources by default for hotplugged devices, similar to what is done
>> on powernv by commit 382746376993 ("powerpc/powernv: Override
>> pcibios_default_alignment() to force PCI devices to be page aligned").
>
> Can we make aligning the BARs to PAGE_SIZE the default behaviour? The
> BAR assignment process is complex enough as-is so I'd rather we didn't
> add another platform hack into the mix.
Absolutely. This will still require the existing changes so that the
custom alignment isn't flat-out ignored on pseries, but I can set
it to default to PAGE_SIZE as well, similar to how it's done on PowerNV.
I've just pushed a v3 to fix a typo and I'll incorporate this change
in v4.
>> Feedback is appreciated.
>>
>> Thanks,
>> Shawn
>>
>> Shawn Anastasio (3):
>> PCI: Introduce pcibios_ignore_alignment_request
>> powerpc/64: Enable pcibios_after_init hook on ppc64
>> powerpc/pseries: Allow user-specified PCI resource alignment after
>> init
>>
>> arch/powerpc/include/asm/machdep.h | 6 ++++--
>> arch/powerpc/kernel/pci-common.c | 9 +++++++++
>> arch/powerpc/kernel/pci_64.c | 4 ++++
>> arch/powerpc/platforms/pseries/setup.c | 22 ++++++++++++++++++++++
>> drivers/pci/pci.c | 9 +++++++--
>> 5 files changed, 46 insertions(+), 4 deletions(-)
>>
>> --
>> 2.20.1
>>
next prev parent reply other threads:[~2019-05-28 4:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 22:55 [RESEND PATCH 0/3] Allow custom PCI resource alignment on pseries Shawn Anastasio
2019-05-27 22:55 ` [RESEND PATCH 1/3] PCI: Introduce pcibios_ignore_alignment_request Shawn Anastasio
2019-05-27 22:55 ` [RESEND PATCH 2/3] powerpc/64: Enable pcibios_after_init hook on ppc64 Shawn Anastasio
2019-05-27 22:55 ` [RESEND PATCH 3/3] powerpc/pseries: Allow user-specified PCI resource alignment after init Shawn Anastasio
2019-05-28 4:01 ` [RESEND PATCH 0/3] Allow custom PCI resource alignment on pseries Oliver
2019-05-28 4:09 ` Shawn Anastasio [this message]
2019-05-28 4:52 ` Oliver
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=476555b7-b462-d844-57ea-7ca1c6113d9b@anastas.io \
--to=shawn@anastas.io \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--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=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 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).