From nobody Fri Dec 19 04:28:20 2025 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=1602167400; cv=none; d=zohomail.com; s=zohoarc; b=ZKBDzdj9aTelNFmsv0m5fCIB55ebrc3KnVgnmz//NdO/FLZ+Dk1bnEkKgHQtybFNeHTRduOh6Pmnfqgk+VrvO9N9RLQfb0+ITH16vEVEmR5HRjxDnJkJVgaXuSsvjM30zi4xNlhVm2aLnDKRKamfnk6JMRy/p706wsHPU6ndV8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602167400; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PNZt5eZzpygN/NHe9hxZ5YJUWkGZkxNu5QAdM0lAEmk=; b=azwLs1zMIdcPioas0V7m5aVWR9m3Q/a9wSECf9gdIM3L/wXAHR4ane3mrne7E6K1+6qDbvKacxiFxYxnkaqqgnT3niWfixnQ3o/SKMzqj59x4xVnsEm1HvMWzkjNsOyyQxeWPSAzM9+SwKnbJCsdI97sUFylc2mY2OTlnulblI0= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602167400050110.39002543274626; Thu, 8 Oct 2020 07:30:00 -0700 (PDT) Received: from localhost ([::1]:53574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQWvc-0000tb-OJ for importer@patchew.org; Thu, 08 Oct 2020 10:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQWrz-0004F8-4M for qemu-devel@nongnu.org; Thu, 08 Oct 2020 10:26:11 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:36075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQWrx-0005yu-9A for qemu-devel@nongnu.org; Thu, 08 Oct 2020 10:26:10 -0400 Received: by mail-wr1-x431.google.com with SMTP id z1so6839757wrt.3 for ; Thu, 08 Oct 2020 07:26:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j1sm7905104wrc.28.2020.10.08.07.26.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 07:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PNZt5eZzpygN/NHe9hxZ5YJUWkGZkxNu5QAdM0lAEmk=; b=Bz7sT2IxENPOnXhADBS8vO95PRsgXG8s2Wmn91ibGAKf4Uy31SR6glksxl9ZKvX4dU GELfriuECpAWudyTRdIE2PYpUzAZoWVUIA+IT9Ed8Hx90rEmDUn/VDm2fNSuc5wKKrMT WKTNFavJaEHu6DunemAqGmvCJy72wSUqN/Qnto6NgELQyFAqA3yCfwJ61ui9xnWppcFK xSiax+Qehli/0OM9HhPN5jjUhGwSBl9cmLBbi9kONHnlqX5BgZUCek5nwRHTvpwINExz E7GerzVss8jKIVCT3L3Q5rpQn4hmi7/jTn4kxt5abz/a/kMzvpFIYHSBPYsKEKD0L4h8 7urg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PNZt5eZzpygN/NHe9hxZ5YJUWkGZkxNu5QAdM0lAEmk=; b=CQjexUlg+s7F4csxI87a50WMjXoe7biFoZYNGsVcnce+kajvEnbXROicyV6RYOp6zZ kP0WvqWOlkldJ7MyARvvGQmoNI/b1KsKgjSosrPT0spMpWe3/R1nHDwLlb3FiG20ineD /HPaYJZHz2BMSat0qxR8rPCI5x9IJY7T+oTrfVtTR7t+KAbkqPZ4X1Pmo7ec5kDYXIxG j/QGL1YIXStflUwgCKuF6U/8FJNgMDCOq6Ab0ZDpW6BY/gfgGwzjICwwzO98GgtPIfMZ HzMHu4PBNsWOQt4ikgI2pMEiAVOG6vW6z+yZ2oBssRkZhowg2c12fNsp6oP5lhuOltlB EmzQ== X-Gm-Message-State: AOAM533Xq2skYvpYBFHHzdpCijrmkCu94FwWuB+/F1tsx8mB6fLadKDx bpQkpydoVs0LTKx+QiYZNzbs8zrZmimdhSkl X-Google-Smtp-Source: ABdhPJzTz4W4vRf0BmDvs2r9WCbTf+uVPH33bkoaSdMCNLr70NWRy1eubSi8UhVeESwzCH7RC1E2mw== X-Received: by 2002:adf:a405:: with SMTP id d5mr3456528wra.421.1602167167647; Thu, 08 Oct 2020 07:26:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/12] target/arm/kvm: Make uncalled stubs explicitly unreachable Date: Thu, 8 Oct 2020 15:25:52 +0100 Message-Id: <20201008142557.9845-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201008142557.9845-1-peter.maydell@linaro.org> References: <20201008142557.9845-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Andrew Jones When we compile without KVM support !defined(CONFIG_KVM) we generate stubs for functions that the linker will still encounter. Sometimes these stubs can be executed safely and are placed in paths where they get executed with or without KVM. Other functions should never be called without KVM. Those functions should be guarded by kvm_enabled(), but should also be robust to refactoring mistakes. Putting a g_assert_not_reached() in the function should help. Additionally, the g_assert_not_reached() calls may actually help the linker remove some code. We remove the stubs for kvm_arm_get/put_virtual_time(), as they aren't necessary at all - the only caller is in kvm.c Reviewed-by: Eric Auger Signed-off-by: Andrew Jones Message-id: 20201001061718.101915-3-drjones@redhat.com Signed-off-by: Peter Maydell --- target/arm/kvm_arm.h | 51 +++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index bc178eeb84c..f513702176a 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -344,18 +344,10 @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, in= t level); =20 #else =20 -static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) -{ - /* - * This should never actually be called in the "not KVM" case, - * but set up the fields to indicate an error anyway. - */ - cpu->kvm_target =3D QEMU_KVM_ARM_TARGET_NONE; - cpu->host_cpu_probe_failed =3D true; -} - -static inline void kvm_arm_add_vcpu_properties(Object *obj) {} - +/* + * It's safe to call these functions without KVM support. + * They should either do nothing or return "not supported". + */ static inline bool kvm_arm_aarch32_supported(void) { return false; @@ -371,23 +363,44 @@ static inline bool kvm_arm_sve_supported(void) return false; } =20 +/* + * These functions should never actually be called without KVM support. + */ +static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) +{ + g_assert_not_reached(); +} + +static inline void kvm_arm_add_vcpu_properties(Object *obj) +{ + g_assert_not_reached(); +} + static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms) { - return -ENOENT; + g_assert_not_reached(); } =20 static inline int kvm_arm_vgic_probe(void) { - return 0; + g_assert_not_reached(); } =20 -static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {} -static inline void kvm_arm_pmu_init(CPUState *cs) {} +static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) +{ + g_assert_not_reached(); +} =20 -static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) {} +static inline void kvm_arm_pmu_init(CPUState *cs) +{ + g_assert_not_reached(); +} + +static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) +{ + g_assert_not_reached(); +} =20 -static inline void kvm_arm_get_virtual_time(CPUState *cs) {} -static inline void kvm_arm_put_virtual_time(CPUState *cs) {} #endif =20 static inline const char *gic_class_name(void) --=20 2.20.1