Skip to contentSkip to conversation

host: Support macOS 12

RFC PATCH In review Philippe Mathieu-Daudé 6 participants 24 messages Jan 10, 2022 – Jan 18, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover host: Support macOS 12

Few patches to be able to build QEMU on macOS 12 (Monterey).

This basically consists of adapting deprecated APIs. I am not sure about these APIs, so tagging as RFC.

I couldn't succeed to adapt the Cocoa code.

CI job added to avoid bitrotting.

Since v2:
- Addressed Akihiko Odaki comments:
. use __is_identifier(),
. remove cocoa setAllowedFileTypes()
- Addressed Daniel Berrangé comment:
. rebased on testing/next, update libvirt-ci/lcitool

Based on Alex's testing/next
Based-on: <[email protected]>

Philippe Mathieu-Daudé (7):
configure: Allow passing extra Objective C compiler flags ui/cocoa: Remove allowedFileTypes restriction in SavePanel
hvf: Make hvf_get_segments() / hvf_put_segments() local
hvf: Remove deprecated hv_vcpu_flush() calls audio/coreaudio: Remove a deprecation warning on macOS 12 block/file-posix: Remove a deprecation warning on macOS 12
gitlab-ci: Support macOS 12 via cirrus-run

 configure                         |  8 ++++++++
 meson.build                       |  5 +++++
 target/i386/hvf/vmx.h             |  2 --
 target/i386/hvf/x86hvf.h          |  2 --
 audio/coreaudio.c                 | 16 ++++++++++------
 block/file-posix.c                | 13 +++++++++----
 target/i386/hvf/x86_task.c        |  1 -
 target/i386/hvf/x86hvf.c          |  6 ++----
 .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++
 .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++
 tests/lcitool/libvirt-ci          |  2 +-
 tests/lcitool/refresh             |  1 +
 ui/cocoa.m                        |  6 ------
 13 files changed, 67 insertions(+), 26 deletions(-)
 create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars
Signature · 1 line
2.33.1
#1 lore raw

RFC PATCH v3 1/7 configure: Allow passing extra Objective C compiler flags

We can pass C/CPP/LD flags via CFLAGS/CXXFLAGS/LDFLAGS environment variables, or via configure --extra-cflags / --extra-cxxflags / --extra-ldflags options. Provide similar behavior for Objective C:
use existing flags from $OBJCFLAGS, or passed via --extra-objcflags.

---
 configure   | 8 ++++++++
 meson.build | 5 +++++
 2 files changed, 13 insertions(+)
configure +8 -0
index 0c57a063c66..adb42d8beb1 100755
@@ -288,6 +288,7 @@ done
 
 EXTRA_CFLAGS=""
 EXTRA_CXXFLAGS=""
+EXTRA_OBJCFLAGS=""
 EXTRA_LDFLAGS=""
 
 xen_ctrl_version="$default_feature"
@@ -400,9 +401,12 @@ for opt do
   --extra-cflags=*)
     EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg"
     EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
+    EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
     ;;
   --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
   ;;
+  --extra-objcflags=*) EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
+  ;;
   --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
   ;;
   --enable-debug-info) debug_info="yes"
@@ -781,6 +785,8 @@ for opt do
   ;;
   --extra-cxxflags=*)
   ;;
+  --extra-objcflags=*)
+  ;;
   --extra-ldflags=*)
   ;;
   --enable-debug-info)
@@ -1318,6 +1324,7 @@ Advanced options (experts only):
   --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
   --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
   --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
+  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
   --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
   --cross-cc-flags-ARCH=   use compiler flags when building ARCH guest tests
@@ -3843,6 +3850,7 @@ if test "$skip_meson" = no; then
   echo "[built-in options]" >> $cross
   echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
   echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
+  test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
   echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "[binaries]" >> $cross
meson.build +5 -0
index 0e52f54b100..a21305d62c1 100644
@@ -3286,6 +3286,11 @@
                                                + ['-O' + get_option('optimization')]
                                                + (get_option('debug') ? ['-g'] : []))}
 endif
+if targetos == 'darwin'
+  summary_info += {'OBJCFLAGS':       ' '.join(get_option('objc_args')
+                                               + ['-O' + get_option('optimization')]
+                                               + (get_option('debug') ? ['-g'] : []))}
+endif
 link_args = get_option(link_language + '_link_args')
 if link_args.length() > 0
   summary_info += {'LDFLAGS':         ' '.join(link_args)}
Signature · 1 line
2.33.1
#2 lore raw

Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags

Quoted 66 lines · Philippe Mathieu-Daudé

We can pass C/CPP/LD flags via CFLAGS/CXXFLAGS/LDFLAGS environment variables, or via configure --extra-cflags / --extra-cxxflags / --extra-ldflags options. Provide similar behavior for Objective C:
use existing flags from $OBJCFLAGS, or passed via --extra-objcflags.

---
 configure   | 8 ++++++++
 meson.build | 5 +++++
 2 files changed, 13 insertions(+)
configure +8 -0
index 0c57a063c66..adb42d8beb1 100755
@@ -288,6 +288,7 @@ done
 
 EXTRA_CFLAGS=""
 EXTRA_CXXFLAGS=""
+EXTRA_OBJCFLAGS=""
 EXTRA_LDFLAGS=""
 
 xen_ctrl_version="$default_feature"
@@ -400,9 +401,12 @@ for opt do
   --extra-cflags=*)
     EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg"
     EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
+    EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
     ;;
   --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
   ;;
+  --extra-objcflags=*) EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
+  ;;
   --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
   ;;
   --enable-debug-info) debug_info="yes"
@@ -781,6 +785,8 @@ for opt do
   ;;
   --extra-cxxflags=*)
   ;;
+  --extra-objcflags=*)
+  ;;
   --extra-ldflags=*)
   ;;
   --enable-debug-info)
@@ -1318,6 +1324,7 @@ Advanced options (experts only):
   --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
   --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
   --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
+  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
   --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
   --cross-cc-flags-ARCH=   use compiler flags when building ARCH guest tests
@@ -3843,6 +3850,7 @@ if test "$skip_meson" = no; then
   echo "[built-in options]" >> $cross
   echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
   echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
+  test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
   echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "[binaries]" >> $cross
meson.build +0 -0
index 0e52f54b100..a21305d62c1 100644

meson.build line 3292

Quoted 7 lines
meson.build +4 -0
@@ -3286,6 +3286,11 @@
                                                + ['-O' + get_option('optimization')]
                                                + (get_option('debug') ? ['-g'] : []))}
 endif
+if targetos == 'darwin'
+  summary_info += {'OBJCFLAGS':       ' '.join(get_option('objc_args')
+                                               + ['-O' + get_option('optimization')]
+                                               + (get_option('debug') ? ['-g'] : []))}

Hi Philippe,

You need to add something like below to actually use the flags in build:

