Skip to contentSkip to conversation

meson: Display summary of Darwin libraries detected

PATCH In review Philippe Mathieu-Daudé 4 participants 8 messages Feb 12, 2025 – Feb 19, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: Display summary of Darwin libraries detected

---
 meson.build | 7 +++++++
 1 file changed, 7 insertions(+)
meson.build +7 -0
index 18cf9e2913b..10f4c9fd30d 100644
@@ -4826,6 +4826,13 @@ summary_info += {'libdw':             libdw}
 if host_os == 'freebsd'
   summary_info += {'libinotify-kqueue': inotify}
 endif
+if host_os == 'darwin'
+  summary_info += {'Hypervisor support': hvf}
+  summary_info += {'CoreFoundation support': coref}
+  summary_info += {'IOKit support': iokit}
+  summary_info += {'ParavirtualizedGraphics support': pvg}
+  summary_info += {'Metal support': metal}
+endif
 summary(summary_info, bool_yn: true, section: 'Dependencies')
 
 if host_arch == 'unknown'
Signature · 1 line
2.47.1
#1 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
---
 meson.build | 7 +++++++
 1 file changed, 7 insertions(+)
meson.build +0 -0
index 18cf9e2913b..10f4c9fd30d 100644

meson.build summary_info += {'libdw': libdw} · line 4834

Quoted 9 lines
meson.build +6 -0
@@ -4826,6 +4826,13 @@ summary_info += {'libdw':             libdw}
 if host_os == 'freebsd'
   summary_info += {'libinotify-kqueue': inotify}
 endif
+if host_os == 'darwin'
+  summary_info += {'Hypervisor support': hvf}
+  summary_info += {'CoreFoundation support': coref}
+  summary_info += {'IOKit support': iokit}
+  summary_info += {'ParavirtualizedGraphics support': pvg}
+  summary_info += {'Metal support': metal}

These last 4 make sense, but I believe we already report HVF earlier in the accelerators block:

  summary_info += {'KVM support':       config_all_accel.has_key('CONFIG_KVM')}
  summary_info += {'HVF support':       config_all_accel.has_key('CONFIG_HVF')}
  summary_info += {'WHPX support':      config_all_accel.has_key('CONFIG_WHPX')}
  summary_info += {'NVMM support':      config_all_accel.has_key('CONFIG_NVMM')}
  summary_info += {'Xen support':       xen.found()}

IIUC CONFIG_HVF is present if 'hvf.found()'

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
---
  meson.build | 7 +++++++
  1 file changed, 7 insertions(+)
meson.build +0 -0
index 18cf9e2913b..10f4c9fd30d 100644

meson.build summary_info += {'libdw': libdw} · line 4835

Quoted 10 lines
meson.build +7 -0
@@ -4826,6 +4826,13 @@ summary_info += {'libdw':             libdw}
  if host_os == 'freebsd'
    summary_info += {'libinotify-kqueue': inotify}
  endif
+if host_os == 'darwin'
+  summary_info += {'Hypervisor support': hvf}
+  summary_info += {'CoreFoundation support': coref}
+  summary_info += {'IOKit support': iokit}
+  summary_info += {'ParavirtualizedGraphics support': pvg}
+  summary_info += {'Metal support': metal}
+endif

I think all of these are going to be present anyway, because they're mandatory (except IOKit which _is_ going to be there, and HVF which is present elsewhere) and there's no version indication for Apple frameworks.

However, adding pvg and metal here makes sense if:

- "config PVG" is added to Kconfig.host with the corresponding assignment to host_kconfig

- "depends on PVG" is added to "config MAC_PVG"

- after which, host_os = "darwin" is not needed anymore in hw/display/meson.build

Also, it's not clear to me if PVG can also work with TCG, and therefore the MMIO version can be used on x86 Macs? If so the 'if cpu = "aarch64"' in hw/display/meson.build seems wrong.

Either way, the Kconfig file does not need "depends on AARCH64" and it should have just

depends on MAC_PVG

with an "imply" somewhere in hw/arm/Kconfig.

Paolo

