From patchwork Fri Jun 4 15:52:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 12300203 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 1ACFAC4743C for ; Fri, 4 Jun 2021 16:54:05 +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 9B06C613C9 for ; Fri, 4 Jun 2021 16:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B06C613C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpD59-0004eC-NR for qemu-devel@archiver.kernel.org; Fri, 04 Jun 2021 12:54:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpCIP-0000gO-Lx for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:03:41 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpCHw-0005w9-Uw for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:03:41 -0400 Received: by mail-wm1-x330.google.com with SMTP id h3so5688469wmq.3 for ; Fri, 04 Jun 2021 09:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FmT2fJZ1uVMYQwf4DRBAass7AtI+GiCA7uzNGZJ41H4=; b=aJ3Haq27l0iwFoE1JmwazN5DPDWmaUuaHsv+xhvf3wHRhwjr+9bVy/TbWVhgNdkPuw 8apDTzuGa3tBoVdM2hDMreL7RW5q2f6Yw6J/HvMzpWmNdEPzcZ4yVpiwff/ER8QHuzqf bmJtN2xUChF2RQFHMIt0/qhIu4/DPmH4Ewti5qT4SMFvE1m90Rpm87ZW3I6c4YeUS9YA juZ41HPWv2cRaWScnDy/1PbbQyViWPbRKFkr6uuJ0ffeAkLMZml02WQSENFgDDrAHv7x RYrbufQMbINQ/eZ1DTem8dsRAcMLfmgJIo/0RKlXnQnUYpzAVocc0CrmCOwQ+mQJW1cl 0SUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FmT2fJZ1uVMYQwf4DRBAass7AtI+GiCA7uzNGZJ41H4=; b=cHVDYFPWRKFwd/Zl7QJO8EOg6LxcgwKEyMACL2EyIgReHSkP4y5C1BfdMH59OGkJzs JgFVaD9VQlkG8BnjynIADPhA7GlCGiOjYhfJPymEubwCTqLJhLvjUKopJrHc7hcVsvCR rI3CTpPFQOKqjqNylXfkvfaQbvLVxnSvmFew+1yIrTeWXz/FJ1x+9raRGr60lGzogYtM Sbg1PvBZSDVF3FjM4Q9A9Ohhy8cBn6JvEJE+5oGmzs+90f75xHpO5I/miWLaslArlvGb cuviN9YbDhh9msV655iqE4ZD/pGaoLsdzKlE+NYs13BiZft+2VYYBriFnj8z2CXsAnDz GTJQ== X-Gm-Message-State: AOAM531T3HVegAKC1eKjfN6BXOsyaFoFUvl2IYSm96a5dPfKp92vHNFT VPJusBHSkKyafyjlXepIRH2vCA== X-Google-Smtp-Source: ABdhPJzETa4MczoRGs7mYQ0dXnKrOtMxvES9MyWi4u+wA7dj9vd6Y/oCpSpW9KkSVn3FTXPKVneP8w== X-Received: by 2002:a1c:e409:: with SMTP id b9mr4220413wmh.63.1622822583730; Fri, 04 Jun 2021 09:03:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d5sm6880344wrb.16.2021.06.04.09.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 09:02:56 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C398B1FFBE; Fri, 4 Jun 2021 16:53:17 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v16 39/99] target/arm: move arm_cpu_list to common_cpu Date: Fri, 4 Jun 2021 16:52:12 +0100 Message-Id: <20210604155312.15902-40-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210604155312.15902-1-alex.bennee@linaro.org> References: <20210604155312.15902-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.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=unavailable 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Richard Henderson , Claudio Fontana , Peter Maydell Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Claudio Fontana Signed-off-by: Claudio Fontana Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- target/arm/cpu-common.c | 42 +++++++++++++++++++++++++++++++++++++++++ target/arm/tcg/helper.c | 41 ---------------------------------------- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/target/arm/cpu-common.c b/target/arm/cpu-common.c index 93aea216cc..f4a3780e9e 100644 --- a/target/arm/cpu-common.c +++ b/target/arm/cpu-common.c @@ -8,6 +8,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/qemu-print.h" #include "qom/object.h" #include "qapi/qapi-commands-machine-target.h" #include "qapi/error.h" @@ -353,3 +354,44 @@ uint64_t arm_sctlr(CPUARMState *env, int el) } return env->cp15.sctlr_el[el]; } + +/* Sort alphabetically by type name, except for "any". */ +static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b) +{ + ObjectClass *class_a = (ObjectClass *)a; + ObjectClass *class_b = (ObjectClass *)b; + const char *name_a, *name_b; + + name_a = object_class_get_name(class_a); + name_b = object_class_get_name(class_b); + if (strcmp(name_a, "any-" TYPE_ARM_CPU) == 0) { + return 1; + } else if (strcmp(name_b, "any-" TYPE_ARM_CPU) == 0) { + return -1; + } else { + return strcmp(name_a, name_b); + } +} + +static void arm_cpu_list_entry(gpointer data, gpointer user_data) +{ + ObjectClass *oc = data; + const char *typename; + char *name; + + typename = object_class_get_name(oc); + name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU)); + qemu_printf(" %s\n", name); + g_free(name); +} + +void arm_cpu_list(void) +{ + GSList *list; + + list = object_class_get_list(TYPE_ARM_CPU, false); + list = g_slist_sort(list, arm_cpu_list_compare); + qemu_printf("Available CPUs:\n"); + g_slist_foreach(list, arm_cpu_list_entry, NULL); + g_slist_free(list); +} diff --git a/target/arm/tcg/helper.c b/target/arm/tcg/helper.c index b9ea043f20..0e3f403e56 100644 --- a/target/arm/tcg/helper.c +++ b/target/arm/tcg/helper.c @@ -552,47 +552,6 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) } -/* Sort alphabetically by type name, except for "any". */ -static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a = (ObjectClass *)a; - ObjectClass *class_b = (ObjectClass *)b; - const char *name_a, *name_b; - - name_a = object_class_get_name(class_a); - name_b = object_class_get_name(class_b); - if (strcmp(name_a, "any-" TYPE_ARM_CPU) == 0) { - return 1; - } else if (strcmp(name_b, "any-" TYPE_ARM_CPU) == 0) { - return -1; - } else { - return strcmp(name_a, name_b); - } -} - -static void arm_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - const char *typename; - char *name; - - typename = object_class_get_name(oc); - name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU)); - qemu_printf(" %s\n", name); - g_free(name); -} - -void arm_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_ARM_CPU, false); - list = g_slist_sort(list, arm_cpu_list_compare); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, arm_cpu_list_entry, NULL); - g_slist_free(list); -} - /* Sign/zero extend */ uint32_t HELPER(sxtb16)(uint32_t x) {