From nobody Thu Apr 3 10:05:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387273; cv=none; d=zohomail.com; s=zohoarc; b=fwH1jmxDtYErDuSsclXN661WmI5rnRtpyiiRj8QlqDqcx1sNl+sXOLKcwc+mpVDKEXZge11mUxc2uEA/rtOH7oVx+bJa+zbfAN3Kzw67xnGi0tW0q8/08Rn1stqVsyJyjjweBQ23intKize0k4wR292NmW/v57xjt8lLRdWC3JA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387273; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vFDIjZoBEkcGFS81AHnWr7iG9XFN0GhdGmikXg5Pgg8=; b=Vzxgo2II1JXDdzeeGpVgrJa/pMNmAWDoKJjR58Q0pExw4vFRdPxoxKKucac/gKzIsTQFt5e4joBOlz92swJpIil1r3pabePFNwWfPHpevhwhI1/US691s2J6IfxBBD6Nt+D1+bg9liWPXJqYx6E5QeITxhRI6c+tT0bSJPhy9oA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387273878588.9004911810158; Fri, 7 Mar 2025 14:41:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMM-00065G-ME; Fri, 07 Mar 2025 17:40:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMK-00064K-3Y for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:00 -0500 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 1tqgMI-0003Mt-5K for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:39:59 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43bc4b1603fso14698375e9.0 for ; Fri, 07 Mar 2025 14:39:57 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bdd8c314asm65349195e9.10.2025.03.07.14.39.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387196; x=1741991996; 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=vFDIjZoBEkcGFS81AHnWr7iG9XFN0GhdGmikXg5Pgg8=; b=zhZQ6zy5585DIFj0jt7j+a6ajOlJRE4LLuuBTVzXSzpQt2mje5U7RQidZ+q+veq5H4 CW6u9hdO+8n0+TD3HPo8Wuk4xG1NbFH5GP7rg/r8asaH+EGfWhUhzkuJP+nUDeNXM1zX Co4yttQfhCh+cGRqzO1mgsvoRmcOlXQ28R23GZEd+tH7F3aI9Z/unIjGgLKPneG889h9 93787WWOpHsk0VmOqrbemqPR6awSw2OKaRA+++dWk4o6YDMlHfLtMBTbefmb2GE75aLJ DW9Tz4jleAhpR/NcIDwmIvEVUJ92Ba2pFcjdvpF8EDrIIyy2Bl7LYiW/GBE28zn4s/wU M6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387196; x=1741991996; 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=vFDIjZoBEkcGFS81AHnWr7iG9XFN0GhdGmikXg5Pgg8=; b=fhhhELJ9DLrJm1/WV19iZ3CXmOaMvqzvs6z9jinpOORMMRHbg87ftZ6aQavE72oquT Hcko8frMvxhKFTCpFJKCMJ5uiVkIbaxZF84knWUJXH1CKDl97fHW1PmwcUwH96jCTXfz rR9l9g/NkpvCbWozXPNzXD2D5W9ehJA5UAN2dBCAjoh4RRjIowoofj8OdYqYnASeWITN UeuKPEjfjwhgVIpChgflIuGNc59Gzd/nMP0JwC2kUhoS/JyJ3/rZZDObOpC9jLNfQJI3 VcL59QePywgF1AtfWV0bOQdh07bBCHbfIWEybL5WqqzHwXQe7Dyu6EVp6Cz0DzChSwVf vNkw== X-Gm-Message-State: AOJu0YzoU6W6swrrouOgTJMc356QFpo2T11ASSispLFp+yLUlR6qf5Ph +aj/99r0FTEXctH5w8sEpB7l5pnJCanxMUE1Zpw0jlqWndcHP6aGWbNUFttsQZL42PAhP6xpabN tQ7Y= X-Gm-Gg: ASbGncvDs91Hk9gDSfej1TAHQKGrNvh1p5TyVy1J/FPJP1SVyr1yhNURyF0yA4ideDQ OIUHUuyBJ9f/iO8K2cBeEqbl4G8ivohVnHmLy/PHhrpkptYOg8yxoigTCBfUbFLFr46v8Akfp+/ yGOD7Fw/q6y0hUBoQsza7vnLNzz4DeraYxmzr85CyQ1qYWtQyONlIbKrG/JZ4V+cGztRmBwB0UF oDaayleBX4SiH6/cfTiAr9/AybLoZPps4eOZzJM8pu7xv2DIsrQtMa9JhU9OEDMh/TXLNWdSQMx Kom1EGRndCFAQ6Z/DPQOwSIsNPhKXJrQQ5gVxxIA+kPTY9FsMz3VA1RAzaeHqNTdSsGRQme0jTH AyTZLx3gxDu9hqFnflIo= X-Google-Smtp-Source: AGHT+IFwGLagRYoTYveF4q5fpm6fs6OOEREKgSMyAOJDGmF0C2x6K7pdRvU8basccICFdStkVzbMJg== X-Received: by 2002:a05:600c:524c:b0:439:a093:fffe with SMTP id 5b1f17b1804b1-43c5a5ff0c0mr37827405e9.7.1741387195759; Fri, 07 Mar 2025 14:39:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/7] system: Replace arch_type global by qemu_arch_available() helper Date: Fri, 7 Mar 2025 23:39:43 +0100 Message-ID: <20250307223949.54040-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387274349019000 qemu_arch_available() is a bit simpler to understand while reviewing than the undocumented arch_type variable. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/system/arch_init.h | 2 +- hw/scsi/scsi-disk.c | 2 +- system/arch_init.c | 5 ++++- system/qdev-monitor.c | 4 ++-- system/vl.c | 6 +++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/system/arch_init.h b/include/system/arch_init.h index d8b77440487..51e24c3091e 100644 --- a/include/system/arch_init.h +++ b/include/system/arch_init.h @@ -25,6 +25,6 @@ enum { QEMU_ARCH_LOONGARCH =3D (1 << 23), }; =20 -extern const uint32_t arch_type; +bool qemu_arch_available(unsigned qemu_arch_mask); =20 #endif diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index e7f738b4841..7c87b20e694 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -3165,7 +3165,7 @@ static void scsi_property_add_specifics(DeviceClass *= dc) ObjectClass *oc =3D OBJECT_CLASS(dc); =20 /* The loadparm property is only supported on s390x */ - if (arch_type & QEMU_ARCH_S390X) { + if (qemu_arch_available(QEMU_ARCH_S390X)) { object_class_property_add_str(oc, "loadparm", scsi_property_get_loadparm, scsi_property_set_loadparm); diff --git a/system/arch_init.c b/system/arch_init.c index b1baed18a30..61c6f680c94 100644 --- a/system/arch_init.c +++ b/system/arch_init.c @@ -38,4 +38,7 @@ int graphic_height =3D 600; int graphic_depth =3D 32; #endif =20 -const uint32_t arch_type =3D QEMU_ARCH; +bool qemu_arch_available(unsigned qemu_arch_mask) +{ + return qemu_arch_mask & QEMU_ARCH; +} diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 856c9e8c32e..5588ed2047d 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -132,7 +132,7 @@ static const char *qdev_class_get_alias(DeviceClass *dc) =20 for (i =3D 0; qdev_alias_table[i].typename; i++) { if (qdev_alias_table[i].arch_mask && - !(qdev_alias_table[i].arch_mask & arch_type)) { + !qemu_arch_available(qdev_alias_table[i].arch_mask)) { continue; } =20 @@ -218,7 +218,7 @@ static const char *find_typename_by_alias(const char *a= lias) =20 for (i =3D 0; qdev_alias_table[i].alias; i++) { if (qdev_alias_table[i].arch_mask && - !(qdev_alias_table[i].arch_mask & arch_type)) { + !qemu_arch_available(qdev_alias_table[i].arch_mask)) { continue; } =20 diff --git a/system/vl.c b/system/vl.c index 04f78466c41..ec93988a03a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -878,11 +878,11 @@ static void help(int exitcode) g_get_prgname()); =20 #define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \ - if ((arch_mask) & arch_type) \ + if (qemu_arch_available(arch_mask)) \ fputs(opt_help, stdout); =20 #define ARCHHEADING(text, arch_mask) \ - if ((arch_mask) & arch_type) \ + if (qemu_arch_available(arch_mask)) \ puts(stringify(text)); =20 #define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL) @@ -2929,7 +2929,7 @@ void qemu_init(int argc, char **argv) const QEMUOption *popt; =20 popt =3D lookup_opt(argc, argv, &optarg, &optind); - if (!(popt->arch_mask & arch_type)) { + if (!qemu_arch_available(popt->arch_mask)) { error_report("Option not supported for this target"); exit(1); } --=20 2.47.1 From nobody Thu Apr 3 10:05:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387217; cv=none; d=zohomail.com; s=zohoarc; b=GZAdpdHsvmayrlOlsKhjEr1dbl8f9Tpl+rGaNSXBzvd4DtwC/NyzuP6wmxIB23saRfbpHIpGZte3Zh+Fn9pWDeaGGqITCB0qzjq2iXhdnDe7xG6KHn4N4ltDED842y4UlkdyRnNDWywfajhPIUTr9YlSzqg8MSZSm+x1WpkCQeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387217; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=koJwEkpLST/7gWyCJsL/yXVo3vaaAtJxi2Nw9A7NzsE=; b=jhN8Yqlk7H1kILhatmIqr82lA9kOLRlVLTKnL2JLPvBIIbpikBNPARhxQug4KnvRxs6cxpVH5yUZzY+Nr6cK4ZGBtvBBKF6xoGBTpYHZMBDUH8vEiD/qQW9SzqmLBhXV5gAToAsad30mx+G84pIA2gRmLGQg6q8ltxmHtiTj0qw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387217059178.51592130338815; Fri, 7 Mar 2025 14:40:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMR-0006Az-Tt; Fri, 07 Mar 2025 17:40:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMP-00066z-08 for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:05 -0500 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 1tqgMN-0003Nk-4n for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:04 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43bbd711eedso18413215e9.3 for ; Fri, 07 Mar 2025 14:40:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bdd8da473sm64096865e9.18.2025.03.07.14.39.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387201; x=1741992001; 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=koJwEkpLST/7gWyCJsL/yXVo3vaaAtJxi2Nw9A7NzsE=; b=DDKsMw29k+bny3kzKqubFlxd+ZrH++YyXmd84Q7l3+ctBdMx/yrmX+s+sQE1BVxmpU OkbkXXFx/9B7ln1JVPbAS+qKxLGOG8pYzP1b5Cmc2lQTAVnQUEQQ/eMYdGWzWGmE2P2K A4xz+rxxm9+CatJdDnBgFuFgju0TET4drTmc3qIq0I+TAIbGRVp7rH/ZxBC5fB08EcPW w7EVfpEweUJwRlDPpePb48HF6pqbmlIlxgRjybNow4bLBGZ8P9BRIx98GkBOhoBanjLI qXAUcHeCtX0DCuCWzrFA20bkdJA8pTthVR5Ju0W0SNUaazXtcD3RyksAk3wN/n7rCGK+ M5uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387201; x=1741992001; 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=koJwEkpLST/7gWyCJsL/yXVo3vaaAtJxi2Nw9A7NzsE=; b=AqKY6p9iHkRLyXAJmYP9KDs+fZGY8/kI/NmHzdt2zLOOq/4w/32M3VWi1rxLTljri4 4JkkmqIj1EB03akC18Nwzpp6QF60H/Qnjc0JgG6NmIErABCX1RoDIFr6mYPPLcGoVGS8 qDJITs7TuUNNFBxZRWDHLJrSWsd6+wXA48Fha8Iuo/ZGsEePmQ55fK54z6w4GLVfotAY myFaMeKIhCChbkSUFIZvHVcSnoOk7WCnufMehxjbrnwZgdJNM+i3clNYKTVgOAlbzEgf MQJLC/LcOcndpPwlBtcR4u12Ia7zQhK625tFAR4t2lkKorbVX3Cosxbc8mJKa4mqZ2BD dhJw== X-Gm-Message-State: AOJu0YxFTJAUTrSR3XP2juI4s5f1ATBYMoYOJEEUiZX0hlyxOomHX6Xi BXRagI8Vc4/COr6xPbXyPR5crnLCoeB2Qfer7/TILMNqkAvQv1rGJQ/T9/0L5j4ekYbgrDuMnzP O8JY= X-Gm-Gg: ASbGncvcovMCpNcXmG8pCfdE+Pkh5ubNJvM6xl1cjHJfE07p/o0xwfz8pfaf5ppS8Mq 6s1zlfzWmWWlX3pJFS+kKtLMF49mtIqhRg57h1+xQDPYaHlgbOL5LkZdsOvWsFo2k3z+HGKqqxG 41HzzOCxFaISVJpMbDpLXzkiKVs/0q9kspvz9SUoqgfs0N/U9jsmN/13XmsB1Xb/rDzO74HZnGk kv5gXHOePxovweL+tv7bcTT6YGzzNraW7CR0rGuigpWzdxqmnqkL8DhS/1bLq2zCK23SQ0ZlPNO u3RNoPZCe3LcYwK6OvJ/qhj501MmoOa6jX/KrftgcoJSAlm3EiXOYbLUicd2l0IZCA6k62C/N25 pIIIxinYu+2ybbbxz+Es= X-Google-Smtp-Source: AGHT+IHTfQQ3o6s2tPclL8m5IPfAHPblUiprGcBMAb09s4SRWQab9eVED6oixw2cK26H3Rfih78zuA== X-Received: by 2002:a05:600c:1c9d:b0:439:643a:c8d5 with SMTP id 5b1f17b1804b1-43c549dcc0amr41814965e9.0.1741387200874; Fri, 07 Mar 2025 14:40:00 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/7] hw/acpi: Introduce acpi_builtin() helper Date: Fri, 7 Mar 2025 23:39:44 +0100 Message-ID: <20250307223949.54040-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387218075019000 acpi_builtin() can be used to check at runtime whether the ACPI subsystem is built in a qemu-system binary. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ani Sinha --- include/hw/acpi/acpi.h | 3 +++ hw/acpi/acpi-stub.c | 5 +++++ hw/acpi/core.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index e0e51e85b41..d1a4fa2af84 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -150,6 +150,9 @@ struct ACPIREGS { Notifier wakeup; }; =20 +/* Return whether ACPI subsystem is built in */ +bool acpi_builtin(void); + /* PM_TMR */ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable); void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar); diff --git a/hw/acpi/acpi-stub.c b/hw/acpi/acpi-stub.c index e268ce9b1a9..790bf509e5d 100644 --- a/hw/acpi/acpi-stub.c +++ b/hw/acpi/acpi-stub.c @@ -25,3 +25,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) { g_assert_not_reached(); } + +bool acpi_builtin(void) +{ + return false; +} diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 870391ed7c8..58f8964e130 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -78,6 +78,11 @@ static void acpi_register_config(void) =20 opts_init(acpi_register_config); =20 +bool acpi_builtin(void) +{ + return true; +} + static int acpi_checksum(const uint8_t *data, int len) { int sum, i; --=20 2.47.1 From nobody Thu Apr 3 10:05:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387248; cv=none; d=zohomail.com; s=zohoarc; b=EjxeokdDWQ0xKqo9t8RXXUoO0cpivboWZhPpwdx0ORfRPqdSUjEpUdmWCcdKtPQXgLHXJyz1s4Sjb8mYaATEm1j1zRVM+PQrEvzeKPCpwueHfkEJPnzV1gU6pZDxfUYi/U6HfLRY0slJEhl69IsHyy6eUQ9iEHKUXVCuE1rZrr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387248; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VODePOvWuMJyhRGr2deCbWysjZeVNWE2sWKn1Ustt/s=; b=I64aolmXJCzcshKgA1xhFdGlIDnXnSa8oQ7k2zFh225ALE4jgIQ/MZuLL+oBQiPD7XDaKHUPmomx1Ub+0W7kg8HUnt68wd5F9l4tYqomIxK3igxQSIeBRrYkjQUe7FLxFOu2yUw211Wp0wKzofCHZsdAcaZY0tbwcvrkWuFZs40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387248290319.4647651482645; Fri, 7 Mar 2025 14:40:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMV-0006Ei-T0; Fri, 07 Mar 2025 17:40:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMT-0006Dt-DZ for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:09 -0500 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 1tqgMR-0003aF-PL for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:09 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43bcf9612f4so19962185e9.3 for ; Fri, 07 Mar 2025 14:40:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bcc186de4sm63546565e9.1.2025.03.07.14.40.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387206; x=1741992006; 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=VODePOvWuMJyhRGr2deCbWysjZeVNWE2sWKn1Ustt/s=; b=Lzsh4w94hF1W6hZV/qyS6g/OOMLJgRxQ1CcZwfjFvkR9gsDc0LpxDxRU44Nw0pLB71 YCzbMXunLMkrxipNxLuLi87wQKLGSSzYQOr36tbopug3o8h+ux6+omENInjAScgy1nNL 8RZf3GIBq+QR+bEeKC95+LXf8Y/S0wNDXFYQRFuS4CUX4knt+aXDU/GgL7dlFrTP0SMZ tnOHvXe04nETfNA//ALMlY7wyXu1wYIva2i0ruukQSruYV3CViWvfR1j7TBlxGrPg9pC 44fomUExuK1ZqubgnSXshKcaGWqYSnD9sqEXfTn6pc0Lu15HdRxuq6oSkYDZmL7zd3Ob cTwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387206; x=1741992006; 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=VODePOvWuMJyhRGr2deCbWysjZeVNWE2sWKn1Ustt/s=; b=lEw8tHXPsr9BNbL+dZdwqWazEIV/2OwM17ZwQoqDb98GojEoVx4tzRScJDijkzSbyt n4C40Zlwb7nmPpoIb0gRJEg1NVyHi23mDrPzMulmf/8zK/zGTjySzWIJpB7/3QMT7cRP t9HFvdfAQmkSLYbdEUv7V/wLqJ3bD1OfcaONLqCC1+45f76+SAWu7KmAI+6wJwG8T85g QMmwjuyYFjPnTxB08w6Fu50FpbVTEbIoCq2Oe+kKjajRMLU4qoVRRj+rnSRgn3BPu2VH 5T4+Z2wlVDsHlGLOLtOPWg/EGJsKTKUhNE+OFSK3bLAKH7PfQLvkaPVBD4VABNeuIMBW O2Cw== X-Gm-Message-State: AOJu0YwF4wbT7KxRq6FfMgub/oYaLPswsTy8Bxp63YjTqunLeQVfNl6D wd6CRmTDxv2TXk7HcGSCLfx8YKEU+oixHP/4/QPyQ2g9oryMENX98t6TgqiPj4Z4y59UmBlP9UK wmPU= X-Gm-Gg: ASbGncvCORToVTWWlI2B3uBlHalu7JqmLcPY/1mNtwssef6q3YkDQH4L0Qds9KlySr0 Uxtrlq4ZLyuUvOmnA+g6GtHOeP0eN8BW1yA+FMzEaQDqIC3L1+nW+9kvzhR1Ng8B1LBDmCo1Pyo 5zJw5Tgu/vHwdKkd/lDa72HiVfcTMCV0kGMSbRa+ytY51XAVd4URKR9RCQv2SdVWar0SCvbaCZC Y0zkbGvAyE+noTA4tgSAHEznzn8VnbrxZ/9uV9vDznCGj44751QdARS/Oeihfc9LDASRh8gFUkw DgfpqmNpRdLeHTeDKbLffDGfPlhZo9CZQDkHr81eKoj54H7rUnpUk00EiR4nORtNX8zHAsZ/fKc BBITzDtynjAlHrQmHKt4= X-Google-Smtp-Source: AGHT+IFOS7lMHNCltqN1TL+3zvSadAxaTMZc8XzihdMZr3TWPoOd+sYBeWN+dfOrZ+E5qHvJnGqMoQ== X-Received: by 2002:a05:600c:190f:b0:439:a1f2:50a3 with SMTP id 5b1f17b1804b1-43ce246ffabmr14923365e9.4.1741387205744; Fri, 07 Mar 2025 14:40:05 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/7] hw/i386/fw_cfg: Check ACPI availability with acpi_builtin() Date: Fri, 7 Mar 2025 23:39:45 +0100 Message-ID: <20250307223949.54040-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387250149019000 Replace the compile-time CONFIG_ACPI check by a runtime one. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ani Sinha --- hw/i386/fw_cfg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index d08aefa0291..a7f1b60b98c 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -145,10 +145,10 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, */ fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ms->ram_size); -#ifdef CONFIG_ACPI - fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, - acpi_tables, acpi_tables_len); -#endif + if (acpi_builtin()) { + fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, + acpi_tables, acpi_tables_len); + } fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1); =20 fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_fw_cfg, sizeof(hpet_fw_cfg= )); --=20 2.47.1 From nobody Thu Apr 3 10:05:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387237; cv=none; d=zohomail.com; s=zohoarc; b=cTuHHRq5Vml1QQo3uINM3tutH74MxFGDPOrjOgXbXNnk3K5UcU0j9riODoG6WRRmGIB3EVTV2gea2mu5RC16Pemc2SgQQS/PwmnEiXS5vwshgF3mEbnpXKHXy7xon8T6siWSuOeUAIPtRX7d0IfyHizVOTOwvcdzYLkRSmkhgoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387237; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IuwCf4WRGv3h0tr40swdZHn3OJodO5dUQXcRGaznNRk=; b=m3wTdIF6xCXWMpzETBAaUh52XUkgKaBpJ8pMikCOs3iIOf9P2JGcrYCG9REefz8nSIDL1+pRdcAP2/qwz79vi32zGzTsJqxHsoSZukC1mh+SH+qSNRZa8/KtNszI13o7nSxt8BujwUw+APcOSDdG8CSXPFV7Ou+YEqCPYW3lyuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174138723787637.369966465682865; Fri, 7 Mar 2025 14:40:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMp-0006NV-Oh; Fri, 07 Mar 2025 17:40:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMZ-0006FA-MG for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:17 -0500 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 1tqgMX-0003b6-OG for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:15 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43bbc8b7c65so27161515e9.0 for ; Fri, 07 Mar 2025 14:40:12 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ce9f2d081sm303985e9.21.2025.03.07.14.40.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387211; x=1741992011; 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=IuwCf4WRGv3h0tr40swdZHn3OJodO5dUQXcRGaznNRk=; b=k3u/8O+LS0s39UwJ54KwjmBxNee5vyeut89tFmivEFbPCN2SBTHVDzm8cXSwkOQDRz 8CvB9lWIhTy2PoHhY3bUHhw4XWqTlU9/e6MD51llTq3ltgp2lVE67bkbFQPevHmCf4FB BzOiTsXoo2Eg6cSgERHM4g/phDtpK0ijYFuEl4Y0qdsEgWpxMsYW+dDnjRP4wMy1vjLs /dKeFJ+h3ol1LUUH+ZDlf8K6p/M1EXIvOxWo74h6Cf3qRJkz6rE5Y4yfaQHUd2Kdx3XD fTe8WcQW7pmwKXItCqmGDmbj9mUZXVnJtD9tWUqHpfgUrc5oR0DVrJaDLJ32qP3lmHSI KfVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387211; x=1741992011; 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=IuwCf4WRGv3h0tr40swdZHn3OJodO5dUQXcRGaznNRk=; b=nL5XqMhcYekByo0LepGzTyBA59R/05CWIGlUgmOrio2exHBTdcFEqkNTK09K6RNJ0W 9KhJ19Cl9o+FPetu7K/mskVaCrP85zmhnbSnDlHcCz6pPEZVxgOgO9lPSmIXxht+rrBN ej9Cba7KhJil3XOUiyFlWk4fgqGfeGaAW86qPxMzmegh6H1JJup6KvwCxcLIHOiExtRT NK3vfU55o3wgMZyqsrFtA4ZaCSTEWUojN7Ln0X4BzDbJ5KcVb91lmDdRR1IjJEbvsPs0 pg5C5guF/e5sf2LCuGREAXQG1jPaursWVFh3JTsK14PePR7NHNBqTP178fCL4YOD/0Hn Cc9g== X-Gm-Message-State: AOJu0YxuFul/T6+jEL6V3i5X5fTW8t4qJmRgBUZteKjlN1h1rd1k7wUb d0rIMvrwKEKXrn41voLxbK6Iz4WqgtmbrQsUz+tAOdfZvtfV0uW5lV0X+ju9z4pgDRJSm67SAnU g1Sk= X-Gm-Gg: ASbGncs5gX4Ecrp4PWN8g1A7stwywMjvwHIZ+xfykDVwJktjM2UpZLMLuL2A0DvgGzn Dm3/UcNLOTrCeCoq4yosgvETx2/Oq3I+SC46oOFzr9wva48FXz2MKaF0K5g6pnmK/dp1lUSa02X Pgdm+Ny0Y3BrUtm9u5GuIDnnZfOd8v/SnAkVvL49pBdYwr0lpD/9Fu5PIGjL491qlTFEeOEsLt/ aA281Ez4jUOAtzuMJ71p7FL2bgsH+5aRC2FZnZbcD5j+3J7OoRGfKr9WUmaXB4Nb/Rq6pcYmXqi sz0owq9ac7toSmo/QViMubfgVkIlHpqYKyWqrBR5eHQpO06ZIVLqV0yoEfbRpv/9RlRgXgJUD5x 3vP7PdPV6Ab5w8lc6k0A= X-Google-Smtp-Source: AGHT+IEcp88EWyq6smiXF2nbjZWjJwR4A+5AKGNnyT7ZmkGKimIJgabejM7fbCKRmdY8mB3aWrncGw== X-Received: by 2002:a05:600c:46d3:b0:439:9424:1b70 with SMTP id 5b1f17b1804b1-43c602223f0mr53786585e9.30.1741387210570; Fri, 07 Mar 2025 14:40:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 4/7] hw/virtio/virtio-mem: Remove CONFIG_DEVICES include Date: Fri, 7 Mar 2025 23:39:46 +0100 Message-ID: <20250307223949.54040-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387239749019100 Rather than checking ACPI availability at compile time by checking the CONFIG_ACPI definition from CONFIG_DEVICES, check at runtime via acpi_builtin(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Hildenbrand Reviewed-by: Pierrick Bouvier --- hw/virtio/virtio-mem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 7b140add765..5f57eccbb66 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -28,7 +28,7 @@ #include "migration/misc.h" #include "hw/boards.h" #include "hw/qdev-properties.h" -#include CONFIG_DEVICES +#include "hw/acpi/acpi.h" #include "trace.h" =20 static const VMStateDescription vmstate_virtio_mem_device_early; @@ -883,10 +883,8 @@ static uint64_t virtio_mem_get_features(VirtIODevice *= vdev, uint64_t features, MachineState *ms =3D MACHINE(qdev_get_machine()); VirtIOMEM *vmem =3D VIRTIO_MEM(vdev); =20 - if (ms->numa_state) { -#if defined(CONFIG_ACPI) + if (ms->numa_state && acpi_builtin()) { virtio_add_feature(&features, VIRTIO_MEM_F_ACPI_PXM); -#endif } assert(vmem->unplugged_inaccessible !=3D ON_OFF_AUTO_AUTO); if (vmem->unplugged_inaccessible =3D=3D ON_OFF_AUTO_ON) { --=20 2.47.1 From nobody Thu Apr 3 10:05:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387251; cv=none; d=zohomail.com; s=zohoarc; b=WmEps2NEawCZTeQLf9zCp1D5y3SdI8vdTKCDpje7SxdUOCqZn/EWGJWDYgHXKFROJdMJEYpZr3XxlS6MKSlj4DT7p1+BmXt7kT7lO2u4zsEassw6su0dpY0DcAAjsuARtYxh1qVdUJG4mcQW818upi65AZe7rn+oqwyehHA9YPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387251; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ffnzgiNvC3uFpe+lcYwlOkxah8KhJcrF9JntmJhQznA=; b=CE2XkmXssGU1Jn4iGFw9maNz70EIS/ByV8SCX7BU61pE8ASDEC5zrwz/BmjFzqGvaa8Q2y7/b1wWpx+nkmR36wHnDT1uSjH6IzZdDi61aVzBa/XZwuJcWA4tMtbd1XN5LDgE7vmBPbhNYpDQCslC3tox4tpmzdov782n4oDwp8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387251185202.48157098905335; Fri, 7 Mar 2025 14:40:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMp-0006QV-R1; Fri, 07 Mar 2025 17:40:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMd-0006HJ-Tx for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:21 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqgMc-0003bS-41 for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:19 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3912baafc58so1585896f8f.1 for ; Fri, 07 Mar 2025 14:40:17 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bdd8de4ffsm65306125e9.24.2025.03.07.14.40.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387216; x=1741992016; 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=ffnzgiNvC3uFpe+lcYwlOkxah8KhJcrF9JntmJhQznA=; b=gAKg4P0CKNf5qcLU4wGiWdZTGpffmk9cWwDWMNdRiBdeTQgi4jBVBKw80UkGcPgbv5 8b2tQSyUWSIgGvn8Sz7AGmd56eLnIgfLGUa/ts9CYJf3Bc13cUjE0uhpI4BoRpLdjrbc wfy/Hvg3KFJopGn8IHTg3P/439yJsuY+SfJSSoQElwv0QQY5sixpX4UX91kl1rnRPH4S ezhpwwDyLIBQ1dEZE1Jp/h6AmRFatnK10gTh40d0TYtggxSpD8ZqofIeDN7BTpKdf3FQ UNexEVwXOBI0tLYsbMQCGp1dEcW4JBhh7DPjrKXtOyjX9wprddRSWC2kLKVZqL/XLymk os1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387216; x=1741992016; 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=ffnzgiNvC3uFpe+lcYwlOkxah8KhJcrF9JntmJhQznA=; b=UYk3FdKoRUJfr7v9EwdwlaoHvMnFY0u/lOPqa0L3UiVM84SHp8KplrkbvRxBkFnhQh rbqTjy3K1y/wNSrhYIRFWf6wylpesix8l9IykM+V40Ab7VyrD/NH4ocG30T6qaNXV76R uyk03PBIv6YLT4rM3JK85PLHBN//R/X2hHGOaWIFKuTUBHkc312G7TY+0sat5z9KBonF VOnc+dXZw8nZlQ/ghAGueR60hs4n5eFnJtGGMY8SlrLuLRWnpaCqxJbGSUsHKuBVTHDc co6yiQgviZbgP1Nl6GYNV7ckhiSq8eg1g9g3/V7bSgYycJfgc72HhEpnqQQve7Bp7pSu RwjA== X-Gm-Message-State: AOJu0YwwQRnuIrLyNpD8CaOeKhZ/vK/y/v3gS9RTX+YsjaWh1uDUUKt6 gXDlq619Ec4iIOLLCZog1Kaq48440zP9L73FpWacESAEm9z0lyeUbH2qK+6M2P9K3uOp4Cn9Gny cNB0= X-Gm-Gg: ASbGnctQdXYTsbiFpSnrmNsqvv71lKo/suRcsnhL2H3Mou3EyRdnSfusUDYjioT69F1 7j1bQvZDGU9OBN3KYKz/I3eM6YfXaBzRpV8V7BL2Iak1fqh7ckMG/4atj018n7Nk+AKTap0f2VO OtVs+psrIpT1E8utZO4MiS8YA4r3mLRZU5qE4OONj8jCIRgO2tGx13W+07MlkxmNLymxd57LK2U MM3F0Z9cNtB22Hs5cLXRuvgAE9M7xOCh7P0FyuBUWhDa+5fA3XGrF21er+Wjb+piaAykUGUu05K JdSc+XI7VMWMOgh8fS1mK4rRaKvsh3X12ZqSh21Pe5XSVu6zedqaZ8ET/cTrhWYH/CC+sg4swRk zeAHx7FpjdqpNiaWLh9A= X-Google-Smtp-Source: AGHT+IFKebrxsQ6T8+ctJmf1stduSmqw5IRD5+7Tfg/JHYWgbjX3Isp5eM32al4bK3y5K3u8at7/FA== X-Received: by 2002:a5d:6c65:0:b0:390:e1d2:1dff with SMTP id ffacd0b85a97d-39132dcf7f4mr3366037f8f.52.1741387216052; Fri, 07 Mar 2025 14:40:16 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/7] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime Date: Fri, 7 Mar 2025 23:39:47 +0100 Message-ID: <20250307223949.54040-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387252462019000 Use qemu_arch_available() to check at runtime if a target architecture is built in. Consider the maximum extent size of any architecture built in. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/virtio/virtio-mem.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 5f57eccbb66..6ff9dab0f66 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 "system/arch_init.h" #include "system/numa.h" #include "system/system.h" #include "system/reset.h" @@ -170,13 +171,24 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *= rb) * necessary (as the section size can change). But it's more likely that t= he * 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) +{ + uint64_t size =3D 0; + + assert(qemu_arch_available(QEMU_ARCH_ARM | QEMU_ARCH_I386 | QEMU_ARCH_= S390X)); + /* + * FIXME: We should use the maximum of instantiated vCPUs ARCH, but + * for now it is easier to take the maximum of any ARCH built i= n. + */ + if (qemu_arch_available(QEMU_ARCH_I386 | QEMU_ARCH_S390X)) { + size =3D MAX(size, 2 * 128 * MiB); + } + if (qemu_arch_available(QEMU_ARCH_ARM)) { + size =3D MAX(size, 2 * 512 * MiB); + } + + return size; +} =20 static bool virtio_mem_is_busy(void) { @@ -721,7 +733,7 @@ static void virtio_mem_resize_usable_region(VirtIOMEM *= vmem, bool can_shrink) { uint64_t newsize =3D MIN(memory_region_size(&vmem->memdev->mr), - requested_size + VIRTIO_MEM_USABLE_EXTENT); + requested_size + virtio_mem_usable_extent_size(= )); =20 /* The usable region size always has to be multiples of the block size= . */ newsize =3D QEMU_ALIGN_UP(newsize, vmem->block_size); --=20 2.47.1 From nobody Thu Apr 3 10:05:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387295; cv=none; d=zohomail.com; s=zohoarc; b=eluLp/Y3g41HTbssbNHlt7j+EkEWKe139Ut1wo0Sgn/a/QtaKS433CYVFMrVnSBR6wydM1WtuYKZ8B35H8pS1c7Kvblap8MG4QhbEgnQWIPS/6SEXV0riiVr2+HSBAoNIpowaMGRmkVEgjuDQrykf/AjLRe0nEu1UiANw4dLLRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387295; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QySqG3zSy3Pvfq1KfaUgxmaXz+8tcYoh2JzWhFmGcNk=; b=WtC+ctM17C6QC17vF0sMgb45HrR+wHanCIjALZQPdtnwBFhhXMOp7IUU2uZnOYRCVTMdAvGDesH9kfEnN7b1tckdOzC5SqCb6Ehx8IqCvSHFxDF4RQKsJGnvsaVVqxmyk/bD96cwu5loT15pRQ7HwtOuSAKY3wLYpYqWIXEc3/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387295454887.7449574665966; Fri, 7 Mar 2025 14:41:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMu-0006hN-R7; Fri, 07 Mar 2025 17:40:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMj-0006N9-UB for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:28 -0500 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 1tqgMh-0003bm-3M for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:25 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43ce71582e9so765215e9.1 for ; Fri, 07 Mar 2025 14:40:22 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bdd8dad73sm66358775e9.19.2025.03.07.14.40.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387221; x=1741992021; 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=QySqG3zSy3Pvfq1KfaUgxmaXz+8tcYoh2JzWhFmGcNk=; b=gz3ZicF5B4xr8miq6EROllkKUaLLgIhOHB4VFnljfNzQXdr0qGykTA35pXAsuCVIAz q2BvVljt3Z13fvSIie2XDOQPvp54yUZSOKTY0G479k8fYAmxpmuAZfO80sSch2qIvLV7 3SDsTV2ROIYkrWSZEALL60W4XSeZqYYtoHKrxlJbxHxLT+M7or8SVd0/gTsVtdPQWlRv yNURyDzrmulrOIU/p3ICtPGUPpOIqsB1v0vPC+JU9IdatdPXWWHrtESqnu+KfXGe+KHc USIvniABoefgWrfzKaTkpvj/827WyR07CGG1XbWJBjRQ8APi1s3gBOg0T351fFGi9Ytf E44A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387221; x=1741992021; 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=QySqG3zSy3Pvfq1KfaUgxmaXz+8tcYoh2JzWhFmGcNk=; b=JBZ1qNro2KRioDiZazcQ8TB5eVvAKz92rSDkElSicynhkms6JtxOgPQmtx8jtL3z9Q ada4EvY++qsRpPZZpUuf6s0vmJvyUoCIFPLnJMgrR5nQRlBGfQ6BfCd0ymUvpSU5XDWB SFXEYxC0wPdn/T/CN2zz9yBpngoPltk3sZE/KjzQDQeh41ArRdyQur95SbpYsoiG2eor vRZhrb/eO9Wuxfh7F7L9i6WQVDea79Fs9oT1v0sD2IagylErzygHFaEdKSiXc08zfL08 14c+wuRDohsXVG0NMOOwUmEnMxOchdIZ87zL2xo6DMshfFMNt2P85XVDGPiAZ6FzbF7J PEsw== X-Gm-Message-State: AOJu0Yz8m0zqiaH2br/sfPkxvKm9hl5XVWAzLDg91+arvPWM2j40sxPy VLU+hvk6pquSI0qqe7hMrps+XVkTMmLldfSj/bw8bQKWoF7M0mNSknGpEyjUAZLIV3CoQRQXukk exoA= X-Gm-Gg: ASbGncv86U8sDRKFscoSZQmvvxxKNPd+/YpcHEUKJA4hGR29GTEuxA2p6sfms9d97N1 PN5KDKQd53XTcsveAS9wqusySqt7+e+1GFVKLFQPY27vU2+5zja0MqUVm15shkinYEuAdNaf9VI VVchwwfig/C6tIFwo1L8RK7Ahiiom3OGgmiW6PNOr3y+DF9F7sHbeUoP0M4ZOvs7qTldr/9Bz3s LOfJlmvgfM1pZivSvLJkTpNXBXAq4WB+1q+hqZOD3oWP5aFFVuCHsryUFWHf/Ew5pAz8XSvHY5k tvTSl+keUhU9Xx4nTEn/CE/BiUU3sw02ZMgMWMk3syG3Dhf35FtmILRF/oNvVlxEEGxwaNNpOZT uMVuaADSzjKxZWxT0b74= X-Google-Smtp-Source: AGHT+IEePJ2DBzbYOnHOK3/nOQOx67r9qAItOqsioIdBwpj9FSfUoGxyy4AuCLt9ldt5fb5F8BnNgg== X-Received: by 2002:a05:600c:5107:b0:43b:cb05:f932 with SMTP id 5b1f17b1804b1-43c5cf3cca8mr30089325e9.25.1741387220883; Fri, 07 Mar 2025 14:40:20 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 6/7] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime Date: Fri, 7 Mar 2025 23:39:48 +0100 Message-ID: <20250307223949.54040-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387296665019000 Use qemu_arch_available() to check at runtime if a target architecture is built in. Register virtio_mem_legacy_guests_properties[] at runtime. Code churn in virtio_mem_device_realize() is due to re-indentation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 61 ++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 6ff9dab0f66..5288fe597b3 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -38,9 +38,10 @@ static const VMStateDescription vmstate_virtio_mem_devic= e_early; * We only had legacy x86 guests that did not support * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Other targets don't have legacy gu= ests. */ -#if defined(TARGET_X86_64) || defined(TARGET_I386) -#define VIRTIO_MEM_HAS_LEGACY_GUESTS -#endif +static bool virtio_mem_has_legacy_guests(void) +{ + return qemu_arch_available(QEMU_ARCH_I386); +} =20 /* * Let's not allow blocks smaller than 1 MiB, for example, to keep the tra= cking @@ -144,7 +145,6 @@ static uint64_t virtio_mem_default_block_size(RAMBlock = *rb) return MAX(page_size, VIRTIO_MEM_MIN_BLOCK_SIZE); } =20 -#if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS) static bool virtio_mem_has_shared_zeropage(RAMBlock *rb) { /* @@ -155,7 +155,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) =3D=3D qemu_real_host_page_size(); } -#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ =20 /* * Size the usable region bigger than the requested size if possible. Esp. @@ -1009,28 +1008,28 @@ static void virtio_mem_device_realize(DeviceState *= dev, Error **errp) rb =3D vmem->memdev->mr.ram_block; page_size =3D qemu_ram_pagesize(rb); =20 -#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 =3D ON_OFF_AUTO_OFF; - } else { - vmem->unplugged_inaccessible =3D 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 =3D ON_OFF_AUTO_OFF; + } else { + vmem->unplugged_inaccessible =3D 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 doe= s" - " not support the shared zeropage.", - VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP); - } - break; - default: - break; + } else { + vmem->unplugged_inaccessible =3D ON_OFF_AUTO_ON; } -#else /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ - vmem->unplugged_inaccessible =3D ON_OFF_AUTO_ON; -#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ =20 if (vmem->dynamic_memslots && vmem->unplugged_inaccessible !=3D ON_OFF_AUTO_ON) { @@ -1723,16 +1722,17 @@ static const Property virtio_mem_properties[] =3D { 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, VirtIO= MEM, - 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), }; =20 +static const Property virtio_mem_legacy_guests_properties[] =3D { + DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIO= MEM, + unplugged_inaccessible, ON_OFF_AUTO_ON), +}; + static uint64_t virtio_mem_rdm_get_min_granularity(const RamDiscardManager= *rdm, const MemoryRegion *mr) { @@ -1885,6 +1885,9 @@ static void virtio_mem_class_init(ObjectClass *klass,= void *data) RamDiscardManagerClass *rdmc =3D RAM_DISCARD_MANAGER_CLASS(klass); =20 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 =3D &vmstate_virtio_mem; =20 set_bit(DEVICE_CATEGORY_MISC, dc->categories); --=20 2.47.1 From nobody Thu Apr 3 10:05:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741387282; cv=none; d=zohomail.com; s=zohoarc; b=Je53KCl2uqKp/mvmBppdSBATT+0Yor4cOvogZEPF7mPtufRMIxAO7r0nWz045zykQqDuBrqOw1CPQs9aReNnOalF9ljFnLuuRbgJiVvT0HrsXuIXI53UL3w33F7GcE6zfPKb7JQP7fY+Mj5jInFXSh2JePX/bCSKEQyeX/yfSD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741387282; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mnovoaUMqprzKKHYFuoZMJZ/2zGWdVOJkellgnL8PG0=; b=BCO+GRCsElGe9KW6MAX8b0VrUegCrP4xz5/0dsD2Ts9r2ujyD+z0iVxPJzyPIyZioc2hIjBLUWPlgL19ajPqKECUsBAKQ8pZlIUaXFuOHvze5H+PIbkhjpgb/5uhpOeH6gH8v37d/Rej+WscFyfW4HLPwYCfzR6cAoxXm8EoR58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741387282379747.765024501194; Fri, 7 Mar 2025 14:41:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqgMs-0006Xo-8H; Fri, 07 Mar 2025 17:40:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqgMn-0006NU-BE for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:29 -0500 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 1tqgMl-0003c5-KH for qemu-devel@nongnu.org; Fri, 07 Mar 2025 17:40:29 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3912c09bea5so1707614f8f.1 for ; Fri, 07 Mar 2025 14:40:26 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bdd9471b7sm63627185e9.34.2025.03.07.14.40.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 07 Mar 2025 14:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741387225; x=1741992025; 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=mnovoaUMqprzKKHYFuoZMJZ/2zGWdVOJkellgnL8PG0=; b=czMQKFBYNwLtRP7DsDDarkvweUNXkkfgPiPyqMuqG6BtxfiOHcfehR2bHDv9iYQl+7 3Hjdh8XagrlUPVpDWV4YAPdq8O8WTIq911kTDKgEAAqdWipilNHboQ+cSgqzaMML9AMX 02vWH4FXm7XaUA+wm1ZlmL2HaTjMuu2GcVVD9NLrQ9s67QKo1LCiFe03+xC+LQQwR4DM nErDAh2KMsJpM+cd2oc3eIm7HzHI170z9I0b1G9EpULQxyDE8IVruBsTYJjTmEXqktwH vq95f5mgfrduc3vIVWTksT4pFN7xWKIjzXS8IFN1NuB8hny/jiCheQrNI33L9Jat+pP3 72Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741387225; x=1741992025; 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=mnovoaUMqprzKKHYFuoZMJZ/2zGWdVOJkellgnL8PG0=; b=KCT+3+96PCby4ng/nGlyf4zyR6Ngxz5UMIDncJA/2toyyy4VMYEl5o0yZWe5V2iaLE Z2/Cx6L/7E43ht3qvaiPgT6ZdJhUFKkILeaMmt6RKto65t2WU4lJpGv6xwKIV0LnaU1o jKQwih6orTuw3t36UCf8hjxkmUgyO+oRQixo+2PvZ53+orz0EqGUq5781GZPUeT9CDpQ 8QUiFls4PxkNszH176QXmRzMbBadP1pjha7guN7e0M+NqPKLpnVatL7mybXB4W+xsasl P9CKeRZKtHI/8FthfgS+p/P1E9MGnYyM9z6kWoYcYcLM1ZcnMrsPNuQPkn+J6BySq2or zdtA== X-Gm-Message-State: AOJu0YwR8+B/KQ1AHcrP0bYDY4H1WyzWhsXph063DfpCpJiFLoc4yPd2 qL6+Uygvc0+HpmdhTl6I1QiIRn3900/PNrnnCZKi+VCFwV/GbKeQgJWGDfTa8V1P+QNhxt2+R9N MjyY= X-Gm-Gg: ASbGncsZLWooeh0Ji1lrRyHFUVrE6Zr9SKWHOee399zb+nHu9c/JzQ4UB2ipZnjaf+3 MJULglcaDic7g9LElo0CbQY9Xc3ysjIPBcnjb9dFUuXkgY75koZrSsNvs7OVCMKTUB1dUpCsUQe tY8WKDjRunGQzyO6uNYkxYaPoUj+xS8mJhO2QFr62oxzZFlMe8SOcS4g8C2hCeQmZaN+GPpSoXC uoZHHZeNFBrG62pER9vJMQU2FdK3Cij0YNapBItUvthu3QSoruIfLscNIxXKQx2tXCZOARIPonM XjG1qzSI0751G65H08HfG8WMQSLptimJXuv5QpSBXd1JNmvFyDK88ENUU21mwXzpxr0TI1U34MC UvwicG/p+mJ42DekqTbk= X-Google-Smtp-Source: AGHT+IGY8etv8/dIDm9L/f7Om9gzMsUEqO/hLEAhAxuVK4Ifw6WAs0qqxGNql5lclqfEMFltDpfVAw== X-Received: by 2002:a05:6000:471d:b0:391:20ef:6300 with SMTP id ffacd0b85a97d-39132d98c7dmr3250867f8f.37.1741387225570; Fri, 07 Mar 2025 14:40:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Marcel Apfelbaum , Igor Mammedov , Pierrick Bouvier , "Michael S. Tsirkin" , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ani Sinha , Richard Henderson , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 7/7] hw/virtio: Compile virtio-mem.c once Date: Fri, 7 Mar 2025 23:39:49 +0100 Message-ID: <20250307223949.54040-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250307223949.54040-1-philmd@linaro.org> References: <20250307223949.54040-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741387283616019100 Remove unused "exec/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=C3=A9 Reviewed-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 5288fe597b3..2e51dcfdf32 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 "exec/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 a5f9f7999dd..7c3513315cb 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -55,7 +55,7 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_tru= e: files('vhost-vsock.c specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vh= ost-user-vsock.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-r= ng.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-m= em.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('vho= st-user-scmi.c')) specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI= '], if_true: files('vhost-user-scmi-pci.c')) =20 --=20 2.47.1