add_global_arguments(config_host['QEMU_OBJCFLAGS'].split(),
native: false, language: 'objc')

Regards,
Roman

Quoted 6 lines
meson.build +1 -0
+endif
 link_args = get_option(link_language + '_link_args')
 if link_args.length() > 0
   summary_info += {'LDFLAGS':         ' '.join(link_args)}
Signature · 1 line
2.33.1
#3 lore raw

Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags

+Paolo who I forgot to Cc.

Quoted 77 lines · Roman Bolshakov
Quoted 66 lines · Philippe Mathieu-Daudé

We can pass C/CPP/LD flags via CFLAGS/CXXFLAGS/LDFLAGS environment variables, or via configure --extra-cflags / --extra-cxxflags / --extra-ldflags options. Provide similar behavior for Objective C:
use existing flags from $OBJCFLAGS, or passed via --extra-objcflags.

---
 configure   | 8 ++++++++
 meson.build | 5 +++++
 2 files changed, 13 insertions(+)
configure +8 -0
index 0c57a063c66..adb42d8beb1 100755
@@ -288,6 +288,7 @@ done
 
 EXTRA_CFLAGS=""
 EXTRA_CXXFLAGS=""
+EXTRA_OBJCFLAGS=""
 EXTRA_LDFLAGS=""
 
 xen_ctrl_version="$default_feature"
@@ -400,9 +401,12 @@ for opt do
   --extra-cflags=*)
     EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg"
     EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
+    EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
     ;;
   --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
   ;;
+  --extra-objcflags=*) EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
+  ;;
   --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
   ;;
   --enable-debug-info) debug_info="yes"
@@ -781,6 +785,8 @@ for opt do
   ;;
   --extra-cxxflags=*)
   ;;
+  --extra-objcflags=*)
+  ;;
   --extra-ldflags=*)
   ;;
   --enable-debug-info)
@@ -1318,6 +1324,7 @@ Advanced options (experts only):
   --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
   --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
   --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
+  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
   --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
   --cross-cc-flags-ARCH=   use compiler flags when building ARCH guest tests
@@ -3843,6 +3850,7 @@ if test "$skip_meson" = no; then
   echo "[built-in options]" >> $cross
   echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
   echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
+  test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
   echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "[binaries]" >> $cross
meson.build +0 -0
index 0e52f54b100..a21305d62c1 100644

meson.build line 3292

Quoted 7 lines
meson.build +4 -0
@@ -3286,6 +3286,11 @@
                                                + ['-O' + get_option('optimization')]
                                                + (get_option('debug') ? ['-g'] : []))}
 endif
+if targetos == 'darwin'
+  summary_info += {'OBJCFLAGS':       ' '.join(get_option('objc_args')
+                                               + ['-O' + get_option('optimization')]
+                                               + (get_option('debug') ? ['-g'] : []))}

Hi Philippe,

Quoted 4 lines

You need to add something like below to actually use the flags in build:

add_global_arguments(config_host['QEMU_OBJCFLAGS'].split(),
native: false, language: 'objc')

But so far we don't need any particular QEMU_OBJCFLAGS, so I rather not add unused code. This patch simply adds passing ObjC flags from "./configure --extra-objcflags=".

Anyway, with your/Akihiko/Christian help during review, this flag is not necessary anymore to build softmmu/tools (I still have to figure how to silent the "#pragma FENV_ACCESS" warning in tests), so let forget about this patch (except if we expect macOS ObjC to keep evolving and need a way to pass OBJCFLAGS).

#4 lore raw

Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags

+Emilio

Quoted 5 lines · Philippe Mathieu-Daudé

Anyway, with your/Akihiko/Christian help during review, this flag is not necessary anymore to build softmmu/tools (I still have to figure how to silent the "#pragma FENV_ACCESS" warning in tests), so let forget about this patch (except if we expect macOS ObjC to keep evolving and need a way to pass OBJCFLAGS).

Apparently Clang equivalent of "#pragma STDC FENV_ACESS ON" is "-ffp-model=strict"

https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-model

I'll see if patching tests/fp/meson.build is sufficient.

#5 lore raw

Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags

Quoted 9 lines · Philippe Mathieu-Daudé

+Emilio

Quoted 5 lines · Philippe Mathieu-Daudé

Anyway, with your/Akihiko/Christian help during review, this flag is not necessary anymore to build softmmu/tools (I still have to figure how to silent the "#pragma FENV_ACCESS" warning in tests), so let forget about this patch (except if we expect macOS ObjC to keep evolving and need a way to pass OBJCFLAGS).

Quoted 6 lines

Apparently Clang equivalent of "#pragma STDC FENV_ACESS ON" is "-ffp-model=strict"

https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-model

I'll see if patching tests/fp/meson.build is sufficient.

This seems to do the job:

-- >8 --

tests/fp/meson.build +6 -0
index 59776a00a79..b790487648a 100644
@@ -37,6 +37,12 @@
   '-Wno-error',
 ]
 
+if cc.get_id() == 'clang' and cc.has_argument('-ffp-model=strict')
+  # Clang does not support '#pragma STDC FENV_ACCESS', but starting
+  # with Clang 10.0 the equivalent is -ffp-model=strict.
+  tfcflags += [ '-ffp-model=strict' ]
+endif
+
 tfgencases = [
   tfdir / 'genCases_ui32.c',
   tfdir / 'genCases_ui64.c',

---

#6 lore raw

RFC PATCH v3 2/7 ui/cocoa: Remove allowedFileTypes restriction in SavePanel

In reply to Philippe Mathieu-Daudé

setAllowedFileTypes is deprecated in macOS 12.

Per Akihiko Odaki [*]:

An image file, which is being chosen by the panel, can be a raw file and have a variety of file extensions and many are not covered by the provided list (e.g. "udf"). Other platforms like GTK can provide an option to open a file with an extension not listed, but Cocoa can't. It forces the user to rename the file to give an extension in the list. Moreover, Cocoa does not tell which extensions are in the list so the user needs to read the source code, which is pretty bad.

Since this code is harming the usability rather than improving it, simply remove the [NSSavePanel allowedFileTypes:] call, fixing:

[2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o
ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first deprecated in macOS 12.0 - Use -allowedContentTypes instead [-Werror,-Wdeprecated-declarations]

      [openPanel setAllowedFileTypes: supportedImageFileTypes];
                 ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: property 'allowedFileTypes' is declared deprecated here
  @property (nullable, copy) NSArray<NSString *> *allowedFileTypes API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0));
                                                  ^

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: 'setAllowedFileTypes:' has been explicitly marked deprecated here
FAILED: libcommon.fa.p/ui_cocoa.m.o

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

---
 ui/cocoa.m | 6 ------
 1 file changed, 6 deletions(-)
