From patchwork Tue Jul 12 22:16:03 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: 12915786 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 11B21C433EF for ; Tue, 12 Jul 2022 22:54:29 +0000 (UTC) Received: from localhost ([::1]:45404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBOlw-0008K9-33 for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 18:54:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBOBK-0007O8-La for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:39 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:52841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBOBI-0002T5-VM for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:38 -0400 Received: by mail-wm1-x32e.google.com with SMTP id o8so5492397wms.2 for ; Tue, 12 Jul 2022 15:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuGIjY7EJYwKlc1lIUgslmUYN25raPW28vS1CpNd758=; b=OZikCEMFXvDIzz1dh+DxpiG3codN1rX2k9glWAu3E4dWQtSecRsuAOkj3QVkAIvng9 HVN9Tx68mVVgn/lS9U+N8Zhj86fuL+iVkqzOmwAeSRGakxZFOYjggnp+2BIxb254uzeZ AEPfmpDn4Ju1Fae0FHz2TMzI7biGAJPS1OBRA6FqDinQQV8DgfM/e+AwvMBai4x2rIBU zjthULb39YitOAYGGNxz9N/PtSwXmoM4naybPAAKQx36kVhR8YlckzfyqOnklELDNXbA /PLFb+bt92xIbAJ/iaLF/1BLEB7A3pGW9C3AOYo25zC1GghzyzHPJdmPjBk6jPoL8quH ceOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KuGIjY7EJYwKlc1lIUgslmUYN25raPW28vS1CpNd758=; b=FBmKxhdcgma4WhakwirWepSLVh1MUIQgK6Qhm/jUiYF1vfpfDxOf0nR7zU6qBNc5li smKArpRZ511rqjZKgy8KF3poOucyxk+vu0Vp/+PYDZkuGl/pi25Clz/g+dUXnH9mTpXl iNcgf+4JPAkWHuw0zwkrF/DFqO1Eq2+5QfcFouz/yiT43m52mdZh///zBiZM6XSiPag+ lzjJLxqhViTZ3IJo2IOxZDWWr1A4iK9ai7xT614IBYHRoZi9xWTpJTLmhEhbeuvGfNMs UXKdwavxhh0XlGx+j3rDxA9ReHCWoEfDieEANZVh+F3KcFaH3DJQmx+dmyCYhwKDKOzX A4jg== X-Gm-Message-State: AJIora8RouAGjZ2Dl+pxqhbD+AlmqNP5p+wOzxfVvB8pXTTdWEYupOlI YkvHqm4j8Ut5Np1jcRYxdt3o2iE1lM3FwNhL X-Google-Smtp-Source: AGRyM1vmMu2YFNGTUWsYYhMdAbmNF8kJMXUk4nVD7GZg8W3vdINvncThoPEBJnq1L1vyXUVmKUpSLw== X-Received: by 2002:a05:600c:19cd:b0:3a2:f2bb:72ad with SMTP id u13-20020a05600c19cd00b003a2f2bb72admr214836wmq.106.1657664194864; Tue, 12 Jul 2022 15:16:34 -0700 (PDT) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id l17-20020a05600c47d100b003a2da6b2cbesm172508wmo.33.2022.07.12.15.16.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Jul 2022 15:16:34 -0700 (PDT) To: qemu-devel@nongnu.org Cc: Roman Bolshakov , Akihiko Odaki , Thomas Huth , Cameron Esfahani , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Silvio Moioli Subject: [PULL 1/5] hvf: Enable RDTSCP support Date: Wed, 13 Jul 2022 00:16:03 +0200 Message-Id: <20220712221607.9933-2-f4bug@amsat.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220712221607.9933-1-f4bug@amsat.org> References: <20220712221607.9933-1-f4bug@amsat.org> MIME-Version: 1.0 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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= From: Cameron Esfahani Pass through RDPID and RDTSCP support in CPUID if host supports it. Correctly detect if CPU_BASED_TSC_OFFSET and CPU_BASED2_RDTSCP would be supported in primary and secondary processor-based VM-execution controls. Enable RDTSCP in secondary processor controls if RDTSCP support is indicated in CPUID. Signed-off-by: Cameron Esfahani Message-Id: <20220214185605.28087-7-f4bug@amsat.org> Tested-by: Silvio Moioli Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1011 Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hvf/hvf.c | 26 +++++++++++++++++--------- target/i386/hvf/vmcs.h | 3 ++- target/i386/hvf/x86_cpuid.c | 7 ++++--- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index f8833277ab..8d2248bb3f 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -221,6 +221,7 @@ int hvf_arch_init_vcpu(CPUState *cpu) { X86CPU *x86cpu = X86_CPU(cpu); CPUX86State *env = &x86cpu->env; + uint64_t reqCap; init_emu(); init_decoder(); @@ -257,19 +258,26 @@ int hvf_arch_init_vcpu(CPUState *cpu) /* set VMCS control fields */ wvmcs(cpu->hvf->fd, VMCS_PIN_BASED_CTLS, cap2ctrl(hvf_state->hvf_caps->vmx_cap_pinbased, - VMCS_PIN_BASED_CTLS_EXTINT | - VMCS_PIN_BASED_CTLS_NMI | - VMCS_PIN_BASED_CTLS_VNMI)); + VMCS_PIN_BASED_CTLS_EXTINT | + VMCS_PIN_BASED_CTLS_NMI | + VMCS_PIN_BASED_CTLS_VNMI)); wvmcs(cpu->hvf->fd, VMCS_PRI_PROC_BASED_CTLS, cap2ctrl(hvf_state->hvf_caps->vmx_cap_procbased, - VMCS_PRI_PROC_BASED_CTLS_HLT | - VMCS_PRI_PROC_BASED_CTLS_MWAIT | - VMCS_PRI_PROC_BASED_CTLS_TSC_OFFSET | - VMCS_PRI_PROC_BASED_CTLS_TPR_SHADOW) | + VMCS_PRI_PROC_BASED_CTLS_HLT | + VMCS_PRI_PROC_BASED_CTLS_MWAIT | + VMCS_PRI_PROC_BASED_CTLS_TSC_OFFSET | + VMCS_PRI_PROC_BASED_CTLS_TPR_SHADOW) | VMCS_PRI_PROC_BASED_CTLS_SEC_CONTROL); + + reqCap = VMCS_PRI_PROC_BASED2_CTLS_APIC_ACCESSES; + + /* Is RDTSCP support in CPUID? If so, enable it in the VMCS. */ + if (hvf_get_supported_cpuid(0x80000001, 0, R_EDX) & CPUID_EXT2_RDTSCP) { + reqCap |= VMCS_PRI_PROC_BASED2_CTLS_RDTSCP; + } + wvmcs(cpu->hvf->fd, VMCS_SEC_PROC_BASED_CTLS, - cap2ctrl(hvf_state->hvf_caps->vmx_cap_procbased2, - VMCS_PRI_PROC_BASED2_CTLS_APIC_ACCESSES)); + cap2ctrl(hvf_state->hvf_caps->vmx_cap_procbased2, reqCap)); wvmcs(cpu->hvf->fd, VMCS_ENTRY_CTLS, cap2ctrl(hvf_state->hvf_caps->vmx_cap_entry, 0)); diff --git a/target/i386/hvf/vmcs.h b/target/i386/hvf/vmcs.h index b4692f63f6..aee6f75dfd 100644 --- a/target/i386/hvf/vmcs.h +++ b/target/i386/hvf/vmcs.h @@ -354,7 +354,7 @@ #define VMCS_PRI_PROC_BASED_CTLS_TSC_OFFSET (1 << 3) #define VMCS_PRI_PROC_BASED_CTLS_HLT (1 << 7) #define VMCS_PRI_PROC_BASED_CTLS_MWAIT (1 << 10) -#define VMCS_PRI_PROC_BASED_CTLS_TSC (1 << 12) +#define VMCS_PRI_PROC_BASED_CTLS_RDTSC (1 << 12) #define VMCS_PRI_PROC_BASED_CTLS_CR8_LOAD (1 << 19) #define VMCS_PRI_PROC_BASED_CTLS_CR8_STORE (1 << 20) #define VMCS_PRI_PROC_BASED_CTLS_TPR_SHADOW (1 << 21) @@ -362,6 +362,7 @@ #define VMCS_PRI_PROC_BASED_CTLS_SEC_CONTROL (1 << 31) #define VMCS_PRI_PROC_BASED2_CTLS_APIC_ACCESSES (1 << 0) +#define VMCS_PRI_PROC_BASED2_CTLS_RDTSCP (1 << 3) #define VMCS_PRI_PROC_BASED2_CTLS_X2APIC (1 << 4) enum task_switch_reason { diff --git a/target/i386/hvf/x86_cpuid.c b/target/i386/hvf/x86_cpuid.c index f24dd50e48..7323a7a94b 100644 --- a/target/i386/hvf/x86_cpuid.c +++ b/target/i386/hvf/x86_cpuid.c @@ -95,7 +95,8 @@ uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, ebx &= ~CPUID_7_0_EBX_INVPCID; } - ecx &= CPUID_7_0_ECX_AVX512_VBMI | CPUID_7_0_ECX_AVX512_VPOPCNTDQ; + ecx &= CPUID_7_0_ECX_AVX512_VBMI | CPUID_7_0_ECX_AVX512_VPOPCNTDQ | + CPUID_7_0_ECX_RDPID; edx &= CPUID_7_0_EDX_AVX512_4VNNIW | CPUID_7_0_EDX_AVX512_4FMAPS; } else { ebx = 0; @@ -132,11 +133,11 @@ uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, CPUID_FXSR | CPUID_EXT2_FXSR | CPUID_EXT2_PDPE1GB | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_3DNOW | CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX; hv_vmx_read_capability(HV_VMX_CAP_PROCBASED2, &cap); - if (!(cap & CPU_BASED2_RDTSCP)) { + if (!(cap2ctrl(cap, CPU_BASED2_RDTSCP) & CPU_BASED2_RDTSCP)) { edx &= ~CPUID_EXT2_RDTSCP; } hv_vmx_read_capability(HV_VMX_CAP_PROCBASED, &cap); - if (!(cap & CPU_BASED_TSC_OFFSET)) { + if (!(cap2ctrl(cap, CPU_BASED_TSC_OFFSET) & CPU_BASED_TSC_OFFSET)) { edx &= ~CPUID_EXT2_RDTSCP; } ecx &= CPUID_EXT3_LAHF_LM | CPUID_EXT3_CMP_LEG | CPUID_EXT3_CR8LEG | From patchwork Tue Jul 12 22:16:04 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: 12915787 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 AFF5CC43334 for ; Tue, 12 Jul 2022 22:56:51 +0000 (UTC) Received: from localhost ([::1]:49764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBOoE-00032N-S4 for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 18:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBOBP-0007VL-LB for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:44 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:40610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBOBO-0002Tm-63 for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:43 -0400 Received: by mail-wm1-x332.google.com with SMTP id o19-20020a05600c511300b003a2de48b4bbso181485wms.5 for ; Tue, 12 Jul 2022 15:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wBc9V+yOG3dBwW/jvrYjFLsdaX8yGI4FNvVQk/4l+Qo=; b=LRc5gfsSv4Rqe9JiXV8l7R6YVLb7yRkViWWW1+euONgGfDBz/cVsNOXTX1WYctddgf 3NN+yHMVqCVIL3QufBHnJIR7m8S/hXSvxyvrmwmDQdplSwIovWeKvzH8wj4Yok0cIF0d EfrqBkG6HwvbaIsFnpmMkn5dQURk88oQNB1zRuwe0feZPBvTABypJWduEnT98sgE9D/9 b8TD/kySTR8yb9i27NMGpB6jee7X8ro+N3OQyIoCUGFyRpDS+8z1NLpDIHBvcXlvM5Qk WSVQJFuPlY9lYkbv0nBjxmsAkDDCAwULolueAeterEOzGypQN8E2pXrZC6+u4zqZs0Nl 7/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wBc9V+yOG3dBwW/jvrYjFLsdaX8yGI4FNvVQk/4l+Qo=; b=oUQhlndQUgcK1rxV3RtG82jsNuCiOpRdzimwvKwXpyXUKDuK6KgcjwWC/GBlk6ABoP 7Uim1vaQzyak2n3OEYQvSIShMmxtTfesZBXNP0pA0lY4h3ruoB50GKz5znZ3xVEGy3Bk Ogld79nqZYvF4tw7iZB7/8WdZVk9i2h4b1vxvADnSNITeCQ1WVv6RB86emhcF5X/oHpy HBWqu0GTHVw9HgzOxcPlBxigu8OyYB8sQMLJco2eA0gVSWF2QyGY1DBuLwDVX1hDaMtT aB9XPUI/rT7EP90KsOWSx/PhmdC170rpTRbFQrMY8WE5iBWArsTa0Gg8pVaPiS8sg05M c87Q== X-Gm-Message-State: AJIora9IFE17xZEI3AM7M9X7fk8ueYBK7dmxYzua/bK8d4tV7gexTmQ9 m0ml+Lo/8/v3O1AqN9QTBolWfwqWNJpexjSO X-Google-Smtp-Source: AGRyM1sCv6j8tL0UKtLepwDH9NppIxuManWOUt2qhxUoHSeGha6+0C1+HM7BfE8/eTu6Y9bOhKEgRQ== X-Received: by 2002:a05:600c:2946:b0:3a2:e11f:ce4 with SMTP id n6-20020a05600c294600b003a2e11f0ce4mr6224924wmd.186.1657664200060; Tue, 12 Jul 2022 15:16:40 -0700 (PDT) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p12-20020a5d48cc000000b0021d9d13bf6csm7859060wrs.97.2022.07.12.15.16.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Jul 2022 15:16:39 -0700 (PDT) To: qemu-devel@nongnu.org Cc: Roman Bolshakov , Akihiko Odaki , Thomas Huth , Cameron Esfahani , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 2/5] configure: Restrict TCG to emulation Date: Wed, 13 Jul 2022 00:16:04 +0200 Message-Id: <20220712221607.9933-3-f4bug@amsat.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220712221607.9933-1-f4bug@amsat.org> References: <20220712221607.9933-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= If we don't need to emulate any target, we certainly don't need TCG. This should also help to compile again with ".../configure --enable-tools --disable-system --disable-user" on systems that do not have a TCG backend. Signed-off-by: Philippe Mathieu-Daudé [thuth: Re-arranged the code, remove check-softfloat from buildtest.yml] Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <20220706153816.768143-1-thuth@redhat.com> --- .gitlab-ci.d/buildtest.yml | 2 +- configure | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 8a4353ef93..1931b77b49 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -599,7 +599,7 @@ build-tools-and-docs-debian: optional: true variables: IMAGE: debian-amd64 - MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope + MAKE_CHECK_ARGS: check-unit ctags TAGS cscope CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools QEMU_JOB_PUBLISH: 1 artifacts: diff --git a/configure b/configure index e8cc850727..465c5000ee 100755 --- a/configure +++ b/configure @@ -329,7 +329,7 @@ fi fdt="auto" # 2. Automatically enable/disable other options -tcg="enabled" +tcg="auto" cfi="false" # parse CC options second @@ -1409,11 +1409,6 @@ EOF fi fi -if test "$tcg" = "enabled"; then - git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" - git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" -fi - if test -z "${target_list+xxx}" ; then default_targets=yes for target in $default_target_list; do @@ -1444,6 +1439,19 @@ case " $target_list " in ;; esac +if test "$tcg" = "auto"; then + if test -z "$target_list"; then + tcg="disabled" + else + tcg="enabled" + fi +fi + +if test "$tcg" = "enabled"; then + git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" + git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" +fi + feature_not_found() { feature=$1 remedy=$2 From patchwork Tue Jul 12 22:16:05 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: 12915759 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 54634C433EF for ; Tue, 12 Jul 2022 22:18:41 +0000 (UTC) Received: from localhost ([::1]:33190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBODI-0002Ia-ED for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 18:18:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBOBV-0007cw-Hw for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:49 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:44786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBOBS-0002U1-Gn for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:48 -0400 Received: by mail-wm1-x334.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so185740wmb.3 for ; Tue, 12 Jul 2022 15:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iAKkygkMO1TUtVaK/7uVgYzViBXQ1KnHrGHWUDPP7AE=; b=P6jvTc26WoW9mGGPpngwUR0CDdsgB68NIOQTH35UuE23TcorudpzQkaMdakCmGk5U0 EDpZVITphXPqXyHQ+/zVaUpPwOoGhg7YxrnfxQ7HGZfDtHGXDIC+aPp0VmwX2dlElM7i TqprLGu0S//lTfI0CJ512FwPzobAETfSgoVfcWL/+aVBrwEU5/JA4QEIvpxfixbnLmqa XVMR/V9DmIdPyaHip4OjHKsU0CfAYqX/VoCI/xepmk6aevZ/AF6A901bWRoQAH7mBdNj gLsofPH2I9tAdJw8ugM9gV2RfPMcwpHGZm2nOpkTnv/6upppRk/EyZTlyQWF1A9hKK4U ppJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iAKkygkMO1TUtVaK/7uVgYzViBXQ1KnHrGHWUDPP7AE=; b=fTsXYkVKsP719Vt4kl73BnHqv2FJkbcpQW8majj9D8N661FxC113Ddo7kDRouAbnbl 5YO2crhjr57bnRLGZEsVNY5h6tWpkxpVKzuLEob3gzUnJsPGoFI+81dsPuu8NJ85ALIc ke/iGa45zJK1shzYOhLuVCDgae0QASBY7tnfKKF3FZoPOcXpLI20helNk6KDQF1EIAcS z5W+6CcOksBoMzx1IdOruZGF4R/t9DOzPTITy+wdjhJCYhswhnnLe7kTNevsBGtbfQ2Y YjhPtAHA0hQtiBKtQdTs9D1B+s1/suJkt1mDH8E8u8eWoiYZmZ+SRCi3MBa6Nn4CfbLY m9CA== X-Gm-Message-State: AJIora/P7By5vclium0T33ht/uzqeonsvL5MeDMf956HOWYa0BdqIs3w rCQO0n53XSUJEUvTSKGRGVuw/rwe1p5mbGOM X-Google-Smtp-Source: AGRyM1uqp1Zlw04TWTdCzEZBBEymzCc+K8V/sERb4NDmaPr/TjVN2xW+AH6cGmgSHkyLARdAVCGWGA== X-Received: by 2002:a05:600c:3507:b0:3a1:9fbb:4d62 with SMTP id h7-20020a05600c350700b003a19fbb4d62mr174945wmq.161.1657664205139; Tue, 12 Jul 2022 15:16:45 -0700 (PDT) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id j5-20020adfea45000000b0021d6a23fdf3sm9212775wrn.15.2022.07.12.15.16.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Jul 2022 15:16:44 -0700 (PDT) To: qemu-devel@nongnu.org Cc: Roman Bolshakov , Akihiko Odaki , Thomas Huth , Cameron Esfahani , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Delevoryas Subject: [PULL 3/5] ui/cocoa: Fix switched_to_fullscreen warning Date: Wed, 13 Jul 2022 00:16:05 +0200 Message-Id: <20220712221607.9933-4-f4bug@amsat.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220712221607.9933-1-f4bug@amsat.org> References: <20220712221607.9933-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= From: Peter Delevoryas I noticed this error while building QEMU on Mac OS X: [1040/1660] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o ../ui/cocoa.m:803:17: warning: variable 'switched_to_fullscreen' set but not used [-Wunused-but-set-variable] static bool switched_to_fullscreen = false; ^ 1 warning generated. I think the behavior is fine if you remove "switched_to_fullscreen", I can still switch in and out of mouse grabbed mode and fullscreen mode with this change, and Command keycodes will only be passed to the guest if the mouse is grabbed, which I think is the right behavior. I'm not sure why a static piece of state was needed to handle that in the first place. Perhaps the refactoring of the flags-state-change fixed that by toggling the Command keycode on. I tested this with an Ubuntu core image on macOS 12.4 wget https://cdimage.ubuntu.com/ubuntu-core/18/stable/current/ubuntu-core-18-i386.img.xz xz -d ubuntu-core-18-i386.img.xz qemu-system-x86_64 -drive file=ubuntu-core-18.i386.img,format=raw Fixes: 6d73bb643aa7 ("ui/cocoa: Clear modifiers whenever possible") Signed-off-by: Peter Delevoryas Reviewed-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20220702044304.90553-1-peter@pjd.dev> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 6a4dccff7f..e883c7466e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -800,7 +800,6 @@ - (bool) handleEventLocked:(NSEvent *)event int buttons = 0; int keycode = 0; bool mouse_event = false; - static bool switched_to_fullscreen = false; // Location of event in virtual screen coordinates NSPoint p = [self screenLocationOfEvent:event]; NSUInteger modifiers = [event modifierFlags]; @@ -952,13 +951,6 @@ - (bool) handleEventLocked:(NSEvent *)event // forward command key combos to the host UI unless the mouse is grabbed if (!isMouseGrabbed && ([event modifierFlags] & NSEventModifierFlagCommand)) { - /* - * Prevent the command key from being stuck down in the guest - * when using Command-F to switch to full screen mode. - */ - if (keycode == Q_KEY_CODE_F) { - switched_to_fullscreen = true; - } return false; } From patchwork Tue Jul 12 22:16:06 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: 12915789 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 8DCE9C433EF for ; Tue, 12 Jul 2022 22:59:00 +0000 (UTC) Received: from localhost ([::1]:54206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBOqJ-00060m-PP for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 18:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBOBc-0007rX-7Q for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:56 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:52841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBOBX-0002T5-Az for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:55 -0400 Received: by mail-wm1-x32e.google.com with SMTP id o8so5492686wms.2 for ; Tue, 12 Jul 2022 15:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EWeAZEgVjDNYCPX5r/G5ZnsWsZ8ptX15tIjDl2hMt5Y=; b=HlPrzP/YAWj4KI4uGXZD9Fef8IwYby2V8B+7pDLACdW1xwcqBd9ZGMi+CqxpUO16th dG8CovQXIojMb+TG2I4MuzBas4JS6ewErZBMrM/omWHkNYT0d2IOEnAxoiOBDPBAr8D5 6ttq0YZ4mWyawdm1IX1x+sdgWzmbbCMsqCuEW6mmoskXrYgyNgrg1OQ9dLrRDjLYFGAu m/6SDNd3w6GzoWYW2WntipK7PSSA1HtZtAQDJxVp1DIYTqPa6dzJOJK9k6SkM1x8gzg3 bWfCGt4hAMCx1KSwVsOXn7tqBteyOtQD+o3UJDhs+b7BKD2DIBRAf41xXVkjAxFD+zf8 /fQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EWeAZEgVjDNYCPX5r/G5ZnsWsZ8ptX15tIjDl2hMt5Y=; b=diZPnrQS6HPq+YprWhaM91lJtgDztgwqrikPNEHEKfzREBJAi9GGNASZORqrv0z/1Z xCghd1ed+bHyC+No/1JV1QkR1ubu2o/4A5oORQ2hNc6z+tKOVoponakGqcNbuyxMnkUR 4gt3aUVBGrfVtSE7vLi5VxS2D9/6yDYLrGThnheofAV7CkB6NATo/hkEAXys4D3yb1E1 I9VEhUMCDvgZhGO+kcR4QO6xy9MhNmpBZwYp5xUvD9i16rFvc5uDmeMJ2jJ3hPgbOlN0 SQRwm3U0Yuayhoi5QAzCRHy+jp9rL1fHlR6oTWcRe4LV4e1Vx3UDDZ4/ic6D5YjdwO7N XaIg== X-Gm-Message-State: AJIora+R8mY9TEWBJKM5WAP6wpTqOgu8nujlp1sKcEA55MwmfKj2RrMu Le3O0cCNcBwS2X4TlTBk2tsCvcxkEK48qb0W X-Google-Smtp-Source: AGRyM1sxD3vuhFjlFxdVWQ/7MSuvMfOXGD3nfMW9P1nbGdQxToL/YXstcaPMZPRVxWwh0oqGlh17VA== X-Received: by 2002:a05:600c:1e8d:b0:3a1:9eb0:fd81 with SMTP id be13-20020a05600c1e8d00b003a19eb0fd81mr194101wmb.19.1657664210427; Tue, 12 Jul 2022 15:16:50 -0700 (PDT) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id r10-20020a05600c35ca00b003a2e5296befsm181242wmq.32.2022.07.12.15.16.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Jul 2022 15:16:49 -0700 (PDT) To: qemu-devel@nongnu.org Cc: Roman Bolshakov , Akihiko Odaki , Thomas Huth , Cameron Esfahani , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 4/5] ui/cocoa: Take refresh rate into account Date: Wed, 13 Jul 2022 00:16:06 +0200 Message-Id: <20220712221607.9933-5-f4bug@amsat.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220712221607.9933-1-f4bug@amsat.org> References: <20220712221607.9933-1-f4bug@amsat.org> MIME-Version: 1.0 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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= From: Akihiko Odaki Retrieve the refresh rate of the display and reflect it with dpy_set_ui_info() and update_displaychangelistener(), allowing the guest and DisplayChangeListener to consume the information. The information will be used as a hint how often the display should be updated. For example, when we run 30 Hz physical display updates it is pointless for the guest to update the screen at 60Hz frequency, the guest can spare some work instead. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Message-Id: <20220702142519.12188-1-akihiko.odaki@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- meson.build | 3 ++- ui/cocoa.m | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ad92d288a6..fea3566ea8 100644 --- a/meson.build +++ b/meson.build @@ -583,7 +583,8 @@ if get_option('attr').allowed() endif endif -cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) +cocoa = dependency('appleframeworks', modules: ['Cocoa', 'CoreVideo'], + required: get_option('cocoa')) if cocoa.found() and get_option('sdl').enabled() error('Cocoa and SDL cannot be enabled at the same time') endif diff --git a/ui/cocoa.m b/ui/cocoa.m index e883c7466e..5a8bd5dd84 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -561,8 +561,20 @@ - (void) updateUIInfoLocked CGDirectDisplayID display = [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]; NSSize screenSize = [[[self window] screen] frame].size; CGSize screenPhysicalSize = CGDisplayScreenSize(display); + CVDisplayLinkRef displayLink; frameSize = isFullscreen ? screenSize : [self frame].size; + + if (!CVDisplayLinkCreateWithCGDisplay(display, &displayLink)) { + CVTime period = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink); + CVDisplayLinkRelease(displayLink); + if (!(period.flags & kCVTimeIsIndefinite)) { + update_displaychangelistener(&dcl, + 1000 * period.timeValue / period.timeScale); + info.refresh_rate = (int64_t)1000 * period.timeScale / period.timeValue; + } + } + info.width_mm = frameSize.width / screenSize.width * screenPhysicalSize.width; info.height_mm = frameSize.height / screenSize.height * screenPhysicalSize.height; } else { From patchwork Tue Jul 12 22:16:07 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: 12915762 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 AD5C5C433EF for ; Tue, 12 Jul 2022 22:22:11 +0000 (UTC) Received: from localhost ([::1]:41316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBOGg-0007wU-Nw for qemu-devel@archiver.kernel.org; Tue, 12 Jul 2022 18:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBOBe-0007wu-Hq for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:58 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:56114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBOBd-0002W1-1Q for qemu-devel@nongnu.org; Tue, 12 Jul 2022 18:16:58 -0400 Received: by mail-wm1-x32c.google.com with SMTP id l42so5428406wms.5 for ; Tue, 12 Jul 2022 15:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kNSwwLUlb4TjazJWbInH85IZYRihokDtaxUvDxQfVGw=; b=aXaRkxGuky9dWr7wLOcLG3Qv5yAzQFzMDrDz3na2GFUg6S/xavmkjXFJqfArXrLcWH PueATxn3udioZjtwGM2k6fW/eld76R+oIw4h+6Ml328uwRJ4zxbLOAcaeK+JqQ6+Vl1Y Rqd6eLGQS8qEmpMedyT08J8857ZAkkZiK/1PvniElRgTf2on9zZqkqg72QeyHX9ju8+k aw33VV8DIA3VVRZMmWLnlSBK/uGDsNhvolxkrdBHOjfoO99EWr+Hw/+sMugypBzSO/z5 GuDWJ8TAZ+d750H/tWfY2jBehltm45ZpRBbNmKH/Qm9h5e3II1OaIX99sAOuLC3mJN17 fTig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kNSwwLUlb4TjazJWbInH85IZYRihokDtaxUvDxQfVGw=; b=bNzxydxr0Ecr+JZHSSEJwwONMEsjeZCoDy14p3WEimj/QzRrKU8+K53QeANa/ll7FQ eyEtNwgTwJFdqX3uNvYbVD2LCjAVtuw2xMyMvc78qfPtCt6Xtbex7EIAmwqOc5ICM2IO xeWErtv2WILiKXnEoh0/Eq1RcYyhCmyVZOsGydeMv1rF8isGY1Rctvg7Uzf1Rp4k1cf8 qJlGWPAKi/sZwceC/GP2WSKfRQ4DsnvAYv+mzdecdNMAdZQSBRkO6G32KfTqdr41rcKy xPMlaNgZpVX0peVvuTyRyAlYVCNeZaZHfzkOypto8cUTE9FR/qlhThbml1+JFS3z9dgR xGjA== X-Gm-Message-State: AJIora+SeYu28ZnxlGravlzqJvu22pcPb8wEZpTZsZj2KbEXQf5fFg4h +WhvBndvbetbGhsetPkJV6gdbyEWyAhcpV9i X-Google-Smtp-Source: AGRyM1vPxNW2EsSrR6U2SwExhHijQjSt0W5gLuUTO511wlEJ0aKgFU+820TIvTgWz+ob+PA60zbQww== X-Received: by 2002:a05:600c:4fc9:b0:3a0:4d54:b315 with SMTP id o9-20020a05600c4fc900b003a04d54b315mr217598wmq.62.1657664215496; Tue, 12 Jul 2022 15:16:55 -0700 (PDT) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id x4-20020adfdd84000000b0021d7f032022sm9258680wrl.17.2022.07.12.15.16.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Jul 2022 15:16:55 -0700 (PDT) To: qemu-devel@nongnu.org Cc: Roman Bolshakov , Akihiko Odaki , Thomas Huth , Cameron Esfahani , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Delevoryas Subject: [PULL 5/5] avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR Date: Wed, 13 Jul 2022 00:16:07 +0200 Message-Id: <20220712221607.9933-6-f4bug@amsat.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220712221607.9933-1-f4bug@amsat.org> References: <20220712221607.9933-1-f4bug@amsat.org> MIME-Version: 1.0 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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Original-From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= via From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= From: Peter Delevoryas I like to build QEMU from the root source directory [*], rather than cd'ing into the build directory. This code may as well include a search path for that, so that you can run avocado tests individually without specifying "-p qemu_bin=build/qemu-system-arm" manually. [*] See commit dedad02720 ("configure: add support for pseudo-"in source tree" builds") Signed-off-by: Peter Delevoryas Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220702185604.46643-1-peter@pjd.dev> [PMD: Mention commit dedad02720] Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/avocado_qemu/__init__.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index b656a70c55..ed4853c805 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -120,14 +120,15 @@ def pick_default_qemu_bin(bin_prefix='qemu-system-', arch=None): # qemu binary path does not match arch for powerpc, handle it if 'ppc64le' in arch: arch = 'ppc64' - qemu_bin_relative_path = os.path.join(".", bin_prefix + arch) - if is_readable_executable_file(qemu_bin_relative_path): - return qemu_bin_relative_path - - qemu_bin_from_bld_dir_path = os.path.join(BUILD_DIR, - qemu_bin_relative_path) - if is_readable_executable_file(qemu_bin_from_bld_dir_path): - return qemu_bin_from_bld_dir_path + qemu_bin_name = bin_prefix + arch + qemu_bin_paths = [ + os.path.join(".", qemu_bin_name), + os.path.join(BUILD_DIR, qemu_bin_name), + os.path.join(BUILD_DIR, "build", qemu_bin_name), + ] + for path in qemu_bin_paths: + if is_readable_executable_file(path): + return path return None