vmapple: making it work on the latest macOS releaases and Apple M4
v2 cover vmapple: making it work on the latest macOS releaases and Apple M4
RFC as it's hacky code, especially for the Apple M4 support workaround part. Support for newer guest OSes isn't part of this series.
v1->v2:
Remove some lines that shouldn't have been present...
Mohamed Mediouni (4):
hw: vmapple: include missing headers
hvf: arm64: add workaround for Apple M4 to run older macOS versions
vmapple: apple-gfx: make it work on the latest macOS release Revert "hw/arm: Do not build VMapple machine by default"
accel/hvf/hvf-accel-ops.c | 4 +- configs/devices/aarch64-softmmu/default.mak | 1 - hw/display/apple-gfx-mmio.m | 56 ++++++++++++----- hw/display/apple-gfx.h | 13 ++++ hw/display/apple-gfx.m | 42 ++++++++++++- hw/vmapple/vmapple.c | 2 + include/system/hvf_int.h | 4 ++ target/arm/hvf/hvf.c | 68 +++++++++++++++++++++ 8 files changed, 171 insertions(+), 19 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)
RFC v2 1/4 hw: vmapple: include missing headers
Disablement by default led to:
../hw/vmapple/vmapple.c:276:39: error: use of undeclared identifier 'GTIMER_VIRT'
276 | qdev_connect_gpio_out(cpudev, GTIMER_VIRT,
| ^../hw/vmapple/vmapple.c:479:54: error: use of undeclared identifier 'QEMU_PSCI_CONDUIT_HVC'
479 | object_property_set_int(cpu, "psci-conduit", QEMU_PSCI_CONDUIT_HVC,
| ^../hw/vmapple/vmapple.c:556:13: error: call to undeclared function 'arm_build_mp_affinity'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
556 | arm_build_mp_affinity(n, GICV3_TARGETLIST_BITS);
| ^3 errors generated.
pretty quickly.
--- hw/vmapple/vmapple.c | 2 ++ 1 file changed, 2 insertions(+)
hw/vmapple/vmapple.c +2 -0
@@ -51,6 +51,8 @@#include "system/reset.h" #include "system/runstate.h" #include "system/system.h" +#include "gtimer.h" +#include "cpu.h" struct VMAppleMachineState {MachineState parent;
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [RFC v2 1/4] hw: vmapple: include missing headers
Quoted 9 lines · Mohamed Mediouni
Disablement by default led to:
../hw/vmapple/vmapple.c:276:39: error: use of undeclared identifier 'GTIMER_VIRT'
276 | qdev_connect_gpio_out(cpudev,GTIMER_VIRT,
| ^../hw/vmapple/vmapple.c:479:54: error: use of undeclared identifier 'QEMU_PSCI_CONDUIT_HVC'
479 | object_property_set_int(cpu, "psci-conduit",QEMU_PSCI_CONDUIT_HVC,
| ^../hw/vmapple/vmapple.c:556:13: error: call to undeclared function 'arm_build_mp_affinity'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Quoted 7 lines
556 | arm_build_mp_affinity(n, GICV3_TARGETLIST_BITS); | ^3 errors generated.
pretty quickly.
Signed-off-by Mohamed Mediouni <[email protected]>
This patch should be stand alone and not RFC.
Alex
Quoted 17 lines
--- hw/vmapple/vmapple.c | 2 ++ 1 file changed, 2 insertions(+)hw/vmapple/vmapple.c +2
-0@@ -51,6 +51,8 @@#include "system/reset.h" #include "system/runstate.h" #include "system/system.h" +#include "gtimer.h" +#include "cpu.h" struct VMAppleMachineState {MachineState parent;
Re: [RFC v2 1/4] hw: vmapple: include missing headers
In reply to Mohamed MediouniQuoted 25 lines · Mohamed Mediouni
Disablement by default led to:
../hw/vmapple/vmapple.c:276:39: error: use of undeclared identifier 'GTIMER_VIRT'
276 | qdev_connect_gpio_out(cpudev,GTIMER_VIRT,
| ^../hw/vmapple/vmapple.c:479:54: error: use of undeclared identifier 'QEMU_PSCI_CONDUIT_HVC'
479 | object_property_set_int(cpu, "psci-conduit",QEMU_PSCI_CONDUIT_HVC,
| ^../hw/vmapple/vmapple.c:556:13: error: call to undeclared function 'arm_build_mp_affinity'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]556 | arm_build_mp_affinity(n, GICV3_TARGETLIST_BITS); | ^3 errors generated.
pretty quickly.
Signed-off-by Mohamed Mediouni <[email protected]>--- hw/vmapple/vmapple.c | 2 ++ 1 file changed, 2 insertions(+)hw/vmapple/vmapple.c +0
-0
hw/vmapple/vmapple.c line 55
Quoted 5 lines
hw/vmapple/vmapple.c +2
-0@@ -51,6 +51,8 @@#include "system/reset.h" #include "system/runstate.h" #include "system/system.h" +#include "gtimer.h" +#include "cpu.h"
Queued using instead:
#include "target/arm/gtimer.h"
#include "target/arm/cpu.h"
RFC v2 2/4 hvf: arm64: add workaround for Apple M4 to run older macOS versions
In reply to Mohamed MediouniApple M4 removes FEAT_SSBS. However, older macOS releases do misbehave in such a configuration and do not boot.
Use private API to trap SCTLR_EL1 accesses through FGT.
--- accel/hvf/hvf-accel-ops.c | 4 +-- include/system/hvf_int.h | 4 +++ target/arm/hvf/hvf.c | 68 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-)
accel/hvf/hvf-accel-ops.c +2 -2
@@ -152,8 +152,8 @@ static int hvf_init_vcpu(CPUState *cpu)sigdelset (&cpu->accel->unblock_ipi_mask,SIG_IPI );#ifdef __aarch64__ - r =hv_vcpu_create (&cpu->accel->fd, - (hv_vcpu_exit_t **)&cpu->accel->exit,NULL ); + r =hvf_vcpu_create (&cpu->accel->fd, + (hv_vcpu_exit_t **)&cpu->accel->exit);#else r =hv_vcpu_create (&cpu->accel->fd,HV_VCPU_DEFAULT );#endif
include/system/hvf_int.h +4 -0
@@ -111,4 +111,8 @@ void hvf_arch_update_guest_debug(CPUState *cpu);*/ bool hvf_arch_supports_guest_debug (void ); +#ifdef __aarch64__ +hv_return_t hvf_vcpu_create (hv_vcpu_t * vcpu_ptr,hv_vcpu_exit_t ** exit); +#endif +#endif
target/arm/hvf/hvf.c +68 -0
95 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [RFC v2 2/4] hvf: arm64: add workaround for Apple M4 to run older macOS versions
Quoted 6 lines · Mohamed Mediouni
Apple M4 removes
FEAT_SSBS. However, older macOS releases do misbehave in such a configuration and do not boot.Use private API to trap
SCTLR_EL1accesses through FGT.Signed-off-by Mohamed Mediouni <[email protected]>
These old macOS versions did not include M4 support, correct? So wouldn't it make more sense to make more recent macOS work instead?
Alex
Re: [RFC v2 2/4] hvf: arm64: add workaround for Apple M4 to run older macOS versions
Quoted 9 lines · Alexander Graf
Quoted 3 lines · Mohamed Mediouni
Apple M4 removes
FEAT_SSBS. However, older macOS releases do misbehave in such a configuration and do not boot.
Quoted 9 lines
Quoted 3 lines
Use private API to trap
SCTLR_EL1accesses through FGT.Signed-off-by Mohamed Mediouni <[email protected]>These old macOS versions did not include M4 support, correct? So wouldn't it make more sense to make more recent macOS work instead?
Alex
Apple ships such a workaround in Virtualization.framework to allow older macOS VMs to work
Re: [RFC v2 2/4] hvf: arm64: add workaround for Apple M4 to run older macOS versions
Quoted 15 lines
Am 08.10.2025 um 13:36 schrieb Mohamed Mediouni <[email protected]>:
Quoted 9 lines · Alexander Graf
Quoted 8 lines · Mohamed Mediouni
Apple M4 removes
FEAT_SSBS. However, older macOS releases do misbehave in such a configuration and do not boot.Use private API to trap
SCTLR_EL1accesses through FGT.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by Mohamed Mediouni <[email protected]>These old macOS versions did not include M4 support, correct? So wouldn't it make more sense to make more recent macOS work instead?
Alex
Apple ships such a workaround in Virtualization.framework to allow older macOS VMs to work
Fair, but we don't have to implement the same hacks :). I think from a user's point of view, running macOS 26 is more important than 12 :)
Alex
Re: [RFC v2 2/4] hvf: arm64: add workaround for Apple M4 to run older macOS versions
Quoted 24 lines · Alexander Graf
Quoted 21 lines
Am 08.10.2025 um 13:36 schrieb Mohamed Mediouni <[email protected]>:
Quoted 14 lines · Alexander Graf
Quoted 9 lines · Mohamed Mediouni
Apple M4 removes
FEAT_SSBS. However, older macOS releases do misbehave in such a configuration and do not boot.Use private API to trap
SCTLR_EL1accesses through FGT.Signed-off-by Mohamed Mediouni <[email protected]>These old macOS versions did not include M4 support, correct? So wouldn't it make more sense to make more recent macOS work instead?
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Alex
Apple ships such a workaround in Virtualization.framework to allow older macOS VMs to work
Fair, but we don't have to implement the same hacks :). I think from a user's point of view, running macOS 26 is more important than 12 :)
Alex
There are at least two mean things that newer macOS releases do on vmapples, but I’m pretty sure I’m missing some more:
- an HVC #0 with x0 set to 0xc1000000 - this is not trapped all the way to the VMM but handled by the virtualisation stack.
The value returned is zero if the VM is running with a private ISA level. The guest then checks it straight away and goes in an infinite loop if the value isn’t 0.
Fine, let’s run with private ISA and see what happens, well...
- An access to the GIC memory ranges that doesn’t meet ISV requirements - using pre-indexing with SP as the base register.
That said I got pretty far with handling those two but I’m not sure that any of this is upstreamable really…
-Mohamed
RFC v2 3/4 vmapple: apple-gfx: make it work on the latest macOS release
In reply to Mohamed MediouniFollow changes in memory management, and enable process isolation for a sandboxed GPU process when on a new OS.
--- hw/display/apple-gfx-mmio.m | 56 +++++++++++++++++++++++++++---------- hw/display/apple-gfx.h | 13 +++++++++ hw/display/apple-gfx.m | 42 +++++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 16 deletions(-)
hw/display/apple-gfx-mmio.m +41 -15
@@ -19,6 +19,7 @@ #include "hw/irq.h" #include "apple-gfx.h" #include "trace.h" +#include "system/address-spaces.h" #import <ParavirtualizedGraphics/ParavirtualizedGraphics.h>
@@ -34,14 +35,25 @@ typedef bool(^IOSFCMapMemory)(uint64_t phys, uint64_t len, bool ro, void **va, void *, void *); +@interface PGMemoryMapDescriptor : NSObject +-(void)addRange:(struct PGGuestPhysicalRange_s) range; +@end + @interface PGDeviceDescriptor (IOSurfaceMapper) @property (readwrite, nonatomic) bool usingIOSurfaceMapper; +@property (readwrite, nonatomic) bool enableArgumentBuffers; +@property (readwrite, nonatomic) bool enableProcessIsolation; +@property (readwrite, nonatomic) bool enableProtectedContent; + +@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor; @end @interface PGIOSurfaceHostDeviceDescriptor : NSObject -(PGIOSurfaceHostDeviceDescriptor *)init; @property (readwrite, nonatomic, copy, nullable) IOSFCMapMemory mapMemory; @property (readwrite, nonatomic, copy, nullable) IOSFCUnmapMemory unmapMemory; +@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor; +@property (readwrite, nonatomic) unsigned long long mmioLength; @property (readwrite, nonatomic, copy, nullable) IOSFCRaiseInterrupt raiseInterrupt; @end
@@ -182,20 +194,28 @@ static bool apple_gfx_mmio_unmap_surface_memory(void *ptr) PGIOSurfaceHostDeviceDescriptor *iosfc_desc = [PGIOSurfaceHostDeviceDescriptor new]; PGIOSurfaceHostDevice *iosfc_host_dev; - - iosfc_desc.mapMemory = - ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) { - *va = apple_gfx_mmio_map_surface_memory(phys, len, ro); - - trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va); - - return *va != NULL; - }; - - iosfc_desc.unmapMemory = - ^bool(void *va, void *b, void *c, void *d, void *e, void *f) { - return apple_gfx_mmio_unmap_surface_memory(va); - }; + PGMemoryMapDescriptor* memoryMapDescriptor = [PGMemoryMapDescriptor new]; + + if (@available(macOS 15.4, *)) { + FlatView* fv = address_space_to_flatview(&address_space_memory); + flatview_for_each_range(fv, apple_gfx_register_memory_cb, memoryMapDescriptor); + iosfc_desc.mmioLength = 0x10000; + iosfc_desc.memoryMapDescriptor = memoryMapDescriptor; + } else { + iosfc_desc.mapMemory = + ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) { + *va = apple_gfx_mmio_map_surface_memory(phys, len, ro); + + trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va); + + return *va != NULL; + }; + + iosfc_desc.unmapMemory = + ^bool(void *va, void *b, void *c, void *d, void *e, void *f) { + return apple_gfx_mmio_unmap_surface_memory(va); + }; + } iosfc_desc.raiseInterrupt = ^bool(uint32_t vector) { trace_apple_gfx_iosfc_raise_irq(vector);
@@ -223,13 +243,19 @@ static void apple_gfx_mmio_realize(DeviceState *dev, Error **errp) }; desc.usingIOSurfaceMapper = true; - s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s); + desc.enableArgumentBuffers = true; + // Process isolation needs to go through PGMemoryMapDescriptor + if (@available(macOS 15.4, *)) { + desc.enableProcessIsolation = true; + } if (!apple_gfx_common_realize(&s->common, dev, desc, errp)) { [s->pgiosfc release]; s->pgiosfc = nil; } + s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s); + [desc release]; desc = nil; }
hw/display/apple-gfx.h +13 -0
@@ -23,6 +23,13 @@ @protocol MTLTexture; @protocol MTLCommandQueue; +typedef struct PGGuestPhysicalRange_s +{ +uint64_t physicalAddress; +uint64_t physicalLength; +void *hostAddress; +}PGGuestPhysicalRange_t ; + typedef QTAILQ_HEAD(, PGTask_s) PGTaskList; typedef struct AppleGFXDisplayMode {
@@ -68,6 +75,12 @@ void *apple_gfx_host_ptr_for_gpa_range(uint64_t guest_physical, uint64_t length, bool read_only, MemoryRegion **mapping_in_region); +bool apple_gfx_register_memory_cb (Int128 start, +Int128 len, +const MemoryRegion *mr, +hwaddr offset_in_region, +void *opaque); +extern const PropertyInfo qdev_prop_apple_gfx_display_mode;#endif
hw/display/apple-gfx.m +41 -1
60 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [RFC v2 3/4] vmapple: apple-gfx: make it work on the latest macOS release
Quoted 1 line · Mohamed Mediouni
Follow changes in memory management, and enable process isolation for a sandboxed GPU process when on a new OS.
Please detail here why this is necessary.
Quoted 57 lines
Signed-off-by Mohamed Mediouni <[email protected]>--- hw/display/apple-gfx-mmio.m | 56 +++++++++++++++++++++++++++---------- hw/display/apple-gfx.h | 13 +++++++++ hw/display/apple-gfx.m | 42 +++++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 16 deletions(-)hw/display/apple-gfx-mmio.m +12
-7@@ -19,6 +19,7 @@ #include "hw/irq.h" #include "apple-gfx.h" #include "trace.h" +#include "system/address-spaces.h" #import <ParavirtualizedGraphics/ParavirtualizedGraphics.h>@@ -34,14 +35,25 @@ typedef bool(^IOSFCMapMemory)(uint64_t phys, uint64_t len, bool ro, void **va, void *, void *); +@interface PGMemoryMapDescriptor : NSObject +-(void)addRange:(struct PGGuestPhysicalRange_s) range; +@end + @interface PGDeviceDescriptor (IOSurfaceMapper) @property (readwrite, nonatomic) bool usingIOSurfaceMapper; +@property (readwrite, nonatomic) bool enableArgumentBuffers; +@property (readwrite, nonatomic) bool enableProcessIsolation; +@property (readwrite, nonatomic) bool enableProtectedContent; + +@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor; @end @interface PGIOSurfaceHostDeviceDescriptor : NSObject -(PGIOSurfaceHostDeviceDescriptor *)init; @property (readwrite, nonatomic, copy, nullable) IOSFCMapMemory mapMemory; @property (readwrite, nonatomic, copy, nullable) IOSFCUnmapMemory unmapMemory; +@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor; +@property (readwrite, nonatomic) unsigned long long mmioLength; @property (readwrite, nonatomic, copy, nullable) IOSFCRaiseInterrupt raiseInterrupt; @end@@ -182,20 +194,28 @@ static bool apple_gfx_mmio_unmap_surface_memory(void *ptr) PGIOSurfaceHostDeviceDescriptor *iosfc_desc = [PGIOSurfaceHostDeviceDescriptor new]; PGIOSurfaceHostDevice *iosfc_host_dev; - - iosfc_desc.mapMemory = - ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) { - *va = apple_gfx_mmio_map_surface_memory(phys, len, ro); - - trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va); -
hw/display/apple-gfx-mmio.m static bool apple_gfx_mmio_unmap_surface_memory(void *ptr) · line 199
Quoted 10 lines
hw/display/apple-gfx-mmio.m +3
-7- return *va != NULL; - }; - - iosfc_desc.unmapMemory = - ^bool(void *va, void *b, void *c, void *d, void *e, void *f) { - return apple_gfx_mmio_unmap_surface_memory(va); - }; + PGMemoryMapDescriptor* memoryMapDescriptor = [PGMemoryMapDescriptor new]; + + if (@available(macOS 15.4, *)) {
This needs a big fat comment explaining what this condition is checking for, why it's doing that and what the effect of it is. I would also recommend to wrap this in something like a static inline bool function that gives it a descriptive name.
hw/display/apple-gfx-mmio.m static bool apple_gfx_mmio_unmap_surface_memory(void *ptr) · line 202
Quoted 3 lines
hw/display/apple-gfx-mmio.m +3
-0+ FlatView* fv = address_space_to_flatview(&address_space_memory); + flatview_for_each_range(fv, apple_gfx_register_memory_cb, memoryMapDescriptor); + iosfc_desc.mmioLength = 0x10000;
Why 0x10000?
Quoted 100 lines
hw/display/apple-gfx-mmio.m +23
-1+ iosfc_desc.memoryMapDescriptor = memoryMapDescriptor; + } else { + iosfc_desc.mapMemory = + ^bool(uint64_t phys, uint64_t len, bool ro, void **va, void *e, void *f) { + *va = apple_gfx_mmio_map_surface_memory(phys, len, ro); + + trace_apple_gfx_iosfc_map_memory(phys, len, ro, va, e, f, *va); + + return *va != NULL; + }; + + iosfc_desc.unmapMemory = + ^bool(void *va, void *b, void *c, void *d, void *e, void *f) { + return apple_gfx_mmio_unmap_surface_memory(va); + }; + } iosfc_desc.raiseInterrupt = ^bool(uint32_t vector) { trace_apple_gfx_iosfc_raise_irq(vector);@@ -223,13 +243,19 @@ static void apple_gfx_mmio_realize(DeviceState *dev, Error **errp) }; desc.usingIOSurfaceMapper = true; - s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s); + desc.enableArgumentBuffers = true; + // Process isolation needs to go through PGMemoryMapDescriptor + if (@available(macOS 15.4, *)) { + desc.enableProcessIsolation = true; + } if (!apple_gfx_common_realize(&s->common, dev, desc, errp)) { [s->pgiosfc release]; s->pgiosfc = nil; } + s->pgiosfc = apple_gfx_prepare_iosurface_host_device(s); + [desc release]; desc = nil; }hw/display/apple-gfx.h +13
-0@@ -23,6 +23,13 @@ @protocol MTLTexture; @protocol MTLCommandQueue; +typedef struct PGGuestPhysicalRange_s +{ +uint64_t physicalAddress; +uint64_t physicalLength; +void *hostAddress; +}PGGuestPhysicalRange_t ; + typedef QTAILQ_HEAD(, PGTask_s) PGTaskList; typedef struct AppleGFXDisplayMode {@@ -68,6 +75,12 @@ void *apple_gfx_host_ptr_for_gpa_range(uint64_t guest_physical, uint64_t length, bool read_only, MemoryRegion **mapping_in_region); +bool apple_gfx_register_memory_cb (Int128 start, +Int128 len, +const MemoryRegion *mr, +hwaddr offset_in_region, +void *opaque); +extern const PropertyInfo qdev_prop_apple_gfx_display_mode;#endif hw/display/apple-gfx.m +14
-0@@ -21,6 +21,7 @@ #include "system/address-spaces.h" #include "system/dma.h" #include "migration/blocker.h" +#include "system/memory.h" #include "ui/console.h" #include "apple-gfx.h" #include "trace.h"@@ -596,6 +597,41 @@ void apple_gfx_common_init(Object *obj, AppleGFXState *s, const char* obj_name) /* TODO: PVG framework supports serialising device state: integrate it! */ } +@interface PGMemoryMapDescriptor : NSObject +-(void)addRange:(struct PGGuestPhysicalRange_s) range; +@end + +@interface PGDeviceDescriptor (IOSurfaceMapper) +@property (readwrite, nonatomic, copy, nullable) PGMemoryMapDescriptor* memoryMapDescriptor; +@end + +bool apple_gfx_register_memory_cb(Int128 start, + Int128 len, + const MemoryRegion *mr, + hwaddr offset_in_region, + void *opaque) {
hw/display/apple-gfx.m void apple_gfx_common_init(Object *obj, AppleGFXState *s, const char* obj_name) · line 622
Quoted 10 lines
hw/display/apple-gfx.m +10
-0+ PGGuestPhysicalRange_t range; + PGMemoryMapDescriptor* memoryMapDescriptor = opaque; + if (mr->ram) { + range.physicalAddress = start; + range.physicalLength = len; + range.hostAddress = memory_region_get_ram_ptr(mr); + [memoryMapDescriptor addRange:range]; + } + return false; +}
By creating a full external function for the new isolated case, but keeping the inline mapMemory function for the non-isolated case this creates an awkward asymmetry. Either move both into functions or keep both inline.
Alex
Quoted 28 lines
hw/display/apple-gfx.m +17
-1+ +static void apple_gfx_register_memory(AppleGFXState *s, + PGDeviceDescriptor *desc) +{ + PGMemoryMapDescriptor* memoryMapDescriptor = [PGMemoryMapDescriptor new]; + + FlatView* fv = address_space_to_flatview(&address_space_memory); + flatview_for_each_range(fv, apple_gfx_register_memory_cb, memoryMapDescriptor); + + desc.memoryMapDescriptor = memoryMapDescriptor; +} + static void apple_gfx_register_task_mapping_handlers(AppleGFXState *s, PGDeviceDescriptor *desc) {@@ -763,7 +799,11 @@ bool apple_gfx_common_realize(AppleGFXState *s, DeviceState *dev, desc.device = s->mtl; - apple_gfx_register_task_mapping_handlers(s, desc); + if (@available(macOS 15.4, *)) { + apple_gfx_register_memory(s, desc); + } else { + apple_gfx_register_task_mapping_handlers(s, desc); + } s->cursor_show = true;
Re: [RFC v2 3/4] vmapple: apple-gfx: make it work on the latest macOS release
Quoted 17 lines · Alexander Graf
Quoted 1 line · Mohamed Mediouni
Follow changes in memory management, and enable process isolation for a sandboxed GPU process when on a new OS.
Please detail here why this is necessary.
Quoted 7 lines
Signed-off-by Mohamed Mediouni <[email protected]>---
hw/display/apple-gfx-mmio.m | 56 +++++++++++++++++++++++++++---------- hw/display/apple-gfx.h | 13 +++++++++ hw/display/apple-gfx.m | 42 +++++++++++++++++++++++++++-3 files changed, 95 insertions(+), 16 deletions(-)
Quoted 7 lines
Quoted 4 lines
+ FlatView* fv =
address_space_to_flatview(&address_space_memory); +flatview_for_each_range(fv, apple_gfx_register_memory_cb, memoryMapDescriptor);
+ iosfc_desc.mmioLength =0x10000;Why
0x10000?
Maybe we want qemu_real_host_page_size() here?
RFC v2 4/4 Revert "hw/arm: Do not build VMapple machine by default"
In reply to Mohamed MediouniThis reverts commit 49551752e860f5e403cdacac11ee1d218141fd3d.
--- configs/devices/aarch64-softmmu/default.mak | 1 - 1 file changed, 1 deletion(-)
configs/devices/aarch64-softmmu/default.mak +0 -1
@@ -9,4 +9,3 @@ include ../arm-softmmu/default.mak # CONFIG_XLNX_VERSAL=n # CONFIG_SBSA_REF=n # CONFIG_NPCM8XX=n -CONFIG_VMAPPLE=n
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [RFC v2 4/4] Revert "hw/arm: Do not build VMapple machine by default"
Quoted 1 line · Mohamed Mediouni
This reverts commit
49551752e860f5e403cdacac11ee1d218141fd3d.
The commit was there for a reason. What is the rationale to revert? Is it safe to do so now?
Alex
Quoted 15 lines
Signed-off-by Mohamed Mediouni <[email protected]>--- configs/devices/aarch64-softmmu/default.mak | 1 - 1 file changed, 1 deletion(-)configs/devices/aarch64-softmmu/default.mak +0
-1@@ -9,4 +9,3 @@ include ../arm-softmmu/default.mak # CONFIG_XLNX_VERSAL=n # CONFIG_SBSA_REF=n # CONFIG_NPCM8XX=n -CONFIG_VMAPPLE=n