ui/cocoa.m +0 -6
index 69745c483b4..dec22968815 100644
@@ -100,7 +100,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
 static char **gArgv;
 static bool stretch_video;
 static NSTextField *pauseLabel;
-static NSArray * supportedImageFileTypes;
 
 static QemuSemaphore display_init_sem;
 static QemuSemaphore app_started_sem;
@@ -1162,10 +1161,6 @@ - (id) init
         [pauseLabel setTextColor: [NSColor blackColor]];
         [pauseLabel sizeToFit];
 
-        // set the supported image file types that can be opened
-        supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg",
-                                 @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr",
-                                  @"toast", nil];
         [self make_about_window];
     }
     return self;
@@ -1408,7 +1403,6 @@ - (void)changeDeviceMedia:(id)sender
     openPanel = [NSOpenPanel openPanel];
     [openPanel setCanChooseFiles: YES];
     [openPanel setAllowsMultipleSelection: NO];
-    [openPanel setAllowedFileTypes: supportedImageFileTypes];
     if([openPanel runModal] == NSModalResponseOK) {
         NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
         if(file == nil) {
Signature · 1 line
2.33.1
Reviewed-by Tested-by on v3 2/7
#7 lore raw

Re: [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel

Quoted 10 lines · Philippe Mathieu-Daudé

setAllowedFileTypes is deprecated in macOS 12.

Per Akihiko Odaki [*]:

An image file, which is being chosen by the panel, can be a raw file and have a variety of file extensions and many are not covered by the provided list (e.g. "udf"). Other platforms like GTK can provide an option to open a file with an extension not listed, but Cocoa can't.

Quoted 8 lines

It forces the user to rename the file
to give an extension in the list. Moreover, Cocoa does not tell which extensions are in the list so the user needs to read the source code, which is pretty bad.

Since this code is harming the usability rather than improving it, simply remove the [NSSavePanel allowedFileTypes:] call, fixing:

Yes, it is an issue for raw images with extensions outside of the specified list or for images without any extension.

Regards,
-Roman

Quoted 52 lines

[2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o
ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first deprecated in macOS 12.0 - Use -allowedContentTypes instead [-Werror,-Wdeprecated-declarations]

      [openPanel setAllowedFileTypes: supportedImageFileTypes];
                 ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: property 'allowedFileTypes' is declared deprecated here
  @property (nullable, copy) NSArray<NSString *> *allowedFileTypes API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0));
                                                  ^

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: 'setAllowedFileTypes:' has been explicitly marked deprecated here
FAILED: libcommon.fa.p/ui_cocoa.m.o

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

---
 ui/cocoa.m | 6 ------
 1 file changed, 6 deletions(-)
ui/cocoa.m +0 -6
index 69745c483b4..dec22968815 100644
@@ -100,7 +100,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
 static char **gArgv;
 static bool stretch_video;
 static NSTextField *pauseLabel;
-static NSArray * supportedImageFileTypes;
 
 static QemuSemaphore display_init_sem;
 static QemuSemaphore app_started_sem;
@@ -1162,10 +1161,6 @@ - (id) init
         [pauseLabel setTextColor: [NSColor blackColor]];
         [pauseLabel sizeToFit];
 
-        // set the supported image file types that can be opened
-        supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg",
-                                 @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr",
-                                  @"toast", nil];
         [self make_about_window];
     }
     return self;
@@ -1408,7 +1403,6 @@ - (void)changeDeviceMedia:(id)sender
     openPanel = [NSOpenPanel openPanel];
     [openPanel setCanChooseFiles: YES];
     [openPanel setAllowsMultipleSelection: NO];
-    [openPanel setAllowedFileTypes: supportedImageFileTypes];
     if([openPanel runModal] == NSModalResponseOK) {
         NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
         if(file == nil) {
Signature · 1 line
2.33.1
#8 lore raw

RFC PATCH v3 3/7 hvf: Make hvf_get_segments() / hvf_put_segments() local

In reply to Philippe Mathieu-Daudé

Both hvf_get_segments/hvf_put_segments() functions are only used within x86hvf.c: do not declare them as public API.

---
 target/i386/hvf/x86hvf.h | 2 --
 target/i386/hvf/x86hvf.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
target/i386/hvf/x86hvf.h +0 -2
index 99ed8d608dd..db6003d6bda 100644
@@ -26,11 +26,9 @@ void hvf_set_segment(struct CPUState *cpu, struct vmx_segment *vmx_seg,
                      SegmentCache *qseg, bool is_tr);
 void hvf_get_segment(SegmentCache *qseg, struct vmx_segment *vmx_seg);
 void hvf_put_xsave(CPUState *cpu_state);
-void hvf_put_segments(CPUState *cpu_state);
 void hvf_put_msrs(CPUState *cpu_state);
 void hvf_get_xsave(CPUState *cpu_state);
 void hvf_get_msrs(CPUState *cpu_state);
 void vmx_clear_int_window_exiting(CPUState *cpu);
-void hvf_get_segments(CPUState *cpu_state);
 void vmx_update_tpr(CPUState *cpu);
 #endif
target/i386/hvf/x86hvf.c +2 -2
index 05ec1bddc4e..907f09f1b43 100644
@@ -83,7 +83,7 @@ void hvf_put_xsave(CPUState *cpu_state)
     }
 }
 
-void hvf_put_segments(CPUState *cpu_state)
+static void hvf_put_segments(CPUState *cpu_state)
 {
     CPUX86State *env = &X86_CPU(cpu_state)->env;
     struct vmx_segment seg;
@@ -166,7 +166,7 @@ void hvf_get_xsave(CPUState *cpu_state)
     x86_cpu_xrstor_all_areas(X86_CPU(cpu_state), xsave, xsave_len);
 }
 
-void hvf_get_segments(CPUState *cpu_state)
+static void hvf_get_segments(CPUState *cpu_state)
 {
     CPUX86State *env = &X86_CPU(cpu_state)->env;
 
Signature · 1 line
2.33.1
Reviewed-by Tested-by on v3 3/7
#9 lore raw

Re: [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local

Quoted 3 lines · Philippe Mathieu-Daudé

Both hvf_get_segments/hvf_put_segments() functions are only used within x86hvf.c: do not declare them as public API.

Thanks,
Roman

Quoted 46 lines
---
 target/i386/hvf/x86hvf.h | 2 --
 target/i386/hvf/x86hvf.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
target/i386/hvf/x86hvf.h +0 -2
index 99ed8d608dd..db6003d6bda 100644
@@ -26,11 +26,9 @@ void hvf_set_segment(struct CPUState *cpu, struct vmx_segment *vmx_seg,
                      SegmentCache *qseg, bool is_tr);
 void hvf_get_segment(SegmentCache *qseg, struct vmx_segment *vmx_seg);
 void hvf_put_xsave(CPUState *cpu_state);
-void hvf_put_segments(CPUState *cpu_state);
 void hvf_put_msrs(CPUState *cpu_state);
 void hvf_get_xsave(CPUState *cpu_state);
 void hvf_get_msrs(CPUState *cpu_state);
 void vmx_clear_int_window_exiting(CPUState *cpu);
-void hvf_get_segments(CPUState *cpu_state);
 void vmx_update_tpr(CPUState *cpu);
 #endif
target/i386/hvf/x86hvf.c +2 -2
index 05ec1bddc4e..907f09f1b43 100644
@@ -83,7 +83,7 @@ void hvf_put_xsave(CPUState *cpu_state)
     }
 }
 
