From: "Christian König" <christian.koenig@amd.com>
To: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Cc: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>,
Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>,
Bjorn Helgaas <helgaas@kernel.org>
Subject: Are back to back PCIe BAR allocations supported by Linux?
Date: Thu, 1 Apr 2021 14:03:34 +0200 [thread overview]
Message-ID: <30b3cc23-75db-a2f7-cf1d-e02182db8be3@amd.com> (raw)
Hello everyone,
we recently had a bug report of a system which works fine when a PCIe
hotplug device is connected on boot, but fails to initialize if those
device are disconnected and then reconnected again.
During investigation I've found that Linux isn't able to assign the BARs
of the device correctly while reconnecting. The problem seems to be that
the Linux PCI code doesn't seem to use back to back BAR allocations.
Now what's back to back BAR allocation? Let's assume you have two
devices with a 256MiB BAR and a 2MiB BAR each behind a common upstream
bridge.
The configuration Linux seems to use is the following:
Device A - 256MiB BAR
Device A - 2MiB BAR
Padding 254MiB
Device B - 256MiB BAR
Device B - 2MIB BAR
With padding this results in at least 770MiB address space requirement
for the common upstream bridge, with alignment this is probably more
like 1GiB.
The BIOS on the other hand seems to be capable of configuring the BARs
like this:
Device A - 256MiB BAR
Device A - 2MiB BAR
Padding 252MiB
Device B - 2MIB BAR
Device B - 256MiB BAR
The result is that you only need 768MiB address space for the upstream
bridge which then perfectly fits into what is assigned for hotplug here.
Is that already supported by the Linux PCIe code? If yes then how? I've
tried to read a bit into the BAR allocation code, but it is kind of hard
to understand.
Regards,
Christian.
next reply other threads:[~2021-04-01 17:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 12:03 Christian König [this message]
2021-04-09 16:30 ` Are back to back PCIe BAR allocations supported by Linux? Christian König
2021-04-09 17:00 ` 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=30b3cc23-75db-a2f7-cf1d-e02182db8be3@amd.com \
--to=christian.koenig@amd.com \
--cc=Andrey.Grodzovsky@amd.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=s.miroshnichenko@yadro.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).