From nobody Fri May 10 07:19:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1694428784; cv=none; d=zohomail.com; s=zohoarc; b=PcHA1HkrBwbym2eZErOgXCcXAwCjuj29V8shsCGT3rWKzTBqnOWVyucNHknq9zXqFYH3cphNP+5wHDWLlLfxdSJTL3dANtwe3v95A/l0vfFKKo8D46ixHufVkfNyoLtJ+nPIN7Zbc03lzVH868MRWoOFKUhZ0wnlE5kFkmWO7XM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694428784; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YnEbICE5DmlevtBmaZnl3yDN8nVPjB9EnaMUokRPLHQ=; b=KejssBPjYMgfzF5Qj5sc8nEnZAY4kpj/N+kAyJtu84ONvuxaDRqk/xxjGbg62AGXP9rmLz5F7/gE8G6TWqEu/FH4Ld9rUts/IJ3w1Q5CRnZHwuM2Qok9g2hXeLHWlT+lMVO9laC514ulLDs5HILQE65IO3nOYuOqKjOXhc7RgbU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694428784446524.9559524632729; Mon, 11 Sep 2023 03:39:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfeJW-0000gO-I5; Mon, 11 Sep 2023 06:38:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfeJU-0000fu-Nn for qemu-devel@nongnu.org; Mon, 11 Sep 2023 06:38:40 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfeJS-0005up-8o for qemu-devel@nongnu.org; Mon, 11 Sep 2023 06:38:40 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-99bf3f59905so531316266b.3 for ; Mon, 11 Sep 2023 03:38:37 -0700 (PDT) Received: from m1x-phil.lan (tfy62-h01-176-171-221-76.dsl.sta.abo.bbox.fr. [176.171.221.76]) by smtp.gmail.com with ESMTPSA id y22-20020a170906449600b0099bc8db97bcsm5125112ejo.131.2023.09.11.03.38.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Sep 2023 03:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694428716; x=1695033516; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YnEbICE5DmlevtBmaZnl3yDN8nVPjB9EnaMUokRPLHQ=; b=CHWbkoLmru0q3HFYB0v6L8jDCqbELU4CaaNSYvl1z/25+grCePsCm2yo1JYtHBwMkx ui7axeGBpuNMRhwoXTezc4BUfODwVItvei9oSt+PhI7GKPXetrlEc7OihMPilhTMFb4P MkA8jpEvIzCgp4TC1qPW9jo0z3nycFfYt5rmlUe41snltv1RJgiWIGtxt6rYQlKSZUj5 Wu7ASeNoYpZrr7Is1pahHyoqqhxQd9dhERrISYlmwfd2M84oTCZwR0aRKxrZWQpGApl7 GwxGaUKQyCuRjf0xvBfcY4zWxYizaGb3G12qQM85Ly3+tn6oo8siFjKHiipBoVo0A7dH WpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694428716; x=1695033516; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YnEbICE5DmlevtBmaZnl3yDN8nVPjB9EnaMUokRPLHQ=; b=jnk5DofhCm4+9jS+AfFV9LEQ9WL0dfGYys5mhFdyWzWEilOSLAcQeBelQ6rNGMNANl FNLSMP/m7jlwfA+YxhGzOF630Bg/WTxE2RjMGV931PSwoe9n/1nHtpdWi8rCAF5witrN PaqmsDDwaeUNsN1QjuZ7VsP9QrjWYE45WJhUIdKuB3h6fvA/0p38VQGmWrOYBwyIuAJb 5tm3hRyG9ovRPoVI2YV93kpqZBro1V7d6rb3h3ZltCZlrauDSQU7lBF94Zz2RtV5GyoM +4AgAGU+yoFXQlEVp4FNw8cPHRoe8EPfiI3jTVnDncgCUuwIjWrNkHIUbVrWnd99hpdC GigA== X-Gm-Message-State: AOJu0YyFLBqK8Zp9JdZHq895Nb1UsfE+e7jORLYW0Pv2UgZeC3kFd1lC bWsRiIAcnpmXYC3dUm2SmoQ3TgiBdY9qG66wEz0= X-Google-Smtp-Source: AGHT+IFjSvvB4G2eEZrSoIPby5ddCxAZgZdv/MfbxJTkw/wssjUUY8LR5XwpUXmGWATZtHgRAEhtsg== X-Received: by 2002:a17:906:8251:b0:99b:d580:546c with SMTP id f17-20020a170906825100b0099bd580546cmr7687810ejx.23.1694428716135; Mon, 11 Sep 2023 03:38:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Paolo Bonzini , Marcelo Tosatti , Michael Tokarev , Stefan Hajnoczi , Richard Henderson , kvm@vger.kernel.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf Subject: [PATCH] target/i386: Re-introduce few KVM stubs for Clang debug builds Date: Mon, 11 Sep 2023 12:38:32 +0200 Message-ID: <20230911103832.23596-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1694428786322100003 Since commits 3adce820cf..ef1cf6890f, When building on a x86 host configured as: $ ./configure --cc=3Dclang \ --target-list=3Dx86_64-linux-user,x86_64-softmmu \ --enable-debug we get: [71/71] Linking target qemu-x86_64 FAILED: qemu-x86_64 /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in funct= ion `cpu_x86_cpuid': cpu.c:(.text+0x1374): undefined reference to `kvm_arch_get_supported_cpui= d' /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in funct= ion `x86_cpu_filter_features': cpu.c:(.text+0x81c2): undefined reference to `kvm_arch_get_supported_cpui= d' /usr/bin/ld: cpu.c:(.text+0x81da): undefined reference to `kvm_arch_get_s= upported_cpuid' /usr/bin/ld: cpu.c:(.text+0x81f2): undefined reference to `kvm_arch_get_s= upported_cpuid' /usr/bin/ld: cpu.c:(.text+0x820a): undefined reference to `kvm_arch_get_s= upported_cpuid' /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o:cpu.c:(.t= ext+0x8225): more undefined references to `kvm_arch_get_supported_cpuid' fo= llow clang: error: linker command failed with exit code 1 (use -v to see invoc= ation) ninja: build stopped: subcommand failed. '--enable-debug' disables optimizations (CFLAGS=3D-O0). While at this (un)optimization level GCC eliminate the following dead code: if (0 && foo()) { ... } Clang does not. Therefore restore a pair of stubs for unoptimized Clang builds. Reported-by: Kevin Wolf Fixes: 3adce820cf ("target/i386: Remove unused KVM stubs") Fixes: ef1cf6890f ("target/i386: Allow elision of kvm_hv_vpindex_settable()= ") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- target/i386/kvm/kvm_i386.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h index 55d4e68c34..0b62ac628f 100644 --- a/target/i386/kvm/kvm_i386.h +++ b/target/i386/kvm/kvm_i386.h @@ -32,7 +32,6 @@ =20 bool kvm_has_smm(void); bool kvm_enable_x2apic(void); -bool kvm_hv_vpindex_settable(void); bool kvm_has_pit_state2(void); =20 bool kvm_enable_sgx_provisioning(KVMState *s); @@ -41,8 +40,6 @@ bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp= ); void kvm_arch_reset_vcpu(X86CPU *cs); void kvm_arch_after_reset_vcpu(X86CPU *cpu); void kvm_arch_do_init_vcpu(X86CPU *cs); -uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, - uint32_t index, int reg); uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index); =20 void kvm_set_max_apic_id(uint32_t max_apic_id); @@ -60,6 +57,10 @@ void kvm_put_apicbase(X86CPU *cpu, uint64_t value); =20 bool kvm_has_x2apic_api(void); bool kvm_has_waitpkg(void); +bool kvm_hv_vpindex_settable(void); + +uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, + uint32_t index, int reg); =20 uint64_t kvm_swizzle_msi_ext_dest_id(uint64_t address); void kvm_update_msi_routes_all(void *private, bool global, @@ -76,6 +77,20 @@ typedef struct kvm_msr_handlers { bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr, QEMUWRMSRHandler *wrmsr); =20 +#elif defined(__clang__) && !defined(__OPTIMIZE__) + +static inline bool kvm_hv_vpindex_settable(void) +{ + g_assert_not_reached(); +} + +static inline uint32_t kvm_arch_get_supported_cpuid(KVMState *env, + uint32_t function, + uint32_t index, int re= g) +{ + g_assert_not_reached(); +} + #endif /* CONFIG_KVM */ =20 void kvm_pc_setup_irq_routing(bool pci_enabled); --=20 2.41.0