-void hvf_put_segments(CPUState *cpu_state)
+static void hvf_put_segments(CPUState *cpu_state)
 {
     CPUX86State *env = &X86_CPU(cpu_state)->env;
     struct vmx_segment seg;
@@ -166,7 +166,7 @@ void hvf_get_xsave(CPUState *cpu_state)
     x86_cpu_xrstor_all_areas(X86_CPU(cpu_state), xsave, xsave_len);
 }
 
-void hvf_get_segments(CPUState *cpu_state)
+static void hvf_get_segments(CPUState *cpu_state)
 {
     CPUX86State *env = &X86_CPU(cpu_state)->env;
 
Signature · 1 line
2.33.1
#10 lore raw

RFC PATCH v3 4/7 hvf: Remove deprecated hv_vcpu_flush() calls

In reply to Philippe Mathieu-Daudé

When building on macOS 12, we get:

In file included from ../target/i386/hvf/hvf.c:59:
../target/i386/hvf/vmx.h:174:5: error: 'hv_vcpu_flush' is deprecated: first deprecated in macOS 11.0 - This API has no effect and always returns HV_UNSUPPORTED [-Werror,-Wdeprecated-declarations]

      hv_vcpu_flush(vcpu);
      ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Hypervisor.framework/Headers/hv.h:364:20: note: 'hv_vcpu_flush' has been explicitly marked deprecated here
  extern hv_return_t hv_vcpu_flush(hv_vcpuid_t vcpu)
                     ^

Since this call "has no effect", simply remove it ¯\_(ツ)_/¯

Not very useful deprecation doc:
https://developer.apple.com/documentation/hypervisor/1441386-hv_vcpu_flush

---
 target/i386/hvf/vmx.h      | 2 --
 target/i386/hvf/x86_task.c | 1 -
 target/i386/hvf/x86hvf.c   | 2 --
 3 files changed, 5 deletions(-)
target/i386/hvf/vmx.h +0 -2
index 6df87116f62..094fb9b9dc9 100644
@@ -159,7 +159,6 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0)
     wvmcs(vcpu, VMCS_GUEST_CR0, cr0 | CR0_NE | CR0_ET);
 
     hv_vcpu_invalidate_tlb(vcpu);
-    hv_vcpu_flush(vcpu);
 }
 
 static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4)
@@ -171,7 +170,6 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4)
     wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE);
 
     hv_vcpu_invalidate_tlb(vcpu);
-    hv_vcpu_flush(vcpu);
 }
 
 static inline void macvm_set_rip(CPUState *cpu, uint64_t rip)
target/i386/hvf/x86_task.c +0 -1
index 422156128b7..c8dc3d48fa8 100644
@@ -181,5 +181,4 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea
     store_regs(cpu);
 
     hv_vcpu_invalidate_tlb(cpu->hvf->fd);
-    hv_vcpu_flush(cpu->hvf->fd);
 }
target/i386/hvf/x86hvf.c +0 -2
index 907f09f1b43..bec9fc58146 100644
@@ -125,8 +125,6 @@ static void hvf_put_segments(CPUState *cpu_state)
 
     hvf_set_segment(cpu_state, &seg, &env->ldt, false);
     vmx_write_segment_descriptor(cpu_state, &seg, R_LDTR);
-    
-    hv_vcpu_flush(cpu_state->hvf->fd);
 }
     
 void hvf_put_msrs(CPUState *cpu_state)
Signature · 1 line
2.33.1
Reviewed-by Tested-by on v3 4/7
#11 lore raw

Re: [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls

Quoted 6 lines · Philippe Mathieu-Daudé

When building on macOS 12, we get:

In file included from ../target/i386/hvf/hvf.c:59:
../target/i386/hvf/vmx.h:174:5: error: 'hv_vcpu_flush' is deprecated: first deprecated in macOS 11.0 - This API has no effect and always returns HV_UNSUPPORTED [-Werror,-Wdeprecated-declarations]

      hv_vcpu_flush(vcpu);
      ^

This seems to be true even for older macOS (e.g. Catalina).

Quoted 9 lines

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Hypervisor.framework/Headers/hv.h:364:20: note: 'hv_vcpu_flush' has been explicitly marked deprecated here extern hv_return_t hv_vcpu_flush(hv_vcpuid_t vcpu)

                     ^

Since this call "has no effect", simply remove it ¯\_(ツ)_/¯

Not very useful deprecation doc:
https://developer.apple.com/documentation/hypervisor/1441386-hv_vcpu_flush

Thanks,
Roman

Quoted 52 lines
---
 target/i386/hvf/vmx.h      | 2 --
 target/i386/hvf/x86_task.c | 1 -
 target/i386/hvf/x86hvf.c   | 2 --
 3 files changed, 5 deletions(-)
target/i386/hvf/vmx.h +0 -2
index 6df87116f62..094fb9b9dc9 100644
@@ -159,7 +159,6 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0)
     wvmcs(vcpu, VMCS_GUEST_CR0, cr0 | CR0_NE | CR0_ET);
 
     hv_vcpu_invalidate_tlb(vcpu);
-    hv_vcpu_flush(vcpu);
 }
 
 static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4)
@@ -171,7 +170,6 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4)
     wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE);
 
     hv_vcpu_invalidate_tlb(vcpu);
-    hv_vcpu_flush(vcpu);
 }
 
 static inline void macvm_set_rip(CPUState *cpu, uint64_t rip)
target/i386/hvf/x86_task.c +0 -1
index 422156128b7..c8dc3d48fa8 100644
@@ -181,5 +181,4 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea
     store_regs(cpu);
 
     hv_vcpu_invalidate_tlb(cpu->hvf->fd);
-    hv_vcpu_flush(cpu->hvf->fd);
 }
target/i386/hvf/x86hvf.c +0 -2
index 907f09f1b43..bec9fc58146 100644
@@ -125,8 +125,6 @@ static void hvf_put_segments(CPUState *cpu_state)
 
     hvf_set_segment(cpu_state, &seg, &env->ldt, false);
     vmx_write_segment_descriptor(cpu_state, &seg, R_LDTR);
-    
-    hv_vcpu_flush(cpu_state->hvf->fd);
 }
 
 void hvf_put_msrs(CPUState *cpu_state)
Signature · 1 line
2.33.1
#12 lore raw

