Received: by 2002:a19:e212:0:0:0:0:0 with SMTP id z18csp620294lfg; Thu, 19 Aug 2021 12:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoheu9mRmWPX9SQhowtXu4MBWD0IZOSHTm3Cb4a/GXL+EWp7V9mP04JCCjg0x5jqVg/d5b X-Received: by 2002:a05:6830:1d69:: with SMTP id l9mr13351499oti.154.1629402053518; Thu, 19 Aug 2021 12:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629402053; cv=none; d=google.com; s=arc-20160816; b=BcBDK7btuIV/eOgnvFJuFiwryharm2DgT7YlMt/IpegjeXSqUwatWcMU9hB7msd3hr lFRsTkLjh4u4RJvIjiuiFoeb0p2I8Q2KlcCPoY2En9PwoAUXpVhVULv3CtJ+KcC6Lsob LPXuDnzQQe4SlZdPpYBqjAnFneGPltpuelzby8rHtYulR873EifilwG6FEtQEwQILfeq Qf6msH/KkiOufFe75g+h+nBTeUYpgvXUMJ5MQjvndBRmnNDDKHt5Zul3tz3knmKopSVe TH7XPSCBe0L7F/kWTbmK++QGb58bzcb6l+98qWGNMP4I+MToacw6BQ/YHf1I4F+Uxhum +9Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kMS3MmvHJATpnU9OCesaNF9ryXpBjG2wuo9K9+YbnyE=; b=S1ViHxXvNS4d2bLRTQPtaiUzKE4+svau8HtcV/R0A57R1XxxMYQPNgEDUGUuxC3jf+ T6ottU0C8rOp1CRRpDVDOTMC3wj/n7vfA2yVOF6flQRTVVtbfBYtQXQvdrSt1u/zqpN/ 5FoXiVui1gpfmrcLzfAP+4w7fnfVYMlrO3jiL0HRh/W2pHOm14sXV9m5z5kGAWoy8G31 +iI9zwTPm6NFp6YnjLiYWjEp3dMDb9JXdlHDDEXK7KppTyPG/B0LOCaiLEUH6FbHSn0b m7CfWRCXsMH+V8BwWSw1PHlbd6wCUajg5twXL4VgWfF3noMkJCjTm5SuBJ2mcTlXYQfv up+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hC8kPWC4; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r7si686218otq.182.2021.08.19.12.40.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Aug 2021 12:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hC8kPWC4; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:53730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGnuG-0006MJ-Kt for alex.bennee@linaro.org; Thu, 19 Aug 2021 15:40:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGnrj-0001AF-Nd for qemu-arm@nongnu.org; Thu, 19 Aug 2021 15:38:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGnrh-0000Aa-Um for qemu-arm@nongnu.org; Thu, 19 Aug 2021 15:38:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629401893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kMS3MmvHJATpnU9OCesaNF9ryXpBjG2wuo9K9+YbnyE=; b=hC8kPWC4KVxzmKsgSb5f8TeDQk2vbJxoHdUwGCCEe4yEXSvVXpm2yXNhy837LhiUJk7bfS /uCEuWDcv/p15VmzEoh0LfG5tm3VUNBGGmWTWS+3pmvUDGnN3v8oeflw3IuMxlkXvtQ1VS dcFrlLVeS7wuqzEUKska+Ir2vbGt5ZU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-FInNp3ebPl-UDK2v9nKI9g-1; Thu, 19 Aug 2021 15:38:08 -0400 X-MC-Unique: FInNp3ebPl-UDK2v9nKI9g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20F9F1015189; Thu, 19 Aug 2021 19:38:07 +0000 (UTC) Received: from gator.home (unknown [10.40.192.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B4F01970F; Thu, 19 Aug 2021 19:38:05 +0000 (UTC) From: Andrew Jones To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH 3/4] target/arm/cpu64: Replace kvm_supported with sve_vq_supported Date: Thu, 19 Aug 2021 21:37:57 +0200 Message-Id: <20210819193758.149660-4-drjones@redhat.com> In-Reply-To: <20210819193758.149660-1-drjones@redhat.com> References: <20210819193758.149660-1-drjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=drjones@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, richard.henderson@linaro.org, ishii.shuuichir@fujitsu.com Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: +vwf3p2+17/K Now that we have an ARMCPU member sve_vq_supported we no longer need the local kvm_supported bitmap for KVM's supported vector lengths. Signed-off-by: Andrew Jones --- target/arm/cpu64.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index eb9318c83b74..557fd4757740 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -265,14 +265,17 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) * any of the above. Finally, if SVE is not disabled, then at least one * vector length must be enabled. */ - DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ); DECLARE_BITMAP(tmp, ARM_MAX_VQ); uint32_t vq, max_vq = 0; - /* Collect the set of vector lengths supported by KVM. */ - bitmap_zero(kvm_supported, ARM_MAX_VQ); + /* + * CPU models specify a set of supported vector lengths which are + * enabled by default. Attempting to enable any vector length not set + * in the supported bitmap results in an error. When KVM is enabled we + * fetch the supported bitmap from the host. + */ if (kvm_enabled() && kvm_arm_sve_supported()) { - kvm_arm_sve_get_vls(CPU(cpu), kvm_supported); + kvm_arm_sve_get_vls(CPU(cpu), cpu->sve_vq_supported); } else if (kvm_enabled()) { assert(!cpu_isar_feature(aa64_sve, cpu)); } @@ -299,7 +302,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) * For KVM we have to automatically enable all supported unitialized * lengths, even when the smaller lengths are not all powers-of-two. */ - bitmap_andnot(tmp, kvm_supported, cpu->sve_vq_init, max_vq); + bitmap_andnot(tmp, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq); bitmap_or(cpu->sve_vq_map, cpu->sve_vq_map, tmp, max_vq); } else { /* Propagate enabled bits down through required powers-of-two. */ @@ -322,12 +325,12 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) /* Disabling a supported length disables all larger lengths. */ for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { if (test_bit(vq - 1, cpu->sve_vq_init) && - test_bit(vq - 1, kvm_supported)) { + test_bit(vq - 1, cpu->sve_vq_supported)) { break; } } max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; - bitmap_andnot(cpu->sve_vq_map, kvm_supported, + bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq); if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { error_setg(errp, "cannot disable sve%d", vq * 128); @@ -392,7 +395,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) if (kvm_enabled()) { /* Ensure the set of lengths matches what KVM supports. */ - bitmap_xor(tmp, cpu->sve_vq_map, kvm_supported, max_vq); + bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); if (!bitmap_empty(tmp, max_vq)) { vq = find_last_bit(tmp, max_vq) + 1; if (test_bit(vq - 1, cpu->sve_vq_map)) { -- 2.31.1