public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: greg@unrelenting.technology, devel@edk2.groups.io, mw@semihalf.com
Cc: Leif Lindholm <leif@nuviainc.com>
Subject: Re: [edk2-devel] Additional configuration options on Armada/Cn913x
Date: Thu, 11 Jun 2020 16:38:48 +0200	[thread overview]
Message-ID: <f8bd15bf-27b1-5e5b-4ed1-117a49512382@arm.com> (raw)
In-Reply-To: <38e05018a4b41becb9d6a37f9defef38@unrelenting.technology>

On 6/11/20 4:33 PM, greg@unrelenting.technology wrote:
> June 11, 2020 5:17 PM, "Ard Biesheuvel" <ard.biesheuvel@arm.com> wrote:
> 
>> On 6/11/20 4:07 PM, greg@unrelenting.technology wrote:
>>
>>> June 11, 2020 4:19 PM, "Ard Biesheuvel" <ard.biesheuvel@arm.com> wrote:
>>> On 6/5/20 5:19 PM, Marcin Wojtas via groups.io wrote:
>>>> Disabling ECAM shift is just a matter of exposing the iATU controls to the OS, right? Why do you
>>>> need to disable it?
>>>
>>> I'm not sure what iATU controls are (and we don't want to do anything in the OS),
>>> but basically the current address is shifted by 0x8000 to only expose the last device to the OS,
>>> to work around the silicon bug (lack of some filtering thing) that causes devices to appear many
>>> many times.
>>> But actually most modern devices (e.g. AMD RX 480, Mellanox CX2) *do not* get duplicated at all,
>>> they show up
>>> in the first position, and this shift moves the memory way past that position and the OS sees
>>> no PCIe devices at all. The only device that was duplicated into all slots for me was a cheap SATA
>>> card.
>>> In my experience whether the device is duplicated seems to correlate with the "Legacy" field
>>> in the UEFI Shell's pci command. IIRC Marcin has explained the actual technical characteristic
>>> of these devices in some mail before. So it might actually be possible to decide whether to do the
>>> shift
>>> automatically at runtime depending on the inserted device (?)
>>> But a setting in the setup menu is easier to do and less magical.
>>> I've just been running with the shift reverted:
>>> https://github.com/myfreeweb/edk2-platforms/commit/36395be2a8707f6d396e07405eb9fe47b64cf964
>>> to make my Radeon GPU work.
>>
>> OK, the shift is definitely a hack, and your assertion that 'most modern devices do not get
>> duplicated at all' does not match my experience, tbh.
>> Are these all devices that support ARI by any chance?
> 
> Mellanox (ConnectX-2) and Intel (82599ES and good old 82576) NICs do.
> 
> But AMD GPUs actually don't! Still the RX480 (POLARIS10) only works without the shift.
> 

Interesting. It all depends on whether the endpoint decodes the device 
field to begin with: it doesn't have to, since the root port at the 
other end should be doing the filtering.

> An older GPU (HD7970 I think) I've tried once was duplicated, but only literally duplicated (into two),
> not into *all* slots.
> 

This is because the iATU granule size is 64k, and so we are only 
exposing 64k of ECAM space to the CPU. (Other implementations of this IP 
that use smaller granule sizes don't need this shift at all)

>> The problem is that the PCIe IP is truly broken, and the lack of a root port means that TLPs get
>> emitted that should never reach the device in the first place, and it is not the job of the device
>> to filter these TLPs, or reason about their own device # in the first place.
> 
> Well, it must be that AMD Radeons do reason about this :)
> and that sadly breaks the offset hack.
> 

This is interesting. I wouldn't expect the endpoint to have any 
awareness of how the ECAM space is exposed to the CPU. How does it fail 
exactly?

  reply	other threads:[~2020-06-11 14:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 15:19 Additional configuration options on Armada/Cn913x Marcin Wojtas
2020-06-11 13:19 ` [edk2-devel] " Ard Biesheuvel
2020-06-11 14:07 ` greg
2020-06-11 14:17   ` Ard Biesheuvel
2020-06-11 22:43     ` Mark Kettenis
2020-06-12  8:45       ` Ard Biesheuvel
2020-06-12 15:07         ` Marcin Wojtas
2020-06-12 16:32           ` greg
2020-06-12 17:09             ` Marcin Wojtas
2020-06-20 15:44               ` Marcin Wojtas
2020-06-11 14:33   ` greg
2020-06-11 14:38     ` Ard Biesheuvel [this message]
2020-06-11 14:46     ` greg

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-list 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=f8bd15bf-27b1-5e5b-4ed1-117a49512382@arm.com \
    --to=devel@edk2.groups.io \
    /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