All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v3 0/7] host: Support macOS 12
@ 2022-01-10 13:09 Philippe Mathieu-Daudé
  2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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: <20220110124638.610145-1-f4bug@amsat.org>

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

-- 
2.33.1



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
@ 2022-01-10 13:09 ` Philippe Mathieu-Daudé
  2022-01-11 17:16   ` Roman Bolshakov
  2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 configure   | 8 ++++++++
 meson.build | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/configure b/configure
index 0c57a063c66..adb42d8beb1 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/meson.build b/meson.build
index 0e52f54b100..a21305d62c1 100644
--- a/meson.build
+++ b/meson.build
@@ -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)}
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
  2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
@ 2022-01-10 13:09 ` Philippe Mathieu-Daudé
  2022-01-10 19:43   ` Roman Bolshakov
  2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/

Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 ui/cocoa.m | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 69745c483b4..dec22968815 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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) {
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
  2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
  2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
@ 2022-01-10 13:09 ` Philippe Mathieu-Daudé
  2022-01-11 16:09   ` Roman Bolshakov
  2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/i386/hvf/x86hvf.h | 2 --
 target/i386/hvf/x86hvf.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/i386/hvf/x86hvf.h b/target/i386/hvf/x86hvf.h
index 99ed8d608dd..db6003d6bda 100644
--- a/target/i386/hvf/x86hvf.h
+++ b/target/i386/hvf/x86hvf.h
@@ -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
diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
index 05ec1bddc4e..907f09f1b43 100644
--- a/target/i386/hvf/x86hvf.c
+++ b/target/i386/hvf/x86hvf.c
@@ -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;
 
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
@ 2022-01-10 13:09 ` Philippe Mathieu-Daudé
  2022-01-11 17:51   ` Roman Bolshakov
  2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/i386/hvf/vmx.h      | 2 --
 target/i386/hvf/x86_task.c | 1 -
 target/i386/hvf/x86hvf.c   | 2 --
 3 files changed, 5 deletions(-)

diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h
index 6df87116f62..094fb9b9dc9 100644
--- a/target/i386/hvf/vmx.h
+++ b/target/i386/hvf/vmx.h
@@ -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)
diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c
index 422156128b7..c8dc3d48fa8 100644
--- a/target/i386/hvf/x86_task.c
+++ b/target/i386/hvf/x86_task.c
@@ -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);
 }
diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
index 907f09f1b43..bec9fc58146 100644
--- a/target/i386/hvf/x86hvf.c
+++ b/target/i386/hvf/x86hvf.c
@@ -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)
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
@ 2022-01-10 13:09 ` Philippe Mathieu-Daudé
  2022-01-10 13:20   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  7 siblings, 3 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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(-)

diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index d8a21d3e507..73cbfd479ac 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -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,
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 6/7] block/file-posix: Remove a deprecation warning on macOS 12
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
@ 2022-01-10 13:10 ` Philippe Mathieu-Daudé
  2022-01-10 18:28   ` Akihiko Odaki
  2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
  2022-01-10 18:06 ` [RFC PATCH v3 0/7] host: Support macOS 12 Roman Bolshakov
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Checkpatch:

 WARNING: architecture specific defines should be avoided

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 block/file-posix.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index b283093e5b7..1d0512026c5 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -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",
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
@ 2022-01-10 13:10 ` Philippe Mathieu-Daudé
  2022-01-13  7:39   ` Thomas Huth
  2022-01-10 18:06 ` [RFC PATCH v3 0/7] host: Support macOS 12 Roman Bolshakov
  7 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Philippe Mathieu-Daudé,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Alex Bennée, Wainer dos Santos Moschetta

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

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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

diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
index b96b22e2697..b7662959070 100644
--- a/.gitlab-ci.d/cirrus.yml
+++ b/.gitlab-ci.d/cirrus.yml
@@ -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:
diff --git a/.gitlab-ci.d/cirrus/macos-12.vars b/.gitlab-ci.d/cirrus/macos-12.vars
new file mode 100644
index 00000000000..997dbc762c8
--- /dev/null
+++ b/.gitlab-ci.d/cirrus/macos-12.vars
@@ -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'
diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
index 8f48e54238d..e91e83fed20 160000
--- a/tests/lcitool/libvirt-ci
+++ b/tests/lcitool/libvirt-ci
@@ -1 +1 @@
-Subproject commit 8f48e54238d28d7a427a541d6dbe56432e3c4660
+Subproject commit e91e83fed2086163013242e8a33c74fbfba7f729
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 033120e223d..6ac8b888927 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -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:
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
  2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
@ 2022-01-10 13:20   ` Philippe Mathieu-Daudé
  2022-01-10 13:43     ` Christian Schoenebeck
  2022-01-11 18:36   ` Roman Bolshakov
  2022-01-12  6:57   ` Roman Bolshakov
  2 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-10 13:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Cameron Esfahani, Roman Bolshakov,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On 1/10/22 14:09, Philippe Mathieu-Daudé wrote:
> 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).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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

> ---
>  audio/coreaudio.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> index d8a21d3e507..73cbfd479ac 100644
> --- a/audio/coreaudio.c
> +++ b/audio/coreaudio.c
> @@ -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
>  };


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
  2022-01-10 13:20   ` Philippe Mathieu-Daudé
