From nobody Thu May 16 09:10:58 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=1658812038; cv=none; d=zohomail.com; s=zohoarc; b=iB5SWsJIsNrNF5VlZk5FUqYsF7yF1875y9V42Is3PAUv00LpCeNT5i0VanJr+0wyaML2ieV/uNnd+p5JM5jGH+c38ROx2+emXEBnlIP5JSLQwSNyH6JCQJcAWVQBCG9hvkHYq0POce8B3WrPf+GKFDqEl2Mq6gyqsvRXHmBPObM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658812038; h=Content-Transfer-Encoding:Cc: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=Lpuu9FS+6IljQuvO2lx2PvlYEAAtS4M2JdBO3J1d0h0=; b=csjVatbhxLYNAYwjTwCfZZkRaxfKN7EaIOr3UoymAMg6F49FSYawf+ICXmaVEHjzzFpVJY54lFEytIObslfEC611PFaA9coZXAEklM2LrUUu+qXt4AR1NVAo+8Lc1DX9usPfWhRfP8NpO0NQWXFs2nrVTLuL1/eWXfA5CDw6GJs= 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 1658812038912689.7525477747557; Mon, 25 Jul 2022 22:07:18 -0700 (PDT) Received: from localhost ([::1]:49460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGCmr-0004Ku-NT for importer@patchew.org; Tue, 26 Jul 2022 01:07:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGCeT-0006FT-K0 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:40 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:44641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGCeQ-0002bO-RF for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:37 -0400 Received: by mail-pf1-x430.google.com with SMTP id e16so12247714pfm.11 for ; Mon, 25 Jul 2022 21:58:32 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:673b:b40:a955:bc1b]) by smtp.gmail.com with ESMTPSA id o19-20020aa79793000000b00525343b5047sm10550460pfp.76.2022.07.25.21.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 21:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lpuu9FS+6IljQuvO2lx2PvlYEAAtS4M2JdBO3J1d0h0=; b=bMdhktFcD4mTOm8qxcc2SXtLVWbgFmlGpOt9S3xk2QBhzUvau42KHXYQY9XmlmbBqs pZfXVpVi+tabk6UqhSBBvEFgB2GtTkaauTlCgPE82ZGesCASNC5xroWo/CI9CvbIuYkZ z5+ipaqv6TpUYISPjY1voD8CkDsZSeEnNWCqDtJ5CPOnIrkS+0XwhwBjPukKSLq36+jf zr3rnxer2SbA8WShlzIXFnL5IW7nJfMfjEQwX+VQYcbvXxae1a4Cg9WpyIkMMsADj5Px Ywy31W9SBEWzKmNn+3P2N90mbe00LHLEXnz8OrFZuQBwCWAj8LaX/OsvbOCnn0lp8E1U negA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lpuu9FS+6IljQuvO2lx2PvlYEAAtS4M2JdBO3J1d0h0=; b=7wvrTnVTCPVeDFJTxDDrMNjFbZiOHo7HJiJJ5dE/+FaBAK8kSQAXdBMexarGfksGiu VHLGiePjIMP9TRpXVCmd+4QP8ffFN7DrhHTWaNXt3lBebJe7wuDHLrBFBIx47Xifq7tZ QFIyGHLaUB8cTRxvV+2Ggi2QHC0Bd9JW7oWoHQbxya5ZnlT1zdGk2c4BLBnxZTW7Y0N5 qGfu7QjRcbrX4fJIC8mMlbumtyKBdvMhPN907urqc5L0+cJMLu3Plpc7FI4t21+mb895 YV2O22Yw+bAwD3EPOiKPCZZ69FyTEmrdfUQiMUfIRr8VZeulwjNl8GLPJFZEKeFczeam ix4g== X-Gm-Message-State: AJIora8jU9q3oZQoAUJ60nLgdZM1RaW3487uCYnZLOJ9v/gKDDECfoyD bW0HZwZmsmmkaBKRqgUAYKgE1QQ/65EqKQ== X-Google-Smtp-Source: AGRyM1v8nwDXz45j/G0upRJXEM5hGVHgdML+MCRARuencHNTc6bbM7cjcRC8X6lPBMl08Zi0CbDqeg== X-Received: by 2002:a63:1220:0:b0:411:f661:f819 with SMTP id h32-20020a631220000000b00411f661f819mr13945541pgl.250.1658811511713; Mon, 25 Jul 2022 21:58:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH v2 1/3] target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features Date: Mon, 25 Jul 2022 21:58:26 -0700 Message-Id: <20220726045828.53697-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220726045828.53697-1-richard.henderson@linaro.org> References: <20220726045828.53697-1-richard.henderson@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=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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, T_SCC_BODY_TEXT_LINE=-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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658812039863100001 Content-Type: text/plain; charset="utf-8" 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 --- 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 d16d4ea250..bb1516b3d5 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.34.1 From nobody Thu May 16 09:10:58 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=1658811807; cv=none; d=zohomail.com; s=zohoarc; b=TnP5ioanqudVua6Q3odg9cV7SARIy1yJUrjOODyaBejVSNz9UDEvXC+tOvIXsT87XXDShtL+pwjy2lfvftgaAg6ahnBHarFuL4Uv5u6TFm2eu4bywTvl9Tl/+7Fc1wd8X64h8VJEAbX3D/jh0lh4kq21Kk6b7Qd219j13eqqHfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658811807; h=Content-Transfer-Encoding:Cc: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=KDVN6nTJJe7rCbQUwyIy/u753J7JpZeC4VTwUN/cZno=; b=jp4ErsEO4rmvjWakphQX1pKqCdqGs/C1QCB7pncd3DmJNDWrotxEbBviLYqaxi38ZimAUBbytqL8penVP377jhVXayLss/EQqwuZ1hYmwBLjCKuRwGqFEMasGYkpG22oHTXFLdlkmtsqVliUMzLouDC9ofOaryIP9YD6vs09TXM= 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 1658811807123245.21509225969055; Mon, 25 Jul 2022 22:03:27 -0700 (PDT) Received: from localhost ([::1]:44200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGCj7-0000jw-1r for importer@patchew.org; Tue, 26 Jul 2022 01:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGCeT-0006FV-Qh for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:38 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGCeQ-0002bX-Rg for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:37 -0400 Received: by mail-pl1-x633.google.com with SMTP id p8so12265794plq.13 for ; Mon, 25 Jul 2022 21:58:33 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:673b:b40:a955:bc1b]) by smtp.gmail.com with ESMTPSA id o19-20020aa79793000000b00525343b5047sm10550460pfp.76.2022.07.25.21.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 21:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KDVN6nTJJe7rCbQUwyIy/u753J7JpZeC4VTwUN/cZno=; b=APhM1IrpttSVx3NmqdfhpBa9QHQqWO9MHeI1Mp0npitZS5gM/fp3WXKk2x9f2Gy0Uq 0O1mfalpAM+mqAIOVQUTy+E9XG05BfkEeWN1suY7m6CaLyBC53q773jd/sci7kHl3APp PUJ1HBJCUH+SNVib9az6aHQz9N9W0ycVfNpuj/s2Uj6TlR8xu3za8BV1alSZQn4dzQzv 5qZ4+QYfEWAI510ijeheAxtQX+nowrlLEigwp6eaDd6VE5hL1c8J8RCcaWz2kOlfyxzT IB1Fv/27gh8igstFblkmqVk6QVGwxmp8ciGUDBF/awPxr1zywzBJe/mKnYBVA3fK9anl G5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KDVN6nTJJe7rCbQUwyIy/u753J7JpZeC4VTwUN/cZno=; b=Wezebh0yyYmcDESj/a1KPHvdMEfbZqUy4M39E1C/zMPrpEtqY4TrAxYoJkC/Zt7Yem fcxtb1qVFH3Ksc3LxRXYB4P7r50Cdthp4qzm9YIDME3HGmxeLHyM2s49KAZ0VmPSDvU0 pbVsusIUu0RuNrEEtSwe/htXLG4b23gxKciYRriNetIGNWuLs3uyGd1ZA75vYZNwG7yF mJq+dONJ+DzyopnTv+ZuyHkvrNlpdx9IlJfBpm0ATcAuRXA6cJMwqwn5Um5EQsAHskdw l6bFR/cwUR3lkIG0vU74doFELvNFnOImyCM0LKlNovFC2MQ/VluqXARaKl4tNuzf83HK Nn9A== X-Gm-Message-State: AJIora8GhD9QYk6wXZKrhxvBRfkvlOXHpjvLKNiMl+XPwj7qXot0aoRC pFS9yoTtkRF1T344G15M/er6yA0Uh2sOdw== X-Google-Smtp-Source: AGRyM1viHVib0MwNmy9t4d9diAKcYYuAWN9oS2J3ETUYKaJcuBxTZe5MCStI4Caxq2SvMA7dbYj5oQ== X-Received: by 2002:a17:90b:4c08:b0:1f2:977:c147 with SMTP id na8-20020a17090b4c0800b001f20977c147mr35532174pjb.6.1658811512608; Mon, 25 Jul 2022 21:58:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH v2 2/3] target/arm: Set KVM_ARM_VCPU_SVE while probing the host Date: Mon, 25 Jul 2022 21:58:27 -0700 Message-Id: <20220726045828.53697-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220726045828.53697-1-richard.henderson@linaro.org> References: <20220726045828.53697-1-richard.henderson@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=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: 1658811808066100002 Content-Type: text/plain; charset="utf-8" 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 --- 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 bb1516b3d5..43cd7eb890 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.34.1 From nobody Thu May 16 09:10:58 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=1658811810; cv=none; d=zohomail.com; s=zohoarc; b=Up3zC5SX8B1FVUB11lt0lPM5ZiO/sfG71pAvLka1lJxdx62oTHhImYJ1xymSqd6yoQMBWbEVpG2NctUI47v7OT5+emvbKBBoop2EdAenUBnFK2C5AGzRKCuh4CTF0mQ8y6S27/iwN2cJ0XuvXzLgyTaO0G/uvrZCriy2FCX1uqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658811810; h=Content-Transfer-Encoding:Cc: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=emSFyLsiKiz9IhTW6WmW8M3rFKM7w+1zQzDRk8176ug=; b=f2jLyKl6Gi5L+8aRjnRHEkBniLU78NEgDud+T6MfdKqW67oehY5DIVK8gflU4VX0T7AZyJP43XHq4Yld6MRdHHH7bBTaoFU5NLUq03RL8BHXa1mUoe21qYTTcgWyMMGUZ9r/f1Hh6Tw60ZM7jrXh9gmJqgrquK7TlQNKSQ4acLM= 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 1658811810708834.1237350540339; Mon, 25 Jul 2022 22:03:30 -0700 (PDT) Received: from localhost ([::1]:44352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGCjA-0000q6-L0 for importer@patchew.org; Tue, 26 Jul 2022 01:03:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGCeV-0006Fb-6U for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:44 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:43898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGCeR-0002bi-5e for qemu-devel@nongnu.org; Tue, 26 Jul 2022 00:58:38 -0400 Received: by mail-pl1-x632.google.com with SMTP id y15so12283933plp.10 for ; Mon, 25 Jul 2022 21:58:34 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:673b:b40:a955:bc1b]) by smtp.gmail.com with ESMTPSA id o19-20020aa79793000000b00525343b5047sm10550460pfp.76.2022.07.25.21.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 21:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=emSFyLsiKiz9IhTW6WmW8M3rFKM7w+1zQzDRk8176ug=; b=JVkZgxXg+61wUQ+htk4SFkSLrq1sPlvbxNnzaXlrtMlVX+g9TLB6DFl3QPvfB77013 bzpaEKTYDwMUpu8EhCxhHIbaud6S8kSOV0ZM/ph7U5HJS0zCk4IMy9x1hSNKI9Dno3KW oPPF1hs+5080+fW7LD12TCjREWn5UKdhPhul8OEkLAl8krfP7suZvWPLF9vC0qhCbu6n BoVjBtHS5b9509ucYcJtdhN11yebYIpkXnmzaEAMSUSqUf2TqIteCyPFVY0QSBU3oElC IZ6t1+JLQf3f2pCpSh9kkMOqC4SC+urZtVjmm9kXuJ5jG7PTmhPMCLaqkeQlLS3bRF8C S4IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=emSFyLsiKiz9IhTW6WmW8M3rFKM7w+1zQzDRk8176ug=; b=iqRoCLL0+h5MgeVoq70TE8IQlbJCBXknk8OL9eBatmCgLrFT9EZppDtUgpcMl3mK6+ aHpQ9AKd38nvrDI+mehApPWrh8/k97MvMOEFGaNm0hKGN0lMa+M1i2pXkCRNsYACOLXj +UMop0jw3OOWTCBd32CxnJicivHhdLbqPoxrL0DsDPjV7I/bqJPWLqFPBc1U+PKf8HeH wZUrKWHXRxxTZ8cKBk0hvwothXHZX5ClB+YArqI+zCIdiGRb3mQ8c7/EwUCtoRDaIs1d CqsIxttFqA6vivRZbAd9cgsz/8A/A4EKDHmYlYg/ANn3z68AW1HybMJnnqMLTGIidvGW 4RbQ== X-Gm-Message-State: AJIora9+gKYy8wWUtMvYjqdDQtPAcHZK/pzqZ68WYeiuemYSegI89JqH vOrPxDPSXHQUmHVSxCLAdWao8prz2Xqdxw== X-Google-Smtp-Source: AGRyM1vJw+pVOGA9S8JirJ/1J8VVNh649qzra7x3u/wtiKTY4doef2dZ/5P3ADQXDiSOoosONxFZ1Q== X-Received: by 2002:a17:902:a586:b0:16c:3182:a9b with SMTP id az6-20020a170902a58600b0016c31820a9bmr15115484plb.44.1658811513688; Mon, 25 Jul 2022 21:58:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH v2 3/3] target/arm: Move sve probe inside kvm >= 4.15 branch Date: Mon, 25 Jul 2022 21:58:28 -0700 Message-Id: <20220726045828.53697-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220726045828.53697-1-richard.henderson@linaro.org> References: <20220726045828.53697-1-richard.henderson@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=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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: 1658811811496100001 Content-Type: text/plain; charset="utf-8" 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 --- 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 43cd7eb890..9b9dd46d78 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.34.1