RFC PATCH v3 5/7 audio/coreaudio: Remove a deprecation warning on macOS 12

In reply to Philippe Mathieu-Daudé

When building on macOS 12 we get:

audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]

      kAudioObjectPropertyElementMaster
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kAudioObjectPropertyElementMain
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: 'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here
      kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain
      ^

Replace by kAudioObjectPropertyElementMain, redefining it to kAudioObjectPropertyElementMaster if not available, using Clang __is_identifier() feature (coreaudio is restricted to macOS).

---
Checkpatch:

WARNING: architecture specific defines should be avoided
#10: FILE: audio/coreaudio.c:47:
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */

Should we define __is_identifier() to 0 for GCC on macOS?

---
 audio/coreaudio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
audio/coreaudio.c +10 -6
index d8a21d3e507..73cbfd479ac 100644
@@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
     bool enabled;
 } coreaudioVoiceOut;
 
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+
 static const AudioObjectPropertyAddress voice_addr = {
     kAudioHardwarePropertyDefaultOutputDevice,
     kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
+    kAudioObjectPropertyElementMain
 };
 
 static OSStatus coreaudio_get_voice(AudioDeviceID *id)
@@ -69,7 +73,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSizeRange,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -86,7 +90,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -103,7 +107,7 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -121,7 +125,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyStreamFormat,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -138,7 +142,7 @@ static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyDeviceIsRunning,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
Signature · 1 line
2.33.1
#13 lore raw

Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12

Quoted 16 lines · Philippe Mathieu-Daudé

When building on macOS 12 we get:

audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]

      kAudioObjectPropertyElementMaster
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kAudioObjectPropertyElementMain
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: 'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here
      kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain
      ^

Replace by kAudioObjectPropertyElementMain, redefining it to kAudioObjectPropertyElementMaster if not available, using Clang __is_identifier() feature (coreaudio is restricted to macOS).

Quoted 8 lines

---
Checkpatch:

WARNING: architecture specific defines should be avoided
#10: FILE: audio/coreaudio.c:47:
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */

Should we define __is_identifier() to 0 for GCC on macOS?

So apparently yes:
https://lore.kernel.org/qemu-devel/2147921.xlN1UyrzLN@silver/

Christian Schoenebeck suggests:

#if !defined(MAC_OS_VERSION_12_0) ||
    (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)

#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster #endif

Quoted 22 lines
---
 audio/coreaudio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
audio/coreaudio.c +5 -1
index d8a21d3e507..73cbfd479ac 100644
@@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
     bool enabled;
 } coreaudioVoiceOut;
 
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+
 static const AudioObjectPropertyAddress voice_addr = {
     kAudioHardwarePropertyDefaultOutputDevice,
     kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
+    kAudioObjectPropertyElementMain
 };
#14 lore raw

Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12

Quoted 37 lines · On Montag, 10. Januar 2022 14:20:56 CET Philippe Mathieu-Daudé wrote:
Quoted 25 lines · Philippe Mathieu-Daudé

When building on macOS 12 we get:
audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is
deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]>

      kAudioObjectPropertyElementMaster
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kAudioObjectPropertyElementMain

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frame works/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note:
'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here>
kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain ^

Replace by kAudioObjectPropertyElementMain, redefining it to kAudioObjectPropertyElementMaster if not available, using Clang __is_identifier() feature (coreaudio is restricted to macOS).

---

Quoted 7 lines

Checkpatch:
WARNING: architecture specific defines should be avoided #10: FILE: audio/coreaudio.c:47:
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */

Should we define __is_identifier() to 0 for GCC on macOS?

So apparently yes:
https://lore.kernel.org/qemu-devel/2147921.xlN1UyrzLN@silver/

Quoted 6 lines

Christian Schoenebeck suggests:

#if !defined(MAC_OS_VERSION_12_0) ||
    (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)

#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster #endif

Note: line wrap. So don't forget a backslash at the end:

#if !defined(MAC_OS_VERSION_12_0) || \
    (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)

#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster #endif

I guess you would have seen it in the editor anyway, but just to be sure.

Quoted 30 lines
Quoted 30 lines

---

 audio/coreaudio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
audio/coreaudio.c +5 -1
index d8a21d3e507..73cbfd479ac 100644
@@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
 
     bool enabled;
 
 } coreaudioVoiceOut;
 
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+
 
 static const AudioObjectPropertyAddress voice_addr = {
 
     kAudioHardwarePropertyDefaultOutputDevice,
     kAudioObjectPropertyScopeGlobal,
 
-    kAudioObjectPropertyElementMaster
+    kAudioObjectPropertyElementMain
 
 };
#15 lore raw

Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

When building on macOS 12 we get:

audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]

      kAudioObjectPropertyElementMaster
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kAudioObjectPropertyElementMain
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: 'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here
      kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain
      ^
Quoted 5 lines

Replace by kAudioObjectPropertyElementMain, redefining it to kAudioObjectPropertyElementMaster if not available, using Clang __is_identifier() feature (coreaudio is restricted to macOS).

As of now it breaks the build on Catalina/10.15:

FAILED: libcommon.fa.p/audio_coreaudio.c.o
cc <...>
../audio/coreaudio.c:54:5: error: use of undeclared identifier 'kAudioObjectPropertyElementMain'; did you mean 'kAudioObjectPropertyElementName'?

    kAudioObjectPropertyElementMain
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    kAudioObjectPropertyElementName

But __is_identifier itself works... Weird.

Quoted 9 lines

---
Checkpatch:

WARNING: architecture specific defines should be avoided
#10: FILE: audio/coreaudio.c:47:
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */

Should we define __is_identifier() to 0 for GCC on macOS?

Clang documentation has this snippet:

#ifdef __is_identifier // Compatibility with non-clang compilers.

  #if __is_identifier(__wchar_t)
    typedef wchar_t __wchar_t;

#endif
#endif

We can also add ifdef around just to be nice to GCC if it ever comes back on macOS :)

Regards,
Roman

Quoted 71 lines
---
 audio/coreaudio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
audio/coreaudio.c +10 -6
index d8a21d3e507..73cbfd479ac 100644
@@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
     bool enabled;
 } coreaudioVoiceOut;
 
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+
 static const AudioObjectPropertyAddress voice_addr = {
     kAudioHardwarePropertyDefaultOutputDevice,
     kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
+    kAudioObjectPropertyElementMain
 };
 
 static OSStatus coreaudio_get_voice(AudioDeviceID *id)
@@ -69,7 +73,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSizeRange,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -86,7 +90,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -103,7 +107,7 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -121,7 +125,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyStreamFormat,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -138,7 +142,7 @@ static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyDeviceIsRunning,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
Signature · 1 line
2.33.1
#16 lore raw

Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12

In reply to Philippe Mathieu-Daudé
Quoted 33 lines · Philippe Mathieu-Daudé

