2021-01-31
00:03x4m3 has joined #asahi-dev
01:51WhyNotHugo has quit [Ping timeout: 260 seconds]
01:52WhyNotHugo has joined #asahi-dev
02:21yuyangchee98[m] has joined #asahi-dev
03:31PhilippvK_ has joined #asahi-dev
03:31PhilippvK has quit [Ping timeout: 264 seconds]
04:13br377 has quit [Ping timeout: 264 seconds]
04:15br377 has joined #asahi-dev
04:33marcanfigured out the sError thing. turns out mapping device memory as nGnRnE isn't enough to guard it, you need to also mark it non-executable...
04:34marcanthat is very weird, though, because you'd *think* that means it would also break with the MMU off, where there is no such thing as non-executable...
04:34marcanbut then again I only saw this behavior, so far, on return from a page fault, which can only happen with the MMU on, so...
04:35marcanthis thing really does punch you in the face if you miss any of these details, moreso than any other CPU I've ever used
04:52modwizcodeI feel like that's because most other CPUs aren't quite as speculative and the intel and amd ones have a microcode to make it behave more probably
04:53modwizcodeAlso I wonder if some of that speculation is disabled unless the MMU is on, like caching.
04:53modwizcodeYeah but I mean like the whole caching system is disabled with MMU off
04:54modwizcodeI'm guess it's a good gate to wait to enable anything that might be buggy until there's an OS capable of dealing with it
04:54modwizcodeAnyway how'd you figure this one out?]
04:54modwizcodeEverytime you write to more HID registers I get to stub them out in my qemu branch :p
04:54marcanwell the L2 subsystem address was basically zero (ignoring the high bits which seem to have a special meaning)
04:55marcanand then I thought something must be broken because it's nGnRnE mapped and yet something was still hitting it speculatively... in what looked like an instruction fetch path even...
04:56modwizcodeI still haven't watched the chicken bits stream, from the registers I've had to poke, what's the L2 stuff pertain to?
04:56modwizcodeDid it give you a signal that it was an instruction path?
04:56modwizcodeI'm more impressed that they can disable all the broken stuff
04:56modwizcodeI didn't realize you meant literally... return
04:57modwizcodeI feel like I've seen that note you screenshotted there
04:57marcananyway, the L2 error reporting can be disabled, which is what corellium do - presumably because they have bad address faults lurking and they didn't want to bother fixing them
04:58modwizcodeRight so I was wondering if they disable that, but thing still work, is it just subtly broken?
04:58marcanwell a bad read or write from unmapped address ranges just does nothing, other than report the error
04:59modwizcodewait what is SError? I thought it meant secure until now but then I thought it was sync.
04:59modwizcodeohhhh
04:59modwizcodeYeah okay that makes sense
05:02modwizcodeyour patch setting TTBR1_EL2 faulted under emulator and I realized that I needed to set some id bits to enable the EL2 virtualization extension fully.
05:03modwizcodeDo you have a dump of the ID registers handy by any chance?
05:03modwizcodeID_AA64MMFR[0-3]_EL1
05:03modwizcodeand there's a few others I might need but those ones I know I need now
05:05modwizcodearm 64 is such a weird architecture, there's so much crap that's shoved in using the MSR type functionality, and they have crazy names for everything. The TLB flush instruction has insane argumentation. (I think it's the tlb flush one?)
05:06modwizcodeI should just pull open the actual architecture reference PDF which is 1000x better but I'm lazy
05:06modwizcodeYeah same here lol
05:06modwizcodeI like PPC's assembly syntax better
05:06modwizcodeAlthough I've used it less
05:06modwizcodeThanks for getting me the registers btw
05:06modwizcodeYeah I was looking at the MMU enable to make sure I didn't have to touch it and I was like what are these arguments
05:07davidrysk[m]how much of it is ARM and how much of it is Apple's version of it?
05:07modwizcodepoint of unification, point of coherance sort of make sense, but then you have inner shared, outer shared.
05:07modwizcodeMost of it's arms
05:07modwizcode*ARM
05:07modwizcodeApple's stuff is mostly just model specific registers to poke at and disable/enable added functionality they've got from what I can tell, marcan probably knows more
05:08marcanI mean the chicken bits are deep CPU feature stuff, so of course nobody knows what those really do
05:09modwizcodeOh god ARM's hypervisor thing I thought was going to make sense and it totally doesn't
05:09modwizcodeIt makes no sense at all
05:09krbtgtmarcan: wrt ppc docs, my problem after reading them is IBM bit ordering is the opposite from everyone else
05:09modwizcodeExcept when PPC decided to be little endian
05:09modwizcodeoh god they're like the ethernet people
05:09davidrysk[m]what about G5 and all of its idiosyncrasies?
05:11modwizcodeARMs docs also do something I find really insufferable which is instead of documenting how enabling one bit that affects others does it, it documents in every other bit how that bit is affected. Which spreads out the meaning of things like the E2H bit into everything. The best part is the E2H bit documentation says "See E2H bit for more details"
05:12modwizcodemarcan: do the barriers you added before print_regs calls have visible effects?
05:13davidrysk[m]I've seen someone say that ARM documentation "reads like stereo instructions"
05:13modwizcodeI don't know how to interpret that but I'll take it
05:13davidrysk[m]ever dealt with boring dull appliance manuals? :P
05:14modwizcodealso is ther eany more details about what SYS_CYC_OVRD does? From m1n1 it seems like it masks interrupts somehow? Why do they have a second place to mask interrupts?
05:22marcanmodwizcode: I want to make sure that speculation doesn't mess up ordering of the L2 error status registers; before I added the one after that sometimes it was already SErroring before it *really* returned from the page fault
05:22modwizcodethat's amazing
05:22marcanthis is low level enough that I don't really mind the shotgun approach to barriers, figuring out the details with all of these system and even undocumented MSRs is not worth it
05:23modwizcodeYeah it's basically impossible I think
05:23modwizcodeTo understand them completely with how much tweaking can be done at a microarchitectural level. Like I said I'm sort of in awe that they had the foresight to have so many of these be tweakable.
05:24modwizcodeI know that all cpus are like this, but knowing what's going to be broken ahead of time is a skill.
05:24marcanIntel and AMD just hide it behind microcode blobs (that contain startup sequences that just poke chicken bits, among other things) and proprietary bringup blobs (AGESA etc)
05:24marcanthe fun thing here is Apple delegates fixing all this stuff to the OS kernel *and* documents the bit descriptions
05:24modwizcodeYeah that's interesting
05:25modwizcodeI mean also though I wonder how much of this complexity the typical arm core even has.
05:25marcanwell, judging by the pile of "work around cortex-whatever" errata fixes in the linux kernel...
05:25modwizcodehmm maybe I'm not enough aware of those yet
05:25marcanI'd say ARM have done a much better job of making those chicken bits ahead of time instead of hideous workarounds the kernel needs to apply
05:26modwizcodeI wonder if not poking these bits at all would leave you with a functional core enough to work around it
05:27marcanI only noticed after applying it after the C code ram and noticing it was undoing everything
05:27davidrysk[m]oops :)
05:27modwizcodeLOL. did you see my question about the SYS_CYC_OVRD bits? I'm guessing CYC refers to cyclone, but what's the deal with those and IRQs?
05:27davidrysk[m]a lot of it probably comes up when you're doing more complex stuff
05:28modwizcodeoh interesting
05:31modwizcodeexample of horrible arm instruction "tlbi vmalls12e1is"
05:31ldhacker[m]What assembly language should I be learning for the M1? Just trying to create a hobby OS that I don’t plan on releasing to learn the OS DEV side of things. Also, any book/reference recommendations?
05:33TheJollyRoger has joined #asahi-dev
05:37modwizcodeNo I like that version!
05:37comexif you're going to have a bunch of magic numbers, why not just hardcode the instruction word
05:37modwizcodeThe documents have a sort of saneness as to what each register mean
05:37modwizcode*er each subop
05:37modwizcodeI used to sort of know it when I was reversing wii stuff
05:39davidrysk[m]marcan: any plans to do another stream sometime?
05:39modwizcodeAnyway I better get to bed before someone gets mad at me
05:39modwizcodenight all
05:39davidrysk[m]night modwizcode
05:40davidrysk[m]ldhacker: M1 uses aarch64... I'd also recommend any good computer architecture books
05:41davidrysk[m]marcan: cool :)
05:41ldhacker[m]Thank you!
06:12amw has joined #asahi-dev
06:34VinDuv has joined #asahi-dev
07:43amwIs the m1n1 loader / kernel stable enough to try booting on a MacBookAir M1 with out serial cable?
07:43amwIf so I was thinking about trying to get this to happen and documenting the setup of the booting
07:54amwIf it's not obvious - I don't have a magic USB Type-C serial cable nor likely to get one anytime soon and if MacOS can easily dual boot / recover it would be safe?
07:55amwThe framebuffer displays on the screen - there's no input till USB / Keyboard is up but still let's one experiment via printk?
08:34VinDuvAFAIK the boot process is very safe, you can always hold the power button to change the boot device back to macOS; if the recovery partition gets damaged (very unlikely) the Mac won’t boot but can be restored using another Mac with DFU mode (see https://github.com/AsahiLinux/docs/wiki/M1-vs.-PC-Boot)
08:35VinDuvBut unless I’ve missed something, m1n1 is not currently able to load a Linux kernel and initramfs from disk; you have to transfer them over serial
08:41kit_ty_kate has quit [Ping timeout: 272 seconds]
08:57bisko has quit [Quit: Textual IRC Client: www.textualapp.com]
08:57amwVinDuv: Good point - but still really fun for me to get working with on my MBA - perhaps not practical for serious debugging though.
09:01amw has quit [Ping timeout: 240 seconds]
10:16marcanI was going to say there is no way to brick these machines as long as you don't write to NOR flash
10:17marcan... I have no idea why corellium actually declare the SPI flash in their device tree, unless they have to read anything from it (which I doubt, iBoot should put everything necessary in the device tree) we are definitely *not* doing that
10:18marcananyway, m1n1 will be usable for normal kernel boot soon, as soon as I get SMP up I'll write in appended payload support
10:43Bluerisemarcan: on some machines, like an APU, it's helpful for firmware upgrades. but on the Macs I wouldn't dare change anything like that, it'd be stupid.
10:46amw has joined #asahi-dev
10:50Glanzmannmarcan: Have you already all the device drivers from corellium in your kernel or are there bigger changes required?
10:51marcanI spent yesterday working out what was causing bus errors on m1n1 - corellium just turns off bus error reporting
10:59marcanbut I would recommend having a secondary macos install you use for linux, instead of messing with your primary one
11:00acelogic has quit [Ping timeout: 265 seconds]
11:00marcanwriting documentation is part of my task list now that this is getting usable for people :)
11:01amwBTW The m1n1+linux+dtb+initramdisk blob wouldn't need a storage driver as it has the init ramdisk?
11:01kettenis has quit [Quit: leaving]
11:02amwSo that means as long as the 1TR can access the bless blob it can be selected in the 1TR mode or something?
11:03marcanno need to keep kmutiling, and no need to screw up your macos partition (Apple's updater probably won't be very happy if you keep replacing the macos kernel)
11:05kettenis has joined #asahi-dev
11:06kettenis has quit [Client Quit]
11:06kettenis has joined #asahi-dev
12:09amw has quit [Ping timeout: 246 seconds]
14:49roxfan2 is now known as roxfan
16:35snalty has quit [Quit: ZNC 1.8.2 - https://znc.in]
16:36TheJollyRoger has quit [Ping timeout: 268 seconds]
16:37modwizcodemarcan: no idea if it's been covered but do you expect Linux to have access to store secrets in the secure enclave? Obviously it won't have OS X access but would it theoretically supprot storing linux keyrings and the like?
16:38TheJollyRoger has joined #asahi-dev
16:40modwizcodeYeah I just wasn't sure if they made the effort to properly support access outside OSX, I think it's probably easier to not do that so who knos
16:42modwizcodeI mean I guess it knows what got booted though
16:42modwizcodeBut you're right it doesn't know it's not OS X
16:43modwizcodeThat's reassuring
16:46modwizcodeWhy does aarch64 have so many damn timers
17:41taziden has quit [Ping timeout: 265 seconds]
17:44acelogic has joined #asahi-dev
17:59taziden has joined #asahi-dev
18:07vafanlignardeBluerise: if you happen to have one of those YZStudio ZY12PDN USD-PD triggers, there's a FUSB302 chip on those (you still need a type-c breakout and level converter though). Someone recently posted an OSS firmware. I've attempted to get Apple VDM working on top of that code although I've only succeeded with UFP and Get Action List so far: https://git.io/JtBD7
18:17Bluerisevafanlignarde: I have a setup with a hummingboard pulse (ptn5110, tcpci compatible) right now
18:18Bluerisebut I might order two... need to think about it. this would allow reducing one device from being complex to being dumb ;) which is an improvement if things work
18:19vafanlignardeBluerise: neat. are there breakout boards easily available for that chip?
19:23vafanlignardeBluerise: i had a few with screw terminals (ZY12PDN-3) but I found that I needed to desolder the terminals to be able to solder wires for the UART onto the MCU.. the ZY12PDN-1 comes without a screw terminal.
19:37Bluerisekettenis: I ordered two. Will take a month to arrive at my place, then I'll see how I can flash i
19:38Blueriseso this week I'll build you one with the hummingboard, next month we might not need the hummingboard anymore
19:40BlueriseNah, just looking forward to a solution that stays on a single pcb, without any weird wires...
19:49bastilianI'm thinking, that at some point there could be a similar solution for non-M1 machines and not as involved as a USB-C PD UART DIY cable, just a proper USB-C (PD) cable.
19:50bastilianBluerise: I don't know, that may depend on the machine. maybe. I really don't know, i try to piece together things, but my electronics and low level hardware knowledge is limited. ...so don't listen to me rambling. :D
20:35amw has joined #asahi-dev
20:37acelogic has quit [Remote host closed the connection]
20:39acelogic has joined #asahi-dev
20:44djhworld has joined #asahi-dev
20:48djhworld has quit [Client Quit]
20:49djhworld has joined #asahi-dev
21:05irl25519 has joined #asahi-dev
21:25VinDuv has quit [Quit: Leaving.]
21:29amw has quit [Ping timeout: 240 seconds]
21:37djhworld has quit [Quit: The Lounge - https://thelounge.chat]
21:39djhworld has joined #asahi-dev
21:51irl25519 has quit [Quit: irl25519]
21:56amw has joined #asahi-dev
23:00yrlf has quit [Quit: The Lounge - https://thelounge.chat]
23:01yrlf has joined #asahi-dev
23:03taziden has quit [Ping timeout: 240 seconds]
23:06taziden has joined #asahi-dev
23:23rwhitbyvafanlignarde: This seems to be much the same board as the ZY12PDN: https://www.aliexpress.com/item/32814956486.html - I happen to have 2 of these boards.
23:27rwhitbyBluerise: https://www.nxp.com/products/interfaces/usb-interfaces/usb-type-c-shield-board-for-kinetis-freedom-and-lpc-boards:OM13588 is pretty much the only dev board that NXP did for the PTN5110 (there's a DP version as well). Note that this board is very low volume - if Digikey runs out of stock you have to wait for some months for new boards (I used this board in a low-volume customer design).
23:28rwhitbyI'm not aware of any breakout boards for ptn5110. I have lots of different proprietary boards with it on. Fun fact - the discontinued Valve VirtualLink adapter for the Index VR headset has one in it.