#3 lore raw
Quoted 16 lines · Paolo Bonzini
Quoted 15 lines · Philippe Mathieu-Daudé
---
  meson.build | 7 +++++++
  1 file changed, 7 insertions(+)
meson.build +2 -0
index 18cf9e2913b..10f4c9fd30d 100644
@@ -4826,6 +4826,13 @@ summary_info += {'libdw':             libdw}
  if host_os == 'freebsd'
    summary_info += {'libinotify-kqueue': inotify}
  endif
+if host_os == 'darwin'
+  summary_info += {'Hypervisor support': hvf}
Quoted 8 lines

meson.build summary_info += {'libdw': libdw} · line 4835

Quoted 5 lines
meson.build +5 -0
+  summary_info += {'CoreFoundation support': coref}
+  summary_info += {'IOKit support': iokit}
+  summary_info += {'ParavirtualizedGraphics support': pvg}
+  summary_info += {'Metal support': metal}
+endif

I think all of these are going to be present anyway, because they're mandatory (except IOKit which _is_ going to be there, and HVF which is present elsewhere) and there's no version indication for Apple frameworks.

Realistically, all of these are always present on supported Darwin versions.

Quoted 5 lines

However, adding pvg and metal here makes sense if:

- "config PVG" is added to Kconfig.host with the corresponding assignment to host_kconfig

Quoted 8 lines

- "depends on PVG" is added to "config MAC_PVG"

- after which, host_os = "darwin" is not needed anymore in hw/display/meson.build

Also, it's not clear to me if PVG can also work with TCG, and therefore the MMIO version can be used on x86 Macs? If so the 'if cpu = "aarch64"' in hw/display/meson.build seems wrong.

This bit I can answer.
PVG is not in any way tied to HVF and so can be used with TCG. HOWEVER
It is not cross-architecture. So, the PVG guest drivers with x86-64 macOS don't give useful results with the aarch64 macOS host PVG framework. (I suspect a mismatch in texture memory layout and perhaps some other data format issues - Apple's GPUs use a "swizzled" memory layout, whereas Intel/AMD/NVIDIA's do not.)

Additionally, the MMIO variant in particular uses the IOSurfaceMapper APIs (PGIOSurfaceHostDevice, PGIOSurfaceHostDeviceDescriptor, usingIOSurfaceMapper) which are only present in the aarch64 version of the host ParavirtualizedGraphics.framework.

