Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6030 (M3 Pro) changes #402

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

T6030 (M3 Pro) changes #402

wants to merge 5 commits into from

Conversation

emxll
Copy link

@emxll emxll commented Sep 9, 2024

Hey, here are some changes I made in order to get m1n1 to work (better, not perfectly though) on my chip.

A couple of notes:

I don't know how much work has been done on AIC3, but as far as I can tell, the interface is identical to (or a superset of) that of AIC2, with only the initial CFG offset being different. I've written aic3_init to be more inline with what the official driver does (mainly pulling everything from the adt (edt?) instead of hardcoding it like m1n1 does) but aic2_init is able to initialize everything just fine.

CMDLINE_LENGTH is 1024 (not 608) on my system/version of macOS but I'm not quite sure what the plan is for addressing this issue which is why I'm not submitting a patch.

The RTBuddy/__OSLOG (causing illegal address panics in phystokv) fix for booting macOS isn't enough for my kernelcache. I'll investigate this more if I can find the time.

@marcan
Copy link
Member

marcan commented Sep 24, 2024

I think you'll want to look at the PRs by @dberlin (e.g. #364) since he did most of the M3 m1n1 bringup already, it's just not merged yet because we didn't get around to pushing forward with that since priorities shifted elsewhere.

@emxll
Copy link
Author

emxll commented Sep 25, 2024

Once those changes have been merged i'll rebase and see if I'm still missing anything.

@flatz
Copy link

flatz commented Sep 26, 2024

@emxll @marcan I was able to fix __OSLOG panics by tweaking segment_names/segment_ranges cleaning code on Python's side:

adt.py:

def remove_os_log_segments(adt, name):
    key = f"/arm-io/{name}"
    if key in adt:
        entry = adt[key]
        try:
            segment_names = entry.segment_names.split(";")
            idx = segment_names.index("__OS_LOG")
            del segment_names[idx]
            entry.segment_names = ";".join(segment_names)
            entry.segment_ranges = entry.segment_ranges[:idx * 32] + entry.segment_ranges[(idx + 1) * 32:] # struct adt_segment_ranges
            return True
        except:
            pass
    return False

Change block within for name in ("mtp", "aop")::
init.py:

        for name in ("mtp", "aop", "dcp", "dcpext"):
            if name in self.adt["/arm-io"]:
                key = f"/arm-io/{name}"
                remove_os_log_segments(self.adt, name)
                remove_os_log_segments(self.adt, f"{name}/iop-{name}-nub")

chainload.py:

for name in ("mtp", "aop", "dcp", "dcpext"):
    if name in u.adt["/arm-io"]:
        key = f"/arm-io/{name}"
        remove_os_log_segments(u.adt, name)
        remove_os_log_segments(u.adt, f"{name}/iop-{name}-nub")

Also older cleaning code has a bug, OSLOG segment could be in the middle and not in the end as it may expect here:

if iop.segment_names.endswith(";__OS_LOG"):

@dberlin
Copy link
Contributor

dberlin commented Sep 26, 2024

Once those changes have been merged i'll rebase and see if I'm still missing anything.

FWIW:
I'm around and don't have a lot of time to code (but will in a few months, actually).

At the point i uploaded all my PR's, i could boot and run osx under m1n1.

I still have notes on things if you run into any issues.

@mildsunrise mildsunrise mentioned this pull request Nov 2, 2024
@mildsunrise
Copy link

although most of the patches here are no longer needed, some are still of value.
@emxll could you add the missing sign offs when you have some time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants