From patchwork Mon Jun 27 10:22:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585273 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2944297mab; Mon, 27 Jun 2022 03:24:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uNv3ir+xM5B2sZtQJ1TO5OWGksDkW06+dI/x7qj0doJ7Wq6T1aw/TrqfqnjqLQddty6B1S X-Received: by 2002:a05:6214:224d:b0:470:4057:e878 with SMTP id c13-20020a056214224d00b004704057e878mr7785069qvc.88.1656325453805; Mon, 27 Jun 2022 03:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325453; cv=none; d=google.com; s=arc-20160816; b=SOpm1zQNNO7vQHsuSOhMClSPFlIr3BjUmjWTWVdKNRD8HhlkhLb0mDkCcIWVVCtp+i +CPw8tvLcVhgXdEAbThvHrtAoyveuApoCoZ/OH4xXAQGdn9sc0auyhJwd04y/t6CNTPT QwO+1nijh7+RWNn5IH+tCjLsH5qiWPgG/qA8js9/fH3phu/DKAswZvO5KYRu+d0dwUtJ yc4gCYV9G6Yznk+djIYIjddIn9WSNx2SsmaBJjGm+Qk+ccZZczOHSUJ2IcR42s7OfCdk ri+ExH3tz0IlQFVIa/mx1h0EJ1ISLWd27WaW8JUwtFYSFg+Uhs7pw4VFxNJeqf4aHInd 5C4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=xGfYsNRh+T8DdsY8ZXI23Otvr3XKAab1Mft3LeNJ+zM=; b=DioFMoBAYOG5jFRRUEXPD61vwkQHz+R/iV7Gc8KyMTASGr4aUC+kShTvQqd5H77lVu 6XD5o6JW2gsisqrAse+eBvaQhmeOavGrb5Et3cJAov/rICKx/mxtNXb9lqKZ3qey6yQg VSwsjCelUzrkHUHhUqaJp/ouM9npT/uYxtyCekXXPIUzg29oogwthDRLIT0Tewczndfw nNUi8FQe0SS5/3AYANimpliyQK6UQrVPzDtyoaGWucOX3iX8j7JwY0l6kjcnU7dTECmd ufKYjSHd724RAPqLIvl4cvXNFjOiQDGARA6TFtvDEe5puwpemf1uidJ9b9JGCDqgzb8p OVag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHDieZJy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u20-20020a05622a14d400b002f94330d075si5126142qtx.39.2022.06.27.03.24.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:24:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHDieZJy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5luf-0003Jt-9J for patch@linaro.org; Mon, 27 Jun 2022 06:24:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltD-0002Fd-NV for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:45 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltA-0004rL-Mb for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:43 -0400 Received: by mail-wr1-x42b.google.com with SMTP id n1so12308150wrg.12 for ; Mon, 27 Jun 2022 03:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xGfYsNRh+T8DdsY8ZXI23Otvr3XKAab1Mft3LeNJ+zM=; b=MHDieZJyCCjnv3y/MNjWazejTogkxeHsHXpq5MvXsUuh68RI04lHIc1bp+CM4Ke8UR WPQeGjZnUJVf6oCCAHJZMaqYj54Ms3/ZdYRmS4o0034q94iufZX422KapnQoSmJrDAJq RzyMkn11dgm9mFgVjdPM8eMj9gDgFzXNeaoNG3QpqyDsuGCN24GiLqn+4kz126smhfW9 vg79/4CBBm4nDG+K6eB1GNlzDnb3tvoraDS8dkw+EJBQ2BsYanH7IMuJ13lF6LhFAcS7 cFbAaL22Uf2h4dTovUQfHbF4PwJOETAJSLpuH5xFm1EcqCh6/WMILLW39da9cv3kx9Fw BmVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xGfYsNRh+T8DdsY8ZXI23Otvr3XKAab1Mft3LeNJ+zM=; b=AMPD6ty3EPNmtflAwch62ODiA63Mux9RWpMJS8UTpige5wlgUVrIf4HW5n2nM6DX+S MpnVavFOh+SGUvlEO+qRI1TYZa69HQ965/kUZZOBH8I6DKNdmC5aq+fVDTGp1V9qcEjS XovnX3yPCKTsc3qbnrn7UP+pwUDL3oZB3ianf42LOuKtvWLM4MLdkdMbl9kFIxfh55Oy WKJYVXeWBsKmxG5+cttSmLAkTGN6wMzAwxpBqR+JU9pz+xP2GAjHqrmhcpLPMN8ii8eB TU3EsunLbYyvYwubilemut5jhCbOjJHHDhRYljpHL2ChanokOxVAvX2RNWrW/CkxisPD e9qQ== X-Gm-Message-State: AJIora/jL6Hempy4UguLnK8bTcQghbtt2yI65fjqiQsx296d4EiLBp31 7+CLLINDjhuGNpZNcXBceGbfVz9AHGMuhw== X-Received: by 2002:a5d:67c3:0:b0:21b:8cd4:ad60 with SMTP id n3-20020a5d67c3000000b0021b8cd4ad60mr12065544wrw.380.1656325359328; Mon, 27 Jun 2022 03:22:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/25] sphinx: change default language to 'en' Date: Mon, 27 Jun 2022 11:22:12 +0100 Message-Id: <20220627102236.3097629-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Martin Liška Fixes the following Sphinx warning (treated as error) starting with 5.0 release: Warning, treated as error: Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English). Signed-off-by: Martin Liska Message-id: e91e51ee-48ac-437e-6467-98b56ee40042@suse.cz Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 49dab44cca5..e33cf3d3812 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -126,7 +126,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From patchwork Mon Jun 27 10:22:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585272 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2944185mab; Mon, 27 Jun 2022 03:24:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sr1u0rRvYoCUguhpbioprLYIr/znhYCe60ItmC5n7Xv/3JT8BvLpseNVRydYxf4koh1cF/ X-Received: by 2002:ac8:5ac4:0:b0:305:87e:3636 with SMTP id d4-20020ac85ac4000000b00305087e3636mr8436225qtd.454.1656325442289; Mon, 27 Jun 2022 03:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325442; cv=none; d=google.com; s=arc-20160816; b=UUbYMGaXC3/FxjzgqtcxHHQkGv01edHcRPiO1M7Kby+vdO6jzap8kgWEmTeZprH7kG NQnScXFP7F4l/KWDXl7+UnIuVc+lSjBdVx1C4sFPdNRurzpFMD9vATUp2+eYPN0cl8fJ 4bHGECTkPhftFO4tNaChAQ5P66EaaArNIfk/okw+TUaiyTDDHNXUBplp+I1zLd3egQpR CJKqx114zt95GSx/6dep3NTBtZu+NpDmt7BCzVxvOB8uoBqNVog4WuIm47JxJ6dQIqNq gbsJ4CnnJXjoaBOskx8XVxQg0OjL82Sxla12EPXUTooBgaz6M1wqqmX5j3EfNrJjd2sr PsJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=0vkzoRelQddFfJLyYQesbsU+lGs7WRi3lXmpjPcYt/HCxGwRVc+k9netkLfWka8kP9 eNKLp8DenUkNmNRxbtAJJpjmW968lBnEZdLygJbzxMLS3fjS8p6OVhBydXQGCHoWebCo fJ7Tr7mLtttsQa18lYqVDmgpqamYo/ztz+EXyJMrVLAvxlCpq//wYZPz8Cq9v7upPm0v CR0qcSUw/HpDLoZ7wjlEtmJTWkyIl5HO4KqQD9F9OH2koHV9I3mpZZRsW/3DXkBmz/ev HAIhvgZtpdqDW2o5A+1V6UNXiButArRwJwIjIeR5F1pFCZx5t5VpYsuvPL0tQfFiKYu4 NezA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FwVFcRrX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t2-20020a05620a450200b006af245d98a9si1357146qkp.404.2022.06.27.03.24.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:24:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FwVFcRrX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5luT-0002XA-Ri for patch@linaro.org; Mon, 27 Jun 2022 06:24:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltF-0002Fo-Cp for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:45 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltB-0004rd-Qj for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:44 -0400 Received: by mail-wr1-x42c.google.com with SMTP id v14so12340152wra.5 for ; Mon, 27 Jun 2022 03:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=FwVFcRrXy3p4zKvB6Ev4hnglI3w6Ldi4RJaKtatZ83oXHyJakWfOaLu96jqIZc4LJH t+b8v+bhSuVtE61XWN3g1VCdXDCj+0/IpZKEE40/m/DKyTMFygJCRqtacbd1CZgCbE/2 8w6FWqoodA7m7cx3+a4jaXN7Tcefv2oxXm2BcA7+Dl33MELo8X1bSEu4FIYYZ3RFsr5V XbD2HyQ4wK72cLHh14WykL0sM2lxeYLW9NLsDDOC+E0XZa/4qK9NR3362hpSH3XORKIj usaxkfJGrz5vMyqmUbEcGfYstYNbFSf8UDRB2i9K1liRQ46Kk0iCWmyZV0QCYEb7OcTZ GNCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=jPrqmxpKC8J8WwtxfNMel/LDiN5zLTgxxMP/1XZtr+21UkahfuleBrYogpQp5g2NPS 1jNRugGxYTL3v7BrxX2uXnMtsOvZ1yZCjqTPaPvrV5GPfNujqX455X0mzQTU4lp4oLaO Zitdu6G/BQa60uyi+/1OEnmXlxmtdR46q7yamUt+sRbNMau08T4LTfubLBPf0OToOeAI XxckWkRlR2Q+N7V0JRLSVMynB3njxqPJ4LrC+Npu/Z/DT7n8CfzkGnsWUcvPdzsVhtrZ pzXq84cr4fqAnfU9cXjWcNn4kpEM+teaSq5KVIW+HGt+PepwD4itq9KdocTIKFvgkM2J CvHg== X-Gm-Message-State: AJIora9XhNVQB+tc/jtUretd8NQhc0h/8FHU5T/agvsdUmPXB6/evkX4 7gDSV1i/pT1iNKBnRIMNUp+y3X2PnahvNQ== X-Received: by 2002:a5d:584d:0:b0:21b:a3a2:d67c with SMTP id i13-20020a5d584d000000b0021ba3a2d67cmr10861641wrf.149.1656325360030; Mon, 27 Jun 2022 03:22:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/25] accel: Introduce current_accel_name() Date: Mon, 27 Jun 2022 11:22:13 +0100 Message-Id: <20220627102236.3097629-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alexander Graf We need to fetch the name of the current accelerator in flexible error messages more going forward. Let's create a helper that gives it to us without casting in the target code. Signed-off-by: Alexander Graf Reviewed-by: Richard Henderson Message-id: 20220620192242.70573-1-agraf@csgraf.de Signed-off-by: Peter Maydell --- include/qemu/accel.h | 1 + accel/accel-common.c | 8 ++++++++ softmmu/vl.c | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 4f4c283f6fc..be56da1b999 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -68,6 +68,7 @@ typedef struct AccelClass { AccelClass *accel_find(const char *opt_name); AccelState *current_accel(void); +const char *current_accel_name(void); void accel_init_interfaces(AccelClass *ac); diff --git a/accel/accel-common.c b/accel/accel-common.c index 7b8ec7e0f72..50035bda55d 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -49,6 +49,14 @@ AccelClass *accel_find(const char *opt_name) return ac; } +/* Return the name of the current accelerator */ +const char *current_accel_name(void) +{ + AccelClass *ac = ACCEL_GET_CLASS(current_accel()); + + return ac->name; +} + static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque) { CPUClass *cc = CPU_CLASS(klass); diff --git a/softmmu/vl.c b/softmmu/vl.c index 54e920ada1a..3dca5936c76 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2271,8 +2271,7 @@ static void configure_accelerators(const char *progname) } if (init_failed && !qtest_chrdev) { - AccelClass *ac = ACCEL_GET_CLASS(current_accel()); - error_report("falling back to %s", ac->name); + error_report("falling back to %s", current_accel_name()); } if (icount_enabled() && !tcg_enabled()) { From patchwork Mon Jun 27 10:22:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585278 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2952532mab; Mon, 27 Jun 2022 03:34:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sfv8nsbHZEHwI5Gb11u0NtLrOvcpjjuAW/Mb7b/dEl05G49QSDpEK5ppcA+OMkAlUp5yOQ X-Received: by 2002:a05:6214:5006:b0:46e:4e1f:ea35 with SMTP id jo6-20020a056214500600b0046e4e1fea35mr8263646qvb.68.1656326093684; Mon, 27 Jun 2022 03:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326093; cv=none; d=google.com; s=arc-20160816; b=sBGx/lHyG4B8CPpOETnaLiguOZ+GneHZKsiOnpeHynLMVQhAKmYNQXo0IalEz119Lg ApyVSQB0bCyFMw5NVgx3j+xgDYt/YY/rUoD4V0BA1pskH3hqtWO8h5VJ0YBMi8S1ZbPl QS3ppiWWFpjgoWiB6eOJibhmZOui7yj2frmosuqBYgYkJfKPT1GuO/RH4zxVMdJtCPNP 7OJyGo6qvtk/j2H9Pkikg8F0KeU9jgLMVlV3WUmN4ypnMnIifAyeTpLbvaZKMbKlg4ZK C0uj4CPZK+3V7xlFDvlfbU8ZcV542dQTbk+DS2fkOyVU7Gc1gs0TCxEm0AUXvrqMmKIO DLxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=Exdw1jWh9d45wApshJRlkzNaiGP955/A0t+N8/5I8ww=; b=nDPauAbxfaFTsU4qiWPSngLB7vxnlzsUOdJX5rGIU5QU7+BWgxH9kbYnXWBYT2rSB6 lEATGSKkm/GZdMwZeYsYaBpg00AXjtwf+Ntzi3iRDPJdS5f8XHmSUti7vZHMdWw1yfqc j73KFwdRJkex4nUezk5P2QnjPbbMFAh66CqfnavedMsutWrtsOJHnQ/pDrRLmJzvWjf8 4lPvQAdaPBcRJzaiXDa2Y9sn9fuWjDCETxARtefBwpCF4Yd9mSPGIGGjtobdC0drtv85 fmek8RuMQV7xUqps8n4UxWXTudN0lukrjM8KtxHDYHE4wcB+sqeyUn0rn0GuKpkkG5nG Bfxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VGEaueDj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r4-20020ad45764000000b00469ad00d6e8si5576916qvx.317.2022.06.27.03.34.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:34:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VGEaueDj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m4z-0006bn-8Q for patch@linaro.org; Mon, 27 Jun 2022 06:34:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltF-0002Fp-D0 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:45 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:36625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltD-0004ri-5W for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:44 -0400 Received: by mail-wr1-x434.google.com with SMTP id o4so8387287wrh.3 for ; Mon, 27 Jun 2022 03:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Exdw1jWh9d45wApshJRlkzNaiGP955/A0t+N8/5I8ww=; b=VGEaueDjpQqajNT7NmPZfYOb14uNL6cD5u2rnzxPiHj09CbYGhDd3k3vp+G5DORQ/Q iISdou4i4WXsopmL0l9DSOox0Dky+dkTnFR1Xg0YxJUHmg47EXHOvyxQvMK2c8CMG+ZX l6TGokpHFjkBlHo75axcTh1n2yagyVTs8oN/ea6UgkbJtLuW9hHip4QvW0J6rxnuJZzQ CW2+1SV5oaI5kSe8C118yiOld5LN3eBxp2ciA6RDt8GwoFGoij0XbIScJkVrQ/2+2UVi JonEKyVPCEdaiYp4I5yMGxrbyGjWOnfUO/V9RaZ0Ch262cac+HcGq8JdcExLsdw0LCco AHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Exdw1jWh9d45wApshJRlkzNaiGP955/A0t+N8/5I8ww=; b=lzX4GCBGC1qk/LkQgRsdIAomuCN9QnVdVJfDPWHu5sOqY+jO6QyUbQM1RGc8JBA3Jg rFSbP6yFCpCNKfNjEemJqqu5ty38yqCp0ypke5FwEawvDLq87bfSnIFPqghCuZplnpWA 9br3CUVG233+bJSODQumD82P+EFqReDFAJRkMOzP8iZJd+XdtUMu281bZ9keSqC1KCyh wyKlGuqBBsJae/Q5aaYAIPjTTo16C0F4atezgpK9bX0qHhXcP8/MUGmY4tA+8cMcpRVm IaF4JDoANbzOh7FFEopC7tSa7d92S6rmdCnceg7qgT6onWokBqQswvX5JvKCkJD6kC8t KiyA== X-Gm-Message-State: AJIora+kHwx1l6OnmLh6RaaaUKXHy9vunp3hC3R2F/+nj+aJ9wSXIWhH BAO44p8vKRZC4lmERnbct7wJXckMGAxX3w== X-Received: by 2002:a05:6000:1689:b0:218:3fb1:fd30 with SMTP id y9-20020a056000168900b002183fb1fd30mr11430304wrd.302.1656325360761; Mon, 27 Jun 2022 03:22:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/25] target/arm: Catch invalid kvm state also for hvf Date: Mon, 27 Jun 2022 11:22:14 +0100 Message-Id: <20220627102236.3097629-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alexander Graf Some features such as running in EL3 or running M profile code are incompatible with virtualization as QEMU implements it today. To prevent users from picking invalid configurations on other virt solutions like Hvf, let's run the same checks there too. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1073 Signed-off-by: Alexander Graf Reviewed-by: Richard Henderson Message-id: 20220620192242.70573-2-agraf@csgraf.de [PMM: Allow qtest accelerator too; tweak comment] Signed-off-by: Peter Maydell --- target/arm/cpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 1b5d5357880..d9c4a9f56d2 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -39,6 +39,7 @@ #include "hw/boards.h" #endif #include "sysemu/tcg.h" +#include "sysemu/qtest.h" #include "sysemu/hw_accel.h" #include "kvm_arm.h" #include "disas/capstone.h" @@ -1490,25 +1491,32 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) } } - if (kvm_enabled()) { + if (!tcg_enabled() && !qtest_enabled()) { /* + * We assume that no accelerator except TCG (and the "not really an + * accelerator" qtest) can handle these features, because Arm hardware + * virtualization can't virtualize them. + * * Catch all the cases which might cause us to create more than one * address space for the CPU (otherwise we will assert() later in * cpu_address_space_init()). */ if (arm_feature(env, ARM_FEATURE_M)) { error_setg(errp, - "Cannot enable KVM when using an M-profile guest CPU"); + "Cannot enable %s when using an M-profile guest CPU", + current_accel_name()); return; } if (cpu->has_el3) { error_setg(errp, - "Cannot enable KVM when guest CPU has EL3 enabled"); + "Cannot enable %s when guest CPU has EL3 enabled", + current_accel_name()); return; } if (cpu->tag_memory) { error_setg(errp, - "Cannot enable KVM when guest CPUs has MTE enabled"); + "Cannot enable %s when guest CPUs has MTE enabled", + current_accel_name()); return; } } From patchwork Mon Jun 27 10:22:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585271 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2944168mab; Mon, 27 Jun 2022 03:24:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUGKAqViUIy6rFLiMDu2h1/zmVuF/yGe0EkRUsTcPaTB2lZn5zqUgpYoVNZhEm3pmN5zl5 X-Received: by 2002:ac8:7d0c:0:b0:319:3485:41b9 with SMTP id g12-20020ac87d0c000000b00319348541b9mr5543248qtb.689.1656325440720; Mon, 27 Jun 2022 03:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325440; cv=none; d=google.com; s=arc-20160816; b=Jc9S2/pjgKqIUu7kg3Ui70OTRqKsmUx+3utNI1haEgKtMkrrGQMFeUXjPwGMQ+blo+ dRD6fJORzjmx52Vl5rM4qtA/nSNCr4AUMyQufAdxv522jJ7kiEby+rV9L7lNXBaDplIJ zUyee5isbYx7OQiN6ND85uyc9UPKy9fknd31Gg3Fyyd6QLGXUd3oxhwJYoLcvU5C0PrV 1+vgxc6o2Xa7/I7bltr+gEIVY7VFEv0/6qPKknhFPEyQ/+k1EsXQbpcFhaPqDkujWDsN soQgD7dfsjw0eji1qCPZXk6j161UYsj3UwG2LSIhpAC+7ANKYv07h4DWdpESXSxleK4n WAIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=Ka8T6WbFRnliAmr+bft7mWOY5gWROhUwaTzzbJ3vo7o=; b=DpV43WRLm3pn5dyatlOB5vmJrYJzun/tw2RekP9PE6Lzmpv9TJ2s2Pwu7ENQ0g86DX ndWKoHIqnma+fz4+9rqXAJJWcNl3LpcUkwriDbLH4I/mG2Eo1AQYGe+QnEvHBMB1zSmv VRNqO7AbsY3yOSSvkAy8sTY/IlU6fY4pq1iPCJQXbJWQ/mlK2Oqxb/rjFdnz6JSImbNN 6HAs/zOs1+VG88Dstl2BkKWmrSaRUtyUF52+bxBktn30ea90e6KI4CwVSU3PgZbMZXJw aYAAB1Qe+kZqA6j5+COxvGb10SvYAItSWN7yXVQtDZSkHIfr1+jq4aZwWYa1WMfv4ICT SmaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zaGklMlw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jl12-20020ad45e8c000000b00470aaf52e01si2717238qvb.113.2022.06.27.03.24.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zaGklMlw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5luS-0002QE-9j for patch@linaro.org; Mon, 27 Jun 2022 06:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltI-0002Ic-0o for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltD-0004rq-5v for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:47 -0400 Received: by mail-wr1-x436.google.com with SMTP id e28so7168599wra.0 for ; Mon, 27 Jun 2022 03:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Ka8T6WbFRnliAmr+bft7mWOY5gWROhUwaTzzbJ3vo7o=; b=zaGklMlwCc7G726S4DHHILYmG8H9cY8UWqO+muTPPGQzrbCdwafx2G/ur6M4yPdyFA BAVA+i7yQZdul/EXZycBWYLMnxKaGMSlthdvpsY44HCQO8LW1HXdmh8m+o+JjuZKcMb4 WQW3uDm+ucxfn9wfblfDded3oVw+0U3g3gFP0iReYLX6pzuC85T4m52zKWPb9VSPoJgQ QfJ6YoMNokfxSpTNq+ouYzC/jHS7jTYAkIkZVIJJgd1L/b0vzjTvIaWpL3TpWQZ9rlt5 tpwBMuSj37XohkO+fuFDc6kYknwhJiZ10FoLP6MBTnUyEcKqWeT3cRHGFmis3TWD/j5L VOIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ka8T6WbFRnliAmr+bft7mWOY5gWROhUwaTzzbJ3vo7o=; b=h8to+n9gOHo+BjFcGCIHQUtzJbgp0tcxDL9yy0uMUdVVQy7rm/JLobcdtool1K6RFt KsPE7j/Qw+jlYMsfUUFQ/IIifpPtV0+mb4CmGSC6rDlrFLn1PpHScHlxS7RmFjQ6r3SR FyzFoyYd4ScKh552E35+waPDPSbasWkLdOb7ND6duqjwEOLQ2Q+B729D3ySXehjJ1uiz XGoOCEhzeuXBACZP8PTw0DJLhQpERkMLOH+Kv0FXgWcMAyZ7WTN78Q2iulwMZKtGVXjz KLFvHqdAbg/pJ6roOb0oiLWEScTYBmHnIL4zWIgsjBs3hKHisl79wZep1MtFsBMAcHLA yISQ== X-Gm-Message-State: AJIora89/Ph/JdZA265dg2EKYb6/9NTgn8iGVHYbdjLKgBvdN401VPPK y9n9915aVz2uiIs6wEk+vzibfXwbEyQS1Q== X-Received: by 2002:adf:e350:0:b0:21a:3bc:7d85 with SMTP id n16-20020adfe350000000b0021a03bc7d85mr11453354wrj.400.1656325361571; Mon, 27 Jun 2022 03:22:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/25] target/arm: Implement TPIDR2_EL0 Date: Mon, 27 Jun 2022 11:22:15 +0100 Message-Id: <20220627102236.3097629-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This register is part of SME, but isn't closely related to the rest of the extension. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/helper.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index df677b2d5d2..05d1e2e8dd1 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -474,6 +474,7 @@ typedef struct CPUArchState { }; uint64_t tpidr_el[4]; }; + uint64_t tpidr2_el0; /* The secure banks of these registers don't map anywhere */ uint64_t tpidrurw_s; uint64_t tpidrprw_s; diff --git a/target/arm/helper.c b/target/arm/helper.c index 6457e6301cd..d21ba7ab836 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6279,6 +6279,35 @@ static const ARMCPRegInfo zcr_reginfo[] = { .writefn = zcr_write, .raw_writefn = raw_write }, }; +#ifdef TARGET_AARCH64 +static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + int el = arm_current_el(env); + + if (el == 0) { + uint64_t sctlr = arm_sctlr(env, el); + if (!(sctlr & SCTLR_EnTP2)) { + return CP_ACCESS_TRAP; + } + } + /* TODO: FEAT_FGT */ + if (el < 3 + && arm_feature(env, ARM_FEATURE_EL3) + && !(env->cp15.scr_el3 & SCR_ENTP2)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + +static const ARMCPRegInfo sme_reginfo[] = { + { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, + .access = PL0_RW, .accessfn = access_tpidr2, + .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, +}; +#endif /* TARGET_AARCH64 */ + void hw_watchpoint_update(ARMCPU *cpu, int n) { CPUARMState *env = &cpu->env; @@ -8440,6 +8469,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) } #ifdef TARGET_AARCH64 + if (cpu_isar_feature(aa64_sme, cpu)) { + define_arm_cp_regs(cpu, sme_reginfo); + } if (cpu_isar_feature(aa64_pauth, cpu)) { define_arm_cp_regs(cpu, pauth_reginfo); } From patchwork Mon Jun 27 10:22:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585275 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2948347mab; Mon, 27 Jun 2022 03:29:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s/cX4/HirWPut9lpXKClaV+0xNgD4aoJo/jCSZQ9noSytK4Qxb8O4lenuBobsUhiL3Jx2c X-Received: by 2002:a37:6656:0:b0:6af:1d6:9aea with SMTP id a83-20020a376656000000b006af01d69aeamr7190067qkc.242.1656325764782; Mon, 27 Jun 2022 03:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325764; cv=none; d=google.com; s=arc-20160816; b=KeY3ywIt8dXXBFD80Dat/YmvTGLqsNH4EWE+hOGlKkuCroe0E+QX87j5zikwBpy1FH lb78R/FZ84kQnqB/5WuVZum0kwyE4ULg4/KK8GrTs39K+r1lUBdUtBgarFKNsvZhLU7j 3ChANz9aV9HAliEXxaUs6m57S/QEndrDX0R0M1D5MLkUTe0e8B+uGMD0MQUbMV0GJTp2 R0C8cVdQH+GTkQ47GHaDwuPQPrMyczdTDvX+sT/VE5EpJm/UI1PIqndDzv90rfI6EobI Wyu+wE5kzTJseiW28xLM7pyzGSIzw8X+6W62sZDCtsCAATWsjG99wcBL0DoWz37Lh0Hy XACg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=n62ubY7+iB/7rTCXmZ/zUPH5zT2IZxj1SHTY5yvBRm8=; b=Ak6bLlPph2086JTgGqeXPZd8bFPoDbK2qwxaXD6e+3PISN9sCCnr+NKmg8Kp8pq1eV D8qLs7mfVdoM0eGpW9OoPEyaKgBlSGvzw3tHcZLMOeegsFVNoMRAZ5aZLKpf0mlkxfb2 4wRhQq6oexshxzQ1oAGdWoMxoANtbHMPuLQSEB0Kzrld25cJpwHR8BJQcGNAjbihSDwz uGL1bA0n6lmBVtaDl5dlVumC+Zz4anX5EUGTpfPKDwfJ8cdOBZY7yo+rOGFnhf6lP3lu KXShq35OG78CQfEetJXjt7VpkdYT4FcZMvlujvNxUZ071ooG0gH3CtegyfRQRbGpVnlF C4uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QxR2jP0R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u11-20020ad45aab000000b004705f52a106si5234240qvg.420.2022.06.27.03.29.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:29:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QxR2jP0R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5lzg-0008WT-BE for patch@linaro.org; Mon, 27 Jun 2022 06:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0002JR-3h for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:49 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltD-0004rv-K1 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: by mail-wr1-x42e.google.com with SMTP id k22so12340593wrd.6 for ; Mon, 27 Jun 2022 03:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=n62ubY7+iB/7rTCXmZ/zUPH5zT2IZxj1SHTY5yvBRm8=; b=QxR2jP0RbnY9kNPOLur59/p6YtdZX6h5GZmjUVDzr9DCAPmrUDMNCK3LeAFTf3lWOq Z/oPFdQyNPtHRznDVLVL/YJItlrIBbMDxSpyG7h6n5idQMLqysPugHeSpazMlwtM4f40 CJKjNkF8WJbipUf9X0yMljZZ+Pvlm6FBqQ59vaPLrOIhj+0pXhpi9Q4xrvdk7Obf0hb6 zhKdI40oqgUnL4raENszGAXUdoKFtbIf25Shcpn52MmILoDW3MMqYdc5DU0xxGNKqm3C /Yj+bO1XLLRasaQpv2p57X65iPMedsh09P7tIIxrPx8Nv4cRMqeaA5V14FWZRVzfCRkC CrFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n62ubY7+iB/7rTCXmZ/zUPH5zT2IZxj1SHTY5yvBRm8=; b=3FfzDqxL4JJNNIaxn8GaN0Ws6VFe4mM3sq/N2ai24vUMruNvmkz2T+w4xE0sl49Tip X4NVoxc4wVuOddCjCN8IVae7LQnBZ0JO7gimnot1WbDDCyRW775zafQd/WE9Oko/tddl BD3rVDaxTszoFshDr83ikhOIcVkR3teHOlzdJWeqc55p9BTGkxEtjxPHix2Ty4N27N3i vQDOC6kzkjGxP70K+TY+8Dr+daU50yGo8+pOW6ehw3fQxJp/T4PD1wNFUlvNT7zaCNbo qY/lubljqZxyzMRloJi939AzAtHY/6sON2yl3hbssfIagFBiv1nqlSuBhCrcm7UnfZPJ JiTQ== X-Gm-Message-State: AJIora+1eMkofXyOzLyBZeB+0VQ+IPd72WpCH2hqzsTmfQpqpHr/FVCe xXCJPwxaOL0jGWNLUSEUIxAQu0SPLy2vCQ== X-Received: by 2002:adf:db50:0:b0:21b:8a4c:594b with SMTP id f16-20020adfdb50000000b0021b8a4c594bmr11420005wrj.564.1656325362299; Mon, 27 Jun 2022 03:22:42 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:42 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/25] target/arm: Add SMEEXC_EL to TB flags Date: Mon, 27 Jun 2022 11:22:16 +0100 Message-Id: <20220627102236.3097629-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is CheckSMEAccess, which is the basis for a set of related tests for various SME cpregs and instructions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 ++ target/arm/translate.h | 1 + target/arm/helper.c | 52 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 1 + 4 files changed, 56 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 05d1e2e8dd1..e99de180978 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1134,6 +1134,7 @@ void aarch64_sync_64_to_32(CPUARMState *env); int fp_exception_el(CPUARMState *env, int cur_el); int sve_exception_el(CPUARMState *env, int cur_el); +int sme_exception_el(CPUARMState *env, int cur_el); /** * sve_vqm1_for_el: @@ -3148,6 +3149,7 @@ FIELD(TBFLAG_A64, ATA, 15, 1) FIELD(TBFLAG_A64, TCMA, 16, 2) FIELD(TBFLAG_A64, MTE_ACTIVE, 18, 1) FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) +FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2) /* * Helpers for using the above. diff --git a/target/arm/translate.h b/target/arm/translate.h index 88dc18a034b..c88c9533253 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -42,6 +42,7 @@ typedef struct DisasContext { bool ns; /* Use non-secure CPREG bank on access */ int fp_excp_el; /* FP exception EL or 0 if enabled */ int sve_excp_el; /* SVE exception EL or 0 if enabled */ + int sme_excp_el; /* SME exception EL or 0 if enabled */ int vl; /* current vector length in bytes */ bool vfp_enabled; /* FP enabled via FPSCR.EN */ int vec_len; diff --git a/target/arm/helper.c b/target/arm/helper.c index d21ba7ab836..2c080c6cac0 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6218,6 +6218,55 @@ int sve_exception_el(CPUARMState *env, int el) return 0; } +/* + * Return the exception level to which exceptions should be taken for SME. + * C.f. the ARM pseudocode function CheckSMEAccess. + */ +int sme_exception_el(CPUARMState *env, int el) +{ +#ifndef CONFIG_USER_ONLY + if (el <= 1 && !el_is_in_host(env, el)) { + switch (FIELD_EX64(env->cp15.cpacr_el1, CPACR_EL1, SMEN)) { + case 1: + if (el != 0) { + break; + } + /* fall through */ + case 0: + case 2: + return 1; + } + } + + if (el <= 2 && arm_is_el2_enabled(env)) { + /* CPTR_EL2 changes format with HCR_EL2.E2H (regardless of TGE). */ + if (env->cp15.hcr_el2 & HCR_E2H) { + switch (FIELD_EX64(env->cp15.cptr_el[2], CPTR_EL2, SMEN)) { + case 1: + if (el != 0 || !(env->cp15.hcr_el2 & HCR_TGE)) { + break; + } + /* fall through */ + case 0: + case 2: + return 2; + } + } else { + if (FIELD_EX64(env->cp15.cptr_el[2], CPTR_EL2, TSM)) { + return 2; + } + } + } + + /* CPTR_EL3. Since ESM is negative we must check for EL3. */ + if (arm_feature(env, ARM_FEATURE_EL3) + && !FIELD_EX64(env->cp15.cptr_el[3], CPTR_EL3, ESM)) { + return 3; + } +#endif + return 0; +} + /* * Given that SVE is enabled, return the vector length for EL. */ @@ -11197,6 +11246,9 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el); } + if (cpu_isar_feature(aa64_sme, env_archcpu(env))) { + DP_TBFLAG_A64(flags, SMEEXC_EL, sme_exception_el(env, el)); + } sctlr = regime_sctlr(env, stage1); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4c64546090c..9a285dd1774 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14603,6 +14603,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); + dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; dc->pauth_active = EX_TBFLAG_A64(tb_flags, PAUTH_ACTIVE); dc->bt = EX_TBFLAG_A64(tb_flags, BT); From patchwork Mon Jun 27 10:22:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585280 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2954983mab; Mon, 27 Jun 2022 03:38:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sRLWhyxIm5FnuOOQSn3eqMQD2jz2ri7oVPS6TyDtcsCm7LqAqUU07A2c0llfUNiG3dZFAw X-Received: by 2002:ae9:ec19:0:b0:6ae:e43b:80ff with SMTP id h25-20020ae9ec19000000b006aee43b80ffmr7425187qkg.324.1656326299386; Mon, 27 Jun 2022 03:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326299; cv=none; d=google.com; s=arc-20160816; b=p9R9Gs2LersVFrodXAkMPUtRMDwS05pPC6kQ3gUOmX+do9PoA44tKxzIJAE0N4GpIr 2rpLVRC8YVqXzxppATxc/QxiY7KFNteJYwlZYnfFS+FaASA63+EvGBoicH5jAupFR+ti 97Mb9BbO9CwvqGj3e18cNL0TAfsS1xNhutM5K0yaU6g4yodZAMcCYtwWDoIeu6/bjaoZ CvU9Y8ZwfH2GeQT+SfkhcMwMfXcIDeWxNYLgBwXRlFo+NRqa3tcRrB9cSw3IQn8x2q16 sI+75riHJZbY3R9zRhS8LBr8NgnxrHEClkoTzWT3h3PdXdE7u+z/r69bkF/47Dqlps3Q n1PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=mo4a3ghMukRKZTagsQFpVCwO5R9nPbKULZ+sDL0pomM=; b=ODwaPrwe1H+rnVeNe+A8zSxbdeLtS+9p0+zKnzAllrVe0NxDnzA0ywXkRcG8eJqKM8 4+LADZWbjVjZnxlL4KiEVgRZxnudg9wPJ/OSvovA4jFMhy3xRzrh+3WcSoANDT+ltFRP ynWYiKuijEYO2dAmpcvgskV4qZDT9dbkGFrhXhEQzKuUhmEopGv6824fm4oQPYslVA2q HgO+RNghXJN7OWAdNnTwllcQHbKb00mmAKWBDtTJKSjMmaBYm/IbLxGCbAGzOoTpWyEw E3jHmSq8s0Y6RFxBewtWbTbY4FbxMU6Rn+qjiBs9nMKL+L0tR6/j0fTgfhfaGemCuC5v VS5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1pKZ2BR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id im5-20020a056214246500b004727d025d2esi77651qvb.229.2022.06.27.03.38.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:38:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1pKZ2BR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m8I-00034p-VA for patch@linaro.org; Mon, 27 Jun 2022 06:38:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0002JL-2w for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:49 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:33876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltG-0004s9-5R for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: by mail-wm1-x332.google.com with SMTP id m6-20020a05600c3b0600b003a0489f412cso1151850wms.1 for ; Mon, 27 Jun 2022 03:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mo4a3ghMukRKZTagsQFpVCwO5R9nPbKULZ+sDL0pomM=; b=n1pKZ2BRXC70h1ue4c1A4udzo/6vOUGBuUbZlJy9jqsOCXENpsEwwdj1MYcY99R7yN TOkngBdjKX9VbSbXvMFmCwsuDK1hMpHMXJkEWnoNHmXTmMvn20OjqCHXWCwiUnno5X6f EF/3F1/hGWnGefGB3S/mwGIHgIBH5ZWhfhdCbbZ02PUKUspHVNgsAZF4A0rgsfgJcjEw peD7Ya6gHRc2gA3Z8W+YYxHflWrwY/DDo0vmXXxaVjESgkCj9qHpEIkGhe5yfi+KyoOA 3AE1yNZj6p+fLV5eHBWPFI927vJ0wpgKqw+o0EtkqDriec9+CMQXMbvO8zcEKzClvwsx WVkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mo4a3ghMukRKZTagsQFpVCwO5R9nPbKULZ+sDL0pomM=; b=I5xv6hpNN8Z3MneDRq+0Sl1cu7q/TGREEppE4uL2d+cRESICgSXS8HdRuz9wEmgHyz OdiwtB4Dd6Dt00chqZayoLxgJ1dZ+aEwe4zxUU+ct8sTaP9zPlTTA0jQJtSJuRorStHU gP9C8GrJYruUnaejzJT7AKQ0JKo1yK6EBGD+LxJrJ9b6GqFzmT8duVW2BfZCE+3Sdu2P p5/TiIeUt3IDVbgZjJdx9Q3JbA4Epnpwh0qV4uTGBo0QHFBt8kj+Je3WvbAqzbQzDq62 KvN8VejR+06CF3nyEENZ47wy7bDN6QsraOWbG98SIMx3/pkDNfDgyDRLa33Hi2WzvCWa 4gxw== X-Gm-Message-State: AJIora/ETXjecUaIk3LfOEqtsJ4MOK8Z+neV0gqwNP7D7Mjr2jdoA7HK 9I5E8+tNb620MntuO27cr3Ugg1Dnd0giVg== X-Received: by 2002:a05:600c:a47:b0:39e:f953:84e2 with SMTP id c7-20020a05600c0a4700b0039ef95384e2mr19168615wmq.202.1656325362997; Mon, 27 Jun 2022 03:22:42 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:42 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/25] target/arm: Add syn_smetrap Date: Mon, 27 Jun 2022 11:22:17 +0100 Message-Id: <20220627102236.3097629-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This will be used for raising various traps for SME. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/syndrome.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index c105f9e6ba5..73df5e37938 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -48,6 +48,7 @@ enum arm_exception_class { EC_AA64_SMC = 0x17, EC_SYSTEMREGISTERTRAP = 0x18, EC_SVEACCESSTRAP = 0x19, + EC_SMETRAP = 0x1d, EC_INSNABORT = 0x20, EC_INSNABORT_SAME_EL = 0x21, EC_PCALIGNMENT = 0x22, @@ -68,6 +69,13 @@ enum arm_exception_class { EC_AA64_BKPT = 0x3c, }; +typedef enum { + SME_ET_AccessTrap, + SME_ET_Streaming, + SME_ET_NotStreaming, + SME_ET_InactiveZA, +} SMEExceptionType; + #define ARM_EL_EC_SHIFT 26 #define ARM_EL_IL_SHIFT 25 #define ARM_EL_ISV_SHIFT 24 @@ -207,6 +215,12 @@ static inline uint32_t syn_sve_access_trap(void) return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT; } +static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) +{ + return (EC_SMETRAP << ARM_EL_EC_SHIFT) + | (is_16bit ? 0 : ARM_EL_IL) | etype; +} + static inline uint32_t syn_pactrap(void) { return EC_PACTRAP << ARM_EL_EC_SHIFT; From patchwork Mon Jun 27 10:22:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585274 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2948326mab; Mon, 27 Jun 2022 03:29:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBcntXAWzELtwBBugdkum0bIr3X2zncMuF/4rbM4tofr9zOhTnl9+rPEt4+YKIPihQvwnj X-Received: by 2002:a37:e307:0:b0:6af:3370:81f0 with SMTP id y7-20020a37e307000000b006af337081f0mr1339095qki.332.1656325763846; Mon, 27 Jun 2022 03:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325763; cv=none; d=google.com; s=arc-20160816; b=QH1+WyZyx6CZl3TfIB0hGPbot6Gb8hb7kBU0Jd2/BrvakbbPeyNcSbvFyW2jwResJy YHMIG4QEdJzfo2dBKv0E8h3uca/+R3slxhw11pJZYXqrb/BhBph8CpRiFt7LXv7PuuS9 SmWw1rPv/yUfM2dZOhFK62NA4u+ii8RoVzyz2xSccVUplu3H2ttZWZ0tmJi9V3Ow1h6h 81PSX81wdwmpwxgG4FviO0hUzg8tvCVbphcZpPm4Xcmfm16iUr2sJVSRCDagGdJ1l+Z6 FLWgOjrNl+iGpxTT/lUN220Lq5i5RvvWZI6qlTkjdrsga1qZkYoDyClkaHiy5jMJNMqw w+2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=kS8fRWuNDkuiztpWqjEa2CzwXqjYXf6gCvCK68jBTPg=; b=QR+r9aLYHrgVHUXxzBNIpv6W414vHWqDCbgBOm52wl3y9rXfRTGx7LSA7p6OJCbfzj feFnvTsCc4l2IH9V1mx2AcpLUzibtnFw/1haHzCmL8fU4+CyhVaOIuj/gD0u+Lviqekr xAqQxOYDswtVJ1TLXo4ELh8/7dRSAq0ri+RcVi3jYAsZ9RDkbTTo1D5xcvo2FGy6ClDn KGFmv6rSycKEuZgEuTKSXUx6LA4YAlrPqAz2KqAgJ7qcocH69yrD8Whp8liN8R+COIbF VK8AJ8xrDIhgUzcEJTndgShT4DivozMjepi0C1Zs8KXzfEpiZnbByFwuQljnaFGBYys0 hwjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BzMjXpTn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w18-20020a05620a445200b006af1bb9fbccsi2490301qkp.423.2022.06.27.03.29.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BzMjXpTn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5lzf-0008QR-EB for patch@linaro.org; Mon, 27 Jun 2022 06:29:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltH-0002Ib-L9 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:46849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltG-0004sC-4R for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:47 -0400 Received: by mail-wr1-x429.google.com with SMTP id i25so6823011wrc.13 for ; Mon, 27 Jun 2022 03:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kS8fRWuNDkuiztpWqjEa2CzwXqjYXf6gCvCK68jBTPg=; b=BzMjXpTnG1r8sIb1BY8QHBRR0Xw+wDPzgOa8OO8hbe8S8eVBtqYMwcTsrAruC5dxVm 7ZDknc/n1/YeBieAqha7/x5ALaZ7TpQaWA7dfOGomL4J4tPxMcQuPyfpoSoH/ExT+bhR UwpJOpgjL4X5cOuDWwodgFl4gFkmbBpouYQ39f2a4RACKNqTZW8y06MYE1nidDz60YOZ DrnBdhzBv/cC69dr5JQuXSjjzswrC8SMsLNFPb5zF7tGFYwKYt0NX10l3BK3+cUsBJDd rhT51pJbPd1lfmFMiC77sU8AL7Gw73Ml5IjCT15z6+tTQLkFcQlBCJ4eqyuJMe1vwLOl 5vCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kS8fRWuNDkuiztpWqjEa2CzwXqjYXf6gCvCK68jBTPg=; b=1zkwcglAIPzsOOZJWEbndUwVx5KG1mmoaix4mkDesK3gJ3kphRbFWvDTwmkdTr5gqV vLap3wyaOQN7VdLZfCyc7TW07z6cKu5Lc1hWe0FkiEpKDYkG+SXXPjGFF5yzkUSOH75t DmQGpnPV+qwvJ0ZZ9me3Qc4NawIWJ5IoiTLs/unj23VMZvBQqzHaMeQdpJv/jc97EfQK Q0vuZTxKEVaNVS/XmxYrmAQH2DCy9vJ/Kz+/VeBoZrWid4QTYK11QH9OZSNPN/uu+nsg gmcfu5vcwfGrCslHHOQ3ENnP8ukzaIuAheV75TyOaOg1JSecSNIf7hNXFoS/eHRgD3Cy Vhkw== X-Gm-Message-State: AJIora9Aalv8GS5xEx4hcIl1Y8JDtbnsOk/xLxrioRQZyGcNuqy96oLK 8WwLoskeVzT+v/oJOVp/Jv9K7st3utRA6w== X-Received: by 2002:adf:ecc6:0:b0:21a:3dca:4dd7 with SMTP id s6-20020adfecc6000000b0021a3dca4dd7mr11256268wro.366.1656325363718; Mon, 27 Jun 2022 03:22:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/25] target/arm: Add ARM_CP_SME Date: Mon, 27 Jun 2022 11:22:18 +0100 Message-Id: <20220627102236.3097629-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This will be used for controlling access to SME cpregs. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpregs.h | 5 +++++ target/arm/translate-a64.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index d9b678c2f17..d30758ee713 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -113,6 +113,11 @@ enum { ARM_CP_EL3_NO_EL2_UNDEF = 1 << 16, ARM_CP_EL3_NO_EL2_KEEP = 1 << 17, ARM_CP_EL3_NO_EL2_C_NZ = 1 << 18, + /* + * Flag: Access check for this sysreg is constrained by the + * ARM pseudocode function CheckSMEAccess(). + */ + ARM_CP_SME = 1 << 19, }; /* diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9a285dd1774..8f609f46b6a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1187,6 +1187,22 @@ bool sve_access_check(DisasContext *s) return fp_access_check(s); } +/* + * Check that SME access is enabled, raise an exception if not. + * Note that this function corresponds to CheckSMEAccess and is + * only used directly for cpregs. + */ +static bool sme_access_check(DisasContext *s) +{ + if (s->sme_excp_el) { + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_smetrap(SME_ET_AccessTrap, false), + s->sme_excp_el); + return false; + } + return true; +} + /* * This utility function is for doing register extension with an * optional shift. You will likely want to pass a temporary for the @@ -1958,6 +1974,8 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, return; } else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) { return; + } else if ((ri->type & ARM_CP_SME) && !sme_access_check(s)) { + return; } if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { From patchwork Mon Jun 27 10:22:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585277 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2952459mab; Mon, 27 Jun 2022 03:34:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uSwK603JIpwejz4X/iyIev92ZUItor47QjtgQMcte9hoqb6TrOxnct/LAr6iIeGaTC0Osr X-Received: by 2002:ac8:5c0b:0:b0:317:c524:c23 with SMTP id i11-20020ac85c0b000000b00317c5240c23mr8624904qti.83.1656326086398; Mon, 27 Jun 2022 03:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326086; cv=none; d=google.com; s=arc-20160816; b=oBIBFkY60WALywc9liw7PqwkfjV+eUIjo2JTSX+AOaU9q6Rhi51AY3XRnXaIMZ1xXj JtblWpu0twuvX4vqKR0kUjOUyjuXnNBM2Hy8PLwDo5hvdIL5CvIJHJmktCQzmkw13csj mv75jfdHACZ60FblpSpnrPS/0dXSGmnfiHDS+QEo6G45Dj68AY0BHlnvwdXzQl5g7G6o nlKWq8Ki3EIn+Z9EUHoQ0aX0ahEpn1FiJfztyCYBi+Z7m9etv9uRkIFWkmdyYJOeZqkC gk3TWNyCtY2M6xRzoVkS4ccEKl8t/nK/0lVCBYzrkc1xXHceM1tiuXnGaLMi5I+RYM9v UXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=N45XJR7lvYA9N61Vw6ZzkFDcUGDF5yKoYKPb5Cpl1mY=; b=sNigvjnAxpcyCWD5HO8QpJZgRRkR06wDDJp5a2wpVChijnGEvnFXhIgQunwl9cWNCf +Bvs+nULiFGEFu39sSLW1iZKBEnh8vYJqqPSI8xH0aDHxibyKr24FsE3+MZGkZG2YMyy 0YdZCfaoyexDycTKytqawb4k44f/NLsrO+kllprONuxeSq5Bs5L1sbwR1wpAk4+Cip9F 2iocqDyi+HR5IA/k+Ibr7mYcodAYIJdODUgvRzbey/8c37zPdARIifj0/20S6mpR+Rr/ PQhOTv7ozACm/u6v2jOJ1yYhOa1uvh14gg1yrWzkR58Hyoh1H+uLRDCzu39NNItIt0tX xg4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c9fxjm2R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r9-20020a0562140c4900b004702d220a82si4943911qvj.516.2022.06.27.03.34.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c9fxjm2R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m4r-0006OK-Vv for patch@linaro.org; Mon, 27 Jun 2022 06:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0002JJ-1k for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:49 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:33424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltG-0004sK-4a for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: by mail-wm1-x32b.google.com with SMTP id o16-20020a05600c379000b003a02eaea815so4625465wmr.0 for ; Mon, 27 Jun 2022 03:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=N45XJR7lvYA9N61Vw6ZzkFDcUGDF5yKoYKPb5Cpl1mY=; b=c9fxjm2R953G/D3g2S2gKQOzGVIvnPAOEBcbZ3ZjUX0Bz3f/jeED9LppfYU5JErpJD tGXqkhwTxcAdW0/lAu78S851DfZqTACpC63FOim5b/l4SCUFX0na0SIagUUlcg+Fs/5n fnIhCSWG39SvX+tEa+tF2hI1pf6UTfzCFDyM9SBicChyCFpYJfbkRKDTaw5xL3A/SGdx TE+1jU+a2qBxtSpv4Yu8Ib4jUbjJjim26TD1OSHqZ1uJ7m54STqYmTuM6f9r4WZ244K+ iuE2JDiOYEcoWq00xSQUoncXqdc8fa7StedP86XfmU1FOd9hV6hT3gl3zBLv9V28xQ6T ZywQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N45XJR7lvYA9N61Vw6ZzkFDcUGDF5yKoYKPb5Cpl1mY=; b=HHjxls9xuwg8fTKDP8jC4Ar1jQaZ+BPXX/Gbp1koQL5S4yc32/Do9HoAM3Rjtrtkvr FgVhTXE47Rmq5KMkGNmy3qcYGtIAUtxVlHG79wwsHeD/MUuGxWMDmJ68+pnkUj+ow19V Af8Btl/VtGyyQkQqbRB87ZUgXEn6QpYdvrU3R4k2ZOGtvTFGhunzV3woFfPMQk96i5ew aT3zymigJsvqk0WzJcaQKeLfd4dpCtYdDx3JZaIVA0BosBfCSpWhigsl3U6IW0Rc5A4G gR7cPEsVJMDgGTDeKyJOqnQqStUIXGmyDtUQxL7ERh5rUkU+9n7l8hLn3uT5SBJhtF/l m0Nw== X-Gm-Message-State: AJIora8Hi4a2/DvGE0iutdVuI30N60WasCZ68TM1w9136lS9fE5i0vtJ TPez64acowe0KIe+TCPzmyR+zB+sH1pnLw== X-Received: by 2002:a05:600c:4f14:b0:39c:8612:a95e with SMTP id l20-20020a05600c4f1400b0039c8612a95emr18660334wmq.107.1656325364453; Mon, 27 Jun 2022 03:22:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/25] target/arm: Add SVCR Date: Mon, 27 Jun 2022 11:22:19 +0100 Message-Id: <20220627102236.3097629-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This cpreg is used to access two new bits of PSTATE that are not visible via any other mechanism. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-6-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 6 ++++++ target/arm/helper.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e99de180978..bb8cb959d12 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -258,6 +258,7 @@ typedef struct CPUArchState { * nRW (also known as M[4]) is kept, inverted, in env->aarch64 * DAIF (exception masks) are kept in env->daif * BTYPE is kept in env->btype + * SM and ZA are kept in env->svcr * all other bits are stored in their correct places in env->pstate */ uint32_t pstate; @@ -292,6 +293,7 @@ typedef struct CPUArchState { uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */ uint32_t btype; /* BTI branch type. spsr[11:10]. */ uint64_t daif; /* exception masks, in the bits they are in PSTATE */ + uint64_t svcr; /* PSTATE.{SM,ZA} in the bits they are in SVCR */ uint64_t elr_el[4]; /* AArch64 exception link regs */ uint64_t sp_el[4]; /* AArch64 banked stack pointers */ @@ -1428,6 +1430,10 @@ FIELD(CPTR_EL3, TCPAC, 31, 1) #define PSTATE_MODE_EL1t 4 #define PSTATE_MODE_EL0t 0 +/* PSTATE bits that are accessed via SVCR and not stored in SPSR_ELx. */ +FIELD(SVCR, SM, 0, 1) +FIELD(SVCR, ZA, 1, 1) + /* Write a new value to v7m.exception, thus transitioning into or out * of Handler mode; this may result in a change of active stack pointer. */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 2c080c6cac0..3acc1dc378a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6349,11 +6349,24 @@ static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri, return CP_ACCESS_OK; } +static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + value &= R_SVCR_SM_MASK | R_SVCR_ZA_MASK; + /* TODO: Side effects. */ + env->svcr = value; +} + static const ARMCPRegInfo sme_reginfo[] = { { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, .access = PL0_RW, .accessfn = access_tpidr2, .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, + { .name = "SVCR", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 2, + .access = PL0_RW, .type = ARM_CP_SME, + .fieldoffset = offsetof(CPUARMState, svcr), + .writefn = svcr_write, .raw_writefn = raw_write }, }; #endif /* TARGET_AARCH64 */ From patchwork Mon Jun 27 10:22:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585283 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2956461mab; Mon, 27 Jun 2022 03:40:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s9t0WypwgeEw7I592e+1IHtCyOUnRbkMzS74Xd8j9qgPj3xjLSoU7CNsuWhgfKeW2kAHlj X-Received: by 2002:a05:6214:240d:b0:470:46a1:fc74 with SMTP id fv13-20020a056214240d00b0047046a1fc74mr8025342qvb.30.1656326431135; Mon, 27 Jun 2022 03:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326431; cv=none; d=google.com; s=arc-20160816; b=MepQjx4RihfDJbW+NuNPH3xQwXxnJ5g68nA6iqrVhgCiceTbe/0qKFaEgSKRdMwGjX vFkJG7YfOlwskkmhyXgoN3MgCp2KJzIFT0fSfXan0CTDMCG5r+hgjQss2UoxkpKGn52P mglV7C08rvLk/vyfuR0SsIWfCAfgoRw4iy4CR3zHgrqQ05e/A0AfaO1ODkU+K6KCT9b3 +yq9vyB3wVUoDY5ko2FBlTeulX7HUmv73/wFAdP059AFX0W7hQyFtFnzxpzRosbY0At4 B2eKS73qk+tr9ELLSNSLn6e8brVHL8gwOsZuWZJhjPgGrFF3ehYnYXau3KW+seIBpgrM eZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=myu9f+rViX6h8d0L3J1Djnr/C3QVHRwUhjQjh6R87+8=; b=Glqb2fr9+BZIaFPhR26slxcs6Ows2rT30wbk/NU74zjtP+nAOM9MVntZf1FQTKDtL5 RI2Plu8eIxghHBeouFPsVqq6kYNxCQom1ivltSJbIo675kaUiMYhXmrfsPZMSPzbg+Qx Xx6YLA0luVH8X+f51CGFytAmjRoggGTRivMgFb9/cS8HRo2IxNPtB6ksxpwNYxchNi3Z poaqtZhi7TP5MuqoeXZpna/OhqTlU4G2aIABa+PILocHfNlGj/f3c2R60VGMxlDxbcRa KYde25hZcHdZbW+74dzLefCAuqW0ppbqYRrJzO8fOd2a026PY5ZM2wJYZCf1YyWPCTnR JUNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3rpxp0n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bp31-20020a05622a1b9f00b00304d5a3092dsi6238916qtb.307.2022.06.27.03.40.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:40:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3rpxp0n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mAQ-0007qe-Nv for patch@linaro.org; Mon, 27 Jun 2022 06:40:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0002JZ-NF for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:50 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:44576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltG-0004sY-Gq for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:48 -0400 Received: by mail-wm1-x32a.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so1319529wmb.3 for ; Mon, 27 Jun 2022 03:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=myu9f+rViX6h8d0L3J1Djnr/C3QVHRwUhjQjh6R87+8=; b=k3rpxp0n/bqtAhF5BurilQzMlhca5l6bvUUhErlp6tdLo0T0luco4GIgVPOu7cKgR2 ++gJE4KnFkh0CqYfbvOzJZZ0QCn5Zl8jAoYUHB818kjVnlej3/igqsYn/1Hl1t050UKI DpRHRDBNS7XJCO15VNLWmnQ5/NrjyrlqVx6D0J5DtgTR2uvGf8KoXwgjk6Qd4ICedYnT tRIdIR/ofQA3rmZdplh/N6ZbJ4acbdHdWybCVBWCwhG8aikUg/TPzt63PllvmgvHZcca S0ZxIsXwPad5NMyrjlsW+Su5H+6SC37YZNs8LlbSAiDZ35oSFJT+uH0PSROpNWFRLEoT /oJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=myu9f+rViX6h8d0L3J1Djnr/C3QVHRwUhjQjh6R87+8=; b=Y40qmPiTDGwwv4B5VLGdj+ylugISrk7nGYkHwlZf/J/7d8KEq4/Jtzj5YLCdPwSNG4 hO+NHU57KIVLS8pxW+2jAp7XhflawLn3si+LefxNE6iQt66AqAdAmgzILumac/XjFUJU 10RQT+d8k+3mEIGcZNBOrge7DgiMBCeYG6IqxEfsjovo0j5qiaxy6S361piIIXGy7r/T zRzhFoFggrov09c6czSkGL1e4XU8f4nhxhZzKYGhsV1bFrISBiJZpHuR5MY3emp183H3 rmxhe8amD7rZHey6ZqdEuoDgFEwCecN08LeuMm2D9+ecAayTpOQX0qFqaho/fUA318at 12Jw== X-Gm-Message-State: AJIora8se8y9WqizbhWSqmoz9GgUTeE9m+6z4SJem0AjR0HX8Nf3YR/k Yl3xrmy5/5DOpZlSNPRZrbIfeRyS/SKocQ== X-Received: by 2002:a05:600c:3ace:b0:3a0:4ea4:5f77 with SMTP id d14-20020a05600c3ace00b003a04ea45f77mr155817wms.57.1656325365189; Mon, 27 Jun 2022 03:22:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/25] target/arm: Add SMCR_ELx Date: Mon, 27 Jun 2022 11:22:20 +0100 Message-Id: <20220627102236.3097629-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These cpregs control the streaming vector length and whether the full a64 instruction set is allowed while in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 8 ++++++-- target/arm/helper.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index bb8cb959d12..dec52c6c3b9 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -669,8 +669,8 @@ typedef struct CPUArchState { float_status standard_fp_status; float_status standard_fp_status_f16; - /* ZCR_EL[1-3] */ - uint64_t zcr_el[4]; + uint64_t zcr_el[4]; /* ZCR_EL[1-3] */ + uint64_t smcr_el[4]; /* SMCR_EL[1-3] */ } vfp; uint64_t exclusive_addr; uint64_t exclusive_val; @@ -1434,6 +1434,10 @@ FIELD(CPTR_EL3, TCPAC, 31, 1) FIELD(SVCR, SM, 0, 1) FIELD(SVCR, ZA, 1, 1) +/* Fields for SMCR_ELx. */ +FIELD(SMCR, LEN, 0, 4) +FIELD(SMCR, FA64, 31, 1) + /* Write a new value to v7m.exception, thus transitioning into or out * of Handler mode; this may result in a change of active stack pointer. */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 3acc1dc378a..2072f2a550e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5879,6 +5879,8 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) */ { K(3, 0, 1, 2, 0), K(3, 4, 1, 2, 0), K(3, 5, 1, 2, 0), "ZCR_EL1", "ZCR_EL2", "ZCR_EL12", isar_feature_aa64_sve }, + { K(3, 0, 1, 2, 6), K(3, 4, 1, 2, 6), K(3, 5, 1, 2, 6), + "SMCR_EL1", "SMCR_EL2", "SMCR_EL12", isar_feature_aa64_sme }, { K(3, 0, 5, 6, 0), K(3, 4, 5, 6, 0), K(3, 5, 5, 6, 0), "TFSR_EL1", "TFSR_EL2", "TFSR_EL12", isar_feature_aa64_mte }, @@ -6357,6 +6359,30 @@ static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, env->svcr = value; } +static void smcr_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + int cur_el = arm_current_el(env); + int old_len = sve_vqm1_for_el(env, cur_el); + int new_len; + + QEMU_BUILD_BUG_ON(ARM_MAX_VQ > R_SMCR_LEN_MASK + 1); + value &= R_SMCR_LEN_MASK | R_SMCR_FA64_MASK; + raw_write(env, ri, value); + + /* + * Note that it is CONSTRAINED UNPREDICTABLE what happens to ZA storage + * when SVL is widened (old values kept, or zeros). Choose to keep the + * current values for simplicity. But for QEMU internals, we must still + * apply the narrower SVL to the Zregs and Pregs -- see the comment + * above aarch64_sve_narrow_vq. + */ + new_len = sve_vqm1_for_el(env, cur_el); + if (new_len < old_len) { + aarch64_sve_narrow_vq(env, new_len + 1); + } +} + static const ARMCPRegInfo sme_reginfo[] = { { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, @@ -6367,6 +6393,21 @@ static const ARMCPRegInfo sme_reginfo[] = { .access = PL0_RW, .type = ARM_CP_SME, .fieldoffset = offsetof(CPUARMState, svcr), .writefn = svcr_write, .raw_writefn = raw_write }, + { .name = "SMCR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 6, + .access = PL1_RW, .type = ARM_CP_SME, + .fieldoffset = offsetof(CPUARMState, vfp.smcr_el[1]), + .writefn = smcr_write, .raw_writefn = raw_write }, + { .name = "SMCR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 6, + .access = PL2_RW, .type = ARM_CP_SME, + .fieldoffset = offsetof(CPUARMState, vfp.smcr_el[2]), + .writefn = smcr_write, .raw_writefn = raw_write }, + { .name = "SMCR_EL3", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 6, + .access = PL3_RW, .type = ARM_CP_SME, + .fieldoffset = offsetof(CPUARMState, vfp.smcr_el[3]), + .writefn = smcr_write, .raw_writefn = raw_write }, }; #endif /* TARGET_AARCH64 */ From patchwork Mon Jun 27 10:22:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585276 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2948808mab; Mon, 27 Jun 2022 03:30:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sf4xmpGS6s+qL3uKwf3BVJS2TvFE2CzEW399rJsvAJ89rN0AnZGEXSdXL3V9NQVwrURM33 X-Received: by 2002:ac8:7e86:0:b0:304:fe0a:8050 with SMTP id w6-20020ac87e86000000b00304fe0a8050mr8384080qtj.112.1656325804539; Mon, 27 Jun 2022 03:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325804; cv=none; d=google.com; s=arc-20160816; b=BPMrR5TlDhswMuxLYNyD318fvXdiJZPZbrvRclqe0uLHhMw2pN5jylen8a/nVEoHlS 5UWguKqCTXrgviNlY+bREyEGwwGdDqkrTwGH/8jUwzhiaOmePKAGRl6PT4nowYxqqNMZ 7CMzQde25orpfKNpRjD2rnnpZ/8EYAIqgzpLmQo2+Rryk6A3rmqsuSJ8xxaWrM8S4ckA iDpeqVLKHyYBsgxPROWYJWwo8y5+nSyJyMYkvPl5X4tVtne5U5GY9RKHJpBtACIwMUbx pkVFk8nqHiN1oYeS0ZjwWuQvHsD6VkRxFV4cZcmbigfK2S/61Q4ByoDRhIOKwSpC3Rjs 1D1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=UTv8wcV/DPc1kqXdo7thfBSpvl/+DZKxa8gDxsT5bAo=; b=ph2agoPY74RxGble7WHSBUIxxbNczfQ2Gm/xcoWAJJggJLI5mwGVvv4gVTqXyJwByl wYkRHOknsAoZO3UASfkjZ4KOS4uGHaCC8Mi8QR3cpYRpQBYJ5zpKHVq8xMviSSdyzcby aRMCc8gZ+pfWLvbIOpkGZj+qI+hoqayGvq1bffNP9G9BSUoAHxCfTm89N+E0MqVn+7EO 4q84af1sT89frw1vokizCc8MRIGNf+8GmsPeo+07/PE7X4QuBlzyOCzXxvJJFzR/eEbx nmHwjXg0k7ivXvDhFDZDHa89L+UO7qhz0fLUPxVBMiS/x5nibyw43pODzOeYsZYpUMpN 2ziA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TneaXHkM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g18-20020ac85812000000b00304def15cb0si5423676qtg.221.2022.06.27.03.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TneaXHkM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m0K-00014i-3M for patch@linaro.org; Mon, 27 Jun 2022 06:30:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0002Ja-Ni for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:50 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:33879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltH-0004sk-88 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:49 -0400 Received: by mail-wm1-x335.google.com with SMTP id m6-20020a05600c3b0600b003a0489f412cso1151907wms.1 for ; Mon, 27 Jun 2022 03:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UTv8wcV/DPc1kqXdo7thfBSpvl/+DZKxa8gDxsT5bAo=; b=TneaXHkM0fXpTarEfQI31y/ee0jSB/jVfAHkfjIosObO2/4CocUTQMR1TuR8OlDeZP YuLocisOt5J/NrSxWU1zJ4FoHouf301ZLK+UUPs0WvkXEge69OF+vWG0Pgic0KEcTpiH x/JtPbLPej/g0LLIBW3delR+nVxRRKex+xh7UzrmVrzJobIvwhK5qwNLWvXqX+wG61ag b+HK/0vO92DcJKP4tbRWuTATHgPANeLIh4FSdyC3GhtIn5Oohos7/G0cSZa6DRrNBiEE H7mQqqZEzoadhH9IfN+F2LZnSXV8NYThJL6VD1tM8x9MgslRUv5+x0pxMjvQ4GFCILr+ GGxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UTv8wcV/DPc1kqXdo7thfBSpvl/+DZKxa8gDxsT5bAo=; b=ZfLSeIT4alN0Qz7HuIZ8V16+apDinlptjnrA15mJWWojqtPCifv25fQMnRQhut/m73 1Z5uzaUotPCjhx+cQBMQd1VXh6HZstbVRsg+FrjHsEWNn+tfooWOlaXvPrysoixcO+Ve /s/+S/pIA12kc/eCgVqqG/gn6TdvlnNVoPw4q/keRPG+P7DvY4ebg05MrGVXnJJ5XrMw 8+06WggOpCRh6hZwGQvMJY66XfA2eWoimNPQNsm2j7FeUCqzvxqGUfpBOhjwfZRVYI/O hfMBM5hWDWCjrBE+cGbaVvruLqrRdApQFYJaPUT5ABSjFYZBmLuV+9UasjG7oMUfmZQ5 bEng== X-Gm-Message-State: AJIora+ELsM6KdDaghS87xp5i6Nv0B1WlXtV+oPML9HBtfufAFbusEJA 9BkX/KMoMbVA3AyUJU0Q5g1AYp4yIQfLOQ== X-Received: by 2002:a1c:7719:0:b0:3a0:31a6:4469 with SMTP id t25-20020a1c7719000000b003a031a64469mr14404228wmi.20.1656325365869; Mon, 27 Jun 2022 03:22:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/25] target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2 Date: Mon, 27 Jun 2022 11:22:21 +0100 Message-Id: <20220627102236.3097629-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Implement the streaming mode identification register, and the two streaming priority registers. For QEMU, they are all RES0. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 2072f2a550e..bbd04fbd67b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6351,6 +6351,18 @@ static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri, return CP_ACCESS_OK; } +static CPAccessResult access_esm(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + /* TODO: FEAT_FGT for SMPRI_EL1 but not SMPRIMAP_EL2 */ + if (arm_current_el(env) < 3 + && arm_feature(env, ARM_FEATURE_EL3) + && !FIELD_EX64(env->cp15.cptr_el[3], CPTR_EL3, ESM)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { @@ -6408,6 +6420,27 @@ static const ARMCPRegInfo sme_reginfo[] = { .access = PL3_RW, .type = ARM_CP_SME, .fieldoffset = offsetof(CPUARMState, vfp.smcr_el[3]), .writefn = smcr_write, .raw_writefn = raw_write }, + { .name = "SMIDR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 6, + .access = PL1_R, .accessfn = access_aa64_tid1, + /* + * IMPLEMENTOR = 0 (software) + * REVISION = 0 (implementation defined) + * SMPS = 0 (no streaming execution priority in QEMU) + * AFFINITY = 0 (streaming sve mode not shared with other PEs) + */ + .type = ARM_CP_CONST, .resetvalue = 0, }, + /* + * Because SMIDR_EL1.SMPS is 0, SMPRI_EL1 and SMPRIMAP_EL2 are RES 0. + */ + { .name = "SMPRI_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 4, + .access = PL1_RW, .accessfn = access_esm, + .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "SMPRIMAP_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 5, + .access = PL2_RW, .accessfn = access_esm, + .type = ARM_CP_CONST, .resetvalue = 0 }, }; #endif /* TARGET_AARCH64 */ From patchwork Mon Jun 27 10:22:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585279 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2952972mab; Mon, 27 Jun 2022 03:35:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8RfWlkOLUrXoOEpqGyM/P3wMxhKZydLr2Wzju4RFJfKPEvU7BrSxuoQBNPZlqGhxeIWEz X-Received: by 2002:a05:6214:27c4:b0:472:6d89:a12 with SMTP id ge4-20020a05621427c400b004726d890a12mr1838978qvb.7.1656326123860; Mon, 27 Jun 2022 03:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326123; cv=none; d=google.com; s=arc-20160816; b=B1S0D5Upn6oMboNVz1FCuXg5Yd5pgHI2LG+eTRWMIflf6VEd4OP9HlxJLot5CEPqFy TGJ5W6wRXxnd9bF+7e57iter3amPFeQfafj63kqBQmUNHpprMg8EgcJNgJFrkk+VFq9o 5JqHvoM777yxqZ3+vIQRM2dYaj/G4HhSSX7yeFBrnjqiY9AlxXB2SOMarZkt0F3Dd4Fw m+O4sFms352ur8Fabsh03wwyGSs3EoEQcwWny/sFtY2d0LaLL3fh40SPHfIIZ8w+27gA m7Ax2DZJ3cWi71AEzZJozzXsg74Abgas/w5r1/9vSAK60djfuv/eYo6pU2ExHyQbc9mP SLyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=5wziFx4VrUkDL3R6unNxwrzbYVixhlidQEgVavCRMsE=; b=aN7jJnHopyWSwkIPEgb3qTeFa+D41Kwjk7dMI6G8iyyu7Q6t2UKflS/s7ea2Y0ol9A fDDaKr2L3tpge+YjI+Gi0uEoUouyxJZd+qCuuBWAa1KfN51FX7nkFqH3BmV86IFnBtQS 9xEcZ737vdZ8GClZr/JDsZ/4QGNfYYXVVMPPVY7AyZc/EOsbdF7Dlbus5PXX3CrFKcFr DmpqONQ2c8P1TcLFLe158cQHxlnm7f6F3zNKrdUFnQ+SC0zgyIf2IMtcKF2CNHpKR2iL 0TkELqDTDmjC0ZT4y51zX3Yc7XDrbKGTdOoc5wKogOerGZiutKD5Faqg3nqsMsfTovT7 Iwtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n/J6yPin"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g9-20020ac87d09000000b00305239682b4si6401207qtb.32.2022.06.27.03.35.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:35:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n/J6yPin"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m5S-0007BV-H7 for patch@linaro.org; Mon, 27 Jun 2022 06:35:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltK-0002Jc-6s for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:50 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:44908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltH-0004st-SM for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:49 -0400 Received: by mail-wr1-x430.google.com with SMTP id i1so7844312wrb.11 for ; Mon, 27 Jun 2022 03:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5wziFx4VrUkDL3R6unNxwrzbYVixhlidQEgVavCRMsE=; b=n/J6yPinG1LqfWCQtbOnNPM/nUCvRgKDHEm2ii0BHR45ChdudLgloKFUSxeF8Cwjsj 0H4yhQHPj8tg6/7+UE8/LnZFXkeOJVodu+bCAMKhPDDGDN9rd7B7D+vNqXKHwpH440zN XHeSyWvz0O34H0uQWePQ4H66BK6yUGoP9bKwO8szcGQcU5QUGWJDyup+DZT09vyrhxFJ FzieaupHyItmCoCvBonGJh5io8BzEC9PlRRF4z0nFCBJyb0Z0k5mvw6pl4dPyP0HfDYV CVGgz1rQx70wLB4I1WKyokfvTBHjbLkG6KVNchRPXT7oCvbz1TPARaJC9wHM9a7D78Cd VGSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5wziFx4VrUkDL3R6unNxwrzbYVixhlidQEgVavCRMsE=; b=aqgKeAb578YE1XAKooCZOouHv66SWWCwkugf3iwdFm93a0nvHiSTU61JUvEE793IBO tvhGjseNeeZcoz/Lt/UdhAKgoaFrFW3CX3JoALojswPC/Au7ko4jnnvEV46nDZRtH7Dj qPophT33F4ZGLgEu2qFeTON0mjRBxW/tWy+1Dz469eaZEY7ltnYDsDUytV74C5seRK6w aCjOr+txre+98BAj5WtT/ARKgcbIp5kV9KuN6l3P1bohcXrtIB5MXDvKxL3mLe9zZzLk fknAqrgqV2EVdiOLBeyzwwWYr5itHBqAbXbZf6tX9j5JsTAo4XGAlFTw5JXg2MzXBf/2 Jn8w== X-Gm-Message-State: AJIora/kf/vV8EQyPQLGQVhqlqEkivagqdOULNCElfW7hpmHbdjaCD6k sBnS6pJq6ndsa7PF4VmvPDvpyQN9ikOOSw== X-Received: by 2002:adf:f245:0:b0:21b:c705:8b1 with SMTP id b5-20020adff245000000b0021bc70508b1mr6764332wrp.282.1656325366522; Mon, 27 Jun 2022 03:22:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/25] target/arm: Add PSTATE.{SM,ZA} to TB flags Date: Mon, 27 Jun 2022 11:22:22 +0100 Message-Id: <20220627102236.3097629-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-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=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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These are required to determine if various insns are allowed to issue. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-9-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 ++ target/arm/translate.h | 4 ++++ target/arm/helper.c | 4 ++++ target/arm/translate-a64.c | 2 ++ 4 files changed, 12 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index dec52c6c3b9..05d369e690a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3160,6 +3160,8 @@ FIELD(TBFLAG_A64, TCMA, 16, 2) FIELD(TBFLAG_A64, MTE_ACTIVE, 18, 1) FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2) +FIELD(TBFLAG_A64, PSTATE_SM, 22, 1) +FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) /* * Helpers for using the above. diff --git a/target/arm/translate.h b/target/arm/translate.h index c88c9533253..93766649f7f 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -97,6 +97,10 @@ typedef struct DisasContext { bool align_mem; /* True if PSTATE.IL is set */ bool pstate_il; + /* True if PSTATE.SM is set. */ + bool pstate_sm; + /* True if PSTATE.ZA is set. */ + bool pstate_za; /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ bool mve_no_pred; /* diff --git a/target/arm/helper.c b/target/arm/helper.c index bbd04fbd67b..e06c054c3d7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11335,6 +11335,10 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } if (cpu_isar_feature(aa64_sme, env_archcpu(env))) { DP_TBFLAG_A64(flags, SMEEXC_EL, sme_exception_el(env, el)); + if (FIELD_EX64(env->svcr, SVCR, SM)) { + DP_TBFLAG_A64(flags, PSTATE_SM, 1); + } + DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA)); } sctlr = regime_sctlr(env, stage1); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 8f609f46b6a..5cf4a283bac 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14630,6 +14630,8 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->ata = EX_TBFLAG_A64(tb_flags, ATA); dc->mte_active[0] = EX_TBFLAG_A64(tb_flags, MTE_ACTIVE); dc->mte_active[1] = EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE); + dc->pstate_sm = EX_TBFLAG_A64(tb_flags, PSTATE_SM); + dc->pstate_za = EX_TBFLAG_A64(tb_flags, PSTATE_ZA); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; From patchwork Mon Jun 27 10:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585289 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2960572mab; Mon, 27 Jun 2022 03:46:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uFr3mVALE7zzuFPLlHwsxePbjtp0ScYqCUb1J7itrxeMbtUxHzI1d1/xfFYPzNPVLPReqq X-Received: by 2002:a05:620a:28c1:b0:6af:2a39:a172 with SMTP id l1-20020a05620a28c100b006af2a39a172mr2411080qkp.192.1656326819045; Mon, 27 Jun 2022 03:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326819; cv=none; d=google.com; s=arc-20160816; b=EuqXo67wdyYr2KB5uAt4BVhj9CmlHRgEw14t/QnZDLq7wrIvxhDljA5LvGJSN+VtvX qGUj8eWpbd+Hg/6AUKEOVuOPe6AWK2fRi+JbgK6wIV/nrWq8RyJxwaFiAumZjhxAgad8 KuQ+7l3c5abYFyHG8Kpw35RpzEsirnFnfRZjompvDAcdkcLS2MjaNTWP4/ovc3B2681h vbJAP6OGxrp9vX/ooEQm8/1LbCTh7eq0EvcyT3dSKyMHRUvuqCkaURuEbgzBT7kZDu/V xEqIGqedDhpefIG0WRQBs0BALoefQoHl/Eo7EVghcsbSk+1/WYsbOgif+S6D7sku9ap4 CwLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=wY3OykP5QHqWmEIls0rL9GmMD7xE9ejKcExTSvnF+xk=; b=WSqnrGPYjkm7KrVlQrw7EZ9wicIM7o761wC1kKZZD8EBg/FYICtF29DLbWKkBYFU7n kytwv5qswKbi3oAJ9IzjKGEae10pcSzSaOyZpm9SFzYto4Cxq1A4jrYulsGscJ/XzUfG 1Gstlzh2Xg8oYOde26BX+c3qKfdBEo02JdCSVHi5852DNwlhtbYzJr4P8htez0+egc1H RFlEKaXEMbN/I7XdqKF7LXJ9TZgxvM+vQYE9t2h28OBEaeJako/UxoelYIphLSZksjWH 2uQT1LkmvMZYMwo68JRaEyYOWHqal7mZIkIwbrlmNs2pTxk4xhTrw9cfuRRUu/4p4xaN D+Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zf1v4eWR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o5-20020ac87c45000000b00307cba9230esi6291250qtv.454.2022.06.27.03.46.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:46:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zf1v4eWR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mGg-0000Dn-Jv for patch@linaro.org; Mon, 27 Jun 2022 06:46:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltL-0002LQ-6g for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:52 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:40848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0004tX-FP for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:50 -0400 Received: by mail-wm1-x32e.google.com with SMTP id v65-20020a1cac44000000b003a03c76fa38so4562710wme.5 for ; Mon, 27 Jun 2022 03:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wY3OykP5QHqWmEIls0rL9GmMD7xE9ejKcExTSvnF+xk=; b=Zf1v4eWRh/SE1p02CbKsz5aSK16JlJcMOyqii3YAU4v2aR2iXHmxCM5lliEvU+WIAg wuJj0d2nCePOfPYEyAj2VEwli0KqMcRaTVXUKLGHN80oTeWWwITV9lXCvYqJ+0dpEOhM YqZqxQWM/iWLnhdRNMEPvPaUWJ8mYx/3ftvu2ImULNRNpUbFaKAUCh+q/nVDYhhiAHc1 2dycGIDJvmMlAfFc/qoYWwd5gjFzflCwQd7dHlxmETQ4AmrqijF41Tghppz1I5c2voLd 3BTy+lZCdhXBO3xjdar36KpVYj7rXfAs8vm3EXGkMdBrr6yp72j6H1ic2Lvq6xwttD6E XXHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wY3OykP5QHqWmEIls0rL9GmMD7xE9ejKcExTSvnF+xk=; b=zwzJW42H+D+UBbFimTk/x7D4RAWrXNeZh31Q8DpJNBUzz1bLLkk3rHgt7tyCL3O8jl x2Vyodh7ZEdSTYWpWKmvChX2j0JDByxjuyjs00GdhJtuC1rnhDD6SML22LP7FbyxKO1I CaUts20vrEyuEBWCVPNi3AWFWBw5Hx5e+9+H0o2xVPN4MfaDL63qGP9mFd6DMtRuNlJ/ qn2RrD0VE7T9smrC+egAe+m/g2fLARUhQEH5+LZZ3lQfdNNnkHpp4L96v7iRlog38SH9 44gAJ0u58UiZ5hpWHK5zvmSXmezKcn+3hqA6WW98gZLm209us7XN/jXEosSETbNSfL5Z s5Yg== X-Gm-Message-State: AJIora/uuOBA9hLefKUunXmbkwZTieCoeKZoxse7xnrEnWoX6zDeEXuE ydLasrJ0uQsdzsi4W08ZhuHKQmIhDWx8MA== X-Received: by 2002:a05:600c:3d8b:b0:3a0:466c:b08d with SMTP id bi11-20020a05600c3d8b00b003a0466cb08dmr8818225wmb.125.1656325367254; Mon, 27 Jun 2022 03:22:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/25] target/arm: Add the SME ZA storage to CPUARMState Date: Mon, 27 Jun 2022 11:22:23 +0100 Message-Id: <20220627102236.3097629-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Place this late in the resettable section of the structure, to keep the most common element offsets from being > 64k. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-10-richard.henderson@linaro.org [PMM: expanded comment on zarray[] format] Signed-off-by: Peter Maydell --- target/arm/cpu.h | 22 ++++++++++++++++++++++ target/arm/machine.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 05d369e690a..52ab6f9bb99 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -694,6 +694,28 @@ typedef struct CPUArchState { } keys; uint64_t scxtnum_el[4]; + + /* + * SME ZA storage -- 256 x 256 byte array, with bytes in host word order, + * as we do with vfp.zregs[]. This corresponds to the architectural ZA + * array, where ZA[N] is in the least-significant bytes of env->zarray[N]. + * When SVL is less than the architectural maximum, the accessible + * storage is restricted, such that if the SVL is X bytes the guest can + * see only the bottom X elements of zarray[], and only the least + * significant X bytes of each element of the array. (In other words, + * the observable part is always square.) + * + * The ZA storage can also be considered as a set of square tiles of + * elements of different sizes. The mapping from tiles to the ZA array + * is architecturally defined, such that for tiles of elements of esz + * bytes, the Nth row (or "horizontal slice") of tile T is in + * ZA[T + N * esz]. Note that this means that each tile is not contiguous + * in the ZA storage, because its rows are striped through the ZA array. + * + * Because this is so large, keep this toward the end of the reset area, + * to keep the offsets into the rest of the structure smaller. + */ + ARMVectorReg zarray[ARM_MAX_VQ * 16]; #endif #if defined(CONFIG_USER_ONLY) diff --git a/target/arm/machine.c b/target/arm/machine.c index 285e387d2c3..54c5c62433d 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -167,6 +167,39 @@ static const VMStateDescription vmstate_sve = { VMSTATE_END_OF_LIST() } }; + +static const VMStateDescription vmstate_vreg = { + .name = "vreg", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_ARRAY(d, ARMVectorReg, ARM_MAX_VQ * 2), + VMSTATE_END_OF_LIST() + } +}; + +static bool za_needed(void *opaque) +{ + ARMCPU *cpu = opaque; + + /* + * When ZA storage is disabled, its contents are discarded. + * It will be zeroed when ZA storage is re-enabled. + */ + return FIELD_EX64(cpu->env.svcr, SVCR, ZA); +} + +static const VMStateDescription vmstate_za = { + .name = "cpu/sme", + .version_id = 1, + .minimum_version_id = 1, + .needed = za_needed, + .fields = (VMStateField[]) { + VMSTATE_STRUCT_ARRAY(env.zarray, ARMCPU, ARM_MAX_VQ * 16, 0, + vmstate_vreg, ARMVectorReg), + VMSTATE_END_OF_LIST() + } +}; #endif /* AARCH64 */ static bool serror_needed(void *opaque) @@ -884,6 +917,7 @@ const VMStateDescription vmstate_arm_cpu = { &vmstate_m_security, #ifdef TARGET_AARCH64 &vmstate_sve, + &vmstate_za, #endif &vmstate_serror, &vmstate_irq_line_state, From patchwork Mon Jun 27 10:22:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585286 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2958384mab; Mon, 27 Jun 2022 03:43:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vcCJ0j5s2BrO5OoUqBSoNUCU3T8eNsGuxIidLZwJkleblF9uZi1og3OwQ13OicLM6wzZAj X-Received: by 2002:a05:620a:4081:b0:6af:31c6:c1d3 with SMTP id f1-20020a05620a408100b006af31c6c1d3mr1674259qko.733.1656326608693; Mon, 27 Jun 2022 03:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326608; cv=none; d=google.com; s=arc-20160816; b=cZz0BHRiD0SzuelpEuYZ3XfJ9IW4fhoVdxl3+5x3u5JE7R5mw6UbY2r9m9c192LPal GBtYYtNV1NGXdLGkxr1lMpw60fRzo9vL06honBmR9boodHLU/UmCVFRrkAsFz/fMbhU1 +tgaFDn3oLpZ7NJDqy9bnvJSf+HvY3e+Sz/ufUjEASMXqWR45hkC935+C08Q4mc0Toji CVwgBo7m/9D+Mbx8mOYQGFoBu+30TsedU8FZ4wBErCQFYRwomj50eW8jKMrlW4KWzl7c FW8NHSbeK/r3+7VxxvXKweJi3HeDfoQf3JWRJsa9CqI659Pb6SY1qZBpCgb2u6mw8Klq Tglg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=QsvjWMzgsdTwwngS2VVn55eZ7SqtlCnLDP2YP9slkkg=; b=FewDhEwfDuUj/llGEsWmhfzxhni4HzkQpGyxZtAyexWaMzF4Fs50sLhrhl50OvU4FN Yg3abuyH6gVA9LP2fBcPUcSW9SkCJN5YpR/hxPGQg+AqWSQbcw9PgQZEp59+0sZRVLd7 OLOYdmHs1vMcEfCYAOYW9OGamo5SENXsWitjsZW/DOz0tnIVWGE2RgylVh7iJpCpbZgg /yzl96PqYLpYxfOdqFfDndqFsxRyQU44LXRtHV8fGLWkmHzUYU/wz5iuspGrtALj3akz +GKcPQNglGj5c7f+BKi/sTeJvP48xfuao+h197qzxtrRt+v1P9CbskHPoi8zOPOXKfa7 GUgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bzr1+Xx1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d19-20020ac85d93000000b00304fea08485si5661764qtx.747.2022.06.27.03.43.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bzr1+Xx1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mDI-00048t-2b for patch@linaro.org; Mon, 27 Jun 2022 06:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltL-0002M1-Fp for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:51 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:46812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltJ-0004tn-Fi for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:51 -0400 Received: by mail-wm1-x32a.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so5301557wmb.5 for ; Mon, 27 Jun 2022 03:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QsvjWMzgsdTwwngS2VVn55eZ7SqtlCnLDP2YP9slkkg=; b=bzr1+Xx1wurrDhFdJ9L9DWiEFefUF/jXINFuoj4hodQjk6jW4vf8Walb7gS8OY2309 ucEFqNwVBcwYZlZrExu0XSeV3gMmNrjk0i7vLRYtkfA8Avn5YEaR/p9OFeUAwhittWfi vZniXfCF0E6joDIxYfUs8EtGDZZLdzE/OpIa830pAqf5VEkmM68bS6nimq/sqwjOKkll NjKgLGCguD3jbD+lc61o3xJtkCcoUg8uHD3X65hRbnQl5GueK4Xd6XPN1weo3uR5LF23 CTbI0ZY6ZJwmYpjpHq3IS9o9oDdY1EUzMWe8itg+QOtqux25ho0qrtGCcxrgAiP4hAsP RiAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QsvjWMzgsdTwwngS2VVn55eZ7SqtlCnLDP2YP9slkkg=; b=qc3yvv9Vq91etsA0Q+Ou9/XSoKxF1LYSUUIPbUqtptPN637cCW6cCa/mL3Ghs01i3p 0rJosZzBVJuAX2fPA2oUlWiXm42JdzcRoAzJs0vZUp02h7h3J19+S7t5ZiyxZ5sh1c5t pKaGm3MHCdKKZ3ctMW+21YMPdVFyqakaVZomBUGVNzXQQVS6ADZyXH28dnx0nIHgor0N Sn5ZDXmsQB4p0tOwV9F44b4cMixzOZK06pshFiPF2xobAnh/TGu7TM4uwX4J4rdzOF/3 cxQwsmkbk/9kfFFhxxupujbNl2mGSavt/DkTs5bqKN6g2mugHOFHNEu/T5jkfT13eRV8 BcWA== X-Gm-Message-State: AJIora8Z+5+2r/TV3SMbrvC/IfIn6FVH967sBhNfQYmpY2WnU2lcob1k iyfUmUQcXqoSZobS2UoOvc9rBJlDxMm8CA== X-Received: by 2002:a05:600c:1c8d:b0:39c:4db1:5595 with SMTP id k13-20020a05600c1c8d00b0039c4db15595mr18820972wms.175.1656325368097; Mon, 27 Jun 2022 03:22:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/25] target/arm: Implement SMSTART, SMSTOP Date: Mon, 27 Jun 2022 11:22:24 +0100 Message-Id: <20220627102236.3097629-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These two instructions are aliases of MSR (immediate). Use the two helpers to properly implement svcr_write. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-11-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/helper-sme.h | 21 +++++++++++++ target/arm/helper.h | 1 + target/arm/helper.c | 6 ++-- target/arm/sme_helper.c | 61 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 24 +++++++++++++++ target/arm/meson.build | 1 + 7 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 target/arm/helper-sme.h create mode 100644 target/arm/sme_helper.c diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 52ab6f9bb99..5877d76c9f3 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1120,6 +1120,7 @@ void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el, bool el0_a64); void aarch64_add_sve_properties(Object *obj); void aarch64_add_pauth_properties(Object *obj); +void arm_reset_sve_state(CPUARMState *env); /* * SVE registers are encoded in KVM's memory in an endianness-invariant format. diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h new file mode 100644 index 00000000000..3bd48c235f0 --- /dev/null +++ b/target/arm/helper-sme.h @@ -0,0 +1,21 @@ +/* + * AArch64 SME specific helper definitions + * + * Copyright (c) 2022 Linaro, Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32) +DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32) diff --git a/target/arm/helper.h b/target/arm/helper.h index 07d45faf495..3a8ce42ab01 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -1022,6 +1022,7 @@ DEF_HELPER_FLAGS_6(gvec_bfmlal_idx, TCG_CALL_NO_RWG, #ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h" +#include "helper-sme.h" #endif #include "helper-mve.h" diff --git a/target/arm/helper.c b/target/arm/helper.c index e06c054c3d7..88d96f7991f 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6366,9 +6366,9 @@ static CPAccessResult access_esm(CPUARMState *env, const ARMCPRegInfo *ri, static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - value &= R_SVCR_SM_MASK | R_SVCR_ZA_MASK; - /* TODO: Side effects. */ - env->svcr = value; + helper_set_pstate_sm(env, FIELD_EX64(value, SVCR, SM)); + helper_set_pstate_za(env, FIELD_EX64(value, SVCR, ZA)); + arm_rebuild_hflags(env); } static void smcr_write(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c new file mode 100644 index 00000000000..b2157255943 --- /dev/null +++ b/target/arm/sme_helper.c @@ -0,0 +1,61 @@ +/* + * ARM SME Operations + * + * Copyright (c) 2022 Linaro, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "internals.h" +#include "exec/helper-proto.h" + +/* ResetSVEState */ +void arm_reset_sve_state(CPUARMState *env) +{ + memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); + /* Recall that FFR is stored as pregs[16]. */ + memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); + vfp_set_fpcr(env, 0x0800009f); +} + +void helper_set_pstate_sm(CPUARMState *env, uint32_t i) +{ + if (i == FIELD_EX64(env->svcr, SVCR, SM)) { + return; + } + env->svcr ^= R_SVCR_SM_MASK; + arm_reset_sve_state(env); +} + +void helper_set_pstate_za(CPUARMState *env, uint32_t i) +{ + if (i == FIELD_EX64(env->svcr, SVCR, ZA)) { + return; + } + env->svcr ^= R_SVCR_ZA_MASK; + + /* + * ResetSMEState. + * + * SetPSTATE_ZA zeros on enable and disable. We can zero this only + * on enable: while disabled, the storage is inaccessible and the + * value does not matter. We're not saving the storage in vmstate + * when disabled either. + */ + if (i) { + memset(env->zarray, 0, sizeof(env->zarray)); + } +} diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 5cf4a283bac..c050ebe0053 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1762,6 +1762,30 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } break; + case 0x1b: /* SVCR* */ + if (!dc_isar_feature(aa64_sme, s) || crm < 2 || crm > 7) { + goto do_unallocated; + } + if (sme_access_check(s)) { + bool i = crm & 1; + bool changed = false; + + if ((crm & 2) && i != s->pstate_sm) { + gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i)); + changed = true; + } + if ((crm & 4) && i != s->pstate_za) { + gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i)); + changed = true; + } + if (changed) { + gen_rebuild_hflags(s); + } else { + s->base.is_jmp = DISAS_NEXT; + } + } + break; + default: do_unallocated: unallocated_encoding(s); diff --git a/target/arm/meson.build b/target/arm/meson.build index ac571fc45db..43dc6005478 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -47,6 +47,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'mte_helper.c', 'pauth_helper.c', 'sve_helper.c', + 'sme_helper.c', 'translate-a64.c', 'translate-sve.c', )) From patchwork Mon Jun 27 10:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585291 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2962558mab; Mon, 27 Jun 2022 03:50:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vxlX7l7WEHqoaRajqp44rx1kiBEzj2Nws7xqTlvzhR1sczaIqCoGY0SpUGvNH6Kh14Dach X-Received: by 2002:a37:6841:0:b0:6ae:eb59:7fa with SMTP id d62-20020a376841000000b006aeeb5907famr7245031qkc.37.1656327007325; Mon, 27 Jun 2022 03:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327007; cv=none; d=google.com; s=arc-20160816; b=VEOXoByLy+CQ5uJn1G2gpuGTopvBQv+hs931tBjkOhLmecYqfIpA5q6sV4wytRSOpX WRjTKlwdepT/AeGZfk39bhQXQRXyqEP3ReYJIqVTrRZqvh4Tzb8ULuFztjklPJ2Ih+1b Kkoquma82N7VlosmQmdq6ui6HDJwJyxlVaUgWDOddWThBwMnhN5DSMyi68CA83rHwrqt 197ra5owO7pnWNayQuDi8SPdaseog/W0YQfJagCocQewXky60nRWBk5vUl7Jr6NqC/n6 IpQd6fMFSUXU+F7KJZ1zL5emEncdB5zIwf7MBpzHuuzdRyk8PGNWroPmccyT/Ub5T9X+ BQ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=3IGOCsty5CkSzsrEjkN+pqZJ0VKeRGXGjb/wc7qfDxw=; b=V8mL+SenqET0pKoQG8h5SBJ8Hr5yrJrFj7G2Zsf3nZXr9JFXDdd4u4noituU2fCxvy Ns0u3I5YTSl/Ck3SjAVSvWiVVnOz2XllhSf5doPwLtpB0c8n94F5mZy34G+Pak5dGQUl nBXZHbI+qf3AEM8w1TKIXh/PLnpaNwaX/AICIfXXp2LstQ7U3PIk0WFAK07ODdX+VYaR ota2oiruquvBnC/IB/CQahAJZYqTuCQSWpkROyGIbh0vGXW/BiFobswpkuAoksksCD6r hJYe6NmB89Te3pgi5+yAGD6EUbrQV4tLX6wqQ7BR4M3ZWPlgfsth50CuevMOFY/kGDEi QZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lZCW7LQp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ed8-20020ad44ea8000000b00470aa2dbe82si2918993qvb.170.2022.06.27.03.50.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:50:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lZCW7LQp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mJi-00054H-SS for patch@linaro.org; Mon, 27 Jun 2022 06:50:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltM-0002NT-Pb for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:43947) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltK-0004uD-5X for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:52 -0400 Received: by mail-wm1-x32a.google.com with SMTP id u12-20020a05600c210c00b003a02b16d2b8so5320183wml.2 for ; Mon, 27 Jun 2022 03:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3IGOCsty5CkSzsrEjkN+pqZJ0VKeRGXGjb/wc7qfDxw=; b=lZCW7LQpoj4VWxc4zFfbKKYf2Hp3eclLg3Okg0RrW9+J5W7HjZje8ABYS+BAZ08iOG UKkJt1PBzPBK0pfrfbzMPvUT1BuxfV8DkkKqeA0AQuGywf1G8DJu/mVSQlQi76lcDQiB tZqX2salNfVpdMzxUySEaQEooMhSq/srD+lil+SvHkrtcOYBlAcjNUQrsHs/4pGR2ZHf +MHZ0aIsJbURwJahsqwqxv5ksTKZlO1oS5IfcIGnuYvbqiGKfMeSz6zdt7A7EdSoFbrc Vs2aZYvq6CWhV9UsXYMb1rhJ1kcK0mPC1VUa92d6uQeLyQJNL+N0gHI0C2OdlBti8qpW toPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3IGOCsty5CkSzsrEjkN+pqZJ0VKeRGXGjb/wc7qfDxw=; b=27UVUaHEa9OnxN5tWBZnY+lAib/JGaXAQ+FRdzEWkN0a0gjkqB/kF4EJQjC+WlYDCS uBCDDfqvkHXqJbADDcH+k6EVjrpjMHxA0JpswxdMQw8vO0c/XZet4CfWfXjUa/2ZaVYT Hlf8kZpRZaDIQxQ24TI+2fwMkCdvI2mkmJnnhWVPUKjA4A0aP3EhkRFYjJrx7hE8pxjN ekSJgWBRsv8UbB+NCx+jFxtuPKWfka5S6ghtvOh9K571PzhkZ7GsQPt8t3T91YPqJElq CW0kpMlMOixx1DH4mza/xAQ+gBQ6OwwQmtgSGvjY7HtAigSKRXIv18vKpkDfC5Efusj9 favQ== X-Gm-Message-State: AJIora807J7L2A/0zm83060OR/dPvEDgmm7d3JJOakKSi84RMCgO7it/ ZBVvMlmsyO69GuhA8SOQTWgkhKmyW7DLeA== X-Received: by 2002:a05:600c:3543:b0:3a0:2a72:e4d2 with SMTP id i3-20020a05600c354300b003a02a72e4d2mr19817232wmq.58.1656325368811; Mon, 27 Jun 2022 03:22:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/25] target/arm: Move error for sve%d property to arm_cpu_sve_finalize Date: Mon, 27 Jun 2022 11:22:25 +0100 Message-Id: <20220627102236.3097629-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Keep all of the error messages together. This does mean that when setting many sve length properties we'll only generate one error, but we only really need one. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu64.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 15665c962b2..a46e40f4f2f 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -487,8 +487,13 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) "using only sve properties.\n"); } else { error_setg(errp, "cannot enable sve%d", vq * 128); - error_append_hint(errp, "This CPU does not support " - "the vector length %d-bits.\n", vq * 128); + if (vq_supported) { + error_append_hint(errp, "This CPU does not support " + "the vector length %d-bits.\n", vq * 128); + } else { + error_append_hint(errp, "SVE not supported by KVM " + "on this host\n"); + } } return; } else { @@ -606,12 +611,6 @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, return; } - if (value && kvm_enabled() && !kvm_arm_sve_supported()) { - error_setg(errp, "cannot enable %s", name); - error_append_hint(errp, "SVE not supported by KVM on this host\n"); - return; - } - cpu->sve_vq_map = deposit32(cpu->sve_vq_map, vq - 1, 1, value); cpu->sve_vq_init |= 1 << (vq - 1); } From patchwork Mon Jun 27 10:22:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585294 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2965127mab; Mon, 27 Jun 2022 03:54:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vSoaxx8DdpaVER7nNpdOXWQ1ZpuTp64tlHI096orQwH6bXBSJMGgbhTVwZMXg2ogsNAqZN X-Received: by 2002:ac8:7fc2:0:b0:318:291d:8f55 with SMTP id b2-20020ac87fc2000000b00318291d8f55mr8325511qtk.572.1656327269193; Mon, 27 Jun 2022 03:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327269; cv=none; d=google.com; s=arc-20160816; b=DbvV+3S6i+g/UBYdl8tg02UZNtj28nWbl71ZrwFa7Ge4d+CCDg53KocbuICnYaKMqP MlmLe3OUTd8+jbyeq0zUiNyUzTFPR9zKtOpiyWTQJdv6Te8L9EujnTJ0b+leru8l6LeE TV3h42c+glta3gBFSpEsSKjzxOAsvNnxnM03kpRSKv/yqQMohRBeKdMoOcW6RzJeJBc+ /EJDD9rxFTGc3EPRjqOhKfFZaHv8AvW++BgM76Ll/gsXOi9lj9126/kqGVmd1FsctZAn Ne7ZzUoYMH+sn9hLUoCcrb1Fpod2wItJnb6V29G8LNjWBeaLvVbAAMQqzJMWlj69R2LH 5ukA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=uCqueGyB/e9yJmQM42J3hsPjGiFeEwWKUsOZsn3m4SQ=; b=E4regx0j5LCeKaU0SgtwLvRdChdPI7blCO5Oa1V4S/sR/+pY/Lg2XZsuO16LLHebHb MGvk36ELn/Cq9hNIN9/vtuPgOYs1N8E6mn3McfRk/Dx1jYkwpqrF2P908JgdJbwAz5vF HwYVFPkhgUeGAl/ks9UWB3kfcN+UKxWM8yjSz3ODPVYWhUXhfJeNXrq42iazRSslCtSo F/o5LOMCE6PoPKTUuMrWgoXCkxx8mht3MOT+pBRn2TAi1DMXvdB7I11D93fQL4xHZYRs bOYIKeyo+w+u5zRPZzXofHXIYACeg5PkRQTkkyykFZkKLYYeb31NB66nKwU5EM/4BGnu +7bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dD3yBiwx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a10-20020a05622a02ca00b002f93b396295si5567897qtx.763.2022.06.27.03.54.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dD3yBiwx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mNw-0003N9-P2 for patch@linaro.org; Mon, 27 Jun 2022 06:54:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltN-0002Nj-6h for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:41617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltL-0004ub-3R for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:52 -0400 Received: by mail-wm1-x32e.google.com with SMTP id t17-20020a1c7711000000b003a0434b0af7so2785118wmi.0 for ; Mon, 27 Jun 2022 03:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uCqueGyB/e9yJmQM42J3hsPjGiFeEwWKUsOZsn3m4SQ=; b=dD3yBiwxqvDpwI6Ez7l4RdiRp1MnZNYG81+/CIMKu+e2ud8LtjqjUafS+xv1dq13Q5 6PVVS0a69orS7LJ3rQWsdspXbnYoD7+SoHlIm8GUdC1+r+3r5HghmLKB0LH8/Odgbdge bYgukFCysgV8xnT+EchKwiUsWjlkErGFa4wdXancw5uK3Hay6lLIBWVqlEoFiNKlH1eD 1j8jlQV61HQL13GL5v5Wpb0kHDQGNUR023QFLdzQ6NCkYk1nB8jTeBdjM9LfGTIJiX5p hZMlQreOdj1PnRn0RXhcl/+N/9WgHWhvDOXDWAzIjrFVZngZ8u4ZtQ9PMyp1/QFRfMJS 1RIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uCqueGyB/e9yJmQM42J3hsPjGiFeEwWKUsOZsn3m4SQ=; b=s7ZZa+8J8M5B6iOBV6MbX6bKRAEc9eJSN2gc/oVl5Z1Bruko2mY+pQ3KBBnJxBDRwF ppQwpJ99DqgtxN46gtHJo6zTR4ZgTXmfaV7p6f28QfOF1sntwwgqpMcAgNalZBrJvYc0 EAfk6JiDVILaCxSQNSX4yKSzeaoulJqq1D8pWdDQRxjVg+L7JNuCXwkBPlWytgUnDzDI pedNKcxlKoNv0cu2EY8ZfUEPsXiI+bbR21csXRphIcPcBLY+FaOhAbOufNNhC7ZOJelV 2tkl1Gk70IGsfiYmzHsnu2G+MguW07PK6H6vqYVl37lb/OPmUvdmxZrA2iITVr30d3+6 xSAw== X-Gm-Message-State: AJIora+H0R5dZExi9LZxwTQcsIS/Hn/F/P7hfKulEi+6dGwc/qdRepaj UbAM6WIgHN7CbR7uTpg6/RdwDFPYYbpoVg== X-Received: by 2002:a05:600c:3592:b0:3a0:4c17:5ec1 with SMTP id p18-20020a05600c359200b003a04c175ec1mr3175875wmq.4.1656325369671; Mon, 27 Jun 2022 03:22:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/25] target/arm: Create ARMVQMap Date: Mon, 27 Jun 2022 11:22:26 +0100 Message-Id: <20220627102236.3097629-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Pull the three sve_vq_* values into a structure. This will be reused for SME. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-13-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 29 ++++++++++++++--------------- target/arm/cpu64.c | 22 +++++++++++----------- target/arm/helper.c | 2 +- target/arm/kvm64.c | 2 +- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 5877d76c9f3..2ce47f8d29f 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -807,6 +807,19 @@ typedef enum ARMPSCIState { typedef struct ARMISARegisters ARMISARegisters; +/* + * In map, each set bit is a supported vector length of (bit-number + 1) * 16 + * bytes, i.e. each bit number + 1 is the vector length in quadwords. + * + * While processing properties during initialization, corresponding init bits + * are set for bits in sve_vq_map that have been set by properties. + * + * Bits set in supported represent valid vector lengths for the CPU type. + */ +typedef struct { + uint32_t map, init, supported; +} ARMVQMap; + /** * ARMCPU: * @env: #CPUARMState @@ -1055,21 +1068,7 @@ struct ArchCPU { uint32_t sve_default_vq; #endif - /* - * In sve_vq_map each set bit is a supported vector length of - * (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector - * length in quadwords. - * - * While processing properties during initialization, corresponding - * sve_vq_init bits are set for bits in sve_vq_map that have been - * set by properties. - * - * Bits set in sve_vq_supported represent valid vector lengths for - * the CPU type. - */ - uint32_t sve_vq_map; - uint32_t sve_vq_init; - uint32_t sve_vq_supported; + ARMVQMap sve_vq; /* Generic timer counter frequency, in Hz */ uint64_t gt_cntfrq_hz; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index a46e40f4f2f..cadc401c7e0 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -355,8 +355,8 @@ 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. */ - uint32_t vq_map = cpu->sve_vq_map; - uint32_t vq_init = cpu->sve_vq_init; + uint32_t vq_map = cpu->sve_vq.map; + uint32_t vq_init = cpu->sve_vq.init; uint32_t vq_supported; uint32_t vq_mask = 0; uint32_t tmp, vq, max_vq = 0; @@ -369,14 +369,14 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) */ if (kvm_enabled()) { if (kvm_arm_sve_supported()) { - cpu->sve_vq_supported = kvm_arm_sve_get_vls(CPU(cpu)); - vq_supported = cpu->sve_vq_supported; + cpu->sve_vq.supported = kvm_arm_sve_get_vls(CPU(cpu)); + vq_supported = cpu->sve_vq.supported; } else { assert(!cpu_isar_feature(aa64_sve, cpu)); vq_supported = 0; } } else { - vq_supported = cpu->sve_vq_supported; + vq_supported = cpu->sve_vq.supported; } /* @@ -534,7 +534,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) /* From now on sve_max_vq is the actual maximum supported length. */ cpu->sve_max_vq = max_vq; - cpu->sve_vq_map = vq_map; + cpu->sve_vq.map = vq_map; } static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name, @@ -595,7 +595,7 @@ static void cpu_arm_get_sve_vq(Object *obj, Visitor *v, const char *name, if (!cpu_isar_feature(aa64_sve, cpu)) { value = false; } else { - value = extract32(cpu->sve_vq_map, vq - 1, 1); + value = extract32(cpu->sve_vq.map, vq - 1, 1); } visit_type_bool(v, name, &value, errp); } @@ -611,8 +611,8 @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, return; } - cpu->sve_vq_map = deposit32(cpu->sve_vq_map, vq - 1, 1, value); - cpu->sve_vq_init |= 1 << (vq - 1); + cpu->sve_vq.map = deposit32(cpu->sve_vq.map, vq - 1, 1, value); + cpu->sve_vq.init |= 1 << (vq - 1); } static bool cpu_arm_get_sve(Object *obj, Error **errp) @@ -974,7 +974,7 @@ static void aarch64_max_initfn(Object *obj) cpu->dcz_blocksize = 7; /* 512 bytes */ #endif - cpu->sve_vq_supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ); + cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ); aarch64_add_pauth_properties(obj); aarch64_add_sve_properties(obj); @@ -1023,7 +1023,7 @@ static void aarch64_a64fx_initfn(Object *obj) /* The A64FX supports only 128, 256 and 512 bit vector lengths */ aarch64_add_sve_properties(obj); - cpu->sve_vq_supported = (1 << 0) /* 128bit */ + cpu->sve_vq.supported = (1 << 0) /* 128bit */ | (1 << 1) /* 256bit */ | (1 << 3); /* 512bit */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 88d96f7991f..a80ca461e53 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6287,7 +6287,7 @@ uint32_t sve_vqm1_for_el(CPUARMState *env, int el) len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[3]); } - len = 31 - clz32(cpu->sve_vq_map & MAKE_64BIT_MASK(0, len + 1)); + len = 31 - clz32(cpu->sve_vq.map & MAKE_64BIT_MASK(0, len + 1)); return len; } diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index ff8f65da22f..d16d4ea2500 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -820,7 +820,7 @@ uint32_t kvm_arm_sve_get_vls(CPUState *cs) static int kvm_arm_sve_set_vls(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); - uint64_t vls[KVM_ARM64_SVE_VLS_WORDS] = { cpu->sve_vq_map }; + uint64_t vls[KVM_ARM64_SVE_VLS_WORDS] = { cpu->sve_vq.map }; struct kvm_one_reg reg = { .id = KVM_REG_ARM64_SVE_VLS, .addr = (uint64_t)&vls[0], From patchwork Mon Jun 27 10:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585293 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2964234mab; Mon, 27 Jun 2022 03:52:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1taOFkNCTzBO8I9rxVY+RuwWehalHC4eKNKPBp45+C1hwSICoRq/0k8P9ELRvfh8FAtjXWz X-Received: by 2002:a37:6453:0:b0:6ae:e740:92c1 with SMTP id y80-20020a376453000000b006aee74092c1mr7222671qkb.174.1656327169273; Mon, 27 Jun 2022 03:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327169; cv=none; d=google.com; s=arc-20160816; b=KuWaskCvjWXZ+UbUHxM0ib3z3P3XTZ2cQoLdiAfumItSlUByK7LRIoJt9lSBUz19Rf wUIZf34SUo7dKA8IEkOF5gFLrLuMrsk2ZL7HpTMDANhabtw1xn+3dvEmGkPWpNPqgBr0 bWOdLHhKf1WBJwmlIpJytnar8AEPWNblQZteTYnKUUId6teou8UEF+7/W7ZJdBztzE3c aTw+ZDibjU2B9ITWd9QbktlMZV0AWiiaaUh5itT/huwVslqAKQ4TzPDS17j88zbKqE1A 1jiZDl1qouuOJuES4NIx4FmgGas8ywoabR9jH8OXpm0Hvkg9zRJ4HZU/lMsdb6RHHXUw Ep9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=YXCaAkUvHPYJs8/UPRqGbeUcr38m+MRpEiyfDOsqhAg=; b=Fv4oFERh2uhDL75fuQhiMx4a3ckoLqmXp5QQPd3mVQqQBfIMoi2fBhfRWvuijpFO59 E70rpfenFy747om0Wa/u9+d5x9y6SuUe8TRik1duv7ZVIFYMcWaQzq1IxHOjQt0zKUAo k3F2qa8JcChTzs88KWNx845mbXV4GRLl/nGMABG8/CgMw2pzREXQNFhoHB1YSvils53x k23ECCIXnNxs+v2/G0ucdOdh0IM//VSYvR9n8fI9PW7pFuurYkrClvit43nKlIyN3BIb +mdj3lxnETI0fWhbKWGoJ3uIpk5UoZCdCxIoda0c6Me0f0fC8M33ARO+kOk1BBAH7/ZO PpuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hPQEZcFa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id im10-20020a056214246a00b0047059799e9bsi5870131qvb.70.2022.06.27.03.52.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:52:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hPQEZcFa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mMK-0000D2-Oa for patch@linaro.org; Mon, 27 Jun 2022 06:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltN-0002Nl-Mm for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:53879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltL-0004ul-O6 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:53 -0400 Received: by mail-wm1-x329.google.com with SMTP id l68so66802wml.3 for ; Mon, 27 Jun 2022 03:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YXCaAkUvHPYJs8/UPRqGbeUcr38m+MRpEiyfDOsqhAg=; b=hPQEZcFau4t9PdThcg3XH4HzA/rLQUsUCY4XWR2tUeyhydtPskFjUy3tGav9RvFnEK jLBa7xBN/3ngwon1n7R3ITtFuZdxGVGKketWEqudLnW7VxGribQHf0lAjVjo8GYyh6nj 8aBvvA1A9di97Yg+goPnE8A/uCSIZR6e7xW8oo1gUIy97xebmeHfOYBYGQ4VLQnoFnI4 Y+g4pGf+Hc4i/IcfRnnRsT8o54hk8lKE92cdqcY4sdQBMjrZYBCip+2oDCtiX0kCyJ0V +wpbVgBFabqg+nkXj/FXrL2kiVtpPPl95WYptG8hB2R0EoWuJxRuYJa3uSv0YTN3gZZz bpSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YXCaAkUvHPYJs8/UPRqGbeUcr38m+MRpEiyfDOsqhAg=; b=YFzkovVfaH1s8GYVqyHL+OW7jB2n0vFqAlpUK7Ug3Qk3Eb4WQaqgiRpgzmUvkCHq50 /Vgv45bdF6BvQya6xBV0PRY8mBh36GZCkr0/qUV0wXyFPNj1g9HmR5PbUzAiUMqfLilS nEkkjtFrR6pFKjeJCyVQhWq0I9RpuecToMWexjM1GkI1Rnt6MXSCKnjpd7xo+BpPdS+m 2VHfEcncwAbfBcy/BDd5H63XXRMxHneSXFrGzCMz7uJfXUbgWYiSFvYMTn20ErZEdoGz PONVqSxpecDOAczrfPnQxZgkkOa9hUKsjL4GgtKkH8mu9OLm2dyajTCaBVV15MUPz0Wb +bkg== X-Gm-Message-State: AJIora8rkX7qz+o1I8LYCoXeGgduECmrXhAp+h9/BUw/wMJjfNNAtWW0 G0mt67zwJmFmaIvLuRdzWeHTkgZl0ZiP/g== X-Received: by 2002:a05:600c:3d9a:b0:3a0:3aad:b1f2 with SMTP id bi26-20020a05600c3d9a00b003a03aadb1f2mr19420913wmb.138.1656325370360; Mon, 27 Jun 2022 03:22:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/25] target/arm: Generalize cpu_arm_{get,set}_vq Date: Mon, 27 Jun 2022 11:22:27 +0100 Message-Id: <20220627102236.3097629-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Rename from cpu_arm_{get,set}_sve_vq, and take the ARMVQMap as the opaque parameter. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-14-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu64.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index cadc401c7e0..1a3cb953bf0 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -579,15 +579,15 @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, } /* - * Note that cpu_arm_get/set_sve_vq cannot use the simpler - * object_property_add_bool interface because they make use - * of the contents of "name" to determine which bit on which - * to operate. + * Note that cpu_arm_{get,set}_vq cannot use the simpler + * object_property_add_bool interface because they make use of the + * contents of "name" to determine which bit on which to operate. */ -static void cpu_arm_get_sve_vq(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void cpu_arm_get_vq(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { ARMCPU *cpu = ARM_CPU(obj); + ARMVQMap *vq_map = opaque; uint32_t vq = atoi(&name[3]) / 128; bool value; @@ -595,15 +595,15 @@ static void cpu_arm_get_sve_vq(Object *obj, Visitor *v, const char *name, if (!cpu_isar_feature(aa64_sve, cpu)) { value = false; } else { - value = extract32(cpu->sve_vq.map, vq - 1, 1); + value = extract32(vq_map->map, vq - 1, 1); } visit_type_bool(v, name, &value, errp); } -static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void cpu_arm_set_vq(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { - ARMCPU *cpu = ARM_CPU(obj); + ARMVQMap *vq_map = opaque; uint32_t vq = atoi(&name[3]) / 128; bool value; @@ -611,8 +611,8 @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, return; } - cpu->sve_vq.map = deposit32(cpu->sve_vq.map, vq - 1, 1, value); - cpu->sve_vq.init |= 1 << (vq - 1); + vq_map->map = deposit32(vq_map->map, vq - 1, 1, value); + vq_map->init |= 1 << (vq - 1); } static bool cpu_arm_get_sve(Object *obj, Error **errp) @@ -691,6 +691,7 @@ static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v, void aarch64_add_sve_properties(Object *obj) { + ARMCPU *cpu = ARM_CPU(obj); uint32_t vq; object_property_add_bool(obj, "sve", cpu_arm_get_sve, cpu_arm_set_sve); @@ -698,8 +699,8 @@ void aarch64_add_sve_properties(Object *obj) for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { char name[8]; sprintf(name, "sve%d", vq * 128); - object_property_add(obj, name, "bool", cpu_arm_get_sve_vq, - cpu_arm_set_sve_vq, NULL, NULL); + object_property_add(obj, name, "bool", cpu_arm_get_vq, + cpu_arm_set_vq, NULL, &cpu->sve_vq); } #ifdef CONFIG_USER_ONLY From patchwork Mon Jun 27 10:22:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585282 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2955142mab; Mon, 27 Jun 2022 03:38:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sFRoS3BQw8nZ5YP5Ej6/uaVISkmH5am60aMXteGFOZZDb9Avg8TxwNiF1MdLBzz6HhIK8e X-Received: by 2002:a05:622a:1a21:b0:2f1:f29e:40a with SMTP id f33-20020a05622a1a2100b002f1f29e040amr8665336qtb.235.1656326313541; Mon, 27 Jun 2022 03:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326313; cv=none; d=google.com; s=arc-20160816; b=JmMU5ymMD5wggreKtKZi8YQRQkvbW4vlYS87VnyM6cYhtaVwDs2J+qLuXn/eqmoU16 1fDsmsT2I7WbGQ/NI1j+Sv1XFvXnXMLp9GOL6TaawL79578mxO/pvSqcQPDYiphmNXpE sT76m8cn+jES//sxtlqSlGIojlx6SjuQ8eF0efPr8vBrMzbMhi4DEqSxOo/gQaPvylU4 uOU0kjZWZxX81YK+5fEkZie3wai4cLY98ym5dwV17RfXfrRJE8JGLd/LHqZVXsPQ/ekV muiFqdGgmYG27r4WQaLRiFuRjCx71u+CYqo4vHCcm+pLxwtyd+HFpWn95/qdtSc0SeOm 0eLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=SSW/9q08rUws37xTPG8UfI9QgtPGrD6IO9sQdb0NX2k=; b=ENhfxa2ZSbOvRkzRSoT3hO8gBid13HFXTLMIKIldRlFvVg8cgmurM3SqthZqyDt8Ok SYzesrpSx7oZEwbJRnSYt54YZ7+b3NNBInkpUQlDGMcE/2eQjvrOp1lRzbcig3CwtxdE K5aUhBHcuT0nJAat9vnAnACXmn20qYar+uise6ZQQ/BMnytDEhOpGbOcATEht/Wl0LW1 E73ibq9ESgFY5lmGUs+5/z8fFv/twHtDI+GmkPjIKTymPMqiEqmJ7h8YtKCDaiov1zCn 9dC3lquNFQQB99z2udQCehIdB7Dz1sOmBfa4Z/Hg8LlMZXDVZ3LjuTNowcUVq6jauUwb o2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W2yxR1xc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q10-20020a05621419ea00b004644918d50bsi5536405qvc.148.2022.06.27.03.38.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:38:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W2yxR1xc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m8X-0003me-5K for patch@linaro.org; Mon, 27 Jun 2022 06:38:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltO-0002No-Dr for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:56003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltM-0004vI-HQ for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: by mail-wm1-x32c.google.com with SMTP id f190so4817752wma.5 for ; Mon, 27 Jun 2022 03:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SSW/9q08rUws37xTPG8UfI9QgtPGrD6IO9sQdb0NX2k=; b=W2yxR1xch57VBaguafQmmfs2c0p4WG86/NpcjpWAEonP+E+ANG2pZkAYWWsz/Lgqz4 ly9Qeiloc5fNLus41ynZaDyx6WRN/6hP9Nj/h8Z6m8xcZQJxu+eoExzhITbPok+1jNNX 1L1RMiECDqcfshV1vQzzulYj4HQKS8/umpZoVqpPViM3bMvmzd8qtI4ZlEbLfLp35Wyz kFVhd5EXaxhI7sYFpFfIUk29kPvN5KnGPVm9XF9PfEyXIN9gBCNTfT5xQm5+WMmFOHFV ujVa31Z+cTkui86vRcqCXbkVuwXnIm87bRFIoYbkCZp0LyVqMeyJrPWRjJaPqXpJFRnk Q/4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SSW/9q08rUws37xTPG8UfI9QgtPGrD6IO9sQdb0NX2k=; b=M15ceqolUqA3Ekn0CF5f0BtY4AmUVUc+O0DtPj/Z6Z+i21n7OARvfh02CrJAkOVB9O sZ/P9QND+AqzMaipgzO8ENv7Hqk187pYXBmnALX5yZHt5WZheKuS5wJYhLPpFDnY4yb/ sFrgya5QOoxn5g7sN+z129WLRn5+rMFCmfleX6xQnJTC9j++KM+DNj7UPXgvwGeFHoIg tsTwkXBIiU/f1UVmewgWS2TXz6BdhvFig+Bts9OAI0zknCwojGTeHM9Q4zD+WtwGZr59 CmLuTtYafipsNXOg0GOr75sTzOFwGpLjkg66O9ZC8il3UB7kEugksqj1I+nMLjNBXFJA bz1A== X-Gm-Message-State: AJIora8gdMWDcXA6EOHLR/hc6azfPPieHpru25stUhemn7uXB2JEYcI3 rkg0EZdzn65d0GrHmXkH2ffJIWGB+T7LNQ== X-Received: by 2002:a05:600c:41d1:b0:3a0:301d:f75f with SMTP id t17-20020a05600c41d100b003a0301df75fmr19693095wmh.31.1656325371096; Mon, 27 Jun 2022 03:22:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/25] target/arm: Generalize cpu_arm_{get, set}_default_vec_len Date: Mon, 27 Jun 2022 11:22:28 +0100 Message-Id: <20220627102236.3097629-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Rename from cpu_arm_{get,set}_sve_default_vec_len, and take the pointer to default_vq from opaque. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu64.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 1a3cb953bf0..b15a0d398ad 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -638,11 +638,11 @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) #ifdef CONFIG_USER_ONLY /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ -static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) { - ARMCPU *cpu = ARM_CPU(obj); + uint32_t *ptr_default_vq = opaque; int32_t default_len, default_vq, remainder; if (!visit_type_int32(v, name, &default_len, errp)) { @@ -651,7 +651,7 @@ static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, /* Undocumented, but the kernel allows -1 to indicate "maximum". */ if (default_len == -1) { - cpu->sve_default_vq = ARM_MAX_VQ; + *ptr_default_vq = ARM_MAX_VQ; return; } @@ -675,15 +675,15 @@ static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, return; } - cpu->sve_default_vq = default_vq; + *ptr_default_vq = default_vq; } -static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) +static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) { - ARMCPU *cpu = ARM_CPU(obj); - int32_t value = cpu->sve_default_vq * 16; + uint32_t *ptr_default_vq = opaque; + int32_t value = *ptr_default_vq * 16; visit_type_int32(v, name, &value, errp); } @@ -706,8 +706,9 @@ void aarch64_add_sve_properties(Object *obj) #ifdef CONFIG_USER_ONLY /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ object_property_add(obj, "sve-default-vector-length", "int32", - cpu_arm_get_sve_default_vec_len, - cpu_arm_set_sve_default_vec_len, NULL, NULL); + cpu_arm_get_default_vec_len, + cpu_arm_set_default_vec_len, NULL, + &cpu->sve_default_vq); #endif } From patchwork Mon Jun 27 10:22:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585281 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2955062mab; Mon, 27 Jun 2022 03:38:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t8lnX0xKGWk+wMXky+i63D5j3wXPfzK1gehsG9syObzbRle7DEVOll0cIpzNOMqQmPLr58 X-Received: by 2002:ac8:5811:0:b0:305:235:9249 with SMTP id g17-20020ac85811000000b0030502359249mr8391473qtg.574.1656326306443; Mon, 27 Jun 2022 03:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326306; cv=none; d=google.com; s=arc-20160816; b=eS7XGLFw1sDJXL5Keu6DroQtKAU0nOXlhltiwFJU/w0uIdJdq4nQinXAFadEMs0TDD dbHjvo22e/mLhxYy8Vwn6RDWk2tUKkzGCISrkQa3r5MwFKh5UwR6KRUxCDGsELn+lwtb FE2Y2LMZo1KHdj7Yt3P68Uc2OEHi5VTYj0uVW+aV4ef1GaJlrcC9qm2DJyYDickt89s0 rzCLPQxvO4MvjSyEnjxqPuAtClW5D0XanGNpIfvvh4pAZMJV+xHEr2DXNzW4y1uR9Zqh BT62RWkYXHU1Ktse9JGWkvmn74yx8eG7fh4MRLRb9az/J5QmJpKt1+rHvM05U2M8xdtY l1CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=qQ9xMY+fBwqOtzYbC4O5Fev27/fyhXhJftbNfnRNex0=; b=DfQqjLewgDBb/bvaFkpd0ifrjtIwQSL1fjHmCvO9QkmYG2VG7pxIiK8NQE+/l/rzv1 8UJEBtIhf4NmJTprrI53Nxhok3Ya/4BJiIQunPSYR3/okOdHnwxukK1J3TUtNeaoOTeb KUQNoI0myP4f4x8KT1xBEMDZUuPwnmxdSsColkGeQdpmoO+KJcviHwHlCdb7xmamJ0en Xzr11CGfSFyDDy0vcXtOUJ4rj18WpdNgKk2k2tFHrf3rtBfg07bXba9yeKRoEtk3sQL5 iRGD6j7GkxPiQ/uMUW5cLSdmP2aOpCX4cUSX4cd5TQX0BX+qexTOR/p7zrJpnNAoVdnx hWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MFei5Lb2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r3-20020a0562140c4300b00470a4d7b4e0si4498484qvj.139.2022.06.27.03.38.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MFei5Lb2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5m8Q-0003Pk-0O for patch@linaro.org; Mon, 27 Jun 2022 06:38:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltO-0002Nn-5b for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:44576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltM-0004sY-Gt for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:53 -0400 Received: by mail-wm1-x32a.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so1319529wmb.3 for ; Mon, 27 Jun 2022 03:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qQ9xMY+fBwqOtzYbC4O5Fev27/fyhXhJftbNfnRNex0=; b=MFei5Lb2ysYgFDN2S+smEI1uvZB7d1NJlax1CdPZF2mlcKyvYTK47JjxfCgd00m2Pu lIMNpOUk+xBlDP8SKsWW6a2ZQ1vVbVKpJh+FP//azhN66T6rFZBGUrsGYkszZ7bG3QRD /pK3J6xmItjlzuqTfKskpYBnl9AQ02CoTFZEtNOhSJ9TCiCFYoVWKmQZHO9zHdiWV195 5cTNLVtYVpqw76woWMRFv+2aK6Tk9256/MnTOCzfBl0yci/iC68zKf6C1EkZUu41JNJK PGo7uyfDD0mbsJqa6YP3mCYLA7bs3WXNzsDM9uVCovjW0HbDwcmKmuM76arRdc9pEFOf BTiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qQ9xMY+fBwqOtzYbC4O5Fev27/fyhXhJftbNfnRNex0=; b=hhnXehMfihg2X4ja54q62XYzod2lvwndRqw07FbbycK4L2hq2Fn4AVCHLfiFczJgQT 063ZR1saYNOf9E5BTGb0TaTI4tuZU7MQ7CqxbrbB+5VZM6KRLWB9iVXOdDOPrtAxuTFA uSjjKSMgCdYnXKrmVlS8OgTr8a2z8HIgyWvPNy9S1Rx3/2DNIw0D5UG8iMzQ3Y5k1xE/ ntXOlHqSfLcwvKsx3Dj1+9s29OUvKTMJLG9tlEGjPjFNsygcKWCTjovKXdRKvSetGp0T S5LQxCmcUEzzDcArU+USI/Ulc1kZLtn3ySzRHNU8O1T5NuXJKcTOcPpjap/qqOjW00/h vvyw== X-Gm-Message-State: AJIora/PLPA1LwhIVidOGYjtWx9DVxQFrF00UcjrubBxBYn5lLDnib7r QCF4tnea3smJgBX0PGYet9s7XYkf3k/1Dw== X-Received: by 2002:a05:600c:3b04:b0:39c:951e:6813 with SMTP id m4-20020a05600c3b0400b0039c951e6813mr14439060wms.193.1656325371806; Mon, 27 Jun 2022 03:22:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/25] target/arm: Move arm_cpu_*_finalize to internals.h Date: Mon, 27 Jun 2022 11:22:29 +0100 Message-Id: <20220627102236.3097629-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Drop the aa32-only inline fallbacks, and just use a couple of ifdefs. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-16-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 6 ------ target/arm/internals.h | 3 +++ target/arm/cpu.c | 2 ++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2ce47f8d29f..675c49f93e0 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -205,14 +205,8 @@ typedef struct { #ifdef TARGET_AARCH64 # define ARM_MAX_VQ 16 -void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); -void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); -void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); #else # define ARM_MAX_VQ 1 -static inline void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { } -static inline void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { } -static inline void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) { } #endif typedef struct ARMVectorReg { diff --git a/target/arm/internals.h b/target/arm/internals.h index 6f94f3019db..aef568adf75 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1288,6 +1288,9 @@ int arm_gdb_get_svereg(CPUARMState *env, GByteArray *buf, int reg); int arm_gdb_set_svereg(CPUARMState *env, uint8_t *buf, int reg); int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg); int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg); +void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); +void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); +void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); #endif #ifdef CONFIG_USER_ONLY diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d9c4a9f56d2..660fd8b8b90 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1422,6 +1422,7 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp) { Error *local_err = NULL; +#ifdef TARGET_AARCH64 if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { arm_cpu_sve_finalize(cpu, &local_err); if (local_err != NULL) { @@ -1441,6 +1442,7 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp) return; } } +#endif if (kvm_enabled()) { kvm_arm_steal_time_finalize(cpu, &local_err); From patchwork Mon Jun 27 10:22:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585295 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2966112mab; Mon, 27 Jun 2022 03:56:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vraE3aAAVko+Xtb0zEYQZGhLvTYCNdVyReki8FsaJ8TpGnuhOLNhz6HdqIWKeCL8IJSppr X-Received: by 2002:a0c:a9d6:0:b0:470:9d52:63aa with SMTP id c22-20020a0ca9d6000000b004709d5263aamr7883489qvb.20.1656327374768; Mon, 27 Jun 2022 03:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327374; cv=none; d=google.com; s=arc-20160816; b=HSW2lIqL22ig52INYsvpPGa2vBFDSCHCFH+HN53SuZliquQEIxXnN1Y7BbLkGwLMap e/Uiu8OR9cLIZRlwF8DpELbllnE6xW4ghVWN8QaevqZZFtP/Qs0lDZF3mVlSwkkmFv4F s4iB2Ux9Zp1mt1SOmTx0xPhmySfL1+QrCk692nwpaY2Ce8Ojkc6SJTHBGPboJjGslAex cWqKGLzohfuAQFrHxn2MXMYqiv6mUbelHcXPp6n7zDlLgWnGurkVHI1rKuetJVX1v6fW IHtKRwwTC8/nGc+qIwM+o20TON+yPNhUMDEx+MZAudiFDygAXNWGF2v8o5nP8Eto24o+ SoAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=EeDydKWKnx270Po7PJkxSD0CsPsoZG7caWBOvCNY4hc=; b=moNpRpAxZkUBSb4kOkd3c/jQhYFKl85RHVN9NE9A8qRJ968LM0EcCy1JokVwnNgDcg OZP2nrkm0hqGTckfSo5mNqwVTn0Kl4klzxXQypebYEMOogSzxBYNIsYAfxpKWbltfjio RBiWJYLbWY8i7KgIj3KMa1n4QSMHSHh3CaKxff8qfd8JJIiCQqnS8rNuFp1eat1qTX+2 vZB1Ajv0qrb0zU793U9NEDdNh5XvSy42AwORnAniIRi1/DCf7V3iAPXwYsbv6gdGhDkT 6fGYIfScpuKE9sPhq0A9qLv4LFNRdl/JZAni+1PwQjhywS1c9OSZokvpzLqA94P+D6mO 94eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mis8lEef; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u11-20020a0562140b0b00b004705fa3a257si4526430qvj.587.2022.06.27.03.56.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mis8lEef; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mPe-0006Fj-BU for patch@linaro.org; Mon, 27 Jun 2022 06:56:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltO-0002Oz-Ty for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:56 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltN-0004rL-6P for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:54 -0400 Received: by mail-wr1-x42b.google.com with SMTP id n1so12308150wrg.12 for ; Mon, 27 Jun 2022 03:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EeDydKWKnx270Po7PJkxSD0CsPsoZG7caWBOvCNY4hc=; b=Mis8lEefL3isVnrEdh+atC4/6B0KMFMkT8AFQaQ82hs3O3OrkY4zLU1sJ0k67pFqT7 ReHPmrV8pkkOviY+msuG8eE11ivAcBYN2QsPtVZzEqVgQV4qZeuyD+0GIocjk8H8Uz0W NqCvikyffk2InTsm0/Z41qsrdU5sNQI2IevPzcVfnozD5sqtT248ej0PaK/L5pXNAaWJ DYQao+ldCa/z5pBzRNKSzPk8NZxL9H/AFRqidMaW7v4+fbBToUacQtOjJFtM1SdJX3L5 h8NGrwYmNGk7Va+TMVaDP4WU6+kxpOVyUh/dgQ8lmQA+PBXYGUShbb28puJy3oN4nQND 45Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EeDydKWKnx270Po7PJkxSD0CsPsoZG7caWBOvCNY4hc=; b=lra8peRJhnzEpT3YmIlBXVTtDY60UE5Bh8yADgtZONyPVMtWnp5GyUiVMD6PuPh0HT E5VUpmHP9XU7r3EZCN8+4as18N/mT3rRsNNLGMisrE6/qakeDUOsbUYOS8df1aIk5Sg0 iGcaPKs2wTuNq32vmn4vky32mB7e6rpkRqzqKnCOB6OfbDa4UBgJ1OCouUs5dhh1wC1X ZI08+fDh3Pzd4AOR8laDxfI9FGjEvy6o5th/mYxdme6y9QCKtAHLpJ3adb0TebOlQYtn K2PhiI2Zqk2eDNWhTT7p8IklX7T+MHhJhFEg1YMtJd36qZshAHX/EQDOoqETiQBjx5PD 4Aag== X-Gm-Message-State: AJIora9lNWBQhbB4pwatlnWNpwhyWSnj+YK6YcADVkDWjYMy5pGqunMg gc4utTxkX3GmLAlEzpotowGsPPZO4TFCNw== X-Received: by 2002:a5d:69d2:0:b0:21b:8e3f:8557 with SMTP id s18-20020a5d69d2000000b0021b8e3f8557mr11394348wrw.422.1656325372468; Mon, 27 Jun 2022 03:22:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/25] target/arm: Unexport aarch64_add_*_properties Date: Mon, 27 Jun 2022 11:22:30 +0100 Message-Id: <20220627102236.3097629-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These functions are not used outside cpu64.c, so make them static. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 3 --- target/arm/cpu64.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 675c49f93e0..d2b005f76c8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1111,8 +1111,6 @@ int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq); void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el, bool el0_a64); -void aarch64_add_sve_properties(Object *obj); -void aarch64_add_pauth_properties(Object *obj); void arm_reset_sve_state(CPUARMState *env); /* @@ -1144,7 +1142,6 @@ static inline void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq) { } static inline void aarch64_sve_change_el(CPUARMState *env, int o, int n, bool a) { } -static inline void aarch64_add_sve_properties(Object *obj) { } #endif void aarch64_sync_32_to_64(CPUARMState *env); diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index b15a0d398ad..6f6ee57a914 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -689,7 +689,7 @@ static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v, } #endif -void aarch64_add_sve_properties(Object *obj) +static void aarch64_add_sve_properties(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); uint32_t vq; @@ -752,7 +752,7 @@ static Property arm_cpu_pauth_property = static Property arm_cpu_pauth_impdef_property = DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false); -void aarch64_add_pauth_properties(Object *obj) +static void aarch64_add_pauth_properties(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); From patchwork Mon Jun 27 10:22:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585288 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2958822mab; Mon, 27 Jun 2022 03:44:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFT6jEc2ITGIR1ex68CmVRTwdkziFqAqc/tQvT9GmcZy/XeMLHR3BstLxDyK6lvPEYz8N/ X-Received: by 2002:a05:6214:19ce:b0:470:3206:fb76 with SMTP id j14-20020a05621419ce00b004703206fb76mr8202321qvc.58.1656326642186; Mon, 27 Jun 2022 03:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326642; cv=none; d=google.com; s=arc-20160816; b=kH0+7n6+L/CiTIV20kYD/djeAd8LeA6EVALIBbvHf6ePWvV7FTTgn6juW8r3hHsi6w lXc6QXMtE6384uVAH8zPGz/xpOvbHqOPy5vgEFFnUNHNpBC5MPACs07VW9j/Mz7VDFE+ YGCV6AvuzxsjykLp9oQi/J1ub3O3swNRG2bM0ROxzIsAJll8eThbg+wD8HFlO9XJKg0k xOWx2OlltJgn6ngPnoyIRBkCXyjnJXN6LhZ/8+pkLhGVFjCAvzsPZMVxFqOKKDSivxyU j2o3bhoNxM/apWOWDADbB3RjeDToRlY+MRNYphkUMIwrSLxwOy9d18Z8CiHUZk3hho/u +jWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=S5KlS03XVlUTJnKwjh9r15WOZqJ50ROAGOtbVW9mWeY=; b=XJfn0v8IBlTZh6/90vwqAOiupzZE9bCsS1eLOk1YPmcOQEER2YXvby38YnhbbAf03c KLSm+p0CjwkhB77nMRqTo0FrWY+TS0fd5G7oZE7sz8+5dWvslDBB7ampe0iBZeBp5b0p iICrtO+KXUY0pmv8Y9BlU+32wN8T++Tjj737lbPspCNszbqIII+SegGkau0YcF6nNohl a8zrhXhkkbY48uG00AuucoMiFgym+sh2IVWnfAxk7ThvfmpPQqk1V4Pr6OiIt5YDEuIB e8yaWa1SDUil54RCr8X1Ie9B0FCIBmo5i6wz1mtZaxjdnGDq+rrKGddCK22P+K9niOvy FeIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ECh2yd0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m14-20020a05620a290e00b006aeed7a41f4si6823715qkp.550.2022.06.27.03.44.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ECh2yd0J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mDp-00052U-OJ for patch@linaro.org; Mon, 27 Jun 2022 06:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltQ-0002Q1-Un for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:57 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:40647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltO-0004w9-NU for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:56 -0400 Received: by mail-wr1-x42c.google.com with SMTP id w17so12334926wrg.7 for ; Mon, 27 Jun 2022 03:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=S5KlS03XVlUTJnKwjh9r15WOZqJ50ROAGOtbVW9mWeY=; b=ECh2yd0JL7PvbvW9gxi9g3kvrgUUqoOrULEsJ1aCsXxoHekbNJ2c8PT5ILvIhckkAs 7vgH85LiGHLeuLZJoYE1J264fMpsUwkTIuhPZE12hImc0IBdVpFuc3cGc962l8s61+ZD z5WD5+D33jKJynGlGkhuZeim1RrOeUf2Pbx4VwGbyM5LguKQDe7OxV/yBY6sG68LYLVG gQq2qUHEoVPKIXuKTtn9Ds1ZDBuEPBuzKWPjcnFp9s6A3dwnP5fmABhzknUGxMF8cY/l Lj2SCQ5TkPh1B+siq/6AaPF5jRqnO5GUQCNNRkJ/aIWOfk+rU1RO19v3YvrcyzEXrrCf BJvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5KlS03XVlUTJnKwjh9r15WOZqJ50ROAGOtbVW9mWeY=; b=e3Af0i9dBGhhGHUn0XPJglGZ9mehMdhq98yiI3zT+RvphMIA88rR5XgX5/KVUK9oQn TqT05vh1h8yY7cUdJ1Qxap1I1htGqLGvrTCMVZXuMIM8Rv7N2vSFCFtCmYaQN3x7r6D1 x8oSBBH6MLNPw//X/rwgEI/sXL9R1H0N27YKShlqmmdY2Q1sNwlpXmmpwIzkj1Nt5xb/ agoiTx40d0whyLR2JjoWuLCNqM+TMSU/uICNoWbNXjzqG3Ur6RdHn+dF9H5fV6PBVU0x zCtoLuQjewRCeBO4TSXr7YovflDHW4b1PbX57YuYI1DtlVm+NtFXbLHHGs3bl5rzApmU H+Pw== X-Gm-Message-State: AJIora+58M+PNhqqBlxJFtOkZgtp+beTHjgUGdAreOTN15tsCSUpkiDt ddBG1a0l8uqyuJ1E38smx9wCrgKedBHEFw== X-Received: by 2002:a05:6000:2ab:b0:211:7fd6:24ef with SMTP id l11-20020a05600002ab00b002117fd624efmr11706448wry.67.1656325373301; Mon, 27 Jun 2022 03:22:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/25] target/arm: Add cpu properties for SME Date: Mon, 27 Jun 2022 11:22:31 +0100 Message-Id: <20220627102236.3097629-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mirror the properties for SVE. The main difference is that any arbitrary set of powers of 2 may be supported, and not the stricter constraints that apply to SVE. Include a property to control FEAT_SME_FA64, as failing to restrict the runtime to the proper subset of insns could be a major point for bugs. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20220620175235.60881-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- docs/system/arm/cpu-features.rst | 56 +++++++++++++++ target/arm/cpu.h | 2 + target/arm/internals.h | 1 + target/arm/cpu.c | 14 +++- target/arm/cpu64.c | 114 +++++++++++++++++++++++++++++-- 5 files changed, 180 insertions(+), 7 deletions(-) diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst index 3e626c4b68a..3fd76fa0b4f 100644 --- a/docs/system/arm/cpu-features.rst +++ b/docs/system/arm/cpu-features.rst @@ -372,6 +372,31 @@ verbose command lines. However, the recommended way to select vector lengths is to explicitly enable each desired length. Therefore only example's (1), (4), and (6) exhibit recommended uses of the properties. +SME CPU Property Examples +------------------------- + + 1) Disable SME:: + + $ qemu-system-aarch64 -M virt -cpu max,sme=off + + 2) Implicitly enable all vector lengths for the ``max`` CPU type:: + + $ qemu-system-aarch64 -M virt -cpu max + + 3) Only enable the 256-bit vector length:: + + $ qemu-system-aarch64 -M virt -cpu max,sme256=on + + 3) Enable the 256-bit and 1024-bit vector lengths:: + + $ qemu-system-aarch64 -M virt -cpu max,sme256=on,sme1024=on + + 4) Disable the 512-bit vector length. This results in all the other + lengths supported by ``max`` defaulting to enabled + (128, 256, 1024 and 2048):: + + $ qemu-system-aarch64 -M virt -cpu max,sve512=off + SVE User-mode Default Vector Length Property -------------------------------------------- @@ -387,3 +412,34 @@ length supported by QEMU is 256. If this property is set to ``-1`` then the default vector length is set to the maximum possible length. + +SME CPU Properties +================== + +The SME CPU properties are much like the SVE properties: ``sme`` is +used to enable or disable the entire SME feature, and ``sme`` is +used to enable or disable specific vector lengths. Finally, +``sme_fa64`` is used to enable or disable ``FEAT_SME_FA64``, which +allows execution of the "full a64" instruction set while Streaming +SVE mode is enabled. + +SME is not supported by KVM at this time. + +At least one vector length must be enabled when ``sme`` is enabled, +and all vector lengths must be powers of 2. The maximum vector +length supported by qemu is 2048 bits. Otherwise, there are no +additional constraints on the set of vector lengths supported by SME. + +SME User-mode Default Vector Length Property +-------------------------------------------- + +For qemu-aarch64, the cpu propery ``sme-default-vector-length=N`` is +defined to mirror the Linux kernel parameter file +``/proc/sys/abi/sme_default_vector_length``. The default length, ``N``, +is in units of bytes and must be between 16 and 8192. +If not specified, the default vector length is 32. + +As with ``sve-default-vector-length``, if the default length is larger +than the maximum vector length enabled, the actual vector length will +be reduced. If this property is set to ``-1`` then the default vector +length is set to the maximum possible length. diff --git a/target/arm/cpu.h b/target/arm/cpu.h index d2b005f76c8..c018f97b77b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1060,9 +1060,11 @@ struct ArchCPU { #ifdef CONFIG_USER_ONLY /* Used to set the default vector length at process start. */ uint32_t sve_default_vq; + uint32_t sme_default_vq; #endif ARMVQMap sve_vq; + ARMVQMap sme_vq; /* Generic timer counter frequency, in Hz */ uint64_t gt_cntfrq_hz; diff --git a/target/arm/internals.h b/target/arm/internals.h index aef568adf75..c66f74a0db1 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1289,6 +1289,7 @@ int arm_gdb_set_svereg(CPUARMState *env, uint8_t *buf, int reg); int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg); int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg); void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); +void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); #endif diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 660fd8b8b90..bb44ad45aa1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1123,11 +1123,13 @@ static void arm_cpu_initfn(Object *obj) #ifdef CONFIG_USER_ONLY # ifdef TARGET_AARCH64 /* - * The linux kernel defaults to 512-bit vectors, when sve is supported. - * See documentation for /proc/sys/abi/sve_default_vector_length, and - * our corresponding sve-default-vector-length cpu property. + * The linux kernel defaults to 512-bit for SVE, and 256-bit for SME. + * These values were chosen to fit within the default signal frame. + * See documentation for /proc/sys/abi/{sve,sme}_default_vector_length, + * and our corresponding cpu property. */ cpu->sve_default_vq = 4; + cpu->sme_default_vq = 2; # endif #else /* Our inbound IRQ and FIQ lines */ @@ -1430,6 +1432,12 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp) return; } + arm_cpu_sme_finalize(cpu, &local_err); + if (local_err != NULL) { + error_propagate(errp, local_err); + return; + } + arm_cpu_pauth_finalize(cpu, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 6f6ee57a914..19188d6cc2a 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -589,10 +589,13 @@ static void cpu_arm_get_vq(Object *obj, Visitor *v, const char *name, ARMCPU *cpu = ARM_CPU(obj); ARMVQMap *vq_map = opaque; uint32_t vq = atoi(&name[3]) / 128; + bool sve = vq_map == &cpu->sve_vq; bool value; - /* All vector lengths are disabled when SVE is off. */ - if (!cpu_isar_feature(aa64_sve, cpu)) { + /* All vector lengths are disabled when feature is off. */ + if (sve + ? !cpu_isar_feature(aa64_sve, cpu) + : !cpu_isar_feature(aa64_sme, cpu)) { value = false; } else { value = extract32(vq_map->map, vq - 1, 1); @@ -636,8 +639,80 @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) cpu->isar.id_aa64pfr0 = t; } +void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp) +{ + uint32_t vq_map = cpu->sme_vq.map; + uint32_t vq_init = cpu->sme_vq.init; + uint32_t vq_supported = cpu->sme_vq.supported; + uint32_t vq; + + if (vq_map == 0) { + if (!cpu_isar_feature(aa64_sme, cpu)) { + cpu->isar.id_aa64smfr0 = 0; + return; + } + + /* TODO: KVM will require limitations via SMCR_EL2. */ + vq_map = vq_supported & ~vq_init; + + if (vq_map == 0) { + vq = ctz32(vq_supported) + 1; + error_setg(errp, "cannot disable sme%d", vq * 128); + error_append_hint(errp, "All SME vector lengths are disabled.\n"); + error_append_hint(errp, "With SME enabled, at least one " + "vector length must be enabled.\n"); + return; + } + } else { + if (!cpu_isar_feature(aa64_sme, cpu)) { + vq = 32 - clz32(vq_map); + error_setg(errp, "cannot enable sme%d", vq * 128); + error_append_hint(errp, "SME must be enabled to enable " + "vector lengths.\n"); + error_append_hint(errp, "Add sme=on to the CPU property list.\n"); + return; + } + /* TODO: KVM will require limitations via SMCR_EL2. */ + } + + cpu->sme_vq.map = vq_map; +} + +static bool cpu_arm_get_sme(Object *obj, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + return cpu_isar_feature(aa64_sme, cpu); +} + +static void cpu_arm_set_sme(Object *obj, bool value, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + uint64_t t; + + t = cpu->isar.id_aa64pfr1; + t = FIELD_DP64(t, ID_AA64PFR1, SME, value); + cpu->isar.id_aa64pfr1 = t; +} + +static bool cpu_arm_get_sme_fa64(Object *obj, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + return cpu_isar_feature(aa64_sme, cpu) && + cpu_isar_feature(aa64_sme_fa64, cpu); +} + +static void cpu_arm_set_sme_fa64(Object *obj, bool value, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + uint64_t t; + + t = cpu->isar.id_aa64smfr0; + t = FIELD_DP64(t, ID_AA64SMFR0, FA64, value); + cpu->isar.id_aa64smfr0 = t; +} + #ifdef CONFIG_USER_ONLY -/* Mirror linux /proc/sys/abi/sve_default_vector_length. */ +/* Mirror linux /proc/sys/abi/{sve,sme}_default_vector_length. */ static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -663,7 +738,11 @@ static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v, * and is the maximum architectural width of ZCR_ELx.LEN. */ if (remainder || default_vq < 1 || default_vq > 512) { - error_setg(errp, "cannot set sve-default-vector-length"); + ARMCPU *cpu = ARM_CPU(obj); + const char *which = + (ptr_default_vq == &cpu->sve_default_vq ? "sve" : "sme"); + + error_setg(errp, "cannot set %s-default-vector-length", which); if (remainder) { error_append_hint(errp, "Vector length not a multiple of 16\n"); } else if (default_vq < 1) { @@ -712,6 +791,31 @@ static void aarch64_add_sve_properties(Object *obj) #endif } +static void aarch64_add_sme_properties(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + uint32_t vq; + + object_property_add_bool(obj, "sme", cpu_arm_get_sme, cpu_arm_set_sme); + object_property_add_bool(obj, "sme_fa64", cpu_arm_get_sme_fa64, + cpu_arm_set_sme_fa64); + + for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) { + char name[8]; + sprintf(name, "sme%d", vq * 128); + object_property_add(obj, name, "bool", cpu_arm_get_vq, + cpu_arm_set_vq, NULL, &cpu->sme_vq); + } + +#ifdef CONFIG_USER_ONLY + /* Mirror linux /proc/sys/abi/sme_default_vector_length. */ + object_property_add(obj, "sme-default-vector-length", "int32", + cpu_arm_get_default_vec_len, + cpu_arm_set_default_vec_len, NULL, + &cpu->sme_default_vq); +#endif +} + void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { int arch_val = 0, impdef_val = 0; @@ -977,9 +1081,11 @@ static void aarch64_max_initfn(Object *obj) #endif cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ); + cpu->sme_vq.supported = SVE_VQ_POW2_MAP; aarch64_add_pauth_properties(obj); aarch64_add_sve_properties(obj); + aarch64_add_sme_properties(obj); object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_vq, cpu_max_set_sve_max_vq, NULL, NULL); qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); From patchwork Mon Jun 27 10:22:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585285 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2956957mab; Mon, 27 Jun 2022 03:41:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNIIkU8m1qKRzcjOLP8IPVgv5hj32IBPZfmI0jLBhOhm/timouDmxuNhKnh0VaNSGpyw4M X-Received: by 2002:ac8:57cc:0:b0:305:1fc6:b0cb with SMTP id w12-20020ac857cc000000b003051fc6b0cbmr8439633qta.427.1656326471819; Mon, 27 Jun 2022 03:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326471; cv=none; d=google.com; s=arc-20160816; b=Qjsot85RqNrHDzECen8eSg1TPe7sProhW4JpZt/F6kHLrGzK5J9RqTh/JVuG/P4dPs QLAukqHGmBlN+VQGr59LzbiIOLBCdWccgd31U0a5cY2uO+DPKZkWP/VDeKwFz8iWkFvz XP+FeGCJudfJIGidOCGnVbH8oifFI7TlJeF40UIPjrvuhcV63QnZfJEDgkqmk6AELdli grSu9YYrYzv+1zpb+dsyCOoJzSaof02nfOgD/ac2C32z4GsAdJ2fUXK4eS4MKueFnwV1 04zjPkMnEU7l4ClMnBTr0p/gpbWwLWpWiBR1ZeNo5JqQ4pjFV84WC8DLGNFXpzvMc1lq LelQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=+S+ij/JQ6BulpHI6mAQb2Jx6jbogpzOBoVPGxRe8ARY=; b=qMuMzPodyOUjFtsVosyu0dnNb2lwq7wfvcOMVUPbV8RRat1jdxzkAEqqK+NGCgrYSt 0KBkeiSEnY+kONL3sP3dFHZj81g4BsRJ7XlmjrBQLTi7y9c36kqWgr5ZmU8D7RxlwZXu 8IJ/GsIl+JJDETYY3G22+7S9KVeaM5QLIJ1VkbJpo9Wiq9ERj08JviwzDS44ZCEVz9pz rY0ChMxCcz3dqxzlxWLaiUqKxTioyAxKs75r+6OeqrPWMKKJHLn/5MEHQnZ9c+lqk9Ly ZjXqZbogSpIQ1VN+RvzDquJ3PwoUl1hKugL5nFX1JLwvzjRB/KwB6lCrBzYuc+1p3cLB VLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dn4C12xO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c7-20020a056214224700b00472776e3311si242589qvc.52.2022.06.27.03.41.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dn4C12xO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mB5-0008WG-Cq for patch@linaro.org; Mon, 27 Jun 2022 06:41:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltQ-0002P2-8k for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:56 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltO-0004rv-MY for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:55 -0400 Received: by mail-wr1-x42e.google.com with SMTP id k22so12340593wrd.6 for ; Mon, 27 Jun 2022 03:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+S+ij/JQ6BulpHI6mAQb2Jx6jbogpzOBoVPGxRe8ARY=; b=Dn4C12xOln0TZLa+62Y6fTKUAogiLAtQvuofcV7nnOybkWoHRHoT9gaKzZhpPR2ZqF 7USdDFq8xf6lAqcu7b2QjMo3w4XmTvqIQ2Xnr3uH4Achj2rjAuRp4L3PwIF2VGUUKD3G 6XF58MncAH5ekdKGUk9rA38zWLItU5amzgxACZ1/dutTq1vfCuPugqpT/B+TteUWtoqk XBh0xkzIBRDHRUNOlorkOARmv7kY19kFQBCwDezR1TZujY4JoDGVcoPx0Mglz7sqAgJl g2TH5qgy+AHnY11PASkBXA/r0XlYaKgMdf1+1u1T5fQXyymx+KZGgf46iXJKdZh9Jjrq BLfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+S+ij/JQ6BulpHI6mAQb2Jx6jbogpzOBoVPGxRe8ARY=; b=TXn3uRV3rvRI0yX6HlyzlR67u4eGX/XvHY1lZslZL8ANkCIctUsyH+Ip40+6Tp2QjV t/ZKxvUFIZiGJuPRoQEWGklOMx611wwXzPzXUZGXf8w0NuJfzAke2lJO/EOZkEP4d18B 2qwk3U1RsAZDNCxWjsNFXh+U8WaO3ivYmfOmtvIQS+aMItb66fSLCDvLdsd/eyewRaOo iWgbN/2ilgtgctoXDkzbMnn3I9hhGiAODwUWgXFX7d84ldqhIXEu9Hv6AapgV1l1evxK fYKvdjNxGrwiVSRs0qFk4nO2ITbNOLnmhpTg9ZOPjfq+FAR7hU75RwzOUOC3DuK111VV XUzw== X-Gm-Message-State: AJIora9A2himW7pSlMy7BUpibs//Dc16CwwwaiQk7LT0E+IN/xJO0OL2 apw8hVmOACbgaOtYAtt++EWADkwNVw2fyg== X-Received: by 2002:a5d:67c3:0:b0:21b:8cd4:ad60 with SMTP id n3-20020a5d67c3000000b0021b8cd4ad60mr12066569wrw.380.1656325374001; Mon, 27 Jun 2022 03:22:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/25] target/arm: Introduce sve_vqm1_for_el_sm Date: Mon, 27 Jun 2022 11:22:32 +0100 Message-Id: <20220627102236.3097629-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson When Streaming SVE mode is enabled, the size is taken from SMCR_ELx instead of ZCR_ELx. The format is shared, but the set of vector lengths is not. Further, Streaming SVE does not require any particular length to be supported. Adjust sve_vqm1_for_el to pass the current value of PSTATE.SM to the new function. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-19-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 9 +++++++-- target/arm/helper.c | 32 +++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c018f97b77b..0295e854838 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1154,13 +1154,18 @@ int sve_exception_el(CPUARMState *env, int cur_el); int sme_exception_el(CPUARMState *env, int cur_el); /** - * sve_vqm1_for_el: + * sve_vqm1_for_el_sm: * @env: CPUARMState * @el: exception level + * @sm: streaming mode * - * Compute the current SVE vector length for @el, in units of + * Compute the current vector length for @el & @sm, in units of * Quadwords Minus 1 -- the same scale used for ZCR_ELx.LEN. + * If @sm, compute for SVL, otherwise NVL. */ +uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm); + +/* Likewise, but using @sm = PSTATE.SM. */ uint32_t sve_vqm1_for_el(CPUARMState *env, int el); static inline bool is_a64(CPUARMState *env) diff --git a/target/arm/helper.c b/target/arm/helper.c index a80ca461e53..2e4e739969a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6272,23 +6272,41 @@ int sme_exception_el(CPUARMState *env, int el) /* * Given that SVE is enabled, return the vector length for EL. */ -uint32_t sve_vqm1_for_el(CPUARMState *env, int el) +uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm) { ARMCPU *cpu = env_archcpu(env); - uint32_t len = cpu->sve_max_vq - 1; + uint64_t *cr = env->vfp.zcr_el; + uint32_t map = cpu->sve_vq.map; + uint32_t len = ARM_MAX_VQ - 1; + + if (sm) { + cr = env->vfp.smcr_el; + map = cpu->sme_vq.map; + } if (el <= 1 && !el_is_in_host(env, el)) { - len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[1]); + len = MIN(len, 0xf & (uint32_t)cr[1]); } if (el <= 2 && arm_feature(env, ARM_FEATURE_EL2)) { - len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[2]); + len = MIN(len, 0xf & (uint32_t)cr[2]); } if (arm_feature(env, ARM_FEATURE_EL3)) { - len = MIN(len, 0xf & (uint32_t)env->vfp.zcr_el[3]); + len = MIN(len, 0xf & (uint32_t)cr[3]); } - len = 31 - clz32(cpu->sve_vq.map & MAKE_64BIT_MASK(0, len + 1)); - return len; + map &= MAKE_64BIT_MASK(0, len + 1); + if (map != 0) { + return 31 - clz32(map); + } + + /* Bit 0 is always set for Normal SVE -- not so for Streaming SVE. */ + assert(sm); + return ctz32(cpu->sme_vq.map); +} + +uint32_t sve_vqm1_for_el(CPUARMState *env, int el) +{ + return sve_vqm1_for_el_sm(env, el, FIELD_EX64(env->svcr, SVCR, SM)); } static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, From patchwork Mon Jun 27 10:22:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585284 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2956577mab; Mon, 27 Jun 2022 03:40:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v0xcWuES/krN0SXXImVOD8lapUYrI20C/V1MDNdvkANp3FW9v5wt0jnEeaISGM+yGwsHQq X-Received: by 2002:a05:622a:1992:b0:319:cb47:b3a4 with SMTP id u18-20020a05622a199200b00319cb47b3a4mr3986630qtc.472.1656326443151; Mon, 27 Jun 2022 03:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326443; cv=none; d=google.com; s=arc-20160816; b=ZP1aYaHKgLEWjCqMJsq4H3Ngiu4WuoG2fssGbtOBJquZGo9ujQjIASw8LXtlJtC5mu /fhE49OB2AsAl2TeDzTzUocd2HY6OPPvfcQcqDnJUR2hZnEBthJ9ETpAEBPsdSbiB21k tBPNbUpfdmzabVnhpI+2vJgHwTTm8ghapr/cddzKRReOS8LqcbyeV/WdklZWTAhN3chJ 5m3D1VnCd3OkMvc3DGVYyyITEq7Up83IE1LED3IwXy9Q6H86j7fM6qcWjOvT7gfVfrPL bg8wduxYdIsEAY1D1Oj8lumTWN46dLv/hxWTo/TO9UOTYVvxfzryT+pokinb4tpIPAV1 N9ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=UxO45iMNQdPBvJ4yQbQwAgduUxMLOFINeX5GnViH9SympLfJXdNcN5iUqwj/sgel1S CxmXIkpbAFvQ2RKWTiAeyjO+sMx0sLEQxkXihFD8OWrn8Uz1DwXK7lLhfEyRFl8VlxZf 1h0RmF7IToLxEmOM94jjSxd1XBAGhK9KfBr7sZZ1sRDELzR7tusS+PPi+IknbuznEOVm BtDVceA2myluAPtGWgrWmcGyT183JYrrufPnW3XwfIyvkwH5jGP0zvNKswB/xdfp4FRo AU51eHHkjpNaM8leLaC4HfDMocUkYt2QtYNEtS2pxIqKKQd6TI53KRo0qNZ0G1arkfZR 0cnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b451WTlO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r10-20020ac85c8a000000b00317ca6f543csi4981360qta.453.2022.06.27.03.40.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b451WTlO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mAc-0008C9-Mm for patch@linaro.org; Mon, 27 Jun 2022 06:40:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltR-0002QO-Oe for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:58 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:38770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltP-0004we-WF for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:57 -0400 Received: by mail-wm1-x334.google.com with SMTP id g39-20020a05600c4ca700b003a03ac7d540so4526735wmp.3 for ; Mon, 27 Jun 2022 03:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=b451WTlOCtJGE4ndovu4eqgdOHvn57xlvI7tC2dsxibPxyCJfvXCf6s+3bQRsrlJue pA4OgL/eTVmUU2e1EULHnYp87KksQhjmg89vhnCh4EIGgp3es0k6wSwrPqiESASEJ5X+ mqO56p1ULLzm60krcMrTkxpHSDZxhGO1xYtXsyEQQ6I5GweiO0Or/yQ9KhGqxmkMaCm1 WviPcekz23/AQNGS+4RiqPtW2VHLxg+hyoZqMtzVcE2FSK4AP/ZfcEcH5OolWAXT4Dj+ 2pu73CKiSBpplFAeo2isjA54CNppoqBqrbGR9CMtbWCr5/SPwS/3MuJw5w0SUoBKrrjK Qcgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=DqV+TVGTdd4l8wudzV6nliBzr7rM06oyI8Go+PaIECKZUhtSC76dZKt6VyXDEnmBE1 NcKAGKdX4ckoHRVfgZFrO+CSWxtIfyGNAy6+A6FED0di3IZrDjAweCZPXHK+rqOPuri/ gNmt6a+51kp+XHw2q3ZJL6VRFohgsxd7RWqtCYisAlFp+bg87/alOHR0H4eiQT/xR+zy wzsQfvXUpu8845GvujnN1OGnMO5TJClEDA/Tt8hbJAeQ6UfMf8jFvzcS0UWHf3URQ9/j fCwL62rl6vp/E00f73+rDomffrxJLXB8pZwRmpjRStEdvX3mToUFpxXOGIgzCjWQCAQP yepw== X-Gm-Message-State: AJIora/fwWtMMMn71au8mzOP975pIANRnf4LfIh+k/dDgjvRdOujN3i5 Hk6zEI120m6Gd0mNp3IunUanb3WCBoqMVA== X-Received: by 2002:a05:600c:a47:b0:39e:f953:84e2 with SMTP id c7-20020a05600c0a4700b0039ef95384e2mr19169552wmq.202.1656325374704; Mon, 27 Jun 2022 03:22:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/25] target/arm: Add SVL to TB flags Date: Mon, 27 Jun 2022 11:22:33 +0100 Message-Id: <20220627102236.3097629-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We need SVL separate from VL for RDSVL et al, as well as ZA storage loads and stores, which do not require PSTATE.SM. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-20-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 12 ++++++++++++ target/arm/translate.h | 1 + target/arm/helper.c | 8 +++++++- target/arm/translate-a64.c | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 0295e854838..4a4342f2622 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3182,6 +3182,7 @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2) FIELD(TBFLAG_A64, PSTATE_SM, 22, 1) FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) +FIELD(TBFLAG_A64, SVL, 24, 4) /* * Helpers for using the above. @@ -3227,6 +3228,17 @@ static inline int sve_vq(CPUARMState *env) return EX_TBFLAG_A64(env->hflags, VL) + 1; } +/** + * sme_vq + * @env: the cpu context + * + * Return the SVL cached within env->hflags, in units of quadwords. + */ +static inline int sme_vq(CPUARMState *env) +{ + return EX_TBFLAG_A64(env->hflags, SVL) + 1; +} + static inline bool bswap_code(bool sctlr_b) { #ifdef CONFIG_USER_ONLY diff --git a/target/arm/translate.h b/target/arm/translate.h index 93766649f7f..22fd882368b 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -44,6 +44,7 @@ typedef struct DisasContext { int sve_excp_el; /* SVE exception EL or 0 if enabled */ int sme_excp_el; /* SME exception EL or 0 if enabled */ int vl; /* current vector length in bytes */ + int svl; /* current streaming vector length in bytes */ bool vfp_enabled; /* FP enabled via FPSCR.EN */ int vec_len; int vec_stride; diff --git a/target/arm/helper.c b/target/arm/helper.c index 2e4e739969a..d2886a123a6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11352,7 +11352,13 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el); } if (cpu_isar_feature(aa64_sme, env_archcpu(env))) { - DP_TBFLAG_A64(flags, SMEEXC_EL, sme_exception_el(env, el)); + int sme_el = sme_exception_el(env, el); + + DP_TBFLAG_A64(flags, SMEEXC_EL, sme_el); + if (sme_el == 0) { + /* Similarly, do not compute SVL if SME is disabled. */ + DP_TBFLAG_A64(flags, SVL, sve_vqm1_for_el_sm(env, el, true)); + } if (FIELD_EX64(env->svcr, SVCR, SM)) { DP_TBFLAG_A64(flags, PSTATE_SM, 1); } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c050ebe0053..c86b97b1d49 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14647,6 +14647,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; + dc->svl = (EX_TBFLAG_A64(tb_flags, SVL) + 1) * 16; dc->pauth_active = EX_TBFLAG_A64(tb_flags, PAUTH_ACTIVE); dc->bt = EX_TBFLAG_A64(tb_flags, BT); dc->btype = EX_TBFLAG_A64(tb_flags, BTYPE); From patchwork Mon Jun 27 10:22:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585290 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2961567mab; Mon, 27 Jun 2022 03:48:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txVcwZaM03U+0maaN1w5z0gHY/Vwh5nz/PGjt4fcgkx76pHwcRIrtjsdp6teuIS5bjIchX X-Received: by 2002:a05:622a:1706:b0:318:6a7f:1f23 with SMTP id h6-20020a05622a170600b003186a7f1f23mr7266314qtk.98.1656326917721; Mon, 27 Jun 2022 03:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326917; cv=none; d=google.com; s=arc-20160816; b=tLXnKH+W0LFTCi7fmwiw94MRvrmwe1INUBdot0hymveoLDwrEsBs0uD8hWE+yrYoDM 0UO0xvYhHCS5FYeaUuIzAUD8YpWofZS4eUkmA7Nfu2qFsvRkzGAsyA2zPfmwK9I94YsH wGo1kvEvfmkt4ZlX80OvNPighhvHkuJmrOw0BOq6cKzqjSu+x/1LU5OCF/2pNHP30Vwn pJzYszzsKP4pY2ulaGVbnLFBzTEIqes7AkFZNuQPEPbqaq2BnyN5NAxhbys1qzDqlB8c pvyj056MVS5j7CmAGBJs4/nnlXmuoDjIJdPEX/n+aKtj0KnBZKU4KnS6nmVMDcMc21kg /KZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=BN4IBa0O3M5EDgTe2ogiAerPKFhYoZaI913konjwrVU=; b=qJmRYvhuyxG5pqXaeYGNT1KLhnZmWI4Zta9XR1HyF7gAsT6LnkP7TlFf+d+WQR4/ep ULOU3b+OvMzmXTo7g+AJHJ+Kd02C5TDcYK7O2qkZKg6k3Kod/RPdDbv99Ya0tnwkH3/p QdX+1ieEOvWC5ekAf7DCjKztKApsGZgce2b50us0HFbXM4ApQeKQE6FwanhmAXRQrtB3 ucDBpFzge209RRJ04hzjxelxfQQ0vv0SKJ9T4uyNbXMJOWsvYyOvtt6sLwq/TzZmg8Gx fZ9164cbmX6o0LMBZwwphnoi65mvvp+KDfnNykqq2iMOdupyfe7MLIqdqpV30H1sK6Ki CsQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=naTHypjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bl36-20020a05620a1aa400b006af2d28f9b0si856841qkb.9.2022.06.27.03.48.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:48:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=naTHypjV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mIA-0001Li-RI for patch@linaro.org; Mon, 27 Jun 2022 06:48:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltS-0002RS-DG for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:58 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltQ-0004rL-9K for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:58 -0400 Received: by mail-wr1-x42b.google.com with SMTP id n1so12308150wrg.12 for ; Mon, 27 Jun 2022 03:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BN4IBa0O3M5EDgTe2ogiAerPKFhYoZaI913konjwrVU=; b=naTHypjVdSZN63rf5N8e3gyS1Vsx+C7AazPCcjvV0eKE6FmHhtEsUNzrEuHkOFYnOD RT5uoh9H9Mz9FfXeY9/qvDxaP4lcmNr0b1eiCjb4OHiUjOh3t93N8XPyxo7nyUP+k1Y1 zos1WvH1thryiMDc2cwE7XJvwKb1M9rEIxYDBbPU/1pzG7drt2TtFwqRhJFhjxJl76TU ZFU3rgKjLVfY5xRtO3kyI0mdMq0cS/uHQpaCjoki+ehUKSEY4ADbTeJY1ioz/f7IDHo2 pfRuW50jQ/N6yXqDo8WXwvaM5pwIYQsz1VLfulfGE+XDgeuC0nh2GvuES5SUnMlm4KPz j7Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BN4IBa0O3M5EDgTe2ogiAerPKFhYoZaI913konjwrVU=; b=EyRF5Iq9J+pVGAFJmk3fn9tdWS4yxr7Om9tRGpbW1n2kMfS30ZBgjm2Qvgmg4DZa9/ tJuQFAiuJUE4l4A9e3OZWCQ5N7Us34BNx+/8dyKRNtxBHhnuMsUeS3fQtBqexXWa2cxy bqg+ZL6IfwZ/znJKHIkGcfaV1VUNsleXgtG7wbg5s/rwFZFUer2RoryrKQDtYeJE6j2M 3qVZ6xr5JlnGobYJA4eSbjTmHT1QhgWYYmR/7Ho0uPCS7wA/upALcVdQtQf4ylQfqLSX ko/QnHUfGqRNA4UqZU9p3fX70c1H2fywpJYGh0wnhegDGMG+hwbJPNwdPfDUN2nrsFOq xA0Q== X-Gm-Message-State: AJIora9nGHNioxKFiJYZ1RXa674JPJKPH0Mm8EqiEhPtO63da2f6P0RG 1lzd3wIIkqOiIXNR4q0kTVQJl3dF259ISg== X-Received: by 2002:a5d:698a:0:b0:21a:3972:7a60 with SMTP id g10-20020a5d698a000000b0021a39727a60mr11210864wru.549.1656325375523; Mon, 27 Jun 2022 03:22:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/25] target/arm: Move pred_{full, gvec}_reg_{offset, size} to translate-a64.h Date: Mon, 27 Jun 2022 11:22:34 +0100 Message-Id: <20220627102236.3097629-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We will need these functions in translate-sme.c. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-21-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate-a64.h | 38 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 36 ------------------------------------ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index dbc917ee65b..f0970c6b8cf 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -107,6 +107,44 @@ static inline int vec_full_reg_size(DisasContext *s) return s->vl; } +/* + * Return the offset info CPUARMState of the predicate vector register Pn. + * Note for this purpose, FFR is P16. + */ +static inline int pred_full_reg_offset(DisasContext *s, int regno) +{ + return offsetof(CPUARMState, vfp.pregs[regno]); +} + +/* Return the byte size of the whole predicate register, VL / 64. */ +static inline int pred_full_reg_size(DisasContext *s) +{ + return s->vl >> 3; +} + +/* + * Round up the size of a register to a size allowed by + * the tcg vector infrastructure. Any operation which uses this + * size may assume that the bits above pred_full_reg_size are zero, + * and must leave them the same way. + * + * Note that this is not needed for the vector registers as they + * are always properly sized for tcg vectors. + */ +static inline int size_for_gvec(int size) +{ + if (size <= 8) { + return 8; + } else { + return QEMU_ALIGN_UP(size, 16); + } +} + +static inline int pred_gvec_reg_size(DisasContext *s) +{ + return size_for_gvec(pred_full_reg_size(s)); +} + bool disas_sve(DisasContext *, uint32_t); void gen_gvec_rax1(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 67761bf2cc5..62b5f3040c7 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -100,42 +100,6 @@ static inline int msz_dtype(DisasContext *s, int msz) * Implement all of the translator functions referenced by the decoder. */ -/* Return the offset info CPUARMState of the predicate vector register Pn. - * Note for this purpose, FFR is P16. - */ -static inline int pred_full_reg_offset(DisasContext *s, int regno) -{ - return offsetof(CPUARMState, vfp.pregs[regno]); -} - -/* Return the byte size of the whole predicate register, VL / 64. */ -static inline int pred_full_reg_size(DisasContext *s) -{ - return s->vl >> 3; -} - -/* Round up the size of a register to a size allowed by - * the tcg vector infrastructure. Any operation which uses this - * size may assume that the bits above pred_full_reg_size are zero, - * and must leave them the same way. - * - * Note that this is not needed for the vector registers as they - * are always properly sized for tcg vectors. - */ -static int size_for_gvec(int size) -{ - if (size <= 8) { - return 8; - } else { - return QEMU_ALIGN_UP(size, 16); - } -} - -static int pred_gvec_reg_size(DisasContext *s) -{ - return size_for_gvec(pred_full_reg_size(s)); -} - /* Invoke an out-of-line helper on 2 Zregs. */ static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, int rd, int rn, int data) From patchwork Mon Jun 27 10:22:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585287 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2958506mab; Mon, 27 Jun 2022 03:43:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFvNDGGeqd6Y4IP+T3AVAEOewRTfNxv1cYVvzZhQLBPj+GG+5KfOkzuGjWsz1d6WDjcTHp X-Received: by 2002:ac8:5f0c:0:b0:317:cc26:6469 with SMTP id x12-20020ac85f0c000000b00317cc266469mr8475728qta.578.1656326617555; Mon, 27 Jun 2022 03:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326617; cv=none; d=google.com; s=arc-20160816; b=C5li5p17Yo59uJznNWh/eTQeRaF8m2b2rAYwRRG/VwLXxiTaYPN/5gcAxjjgtzXEPu OTKLyXi9COMJRm1O1QeY72Q+TUxnI9Rwc+YE2tyB+5EHCdZpL1Jy7Kknk8H4ffQ0071E 3yxB2jQrORIrlOsVF7tZ1/Z0k+z+1exYTHPJtcMpwc68R2fVfOYb2smhbiWDOJk7BLkW cWBiWNJH7VH2Pt+BSgduJPYZSrA30cZK6po50QgmKowSdozlpaIWw1+NJcJ9710qbsBz CtKQSg5CUWy7KvVRNWcqLqkrtS+rXdI/tUXXEMQ3EIliZeNEIqXGGBqVVRO3mtEeIcxT SYAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=9KeQmq+koa3iMWt7CG401QEinMf8dAeAjDC93KnxL1Y=; b=R63yrk/puzvtHiJ87THKlIqHX0ZVewhJDw1dCb5IpDk8AkbriekmYpe5i9Osqlaa5O gxqGVKTZhygo0baF7PNdvaCGXjUPgBbc1McS3Vc+fu+KF69YdKv0oXR1YzuInIdVnPlu h8OO8/s3qtQuaui5c0xuyr8PxSaGUlqk48J3Wrf+RZM1OQKzHgoMmGJIXyyc1oMBNxX3 4NCEKTgb6FRJYmeTXWrpMLp3uv7tHGeVA9KgktM6B4y5pf/N6GtoQM+HymcfqfMoNX6K DrazrI2RTm5EHdrfVpsfb3/JyOize7IZ7WADl4Zt6RjfT+vUJmNLYd/hZNNYoNLcoTp7 PGTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTtXv+ye; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dl11-20020a05620a1d0b00b006a763dc8999si5300120qkb.362.2022.06.27.03.43.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTtXv+ye; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mDR-0004f2-52 for patch@linaro.org; Mon, 27 Jun 2022 06:43:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltT-0002TH-63 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:59 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:38772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltR-0004x2-J4 for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:58 -0400 Received: by mail-wm1-x336.google.com with SMTP id g39-20020a05600c4ca700b003a03ac7d540so4526785wmp.3 for ; Mon, 27 Jun 2022 03:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9KeQmq+koa3iMWt7CG401QEinMf8dAeAjDC93KnxL1Y=; b=WTtXv+yep0k+Us+Fh0Lkzm2X22DkELBYI9ny9P13z0as4hEYxCwRF3wcy6dIbeSgZH rj7X54qYy5EghohkBl2MAZDvsXSRtrdqGi7Tq8YtRxYZYpf8aVF7oip5sDy4ahOrnI4A H6DCycEupdtCeXqN3PY9EZcTI/S+tsh8yy0QSagtDbICAl9WZ7mVqe2wbtzS/221XTJe KfrZUOeRytDlZbrpdtVB9edDSasxwXmao1+ZuK/zonzdui8VA/fB/fhWWoCB/m0iZ/s3 RNsVLZL2Ypo8EbQD0v5PN7pDT/ECmgBqt4fWAKuLeIUcPdGeftJVcgQxpRIZHoi6E29s qQug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9KeQmq+koa3iMWt7CG401QEinMf8dAeAjDC93KnxL1Y=; b=RqKjtbjcuc6bQnCYQ7Wh0R2FJ2/p4cAn0ScHLZ0I8aYZZS0un0XoCetKW6hVTxgjYU U/o1rnLyBxpmXndXPy15YUoV5Hs9kkKi2h3WPYNgt49geONsJkzk1+fJ4JZYxhktMXNZ Jh2Q3Y7Za44OYJVpXK+ka1r5QYE+4c/8bbBKU/NJLoeHxxB05ueAChIHmlZUPpFvl19m rJGoJQrxsKeF7AiUhZqG7xVRk4llC9/ctv2TXPBsDxwYS4iqnloDbn+IACG7zAwvQdDs OBonICBbgGlvvA/SAZkiAoza/zqZ7i6nqwNE4gbSQ43zuCdAINuLYZ5P34xzixA5rCEJ Bpvg== X-Gm-Message-State: AJIora8yDo8L3b031bWcTST8WnKBi748OeZRsvVkFaNHZ3UGL8SFM+hP rHXRZcipvz6eoACqK+9TlEPAKuGlfmyTZQ== X-Received: by 2002:a1c:1906:0:b0:39d:bc9d:a54f with SMTP id 6-20020a1c1906000000b0039dbc9da54fmr19071644wmz.128.1656325376312; Mon, 27 Jun 2022 03:22:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/25] target/arm: Extend arm_pamax to more than aarch64 Date: Mon, 27 Jun 2022 11:22:35 +0100 Message-Id: <20220627102236.3097629-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Move the code from hw/arm/virt.c that is supposed to handle v7 into the one function. Signed-off-by: Richard Henderson Reported-by: He Zhe Message-id: 20220619001541.131672-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/virt.c | 10 +--------- target/arm/ptw.c | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 097238faa7a..5502aa60c83 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2010,15 +2010,7 @@ static void machvirt_init(MachineState *machine) cpuobj = object_new(possible_cpus->cpus[0].type); armcpu = ARM_CPU(cpuobj); - if (object_property_get_bool(cpuobj, "aarch64", NULL)) { - pa_bits = arm_pamax(armcpu); - } else if (arm_feature(&armcpu->env, ARM_FEATURE_LPAE)) { - /* v7 with LPAE */ - pa_bits = 40; - } else { - /* Anything else */ - pa_bits = 32; - } + pa_bits = arm_pamax(armcpu); object_unref(cpuobj); diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 4d97a248084..07f7a218611 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -36,15 +36,23 @@ static const uint8_t pamax_map[] = { /* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */ unsigned int arm_pamax(ARMCPU *cpu) { - unsigned int parange = - FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { + unsigned int parange = + FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); - /* - * id_aa64mmfr0 is a read-only register so values outside of the - * supported mappings can be considered an implementation error. - */ - assert(parange < ARRAY_SIZE(pamax_map)); - return pamax_map[parange]; + /* + * id_aa64mmfr0 is a read-only register so values outside of the + * supported mappings can be considered an implementation error. + */ + assert(parange < ARRAY_SIZE(pamax_map)); + return pamax_map[parange]; + } + if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { + /* v7 with LPAE */ + return 40; + } + /* Anything else */ + return 32; } /* From patchwork Mon Jun 27 10:22:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585292 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2963335mab; Mon, 27 Jun 2022 03:51:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQSIHem83ylfqHgMwFF0ZEzViiB27+oxV6FD1Agn/B+33TYINIGWqIfdDcyxCXbDckhrkd X-Received: by 2002:a05:6214:8d1:b0:470:45a3:798d with SMTP id da17-20020a05621408d100b0047045a3798dmr7954566qvb.13.1656327068694; Mon, 27 Jun 2022 03:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327068; cv=none; d=google.com; s=arc-20160816; b=WcXVnj59QnWCxHtnGd0e0ZCzo1uVGMO5J0SpHSVz5980cE3qEzU9BDNDyZTBaYiTyE Tjb/QsKQcwApWxX2rv8z4W+eZ2V6Zp3uMS/Xq65s8unmwEVhK5fc36JCXgWNXpEyjjR6 fUZFB6tAeRAOREixP/18Ili5octJh3uuxtogwLIrBMKVvKsE7JanE+U6cPLRHHL4rsn6 D18aKavWc5w+2vrJRcIF84yLcfyQooU2HG5B1xU65Kk4UQy4U9/kUhwcn0Anumyk/bJV hIYeHlXYHsx4zU0+1ZcOwd3AN/v6WQO0S/j76dfTyrj5uMSPZPKDvfuZUtrXdkrjeqaw DVqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=WLTfmFsSYbrlNsXm8wT7ZM68yVYl9HPl9JI5ukxP0vI=; b=eu2EcpLE25HtGNl5/6xhIG/FLhffffsravAjqMbSetIu4Zv+GxtMvIeZNltlHg3GfV 0TQvakn4THNOSudwryGgTSaI/+cYAEqY++Tn7jkS1HeaLZy/UlVqzF85QgjwhyVCiCtl mV+RSaVdx8UxWu/wJKH2HdYUCHUu+p5IxnWYYSpvwnA9KMYZ1EjEbSd8iN2qRExKeunV KdcEHpx3iEHZU5tHBWtluR+ALQX9s7pSNJT27AU+Sa8qnv6BPq7Yb/KPECq7HtA6fsWh L9n9qfpd9xtCbERXsWNBBy6jixh5ab3wBomQ9BrJvbUF5RiaP8QGhcjn5Z3La5WTNAzR nK0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQkhiKx3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jk3-20020ad45d43000000b0047054417e66si6554191qvb.98.2022.06.27.03.51.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:51:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQkhiKx3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mKi-0005uu-Aw for patch@linaro.org; Mon, 27 Jun 2022 06:51:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltU-0002V9-Ba for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:23:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:35736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltS-0004xC-AU for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:59 -0400 Received: by mail-wr1-x42a.google.com with SMTP id q5so6992268wrc.2 for ; Mon, 27 Jun 2022 03:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=WLTfmFsSYbrlNsXm8wT7ZM68yVYl9HPl9JI5ukxP0vI=; b=AQkhiKx3VAIi6Q5sZUKmOMGyiKFmkVEmN+ul8XiVUYS8acLUo9FBPAmbICo4Cr7FSm +DduQiZ2ZeovMzQj+HP425WlVcXlfrnXzOKzVRdrshhGYP7itKfpTxDqcELLdUqdjd05 9WUjhApZqZq5k6u9oLNowgdB1jN4mKn8pgZVZAdMcdOzmiR3VHH83IHoMYdNK1fNM12Q f6vL5NVrYY4rbKxEJ+w/i4zq6jX2NyiklHk0dOQkoijia2uwtahJ3F9dCV1i0himK3av 4tQAytDRgkiexQnGUVYWAXWRW2e/im3t1OV7Q8HAv9I+KOviNvs99b9vlP4u8MpySU2Y lOUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WLTfmFsSYbrlNsXm8wT7ZM68yVYl9HPl9JI5ukxP0vI=; b=yqsqYznIdq+EBPFH6ue4mJzz+A5qm4YQT6+aDL3eyFcc3WFUSGbZ9zmvXkzgaWVCjc Ox1hBfBKJAk7r1B+D5mZhuagBMxchGAhA6Zo/1mpE8yBC7yLnbM4h3Z6ctG2ZVPbBMCv c7eJaZxwx9ULA+sDbJbzrt5YFupHH7wYHK/3Leopm6x6F2hI5grRWf53LyiciIS93Csv 5c6nOEu7WQevYrv0v/Yv+YWir5CUa7/OuE4bihqtWopjO0kOT+s+Ns43MR4+5dWJbBj9 2s4zxERm0jpolmRDAM3DBz54Q7FtfNxtqpXPX48CnvFfFeJ9XB6vFAwOJ4U5UGRZGjDm 4uzw== X-Gm-Message-State: AJIora8dQrnN+WgTwTCiY+srH6FLqsKmBrVl3OK/PjtpGJlRNKWkp5qx Ok4RnpdkXQbqBWRVlZE63p6WcIS8YyQMPg== X-Received: by 2002:a05:6000:1689:b0:218:3fb1:fd30 with SMTP id y9-20020a056000168900b002183fb1fd30mr11431358wrd.302.1656325376955; Mon, 27 Jun 2022 03:22:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/25] target/arm: Check V7VE as well as LPAE in arm_pamax Date: Mon, 27 Jun 2022 11:22:36 +0100 Message-Id: <20220627102236.3097629-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson In machvirt_init we create a cpu but do not fully initialize it. Thus the propagation of V7VE to LPAE has not been done, and we compute the wrong value for some v7 cpus, e.g. cortex-a15. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1078 Signed-off-by: Richard Henderson Reported-by: He Zhe Message-id: 20220619001541.131672-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/ptw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 07f7a218611..da478104f05 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -47,7 +47,13 @@ unsigned int arm_pamax(ARMCPU *cpu) assert(parange < ARRAY_SIZE(pamax_map)); return pamax_map[parange]; } - if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { + + /* + * In machvirt_init, we call arm_pamax on a cpu that is not fully + * initialized, so we can't rely on the propagation done in realize. + */ + if (arm_feature(&cpu->env, ARM_FEATURE_LPAE) || + arm_feature(&cpu->env, ARM_FEATURE_V7VE)) { /* v7 with LPAE */ return 40; }