@ 2022-01-10 13:43     ` Christian Schoenebeck
  0 siblings, 0 replies; 24+ messages in thread
From: Christian Schoenebeck @ 2022-01-10 13:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Alex Bennée, Alexander Graf, Cameron Esfahani,
	Roman Bolshakov, Gerd Hoffmann, Daniel P . Berrangé,
	Wainer dos Santos Moschetta, Peter Maydell, Akihiko Odaki,
	Thomas Huth

On Montag, 10. Januar 2022 14:20:56 CET Philippe Mathieu-Daudé wrote:
> On 1/10/22 14:09, Philippe Mathieu-Daudé wrote:
> > 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).
> > 
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
> > 
> > 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

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.

> 
> > ---
> > 
> >  audio/coreaudio.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> > index d8a21d3e507..73cbfd479ac 100644
> > --- a/audio/coreaudio.c
> > +++ b/audio/coreaudio.c
> > @@ -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
> > 
> >  };




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 0/7] host: Support macOS 12
  2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
@ 2022-01-10 18:06 ` Roman Bolshakov
  7 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-10 18:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:54PM +0100, Philippe Mathieu-Daudé wrote:
> 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

Hi Philippe,

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

Thanks,
Roman

> Based-on: <20220110124638.610145-1-f4bug@amsat.org>
> 
> 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
> 
> -- 
> 2.33.1
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 6/7] block/file-posix: Remove a deprecation warning on macOS 12
  2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
@ 2022-01-10 18:28   ` Akihiko Odaki
  0 siblings, 0 replies; 24+ messages in thread
From: Akihiko Odaki @ 2022-01-10 18:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, Cameron Esfahani, Roman Bolshakov,
	Alexander Graf, Gerd Hoffmann, Alex Bennée,
	Wainer dos Santos Moschetta

On 2022/01/10 22:10, Philippe Mathieu-Daudé wrote:
> 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).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Checkpatch:
> 
>   WARNING: architecture specific defines should be avoided
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   block/file-posix.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/block/file-posix.c b/block/file-posix.c
> index b283093e5b7..1d0512026c5 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -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",

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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel
  2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
@ 2022-01-10 19:43   ` Roman Bolshakov
  0 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-10 19:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:56PM +0100, Philippe Mathieu-Daudé wrote:
> 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:
> 

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

Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>

Regards,
-Roman

