From nobody Fri Apr 4 03:39:19 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