When building on macOS 12 we get:

audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]

      kAudioObjectPropertyElementMaster
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kAudioObjectPropertyElementMain
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: 'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here
      kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain
      ^

Replace by kAudioObjectPropertyElementMain, redefining it to kAudioObjectPropertyElementMaster if not available, using Clang __is_identifier() feature (coreaudio is restricted to macOS).

---
Checkpatch:

WARNING: architecture specific defines should be avoided
#10: FILE: audio/coreaudio.c:47:
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */

Should we define __is_identifier() to 0 for GCC on macOS?

---
 audio/coreaudio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
audio/coreaudio.c +0 -0
index d8a21d3e507..73cbfd479ac 100644

audio/coreaudio.c typedef struct coreaudioVoiceOut { · line 49

Quoted 6 lines
audio/coreaudio.c +3 -0
@@ -44,10 +44,14 @@ typedef struct coreaudioVoiceOut {
     bool enabled;
 } coreaudioVoiceOut;
 
+#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif

Christian and Akihiko are right you need to replace it with macOS version wrappers:

audio/coreaudio.c +2 -1
index 73cbfd479a..7367a2ffd4 100644
@@ -44,7 +44,8 @@ typedef struct coreaudioVoiceOut {
     bool enabled;
 } coreaudioVoiceOut;
 
-#if !__is_identifier(kAudioObjectPropertyElementMain) /* macOS >= 12.0 */
+#if !defined(MAC_OS_VERSION_12_0) || \
+    (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)
 #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
 #endif
 

And in the patch 6 you'd do likewise:

block/file-posix.c +2 -1
index 1d0512026c..c0038629a1 100644
@@ -3325,7 +3325,8 @@ BlockDriver bdrv_file = {
 static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
                                 CFIndex maxPathSize, int flags);
 
-#if !__is_identifier(IOMainPort) /* macOS >= 12.0 */
+#if !defined(MAC_OS_VERSION_12_0) || \
+    (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)
 #define IOMainPort IOMasterPort
 #endif
 

This way it the build would work also on older macOS.

Two more issues are left:

1. Linker has corrupted paths to clang directory (happens on all macOS versions).

Monterey:

[732/737] Linking target qemu-system-mips-unsigned
ld: warning: directory not found for option '-Lns/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0' [733/737] Linking target qemu-system-mips64-unsigned
ld: warning: directory not found for option '-Lns/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0' [737/737] Generating qemu-system-mips64 with a custom command

Catalina:

ld: warning: directory not found for option '-Lveloper/CommandLineTools/usr/lib/clang/11.0.0' [102/105] Linking target qemu-system-or1k-unsigned
ld: warning: directory not found for option '-Lveloper/CommandLineTools/usr/lib/clang/11.0.0' [104/105] Linking target qemu-system-ppc-unsigned
ld: warning: directory not found for option '-Lveloper/CommandLineTools/usr/lib/clang/11.0.0' [105/105] Generating qemu-system-ppc with a custom command

2. QEMU tests show FENV_ACCESS warning on Monterey:

[409/771] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_az_f128_rx.c.o ../tests/fp/berkeley-testfloat-3/source/test_az_f128_rx.c:49:14: warning: '#pragma FENV_ACCESS' is not supported on this target - ignored [-Wignored-pragmas] #pragma STDC FENV_ACCESS ON

             ^

1 warning generated.
[410/771] Compiling C object tests/fp/libtestfloat.a.p/berkeley-testfloat-3_source_test_abcz_f128.c.o ../tests/fp/berkeley-testfloat-3/source/test_abcz_f128.c:48:14: warning: '#pragma FENV_ACCESS' is not supported on this target - ignored [-Wignored-pragmas] #pragma STDC FENV_ACCESS ON

             ^

1 warning generated.

Regards,
Roman

Quoted 56 lines
audio/coreaudio.c +7 -6
+
 static const AudioObjectPropertyAddress voice_addr = {
     kAudioHardwarePropertyDefaultOutputDevice,
     kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
+    kAudioObjectPropertyElementMain
 };
 
 static OSStatus coreaudio_get_voice(AudioDeviceID *id)
@@ -69,7 +73,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSizeRange,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -86,7 +90,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
@@ -103,7 +107,7 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesize)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyBufferFrameSize,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -121,7 +125,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID id,
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyStreamFormat,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectSetPropertyData(id,
@@ -138,7 +142,7 @@ static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result)
     AudioObjectPropertyAddress addr = {
         kAudioDevicePropertyDeviceIsRunning,
         kAudioDevicePropertyScopeOutput,
-        kAudioObjectPropertyElementMaster
+        kAudioObjectPropertyElementMain
     };
 
     return AudioObjectGetPropertyData(id,
Signature · 1 line
2.33.1
#17 lore raw

RFC PATCH v3 6/7 block/file-posix: Remove a deprecation warning on macOS 12

In reply to Philippe Mathieu-Daudé

When building on macOS 12 we get:

block/file-posix.c:3335:18: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]

      kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
                   ^~~~~~~~~~~~
                   IOMainPort