>   [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/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/
> 
> Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  ui/cocoa.m | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 69745c483b4..dec22968815 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -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) {
> -- 
> 2.33.1
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local
  2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
@ 2022-01-11 16:09   ` Roman Bolshakov
  0 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-11 16:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Alex Bennée, Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:57PM +0100, Philippe Mathieu-Daudé wrote:
> Both hvf_get_segments/hvf_put_segments() functions are only
> used within x86hvf.c: do not declare them as public API.
> 

Reviewed-by: Roman Bolshakov <roman@roolebo.dev>
Tested-by: Roman Bolshakov <roman@roolebo.dev>

Thanks,
Roman

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/i386/hvf/x86hvf.h | 2 --
>  target/i386/hvf/x86hvf.c | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/target/i386/hvf/x86hvf.h b/target/i386/hvf/x86hvf.h
> index 99ed8d608dd..db6003d6bda 100644
> --- a/target/i386/hvf/x86hvf.h
> +++ b/target/i386/hvf/x86hvf.h
> @@ -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
> diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
> index 05ec1bddc4e..907f09f1b43 100644
> --- a/target/i386/hvf/x86hvf.c
> +++ b/target/i386/hvf/x86hvf.c
> @@ -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;
>  
> -- 
> 2.33.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
  2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
@ 2022-01-11 17:16   ` Roman Bolshakov
  2022-01-12 13:46     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-11 17:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Alex Bennée, Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:55PM +0100, Philippe Mathieu-Daudé wrote:
> 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.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  configure   | 8 ++++++++
>  meson.build | 5 +++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/configure b/configure
> index 0c57a063c66..adb42d8beb1 100755
> --- a/configure
> +++ b/configure
> @@ -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
> diff --git a/meson.build b/meson.build
> index 0e52f54b100..a21305d62c1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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

> +endif
>  link_args = get_option(link_language + '_link_args')
>  if link_args.length() > 0
>    summary_info += {'LDFLAGS':         ' '.join(link_args)}
> -- 
> 2.33.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls
  2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
@ 2022-01-11 17:51   ` Roman Bolshakov
  0 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-11 17:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Alex Bennée, Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:58PM +0100, Philippe Mathieu-Daudé wrote:
> 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).

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

Reviewed-by: Roman Bolshakov <roman@roolebo.dev>
Tested-by: Roman Bolshakov <roman@roolebo.dev>

Thanks,
Roman

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/i386/hvf/vmx.h      | 2 --
>  target/i386/hvf/x86_task.c | 1 -
>  target/i386/hvf/x86hvf.c   | 2 --
>  3 files changed, 5 deletions(-)
> 
> diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h
> index 6df87116f62..094fb9b9dc9 100644
> --- a/target/i386/hvf/vmx.h
> +++ b/target/i386/hvf/vmx.h
> @@ -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)
> diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c
> index 422156128b7..c8dc3d48fa8 100644
> --- a/target/i386/hvf/x86_task.c
> +++ b/target/i386/hvf/x86_task.c
> @@ -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);
>  }
> diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
> index 907f09f1b43..bec9fc58146 100644
> --- a/target/i386/hvf/x86hvf.c
> +++ b/target/i386/hvf/x86hvf.c
> @@ -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)
> -- 
> 2.33.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
  2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
  2022-01-10 13:20   ` Philippe Mathieu-Daudé
@ 2022-01-11 18:36   ` Roman Bolshakov
  2022-01-12  6:57   ` Roman Bolshakov
  2 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-11 18:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Alex Bennée, Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:59PM +0100, Philippe Mathieu-Daudé wrote:
> 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).
> 

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.

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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

> ---
>  audio/coreaudio.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> index d8a21d3e507..73cbfd479ac 100644
> --- a/audio/coreaudio.c
> +++ b/audio/coreaudio.c
> @@ -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,
> -- 
> 2.33.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12
  2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
  2022-01-10 13:20   ` Philippe Mathieu-Daudé
  2022-01-11 18:36   ` Roman Bolshakov
@ 2022-01-12  6:57   ` Roman Bolshakov
  2 siblings, 0 replies; 24+ messages in thread
From: Roman Bolshakov @ 2022-01-12  6:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Alex Bennée, Wainer dos Santos Moschetta

On Mon, Jan 10, 2022 at 02:09:59PM +0100, Philippe Mathieu-Daudé wrote:
> 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).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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(-)
> 
> diff --git a/audio/coreaudio.c b/audio/coreaudio.c
> index d8a21d3e507..73cbfd479ac 100644
> --- a/audio/coreaudio.c
> +++ b/audio/coreaudio.c
> @@ -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:

diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 73cbfd479a..7367a2ffd4 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -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:

diff --git a/block/file-posix.c b/block/file-posix.c
index 1d0512026c..c0038629a1 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -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

> +
>  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,
> -- 
> 2.33.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
  2022-01-11 17:16   ` Roman Bolshakov
@ 2022-01-12 13:46     ` Philippe Mathieu-Daudé
  2022-01-12 14:09       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-12 13:46 UTC (permalink / raw)
  To: Roman Bolshakov
  Cc: Peter Maydell, Thomas Huth, Daniel P. Berrangé,
	Christian Schoenebeck, qemu-devel, Cameron Esfahani,
	Roman Bolshakov, Alexander Graf, Gerd Hoffmann, Akihiko Odaki,
	Paolo Bonzini, Alex Bennée, Wainer dos Santos Moschetta

+Paolo who I forgot to Cc.

On 1/11/22 18:16, Roman Bolshakov wrote:
> On Mon, Jan 10, 2022 at 02:09:55PM +0100, Philippe Mathieu-Daudé wrote:
>> 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.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  configure   | 8 ++++++++
>>  meson.build | 5 +++++
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 0c57a063c66..adb42d8beb1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -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
>> diff --git a/meson.build b/meson.build
>> index 0e52f54b100..a21305d62c1 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -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')


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
  2022-01-12 13:46     ` Philippe Mathieu-Daudé
