#
✕ nick:marcan
#asahi-dev · 2022-09-27 13:21
marcanoh, that one's news to me. neat, mediatek uses it.
#asahi-dev · 2022-09-27 13:17
marcan(note: parent/child device model doesn't really work for the multi-die devices we have, assuming we don't want to pull this entirely outside of the die bus nodes, since the top-level cpufreq node has to span clusters on both dies)
#asahi-dev · 2022-09-27 13:16
marcanif we want to keep the "virtual device / physical devices" model, then there could be a top-level cpufreq instance (with no reg) with phandles to the individual cluster devices (which have a reg) and then just make the latter not probe by default, or probe as separate drivers but do nothing other than mmap IO and store it as driver data for the top-level device to reference?
#asahi-dev · 2022-09-27 13:12
marcanand we also need to describe the mapping between CPUs and cpufreq clusters
#asahi-dev · 2022-09-27 13:11
marcandriver/device instance
#asahi-dev · 2022-09-27 13:10
marcanbut then Linux needs to probe them all as a single driver
#asahi-dev · 2022-09-27 13:10
marcanso the question is, how should this be represented in the DT? conceptually, the hardware is a cpufreq instance per CPU cluster, and they're independent
#asahi-dev · 2022-09-27 13:10
marcanbut cpufreq-dt does probe magic behind the scenes
#asahi-dev · 2022-09-27 13:09
marcanrobher: yeah, and cpufreq-dt sort of does it right, but only works for devices with low-level clock/etc drivers (I tried that approach, was shot down and honestly wasn't a good match)
#asahi-dev · 2022-09-27 10:35
marcaneither way, the answer for the current DT model/driver is to put cpufreq outside of either die bus. could be in a third, shared/common bus.
#asahi-dev · 2022-09-27 10:33
marcan(ping robher, any opinions about this? cases where the Linux model demands a single driver instance for what logically are completely independent pieces of hardware?)
#asahi-dev · 2022-09-27 10:33
marcanit's stupid and honestly should not be bound in the DT like that, the DT should just have clusters and the cpufreq driver should pick them all up, but that's not how current cpufreq drivers do it...
#asahi-dev · 2022-09-27 10:32
marcanjannau: you can only have a single cpufreq instance, that's why it's done the way it is with all clusters in one device
#asahi-dev · 2022-09-26 20:27
marcanyeah, I don't think we want this in m1n1
#asahi-dev · 2022-09-26 20:25
marcan+5000 lines of code ish for NV support in KVM
#asahi-dev · 2022-09-26 20:23
marcanyes
#asahi-dev · 2022-09-26 20:21
marcanisn't nested virt quite a bit more complicated than that? don't you have to deal with page table flattening and all that stuff?
#asahi-dev · 2022-09-26 13:42
marcanmaybe you're thinking of the S2 ones? ISAS2E1 and co? those do use the current *VMID*.
#asahi-dev · 2022-09-26 13:41
marcandoes it? VAE1 also takes the ASID
#asahi-dev · 2022-09-26 13:40
marcanmaz: and all the other ones also take the ASID in the high bits, right? so it doesn't matter if it's in a TTB, you can specify whatever
#asahi-dev · 2022-09-26 13:34
marcanyeah, that makes more sense
#asahi-dev · 2022-09-26 13:31
marcanhuh. really? I somehow doubt the macOS driver does that...
#asahi-dev · 2022-09-26 13:28
marcan(also maybe you should join #asahi-gpu :p)
#asahi-dev · 2022-09-26 13:28
marcanwhat do you mean by that exactly, by the way?
#asahi-dev · 2022-09-26 13:28
marcanmaz: > you need a userspace context to perform the TLBI anyway
#asahi-dev · 2022-09-26 13:25
marcancould also defer releases a bit, so that userspace process thrashing doesn't thrash nominally active GPU contexts during short idle windows
#asahi-dev · 2022-09-26 13:24
marcanbut that can be done
#asahi-dev · 2022-09-26 13:24
marcanwell, it'd also have to track if an ASID is transiently reused by another VM
#asahi-dev · 2022-09-26 13:23
marcanyeah, I think if the GPU side just flushes TLBs any time it gets a new ASID that's different from the previous one for that VM, it should work
#asahi-dev · 2022-09-26 13:22
marcanwell, I guess that could technically just be done when a new ASID is assigned?
#asahi-dev · 2022-09-26 13:21
marcanand then you also need some kind of hook to flush the GPU TLB when a previously GPU-mapped ASID gets reused by another process...
#asahi-dev · 2022-09-26 13:17
marcanI think you'd basically just want new_context(), but a generic version that doesn't take a mm_struct but rather just the ASID-relevant bits from it.
#asahi-dev · 2022-09-26 13:16
marcanguess that's easy enough to test with some aliasing and TLB shootdowns
#asahi-dev · 2022-09-26 13:15
marcanso yeah, probably just something to have the driver ask mm for an ASID/release it as needed? I'm not sure it's actually 6 bits, it might be more. IIRC it's just macOS did a 1:1 map to context slots.
#asahi-dev · 2022-09-26 13:14
marcan*around
#asahi-dev · 2022-09-26 13:14
marcanwell, it can't be, since the same process is allowed to open /dev/dri/* multiple times and file descriptors can be passed aroudn
#asahi-dev · 2022-09-26 13:13
marcanbetter ask lina about how the VM works/should work exactly. I'm not sure it's 1:1 to userspace processes.
#asahi-dev · 2022-09-26 13:10
marcansomething something module parameter?
#asahi-dev · 2022-09-26 13:09
marcanI'm not sure GPU performance would appreciate that :p
#asahi-dev · 2022-09-26 13:09
marcanI think if you limit the number of simultaneously mapped GPU VMs?
#asahi-dev · 2022-09-26 13:08
marcan(assuming they all get reserved upfront - this *could* be dynamic I think?)
#asahi-dev · 2022-09-26 13:08
marcanso the GPU would eat 1/4 of that
#asahi-dev · 2022-09-26 13:08
marcanyeah, 8 bits was it?
#asahi-dev · 2022-09-26 13:04
marcando you have a link/keyword to find this?
#asahi-dev · 2022-09-26 13:04
marcaninteresting
#asahi-dev · 2022-09-26 13:03
marcanis that configurable?
#asahi-dev · 2022-09-26 13:03
marcanhuh
#asahi-dev · 2022-09-26 13:03
marcanoh?
#asahi-dev · 2022-09-26 13:02
marcanyes, they do, it's just 0-63. you *could* carve out the CPU side ASIDs instead.
#asahi-dev · 2022-09-26 13:02
marcanthat one is going to be fun to implement in Linux...

plus ›