From patchwork Sun Mar 6 23:17:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9ECFC433F5 for ; Sun, 6 Mar 2022 23:19:46 +0000 (UTC) Received: from localhost ([::1]:36924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0AD-0000fO-Jx for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:19:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR08b-0006HZ-E9; Sun, 06 Mar 2022 18:18:06 -0500 Received: from [2a00:1450:4864:20::432] (port=33663 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08Z-0007Kc-6C; Sun, 06 Mar 2022 18:18:04 -0500 Received: by mail-wr1-x432.google.com with SMTP id j17so20736152wrc.0; Sun, 06 Mar 2022 15:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N7G7pua0ux3SixtBsNiCF9TVOy1kTa/nTaWJb2Ht7yQ=; b=gaR6VjiqS03w7lLwDlOzgusIOhdj3dOO1C3Mt25FtNsvlBpH2uXyoRAqqWYj8LWhdp 9iDKChA89MNsxLLG5yDbrOy0jj3dHmQqKmqVy+HH3sGtpj+RYBBIR4aaM6dhwvJHwt1I zBFXKZNJTTKpzx5GeOcLtUOXkrzxZx44lSl7Jt3yQVWgHPlXMPrFjjkrrnXHH2Tu7unV DuLMXiv1zsd9ckQEoozZluAe3tiQXJtxKszYNCxFXuShJ0rYSnfzCMPTy0DHwYp16BR/ dcfwQAyLkke+Rr5tkgHuAubaKAPt1RGc3ucB4jpUkUHwTd2ZeyYz6EbJFit4RZijILbQ BR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N7G7pua0ux3SixtBsNiCF9TVOy1kTa/nTaWJb2Ht7yQ=; b=hw2bYKo0lUy6PHxwuctvwYJTvd4gUhLX+cIVkllCFB3dUTUQN1YHIu/8mH7eFw0lU9 not8Q+Nzs4jkz2Bwku8+KLlZLgp6jwzRea2S4fsbsRfaXjO4MFEE3UuW1fzadb1r1ypK R0nnvpRkh+FJVTaqTBGCzV5zw/R+0htYrskRiooXd1b8tO4sbio9Y9tQaMctO/oIIzw0 b7QD53UUsxAPi44xbypBaZqd5ZOwiZiPQ0IB5Zhr/SsN5Ly3FM8yi3IBUGA7TVktwE3H /tcCPSUj9Qc6UPZ3aY23Owl+OsoAK/JlV+AAGHwkRvTPKw28hMQdKWEWHWReVGVB89AC SG6A== X-Gm-Message-State: AOAM531+Z7IeBzYxOEBr3B5ARG0g5SFlwBZ/D9Z9WDE0rXvkkifekgx2 QORCN6Qedfz+5FnB/fdacLdaYY2apU0= X-Google-Smtp-Source: ABdhPJwq6E43+mTvSblhaBd0SWBSmi9/KrNHMTsOI4V00TJyu6mMxgGIG8+evASsugSghn1qGAFHlg== X-Received: by 2002:a5d:4e08:0:b0:1f1:e606:a81a with SMTP id p8-20020a5d4e08000000b001f1e606a81amr4388681wrt.393.1646608681226; Sun, 06 Mar 2022 15:18:01 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id l13-20020a05600002ad00b001ea78a5df11sm11404363wry.1.2022.03.06.15.17.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 01/22] configure: Allow passing extra Objective C compiler flags Date: Mon, 7 Mar 2022 00:17:32 +0100 Message-Id: <20220306231753.50277-2-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: 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. Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé --- configure | 8 ++++++++ meson.build | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/configure b/configure index 81618708e4..e60156f90f 100755 --- a/configure +++ b/configure @@ -285,6 +285,7 @@ done EXTRA_CFLAGS="" EXTRA_CXXFLAGS="" +EXTRA_OBJCFLAGS="" EXTRA_LDFLAGS="" xen_ctrl_version="$default_feature" @@ -366,9 +367,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" @@ -748,6 +752,8 @@ for opt do ;; --extra-cxxflags=*) ;; + --extra-objcflags=*) + ;; --extra-ldflags=*) ;; --enable-debug-info) @@ -1172,6 +1178,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-cflags-ARCH= use compiler flags when building ARCH guest tests @@ -3137,6 +3144,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 038502714a..b6e30d7463 100644 --- a/meson.build +++ b/meson.build @@ -3457,6 +3457,11 @@ if link_language == 'cpp' + ['-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)} From patchwork Sun Mar 6 23:17:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 911CCC433F5 for ; Sun, 6 Mar 2022 23:20:01 +0000 (UTC) Received: from localhost ([::1]:37462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0AS-00011z-6v for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:20:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR08f-0006KB-TV; Sun, 06 Mar 2022 18:18:10 -0500 Received: from [2a00:1450:4864:20::42e] (port=37389 helo=mail-wr1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08e-0007L0-IC; Sun, 06 Mar 2022 18:18:09 -0500 Received: by mail-wr1-x42e.google.com with SMTP id q14so5105462wrc.4; Sun, 06 Mar 2022 15:18:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/n/kp/EEzr/qAon/GdLY35mCaB/pGz6v6JFGGwXRBP4=; b=C0W5U2YuG2OrjxgScBW+VzEe5rWVw64MPCGaghWgtDj9WYrTGc3Yj2I8bn3UCqnSNX 51XY+iX9vnDINj5/P2ytv5kagB5zOnycr93nb7vQCwRbFuGhTJkZopA8faTwjPc5Q6S8 YONFiMHghToFziP09ynrWTaZsA2trb98FJT/7qUZPECA1bf8XXay/5gCztjsk4+GGEOd axa/KUYXnnUnQo1p1KAHvIThxzNNLfwP+gvoVip5Vc+CCkMsYzgLixxQFnqR1hJEwAo5 v/2UB8gsnyPa/fO3MOCiDpc9u7Id2UZCxC0/mocbTYrlMT1CMr95DxSS2Q5+AomTeoil uK+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/n/kp/EEzr/qAon/GdLY35mCaB/pGz6v6JFGGwXRBP4=; b=i4XDg6abZkV+C4BewbagKL9kk/+PReizbuhtAnPiFlVNS78kOH1LgMZ4LfVY6quKt+ ol4UjK2rzvkLvgHwj82oMBSKt+KgEx+/0YG/4fy0OLyrxb/+fyetiiE4Bdqc20yZpiMG OI8dTteRm7dwHzieyBa8uQAVzmdLrxwOvR1UafqrC0HfnpPdqoP5c4n0mhLnOJtc0sph Hv9eC/uTcSUnGQCZpvVIBYzBdqyr2/esju7F5loGkBB8fSwNbxLpklyKMwEgAwXIVJdK le0eZh14q0uTxzreywxKhTRSfdFm09KJJP6yVyriDd8PwvIfjPrx0ykr8PhHjl+W52C3 CbRw== X-Gm-Message-State: AOAM530sxLEXRUC9nY2eSfyFLE+N9DOJwweWIPKpU3PuzfDbtw9jQaeo umL5M+u4E5mFY4y4A/4fndN07UV0qJY= X-Google-Smtp-Source: ABdhPJyu+FvKzRahj2WTzb8KJbelZAGrL7HvBmRld+qKI9uJ9FpOQZryp2AQLbZEHncgA3/bpmdZtQ== X-Received: by 2002:adf:db82:0:b0:1ed:bf4b:e327 with SMTP id u2-20020adfdb82000000b001edbf4be327mr6220407wri.527.1646608686406; Sun, 06 Mar 2022 15:18:06 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u23-20020a7bcb17000000b0037bdfa1665asm27125392wmj.18.2022.03.06.15.18.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 02/22] tests/fp/berkeley-testfloat-3: Ignore ignored #pragma directives Date: Mon, 7 Mar 2022 00:17:33 +0100 Message-Id: <20220306231753.50277-3-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42e (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , Roman Bolshakov , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Since we already use -Wno-unknown-pragmas, we can also use -Wno-ignored-pragmas. This silences hundred of warnings using clang 13 on macOS 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. Having: $ cc -v Apple clang version 13.0.0 (clang-1300.0.29.30) Reported-by: Roman Bolshakov Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé Acked-by: Alex Bennée --- tests/fp/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/fp/meson.build b/tests/fp/meson.build index 59776a00a7..8bd0979f67 100644 --- a/tests/fp/meson.build +++ b/tests/fp/meson.build @@ -37,6 +37,11 @@ tfcflags = [ '-Wno-error', ] +if cc.get_id() == 'clang' + # Clang does not support '#pragma STDC FENV_ACCESS' + tfcflags += [ '-Wno-ignored-pragmas' ] +endif + tfgencases = [ tfdir / 'genCases_ui32.c', tfdir / 'genCases_ui64.c', From patchwork Sun Mar 6 23:17:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770956 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8741C433EF for ; Sun, 6 Mar 2022 23:20:02 +0000 (UTC) Received: from localhost ([::1]:37708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0AT-0001Dk-Nn for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:20:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR08l-0006Rk-CH; Sun, 06 Mar 2022 18:18:17 -0500 Received: from [2a00:1450:4864:20::32e] (port=35585 helo=mail-wm1-x32e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08j-0007LR-Ha; Sun, 06 Mar 2022 18:18:15 -0500 Received: by mail-wm1-x32e.google.com with SMTP id v2-20020a7bcb42000000b0037b9d960079so10364545wmj.0; Sun, 06 Mar 2022 15:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3zqaK9s5/raZ8zuTcIzPJOQG8kwceFqw1+s0bbIn7Ok=; b=kLawS8i2hOYYn7WCff9HPTg3O35OWNOVTehwY5aBMGfpy6Nq3zILQBKNAM1SFLPQRh zyG6Cgo7K+ajOjnOscLYq527t2b1OKQxsSMvDKbSTlvMeygg79Y9YdOUczHVwYT5534U tVyMoK3kTeqssMyGByukvkdFij9XfafzTjz6E+l5mr4xAGUzEwGYVPi5/O94QyLnKeqH 3RCnIcqXIYUeuSkmZkRrUkzJEUvrUaHmDgUXxRoWd5BPSl6zL3dMHbLLsQLK8bK2Vgpq 5D/5u3bzilB6YWb0CBqN0gK+YxqfL5aI/URIIW+65Q7BaXBprmDxvO09CqOcP9Nabas6 q71w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3zqaK9s5/raZ8zuTcIzPJOQG8kwceFqw1+s0bbIn7Ok=; b=WkUAf55cpyQRCbOeLE0bmN78n+D86ELECsxtQrtjHkTHtN0VS9NVhjOnuY8Swm45++ UVJdmSLcTwRSS03rYAF2NANLgKaZ4wF4KUd6Xb5qIbnfQy6gmjL4pNOT228OPoLnYDmI oAM9w+FMIGyfcLDVq2IN3/Ks3/415x3bcCJ5NMZr153x4l6ZFrgvaesozBOXoOJOA5oQ CMYSWnFO+bfEvZFA/goJvLowEyvku0G2l3gIViC8wLE5f2eiYRu4WviXZvfMoeZXCHsH K+1JVdFl5tu3rNWnZP22W7U0EdeQhvr6kJ7NOZKDrJA2nHMgWAOMvUN63BdbKJ6qlO4O Y9Bg== X-Gm-Message-State: AOAM533vRQa9VRUZt2D6CRVN9G9Z56QMY8yCCl6fmy5iMRZpO6VS+/Tq NC8vdvP8W3s43eS9lNOcKrFifLuPtS4= X-Google-Smtp-Source: ABdhPJwbvDxosQXkRkGKH+g4x6LwCQay0bzIKoVgvuvN5vy5xmHXrDejm+B7q++b3sV/pVRk+URe+Q== X-Received: by 2002:a1c:3b55:0:b0:389:89bc:4207 with SMTP id i82-20020a1c3b55000000b0038989bc4207mr8582099wma.132.1646608691678; Sun, 06 Mar 2022 15:18:11 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u23-20020a7bcb17000000b0037bdfa1665asm27125748wmj.18.2022.03.06.15.18.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 03/22] hvf: Use standard CR0 and CR4 register definitions Date: Mon, 7 Mar 2022 00:17:34 +0100 Message-Id: <20220306231753.50277-4-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32e (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Cameron Esfahani No need to have our own definitions of these registers. Signed-off-by: Cameron Esfahani Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hvf/vmx.h | 17 +++++++++-------- target/i386/hvf/x86.c | 6 +++--- target/i386/hvf/x86.h | 34 ---------------------------------- target/i386/hvf/x86_mmu.c | 2 +- target/i386/hvf/x86_task.c | 3 ++- 5 files changed, 15 insertions(+), 47 deletions(-) diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h index 6df87116f6..29b7deed3c 100644 --- a/target/i386/hvf/vmx.h +++ b/target/i386/hvf/vmx.h @@ -124,10 +124,11 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0) uint64_t efer = rvmcs(vcpu, VMCS_GUEST_IA32_EFER); uint64_t old_cr0 = rvmcs(vcpu, VMCS_GUEST_CR0); uint64_t changed_cr0 = old_cr0 ^ cr0; - uint64_t mask = CR0_PG | CR0_CD | CR0_NW | CR0_NE | CR0_ET; + uint64_t mask = CR0_PG_MASK | CR0_CD_MASK | CR0_NW_MASK | + CR0_NE_MASK | CR0_ET_MASK; uint64_t entry_ctls; - if ((cr0 & CR0_PG) && (rvmcs(vcpu, VMCS_GUEST_CR4) & CR4_PAE) && + if ((cr0 & CR0_PG_MASK) && (rvmcs(vcpu, VMCS_GUEST_CR4) & CR4_PAE_MASK) && !(efer & MSR_EFER_LME)) { address_space_read(&address_space_memory, rvmcs(vcpu, VMCS_GUEST_CR3) & ~0x1f, @@ -142,8 +143,8 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0) wvmcs(vcpu, VMCS_CR0_SHADOW, cr0); if (efer & MSR_EFER_LME) { - if (changed_cr0 & CR0_PG) { - if (cr0 & CR0_PG) { + if (changed_cr0 & CR0_PG_MASK) { + if (cr0 & CR0_PG_MASK) { enter_long_mode(vcpu, cr0, efer); } else { exit_long_mode(vcpu, cr0, efer); @@ -155,8 +156,8 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0) } /* Filter new CR0 after we are finished examining it above. */ - cr0 = (cr0 & ~(mask & ~CR0_PG)); - wvmcs(vcpu, VMCS_GUEST_CR0, cr0 | CR0_NE | CR0_ET); + cr0 = (cr0 & ~(mask & ~CR0_PG_MASK)); + wvmcs(vcpu, VMCS_GUEST_CR0, cr0 | CR0_NE_MASK | CR0_ET_MASK); hv_vcpu_invalidate_tlb(vcpu); hv_vcpu_flush(vcpu); @@ -164,11 +165,11 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0) static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4) { - uint64_t guest_cr4 = cr4 | CR4_VMXE; + uint64_t guest_cr4 = cr4 | CR4_VMXE_MASK; wvmcs(vcpu, VMCS_GUEST_CR4, guest_cr4); wvmcs(vcpu, VMCS_CR4_SHADOW, cr4); - wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE); + wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE_MASK); hv_vcpu_invalidate_tlb(vcpu); hv_vcpu_flush(vcpu); diff --git a/target/i386/hvf/x86.c b/target/i386/hvf/x86.c index 2898bb70a8..91a3fe002c 100644 --- a/target/i386/hvf/x86.c +++ b/target/i386/hvf/x86.c @@ -119,7 +119,7 @@ bool x86_read_call_gate(struct CPUState *cpu, struct x86_call_gate *idt_desc, bool x86_is_protected(struct CPUState *cpu) { uint64_t cr0 = rvmcs(cpu->hvf->fd, VMCS_GUEST_CR0); - return cr0 & CR0_PE; + return cr0 & CR0_PE_MASK; } bool x86_is_real(struct CPUState *cpu) @@ -150,13 +150,13 @@ bool x86_is_long64_mode(struct CPUState *cpu) bool x86_is_paging_mode(struct CPUState *cpu) { uint64_t cr0 = rvmcs(cpu->hvf->fd, VMCS_GUEST_CR0); - return cr0 & CR0_PG; + return cr0 & CR0_PG_MASK; } bool x86_is_pae_enabled(struct CPUState *cpu) { uint64_t cr4 = rvmcs(cpu->hvf->fd, VMCS_GUEST_CR4); - return cr4 & CR4_PAE; + return cr4 & CR4_PAE_MASK; } target_ulong linear_addr(struct CPUState *cpu, target_ulong addr, X86Seg seg) diff --git a/target/i386/hvf/x86.h b/target/i386/hvf/x86.h index 782664c2ea..947b98da41 100644 --- a/target/i386/hvf/x86.h +++ b/target/i386/hvf/x86.h @@ -42,40 +42,6 @@ typedef struct x86_register { }; } __attribute__ ((__packed__)) x86_register; -typedef enum x86_reg_cr0 { - CR0_PE = (1L << 0), - CR0_MP = (1L << 1), - CR0_EM = (1L << 2), - CR0_TS = (1L << 3), - CR0_ET = (1L << 4), - CR0_NE = (1L << 5), - CR0_WP = (1L << 16), - CR0_AM = (1L << 18), - CR0_NW = (1L << 29), - CR0_CD = (1L << 30), - CR0_PG = (1L << 31), -} x86_reg_cr0; - -typedef enum x86_reg_cr4 { - CR4_VME = (1L << 0), - CR4_PVI = (1L << 1), - CR4_TSD = (1L << 2), - CR4_DE = (1L << 3), - CR4_PSE = (1L << 4), - CR4_PAE = (1L << 5), - CR4_MSE = (1L << 6), - CR4_PGE = (1L << 7), - CR4_PCE = (1L << 8), - CR4_OSFXSR = (1L << 9), - CR4_OSXMMEXCPT = (1L << 10), - CR4_VMXE = (1L << 13), - CR4_SMXE = (1L << 14), - CR4_FSGSBASE = (1L << 16), - CR4_PCIDE = (1L << 17), - CR4_OSXSAVE = (1L << 18), - CR4_SMEP = (1L << 20), -} x86_reg_cr4; - /* 16 bit Task State Segment */ typedef struct x86_tss_segment16 { uint16_t link; diff --git a/target/i386/hvf/x86_mmu.c b/target/i386/hvf/x86_mmu.c index e9ed0f5aa1..df0b91cd42 100644 --- a/target/i386/hvf/x86_mmu.c +++ b/target/i386/hvf/x86_mmu.c @@ -129,7 +129,7 @@ static bool test_pt_entry(struct CPUState *cpu, struct gpt_translation *pt, uint32_t cr0 = rvmcs(cpu->hvf->fd, VMCS_GUEST_CR0); /* check protection */ - if (cr0 & CR0_WP) { + if (cr0 & CR0_WP_MASK) { if (pt->write_access && !pte_write_access(pte)) { return false; } diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c index 422156128b..e1301599e9 100644 --- a/target/i386/hvf/x86_task.c +++ b/target/i386/hvf/x86_task.c @@ -174,7 +174,8 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea //ret = task_switch_16(cpu, tss_sel, old_tss_sel, old_tss_base, &next_tss_desc); VM_PANIC("task_switch_16"); - macvm_set_cr0(cpu->hvf->fd, rvmcs(cpu->hvf->fd, VMCS_GUEST_CR0) | CR0_TS); + macvm_set_cr0(cpu->hvf->fd, rvmcs(cpu->hvf->fd, VMCS_GUEST_CR0) | + CR0_TS_MASK); x86_segment_descriptor_to_vmx(cpu, tss_sel, &next_tss_desc, &vmx_seg); vmx_write_segment_descriptor(cpu, &vmx_seg, R_TR); From patchwork Sun Mar 6 23:17:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9B50C433F5 for ; Sun, 6 Mar 2022 23:22:48 +0000 (UTC) Received: from localhost ([::1]:46258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0DA-00073F-0i for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:22:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR08r-0006Vw-NC; Sun, 06 Mar 2022 18:18:21 -0500 Received: from [2a00:1450:4864:20::432] (port=42869 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08p-0007Ll-Vw; Sun, 06 Mar 2022 18:18:21 -0500 Received: by mail-wr1-x432.google.com with SMTP id u10so19027512wra.9; Sun, 06 Mar 2022 15:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ArFcmNt0gGLU+mr5/TYFcI9zp4Pabr8VQk5NFCrO7o4=; b=YZRfxiXDBwbq1yzxYMRi4narMWbh8QHz09PZAMEG7FK4MHFsaw/GsViV/uzr5Kc3un PI2m7njySQSdy5U54kjtOgIuQvoZFqr4MJHiwG/7I/C4ttoRGlKjNgJe/mMzJh9LIQU9 ql1KWZRj8Mq20nRDVIUbsPYS5T8ot/usgZ9N9rM008wgXGF0bsL2xi0gOCFmLaolID08 ZJRi2AxsI5M1Vd5mIbmkP2x1wET3qwwbHsR/mvpS9IrkPy1px43ecK5BMZhhD7+CZj0M 7+aPua7EPDRo1gVWLgkL6ym29FE7/rhdwB7rAjgYzSMzrnamdAlTnc3Ic7HZpKxWA9yO xAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ArFcmNt0gGLU+mr5/TYFcI9zp4Pabr8VQk5NFCrO7o4=; b=Ai3PZX87uOD3t0Jokn+n6sthukeOL/Y4GjAgoZcAzcRITPhUg0b9mdkjM7JE5pRS5/ oAP3xSa9J3UKTGQeC4gbwlmUrM5FIGNKkxqE2nbQV5j17elaW2WutJgcTpH+qvLguEUr 2kTQy/R3Ng3KvXh/blZTL5Nt2PqFi99Elx9F5mx2CQa/E4qA7zjahxOJl3NHCucE2OCa 5wjRtpRAU37Kl8sDJf/50mt7rCrOEAgHMMok0wD0KBetypk2XnHvPAOa0ax8LwKe4Ehq jvOv4d7ATCJUtm/wVlqeq1LwF8anmdoO+0kwVqKaArPeSn5QoxSSpDgF9Y57v/7eel2K EN0g== X-Gm-Message-State: AOAM533OJBacmBw+CHzPnZIdp2tB1slsQLiJGYw6vEiBsIz33vrED56T 5VjO7xr+AD2NypclO9qSEQl2rCA5Dx0= X-Google-Smtp-Source: ABdhPJyPKlEouONG5pcg0NmBYgWUnoJF/keOhs05LJgfqDSBunEVK5wBnXb+BYf398arfGiA7q6CPA== X-Received: by 2002:a5d:47c2:0:b0:1f1:fc40:920b with SMTP id o2-20020a5d47c2000000b001f1fc40920bmr333260wrc.114.1646608696958; Sun, 06 Mar 2022 15:18:16 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id e18-20020adfdbd2000000b001e4bbbe5b92sm10560778wrj.76.2022.03.06.15.18.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 04/22] hvf: Make hvf_get_segments() / hvf_put_segments() local Date: Mon, 7 Mar 2022 00:17:35 +0100 Message-Id: <20220306231753.50277-5-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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 Tested-by: Roman Bolshakov Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hvf/x86hvf.c | 4 ++-- target/i386/hvf/x86hvf.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 05ec1bddc4..907f09f1b4 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; diff --git a/target/i386/hvf/x86hvf.h b/target/i386/hvf/x86hvf.h index 99ed8d608d..db6003d6bd 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 From patchwork Sun Mar 6 23:17:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94137C433EF for ; Sun, 6 Mar 2022 23:22:48 +0000 (UTC) Received: from localhost ([::1]:46252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0D9-00072i-LG for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:22:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR08v-0006av-RD; Sun, 06 Mar 2022 18:18:27 -0500 Received: from [2a00:1450:4864:20::433] (port=41950 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08u-0007MK-Av; Sun, 06 Mar 2022 18:18:25 -0500 Received: by mail-wr1-x433.google.com with SMTP id i8so20637604wrr.8; Sun, 06 Mar 2022 15:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RcstpUhbUgnI9fuTcLWWtxfVGC/x5MLDlmMnW6NP8eM=; b=g1bKIailuqLbe6D/eWA98fYHCMGuAYc/LjwxBJnrRtbHMKM7zim5SuLTkDcD2/yjR2 6MZRZ9qEqZrVXCrOze64aCmnAaDgvkAjOuK0XAS7KWOckOjztBBb+Z3gK+NjYZhykZTO I2lyn2ZxXVTshkarkrV89JiCEtduManbVgotKb2kR0JgmzFSYwKG5Zev/nDtmD7+vVQ0 INpTPwjNAB6V+D2TSQuqm/JG2xo5MBy0LLf/WoyEvRB/neRjUvfJoKbg3XAg3xM+puti fIPEN8O8GIkoC0pYKX0+nQCJzRfV6vFbSsnzWmATPePSRGBrUXYJON2pEoPg3fCPgI9y cE4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RcstpUhbUgnI9fuTcLWWtxfVGC/x5MLDlmMnW6NP8eM=; b=5tY/riGT1pUqtxzT7XgoXQbPepzULzpgM32vofOtNWUPMOK7i13NjE8qZk6aaXxBlH 9nCxxCvvzVV52Q251P4qp7QH+ahnQDN3dNx5wAglaS94YegJRIg/WW4C14rGOMv0lwGn p4DP5VYwaRegNZqDV7lEzcdb5W9FfkXQt4CyGLbrEAihoUZJm1rcjB35J7/H7TwFJM2u CdFlj0MHKMAmagbx4Uizn1gc66YCm0T9cWRvZgh0Cnmq454nUK47UDsU9A6EtN0X/o57 seo48dHscGSUcwRBHuz5ig2Cmo4cy8bRTCXFWrhWZXn78ZEjJHVBE40syIBbt3ruEHLs PWBg== X-Gm-Message-State: AOAM532w5ZaTqNMR4lOREmzgv0K5FV3h935WjLVrXEeiQLoxqeX/3Q6M oaictKe4Un9N3Bxb28+NgBIIP84j04Y= X-Google-Smtp-Source: ABdhPJywy3lQ96uXdW0ZdybHLqYpb6lyyFk430+e6Z7WJ9zlsNBLaHCj5Bb8F+fIN4ZhKX/O2dZbOw== X-Received: by 2002:a5d:4dc5:0:b0:1f0:73e4:2cd9 with SMTP id f5-20020a5d4dc5000000b001f073e42cd9mr6180089wru.212.1646608702322; Sun, 06 Mar 2022 15:18:22 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id e20-20020adfa454000000b001f01a14dce8sm9739269wra.97.2022.03.06.15.18.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 05/22] hvf: Remove deprecated hv_vcpu_flush() calls Date: Mon, 7 Mar 2022 00:17:36 +0100 Message-Id: <20220306231753.50277-6-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When building on macOS 11 [*], 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 [*] Also 10.15 (Catalina): https://lore.kernel.org/qemu-devel/Yd3DmSqZ1SiJwd7P@roolebo.dev/ Reviewed-by: Roman Bolshakov Tested-by: Roman Bolshakov Signed-off-by: Philippe Mathieu-Daudé --- 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 29b7deed3c..573ddc33c0 100644 --- a/target/i386/hvf/vmx.h +++ b/target/i386/hvf/vmx.h @@ -160,7 +160,6 @@ static inline void macvm_set_cr0(hv_vcpuid_t vcpu, uint64_t cr0) wvmcs(vcpu, VMCS_GUEST_CR0, cr0 | CR0_NE_MASK | CR0_ET_MASK); hv_vcpu_invalidate_tlb(vcpu); - hv_vcpu_flush(vcpu); } static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4) @@ -172,7 +171,6 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4) wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE_MASK); 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 e1301599e9..d24daf6a41 100644 --- a/target/i386/hvf/x86_task.c +++ b/target/i386/hvf/x86_task.c @@ -182,5 +182,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 907f09f1b4..bec9fc5814 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) From patchwork Sun Mar 6 23:17:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 902CCC433F5 for ; Sun, 6 Mar 2022 23:22:56 +0000 (UTC) Received: from localhost ([::1]:47010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0DH-0007YJ-KF for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:22:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR091-0006eA-4j; Sun, 06 Mar 2022 18:18:32 -0500 Received: from [2a00:1450:4864:20::42c] (port=36805 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR08z-0007Mh-Eu; Sun, 06 Mar 2022 18:18:30 -0500 Received: by mail-wr1-x42c.google.com with SMTP id r10so20674333wrp.3; Sun, 06 Mar 2022 15:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3oE10bEiyixc2uXJpKqOp4Nvl3FEz90xEnyLDQlRTXc=; b=nVRhgWmB8IrWpY15THJ0z3MEV3zW0LBSw3uaxXzKs4Q3wmELLNRe6mM4U3jkqYSYFx edP+jTisQ+3tUBD6JmM9yfCbSWabtETTyHYi2NuygCUrIXk09KA0cpLoS+Zn3aTED7iO sIJT+jShUrHc4nrg2bWEFVgBcquWx0qd1tvwM93Feq7PPaybeT3DJugi8Yn60bTBfL8D wdPl8h14PNEr91bnfjvDOBJewijowJD7z7VxKyovRB0GQVO8A3iKNgurFIxA/JGo+O/U yma4KKH1/nGPSGrkaJw8fAT80zHIvwnciZ4b6p4v7Sb9H8YiUz+C9qdSfIZLfBJqzl1t RZfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3oE10bEiyixc2uXJpKqOp4Nvl3FEz90xEnyLDQlRTXc=; b=ZnpFtl+qdWu1M3u7qVATKDLa2niGxJZAjVZFuapJEAHDmQah+k7rFab0MdzpBA0Hpo jnh+HVWePxku4XsYxIf8lnL+wfxCilUX4v9saljovPOGV4r4AvFhhjt9bnwTm1yOx3qH fRF1QfxkLw3NJQiohXOW6fjkLfhvhg7R2Mt8OWHhgHEoApqLfhLQbOAQ8ksz2KpzD8aI l1cBvXbvcQzoKSZ1smhj8qaVKsK0VW/V/9Pgduh8+X62sPVLgn2R8G/dImYmwchM+tH6 pkIO55OaVbtiApvySRhod/Kdv6OQJZECw70dabG6Q5XVLsXi/kzkoeLTkB4vSWA4NuxD 3yJA== X-Gm-Message-State: AOAM530FC2WusPXubdXZMl+kjGiLbBfOCUDqaVB0FKIh4d6mGCKM4CmO aQ1xVXNlVfLygH2QwY3sfKIIAt7g790= X-Google-Smtp-Source: ABdhPJxMZRPHq5veC5HzibBDBbuHotZCVFrJGRpVHTzfyWyqmnRKR2syVb4qMYjnnwwY9Np0loYfdA== X-Received: by 2002:a5d:6392:0:b0:1f0:651d:51ac with SMTP id p18-20020a5d6392000000b001f0651d51acmr6524203wru.253.1646608707758; Sun, 06 Mar 2022 15:18:27 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id c11-20020a05600c0a4b00b0037c91e085ddsm22191017wmq.40.2022.03.06.15.18.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 06/22] hvf: Fix OOB write in RDTSCP instruction decode Date: Mon, 7 Mar 2022 00:17:37 +0100 Message-Id: <20220306231753.50277-7-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Cameron Esfahani A guest could craft a specific stream of instructions that will have QEMU write 0xF9 to inappropriate locations in memory. Add additional asserts to check for this. Generate a #UD if there are more than 14 prefix bytes. Found by Julian Stecklina Signed-off-by: Cameron Esfahani Message-Id: <20220219063831.35356-1-dirty@apple.com> Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hvf/x86_decode.c | 12 ++++++++++-- target/i386/hvf/x86hvf.c | 8 ++++++++ target/i386/hvf/x86hvf.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/target/i386/hvf/x86_decode.c b/target/i386/hvf/x86_decode.c index 062713b1a4..5d051252b4 100644 --- a/target/i386/hvf/x86_decode.c +++ b/target/i386/hvf/x86_decode.c @@ -24,8 +24,10 @@ #include "vmx.h" #include "x86_mmu.h" #include "x86_descr.h" +#include "x86hvf.h" #define OPCODE_ESCAPE 0xf +#define X86_MAX_INSN_PREFIX_LENGTH (14) static void decode_invalid(CPUX86State *env, struct x86_decode *decode) { @@ -541,7 +543,8 @@ static void decode_lidtgroup(CPUX86State *env, struct x86_decode *decode) }; decode->cmd = group[decode->modrm.reg]; if (0xf9 == decode->modrm.modrm) { - decode->opcode[decode->len++] = decode->modrm.modrm; + VM_PANIC_ON(decode->opcode_len >= sizeof(decode->opcode)); + decode->opcode[decode->opcode_len++] = decode->modrm.modrm; decode->cmd = X86_DECODE_CMD_RDTSCP; } } @@ -1847,7 +1850,8 @@ void calc_modrm_operand(CPUX86State *env, struct x86_decode *decode, static void decode_prefix(CPUX86State *env, struct x86_decode *decode) { - while (1) { + /* At most X86_MAX_INSN_PREFIX_LENGTH prefix bytes. */ + for (int i = 0; i < X86_MAX_INSN_PREFIX_LENGTH; i++) { /* * REX prefix must come after legacy prefixes. * REX before legacy is ignored. @@ -1892,6 +1896,8 @@ static void decode_prefix(CPUX86State *env, struct x86_decode *decode) return; } } + /* Too many prefixes! Generate #UD. */ + hvf_inject_ud(env); } void set_addressing_size(CPUX86State *env, struct x86_decode *decode) @@ -2090,11 +2096,13 @@ static void decode_opcodes(CPUX86State *env, struct x86_decode *decode) uint8_t opcode; opcode = decode_byte(env, decode); + VM_PANIC_ON(decode->opcode_len >= sizeof(decode->opcode)); decode->opcode[decode->opcode_len++] = opcode; if (opcode != OPCODE_ESCAPE) { decode_opcode_1(env, decode, opcode); } else { opcode = decode_byte(env, decode); + VM_PANIC_ON(decode->opcode_len >= sizeof(decode->opcode)); decode->opcode[decode->opcode_len++] = opcode; decode_opcode_2(env, decode, opcode); } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index bec9fc5814..a338c207b7 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -423,6 +423,14 @@ bool hvf_inject_interrupts(CPUState *cpu_state) & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)); } +void hvf_inject_ud(CPUX86State *env) +{ + env->exception_nr = EXCP06_ILLOP; + env->exception_injected = 1; + env->has_error_code = false; + env->error_code = 0; +} + int hvf_process_events(CPUState *cpu_state) { X86CPU *cpu = X86_CPU(cpu_state); diff --git a/target/i386/hvf/x86hvf.h b/target/i386/hvf/x86hvf.h index db6003d6bd..427cdc1c13 100644 --- a/target/i386/hvf/x86hvf.h +++ b/target/i386/hvf/x86hvf.h @@ -22,6 +22,7 @@ int hvf_process_events(CPUState *); bool hvf_inject_interrupts(CPUState *); +void hvf_inject_ud(CPUX86State *); 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); From patchwork Sun Mar 6 23:17:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2DA7AC433F5 for ; Sun, 6 Mar 2022 23:25:02 +0000 (UTC) Received: from localhost ([::1]:55540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0FJ-0004jO-6a for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:25:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR097-0006tX-My; Sun, 06 Mar 2022 18:18:37 -0500 Received: from [2a00:1450:4864:20::42f] (port=38685 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR095-0007My-1N; Sun, 06 Mar 2022 18:18:37 -0500 Received: by mail-wr1-x42f.google.com with SMTP id t11so20677359wrm.5; Sun, 06 Mar 2022 15:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yCfDKLgC3DDY0V5rToqGFhbzD2NJTXWfNnXPl2aTeQI=; b=hcX0+jnT9e9NfCm5ZnEUMw32XA8NQAn0hexNIh7Sox3qdy7eN9MlftyNVCrJ2LaaZ7 aRXaCE9I9uURp8H6XaFH4zSLpzufBtuumojozY7YdLnX5Gd0MdYjm0e7dzOP1QL4ZnMH 5yh1VKXtWSpoOLWeYLZb1x/xFMxTC1ICf1agO9iy7T9ANYWnmw+ZV3AzxAdFuWmNiSbQ /kCcXC/e18m6qoPx4tmDbxN0bZQp8+wmj6IriN3HYY4lJrVS9OZRRCZDGdDlS32hEiw4 qMqfKYaVwHD/c2fRjItcNlHfnszRVMuekP/9UO7yY5Vv4oV37s9IsRd6Vx3FcvCUoHAE PRfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yCfDKLgC3DDY0V5rToqGFhbzD2NJTXWfNnXPl2aTeQI=; b=WgWQsO4eNwZA4MS0R8KaaFnamAXhwk39N7P6UudAV+54h3O9ArpPxXE90jRCTZu0k1 KyC/fmoXFwZ4Ej7lVAdvu4Tyt2utI05vCFg5aC4hTwt5O7DDvvQS8P/++Qwz2HD6p5D6 vuQDOWubNaqcKMXGi6IsYo0Hyng5t3PV7Sn/ULZpZXP4+rhGFxWsAUpB1RgaVfT75IzC Knbq2fsoXLc5BJhxogHDjF4JpdzVOkuzc+mdtsk/ucuZUxH+wDhcZiC6rmLTxAUnbPD/ jew+qg4e2CDgKuNhRQO0jH08MSj27PTTRwRydS8J9DNaHT9veajuqBl0y5kqSx1BaYi5 aAWA== X-Gm-Message-State: AOAM533RedE66y/+RZc7kc/WpLeW1ivjKkCQrjQorxnuu+FscIOiBaah CYh3rnm+KighC3vNUHNgIK0Q6khtOmY= X-Google-Smtp-Source: ABdhPJwcY8oU2TK5zTMKokheyQ6WmSgA2lzyHs4g/iaztjCYgFLaSpi8GyKhYXr1om6Wu616/1IBUA== X-Received: by 2002:a5d:628d:0:b0:1f1:d81d:c954 with SMTP id k13-20020a5d628d000000b001f1d81dc954mr6231165wru.273.1646608712929; Sun, 06 Mar 2022 15:18:32 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id n4-20020a056000170400b001f1fefa429bsm165198wrc.8.2022.03.06.15.18.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 07/22] block/file-posix: Remove a deprecation warning on macOS 12 Date: Mon, 7 Mar 2022 00:17:38 +0100 Message-Id: <20220306231753.50277-8-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: 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. Suggested-by: Akihiko Odaki Reviewed-by: Christian Schoenebeck Reviewed by: Cameron Esfahani Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé --- block/file-posix.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 1f1756e192..13393ad296 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3319,17 +3319,23 @@ BlockDriver bdrv_file = { #if defined(__APPLE__) && defined(__MACH__) static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize, int flags); + +#if !defined(MAC_OS_VERSION_12_0) \ + || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_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; @@ -3342,7 +3348,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", From patchwork Sun Mar 6 23:17:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FA9DC433EF for ; Sun, 6 Mar 2022 23:25:12 +0000 (UTC) Received: from localhost ([::1]:56376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0FT-0005HY-FQ for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:25:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09B-00079a-U7; Sun, 06 Mar 2022 18:18:41 -0500 Received: from [2a00:1450:4864:20::429] (port=35781 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR099-0007Nb-Vm; Sun, 06 Mar 2022 18:18:41 -0500 Received: by mail-wr1-x429.google.com with SMTP id b5so20692595wrr.2; Sun, 06 Mar 2022 15:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ueCRNYHpSl6dEFkGrmfKFWZkvVO5EBSCasWZO0J78vo=; b=U5ei4TH3S8XxIZlt4RgO+7P/tBEUcV6o7xcG2x5CJynAWXi0/Rtam26DJtjtw0Etco 1Ei/xB6BgfLok483qLS7wVNwdqNKqTxt0GT9QyNznCUEKCts23Gz39PHtO/51JTrK7dX 6NDBvkrw4a2R5sXHlTqfzfDOnDVvBbK4yAaCdv0LOUBpvxVsYRgVfv9Vfigfe8tZoCLE cuYNKK9mBtnXVTwDFYaTpXTIgpTFuezC1VUjhOdHbOLicQxkQxByCG8VHJvsovHJd77I NDHyuw0wAsMmN87bjpsr8DlYH8MjwtmadgpOdMqj6WXR5nAIh7s1Bk9saHypiwBaVRyj D4VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ueCRNYHpSl6dEFkGrmfKFWZkvVO5EBSCasWZO0J78vo=; b=686ID9CmYTeeIw70d9jJ9MVm9ClWLvqLCRq06StAtQSncTOt9b3NTkzIpKchTjQD9j uG2V5WghCotKj8LmkGtM/7CMReDL+UC6QMkFiIKU4bts58Rg37iKMpmp9Gp/KVYBTz6i gjTjU26/9mJZHSJ0LLPQpApLGIy2oGp62IAeDHn91Rstm5ALjteiRT4IzZjtv9TbPvoi FbJyvkBSXyoRfVif6UUhXbYv72iXORrZyKuavABjmVeRA8XYgdvJqBLMYOmcZcZnPKDy BS+RPiUeAwdied1Bs5ajj1GXRX7tPQihNsgIVu+Ym8/pASxoZzUOK7IDITYKjaS+yAlW 65fQ== X-Gm-Message-State: AOAM532UxgWvOv8Qq4pwB3ttDhEsiZsCRBVQ54t+a8MnrCI7D4zQwsbn rDLVrcBm6pKV/AUbm2ZUHHMmTH9tTEU= X-Google-Smtp-Source: ABdhPJyelMFuK8tCm+0iVxr5V3OhDo4zrLlUwOc/INeybtyOEL1KQrwReidrzNoYpu7HJT+oISRp1w== X-Received: by 2002:adf:d1ec:0:b0:1f1:e586:87ae with SMTP id g12-20020adfd1ec000000b001f1e58687aemr4886744wrd.619.1646608718072; Sun, 06 Mar 2022 15:18:38 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id n5-20020a05600c3b8500b00380fc02ff76sm12243212wms.15.2022.03.06.15.18.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 08/22] audio/coreaudio: Remove a deprecation warning on macOS 12 Date: Mon, 7 Mar 2022 00:17:39 +0100 Message-Id: <20220306231753.50277-9-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , Roman Bolshakov , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: 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. Suggested-by: Akihiko Odaki Suggested-by: Christian Schoenebeck Suggested-by: Roman Bolshakov Reviewed-by: Christian Schoenebeck Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé --- audio/coreaudio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 0f19d0ce01..23d7593eb9 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -44,10 +44,15 @@ typedef struct coreaudioVoiceOut { bool enabled; } coreaudioVoiceOut; +#if !defined(MAC_OS_VERSION_12_0) \ + || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0) +#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster +#endif + static const AudioObjectPropertyAddress voice_addr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; static OSStatus coreaudio_get_voice(AudioDeviceID *id) @@ -69,7 +74,7 @@ static OSStatus coreaudio_get_framesizerange(AudioDeviceID id, AudioObjectPropertyAddress addr = { kAudioDevicePropertyBufferFrameSizeRange, kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; return AudioObjectGetPropertyData(id, @@ -86,7 +91,7 @@ static OSStatus coreaudio_get_framesize(AudioDeviceID id, UInt32 *framesize) AudioObjectPropertyAddress addr = { kAudioDevicePropertyBufferFrameSize, kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; return AudioObjectGetPropertyData(id, @@ -103,7 +108,7 @@ static OSStatus coreaudio_set_framesize(AudioDeviceID id, UInt32 *framesize) AudioObjectPropertyAddress addr = { kAudioDevicePropertyBufferFrameSize, kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; return AudioObjectSetPropertyData(id, @@ -121,7 +126,7 @@ static OSStatus coreaudio_set_streamformat(AudioDeviceID id, AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreamFormat, kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; return AudioObjectSetPropertyData(id, @@ -138,7 +143,7 @@ static OSStatus coreaudio_get_isrunning(AudioDeviceID id, UInt32 *result) AudioObjectPropertyAddress addr = { kAudioDevicePropertyDeviceIsRunning, kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; return AudioObjectGetPropertyData(id, From patchwork Sun Mar 6 23:17:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7A4AC433F5 for ; Sun, 6 Mar 2022 23:27:26 +0000 (UTC) Received: from localhost ([::1]:36594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Hd-0002XW-N6 for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:27:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09G-0007Sd-G8; Sun, 06 Mar 2022 18:18:46 -0500 Received: from [2a00:1450:4864:20::431] (port=40763 helo=mail-wr1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09E-0007PU-W1; Sun, 06 Mar 2022 18:18:46 -0500 Received: by mail-wr1-x431.google.com with SMTP id k24so11194236wrd.7; Sun, 06 Mar 2022 15:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LG/c+ztFQy+lUqxAjjhbBGZeuruF9FjjhdwvvjkCJJo=; b=c5KvniZr3NAmm7o04SW2gxatubovbgQhCjoIp0NG+tvllj6YW2hGA15KVHP0uGBkv4 pwoXiuUrw9VZ98wOWqKt8Ui775Bqd96r3qw8THDtgwkRpln+NjqT1n/84NU4pD3yokZ7 U/3x860jh7pejP1CWP0Ucj025Ib4J2FHyD7/OZLWFM7yz5Yd6oj8OqlIUEydTcufOWEQ YfC8dOLN2mls2INIbuZ1GleVvwJnpH1HKN9SQeCEZax9BabOnzBGX61tjcxd6yBSEOXQ 2fa/MNfqnPK9N3yARYiBGAtX7OJvnjhHIk040f2vnHif+r3FyabNcS+Fo3EWCY8JrVuE S/eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LG/c+ztFQy+lUqxAjjhbBGZeuruF9FjjhdwvvjkCJJo=; b=mB3j+3XACTccozTg1cpuy9bm6ToGZqoc4ryLQ31L+PLnYS5aM2yDnJWBShat2xTk7H HWmqtoy3/RDe+lzeD1NBcNz04gG7ELSnr1tSwet0x1wXYfVhOe1QEC62CdtUIVoIxthw ug0inf6b79LxH73J8mqfIbrN3KYcHINNIYtKUGG5Y/PvPW3qmW0vQgh1P5YDFSJGAzz+ DRvXSHwa9ubgoxGNey9lqE+FitBYs9013iSWeZE8+/L5lOCOIhT6Wlva6QNkLigogRgG bGEnarkkjoHrQikYZYpcZCoKgrMDETWsRI7ldQ70Haag9PC9aHpGYT1hbpi0ShJg8MF2 O2bA== X-Gm-Message-State: AOAM5300P0vnZfLqIiK21h4cPjVZmGrCCRDIyx6RFaBF8aPjAfnwarnE vpKKj0CSmybylFqbBD7gpAoADP2JeWQ= X-Google-Smtp-Source: ABdhPJzcHb0HDMZHNRGQh2dFvWvQsna3sk/dbkDGaHlNbxWbcHz5fh/iwzqbptJ2wnO+1VBXB/ifDw== X-Received: by 2002:a05:6000:1a8b:b0:1f1:d8f4:4aa with SMTP id f11-20020a0560001a8b00b001f1d8f404aamr6623248wry.238.1646608723256; Sun, 06 Mar 2022 15:18:43 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id d3-20020a05600c34c300b003884e826642sm11277989wmq.12.2022.03.06.15.18.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 09/22] audio/dbus: Fix building with modules on macOS Date: Mon, 7 Mar 2022 00:17:40 +0100 Message-Id: <20220306231753.50277-10-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::431 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Li Zhang , Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When configuring QEMU with --enable-modules we get on macOS: --- stderr --- Dependency ui-dbus cannot be satisfied ui-dbus depends on pixman and opengl, so add these dependencies to audio-dbus. Fixes: 739362d420 ("audio: add "dbus" audio backend") Reviewed-by: Li Zhang Signed-off-by: Philippe Mathieu-Daudé --- audio/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/meson.build b/audio/meson.build index 0ac3791d0b..d9b295514f 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -28,7 +28,7 @@ endforeach if dbus_display module_ss = ss.source_set() - module_ss.add(when: gio, if_true: files('dbusaudio.c')) + module_ss.add(when: [gio, pixman, opengl, 'CONFIG_GIO'], if_true: files('dbusaudio.c')) audio_modules += {'dbus': module_ss} endif From patchwork Sun Mar 6 23:17:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70462C433EF for ; Sun, 6 Mar 2022 23:27:28 +0000 (UTC) Received: from localhost ([::1]:36726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Hf-0002cN-Jx for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:27:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09M-0007pV-55; Sun, 06 Mar 2022 18:18:52 -0500 Received: from [2a00:1450:4864:20::42f] (port=45919 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09K-0007QI-A1; Sun, 06 Mar 2022 18:18:51 -0500 Received: by mail-wr1-x42f.google.com with SMTP id p9so20648625wra.12; Sun, 06 Mar 2022 15:18:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=46NBNvVoysH9eJqR3eLDXH7RhT1oumyXXssv7c0pDs4=; b=EuVul0FiVgxxO0SMtN1aleSrFSR5fQ6OC/jIirSGVyDO2GxsKPR8KCho202pLkUSRj APsOA/RdsViUtfDlA3MKhtuzTUv7DMelrMmmUBb2cO8ipE4Et9r2/jkTVX9xp+HX/u3z 1O4cSrGBTq08Xy3w5MIMR8XVq4VTgcERi5n56lYw9Zf8wbFe84VDUkZMd1FRd068meyY 3QndukVGeQ0TL6bbhzt8A5Q+Adcb1pNLryEOMRjfE79EUMi3pTuI3G5xdboc8Na7lIsc CdPT8l9LaIRTCaJgKzQg5Ajf/ZElNMW2ZauEnSYIMu0+i2OFpMCUDkSHmnuTmg5RDJmG jQIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=46NBNvVoysH9eJqR3eLDXH7RhT1oumyXXssv7c0pDs4=; b=dbVDIzKpbP5vFky510PQKONSDhLias3nUFzDjBFZnYFKjPt7qMV663gDYoBr3c8sN7 Dwxffmj1rW+4bToQcFb7tpPAPVvHRZHmos16is+gm109nAQO4FEIIt7FCvMiQiv75Jc/ 0iyqcPc4fN5squ5sJP36ayJmjcRuQiWfU8b59Yo675HQcW3vkHSFxyf34TqjsXXYW0Gg OA/yZLcWuE82PB6nlOaox+deKxMTksjO+3sMsNrVlFTDtuUDyIFjIM9pnCazbdF7BpFj NWhsPchffydsVJ0oRf4NVmZHiv6jg1iy6D4ErYHmymGrJjXWF7w7LvJ2+MkRC7vQ6yCd lGkg== X-Gm-Message-State: AOAM531XDY9vuXPw/hcqj9AHGudiuz54CU2pcpA1lG8c3c+5EJN050J3 rrj+fNu/rDM9or0nQD2wdzDTZGaVbW0= X-Google-Smtp-Source: ABdhPJygEy1oAaDpNEut47oj2XoNGyAjL54W5qLvJl7kEM2dLX7Hq1rbIO1e+TS6iRR+xO0C+lSlVA== X-Received: by 2002:a5d:53cb:0:b0:1f1:e947:1933 with SMTP id a11-20020a5d53cb000000b001f1e9471933mr3247310wrw.478.1646608728349; Sun, 06 Mar 2022 15:18:48 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id bg18-20020a05600c3c9200b0037c2ef07493sm13424506wmb.3.2022.03.06.15.18.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 10/22] audio: Log context for audio bug Date: Mon, 7 Mar 2022 00:17:41 +0100 Message-Id: <20220306231753.50277-11-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki Without this change audio_bug aborts when the bug condition is met, which discards following useful logs. Call abort after such logs. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220306063202.27331-1-akihiko.odaki@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- audio/audio.c | 25 ++++++++++++------------- audio/audio_template.h | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index a88572e713..6bc313d9f5 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -117,7 +117,6 @@ int audio_bug (const char *funcname, int cond) AUD_log (NULL, "I am sorry\n"); } AUD_log (NULL, "Context:\n"); - abort(); } return cond; @@ -138,7 +137,7 @@ static inline int audio_bits_to_index (int bits) default: audio_bug ("bits_to_index", 1); AUD_log (NULL, "invalid bits %d\n", bits); - return 0; + abort(); } } @@ -156,7 +155,7 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", funcname); AUD_log (NULL, "nmemb=%d size=%zu (len=%zu)\n", nmemb, size, len); - return NULL; + abort(); } return g_malloc0 (len); @@ -543,7 +542,7 @@ static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw) size_t live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); if (audio_bug(__func__, live > hw->conv_buf->size)) { dolog("live=%zu hw->conv_buf->size=%zu\n", live, hw->conv_buf->size); - return 0; + abort(); } return live; } @@ -581,7 +580,7 @@ static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *buf, size_t size) } if (audio_bug(__func__, live > hw->conv_buf->size)) { dolog("live_in=%zu hw->conv_buf->size=%zu\n", live, hw->conv_buf->size); - return 0; + abort(); } rpos = audio_ring_posb(hw->conv_buf->pos, live, hw->conv_buf->size); @@ -656,7 +655,7 @@ static size_t audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live) if (audio_bug(__func__, live > hw->mix_buf->size)) { dolog("live=%zu hw->mix_buf->size=%zu\n", live, hw->mix_buf->size); - return 0; + abort(); } return live; } @@ -706,7 +705,7 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t size) live = sw->total_hw_samples_mixed; if (audio_bug(__func__, live > hwsamples)) { dolog("live=%zu hw->mix_buf->size=%zu\n", live, hwsamples); - return 0; + abort(); } if (live == hwsamples) { @@ -998,7 +997,7 @@ static size_t audio_get_avail (SWVoiceIn *sw) if (audio_bug(__func__, live > sw->hw->conv_buf->size)) { dolog("live=%zu sw->hw->conv_buf->size=%zu\n", live, sw->hw->conv_buf->size); - return 0; + abort(); } ldebug ( @@ -1028,7 +1027,7 @@ static size_t audio_get_free(SWVoiceOut *sw) if (audio_bug(__func__, live > sw->hw->mix_buf->size)) { dolog("live=%zu sw->hw->mix_buf->size=%zu\n", live, sw->hw->mix_buf->size); - return 0; + abort(); } dead = sw->hw->mix_buf->size - live; @@ -1170,7 +1169,7 @@ static void audio_run_out (AudioState *s) if (audio_bug(__func__, live > hw->mix_buf->size)) { dolog("live=%zu hw->mix_buf->size=%zu\n", live, hw->mix_buf->size); - continue; + abort(); } if (hw->pending_disable && !nb_live) { @@ -1203,7 +1202,7 @@ static void audio_run_out (AudioState *s) if (audio_bug(__func__, hw->mix_buf->pos >= hw->mix_buf->size)) { dolog("hw->mix_buf->pos=%zu hw->mix_buf->size=%zu played=%zu\n", hw->mix_buf->pos, hw->mix_buf->size, played); - hw->mix_buf->pos = 0; + abort(); } #ifdef DEBUG_OUT @@ -1223,7 +1222,7 @@ static void audio_run_out (AudioState *s) if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) { dolog("played=%zu sw->total_hw_samples_mixed=%zu\n", played, sw->total_hw_samples_mixed); - played = sw->total_hw_samples_mixed; + abort(); } sw->total_hw_samples_mixed -= played; @@ -1346,7 +1345,7 @@ static void audio_run_capture (AudioState *s) if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)) { dolog("captured=%zu sw->total_hw_samples_mixed=%zu\n", captured, sw->total_hw_samples_mixed); - captured = sw->total_hw_samples_mixed; + abort(); } sw->total_hw_samples_mixed -= captured; diff --git a/audio/audio_template.h b/audio/audio_template.h index d2d348638b..7192b19e73 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -59,12 +59,13 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioState *s, if (audio_bug(__func__, !voice_size && max_voices)) { dolog ("drv=`%s' voice_size=0 max_voices=%d\n", drv->name, max_voices); - glue (s->nb_hw_voices_, TYPE) = 0; + abort(); } if (audio_bug(__func__, voice_size && !max_voices)) { dolog ("drv=`%s' voice_size=%d max_voices=0\n", drv->name, voice_size); + abort(); } } @@ -81,6 +82,7 @@ static void glue(audio_pcm_hw_alloc_resources_, TYPE)(HW *hw) size_t samples = hw->samples; if (audio_bug(__func__, samples == 0)) { dolog("Attempted to allocate empty buffer\n"); + abort(); } HWBUF = g_malloc0(sizeof(STSampleBuffer) + sizeof(st_sample) * samples); @@ -252,12 +254,12 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, if (audio_bug(__func__, !drv)) { dolog ("No host audio driver\n"); - return NULL; + abort(); } if (audio_bug(__func__, !drv->pcm_ops)) { dolog ("Host audio driver without pcm_ops\n"); - return NULL; + abort(); } hw = audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE)); @@ -275,12 +277,13 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, QLIST_INIT (&hw->cap_head); #endif if (glue (hw->pcm_ops->init_, TYPE) (hw, as, s->drv_opaque)) { - goto err0; + g_free(hw); + return NULL; } if (audio_bug(__func__, hw->samples <= 0)) { dolog("hw->samples=%zd\n", hw->samples); - goto err1; + abort(); } if (hw->info.is_float) { @@ -309,12 +312,6 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, audio_attach_capture (hw); #endif return hw; - - err1: - glue (hw->pcm_ops->fini_, TYPE) (hw); - err0: - g_free (hw); - return NULL; } AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)(Audiodev *dev) @@ -435,7 +432,7 @@ void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) if (sw) { if (audio_bug(__func__, !card)) { dolog ("card=%p\n", card); - return; + abort(); } glue (audio_close_, TYPE) (sw); @@ -457,7 +454,7 @@ SW *glue (AUD_open_, TYPE) ( if (audio_bug(__func__, !card || !name || !callback_fn || !as)) { dolog ("card=%p name=%p callback_fn=%p as=%p\n", card, name, callback_fn, as); - goto fail; + abort(); } s = card->state; @@ -468,12 +465,12 @@ SW *glue (AUD_open_, TYPE) ( if (audio_bug(__func__, audio_validate_settings(as))) { audio_print_settings (as); - goto fail; + abort(); } if (audio_bug(__func__, !s->drv)) { dolog ("Can not open `%s' (no host audio driver)\n", name); - goto fail; + abort(); } if (sw && audio_pcm_info_eq (&sw->info, as)) { From patchwork Sun Mar 6 23:17:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23289C4332F for ; Sun, 6 Mar 2022 23:25:03 +0000 (UTC) Received: from localhost ([::1]:55648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0FK-0004oA-9v for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:25:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09Q-00086k-UO; Sun, 06 Mar 2022 18:18:56 -0500 Received: from [2a00:1450:4864:20::330] (port=46833 helo=mail-wm1-x330.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09P-0007Rj-BW; Sun, 06 Mar 2022 18:18:56 -0500 Received: by mail-wm1-x330.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so8291839wmp.5; Sun, 06 Mar 2022 15:18:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4Tp3WhNKm8JxXl/T2EoFZ8o3VjhBm7jaY9n4gps6ekw=; b=c5vj0Ib1OzUvzJdZ7tINjDtHZ03sVw7XitsvE8MwOUnaSZ834UgQQdX92QJZ8/2JGY s8tqyrbeVsEIpv0aFptI+vX8NWxjt3HwuE9VC158hdXEWgMkLgm5P+hAfbyZxTFLZTRI Yt02OFOf8HuLzEh8zGsfzj1Sip+G3V6e05NGGA9vjT3aXa+84kq7v/7cqX5VtAuebCI3 bO+WD3UKfr3mdT1GLy7DR1KxaCO777/S73jxHOoWrsCpRPP5T6rrAXDoOX7+2pTJSaNC WfNzJlwusJreLT9vfQmBnTIb+4c3aBZ+l28tEX8U6sxVaA+qlpSHTVR0BphIV2zpcrGJ 34Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4Tp3WhNKm8JxXl/T2EoFZ8o3VjhBm7jaY9n4gps6ekw=; b=HQSUnW912pjns4PtujndawVlHb9QO3AhYCQqjC93QnhblB6jYPlywJl6DdWc4urFO/ gI5Ik6cw4eMnAThAFYzqUbWHS6zBoIsycvwbJHP//MQrHeCLqqyvzJsY31oYEoYy9EgS hp5LpV8pKiEobn0/J+/EP34nps2V6Izr2AZQAEKDv2DgPO1AIwQ/6+AAuYgf8OD9hUS9 uP4xb9KlTnaqrgRt0RVUfKPFCbODPBh/X7kxQOSot5GVQmwouKBWoBy+F6Te48nZgcwC 1SC/IPVWT01wCbEamc7yypPxNiSHSyorFoiTcmn13k1SM5jpZGqyHAppH8TxPcrJABp3 XyqQ== X-Gm-Message-State: AOAM530tOnii+LzSqPQsT2gG/M8ec9RpeL/iZ5ICE7OGHLHVynwhOLMC u0nT1AmQfo/Sj9tz9vjzkKViPKK4LSA= X-Google-Smtp-Source: ABdhPJwTK+JYPiA2tUiszKvVTa18E5BjmwJ4PKdxqbUBPSFN/Aah+X5bzr1AAXY66NXMWW9J+f4c6Q== X-Received: by 2002:a05:600c:1d91:b0:389:ac07:37eb with SMTP id p17-20020a05600c1d9100b00389ac0737ebmr344171wms.133.1646608733617; Sun, 06 Mar 2022 15:18:53 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id 186-20020a1c19c3000000b0038990c0925fsm6001041wmz.14.2022.03.06.15.18.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 11/22] coreaudio: Always return 0 in handle_voice_change Date: Mon, 7 Mar 2022 00:17:42 +0100 Message-Id: <20220306231753.50277-12-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::330 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki handle_voice_change() is a CoreAudio callback function as of CoreAudio type AudioObjectPropertyListenerProc, and for the latter MacOSX.sdk/System/ Library/Frameworks/CoreAudio.framework/Headers/AudioHardware.h says "The return value is currently unused and should always be 0.". Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220306123410.61063-1-akihiko.odaki@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- audio/coreaudio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 23d7593eb9..3186b68474 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -545,7 +545,6 @@ static OSStatus handle_voice_change( const AudioObjectPropertyAddress *in_addresses, void *in_client_data) { - OSStatus status; coreaudioVoiceOut *core = in_client_data; qemu_mutex_lock_iothread(); @@ -554,13 +553,12 @@ static OSStatus handle_voice_change( fini_out_device(core); } - status = init_out_device(core); - if (!status) { + if (!init_out_device(core)) { update_device_playback_state(core); } qemu_mutex_unlock_iothread(); - return status; + return 0; } static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, From patchwork Sun Mar 6 23:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 526E3C433FE for ; Sun, 6 Mar 2022 23:27:28 +0000 (UTC) Received: from localhost ([::1]:36728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Hf-0002cO-E1 for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:27:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09W-0008Rl-BD; Sun, 06 Mar 2022 18:19:02 -0500 Received: from [2a00:1450:4864:20::42f] (port=45920 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09U-0007S8-KX; Sun, 06 Mar 2022 18:19:02 -0500 Received: by mail-wr1-x42f.google.com with SMTP id p9so20648919wra.12; Sun, 06 Mar 2022 15:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ldn2Z6B3k3Plt1cJVie4T8Wt19hcp59Igf8ZqI/jiUE=; b=o9gDAPqIfP4UFswBmNZwq2O//adImPtB2z2BLKdX5hx0/7Dl9pE2VVv4KSnge7Z0RN y2YL0rY1PT8uFjAhRmvjLxx6CdhyMcX8ZGhM9M5bo6mFXH5bSol4epwCKESF8rOPxUdK 3ht7E/IVJ3xj5VkIv+A7V1iwXCq7xMIN9dsQzHrZkIjIX9NYaX6yQz5047shf4H4hx7k ++uB0znPTerAyFRT7KseVt3YaXcfIBMF800uonsdWAX+79Ifrqd4Wna6A02tdIdQqeNQ O9tT9AeV5aQe5SocnuzOvEtMsmj+swVmDbOdiMxpJLifD00knJTk01tqNDOmKeErR4el 23/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ldn2Z6B3k3Plt1cJVie4T8Wt19hcp59Igf8ZqI/jiUE=; b=D7wRWFuScaXFfI7EyLjx9voZhMAkcCwK2C0wYsjvsNpAJVu4Ad9c7hpAtvhERMUJv5 a0T9KedkCNpMnG6ywl9TXpd6QRqGgE2XdVj9tYx2H0ijiWj5YDnBVNZilxYRGVpYWJ3a hWwYonNmI4EPKIwZqCTadIA2gq2sLavuUkdzMPWr/bfbv1FYww2Ztp0kS8/+bR8aD3/b xvaXl8X+b2dFoWWADEj1vNTJZIDN35sqL0efMdWcMkueJKo3a6sT4b4hsEj+uBazdFsz iK7juF4C+YP9E6FM8Sx3ziukPXIBuZs3/nTslF8Mi3IBWp0dvKLmY3ukaRgdx7asbRvq uW4w== X-Gm-Message-State: AOAM531Ty7VNIc0rZ0w2ZCP9hJR3Sb7CCYNNLf8tr5p+3g3UdTIMpGds SYoHHdFKpsKTOF61/jrrCp/1KGTJdxE= X-Google-Smtp-Source: ABdhPJztQwRBMpekx3C6bxQ+E+YGGyqWL/w+6tUQpDAZrAPoYx1PrjlJMpRQbKhGueXgh5klHMyj5w== X-Received: by 2002:adf:8b9d:0:b0:1f1:deb6:5607 with SMTP id o29-20020adf8b9d000000b001f1deb65607mr5844511wra.125.1646608738838; Sun, 06 Mar 2022 15:18:58 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id ay23-20020a5d6f17000000b001ea79f73fbcsm9611259wrb.25.2022.03.06.15.18.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:18:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 12/22] audio: Rename coreaudio extension to use Objective-C compiler Date: Mon, 7 Mar 2022 00:17:43 +0100 Message-Id: <20220306231753.50277-13-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The coreaudio library includes Objective-C declarations (using the caret '^' symbol to declare block references [*]). When building with a C compiler we get: [175/839] Compiling C object libcommon.fa.p/audio_coreaudio.c.o In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h:18, from ../../audio/coreaudio.c:26: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardware.h:162:2: error: expected identifier or '(' before '^' token 162 | (^AudioObjectPropertyListenerBlock)( UInt32 inNumberAddresses, | ^ FAILED: libcommon.fa.p/audio_coreaudio.c.o Rename the file to use the Objective-C default extension (.m) so meson calls the correct compiler. [*] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html Reviewed-by: Christian Schoenebeck Signed-off-by: Philippe Mathieu-Daudé --- audio/{coreaudio.c => coreaudio.m} | 0 audio/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename audio/{coreaudio.c => coreaudio.m} (100%) diff --git a/audio/coreaudio.c b/audio/coreaudio.m similarity index 100% rename from audio/coreaudio.c rename to audio/coreaudio.m diff --git a/audio/meson.build b/audio/meson.build index d9b295514f..94dab16891 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -7,7 +7,7 @@ softmmu_ss.add(files( 'wavcapture.c', )) -softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.c')) +softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.m')) softmmu_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_int.c')) audio_modules = {} From patchwork Sun Mar 6 23:17:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FF81C433F5 for ; Sun, 6 Mar 2022 23:29:35 +0000 (UTC) Received: from localhost ([::1]:45336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Ji-0008JV-Lc for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:29:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09b-0000NW-K8; Sun, 06 Mar 2022 18:19:07 -0500 Received: from [2a00:1450:4864:20::336] (port=40575 helo=mail-wm1-x336.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09a-0007SY-6i; Sun, 06 Mar 2022 18:19:07 -0500 Received: by mail-wm1-x336.google.com with SMTP id bi14-20020a05600c3d8e00b00386f2897400so4581455wmb.5; Sun, 06 Mar 2022 15:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q4dYzTMB+Jz3sFZLoUhLXf7pjh7WrTTvJu05cnU9v1M=; b=HTjfaERoODP3fX64s/67Rj6axuCUoOWQ2hG9VkggexW/zR8TYJB7l5EnTID1mdFvR/ 1NfdDAS9t+y3OseNnVHw/Ut3fQwRE1cBZhILbJO2ECVm8W5hGBGHWhaB0UM7PldFAHLi xSh6KcGgNZWPeFqjjyWvxM+sxxhCh/ilJxnDTqn17StnjaZGohzovJ1bvOprdDRYyVET /Rhg5QIqukkYVlXgbKNxN7xFdehHpTYZ4gSPM9Xi/Im5vghPV++5AmheKNHCCrq7aON0 4jsgAZGgBRcL3EIC4k4OJg9JRqKF1u8E9oCuJMAW7h2f26jTI8g1P27mWxXUyEN7/1xL 7oPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q4dYzTMB+Jz3sFZLoUhLXf7pjh7WrTTvJu05cnU9v1M=; b=mUDTH5jLfweQlrkNHz5sd/pEJEJSt5BJsyZ2nG8pkwYQF3OffmPtuiqjJghKlyMSyp eo5p/ooHCGrRy9zTeiwgbdoTeudVPHHQHB+EWNB1as03yk2RP6AEWrwmLhpVEneMcOn/ CpK9Sq1Xax9MJhLkI37rcplFeuyV6EXdZ1h+rPZF/l4Py5D8PJE/tm1xHtDqAlBjOUrU lcpCqI99Xw9Bcs4ob+sYFQ4LcGEJF/B2zOECVlt8+mvgLJDEWXEQaLyZE1r5F2XYLtCc H9Vu2YOT2Z3OeaEgheF+rc+XMUHdmUy8bNwRi/xC37BO/9O3xWHrX/XuzP+EABqsXyYE I5rw== X-Gm-Message-State: AOAM530aiVYqHQLKeZrY0PiaLrd05cs/2nncmwUf44nA12wj6l+NnlgK VuZMHuqg51PZA3uqKgd+jk2lLx0uFzo= X-Google-Smtp-Source: ABdhPJzYO1d1r6tQBXQ8q3BqS1+M3olYNHhRnCnillI232nIT07DDOm4ByaCk6Axy8EBgkgfEtwIXg== X-Received: by 2002:a7b:c2aa:0:b0:389:891f:1fd1 with SMTP id c10-20020a7bc2aa000000b00389891f1fd1mr9252655wmk.138.1646608744333; Sun, 06 Mar 2022 15:19:04 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f7-20020a5d4dc7000000b001f1d99e9441sm5196902wru.106.2022.03.06.15.19.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 13/22] osdep: Avoid using Clang-specific __builtin_available() Date: Mon, 7 Mar 2022 00:17:44 +0100 Message-Id: <20220306231753.50277-14-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::336 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Remove the Clang specific __builtin_available() to allow building with GCC, otherwise we get: include/qemu/osdep.h: In function 'qemu_thread_jit_write': include/qemu/osdep.h:787:9: warning: implicit declaration of function '__builtin_available'; did you mean '__builtin_scalbl'? [-Wimplicit-function-declaration] 787 | if (__builtin_available(macOS 11.0, *)) { | ^~~~~~~~~~~~~~~~~~~ | __builtin_scalbl include/qemu/osdep.h:787:9: warning: nested extern declaration of '__builtin_available' [-Wnested-externs] include/qemu/osdep.h:787:29: error: 'macOS' undeclared (first use in this function) 787 | if (__builtin_available(macOS 11.0, *)) { | ^~~~~ include/qemu/osdep.h:787:29: note: each undeclared identifier is reported only once for each function it appears in include/qemu/osdep.h:787:34: error: expected ')' before numeric constant 787 | if (__builtin_available(macOS 11.0, *)) { | ~ ^~~~~ | ) Beside, on macOS Catalina we get 2254 times: include/qemu/osdep.h:780:5: warning: 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer [-Wunguarded-availability-new] pthread_jit_write_protect_np(true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by using a stricker toolchain version low range, replacing MAC_OS_X_VERSION_MAX_ALLOWED by MAC_OS_X_VERSION_MIN_REQUIRED. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- include/qemu/osdep.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 7bcce3bceb..488a286300 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -642,19 +642,15 @@ size_t qemu_get_host_physmem(void); * for the current thread. */ #if defined(MAC_OS_VERSION_11_0) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 + MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 static inline void qemu_thread_jit_execute(void) { - if (__builtin_available(macOS 11.0, *)) { - pthread_jit_write_protect_np(true); - } + pthread_jit_write_protect_np(true); } static inline void qemu_thread_jit_write(void) { - if (__builtin_available(macOS 11.0, *)) { - pthread_jit_write_protect_np(false); - } + pthread_jit_write_protect_np(false); } #else static inline void qemu_thread_jit_write(void) {} From patchwork Sun Mar 6 23:17:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C56EDC433EF for ; Sun, 6 Mar 2022 23:30:18 +0000 (UTC) Received: from localhost ([::1]:48944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0KP-0002H0-Po for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:30:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09h-0000ib-5A; Sun, 06 Mar 2022 18:19:13 -0500 Received: from [2a00:1450:4864:20::32b] (port=53009 helo=mail-wm1-x32b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09f-0007T4-MU; Sun, 06 Mar 2022 18:19:12 -0500 Received: by mail-wm1-x32b.google.com with SMTP id r65so8197283wma.2; Sun, 06 Mar 2022 15:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/7dyfQ+q13OVQN73h3YfXem2xDDBUD4YaJugztqF7Q=; b=bOEU7lD256+f4WT3ERWIvQPJKpvJ5Y/X5SjpUdN2JucmyBt/s3WsWdzqBpw826Z2Dw +mFsukII2c71MJs9/ju60AhwX6c9wE/bdT1PM34AZ2l/cuAsMji3de8CAQM6k/ueVDQa dFgiuQ3s1Y5F2ogcnSRBj0v+dr/co5DKdsZwgIs0JBUqWKC9gsv2XE69onvUn0o/u0x2 4p/ChhemMoy2zs5+7unwKUcPWTZuEGOp2V30WBI0qmyNKBsZEgl0sWOn1DNVfXx0n02o bKcbFaXKIfDr47Y3SWoMyrX4K03Y9z6JHHI+QRVkpEv7pKxUE2H1HYmNNRDGWRcQnCBQ S5EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/7dyfQ+q13OVQN73h3YfXem2xDDBUD4YaJugztqF7Q=; b=fLUDTYX0mxtKVV8j2inktngkoF6xQDhz4eK4IsxwaySHFlxCwNb0AsBdn+4hwnS86o ACkHH83iBNK5JMndqSfiN5pujNlqXztugCB/0X0d9w2NL4PvJYWAZJZYKe677B7dS3TI necg08Cl3prESM1vyT/kUUd89aQ0krukP7OQ6diIRoQsKUTMlRi9ZcadwNYAccB1mzMx guwTGYV65MvthY+AmZiL9yIKskEiCG+T1E0h4wX9Rsb/fF1tkStIBlZNHn0PhdF2KY4T 4LYUndBBjqesee+Pxo36q2THoYkVURhcUZfQmLqXXsV0SvtIJtTetv1BYDR27wPEfg11 Hlbg== X-Gm-Message-State: AOAM530sJxz/ivdrHWGic1AM2OHl9wb/PU0rLwR7OE+ucRmXRs6AZCgV w0KW5TA9pQvqFx8SuelusIs7+W4cBXM= X-Google-Smtp-Source: ABdhPJxW2G7iCog24saAI7iCmSuUziLH4TaNhQoKCiovACEDGNf3u0rdeK0l2jgedUx+MmSra6RSFg== X-Received: by 2002:a05:600c:643:b0:389:9596:4d27 with SMTP id p3-20020a05600c064300b0038995964d27mr6418885wmm.194.1646608749847; Sun, 06 Mar 2022 15:19:09 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f1-20020a056000128100b001f04a47762dsm9661248wrx.109.2022.03.06.15.19.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:09 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 14/22] meson: Resolve the entitlement.sh script once for good Date: Mon, 7 Mar 2022 00:17:45 +0100 Message-Id: <20220306231753.50277-15-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Commit 235b523dba ("meson: Use find_program() to resolve the entitlement.sh script") didn't correctly fixed the issue, as the script is still resolved for each target. Move the check earlier, before processing each target. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b6e30d7463..8ca2b7c8c2 100644 --- a/meson.build +++ b/meson.build @@ -3063,6 +3063,10 @@ common_all = static_library('common', feature_to_c = find_program('scripts/feature_to_c.sh') +if targetos == 'darwin' + entitlement = find_program('scripts/entitlement.sh') +endif + emulators = {} foreach target : target_dirs config_target = config_target_mak[target] @@ -3220,7 +3224,6 @@ foreach target : target_dirs install_input += meson.current_source_dir() / entitlements endif - entitlement = find_program('scripts/entitlement.sh') emulators += {exe['name'] : custom_target(exe['name'], input: build_input, output: exe['name'], From patchwork Sun Mar 6 23:17:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C48FC433EF for ; Sun, 6 Mar 2022 23:29:51 +0000 (UTC) Received: from localhost ([::1]:46742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Jy-0000oX-G0 for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:29:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09m-000144-LI; Sun, 06 Mar 2022 18:19:18 -0500 Received: from [2a00:1450:4864:20::435] (port=34532 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09l-0007Tf-7c; Sun, 06 Mar 2022 18:19:18 -0500 Received: by mail-wr1-x435.google.com with SMTP id j26so10296269wrb.1; Sun, 06 Mar 2022 15:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3t7+/mInACvZRYaoFuoTkf2bXtSvwwVEGgg+XICyn98=; b=pBE1ErkSmCwti0ezSSn3RhFe/Vle4NxGvsEZWw5OZQ4xj6MsOrxxWdhiwUXuGuTY1w cJBWwf+jX+RFuWzYcsjQEIxjFcaCFV93UQNAiU1G2qdl0uzu1LQJgY7uBf2rQFvzbdcA 47JR3OUNxr0Fnd8QV/zuOKTdei16/tTFzkC6B47cIZqSTLQR3xoN72fE/9Cl0nQV2d8E 1IkyoLY2xoeB9/fgjoJBXV4XlgQu/M8CZzXBzaUOOW7hfjqBJgztG4E1UPuKayu/E2gs 0a1ttdGMmWHmjfxt8/y1oZkbWNPejlQ8JFFuP35TBFO5mh2vGcxbiI73DG0g/0LOQnN+ XnTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3t7+/mInACvZRYaoFuoTkf2bXtSvwwVEGgg+XICyn98=; b=lPCk7CqIxfxqzh7Zb6Vdj6VR/uNJCAx0tYWzRiHOx0/Vzfcn7O1rOo9dHi56oa59dt ovuYarrEEdxQGAXHKUpWNTVo90WVqXZqcDFHyHs3GzB8uj9rqQnx3tjiQg7azUb4eQq6 lSLYiY8e4i79c7CsNz2QX7nkaakaMUTReZ6WGVOUr68QOJDb0RwiFOa3Xol5CTOBYRnh sZw8guelxMZOxG48NQLgej8mW6PKI+gHhqd5U9EWeFY8mrmrcXT5RLe05e1hMhFknyFT cI1vjagR12PEdTmwySRsQPW8aB6mgOTCyOxgEKpHVk0kQQfagTII2EySjGqD0+xUdKbR K88g== X-Gm-Message-State: AOAM533Qtq7GNHz3Ne+3OBGDJlmDXYu4Azx9DthB4dP0/r1z6Imu6FJs L5IWZBlHiPx1LdcWfyvMX51adBebbDo= X-Google-Smtp-Source: ABdhPJy6iX5M2HLhf7G77Wp6ObJUl4xEig48PNmQWKYpIM8IMMZcBRZF5bg5Xuh875fmKVUAd6UHSw== X-Received: by 2002:adf:f804:0:b0:1f0:326e:5e78 with SMTP id s4-20020adff804000000b001f0326e5e78mr6507322wrp.251.1646608755220; Sun, 06 Mar 2022 15:19:15 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p12-20020a056000018c00b001f079518150sm6632238wrx.93.2022.03.06.15.19.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:14 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 15/22] meson: Log QEMU_CXXFLAGS content in summary Date: Mon, 7 Mar 2022 00:17:46 +0100 Message-Id: <20220306231753.50277-16-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::435 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 8ca2b7c8c2..0d38b2e72a 100644 --- a/meson.build +++ b/meson.build @@ -3470,6 +3470,7 @@ if link_args.length() > 0 summary_info += {'LDFLAGS': ' '.join(link_args)} endif summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} +summary_info += {'QEMU_CXXFLAGS': config_host['QEMU_CXXFLAGS']} summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} summary_info += {'profiler': get_option('profiler')} summary_info += {'link-time optimization (LTO)': get_option('b_lto')} From patchwork Sun Mar 6 23:17:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E438C433EF for ; Sun, 6 Mar 2022 23:33:16 +0000 (UTC) Received: from localhost ([::1]:56770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0NG-0007ZK-Ud for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:33:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09r-00018K-VV; Sun, 06 Mar 2022 18:19:24 -0500 Received: from [2a00:1450:4864:20::432] (port=44905 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09q-0007U6-Al; Sun, 06 Mar 2022 18:19:23 -0500 Received: by mail-wr1-x432.google.com with SMTP id u1so20633841wrg.11; Sun, 06 Mar 2022 15:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=da8OQjebbO6QE5YN8nEdTrGi8lsVvBcImkkqljSMF0k=; b=qEahTBZQDrEMo0i6DyY8s7ZHt/8L5EIoOKVaceY+hrPqzHOu1/RMcb7E5VtgwKeoM7 Q/Q1qq+ZOI43Sz5RSD0TwRHguIsfyJg6NzkIOfOM6+LCPmmjMw3r9dzekS93rXS2PenY tB6VOle9n4b75u3zPng4rXwfOQbqrWrvkQWb0pF0Q2wlWc1nLFChlT/CbVfAAY64Jc2q 2Rg9sY2XJG5eIuPJ4yCxNOECpt6wk6vGsMkDI16Snb8mZVgl5WkKo0PgPB2lKthrgk8y aTdbHmx803i8+8K4CissQuRBVIbaFjghnhBM3/MBcDvJ06n4J/WYN1hhwKYAzCtIFh1b E0pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=da8OQjebbO6QE5YN8nEdTrGi8lsVvBcImkkqljSMF0k=; b=tAYxiVGG6nSnwvqzUPWuhUXdEJTp13tqFnkj7v6uTDi6V44zx2ahPKfTC255z0LQzS 1uMLEJ70J1Bkj39LVqapw2rChnYFbpdITXPKHnHOVwkbNJv9TJ0i/rR99mYY5Ck52AYt xeHl7fuskGKOMZmSxkv8j84nLnZUWqX6L5RB19ZRZM1MNC1ExuJ8yhpSV+pDXA63dURL cnoaw3dfnWISaNOmgElANcGHC8v2gHk74ZImRzUvufuGe6JMR8bh9cz8KpejGpYEz41x nQX+GlBuyeU7KtuQIRX65meIO/LPwNXpPkPZH79yYXVfwXbkHKYgU6ru7gS5fSmmF3fl Qvng== X-Gm-Message-State: AOAM532sbYJ1f408KD585UNYo5QSBFkwnsdvtqsuOMp5fxmgsmFKAmW4 WMmtAnD1KC4yY0vTyGzp22g7oiAv+7M= X-Google-Smtp-Source: ABdhPJz4S0Y6kmi4zEKgUHnnSbEI3Ff11a1KlpWHUhp5FHR9uRsQxcrrrVc+18mTNEbzV6ASfaeVwQ== X-Received: by 2002:a5d:64ef:0:b0:1f0:45d3:5c3a with SMTP id g15-20020a5d64ef000000b001f045d35c3amr6373890wri.683.1646608760533; Sun, 06 Mar 2022 15:19:20 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id l5-20020a5d6745000000b001f1e4e40e42sm4001996wrw.77.2022.03.06.15.19.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 16/22] configure: Pass filtered QEMU_OBJCFLAGS to meson Date: Mon, 7 Mar 2022 00:17:47 +0100 Message-Id: <20220306231753.50277-17-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Filter unsupported Objective-C options, to avoid 'unknown-warning-option' warnings when using Clang: [34/373] Compiling Objective-C object libcommon.fa.p/audio_coreaudio.m.o warning: unknown warning option '-Wold-style-declaration'; did you mean '-Wout-of-line-declaration'? [-Wunknown-warning-option] warning: unknown warning option '-Wimplicit-fallthrough=2'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option] 2 warnings generated. Acked-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- configure | 23 +++++++++++++++++++++++ meson.build | 6 +++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e60156f90f..7d1f35603b 100755 --- a/configure +++ b/configure @@ -77,6 +77,7 @@ TMPB="qemu-conf" TMPC="${TMPDIR1}/${TMPB}.c" TMPO="${TMPDIR1}/${TMPB}.o" TMPCXX="${TMPDIR1}/${TMPB}.cxx" +TMPM="${TMPDIR1}/${TMPB}.m" TMPE="${TMPDIR1}/${TMPB}.exe" rm -f config.log @@ -148,6 +149,10 @@ do_cxx() { do_compiler "$cxx" $CPU_CFLAGS "$@" } +do_objc() { + do_compiler "$objcc" $CPU_CFLAGS "$@" +} + # Append $2 to the variable named $1, with space separation add_to() { eval $1=\${$1:+\"\$$1 \"}\$2 @@ -1445,10 +1450,27 @@ cc_has_warning_flag() { compile_prog "-Werror $optflag" "" } +objcc_has_warning_flag() { + cat > $TMPM <> $config_host_mak echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak +echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak echo "GLIB_LIBS=$glib_libs" >> $config_host_mak echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak diff --git a/meson.build b/meson.build index 0d38b2e72a..a770e80a32 100644 --- a/meson.build +++ b/meson.build @@ -173,11 +173,13 @@ endif qemu_cflags = config_host['QEMU_CFLAGS'].split() qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split() +qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split() qemu_ldflags = config_host['QEMU_LDFLAGS'].split() if get_option('gprof') qemu_cflags += ['-p'] qemu_cxxflags += ['-p'] + qemu_objcflags += ['-p'] qemu_ldflags += ['-p'] endif @@ -216,8 +218,9 @@ if get_option('fuzzing') endif endif -add_global_arguments(qemu_cflags, native: false, language: ['c', 'objc']) +add_global_arguments(qemu_cflags, native: false, language: ['c']) add_global_arguments(qemu_cxxflags, native: false, language: ['cpp']) +add_global_arguments(qemu_objcflags, native: false, language: ['objc']) add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc']) if targetos == 'linux' @@ -3471,6 +3474,7 @@ if link_args.length() > 0 endif summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} summary_info += {'QEMU_CXXFLAGS': config_host['QEMU_CXXFLAGS']} +summary_info += {'QEMU_OBJCFLAGS': config_host['QEMU_OBJCFLAGS']} summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} summary_info += {'profiler': get_option('profiler')} summary_info += {'link-time optimization (LTO)': get_option('b_lto')} From patchwork Sun Mar 6 23:17:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DA69C433F5 for ; Sun, 6 Mar 2022 23:32:48 +0000 (UTC) Received: from localhost ([::1]:56002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Mp-00072f-5W for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:32:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR09w-0001JZ-VN; Sun, 06 Mar 2022 18:19:28 -0500 Received: from [2a00:1450:4864:20::42c] (port=44900 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR09v-0007Ur-KX; Sun, 06 Mar 2022 18:19:28 -0500 Received: by mail-wr1-x42c.google.com with SMTP id u1so20633966wrg.11; Sun, 06 Mar 2022 15:19:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6yzxNN4URFUXGYJVg6HXHnx+8jkgJa6W3GmcO3omPgk=; b=qsNX8Od7AjCy3B5qP+PENH7QIaHfNhlA51qbjwfNoKQ81KLFvEEE3Ea7i+rjeIVOcQ CDvZLja0vZSPy8ofdO4b2y7HxKO+bOiPddmOouKQgNX76X/LGLinggGJfsK+51yoPB8+ Q2P1Sj1lqMBEIWy70H/0M19MXUQkpa2nmp4O+KSN5xjB++Cl9YP3+eu4wx5JvJtnANxb Dz718Nem/JYPmgN+AsGw2uPh6m9FJIEHRATnxwISDmYkJJIrsmy7L90LQfZ4yPInv7JZ sGaX7kt2Ku6qgCmbp24TaKC+taqnO3SdN0k3CQdczpO5H9/9lRwmdQsLmxIWxe5CN9pK MegA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6yzxNN4URFUXGYJVg6HXHnx+8jkgJa6W3GmcO3omPgk=; b=CcmhiUCYQMKhcN1/kBmp5b0i1kyibnlL3UDupC8SfzFNJfBnBNnawMxwBRi9KoL49q vBbf6m6eZfk9HFXAY7NB0m2lB4pzlB01jbOS1+AcHfpsgC9MqBx6orfSrckyoqDnCnHQ vpRPJLDtKclYTp8L9BJetsnL7K5kQfs4yIP19qYEyza1cYT49d6rxPY3vbFceLfkuJDn VvKn8f52HFP8HhWaV3kVS1kFtrBx/AMhdn5NqHNU7yqMrw/mztJa7aemJ3faWY4fzMZn rhLcoP02u7thZ5VHZBSojWdEEibotO9UG1+dnoGZTFrM67TjvZx8p+4UchnBfvoEC7ZS EZqQ== X-Gm-Message-State: AOAM530yWmhT6yftpP2CXkpK0f/JE54xA8OdQ/UI7iC8K6oSEfnO1jDe 5INL0GkQ9/GTFVNOK8mBxTHCD6C0Q/s= X-Google-Smtp-Source: ABdhPJxZOyp3sGnLEKw22IOMkyflcxZZoQimRKU98FpUcUS+h14lHRJUPgXiTjYC6OcoHWSFby43ZQ== X-Received: by 2002:a05:6000:1206:b0:1f1:e68d:a72b with SMTP id e6-20020a056000120600b001f1e68da72bmr3884072wrx.368.1646608765901; Sun, 06 Mar 2022 15:19:25 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id k3-20020a1ca103000000b0038993e53be7sm5285907wme.39.2022.03.06.15.19.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 17/22] ui/cocoa: Constify qkeycode translation arrays Date: Mon, 7 Mar 2022 00:17:48 +0100 Message-Id: <20220306231753.50277-18-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Reported-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- ui/cocoa.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 8ab9ab5e84..a6db8ebfb6 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -671,7 +671,7 @@ QemuCocoaView *cocoaView; /* translates Macintosh keycodes to QEMU's keysym */ - int without_control_translation[] = { + static const int without_control_translation[] = { [0 ... 0xff] = 0, // invalid key [kVK_UpArrow] = QEMU_KEY_UP, @@ -686,7 +686,7 @@ QemuCocoaView *cocoaView; [kVK_Delete] = QEMU_KEY_BACKSPACE, }; - int with_control_translation[] = { + static const int with_control_translation[] = { [0 ... 0xff] = 0, // invalid key [kVK_UpArrow] = QEMU_KEY_CTRL_UP, From patchwork Sun Mar 6 23:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770960 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C9E7C433F5 for ; Sun, 6 Mar 2022 23:23:19 +0000 (UTC) Received: from localhost ([::1]:49220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0De-0000Zc-H3 for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:23:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR0A3-0001df-9O; Sun, 06 Mar 2022 18:19:35 -0500 Received: from [2a00:1450:4864:20::32f] (port=39702 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR0A1-0007VZ-Nq; Sun, 06 Mar 2022 18:19:35 -0500 Received: by mail-wm1-x32f.google.com with SMTP id o18-20020a05600c4fd200b003826701f847so9749120wmq.4; Sun, 06 Mar 2022 15:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LzGUfymbxp+y62HZzvEHIfdBSsWo5xnhh+8DCigMhQg=; b=ZugEt4kYgi2lUDQawRRp0gFddzyNARQjS0H3R8KoLk6zt3VidBexZnCf5hwaNP+el5 XBv5Pi3dYVz7ChHNkWDiNBmI8nwapeCnWoVruqk0W5vINzXuLHE16G9GKpNwtSHkFmi3 QGv7ZexDItWRffK8p8akYCEJKCGzyjfHMGt0KP666v/1D894t5cM0+24Qg3W2hA3Iw2+ 5eipF+Sz1G1Nb4bJvNAWzq6RUanmFNVIQbkG3ahCZZPao/x2oHIYjyrLJiUDXbsOJslS YIRWd7excNd1/EVepGCDAv9sngEm2Ary8X55FU16d1lpdc+hXDiLt76SU+fkQAoGBFlm oPZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LzGUfymbxp+y62HZzvEHIfdBSsWo5xnhh+8DCigMhQg=; b=y2ixEiLQ3/pvAf0IwdL/Jthju+uRkkcB3mstUIf0xt+G+Vwki/4G0mZ2u8B/uO78BW xsn6TbtrlpDI0Iom/PnBkv5Z0pDqUGgYHCO9x28d0Eh468eCQwucfTCGGwn7s9XV01JQ s0oT/IYPOWisgKBoQiGdGYRjul6G5Ar3M9Q4E14V30XPNSFK7Kb8D0Ycxh/RdcABa+6m 0iR+L3yytm8pHgJeBnjuo4szxUaZC2sHwthtWczYr3PQpMUccYE8hYnR4kOXWIi+Fdmr nCxzaW5qzzPnwZv1inmLPwtU5o6MBIw53Py66qyiY8JB9BizU30P01dYu24qRtEzYiNL eikA== X-Gm-Message-State: AOAM533V38qMGf0IUghaMwp3KtEOmih0QnHtrgJKmbkPJS4+y9jxjYsr RC31eo8ifXOYxz7EmYu1lqc7RPr0El4= X-Google-Smtp-Source: ABdhPJzYmhZcajM43EcqRn65mlws4R5thWnt7bAxxZFePIADvFJxOoHZTMVJv54laTOMYUqCJ+u9nQ== X-Received: by 2002:a05:600c:602a:b0:389:9e05:6f01 with SMTP id az42-20020a05600c602a00b003899e056f01mr4484487wmb.1.1646608771355; Sun, 06 Mar 2022 15:19:31 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id g6-20020a5d5406000000b001f049726044sm9836661wrv.79.2022.03.06.15.19.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 18/22] ui/cocoa: add option to disable left-command forwarding to guest Date: Mon, 7 Mar 2022 00:17:49 +0100 Message-Id: <20220306231753.50277-19-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , Carwyn Ellis , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Carwyn Ellis When switching between guest and host on a Mac using command-tab the command key is sent to the guest which can trigger functionality in the guest OS. Specifying left-command-key=off disables forwarding this key to the guest. Defaults to enabled. Also updated the cocoa display documentation to reference the new left-command-key option along with the existing show-cursor option. Signed-off-by: Carwyn Ellis Reviewed-by: Akihiko Odaki [PMD: Set QAPI structure @since tag to 7.0] Signed-off-by: Philippe Mathieu-Daudé --- qapi/ui.json | 18 ++++++++++++++++++ qemu-options.hx | 12 ++++++++++++ ui/cocoa.m | 8 +++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/qapi/ui.json b/qapi/ui.json index 4a13f883a3..4dea35a819 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1260,6 +1260,23 @@ { 'struct' : 'DisplayCurses', 'data' : { '*charset' : 'str' } } +## +# @DisplayCocoa: +# +# Cocoa display options. +# +# @left-command-key: Enable/disable forwarding of left command key to +# guest. Allows command-tab window switching on the +# host without sending this key to the guest when +# "off". Defaults to "on" +# +# Since: 7.0 +## +{ 'struct': 'DisplayCocoa', + 'data': { + '*left-command-key': 'bool' + } } + ## # @DisplayType: # @@ -1338,6 +1355,7 @@ 'discriminator' : 'type', 'data' : { 'gtk': { 'type': 'DisplayGTK', 'if': 'CONFIG_GTK' }, + 'cocoa': { 'type': 'DisplayCocoa', 'if': 'CONFIG_COCOA' }, 'curses': { 'type': 'DisplayCurses', 'if': 'CONFIG_CURSES' }, 'egl-headless': { 'type': 'DisplayEGLHeadless', 'if': { 'all': ['CONFIG_OPENGL', 'CONFIG_GBM'] } }, diff --git a/qemu-options.hx b/qemu-options.hx index 094a6c1d7c..ffaeab61ed 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1922,6 +1922,9 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #if defined(CONFIG_DBUS_DISPLAY) "-display dbus[,addr=]\n" " [,gl=on|core|es|off][,rendernode=]\n" +#endif +#if defined(CONFIG_COCOA) + "-display cocoa[,show-cursor=on|off][,left-command-key=on|off]\n" #endif "-display none\n" " select display backend type\n" @@ -2009,6 +2012,15 @@ SRST ``charset=CP850`` for IBM CP850 encoding. The default is ``CP437``. + ``cocoa`` + Display video output in a Cocoa window. Mac only. This interface + provides drop-down menus and other UI elements to configure and + control the VM during runtime. Valid parameters are: + + ``show-cursor=on|off`` : Force showing the mouse cursor + + ``left-command-key=on|off`` : Disable forwarding left command key to host + ``egl-headless[,rendernode=]`` Offload all OpenGL operations to a local DRI device. For any graphical display, this display needs to be paired with either diff --git a/ui/cocoa.m b/ui/cocoa.m index a6db8ebfb6..319af5045b 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -95,6 +95,7 @@ static DisplayChangeListener dcl = { }; static int last_buttons; static int cursor_hide = 1; +static int left_command_key_enabled = 1; static int gArgc; static char **gArgv; @@ -853,7 +854,8 @@ QemuCocoaView *cocoaView; /* Don't pass command key changes to guest unless mouse is grabbed */ case kVK_Command: if (isMouseGrabbed && - !!(modifiers & NSEventModifierFlagCommand)) { + !!(modifiers & NSEventModifierFlagCommand) && + left_command_key_enabled) { [self toggleKey:Q_KEY_CODE_META_L]; } break; @@ -2068,6 +2070,10 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) cursor_hide = 0; } + if (opts->u.cocoa.has_left_command_key && !opts->u.cocoa.left_command_key) { + left_command_key_enabled = 0; + } + // register vga output callbacks register_displaychangelistener(&dcl); From patchwork Sun Mar 6 23:17:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90895C433EF for ; Sun, 6 Mar 2022 23:25:27 +0000 (UTC) Received: from localhost ([::1]:57790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Fi-0006Cm-OO for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:25:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR0A8-0001kq-7M; Sun, 06 Mar 2022 18:19:41 -0500 Received: from [2a00:1450:4864:20::42d] (port=41953 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR0A6-0007Vw-Mk; Sun, 06 Mar 2022 18:19:39 -0500 Received: by mail-wr1-x42d.google.com with SMTP id i8so20640036wrr.8; Sun, 06 Mar 2022 15:19:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5VwmaLZzHsZKPGjUk5pNKJd1rzr4Iit854/BbqGnfSU=; b=iwWbmFWJvd07m7vNd8U/FDWSszOgSLgRhhiJlPlPKZ1aRtLn7880CAGPhO3oEAfe1g 0/exm/VoR/7VGOGVHwGlLaWV67C6YZZnimHVCAFvF5HDDuEHEZt+qUbQpL8+Gjf4iuLg r0byVpegparZSqrFmN4KaMeZ2uvMqeepSGXH935dFeCKFAR4bSBqO8n60BRQcKW2/CQh v0u9Rk2PBDMCNNqxox643eMONnU72eXdKK1CrDCQCypxrYU3s+ht7WZT1iet1135UZIg 9JUP1HTxQHfX2/r+YghmhtBY6hlHcmYZXdWKGlk5V12I622KaVQ/2mjH8pMKgBjCb3pQ +SSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5VwmaLZzHsZKPGjUk5pNKJd1rzr4Iit854/BbqGnfSU=; b=AVl4DeaWaT3DZCt/AayaVIhfSMgALprXaBG3XNAjXa55hqzpa/80lUlkzipNDgcluZ RyPIdAdIJFF7m2Xurs9W1MHwB7y6umnpP0WrlD+NJfn2Ty1Io4JC8Vw/3JR71lbZB4xp HqjzVibF7cU2q8lVimm7sCW84AYKcqWknTYxzT76TywMwNoK2bf4kIOzUYpNaEMBX5XA ioWXxaD5Wjzm0UDpxkhfGBXD7vKE9bYqeyrNm3P+GboOfJrukoSpC4GmUhMCI2+hSyRE OtWFn/dgqJAEEXF+r90Y9jYbDjoHjUp/PZYUi8w302LZAVK8YTKVsMAPcNdu2dZ7Edu+ QInw== X-Gm-Message-State: AOAM531fFVn64YFyxYZ9+UQ/klHC0m+PslGchEas2lLR+Ucrx0dZxMsf YzmScAdrEucmvtVoGVWLK/4QgEkD8+s= X-Google-Smtp-Source: ABdhPJytl164XtFy/guGDwE/v15+vZK+uTA9vRdMtihjNhUGfLFRRq9wfFNyVRXyjvoSjJo6vtJ25Q== X-Received: by 2002:a5d:624d:0:b0:1e6:f18c:d264 with SMTP id m13-20020a5d624d000000b001e6f18cd264mr6439794wrv.546.1646608776936; Sun, 06 Mar 2022 15:19:36 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id n16-20020a5d4010000000b001f07772457csm6700292wrp.101.2022.03.06.15.19.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 19/22] ui/cocoa: release mouse when user switches away from QEMU window Date: Mon, 7 Mar 2022 00:17:50 +0100 Message-Id: <20220306231753.50277-20-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , Carwyn Ellis , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Carwyn Ellis This resolves an issue where using command-tab to switch between QEMU and other windows on the host can leave the mouse pointer visible. By releasing the mouse when the user switches away, the user must left click on the QEMU window when switching back in order to hide the pointer and return control to the guest. This appraoch ensures that the calls to NSCursor hide and unhide are always balanced and thus work correctly when invoked. Signed-off-by: Carwyn Ellis Reviewed-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/cocoa.m b/ui/cocoa.m index 319af5045b..31f0846c30 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1264,6 +1264,7 @@ QemuCocoaView *cocoaView; - (void) applicationWillResignActive: (NSNotification *)aNotification { COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n"); + [cocoaView ungrabMouse]; [cocoaView raiseAllKeys]; } @@ -2066,6 +2067,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) [(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil]; }); } + if (opts->has_show_cursor && opts->show_cursor) { cursor_hide = 0; } From patchwork Sun Mar 6 23:17:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2974EC433F5 for ; Sun, 6 Mar 2022 23:27:43 +0000 (UTC) Received: from localhost ([::1]:38144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Hu-0003XT-BX for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:27:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR0AF-0001tc-8D; Sun, 06 Mar 2022 18:19:47 -0500 Received: from [2a00:1450:4864:20::429] (port=42870 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR0AD-0007WM-Bm; Sun, 06 Mar 2022 18:19:46 -0500 Received: by mail-wr1-x429.google.com with SMTP id u10so19029947wra.9; Sun, 06 Mar 2022 15:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u+lyBbriO7k8JBjMdjeIbWvTvUw8GNP0/ldfmZ4fVhY=; b=loyI9jgtnhTNLWIY0PA2O2RRcJNwgQ6wRhnHQpS2BVqqYbzM4rA4TGIzREyRqAvUR1 +smBFZhp16kVif3URnYBOhb8R5sxqxm8DfDloqG0xXtmk8fBkT9LXarLuJrW/wMvsmTN 8jIp35QZr1nxq0RBqyunYVBeSahtLAzN5obmrG88DYAlYVdbQvlhcnEleklPwnmS2/C5 Gu5EkQX+xfpHBbdkKnrpxbM29CN5Jl49JMHXR07H7RfFsf/ZZMoTEt9F1zt8q3a8fvBz KfQFGHQYVL3Sdkd202z4Wk8LTl3aNIiEkxUvHpsLuPeax97IPK3WuG+5FcVL1gltypwv OL1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u+lyBbriO7k8JBjMdjeIbWvTvUw8GNP0/ldfmZ4fVhY=; b=vLFdvp3j5FFH74WX5ATq7dHMxXV1I9xeLqihe/j8epa/KMm78WUXt/4zMYqem9aZxd TKV8I42QT0jVrE1jPsjKuE+FSajXyq/JP+0/XUpf0JShg4C5QF13t4Av+s5jiqNqnGry RfKAqz4M2YN6N/00fgZgzpAXaaK1plcMKoMTJJpQ4hSWR9s/2RZzxb218NVYq1d3IRU2 HsuK75wWSdScM5QoHYw0epq86k4wm7lhnJULYrN6ZEOU4dqAUs6Otz3/bYMXGdSkjLZz +7Va0zv0T3gEUO+INde19cQZVXPrFLn+cG2JEsCx8ES1hTmo1s7aWJqMcpiOdn9hcfTs 1nSg== X-Gm-Message-State: AOAM530OtK9J1GSiW9p0c0oj1nnc490zdFLleSP3CWSVVt6JaW6lNqFi 6awRGehgKy9iePneZ0vvv1fWDzCCkR0= X-Google-Smtp-Source: ABdhPJyeMtFmCqzcYHcGRHj1A0yMzKuDqyhmeYXo/HL9dcKe17uuC/Okr7Kp/OrEeJ9ixTh81U76VQ== X-Received: by 2002:adf:fbcf:0:b0:1ef:d5f2:23a5 with SMTP id d15-20020adffbcf000000b001efd5f223a5mr6337375wrs.567.1646608782319; Sun, 06 Mar 2022 15:19:42 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id o12-20020a5d62cc000000b001f048bc25dfsm9620977wrv.67.2022.03.06.15.19.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 20/22] ui/cocoa: capture all keys and combos when mouse is grabbed Date: Mon, 7 Mar 2022 00:17:51 +0100 Message-Id: <20220306231753.50277-21-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Markus Armbruster , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , Gustavo Noronha Silva Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gustavo Noronha Silva Applications such as Gnome may use Alt-Tab and Super-Tab for different purposes, some use Ctrl-arrows so we want to allow qemu to handle everything when it captures the mouse/keyboard. However, Mac OS handles some combos like Command-Tab and Ctrl-arrows at an earlier part of the event handling chain, not letting qemu see it. We add a global Event Tap that allows qemu to see all events when the mouse is grabbed. Note that this requires additional permissions. See: https://developer.apple.com/documentation/coregraphics/1454426-cgeventtapcreate?language=objc#discussion https://support.apple.com/en-in/guide/mac-help/mh32356/mac Acked-by: Markus Armbruster Signed-off-by: Gustavo Noronha Silva Message-Id: <20210713213200.2547-2-gustavo@noronha.dev.br> Signed-off-by: Akihiko Odaki Message-Id: <20220306121119.45631-2-akihiko.odaki@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- qapi/ui.json | 8 +++++- qemu-options.hx | 3 +++ ui/cocoa.m | 65 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 4dea35a819..1d60d5fc78 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1270,11 +1270,17 @@ # host without sending this key to the guest when # "off". Defaults to "on" # +# @full-grab: Capture all key presses, including system combos. This +# requires accessibility permissions, since it performs +# a global grab on key events. (default: off) +# See https://support.apple.com/en-in/guide/mac-help/mh32356/mac +# # Since: 7.0 ## { 'struct': 'DisplayCocoa', 'data': { - '*left-command-key': 'bool' + '*left-command-key': 'bool', + '*full-grab': 'bool' } } ## diff --git a/qemu-options.hx b/qemu-options.hx index ffaeab61ed..2e6d54db4f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1916,6 +1916,9 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #if defined(CONFIG_CURSES) "-display curses[,charset=]\n" #endif +#if defined(CONFIG_COCOA) + "-display cocoa[,full_grab=on|off]\n" +#endif #if defined(CONFIG_OPENGL) "-display egl-headless[,rendernode=]\n" #endif diff --git a/ui/cocoa.m b/ui/cocoa.m index 31f0846c30..ca1cab1ae6 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -309,11 +309,13 @@ static void handleAnyDeviceErrors(Error * err) BOOL isMouseGrabbed; BOOL isFullscreen; BOOL isAbsoluteEnabled; + CFMachPortRef eventsTap; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; - (void) ungrabMouse; - (void) toggleFullScreen:(id)sender; +- (void) setFullGrab:(id)sender; - (void) handleMonitorInput:(NSEvent *)event; - (bool) handleEvent:(NSEvent *)event; - (bool) handleEventLocked:(NSEvent *)event; @@ -336,6 +338,19 @@ static void handleAnyDeviceErrors(Error * err) QemuCocoaView *cocoaView; +static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEventRef cgEvent, void *userInfo) +{ + QemuCocoaView *cocoaView = userInfo; + NSEvent *event = [NSEvent eventWithCGEvent:cgEvent]; + if ([cocoaView isMouseGrabbed] && [cocoaView handleEvent:event]) { + COCOA_DEBUG("Global events tap: qemu handled the event, capturing!\n"); + return NULL; + } + COCOA_DEBUG("Global events tap: qemu did not handle the event, letting it through...\n"); + + return cgEvent; +} + @implementation QemuCocoaView - (id)initWithFrame:(NSRect)frameRect { @@ -361,6 +376,11 @@ QemuCocoaView *cocoaView; } qkbd_state_free(kbd); + + if (eventsTap) { + CFRelease(eventsTap); + } + [super dealloc]; } @@ -655,6 +675,36 @@ QemuCocoaView *cocoaView; } } +- (void) setFullGrab:(id)sender +{ + COCOA_DEBUG("QemuCocoaView: setFullGrab\n"); + + CGEventMask mask = CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventKeyUp) | CGEventMaskBit(kCGEventFlagsChanged); + eventsTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, + mask, handleTapEvent, self); + if (!eventsTap) { + warn_report("Could not create event tap, system key combos will not be captured.\n"); + return; + } else { + COCOA_DEBUG("Global events tap created! Will capture system key combos.\n"); + } + + CFRunLoopRef runLoop = CFRunLoopGetCurrent(); + if (!runLoop) { + warn_report("Could not obtain current CF RunLoop, system key combos will not be captured.\n"); + return; + } + + CFRunLoopSourceRef tapEventsSrc = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventsTap, 0); + if (!tapEventsSrc ) { + warn_report("Could not obtain current CF RunLoop, system key combos will not be captured.\n"); + return; + } + + CFRunLoopAddSource(runLoop, tapEventsSrc, kCFRunLoopDefaultMode); + CFRelease(tapEventsSrc); +} + - (void) toggleKey: (int)keycode { qkbd_state_key_event(kbd, keycode, !qkbd_state_key_get(kbd, keycode)); } @@ -1284,6 +1334,13 @@ QemuCocoaView *cocoaView; [cocoaView toggleFullScreen:sender]; } +- (void) setFullGrab:(id)sender +{ + COCOA_DEBUG("QemuCocoaAppController: setFullGrab\n"); + + [cocoaView setFullGrab:sender]; +} + /* Tries to find then open the specified filename */ - (void) openDocumentation: (NSString *) filename { @@ -2060,11 +2117,17 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) qemu_sem_wait(&app_started_sem); COCOA_DEBUG("cocoa_display_init: app start completed\n"); + QemuCocoaAppController *controller = (QemuCocoaAppController *)[[NSApplication sharedApplication] delegate]; /* if fullscreen mode is to be used */ if (opts->has_full_screen && opts->full_screen) { dispatch_async(dispatch_get_main_queue(), ^{ [NSApp activateIgnoringOtherApps: YES]; - [(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil]; + [controller toggleFullScreen: nil]; + }); + } + if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) { + dispatch_async(dispatch_get_main_queue(), ^{ + [controller setFullGrab: nil]; }); } From patchwork Sun Mar 6 23:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 638F2C433F5 for ; Sun, 6 Mar 2022 23:32:18 +0000 (UTC) Received: from localhost ([::1]:53892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0ML-0005e3-C6 for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:32:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR0AJ-00021S-D9; Sun, 06 Mar 2022 18:19:51 -0500 Received: from [2a00:1450:4864:20::32c] (port=37680 helo=mail-wm1-x32c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR0AH-0007X0-KO; Sun, 06 Mar 2022 18:19:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id q7-20020a7bce87000000b00382255f4ca9so9828123wmj.2; Sun, 06 Mar 2022 15:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9MIxFXt6QBm8RrRkOgLio3kEWC3v+nhkcw1Ez/nLUEY=; b=MMD8c8E+p3AQErPo03+rZv27SdGnjA14NC8ihHjzwvFImm8N++QyeJGKqP8U9VtABz 0lC9vDHW5d3Co0jIZo94ZyWOXKHiD7NYa35oYuGrph0g/P3A3ObtoqlSl6Koz/+rH4mZ /67liArNQY+Pn9CXeWyq/hTpoSxCjXUFadTPxRIXZmXvJ0ysPQ0Pfm49vX7QmmSLgf9v /qh+zmgGNvYxi0tqHV5xrzVIsyiUaYMhh2NAzjnxLVeGT89ibrAs/8O2pfjl0aEu3qWD M1V+ubZhvTiWwgU2YMVywSC7CRT0/oCaZdK91JifjtfHLz03rK9EU47jlsKebhAB5t2t DKwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9MIxFXt6QBm8RrRkOgLio3kEWC3v+nhkcw1Ez/nLUEY=; b=UCkCc03wJy4r8IOTLo27moWmOMw3WTos8tmyi8p3SASRUra4R0FuCGMSQZX9/5ABPS /xzadFulsKeC+lJNAuNjdGBuU7bBEzgE++H9IP6kHEsPsfoc60qFUzu2RPWVGIQ6wpJ/ H3ndXgIuMgI+GWrnJES5i7ixXQS19vLUlHv66JmABARhNjSo2HEbH8PCII2XWTmKfqjC KNCkHdU6Uydf7TlfVlwQSSY9GNLWhtfXWoMKGCl/NsI84g9kyOGzvDvwkGmtllDyMxeU IZ//DuHgpiYQ6NTuBOfO5FJOeH7NW+goN7mbUAgmtWn5GGL9YlZCxBoOzmeGv1+LdqFi 4RJw== X-Gm-Message-State: AOAM532+imJw1XLtuKW1VkCOj+mUhoZ52x2iXwqXJtdXyEmqn9+12UkC bbaAFUCaaTfKYy7D8/7LgsfuDn56OUk= X-Google-Smtp-Source: ABdhPJyCeYrcf4QU4ysfWZVvqkFMe59zpL+yBF7uYmSTUvrXoVoDWW1KkRCbFdCxCksIbYIAZ3ITgQ== X-Received: by 2002:a05:600c:a0a:b0:350:564b:d55e with SMTP id z10-20020a05600c0a0a00b00350564bd55emr6867615wmp.124.1646608787892; Sun, 06 Mar 2022 15:19:47 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p6-20020a5d4586000000b001f0436cb325sm9484768wrq.52.2022.03.06.15.19.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 21/22] ui/cocoa: add option to swap Option and Command Date: Mon, 7 Mar 2022 00:17:52 +0100 Message-Id: <20220306231753.50277-22-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Markus Armbruster , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , Gustavo Noronha Silva Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gustavo Noronha Silva On Mac OS X the Option key maps to Alt and Command to Super/Meta. This change swaps them around so that Alt is the key closer to the space bar and Meta/Super is between Control and Alt, like on non-Mac keyboards. It is a cocoa display option, disabled by default. Acked-by: Markus Armbruster Signed-off-by: Gustavo Noronha Silva Message-Id: <20210713213200.2547-3-gustavo@noronha.dev.br> Signed-off-by: Akihiko Odaki Message-Id: <20220306121119.45631-3-akihiko.odaki@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- qapi/ui.json | 7 ++++++- qemu-options.hx | 2 +- ui/cocoa.m | 49 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 1d60d5fc78..664da9e462 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1275,12 +1275,17 @@ # a global grab on key events. (default: off) # See https://support.apple.com/en-in/guide/mac-help/mh32356/mac # +# @swap-opt-cmd: Swap the Option and Command keys so that their key codes match +# their position on non-Mac keyboards and you can use Meta/Super +# and Alt where you expect them. (default: off) +# # Since: 7.0 ## { 'struct': 'DisplayCocoa', 'data': { '*left-command-key': 'bool', - '*full-grab': 'bool' + '*full-grab': 'bool', + '*swap-opt-cmd': 'bool' } } ## diff --git a/qemu-options.hx b/qemu-options.hx index 2e6d54db4f..f443b0f33a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1917,7 +1917,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, "-display curses[,charset=]\n" #endif #if defined(CONFIG_COCOA) - "-display cocoa[,full_grab=on|off]\n" + "-display cocoa[,full-grab=on|off][,swap-opt-cmd=on|off]\n" #endif #if defined(CONFIG_OPENGL) "-display egl-headless[,rendernode=]\n" diff --git a/ui/cocoa.m b/ui/cocoa.m index ca1cab1ae6..c0a948201d 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -96,6 +96,7 @@ static DisplayChangeListener dcl = { static int last_buttons; static int cursor_hide = 1; static int left_command_key_enabled = 1; +static bool swap_opt_cmd; static int gArgc; static char **gArgv; @@ -854,12 +855,22 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven qkbd_state_key_event(kbd, Q_KEY_CODE_CTRL_R, false); } if (!(modifiers & NSEventModifierFlagOption)) { - qkbd_state_key_event(kbd, Q_KEY_CODE_ALT, false); - qkbd_state_key_event(kbd, Q_KEY_CODE_ALT_R, false); + if (swap_opt_cmd) { + qkbd_state_key_event(kbd, Q_KEY_CODE_META_L, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_META_R, false); + } else { + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT_R, false); + } } if (!(modifiers & NSEventModifierFlagCommand)) { - qkbd_state_key_event(kbd, Q_KEY_CODE_META_L, false); - qkbd_state_key_event(kbd, Q_KEY_CODE_META_R, false); + if (swap_opt_cmd) { + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT_R, false); + } else { + qkbd_state_key_event(kbd, Q_KEY_CODE_META_L, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_META_R, false); + } } switch ([event type]) { @@ -891,29 +902,44 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven case kVK_Option: if (!!(modifiers & NSEventModifierFlagOption)) { - [self toggleKey:Q_KEY_CODE_ALT]; + if (swap_opt_cmd) { + [self toggleKey:Q_KEY_CODE_META_L]; + } else { + [self toggleKey:Q_KEY_CODE_ALT]; + } } break; case kVK_RightOption: if (!!(modifiers & NSEventModifierFlagOption)) { - [self toggleKey:Q_KEY_CODE_ALT_R]; + if (swap_opt_cmd) { + [self toggleKey:Q_KEY_CODE_META_R]; + } else { + [self toggleKey:Q_KEY_CODE_ALT_R]; + } } break; /* Don't pass command key changes to guest unless mouse is grabbed */ case kVK_Command: if (isMouseGrabbed && - !!(modifiers & NSEventModifierFlagCommand) && - left_command_key_enabled) { - [self toggleKey:Q_KEY_CODE_META_L]; + !!(modifiers & NSEventModifierFlagCommand)) { + if (swap_opt_cmd) { + [self toggleKey:Q_KEY_CODE_ALT]; + } else { + [self toggleKey:Q_KEY_CODE_META_L]; + } } break; case kVK_RightCommand: if (isMouseGrabbed && !!(modifiers & NSEventModifierFlagCommand)) { - [self toggleKey:Q_KEY_CODE_META_R]; + if (swap_opt_cmd) { + [self toggleKey:Q_KEY_CODE_ALT_R]; + } else { + [self toggleKey:Q_KEY_CODE_META_R]; + } } break; } @@ -2134,6 +2160,9 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) if (opts->has_show_cursor && opts->show_cursor) { cursor_hide = 0; } + if (opts->u.cocoa.has_swap_opt_cmd) { + swap_opt_cmd = opts->u.cocoa.swap_opt_cmd; + } if (opts->u.cocoa.has_left_command_key && !opts->u.cocoa.left_command_key) { left_command_key_enabled = 0; From patchwork Sun Mar 6 23:17:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12770977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08968C433F5 for ; Sun, 6 Mar 2022 23:29:52 +0000 (UTC) Received: from localhost ([::1]:46792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR0Jz-0000qR-6Z for qemu-devel@archiver.kernel.org; Sun, 06 Mar 2022 18:29:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR0AP-0002Ak-DF; Sun, 06 Mar 2022 18:19:57 -0500 Received: from [2a00:1450:4864:20::433] (port=38698 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nR0AN-0007YV-B3; Sun, 06 Mar 2022 18:19:57 -0500 Received: by mail-wr1-x433.google.com with SMTP id t11so20679725wrm.5; Sun, 06 Mar 2022 15:19:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hG3fzMLjA1MqokTt6OJRgmQLIdkbnzb2RNEkMvPsfF0=; b=JjsrdUDXCB2+jSMOrGHFJsxc7weqEdBw8e/CzkqRvL8G3I7/agdMKAtPJykeyAdO0Q G0kKu5A8tFd5k14u/S60+OAJUXSrm+9fKwsvf7TnPDjyqsuEI16EKo6srrrPaVvF1vR8 gszfE62BCddZytBcMiMJw4UDZuzXvnNkKcUfqvIsgANqhEPwabMGqNBmVRrZ2aRQa8vS J8zaUj/W8x9dmY7wMg12ZFn7c56r47CEXpdixVBTel/4YiJgd6/V5BnGi5wPNp2To8DB 6zfy9jYj3OXOyZ35QYgR7/vFQN7lm/+2TjQfIgXEXOY/QVPhCDZYTQ9V3mz0z2oT0ofF kcng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hG3fzMLjA1MqokTt6OJRgmQLIdkbnzb2RNEkMvPsfF0=; b=hi1cCEvm1ivO9I97aZKjQ/uCPy0kB4wG5kxKwUKya34rqVuuYwgt083oEGrnvSjESN 32tHJjICX5PGSGQAsdYbY1RYXVy2ckNApV2jIfYdWUkCtgRfHdh6hiyqrXwI2ZGUTMNL z8fu4zMlKZ9kG2EA9ggSNEbtkj8JZQshRUae0gxQS/mBgurhUlldkphLgdolsuy3isAN zA4WmMJujSKWzHQea6+jDIz3GwMFFE9iMbH6185KQ2pdYc+T55jrwqyqAwEwrEskO8/z s4fnrdfPfYeIkFWfcbiP90d2PfGr565SCGir0PG0hZeO4RLidf4sQbDJofVs273KzEvj ddvg== X-Gm-Message-State: AOAM530u1Ejq/XzL+BOafzHTAwkHvVkSp+Vap6yWJ1/aGh5Oarn+T6fy iKcU9dHoI+MBGb5EUz0ravnidaLIPkU= X-Google-Smtp-Source: ABdhPJw35sUeyKXU+Ir6y5wMH8wd0hCu4iRMSWSdtt1XNtbiWu7Q8TQVriP/WsZpYWqAAuCYOlRnOA== X-Received: by 2002:a5d:4e83:0:b0:1ea:99dd:d335 with SMTP id e3-20020a5d4e83000000b001ea99ddd335mr6584646wru.16.1646608793397; Sun, 06 Mar 2022 15:19:53 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id l16-20020a05600c1d1000b003816edb5711sm18689220wms.26.2022.03.06.15.19.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 06 Mar 2022 15:19:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 22/22] gitlab-ci: Support macOS 12 via cirrus-run Date: Mon, 7 Mar 2022 00:17:53 +0100 Message-Id: <20220306231753.50277-23-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> References: <20220306231753.50277-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Christian Schoenebeck , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cameron Esfahani , Roman Bolshakov , Will Cohen , Gerd Hoffmann , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Add support for macOS 12 build on Cirrus-CI, similarly to commit 0e103a65ba1 ("gitlab: support for ... macOS 11 via cirrus-run"), but with the following differences: - Enable modules (configure --enable-modules) - Do not run softfloat3 tests (make check-softfloat) - Run Aarch64 qtests instead of x86_64 ones Generate the vars file by calling 'make lcitool-refresh'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé --- .gitlab-ci.d/cirrus.yml | 16 ++++++++++++++++ .gitlab-ci.d/cirrus/macos-12.vars | 16 ++++++++++++++++ tests/lcitool/refresh | 1 + 3 files changed, 33 insertions(+) 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 b96b22e269..be1dce5d4e 100644 --- a/.gitlab-ci.d/cirrus.yml +++ b/.gitlab-ci.d/cirrus.yml @@ -87,6 +87,22 @@ 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 + CONFIGURE_ARGS: --enable-modules + TEST_TARGETS: check-unit check-block check-qapi-schema check-qtest-aarch64 + # 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 0000000000..a793258c64 --- /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 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/refresh b/tests/lcitool/refresh index 1f00281b44..e2f0bbd1b1 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -105,6 +105,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: