Skip to content

Framebuffer on notched devices not being page size aligned causes issues with Project Mu booting #468

@amarioguy

Description

@amarioguy

Hello,

I normally don't raise issues on the main m1n1 repository for issues relating to scenarios that aren't directly linked to U-Boot or Asahi (since I handle those on my fork myself more or less because upstream focuses on Linux first) but I'm running into an issue where I'm not sure how to solve it fully properly, and this could affect anyone that wants to use standard EDK2 firmware on upstream m1n1 as well so I'm raising the issue here.

The issue here is that Project Mu (and standard EDK2 firmware by extension) is expecting that all virtual memory map addresses and lengths be page aligned, which makes sense because that's required when enabling the MMU, however the trouble is that the framebuffer on notched laptops (my scenario is a J416s MacBook Pro (Early 2023), M2 Pro) by virtue of being at a non-standard resolution either doesn't have a page aligned length (before m1n1 gets the notchless FB) or doesn't have a page aligned base address (after m1n1 gets the notchless FB). Both cases cause my Mu fork to error out. Hacking around it by leaving either framebuffer base or length unchanged isn't an option either since the guest will inevitably try to write to unmapped framebuffer memory which causes an exception.

I don't mind implementing the fix myself - but how would I need to do the math on the framebuffer (I believe get_notchless_fb in kboot.c is where the correction to the framebuffer happens on notched devices) so that the FB ends up being page aligned in terms of both base address and size? Ideally I wouldn't want to tamper with the resolution here, but if that's the only solution then so be it. (I need at least 4K page alignment here but because of how ASi platforms rely on 16K page alignment, that would be preferred)

Logs attached for your convenience (note that these logs are for m1n1 itself - Mu isn't the problem here it's m1n1 and how it handles notched framebuffers and page alignment)

m1n1_fb_notch_issue_get_notchless_fb_call_disabled_log.txt

m1n1_fb_notch_issue_get_notchless_fb_call_base_unchanged_log.txt

m1n1_fb_notch_issue_default_behavior_log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions