From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F125AC433DF for ; Mon, 3 Aug 2020 15:19:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BD4A62054F for ; Mon, 3 Aug 2020 15:19:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Q2O9/Dhk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD4A62054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2cFA-0005px-Si for qemu-devel@archiver.kernel.org; Mon, 03 Aug 2020 11:19:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2cEP-00050D-ED for qemu-devel@nongnu.org; Mon, 03 Aug 2020 11:18:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35992 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k2cEN-0003fj-Mc for qemu-devel@nongnu.org; Mon, 03 Aug 2020 11:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596467906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7CXGvfSTOUj22+OT1trdS/F+9jmnVW8RVrrIqVkynMA=; b=Q2O9/Dhk5+fPiH/B+8540/xc7C9s0utemooOw85brfp3c/8elsed7Vgc/vlMSTXxO5CySX cbGoIWuvp/FOCpAu4WwlBweaJM2Qf8dYp7ASiXthNskbDwiZeEaG6VfwCHd2Q8irHZaDgz n8Q4p7CQMX1Sz9ABialn7qFKRoJIZFM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-qCK6H_45PEm9J9mTieyrEQ-1; Mon, 03 Aug 2020 11:18:23 -0400 X-MC-Unique: qCK6H_45PEm9J9mTieyrEQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63E47101C8AC; Mon, 3 Aug 2020 15:18:22 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.40.193.111]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 515A17176F; Mon, 3 Aug 2020 15:18:21 +0000 (UTC) Date: Mon, 3 Aug 2020 17:18:18 +0200 From: Andrew Jones To: Peter Maydell Subject: Re: [PATCH 3/3] hw/arm/virt: Implement kvm-steal-time Message-ID: <20200803151818.3ejilt5crefdyw6h@kamzik.brq.redhat.com> References: <20200711101033.47371-1-drjones@redhat.com> <20200711101033.47371-4-drjones@redhat.com> <20200729144050.pzl4t3pnpt2zg36u@kamzik.brq.redhat.com> MIME-Version: 1.0 In-Reply-To: <20200729144050.pzl4t3pnpt2zg36u@kamzik.brq.redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=205.139.110.120; envelope-from=drjones@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/03 01:24:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: , Cc: qemu-arm , QEMU Developers , Beata Michalska Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, Jul 29, 2020 at 04:40:54PM +0200, Andrew Jones wrote: > > > +static inline void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp) {} > > > > Does this stub need to report an error to the caller via errp, > > or is it a "never called but needs to exist to avoid linker errors" ? > > The second one, as we can't have kvm_enabled() and !defined(CONFIG_KVM). > Hmm, these types of stubs would be more robust to refactoring if we put > build bugs in them. I can try to analyze all the stubs in this #else to > see which ones should be returning false/error/nothing vs. build bugging. > I couldn't come up with a way to die at compile-time, but I think we should be able to use g_assert_not_reached() in these functions. How about something like the diff below? Thanks, drew diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index adb38514bf20..0da00eb6b20c 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -344,16 +344,10 @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level); #else -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 = QEMU_KVM_ARM_TARGET_NONE; - cpu->host_cpu_probe_failed = true; -} - +/* + * It's safe to call these functions without KVM support. + * They should either do nothing or return "not supported". + */ static inline void kvm_arm_add_vcpu_properties(Object *obj) {} static inline bool kvm_arm_aarch32_supported(void) @@ -371,23 +365,39 @@ static inline bool kvm_arm_sve_supported(void) return false; } +/* + * 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 int kvm_arm_get_max_vm_ipa_size(MachineState *ms) { - return -ENOENT; + g_assert_not_reached(); } static inline int kvm_arm_vgic_probe(void) { - return 0; + g_assert_not_reached(); } -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(); +} -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(); +} -static inline void kvm_arm_get_virtual_time(CPUState *cs) {} -static inline void kvm_arm_put_virtual_time(CPUState *cs) {} #endif static inline const char *gic_class_name(void)