From patchwork Mon Dec 19 21:10:33 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: 635129 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2563312pvb; Mon, 19 Dec 2022 13:12:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4aLlXCdUuD20CamazxJtXxJ0x4dUlnxCZxvrtWDnBCNkwNnU09VMo+rQJRbTgBhhBQB4+m X-Received: by 2002:ad4:442d:0:b0:4c7:4574:1bb with SMTP id e13-20020ad4442d000000b004c7457401bbmr54646621qvt.40.1671484354892; Mon, 19 Dec 2022 13:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671484354; cv=none; d=google.com; s=arc-20160816; b=DhPTUMqbhbp8wtZCS/Pl0MKeZMgdE5Flta47WZEo0waadbKlPRBIJPn9VeTIl+9/gD U/fDtt3woYKgGxISpeBNm8Ps6euqQuIk1bDjupdrE5QrWiZR5xLHfLp1UcIJI3p+n73m ZUbPMm1CUKefToA3A+SDsmN9kpY5Y8q9RI2J/tF4DBeefJnGjoRJgOeoYEIkYvRt6YWE Yog+aOIF0N6tfCbI6blhDAWdYFV1GzjBDtqgHTRfqf93mWJdLzmtTZXAfi0Exc3GygDh RrVYXcwTNFAMgQig0gkbA2lU0Fm9NSqg/bJR6wSEDIoPGrYpQ+gpsbExCfnjbhVop4TE PBvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fo8+Ahgs2QuUhudL1bZYU1hHDGowGkitN9gc7X0zF9w=; b=K+swvrEKvgr+hU/jdeYAhkeWDYs3+EOzlijzWSK6oEEfbDVW6PzTqk7Hfs/LvKq+nz qr/f0iry2Rf1UdEL9pk3Z+33E4LauzpOTMzEzJQGzLBRJyVgpOb2SGF6pNrWkc+2epcK B93NRn9CJNo0Nr91TBf4xTVmGhKqMcPA0S5ih9adCePXI+52se0NAdhZYie19CNy27NP OLzI4SJ/0zngDUoEoRCp6gwzKBdnDTDRMSzUNt1JvYYQqBxfUlgxc0hwOoa90kNcASjL 2wnPMMpYXBcpsFMhrapcj+e5cD6Smw7HSHKQAWrTFNmZnIyiMKqiOT4LzJlJGHgobe/9 XhVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwWRwVNh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kf10-20020a056214524a00b004c7528af8b6si4072127qvb.517.2022.12.19.13.12.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Dec 2022 13:12:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwWRwVNh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7NPZ-000305-6I; Mon, 19 Dec 2022 16:11:01 -0500 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 1p7NPX-0002zO-3l for qemu-devel@nongnu.org; Mon, 19 Dec 2022 16:10:59 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7NPV-0003sZ-CF for qemu-devel@nongnu.org; Mon, 19 Dec 2022 16:10:58 -0500 Received: by mail-ed1-x533.google.com with SMTP id d20so14836810edn.0 for ; Mon, 19 Dec 2022 13:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fo8+Ahgs2QuUhudL1bZYU1hHDGowGkitN9gc7X0zF9w=; b=bwWRwVNh2H7W4miRdmLssxNZTL/y1dZLH6m5SYn9FpC44e28GsvLhRY1ssiC3mHCB+ ZPZI/qTcfD6joEfptKsF6ndj1LtzAfH5a2hg6sgk6YBU/f5OPfWFdDvRe5GE0+BhmiOz qhjI/mOnAKCiT8duygu4gtutG47OAoWhXqx+KzT3HYLsJk5VMn+iZ+oGYLEUJl9XkpVI +hU9oOEUNm2/4HvBv1R4VVpOLShNj//9LEoVUXx1sq6cYwoALaJXlHGd7/5KyVQJY8zt qBj9HPvoAyKNf61cnvy9bkqqjdSmtsOyu7TuxqpmKWcxZ6AGBOGNyxcd8qIEMFAqTnxl AFhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fo8+Ahgs2QuUhudL1bZYU1hHDGowGkitN9gc7X0zF9w=; b=x8WyRl451OvtZVHEPjIvkhb9f+j7BZsjpx/x/Tcrcg2d4TEyaUah9gNRzBK0Bv1UHn HH4DypcV6N/wFFB0YVvc7OjJd4c9169oTVNjn7L4B4TmD4Bk0IbB/F11wKXEeysU+1fY Pva5hCPD+fl2XQ4dXu49LLSTEXRYXZn3qk0cQa2+YQNKixBOJ7803Kj3FjWKdE5KiW+4 aWocuvCNh1NoGyY8pGaMYSQoAHsFDXrD8pcDfIwHjU5N4IKENHysGnYIBlYA0NnuxXyU p5VXnBwh9AOHbl2TkGvr5LVfmsT0Ee0O+kzBNOQo4ZSxwOG1iUALzlqOuWlpQ5l/6XU3 u1/A== X-Gm-Message-State: ANoB5pll8NLH2FcHWNEam9qNfMnNtBLuHQtlotXY65e8T29smqPIgkG5 vcloE5SzG87BdEO4yq0n74Zfd/sa3Lt/YXhRuCM= X-Received: by 2002:a05:6402:3895:b0:468:354a:4d6 with SMTP id fd21-20020a056402389500b00468354a04d6mr20912433edb.20.1671484256379; Mon, 19 Dec 2022 13:10:56 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p6-20020a056402500600b0046ac017b007sm4769122eda.18.2022.12.19.13.10.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Dec 2022 13:10:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Huacai Chen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Xiaojuan Yang , Daniel Henrique Barboza , Aleksandar Rikalo , Aurelien Jarno , Peter Maydell , David Gibson , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Jiaxun Yang , Greg Kurz , Song Gao Subject: [PATCH 3/4] target/mips: Restrict 'qapi-commands-machine.h' to system emulation Date: Mon, 19 Dec 2022 22:10:33 +0100 Message-Id: <20221219211034.70491-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221219211034.70491-1-philmd@linaro.org> References: <20221219211034.70491-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=philmd@linaro.org; helo=mail-ed1-x533.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since commit a0e61807a3 ("qapi: Remove QMP events and commands from user-mode builds") we don't generate the "qapi-commands-machine.h" header in a user-emulation-only build. Extract the QMP functions from cpu.c (which is always compiled) to the new 'sysemu/monitor.c' unit (which is only compiled when system emulation is selected). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/mips/cpu.c | 29 ------------------------- target/mips/sysemu/meson.build | 1 + target/mips/sysemu/monitor.c | 39 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 target/mips/sysemu/monitor.c diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 7a565466cb..7a37123419 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -32,7 +32,6 @@ #include "hw/qdev-properties.h" #include "hw/qdev-clock.h" #include "semihosting/semihost.h" -#include "qapi/qapi-commands-machine-target.h" #include "fpu_helper.h" const char regnames[32][3] = { @@ -627,34 +626,6 @@ static void mips_cpu_register_types(void) type_init(mips_cpu_register_types) -static void mips_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CpuDefinitionInfoList **cpu_list = user_data; - CpuDefinitionInfo *info; - const char *typename; - - typename = object_class_get_name(oc); - info = g_malloc0(sizeof(*info)); - info->name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_MIPS_CPU)); - info->q_typename = g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} - -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - - list = object_class_get_list(TYPE_MIPS_CPU, false); - g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); - g_slist_free(list); - - return cpu_list; -} - /* Could be used by generic CPU object */ MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk) { diff --git a/target/mips/sysemu/meson.build b/target/mips/sysemu/meson.build index cefc227582..0e424c9cc6 100644 --- a/target/mips/sysemu/meson.build +++ b/target/mips/sysemu/meson.build @@ -3,5 +3,6 @@ mips_softmmu_ss.add(files( 'cp0.c', 'cp0_timer.c', 'machine.c', + 'monitor.c', 'physaddr.c', )) diff --git a/target/mips/sysemu/monitor.c b/target/mips/sysemu/monitor.c new file mode 100644 index 0000000000..6db4626412 --- /dev/null +++ b/target/mips/sysemu/monitor.c @@ -0,0 +1,39 @@ +/* + * QEMU MIPS CPU (monitor definitions) + * + * SPDX-FileCopyrightText: 2012 SUSE LINUX Products GmbH + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-machine-target.h" +#include "cpu.h" + +static void mips_cpu_add_definition(gpointer data, gpointer user_data) +{ + ObjectClass *oc = data; + CpuDefinitionInfoList **cpu_list = user_data; + CpuDefinitionInfo *info; + const char *typename; + + typename = object_class_get_name(oc); + info = g_malloc0(sizeof(*info)); + info->name = g_strndup(typename, + strlen(typename) - strlen("-" TYPE_MIPS_CPU)); + info->q_typename = g_strdup(typename); + + QAPI_LIST_PREPEND(*cpu_list, info); +} + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + CpuDefinitionInfoList *cpu_list = NULL; + GSList *list; + + list = object_class_get_list(TYPE_MIPS_CPU, false); + g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); + g_slist_free(list); + + return cpu_list; +}