From nobody Sat Nov 15 06:34:10 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=1754932114; cv=none; d=zohomail.com; s=zohoarc; b=Qy0K3GQr1ccBHG2kKzLdpCvQLYuW3LjI0R8uetpzISCSiyBSXLkpNoTcplqJhMprygVvYAbcc35tR0y2P1FMceJZdSRv2OpR10Ht+8OxuTyvkYfg9x/05/bca9Du4Zi7Xhhdc08LDtWJ6qRfx+O6wS0JM0A4iAGSYk3e2FW0F0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1754932114; 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=sTgiDxRSLxB+/Dn7RyfAMOT6DRpkQW6SJaCX0ndx+MI=; b=QIHk76kii+gdzVMdg2b0gH2+z+8eEMJUQjRKpxoL6j07HjH3DVddVO1NmoJtimZd99PK4y2ZKzK2MFoQ0OeytRNpU3/YFcVWpOEOrjU0B/fwzfDLNsrQ876kmleGdO2DZX77EXsl+SKevlu+K9hgM/cZz1dyRZMBHONtE4WD9WY= 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 1754932114473953.5252328070325; Mon, 11 Aug 2025 10:08:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ulVyt-0004pF-Sq; Mon, 11 Aug 2025 13:06:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ulVyr-0004oJ-Gs for qemu-devel@nongnu.org; Mon, 11 Aug 2025 13:06:41 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ulVye-0001lD-KC for qemu-devel@nongnu.org; Mon, 11 Aug 2025 13:06:40 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-459ddf9019cso15114945e9.0 for ; Mon, 11 Aug 2025 10:06:28 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b8e0683045sm32464335f8f.41.2025.08.11.10.06.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Aug 2025 10:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754931985; x=1755536785; 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=sTgiDxRSLxB+/Dn7RyfAMOT6DRpkQW6SJaCX0ndx+MI=; b=IsG+H3GntxmqMDHatqDlOp4fADROO4cmTatuD85H1Ia5zoobIbN2UcqFuMP9/hQz2d 1I1tKglOMF7CQ/VA0pbmUPNZEtw9AhFmi1GszImwP0rCTIiwZ95GUdsY3SXg4IkAq5TE fPJcBhC5fDtvEdllGMdSeRgyfa6wb8ZhnzBRHBT9TouLnqGPvXeIafuQX5VjHGS5WF3l 1W3nbmtuSUjXoCjRhUekdH5OHmB2QL91b/c2RPBrLly3MYTU/4iQsbKEp5aRkbEIk+Yy ipuThvPF7TVLfgsaLMnbdfZYlHIJiBadZQ7Izk4fhm/hxZyYtkUSH5F61fuDnKo4wSzM zuAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754931985; x=1755536785; 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=sTgiDxRSLxB+/Dn7RyfAMOT6DRpkQW6SJaCX0ndx+MI=; b=srTDxfIMuqAk1z9q2lp2TOim6e83p6pevr8m8xTd8TE5ceo1+KPO4ILrC1ku7cXy7/ HyIA3OpU7fmXHseAv3ICrr68WRtArIHRFrS4i1N/zpJeuhA8c2jMB+0tldAUDONT3MfL q6Fso/93UrP+T+zF0IN9UxsPiJA5Bz7VTWRKbIfVLDZE9shujqvWUi7UMcLcHgSK/qMT INKeVxNuLMg3HdRkjC/JACMKuIemOm5XK+m1IQVMS5+YlTzIHdqUBmo19ULfIkWLRYa0 /7gjMtwPme30shNtHKPLzeXt6/v92ant7jfmxjD0oUxYcNizLKKFRRMUXVUq9Xztt2zi pI5w== X-Gm-Message-State: AOJu0Yw/enqSFfrHgvRDPKKVGTyfphlOuoUSvf2U332AhRsw7h73Yx6F jciLB9jVsnvul3FcjxBjAGiaENLW1OL7g+ehMCIgmncM8nJIXucLQaKQRm4Ap0VG+CuVO6FLwe8 fNpYf X-Gm-Gg: ASbGncvSuoBIfmDrFaVhSoAab8/Z7W9du9Kg0RjUkYJRaewQBIbkoDjUPUOiRxlyg5o bURrS4N8gXaQ+vIXmBDKNvF7R8VDTb6HS+ZwmGznkEspbqgy1//W6TEaJuQBun5hDBjSLgpt2nW 6+QLDN+K5ehreuraKYb6BYs7rh0+q/G/WnVqBF2U6TlFssbR8HzQY+HuXjisvzdkxa2GAMDPic+ U5dP24aN3fI+FPWAvchX2LRMewsZ3xNhH9sBtUuMnbto6cHrByHg3lhMaHsR8xrovhw9dfKJQuu AgLU7n07+c0+QI7y7Slqe+Ennwz94Gt7MwqcGTfQetQbB06FkDA6BA5iIn4+9bX3Kkuo53p+0sF +jwA7qxmFwhy4Y64/2shB0DL0nhTWmj1vFR5c/074xetH9/UT6qI+RYY9yZljmkH9mUTJdME1 X-Google-Smtp-Source: AGHT+IHmKFWh0EX5W4UrlAuaShc8z5HGaqyl6BzhAlbha6mdD4im91lzcojjBo1X/5DvQMYjrTsAeg== X-Received: by 2002:a05:600c:3b89:b0:459:ea5d:418b with SMTP id 5b1f17b1804b1-45a10f58f2amr1775565e9.9.1754931985104; Mon, 11 Aug 2025 10:06:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Miguel Luis , Richard Henderson , kvm@vger.kernel.org, Peter Maydell , Paolo Bonzini , Haibo Xu , Mohamed Mediouni , Mark Burton , Alexander Graf , Claudio Fontana , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mads Ynddal , Eric Auger , qemu-arm@nongnu.org, Cameron Esfahani , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [RFC PATCH 02/11] target/arm: Use generic hwaccel_enabled() to check 'host' cpu type Date: Mon, 11 Aug 2025 19:06:02 +0200 Message-ID: <20250811170611.37482-3-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250811170611.37482-1-philmd@linaro.org> References: <20250811170611.37482-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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1754932115815116600 We should be able to use the 'host' CPU with any hardware accelerator. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier --- target/arm/arm-qmp-cmds.c | 5 +++-- target/arm/cpu.c | 5 +++-- target/arm/cpu64.c | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index d292c974c44..1142e28cb76 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -31,6 +31,7 @@ #include "qapi/qapi-commands-misc-arm.h" #include "qobject/qdict.h" #include "qom/qom-qobject.h" +#include "system/hw_accel.h" #include "cpu.h" =20 static GICCapability *gic_cap_new(int version) @@ -117,8 +118,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(Cp= uModelExpansionType type, return NULL; } =20 - if (!kvm_enabled() && !strcmp(model->name, "host")) { - error_setg(errp, "The CPU type '%s' requires KVM", model->name); + if (!hwaccel_enabled() && !strcmp(model->name, "host")) { + error_setg(errp, "The CPU type 'host' requires hardware accelerato= r"); return NULL; } =20 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e2b2337399c..d9a8f62934d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1984,8 +1984,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error= **errp) * this is the first point where we can report it. */ if (cpu->host_cpu_probe_failed) { - if (!kvm_enabled() && !hvf_enabled()) { - error_setg(errp, "The 'host' CPU type can only be used with KV= M or HVF"); + if (!hwaccel_enabled()) { + error_setg(errp, "The 'host' CPU type can only be used with " + "hardware accelator such KVM/HVF"); } else { error_setg(errp, "Failed to retrieve host CPU features"); } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 26cf7e6dfa2..034bbc504cd 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -26,6 +26,7 @@ #include "qemu/units.h" #include "system/kvm.h" #include "system/hvf.h" +#include "system/hw_accel.h" #include "system/qtest.h" #include "system/tcg.h" #include "kvm_arm.h" @@ -522,7 +523,7 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) isar2 =3D FIELD_DP64(isar2, ID_AA64ISAR2, APA3, 0); isar2 =3D FIELD_DP64(isar2, ID_AA64ISAR2, GPA3, 0); =20 - if (kvm_enabled() || hvf_enabled()) { + if (hwaccel_enabled()) { /* * Exit early if PAuth is enabled and fall through to disable it. * The algorithm selection properties are not present. @@ -599,10 +600,10 @@ void aarch64_add_pauth_properties(Object *obj) =20 /* Default to PAUTH on, with the architected algorithm on TCG. */ qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); - if (kvm_enabled() || hvf_enabled()) { + if (hwaccel_enabled()) { /* * Mirror PAuth support from the probed sysregs back into the - * property for KVM or hvf. Is it just a bit backward? Yes it is! + * property for HW accel. Is it just a bit backward? Yes it is! * Note that prop_pauth is true whether the host CPU supports the * architected QARMA5 algorithm or the IMPDEF one. We don't * provide the separate pauth-impdef property for KVM or hvf, @@ -780,8 +781,8 @@ static void aarch64_host_initfn(Object *obj) =20 static void aarch64_max_initfn(Object *obj) { - if (kvm_enabled() || hvf_enabled()) { - /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ + if (hwaccel_enabled()) { + /* When hardware acceleration enabled, '-cpu max' is identical to = '-cpu host' */ aarch64_host_initfn(obj); return; } --=20 2.49.0