@ 2022-01-12 14:09       ` Philippe Mathieu-Daudé
  2022-01-12 14:47         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-12 14:09 UTC (permalink / raw)
  To: Roman Bolshakov
  Cc: Peter Maydell, Thomas Huth, Daniel P. Berrangé,
	Emilio G. Cota, Christian Schoenebeck, qemu-devel,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Paolo Bonzini, Alex Bennée,
	Wainer dos Santos Moschetta

+Emilio

On 1/12/22 14:46, Philippe Mathieu-Daudé wrote:
> 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.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
  2022-01-12 14:09       ` Philippe Mathieu-Daudé
@ 2022-01-12 14:47         ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-12 14:47 UTC (permalink / raw)
  To: Roman Bolshakov
  Cc: Peter Maydell, Thomas Huth, Daniel P. Berrangé,
	Emilio G. Cota, Christian Schoenebeck, qemu-devel,
	Cameron Esfahani, Roman Bolshakov, Alexander Graf, Gerd Hoffmann,
	Akihiko Odaki, Paolo Bonzini, Alex Bennée,
	Wainer dos Santos Moschetta

On 1/12/22 15:09, Philippe Mathieu-Daudé wrote:
> +Emilio
> 
> On 1/12/22 14:46, Philippe Mathieu-Daudé wrote:
>> 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.

This seems to do the job:

-- >8 --
diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index 59776a00a79..b790487648a 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -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',
---


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run
  2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
@ 2022-01-13  7:39   ` Thomas Huth
  2022-01-13 11:41     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Huth @ 2022-01-13  7:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	Christian Schoenebeck, Cameron Esfahani, Roman Bolshakov,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On 10/01/2022 14.10, Philippe Mathieu-Daudé wrote:
> 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'.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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
> 
> diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
> index b96b22e2697..b7662959070 100644
> --- a/.gitlab-ci.d/cirrus.yml
> +++ b/.gitlab-ci.d/cirrus.yml
> @@ -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

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




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run
  2022-01-13  7:39   ` Thomas Huth
@ 2022-01-13 11:41     ` Philippe Mathieu-Daudé
  2022-01-18  9:34       ` Thomas Huth
  0 siblings, 1 reply; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-13 11:41 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	Christian Schoenebeck, Cameron Esfahani, Roman Bolshakov,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On 13/1/22 08:39, Thomas Huth wrote:
> On 10/01/2022 14.10, Philippe Mathieu-Daudé wrote:
>> 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'.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> 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
>>
>> diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
>> index b96b22e2697..b7662959070 100644
>> --- a/.gitlab-ci.d/cirrus.yml
>> +++ b/.gitlab-ci.d/cirrus.yml
>> @@ -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
> 
> 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.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run
  2022-01-13 11:41     ` Philippe Mathieu-Daudé
@ 2022-01-18  9:34       ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2022-01-18  9:34 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	Christian Schoenebeck, Cameron Esfahani, Roman Bolshakov,
	Alexander Graf, Gerd Hoffmann, Akihiko Odaki, Alex Bennée,
	Wainer dos Santos Moschetta

On 13/01/2022 12.41, Philippe Mathieu-Daudé wrote:
> On 13/1/22 08:39, Thomas Huth wrote:
>> On 10/01/2022 14.10, Philippe Mathieu-Daudé wrote:
>>> 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'.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> 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
>>>
>>> diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
>>> index b96b22e2697..b7662959070 100644
>>> --- a/.gitlab-ci.d/cirrus.yml
>>> +++ b/.gitlab-ci.d/cirrus.yml
>>> @@ -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
>>
>> 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?

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



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-01-18  9:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
2022-01-11 17:16   ` Roman Bolshakov
2022-01-12 13:46     ` Philippe Mathieu-Daudé
2022-01-12 14:09       ` Philippe Mathieu-Daudé
2022-01-12 14:47         ` Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
2022-01-10 19:43   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
2022-01-11 16:09   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
2022-01-11 17:51   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:20   ` Philippe Mathieu-Daudé
2022-01-10 13:43     ` Christian Schoenebeck
2022-01-11 18:36   ` Roman Bolshakov
2022-01-12  6:57   ` Roman Bolshakov
2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
2022-01-10 18:28   ` Akihiko Odaki
2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
2022-01-13  7:39   ` Thomas Huth
2022-01-13 11:41     ` Philippe Mathieu-Daudé
2022-01-18  9:34       ` Thomas Huth
2022-01-10 18:06 ` [RFC PATCH v3 0/7] host: Support macOS 12 Roman Bolshakov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.