From nobody Thu May 16 21:46:10 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=1658773126; cv=none; d=zohomail.com; s=zohoarc; b=nq6KmB6AUeuJ8vLpg8XTsBXXEELZtWrwgdlr49Bp64qRd2K29qtTNSpVk1f/23e6uMEnHiWlqdokmrKJLqtv2R3yXKQPKrgFGPbt3Nuh14Epe4CGVDrNyGiD6Uo+RHSBTwvHU4Iwxq/g8GExIxxG8u1ySjwJ2EkLurPqu2i3GsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658773126; 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=yEs9SFwgwTuqEnbJkZEUd2ZZZGNmQAbrUyEKBuLlY20=; b=IMKWGy02ZxkJwjECP5ZxOUD/vLsnhMQnaQxI/0SNbO+h+ghY1QOmen/3/bv106o2vL7OzUFmgaT+y9x/Sqa6KX1XKUgk1Re3XYtAiy4SbBII3A7wcHSutaRp+8edv145Qw5I64N5J+w7I1LGJYCMsDy5iYYM8E4QdBeml2NO+FE= 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 1658773126660413.4771325916503; Mon, 25 Jul 2022 11:18:46 -0700 (PDT) Received: from localhost ([::1]:55078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG2fF-0006xf-4n for importer@patchew.org; Mon, 25 Jul 2022 14:18:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG2bo-0004mf-4S for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:14 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:45637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG2bk-0005pt-S5 for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:11 -0400 Received: by mail-pj1-x1030.google.com with SMTP id g5-20020a17090a290500b001f2ea602563so258017pjd.4 for ; Mon, 25 Jul 2022 11:15:07 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:30c1:2484:a853:233d]) by smtp.gmail.com with ESMTPSA id bg5-20020a1709028e8500b0016d8d277c02sm1125004plb.25.2022.07.25.11.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 11:15:06 -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=yEs9SFwgwTuqEnbJkZEUd2ZZZGNmQAbrUyEKBuLlY20=; b=E9cUo9c644yNmMSr8+ErgCNlM4ry7ody/uDbFBVCPIaRMhDwEb55p1mrNlIW7Me/Oa Zm0dumNVZiFVjjtIc4eeUAp4ytDK0OJmxcVez2CQkkBznkT1RZelCvOJNtWpJe7bu1En 7TrDIWNhc2g/ttqD15MxHCGfX7Jaci8et8Z7H6HY72Ufi5mElEHxv35ValEb5v/sNcCk pFzycWRnmQys6TxPbw/O4azt5G9GoP8yd1jt/UGRxCiBISmxTRStGA6TFS0B6vsUzVYI tKZtvdNpwpbcF3m6i8MtRB25yGJh5nZYG1nReMGzbwDCRodBPEZWk9YRMm0k1hAZwzfs RFcw== 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=yEs9SFwgwTuqEnbJkZEUd2ZZZGNmQAbrUyEKBuLlY20=; b=X82fjRPV5sIFsMrN7PU3lJYV3TpKgK0p7EH3spkYg6s0umv+K+YwOThNVTt6Sk77p0 wfcBOew4hFi35VO5yOmhCglGYBxCYhNBrB+PQYTm1boNghf+IkIV6xOsBFFmB1R5lejS ZNddyOPbE8/K1308v7u+MyRNtd2OeVtWte/SPoTX61heXSCUKtujhK9XhFQCfpLfWQzM u18gDGxNjis66VCtBeGbrST/7xAI5Jlf2dx3n7zjFM1X/vV+v1mTRrcTp772TdClqBM4 2mgAdX5DBelf9rndgj1dNoCtbhmopKUee4s79yYV9lzeuMWu9i3iK5w8XWgGoXfj96QG kRhQ== X-Gm-Message-State: AJIora/N903ejGN6dULZK3pQHh6NC4dCeXHbd+EfA+hz5J+5pepzTBIb UxPKXDw/zJNT97s1aNEvxoDRosZN60PV2w== X-Google-Smtp-Source: AGRyM1t1EeXFP82sHeS0NNW3bt4zUwHIV6PzN7zF4u05SIsDnfCairGyBT46aBTGJG16Y/3g9UqSYg== X-Received: by 2002:a17:902:7c0d:b0:16d:500b:1255 with SMTP id x13-20020a1709027c0d00b0016d500b1255mr12369828pll.98.1658772906915; Mon, 25 Jul 2022 11:15:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH 1/3] target/arm: Create kvm_arm_svm_supported Date: Mon, 25 Jul 2022 11:14:55 -0700 Message-Id: <20220725181457.41083-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220725181457.41083-1-richard.henderson@linaro.org> References: <20220725181457.41083-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::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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: 1658773127467100001 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. Mirror kvm_arm_pauth_supported. Signed-off-by: Richard Henderson --- target/arm/kvm64.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index d16d4ea250..36ff20c9e3 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -496,6 +496,11 @@ static bool kvm_arm_pauth_supported(void) kvm_check_extension(kvm_state, KVM_CAP_ARM_PTRAUTH_GENERIC)); } =20 +static bool kvm_arm_svm_supported(void) +{ + return kvm_check_extension(kvm_state, KVM_CAP_ARM_SVE); +} + bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) { /* Identify the feature bits corresponding to the host CPU, and @@ -675,7 +680,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_svm_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 21:46:10 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=1658773339; cv=none; d=zohomail.com; s=zohoarc; b=R3XbXKRgUPO4odOxs8qu6AW0zBChyrkttqVrETID/44uBT16kQ5sDGeR4jklEarD71dO1Jq37wRFkUdzlKK41AjghHdQUgXJ+8//n1j7xgM0LMGkLts/XDtpk6sehJ6TJ9p8pytAo27KKGCukQti0+LynEhODTkkGNPba9ZnbUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658773339; 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=N2OJQKKwRLRjFx/fh9iTaEVWiqAoFPuSiTt6AYqCB48=; b=UENnfhUaI/JzwYhqwiSItj3QTmRExnrsijYCiG/zlKO4zA87ncloV3tykzZAMxR0BFQjE/Nsqmu9g7VXGmgYkjm5QoHrGGkyTw0Y1wukCh5u2DlNHKtdXEaaPvcTCDUCNqfjUYA3oH1eGThxLqzt3c6D0x/haFkRrfE11O04on8= 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 1658773339861501.39905796301343; Mon, 25 Jul 2022 11:22:19 -0700 (PDT) Received: from localhost ([::1]:59932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG2ig-00025B-06 for importer@patchew.org; Mon, 25 Jul 2022 14:22:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG2bo-0004mh-82 for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:15 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG2bl-0005q9-E1 for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:11 -0400 Received: by mail-pj1-x1031.google.com with SMTP id g5-20020a17090a290500b001f2ea602563so258065pjd.4 for ; Mon, 25 Jul 2022 11:15:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:30c1:2484:a853:233d]) by smtp.gmail.com with ESMTPSA id bg5-20020a1709028e8500b0016d8d277c02sm1125004plb.25.2022.07.25.11.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 11:15:07 -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=N2OJQKKwRLRjFx/fh9iTaEVWiqAoFPuSiTt6AYqCB48=; b=k4z62w5IpFLty3Sy7/0qLGS4SWQO4CjNegPSxpWly3VcZf0kSa3MzwL3M4+34CbLqa LhO166wyO+M/MVMahHYFFxJ7H01JznqF9r7NbhAoioPy8vi9YSASVFtEPlklaj2an2Ss k7UVdtb1Fj6G2gCTDMlP9X+a9TkrSxAzHGuPy5+jg0MDCHDYzOFw6FbNTTlnudA7DtJ6 OtjUVMv1N3d6Jfq/JvRFU2b1uPxtJqq0G4qoFUw3/AUtEn0yLFJ+BJsAiB3nyZeGoFDV et2p2QvXUaNQjN8F4Mz8I9sZMaBu23dvZo/mzJA0lJBnyKfNKDjAHuniH6cnJC1O9xsP SYsw== 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=N2OJQKKwRLRjFx/fh9iTaEVWiqAoFPuSiTt6AYqCB48=; b=56pmWyb669X1tRtuKN9v9VAQPhi7jyY4FQrm3+oWduz0WLhqh8xVzAD071uAwXwR1O j8nblDm1ZD5wQTH2sqMBDlNhDagR8al/ZdMYl/PW6td7w6ZETVb41Phg+IiystrEWu70 SzJH5LhT8t0paxtchAfx0phktZMm2wlTRkzpnQnBYUtycLMI9H0cH+Zs53S9yOyeIWQB U34rPHEZhM2wtNgS5v26ms8C6ojldB3ooVhD2eTquaxXHN/0eF5v8gYd/vpFlM1GZF3f vKrZFHQ3SpXAQao4HWWmeBQlzJ+5fqWXRuSfnkaqstuwDdaCJ07dAoS8Jv7Zm0Ca3Jil IY5A== X-Gm-Message-State: AJIora+l42+gbj3fV3o9FozSBZDU+2F2GAJxioe2YzP8rOJTtZCVdSKN xZKeCVGh3G/uTeh1YijtT0dLg6T9kzdB8A== X-Google-Smtp-Source: AGRyM1vNlm5NJPRWRznEPLaCoFG+T677SB5++0X1+X8SW8/nlaPXr5Pw+es5HEDBMdyFVYE67OT72g== X-Received: by 2002:a17:902:ec86:b0:16d:6424:efb2 with SMTP id x6-20020a170902ec8600b0016d6424efb2mr9952698plg.62.1658772908058; Mon, 25 Jul 2022 11:15:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH 2/3] target/arm: Set KVM_ARM_VCPU_SVE while probing the host Date: Mon, 25 Jul 2022 11:14:56 -0700 Message-Id: <20220725181457.41083-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220725181457.41083-1-richard.henderson@linaro.org> References: <20220725181457.41083-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::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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: 1658773340429100003 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. 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 36ff20c9e3..8b2ae9948a 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -512,7 +512,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 @@ -533,10 +532,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_svm_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 | @@ -680,20 +686,13 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures= *ahcf) } } =20 - sve_supported =3D kvm_arm_svm_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 21:46:10 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=1658773329; cv=none; d=zohomail.com; s=zohoarc; b=d3+63JVo47kmyxv1wxY7zz0rzY9ltfBhaxEx7R17f+FRrJFjZrF1tmYRnlDHbnQ/ojABQRx8WUfgpgxeDsMRpiz+DG6gRzu7tZ07m2FFQkZwrrLXWKQ7RdFAibxubhYCvQngZMn/scSXU51LRK0oMtJhzSst+CugpCbxktCpTUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658773329; 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=RMuYv4EVFHYkxhumjJ2SxEr+kwKlkg7raeV+cD/IvUA=; b=bdRg7t6YAkcANrcZXeQKtvsx98MaJGTd6/p/eBG5c/yc7Rrhn9dqfJNVgVurxaiKpURs3hjnGNhNoonq0WML5op8pU5eB5HWrbXz6zlTNepEiGFqsce/IZEO8XAHXcvh1Yp+EJ+kX/87WfBcThABwNmHmiu8IZicywcOOE9ZTWI= 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 1658773329004686.9064264269647; Mon, 25 Jul 2022 11:22:09 -0700 (PDT) Received: from localhost ([::1]:59514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG2iW-0001o4-0q for importer@patchew.org; Mon, 25 Jul 2022 14:22:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG2bp-0004mj-8q for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:24 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:40541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG2bm-0005qS-HF for qemu-devel@nongnu.org; Mon, 25 Jul 2022 14:15:12 -0400 Received: by mail-pj1-x102e.google.com with SMTP id p6-20020a17090a680600b001f2267a1c84so13418202pjj.5 for ; Mon, 25 Jul 2022 11:15:10 -0700 (PDT) Received: from stoup.. ([2602:ae:1549:801:30c1:2484:a853:233d]) by smtp.gmail.com with ESMTPSA id bg5-20020a1709028e8500b0016d8d277c02sm1125004plb.25.2022.07.25.11.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 11:15:08 -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=RMuYv4EVFHYkxhumjJ2SxEr+kwKlkg7raeV+cD/IvUA=; b=gdkKLSsn67CGhJcgVZK6E1oznK8FiA2GeWq8C5g/ShfoaiPh7tWV3dMdpTGb1uKEhM x7adCPIMCKbE5h1nf3LOQkd95D8YEruVYo76URWAmy/PN/RI0poGBdafZYcoUhvarlQX tYD8TMikMYuxhi2hNttDdklf909MIQcgxZepLxEn+pzn/+9SJV4c/IDYGaKqnVGg1Dk0 jVcbdRRf7hQbilgjF6YK8/M5SBTHlQavxHu5AMhCclx5MqzL0kGntA7w2KTvF+ijPpFN yEJ+OGdg7R1KfOpfOJ5+E1QFVkdluph/gvw4aNR80bzghkcqrd0LiBEyvF9EqtYCOFG2 7oVg== 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=RMuYv4EVFHYkxhumjJ2SxEr+kwKlkg7raeV+cD/IvUA=; b=YKbj3oJPfr9PxPIw2rKmkE6VSH7M/np7ey82IUin3dV0cFkgSIIxOqbGCfzDZOnEnb ZvEiE3Ca+L3F228x0arEC+29VXHlywvvuHQ1d6iPM/+h1wxOuwXULsBRWjmqVQJ0zJX8 zeYmCkh696+pwMvIQ68H7pTxBx8HgVDQXUpHLbDX+lo+YpAm8VQ+NokUEjHs1sYj5b1I t83GqOAl+X3dzpw8AV6ziNiy3IAGdzU/BfA8A42YtrKIL4rDYubVmHK2/yPLZd30gWtI n+Sd82wFPDSjam1j6gEtWfJRrt8AFC/I+v2a8iCYHqiagc2wT1FzIj1ykcrpHP9m6oDa yzgw== X-Gm-Message-State: AJIora8ZusuiZFuAmqvzY4R9m/IiuXXdUh0Y5kMeqeiPaUw8+pPnydsT 2CuX/EQlJx2XCcO1ZontbwBlXykUq7fEpw== X-Google-Smtp-Source: AGRyM1uV9VK9jpy6AJF2jPFpKKvHyzcfdAZx+xKOrsk9bVr6s/uggvaXdYXvr3lcxFhWvNBP2/wrUA== X-Received: by 2002:a17:902:8b88:b0:16d:2a70:26d9 with SMTP id ay8-20020a1709028b8800b0016d2a7026d9mr13502777plb.84.1658772909150; Mon, 25 Jul 2022 11:15:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: yuzenghui@huawei.com, qemu-arm@nongnu.org Subject: [PATCH 3/3] target/arm: Move sve probe inside kvm >= 4.15 branch Date: Mon, 25 Jul 2022 11:14:57 -0700 Message-Id: <20220725181457.41083-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220725181457.41083-1-richard.henderson@linaro.org> References: <20220725181457.41083-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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: 1658773330363100001 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 8b2ae9948a..bc3d7d9883 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -684,18 +684,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