From patchwork Thu Apr 25 11:01:34 2024 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: 13643127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7F020C4345F for ; Thu, 25 Apr 2024 11:03:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwro-0007ka-G3; Thu, 25 Apr 2024 07:02:16 -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 1rzwrj-0007ju-R1 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:12 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwrg-00088I-Th for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:11 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-418e4cd2196so6833835e9.1 for ; Thu, 25 Apr 2024 04:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042927; x=1714647727; darn=nongnu.org; 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=wjoLmpbwfS6wFuFSJimySduX47ZEmh3QOL6abPkvr5o=; b=LiSA7jOVkbTokpNSinr3zsFN61oPTSKAuVYvpHfbHxwIk+tJAek43Wlr7awXyBC3/V DH5Q8v1rO/VFtXzpKiVCaqtH299eXylf3Xjx+r+EikvMffQg3UGS0ChbbEH52Qxuo6H9 Qoe+S0gFCgOpxhny2r1+51pgBJOOc0EcpNi1jBcItdH18SLba5xCaalowv+cFYuAflDq chgAS5l9hZNOJYVOgOdWF4U3btPV1/1i4FpLeC+LnO3ru8gDZ6FUYKUYKvHcIsNYH6dd s8MA1FP5W3zvPN5TOTx6Ff8lg1VRMRzpGkj3//vj7LeTqIWU+zleYuIc9g4FZPGI/0kQ NMDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042927; x=1714647727; 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=wjoLmpbwfS6wFuFSJimySduX47ZEmh3QOL6abPkvr5o=; b=HDTJfggxeqpht4dLrBO4cAEbs1EMibxVvLaYq/lib0uSDCYs42AXrcGh9HqV9DnL0O 5idTv6rG/1FAWgzES+iVCoRwEgJIn2rgPeuoBXvsO1kZjU3K1dmVW8hagqDnkB8AdIiD 2KUKkkFA/WPZTMvVFIiSQHzGcv19s4d3vdyT4MCFYjvnbXJXavWykn0wDPb2lYuUV5dM JQwsDdsSkr8Ay5dumv7Rj7UI69oasHdnsISQt/ez6J/etG5j0VcREB0cPtO3yd2nGjsq fCiGVBbRolpIG/dZzMSOMAh3mUrU0CeBmV6XGRRtOn2Nw/7e2G1isAEP0mNhVpZ0N1Yg dOVg== X-Gm-Message-State: AOJu0YwKZMPFtO4SkAf90iPtMw6HuJbk6GqtgiXN+yymvcjM0v/rVBa8 +3P+jDlAVS478e1PDrNIJnyTYlpnc4qFBkkl+fbKN/ll5KZ6ijQNdFKX9hulMKb95ILuMTTzmjp 1 X-Google-Smtp-Source: AGHT+IHQ2mv+CeJro9jqWlhkOIlmdcn/MGtTGdAo7lLFcltymnD0f4bSsdMfj0nsoNTC4MxDjpUT3w== X-Received: by 2002:adf:efcf:0:b0:347:d21:6855 with SMTP id i15-20020adfefcf000000b003470d216855mr3965037wrp.14.1714042925092; Thu, 25 Apr 2024 04:02:05 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id b16-20020a5d40d0000000b00346406a5c80sm19587104wrq.32.2024.04.25.04.02.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Maksim Davydov , Vladimir Sementsov-Ogievskiy , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Subject: [PULL 01/22] qom: add default value Date: Thu, 25 Apr 2024 13:01:34 +0200 Message-ID: <20240425110157.20328-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Maksim Davydov qmp_qom_list_properties can print default values if they are available as qmp_device_list_properties does, because both of them use the ObjectPropertyInfo structure with default_value field. This can be useful when working with "not device" types (e.g. memory-backend). Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Message-ID: <20240318213550.155573-2-davydov-max@yandex-team.ru> Signed-off-by: Philippe Mathieu-Daudé --- qom/qom-qmp-cmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 7c087299de..e91a235347 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -212,6 +212,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename, info->name = g_strdup(prop->name); info->type = g_strdup(prop->type); info->description = g_strdup(prop->description); + info->default_value = qobject_ref(prop->defval); QAPI_LIST_PREPEND(prop_list, info); } From patchwork Thu Apr 25 11:01:35 2024 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: 13643132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 920C2C41513 for ; Thu, 25 Apr 2024 11:04:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwru-0007oC-FM; Thu, 25 Apr 2024 07:02:22 -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 1rzwrq-0007lf-P9 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:18 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwrn-00089U-Q5 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:18 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2dd041acff1so9300301fa.1 for ; Thu, 25 Apr 2024 04:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042933; x=1714647733; darn=nongnu.org; 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=vLZ+JSbydZ+0P9XLjVkCEIbh5VWxC42GBVm2ZIIKLSk=; b=J4G96lAURIAg+kmcYhgjVDW9HYr8wnW1rI66EHq9itxF++2G7BpXZcwRrHgspLFJz4 qXJTpVMA6A2XKRpDYkHZBFX8QDaLENEum298A7VBXw2BMfsS8QoTdQ28D7fT21wi4a1D CsXRg96wAghBks2Imv6xfFZjyZiPfg1PEEEeI3IjEREz2VbKN5E5+h/a7Mw39G+emooP IEWrMMiz9Bcjkev0ZR9KT9uCTNR+ar/BdFTgRDywXF6PSbbyXcvquk897uBj+GWe50Uq VpyUyv7T6C1Dnpr++Csov+MXkZFOhEUBUTHaWUj1pl/1iSRU/YikE65P4g1Gm9hIbiHD lUsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042933; x=1714647733; 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=vLZ+JSbydZ+0P9XLjVkCEIbh5VWxC42GBVm2ZIIKLSk=; b=ffuy7P8zXZeuSPIP6zmD14irKv+c+Wk/lp5rsmLPzaxGy2caDll2Ss2e4ipnzzwiFi TBHDg8mgQm8Q8P9lVZf4zB8Q4hADG5IR/Rd041irekAc27v0EYR5VLASlgNKi98PF4aG JYN7MYe0zITWifDyNNIazovrxUGslCHwLJtBpxbtcFJcfk2fiNl62ai28q2wqV38Rbl8 GYfWJBVu3V05SxNtNO9cTHdtOBPKHjrKJRIp+BvAjP2M25kxIiMooLwV+VNWxQ0YSDEn C7q4Chhs6rNTO1/qO5/gqNdTKYCHWcT5RuNYWOjexPxaxldlMGKZ5CEJTJu6UV94GNjP 8xqg== X-Gm-Message-State: AOJu0YxJhgKQkZwQV1LlUZn0z3RJnmzas0cVWirIufHKulMc1Gqux/Go itGlXPjZxiCiu/PQd7kl7kiZ6SXoVA1e4y30ASX0w1sftbL24KXi5O8kU8cNsy+G15kheN91cT1 Z X-Google-Smtp-Source: AGHT+IEIwEKtRxzjDxE5XZKOER0BztzWhqxqJNsv78wTLrxRgsPNwlOo5sgeR9LyeZoBJnnXiQJaKA== X-Received: by 2002:a2e:88d1:0:b0:2dd:2fc:3cd with SMTP id a17-20020a2e88d1000000b002dd02fc03cdmr3419727ljk.29.1714042933255; Thu, 25 Apr 2024 04:02:13 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id bi14-20020a05600c3d8e00b0041b5944a197sm1195465wmb.45.2024.04.25.04.02.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Maksim Davydov , Vladimir Sementsov-Ogievskiy , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Eric Blake , Alexander Bulekov , Paolo Bonzini , Bandan Das , Stefan Hajnoczi , Thomas Huth , Darren Kenny , Qiuhao Li , Laurent Vivier Subject: [PULL 02/22] qmp: add dump machine type compatibility properties Date: Thu, 25 Apr 2024 13:01:35 +0200 Message-ID: <20240425110157.20328-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=philmd@linaro.org; helo=mail-lj1-x22f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Maksim Davydov To control that creating new machine type doesn't affect the previous types (their compat_props) and to check complex compat_props inheritance we need qmp command to print machine type compatibility properties. This patch adds the ability to get list of all the compat_props of the corresponding supported machines for their comparison via new optional argument of "query-machines" command. Since information on compatibility properties can increase the command output by a factor of 40, add an argument to enable it, default off. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster Message-ID: <20240318213550.155573-3-davydov-max@yandex-team.ru> Signed-off-by: Philippe Mathieu-Daudé --- qapi/machine.json | 67 +++++++++++++++++++++++++++++++++++-- hw/core/machine-qmp-cmds.c | 23 ++++++++++++- tests/qtest/fuzz/qos_fuzz.c | 2 +- 3 files changed, 88 insertions(+), 4 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 2df407e877..3e9cc3f17d 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -135,6 +135,26 @@ ## { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } +## +# @CompatProperty: +# +# Property default values specific to a machine type, for use by +# scripts/compare-machine-types. +# +# @qom-type: name of the QOM type to which the default applies +# +# @property: name of its property to which the default applies +# +# @value: the default value (machine-specific default can overwrite +# the "default" default, to avoid this use -machine none) +# +# Since: 9.1 +## +{ 'struct': 'CompatProperty', + 'data': { 'qom-type': 'str', + 'property': 'str', + 'value': 'str' } } + ## # @MachineInfo: # @@ -166,6 +186,14 @@ # # @acpi: machine type supports ACPI (since 8.0) # +# @compat-props: The machine type's compatibility properties. Only +# present when query-machines argument @compat-props is true. +# (since 9.1) +# +# Features: +# +# @unstable: Member @compat-props is experimental. +# # Since: 1.2 ## { 'struct': 'MachineInfo', @@ -173,18 +201,53 @@ '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', 'deprecated': 'bool', '*default-cpu-type': 'str', - '*default-ram-id': 'str', 'acpi': 'bool' } } + '*default-ram-id': 'str', 'acpi': 'bool', + '*compat-props': { 'type': ['CompatProperty'], + 'features': ['unstable'] } } } ## # @query-machines: # # Return a list of supported machines # +# @compat-props: if true, also return compatibility properties. +# (default: false) (since 9.1) +# +# Features: +# +# @unstable: Argument @compat-props is experimental. +# # Returns: a list of MachineInfo # # Since: 1.2 +# +# Example: +# +# -> { "execute": "query-machines", "arguments": { "compat-props": true } } +# <- { "return": [ +# { +# "hotpluggable-cpus": true, +# "name": "pc-q35-6.2", +# "compat-props": [ +# { +# "qom-type": "virtio-mem", +# "property": "unplugged-inaccessible", +# "value": "off" +# } +# ], +# "numa-mem-supported": false, +# "default-cpu-type": "qemu64-x86_64-cpu", +# "cpu-max": 288, +# "deprecated": false, +# "default-ram-id": "pc.ram" +# }, +# ... +# } ## -{ 'command': 'query-machines', 'returns': ['MachineInfo'] } +{ 'command': 'query-machines', + 'data': { '*compat-props': { 'type': 'bool', + 'features': [ 'unstable' ] } }, + 'returns': ['MachineInfo'] } ## # @CurrentMachineParams: diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index c20829b9ae..5972100b1f 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -64,7 +64,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) return head; } -MachineInfoList *qmp_query_machines(Error **errp) +MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props, + Error **errp) { GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false); MachineInfoList *mach_list = NULL; @@ -96,6 +97,26 @@ MachineInfoList *qmp_query_machines(Error **errp) info->default_ram_id = g_strdup(mc->default_ram_id); } + if (compat_props && mc->compat_props) { + int i; + info->compat_props = NULL; + CompatPropertyList **tail = &(info->compat_props); + info->has_compat_props = true; + + for (i = 0; i < mc->compat_props->len; i++) { + GlobalProperty *mt_prop = g_ptr_array_index(mc->compat_props, + i); + CompatProperty *prop; + + prop = g_malloc0(sizeof(*prop)); + prop->qom_type = g_strdup(mt_prop->driver); + prop->property = g_strdup(mt_prop->property); + prop->value = g_strdup(mt_prop->value); + + QAPI_LIST_APPEND(tail, prop); + } + } + QAPI_LIST_PREPEND(mach_list, info); } diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index e403d373a0..b71e945c5f 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -46,7 +46,7 @@ static void qos_set_machines_devices_available(void) MachineInfoList *mach_info; ObjectTypeInfoList *type_info; - mach_info = qmp_query_machines(&error_abort); + mach_info = qmp_query_machines(false, false, &error_abort); machines_apply_to_node(mach_info); qapi_free_MachineInfoList(mach_info); From patchwork Thu Apr 25 11:01:36 2024 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: 13643128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F00D9C19F4F for ; Thu, 25 Apr 2024 11:03:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwrw-0007p7-OL; Thu, 25 Apr 2024 07:02:24 -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 1rzwrv-0007od-F5 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:23 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwrs-0008Ai-Jk for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:23 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-34c1fff534fso204561f8f.1 for ; Thu, 25 Apr 2024 04:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042938; x=1714647738; darn=nongnu.org; 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=eiSgNxRXT9EJcnQ8aO7qTnStvPwh3mzz93fTZzoT/NU=; b=VOrNwkjEc18XDYZn+sCdPXF09AvzrAv6uTFbdrdv2L5DxNnyWPIyaLdVGDhpfwYsi1 kYBOgtZo2EATtxrtPUkJk7axCF1UcOwP+sPAOi9quSXHTl/8pP0rDcaotA1ebdLE8YLn 794fwgrGxGE0fGgraq79JHMEHJrmi6qSjh2a0ATvlUqnKDMOj16WF+qPUnEMxnjfk+6O Rm1Kg7UmsqEMNJI1glB2I04m1v8ab5iZVGB7p539WX/rrkpXA0eG0qzTuZ8oZFHPfUHN watrBGVN9V0GnLIajZHkP4DwY05b6OxQvC5xqaUW9ZPaNPJ5Qjs68BxwfXyPCpYMyxyW CGeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042938; x=1714647738; 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=eiSgNxRXT9EJcnQ8aO7qTnStvPwh3mzz93fTZzoT/NU=; b=T+dLKBBBg57vOE121PBtb/o8j/mXbN8mCL9WIqWqsOwOPrtLdviadIyaVTolw7xSho au1Xbyv+bmnMtC7yTR+9p2/1L4ckDlB7JhPaAWQHGYrMz6hsdeHV7xaI0EWqn6A0QzNE LIioyvJ/AGZR5Cx6NfKTlkqxc8n4ydPsnfV5WERE8iF72FS4FjUJmlDuP3kGgwJYTvsE t5uqZDZL0qEUXw0GXrtMkjsDCeoVDwykciTzEDQcTepCrjicuiygR0X/0AcBeBF96Eui /RgumpeF4e/2FU4my8okpdg6PMH2Pnwn3bqXOy3CRbreU7z3Q4dSbvzd8s/jor/GC98J 9YUg== X-Gm-Message-State: AOJu0Yw1PGSn5JAv/Mbpb4hfRvMsv2F6WNaUvW16E+XJ/UApLBpRPBZ2 TlbFEMDfRBc9e0J1YKhp+SxgKJWMl1Ec91F9lVlZoyqcr4fYwlEba0cAdEvfZkV9gf2gd9J+YxB R X-Google-Smtp-Source: AGHT+IGhQJMdjUzfkRipN6K78u1AWPOja9RuLHySGruzAQvqzc+/THb5+/v0sO6OeHnLbaa6kJroSQ== X-Received: by 2002:adf:f34d:0:b0:34c:233e:f40c with SMTP id e13-20020adff34d000000b0034c233ef40cmr522061wrp.7.1714042938701; Thu, 25 Apr 2024 04:02:18 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id p3-20020a5d6383000000b00341b451a31asm19488279wru.36.2024.04.25.04.02.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Maksim Davydov , John Snow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cleber Rosa , Beraldo Leal Subject: [PULL 03/22] python/qemu/machine: add method to retrieve QEMUMachine::binary field Date: Thu, 25 Apr 2024 13:01:36 +0200 Message-ID: <20240425110157.20328-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Maksim Davydov Add a supportive property to access the path to the QEMU binary Signed-off-by: Maksim Davydov Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240318213550.155573-4-davydov-max@yandex-team.ru> Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/machine/machine.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 31cb9d617d..f648f6af45 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -328,6 +328,11 @@ def args(self) -> List[str]: """Returns the list of arguments given to the QEMU binary.""" return self._args + @property + def binary(self) -> str: + """Returns path to the QEMU binary""" + return self._binary + def _pre_launch(self) -> None: if self._qmp_set: if self._monitor_address is None: From patchwork Thu Apr 25 11:01:37 2024 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: 13643130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9A120C19F4F for ; Thu, 25 Apr 2024 11:04:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwsF-0007z6-E3; Thu, 25 Apr 2024 07:02:43 -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 1rzws4-0007rD-L1 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:32 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwry-0008Ce-Mo for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:32 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41b51ee24f9so2079645e9.1 for ; Thu, 25 Apr 2024 04:02:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042945; x=1714647745; darn=nongnu.org; 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=5bWeBXj+Rcq1Ig4OiKi3ZYcboAcFHPofG2jdDBnd1oA=; b=xEw86AMvlTBI45QwaA88bFzsSXzgIU0/kRewvIUfr7aNKK7auG80Ghns65spgpLi1z bnDYNf9WM5ewD2NF8gxQA7NUJL7eBHfgtoNJrBAX8aKp6975f1rT3vgXrVLmHhJNoLtZ n3iOPVC5QUxSE9esAXR0ha1QhwYCTEwkPNzVW9bbBi8KdMGcBqis+Aedo4ZT7he7/TqB FIlkRj1WGG9fChyzrERBVAMeXFZcskWLKaplBscenUhSrBGalEaefQcUBIyoSzxQHOQL 0bKfEe6G1/mYw9dHeAhymrH7i44e0soEgpfW7FDGeNFV3SlkSyJS0RKAH2dD2ep/d+Je i2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042945; x=1714647745; 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=5bWeBXj+Rcq1Ig4OiKi3ZYcboAcFHPofG2jdDBnd1oA=; b=kpO5AbLYQZzy6bg1z7H97mHbhCYpT2IseuJ8/RLesU2dWNRh5+O3ZYA5SeSgMSyfqS tY/NZJGFPtNP7mOND3XCABWQK0mVvi+TiM9SRPWhc3py3YOvTYTC4pJeJPDZYvm7U1rG DmQpKb+WVO8rMtYs3dkVGAaKH5Q4SCE+Xfb1Xl0JovnOz2QrJdi5ENDreVYeXXG1nRv9 BxkMTXTSxZp4SsOXPrmti4z5PVdjsvdvdlJ/QQFLrdVhe6ehc1Cezlp9mks12W1YA6CB oN+/o+DdmGBquGN1v/8UrJSplFsJjy0AUPd5vNTRkkdu2GnH/6apTO4R1RFOCwdjFuUb IpZw== X-Gm-Message-State: AOJu0YyrSIXpWTyX+/qO/QmwsxlN1Y7ciN0Zr7xfF5v1B/Sdi8qWxLIv 1ocWWFLqnWV5C3aBQQGx+yy85B5S0jscc152l/PXOMmLwS73QNN6bsG7RGfWEJXUqzEDE94Mlc3 k X-Google-Smtp-Source: AGHT+IEUMYXRqiLIWFxxroPfzW46L2BAQ+t0dFyu9IXEw/UtsPz1ZgY9ZMFFqavmpayk845iwOWhQw== X-Received: by 2002:a05:600c:4fc4:b0:418:98fc:a46a with SMTP id o4-20020a05600c4fc400b0041898fca46amr2040794wmq.15.1714042944275; Thu, 25 Apr 2024 04:02:24 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id z9-20020a05600c0a0900b00418916f5848sm26698328wmp.43.2024.04.25.04.02.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Maksim Davydov , Vladimir Sementsov-Ogievskiy , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa Subject: [PULL 04/22] scripts: add script to compare compatibility properties Date: Thu, 25 Apr 2024 13:01:37 +0200 Message-ID: <20240425110157.20328-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Maksim Davydov This script runs QEMU to obtain compat_props of machines and default values of different types of drivers to produce comparison table. This table can be used to compare machine types to choose the most suitable machine or compare binaries to be sure that migration to the newer version will save all device properties. Also the json or csv format of this table can be used to check does a new machine affect the previous ones by comparing tables with and without the new machine. Default values (that will be used without machine compat_props) of properties are needed to fill "holes" in the table (one machine has the property but another machine not. For instance, 2.12 machine has `{ "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }`, but compat_pros of 3.1 machine doesn't have it. Thus, to compare these machines we need to get unknown value of "EPYC-x86_64-cpu-xlevel" for 3.1 machine. These unknown values in the table are called "holes". To get values for these "holes" the script uses list of appropriate methods.) Notes: * Some init values from the devices can't be available like properties from virtio-9p when configure has --disable-virtfs. This situations will be seen in the table as "unavailable driver". * Default values can be obtained in an unobvious way, like x86 features. If the script doesn't know how to get property default value to compare one machine with another it fills "holes" with "unavailable method". This is done because script uses whitelist model to get default values of different types. It means that the method that can't be applied to a new type that can crash this script. It is better to get an "unavailable driver" when creating a new machine with new compatible properties than to break this script. So it turns out a more stable and generic script. * If the default value can't be obtained because this property doesn't exist or because this property can't have default value, appropriate "hole" will be filled by "unknown property" or "no default value" * If the property is applied to the abstract class, the script collects default values from all child classes and prints all these classes * Raw table (--raw flag) should be used with json/csv parameters for scripts and etc. Human-readable (default) format contains transformed and simplified values and it doesn't contain lines with the same values in columns Example: ./scripts/compare-machine-types.py --mt pc-q35-6.2 pc-q35-7.1 ╒══════════════════╤══════════════════════════╤════════════════════════════╤════════════════════════════╕ │ Driver │ Property │ build/qemu-system-x86_64 │ build/qemu-system-x86_64 │ │ │ │ pc-q35-6.2 │ pc-q35-7.1 │ ╞══════════════════╪══════════════════════════╪════════════════════════════╪════════════════════════════╡ │ PIIX4_PM │ x-not-migrate-acpi-index │ True │ False │ ├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤ │ arm-gicv3-common │ force-8-bit-prio │ True │ unavailable driver │ ├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤ │ nvme-ns │ eui64-default │ True │ False │ ├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤ │ virtio-mem │ unplugged-inaccessible │ False │ auto │ ╘══════════════════╧══════════════════════════╧════════════════════════════╧════════════════════════════╛ Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy Message-ID: <20240318213550.155573-5-davydov-max@yandex-team.ru> Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 5 + scripts/compare-machine-types.py | 486 +++++++++++++++++++++++++++++++ 2 files changed, 491 insertions(+) create mode 100755 scripts/compare-machine-types.py diff --git a/MAINTAINERS b/MAINTAINERS index 8bb32f4a7e..118206c3e0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4229,3 +4229,8 @@ Code Coverage Tools M: Alex Bennée S: Odd Fixes F: scripts/coverage/ + +Machine development tool +M: Maksim Davydov +S: Supported +F: scripts/compare-machine-types.py diff --git a/scripts/compare-machine-types.py b/scripts/compare-machine-types.py new file mode 100755 index 0000000000..2af3995eb8 --- /dev/null +++ b/scripts/compare-machine-types.py @@ -0,0 +1,486 @@ +#!/usr/bin/env python3 +# +# Script to compare machine type compatible properties (include/hw/boards.h). +# compat_props are applied to the driver during initialization to change +# default values, for instance, to maintain compatibility. +# This script constructs table with machines and values of their compat_props +# to compare and to find places for improvements or places with bugs. If +# during the comparison, some machine type doesn't have a property (it is in +# the comparison table because another machine type has it), then the +# appropriate method will be used to obtain the default value of this driver +# property via qmp command (e.g. query-cpu-model-expansion for x86_64-cpu). +# These methods are defined below in qemu_property_methods. +# +# Copyright (c) Yandex Technologies LLC, 2023 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . + +import sys +from os import path +from argparse import ArgumentParser, RawTextHelpFormatter, Namespace +import pandas as pd +from contextlib import ExitStack +from typing import Optional, List, Dict, Generator, Tuple, Union, Any, Set + +try: + qemu_dir = path.abspath(path.dirname(path.dirname(__file__))) + sys.path.append(path.join(qemu_dir, 'python')) + from qemu.machine import QEMUMachine +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.") + print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir") + sys.exit(1) + + +default_qemu_args = '-enable-kvm -machine none' +default_qemu_binary = 'build/qemu-system-x86_64' + + +# Methods for gettig the right values of drivers properties +# +# Use these methods as a 'whitelist' and add entries only if necessary. It's +# important to be stable and predictable in analysis and tests. +# Be careful: +# * Class must be inherited from 'QEMUObject' and used in new_driver() +# * Class has to implement get_prop method in order to get values +# * Specialization always wins (with the given classes for 'device' and +# 'x86_64-cpu', method of 'x86_64-cpu' will be used for '486-x86_64-cpu') + +class Driver(): + def __init__(self, vm: QEMUMachine, name: str, abstract: bool) -> None: + self.vm = vm + self.name = name + self.abstract = abstract + self.parent: Optional[Driver] = None + self.property_getter: Optional[Driver] = None + + def get_prop(self, driver: str, prop: str) -> str: + if self.property_getter: + return self.property_getter.get_prop(driver, prop) + else: + return 'Unavailable method' + + def is_child_of(self, parent: 'Driver') -> bool: + """Checks whether self is (recursive) child of @parent""" + cur_parent = self.parent + while cur_parent: + if cur_parent is parent: + return True + cur_parent = cur_parent.parent + + return False + + def set_implementations(self, implementations: List['Driver']) -> None: + self.implementations = implementations + + +class QEMUObject(Driver): + def __init__(self, vm: QEMUMachine, name: str) -> None: + super().__init__(vm, name, True) + + def set_implementations(self, implementations: List[Driver]) -> None: + self.implementations = implementations + + # each implementation of the abstract driver has to use property getter + # of this abstract driver unless it has specialization. (e.g. having + # 'device' and 'x86_64-cpu', property getter of 'x86_64-cpu' will be + # used for '486-x86_64-cpu') + for impl in implementations: + if not impl.property_getter or\ + self.is_child_of(impl.property_getter): + impl.property_getter = self + + +class QEMUDevice(QEMUObject): + def __init__(self, vm: QEMUMachine) -> None: + super().__init__(vm, 'device') + self.cached: Dict[str, List[Dict[str, Any]]] = {} + + def get_prop(self, driver: str, prop_name: str) -> str: + if driver not in self.cached: + self.cached[driver] = self.vm.cmd('device-list-properties', + typename=driver) + for prop in self.cached[driver]: + if prop['name'] == prop_name: + return str(prop.get('default-value', 'No default value')) + + return 'Unknown property' + + +class QEMUx86CPU(QEMUObject): + def __init__(self, vm: QEMUMachine) -> None: + super().__init__(vm, 'x86_64-cpu') + self.cached: Dict[str, Dict[str, Any]] = {} + + def get_prop(self, driver: str, prop_name: str) -> str: + if not driver.endswith('-x86_64-cpu'): + return 'Wrong x86_64-cpu name' + + # crop last 11 chars '-x86_64-cpu' + name = driver[:-11] + if name not in self.cached: + self.cached[name] = self.vm.cmd( + 'query-cpu-model-expansion', type='full', + model={'name': name})['model']['props'] + return str(self.cached[name].get(prop_name, 'Unknown property')) + + +# Now it's stub, because all memory_backend types don't have default values +# but this behaviour can be changed +class QEMUMemoryBackend(QEMUObject): + def __init__(self, vm: QEMUMachine) -> None: + super().__init__(vm, 'memory-backend') + self.cached: Dict[str, List[Dict[str, Any]]] = {} + + def get_prop(self, driver: str, prop_name: str) -> str: + if driver not in self.cached: + self.cached[driver] = self.vm.cmd('qom-list-properties', + typename=driver) + for prop in self.cached[driver]: + if prop['name'] == prop_name: + return str(prop.get('default-value', 'No default value')) + + return 'Unknown property' + + +def new_driver(vm: QEMUMachine, name: str, is_abstr: bool) -> Driver: + if name == 'object': + return QEMUObject(vm, 'object') + elif name == 'device': + return QEMUDevice(vm) + elif name == 'x86_64-cpu': + return QEMUx86CPU(vm) + elif name == 'memory-backend': + return QEMUMemoryBackend(vm) + else: + return Driver(vm, name, is_abstr) +# End of methods definition + + +class VMPropertyGetter: + """It implements the relationship between drivers and how to get their + properties""" + def __init__(self, vm: QEMUMachine) -> None: + self.drivers: Dict[str, Driver] = {} + + qom_all_types = vm.cmd('qom-list-types', abstract=True) + self.drivers = {t['name']: new_driver(vm, t['name'], + t.get('abstract', False)) + for t in qom_all_types} + + for t in qom_all_types: + drv = self.drivers[t['name']] + if 'parent' in t: + drv.parent = self.drivers[t['parent']] + + for drv in self.drivers.values(): + imps = vm.cmd('qom-list-types', implements=drv.name) + # only implementations inherit property getter + drv.set_implementations([self.drivers[imp['name']] + for imp in imps]) + + def get_prop(self, driver: str, prop: str) -> str: + # wrong driver name or disabled in config driver + try: + drv = self.drivers[driver] + except KeyError: + return 'Unavailable driver' + + assert not drv.abstract + + return drv.get_prop(driver, prop) + + def get_implementations(self, driver: str) -> List[str]: + return [impl.name for impl in self.drivers[driver].implementations] + + +class Machine: + """A short QEMU machine type description. It contains only processed + compat_props (properties of abstract classes are applied to its + implementations) + """ + # raw_mt_dict - dict produced by `query-machines` + def __init__(self, raw_mt_dict: Dict[str, Any], + qemu_drivers: VMPropertyGetter) -> None: + self.name = raw_mt_dict['name'] + self.compat_props: Dict[str, Any] = {} + # properties are applied sequentially and can rewrite values like in + # QEMU. Also it has to resolve class relationships to apply appropriate + # values from abstract class to all implementations + for prop in raw_mt_dict['compat-props']: + driver = prop['qom-type'] + try: + # implementation adds only itself, abstract class adds + # lementation (abstract classes are uninterestiong) + impls = qemu_drivers.get_implementations(driver) + for impl in impls: + if impl not in self.compat_props: + self.compat_props[impl] = {} + self.compat_props[impl][prop['property']] = prop['value'] + except KeyError: + # QEMU doesn't know this driver thus it has to be saved + if driver not in self.compat_props: + self.compat_props[driver] = {} + self.compat_props[driver][prop['property']] = prop['value'] + + +class Configuration(): + """Class contains all necessary components to generate table and is used + to compare different binaries""" + def __init__(self, vm: QEMUMachine, + req_mt: List[str], all_mt: bool) -> None: + self._vm = vm + self._binary = vm.binary + self._qemu_args = args.qemu_args.split(' ') + + self._qemu_drivers = VMPropertyGetter(vm) + self.req_mt = get_req_mt(self._qemu_drivers, vm, req_mt, all_mt) + + def get_implementations(self, driver_name: str) -> List[str]: + return self._qemu_drivers.get_implementations(driver_name) + + def get_table(self, req_props: List[Tuple[str, str]]) -> pd.DataFrame: + table: List[pd.DataFrame] = [] + for mt in self.req_mt: + name = f'{self._binary}\n{mt.name}' + column = [] + for driver, prop in req_props: + try: + # values from QEMU machine type definitions + column.append(mt.compat_props[driver][prop]) + except KeyError: + # values from QEMU type definitions + column.append(self._qemu_drivers.get_prop(driver, prop)) + table.append(pd.DataFrame({name: column})) + + return pd.concat(table, axis=1) + + +script_desc = """Script to compare machine types (their compat_props). + +Examples: +* save info about all machines: ./scripts/compare-machine-types.py --all \ +--format csv --raw > table.csv +* compare machines: ./scripts/compare-machine-types.py --mt pc-q35-2.12 \ +pc-q35-3.0 +* compare binaries and machines: ./scripts/compare-machine-types.py \ +--mt pc-q35-6.2 pc-q35-7.0 --qemu-binary build/qemu-system-x86_64 \ +build/qemu-exp + ╒════════════╤══════════════════════════╤════════════════════════════\ +╤════════════════════════════╤══════════════════╤══════════════════╕ + │ Driver │ Property │ build/qemu-system-x86_64 \ +│ build/qemu-system-x86_64 │ build/qemu-exp │ build/qemu-exp │ + │ │ │ pc-q35-6.2 \ +│ pc-q35-7.0 │ pc-q35-6.2 │ pc-q35-7.0 │ + ╞════════════╪══════════════════════════╪════════════════════════════\ +╪════════════════════════════╪══════════════════╪══════════════════╡ + │ PIIX4_PM │ x-not-migrate-acpi-index │ True \ +│ False │ False │ False │ + ├────────────┼──────────────────────────┼────────────────────────────\ +┼────────────────────────────┼──────────────────┼──────────────────┤ + │ virtio-mem │ unplugged-inaccessible │ False \ +│ auto │ False │ auto │ + ╘════════════╧══════════════════════════╧════════════════════════════\ +╧════════════════════════════╧══════════════════╧══════════════════╛ + +If a property from QEMU machine defintion applies to an abstract class (e.g. \ +x86_64-cpu) this script will compare all implementations of this class. + +"Unavailable method" - means that this script doesn't know how to get \ +default values of the driver. To add method use the construction described \ +at the top of the script. +"Unavailable driver" - means that this script doesn't know this driver. \ +For instance, this can happen if you configure QEMU without this device or \ +if machine type definition has error. +"No default value" - means that the appropriate method can't get the default \ +value and most likely that this property doesn't have it. +"Unknown property" - means that the appropriate method can't find property \ +with this name.""" + + +def parse_args() -> Namespace: + parser = ArgumentParser(formatter_class=RawTextHelpFormatter, + description=script_desc) + parser.add_argument('--format', choices=['human-readable', 'json', 'csv'], + default='human-readable', + help='returns table in json format') + parser.add_argument('--raw', action='store_true', + help='prints ALL defined properties without value ' + 'transformation. By default, only rows ' + 'with different values will be printed and ' + 'values will be transformed(e.g. "on" -> True)') + parser.add_argument('--qemu-args', default=default_qemu_args, + help='command line to start qemu. ' + f'Default: "{default_qemu_args}"') + parser.add_argument('--qemu-binary', nargs="*", type=str, + default=[default_qemu_binary], + help='list of qemu binaries that will be compared. ' + f'Deafult: {default_qemu_binary}') + + mt_args_group = parser.add_mutually_exclusive_group() + mt_args_group.add_argument('--all', action='store_true', + help='prints all available machine types (list ' + 'of machine types will be ignored)') + mt_args_group.add_argument('--mt', nargs="*", type=str, + help='list of Machine Types ' + 'that will be compared') + + return parser.parse_args() + + +def mt_comp(mt: Machine) -> Tuple[str, int, int, int]: + """Function to compare and sort machine by names. + It returns socket_name, major version, minor version, revision""" + # none, microvm, x-remote and etc. + if '-' not in mt.name or '.' not in mt.name: + return mt.name, 0, 0, 0 + + socket, ver = mt.name.rsplit('-', 1) + ver_list = list(map(int, ver.split('.', 2))) + ver_list += [0] * (3 - len(ver_list)) + return socket, ver_list[0], ver_list[1], ver_list[2] + + +def get_mt_definitions(qemu_drivers: VMPropertyGetter, + vm: QEMUMachine) -> List[Machine]: + """Constructs list of machine definitions (primarily compat_props) via + info from QEMU""" + raw_mt_defs = vm.cmd('query-machines', compat_props=True) + mt_defs = [] + for raw_mt in raw_mt_defs: + mt_defs.append(Machine(raw_mt, qemu_drivers)) + + mt_defs.sort(key=mt_comp) + return mt_defs + + +def get_req_mt(qemu_drivers: VMPropertyGetter, vm: QEMUMachine, + req_mt: Optional[List[str]], all_mt: bool) -> List[Machine]: + """Returns list of requested by user machines""" + mt_defs = get_mt_definitions(qemu_drivers, vm) + if all_mt: + return mt_defs + + if req_mt is None: + print('Enter machine types for comparision') + exit(0) + + matched_mt = [] + for mt in mt_defs: + if mt.name in req_mt: + matched_mt.append(mt) + + return matched_mt + + +def get_affected_props(configs: List[Configuration]) -> Generator[Tuple[str, + str], + None, None]: + """Helps to go through all affected in machine definitions drivers + and properties""" + driver_props: Dict[str, Set[Any]] = {} + for config in configs: + for mt in config.req_mt: + compat_props = mt.compat_props + for driver, prop in compat_props.items(): + if driver not in driver_props: + driver_props[driver] = set() + driver_props[driver].update(prop.keys()) + + for driver, props in sorted(driver_props.items()): + for prop in sorted(props): + yield driver, prop + + +def transform_value(value: str) -> Union[str, bool]: + true_list = ['true', 'on'] + false_list = ['false', 'off'] + + out = value.lower() + + if out in true_list: + return True + + if out in false_list: + return False + + return value + + +def simplify_table(table: pd.DataFrame) -> pd.DataFrame: + """transforms values to make it easier to compare it and drops rows + with the same values for all columns""" + + table = table.map(transform_value) + + return table[~table.iloc[:, 3:].eq(table.iloc[:, 2], axis=0).all(axis=1)] + + +# constructs table in the format: +# +# Driver | Property | binary1 | binary1 | ... +# | | machine1 | machine2 | ... +# ------------------------------------------------------ ... +# driver1 | property1 | value1 | value2 | ... +# driver1 | property2 | value3 | value4 | ... +# driver2 | property3 | value5 | value6 | ... +# ... | ... | ... | ... | ... +# +def fill_prop_table(configs: List[Configuration], + is_raw: bool) -> pd.DataFrame: + req_props = list(get_affected_props(configs)) + if not req_props: + print('No drivers to compare. Check machine names') + exit(0) + + driver_col, prop_col = tuple(zip(*req_props)) + table = [pd.DataFrame({'Driver': driver_col}), + pd.DataFrame({'Property': prop_col})] + + table.extend([config.get_table(req_props) for config in configs]) + + df_table = pd.concat(table, axis=1) + + if is_raw: + return df_table + + return simplify_table(df_table) + + +def print_table(table: pd.DataFrame, table_format: str) -> None: + if table_format == 'json': + print(comp_table.to_json()) + elif table_format == 'csv': + print(comp_table.to_csv()) + else: + print(comp_table.to_markdown(index=False, stralign='center', + colalign=('center',), headers='keys', + tablefmt='fancy_grid', + disable_numparse=True)) + + +if __name__ == '__main__': + args = parse_args() + with ExitStack() as stack: + vms = [stack.enter_context(QEMUMachine(binary=binary, qmp_timer=15, + args=args.qemu_args.split(' '))) for binary in args.qemu_binary] + + configurations = [] + for vm in vms: + vm.launch() + configurations.append(Configuration(vm, args.mt, args.all)) + + comp_table = fill_prop_table(configurations, args.raw) + if not comp_table.empty: + print_table(comp_table, args.format) From patchwork Thu Apr 25 11:01:38 2024 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: 13643137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3C932C10F15 for ; Thu, 25 Apr 2024 11:05:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtl-0000OP-0z; Thu, 25 Apr 2024 07:04:17 -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 1rzws6-0007s4-0m for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:41 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzws3-0008Eq-Lu for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:33 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-418e4cd2196so6836675e9.1 for ; Thu, 25 Apr 2024 04:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042949; x=1714647749; darn=nongnu.org; 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=b/DaGtvlqhC1nG0WRRs696RzTAGLW5V48G1JnVnt1qc=; b=qDsNuyso8EAIa1u2Bmlv2bVFIvJwqUkA0b3keiTrsJYp1M+wmLxVEFk0eOi/c1I49x y/j9Spnv5W2cFVH3W/JMtNSXSnEB1t/WoFawPUsR/0y2OOBq+RLT+GxcvViAsDjt3ZCE MuT0xhwNUf+21c3gtc6B/m828+TBcBxCqWWxofoo5VL0DF2ohZgi9rEUzO1B+5YIIhcW Y2KEY0/LurwxZBmWySOpgPeLd/XSp1VvFUC/K+qwWOW3UpKD6W/fp4Dd+zIdZIHuLiQM IRg5or8377kSgoLSe99VZs+blbioxdAaRbATG8a9H86sUvWnU6Now7aMW7hDHGtw8NXW +Iaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042949; x=1714647749; 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=b/DaGtvlqhC1nG0WRRs696RzTAGLW5V48G1JnVnt1qc=; b=glc7XtRsSr55+y78ozAFU/VD9MPF2x291IOMrtJWxVJJIPqGarL5E+wuaDB6htqTph ooAPyNqvp5QTdHDhDCOwDbhmuJNUxF0qWcq5nIiE4Kfmw5lSyr2kNEZsyeBmYhuYFiu0 shINHH/0MaPZ0+vD05pGX4rkEryQVxciSjDrnsaFiQOCq37Ox3Y9S0coqNAoZAukZ4ZY 8PwODP4f03gc+1I3ZfSSyUlynguGyuWqsucICGYkdV9cno5mvivYcXV1Y0ALpoRr8XEd AmuTKz4uVRytbZzh+HbmR0D4chgl4JSelhx2NmA8owMvIbp36oPQKfUq/PQfkqFmpcS0 7S8w== X-Gm-Message-State: AOJu0YxGks1jJ+u1ptcpibQIcTIrmWzsYLK6xI2tcpFKobj1nFfZ/Uaa KhCc1WIy355z5n/hokenhIDEqUzCiN8yyVB2GbRHJb5raOjvaAChPMozqV9J3DKyIaHsP7v9xDz r X-Google-Smtp-Source: AGHT+IGxA0fp45S5TMqgqmXhQYaNVa3QNit+EQ7R21X8NbKdw/H6ughSa+c5LgPpgdOWh3hwMMfjnQ== X-Received: by 2002:a05:600c:4f03:b0:418:ed13:315e with SMTP id l3-20020a05600c4f0300b00418ed13315emr3752068wmq.2.1714042949561; Thu, 25 Apr 2024 04:02:29 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c155100b00418db9e4228sm27280045wmg.29.2024.04.25.04.02.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Richard Henderson , Paolo Bonzini Subject: [PULL 05/22] hw/core: Remove check on NEED_CPU_H in tcg-cpu-ops.h Date: Thu, 25 Apr 2024 13:01:38 +0200 Message-ID: <20240425110157.20328-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Commit fd3f7d24d4 ("include/hw/core: Remove i386 conditional on fake_user_interrupt") remove the need to check on NEED_CPU_H. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240321154838.95771-3-philmd@linaro.org> --- include/hw/core/tcg-cpu-ops.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index bf8ff8e3ee..dc1f16a977 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -49,7 +49,6 @@ struct TCGCPUOps { /** @debug_excp_handler: Callback for handling debug exceptions */ void (*debug_excp_handler)(CPUState *cpu); -#ifdef NEED_CPU_H #ifdef CONFIG_USER_ONLY /** * @fake_user_interrupt: Callback for 'fake exception' handling. @@ -174,8 +173,6 @@ struct TCGCPUOps { */ bool (*need_replay_interrupt)(int interrupt_request); #endif /* !CONFIG_USER_ONLY */ -#endif /* NEED_CPU_H */ - }; #if defined(CONFIG_USER_ONLY) From patchwork Thu Apr 25 11:01:39 2024 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: 13643131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A1A84C10F15 for ; Thu, 25 Apr 2024 11:04:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwsU-0008Cq-9B; Thu, 25 Apr 2024 07:02:58 -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 1rzwsH-00085l-VR for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:47 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsD-0008GT-Ov for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:44 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-34a00533d08so477939f8f.3 for ; Thu, 25 Apr 2024 04:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042955; x=1714647755; darn=nongnu.org; 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=wFyOmcP9zazcZyBZQtyOmZdkDwwfij0kGGeaUavMPCY=; b=JM3p7lNoymgGwo9QJIAXFDLyYvg1zWCIQUh5HhR0sAs3LWhlzep73kVohA7FD0s2vC 8lo0fdYq0Zz+1H9Q9PiMaouFeqw02Ia4CjrsrkcuwQdlHKiJ42h6+iVg+yKtoS4E2IyW 0kOdUmeXjsAJLAZq0PKTp7gCP7clcREo4RB50sLth7LOLeJVZs77JNtkGmTVSPm0tR1+ upfmRvEBXwK70BG6hZn0RcUhbYiCEolR3bqwdfjOylExtwTmewNlYGh8cTBh5FSg91NQ HxvAgOmmDie/fyqa/aghpkkbQBdEXQNjjIAFo205DGRVyUZ6vu2grWDXaifh/jHNuPDS +m2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042955; x=1714647755; 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=wFyOmcP9zazcZyBZQtyOmZdkDwwfij0kGGeaUavMPCY=; b=Prb6W3cN8QZ/Z4k6wNl9EL2a2w5BaAxE4xQzFDhf15lwvxq3TgEL6nPZwtH+9yUnaW ZarigvqMrdDjh2G5jK1lIg0rHPT0oLXN411C+jA2b7j5kGNtIOdqJlvtdD6lE73eKZ0c EH1gN0jc8p1g6gJPKuiOfOdqBM+47ZhzCBVtfqvf7r1QI+cnG0WKGgA4yk6sBYtnKRdb yRe1oguFL3lS5ZTM/Akb1t22fyUnfoTRNrI/vjIcL1RweXar7Px2Op+2b7ODBKF6ytAL esu7fUYrGiFG8PtIeCzJAy9MP2/pQU0I8M+9r7Z/bbf2VrgrUmMeqqGmAEvY9CTDTiXd Hvbw== X-Gm-Message-State: AOJu0YyUiD4slfzsPafcn++/esVHwfcLxJbL6rj9VrlRBKqMzkszW9Ox v+QK7I9jIteWNDRswOAfzowdFuMb0tlO7ESt8PztV0Av9+v3Q+uLJROYxyjLCOW43d1kHhTWxDq L X-Google-Smtp-Source: AGHT+IGbYXBotcggNmvYjJn0SeDlza7RBgJd8SuRBaPyoda0C+BK+2E4ZRY1R2o55gkIYXrS+UqrnQ== X-Received: by 2002:a5d:6709:0:b0:341:d3b0:ae7d with SMTP id o9-20020a5d6709000000b00341d3b0ae7dmr4204754wru.45.1714042955056; Thu, 25 Apr 2024 04:02:35 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id m18-20020adff392000000b00345920fcb45sm19699321wro.13.2024.04.25.04.02.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Richard Henderson , Zhao Liu , Paolo Bonzini Subject: [PULL 06/22] target/i386: Move APIC related code to cpu-apic.c Date: Thu, 25 Apr 2024 13:01:39 +0200 Message-ID: <20240425110157.20328-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Move APIC related code split in cpu-sysemu.c and monitor.c to cpu-apic.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Zhao Liu Message-Id: <20240321154838.95771-4-philmd@linaro.org> --- target/i386/cpu-apic.c | 112 +++++++++++++++++++++++++++++++++++++++ target/i386/cpu-sysemu.c | 77 --------------------------- target/i386/monitor.c | 25 --------- target/i386/meson.build | 1 + 4 files changed, 113 insertions(+), 102 deletions(-) create mode 100644 target/i386/cpu-apic.c diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c new file mode 100644 index 0000000000..d397ec94dc --- /dev/null +++ b/target/i386/cpu-apic.c @@ -0,0 +1,112 @@ +/* + * QEMU x86 CPU <-> APIC + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "qapi/qmp/qdict.h" +#include "qapi/error.h" +#include "monitor/monitor.h" +#include "monitor/hmp-target.h" +#include "sysemu/hw_accel.h" +#include "sysemu/kvm.h" +#include "sysemu/xen.h" +#include "exec/address-spaces.h" +#include "hw/qdev-properties.h" +#include "hw/i386/apic_internal.h" +#include "cpu-internal.h" + +APICCommonClass *apic_get_class(Error **errp) +{ + const char *apic_type = "apic"; + + /* TODO: in-kernel irqchip for hvf */ + if (kvm_enabled()) { + if (!kvm_irqchip_in_kernel()) { + error_setg(errp, "KVM does not support userspace APIC"); + return NULL; + } + apic_type = "kvm-apic"; + } else if (xen_enabled()) { + apic_type = "xen-apic"; + } else if (whpx_apic_in_platform()) { + apic_type = "whpx-apic"; + } + + return APIC_COMMON_CLASS(object_class_by_name(apic_type)); +} + +void x86_cpu_apic_create(X86CPU *cpu, Error **errp) +{ + APICCommonState *apic; + APICCommonClass *apic_class = apic_get_class(errp); + + if (!apic_class) { + return; + } + + cpu->apic_state = DEVICE(object_new_with_class(OBJECT_CLASS(apic_class))); + object_property_add_child(OBJECT(cpu), "lapic", + OBJECT(cpu->apic_state)); + object_unref(OBJECT(cpu->apic_state)); + + /* TODO: convert to link<> */ + apic = APIC_COMMON(cpu->apic_state); + apic->cpu = cpu; + apic->apicbase = APIC_DEFAULT_ADDRESS | MSR_IA32_APICBASE_ENABLE; + + /* + * apic_common_set_id needs to check if the CPU has x2APIC + * feature in case APIC ID >= 255, so we need to set apic->cpu + * before setting APIC ID + */ + qdev_prop_set_uint32(cpu->apic_state, "id", cpu->apic_id); +} + +void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) +{ + APICCommonState *apic; + static bool apic_mmio_map_once; + + if (cpu->apic_state == NULL) { + return; + } + qdev_realize(DEVICE(cpu->apic_state), NULL, errp); + + /* Map APIC MMIO area */ + apic = APIC_COMMON(cpu->apic_state); + if (!apic_mmio_map_once) { + memory_region_add_subregion_overlap(get_system_memory(), + apic->apicbase & + MSR_IA32_APICBASE_BASE, + &apic->io_memory, + 0x1000); + apic_mmio_map_once = true; + } +} + +void hmp_info_local_apic(Monitor *mon, const QDict *qdict) +{ + CPUState *cs; + + if (qdict_haskey(qdict, "apic-id")) { + int id = qdict_get_try_int(qdict, "apic-id", 0); + + cs = cpu_by_arch_id(id); + if (cs) { + cpu_synchronize_state(cs); + } + } else { + cs = mon_get_cpu(mon); + } + + + if (!cs) { + monitor_printf(mon, "No CPU available\n"); + return; + } + x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU); +} diff --git a/target/i386/cpu-sysemu.c b/target/i386/cpu-sysemu.c index 3f9093d285..227ac021f6 100644 --- a/target/i386/cpu-sysemu.c +++ b/target/i386/cpu-sysemu.c @@ -19,19 +19,12 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "sysemu/kvm.h" -#include "sysemu/xen.h" -#include "sysemu/whpx.h" #include "qapi/error.h" #include "qapi/qapi-visit-run-state.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qom/qom-qobject.h" #include "qapi/qapi-commands-machine-target.h" -#include "hw/qdev-properties.h" - -#include "exec/address-spaces.h" -#include "hw/i386/apic_internal.h" #include "cpu-internal.h" @@ -273,75 +266,6 @@ void x86_cpu_machine_reset_cb(void *opaque) cpu_reset(CPU(cpu)); } -APICCommonClass *apic_get_class(Error **errp) -{ - const char *apic_type = "apic"; - - /* TODO: in-kernel irqchip for hvf */ - if (kvm_enabled()) { - if (!kvm_irqchip_in_kernel()) { - error_setg(errp, "KVM does not support userspace APIC"); - return NULL; - } - apic_type = "kvm-apic"; - } else if (xen_enabled()) { - apic_type = "xen-apic"; - } else if (whpx_apic_in_platform()) { - apic_type = "whpx-apic"; - } - - return APIC_COMMON_CLASS(object_class_by_name(apic_type)); -} - -void x86_cpu_apic_create(X86CPU *cpu, Error **errp) -{ - APICCommonState *apic; - APICCommonClass *apic_class = apic_get_class(errp); - - if (!apic_class) { - return; - } - - cpu->apic_state = DEVICE(object_new_with_class(OBJECT_CLASS(apic_class))); - object_property_add_child(OBJECT(cpu), "lapic", - OBJECT(cpu->apic_state)); - object_unref(OBJECT(cpu->apic_state)); - - /* TODO: convert to link<> */ - apic = APIC_COMMON(cpu->apic_state); - apic->cpu = cpu; - apic->apicbase = APIC_DEFAULT_ADDRESS | MSR_IA32_APICBASE_ENABLE; - - /* - * apic_common_set_id needs to check if the CPU has x2APIC - * feature in case APIC ID >= 255, so we need to set apic->cpu - * before setting APIC ID - */ - qdev_prop_set_uint32(cpu->apic_state, "id", cpu->apic_id); -} - -void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) -{ - APICCommonState *apic; - static bool apic_mmio_map_once; - - if (cpu->apic_state == NULL) { - return; - } - qdev_realize(DEVICE(cpu->apic_state), NULL, errp); - - /* Map APIC MMIO area */ - apic = APIC_COMMON(cpu->apic_state); - if (!apic_mmio_map_once) { - memory_region_add_subregion_overlap(get_system_memory(), - apic->apicbase & - MSR_IA32_APICBASE_BASE, - &apic->io_memory, - 0x1000); - apic_mmio_map_once = true; - } -} - GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); @@ -385,4 +309,3 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, errp); qapi_free_GuestPanicInformation(panic_info); } - diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 3a281dab02..2d766b2637 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,8 +28,6 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "sysemu/hw_accel.h" -#include "sysemu/kvm.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" @@ -647,26 +645,3 @@ const MonitorDef *target_monitor_defs(void) { return monitor_defs; } - -void hmp_info_local_apic(Monitor *mon, const QDict *qdict) -{ - CPUState *cs; - - if (qdict_haskey(qdict, "apic-id")) { - int id = qdict_get_try_int(qdict, "apic-id", 0); - - cs = cpu_by_arch_id(id); - if (cs) { - cpu_synchronize_state(cs); - } - } else { - cs = mon_get_cpu(mon); - } - - - if (!cs) { - monitor_printf(mon, "No CPU available\n"); - return; - } - x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU); -} diff --git a/target/i386/meson.build b/target/i386/meson.build index 8abce725f8..075117989b 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -18,6 +18,7 @@ i386_system_ss.add(files( 'arch_memory_mapping.c', 'machine.c', 'monitor.c', + 'cpu-apic.c', 'cpu-sysemu.c', )) i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) From patchwork Thu Apr 25 11:01:40 2024 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: 13643143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9BBA0C4345F for ; Thu, 25 Apr 2024 11:08:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwto-0000mc-AB; Thu, 25 Apr 2024 07:04:20 -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 1rzwsH-00085j-VR for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:47 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsF-0008IR-Lx for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:44 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-347c197a464so622174f8f.2 for ; Thu, 25 Apr 2024 04:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042960; x=1714647760; darn=nongnu.org; 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=lYhjl1/jGiesNQD68pOCk3VBrraJnT7fa7wrXc4FOT0=; b=sS9SNaY2m91SB2OuGxhRGe3Zi640dzqYr+7FM0qXPCca7ZjDwL/7jLEsJbRCeN/MHm zN1X0yKopOlZPSXZfLa3wjPoTrNBk8SINFYZR/C+049d1tuYW2c5L/Z0ui3IzYdHEbCm /hGKBzdn4K+uv4/MTZmHgpTgouyIjQAPlGqBs9O3RxD+gWzDjxjtPcu5D6Z2TY448kok 03cz9qZGWePMuofu9qcMXjLqfWrk9NMXwUz9movYjDmH9UMh8GuXIE2hefebeWK66uU5 hz7r/e/mwMwK/3nsJn/wKPm7RR9wIF+FSudPsR3mApq9xr3ehinTIGtLyNoPY+loV+th 7tww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042960; x=1714647760; 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=lYhjl1/jGiesNQD68pOCk3VBrraJnT7fa7wrXc4FOT0=; b=HCwH0z+oJkeau3d32PtsS498LrzpTPZaUSJM17Q+Hul9/Wbd8LKd6B48glQs+Uu6h0 mGvHMbJm/exttrKeQUJJAXv4Kd45HQSr05mQmQscw6U50M9WYYMqfmF82NsK6IHhK5C+ 4/BFbim4oS+OT9VII5nBc/4OjcbX9p9fH0pQsL1q4Baw7xPfZH8A0Pb+1MznyXYPlBjN B3C1721xS9telADV/bE6OkkHPseVevYBat1Yak1ECfNBmC0XSTBHQz2RllzPn5ljwmAm sfudfklqfGxbjy3fMIweN7LRfPw0sklo8mdoauy8My8WkCNqVfCjaei/Wnbp2bDXKdr3 1nXw== X-Gm-Message-State: AOJu0YwfWueNHvrTL7ezpyG+HxKeKLyvolUjR9bMiZAo8/im+ThOXES1 QkAwcsjSHO5CKoUer3jkhzm8ciIB6NLfqfL0nD/dp8OWBSbWHXN53NTpGSNWgUurP+0OpI3qgUm P X-Google-Smtp-Source: AGHT+IE+z8VLtpiVcsEDriTtA4dS6T5UEXA3GkhSwRz42pIaS0iByWzozD1pu3D1/ycppsU1VPSF5A== X-Received: by 2002:a05:6000:47:b0:33d:b376:8a07 with SMTP id k7-20020a056000004700b0033db3768a07mr3496522wrx.8.1714042960487; Thu, 25 Apr 2024 04:02:40 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id y18-20020a5d4ad2000000b0034a0d3c0715sm19281014wrs.50.2024.04.25.04.02.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Peter Maydell Subject: [PULL 07/22] hw/misc/applesmc: Simplify DeviceReset handler Date: Thu, 25 Apr 2024 13:01:40 +0200 Message-ID: <20240425110157.20328-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Have applesmc_find_key() return a const pointer. Since the returned buffers are not modified in applesmc_io_data_write(), it is pointless to delete and re-add the keys in the DeviceReset handler. Add them once in DeviceRealize, and discard them in the DeviceUnrealize handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Message-Id: <20240410180819.92332-1-philmd@linaro.org> --- hw/misc/applesmc.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 14e3ef667d..59a4899312 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -145,7 +145,7 @@ static void applesmc_io_cmd_write(void *opaque, hwaddr addr, uint64_t val, s->data_pos = 0; } -static struct AppleSMCData *applesmc_find_key(AppleSMCState *s) +static const struct AppleSMCData *applesmc_find_key(AppleSMCState *s) { struct AppleSMCData *d; @@ -161,7 +161,7 @@ static void applesmc_io_data_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { AppleSMCState *s = opaque; - struct AppleSMCData *d; + const struct AppleSMCData *d; smc_debug("DATA received: 0x%02x\n", (uint8_t)val); switch (s->cmd) { @@ -269,23 +269,10 @@ static void applesmc_add_key(AppleSMCState *s, const char *key, static void qdev_applesmc_isa_reset(DeviceState *dev) { AppleSMCState *s = APPLE_SMC(dev); - struct AppleSMCData *d, *next; - /* Remove existing entries */ - QLIST_FOREACH_SAFE(d, &s->data_def, node, next) { - QLIST_REMOVE(d, node); - g_free(d); - } s->status = 0x00; s->status_1e = 0x00; s->last_ret = 0x00; - - applesmc_add_key(s, "REV ", 6, "\x01\x13\x0f\x00\x00\x03"); - applesmc_add_key(s, "OSK0", 32, s->osk); - applesmc_add_key(s, "OSK1", 32, s->osk + 32); - applesmc_add_key(s, "NATJ", 1, "\0"); - applesmc_add_key(s, "MSSP", 1, "\0"); - applesmc_add_key(s, "MSSD", 1, "\0x3"); } static const MemoryRegionOps applesmc_data_io_ops = { @@ -343,6 +330,24 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp) } QLIST_INIT(&s->data_def); + applesmc_add_key(s, "REV ", 6, "\x01\x13\x0f\x00\x00\x03"); + applesmc_add_key(s, "OSK0", 32, s->osk); + applesmc_add_key(s, "OSK1", 32, s->osk + 32); + applesmc_add_key(s, "NATJ", 1, "\0"); + applesmc_add_key(s, "MSSP", 1, "\0"); + applesmc_add_key(s, "MSSD", 1, "\0x3"); +} + +static void applesmc_unrealize(DeviceState *dev) +{ + AppleSMCState *s = APPLE_SMC(dev); + struct AppleSMCData *d, *next; + + /* Remove existing entries */ + QLIST_FOREACH_SAFE(d, &s->data_def, node, next) { + QLIST_REMOVE(d, node); + g_free(d); + } } static Property applesmc_isa_properties[] = { @@ -377,6 +382,7 @@ static void qdev_applesmc_class_init(ObjectClass *klass, void *data) AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); dc->realize = applesmc_isa_realize; + dc->unrealize = applesmc_unrealize; dc->reset = qdev_applesmc_isa_reset; device_class_set_props(dc, applesmc_isa_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); From patchwork Thu Apr 25 11:01:41 2024 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: 13643129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DF9BEC4345F for ; Thu, 25 Apr 2024 11:04:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwti-0000Le-Ma; Thu, 25 Apr 2024 07:04:17 -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 1rzwsP-00089g-1V for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:53 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsK-0008ME-L7 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:52 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-34782453ffdso774951f8f.1 for ; Thu, 25 Apr 2024 04:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042966; x=1714647766; darn=nongnu.org; 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=1My8ZSy1rXly0MJHGOKnYCpxMH11O/qNA4PcnoQO/Bk=; b=KVskqAR3LQ9dvMHcvBTznebqLCn/DRkEwFiSaYB/Mgfjq36jG4YPFzAFs6j15i7QWo CYTMZTakuAMZ1eqoxdg9kAOu1UEh6nbMMT94cyz0ycXKLoSS7sVcfVNdKVuS52/Jmj9U dbVAIorWMZONE0F2lZeSVQrqwvD0TbCW1pd7TpwkVUVsHXjZ85ZiOyY5tGBF3+wzdEdk zYwZRdnbk9frdRd8e9xqAADnjwMKICbEWLqRxEEXsK21kFd5a+RZKisM26ZQx/bAaus3 lFCclX8cTBJRSzQ4Zg4kdRT4tR+SbqIb5rlhUy5hRd/OkuuJ/BjuLrRPCsTdv1SQA1jc 6+pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042966; x=1714647766; 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=1My8ZSy1rXly0MJHGOKnYCpxMH11O/qNA4PcnoQO/Bk=; b=O7wUdr12Ntb/RD6rNbmd6LMRL0YqF2Ub6gisDNPAJS7+429t322KOBjAwoxogDJjJO D4llyVCVWeZzmrr3DQ99lvMQLKwh0oWymqCPKGeabITWyLyCNPCw4wE1/2kVPBpHPR/Q 4cqStm0sGlmSwjym5D4T/hgqulUkSIuH6JfN+A1BJxaMlb7Pk5dagvRwYKY7bSVI7cdM pTFvjRzd7yLXuVm6st18s4wmNaXxUtSh5TFdpr0p/tT5zuOOM+uD8t0JhDd707HTyUSn AMqefwUQZ/eFxYDy3AojSx2G7pICyWG2Mekc/IdqbF37DfD95+qWsIEet5Huy71GpVoi awHw== X-Gm-Message-State: AOJu0Ywon049P6UT2lE+zIyq0vq3l6Fthj9YN+MjO9bU0cM+Js3TbGlJ jbYU/FzknMvQ2RdCgISqM0wJrTzUfESrtXNfvNpQ6kxhZOVUFSn0g2FTEiSFps49MVYOYyjJk/d s X-Google-Smtp-Source: AGHT+IE4IoeXcSulUmKusv8xe735pBmPVtI1vUDyo/L1oiGIjq+L/sDOEgWcwuFIItf50QS5uMpM1w== X-Received: by 2002:a5d:420a:0:b0:34a:33e6:440d with SMTP id n10-20020a5d420a000000b0034a33e6440dmr4481547wrq.24.1714042966196; Thu, 25 Apr 2024 04:02:46 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id fj3-20020a05600c0c8300b00416b2cbad06sm31028131wmb.41.2024.04.25.04.02.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Peter Maydell , Richard Henderson , Jean-Christophe Dubois , Andrey Smirnov , Jason Wang , Alistair Francis Subject: [PULL 08/22] hw/misc/imx: Replace sprintf() by snprintf() Date: Thu, 25 Apr 2024 13:01:41 +0200 Message-ID: <20240425110157.20328-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developer experience. Use snprintf() instead. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Message-Id: <20240411104340.6617-6-philmd@linaro.org> Signed-off-by: Richard Henderson --- hw/misc/imx25_ccm.c | 2 +- hw/misc/imx31_ccm.c | 2 +- hw/misc/imx6_ccm.c | 4 ++-- hw/misc/imx6_src.c | 2 +- hw/misc/imx6ul_ccm.c | 4 ++-- hw/misc/imx7_src.c | 2 +- hw/net/imx_fec.c | 2 +- hw/ssi/imx_spi.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c index d888966014..faa726a86a 100644 --- a/hw/misc/imx25_ccm.c +++ b/hw/misc/imx25_ccm.c @@ -91,7 +91,7 @@ static const char *imx25_ccm_reg_name(uint32_t reg) case IMX25_CCM_LPIMR1_REG: return "lpimr1"; default: - sprintf(unknown, "[%u ?]", reg); + snprintf(unknown, sizeof(unknown), "[%u ?]", reg); return unknown; } } diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c index a9059bb1f7..125d4fceeb 100644 --- a/hw/misc/imx31_ccm.c +++ b/hw/misc/imx31_ccm.c @@ -89,7 +89,7 @@ static const char *imx31_ccm_reg_name(uint32_t reg) case IMX31_CCM_PDR2_REG: return "PDR2"; default: - sprintf(unknown, "[%u ?]", reg); + snprintf(unknown, sizeof(unknown), "[%u ?]", reg); return unknown; } } diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index 56489d8b57..b1def7f05b 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -85,7 +85,7 @@ static const char *imx6_ccm_reg_name(uint32_t reg) case CCM_CMEOR: return "CMEOR"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } @@ -224,7 +224,7 @@ static const char *imx6_analog_reg_name(uint32_t reg) case USB_ANALOG_DIGPROG: return "USB_ANALOG_DIGPROG"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c index 0c6003559f..3766bdf561 100644 --- a/hw/misc/imx6_src.c +++ b/hw/misc/imx6_src.c @@ -68,7 +68,7 @@ static const char *imx6_src_reg_name(uint32_t reg) case SRC_GPR10: return "SRC_GPR10"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c index bbc0be9921..0ac49ea34b 100644 --- a/hw/misc/imx6ul_ccm.c +++ b/hw/misc/imx6ul_ccm.c @@ -143,7 +143,7 @@ static const char *imx6ul_ccm_reg_name(uint32_t reg) case CCM_CMEOR: return "CMEOR"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } @@ -274,7 +274,7 @@ static const char *imx6ul_analog_reg_name(uint32_t reg) case USB_ANALOG_DIGPROG: return "USB_ANALOG_DIGPROG"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } diff --git a/hw/misc/imx7_src.c b/hw/misc/imx7_src.c index b3725ff6e7..d19f0450d4 100644 --- a/hw/misc/imx7_src.c +++ b/hw/misc/imx7_src.c @@ -75,7 +75,7 @@ static const char *imx7_src_reg_name(uint32_t reg) case SRC_GPR10: return "SRC_GPR10"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index cee84af7ba..8c91d20d44 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -41,7 +41,7 @@ static const char *imx_default_reg_name(IMXFECState *s, uint32_t index) { static char tmp[20]; - sprintf(tmp, "index %d", index); + snprintf(tmp, sizeof(tmp), "index %d", index); return tmp; } diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index d8a7583ff3..12d897d306 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -53,7 +53,7 @@ static const char *imx_spi_reg_name(uint32_t reg) case ECSPI_MSGDATA: return "ECSPI_MSGDATA"; default: - sprintf(unknown, "%u ?", reg); + snprintf(unknown, sizeof(unknown), "%u ?", reg); return unknown; } } From patchwork Thu Apr 25 11:01:42 2024 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: 13643135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0C82BC4345F for ; Thu, 25 Apr 2024 11:04:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtw-0001dQ-KL; Thu, 25 Apr 2024 07:04:28 -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 1rzwsS-0008DM-NX for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:58 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsP-0008No-VT for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:55 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41b5dd5aefaso1540755e9.2 for ; Thu, 25 Apr 2024 04:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042972; x=1714647772; darn=nongnu.org; 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=Rf1txhvOtU9A895EpVlfVLIui0ISU1TQahG+lZi6+b0=; b=PR5ClGRqgiiosD0JZPWcJyUawvI/ODaN7ZRYcLTZK25JoSDmN77cwLSCk3vgFT3icb rKIrpjor+xpY43qJFwdZp6sV86OTYz6J5RqnB/1/QQqwUzvJMjo4iWlCvqNgrKZrv+cX VMg8MtpQV+r/3SERfoQ4b8dqFox6QTZmMkUGZw7Z2UfaWUmSJB1YUirw7UvrTtvN8rm9 tNfifvy9h13SIE8NRef3T8UwD5UKshoBLO7CEFSB/Zyj68F9oK7K3ZVB4XNQlGCC8JJR YWzHph8ohRhGMlhx2937TxhMWxwS+p+aSzHOAQEjXi2QMZpweYU9jHzton+saQYbcU7m s9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042972; x=1714647772; 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=Rf1txhvOtU9A895EpVlfVLIui0ISU1TQahG+lZi6+b0=; b=ivAQM0MiOy5fVDbXn8JYIuXcwisT70XAgFH4r0HqK1cGVPouMT08xC5ZIj+Zl2O5Df XXThUSJlw99vzSKAMJo+T16kTbxnHxj0JMSlz3CJmuco0mNn/6MpNSibqRU/nAQ6OGu6 L76JX8yszRDKgCKTQmY9rVd5MY+DVjSuKlfTXgIZ3CI/TqyhBD4rPLJ6FR68rebQkMup RTIAWTWM88sS8F62dSRP4dCjrqs+VjJPITxY7W4BrgR7ZQajuVk35MXttnBhLx2q+IHT g4TtR0UuG8rcf2xpNAopJt/8UrQimNcEPNqpo8MupbYs8/uTWQgerkPAPs/Ri4Wyt3j3 uiQw== X-Gm-Message-State: AOJu0YwHgov8w0/YY5jWLwA5XczQHLcAQS/6pNctgwCc+lN5C1wXAT9s N4UghdG3Us5lCeFGuh2zrBuIWcvGvt7fdWJTiUfTxWW3dWJXUQrgdkDDpTEcq1QJP+b6MSLpZ9x M X-Google-Smtp-Source: AGHT+IEagd4TEJwMWXiRoiDfm5K7DXg/2fEHi+ML+UAWzDDR+Bsuyjlmyp/tzJESuePfwQuGb6xq+g== X-Received: by 2002:a05:600c:4ec9:b0:41a:bf5d:c30a with SMTP id g9-20020a05600c4ec900b0041abf5dc30amr5646980wmq.18.1714042972013; Thu, 25 Apr 2024 04:02:52 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id c9-20020a05600c0a4900b0041b43d2d745sm2089435wmq.7.2024.04.25.04.02.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Richard Henderson , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 09/22] hw/riscv/virt: Replace sprintf by g_strdup_printf Date: Thu, 25 Apr 2024 13:01:42 +0200 Message-ID: <20240425110157.20328-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1. Use g_strdup_printf instead. Signed-off-by: Philippe Mathieu-Daudé [rth: Use g_strdup_printf] Signed-off-by: Richard Henderson Message-Id: <20240412073346.458116-26-richard.henderson@linaro.org> --- hw/riscv/virt.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index d171e74f7b..4fdb660525 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1617,10 +1617,8 @@ static void virt_machine_instance_init(Object *obj) static char *virt_get_aia_guests(Object *obj, Error **errp) { RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); - char val[32]; - sprintf(val, "%d", s->aia_guests); - return g_strdup(val); + return g_strdup_printf("%d", s->aia_guests); } static void virt_set_aia_guests(Object *obj, const char *val, Error **errp) @@ -1741,7 +1739,6 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, static void virt_machine_class_init(ObjectClass *oc, void *data) { - char str[128]; MachineClass *mc = MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); @@ -1767,7 +1764,6 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); #endif - object_class_property_add_bool(oc, "aclint", virt_get_aclint, virt_set_aclint); object_class_property_set_description(oc, "aclint", @@ -1785,9 +1781,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_str(oc, "aia-guests", virt_get_aia_guests, virt_set_aia_guests); - sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value " - "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS); - object_class_property_set_description(oc, "aia-guests", str); + { + g_autofree char *str = + g_strdup_printf("Set number of guest MMIO pages for AIA IMSIC. " + "Valid value should be between 0 and %d.", + VIRT_IRQCHIP_MAX_GUESTS); + object_class_property_set_description(oc, "aia-guests", str); + } + object_class_property_add(oc, "acpi", "OnOffAuto", virt_get_acpi, virt_set_acpi, NULL, NULL); From patchwork Thu Apr 25 11:01:43 2024 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: 13643134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 79228C10F15 for ; Thu, 25 Apr 2024 11:04:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtn-0000ij-No; Thu, 25 Apr 2024 07:04:19 -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 1rzwsa-0008Ot-B6 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:14 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsW-0008TK-CN for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:03 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41b5dc5e0d6so1749735e9.0 for ; Thu, 25 Apr 2024 04:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042977; x=1714647777; darn=nongnu.org; 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=BdAyeGYkrzEliXsZ63G9PrJ5ByexuubM31tow2m95nM=; b=fHYlOULTE2a3fsprAAta1qZ2ezY1pfD4k4EXW6g1tW/+LwQ65TJGGdnhuLJYqvfAgX aICle9981skz+Jnn8Cw0Lxp52xaZICqC9g1Ad27mEuONz0ICz8IHmzsGH2on+6oPUfRE PQebi7rXgU5reXb4kferau3jlWdS4d96dyZk99psuTVjObzaR+/J2xZhBBmymJOqF1DY tHOfzp56SEYb58KS/qB0IdJ8fFVmgrIiDZF1wfAFo9KlAW1xi07fKeLUcuCu6LGzuK5w f1SAgVSJ6i3sbeQyv9nhuI1EZrpDY4/uKi3VROvH286YMNrOqz48LSRJR0TBl4NcUG36 1b7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042977; x=1714647777; 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=BdAyeGYkrzEliXsZ63G9PrJ5ByexuubM31tow2m95nM=; b=fw1p4ZwF/HdbIZJqG68UeNqj7C9+18owzdizJ4v6Q4xMoqfpaJInAKbg3U/ODiZz1W FIdbTBn2H0J4O+GjJ91NCZ6UNZ3LeQCBdlcrCUwzb+POiapf06h8dSf/pO+MC0NyjWNF H0vAExSPhaD7dk2JN/ExjfVpTdaxEY8mh8/u31J4i3pFn1QXz8QmwQrFuY/Jt8DGZzgf sJXPo6b3EFCWEHgk1KahZcuH1fpgAUhqAPpzuQnDTudkctNJnkx/I2vx3WZ67K72hkTV pWYQtJYEsBon0MrvMF87OVwmrFp9KvpIujJvRJh3hRlM5Vh/FyfIR7HCLYZt95kZ02uP veKA== X-Gm-Message-State: AOJu0YyW81UVVMYo5A2dIulbAmj1C7/NYyw+qzo0T8W/zVc0ZTPGVrUH iP5HIuTOVVixec1WZAf4l/bpYtDN2ilBUqqHucwDvSjHAj3BCfmfHMBS+u9IaA1+qIpD5ghkDJc p X-Google-Smtp-Source: AGHT+IFeW3acT9aERuuRclTexJYBdyBpYe3GuhkGTdOm4UP1aF2NxUWvVkQ1Y32yGXUUjpZL9cegSg== X-Received: by 2002:a05:600c:3143:b0:41a:afe1:6d77 with SMTP id h3-20020a05600c314300b0041aafe16d77mr3643130wmo.11.1714042977351; Thu, 25 Apr 2024 04:02:57 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c19d100b00416b163e52bsm30648723wmq.14.2024.04.25.04.02.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , Peter Maydell Subject: [PULL 10/22] hw: Fix problem with the A*MPCORE switches in the Kconfig files Date: Thu, 25 Apr 2024 13:01:43 +0200 Message-ID: <20240425110157.20328-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Huth A9MPCORE, ARM11MPCORE and A15MPCORE are defined twice, once in hw/cpu/Kconfig and once in hw/arm/Kconfig. This is only possible by accident, since hw/cpu/Kconfig is never included from hw/Kconfig. Fix it by declaring the switches only in hw/cpu/Kconfig (since the related files reside in the hw/cpu/ folder) and by making sure that the file hw/cpu/Kconfig is now properly included from hw/Kconfig. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth Message-ID: <20240415065655.130099-2-thuth@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- hw/Kconfig | 1 + hw/arm/Kconfig | 15 --------------- hw/cpu/Kconfig | 12 +++++++++--- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/hw/Kconfig b/hw/Kconfig index b1cc40d6be..f7866e76f7 100644 --- a/hw/Kconfig +++ b/hw/Kconfig @@ -47,6 +47,7 @@ source watchdog/Kconfig # arch Kconfig source arm/Kconfig +source cpu/Kconfig source alpha/Kconfig source avr/Kconfig source cris/Kconfig diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 893a7bff66..d97015c45c 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -678,21 +678,6 @@ config ZAURUS select NAND select ECC -config A9MPCORE - bool - select A9_GTIMER - select A9SCU # snoop control unit - select ARM_GIC - select ARM_MPTIMER - -config A15MPCORE - bool - select ARM_GIC - -config ARM11MPCORE - bool - select ARM11SCU - config ARMSSE bool select ARM_V7M diff --git a/hw/cpu/Kconfig b/hw/cpu/Kconfig index 1767d028ac..f776e884cd 100644 --- a/hw/cpu/Kconfig +++ b/hw/cpu/Kconfig @@ -1,8 +1,14 @@ -config ARM11MPCORE - bool - config A9MPCORE bool + select A9_GTIMER + select A9SCU # snoop control unit + select ARM_GIC + select ARM_MPTIMER config A15MPCORE bool + select ARM_GIC + +config ARM11MPCORE + bool + select ARM11SCU From patchwork Thu Apr 25 11:01:44 2024 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: 13643149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B02CFC4345F for ; Thu, 25 Apr 2024 11:09:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwuK-0002vj-G1; Thu, 25 Apr 2024 07:04:52 -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 1rzwsj-0008UP-3M for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:38 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsb-00005s-E2 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:07 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-41adf155cffso6384055e9.2 for ; Thu, 25 Apr 2024 04:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042983; x=1714647783; darn=nongnu.org; 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=LbAs9YmrS9dSJaP9YCdhZk5wTEYcOSkfG+YJap7/m1c=; b=upb2cCJutQ4RH6YHzzcoh/SDNJoih4pUuQVugFQuUw/SYzlRKtBXLJVkLUhTaWhD12 86gxQHirJvp/zOls6O3rP7PURSM3hSXhbz4aoIAS98Fgb5+sO17E2uiD9bisXYPPXwzv jUX1Q+etUnPzPnCmjMj0smUZngnFNRI3rXlLDlsgEk10YDwtaKkNQ6Oz+vUvQoYTd7YZ IvnAmQuDN//McM+FdPzTKIeOkHSOOarysxBBhea3gdeJtDtcuTZfqildmjRlt4e0rTD8 FPt0LvRxeSUWNCr6ixC5z6UqlBa/Ro1mRi3szVPepMUPmhHg6syJNqr5MTJIV9AhxKAz W8+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042983; x=1714647783; 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=LbAs9YmrS9dSJaP9YCdhZk5wTEYcOSkfG+YJap7/m1c=; b=ibNPqwXVnGq157gapBD6lellJsdmIFRqWf5oGuc8huBsdRNWQ0zZPt/K8KPHT1t9rf Q+MsujH0VKssLuo35XahUC/KDGxhsrkR5lW0KqsahD+3ATPQHXy3GW0G3bxY0In8aQom 7DJ9pR934bOZcu+iRJNmdTrIJb9NqVlAkSoH6mXCXJ967xA3z9PA44sKyuwVAfdVSpGu Fr3om1209b412g6koWDG7WSCPqxZbXi30O9Ifdp3pcPCcu32vXyEN0+vZfSFNaAQzDeq /g26uOdlfEUdmlUh1uTUxbTL/9RJJemII74L6t7mYstNk1JuVMYKqswzYgyXqL5G80GV TTgQ== X-Gm-Message-State: AOJu0YxIjlpOJCJHb8s1gjGltFvKCDLvaVsNx8JxjOzs+dmbbQO8o4hC BAz/RBZx6Ep0WX3W4G6SwxZqIcF5MVC51lQ0t4VERx4P/UkAIFMaolQycMhVx1Z4hxPP1z6SfOr S X-Google-Smtp-Source: AGHT+IFGt7D2a5BG0f6Ej/yKtX3pUKUzeeUlIFdZucYldsHGorV+6z4Q5Ind8NR6PRSHS1Ee03ftFg== X-Received: by 2002:a05:600c:154f:b0:418:e08c:817 with SMTP id f15-20020a05600c154f00b00418e08c0817mr3681618wmg.32.1714042983172; Thu, 25 Apr 2024 04:03:03 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id p9-20020a05600c1d8900b0041b13c5c9f9sm4678586wms.17.2024.04.25.04.03.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , Peter Maydell , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 11/22] hw: Add a Kconfig switch for the TYPE_CPU_CLUSTER device Date: Thu, 25 Apr 2024 13:01:44 +0200 Message-ID: <20240425110157.20328-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Huth The cpu-cluster device is only needed for some few arm and riscv machines. Let's avoid compiling and linking it if it is not really necessary. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth Message-ID: <20240415065655.130099-3-thuth@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/Kconfig | 3 +++ hw/cpu/Kconfig | 3 +++ hw/cpu/meson.build | 3 ++- hw/riscv/Kconfig | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index d97015c45c..5d4015b75a 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -485,6 +485,7 @@ config XLNX_ZYNQMP_ARM select AHCI select ARM_GIC select CADENCE + select CPU_CLUSTER select DDC select DPCD select SDHCI @@ -503,6 +504,7 @@ config XLNX_VERSAL default y depends on TCG && AARCH64 select ARM_GIC + select CPU_CLUSTER select PL011 select CADENCE select VIRTIO_MMIO @@ -688,6 +690,7 @@ config ARMSSE select CMSDK_APB_DUALTIMER select CMSDK_APB_UART select CMSDK_APB_WATCHDOG + select CPU_CLUSTER select IOTKIT_SECCTL select IOTKIT_SYSCTL select IOTKIT_SYSINFO diff --git a/hw/cpu/Kconfig b/hw/cpu/Kconfig index f776e884cd..baff478e1b 100644 --- a/hw/cpu/Kconfig +++ b/hw/cpu/Kconfig @@ -12,3 +12,6 @@ config A15MPCORE config ARM11MPCORE bool select ARM11SCU + +config CPU_CLUSTER + bool diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build index 38cdcfbe57..9d36bf8ae2 100644 --- a/hw/cpu/meson.build +++ b/hw/cpu/meson.build @@ -1,4 +1,5 @@ -system_ss.add(files('core.c', 'cluster.c')) +system_ss.add(files('core.c')) +system_ss.add(when: 'CONFIG_CPU_CLUSTER', if_true: files('cluster.c')) system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c')) system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c')) diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig index 5d644eb7b1..fc72ef0379 100644 --- a/hw/riscv/Kconfig +++ b/hw/riscv/Kconfig @@ -9,6 +9,7 @@ config IBEX config MICROCHIP_PFSOC bool select CADENCE_SDHCI + select CPU_CLUSTER select MCHP_PFSOC_DMC select MCHP_PFSOC_IOSCB select MCHP_PFSOC_MMUART @@ -68,6 +69,7 @@ config SIFIVE_E config SIFIVE_U bool select CADENCE + select CPU_CLUSTER select RISCV_ACLINT select SIFIVE_GPIO select SIFIVE_PDMA From patchwork Thu Apr 25 11:01:45 2024 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: 13643146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D6D28C10F15 for ; Thu, 25 Apr 2024 11:09:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtv-0001UA-Am; Thu, 25 Apr 2024 07:04:27 -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 1rzwsn-0008VP-MQ for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:38 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsk-00007H-AO for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:16 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2def8e5ae60so4591341fa.2 for ; Thu, 25 Apr 2024 04:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042989; x=1714647789; darn=nongnu.org; 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=LU/r9zSSWOAgtXVFmIxCt1qMAeFSfB+B8bTVtMRUbL4=; b=WrXR9xds2luym4J6tztK66DnJaf/wuj2yu2EDa583PaxoSFJwEWk1s2L1aNchIx+/r bbR9UZz7iFtrCvMuaaKDwy3TZsSwGW9zzUFnkKUtVogRlNYkQ18amTlZR9yb/pPExQ2j fjGvhqmzFGItbBbAjuHVlaCBQNbmXskDV7Snl6aLxO67SwCZGLsYvUI6KWzLAQQ/obJ8 MeQ9254Ek3cXhnTeh1ApAZ9/J5mkzleH+K9rKInF3B7Y1sQ4VXjXN0HdV+sqQ7CRQsXS xsVN1HokLi5KiqQA+3m7jZXt90Xy2TAVok0I9hsD2cFYXLzuWsODMcI6TuDobnVQOdTP 5GAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042989; x=1714647789; 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=LU/r9zSSWOAgtXVFmIxCt1qMAeFSfB+B8bTVtMRUbL4=; b=nu2s1F0tXocxlkW19Um2yfxIqYJA9NKxfyGXv/B+AQvLbg+7x6k8AufPBtR0/3AswP usT0hPoR0qx8jl+L51fCJecDxzd9+/JriR6vcNR8OnB0qklxnf294IAcK6ePZZlym65b gAHw3ONgkxcLvkAGBe6zhXfHU0FaXbEMVJgGTXITR2A6wrhC175MtRQPiMz2Ggx88LLA QKlg4WeiyFYm4ee7oynGRzYJIo7HqbN2/ckjQjOyu+5NoULjUq6L8gt15TP1MqtPdyOg JAOpq7gDBW2uI/zfDaT4Fxvv923evef6gZO4xT2s9rA4vqZO/zIUZbykZsPiF2Oj26Er nKCg== X-Gm-Message-State: AOJu0Yx0dEjt7tKZ93PjPrSS53yX2mzHUmCJGY8xW4J62Ozk6LF9riWn xU0Azd2WSeKDZlri3jU+xAwwlI5i2glaLHyzl+8zlFHMvDrqDsa13A5V4y3VguMAyjIqlwTFQlI x X-Google-Smtp-Source: AGHT+IFO8miQl6dbOAeeTD9X+PVLuHZOUwqnZSgopxhCCr33r6EuDuv6CgJsQcLWxILvpMYPwwf/Zw== X-Received: by 2002:a2e:954f:0:b0:2de:81c9:14b3 with SMTP id t15-20020a2e954f000000b002de81c914b3mr2837508ljh.35.1714042988935; Thu, 25 Apr 2024 04:03:08 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id o20-20020a05600c511400b0041a49b10a13sm14955302wms.11.2024.04.25.04.03.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jonathan Cameron , Jonathan Cameron , Fan Ni Subject: [PULL 12/22] hw/cxl/cxl-cdat: Make ct3_load_cdat() return boolean Date: Thu, 25 Apr 2024 13:01:45 +0200 Message-ID: <20240425110157.20328-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=philmd@linaro.org; helo=mail-lj1-x235.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. So make ct3_load_cdat() return boolean, and this is the preparation for cxl_doe_cdat_init() returning boolean. Suggested-by: Markus Armbruster Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Acked-by: Jonathan Cameron Message-ID: <20240418100433.1085447-2-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/cxl/cxl-cdat.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c index 551545f782..b3e496857a 100644 --- a/hw/cxl/cxl-cdat.c +++ b/hw/cxl/cxl-cdat.c @@ -111,7 +111,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp) cdat->entry = g_steal_pointer(&cdat_st); } -static void ct3_load_cdat(CDATObject *cdat, Error **errp) +static bool ct3_load_cdat(CDATObject *cdat, Error **errp) { g_autofree CDATEntry *cdat_st = NULL; g_autofree uint8_t *buf = NULL; @@ -127,11 +127,11 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp) &file_size, &error)) { error_setg(errp, "CDAT: File read failed: %s", error->message); g_error_free(error); - return; + return false; } if (file_size < sizeof(CDATTableHeader)) { error_setg(errp, "CDAT: File too short"); - return; + return false; } i = sizeof(CDATTableHeader); num_ent = 1; @@ -139,19 +139,19 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp) hdr = (CDATSubHeader *)(buf + i); if (i + sizeof(CDATSubHeader) > file_size) { error_setg(errp, "CDAT: Truncated table"); - return; + return false; } cdat_len_check(hdr, errp); i += hdr->length; if (i > file_size) { error_setg(errp, "CDAT: Truncated table"); - return; + return false; } num_ent++; } if (i != file_size) { error_setg(errp, "CDAT: File length mismatch"); - return; + return false; } cdat_st = g_new0(CDATEntry, num_ent); @@ -185,6 +185,7 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp) cdat->entry_len = num_ent; cdat->entry = g_steal_pointer(&cdat_st); cdat->buf = g_steal_pointer(&buf); + return true; } void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp) From patchwork Thu Apr 25 11:01:46 2024 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: 13643140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 98C91C10F15 for ; Thu, 25 Apr 2024 11:06:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtz-0001p4-Cc; Thu, 25 Apr 2024 07:04:31 -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 1rzwsq-000057-3r for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:38 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsn-0000AB-Fr for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:19 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-41a77836f16so6566255e9.3 for ; Thu, 25 Apr 2024 04:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042994; x=1714647794; darn=nongnu.org; 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=8bJ1N9o6y+S8lNsIITbhbB1Udo8RPNY/z42IZN8n3uY=; b=o9e2JvchHg5dfWSh/z2SQMfNy0QkVIe91WIGmoHqe2VYBytEsQZxCyuy43VUT0Cvqg BOgDlE/7pATxN5NYjfW62/PeVsTPMm9SlQT4ksgbfOo5RRSGINZQBeMEx8al0LBuegIM SVc5Vd0glybBwHQjgzkjJqsznfmrj/z7Hmn0+obklXI2F8iShdJeskrCdmvX6cfaoabm R6eLWEA6UcsMFBjiIf8Bfjh1WN2Xhw6dVB3sjfhBYupFiJPtBipofJpW97qjmybVBf9O +9NPuqaXFYYQ+TiIj+v4OIsqTZEGbeqIVpD5t0YH3YN+Cpvt+RYx1K41qzhwL1ior+OY Sdrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042994; x=1714647794; 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=8bJ1N9o6y+S8lNsIITbhbB1Udo8RPNY/z42IZN8n3uY=; b=l8Z+WVCvL7X5pPgTBSgm1CwRWEPo9v5ttnqxpZFFfGvgPFWC01zDONOEbp8rxzAwNb QKR4bZ0uU0pR2TO4m66+VPtaaJ7G8V+LtCRmVM5WwsnVowiScp7Pbk2VtsitcHSTc3U5 PHGH6hJ1Zz/eZWQgw7SDehMoFLYn7twseR0twFB3ZebSOkbzRHtZSMM+KPQbg5nbDZ3n 4GALWihaQc6mCot52MrchUpfIppz84cA2irCvOVHUwN1YWhKEbShz1rBJeg2KGIZ/nfN JivmTixVb06sYc9RXlQ/+KBEJ3mmZOB2Tjwt4MjusqulW0m1tz9xCTy5oPORnOgAfStE +w7g== X-Gm-Message-State: AOJu0Yy9l/E6q38fXm9DZ27lWKoeuZAuLgNp+iScC1EtKO9hFj0bT6uA LtJeej1XbKSuZqby/FcAEDKHyrGdNWu15c9JCACwALBABEJHwW89gCxRvBCOvTnnBjP9f5K5DtV p X-Google-Smtp-Source: AGHT+IExtxLJ50MnYU/IbmveQvsJjUvXAL9seoPtUBsjFHLwrfdxSyldZdl8iBPaCQOyZrDoOo9++g== X-Received: by 2002:a05:600c:35c7:b0:418:a7a7:990f with SMTP id r7-20020a05600c35c700b00418a7a7990fmr4300251wmq.13.1714042994514; Thu, 25 Apr 2024 04:03:14 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id fc19-20020a05600c525300b00418981b59d4sm31049322wmb.10.2024.04.25.04.03.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jonathan Cameron , Jonathan Cameron , Fan Ni Subject: [PULL 13/22] hw/cxl/cxl-cdat: Make ct3_build_cdat() return boolean Date: Thu, 25 Apr 2024 13:01:46 +0200 Message-ID: <20240425110157.20328-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. So make ct3_build_cdat() return boolean, and this is the preparation for cxl_doe_cdat_init() returning boolean. Suggested-by: Markus Armbruster Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Acked-by: Jonathan Cameron Message-ID: <20240418100433.1085447-3-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/cxl/cxl-cdat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c index b3e496857a..e7bc1380bf 100644 --- a/hw/cxl/cxl-cdat.c +++ b/hw/cxl/cxl-cdat.c @@ -44,7 +44,7 @@ static void cdat_len_check(CDATSubHeader *hdr, Error **errp) } } -static void ct3_build_cdat(CDATObject *cdat, Error **errp) +static bool ct3_build_cdat(CDATObject *cdat, Error **errp) { g_autofree CDATTableHeader *cdat_header = NULL; g_autofree CDATEntry *cdat_st = NULL; @@ -58,7 +58,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp) cdat_header = g_malloc0(sizeof(*cdat_header)); if (!cdat_header) { error_setg(errp, "Failed to allocate CDAT header"); - return; + return false; } cdat->built_buf_len = cdat->build_cdat_table(&cdat->built_buf, @@ -67,14 +67,14 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp) if (cdat->built_buf_len <= 0) { /* Build later as not all data available yet */ cdat->to_update = true; - return; + return true; } cdat->to_update = false; cdat_st = g_malloc0(sizeof(*cdat_st) * (cdat->built_buf_len + 1)); if (!cdat_st) { error_setg(errp, "Failed to allocate CDAT entry array"); - return; + return false; } /* Entry 0 for CDAT header, starts with Entry 1 */ @@ -109,6 +109,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp) cdat_st[0].length = sizeof(*cdat_header); cdat->entry_len = 1 + cdat->built_buf_len; cdat->entry = g_steal_pointer(&cdat_st); + return true; } static bool ct3_load_cdat(CDATObject *cdat, Error **errp) From patchwork Thu Apr 25 11:01:47 2024 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: 13643139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 09FD0C19F4F for ; Thu, 25 Apr 2024 11:06:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtw-0001c3-FK; Thu, 25 Apr 2024 07:04:28 -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 1rzwtB-00009T-2S for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:57 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwss-0000DG-7b for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:26 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41adf3580dbso5031725e9.0 for ; Thu, 25 Apr 2024 04:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043000; x=1714647800; darn=nongnu.org; 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=pvunkSj/8Waxads7PhZ8ZQlWRsJ6KI6vMAUvxRYx65M=; b=gL9a3tea7yE6jcdX6zkmxwDmR6RkxmQKGR0W8cbgks1HpM55Kl2q+Fh5rDjzchqYhY ibf6gTSzByxXyHNx3UMizX1IL+oJfoPpgfewwNEdFKYZRg6DDQgrJ/yQlBA/QOFsOT30 mPK+d1+VuHN3r3++vGimHOahyjN386AlBBbee1h9kn3SpQcpFESm/DIQ2CK8kNho5nJp 24zHp3k6m2azSmBCFVEiiXKCNsLNVXUwhFGki3EhncgbEJir3NyRHAhCd1U1V8o6lkEQ 70rEdMd1hXHJQieDioZs0cKc08yQlROsxMFvwpfcpDfkKuMuvWWevUqvtOohZZGXyXHp nHHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043000; x=1714647800; 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=pvunkSj/8Waxads7PhZ8ZQlWRsJ6KI6vMAUvxRYx65M=; b=QQdsw8uMFram+rWtSsd2xHY5tLXOhcqonDaDahwOrbol0Fu/T443cS02g/JjsiSRp5 QuhS7O1Oge2Qz4lCt522wPKJyfjH/aYqQFT9CXRICqdWt8DLxSkuYrLVzWeQQcz0iF/L oVIxNqhR09y3sNl+5YfJ/Vk76//YGz+M1sYXOoiJ1KH8fugmWdKdz6w9lmEDwjMaZJun awx7dIeVVV5LfqW4PqrlkyxYzhN783ujna2MswwdJECS59yl2Ml0mXdF5T6C1kuxCQuh 3bNDP00rk9ioyZxBHbeN+sgPh9hG9ta4CqxxiMi9/QyTNPv0hCM4i+dd9RwcL1Sqbxwm KgUw== X-Gm-Message-State: AOJu0YwAulEvWGbCiWP690K3rXoUrr8+FB2n+U2Ze48OcsWoZKTFaL3Y IcPgQvJ43tcs1f7cxtDAC6ZfNgnvbb+KFDqdwo9qirDyufiMNnd2d6QQ1AWyOA8NdESGJ2eLS41 J X-Google-Smtp-Source: AGHT+IEmrIxHIZTR3N3C87Loh/LBNBpgekND21HRCbgm42Ea4SiO726knsE1orKhBPiOc+Dh2IhLkQ== X-Received: by 2002:a05:600c:3554:b0:415:ff48:59fc with SMTP id i20-20020a05600c355400b00415ff4859fcmr2033033wmq.8.1714043000386; Thu, 25 Apr 2024 04:03:20 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id k41-20020a05600c1ca900b00417e8be070csm27334682wms.9.2024.04.25.04.03.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jonathan Cameron , Jonathan Cameron , Fan Ni , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PULL 14/22] hw/cxl/cxl-cdat: Make cxl_doe_cdat_init() return boolean Date: Thu, 25 Apr 2024 13:01:47 +0200 Message-ID: <20240425110157.20328-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu As error.h suggested, the best practice for callee is to return something to indicate success / failure. With returned boolean, there's no need to dereference @errp to check failure case. Suggested-by: Markus Armbruster Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Acked-by: Jonathan Cameron Message-ID: <20240418100433.1085447-4-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/cxl/cxl_component.h | 2 +- hw/cxl/cxl-cdat.c | 6 +++--- hw/mem/cxl_type3.c | 3 +-- hw/pci-bridge/cxl_upstream.c | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h index 5012fab6f7..945ee6ffd0 100644 --- a/include/hw/cxl/cxl_component.h +++ b/include/hw/cxl/cxl_component.h @@ -273,7 +273,7 @@ hwaddr cxl_decode_ig(int ig); CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb); bool cxl_get_hb_passthrough(PCIHostState *hb); -void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp); +bool cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp); void cxl_doe_cdat_release(CXLComponentState *cxl_cstate); void cxl_doe_cdat_update(CXLComponentState *cxl_cstate, Error **errp); diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c index e7bc1380bf..959a55518e 100644 --- a/hw/cxl/cxl-cdat.c +++ b/hw/cxl/cxl-cdat.c @@ -189,14 +189,14 @@ static bool ct3_load_cdat(CDATObject *cdat, Error **errp) return true; } -void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp) +bool cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp) { CDATObject *cdat = &cxl_cstate->cdat; if (cdat->filename) { - ct3_load_cdat(cdat, errp); + return ct3_load_cdat(cdat, errp); } else { - ct3_build_cdat(cdat, errp); + return ct3_build_cdat(cdat, errp); } } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index b0a7e9f11b..3e42490b6c 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -705,8 +705,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp) cxl_cstate->cdat.build_cdat_table = ct3_build_cdat_table; cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table; cxl_cstate->cdat.private = ct3d; - cxl_doe_cdat_init(cxl_cstate, errp); - if (*errp) { + if (!cxl_doe_cdat_init(cxl_cstate, errp)) { goto err_free_special_ops; } diff --git a/hw/pci-bridge/cxl_upstream.c b/hw/pci-bridge/cxl_upstream.c index 783fa6adac..e51221a5f3 100644 --- a/hw/pci-bridge/cxl_upstream.c +++ b/hw/pci-bridge/cxl_upstream.c @@ -338,8 +338,7 @@ static void cxl_usp_realize(PCIDevice *d, Error **errp) cxl_cstate->cdat.build_cdat_table = build_cdat_table; cxl_cstate->cdat.free_cdat_table = free_default_cdat_table; cxl_cstate->cdat.private = d; - cxl_doe_cdat_init(cxl_cstate, errp); - if (*errp) { + if (!cxl_doe_cdat_init(cxl_cstate, errp)) { goto err_cap; } From patchwork Thu Apr 25 11:01:48 2024 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: 13643141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B949AC4345F for ; Thu, 25 Apr 2024 11:06:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwuM-000322-FM; Thu, 25 Apr 2024 07:04:54 -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 1rzwtE-00009y-6k for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:03 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwt9-0000G4-I1 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:42 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41b5e74fa83so1814755e9.0 for ; Thu, 25 Apr 2024 04:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043006; x=1714647806; darn=nongnu.org; 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=AM4wpjhaRu1VnbLScsMczsVnLF9tLEy5hd6kj7QFVIE=; b=DRP/e7hmF6iTP+67jZNGAZC5bdVnFmP3bDeqkkvXVRtNO1QVv9eP+1BQ51xeN1OnO7 GrQgB+KpD9aKhDRUDjNILD++QhzOgAoyQo8ZV2wS16RW7tPR+z9QYb4viTK4x6Tv3tOf PJn0lKmm26v30ffqOJfJkntUbhMQN6/WZqaOTMQyaNG5DpTPxDWZx+2xj3ZuAmZx4rWZ 53j8HNEgGjxvtECCQ5LQ+OPHXbHisNkuBtdoCc8+NbausmdY4/8V0bMH29qz8ZrME+2D BR2kWIENkCnd41O60ynhaXnLwMEJqjUYvwqt8ORwK6XzUuaraxXQQRa4oPp8YIxglKm+ 1UFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043006; x=1714647806; 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=AM4wpjhaRu1VnbLScsMczsVnLF9tLEy5hd6kj7QFVIE=; b=pajwHbasfcXPaAhindbfoIlB7f0BQlOCex0TRtfo9z+Za3MxG4tjOa2R1vBtEgs1Q3 /E3aRGZqNGJ+bODNo7rxQXiSWxawZZIrH9OSB4+3QI8nYN/w4W5WVXBzOJpb+a2L1e3/ LhV4qDjhUoAq1SQGwtYpZZSyl8rfmMePGGS9kKVHYu9ws7mC/JGdL3B+6eQztR5xEDjs ODCu736Q/xGJcBDyYXM0SWsqWY11jblmZHZRDFkKcmYNYuo8gMX6rm844xtLn7wFZVJO Z9XrCTLwAt1NsfQcQoBa9z7I0ZhxG+mmP3NZLcauTmUcTLowXKuSpmtP3T5lsLxIV0fV Lqgw== X-Gm-Message-State: AOJu0YyyuI/7yfjf7uncyuQnMiFAanOt2Oa6pE+t90a6MUr6Vn4fJT89 4fzOuIhAXkkevgIKpCir3cRRDsOi3yA0RMuTvulajnAMQrhVio8cqsuzGLic2JYtfiMQRKqgW1t V X-Google-Smtp-Source: AGHT+IGe49IAc2SdSXO25jaUyqK6FP6td8CeYnIlxdI0bb6LP3p3uwTpqkW0EOAH6Idsm470AsYsHQ== X-Received: by 2002:a05:600c:4508:b0:418:f991:8ad4 with SMTP id t8-20020a05600c450800b00418f9918ad4mr4383715wmo.6.1714043006094; Thu, 25 Apr 2024 04:03:26 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id l37-20020a05600c1d2500b004186f979543sm31187720wms.33.2024.04.25.04.03.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Richard Henderson , Warner Losh , Kyle Evans , Laurent Vivier Subject: [PULL 15/22] hw/elf_ops: Rename elf_ops.h -> elf_ops.h.inc Date: Thu, 25 Apr 2024 13:01:48 +0200 Message-ID: <20240425110157.20328-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since commit 139c1837db ("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc. Besides, since commit 6a0057aa22 ("docs/devel: make a statement about includes") this is documented in the Coding Style: If you do use template header files they should be named with the ``.c.inc`` or ``.h.inc`` suffix to make it clear they are being included for expansion. Therefore rename "hw/elf_ops.h" as "hw/elf_ops.h.inc". Signed-off-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson Message-Id: <20240424173333.96148-2-philmd@linaro.org> --- include/hw/{elf_ops.h => elf_ops.h.inc} | 0 bsd-user/elfload.c | 2 +- hw/core/loader.c | 4 ++-- linux-user/elfload.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename include/hw/{elf_ops.h => elf_ops.h.inc} (100%) diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h.inc similarity index 100% rename from include/hw/elf_ops.h rename to include/hw/elf_ops.h.inc diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index baf2f63d2f..833fa3bd05 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -383,7 +383,7 @@ static const char *lookup_symbolxx(struct syminfo *s, uint64_t orig_addr) return ""; } -/* FIXME: This should use elf_ops.h */ +/* FIXME: This should use elf_ops.h.inc */ static int symcmp(const void *s0, const void *s1) { struct elf_sym *sym0 = (struct elf_sym *)s0; diff --git a/hw/core/loader.c b/hw/core/loader.c index b8e52f3fb0..2f8105d7de 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -305,7 +305,7 @@ static void *load_at(int fd, off_t offset, size_t size) #define elf_word uint32_t #define elf_sword int32_t #define bswapSZs bswap32s -#include "hw/elf_ops.h" +#include "hw/elf_ops.h.inc" #undef elfhdr #undef elf_phdr @@ -327,7 +327,7 @@ static void *load_at(int fd, off_t offset, size_t size) #define elf_sword int64_t #define bswapSZs bswap64s #define SZ 64 -#include "hw/elf_ops.h" +#include "hw/elf_ops.h.inc" const char *load_elf_strerror(ssize_t error) { diff --git a/linux-user/elfload.c b/linux-user/elfload.c index f4a0b78c75..a0999dac15 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3572,7 +3572,7 @@ static const char *lookup_symbolxx(struct syminfo *s, uint64_t orig_addr) return ""; } -/* FIXME: This should use elf_ops.h */ +/* FIXME: This should use elf_ops.h.inc */ static int symcmp(const void *s0, const void *s1) { struct elf_sym *sym0 = (struct elf_sym *)s0; From patchwork Thu Apr 25 11:01:49 2024 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: 13643145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 46396C4345F for ; Thu, 25 Apr 2024 11:08:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwu4-0002K9-LE; Thu, 25 Apr 2024 07:04:36 -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 1rzwtJ-0000B0-T9 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:03 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtA-0000I3-Sq for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:44 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2de233961caso7891981fa.3 for ; Thu, 25 Apr 2024 04:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043011; x=1714647811; darn=nongnu.org; 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=2PQHJ5tsa1+Iw7rGUJbqHRL8DwWj2o26FTHLneT25lU=; b=qF5vPcOkQSHZM1NLwAfCBQMhgKN/jwiR9NQS6Ch89FK9VZIjHtD/ZTHN1U1oybFX9/ j8km1Ge599RgH2hYhdMMQ/9FzK9rsJHIXk5WHMmT8xx79+NQvbvqp5RLY1B27ZBbLhsR E45oDsbfz2XHLQloCcYrmAb5HSOCzmCIUypH5bGamARXwIYgz02OqGSD6sFYcSxnIu0O nFAApaf1RT58vkwUKnTcdFQ4dEHldFNiO4Kffc2BISTerJOpHnHPdnFE0AyaIa4UhO5/ x7u5Jrz2uRTFxoE08ZqEIvE44frv9LSbx6Wd1fQU6PgRYJbq817/YvCTEYUE8sXv3918 GWFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043011; x=1714647811; 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=2PQHJ5tsa1+Iw7rGUJbqHRL8DwWj2o26FTHLneT25lU=; b=CW+2pwd07fyF+AOcDJ1u0LQb0PXIMzJjiJseJWGJfm18gjcwtUAsnRptDkD75BaPo4 gwY4KZ6bjpdQ5FUmI7RH7Hgmdt9fy8yqp8yr5/r2BzaDQD9HIahniWnAFsMwN67lZRx+ LNbVI9XVj2KJImO3ZM5LSUFYegczNvN/6DlGoIu9hCLFqaM7i47a+OphuoKONZJZdswG L2Q4hSJX6ZoyMbpx3ekxp8X5bN0kZkqkLT7WnT6Hb75tGJNutAhvjNTajqHVQB2Nx5Rk zKVESalVnj3tyI8Tw/vPHQOr8CzlmQJO82dOx4iVj0eKnruCHvysJgPotoGpTZjmFMS9 tCSA== X-Gm-Message-State: AOJu0Yxt7KNJPw4jQR8dem6nJymdQO++FKYLc50joCw3ytmi0F/PfLF1 +M9r8WbtvV5V4QOhqGy+L8U7ObXq3USDHikQs9o/XFeDRQZyWRGq8zC716+9bAvr+KXvN724+cm Z X-Google-Smtp-Source: AGHT+IHjXpphfPvfQQeNi/tfubBrsdyX+KmCThTxoYcIYz0zKxSB3Us2byui4wQDChBJF2z3pJlAyg== X-Received: by 2002:a2e:b353:0:b0:2d8:3e07:5651 with SMTP id q19-20020a2eb353000000b002d83e075651mr4356960lja.34.1714043011391; Thu, 25 Apr 2024 04:03:31 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id bd25-20020a05600c1f1900b00419f7d6879dsm18832137wmb.8.2024.04.25.04.03.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Anton Johansson , Max Filippov Subject: [PULL 16/22] hw/xtensa: Include missing 'exec/cpu-common.h' in 'bootparam.h' Date: Thu, 25 Apr 2024 13:01:49 +0200 Message-ID: <20240425110157.20328-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org cpu_physical_memory_write() is declared in "exec/cpu-common.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Message-Id: <20240418192525.97451-21-philmd@linaro.org> --- hw/xtensa/bootparam.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xtensa/bootparam.h b/hw/xtensa/bootparam.h index ade7891ec5..f57ff850bc 100644 --- a/hw/xtensa/bootparam.h +++ b/hw/xtensa/bootparam.h @@ -1,6 +1,8 @@ #ifndef HW_XTENSA_BOOTPARAM_H #define HW_XTENSA_BOOTPARAM_H +#include "exec/cpu-common.h" + #define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/ #define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */ #define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */ From patchwork Thu Apr 25 11:01:50 2024 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: 13643147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EF9A9C19F4F for ; Thu, 25 Apr 2024 11:09:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwuK-0002u4-0Y; Thu, 25 Apr 2024 07:04:52 -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 1rzwtJ-0000Az-So for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:01 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtA-0000Ia-SM for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:44 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41a72f3a1edso6922155e9.2 for ; Thu, 25 Apr 2024 04:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043016; x=1714647816; darn=nongnu.org; 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=q5xgdXCGND9O0mxiiZCYBTt0WDd2teRijPgGqLuPJXs=; b=KLiWuHsUAeuPx4sl4ND4n1oy5qSZ+UIdFxCcJey6GEAV02TWen3HmX6Tb5RcYbDIRU 5Zes31VVjrwyd487fvDRHZ38g7tFP+xqrf16DtPLJJfzITgoAQoPcfKUPLmwHn3Ae4FM 2FgqqNOv5ernMV70wfkFg+oVOXTF/y3gmPJ3ZaC3+vgY/5zN+oJJDLYdosCbHxAk7wNe HJhG9pSmv2EPUN0Z1wInparDlwG+HMrCgmSj3wrj1D6Zvgd6CCsDpn2xrWZzzZ5cPA+z 2JJgXhrdQM7NbxE2Xv+79vOmTwWqu77cHQVpiAlMtRjadSMx6mC4NgKmBwuZgaZ36msP i31g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043016; x=1714647816; 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=q5xgdXCGND9O0mxiiZCYBTt0WDd2teRijPgGqLuPJXs=; b=Uk0T8iZCSMJYoF3oVAkId5WkQUJKnXMUgnCgyv1SEyaur7XYufm29/0acWNKR0c/x+ HVoT2jhwNekIsa674jYCZRiIdPQTTU5CZ6YpChpFalIsT2A4uCyfTDNEsyjf9sOFvKOh VTAY51LwfhglnR/IIF2KsD8bTQca3p2Y5jOmDthZszynY2btzdUaanEA9WfMyzcG6VVw SWHFvi/QNsGb6hpvQ1G2bzR5aH9X1ysY14XuJNIrQVCl6EJHbJDHzPzsxCMiCsSa0yzU KIOZs8ACPrdmjkKIs1oS1FLr3Dl2+lNHPmQWe/BwlOHbk6qrNGd3daIdZEApjC3KfM9x LEcQ== X-Gm-Message-State: AOJu0YwCk/YTshnfUICUioSjN62ffRRrKEMn9fFjQNNqFgCZ9SIGjmRn TrvmILOaxEipb4NezEyHJ0a02RsezCnJ+3E5purXQp3VNcHQ5A53kUONxGxenJnIbPp+kPe4Wh2 T X-Google-Smtp-Source: AGHT+IGo4/4ds+aqwK0mOG61Mddx3imkACop4W8f2nNt+x5+kxgtBIL46K0+6irigKjFcRzE/192Mw== X-Received: by 2002:adf:f146:0:b0:343:b686:89a0 with SMTP id y6-20020adff146000000b00343b68689a0mr3968839wro.13.1714043016769; Thu, 25 Apr 2024 04:03:36 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id x13-20020a5d54cd000000b0034335e47102sm19464539wrv.113.2024.04.25.04.03.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?In=C3=A8s_Varhol?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Arnaud Minier Subject: [PULL 17/22] hw/misc : Correct 5 spaces indents in stm32l4x5_exti Date: Thu, 25 Apr 2024 13:01:50 +0200 Message-ID: <20240425110157.20328-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Inès Varhol Signed-off-by: Inès Varhol Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240421141455.116548-1-ines.varhol@telecom-paris.fr> Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/stm32l4x5_exti.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/stm32l4x5_exti.c b/hw/misc/stm32l4x5_exti.c index 9fd859160d..5c55ee4268 100644 --- a/hw/misc/stm32l4x5_exti.c +++ b/hw/misc/stm32l4x5_exti.c @@ -59,22 +59,22 @@ static const uint32_t exti_romask[EXTI_NUM_REGISTER] = { static unsigned regbank_index_by_irq(unsigned irq) { - return irq >= EXTI_MAX_IRQ_PER_BANK ? 1 : 0; + return irq >= EXTI_MAX_IRQ_PER_BANK ? 1 : 0; } static unsigned regbank_index_by_addr(hwaddr addr) { - return addr >= EXTI_IMR2 ? 1 : 0; + return addr >= EXTI_IMR2 ? 1 : 0; } static unsigned valid_mask(unsigned bank) { - return MAKE_64BIT_MASK(0, irqs_per_bank[bank]); + return MAKE_64BIT_MASK(0, irqs_per_bank[bank]); } static unsigned configurable_mask(unsigned bank) { - return valid_mask(bank) & ~exti_romask[bank]; + return valid_mask(bank) & ~exti_romask[bank]; } static void stm32l4x5_exti_reset_hold(Object *obj) From patchwork Thu Apr 25 11:01:51 2024 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: 13643148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 325C4C19F4F for ; Thu, 25 Apr 2024 11:09:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwuJ-0002rz-CK; Thu, 25 Apr 2024 07:04:51 -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 1rzwtN-0000Du-M8 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:03 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtH-0000Jz-Lk for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:52 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41b3692b508so6091645e9.1 for ; Thu, 25 Apr 2024 04:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043022; x=1714647822; darn=nongnu.org; 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=3jM66TtA9+JPWnnaJ/wdkFyoBPGKJrTnB7XlYnSXjfw=; b=q67tICheuqQtUFBIwqS8xdmp9ZjCnwej4ObCq0rfBW0NnQ5jxQfOibhMOdM4cS/LZO 7uEqp3eN7KJ/f6mHWt0GgKd4kvOj8bCevQQIsTWS4PDAgRVEmw/JWezo/nUIlZCDleWp lPlHGABqys96bi7bcWl/Baf6f5EW3jNOhUcNwmrFBj/pLdJ+BcS+V4RB8VTY4X/b+ti5 a4ZNF4Sc7vaIwUXU7DedWrG1qF9SG8ty02pFOLgjKUZnkecwOxCWWJ5Y5jQlgRwxFcYG uUQhoPrnbf3PSDWRrSG/RhlgDYK5kXAhZvVj86moZEn003H0yMemIislAARfYsVmG8uR Hbkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043022; x=1714647822; 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=3jM66TtA9+JPWnnaJ/wdkFyoBPGKJrTnB7XlYnSXjfw=; b=MBvshvN+3TEyZF207hQSpIV0u134DHOj7jYMY1DdMGrCEcZplqMr1JDa9HDpHTpEix 91G2qoA7ZyNGjplMh3GHLkGFUgRKfs89xzXo0BPW4XYfoJRMmvxFe/1O1dgx/M/12Yeq 6bN4kvXgCA1pxc/eC24RwGHhZfUw/zKLufwbwwYbV65wZa0NpzIrl8q2xIJeSA7O1B95 UrkWgF8vANrvcHCcEI2uLvQy4JPPdjTv4L8BIZQyEpZw+AHfarH81kDav1JN8LIo2BzN 05q6tca96Sn40riTTtMa0B/ozODxJliuhdmrciQICpShj4EuG4qnoIgTg9Mr2PIE6SNQ E9xA== X-Gm-Message-State: AOJu0YzyhRznqnFYNgylpA8NuOG5Xl/+tb0+rsUBsnIaGlx6M1xUtIlp ag7sQJ77fjere6oQDtk1jmlGm1G6JdPB41hmV6M92M8esr1yFxFH3Ml2ktUsJNuIIZISBu02nRi k X-Google-Smtp-Source: AGHT+IFep8mayYoTqo1tEoWaxYRBNnZQKy6JlVbPvXcPmoksWBiLC7hipxkwT32wWx0hqDlaV9VWvQ== X-Received: by 2002:a05:600c:4ecb:b0:419:ed35:e312 with SMTP id g11-20020a05600c4ecb00b00419ed35e312mr4210635wmq.21.1714043022268; Thu, 25 Apr 2024 04:03:42 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id u11-20020a05600c138b00b004187450e4cesm30787552wmf.29.2024.04.25.04.03.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 18/22] hw/i386/pc_sysfw: Remove unused parameter from pc_isa_bios_init() Date: Thu, 25 Apr 2024 13:01:51 +0200 Message-ID: <20240425110157.20328-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240422200625.2768-2-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_sysfw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 3efabbbab2..87b5bf59d6 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -41,8 +41,7 @@ #define FLASH_SECTOR_SIZE 4096 static void pc_isa_bios_init(MemoryRegion *rom_memory, - MemoryRegion *flash_mem, - int ram_size) + MemoryRegion *flash_mem) { int isa_bios_size; MemoryRegion *isa_bios; @@ -186,7 +185,7 @@ static void pc_system_flash_map(PCMachineState *pcms, if (i == 0) { flash_mem = pflash_cfi01_get_memory(system_flash); - pc_isa_bios_init(rom_memory, flash_mem, size); + pc_isa_bios_init(rom_memory, flash_mem); /* Encrypt the pflash boot ROM */ if (sev_enabled()) { From patchwork Thu Apr 25 11:01:52 2024 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: 13643150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0951EC10F15 for ; Thu, 25 Apr 2024 11:11:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwuW-0003JF-Qa; Thu, 25 Apr 2024 07:05:06 -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 1rzwtX-0000IJ-HN for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:09 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtN-0000Ky-B3 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:03:55 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-41b3692b508so6092365e9.1 for ; Thu, 25 Apr 2024 04:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043028; x=1714647828; darn=nongnu.org; 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=W7uwePuX3rPWTRA+fw+W1FX6Shl9Ifmx73up+GoZgb0=; b=CFwqAPvFeUPkhH4JNVmmXc9RzcanHFPge6GaaXeL2rXurKpilMQmpVqVsGz32mxv6v pGWBI3PACyXx3XAKNi5uBH7D6+5BAiP5Z7GNBCfu2hidZx6UDASwjZIuS7yXeEK31Zag F3mokBzLLIgZcEste0+Y+dV5FAVJKYp7OLNyHJPDxI54AqSPLZaT1shztRSONi7pvBDz fN5+Ew2IS2A/T9Rwe/CT9LPzXd/+i43LDx36X9FimFBzIzk6kAvYDI9Lfze+2tHN+03B IO4pYV5t/PVtQ1rKsxqZXV1IfYz+SX00FS5yACi7Nbyc0uqxVHX3o3k1xpjCWK8UiUhf L9cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043028; x=1714647828; 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=W7uwePuX3rPWTRA+fw+W1FX6Shl9Ifmx73up+GoZgb0=; b=V7mYkam3QXfpO+3JbnXBqXdOV8JnxxqrqykgCylHKF86KqzPrRhvCzj7518ZLefbwT VDA79d5UQBB1/XDK5/3xQ3KttqVRVXEEokKLUnHcxqK4g0UEr4KU9C7J67wQaOk0FLYj LEyG96VE0/ETdKJglF7uZ25WuYUXpjbA3Y0R5u4A+NLndNaSKkb7QXE3JcZsihTdyi3/ rg0n8vH+iAgC4ll6uqoSVa6gs0KCi8LkLVjFAtOKbVfCp4FP/ucX5S7k+s+d5husVgvL VgUvt6ZNYd+sHA8v36XHRXOTyzfT5gav+lJc5Bz3/CuAXvvcy4kRxJf+2qL3Az6jtTe4 OTrQ== X-Gm-Message-State: AOJu0YzHKzY6bP7q8vSftzNUKsbT2vVYi3PhtQcO1ppGxeys9VvZ5Bex eJxjA19YAJlAz8/FISpZJi6cdXyT8ozFg4yeyt+eEJytmjLTWOvizLnfNxTgqO0zfm3AUqbCz7b e X-Google-Smtp-Source: AGHT+IHNDMb4unbEF38ERzGAuYkwXlMJIjH7EVKROZcBO6j/BgEOn6BE5qQWhB8ADTUv7U6/8UAb4g== X-Received: by 2002:a05:600c:3502:b0:41a:fe41:80e4 with SMTP id h2-20020a05600c350200b0041afe4180e4mr3402391wmq.0.1714043027837; Thu, 25 Apr 2024 04:03:47 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id jg1-20020a05600ca00100b0041b25a70a85sm3623801wmb.30.2024.04.25.04.03.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Xiaoyao Li , Yongwei Ma , Babu Moger , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 19/22] hw/core/machine: Introduce the module as a CPU topology level Date: Thu, 25 Apr 2024 13:01:52 +0200 Message-ID: <20240425110157.20328-20-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu In x86, module is the topology level above core, which contains a set of cores that share certain resources (in current products, the resource usually includes L2 cache, as well as module scoped features and MSRs). Though smp.clusters could also share the L2 cache resource [1], there are following reasons that drive us to introduce the new smp.modules: * As the CPU topology abstraction in device tree [2], cluster supports nesting (though currently QEMU hasn't support that). In contrast, (x86) module does not support nesting. * Due to nesting, there is great flexibility in sharing resources on cluster, rather than narrowing cluster down to sharing L2 (and L3 tags) as the lowest topology level that contains cores. * Flexible nesting of cluster allows it to correspond to any level between the x86 package and core. * In Linux kernel, x86's cluster only represents the L2 cache domain but QEMU's smp.clusters is the CPU topology level. Linux kernel will also expose module level topology information in sysfs for x86. To avoid cluster ambiguity and keep a consistent CPU topology naming style with the Linux kernel, we introduce module level for x86. The module is, in existing hardware practice, the lowest layer that contains the core, while the cluster is able to have a higher topological scope than the module due to its nesting. Therefore, place the module between the cluster and the core: drawer/book/socket/die/cluster/module/core/thread With the above topological hierarchy order, introduce module level support in MachineState and MachineClass. [1]: https://lore.kernel.org/qemu-devel/c3d68005-54e0-b8fe-8dc1-5989fe3c7e69@huawei.com/ [2]: https://www.kernel.org/doc/Documentation/devicetree/bindings/cpu/cpu-topology.txt Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Tested-by: Babu Moger Message-ID: <20240424154929.1487382-2-zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 4 ++++ hw/core/machine-smp.c | 2 +- hw/core/machine.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 69c1ba45cf..2fa800f11a 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -144,6 +144,7 @@ typedef struct { * provided SMP configuration * @books_supported - whether books are supported by the machine * @drawers_supported - whether drawers are supported by the machine + * @modules_supported - whether modules are supported by the machine */ typedef struct { bool prefer_sockets; @@ -152,6 +153,7 @@ typedef struct { bool has_clusters; bool books_supported; bool drawers_supported; + bool modules_supported; } SMPCompatProps; /** @@ -339,6 +341,7 @@ typedef struct DeviceMemoryState { * @sockets: the number of sockets in one book * @dies: the number of dies in one socket * @clusters: the number of clusters in one die + * @modules: the number of modules in one cluster * @cores: the number of cores in one cluster * @threads: the number of threads in one core * @max_cpus: the maximum number of logical processors on the machine @@ -350,6 +353,7 @@ typedef struct CpuTopology { unsigned int sockets; unsigned int dies; unsigned int clusters; + unsigned int modules; unsigned int cores; unsigned int threads; unsigned int max_cpus; diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 27864c9507..2e68fcfdfd 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -266,7 +266,7 @@ void machine_parse_smp_config(MachineState *ms, unsigned int machine_topo_get_cores_per_socket(const MachineState *ms) { - return ms->smp.cores * ms->smp.clusters * ms->smp.dies; + return ms->smp.cores * ms->smp.modules * ms->smp.clusters * ms->smp.dies; } unsigned int machine_topo_get_threads_per_socket(const MachineState *ms) diff --git a/hw/core/machine.c b/hw/core/machine.c index 582c2df37a..9966641159 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1157,6 +1157,7 @@ static void machine_initfn(Object *obj) ms->smp.sockets = 1; ms->smp.dies = 1; ms->smp.clusters = 1; + ms->smp.modules = 1; ms->smp.cores = 1; ms->smp.threads = 1; From patchwork Thu Apr 25 11:01:53 2024 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: 13643136 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A92C5C4345F for ; Thu, 25 Apr 2024 11:05:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwu4-0002Ku-SB; Thu, 25 Apr 2024 07:04:36 -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 1rzwtd-0000LH-PR for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:11 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtZ-0000MP-9W for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:08 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-41b51ee24f9so2088585e9.1 for ; Thu, 25 Apr 2024 04:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043034; x=1714647834; darn=nongnu.org; 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=g96vdGUPlIMAMR0tgpTdGd3qjyGWYgQDQCU+2PoDhEA=; b=lXLKlDz+kj0vrE/FQpclKomG+nbgEYsQfQzMsUyDCTJwlryROR7hW3iY179ObPbiyP t0vI9mCSNlAvvhHTG1DaqPrtPOqqKNyTsbOGxJy8S7wV4+T+yBdZpGGWkME0UenRJwNj oxJ+ofX5FPu1k2s/pVt9xcvmbAATR/osfMBI1v73u8LhKyjtpfVQhGXX/Hdr3zAm7ptE pQPHpXJWUaeZ+FXm1bMKop5BsgdPXYKR2imr/AHiZ5a1/NWyoxc5tFYN0vSl2vBomU5W 9hMaeuepLAz+95qUq3H0T7MlR7848nP5uD7EH9WTb6FidI1/iGVUgZHBpVERx440mi+a HvuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043034; x=1714647834; 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=g96vdGUPlIMAMR0tgpTdGd3qjyGWYgQDQCU+2PoDhEA=; b=t99PqGslavUEw9/zZlfptwwHfON+gCONro1ttPwl1Yz0vIuQUdGCRVJgVwzdo7mKJQ slQnjecVtcmKTq3LDoM0WBkIdTQzW5by1H5bhpw5vPl0luxcGxUXlL6uXKfaK5yBlE9o izDjafCU9cJ6YvfGW6tF8pQpNOxeMoez8cII/KP0qei87m6LPJRYRIuuwlNydDlV8n0A z4+hELKM5LUL/tFMtPt/BIkhJlDaw6WoC7w5k48zV7Uxrq8WrYs5/3s/csApMoRY/e97 qR6lVWLNfqgNDIv2AWrO4uIUNbMHW2cHrgnc6ydsG4Kuk829qRPsXl+0aCg4MdjvyDWg BTpA== X-Gm-Message-State: AOJu0YyGHeGX+U/Md3Qi7AOocSX+q6i2YHYEroFIoc4NLacrVpsoFdZa y9u8IwTAJUmszaZO4oEYoJoEi/2wJc4hIM/k+HzRa+JO4SqSaEFettYq+D3ZulwsoTjbdAwtfLK 8 X-Google-Smtp-Source: AGHT+IGjQzm6j03xu7otoMVLUkfmm4z/psoO2x+hsMHYrcIwQPKyBdHoI4vAt2n90sdZN9DGeD4D4g== X-Received: by 2002:a05:600c:4fc6:b0:41a:3369:61a3 with SMTP id o6-20020a05600c4fc600b0041a336961a3mr2073458wmq.5.1714043033731; Thu, 25 Apr 2024 04:03:53 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c46c600b0041892857924sm27165769wmo.36.2024.04.25.04.03.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Xiaoyao Li , Yongwei Ma , Babu Moger , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Eric Blake , Paolo Bonzini Subject: [PULL 20/22] hw/core/machine: Support modules in -smp Date: Thu, 25 Apr 2024 13:01:53 +0200 Message-ID: <20240425110157.20328-21-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu Add "modules" parameter parsing support in -smp. Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Tested-by: Babu Moger Acked-by: Markus Armbruster Message-ID: <20240424154929.1487382-3-zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- qapi/machine.json | 3 +++ hw/core/machine-smp.c | 39 +++++++++++++++++++++++++++++++++------ hw/core/machine.c | 1 + system/vl.c | 3 +++ 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 3e9cc3f17d..48f98e7d9f 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1696,6 +1696,8 @@ # # @clusters: number of clusters per parent container (since 7.0) # +# @modules: number of modules per parent container (since 9.1) +# # @cores: number of cores per parent container # # @threads: number of threads per core @@ -1709,6 +1711,7 @@ '*sockets': 'int', '*dies': 'int', '*clusters': 'int', + '*modules': 'int', '*cores': 'int', '*threads': 'int', '*maxcpus': 'int' } } diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 2e68fcfdfd..2b93fa99c9 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -51,6 +51,10 @@ static char *cpu_hierarchy_to_string(MachineState *ms) g_string_append_printf(s, " * clusters (%u)", ms->smp.clusters); } + if (mc->smp_props.modules_supported) { + g_string_append_printf(s, " * modules (%u)", ms->smp.modules); + } + g_string_append_printf(s, " * cores (%u)", ms->smp.cores); g_string_append_printf(s, " * threads (%u)", ms->smp.threads); @@ -88,6 +92,7 @@ void machine_parse_smp_config(MachineState *ms, unsigned sockets = config->has_sockets ? config->sockets : 0; unsigned dies = config->has_dies ? config->dies : 0; unsigned clusters = config->has_clusters ? config->clusters : 0; + unsigned modules = config->has_modules ? config->modules : 0; unsigned cores = config->has_cores ? config->cores : 0; unsigned threads = config->has_threads ? config->threads : 0; unsigned maxcpus = config->has_maxcpus ? config->maxcpus : 0; @@ -103,6 +108,7 @@ void machine_parse_smp_config(MachineState *ms, (config->has_sockets && config->sockets == 0) || (config->has_dies && config->dies == 0) || (config->has_clusters && config->clusters == 0) || + (config->has_modules && config->modules == 0) || (config->has_cores && config->cores == 0) || (config->has_threads && config->threads == 0) || (config->has_maxcpus && config->maxcpus == 0)) { @@ -115,6 +121,20 @@ void machine_parse_smp_config(MachineState *ms, * If not supported by the machine, a topology parameter must be * omitted. */ + if (!mc->smp_props.modules_supported && config->has_modules) { + if (config->modules > 1) { + error_setg(errp, "modules not supported by this " + "machine's CPU topology"); + return; + } else { + /* Here modules only equals 1 since we've checked zero case. */ + warn_report("Deprecated CPU topology (considered invalid): " + "Unsupported modules parameter mustn't be " + "specified as 1"); + } + } + modules = modules > 0 ? modules : 1; + if (!mc->smp_props.clusters_supported && config->has_clusters) { if (config->clusters > 1) { error_setg(errp, "clusters not supported by this " @@ -185,11 +205,13 @@ void machine_parse_smp_config(MachineState *ms, cores = cores > 0 ? cores : 1; threads = threads > 0 ? threads : 1; sockets = maxcpus / - (drawers * books * dies * clusters * cores * threads); + (drawers * books * dies * clusters * + modules * cores * threads); } else if (cores == 0) { threads = threads > 0 ? threads : 1; cores = maxcpus / - (drawers * books * sockets * dies * clusters * threads); + (drawers * books * sockets * dies * + clusters * modules * threads); } } else { /* prefer cores over sockets since 6.2 */ @@ -197,22 +219,26 @@ void machine_parse_smp_config(MachineState *ms, sockets = sockets > 0 ? sockets : 1; threads = threads > 0 ? threads : 1; cores = maxcpus / - (drawers * books * sockets * dies * clusters * threads); + (drawers * books * sockets * dies * + clusters * modules * threads); } else if (sockets == 0) { threads = threads > 0 ? threads : 1; sockets = maxcpus / - (drawers * books * dies * clusters * cores * threads); + (drawers * books * dies * clusters * + modules * cores * threads); } } /* try to calculate omitted threads at last */ if (threads == 0) { threads = maxcpus / - (drawers * books * sockets * dies * clusters * cores); + (drawers * books * sockets * dies * + clusters * modules * cores); } } - total_cpus = drawers * books * sockets * dies * clusters * cores * threads; + total_cpus = drawers * books * sockets * dies * + clusters * modules * cores * threads; maxcpus = maxcpus > 0 ? maxcpus : total_cpus; cpus = cpus > 0 ? cpus : maxcpus; @@ -222,6 +248,7 @@ void machine_parse_smp_config(MachineState *ms, ms->smp.sockets = sockets; ms->smp.dies = dies; ms->smp.clusters = clusters; + ms->smp.modules = modules; ms->smp.cores = cores; ms->smp.threads = threads; ms->smp.max_cpus = maxcpus; diff --git a/hw/core/machine.c b/hw/core/machine.c index 9966641159..494b712a76 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -881,6 +881,7 @@ static void machine_get_smp(Object *obj, Visitor *v, const char *name, .has_sockets = true, .sockets = ms->smp.sockets, .has_dies = true, .dies = ms->smp.dies, .has_clusters = true, .clusters = ms->smp.clusters, + .has_modules = true, .modules = ms->smp.modules, .has_cores = true, .cores = ms->smp.cores, .has_threads = true, .threads = ms->smp.threads, .has_maxcpus = true, .maxcpus = ms->smp.max_cpus, diff --git a/system/vl.c b/system/vl.c index c644222982..7756eac81e 100644 --- a/system/vl.c +++ b/system/vl.c @@ -741,6 +741,9 @@ static QemuOptsList qemu_smp_opts = { }, { .name = "clusters", .type = QEMU_OPT_NUMBER, + }, { + .name = "modules", + .type = QEMU_OPT_NUMBER, }, { .name = "cores", .type = QEMU_OPT_NUMBER, From patchwork Thu Apr 25 11:01:54 2024 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: 13643142 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5B2DFC4345F for ; Thu, 25 Apr 2024 11:07:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwvZ-0004Ty-VN; Thu, 25 Apr 2024 07:06:10 -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 1rzwtd-0000LG-P3 for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:11 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtZ-0000Mw-9g for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:08 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2dd6c14d000so9581821fa.0 for ; Thu, 25 Apr 2024 04:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043039; x=1714647839; darn=nongnu.org; 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=vykN0pIt49J3GEMpH2YakbfFLS9d+NOdnblTzedh0DY=; b=ge/5W1Z5UVX3PPgyKn4UHFd9nbESU5wtOTP5095Bm6afywSeBiHPR5htX1M130Qno2 XaV2Y+Sal3luYptmwrG+oNOxp/JMTvsZL9PjQhgsiqozUKtxQ3qymfYVfIsL1hnp+w7U 3WP+c3tsTB9UmQ7oAh1nI1HXpLX52wAkmUmoB4mMKULchs7HLoE/PJRl9ZhUBrgEJVcb kRxsZ/RV/ShdXmv4b+vXS42eZFWq8RBOhH54OrSuD+FCQsDlv8IoJ9ryvWzD1rvYp4Tt dRt6r0yr5VmCD+4kCgfU08vUV06QEsJcJ7vFG+xj0q+Yk/9nNNtLsa/pMHUbNssLhWd/ 7hyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043039; x=1714647839; 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=vykN0pIt49J3GEMpH2YakbfFLS9d+NOdnblTzedh0DY=; b=wFh0wdH2E4MzO+j7VZA9fpWLC1G0QKfIUvbEmqolVrhHbMlVIXce1dE9JJc6MpLCfq MGjLILMiwyq+2BfnDm4ljUdyYfVHZ/g5pee8tkgGAvlHmwSqGtjj2QPwcTBPiCQM+hfB bBvGlhW+ngWiIA7RNwt818arg6uWukEyEhZBLLrGENIxD9OM/wXaozIkHCMSWR7dEOl8 +nUouZXVZaSjQEqKUoJO70NJeL0ImiMgIe59s7v94HjcvntRN6TTskAlIocpka8PN1an TnSCKIdYiKDj6os9jBV/K5Tv+6IbyDaJLn+WQLdXMJ2GZW69GILdNtfnyBCg7awep6dZ Vkxg== X-Gm-Message-State: AOJu0YwAZbTP9Hng+h6JhUnmIFfkLaLF09MNCI6ASxElsf7P6gw8HST2 Mn7v2BzxqZHDN38YYVcZbNnTh/biVdqesRusAfQqksAwj3DL+dS0CNgxb2cL/BL4J0xdb2XLx3z M X-Google-Smtp-Source: AGHT+IH8mFAQdgVe8Ug584icuarIPeRoP8mdneCGHYZqIATf4nok2omqYQTD+Ae/+hRL3KyPU8mLmQ== X-Received: by 2002:a2e:bb83:0:b0:2d8:901f:7f45 with SMTP id y3-20020a2ebb83000000b002d8901f7f45mr3356811lje.13.1714043039569; Thu, 25 Apr 2024 04:03:59 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id e4-20020a05600c4e4400b0041b0f10fc7asm5000576wmq.31.2024.04.25.04.03.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:03:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Xiaoyao Li , Yongwei Ma , Babu Moger , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Eric Blake Subject: [PULL 21/22] hw/core: Introduce module-id as the topology subindex Date: Thu, 25 Apr 2024 13:01:54 +0200 Message-ID: <20240425110157.20328-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu Add module-id in CpuInstanceProperties, to locate the CPU with module level. Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Tested-by: Babu Moger Acked-by: Markus Armbruster Message-ID: <20240424154929.1487382-4-zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- qapi/machine.json | 4 ++++ hw/core/machine-hmp-cmds.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/qapi/machine.json b/qapi/machine.json index 48f98e7d9f..bce6e1bbc4 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -988,6 +988,9 @@ # @cluster-id: cluster number within the parent container the CPU # belongs to (since 7.1) # +# @module-id: module number within the parent container the CPU belongs +# to (since 9.1) +# # @core-id: core number within the parent container the CPU belongs to # # @thread-id: thread number within the core the CPU belongs to @@ -1005,6 +1008,7 @@ '*socket-id': 'int', '*die-id': 'int', '*cluster-id': 'int', + '*module-id': 'int', '*core-id': 'int', '*thread-id': 'int' } diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index a6ff6a4875..8701f00cc7 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -87,6 +87,10 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n", c->cluster_id); } + if (c->has_module_id) { + monitor_printf(mon, " module-id: \"%" PRIu64 "\"\n", + c->module_id); + } if (c->has_core_id) { monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); } From patchwork Thu Apr 25 11:01:55 2024 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: 13643151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C7D8FC4345F for ; Thu, 25 Apr 2024 11:11:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwvx-0005cY-Bb; Thu, 25 Apr 2024 07:06:33 -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 1rzwte-0000LM-NY for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:11 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwtb-0000OF-5o for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:04:09 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-347e635b1fcso639962f8f.1 for ; Thu, 25 Apr 2024 04:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714043045; x=1714647845; darn=nongnu.org; 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=DtMNR1ZQjJCcNYkkejZVBvEmwe3F+2PjUE+kGb5DBZI=; b=qQ8XGqfKyttfqQ17Re/ThAnwmjlzoPq9rO1qUq/w6yY5A71wbKOdIN8SCHl2A22jjN O3Ae6fIwtJcAmvtIPr+PWUTPutzI9jMKQUlnFwIn07K3Opu7hDSqeutdoL3IuvTezjfe w7Zaj9ygGl+95fhQp5yK5FccE0OIqDUzyDquhlVEjXl4LUWEisOqxkUHAYZ2UzZQFKOI wGUhgGJ4iXsdmXhGQI7OBpqaja9wS8FtgYvrQEX2ozOdl0CEIuy6GWLT4SMAciIytFX8 4zDk06SRM5R7w9+5w7PtcIkke8e5Opl7BonYK3n+J2J0WfUuIQp5tmX5sPaNoS5kF4CX WzLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714043045; x=1714647845; 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=DtMNR1ZQjJCcNYkkejZVBvEmwe3F+2PjUE+kGb5DBZI=; b=lmzBaij28V5PGGBJ/U2NwieYF1ew1nIl1rZUK3l2A7E7b5LiShRmROqIsxJQoc5F3b IfwbzVarGD5KdQjxYz8uFzcXNliz3HTG8mBPXc0ZjOQx3NX5VziI2Us9YuwQg1xsQx8o AuqoyGGj9b2IHbeWNSdGIyBfRJ3noFgYVrRQXaQPP7wmaAjLPODqhLk3ehmq/04/XWb3 uDBKSIFKqGLIN0oKwIY0aHRzbX072Hklv5a1NLJsCirTcA5k87nRFKLS0p13DfgWClmE IoFQHhcKClMQMA3Z7x5f/NWSzVATtAXL0V3lOx2K5O7rxTTmvJP8ibDaUiJkKoY5zNtm mq1Q== X-Gm-Message-State: AOJu0Yyygah4TkJYtf8RhyrVOaVVF7e89IRiZKaLZnDBx3htGOpxdz1x Yv9sCgoiS4tzBhlPaL1mgZlr6W9KaSplC+hcosb2fxKpkWwqyALBtETf2cSU3b5RtrCbaPICzk7 D X-Google-Smtp-Source: AGHT+IEWNircr86tkVldy1EsXrXAxD/kzzSUIMWxBrCkq+T/LXkDmvFt7vckXR5njOJa/f9q3055aQ== X-Received: by 2002:a5d:6e5d:0:b0:34b:1f34:9c06 with SMTP id j29-20020a5d6e5d000000b0034b1f349c06mr3712985wrz.24.1714043045068; Thu, 25 Apr 2024 04:04:05 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id u17-20020adfeb51000000b00347321735a6sm19543079wrn.66.2024.04.25.04.04.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:04:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Yongwei Ma , Babu Moger , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 22/22] hw/core: Support module-id in numa configuration Date: Thu, 25 Apr 2024 13:01:55 +0200 Message-ID: <20240425110157.20328-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu Module is a level above the core, thereby supporting numa configuration on the module level can bring user more numa flexibility. This is the natural further support for module level. Add module level support in numa configuration. Tested-by: Yongwei Ma Signed-off-by: Zhao Liu Tested-by: Babu Moger Message-ID: <20240424154929.1487382-5-zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 494b712a76..0dec48e802 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -800,6 +800,11 @@ void machine_set_cpu_numa_node(MachineState *machine, return; } + if (props->has_module_id && !slot->props.has_module_id) { + error_setg(errp, "module-id is not supported"); + return; + } + if (props->has_cluster_id && !slot->props.has_cluster_id) { error_setg(errp, "cluster-id is not supported"); return; @@ -824,6 +829,11 @@ void machine_set_cpu_numa_node(MachineState *machine, continue; } + if (props->has_module_id && + props->module_id != slot->props.module_id) { + continue; + } + if (props->has_cluster_id && props->cluster_id != slot->props.cluster_id) { continue; @@ -1226,6 +1236,12 @@ static char *cpu_slot_to_string(const CPUArchId *cpu) } g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id); } + if (cpu->props.has_module_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "module-id: %"PRId64, cpu->props.module_id); + } if (cpu->props.has_core_id) { if (s->len) { g_string_append_printf(s, ", ");