From patchwork Fri May 2 21:45:47 2025 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: 886649 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp1018427wrq; Fri, 2 May 2025 14:46:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4eIYeKAn9OQc8LxIJyZVYuViAj9lGtWpY994M7MH5LX6LcG/PUEc1CCoBFQQaE84riM58UQ==@linaro.org X-Google-Smtp-Source: AGHT+IGxqAtmGacCUYhTBiMuhE08h9CckiVVSHPZap5YfaoIo3lcswjENOmdTsgiMVwil4XgJgi6 X-Received: by 2002:a05:620a:2550:b0:7c7:a536:66d1 with SMTP id af79cd13be357-7cad572b1c1mr670249485a.6.1746222400983; Fri, 02 May 2025 14:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746222400; cv=none; d=google.com; s=arc-20240605; b=eH46CneO2FOlsiYSeugedbD/jWIP7MMACtxtv5nPd3Jh86472lDA5cfwMgfnObWsJx AllnX4ntLdAERkH3GKrgKlnipBFBmlvi3g/OoYUjrZi77IcdGk6jVT8G9yGt5yQmTwYH 1PMZZQQN8Df9rcRiLGfzHcSOIEaj7QujFQwrZOuYBjCcP/Na4gmVwK7W+RSQcHk4wm+W CmXttT0yvT6/XW75PPJg3ZY8k05UJ60G56yaJzoZyZPebyqX3ucDz7k3z0f/lGsVD6QW oNUw2ImfNbWrrPJJB107cR5u0jNZUVpQ5d5rKPPjs7+jSc4l/F/EoTfcaA+9ilMev69m oZZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LXgZidSSSrLiEhibf6u0N42Azn0PbvpjkuJ4Pt+Naxo=; fh=w9UtuAm08K0O6DwRXOEWzl92QaS8M3PoE8G3rbCBQ9s=; b=ZE1NUiZyNjEyFrHKVy2unMaT/UiHFcdNSSoF/Z5V52/snn50w+0bPfT+hPPkJFKuA/ WOep34jT5NYIDxBdBHpVqxnLOhQcHjvlAGhS/PtP/offhTddUhspWCjC6wqwoC2G+PQv +mPD6leAvrhZyfi1lJTJ40OkDbmBMrKF9xN2bh8pXzfjZ8guWKKVsuRMKNNNgQhRg9g3 RqpI0zVITHeqbhbW3yJDO7dm69yJTb4eqK0DtI9eo+6+NtRE668QRgzSCoQ047sUTA/v KtHBuzGm4E6NEt3SNuMG2/U9WSh4eLjVLTEudbcZ/eqHmu9XsIQG1b/SEJFDQcLPFhEj bSvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ws/sVr45"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7cad2432612si399049085a.368.2025.05.02.14.46.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 May 2025 14:46:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ws/sVr45"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAyCr-0000gR-DZ; Fri, 02 May 2025 17:46:05 -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 1uAyCp-0000fT-BP for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:03 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAyCn-0003VN-JR for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:03 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-ac2bb7ca40bso404386966b.3 for ; Fri, 02 May 2025 14:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746222359; x=1746827159; 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=LXgZidSSSrLiEhibf6u0N42Azn0PbvpjkuJ4Pt+Naxo=; b=ws/sVr45ff9wSgY51A6PofgVsR4PMqlB/g4gVXA+GUJn/mRHMbDeBCuYBPrcnyO/kO v5IBd9ylynEqKmEhVdPOkjRyUXUL4L3dz71xAzGBgUNMFGi5XKVuB+N04bSTc1g4q0fs KaxS2RKgjcIZgixbVZD3MSYzOTV6mBEJ11z2s8q83xJoG2xwc0blrSQda8e6LoIQW8Rl 8wgWkCxs9uoPUBGjFi7jfR7r7A9BQ54N8sRsXKnQDQcvbNoFI33AJqUqYP7NlBOVAoxO afCWnuTNUU+69BLfaVcji9X3Py2FCDVURoLzu+niYlNLffKZWKS5IzeTF7TFBbwk4lKo G8+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746222359; x=1746827159; 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=LXgZidSSSrLiEhibf6u0N42Azn0PbvpjkuJ4Pt+Naxo=; b=U0/m5ZLt/j481yXGVgZJBIprwTyGjfpLke/mpcWvWLBvAtHqb/WtvHfM+jfXdC8dIs +dyhwWafgOUxNu+gcBJxyZyiFyrHN7W1BMv2fgj/A6AfYD4iZ3tVdb0VMkhwSCM/laA3 FK+fFlVdtcd4HJJGO59FPQJ3LltYaFhWTQwaDdERvWS5lx+UJw1pOxVb2jAvunBtX2Lb kFPHLzzo73m8sYM1QC3P1r9eruHPbPI7zdz+HI9NR7lv/sMiMn4u6xdbwwS5u4N2aEhX u7nf5e0J73EjPIlmUrns5HMKUpGSeZL9DwO+CyI8uV7NC1+LBlU5Qw8IHBPILwtbv7C6 belw== X-Gm-Message-State: AOJu0YwITXw3jLYm7XxajXw3YTPS7L/5JTIfDZiDrI3mgLa+rUFzhsoY uZ4s5Xr995FxdnvAbcN1PCKdC3XgVnmxsKpRNiwhtDLlBOyGfb4aaHDjX+p3lkiRowxKiZQbyf+ o X-Gm-Gg: ASbGnctHoXtffbSfPP1LPXr2MZbxADhx33Wpf7bQSU6d5rr9Fdo2M3RGoFrOAfrriyD zz51iWVhh6D1gUJ741aOUHr/G3OcM79lHguA1ju06f9ssjk6SQAmloM/Fd91bDYwvspYKltDuKD 8n6g6W9T4Z2IcJq9PNmf2PkPXm6WVYdd/NAYUb1FKr9vpAMbarWxj+VXXPVmeq2BUiCoXkkorE9 DCYFYq29ZseDDvTUxRUYkssxaPBxeEv0vRgzEcdLl2bbyPsuIcuU7s7syHCe8MLYDBhzAnNW7ZS fAJ0iPSAyfDhvjTvlOl36QgdQsjJr0o6Ljw4CH7ELADbuB3hKwCpMVFaatBPYNuEWeIGx5ufN+9 SEtfH74ACuArSebY= X-Received: by 2002:a17:906:22db:b0:ad1:8f1b:21b5 with SMTP id a640c23a62f3a-ad18f1b2528mr101985766b.36.1746222359478; Fri, 02 May 2025 14:45:59 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad189146f74sm104922166b.17.2025.05.02.14.45.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 02 May 2025 14:45:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Zhao Liu , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Thomas Huth , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v3 1/5] qemu/target-info: Factor target_system_arch() out Date: Fri, 2 May 2025 23:45:47 +0200 Message-ID: <20250502214551.80401-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250502214551.80401-1-philmd@linaro.org> References: <20250502214551.80401-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/target-info.h | 9 +++++++++ hw/core/machine-qmp-cmds.c | 6 ++---- target-info.c | 12 ++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 850a2958b9c..87b4b0e0cbb 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -9,6 +9,8 @@ #ifndef QEMU_TARGET_INFO_H #define QEMU_TARGET_INFO_H +#include "qapi/qapi-types-machine.h" + /** * target_name: * @@ -16,6 +18,13 @@ */ const char *target_name(void); +/** + * target_system_arch: + * + * Returns: QAPI SysEmuTarget enum (i.e. SYS_EMU_TARGET_I386). + */ +SysEmuTarget target_system_arch(void); + /** * target_long_bits: * diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index d82043e1c68..8f491dba441 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -37,8 +37,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) MachineState *ms = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(ms); CpuInfoFastList *head = NULL, **tail = &head; - SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), - -1, &error_abort); + SysEmuTarget target = target_system_arch(); CPUState *cpu; CPU_FOREACH(cpu) { @@ -139,8 +138,7 @@ QemuTargetInfo *qmp_query_target(Error **errp) { QemuTargetInfo *info = g_malloc0(sizeof(*info)); - info->arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, - &error_abort); + info->arch = target_system_arch(); return info; } diff --git a/target-info.c b/target-info.c index 16fdca7aaaf..8232d488870 100644 --- a/target-info.c +++ b/target-info.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qemu/target-info.h" #include "qemu/target-info-impl.h" +#include "qapi/error.h" const char *target_name(void) { @@ -20,6 +21,17 @@ unsigned target_long_bits(void) return target_info()->long_bits; } +SysEmuTarget target_system_arch(void) +{ + static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX; + + if (system_arch == SYS_EMU_TARGET__MAX) { + system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, + &error_abort); + } + return system_arch; +} + const char *target_cpu_type(void) { return target_info()->cpu_type; From patchwork Fri May 2 21:45:48 2025 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: 886650 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp1018429wrq; Fri, 2 May 2025 14:46:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjobHwjTe5Huqg20VPUB1MJ753ZUHzbrv/KuxOuG2TWKNBEwV7qEY4ewd/PccZBxadtOt0lw==@linaro.org X-Google-Smtp-Source: AGHT+IFNQ53ggxfp8fq3xbhRC6PQ725OUmGFJ565Z4BYYGCCElyzgiacPUtfF3fKK8K0rr6WWe+6 X-Received: by 2002:a05:620a:248e:b0:7be:73f6:9e86 with SMTP id af79cd13be357-7cacea24485mr1141257685a.20.1746222401091; Fri, 02 May 2025 14:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746222401; cv=none; d=google.com; s=arc-20240605; b=AJQxEt4CmzjKMLZ/NqYDzKkKeas+CfGTJzyN0cWL4GNoCycFdPzCSeXDZxpuVbMZJj RBaqXYKfFesY7Va4CVfQsgzqTqlQs9j+QVOCYTOYJCChSendBRWvs6BiJsf08bej6Aro qZbSglZJXTS8us0Osrfala1xpQ9JUXHhqhmnSgB/EyroFxtpToah7hDUFu/xN7Bi0v3m uXc8HGA4SyJAcamzjD0LXz3r3kBt9njr44d9WsxbgkI7V+cBxRJKDTlHmUBFXhWlo+KX jIJfaHDsoAkgGYXkzgthrwRm/97ZPWtOQOYuLAAZStu0lLOkUKaE7fYzF6H+32NebB6D q7ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N7Hzb0w1jlzsKSiFmuI60CliIwDp64ZHh16gYYLKY+A=; fh=w9UtuAm08K0O6DwRXOEWzl92QaS8M3PoE8G3rbCBQ9s=; b=Y+XBYiRzFihSkAm97b3R3qkAShE30H9opHEDzy6Vx7kXFM5YeasEnF4Mu8QdSxqKGE Lo1zovvGYkttG1tJ0UtcNGz1RXXfFPqPRDjbKEgdvT1A4DlbgQVJSzJdat0KOj7TG8fP w3LY7HBRAj9AxhCg6zgquPnaxR3eApRqlVSKIMvngScMQyEorI9EYBt0G0MU5GvURhaH WqFbPup+N4QJ3wYKeksGvdyY5LZXKlAZ5uQQ9X/ddE4HuvKnmS4EcvlzXh3bvQzYGhg2 WL23/xaB60sQVHdHdL6ar8zu8jUQdmCYGj+WoTCyd1k3HpXtNlrsBOL+3beyfYsLtU1I H4JQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FIkrvETV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7cad23c7bc4si370453585a.144.2025.05.02.14.46.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 May 2025 14:46:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FIkrvETV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAyCw-0000hm-Kq; Fri, 02 May 2025 17:46: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 1uAyCu-0000hF-VQ for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:09 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAyCt-0003W0-0B for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:08 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-acb39c45b4eso384454866b.1 for ; Fri, 02 May 2025 14:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746222365; x=1746827165; 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=N7Hzb0w1jlzsKSiFmuI60CliIwDp64ZHh16gYYLKY+A=; b=FIkrvETVpM7/xF+Bqq/Zqmhjna3nhTZpAovxV7z13FoOaLqiC04VzqXoWw4AvDMQgZ NZ9kqKX7j4XqrE3GL3LrlmMXIxK4BJ1g9BNivSxphx5l6r5JMO3COQnTrIbEf3dejUgd WnSoFHuX0sGPGak3rebxlXI6MD07oObUvKVy9TEX99mCNOx2M2EHWC2Wl+X/JcoTHLCg 8I+XjBGRIz4kUlIK7ltDXZau0et3kHMOvhQ+x8lRDH0p3+3yEDnhDUstLI/pESw1B/Av ddsHCC4c0QoxKEGapTPa3OwHjz0nftBYAVDUATrdYRm89ouew05OvdNmjnmwmB+dpedw bOgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746222365; x=1746827165; 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=N7Hzb0w1jlzsKSiFmuI60CliIwDp64ZHh16gYYLKY+A=; b=NUVcudW1LQd3auFwFmbMlo/zohvSpt6kFKIe9B0VToOUIC53dZhCzseXuMcyT8jIZ7 Q3fQOH4Xak0DlC5B2ia7Wsn71EfyXdSO69hD61pPyLm0GuQMX3IZvOBq+WJuIeEPIl1U 2o+1NhiGtl5+p98LHWwpkp0iHlQyddoz8xhyOLrkVu1oA6N22giSEGx9YS8Cer7s4QpW 62EeDx/gS0VyuBES68Tgl7zTAfVn6SgvHbi5Q5Lg/smMrAdnWxFmELHt0LVrw0Fwg+Yi MKT/LA90WoxaOgKOrKRmRrHuCRjzAvuspQ5M9/p3sx9EUuM604TynkBoVcnOvCn19Vtp rVCQ== X-Gm-Message-State: AOJu0YxHWcrxn3OGIOuzOSh2xNdyqJ2g1fYKAEwfTDa5pRrilc0mPD61 OADd4CatYlj+uOLcim/LkMXyz8zUCdoGGaCxqYKIt0kUiWOIUZUue6aXduZC1UKYIkgKwBxcxc9 U X-Gm-Gg: ASbGncs3gae5NVDNs7FSmjQVZ0eZgCk/T5RD/c2PQkIxoSsVvPbgGgUV6WZALWDal2m RKo7K0sdiBbJXX1MtcIeUoeePXjx8A8Nw7qW8r5QeaXjeSBpS2fvIVFmboUYHb0OKVoivnhXQjt w2HwEC7mqNl6kgt+lsNwNg0xvKcI0KzcgRSJjbarwjsrE1Z38wxhUQzBaZgl+556ifnm4RUihq3 VmL2ThQvWMQioxqR2SLlbGryUr6W2dCBzGN68UIzvFrYY2LRVSps5kuuC1HoM8GHauGhT/Hvz7j w5XbRlMujIhcCKQB4JemPdMBi3tIEsVWh/W6GjQhlQlWHOSldOFoIcuVh47rqVCpoZ2zJ39t4KH Xh0z+dhh7O2vNh8E= X-Received: by 2002:a17:907:3fa4:b0:abf:73ba:fd60 with SMTP id a640c23a62f3a-ad17b5dbc19mr446152966b.29.1746222364621; Fri, 02 May 2025 14:46:04 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad1895402c7sm100512466b.164.2025.05.02.14.46.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 02 May 2025 14:46:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Zhao Liu , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Thomas Huth , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v3 2/5] qemu/target-info: Add %target_arch field to TargetInfo Date: Fri, 2 May 2025 23:45:48 +0200 Message-ID: <20250502214551.80401-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250502214551.80401-1-philmd@linaro.org> References: <20250502214551.80401-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/target-info-impl.h | 4 +++- target-info-stub.c | 1 + target-info.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-impl.h index 1b51cbcfe1b..83d584d7dba 100644 --- a/include/qemu/target-info-impl.h +++ b/include/qemu/target-info-impl.h @@ -9,11 +9,13 @@ #ifndef QEMU_TARGET_INFO_IMPL_H #define QEMU_TARGET_INFO_IMPL_H -#include "qemu/target-info.h" +#include "qapi/qapi-types-common.h" typedef struct TargetInfo { /* runtime equivalent of TARGET_NAME definition */ const char *target_name; + /* related to TARGET_ARCH definition */ + SysEmuTarget target_arch; /* runtime equivalent of TARGET_LONG_BITS definition */ unsigned long_bits; /* runtime equivalent of CPU_RESOLVING_TYPE definition */ diff --git a/target-info-stub.c b/target-info-stub.c index fecc0e71286..2e4407ff04b 100644 --- a/target-info-stub.c +++ b/target-info-stub.c @@ -14,6 +14,7 @@ static const TargetInfo target_info_stub = { .target_name = TARGET_NAME, + .target_arch = SYS_EMU_TARGET__MAX, .long_bits = TARGET_LONG_BITS, .cpu_type = CPU_RESOLVING_TYPE, .machine_typename = TYPE_MACHINE, diff --git a/target-info.c b/target-info.c index 8232d488870..5f6096606e4 100644 --- a/target-info.c +++ b/target-info.c @@ -25,6 +25,9 @@ SysEmuTarget target_system_arch(void) { static SysEmuTarget system_arch = SYS_EMU_TARGET__MAX; + if (system_arch == SYS_EMU_TARGET__MAX) { + system_arch = target_info()->target_arch; + } if (system_arch == SYS_EMU_TARGET__MAX) { system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1, &error_abort); From patchwork Fri May 2 21:45:49 2025 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: 886653 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp1018716wrq; Fri, 2 May 2025 14:47:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWv6B9JOozPUU9Q7Ohalhafc2Itp/R9Nu6+AcCtWsWHsmmaE4tEI1xzbnoFx++OoeKybYBBg==@linaro.org X-Google-Smtp-Source: AGHT+IGoLNfljFjS8yzZiuJyv+pBxwHASp0Y7qdJqVWFiTla6JlADGIvTsYmxisr1KaHLNq4ReGV X-Received: by 2002:a05:622a:1a01:b0:48c:4c6c:bd8d with SMTP id d75a77b69052e-48c4c6cbe0fmr60218631cf.2.1746222460614; Fri, 02 May 2025 14:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746222460; cv=none; d=google.com; s=arc-20240605; b=CLbnvlhE6q+XvECwYCMMOwVdmBqw4IfOsDIxN3s9XpbzZKb7zMDxoNZVv5hhA30wBu askjEH50ZrKr08yvqRlcVxVCpwt76MXe4yyRg/l/KuNt1nPz7TJd9LH6+aM9dAoaYJQZ aOPKj7GaPQ7GUMNd7b9C5O0/09rkhnCWrwJx3MWru3VJ0GNAvFZRNCETNLp+mekjxIvh v/CjEUU7Ghjk30950Mjl1fk1Lj6Bo6nV+71i9r2ersLUmeRmMLi0XXu2f/aFQEVym7Qo i0DdOD0U0RY+Dr8wyutpy+wvV3asVQOIZ6PMn0ARxJ7hUd1rbhM3szqMmFiMsTU/KXWi nfpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xWWrKwoCLn5b4Gd/jxCzJvCASZPS/cC4XOoTz1WNgkY=; fh=w9UtuAm08K0O6DwRXOEWzl92QaS8M3PoE8G3rbCBQ9s=; b=BntrlnWJSSE5ehtwSOyi+y+O9GdIw82uDbOus2LFfoY7cYE63toBgWHt5rSgFwDlTm crZtT+c8wCcPfGsIB23i+sGylqHLflSpzyi4f9UeepIkovBdfaR+rGMDF+plHAiV85Is RFg4R9KIkfRKdbuQ5aT/X6gE+Nqq7D+wxMTvcOA4eJ5oiLLBhU2XtOniQ4kH03WKXZK3 cf7EmPy5jUdqWoey96G7Iunmdc4upagrx9TfQsdcWgv9OVWI2IDxTcu8TffPE4Zs1uc+ HVBkxjQbQWRH9eyTgCkE6r3HUZ7kea6cq4mdmXpZ4cTW0opulk+vM4J/Cdryc8v+y7Se GlYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hHYbzy5/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-48b98d12216si35813971cf.540.2025.05.02.14.47.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 May 2025 14:47:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hHYbzy5/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAyD1-0000jW-F2; Fri, 02 May 2025 17:46:15 -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 1uAyD0-0000ix-1Q for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:14 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAyCy-0003WZ-9Z for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:13 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5ed43460d6bso3849033a12.0 for ; Fri, 02 May 2025 14:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746222370; x=1746827170; 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=xWWrKwoCLn5b4Gd/jxCzJvCASZPS/cC4XOoTz1WNgkY=; b=hHYbzy5/hnO7+9EoFbqbZr/nYxf/P4txTzpr7zwmr3T5u+xLa9Mr/VaDP4TtsTzvLD c66zrOfASOG9GrfL4EKX12iZcWn4w/qfdYqxWxB9kI5cfUyc4acgvahZK0vTzuMGK1Gh neuhbZyP3r57z92B880u+p3mHBruZongJKlrYOr2ezXvrPp6Umq/JezWl1nm1rBLARI8 fr/IBYxp8bP4jS6BayhWeWz9Zgj2q89mKqRHNauAhdsWoAiHOo/0XSEtHHnd7ra+PnWM NGrfM36VF/ffYOquuWSKJy2eJVaEQ8Y1yYjiTXjSBR8yIJpPWAspSX2ByFPD41oLHhQM 4AGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746222370; x=1746827170; 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=xWWrKwoCLn5b4Gd/jxCzJvCASZPS/cC4XOoTz1WNgkY=; b=d12EDH1KyhXMpN8GGPU8KcJYkajTCHAeAD7tTSYPJnhYMwCKlqLMAhm/FQLxIgW/GH Vb2gMGJvVT7E9yxbxa9ZiEUyU1V/UnJJ9EN5Yi8+yn+nMSg2NrnD8dNat2Fx+LsLbtEN moTA7B8QE/83QObX7mT0OOJDAvhaYKUg63JBj8Q/f4RTg7fu3cK/6knvZO9eZhNhv/rZ 26vW0UslLFPaCwMNuPuMcZidh1a8PJe09r/9P2NmSn7nOsTPhDzsWZHsEShBtLNIYv4Q myTeiM4ws45DWK/Sz+9B6F/GXZGj+IV+CujWxajlx+/UsrMkyRMn1UMhLXzYfjOJxFX7 OlQQ== X-Gm-Message-State: AOJu0Yxgz3SWIajlzp9UBfeJ1WCRqgRdZ+uv422mBIS35exeMqDWuD20 tVK+/aXBJvreYabV/WzJ/2JUp22tYuVVLGUJCdAwsH1OHb58sRor7IZMjDSyV2JU4HLPpfeT48V T X-Gm-Gg: ASbGnctjs19AULSLy9SlUUF9+5aHEuQRDPdXSs/eQg34Yn9P4Um31XxUmUmi3QoiVS5 pG/QIOP3kQuXm4e830vG6xjgRdQQ0BxPBpmii2SLodYmSlwt57Ah5XgDVJlF6WJZBEnuJ3LCgXf mwxqWHESIpj2D4XlWfQqvbq3vjNzfyI42qQZBKtNtF7xVrFEunujfYNufOSboPfh8/S8H3kMYrj XFPcs/O+TKc0zyszoW/aGobZACfDCkY07osmXXO3uB85yLMCax8KXf6VRyzyAQP/+SkcV1GHhUx bQ7PuqnPwRLHNBb7wbrjCpPv85E3pxOllN+UT8cRcxJg+PH5dL27GUO76lcl0JRE2Zr5NwQ5QMF 47yh6d6jJi8m1zuA= X-Received: by 2002:a05:6402:2710:b0:5f8:36b2:dc1a with SMTP id 4fb4d7f45d1cf-5fa78062dccmr3729539a12.16.1746222370036; Fri, 02 May 2025 14:46:10 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5fa77c38618sm1730083a12.81.2025.05.02.14.46.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 02 May 2025 14:46:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Zhao Liu , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Thomas Huth , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v3 3/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime Date: Fri, 2 May 2025 23:45:49 +0200 Message-ID: <20250502214551.80401-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250502214551.80401-1-philmd@linaro.org> References: <20250502214551.80401-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use target_system_arch() to check at runtime which target architecture is being run. Note, since TARGET_ARM is defined for TARGET_AARCH64, we check for both ARM & AARCH64 enum values. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Acked-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index a3d1a676e71..02c47730ae8 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -170,13 +170,20 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb) * necessary (as the section size can change). But it's more likely that the * section size will rather get smaller and not bigger over time. */ -#if defined(TARGET_X86_64) || defined(TARGET_I386) || defined(TARGET_S390X) -#define VIRTIO_MEM_USABLE_EXTENT (2 * (128 * MiB)) -#elif defined(TARGET_ARM) -#define VIRTIO_MEM_USABLE_EXTENT (2 * (512 * MiB)) -#else -#error VIRTIO_MEM_USABLE_EXTENT not defined -#endif +static uint64_t virtio_mem_usable_extent_size(void) +{ + switch (target_system_arch()) { + case SYS_EMU_TARGET_I386: + case SYS_EMU_TARGET_X86_64: + case SYS_EMU_TARGET_S390X: + return 2 * 128 * MiB; + case SYS_EMU_TARGET_AARCH64: + case SYS_EMU_TARGET_ARM: + return 2 * 512 * MiB; + default: + g_assert_not_reached(); + } +} static bool virtio_mem_is_busy(void) { @@ -721,7 +728,7 @@ static void virtio_mem_resize_usable_region(VirtIOMEM *vmem, bool can_shrink) { uint64_t newsize = MIN(memory_region_size(&vmem->memdev->mr), - requested_size + VIRTIO_MEM_USABLE_EXTENT); + requested_size + virtio_mem_usable_extent_size()); /* The usable region size always has to be multiples of the block size. */ newsize = QEMU_ALIGN_UP(newsize, vmem->block_size); From patchwork Fri May 2 21:45:50 2025 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: 886654 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp1018719wrq; Fri, 2 May 2025 14:47:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQwb9ib/82h8v6ImBGHTj7GCmnLLoWlrWi0ZA4v97zW8HEZx6+e06E4evQlGgP6DLUOUalRw==@linaro.org X-Google-Smtp-Source: AGHT+IHXg3WDMvLhWRSz0yzfIbKx10Z+O99LuamKM5OsExnABf6c9InUIhSZRBzCvTvlZJxKZI09 X-Received: by 2002:a05:622a:1b14:b0:47a:e49c:dc05 with SMTP id d75a77b69052e-48c30f6e7efmr71886021cf.11.1746222460667; Fri, 02 May 2025 14:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746222460; cv=none; d=google.com; s=arc-20240605; b=DWhUcadH9KbjaFCWm8a81WzTJJwatV0mxl+FeRILlbjefg4+UJDMZHewmbjwDZOELz jQhnZG6FjWxftP3c8/zf5ds3bZE4dZUd1pKgPOo9Vd1vVfb9mnW1crT5HtewVDhX6TxA 05gmPrsyt+nu+2vVGY2GVieo7zIoXMghS51U1W4vMFk/LklE8tDQcVAHTonYKdY8OPd7 bVg3pQEKuD8ALT7JEVt4js+6QbfCJ4j/WEYXDqRghwIS4c9WM1rFro+0/4bMcISFsDLD x1U70/j1HQozmPnQOmnBN44U5MDdzrqH7e6Hrq3vZn1TqUO06/OYpl1D3ecPjQ4deFB0 K/Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A9FlrQnjVSYEb0+dNGQFK1FqE6e7hFamBzmAqPtToxE=; fh=w9UtuAm08K0O6DwRXOEWzl92QaS8M3PoE8G3rbCBQ9s=; b=M2Obm4/I1VY99HOurdfX+nfPcqc4SRt+hrEOQEWdL2XqC52+IIYMOwQ7AJRhnA+3Qd +9vsVnakHQLoRjBYbHoYQLlkt+oCuMebd90P8emL5wvviFwu5oKGs2JcH587yE/jhSZ2 naHtqTqDzp6mLtLQSw7M85IyB+08psBc/F1cs2VfxC0PD97bMta+KxggWCK5ZoPhySjK 0NKMtu3i69JIDe7fDJqm99fGaWF2IJGsDWJqTBlFbRTf46ZpjkyHjH88lyUeFyjw9Uc5 CMISWtIjB3GzGPbyXycF6LHZb2AcbyKQZ918X2GS84xQMpLzxoq3qSKQgsggf6pCR+5C OyZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bnbHW9Lv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-48b987240b7si38696361cf.412.2025.05.02.14.47.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 May 2025 14:47:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bnbHW9Lv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAyD7-0000ka-8N; Fri, 02 May 2025 17:46:21 -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 1uAyD5-0000k7-M6 for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:19 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAyD3-0003Wt-Ig for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:19 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-acec5b99052so424762066b.1 for ; Fri, 02 May 2025 14:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746222375; x=1746827175; 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=A9FlrQnjVSYEb0+dNGQFK1FqE6e7hFamBzmAqPtToxE=; b=bnbHW9LvXT9d8U2qt/BpzFDSoPthJNq3eK1pHnVI5mVQ8vhyjo3oaJY5xoBu7nN4a3 Em3yYlHa6tcr8wiq8N+W31vQymrpSSsX9I1gd59mnArD4Nf9amNGIpRjNpUAwKtlchdX 3z37XAq43/js1+n6Jx8PoQjnLfNRXLUSpfKKX58w7TD66pKMY/awD+lLRqv9RKWf71MR qWl4BtGrAtbbL2jGcu5niDoVw6fDKS2ebfMVLYYVrLAk++7CAm5rKNz/OMLVB8Y9uOHS UVpPyWEeI8OGlKZLhmbZzCDzpdYJ8HGgqM8jBXuJutcmdG6WsEKKNja2E0SbP2VWiaqr fcow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746222375; x=1746827175; 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=A9FlrQnjVSYEb0+dNGQFK1FqE6e7hFamBzmAqPtToxE=; b=DYxl/IuoDq6kOHWD2VCOGU1Jt8Dae9iVsB2dSBXj2pFERqubbJICVHLKt+lfiwhAQ5 h9jL6nydcvbGyR4klIM1QsxnzgCogqxZ/b6qGSWZJaGtcTXEfkgFUsmBn2T0GMV6sGFI hMR9pPUR392nJWAgoCVSiQQ444gzxCIiqUJa2mDl1t6LkDWzg0+pTFaJxL7LwcZjVa7I wYZ7D/wANTrOmHJwMXueAXQ/JGSfxqdXnZVCUxlR4WHKTxNL3AyfV+y3jZsktjlBzqDA EgXzDkrpsanAKn1zdfd6fUURC0ldYBztCgzz2yzp5zkzGy7B6JOS7cl2+KRBBvjjekCr Mfng== X-Gm-Message-State: AOJu0YyJI2EZfyG/ntoI1DHljI2uWFvrrR69LBdqaJMP11iVB91b38v0 uWdsdJxtiP+6uzKbqwGbWeeDZMJypKQhlXI/EjyztDo66RAkXdTgqYeZhh5kJdVbMvMptZF0Bdh C X-Gm-Gg: ASbGncug0B6WU1zmLYGBVOrL/ok/qkVBw16H4OghE0Jw95Himo3Tr735485F21VWbAb sOqd12WO5zIL4DSGVuNmS4PGmVSRbQOcTJHhIZvrJd3j5daxp7JHD5vBtickB5XCmtZcAckxfJ7 wW95EVlRpTldAWq9muMaGWP15uFMY+VcPXyPnw657LT801gvsm74B323Bt0B3zGKV49ceX5ICti 6Mi5gdgZ/orr9l97FItEh3gka5oL/Vp6uqpu5eGHgT5SVhjL3zjVFJLdC4vE+7XB18B/7zI6mue orTn8mZPan1Ag0k0NeCR9EjiNJlinYvEXx7SeDsOBt26dUrKu28jH+Mqw5ZZVlituZufBItBoOC DsFFHARknj2rn2cw= X-Received: by 2002:a17:907:d8e:b0:ac6:ecd8:a235 with SMTP id a640c23a62f3a-ad17adaeceamr440062066b.28.1746222375214; Fri, 02 May 2025 14:46:15 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad1894c02e5sm103375066b.95.2025.05.02.14.46.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 02 May 2025 14:46:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Zhao Liu , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Thomas Huth , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v3 4/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime Date: Fri, 2 May 2025 23:45:50 +0200 Message-ID: <20250502214551.80401-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250502214551.80401-1-philmd@linaro.org> References: <20250502214551.80401-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Check legacy guests support at runtime: instead of evaluating the VIRTIO_MEM_HAS_LEGACY_GUESTS definition at compile time, call target_system_arch() to detect which target is being run at runtime. Register virtio_mem_legacy_guests_properties[] at runtime. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Acked-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 77 ++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 02c47730ae8..4234396f774 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -15,6 +15,7 @@ #include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/units.h" +#include "qemu/target-info.h" #include "system/numa.h" #include "system/system.h" #include "system/reset.h" @@ -33,13 +34,21 @@ static const VMStateDescription vmstate_virtio_mem_device_early; -/* - * We only had legacy x86 guests that did not support - * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Other targets don't have legacy guests. - */ -#if defined(TARGET_X86_64) || defined(TARGET_I386) -#define VIRTIO_MEM_HAS_LEGACY_GUESTS -#endif +static bool virtio_mem_has_legacy_guests(void) +{ + /* + * We only had legacy x86 guests that did not support + * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Other targets don't have + * legacy guests. + */ + switch (target_system_arch()) { + case SYS_EMU_TARGET_I386: + case SYS_EMU_TARGET_X86_64: + return true; + default: + return false; + } +} /* * Let's not allow blocks smaller than 1 MiB, for example, to keep the tracking @@ -143,7 +152,6 @@ static uint64_t virtio_mem_default_block_size(RAMBlock *rb) return MAX(page_size, VIRTIO_MEM_MIN_BLOCK_SIZE); } -#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS) static bool virtio_mem_has_shared_zeropage(RAMBlock *rb) { /* @@ -154,7 +162,6 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb) return !qemu_ram_is_shared(rb) && qemu_ram_get_fd(rb) < 0 && qemu_ram_pagesize(rb) == qemu_real_host_page_size(); } -#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ /* * Size the usable region bigger than the requested size if possible. Esp. @@ -1004,28 +1011,28 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp) rb = vmem->memdev->mr.ram_block; page_size = qemu_ram_pagesize(rb); -#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS) - switch (vmem->unplugged_inaccessible) { - case ON_OFF_AUTO_AUTO: - if (virtio_mem_has_shared_zeropage(rb)) { - vmem->unplugged_inaccessible = ON_OFF_AUTO_OFF; - } else { - vmem->unplugged_inaccessible = ON_OFF_AUTO_ON; + if (virtio_mem_has_legacy_guests()) { + switch (vmem->unplugged_inaccessible) { + case ON_OFF_AUTO_AUTO: + if (virtio_mem_has_shared_zeropage(rb)) { + vmem->unplugged_inaccessible = ON_OFF_AUTO_OFF; + } else { + vmem->unplugged_inaccessible = ON_OFF_AUTO_ON; + } + break; + case ON_OFF_AUTO_OFF: + if (!virtio_mem_has_shared_zeropage(rb)) { + warn_report("'%s' property set to 'off' with a memdev that does" + " not support the shared zeropage.", + VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP); + } + break; + default: + break; } - break; - case ON_OFF_AUTO_OFF: - if (!virtio_mem_has_shared_zeropage(rb)) { - warn_report("'%s' property set to 'off' with a memdev that does" - " not support the shared zeropage.", - VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP); - } - break; - default: - break; + } else { + vmem->unplugged_inaccessible = ON_OFF_AUTO_ON; } -#else /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ - vmem->unplugged_inaccessible = ON_OFF_AUTO_ON; -#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ if (vmem->dynamic_memslots && vmem->unplugged_inaccessible != ON_OFF_AUTO_ON) { @@ -1718,16 +1725,17 @@ static const Property virtio_mem_properties[] = { DEFINE_PROP_BOOL(VIRTIO_MEM_PREALLOC_PROP, VirtIOMEM, prealloc, false), DEFINE_PROP_LINK(VIRTIO_MEM_MEMDEV_PROP, VirtIOMEM, memdev, TYPE_MEMORY_BACKEND, HostMemoryBackend *), -#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS) - DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIOMEM, - unplugged_inaccessible, ON_OFF_AUTO_ON), -#endif DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM, early_migration, true), DEFINE_PROP_BOOL(VIRTIO_MEM_DYNAMIC_MEMSLOTS_PROP, VirtIOMEM, dynamic_memslots, false), }; +static const Property virtio_mem_legacy_guests_properties[] = { + DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIOMEM, + unplugged_inaccessible, ON_OFF_AUTO_ON), +}; + static uint64_t virtio_mem_rdm_get_min_granularity(const RamDiscardManager *rdm, const MemoryRegion *mr) { @@ -1880,6 +1888,9 @@ static void virtio_mem_class_init(ObjectClass *klass, const void *data) RamDiscardManagerClass *rdmc = RAM_DISCARD_MANAGER_CLASS(klass); device_class_set_props(dc, virtio_mem_properties); + if (virtio_mem_has_legacy_guests()) { + device_class_set_props(dc, virtio_mem_legacy_guests_properties); + } dc->vmsd = &vmstate_virtio_mem; set_bit(DEVICE_CATEGORY_MISC, dc->categories); From patchwork Fri May 2 21:45:51 2025 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: 886651 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp1018586wrq; Fri, 2 May 2025 14:47:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWbmCfmdoRywU+IgFnX4aBop9RiLrW+ubQ0V2iEvAWAsWuUcS7H3aoJfgNzXRCPZngt05RX0A==@linaro.org X-Google-Smtp-Source: AGHT+IF0PYsAZQYwgAHa8YOo7KDqrCj+tUf9oA0hQdNihCFPzAuNgaNwkHKoKG2l/cPPGGcaHB1a X-Received: by 2002:a05:620a:2697:b0:7c7:5387:c754 with SMTP id af79cd13be357-7cadfdd55cdmr84542085a.24.1746222434239; Fri, 02 May 2025 14:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746222434; cv=none; d=google.com; s=arc-20240605; b=EDXyO9mPye/PoRyDqAgRmRJyHqYbroAU1Ep8otB+9Oa6HioIrsy8RoT3/4fpdMOnF+ T4LyfxPZzKk42WFXFcZ404yNK0oyDg6HHrpuXGdnxYEcjRwphR86QwvE6MQsy5lc/mI/ hSMhw8sR3eb5mTIwEB3C066rpi7nlPzmyJJogNMvWRYS+NPkQEAGkx3x7c8v4qpKxx3A MvLMeO26wqNh04p2+m4CwOXVfnZIoBisalSrkNGmCQiixw9QdymqSeTEMyTz4CsrnYc7 7r91BClvcwMcs8RaqG0kLvSQClN47rneZaW/eQuzj4EqyLxf/a5/uowq0h+A296ekAw/ CiHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DsDN4bksGI+t6Ajgx6lEwHOduZigzfyenP30N9rjdOI=; fh=w9UtuAm08K0O6DwRXOEWzl92QaS8M3PoE8G3rbCBQ9s=; b=fh4I1vwSXezukkJuoUcH+zen/j8XkvzJvxkfoJPcH3ArTOan2dNNutrJ5qw/hdDD14 /oXIzbkG2PQjzoHPjI+3wDwVDe1dfQin+UDeyq3SmRXIdjJq5zoKWg7YYOCgsPIhck2z 8+zV9Tc7lhfVAel3DcAxjehKJ9F6V+Ors4N7xxzB//OSnwHTXUfgkVAbiYgFjQvGTFU1 MUbc5GVABeTAeYQgp6Hl5sPmG9HjMShlvWLnH+eQ9O4HEvMpfTzQFXc8V5yKzCdRDjwK KJmjdZkU1T1C0RlaV3v7nB5Bnfju9hKTC2/Ad5zoHC3u17bco0uUA2F4GyqWKmPA+KJy +qcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RLC2spLK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7cad23ba9fcsi376132485a.17.2025.05.02.14.47.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 May 2025 14:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RLC2spLK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAyDB-0000lI-3g; Fri, 02 May 2025 17:46:25 -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 1uAyDA-0000l6-8C for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:24 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAyD8-0003Xe-Ns for qemu-devel@nongnu.org; Fri, 02 May 2025 17:46:24 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ac2c663a3daso467642766b.2 for ; Fri, 02 May 2025 14:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746222380; x=1746827180; 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=DsDN4bksGI+t6Ajgx6lEwHOduZigzfyenP30N9rjdOI=; b=RLC2spLKgwcop4kB/u1cqoTkwAsPI5BI4Yp8fyUTKurk5ZH5iePqpsKujvutBXQyyC mhlrc7wszYMRT/qAAcfGnZ9PRepi9cIzzTq8EGx1APeUw8cXN0xzdSpLLUaoJ3M2NvbR RiKaet4AhOezzy/P5p/3TVd/gaIY5WWhDTNtWnqMPqNP1ld9n6b+fpDcXMy9PUva89AQ Hk64nDz5LWvgfQd1Tv1jEuD+xItgksHTC7OnCPe5ojS60Uxo7RYAuOu9jFKIIWIgBLXY 2SKtx5T4NNJSAx1b+OXavEyF+wqAqyDoXAuOCjbATnGmtthhza+gesWSksmf8J0oYX4p qQpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746222380; x=1746827180; 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=DsDN4bksGI+t6Ajgx6lEwHOduZigzfyenP30N9rjdOI=; b=CdCiwGI+1Sk72xS4EacbkfCus1WsPa9JQyoqAXcUcH6nBeSSFmry+u0hSYPKqm2NTA O400hYVifAVSyyT70Itk5dcpHkJ/+1LezzSTG6aNwdyf+cKYVpG/oHFPewRUb7XgcC8G n3RimzgG8EnpHxWn3yc64E07adlBXOoQYMXkxEz2bPrrjbqahBgfwtYe4VOCd4zjwCsK okut3jCyr069uAE20L1vjBhSlZMqyAyOVImhx2CZDbQLNj4BBEimf8/1nBsAH3e8YH+3 0p25t2OCgURI2mSUk63eZdhjYYJGv1VOP/sWTfepn6wtMiGhEfb70zILFGLb7+WsHdZE /hMw== X-Gm-Message-State: AOJu0Yy//pBtYQNHXqJACfInHTnK5M/cL+6GsDakwMA1SMM41p6/rtMv 7lTasTjFxMjc7ixmeotGQM8+fW0mO0S4eRQ822TEyayzoQcQ+YtSeqVgKuq9e2pnubIhRBvDn/b G X-Gm-Gg: ASbGnctPqZ9Q4VwptN560JAlhlHM3BEQIJP1QGF5w2SzkY/4IQ2SF44ExKTOtoneRXk 7cEAWhtFvYLi1ZcFVuFZVj0AtexV3I866/qjZCuZflduCckfYsRSGMhvKgacfhrOwql5YHTnmC7 KD9MibtiITxWXqMxNRBSpN24Iv2EeOEeaFGj3Hp6S4ubRnYn3oBaAAlge0KyrVgMJjtokfqodA/ F5VdKuZi1ZJARepXWJ0KQehcY1toFilXsLmAZ40kYUIY1EED5PlAasrQaLw42smm/CCfuEIYG6D +VX8ONNGx4wkpPn6TBm1x3eU6xnn64u1IaOxQgzPB/Gk0gSNTRqiV1f5KcMsZ0aUuZy0ex1phmU 63YaN6kAIAZk+T2g= X-Received: by 2002:a17:907:3f88:b0:ace:d811:db25 with SMTP id a640c23a62f3a-ad17b01fe1dmr425125466b.60.1746222380468; Fri, 02 May 2025 14:46:20 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad1895402c7sm100535466b.164.2025.05.02.14.46.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 02 May 2025 14:46:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Zhao Liu , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Thomas Huth , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v3 5/5] hw/virtio: Compile virtio-mem.c once Date: Fri, 2 May 2025 23:45:51 +0200 Message-ID: <20250502214551.80401-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250502214551.80401-1-philmd@linaro.org> References: <20250502214551.80401-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Remove unused "system/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[]. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Reviewed-by: Pierrick Bouvier Acked-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 1 - hw/virtio/meson.build | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 4234396f774..f4882c6901b 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -25,7 +25,6 @@ #include "hw/virtio/virtio-mem.h" #include "qapi/error.h" #include "qapi/visitor.h" -#include "system/ram_addr.h" #include "migration/misc.h" #include "hw/boards.h" #include "hw/qdev-properties.h" diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 164f6fd995a..525679954ee 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -56,7 +56,7 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('virtio-nsm.c', 'cbor-helpers.c'), libcbor]) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-user-scmi.c')) specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI'], if_true: files('vhost-user-scmi-pci.c'))