In summary, hw/display/apple-gfx-mmio.m has a hard dependency on aarch64 *host* systems, and both apple-gfx device variants only make sense when host arch matches guest arch. (Unless you're a developer attempting to find a workaround to the incompatibility.)

I'm very much not a Meson expert, so this was my best attempt at encoding these facts in the build system. (And nobody suggested anything better during review.)

Quoted 10 lines

Either way, the Kconfig file does not need "depends on AARCH64" and it should have just

depends on MAC_PVG

with an "imply" somewhere in hw/arm/Kconfig.

Paolo

Phil

#4 lore raw
Quoted 4 lines · Phil Dennis-Jordan

It is not cross-architecture. So, the PVG guest drivers with x86-64 macOS don't give useful results with the aarch64 macOS host PVG framework. (I suspect a mismatch in texture memory layout and perhaps some other data format issues Apple's GPUs use a "swizzled" memory layout, whereas Intel/AMD/NVIDIA's do not.)

Thanks, that helps.

Quoted 6 lines

In summary, hw/display/apple-gfx-mmio.m has a hard dependency on aarch64 *host* systems, and both apple-gfx device variants only make sense when host arch matches guest arch. (Unless you're a developer attempting to find a workaround to the incompatibility.) I'm very much not a Meson expert, so this was my best attempt at encoding these facts in the build system. (And nobody suggested anything better during review.)

I'll find a way to do that, thanks. I also would prefer to add --enable/--disable-pvg; I
can take care of that, but I just need to know...

Quoted 6 lines
Quoted 6 lines

Either way, the Kconfig file does not need "depends on AARCH64" and it should have just

depends on MAC_PVG

with an "imply" somewhere in hw/arm/Kconfig.

... which boards should enable MAC_PVG_MMIO? Is it only VIRT, or something else?

Paolo

#5 lore raw
Quoted 31 lines · Paolo Bonzini
Quoted 1 line · Phil Dennis-Jordan

It is not cross-architecture. So, the PVG guest drivers with x86-64

macOS don't

Quoted 1 line

give useful results with the aarch64 macOS host PVG framework. (I

suspect a

Quoted 1 line

mismatch in texture memory layout and perhaps some other data format

issues

Quoted 1 line

Apple's GPUs use a "swizzled" memory layout, whereas Intel/AMD/NVIDIA's

do not.)

Thanks, that helps.

Quoted 1 line

In summary, hw/display/apple-gfx-mmio.m has a hard dependency on aarch64

*host*

Quoted 1 line

systems, and both apple-gfx device variants only make sense when host

arch matches

Quoted 1 line

guest arch. (Unless you're a developer attempting to find a workaround

to the

Quoted 1 line

incompatibility.) I'm very much not a Meson expert, so this was my best

attempt at

Quoted 1 line

encoding these facts in the build system. (And nobody suggested anything

better during

Quoted 1 line

review.)

I'll find a way to do that, thanks. I also would prefer to add --enable/--disable-pvg; I
can take care of that, but I just need to know...

Quoted 1 line

Either way, the Kconfig file does not need "depends on AARCH64" and it

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

should have just

depends on MAC_PVG

with an "imply" somewhere in hw/arm/Kconfig.

... which boards should enable MAC_PVG_MMIO? Is it only VIRT, or something else?

I doubt anyone will be able to use it productively with virt, but I am regularly surprised by people's creativity.

The intended target machine is vmapple, which is the only known way to run aarch64 macOS guests. The PVG patches were part of that series, the PCI variant is useful independently of it though; Philippe said at one point early Jan/late Dec he was going to merge the rest of the patch series containing that machine type, but there were some question marks about the software GICv3 dependency and HVF I believe. I'll try to rebase that series and re-post it in the next few days - I've been too busy with another project to stay on top of chasing that down, but I'd really like to get it done for 10.0.

Phil

#6 lore raw
Quoted 4 lines · Phil Dennis-Jordan
Quoted 2 lines

... which boards should enable MAC_PVG_MMIO? Is it only VIRT, or something else?

I doubt anyone will be able to use it productively with virt, but I am regularly surprised by people's creativity.

Ah okay, so for now it's effectively dead code.

Quoted 3 lines

The intended target machine is vmapple, which is the only known way to run aarch64 macOS guests. [...]
I'll try to rebase that series and re-post it in the next few days

Thanks, I'll keep an eye on that.

Paolo

#7 lore raw
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Phil Dennis-Jordan
Quoted 2 lines

... which boards should enable MAC_PVG_MMIO? Is it only VIRT, or something else?

I doubt anyone will be able to use it productively with virt, but I am regularly surprised by people's creativity.

Ah okay, so for now it's effectively dead code.

Correct (still tested before merging). I have Phil's vmapple series queued but it fails the '--disable-hvf' build config so I had to drop it before sending the PR. I kept the PVG device to save Phil from respining again and again the same patches, hoping for a quick fix to merge the rest, waiting for an update on whether Phil's suggestion to fix the GIC dependency was OK or not, but no update so far, see:

https://lore.kernel.org/qemu-devel/CAAibmn0puNwDvHcU8xYi1EJ=dnAEhasoTKCk0kmF4DiQfR7dHQ@mail.gmail.com/

and my proposal:

https://lore.kernel.org/qemu-devel/[email protected]/

And now I see Phil's reply which I missed ...:
https://lore.kernel.org/qemu-devel/CAAibmn1g6+btdRX99ZUvbaBm7hP_AnAGNfDHz4Wgi3fPn=waOw@mail.gmail.com/

Quoted 9 lines
Quoted 4 lines

The intended target machine is vmapple, which is the only known way to run aarch64 macOS guests. [...]
I'll try to rebase that series and re-post it in the next few days

Thanks, I'll keep an eye on that.

Paolo