andreiw / RaspberryPiPkg

DEPRECATED - DO NOT USE | Go here instead ->
https://github.com/tianocore/edk2-platforms/tree/master/Platform/RaspberryPi/RPi3
744 stars 142 forks source link

[RFC] Submitting RaspberryPiPkg to edk2-platforms #88

Closed pbatard closed 5 years ago

pbatard commented 5 years ago

Hi Andrei,

I am planning to submit your RaspberryPiPkg for integration into edk2-platforms, since I think it's gotten stable enough to try to officialize things and I am also hoping that having an inexpensive and widely popular ARM platform there will help getting more people interested in EDK2/UEFI development.

Before submitting your code for integration however, I want to give everyone interested an opportunity to comment on the proposal, a version of which can be found at https://github.com/pbatard/RaspberryPiPkg

Now, to try to keep things short, the points of interest I would like to bring up on that proposal are the following:

At this stage, depending on the feedback provided here, I am aiming at starting submitting patches for edk2-platforms integration around the middle of next week.

I'll conclude by saying a massive THANKS to Andrei and everybody who contributed to making a usable UEFI firmware for the Raspberry Pi a reality, which is something I have been wanting to see for a long time. Hopefully, we can now push it to the next step and make its formal integration into EDK2 a reality...

pbatard commented 5 years ago

Just to mention that a v2 of the EDK2 patch was submitted, since they wanted a more manageable break down of the components.

Once they start reviewing it in earnest, we'll probably need to submit a few more versions, but that's the just the regular EDK2 submission workflow.

andreiw commented 5 years ago

Congrats! Very cool.

P.S. I've not had a chance to fix HypDxe yet but I'll get there soon :).

A

On Mon, Dec 10, 2018 at 12:45 PM Pete Batard notifications@github.com wrote:

Just to mention that a v2 of the EDK2 patch https://lists.01.org/pipermail/edk2-devel/2018-December/033686.html was submitted, since they wanted a more manageable break down of the components.

Once they start reviewing it in earnest, we'll probably need to submit a few more versions, but that's the just the regular EDK2 submission workflow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andreiw/RaspberryPiPkg/issues/88#issuecomment-445905964, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsta4n4qUO2jtIPGUCpY2zxWzgt-IP5ks5u3p2ngaJpZM4YKFNy .

-- A

pbatard commented 5 years ago

No worries about HypDxe. We can sort that out after edk2 integration.

Just one question, that I wondered about and that also got raised from the initial patches review: What does AddAnd mean in the AddAndRTSData() (and other AddAnd...) function calls of MemoryInitPeiLib.c?