Replace by IOMainPort, redefining it to IOMasterPort if not available, using Clang __is_identifier() feature (this code is guarded by __APPLE__ #ifdef'ry).

---
Checkpatch:

WARNING: architecture specific defines should be avoided

---
 block/file-posix.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
block/file-posix.c +9 -4
index b283093e5b7..1d0512026c5 100644
@@ -3324,17 +3324,22 @@ BlockDriver bdrv_file = {
 #if defined(__APPLE__) && defined(__MACH__)
 static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
                                 CFIndex maxPathSize, int flags);
+
+#if !__is_identifier(IOMainPort) /* macOS >= 12.0 */
+#define IOMainPort IOMasterPort
+#endif
+
 static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
 {
     kern_return_t kernResult = KERN_FAILURE;
-    mach_port_t     masterPort;
+    mach_port_t mainPort;
     CFMutableDictionaryRef  classesToMatch;
     const char *matching_array[] = {kIODVDMediaClass, kIOCDMediaClass};
     char *mediaType = NULL;
 
-    kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
+    kernResult = IOMainPort(MACH_PORT_NULL, &mainPort);
     if ( KERN_SUCCESS != kernResult ) {
-        printf( "IOMasterPort returned %d\n", kernResult );
+        printf("IOMainPort returned %d\n", kernResult);
     }
 
     int index;
@@ -3347,7 +3352,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
         }
         CFDictionarySetValue(classesToMatch, CFSTR(kIOMediaEjectableKey),
                              kCFBooleanTrue);
-        kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
+        kernResult = IOServiceGetMatchingServices(mainPort, classesToMatch,
                                                   mediaIterator);
         if (kernResult != KERN_SUCCESS) {
             error_report("Note: IOServiceGetMatchingServices returned %d",
Signature · 1 line
2.33.1
#18 lore raw

Re: [RFC PATCH v3 6/7] block/file-posix: Remove a deprecation warning on macOS 12

Quoted 53 lines · Philippe Mathieu-Daudé

When building on macOS 12 we get:

   block/file-posix.c:3335:18: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
       kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
                    ^~~~~~~~~~~~
                    IOMainPort

Replace by IOMainPort, redefining it to IOMasterPort if not available, using Clang __is_identifier() feature (this code is guarded by __APPLE__ #ifdef'ry).

---
Checkpatch:

WARNING: architecture specific defines should be avoided

---
  block/file-posix.c | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
block/file-posix.c +8 -3
index b283093e5b7..1d0512026c5 100644
@@ -3324,17 +3324,22 @@ BlockDriver bdrv_file = {
  #if defined(__APPLE__) && defined(__MACH__)
  static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
                                  CFIndex maxPathSize, int flags);
+
+#if !__is_identifier(IOMainPort) /* macOS >= 12.0 */
+#define IOMainPort IOMasterPort
+#endif
+
  static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
  {
      kern_return_t kernResult = KERN_FAILURE;
-    mach_port_t     masterPort;
+    mach_port_t mainPort;
      CFMutableDictionaryRef  classesToMatch;
      const char *matching_array[] = {kIODVDMediaClass, kIOCDMediaClass};
      char *mediaType = NULL;
 
-    kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
+    kernResult = IOMainPort(MACH_PORT_NULL, &mainPort);
      if ( KERN_SUCCESS != kernResult ) {
-        printf( "IOMasterPort returned %d\n", kernResult );
+        printf("IOMainPort returned %d\n", kernResult);
      }
 
      int index;

block/file-posix.c static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator) · line 3358

Quoted 8 lines
block/file-posix.c +1 -1
@@ -3347,7 +3352,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
          }
          CFDictionarySetValue(classesToMatch, CFSTR(kIOMediaEjectableKey),
                               kCFBooleanTrue);
-        kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
+        kernResult = IOServiceGetMatchingServices(mainPort, classesToMatch,
                                                    mediaIterator);
          if (kernResult != KERN_SUCCESS) {
              error_report("Note: IOServiceGetMatchingServices returned %d",

Unlike kAudioObjectPropertyElementMain, which is a constant, IOMainPort is a symbol, and its availability depends on the runtime. As such, the check the existence of the compile-time identifier is not sufficient here. MAC_OS_X_VERSION_MIN_REQUIRED should be used instead. (I should have suggested the use of MAC_OS_X_VERSION_MIN_REQUIRED at the first place since it can be used regardless if the identifier is for a constant or a symbol. My Bad.)

Regards,
Akihiko Odaki

#19 lore raw

RFC PATCH v3 7/7 gitlab-ci: Support macOS 12 via cirrus-run

In reply to Philippe Mathieu-Daudé

Add support for macOS 12 build on Cirrus-CI, similarly to commit 0e103a65ba1 ("gitlab: support for ... macOS 11 via cirrus-run").

Update the lcitool repository to get the macos12 mappings, and generate the vars file by calling 'make lcitool-refresh'.

---
Pending on libvirt-ci MR #210:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/210

---
 .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++
 .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++
 tests/lcitool/libvirt-ci          |  2 +-
 tests/lcitool/refresh             |  1 +
 4 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars
.gitlab-ci.d/cirrus.yml +15 -0
index b96b22e2697..b7662959070 100644
@@ -87,6 +87,21 @@ x64-macos-11-base-build:
     PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
     TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
 
+x64-macos-12-base-build:
+  extends: .cirrus_build_job
+  variables:
+    NAME: macos-12
+    CIRRUS_VM_INSTANCE_TYPE: osx_instance
+    CIRRUS_VM_IMAGE_SELECTOR: image
+    CIRRUS_VM_IMAGE_NAME: monterey-base
+    CIRRUS_VM_CPUS: 12
+    CIRRUS_VM_RAM: 24G
+    UPDATE_COMMAND: brew update
+    INSTALL_COMMAND: brew install
+    PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
+    PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
+    TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
+
 
 # The following jobs run VM-based tests via KVM on a Linux-based Cirrus-CI job
 .cirrus_kvm_job:
.gitlab-ci.d/cirrus/macos-12.vars new file +16 -0
new file mode 100644
index 00000000000..997dbc762c8
@@ -0,0 +1,16 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool variables macos-12 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
+CCACHE='/usr/local/bin/ccache'
+CPAN_PKGS='Test::Harness'
+CROSS_PKGS=''
+MAKE='/usr/local/bin/gmake'
+NINJA='/usr/local/bin/ninja'
+PACKAGING_COMMAND='brew'
+PIP3='/usr/local/bin/pip3'
+PKGS='bash bc bzip2 capstone ccache cpanminus ctags curl dbus diffutils dtc gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb libxml2 llvm lzo make meson ncurses nettle ninja perl pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract texinfo usbredir vde vte3 zlib zstd'
+PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme virtualenv'
+PYTHON='/usr/local/bin/python3'
tests/lcitool/libvirt-ci +1 -1
index 8f48e54238d..e91e83fed20 160000
@@ -1 +1 @@
-Subproject commit 8f48e54238d28d7a427a541d6dbe56432e3c4660
+Subproject commit e91e83fed2086163013242e8a33c74fbfba7f729
tests/lcitool/refresh +1 -0
index 033120e223d..6ac8b888927 100755
@@ -89,6 +89,7 @@ try:
    generate_cirrus("freebsd-12")
    generate_cirrus("freebsd-13")
    generate_cirrus("macos-11")
+   generate_cirrus("macos-12")
 
    sys.exit(0)
 except Exception as ex:
Signature · 1 line
2.33.1
#20 lore raw

Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run

Quoted 30 lines · Philippe Mathieu-Daudé

Add support for macOS 12 build on Cirrus-CI, similarly to commit 0e103a65ba1 ("gitlab: support for ... macOS 11 via cirrus-run").

Update the lcitool repository to get the macos12 mappings, and generate the vars file by calling 'make lcitool-refresh'.

---
Pending on libvirt-ci MR #210:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/210

---
  .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++
  .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++
  tests/lcitool/libvirt-ci          |  2 +-
  tests/lcitool/refresh             |  1 +
  4 files changed, 33 insertions(+), 1 deletion(-)

create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars

.gitlab-ci.d/cirrus.yml +4 -0
index b96b22e2697..b7662959070 100644
@@ -87,6 +87,21 @@ x64-macos-11-base-build:
      PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
      TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
 
+x64-macos-12-base-build:
+  extends: .cirrus_build_job
+  variables:
+    NAME: macos-12

.gitlab-ci.d/cirrus.yml x64-macos-11-base-build: · line 103

Quoted 10 lines
.gitlab-ci.d/cirrus.yml +10 -0
+    CIRRUS_VM_INSTANCE_TYPE: osx_instance
+    CIRRUS_VM_IMAGE_SELECTOR: image
+    CIRRUS_VM_IMAGE_NAME: monterey-base
+    CIRRUS_VM_CPUS: 12
+    CIRRUS_VM_RAM: 24G
+    UPDATE_COMMAND: brew update
+    INSTALL_COMMAND: brew install
+    PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
+    PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
+    TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64

Since we cannot run that many Cirrus-CI jobs in parallel, I think it might make sense to limit the macos-11 job to manual mode now?

Thomas

#21 lore raw

Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run

Quoted 42 lines · Thomas Huth
Quoted 41 lines · Philippe Mathieu-Daudé

Add support for macOS 12 build on Cirrus-CI, similarly to commit 0e103a65ba1 ("gitlab: support for ... macOS 11 via cirrus-run").

Update the lcitool repository to get the macos12 mappings, and generate the vars file by calling 'make lcitool-refresh'.

---
Pending on libvirt-ci MR #210:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/210
---
  .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++ .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++ tests/lcitool/libvirt-ci          |  2 +- tests/lcitool/refresh             |  1 +

  4 files changed, 33 insertions(+), 1 deletion(-)

  create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars

.gitlab-ci.d/cirrus.yml +0 -0
index b96b22e2697..b7662959070 100644
@@ -87,6 +87,21 @@ x64-macos-11-base-build:

      PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig

      TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64 +x64-macos-12-base-build:
+  extends: .cirrus_build_job
+  variables:
+    NAME: macos-12
+    CIRRUS_VM_INSTANCE_TYPE: osx_instance
+    CIRRUS_VM_IMAGE_SELECTOR: image
+    CIRRUS_VM_IMAGE_NAME: monterey-base
+    CIRRUS_VM_CPUS: 12
+    CIRRUS_VM_RAM: 24G
+    UPDATE_COMMAND: brew update
+    INSTALL_COMMAND: brew install
+    PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
+    PKG_CONFIG_PATH:
/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig

Quoted 4 lines
Quoted 2 lines

+    TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64

Since we cannot run that many Cirrus-CI jobs in parallel, I think it might make sense to limit the macos-11 job to manual mode now?

TBH I don't know, IIUC macOS seems somehow a bit tied with hardware (updated less often), and apparently our user base is still interested in having the previous Catalina version working too.

What about FreeBSD jobs? Do you also plan to set the FreeBSD 12 job to manual?

Maybe we could split the configured options, but I'm not sure we'll save much, the basics to be covered are major sysemu with ui, tools & doc.

#22 lore raw

Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run

Quoted 48 lines · Philippe Mathieu-Daudé
Quoted 42 lines · Thomas Huth
Quoted 41 lines · Philippe Mathieu-Daudé

Add support for macOS 12 build on Cirrus-CI, similarly to commit 0e103a65ba1 ("gitlab: support for ... macOS 11 via cirrus-run").

Update the lcitool repository to get the macos12 mappings, and generate the vars file by calling 'make lcitool-refresh'.

---
Pending on libvirt-ci MR #210:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/210
---
  .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++ .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++ tests/lcitool/libvirt-ci          |  2 +- tests/lcitool/refresh             |  1 +

  4 files changed, 33 insertions(+), 1 deletion(-)

  create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars

.gitlab-ci.d/cirrus.yml +0 -0
index b96b22e2697..b7662959070 100644
@@ -87,6 +87,21 @@ x64-macos-11-base-build:

      PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig

      TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64 +x64-macos-12-base-build:
+  extends: .cirrus_build_job
+  variables:
+    NAME: macos-12
+    CIRRUS_VM_INSTANCE_TYPE: osx_instance
+    CIRRUS_VM_IMAGE_SELECTOR: image
+    CIRRUS_VM_IMAGE_NAME: monterey-base
+    CIRRUS_VM_CPUS: 12
+    CIRRUS_VM_RAM: 24G
+    UPDATE_COMMAND: brew update
+    INSTALL_COMMAND: brew install
+    PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
+    PKG_CONFIG_PATH:
/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig

Quoted 4 lines
Quoted 2 lines

+    TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64

Since we cannot run that many Cirrus-CI jobs in parallel, I think it might make sense to limit the macos-11 job to manual mode now?

Quoted 5 lines

TBH I don't know, IIUC macOS seems somehow a bit tied with hardware (updated less often), and apparently our user base is still interested in having the previous Catalina version working too.

What about FreeBSD jobs? Do you also plan to set the FreeBSD 12 job to manual?

No good clue... Maybe we could also simply bump the timeout setting in .gitlab-ci.d/cirrus.yml to the maximum value (120 min, I think?) and hope that all the Cirrus-CI jobs finish within that amount of time?

Thomas

#23 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

Few patches to be able to build QEMU on macOS 12 (Monterey).

This basically consists of adapting deprecated APIs. I am not sure about these APIs, so tagging as RFC.

I couldn't succeed to adapt the Cocoa code.

CI job added to avoid bitrotting.

Quoted 8 lines

Since v2:
- Addressed Akihiko Odaki comments:
. use __is_identifier(),
. remove cocoa setAllowedFileTypes()
- Addressed Daniel Berrangé comment:
. rebased on testing/next, update libvirt-ci/lcitool

Based on Alex's testing/next

Hi Philippe,

Could you please share URI to the remote?
I want to apply the series on it.

Thanks,
Roman

Quoted 30 lines

Based-on: <[email protected]>

Philippe Mathieu-Daudé (7):
configure: Allow passing extra Objective C compiler flags ui/cocoa: Remove allowedFileTypes restriction in SavePanel
hvf: Make hvf_get_segments() / hvf_put_segments() local
hvf: Remove deprecated hv_vcpu_flush() calls audio/coreaudio: Remove a deprecation warning on macOS 12 block/file-posix: Remove a deprecation warning on macOS 12
gitlab-ci: Support macOS 12 via cirrus-run

 configure                         |  8 ++++++++
 meson.build                       |  5 +++++
 target/i386/hvf/vmx.h             |  2 --
 target/i386/hvf/x86hvf.h          |  2 --
 audio/coreaudio.c                 | 16 ++++++++++------
 block/file-posix.c                | 13 +++++++++----
 target/i386/hvf/x86_task.c        |  1 -
 target/i386/hvf/x86hvf.c          |  6 ++----
 .gitlab-ci.d/cirrus.yml           | 15 +++++++++++++++
 .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++
 tests/lcitool/libvirt-ci          |  2 +-
 tests/lcitool/refresh             |  1 +
 ui/cocoa.m                        |  6 ------
 13 files changed, 67 insertions(+), 26 deletions(-)
 create mode 100644 .gitlab-ci.d/cirrus/macos-12.vars
Signature · 1 line
2.33.1