#
#asahi-dev · 2023-11-28 14:28
DannyBso we do call memalign
#asahi-dev · 2023-11-28 14:28
DannyBwe configure TCR in mmu_configure after initing pagetables/etc
#asahi-dev · 2023-11-28 14:27
DannyBActually
#asahi-dev · 2023-11-28 14:27
DannyBright?
#asahi-dev · 2023-11-28 14:27
DannyBeven though nothing in between allocates memory
#asahi-dev · 2023-11-28 14:27
svenhuh
#asahi-dev · 2023-11-28 14:27
DannyByes
#asahi-dev · 2023-11-28 14:27
svenor, wait, you first set it to the XNU value and then later m1n1 overwrites it and the MMU works then?
#asahi-dev · 2023-11-28 14:26
DannyBand the initial TCR set by XNU in common_start is 0x10800236511A511uLL
#asahi-dev · 2023-11-28 14:26
svenhmm... how does the XNU TCR differ from ours?
#asahi-dev · 2023-11-28 14:26
DannyBThe initial SPRR perms for EL1 (set by iboot i guess?) is 0x2020A5203020FAF5LL
#asahi-dev · 2023-11-28 14:25
DannyBi know the value but don't know what sets it
#asahi-dev · 2023-11-28 14:25
DannyBThere is a bootstrap SPRR set of perms
#asahi-dev · 2023-11-28 14:24
DannyBso please, have at it :)
#asahi-dev · 2023-11-28 14:24
DannyBRubber duck debugging is great
#asahi-dev · 2023-11-28 14:24
svenj`ey: i'm only asking dumb questions anyway because that usually helps when i'm stuck at weird bugs like that :D
#asahi-dev · 2023-11-28 14:24
DannyBi'll update it to my hacked up current version
#asahi-dev · 2023-11-28 14:23
DannyBand definitely busted
#asahi-dev · 2023-11-28 14:23
DannyBThat code is now old
#asahi-dev · 2023-11-28 14:23
DannyBThe initial TCR, and bootstrap pagetables, are the same in XNU for 14.2 for m2/m3. I was going to look at older kernels today see if it was differnet before, and they just chose something in 14.2 that works for all
#asahi-dev · 2023-11-28 14:23
DannyBYes. I have the initial XNU TCR value, and decoded it, ours did not look crazy but maybe i decoded it wrong.
#asahi-dev · 2023-11-28 14:23
j`eyhttps://github.com/AsahiLinux/m1n1/pull/357/files the code is here
#asahi-dev · 2023-11-28 14:23
svenI don't remember if the initial pagetables already use SPRR but they might
#asahi-dev · 2023-11-28 14:21
svenhave you checked if the initial xnu pagetables look weird in some way or how that TCR value XNU differs from the one inside m1n1?
#asahi-dev · 2023-11-28 14:21
mazinteresting!
#asahi-dev · 2023-11-28 14:21
svennice :)
#asahi-dev · 2023-11-28 14:21
DannyB(On the plus side, i did figure out 75% of the unknown chicken bits we are using on the M2 and documented them :)
#asahi-dev · 2023-11-28 14:20
DannyBto MMU/SPRR
#asahi-dev · 2023-11-28 14:20
DannyBand they don't look related
#asahi-dev · 2023-11-28 14:20
DannyBI also was able to get most of the names/info of these chicken bits from the kernel debug info
#asahi-dev · 2023-11-28 14:20
DannyBAs for chickens themselves, i automated running every combination of lines in chickens for m3 and they all have the same behavior if i don't play with TCR (IE none of them change that we hang the chip the second MMU is turned on)
#asahi-dev · 2023-11-28 14:18
DannyBbut i set them to lockdown nothing in chickens (and have tried both ways there too)
#asahi-dev · 2023-11-28 14:18
DannyBwhich appears to be MSR lockdown for EL2
#asahi-dev · 2023-11-28 14:17
DannyBthere is also an additional MSR lockdown register that is write only
#asahi-dev · 2023-11-28 14:17
svenI think it's just the call to mmu_init_sprr() which may do weird things if they changed those regs
#asahi-dev · 2023-11-28 14:17
DannyBsven: but not tried turning off SPRR permissions
#asahi-dev · 2023-11-28 14:17
DannyBsven: I have run it without gxf init and no dice
#asahi-dev · 2023-11-28 14:17
DannyBsven: I'll give it a shot
#asahi-dev · 2023-11-28 14:16
svenhrm, no, looking at it again we leave SPRR/GXF disabled in the MMU init and only prepare everything for the HV
#asahi-dev · 2023-11-28 14:15
svenI'd try to remove the sprr/gxf init from m1n1's mmu and see if that changes anything. I think we only need that for the HV
#asahi-dev · 2023-11-28 14:14
mazif they have stuffed non-architectural stuff in TCR_EL2, that's going to be fun. not.
#asahi-dev · 2023-11-28 14:13
svenif the chickens are correct maybe they changed something with how SPRR/GXF works?
#asahi-dev · 2023-11-28 14:12
svenhrm, i think when i wrote the original MMU code I didn't rely on any previous state of the architectural registers
#asahi-dev · 2023-11-28 14:07
DannyBregister. So i assume something changed that is causing addresses to be translated or whatever in a way that we don't want on the m3, but not m1/m2. The MMU is not on when we get it on m3, so i have no idea why this has any effect, but it does!
#asahi-dev · 2023-11-28 14:07
DannyBThe alternative would be to have a real spec of what we expect the invariants to be for m1n1, and put all the chips in that state. Maybe later
#asahi-dev · 2023-11-28 14:07
DannyBUnless someone has a better idea, i'm going to assume that the set of things that m1n1 wants is defined as "however the m1/m2 chip registers start right now", and ensure we put the m3 in the same state in chickens.
#asahi-dev · 2023-11-28 14:07
DannyBXNU resets the TCR very early and uses statically allocated bootstrap pagetables very early in the init until it sets up real pagetables.
#asahi-dev · 2023-11-28 14:07
DannyBWhee. i figured out why the m3 mmu hangs but i'm not sure what to do about it. It seems the state that m1n1 expects us to start in is not how things start for the m3. So for example, i have to clear the TCR register in chickens (or at least set it to the value that XNU does), to make the MMU init work, even though the MMU init *also* sets the TCR register itself. If i don't, the chip hangs when we set the SCTLR
#asahi-dev · 2023-11-28 12:41
svenmainly because there were some reports of usb3 being a bit flaky but I think that's because I have the atcphy/dwc3 order wrong in the current kernel
#asahi-dev · 2023-11-28 12:39
svencan anyone who has multiple M-series SoCs connect the same usb 3 device in the same orientation to all of them and trace atcphy? i want to confirm that there are no differences between the various generations

plus ›