I think I can address the other points that were raised (see Ard's latest replies here), but that one question I can't answer.

andreiw commented 5 years ago

MemoryPeim function is supposed to create the memory map.

AddAndXXX creates a new resource range and then immediately reserves it away with a certain memory allocation type. There are multiple of these, because different ranges call for different resource range attributes (such as cache-ability) and of course different types.

The Variable portion of the FD has to be accessible after ExitBootServices, and so must be reserved as RuntimeServicesData.

A

13 дек. 2018 г., в 5:23, Pete Batard notifications@github.com написал(а):

No worries about HypDxe. We can sort that out after edk2 integration.

Just one question, that I wondered about and that also got raised from the initial patches review: What does AddAnd mean in the AddAndRTSData() (and other AddAnd...) function calls of MemoryInitPeiLib.c?

I think I can address the other points that were raised (see Ard's latest replies here), but that one question I can't answer.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

andreiw commented 5 years ago

Yes, you can drop the MMIO range, as its not used in RT services. (Don’t drop it from the ARM_MEMORY_REGION_DESCRIPTOR, though, if you like booting - it needs to be mapped in the page tables)

A

13 дек. 2018 г., в 5:23, Pete Batard notifications@github.com написал(а):

No worries about HypDxe. We can sort that out after edk2 integration.

Just one question, that I wondered about and that also got raised from the initial patches review: What does AddAnd mean in the AddAndRTSData() (and other AddAnd...) function calls of MemoryInitPeiLib.c?

I think I can address the other points that were raised (see Ard's latest replies here), but that one question I can't answer.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

pbatard commented 5 years ago

For those who wonder what's the status on the EDK2 submission, I'm just going to point out that I am still working on the v3 patch submission process and that you can follow the progress of it through the corresponding github project on my branch.

Because I'm a bit busy with other stuff, and splitting the content between Platform and Silicon is likely to take some time, I probably won't be able to submit the v3 until next week at the earliest.

andreiw commented 5 years ago

Thanks for the update. I still owe you a HypDxe fix. Time...

pbatard commented 5 years ago

v3 patchset has now been posted to edk2 mailing list (see here). Sorry it took so long.

I'll start working on a new v4 patchset right away, since we have the usual set of additional requests, but one thing I could use some help with is the feedback we just got on the ACPI tables:

pbatard commented 5 years ago

Also, I got the following question (off list):

Arasan implements the SDHCI spec and edk2 has a driver for this already - Can you use the NonDiscoverbleDevice infrastructure to use the existing driver and avoid introducing another one?

Any thoughts on that?

andreiw commented 5 years ago

Yeah, the Arasan controller has a bunch of nasty quirks like using 32-bit only accesses.

I am not saying it's impossible, but the stock SDHCI driver will not work, and it will take a serious effort to get anywhere. Effort that I am sure no one from the "helpful reviewer camp" wants to front.

A

On Mon, Jan 28, 2019 at 5:52 PM Pete Batard notifications@github.com wrote:

Also, I got the following question (off list):

Arasan implements the SDHCI spec and edk2 has a driver for this already https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Bus/Sd/SdBlockIoPei

  • Can you use the NonDiscoverbleDevice infrastructure to use the existing driver and avoid introducing another one?

Any thoughts on that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andreiw/RaspberryPiPkg/issues/88#issuecomment-458334769, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsta5EkETthLDj2PBrJqqte31CqJokuks5vH387gaJpZM4YKFNy .

-- A

andreiw commented 5 years ago

Yikes. v4? Sorry you have to deal with this. You know, considering the general quality of stuff in edk2, I'm curious why there's so much cage rattling going on. Surely once the big items (e.g. code structure) are in, it's easier to fix the rest of the nits in place, esp. when many of these (e.g. SDHCI) require domain experience or just plain effort that a single person can't meaningfully provide, pro bono, in a reasonable time frame. If you get frustrated and give up, what's the value behind any of these "helpful reviews?"

The ACPI feedback you got is exactly useless. There is only one OS on the planet, publicly, that these will boot. The tables came from Microsoft. They are not even ACPI compliant (there's no definition of ACPI that includes the RPI interrupt controller!). You do as little as breathe at them the wrong way, and that only OS (Windows) will probably not boot - I remember having to maintain the compiler IDs across iasl invocations to match the M$ ones. It was a nightmare, because the wrong IDs meant the system was not being detected as the Pi (with obvious bugcheck consequences, completely undebuggable without symbols).

We can't randomly change the PNP IDs, just because Ard would like it that way, because the Microsoft Windows drivers expect those exact IDs.

A

On Mon, Jan 28, 2019 at 11:38 AM Pete Batard notifications@github.com wrote:

v3 patchset has now been posted to edk2 mailing list (see here https://lists.01.org/pipermail/edk2-devel/2019-January/thread.html#35789). Sorry it took so long.

I'll start working on a new v4 patchset right away, since we have the usual set of additional requests, but one thing I could use some help with is the feedback we just got on the ACPI tables https://lists.01.org/pipermail/edk2-devel/2019-January/035798.html:

  • Looks like the _CID (Compatible ID) name string need to follow a specific format (4 letters + 4 digits? I'm still trying to figure out where this is documented...), so we need to change that. However, I'd rather have you pick the IDs you think will suit us best, rather than improvise stuff on my own, since you're more familiar with the platform.
  • Ard also wonders is there's any chance we could make these ACPI tables compliant with the 6.0+ specs, since they appear to be 5.0 and rather Windows centric. This looks unlikely to me (or at least, it's not something I can see myself doing on my own in any reasonable timeframe) and it is not a showstopper, but I'd still like to have your thoughts on that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andreiw/RaspberryPiPkg/issues/88#issuecomment-458204841, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsta_cau9MjYlfb_lWqrM8_ksO7xII6ks5vHyd9gaJpZM4YKFNy .

-- A

pbatard commented 5 years ago

Thanks for the updates. I kind of figured as much for the Arasan driver replacement, and I had a hunch that the ACPI changes might be a lot more problematic than Ard thinks they are. Can't blame the EDK2 people for trying to see how much compliance and reuse we can squeeze into the Pi UEFI firmware, especially as a lot of people may come to look at that firmware due to the Pi popularity. So they want to make sure that things are as close to a nice spotless reference platform as can be. But of course, the Pi hardware and the ACPI implementation Microsoft chose to use will alter that deal quite a bit...

With this new feedback, I should be able to submit a v4 later on today.

andreiw commented 5 years ago

I don't think it's ever going to be spotless, and frankly, that's still better than what they have today for Pi (nothing at all) or some of the other embedded boards (usually just UART + MMC)

Some obvious areas that need work, in case there are folks yearning to do something on the Pi:

A

On Tue, Jan 29, 2019 at 7:05 AM Pete Batard notifications@github.com wrote:

Thanks for the updates. I kind of figured as much for the Arasan driver replacement, and I had a hunch that the ACPI changes might be a lot more problematic than Ard thinks they are. Can't blame the EDK2 people for trying to see how much compliance and reuse we can squeeze into the Pi UEFI firmware, especially as a lot of people may come to look at that firmware due to the Pi popularity. So they want to make sure that things are as close to a nice spotless reference platform as can be. But of course, the Pi hardware and the ACPI implementation Microsoft chose to use will alter that deal quite a bit...

With this new feedback, I should be able to submit a v4 later on today.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andreiw/RaspberryPiPkg/issues/88#issuecomment-458516016, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsta56V30ja6Utvp5rb9AlZnOoaGdbqks5vIDjugaJpZM4YKFNy .

-- A

pbatard commented 5 years ago

I have now posted a v4 patchset.

Quite frankly, I don't think the "pushback" from the EDK2 is that bad, especially compared to some other projects that are a way more autocratic in their decisionmaking. At least the EDK2 feedback is rational and looks fair to me since, of course, they can't know everything about how the source took shape, so it's natural they'll ask about things that they believe might be improved, while not realizing that it's not as easy as it may seem. Plus some of the elements they asked to fix were problems that I introduced myself (such as trying to slide the GpioLib function defs in IndustryProtocol to spare us a header, which I reckon wasn't probably that great an idea).

Besides, I went into this expecting that it'll probably take us at least 6 pacthset submissions before we get the platform integrated, so I knew what I was signing for...

And just so you know, Ard, who has now tested a build on real hardware, is very enthusiastic about it. 😄

hansmbakker commented 5 years ago

@pbatard it looks like you (and others too, but I see you driving this recent work on the mailing list) did a tremendous effort, well done! Really nice to get such feedback, too!

And in general - thanks to all people working on this repo! Knowledge of these low-level things is not that common, so it's really nice that you spend your effort on improving RPi support! I think if this is merged in upstream, it is a really well-deserved :+1: for all maintainers here!

andreiw commented 5 years ago

Good! Glad people like it - that’s definitely incentive to push on.

I had recently fixed the weird handling of boot options (esp between 3B/3B+ and between Arasan/SdHost), and will also soon push a DisplayDxe/ConfigDxe improvement around virtual resolution handling, which will make the 7” Pi screen actually usable.

A

29 янв. 2019 г., в 16:11, Pete Batard notifications@github.com написал(а):

I have now posted a v4 patchset.

Quite frankly, I don't think the "pushback" from the EDK2 is that bad, especially compared to some other projects that are a way more autocratic in their decisionmaking. At least the EDK2 feedback is rational and looks fair to me since, of course, they cant' know everything about how the source took shape, so it's natural they'll ask about things that they believe might be improved, while not realizing that it's notas easy as it may seem. Plus some of the elements they asked to fix were problems that I introduced myself (such as trying to slide the GpioLib function defs in IndustryProtocol to spare us a header, which I reckon wasn't probably that great an idea).

Besides, I went into this expecting that it'll probably take us at least 6 pacthset submissions before we get the platform integrated, so I knew what I was signing for...

And just so you know, Ard, who has now tested a build on real hardware, is very enthusiastic about it. 😄

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

pbatard commented 5 years ago

Just going to drop a link to the v5 that was submitted about a week ago. I expect this one to take a bit longer to be reviewed, as it also depends on an patch that moves VirtualRealTimeClockLib into edk2's EmbeddedPkg.

Now, it is possible that these 2 patchsets are the ones that finally lead to RPi being integrated as a platform into the EDK2, but I wouldn't hold my breath... Still, even if the process is slow, things are continuing to move steadily towards achieving that goal.

pbatard commented 5 years ago

And we're finally in!! 😄

As of today, if you pull the latest edk2, edk2-platforms and edk2-non-osi, then you can build the RPi3 firmware right off the authoritative UEFI Open Source repositories. Isn't that just awesome? 😉

Andrei, I really can't thank you enough for the work you did on this project and all the help you provided. Even if it may have felt slow at times, turning your repository into something that the EDK2 would accept was a relative breeze, so you really did an outstanding job in the first place here!

And while I did have to rework a few things, some of which might make the EDK2 version look quite different from yours in some places (mostly due to reworking the code style, in order to keep the EDK2 folks happy), I hope you too will be thrilled with the result.

Oh, and just so you know, more EDK2 people have come forward to indicate how impressed they are after having tested the firmware.

Since there's nothing more to do here, I will therefore close this issue.

andreiw commented 5 years ago

Thanks Pete, this is an amazing achievement. Thank you for your work.

Aside from stylistical changes and HypDxe, what are the functional differences?

pbatard commented 5 years ago

From looking at the history from https://github.com/pbatard/RaspberryPiPkg/commits/master this is what I can come up with:

There's probably more stuff that I'm forgetting, but this should give you some idea. Overall no real major changes.

By the way, one thing I would advise you to do, instead of committing your firmware binaries in the source itself, which is a practice that's generally frowned upon because it forces everyone who wants to clone or fork the source to carry a lot of cumbersome deadweight, is to instead use the GitHub Releases feature to upload these same binaries, like I did here for instance. Unless they are needed for the build, there's no good reason to include binaries in a source, especially when working with a GitHub repo.

Also, if you'd like, now that the platform has been integrated, I would also encourage you to create your own clone of edk2-platforms and upload GitHub Releases for the EDK2 binaries there, so that you can point people to trying these alternate versions if they want to. Of course, I could do that myself too, but I think it makes more sense if you were the one to do it, as you have come to be known as the provider of UEFI RPi firmwares (and for good measure, since it's mostly your work :wink:).

andreiw commented 5 years ago

Thanks Pete - that’s the plan, I will re-host myself in top of your upstream now and start providing builds the preferred way.

One question: Who is the maintainer for the upstream? Again, sadly, I’ll barely have time to continue adding value to the firmware, which excludes upstreaming activities for further work...

pbatard commented 5 years ago

Well, as per Maintainers.txt, Ard. Leif and Michael (who all participated in the review process) are now the official maintainers of the platform.

But I guess your question is more "Who will take the job of sending patches and fixes I might add to my repo to EDK2 upstream?" in which case, provided I have the time, I will try to continue to do so.

However, as you have seen, this takes quite a bit of time, and I too will be trying to wind down my RPi related activities so that I can concentrate on other matters, so I can't promise anything...

pbatard commented 5 years ago

As a matter of fact, I'm going to point out that Ard is already submitting improvements of his own against the platform, such as adding a Random Number Generator driver, so, you'll definitely want to monitor upstream for changes...

andreiw commented 5 years ago

Ok, thanks

A

16 февр. 2019 г., в 3:07, Pete Batard notifications@github.com написал(а):

As a matter of fact, I'm going to point out that Ard is already submitting improvements of his own against the platform, such as adding a Random Number Generator driver, so, you'll definitely want to monitor upstream for changes...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

andreiw commented 5 years ago

What does it take to be added to Maintainers.txt? Or is it not per platform, but global?

pbatard commented 5 years ago

It's global. AFAIK, the regular edk-2platforms contributors and maintainers tend to take ownership, since there's no guarantee that the person who submitted a platform is actually going to stick around.