From nobody Wed May 8 10:31:38 2024 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=1659368658; cv=none; d=zohomail.com; s=zohoarc; b=b6BZmk0JARVCyMxwEXvH66ZuhxxY6HTOiUAYozeTYjNEMKrsrK7Q0OIJCFB+6kBAlcQq7GhXqlpJIy8YRN5YiofJQkxjwyNxLTPRlhS50BWKQATOITJsi52PC5iV3ORmjmGqpVL4eZgLqNxqvusY5J8OZLXMMf9tvck+UiOcg9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659368658; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ipf2GTEsKt1D5ZFSIONpxUko5GzazWg9tTGt6/Pqvzs=; b=RMXOaB4pu2Q4LL1di7sgbGmzxFfdP3EyKlua9eel/CtDTKoK3ynRz74pB5ns1xkZZapSiT/MEZ/Sz8cPXoZcZ8eWefsgn7EE8fTbDftm2/gnswUvooACVqPkfo0ZvZsuHNO3CP5SuKNMeaUDVXcxDcG1hRSJMhNxydvERR1h/Mo= 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 1659368658307940.4794013299883; Mon, 1 Aug 2022 08:44:18 -0700 (PDT) Received: from localhost ([::1]:59302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIXab-0003Lu-25 for importer@patchew.org; Mon, 01 Aug 2022 11:44:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIXSm-0005Ky-DX for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:13 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:40847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIXSk-0006gs-OK for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:11 -0400 Received: by mail-wm1-x329.google.com with SMTP id ay11-20020a05600c1e0b00b003a3013da120so7611623wmb.5 for ; Mon, 01 Aug 2022 08:36:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id l16-20020a5d4bd0000000b0022059422255sm7109295wrt.69.2022.08.01.08.36.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 08:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=Ipf2GTEsKt1D5ZFSIONpxUko5GzazWg9tTGt6/Pqvzs=; b=WCss6kAZmxyOwNaQLQz70U5Qr6bt+RJYYHajWxqXQbeNjuKzKEUSu6EWg1STfKZcDh lhKmnNUK2f9jF3zjX7CgKA9Ujjs8z/3KNwbxfVJGNzMw2naWVxhuU+VBzJCsthdgTiKa B1IoA+d6JPhgs7b2/ymTXXZHmfyVS05kz6G9s2tGNKEhNV55yUMxSYQ1GCBJSBm+xxer qv5lAqtkQPyp1jijWfFHsciMWjUwJ+8c6Sw7bqnS2uzo9+ighNJ6ECyqXWTYi6Fjaeh9 GA9EtLpKZz65KbH6/CIb5f+ZxHZxYZGOxpo6lyNH8xQHvNULwGvAv6HAWaaR7CEmP/vR x9ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=Ipf2GTEsKt1D5ZFSIONpxUko5GzazWg9tTGt6/Pqvzs=; b=c2XIZWeu6BcTrucMu8oGmH1KLR6Q/D5yYbe/zkVIn2HSeKJB4ubhr93YGr79PZhWEk DZ0zZkjCDBFOikjsLdzmFZ54GYclX2E1dC1U251AI0XZsiKjw7xtsMA7ZmUTrNbum8pM /F3cNw5l6FedP2CNWA9r+JiP7/I+taLXGoqNd0i9bhCGM5G9+XtPbbGDeAQ4hdHw+KyE iVZiWFMFzdD/L8qmMcC1Mm5OJ/B3EbuCfVUvv0i6UlmtTaz7DdKaGtQ0KJYxjwVRDYaz 7s2K0A6gTknTVwe7fSwxcfRjOaU+ECM20OSljat2dIdv5sdrBmkt6iycMfT2dezdWR7n gYlA== X-Gm-Message-State: AJIora8Tk+SpojBUHUS/Jsty+/312X1Ym3v30GH9N6aq8FmmKHcnY+Ik DTJdtga/i9xH9jSW2ngcrRUkXGy5xTZpKg== X-Google-Smtp-Source: AGRyM1tlf+UmLmfw4mBS4G3tf1cmlOOX2N9XSIMH2+rBDzyBjNQE9mk/uGModlQiuRRVX7ipwLlLFQ== X-Received: by 2002:a05:600c:19d2:b0:3a3:3aca:a83d with SMTP id u18-20020a05600c19d200b003a33acaa83dmr11808295wmq.88.1659368169273; Mon, 01 Aug 2022 08:36:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/3] target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features Date: Mon, 1 Aug 2022 16:36:03 +0100 Message-Id: <20220801153605.3051778-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220801153605.3051778-1-peter.maydell@linaro.org> References: <20220801153605.3051778-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659368659997100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Indication for support for SVE will not depend on whether we perform the query on the main kvm_state or the temp vcpu. Signed-off-by: Richard Henderson Message-id: 20220726045828.53697-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/kvm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index d16d4ea2500..bb1516b3d5a 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -675,7 +675,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) } } =20 - sve_supported =3D ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_S= VE) > 0; + sve_supported =3D kvm_arm_sve_supported(); =20 /* Add feature bits that can't appear until after VCPU init. */ if (sve_supported) { --=20 2.25.1 From nobody Wed May 8 10:31:38 2024 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=1659368435; cv=none; d=zohomail.com; s=zohoarc; b=NOGpKF0FZKOORWq/gIAUJsfSwqeRjBN0ZzDtxpDEuuVcbzm/wajqoy3vuwjJALTWEsC3SL/GZpUOtSnniOG9RiG6vShv5GRh9PWqv3OG89TulV77UtItmmN5H7pEC7hOCrcLpuz6gj8dcMJsHBMd71dL2kAAQaxmxj0eW/0epmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659368435; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zlTomEsC6jgfuL5E2VJ8p507QO9XDvOULRxbbhKQdX4=; b=WrK+LkZcjOiw8zrNjGtJq+ApEJw+mA8n5AKiG6nXOYdJ+evjhZaP67ycNi13+iwI8se2FEd1zRKWn63x5OEQBTrjjhRksmBVderErBy7K/q4s27cO0TVWtCVNTL0np9ncv9H3o4sJB2HGmKSJkup+kAqMNFQKUzBf9jFttiP7LQ= 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 1659368435249353.1330671387291; Mon, 1 Aug 2022 08:40:35 -0700 (PDT) Received: from localhost ([::1]:54148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIXWy-00081l-Gy for importer@patchew.org; Mon, 01 Aug 2022 11:40:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIXSn-0005Mb-Nd for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:15 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIXSl-0006h7-Px for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:13 -0400 Received: by mail-wr1-x432.google.com with SMTP id z17so9912698wrq.4 for ; Mon, 01 Aug 2022 08:36:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id l16-20020a5d4bd0000000b0022059422255sm7109295wrt.69.2022.08.01.08.36.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 08:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=zlTomEsC6jgfuL5E2VJ8p507QO9XDvOULRxbbhKQdX4=; b=QBIcLC5HT6W95Xs+9s3+gYB+O9f+E/zLealQJZ+Ch1jDrXdc2TMbsDOyAoC5rZyzhv eDAC58T5Z7+isN7DLc0NpneSxCcPElVgx7q3+h78nVFxlDcdqj71OA2GDNK3zOhKN9r2 lLrk0VlA49JapynuFMRIx4F33VFdcfVIu+mKQaDC3K4VIyIjnWx76MGAI04I0V5b4EKD O1M9UIkEyDm+rGNuLTFbBBoCbZqVVIqZxzPvhFUvwOxUSxbwC8FD4R3n49Im6B7sJbFv HoEeFo2dRd3dzMDAj1UtPgA0XDrWT/UTqcH7pSYZ6/KHzA95POy8gkddgZzsmaYeIVF8 JwsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=zlTomEsC6jgfuL5E2VJ8p507QO9XDvOULRxbbhKQdX4=; b=4TgaVeiV9A43c5s5cVKRD88+e5U34ML3qSAUjICXeHbMX66ilWu4dHlRkPcrMp7ujn vWk793TU3gU1DrhXr3Pgbi25sFpSVAVSNwJQSbGZs4cAhy8Fgiu/zdMi0h7rUMovHFFm RrNUa00DUz/wmg8uL8ulX3FlnIop7QVSFLroqGiuovjcNoxGPlLXd/CXpT2j43vBYt5u 7mv4B24PV1QVNxj03hg/SUe5hTEkH8TXvrvfVhL1Akk1pl3A5AH23ol8HZU07Eqd5MJ0 TQplXqY0mpW7l1dfaplZZTKiBBQtVsHXAk3RY7sZqR+FTbpshwa05lkXGD+EQu05BQNY xVTg== X-Gm-Message-State: ACgBeo1PDqQF/WTKQx/wA1HSyD2n/+MFY749KhtcJ708TKTo5zaIAcVL aE48gjXVs7CpAYB4yDWnqryEePUyOYzH/w== X-Google-Smtp-Source: AA6agR64y/z+8cJyWQknvQ8HzSMw+oG3v0FdV+Eju8INorhnOHVS074sm4B/q0obS5qYvR44xVBXLg== X-Received: by 2002:a05:6000:156e:b0:21d:c50a:7cdb with SMTP id 14-20020a056000156e00b0021dc50a7cdbmr10927716wrz.16.1659368170191; Mon, 01 Aug 2022 08:36:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/3] target/arm: Set KVM_ARM_VCPU_SVE while probing the host Date: Mon, 1 Aug 2022 16:36:04 +0100 Message-Id: <20220801153605.3051778-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220801153605.3051778-1-peter.maydell@linaro.org> References: <20220801153605.3051778-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659368436913100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Because we weren't setting this flag, our probe of ID_AA64ZFR0 was always returning zero. This also obviates the adjustment of ID_AA64PFR0, which had sanitized the SVE field. The effects of the bug are not visible, because the only thing that ID_AA64ZFR0 is used for within qemu at present is tcg translation. The other tests for SVE within KVM are via ID_AA64PFR0.SVE. Reported-by: Zenghui Yu Signed-off-by: Richard Henderson Message-id: 20220726045828.53697-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/kvm64.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index bb1516b3d5a..43cd7eb8904 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -507,7 +507,6 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) bool sve_supported; bool pmu_supported =3D false; uint64_t features =3D 0; - uint64_t t; int err; =20 /* Old kernels may not know about the PREFERRED_TARGET ioctl: however @@ -528,10 +527,17 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures= *ahcf) struct kvm_vcpu_init init =3D { .target =3D -1, }; =20 /* - * Ask for Pointer Authentication if supported. We can't play the - * SVE trick of synthesising the ID reg as KVM won't tell us - * whether we have the architected or IMPDEF version of PAuth, so - * we have to use the actual ID regs. + * Ask for SVE if supported, so that we can query ID_AA64ZFR0, + * which is otherwise RAZ. + */ + sve_supported =3D kvm_arm_sve_supported(); + if (sve_supported) { + init.features[0] |=3D 1 << KVM_ARM_VCPU_SVE; + } + + /* + * Ask for Pointer Authentication if supported, so that we get + * the unsanitized field values for AA64ISAR1_EL1. */ if (kvm_arm_pauth_supported()) { init.features[0] |=3D (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | @@ -675,20 +681,13 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures= *ahcf) } } =20 - sve_supported =3D kvm_arm_sve_supported(); - - /* Add feature bits that can't appear until after VCPU init. */ if (sve_supported) { - t =3D ahcf->isar.id_aa64pfr0; - t =3D FIELD_DP64(t, ID_AA64PFR0, SVE, 1); - ahcf->isar.id_aa64pfr0 =3D t; - /* * There is a range of kernels between kernel commit 73433762fcae * and f81cb2c3ad41 which have a bug where the kernel doesn't expo= se * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabl= ed - * SVE support, so we only read it here, rather than together with= all - * the other ID registers earlier. + * SVE support, which resulted in an error rather than RAZ. + * So only read the register if we set KVM_ARM_VCPU_SVE above. */ err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, ARM64_SYS_REG(3, 0, 0, 4, 4)); --=20 2.25.1 From nobody Wed May 8 10:31:38 2024 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=1659368407; cv=none; d=zohomail.com; s=zohoarc; b=nMlfJ81d/K5/zXMSa5IyqrBtAwozhGGyfgfr5tWjI+ho6KO+SYr2roSuZE+neSoUXi4XQPq4x6vZ7RdnevawMN5ACCMZ+f0o1r/iqRq+rRjAQ2xbNSSZgfAyPMKBYsiGqayiL/SItBMTrOaIlIVP+yLgiYujcZBZuA7d0ZFvojY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659368407; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7TrRZP89XydMUNpJE0vVRKRxKhZa4Vn1cfpQMOwzXNY=; b=Xngvrf/prhAiiXRmG+2oeUGyaGdrKYvtkaNEBMmBZagA709iItXTj17nRizsmPAoLjwj25rc7HIAVAX+46Bop1CWRSM7nX2LNCnH74IoSsCyF5UVliUj9ZTlCXr+jMQHV/Hihk79wFGHI8CTISkhrLATrhPL8+d5JwRp3lDu0ss= 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 1659368407036577.8324590504069; Mon, 1 Aug 2022 08:40:07 -0700 (PDT) Received: from localhost ([::1]:53662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIXWW-0007hq-L1 for importer@patchew.org; Mon, 01 Aug 2022 11:40:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIXSo-0005Ml-IF for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:15 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:42982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIXSm-0006hC-8I for qemu-devel@nongnu.org; Mon, 01 Aug 2022 11:36:14 -0400 Received: by mail-wr1-x42b.google.com with SMTP id z12so4495007wrs.9 for ; Mon, 01 Aug 2022 08:36:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id l16-20020a5d4bd0000000b0022059422255sm7109295wrt.69.2022.08.01.08.36.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 08:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=7TrRZP89XydMUNpJE0vVRKRxKhZa4Vn1cfpQMOwzXNY=; b=ziGjG+ZzRSGC2GzPgrs7Lgx31Mr3RcINHJyMatrS6pjL0r6+JSdc3832uoOEEhucID gix+fAFlUgGP44SVGUWCJwfC6XfynsJ6drRkE9VBovQn1FEvyHEXcNjwNg0U/qKWXcWP vzk384XZ8m7wG+ZA4O/D1VnFMzse45p7m082ZypBVdHaC0YUp7edYIz7QJcuK8WLOEMv P+RHN2GcgnU4rh7YQXvyilLOCAJ3suzBB2lWSmO87ll86t784aa484MEs7TVWHQCHpiH 9PcxS3g5tYblyUJ0uCivva57eyBdsg+x7IBcrGDn8s2Nta3nRRvfYAPUz0+Kj5+VBbpp fn7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=7TrRZP89XydMUNpJE0vVRKRxKhZa4Vn1cfpQMOwzXNY=; b=U61nhY7v4KKo9OWkNuxq+8/o+W2WhsogPfuZvb2kNgKsvtWdz9dZq8b7RNWXbStn/b SnZokoa80hcOZ/BliT/kE0sB7toxPEDm0gOTV6HY1Xw6HzxFQJktLwtWyvb6X1xeEkJA Hx6Em20iaVwhy7vh3jLnal6hOri94tIjunnxjIiBHvuB/5HTKvJwxkb8L3LpEquwMaRB ajy6t+C2AjfQlT2iTOK04m+wh4+DCqlQ0ouWcrsCddLUFapBJselmfsnzN0FeBpn2zuS nbJTG5NAUaTSmdefC2VLzteN6r/Tji05e00r8/0N60oCJQgTwf1OcHuLfm1fWRzbrgv6 OG/w== X-Gm-Message-State: ACgBeo3stAyXx62fa3BYeO6WpNTYa75asnrU9DBR2eVXzFGsUr7hj+Zj 1kvtEoXp7rixjnkknCSlVm0yKGMPt0U0wg== X-Google-Smtp-Source: AA6agR43oZ/gq9cNqDuSTmMwu/6wZ2lfOGpBZgkYHZKz8kJP4unF6BEKvQnPreAQC2fK/HsDgT4OIg== X-Received: by 2002:a05:6000:1a8e:b0:21d:a7a8:54f4 with SMTP id f14-20020a0560001a8e00b0021da7a854f4mr10680740wry.654.1659368170938; Mon, 01 Aug 2022 08:36:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/3] target/arm: Move sve probe inside kvm >= 4.15 branch Date: Mon, 1 Aug 2022 16:36:05 +0100 Message-Id: <20220801153605.3051778-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220801153605.3051778-1-peter.maydell@linaro.org> References: <20220801153605.3051778-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1659368408948100002 Content-Type: text/plain; charset="utf-8" From: Richard Henderson The test for the IF block indicates no ID registers are exposed, much less host support for SVE. Move the SVE probe into the ELSE block. Signed-off-by: Richard Henderson Message-id: 20220726045828.53697-4-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/kvm64.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 43cd7eb8904..9b9dd46d782 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -679,18 +679,18 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures= *ahcf) err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, ARM64_SYS_REG(3, 3, 9, 12, 0)); } - } =20 - if (sve_supported) { - /* - * There is a range of kernels between kernel commit 73433762fcae - * and f81cb2c3ad41 which have a bug where the kernel doesn't expo= se - * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabl= ed - * SVE support, which resulted in an error rather than RAZ. - * So only read the register if we set KVM_ARM_VCPU_SVE above. - */ - err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, - ARM64_SYS_REG(3, 0, 0, 4, 4)); + if (sve_supported) { + /* + * There is a range of kernels between kernel commit 73433762f= cae + * and f81cb2c3ad41 which have a bug where the kernel doesn't + * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the V= M has + * enabled SVE support, which resulted in an error rather than= RAZ. + * So only read the register if we set KVM_ARM_VCPU_SVE above. + */ + err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, + ARM64_SYS_REG(3, 0, 0, 4, 4)); + } } =20 kvm_arm_destroy_scratch_host_vcpu(fdarray); --=20 2.25.1