On Mon, 17 Feb 2025 at 19:37, Paolo Bonzini <pbonz...@redhat.com> wrote:

> On 2/12/25 12:29, Philippe Mathieu-Daudé wrote:
> > Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> > ---
> >   meson.build | 7 +++++++
> >   1 file changed, 7 insertions(+)
> >
> > diff --git a/meson.build b/meson.build
> > index 18cf9e2913b..10f4c9fd30d 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -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.


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


> 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.


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.)


> 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

Reply via email to