From patchwork Fri Feb 3 14:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650034 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp848909pva; Fri, 3 Feb 2023 06:29:56 -0800 (PST) X-Google-Smtp-Source: AK7set9Gp2ypf6tNWM/mlJYVFUJ2/FAxoWenSAU31MdxorA+OZJGIZffWgRK2NoXpyFcmypG6/w5 X-Received: by 2002:ac8:5a55:0:b0:3b8:29a0:edb7 with SMTP id o21-20020ac85a55000000b003b829a0edb7mr19503397qta.59.1675434596319; Fri, 03 Feb 2023 06:29:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434596; cv=none; d=google.com; s=arc-20160816; b=IIOAAAOiQK1SMIPszlLs8Yi80Q1IsTLVd1Nu1XxWSeO49cKiJRcD4gKmikbHzHWkYq 6+VYoO7MPobBVpjRoVW9qS5UPn3FGjAdyeWRJNaXn1mqS9kTp/iUjfgiVvBMXd0C5chn glCXXMx7OR9LU6S8Pwpuplg5PkulQKmZYY3rBKmYcoA6kmaYa3g2FoXzbPEwCv+eZj9Z Jx4iNxhVaC7LjOYOGt7RNF+QL5SVhfMGCK8IhnVvTY37wtQo8mf1SzY++9YT4r7atGV/ jp6Tdjnhp6l8C3oTvesZ88NLQROByz7FmdWSWVo2jzv2tleIkH1kkwOnvpz9uEUsnpx0 wmbA== 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=Li+pWB+M1ny80ksWu15v+SH9Uhscz2fzZUVC1wklHOc=; b=tpwEjpXhwKo17RvH/oVonQUTxdq6+FLqYjbcYPEkCPwrCBHOriRNjne8MQN8T5wm2d xjq8BTFGwzIKd2Z7iFDLh1HnWE4p8e0/jU/CtKWUO1l0PC3hLCAs8qnH7LXXMPXY2Abm TxoDtlRhuEYMKEn0tOol3UfVSDdndBXr6U2xb9IWEsuABwsbnfJzKAAeMnVKOSKbgql4 Yp6r8dtaPOeOWoE9NlTiHfun3MAJztWk/f6ilIqh84u6P8ozlCDFneYAqURh7k+UWlVR c3KMfwxmxB2b/9r/GMxA2CeN2WM9mFUkVET8oh40FXQxhF7wgUVR3JWpRgXORVHbuUiF acgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JXAzJ6aV; 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 v21-20020a05622a131500b003b9ba906cb4si1853957qtk.538.2023.02.03.06.29.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:29:56 -0800 (PST) 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=JXAzJ6aV; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4T-0006ev-Ax; Fri, 03 Feb 2023 09:29:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4H-0006ao-GA for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:34 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4F-00053d-PZ for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:33 -0500 Received: by mail-wm1-x333.google.com with SMTP id q8so3999534wmo.5 for ; Fri, 03 Feb 2023 06:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Li+pWB+M1ny80ksWu15v+SH9Uhscz2fzZUVC1wklHOc=; b=JXAzJ6aVeUmX4jW3n9mI3bu2+wJS722OrZm05c5aowDEyyYgjIns4tJnH08sspHz4F ImcBWQvlGK+RmFJneHyUPcTJ//dwA662ZZMuQnSEhVgc6UgExAEp9eZpYRgDNwAGqy1c w1TVE131EIIFGp8+JYV+ACc5lbukcnPjiLhX2OJW8FPqcK2Nf+NATA4a1bpku8qP/r+c UCRBgJ44wW7fvcUzdUT7SBWgYJv9CrreUiMaGwnCCuWhMcsskJHunAuh7hZm0cAuPzVq FUfzrO5g9rvqgwMS88kQ2iHJiD20jBL4wEJjmMBj9OrfY1U/ovj1Y4+/jJbgBfxqdTae WXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Li+pWB+M1ny80ksWu15v+SH9Uhscz2fzZUVC1wklHOc=; b=SmvmmNHhLeuUFKD8jt6v818ll7evXcrO8u8WULDAZBjPeZfr4rjpi3+mackQ96mlnR m2jfZO5Dk/PCYOpA+o9zra5A6y6xlSes6Kq/Ph4IBkapzPgCF3T3O4l5dsEZYcvxNdMO PUrgOoc1FQQ/0X3Y7VSiMovRpjmxgJBcdTQrlm+f+IGEB42PY3g5Ucc6draCHlADwY6F wVQWoD586s6uP1YRAJkiXxVLKeroq3ZNiwLjyrgYonjosWRrF8FgK+itGWTI94SeJZAn Pjz7qyGJ7IYkUVSBqhLQ/kOZoCkz2xWsrg6QjHnGMR8V+ni8YVDBta4/RFrFkiut7hFj F6Xw== X-Gm-Message-State: AO0yUKXsCPKvNZyHQhnirC/94uyYuXs96Woa2lgHYvFSrz1mpdZzOxEs MERSelTHuqttuDIVqlhlgPg1csWXXha1raiN X-Received: by 2002:a05:600c:314a:b0:3df:ee43:860b with SMTP id h10-20020a05600c314a00b003dfee43860bmr731698wmo.23.1675434570103; Fri, 03 Feb 2023 06:29:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/33] hw/arm: Use TYPE_ARM_SMMUV3 Date: Fri, 3 Feb 2023 14:28:55 +0000 Message-Id: <20230203142927.834793-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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 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-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Use the macro instead of two explicit string literals. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Message-id: 20230124232059.4017615-1-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- hw/arm/sbsa-ref.c | 3 ++- hw/arm/virt.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 4bb444684f4..8378441dbb1 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -29,6 +29,7 @@ #include "exec/hwaddr.h" #include "kvm_arm.h" #include "hw/arm/boot.h" +#include "hw/arm/smmuv3.h" #include "hw/block/flash.h" #include "hw/boards.h" #include "hw/ide/internal.h" @@ -574,7 +575,7 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) DeviceState *dev; int i; - dev = qdev_new("arm-smmuv3"); + dev = qdev_new(TYPE_ARM_SMMUV3); object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), &error_abort); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ea2413a0bad..90a7099d3b5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1343,7 +1343,7 @@ static void create_smmu(const VirtMachineState *vms, return; } - dev = qdev_new("arm-smmuv3"); + dev = qdev_new(TYPE_ARM_SMMUV3); object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), &error_abort); From patchwork Fri Feb 3 14:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650064 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp853055pva; Fri, 3 Feb 2023 06:37:04 -0800 (PST) X-Google-Smtp-Source: AK7set9LalGAUFAziBk4nl4k9L6F7a2YWrUK+1itm0DN/wEe0azO6yddr6xT4/w7HZBJCgmz5x/G X-Received: by 2002:ac8:57c5:0:b0:3b8:6d74:234a with SMTP id w5-20020ac857c5000000b003b86d74234amr18650969qta.2.1675435023940; Fri, 03 Feb 2023 06:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675435023; cv=none; d=google.com; s=arc-20160816; b=WC85dVNAJ3lSvLy3r101nQKebOR+OSH9pJJj6sIh6PIVdPCEtEi7attLwQRxx95sY7 kfTRqOQXDnDuzDM0KovCqO1Gbv3Gt0/itNe5iiJmm+zzAGXs+58b15Kr8xLXRjnKYYZH XxWCGJPNQ3OBfQRehW4r3HkLf2PuiaeZXwJz6lpsIoiXjZWQX6/7ktjVOCdlCY2qy8Xz wOgAFe54IUN/cZZF1SYyIQWiccyp4M1ACLnd+662oZPYZXI/AG1mk3XbG2zHWLZyQrG/ XulslGHw9/F0CWd8MirWRSYTx8pyaEZsR3NQwlGPYZ9flD9LjOZr6M4tzWCfCB1d4d9W hwGg== 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=m8O7Eb+in4iFMyKSZKYhuiuIHFHL3PaJb5r8x77Y6qc=; b=uxX58qwClq1W8ugatsFXRRsEC/SkSmmAUts56YauCUKyvhLDErYqiO611esQN+PKR4 eC/i1ppFdyxU+jfIAfmYr1okAlGTNPN9pTGsDRTceBhmHN3P/OEgQByPVQlvoATVKgK9 1aDv6J/ssIg/qL0HsbrfW6OaaGrklxodXC4c3POTTz7J1OeuY0pgp2NP6Ldt06QS5gjz dGymIQFpFBEAZpH40cyZD5wUeWL52ZgX121XjJ969hJjLwAo7GZsRfrja7iVYJHEo7n1 oTW/Q7z9RgkglOHfxRxreNHra8gmG6hAqTJv+S//aYZS1/zI+YbN0ku69Ks8Bgtb4wgv sedw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8IPwMDB; 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 q15-20020a05622a030f00b003ab9329d092si1957329qtw.518.2023.02.03.06.37.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:37:03 -0800 (PST) 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=i8IPwMDB; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4Q-0006eJ-D5; Fri, 03 Feb 2023 09:29:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4I-0006cW-Ni for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:34 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4G-00053h-7Q for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:34 -0500 Received: by mail-wm1-x32f.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso6160135wms.0 for ; Fri, 03 Feb 2023 06:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=m8O7Eb+in4iFMyKSZKYhuiuIHFHL3PaJb5r8x77Y6qc=; b=i8IPwMDBK6D7U86NTuPt5cIyVUk6mlA4mBJvYgIojsxJzoWKibHeuVtli4qnDOL3pt Yd1ld05rY1iYMGsLT5sK2vg9mY+TmQ2TVs/TMmMR3xx6ZDb0RjpiG+7WrXdNZSZhkFhM fq6HG09ZyrS7ZODB9X3lz7t0UVq/c5gpZXxdUliRhtvixCSs027smHEyXP+S0KRc83QX 665VkBj3IGZ2/lflE+CCSqULaMib+1y4TKCByWbm5Q/Qhx/cG3vHJ3GP4kyGz4wZ+gQ4 0l98wD09AeQ7u+us2R2gdWqnlpmUGjXXsoSH69kT11YiFKcWHJSxhUNpgT3WJ5lCbSyN Lv5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m8O7Eb+in4iFMyKSZKYhuiuIHFHL3PaJb5r8x77Y6qc=; b=lFM0aJ9Locjf1yjQeCfmqoZGKETy2b7APbMYDI8AJwXMybAhSx0C0dAy/jdMbJWupX DyudobwH75ifZSdK8HWGnFlTnbogYMsKzH4ZO6K5hqbxeRYEEwLSZ/7Nnc86P0n33goa KF/T2DzZSKeS8ERz5Kg8lMy+U0Dd8o7qg+Y3XQz8HB2XVVREAjF1BM1jikLlr3zDB+oD 9HJHxc4bYCrqmE3jFzLcpynPXY+oXp2VZO/CfXIlFY6vqfWu0IDaZXDVdLW7iSsSVppo Zu8BHj7cbs3N5CDg/LoXJcGiQKmEYdP1dTx0PVf0R8jY2/ZuOIh6rSMOXAPoNZiWXQ/C YvrA== X-Gm-Message-State: AO0yUKXq8lmNAMhSptnlZO2h36cJy0E4mbMvjAsK6/i4wqSVrKrxqdUB 7g/nxxa9PuDRzGzzKfob+99OqBHKoMWdROUl X-Received: by 2002:a05:600c:4ec7:b0:3dc:5e0d:4ce7 with SMTP id g7-20020a05600c4ec700b003dc5e0d4ce7mr9786261wmq.11.1675434570955; Fri, 03 Feb 2023 06:29:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/33] target/arm: Fix physical address resolution for Stage2 Date: Fri, 3 Feb 2023 14:28:56 +0000 Message-Id: <20230203142927.834793-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 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-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Conversion to probe_access_full missed applying the page offset. Cc: qemu-stable@nongnu.org Reported-by: Sid Manning Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230126233134.103193-1-richard.henderson@linaro.org Fixes: f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking") Signed-off-by: Richard Henderson Signed-off-by: Peter Maydell --- target/arm/ptw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 57f3615a66d..2b125fff446 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -266,7 +266,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, if (unlikely(flags & TLB_INVALID_MASK)) { goto fail; } - ptw->out_phys = full->phys_addr; + ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK); ptw->out_rw = full->prot & PAGE_WRITE; pte_attrs = full->pte_attrs; pte_secure = full->attrs.secure; From patchwork Fri Feb 3 14:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650047 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849891pva; Fri, 3 Feb 2023 06:31:32 -0800 (PST) X-Google-Smtp-Source: AK7set/GaYFBRqAOWvTrLYuqBMmQUSICESvUdkAqtXGmWpF3tWTk7DyOQutXEpgJbk+LdBl6c/Lx X-Received: by 2002:a05:6214:502:b0:536:653d:9760 with SMTP id px2-20020a056214050200b00536653d9760mr13914590qvb.29.1675434692066; Fri, 03 Feb 2023 06:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434692; cv=none; d=google.com; s=arc-20160816; b=i1/KNoz66UaoZNmTS7+PLcvDeEEJf3YzBF8mHSCqrMJ1/Ppun6EpGQSXF56gg2D8ZS kqdL2WHElDQcTgV1AwLqt3AbU29OuV6RhTxfZ/8NcwCNCfzlDo+laJ9yFv0qLv+cm7hT /y/5NHeH0R5bAHkw/UhL86TpKmT0muQu3LudBEDr/fBpHrNuB0tnFid1dIQYzgjXMsP+ 9OJPNaGY13scZLJBKEBwpaQZR1149Eqsf9rC+756JdEPzfgiGgyDifOpRtWzeHWoQgQx WEC64sFD9NJRJgyOhDJftTsp+QST9zK+Ob4VJRMwXAR5N+RRKTfOCN0WVXIk4bffozIr YeiQ== 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=Dl2CfwC4j/0AnqvEmuWD2f4Vi2U4yq85CQrdrzm1Em8=; b=f4NouR7tL9Xss3yHITHkHkQJpkTrCdTaOOmVLVA5Z8osGJMFcBJHVMbA2Konv4HQrr FtxoI17EpvuQklUZGxrms5VaecDTF+jTxIFxbHlzjAA1HidDTRvQzgYYjEanoYC+mH0n Meo2YmLqAX0unwSFT4IXb5NN00t82yySEghE9/HPgCGLsgruKTjtfFHTmM1SgsC92+RO cVaWdLkNFW1gqMmUrPQ7olFhVzIfh1gOr7d4HhJhEG3pg570noWsxTpmQlvghZi9BkJJ Qtx5ZLrnEvY4GJWare4meenYyUUI6Xzp36+35Wzh2Xq2AgzC5hv7xmn3cLcqRRlaimWD bb9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p59wWQO8; 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 m7-20020a0cac47000000b0053181632467si1676404qvb.14.2023.02.03.06.31.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:32 -0800 (PST) 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=p59wWQO8; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4V-0006fM-1L; Fri, 03 Feb 2023 09:29:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4J-0006d3-DC for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:35 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4H-000545-DM for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:34 -0500 Received: by mail-wm1-x32e.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4002262wms.2 for ; Fri, 03 Feb 2023 06:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Dl2CfwC4j/0AnqvEmuWD2f4Vi2U4yq85CQrdrzm1Em8=; b=p59wWQO866sLgxt/UIMwhf6fFMGO5jiMxdiazwnw5dhkgM9wQy/uTcjDvtA7zF38mn s6osZszOW5nrHr7Zz3j9dLRwVOW7puO5IGlfM3ycF15osziz7GvAZBqZMdVI3MQv4IVM CNJ6ajYjZtjKeHKNcIpEIOvx3lI86baz1ei8e4OWzToviMtonevA5FzGl+LLQMGFUqyy /eXP1aIG/O4hVDk936rHDmoJxgCqHvqLgtA4wuDnglFdGj0FIMefhxlMx+0KQRN2guYx NNWeoxH/m/gptdm/eVvM4egHOOVEDZCJlGFFG9EaIHvzyfy9XsBUipcz5c+JQS4CiDfX W2IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dl2CfwC4j/0AnqvEmuWD2f4Vi2U4yq85CQrdrzm1Em8=; b=gOk+nDVzNoIi2HWzIbQrKt1GwgWeUN2mdyPiOuaFwuyvUMrp2YNF4qJW14XvmhwfYM e9pmuNwOci4pfsBo98OxGCxX+zPgCiweVuzk7cs1Fggd+f0lqzUFOEhaHfDhI8/djcNu 2zhsYzLxoFU/hDMKI1ITJ0UAeGh8uWAp9et9IApzcq62z54qxWNpZE1v2OnJUoiaJTPT CGaKoqAIZ+GYaT3PI4DAicrL8rTdOEsnhkF4j9aQl2/esQ9/hoL+1zNO69NqFz+O0Ls1 o0AkB4aB0yeHsfL4u4oVwP2m8ofGy+9dgmlbJTHbDiKzIftHaTtmtKF5wvgSzu5yi5Nf tjMA== X-Gm-Message-State: AO0yUKUwhH76CQR3IcJIhiH2zull0trcHZon21CPPDV3WT/FW/dE/wCB yDOoy6fDGfgPc5iIZQN0tnA1Oas0ZtlHUyvG X-Received: by 2002:a05:600c:4447:b0:3d8:e0d3:ee24 with SMTP id v7-20020a05600c444700b003d8e0d3ee24mr12219695wmn.37.1675434571825; Fri, 03 Feb 2023 06:29:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/33] hw/char/pl011: refactor FIFO depth handling code Date: Fri, 3 Feb 2023 14:28:57 +0000 Message-Id: <20230203142927.834793-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org From: Evgeny Iakovlev PL011 can be in either of 2 modes depending guest config: FIFO and single register. The last mode could be viewed as a 1-element-deep FIFO. Current code open-codes a bunch of depth-dependent logic. Refactor FIFO depth handling code to isolate calculating current FIFO depth. One functional (albeit guest-invisible) side-effect of this change is that previously we would always increment s->read_pos in UARTDR read handler even if FIFO was disabled, now we are limiting read_pos to not exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230123162304.26254-2-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- include/hw/char/pl011.h | 5 ++++- hw/char/pl011.c | 30 ++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h index dc2c90eedca..926322e242d 100644 --- a/include/hw/char/pl011.h +++ b/include/hw/char/pl011.h @@ -27,6 +27,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(PL011State, PL011) /* This shares the same struct (and cast macro) as the base pl011 device */ #define TYPE_PL011_LUMINARY "pl011_luminary" +/* Depth of UART FIFO in bytes, when FIFO mode is enabled (else depth == 1) */ +#define PL011_FIFO_DEPTH 16 + struct PL011State { SysBusDevice parent_obj; @@ -39,7 +42,7 @@ struct PL011State { uint32_t dmacr; uint32_t int_enabled; uint32_t int_level; - uint32_t read_fifo[16]; + uint32_t read_fifo[PL011_FIFO_DEPTH]; uint32_t ilpr; uint32_t ibrd; uint32_t fbrd; diff --git a/hw/char/pl011.c b/hw/char/pl011.c index c076813423f..3fa3b75d042 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -81,6 +81,17 @@ static void pl011_update(PL011State *s) } } +static bool pl011_is_fifo_enabled(PL011State *s) +{ + return (s->lcr & 0x10) != 0; +} + +static inline unsigned pl011_get_fifo_depth(PL011State *s) +{ + /* Note: FIFO depth is expected to be power-of-2 */ + return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; +} + static uint64_t pl011_read(void *opaque, hwaddr offset, unsigned size) { @@ -94,8 +105,7 @@ static uint64_t pl011_read(void *opaque, hwaddr offset, c = s->read_fifo[s->read_pos]; if (s->read_count > 0) { s->read_count--; - if (++s->read_pos == 16) - s->read_pos = 0; + s->read_pos = (s->read_pos + 1) & (pl011_get_fifo_depth(s) - 1); } if (s->read_count == 0) { s->flags |= PL011_FLAG_RXFE; @@ -273,11 +283,7 @@ static int pl011_can_receive(void *opaque) PL011State *s = (PL011State *)opaque; int r; - if (s->lcr & 0x10) { - r = s->read_count < 16; - } else { - r = s->read_count < 1; - } + r = s->read_count < pl011_get_fifo_depth(s); trace_pl011_can_receive(s->lcr, s->read_count, r); return r; } @@ -286,15 +292,15 @@ static void pl011_put_fifo(void *opaque, uint32_t value) { PL011State *s = (PL011State *)opaque; int slot; + unsigned pipe_depth; - slot = s->read_pos + s->read_count; - if (slot >= 16) - slot -= 16; + pipe_depth = pl011_get_fifo_depth(s); + slot = (s->read_pos + s->read_count) & (pipe_depth - 1); s->read_fifo[slot] = value; s->read_count++; s->flags &= ~PL011_FLAG_RXFE; trace_pl011_put_fifo(value, s->read_count); - if (!(s->lcr & 0x10) || s->read_count == 16) { + if (s->read_count == pipe_depth) { trace_pl011_put_fifo_full(); s->flags |= PL011_FLAG_RXFF; } @@ -359,7 +365,7 @@ static const VMStateDescription vmstate_pl011 = { VMSTATE_UINT32(dmacr, PL011State), VMSTATE_UINT32(int_enabled, PL011State), VMSTATE_UINT32(int_level, PL011State), - VMSTATE_UINT32_ARRAY(read_fifo, PL011State, 16), + VMSTATE_UINT32_ARRAY(read_fifo, PL011State, PL011_FIFO_DEPTH), VMSTATE_UINT32(ilpr, PL011State), VMSTATE_UINT32(ibrd, PL011State), VMSTATE_UINT32(fbrd, PL011State), From patchwork Fri Feb 3 14:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650050 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850551pva; Fri, 3 Feb 2023 06:32:33 -0800 (PST) X-Google-Smtp-Source: AK7set+MLdEQBMcUGKrHLcPn9WOjc9nZvackZVYJbwY9nX0yQWteTTRYZVCgLADfP266So2UryDk X-Received: by 2002:ac8:5704:0:b0:3a9:86dd:3c60 with SMTP id 4-20020ac85704000000b003a986dd3c60mr18843226qtw.47.1675434753829; Fri, 03 Feb 2023 06:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434753; cv=none; d=google.com; s=arc-20160816; b=0qn385UeCvwA5LcAebejMukCcvUdVeIopO/K2kBHGNN5AlKieAKvJ/qCmgviR12XiQ KIWWvwKw7Wldg79/rYxM9GspsxP6Eva1anQnQlNPDqOQMtprqfGkxeug83zesZ+NcSue ZIXW97fUy7X4D8Vcyx+pLbgcdlC4dHUuoIfAm0TQC9abog7bJ7COpXbgTv497+ci+AaT +1bWD3UOdAh/qLDotaTOUG4tDPzGbhE7kircynKbM3ZWOKjnmVxRE1M3t/YAiYI782T2 OSOmwaJGzBF7o37KhVJj6LdTn9GA75QMIDXbcaIdSXoR7WZhWkOxMICpM+45U2lZjkjf 1EDw== 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=yxaajrT8hw/p9R5XVhSvXLClGevo4qVUStBee60tFvg=; b=RNrBYgBKR9HzguxpeAYaNn++OYxO+XQQFkRRWxyIOQ5FT33dmmEzEkh7KpLviNLofF xn3gZH3LmoETnQziAsKctsJU06UUmf2hNFpRGBfZVDr+1KAHPBCVHAaPcJVfoV7Hat6S Lce03F368kugrd1bAQMU5w/xHt+fn/y0Tqv2ONogRGKeF+vfXB/HeJaa7VPp0dRte2HX spHHaQMiOHceHT2YWhiaOoiYJ5ai2z5/3Xk+SHCyaALvXC3W4iwLvYtkpUdIg2DAfd3c ZU7RUYWdDCJVFqhcQI5y+WbjajNwMCffCzSJ2laX/VV6AFkB5dD+A24UlKBRZv2T2XYO 5E7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J8I6OgG4; 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 k13-20020ac85fcd000000b003b6472c386asi1931535qta.39.2023.02.03.06.32.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:32:33 -0800 (PST) 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=J8I6OgG4; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4V-0006g1-DO; Fri, 03 Feb 2023 09:29:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4L-0006dI-1x for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:37 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4I-00054B-0a for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:35 -0500 Received: by mail-wm1-x330.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4002293wms.2 for ; Fri, 03 Feb 2023 06:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yxaajrT8hw/p9R5XVhSvXLClGevo4qVUStBee60tFvg=; b=J8I6OgG4yK64MYUVV3p0iaHxs/3GpP91jZfikVKcQBZn3XTtvbyiGpGPIF/GuHqozn bxzoz00vjXlc2g/yTmEcfwnCt3Wk1wu8qYevABdr+o3ryKyoU/7P/rqO0Krgc4081hdK L5/noIUY97aaduO/u39v0BQjpG0KbSqE5dGdUPIgR3eOQocTz7j/GFYV6GLmc5BtKeZw Gu6RhOND6QJeC703/+MXq9nGFi7TP9Lz8YYtMHlm5+jPTwnHSaMl/so0HtQ1MrByBMrE 1q6xKalw5yb9bC7OUhJZIqN/es/qm9t0HUtDdUX6FZ3ttMHwN2INT7ZOte9O9NnPNsJp YErQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yxaajrT8hw/p9R5XVhSvXLClGevo4qVUStBee60tFvg=; b=Mj7PEMPzgh8VcFgJzNv9LFGFfCQ1/5F3VmwwDnjTeF7pX5lcAuK37hJN4ssxLq8ove Bsn0pzqgzn2d2/8h+BsAD5oEnu5D9ebLcf/0zGMgJQSkpLfRnh8Hf0hnM4nt177bD49d TCKRHPJFPGskE8J0QJrlxqhLLNfNHVEwbdQEgP7WybtcoQT5jbvLPqwdbZ9Et04kNy5p jD/+RfvAwXr+5Sj0OeerMMjYvrEoTwpRhmW3kwmqen+fWiVPv6yRGfPoFbw/yu6UDmSX kQl/qZk69DRlDp+Hkefdu47FXIRhYEr2gc/KWS8hCHiojKam79RmDZb34J8tyFJimOnV nnmw== X-Gm-Message-State: AO0yUKWa8Ln12ZgMxzJjwdbU8Qm6JhjPVaVMO4ZugmPiRzJ3K2mvT8qD Ya+zXmEarWynwUqcS+QOpnXUj+qhjbrk8/3U X-Received: by 2002:a7b:c85a:0:b0:3d2:392e:905f with SMTP id c26-20020a7bc85a000000b003d2392e905fmr9589877wml.24.1675434572659; Fri, 03 Feb 2023 06:29:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/33] hw/char/pl011: add post_load hook for backwards-compatibility Date: Fri, 3 Feb 2023 14:28:58 +0000 Message-Id: <20230203142927.834793-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 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-bounces+patch=linaro.org@nongnu.org From: Evgeny Iakovlev Previous change slightly modified the way we handle data writes when FIFO is disabled. Previously we kept incrementing read_pos and were storing data at that position, although we only have a single-register-deep FIFO now. Then we changed it to always store data at pos 0. If guest disables FIFO and the proceeds to read data, it will work out fine, because we still read from current read_pos before setting it to 0. However, to make code less fragile, introduce a post_load hook for PL011State and move fixup read FIFO state when FIFO is disabled. Since we are introducing a post_load hook, also do some sanity checking on untrusted incoming input state. Signed-off-by: Evgeny Iakovlev Message-id: 20230123162304.26254-3-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- hw/char/pl011.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 3fa3b75d042..05e8bdc050e 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -352,10 +352,35 @@ static const VMStateDescription vmstate_pl011_clock = { } }; +static int pl011_post_load(void *opaque, int version_id) +{ + PL011State* s = opaque; + + /* Sanity-check input state */ + if (s->read_pos >= ARRAY_SIZE(s->read_fifo) || + s->read_count > ARRAY_SIZE(s->read_fifo)) { + return -1; + } + + if (!pl011_is_fifo_enabled(s) && s->read_count > 0 && s->read_pos > 0) { + /* + * Older versions of PL011 didn't ensure that the single + * character in the FIFO in FIFO-disabled mode is in + * element 0 of the array; convert to follow the current + * code's assumptions. + */ + s->read_fifo[0] = s->read_fifo[s->read_pos]; + s->read_pos = 0; + } + + return 0; +} + static const VMStateDescription vmstate_pl011 = { .name = "pl011", .version_id = 2, .minimum_version_id = 2, + .post_load = pl011_post_load, .fields = (VMStateField[]) { VMSTATE_UINT32(readbuff, PL011State), VMSTATE_UINT32(flags, PL011State), From patchwork Fri Feb 3 14:28:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650062 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp853020pva; Fri, 3 Feb 2023 06:37:01 -0800 (PST) X-Google-Smtp-Source: AK7set9v73DLF42O9d1D59ERz0HYCJKyWxeyqNnWygYtNYxjw2WKDM9tzcp6xYHoWa+upuwCwL5L X-Received: by 2002:ad4:5f0f:0:b0:56a:289d:e77 with SMTP id fo15-20020ad45f0f000000b0056a289d0e77mr2309214qvb.12.1675435021093; Fri, 03 Feb 2023 06:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675435021; cv=none; d=google.com; s=arc-20160816; b=C9xuXNuHzU1jxZZZcXNVdJixLFBtd5R2PRgqU063hSP1QhJI8vIIt8lLTcvbegGcUZ RpoxnpoX9iy+fkyWi9GXgy7agLG+Q7nlkkHzk4nbgbzAzOeBtK/1NiqEyySwQnJ/U5ZB 0blG+pvk4jXCIfFkBP7B+oLmV4ruFr4F6cZ1F4y1fNmwcXepRfkDILS8a4dSbIq8lNWI ErGbPYIYR7s3SAKENny8QvJdTGtmqGN0Rn7iw3Ume71jm/1yZpQnCW/BTJ8jZVuUlfzY 8xL6LwpnweQakJKiW2jSmLknms3YbdU8lusQWO/TJcDn7JZhIGLnd1S4hBI3AbFNYzSq ckQg== 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=kl1m+bg2bq062qmRTd0sPieM4oFZq05ngUG4exabYiE=; b=ymGvkNZ9EKBt9NC7lNFdMM0/3hXqkXTlyz0mHFk16WWlagdwDZ/o5RkVmkzeZtNrVb IEhm1mxBQ/I6ZJZelmOTs9qyWbpgEnwx4Ehf01aqCXAJdr90GPIViT4XDs2/bfMl3L6M M5/5sQ1K4uBjGTNelQhZz5/VkgWXLcfG8O675r6/xdbD6NUPlEqB7EMM/Qwj5bvA4jPq VoTCqY3hr0o+w5Nx+A7hArWfOw5YzDETBNaOPO2XM96BZT3uV5Ez7KeuFZSVNrJcQxcU 8M97LOQArEwDPVNSVfgQG/XxDWhX/9BUFy2cLEbvpPF9TEF4rvKv5lSyQCQCY67A0q3g nKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vRIphZWT; 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 d3-20020a05621421c300b005376f7b8711si2198006qvh.266.2023.02.03.06.37.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:37:01 -0800 (PST) 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=vRIphZWT; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4W-0006gJ-2P; Fri, 03 Feb 2023 09:29:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4N-0006db-3d for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:40 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4J-00054S-5m for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so6153045wma.1 for ; Fri, 03 Feb 2023 06:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kl1m+bg2bq062qmRTd0sPieM4oFZq05ngUG4exabYiE=; b=vRIphZWTyMirEag0ZByn3ahSC+LS3YF5LTF8PEW944bS+7rz6vquIpNk11tce3yYSF /EifeI8X4YS2x+Ju5pK+pQ8NITXhZNPZ8MHwoZuKXcjAoVO7weyMArfEg6syA4MTKIQW MMR4Q5e31SkniAX4ZiSYtbEbPz4v++3RSV4H6SbIDemrOlwmWnhytmKlNiGYThFA+ZoB HfniOlAJwVGYxfQwFlO3fx6j92pxGc6ZuPG9F//n0ptcLZGfnONL35eOBSRjH5g3jJfO FqeDT+EGqOotjuT5+3PDIDZ245yWLgRlwizFIPN0fsGuyqtczy5tpnST0TvWJWrrOXgK bPpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kl1m+bg2bq062qmRTd0sPieM4oFZq05ngUG4exabYiE=; b=GksWlQ3ja7q1fOoxrB0bdr0jpeNc+a60Awu9dOud/6MemtlL/DCjiw7Ri6ZhqYv3aT DdASa6E55UZoed27F54g9kv+zTt1aQQvxCxQu10E4NPL4A7tZD7iU7lVsXXa/lCqZzgx 5CSnXlfSN/lCk5n5iF41bUvbXT4mVQtN2YPdIqSzRGB5QD1nGBRTSfcQ7TOeItaZt41x 5Jro5uxJt7u8cR3XovZecifGqvd3k9xGAyREtiGYIYFw45HomJzSlQ64g6Fd8q4BZsnO excvgDtYsQ1OheBQTw9Oo955d35ApEPRof8GbvMN7PmWdx0zkSgRZXcLjyi78Ja4FIvk hqxQ== X-Gm-Message-State: AO0yUKXnu668xb1m+EoS5z89N3jUvLFracBi3NczFmWFxo3LKUyAiq85 LoNFuG8SxATkyflMbUfLJwtDv99xoiisYGws X-Received: by 2002:a1c:4c17:0:b0:3db:262a:8ef with SMTP id z23-20020a1c4c17000000b003db262a08efmr10095638wmf.38.1675434573525; Fri, 03 Feb 2023 06:29:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/33] hw/char/pl011: implement a reset method Date: Fri, 3 Feb 2023 14:28:59 +0000 Message-Id: <20230203142927.834793-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org From: Evgeny Iakovlev PL011 currently lacks a reset method. Implement it. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230123162304.26254-4-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- hw/char/pl011.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 05e8bdc050e..ca7537d8ed2 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -427,11 +427,6 @@ static void pl011_init(Object *obj) s->clk = qdev_init_clock_in(DEVICE(obj), "clk", pl011_clock_update, s, ClockUpdate); - s->read_trigger = 1; - s->ifl = 0x12; - s->cr = 0x300; - s->flags = 0x90; - s->id = pl011_id_arm; } @@ -443,11 +438,32 @@ static void pl011_realize(DeviceState *dev, Error **errp) pl011_event, NULL, s, NULL, true); } +static void pl011_reset(DeviceState *dev) +{ + PL011State *s = PL011(dev); + + s->lcr = 0; + s->rsr = 0; + s->dmacr = 0; + s->int_enabled = 0; + s->int_level = 0; + s->ilpr = 0; + s->ibrd = 0; + s->fbrd = 0; + s->read_pos = 0; + s->read_count = 0; + s->read_trigger = 1; + s->ifl = 0x12; + s->cr = 0x300; + s->flags = 0x90; +} + static void pl011_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = pl011_realize; + dc->reset = pl011_reset; dc->vmsd = &vmstate_pl011; device_class_set_props(dc, pl011_properties); } From patchwork Fri Feb 3 14:29:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650048 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849999pva; Fri, 3 Feb 2023 06:31:41 -0800 (PST) X-Google-Smtp-Source: AK7set+qWmu5LetGibHieQWEV22F8d9EEvDSeFneBxbCwYxCVXZmuXpUCYIxsaLLLe0Q0/v6MR94 X-Received: by 2002:a81:fe08:0:b0:473:b1e2:846d with SMTP id j8-20020a81fe08000000b00473b1e2846dmr5563437ywn.19.1675434700821; Fri, 03 Feb 2023 06:31:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434700; cv=none; d=google.com; s=arc-20160816; b=gXZBxJQgt3mscO+1jktvCStHwg97cUNb5Ad3Eyn6dDXWD6BXYTkuu/M4ZzktrKXIIQ K3s4J4TqLhZafz/lUFmko3wJOb2gilaeVfFtosL/cBz1M/3Y7qWdmYfv+swwIHMWvlR0 EQ3thpAWrkeQ0LJ92ZbhwyEShxfpAdLRt4W0qP1U+uRhjFZs+f5qUuAVlpjnqkVuedw6 QSo5By+71Jl+HVKxaRBnzVvMdzFIPs0M5qgrZEajYnubCTchGET/DV74bY0MD2TbxgI/ 16/nDpSH37yUK7LvqaMXYCsu/S/NUN3JtvSt9vFZin/WOjRPvvQ2SEHpFvkNoX+5Z8Mc W+eA== 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=vPVJCWB3C3sZSgsGNanDCbKT7SX6LCAO601kW+euxik=; b=KBCDpAr7FTe1RgS0u7p1PESaHQ4gb+EmP2e4zohAkTdE3znfapAkULXZ09sXIRFPmz ST3mvWr2kgJSC+ohZCe4jI7uCWCi3EbjJqV3NhgpyTlS+jFjGIZKArQ7EniVZju8ItQc NOa5a36toDeGEhRilRNUlP7tpCvGG45xwcS5Ol1t3XqbXGg8wlzDlry/vyTCFIkxuSlz 7p2qPSouCGxwfmIkMfl72T+9j8hdc6DFdQr98D9xHMCuhixIaimt9cWJHO2Bz7uvHrux S5iFU1PPkLH4jHBHkPDG0veeFr7mgWmtAuZ51RB8IBgJzOktQYMEp3tjoOHsJFNa0RW4 dEQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FpBIaM3X; 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 80-20020a370453000000b007204574662fsi2129483qke.406.2023.02.03.06.31.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:40 -0800 (PST) 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=FpBIaM3X; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006jQ-RD; Fri, 03 Feb 2023 09:29:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4T-0006f4-Fq for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:46 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4K-00054x-87 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:40 -0500 Received: by mail-wr1-x42b.google.com with SMTP id j25so1277741wrc.4 for ; Fri, 03 Feb 2023 06:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vPVJCWB3C3sZSgsGNanDCbKT7SX6LCAO601kW+euxik=; b=FpBIaM3XdddGB2IqZS6R6yqeKLqK6EJv9gHWvP6NcL8r8e3HrOK+f7xwhPDegBBZxE 7bgdmGRo5q/qvcuhZq4lcYYVDUSbovpuFFy2DEsT3qDQBVx1lpXRosPD1dFpJqpzJSIQ gGWEccvvUpTR+0lBRLh1+pMGRrpDe0WmR9BQgosv0saE9wwejkuAS/6MhYeNhngRw2aR ZQxPayLjM9eu0jvGBoXR3fOASwhJTDaiaX7VIWbsCbskpBMAMHQGn+9cK0BMRIl0HPYj 0oVrGK9zam2EVoxb5lgtrqdrsNpLPPlikgMjjHYGcRi5sO/slugTCQUlB1n/1V3HZZLw fA/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vPVJCWB3C3sZSgsGNanDCbKT7SX6LCAO601kW+euxik=; b=QwuKdKfgEVT8uCpSMmlaqZVHRgUC/Lo2rd+Kme9EIYpH35Qfuzb6IKvnP9bqQifEr+ FReG7KDhqlo77llb5VZ9ffY9m2FPaqCdpePtrAREIvp3op6yuQRlwxmcsfExxfJOq41Y aCewqYiHMRneWSNO6RgX4X0ow2Jcp8b+xn+YXWA4pS+K+2QX+X3kQftRtWXjm0j2wPsE o1uW5uo7H1iEaq2lGRHCDlgbb6FersYviu8sxQFziTqYpT/Wx52nI4n2S2rUKMG8bvBF pKEhiS8thuh6C9dz/8eaTUa1PxQUnjqOx6wmuEGQ38RngUuION0m46Ne5RsC7WeqcD2e NpqA== X-Gm-Message-State: AO0yUKXAOGvhNZpQ2Qwa7r/wJBZNXnTs+qYnZe38Wmo+C+xVvVb7bpHg SULdkvon6l291Pnr7ufYTxg/ciF6cIzFWpTQ X-Received: by 2002:a5d:5092:0:b0:2bf:9468:340 with SMTP id a18-20020a5d5092000000b002bf94680340mr7874118wrt.19.1675434574257; Fri, 03 Feb 2023 06:29:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/33] hw/char/pl011: better handling of FIFO flags on LCR reset Date: Fri, 3 Feb 2023 14:29:00 +0000 Message-Id: <20230203142927.834793-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org From: Evgeny Iakovlev Current FIFO handling code does not reset RXFE/RXFF flags when guest resets FIFO by writing to UARTLCR register, although internal FIFO state is reset to 0 read count. Actual guest-visible flag update will happen only on next data read or write attempt. As a result of that any guest that expects RXFE flag to be set (and RXFF to be cleared) after resetting FIFO will never see that happen. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Message-id: 20230123162304.26254-5-eiakovlev@linux.microsoft.com Signed-off-by: Peter Maydell --- hw/char/pl011.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index ca7537d8ed2..c15cb7af20b 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -92,6 +92,16 @@ static inline unsigned pl011_get_fifo_depth(PL011State *s) return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; } +static inline void pl011_reset_fifo(PL011State *s) +{ + s->read_count = 0; + s->read_pos = 0; + + /* Reset FIFO flags */ + s->flags &= ~(PL011_FLAG_RXFF | PL011_FLAG_TXFF); + s->flags |= PL011_FLAG_RXFE | PL011_FLAG_TXFE; +} + static uint64_t pl011_read(void *opaque, hwaddr offset, unsigned size) { @@ -239,8 +249,7 @@ static void pl011_write(void *opaque, hwaddr offset, case 11: /* UARTLCR_H */ /* Reset the FIFO state on FIFO enable or disable */ if ((s->lcr ^ value) & 0x10) { - s->read_count = 0; - s->read_pos = 0; + pl011_reset_fifo(s); } if ((s->lcr ^ value) & 0x1) { int break_enable = value & 0x1; @@ -450,12 +459,11 @@ static void pl011_reset(DeviceState *dev) s->ilpr = 0; s->ibrd = 0; s->fbrd = 0; - s->read_pos = 0; - s->read_count = 0; s->read_trigger = 1; s->ifl = 0x12; s->cr = 0x300; - s->flags = 0x90; + s->flags = 0; + pl011_reset_fifo(s); } static void pl011_class_init(ObjectClass *oc, void *data) From patchwork Fri Feb 3 14:29:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650054 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850972pva; Fri, 3 Feb 2023 06:33:20 -0800 (PST) X-Google-Smtp-Source: AK7set/9m9E7qVVLHmpoPpfUURwNWsIsNTtSMQK52Yj00QT/uqOTYaQU91qdhXHeAuFNb1zIwa5x X-Received: by 2002:ad4:4d03:0:b0:53c:e8c2:122c with SMTP id l3-20020ad44d03000000b0053ce8c2122cmr16723523qvl.17.1675434800197; Fri, 03 Feb 2023 06:33:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434800; cv=none; d=google.com; s=arc-20160816; b=qFjUAAT9kASRBi2hfR3V55RDnsppk3Y3y+0KGKiJCjPw0W6Ohw7+U4IQYnN29u2BwS EZQJJPkOBZL/rVUJz204rpqcpQ83mIexncP6KWw9vDR8h/Rfb8LCZqgq06Uz0QTGkQwI fEXzzRfrsJKY+kIY2RYpYdLZqkNbWh7kN21CZ0eQaVY97SIJobpa2TB8bFTw1htqaYrL tVZC34kuNZumXmOqmBm29bO6e7xtHk/qSNZilSOF1BqSpWtB6bGMJIqhG+0+AoqpEr/g CJcRLzx9i+DSYZf6dQignmgZa6YrWfyF1KxtLZuqxgaNUexFL9J7XFLjHsBkTPawR/It ph9A== 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=xjR2XR977p7LFkCyD/RSl9r6hvoh3VT3zTXhEMUsJd8=; b=htxVHp/Ed71nyDG5en1FRkBdK9tIoVdU1jC3cjtKiGl8nDtsVDIBdyOxGsb6BWkTx9 fzUUdmRT2AmDNPRmpnhbigtMNTN/pj4kpe5LoPtp3yNfal7GS+a9Xy65vWAKSmq/hdZJ 180Etsi1+VaCNMc6pB9I6/99QOP9oUfwSUQX/qfqkaayn0/9VNvstWc5XRbJ523I42SP k8Hv0B+217XmCF8LqyYaCVO2TwouBZSBFaWP3oLyxPhZTJL8bwuW7lFrIMLr9vfVQ0Gp /bbPIeDrCuGjckQ1IQbxN6TfbmYmoX2sN3raPnMVzTypcvHhl9rDuPVP696Y7cNIidki 4gLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ru7LF32+; 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 2-20020a05621420c200b0053769653cf4si2077922qve.553.2023.02.03.06.33.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:20 -0800 (PST) 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=ru7LF32+; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4W-0006gi-P1; Fri, 03 Feb 2023 09:29:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4S-0006f3-Nw for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:45 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4K-00053d-Ex for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:40 -0500 Received: by mail-wm1-x333.google.com with SMTP id q8so3999749wmo.5 for ; Fri, 03 Feb 2023 06:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xjR2XR977p7LFkCyD/RSl9r6hvoh3VT3zTXhEMUsJd8=; b=ru7LF32+GMvqBKUzoUsMR6hQDS6MrPomUhCpMiIu4ZoAFFr66bVMlWYFkCS6hh23Iw IgLAYpMS+il8iceVds/doOrOhUiCA7VHmX38VvX9QiY5FUj/qTC8PE4bM6EQcK/R6hFG aMRDrdX/X3VY37PV2zzlcFQTxnf4/Cihh8DHkK4QhaRzz6JiPtsYP6YLBanT+G4F7Exq D7Bn1FryShyN/VXvl8KBK1VBBeOP/dpQPqBfPSG/Gm9X0nMpG3+Nws4ck96Fv0b1P0E+ fpWS851tzn2Bz4jkGJxbnUef3EWyz3h9C9XywAtamcN7bQ2LsK5KrBWCVUlnCWM2U6jT aRvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xjR2XR977p7LFkCyD/RSl9r6hvoh3VT3zTXhEMUsJd8=; b=DNa5IS2sM7cpO13Z2BXF8TQhoR7SUAjhKEu+8nrEpkNoUQAABnSmtRYmIBo1kLrhHb K3UQmHvUDQ5RWPUiIiDcfORCV1cPiHJfBm3/Cr0qI3bJj3Sp8DP8Bc+H3UdI0z7q+Mjx CXfzi4owN4u4lpKaeYzRXqPjkywMQ5HusJ5Ds8m7uik1krRTusejDav7mppd7FIJXn7S 9U3bioAdw7UU1yaYDfJXnfs7iOPkRQ32JfjT9DHB+t9RRkK3WPxxY5+51RARR+RwYrrL 3bc+p1Si/6eSzetpIZno+3rw78mVH0Dbiuq9eRx3k1fqXKUDLnMheJKUqgBro5GLpLiQ F8iA== X-Gm-Message-State: AO0yUKWnS3hMnP6ab2Rw1mNE+YL4NbZsMFpnewdVbKyLdmd1g3eri9sn tTF33Uot5Tms6uAnoCccAsF6BoRzmLWseKxb X-Received: by 2002:a7b:ce85:0:b0:3dc:50c2:cc1 with SMTP id q5-20020a7bce85000000b003dc50c20cc1mr10069615wmj.23.1675434575021; Fri, 03 Feb 2023 06:29:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/33] hvf: arm: Add support for GICv3 Date: Fri, 3 Feb 2023 14:29:01 +0000 Message-Id: <20230203142927.834793-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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 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-bounces+patch=linaro.org@nongnu.org From: Alexander Graf We currently only support GICv2 emulation. To also support GICv3, we will need to pass a few system registers into their respective handler functions. This patch adds support for HVF to call into the TCG callbacks for GICv3 system register handlers. This is safe because the GICv3 TCG code is generic as long as we limit ourselves to EL0 and EL1 - which are the only modes supported by HVF. To make sure nobody trips over that, we also annotate callbacks that don't work in HVF mode, such as EL state change hooks. With GICv3 support in place, we can run with more than 8 vCPUs. Signed-off-by: Alexander Graf Message-id: 20230128224459.70676-1-agraf@csgraf.de Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_cpuif.c | 16 +++- target/arm/hvf/hvf.c | 151 ++++++++++++++++++++++++++++++++++++ target/arm/hvf/trace-events | 2 + 3 files changed, 168 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index b17b29288c7..9a7fc190994 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -21,6 +21,8 @@ #include "hw/irq.h" #include "cpu.h" #include "target/arm/cpregs.h" +#include "sysemu/tcg.h" +#include "sysemu/qtest.h" /* * Special case return value from hppvi_index(); must be larger than @@ -2810,6 +2812,8 @@ void gicv3_init_cpuif(GICv3State *s) * which case we'd get the wrong value. * So instead we define the regs with no ri->opaque info, and * get back to the GICv3CPUState from the CPUARMState. + * + * These CP regs callbacks can be called from either TCG or HVF code. */ define_arm_cp_regs(cpu, gicv3_cpuif_reginfo); @@ -2905,6 +2909,16 @@ void gicv3_init_cpuif(GICv3State *s) define_arm_cp_regs(cpu, gicv3_cpuif_ich_apxr23_reginfo); } } - arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); + if (tcg_enabled() || qtest_enabled()) { + /* + * We can only trap EL changes with TCG. However the GIC interrupt + * state only changes on EL changes involving EL2 or EL3, so for + * the non-TCG case this is OK, as EL2 and EL3 can't exist. + */ + arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); + } else { + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL2)); + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL3)); + } } } diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 060aa0ccf4b..ad65603445e 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -80,6 +80,33 @@ #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7) +#define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4) +#define SYSREG_ICC_AP0R1_EL1 SYSREG(3, 0, 12, 8, 5) +#define SYSREG_ICC_AP0R2_EL1 SYSREG(3, 0, 12, 8, 6) +#define SYSREG_ICC_AP0R3_EL1 SYSREG(3, 0, 12, 8, 7) +#define SYSREG_ICC_AP1R0_EL1 SYSREG(3, 0, 12, 9, 0) +#define SYSREG_ICC_AP1R1_EL1 SYSREG(3, 0, 12, 9, 1) +#define SYSREG_ICC_AP1R2_EL1 SYSREG(3, 0, 12, 9, 2) +#define SYSREG_ICC_AP1R3_EL1 SYSREG(3, 0, 12, 9, 3) +#define SYSREG_ICC_ASGI1R_EL1 SYSREG(3, 0, 12, 11, 6) +#define SYSREG_ICC_BPR0_EL1 SYSREG(3, 0, 12, 8, 3) +#define SYSREG_ICC_BPR1_EL1 SYSREG(3, 0, 12, 12, 3) +#define SYSREG_ICC_CTLR_EL1 SYSREG(3, 0, 12, 12, 4) +#define SYSREG_ICC_DIR_EL1 SYSREG(3, 0, 12, 11, 1) +#define SYSREG_ICC_EOIR0_EL1 SYSREG(3, 0, 12, 8, 1) +#define SYSREG_ICC_EOIR1_EL1 SYSREG(3, 0, 12, 12, 1) +#define SYSREG_ICC_HPPIR0_EL1 SYSREG(3, 0, 12, 8, 2) +#define SYSREG_ICC_HPPIR1_EL1 SYSREG(3, 0, 12, 12, 2) +#define SYSREG_ICC_IAR0_EL1 SYSREG(3, 0, 12, 8, 0) +#define SYSREG_ICC_IAR1_EL1 SYSREG(3, 0, 12, 12, 0) +#define SYSREG_ICC_IGRPEN0_EL1 SYSREG(3, 0, 12, 12, 6) +#define SYSREG_ICC_IGRPEN1_EL1 SYSREG(3, 0, 12, 12, 7) +#define SYSREG_ICC_PMR_EL1 SYSREG(3, 0, 4, 6, 0) +#define SYSREG_ICC_RPR_EL1 SYSREG(3, 0, 12, 11, 3) +#define SYSREG_ICC_SGI0R_EL1 SYSREG(3, 0, 12, 11, 7) +#define SYSREG_ICC_SGI1R_EL1 SYSREG(3, 0, 12, 11, 5) +#define SYSREG_ICC_SRE_EL1 SYSREG(3, 0, 12, 12, 5) + #define WFX_IS_WFE (1 << 0) #define TMR_CTL_ENABLE (1 << 0) @@ -788,6 +815,43 @@ static bool is_id_sysreg(uint32_t reg) SYSREG_CRM(reg) < 8; } +static uint32_t hvf_reg2cp_reg(uint32_t reg) +{ + return ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, + (reg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK, + (reg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK, + (reg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK, + (reg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK, + (reg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK); +} + +static bool hvf_sysreg_read_cp(CPUState *cpu, uint32_t reg, uint64_t *val) +{ + ARMCPU *arm_cpu = ARM_CPU(cpu); + CPUARMState *env = &arm_cpu->env; + const ARMCPRegInfo *ri; + + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); + if (ri) { + if (ri->accessfn) { + if (ri->accessfn(env, ri, true) != CP_ACCESS_OK) { + return false; + } + } + if (ri->type & ARM_CP_CONST) { + *val = ri->resetvalue; + } else if (ri->readfn) { + *val = ri->readfn(env, ri); + } else { + *val = CPREG_FIELD64(env, ri); + } + trace_hvf_vgic_read(ri->name, *val); + return true; + } + + return false; +} + static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) { ARMCPU *arm_cpu = ARM_CPU(cpu); @@ -839,6 +903,36 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) case SYSREG_OSDLR_EL1: /* Dummy register */ break; + case SYSREG_ICC_AP0R0_EL1: + case SYSREG_ICC_AP0R1_EL1: + case SYSREG_ICC_AP0R2_EL1: + case SYSREG_ICC_AP0R3_EL1: + case SYSREG_ICC_AP1R0_EL1: + case SYSREG_ICC_AP1R1_EL1: + case SYSREG_ICC_AP1R2_EL1: + case SYSREG_ICC_AP1R3_EL1: + case SYSREG_ICC_ASGI1R_EL1: + case SYSREG_ICC_BPR0_EL1: + case SYSREG_ICC_BPR1_EL1: + case SYSREG_ICC_DIR_EL1: + case SYSREG_ICC_EOIR0_EL1: + case SYSREG_ICC_EOIR1_EL1: + case SYSREG_ICC_HPPIR0_EL1: + case SYSREG_ICC_HPPIR1_EL1: + case SYSREG_ICC_IAR0_EL1: + case SYSREG_ICC_IAR1_EL1: + case SYSREG_ICC_IGRPEN0_EL1: + case SYSREG_ICC_IGRPEN1_EL1: + case SYSREG_ICC_PMR_EL1: + case SYSREG_ICC_SGI0R_EL1: + case SYSREG_ICC_SGI1R_EL1: + case SYSREG_ICC_SRE_EL1: + case SYSREG_ICC_CTLR_EL1: + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ + if (!hvf_sysreg_read_cp(cpu, reg, &val)) { + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); + } + break; default: if (is_id_sysreg(reg)) { /* ID system registers read as RES0 */ @@ -944,6 +1038,33 @@ static void pmswinc_write(CPUARMState *env, uint64_t value) } } +static bool hvf_sysreg_write_cp(CPUState *cpu, uint32_t reg, uint64_t val) +{ + ARMCPU *arm_cpu = ARM_CPU(cpu); + CPUARMState *env = &arm_cpu->env; + const ARMCPRegInfo *ri; + + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); + + if (ri) { + if (ri->accessfn) { + if (ri->accessfn(env, ri, false) != CP_ACCESS_OK) { + return false; + } + } + if (ri->writefn) { + ri->writefn(env, ri, val); + } else { + CPREG_FIELD64(env, ri) = val; + } + + trace_hvf_vgic_write(ri->name, val); + return true; + } + + return false; +} + static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) { ARMCPU *arm_cpu = ARM_CPU(cpu); @@ -1021,6 +1142,36 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) case SYSREG_OSDLR_EL1: /* Dummy register */ break; + case SYSREG_ICC_AP0R0_EL1: + case SYSREG_ICC_AP0R1_EL1: + case SYSREG_ICC_AP0R2_EL1: + case SYSREG_ICC_AP0R3_EL1: + case SYSREG_ICC_AP1R0_EL1: + case SYSREG_ICC_AP1R1_EL1: + case SYSREG_ICC_AP1R2_EL1: + case SYSREG_ICC_AP1R3_EL1: + case SYSREG_ICC_ASGI1R_EL1: + case SYSREG_ICC_BPR0_EL1: + case SYSREG_ICC_BPR1_EL1: + case SYSREG_ICC_CTLR_EL1: + case SYSREG_ICC_DIR_EL1: + case SYSREG_ICC_EOIR0_EL1: + case SYSREG_ICC_EOIR1_EL1: + case SYSREG_ICC_HPPIR0_EL1: + case SYSREG_ICC_HPPIR1_EL1: + case SYSREG_ICC_IAR0_EL1: + case SYSREG_ICC_IAR1_EL1: + case SYSREG_ICC_IGRPEN0_EL1: + case SYSREG_ICC_IGRPEN1_EL1: + case SYSREG_ICC_PMR_EL1: + case SYSREG_ICC_SGI0R_EL1: + case SYSREG_ICC_SGI1R_EL1: + case SYSREG_ICC_SRE_EL1: + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ + if (!hvf_sysreg_write_cp(cpu, reg, val)) { + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); + } + break; default: cpu_synchronize_state(cpu); trace_hvf_unhandled_sysreg_write(env->pc, reg, diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events index 820e8e02979..4fbbe4b45ec 100644 --- a/target/arm/hvf/trace-events +++ b/target/arm/hvf/trace-events @@ -9,3 +9,5 @@ hvf_unknown_hvc(uint64_t x0) "unknown HVC! 0x%016"PRIx64 hvf_unknown_smc(uint64_t x0) "unknown SMC! 0x%016"PRIx64 hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [ec=0x%x pc=0x%"PRIx64"]" hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpu=0x%x" +hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" +hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" From patchwork Fri Feb 3 14:29:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650040 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849505pva; Fri, 3 Feb 2023 06:30:56 -0800 (PST) X-Google-Smtp-Source: AK7set8+ag4wReu0r0fw4SaOZiQFGVlV65xUpYMCI0QYQkWyIDE+UoGEduR7f+T3RdbibcMo/OwJ X-Received: by 2002:a1f:f2c8:0:b0:3ea:270e:ec1b with SMTP id q191-20020a1ff2c8000000b003ea270eec1bmr4894715vkh.5.1675434656494; Fri, 03 Feb 2023 06:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434656; cv=none; d=google.com; s=arc-20160816; b=nvCKuAOY9dmwNULwFpS+5jW63GOGkoc/p5PipfrEfSlqskfTLa8I9EIzUsNz0m6WTA 2C8KkJ3iB6Ap+J/lQ532TPgTMbwEChuDr/IgMjaB3bMrrJfJs004D2nYgklHJdT/kTJ2 g1Uxz9J6zJDGyPp1J8G2omBeGvA07yW8ipzjxzvLS3kMfXjuq1Cqntq3MzMr79GuMP5F O5ykjcCNozR4VOA/av6I6hXZy5LhmM9F4aN2cGD168DDXJuiJdVg3buDp5qM3aoP0/vg AI4zTom2hD0t7hCIlwpxBK+gAlgArlY+DxlxjgxhcY5BGQzAWH73iKmZL1N+CnX53Yrh OH6A== 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=XxpRepMJTovvA+isBKIvWPf2Mb0oogTF5j2Y5fZGMUU=; b=wiXsLyMIscDZb6XSM376QpP9ra+CaEE/+n3EJsjLwoGTBZrG+xmBgcunLrET1D8HHg MbJWqxrgFjuf7mjOzBmKrZGvD0nAZpjrhiY1YJ3Ju3ScxPQN7KTwohfrwT2iYwv5bwTT N05EX3frwobi9pF6f+dZT7s6hMQG/eeXl993uywlzrwLMw55w/3p4aVgK/7yVgJObQfG ikcamcR79rUlTUgL5UAhGWVSAttfDM1rw8uRhIScCUOBIeNBKjwiPsOzlodu0Qw44qKy O8DZvrYQyXqWQtqgQ9kNH+ONz7iJ9LJsqhhEbkB5rmWNf3sOh2z7dcw50PoNQal682vM yOZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YwOWfy6V; 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 d80-20020a1f1d53000000b003e7a4050578si721092vkd.67.2023.02.03.06.30.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:56 -0800 (PST) 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=YwOWfy6V; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006jR-RQ; Fri, 03 Feb 2023 09:29:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4U-0006fR-Mm for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:46 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4M-00055K-T2 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:43 -0500 Received: by mail-wm1-x32c.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so4005581wms.1 for ; Fri, 03 Feb 2023 06:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=XxpRepMJTovvA+isBKIvWPf2Mb0oogTF5j2Y5fZGMUU=; b=YwOWfy6VyhNuaVP/DEUZPqtZJkqhYO3GDZyIov9FheIwMWJJkGSCZkUbIb6gv5TrnB FHbtsCZnwVeZZKFtNg/q3sEeR0Y278AEjtqAVHwrIZkAat3XMae/9RU9EjSsQeI+uNQh YqaAypzFex6nYULV4Y6TA2A1Uq4Wg8OFxPjW7LAyRlG7hvJFMpyP9EEO1XDrYi/aQ3yz HZEbWfRgV5eQdSUPA9JqxWa2wVQPEvpm1UZJ3jcOO93Prm8kZo7G47N+gxUor8l4z7jj k998XfpY9J/bYfgyDcMoP+77AS6tvN1+cs1PebzawNLiPtOpIg0xhVX4tC+o5UYybB9F Jdpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XxpRepMJTovvA+isBKIvWPf2Mb0oogTF5j2Y5fZGMUU=; b=A0g86WK9SJlWA27eEJo46tTb/5Lla+56I5w1UaceiTbAvZu9qqswl20rvCQAyUnYQn X8fSLvVDSkfl9OkhQiGuA5Ha+qupTd4925bPg11dOt2LAfOxF3VmfhaibV018idUmX8t XOHQwqAFSU2FhlM/Eht2xKYiINENiCoBlgmDrihb2hMGqTxpCQ9kKINpsmAJzZRbJAfC JFm0dw2afCS/EHlkOISMTdpYJ04Hu82pJbR0X6f3pjGqK6uqEuE5ZgptjAZy5i8H1R9w yihwaDaGd58L4F4qtWcHj5GFb8qAMP2RoVBbFhxPGvt6GquhfPlYcYFLBoRXPtmB6lfq BVVQ== X-Gm-Message-State: AO0yUKXD/DQZNT1v7MAQk2Kv80L4Af1EQK74UhydFK3xVH+EStw1QzOi 1JjDQoFxlBPPtItY7zPoxz7szOhcpMKQysi+ X-Received: by 2002:a7b:ca54:0:b0:3dc:2b62:ee9f with SMTP id m20-20020a7bca54000000b003dc2b62ee9fmr10009573wml.3.1675434575851; Fri, 03 Feb 2023 06:29:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/33] hw/arm/virt: Consolidate GIC finalize logic Date: Fri, 3 Feb 2023 14:29:02 +0000 Message-Id: <20230203142927.834793-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org From: Alexander Graf Up to now, the finalize_gic_version() code open coded what is essentially a support bitmap match between host/emulation environment and desired target GIC type. This open coding leads to undesirable side effects. For example, a VM with KVM and -smp 10 will automatically choose GICv3 while the same command line with TCG will stay on GICv2 and fail the launch. This patch combines the TCG and KVM matching code paths by making everything a 2 pass process. First, we determine which GIC versions the current environment is able to support, then we go through a single state machine to determine which target GIC mode that means for us. After this patch, the only user noticable changes should be consolidated error messages as well as TCG -M virt supporting -smp > 8 automatically. Signed-off-by: Alexander Graf Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Reviewed-by: Zenghui Yu Message-id: 20221223090107.98888-2-agraf@csgraf.de Signed-off-by: Peter Maydell --- include/hw/arm/virt.h | 15 ++-- hw/arm/virt.c | 198 ++++++++++++++++++++++-------------------- 2 files changed, 112 insertions(+), 101 deletions(-) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index c7dd59d7f1f..e1ddbea96be 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -109,14 +109,19 @@ typedef enum VirtMSIControllerType { } VirtMSIControllerType; typedef enum VirtGICType { - VIRT_GIC_VERSION_MAX, - VIRT_GIC_VERSION_HOST, - VIRT_GIC_VERSION_2, - VIRT_GIC_VERSION_3, - VIRT_GIC_VERSION_4, + VIRT_GIC_VERSION_MAX = 0, + VIRT_GIC_VERSION_HOST = 1, + /* The concrete GIC values have to match the GIC version number */ + VIRT_GIC_VERSION_2 = 2, + VIRT_GIC_VERSION_3 = 3, + VIRT_GIC_VERSION_4 = 4, VIRT_GIC_VERSION_NOSEL, } VirtGICType; +#define VIRT_GIC_VERSION_2_MASK BIT(VIRT_GIC_VERSION_2) +#define VIRT_GIC_VERSION_3_MASK BIT(VIRT_GIC_VERSION_3) +#define VIRT_GIC_VERSION_4_MASK BIT(VIRT_GIC_VERSION_4) + struct VirtMachineClass { MachineClass parent; bool disallow_affinity_adjustment; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 90a7099d3b5..28c43d59fbd 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1820,6 +1820,84 @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) } } +static VirtGICType finalize_gic_version_do(const char *accel_name, + VirtGICType gic_version, + int gics_supported, + unsigned int max_cpus) +{ + /* Convert host/max/nosel to GIC version number */ + switch (gic_version) { + case VIRT_GIC_VERSION_HOST: + if (!kvm_enabled()) { + error_report("gic-version=host requires KVM"); + exit(1); + } + + /* For KVM, gic-version=host means gic-version=max */ + return finalize_gic_version_do(accel_name, VIRT_GIC_VERSION_MAX, + gics_supported, max_cpus); + case VIRT_GIC_VERSION_MAX: + if (gics_supported & VIRT_GIC_VERSION_4_MASK) { + gic_version = VIRT_GIC_VERSION_4; + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { + gic_version = VIRT_GIC_VERSION_3; + } else { + gic_version = VIRT_GIC_VERSION_2; + } + break; + case VIRT_GIC_VERSION_NOSEL: + if ((gics_supported & VIRT_GIC_VERSION_2_MASK) && + max_cpus <= GIC_NCPU) { + gic_version = VIRT_GIC_VERSION_2; + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { + /* + * in case the host does not support v2 emulation or + * the end-user requested more than 8 VCPUs we now default + * to v3. In any case defaulting to v2 would be broken. + */ + gic_version = VIRT_GIC_VERSION_3; + } else if (max_cpus > GIC_NCPU) { + error_report("%s only supports GICv2 emulation but more than 8 " + "vcpus are requested", accel_name); + exit(1); + } + break; + case VIRT_GIC_VERSION_2: + case VIRT_GIC_VERSION_3: + case VIRT_GIC_VERSION_4: + break; + } + + /* Check chosen version is effectively supported */ + switch (gic_version) { + case VIRT_GIC_VERSION_2: + if (!(gics_supported & VIRT_GIC_VERSION_2_MASK)) { + error_report("%s does not support GICv2 emulation", accel_name); + exit(1); + } + break; + case VIRT_GIC_VERSION_3: + if (!(gics_supported & VIRT_GIC_VERSION_3_MASK)) { + error_report("%s does not support GICv3 emulation", accel_name); + exit(1); + } + break; + case VIRT_GIC_VERSION_4: + if (!(gics_supported & VIRT_GIC_VERSION_4_MASK)) { + error_report("%s does not support GICv4 emulation, is virtualization=on?", + accel_name); + exit(1); + } + break; + default: + error_report("logic error in finalize_gic_version"); + exit(1); + break; + } + + return gic_version; +} + /* * finalize_gic_version - Determines the final gic_version * according to the gic-version property @@ -1828,118 +1906,46 @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) */ static void finalize_gic_version(VirtMachineState *vms) { + const char *accel_name = current_accel_name(); unsigned int max_cpus = MACHINE(vms)->smp.max_cpus; + int gics_supported = 0; - if (kvm_enabled()) { - int probe_bitmap; + /* Determine which GIC versions the current environment supports */ + if (kvm_enabled() && kvm_irqchip_in_kernel()) { + int probe_bitmap = kvm_arm_vgic_probe(); - if (!kvm_irqchip_in_kernel()) { - switch (vms->gic_version) { - case VIRT_GIC_VERSION_HOST: - warn_report( - "gic-version=host not relevant with kernel-irqchip=off " - "as only userspace GICv2 is supported. Using v2 ..."); - return; - case VIRT_GIC_VERSION_MAX: - case VIRT_GIC_VERSION_NOSEL: - vms->gic_version = VIRT_GIC_VERSION_2; - return; - case VIRT_GIC_VERSION_2: - return; - case VIRT_GIC_VERSION_3: - error_report( - "gic-version=3 is not supported with kernel-irqchip=off"); - exit(1); - case VIRT_GIC_VERSION_4: - error_report( - "gic-version=4 is not supported with kernel-irqchip=off"); - exit(1); - } - } - - probe_bitmap = kvm_arm_vgic_probe(); if (!probe_bitmap) { error_report("Unable to determine GIC version supported by host"); exit(1); } - switch (vms->gic_version) { - case VIRT_GIC_VERSION_HOST: - case VIRT_GIC_VERSION_MAX: - if (probe_bitmap & KVM_ARM_VGIC_V3) { - vms->gic_version = VIRT_GIC_VERSION_3; - } else { - vms->gic_version = VIRT_GIC_VERSION_2; - } - return; - case VIRT_GIC_VERSION_NOSEL: - if ((probe_bitmap & KVM_ARM_VGIC_V2) && max_cpus <= GIC_NCPU) { - vms->gic_version = VIRT_GIC_VERSION_2; - } else if (probe_bitmap & KVM_ARM_VGIC_V3) { - /* - * in case the host does not support v2 in-kernel emulation or - * the end-user requested more than 8 VCPUs we now default - * to v3. In any case defaulting to v2 would be broken. - */ - vms->gic_version = VIRT_GIC_VERSION_3; - } else if (max_cpus > GIC_NCPU) { - error_report("host only supports in-kernel GICv2 emulation " - "but more than 8 vcpus are requested"); - exit(1); - } - break; - case VIRT_GIC_VERSION_2: - case VIRT_GIC_VERSION_3: - break; - case VIRT_GIC_VERSION_4: - error_report("gic-version=4 is not supported with KVM"); - exit(1); + if (probe_bitmap & KVM_ARM_VGIC_V2) { + gics_supported |= VIRT_GIC_VERSION_2_MASK; } - - /* Check chosen version is effectively supported by the host */ - if (vms->gic_version == VIRT_GIC_VERSION_2 && - !(probe_bitmap & KVM_ARM_VGIC_V2)) { - error_report("host does not support in-kernel GICv2 emulation"); - exit(1); - } else if (vms->gic_version == VIRT_GIC_VERSION_3 && - !(probe_bitmap & KVM_ARM_VGIC_V3)) { - error_report("host does not support in-kernel GICv3 emulation"); - exit(1); + if (probe_bitmap & KVM_ARM_VGIC_V3) { + gics_supported |= VIRT_GIC_VERSION_3_MASK; } - return; - } - - /* TCG mode */ - switch (vms->gic_version) { - case VIRT_GIC_VERSION_NOSEL: - vms->gic_version = VIRT_GIC_VERSION_2; - break; - case VIRT_GIC_VERSION_MAX: + } else if (kvm_enabled() && !kvm_irqchip_in_kernel()) { + /* KVM w/o kernel irqchip can only deal with GICv2 */ + gics_supported |= VIRT_GIC_VERSION_2_MASK; + accel_name = "KVM with kernel-irqchip=off"; + } else { + gics_supported |= VIRT_GIC_VERSION_2_MASK; if (module_object_class_by_name("arm-gicv3")) { - /* CONFIG_ARM_GICV3_TCG was set */ + gics_supported |= VIRT_GIC_VERSION_3_MASK; if (vms->virt) { /* GICv4 only makes sense if CPU has EL2 */ - vms->gic_version = VIRT_GIC_VERSION_4; - } else { - vms->gic_version = VIRT_GIC_VERSION_3; + gics_supported |= VIRT_GIC_VERSION_4_MASK; } - } else { - vms->gic_version = VIRT_GIC_VERSION_2; } - break; - case VIRT_GIC_VERSION_HOST: - error_report("gic-version=host requires KVM"); - exit(1); - case VIRT_GIC_VERSION_4: - if (!vms->virt) { - error_report("gic-version=4 requires virtualization enabled"); - exit(1); - } - break; - case VIRT_GIC_VERSION_2: - case VIRT_GIC_VERSION_3: - break; } + + /* + * Then convert helpers like host/max to concrete GIC versions and ensure + * the desired version is supported + */ + vms->gic_version = finalize_gic_version_do(accel_name, vms->gic_version, + gics_supported, max_cpus); } /* From patchwork Fri Feb 3 14:29:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650043 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849657pva; Fri, 3 Feb 2023 06:31:11 -0800 (PST) X-Google-Smtp-Source: AK7set8AnFOtZrJUGLKAUAGhMzuCZeY9XyzOkMp+kuTj2/1fALFJ2KO0mJ4kZa2yBf0htBPlg0VL X-Received: by 2002:ac8:7f47:0:b0:3b9:a532:a1d with SMTP id g7-20020ac87f47000000b003b9a5320a1dmr19117467qtk.58.1675434670906; Fri, 03 Feb 2023 06:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434670; cv=none; d=google.com; s=arc-20160816; b=lwh3w6YmYwe/gw7jO7dlnLjlMpv/BXP8y5XIHClub80y5Tcbf3cwOpJVnIl0+/aFDv 1QUBTN1+LKrqSmzLHIWhNI6ok4pkF078Fll0zEUnsmh7SPwiSkWuDMzvr/iJ5SwXtMXQ 5eEZ5+zPA3xo9hNpq24LZFcUQnxqlUkoET/bPI2cP9wNcdpXKqwXhfLpmlgkIbO7AI0d 9obtV2WNKjGO5fp5sw3DYvAaPcnBeiFjvAEEtZyFkWB92n6XtgbhahyxYfajb2fTnWoB MsOxDqrOImIAqMMd3kzqMhswWRtIJFi9TMwXQocb7vVcWLy1xBuv1ukvImdfS5IKCe2N 9D9w== 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=hajMqWBba417xljX2PthUn9B4t3yYT0YWGuT0ofiAD4=; b=xoG6oE7UKA4dKD59+fEab2U2min3jjyx0M5z7Q8wd9xzPie95Zib6aFKbtHI0srR4Z PdkOJqirA8X+TaFyUGz+ktca9vBzg3nTJsfM13YsztpqqRq08mCQQBA6H0Zo8oMakpdr h2JfWcQxA+NWOz9Henz94ecd2GNXWUuFfSl0CKs/DrKT5nZLLsIVSGL7vKFkgwpq98tm qyz6TK7HSk4iL/ypl6OeZoYoKhV/WBxrr4OIOFawr5Ir6kb+5lz9zqN4KlBdfjQs7kss 9hkcdOI8RQT0Zk57VJ6ftY8z/R58rpUOzLDMHBEfG5LJ5rU9hEJqjnUMU7FKhXRnnrva Behw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zXafyWWn; 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 y3-20020a0ce803000000b004c6d74d313dsi1551591qvn.351.2023.02.03.06.31.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:10 -0800 (PST) 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=zXafyWWn; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006jI-P8; Fri, 03 Feb 2023 09:29:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4U-0006fP-Lo for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:46 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4M-00055T-T2 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:43 -0500 Received: by mail-wm1-x336.google.com with SMTP id k16so4011794wms.2 for ; Fri, 03 Feb 2023 06:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hajMqWBba417xljX2PthUn9B4t3yYT0YWGuT0ofiAD4=; b=zXafyWWnS/sBsfgec+52+1yPAb5prgixQCW2hETKzQ61js4oR6oA+TDj47pC/shGvS gvtk2c8z4XEj/qnkFDw7B6vcU6K204wJPQE3F26T2YqdOYBBBKAQ7wtpDexB0Fwv5nTD SYG6w8kG1Fak8EqHgp4RXXmc8/HD3NvSOo5pv7qDQfDPcr8YD7Y+1f8/guyzN8aynwdK MICpDZynT/QvYVE37PosFyOHv7nJWQ0nYSY3PXhYLDlPmuzBT9YYr2fEBdilfVBQ6VkW DhNj+Ppf5XATy6oyjY5AYLRilwX+4D5BNnm3yZ9Vr9QAsaqMd68BErPelHAydbADy0a5 /NJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hajMqWBba417xljX2PthUn9B4t3yYT0YWGuT0ofiAD4=; b=njjEkUxtTQ8Vb+MoZdOmW1XAkP7xGeR7ZNwOmvZJT+YOJsONbPh/aJWpLI4aC7I2UQ x4MAImbJOUfivygufiM+BRCKhJQPiymjwDXEn1wSTV+UaKEs6CNyWWz4U8xEVVrCAH6O ewCom0xvspNSmpdphdN9Yrerga6p1ViPUHdDkxp9mpog1PsmMXpOF4MasW59GxHJlNnQ GMHfRe0C1S87jHub2EgxUKsqzrf1vWuscuiJwagrsGzZ41Wj9GtncI/mArtc44k+bOOA Dtyh6qxnUZh5Iumlws1RJlyPCvj/jGGkQWRqXDVpDik3yWuh/nEVe2IswgUiZSZtAs62 t+Eg== X-Gm-Message-State: AO0yUKUyLEDPFGkaAaUv1JWR+hZYCzDeYidMkKiu92svjWm0JW1AqOIM Tut9pg8DRcRUWUiiFIk7eRKke1EjpuJ5CNQq X-Received: by 2002:a05:600c:3545:b0:3df:ea9a:21c7 with SMTP id i5-20020a05600c354500b003dfea9a21c7mr1827418wmq.33.1675434576722; Fri, 03 Feb 2023 06:29:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/33] hw/arm/virt: Make accels in GIC finalize logic explicit Date: Fri, 3 Feb 2023 14:29:03 +0000 Message-Id: <20230203142927.834793-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org From: Alexander Graf Let's explicitly list out all accelerators that we support when trying to determine the supported set of GIC versions. KVM was already separate, so the only missing one is HVF which simply reuses all of TCG's emulation code and thus has the same compatibility matrix. Signed-off-by: Alexander Graf Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Reviewed-by: Zenghui Yu Reviewed-by: Richard Henderson Message-id: 20221223090107.98888-3-agraf@csgraf.de [PMM: Added qtest to the list of accelerators] Signed-off-by: Peter Maydell --- hw/arm/virt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 28c43d59fbd..ba477282885 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -47,8 +47,10 @@ #include "sysemu/numa.h" #include "sysemu/runstate.h" #include "sysemu/tpm.h" +#include "sysemu/tcg.h" #include "sysemu/kvm.h" #include "sysemu/hvf.h" +#include "sysemu/qtest.h" #include "hw/loader.h" #include "qapi/error.h" #include "qemu/bitops.h" @@ -1929,7 +1931,7 @@ static void finalize_gic_version(VirtMachineState *vms) /* KVM w/o kernel irqchip can only deal with GICv2 */ gics_supported |= VIRT_GIC_VERSION_2_MASK; accel_name = "KVM with kernel-irqchip=off"; - } else { + } else if (tcg_enabled() || hvf_enabled() || qtest_enabled()) { gics_supported |= VIRT_GIC_VERSION_2_MASK; if (module_object_class_by_name("arm-gicv3")) { gics_supported |= VIRT_GIC_VERSION_3_MASK; @@ -1938,6 +1940,9 @@ static void finalize_gic_version(VirtMachineState *vms) gics_supported |= VIRT_GIC_VERSION_4_MASK; } } + } else { + error_report("Unsupported accelerator, can not determine GIC support"); + exit(1); } /* From patchwork Fri Feb 3 14:29:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650044 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849802pva; Fri, 3 Feb 2023 06:31:25 -0800 (PST) X-Google-Smtp-Source: AK7set9MZ9ADdJ6XgnlNCsQxK86TQUD16yRVf4ti4NA2GbvU2ayuYvYws+UmXGHUaVDHxc+pbBDt X-Received: by 2002:a81:af60:0:b0:526:881c:12f4 with SMTP id x32-20020a81af60000000b00526881c12f4mr553289ywj.24.1675434684888; Fri, 03 Feb 2023 06:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434684; cv=none; d=google.com; s=arc-20160816; b=Bn2KCQaP5k2Zqb9QKXbzy2Q9bVeJ7qp+onNFgQwheRhkqEcIr5hyW2RS1eO3X3WXpr j/s/kYhWZzAOyZZLR0jenYIoYfxt/qzSehJTj+OebbuPwatsfCvYSEnAzZXDg55wDWct 59jegetjSqN16vZOG51m+KVXQnTJ/H/pNDZZxLzb57mPSy2NOQlT7WR6PnOx3T0xOBD3 L1jd83VKGX/XeCcUotQfqeRnIdeXfjg0jZgNGBL/JKmUMQiOijAThRH+pVVVhTqY5kYb JBhflCc7cWMEi/r1GuWl+mQ0sbT/4qVg2KZk62yZPYnTDWgudmGk7dSPjrLWIzgXNJtt edOw== 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=PCE6xhlUxSVGC/HAzEQA6//gIKkr5P4027KM8duLe7Y=; b=S314WdfeBJKpLPus+z91nWqsMFvsMl+Ctz79q9QejOh2tWO7Cxaz39WQZdKRY4uKj5 y/YEc6Ffp14IxpWB2u8h8/T456cphigsXge0hygqWzPIgz6xfUV1rqSCvIG8Cu6YBnKD ssjUs2QCkOJR/SwecsfxiItXtimRyVRspXIOXQ5YrDv1pvbXpl0Ns+C5GUwsdiUnlgYn PmK3/QRhvDTn2DPnyfMZtZ7wFKwDI3dNUEKOzOFe+1JhtIlgRsj/dZCj+PalHQaqu2Si aY3ld+bmtAB7oKaeop5ZdQVpJrE/uhBO9ubjeczmuuxbKiReXchaZbnQy7DAaEFUxj+m wa+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=smExylBu; 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 135-20020a37038d000000b006fc5ded6d1esi2110335qkd.325.2023.02.03.06.31.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:24 -0800 (PST) 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=smExylBu; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006su-1I; Fri, 03 Feb 2023 09:29:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4U-0006fQ-Md for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:46 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4O-00055Z-Og for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:44 -0500 Received: by mail-wm1-x32f.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so4005652wms.1 for ; Fri, 03 Feb 2023 06:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PCE6xhlUxSVGC/HAzEQA6//gIKkr5P4027KM8duLe7Y=; b=smExylBu+dCWNA3iRN6G2wrNloWUa4Uctl9f5ddsyGBmSvd1wEu2psoXlRaCVlgwXN lxOaHTlobfPHw90UtMUr55q9wZkxJd8u+UQ5YejV7EEyXUAPLmy8HB0oS8wrMfHzBzl+ byjE/lJDZKRmyGn6eTv/uUYmGiBKuFH9BS9zFI63xs0gaWpCX9qpULBAxgShz1MssgOe 954oporfEtAEUUj8S2XTGLgRYxlUDGPwt3CjPaF3jaHwMAyadJ1Aaimpzzn8zwjmLsEj js+ZwEQijRwYJ7eZHVX1hFVBDlbVjIOBVgLFUpLKwiq5f730K+6m3aAZnc0oWWqKfG+E a8Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PCE6xhlUxSVGC/HAzEQA6//gIKkr5P4027KM8duLe7Y=; b=AT4PrlwhPVD+uK2Zah9r4/BlReFCx9l0XV38R008xR6TYJjya8Q8XCIkeD0y2X7gjP pqDKzu1ZBQjbYojVr661Q66lc8fgAhbQ6a8d7CfSWB1KX2YPkcw9qUHW86OBheLZIIyi 3scZO8iFTkMQeIvdi/8pxeK8uMWKz217zp10RbWcUjiuqJjxo8FA9ThYqwvvpx5eSqZM toSEGFd0jDMtyem+80UfW80OZ1UUojmzk/mu+r/s40uy8vwlW/GNwpgIiUPNITr6Mbsr ZaQOq0IIG419kFlsDfEdAT4GNojGWPwTTFl612IA0nk1h/rOCrtLH66KXWpCoXIETSbr V9LQ== X-Gm-Message-State: AO0yUKUdXK/6pM2Zxo+5T8WWTxWSqasfUPEj2TgSmS3WHXXV0H8EZSfJ BrgWrlgmU67GAFkUh4vduzdJhEtFUujwLrOe X-Received: by 2002:a05:600c:3795:b0:3dc:561a:79e7 with SMTP id o21-20020a05600c379500b003dc561a79e7mr9541317wmr.2.1675434577609; Fri, 03 Feb 2023 06:29:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/33] sbsa-ref: remove cortex-a76 from list of supported cpus Date: Fri, 3 Feb 2023 14:29:04 +0000 Message-Id: <20230203142927.834793-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 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-bounces+patch=linaro.org@nongnu.org From: Marcin Juszkiewicz Cortex-A76 supports 40bits of address space. sbsa-ref's memory starts above this limit. Signed-off-by: Marcin Juszkiewicz Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Message-id: 20230126114416.2447685-1-marcin.juszkiewicz@linaro.org Signed-off-by: Peter Maydell --- hw/arm/sbsa-ref.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 8378441dbb1..f778cb6d097 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -146,7 +146,6 @@ static const int sbsa_ref_irqmap[] = { static const char * const valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("cortex-a72"), - ARM_CPU_TYPE_NAME("cortex-a76"), ARM_CPU_TYPE_NAME("neoverse-n1"), ARM_CPU_TYPE_NAME("max"), }; From patchwork Fri Feb 3 14:29:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650063 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp853022pva; Fri, 3 Feb 2023 06:37:01 -0800 (PST) X-Google-Smtp-Source: AK7set9qzvl811xAKdy1IFSjPLO1uz2GqMkXTisFSmF0+kBUxqP84VrOcQj1Y7ThtRB1FR3xQuPL X-Received: by 2002:a05:622a:290:b0:3b9:c0b4:8afe with SMTP id z16-20020a05622a029000b003b9c0b48afemr8395805qtw.2.1675435021203; Fri, 03 Feb 2023 06:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675435021; cv=none; d=google.com; s=arc-20160816; b=l4xALPI7iOYe015bPWYiSePj6yebrCHrSM9DyKVzgqjwvorC+VRDEgLSFSKg7CutwJ ZFUzVILf250bmBM9nje7BffODOS2Q6jHK0fhKDxddqKsaA9Yy35r/LxCiUpfwUWKyQv5 UnwtzG4HQVvSHJbqBpDCK4HjuN5U4vtVQPJoBr47exDshmIi05wUM0lkUDxoPYObaL1L 6uovTTCEBpxS+NOrXoXmy5RA1YqtsN98W/dXk3m27825FsNJD19bGNUjqEWryKeStbvn +f5CLD/K6ZJVuqaDijUbfg5kvNy6Hn5v91FTn6oTUyR3Hlyrj1MtT+A+Yp98JvJFROD1 0Tcg== 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=vEB5hK/P/E0Hi1gXCAfQiABUckdVC9FZuTnsRmpcDkM=; b=wAvBLox52mTKg1cO9LiOnyN0JFqskQtmUcAl10KvG5zjc+ukIqOV31mC98rUX3VQxV ibtpB09EbKJ53pwOT8lrt0PVymepX9IrPMqs7+EmuUfAw4yQ661XHPoJOlDEwMC5/bes wMnvoE2Dx8rsK2iubJQvNBKp4zR4g3c5oRK3JtuNx/f2MOfXGVEUaBPZMqeJmpQuVU4Q TimgMhRERePh5F9jYYaCFXRg8W71DlLUMa1SF5YJwg6c1we+EbmHK7iqP+R9WlhVsCKV 2miQ0K+9cwgG7Ty9xujpZ3CmgZ6gR0VKQeYbS7ozFtWirLvVJ9CAOQHSMf+uAYeAuRLN fZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IHm8AL62; 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 h15-20020a05622a170f00b003b9b831a468si1965020qtk.471.2023.02.03.06.37.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:37:01 -0800 (PST) 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=IHm8AL62; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006tn-QZ; Fri, 03 Feb 2023 09:29:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hi-L2 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4Q-00055e-Ky for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:47 -0500 Received: by mail-wm1-x329.google.com with SMTP id q8so3999859wmo.5 for ; Fri, 03 Feb 2023 06:29:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vEB5hK/P/E0Hi1gXCAfQiABUckdVC9FZuTnsRmpcDkM=; b=IHm8AL62XXf9/K1Iz4qp8f9mZWq1GzrGp4pOcSlPYF6xj4wxPeUhvouyb5O7AV//Wm QpL9qdH1cTjzwvCzUhQHjXbKQCPEZVcB542h3dAfa3Y8CiDVCzxXVAJ0K1ELv2X1Muih BKtYT2zwM+OnQasHF5OkfSCsc6Uwz+XDGNEqR/maOHyAXfEcHaAhVsxKORxsuzU0HwzT G5uhEEUXDgfOtBWOpgWc7wlFNgxZil1qZBJvxgbGJVzKBA4OT3k5xaRJTRp2501GE24f RI5BnUxSmN5vZjhHmN1PdG8mZw1diOSgSDCTWnqPf6SUK9CWVjg7+aFweZfoVkaOt0m4 Ch5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vEB5hK/P/E0Hi1gXCAfQiABUckdVC9FZuTnsRmpcDkM=; b=Lh0VstW72dSZTM12AckiYV4UANbRIaHyAOUlSP+dDc4ZBGTbQiufOAUj490172nPD2 UsFas9v6O6Jq3iy+JaZfsCMMQOreVnMJqhJAWGOMCfYK0NSsw1sKRqviJoiZy4CHtq0+ chFGHU3M69rDdd9bb41k6u5OykKFGfIZey+p7Yh7WTvkIWihSD7SRroB9SRwC687WJ8V Z8kqottPjfV+Ma2vEn1J9JQzfEvsftDuDwFzXABhM8Fp/dBCXBcbSM4srbciWu2FhTYg ET3TyFYPtoS760oQRR7KPxC70TAfygjLRuVOU4E7x5Nao+cPRXCJG0OLJbk/KOoOJ285 fvgw== X-Gm-Message-State: AO0yUKXB6cosBEt/GL5iDrF+FrG58Y/A2M4DktoJa5oX19ojDW9DBfsP YFjZrozKDLYow8JV53mwkpCoYsfEFqGwWUu6 X-Received: by 2002:a05:600c:3d90:b0:3df:eedf:df32 with SMTP id bi16-20020a05600c3d9000b003dfeedfdf32mr162829wmb.17.1675434578414; Fri, 03 Feb 2023 06:29:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/33] target/arm: Name AT_S1E1RP and AT_S1E1WP cpregs correctly Date: Fri, 3 Feb 2023 14:29:05 +0000 Message-Id: <20230203142927.834793-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org The encodings 0,0,C7,C9,0 and 0,0,C7,C9,1 are AT SP1E1RP and AT S1E1WP, but our ARMCPRegInfo definitions for them incorrectly name them AT S1E1R and AT S1E1W (which are entirely different instructions). Fix the names. (This has no guest-visible effect as the names are for debug purposes only.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-2-peter.maydell@linaro.org Message-id: 20230127175507.2895013-2-peter.maydell@linaro.org --- target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 72b37b7cf17..ccb7d1e1712 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7734,11 +7734,11 @@ static const ARMCPRegInfo vhe_reginfo[] = { #ifndef CONFIG_USER_ONLY static const ARMCPRegInfo ats1e1_reginfo[] = { - { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, + { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, - { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, + { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, From patchwork Fri Feb 3 14:29:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650059 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp851701pva; Fri, 3 Feb 2023 06:34:33 -0800 (PST) X-Google-Smtp-Source: AK7set/6OrLhLH+ezm03hhMiZTgA52CKDFodVq1dQRnLj/EdQt1dS/wB7gJckFHkx2htk0pRwRpk X-Received: by 2002:a05:6214:400f:b0:56a:71e8:3c0 with SMTP id kd15-20020a056214400f00b0056a71e803c0mr1708944qvb.16.1675434873540; Fri, 03 Feb 2023 06:34:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434873; cv=none; d=google.com; s=arc-20160816; b=xC8JDM9kgrD8FLQ3f7iGithNjkFc8tHSmktRKxs7T4zvEzTCPWcNcuSe1XT1gwd774 toHRRGHKCWUhZ/kzvkZLe9fiSj+uRXkr1FWEec57+2LaOHJYoyEhycQ2XAkQpSFB16HR 9PsvZxPf3F1k+g3WfMWAupE21Lc+h7tQ0B7DUQrDsd9otGDmmVce0PseFj8xhng21GML GuKGr6LvJdxN/aWurdjlJXVsA9Mcb//twaGC3qhTGEOrSg7D9AgxvlARb9RdPIzhC+km ntqSmjQqaDRvgmp+ltK2m0SMLuAAi+VhLgfsZ98uJGKeNK0S5/pNYeXAgbIsL5/OyI93 658A== 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=YcRN5KzcgPE4Jkd8YcnXRx6q8ttqJHp+NRxt/dZGyyI=; b=0A6HxUcjNJPVpwy7V+rXTNIoJiMwvnO4NKJswyGWB3lwHJpABfHkewRPnZW2GEdfXZ KdFY11jchcWr9pb+mu9tYYJuKgItRS+6YtduRxBvCIhB0uzGb7L8duBn7YZqMGDZqOX7 BkGB6GVVnH4xqTpa0M3bVNCD3ZjcBNmgT7ks2T1FN60ctnJLIPljQbIoZhlWsIjX9qlb QzQ8pSO9ifxp4DEcbDX02+lfmF7nOCo5QupnPH1euwUcVnrZxLKEAD9E0R8RpqqASQU7 KAISoyt9lqjWYRaF8pxV1DWlqhqF4RTEl6HUQnzWeyrsQIT7F4tAl8Ze2BxW+WKxgN2d k+Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AbmdDGlk; 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 k20-20020a05621414f400b005355f43f73csi1670071qvw.114.2023.02.03.06.34.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:34:33 -0800 (PST) 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=AbmdDGlk; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4j-0006ua-CN; Fri, 03 Feb 2023 09:30:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hk-M4 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4Q-00055s-LH for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:47 -0500 Received: by mail-wm1-x32a.google.com with SMTP id bg26so4031501wmb.0 for ; Fri, 03 Feb 2023 06:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YcRN5KzcgPE4Jkd8YcnXRx6q8ttqJHp+NRxt/dZGyyI=; b=AbmdDGlk4qmqgcQbJscQpMSnhttNdRoip+D2y16lovjDZPzYFzkPqAtdvXMuR6QmI2 CCsUHkB8drSsH/wm47WKZ5UmQRPDWxqIes9tS53ZGCoqi3RJp6EiRAz42FRlFD0pM9Mr tt4gOlXwc6yfAGETWXtxjUWawk1rjpB9iaM7DDySdEgwhflZU+oVBfPE3Tjeny96EFuP +0ZWH0ZsdHd5XQm4EGqTe+IF/J0/eC+4axy+s9mUPkquTeTiczgk7F9Mmy90vY6TbFPr 9IQO2hmJlRTwlfD95vajkJJGS6pHBfbnnxVzRyQ0jVeXSxrYTdXw28utlWJamdDyNIvX Ek1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YcRN5KzcgPE4Jkd8YcnXRx6q8ttqJHp+NRxt/dZGyyI=; b=oXWnyxlrHqZm36A3+CqyiKzRh/SeK0ZpugqOQPtf1xRSGvUebXsnuNPplfLrb1yX6k yT8GwbeWPNHFNJlyaVWwwbsZ7IdqqjITFSkoURfPdte1NTu6F4qKnwpkNXqWl9Z1GyAY BliOdZhJ/8EwBAgqYEZoJb0zFOwr8b7+WKABR9IboOKk5QkmP7bEHOsp9c1LunKq54fe R9L1ZFR8fAx5fM34ExSVYoueO+mElp5hlxmTkqDhO/9YcpDHYVI/lj3ExzbsP/wdTJdW xZKNfbiM9PPSKtfa+bdsOw12AgT/f0qDCv6/rMojE04ztr7Clo2s9rDfHot7LEXspHAw kSOQ== X-Gm-Message-State: AO0yUKVpSRiz2yS+sKKlpUtaaAxpjs2Z9UCj7O+Guy418+1boGqNViZt QdNOSvk+HPXr5oYp8tz2qUhwakd2xybLPWIO X-Received: by 2002:a05:600c:4ec7:b0:3dc:5e0d:4ce7 with SMTP id g7-20020a05600c4ec700b003dc5e0d4ce7mr9786650wmq.11.1675434579209; Fri, 03 Feb 2023 06:29:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/33] target/arm: Correct syndrome for ATS12NSO* at Secure EL1 Date: Fri, 3 Feb 2023 14:29:06 +0000 Message-Id: <20230203142927.834793-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org The AArch32 ATS12NSO* address translation operations are supposed to trap to either EL2 or EL3 if they're executed at Secure EL1 (which can only happen if EL3 is AArch64). We implement this, but we got the syndrome value wrong: like other traps to EL2 or EL3 on an AArch32 cpreg access, they should report the 0x3 syndrome, not the 0x0 'uncategorized' syndrome. This is clear in the access pseudocode for these instructions. Fix the syndrome value for these operations by correcting the returned value from the ats_access() function. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-3-peter.maydell@linaro.org Message-id: 20230127175507.2895013-3-peter.maydell@linaro.org --- target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index ccb7d1e1712..6f6772d8e04 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3284,9 +3284,9 @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, if (arm_current_el(env) == 1) { if (arm_is_secure_below_el3(env)) { if (env->cp15.scr_el3 & SCR_EEL2) { - return CP_ACCESS_TRAP_UNCATEGORIZED_EL2; + return CP_ACCESS_TRAP_EL2; } - return CP_ACCESS_TRAP_UNCATEGORIZED_EL3; + return CP_ACCESS_TRAP_EL3; } return CP_ACCESS_TRAP_UNCATEGORIZED; } From patchwork Fri Feb 3 14:29:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650036 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp848986pva; Fri, 3 Feb 2023 06:30:04 -0800 (PST) X-Google-Smtp-Source: AK7set8DF0ZSY0v4WXAyqYdzqcbQP35SJT8ebf00CYN9XXnncS65YEeD9TnRWmPPXujZN8taIB1c X-Received: by 2002:a05:622a:412:b0:3b9:b98b:3c56 with SMTP id n18-20020a05622a041200b003b9b98b3c56mr18287383qtx.68.1675434604308; Fri, 03 Feb 2023 06:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434604; cv=none; d=google.com; s=arc-20160816; b=MPQHTakECsEkED5G1qy7NnaxxM5nA/E2KI/zMClHwijZUI9DqSn4JVv5nu3iazLAQW oQGzdR7OqHsFV/34CyXOpl62JEREsUro5wGiRfUoVhKNLUqOsl20elEYoWyQnEpeWaYj Ags0Qxu9Cuh7OAOzRkvbwmv2O2jIWw+AV44wseiyWLds8k92xFx1n6sn9SHTlv5aEzw2 NugMJBp2HV84s7i544YT5KdDZLV9trIZFW1fy/K8EpeS8R2Li/F5Hrq3tGvjspAq4r/i MAwuXQ2dilOdeJmWNDE5CVCNMGS06DvgmXqAoSJXgy4vha3b4/enr2Rdn/rmEXeEsOgG W1fA== 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=Sdt11QbukYZJY11YGNYm/awc0QmfZC+VMlPzEhlWldI=; b=dQS9Um+UxYLCI+cGjdQiAHX9QqYC7OrdCYbl6eoc9j2t89iJruzXotkWgk3QcsoyjT wx5xQLNO5RNoZGk4J05Prx+9uplJvNpJ5PGvti6VjiVhmi0fCaNaESAyGGW3sT053lFA kMQ8lsKrr9aPakmeWhLXLvOc4lydKNmqOae0GECBQGzdyxdlZ7GucfhIO38MiwXPQjCU nqNIu8GyHrolxTY54v3C11wjajqzA6ODJ9WMzMA5w5KUBbEVK8lsZFJ/HTZWGfif1Alq Z3/q6xMXOnqWksCQucsd3Ycvy6VxigWpvvLvzDtHLhZv7zcn3U2NHJWEcUK6PHFAezFG VHwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xXRco1L5; 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 i10-20020ac85e4a000000b003b842e16080si2064909qtx.34.2023.02.03.06.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:04 -0800 (PST) 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=xXRco1L5; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006sv-3R; Fri, 03 Feb 2023 09:29:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hl-Kr for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4S-00055y-L0 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:48 -0500 Received: by mail-wm1-x32b.google.com with SMTP id bg26so4031531wmb.0 for ; Fri, 03 Feb 2023 06:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Sdt11QbukYZJY11YGNYm/awc0QmfZC+VMlPzEhlWldI=; b=xXRco1L51IAQ54FA3XZBtXgDImQcDfT1e4IDAXCOzisC51ffYnt1Bno8fRfgxadu8E ZLHqHkHoWjT44tqAbmJymTQv7rqys89+I4W7uEhe4xJ8OyQqrWqY5JNULpMsr7RJR7Yb duqYjU3rfQFxGBUpEyFuyzpOTef6fh53gml2ERns3OVAimpxfamC2PeiNRbfLRAd+9Jr bO/up1oIbt+DeQLz5a0lMyh+U1KCRV6Y4Swu7jpBfNLFHKgQuD7recCxi1mQAiIIo+Q+ 9FOMq55aUXaJP/TgaHEyose9/OlK1L643V5hkklKtIrKUk/IJ6GrqZySqTmuqhFtHqMy n1iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sdt11QbukYZJY11YGNYm/awc0QmfZC+VMlPzEhlWldI=; b=y0fN/bTrDyS4OQzV4+V+T8SlpNFkbkXbe2vs32nc11y4jpBo/QjvkKccYTfQZFlLdP 5+dLj3or/m+PL6A7CXq/bfMtBh7Ug05ZP1tIUoHReP4UwtIYUzkuGSeTmpt7VnFr1R+y FAYDzI6OK4TUWuV7RC9RY65p4mc+IDWho2FmyCDvUpPndzehRF73V8cb1Daq17Y2OqGa 1/hLTOEPPTgBrhTBEaGH0TM94uGtcrLhINZwnwQYAmktzeAjvaxxdf8c12xaMl9LwHTT MGPZ2BEhoHv862Fhb1AA7LzbuTWUtjtPDuV32wrQrPRbEZ+oW582A6ikADaZiZlOjWfb J57g== X-Gm-Message-State: AO0yUKW1FVbOmFsu31JbOMUu7MsIUOfPOd2noZRfqG1CHYSgvjnH5nIv B8scen+iZYT7BOlyVQSia4wYUnTdWl0j/uLH X-Received: by 2002:a05:600c:1e24:b0:3da:f665:5b66 with SMTP id ay36-20020a05600c1e2400b003daf6655b66mr12426685wmb.6.1675434580123; Fri, 03 Feb 2023 06:29:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/33] target/arm: Remove CP_ACCESS_TRAP_UNCATEGORIZED_{EL2, EL3} Date: Fri, 3 Feb 2023 14:29:07 +0000 Message-Id: <20230203142927.834793-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org We added the CPAccessResult values CP_ACCESS_TRAP_UNCATEGORIZED_EL2 and CP_ACCESS_TRAP_UNCATEGORIZED_EL3 purely in order to use them in the ats_access() function, but doing so was incorrect (a bug fixed in a previous commit). There aren't any cases where we want an access function to be able to request a trap to EL2 or EL3 with a zero syndrome value, so remove these enum values. As well as cleaning up dead code, the motivation here is that we'd like to implement fine-grained-trap handling in helper_access_check_cp_reg(). Although the fine-grained traps to EL2 are always lower priority than trap-to-same-EL and higher priority than trap-to-EL3, they are in the middle of various other kinds of trap-to-EL2. Knowing that a trap-to-EL2 must always for us have the same syndrome (ie that an access function will return CP_ACCESS_TRAP_EL2 and there is no other kind of trap-to-EL2 enum value) means we don't have to try to choose which of the two syndrome values to report if the access would trap to EL2 both for the fine-grained-trap and because the access function requires it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-4-peter.maydell@linaro.org Message-id: 20230127175507.2895013-4-peter.maydell@linaro.org --- target/arm/cpregs.h | 4 ++-- target/arm/op_helper.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 7e78c2c05c6..9744179df01 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -224,10 +224,10 @@ typedef enum CPAccessResult { * Access fails and results in an exception syndrome 0x0 ("uncategorized"). * Note that this is not a catch-all case -- the set of cases which may * result in this failure is specifically defined by the architecture. + * This trap is always to the usual target EL, never directly to a + * specified target EL. */ CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), - CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = CP_ACCESS_TRAP_UNCATEGORIZED | 2, - CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = CP_ACCESS_TRAP_UNCATEGORIZED | 3, } CPAccessResult; typedef struct ARMCPRegInfo ARMCPRegInfo; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 31f89db8997..def5d3515e2 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -673,6 +673,8 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, case CP_ACCESS_TRAP: break; case CP_ACCESS_TRAP_UNCATEGORIZED: + /* Only CP_ACCESS_TRAP traps are direct to a specified EL */ + assert((res & CP_ACCESS_EL_MASK) == 0); if (cpu_isar_feature(aa64_ids, cpu) && isread && arm_cpreg_in_idspace(ri)) { /* From patchwork Fri Feb 3 14:29:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650042 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849603pva; Fri, 3 Feb 2023 06:31:06 -0800 (PST) X-Google-Smtp-Source: AK7set991KRpudD5gc1b3JpS6D5ccq49k3kNh30SmipZsVUSsesmGm5q1wD15mUlbYHmcAt0h7No X-Received: by 2002:a05:6102:5121:b0:3ff:4422:ab69 with SMTP id bm33-20020a056102512100b003ff4422ab69mr6107998vsb.14.1675434666364; Fri, 03 Feb 2023 06:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434666; cv=none; d=google.com; s=arc-20160816; b=SvsGvdNS8PtzUTFhgy9W3BGxiL6LlqrRRttoKZ5xfeFtSJaOrISfxaJQtO/Cr9o3cT 20URDDMFRUAzVcY3lC7858TiOQUUlx/AIaC1kUxFPlHhTH3X0hPARDoSan2dbeS3qMAX YG9NfutseSKuS2kL8qYRO+GQru6sF55aXPEYu9ytgLQXL8rW2Khry9LA+oIHS9lIMOBH UCVUWE0xPmxV8EhJfhSzdxiL28rCf63ZqafqWa1YA40WhUc2hdLyD06QID4rFiUZ8sru V9/K7o7UMMbtTcE6QpU4UDSv5FCKFn5VhDgFwfoXiZkCnrKPVp0+K40DXHnSKIEgzQTh sOzQ== 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=Dfm26fYv3JIUSRJGZZpIcFrn+v6yWG7PrqTs/YhXiNE=; b=KqUWWuArOLOXzUnqwb3idThEICgtKsAh2pVfbXp6969n2LBKhbj+tXZN2OHX2wiDPH L3dst9I1XNGFJREI8KhSePcSLDMd4SA2zkLyIK1Nt1eW0b/B/Qkfdnwl6XBy7KofoG7O BcNVAG8i2TmW4Ht85lYnayFvVUUINbUuL6iDApCWqrmZRDTi/ackngKVsfQmZrcvIQdF uqs4Tx8ey0LZewtXjkZGQEE7H+oLM4NqXzyqDY+/oMPOpCFyQRNb6XC3vjwPqqMcMEnW bHWULCFen/qgms4cHe4oXuwWuCCZ+KAw9lQv9n4woXjax7+iJdvNU2jA6fthoxous95p NZkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LvG8CmYM; 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 t23-20020a67f5d7000000b003f15c88d1e1si685920vso.317.2023.02.03.06.31.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:06 -0800 (PST) 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=LvG8CmYM; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4l-0006xE-Kb; Fri, 03 Feb 2023 09:30:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hn-Lx for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4U-000560-FF for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:50 -0500 Received: by mail-wm1-x32d.google.com with SMTP id q8so3999939wmo.5 for ; Fri, 03 Feb 2023 06:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Dfm26fYv3JIUSRJGZZpIcFrn+v6yWG7PrqTs/YhXiNE=; b=LvG8CmYM0h4lkSolWC/d3q1fmqzy3awVjQ4MK12MxKzLt5O7fDSIns4HRLyMRiseev biXPop+IHblE0JPHsirvup8HIIJY+ZVgv5tgIs+zEnYysZhqQiufFjNxaHRmg2GNZu9c 42wMIAKPArisO0X4H/2n6Z2SwuFf7QmN8bP17K2evaVmU9cEF6/e+xT74LgjyyZsyUx0 MaGK+o+W3bi/qaPrYkmKYjLvuluBMxj79sTMJBdZvnlzZ1ai9FMABUQSZWGo2TdGw9jp IF4ZlwXoaw2cbJeo8Td1bhDA+STqigFYQJphg9Fp2c/bVKLfEEJutf8nCJjcGfM6KvCa F9Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dfm26fYv3JIUSRJGZZpIcFrn+v6yWG7PrqTs/YhXiNE=; b=djdhPA7VwtuaeOqsmS9xJIP7QZpv8++utOA6GDLNcZHmsIVfhWzO8L8jaJd2afNhUh 1vXiO8vcvm63esQy/d833CV5fugULYYh5IDiQnU7hQsVj0/2kBFXzAy+QVe5WNFdUAmm fPOyD5cei/rZQURyzHMR/EEaDmaHYToJqECiLh6+LUNh+5X6QAHr/HPsHKOj7Uz2eQ2x gRaHbaEFA2LyaSZHoAil/3g5oC84QFMcQMuHRn4rJvffbmvurnqjOMrh5H7+z8NJMbv3 Wx1i+vUDEW4pw5aehS3p36SoYvd5lUSOGy1F73QzcS9C9lPsZT0qUQmxSxSVRoS4L1ag k9UQ== X-Gm-Message-State: AO0yUKWvRTr/Wxh6l81JwISjSUqy1+16powG+rW2ZXbbgjrxCqOnAiGf gkg1OwV/j9TYMLPWieY66AdH5ua2G+k7pkrV X-Received: by 2002:a7b:ce94:0:b0:3dc:43a0:83bb with SMTP id q20-20020a7bce94000000b003dc43a083bbmr10177557wmj.3.1675434580920; Fri, 03 Feb 2023 06:29:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/33] target/arm: Move do_coproc_insn() syndrome calculation earlier Date: Fri, 3 Feb 2023 14:29:08 +0000 Message-Id: <20230203142927.834793-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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 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-bounces+patch=linaro.org@nongnu.org Rearrange the code in do_coproc_insn() so that we calculate the syndrome value for a potential trap early; we're about to add a second check that wants this value earlier than where it is currently determined. (Specifically, a trap to EL2 because of HSTR_EL2 should take priority over an UNDEF to EL1, even when the UNDEF is because the register does not exist at all or because its ri->access bits non-configurably fail the access. So the check we put in for HSTR_EL2 trapping at EL1 (which needs the syndrome) is going to have to be done before the check "is the ARMCPRegInfo pointer NULL".) This commit is just code motion; the change to HSTR_EL2 handling that will use the 'syndrome' variable is in a subsequent commit. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-5-peter.maydell@linaro.org Message-id: 20230127175507.2895013-5-peter.maydell@linaro.org --- target/arm/translate.c | 83 +++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 365e02fb0b8..9252a464a12 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4718,6 +4718,47 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key); TCGv_ptr tcg_ri = NULL; bool need_exit_tb; + uint32_t syndrome; + + /* + * Note that since we are an implementation which takes an + * exception on a trapped conditional instruction only if the + * instruction passes its condition code check, we can take + * advantage of the clause in the ARM ARM that allows us to set + * the COND field in the instruction to 0xE in all cases. + * We could fish the actual condition out of the insn (ARM) + * or the condexec bits (Thumb) but it isn't necessary. + */ + switch (cpnum) { + case 14: + if (is64) { + syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, + rt, isread, false); + } + break; + case 15: + if (is64) { + syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, + isread, false); + } else { + syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, + rt, isread, false); + } + break; + default: + /* + * ARMv8 defines that only coprocessors 14 and 15 exist, + * so this can only happen if this is an ARMv7 or earlier CPU, + * in which case the syndrome information won't actually be + * guest visible. + */ + assert(!arm_dc_feature(s, ARM_FEATURE_V8)); + syndrome = syn_uncategorized(); + break; + } if (!ri) { /* @@ -4755,48 +4796,6 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, * Note that on XScale all cp0..c13 registers do an access check * call in order to handle c15_cpar. */ - uint32_t syndrome; - - /* - * Note that since we are an implementation which takes an - * exception on a trapped conditional instruction only if the - * instruction passes its condition code check, we can take - * advantage of the clause in the ARM ARM that allows us to set - * the COND field in the instruction to 0xE in all cases. - * We could fish the actual condition out of the insn (ARM) - * or the condexec bits (Thumb) but it isn't necessary. - */ - switch (cpnum) { - case 14: - if (is64) { - syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, - isread, false); - } else { - syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, - rt, isread, false); - } - break; - case 15: - if (is64) { - syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, - isread, false); - } else { - syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, - rt, isread, false); - } - break; - default: - /* - * ARMv8 defines that only coprocessors 14 and 15 exist, - * so this can only happen if this is an ARMv7 or earlier CPU, - * in which case the syndrome information won't actually be - * guest visible. - */ - assert(!arm_dc_feature(s, ARM_FEATURE_V8)); - syndrome = syn_uncategorized(); - break; - } - gen_set_condexec(s); gen_update_pc(s, 0); tcg_ri = tcg_temp_new_ptr(); From patchwork Fri Feb 3 14:29:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650037 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849144pva; Fri, 3 Feb 2023 06:30:21 -0800 (PST) X-Google-Smtp-Source: AK7set9mmc7MRujcYO23oAHPC1yVsipn9eJtk2sZ1XZQG8ofGl6m8OPoggBkVp65yZH6OgpNab04 X-Received: by 2002:a05:6214:5a05:b0:537:649f:747c with SMTP id lu5-20020a0562145a0500b00537649f747cmr16824949qvb.11.1675434621343; Fri, 03 Feb 2023 06:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434621; cv=none; d=google.com; s=arc-20160816; b=DPzgpVkEvggA1ROVhJJvLxRwtyotqXHTSMA84DOOYqp6Ce5tqOzZpolm6D/TVZLSH3 ip/wz+b0uT5WKu2fZjyD4K9SQkmiabvlLHMS/u0r1C4zruLVuM2Ip9wc7ks8gLqqm2h+ D6B466Nwk7Atw8Lm1JQj2kcTk7T5/aWRW9LsGcR7JbXuBkdALLIPR7wko56RxKwSBHzc 0gLj291bmjRy89j9l7JT5hPSxN1EqQ4Pc7aKnr2AFNEFfuF1IS90Zp/VMPGv4LTfw2jK /FaQSMEEfAyy2mSGHjrOxroqv9vE5YKiUKZOsu7I0/I5ZR5LMMEe9fGaP3bt0ZGrSU5W zkCg== 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=VPoHsQyZBehpHPFgUeyHV4nrXZ51tWP4ro3jxrpAuIc=; b=RW7vCuID1NtLegguaf+FMduCBA8OQJV7i8ZLOmZcRqQSh4KZHFw9KRmg9Vx/TJigxx 3fVLJnwCNm4+L1N/uPl9aoS1sFcY9RuDoRHoiYBC638ISzQS+w4VFjRrlrIdlNfT70WS GKOZw9HM5H69eHHALSS7bTu7t0QUMQ8khI5vjSPc5olk3P9VydM849Wmcv+kNX3q6Wl0 +KIfi6Y3k8Le+Qy8ts07pikPK4Cq0X5NR0HIwYbG+v0ZWPOiQjGJxa2YqlTOoD8myOgQ D0JUXTqlhZWv6JAzyhv6mmfyry28YjN4Tnv06CsvQ44Tm8bR4dXgbS9pu9T1NUAdryIL rSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yaG0Yu5e; 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 ok13-20020a0562143c8d00b00565b4e4de5asi1923788qvb.373.2023.02.03.06.30.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:21 -0800 (PST) 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=yaG0Yu5e; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4n-0006xV-B0; Fri, 03 Feb 2023 09:30:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006ho-Mw for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4U-000566-FS for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:50 -0500 Received: by mail-wm1-x335.google.com with SMTP id o36so4020314wms.1 for ; Fri, 03 Feb 2023 06:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VPoHsQyZBehpHPFgUeyHV4nrXZ51tWP4ro3jxrpAuIc=; b=yaG0Yu5edOsbec845lS2t3qRBwtEXeIORo2yyXAQD3UNqIVHBaKueJ0ppCO5rJz/Bm 2R+dvZjHAheHH5Pfl6KgP480s7w2szbTaOSnDWIxiv0PLvgoA9d/YQQdiWAHpFem5R7B d+wOKqUFyDSUOkjCN04pSlzMLp5UM6QoY/opTC3oGcG2wsM1rVAkv+/LTaKhTgH7Mk7U VLaHwxYw+iEbZd4nDhGNG8KfU0rfNWf0NjaRtgUq5Q3y6L/qy9rLNObh+AACcIuRbh42 tMHPa7dueOrG/EZj7T+F/QKKw71JtfdRElW5p4mSeQ4Vah331ESF7wisGtlsJN7SAXLA aTdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VPoHsQyZBehpHPFgUeyHV4nrXZ51tWP4ro3jxrpAuIc=; b=BBxOHXKDjJQe/a9RQTVxJ69Z9oeawjvDDPi+3mBS7Ibq9r4WLsPWET/VErpj0Mfk34 HFzXoGSMqhAtQuZu1k/p4Bmmi3JcR6Fy/xRbcHQu15itIpsKLF3Iwe8jzJxOrEGYm+Wq mCYWBfIGbWu1tGhj3TRJoZRLtIoMhMXj8rOUPfewfPtDxq6ShesyzOnvlZnWCJjXgbjT lCsdOx1XYq9pmjepH6toG7wXbFyMP5ubWtxV0R/VCNdNe/x4OhzQ1dQG9zV1CUZigsJk zYG0h6RwsnS6ddKkelrrX98NbobVa0coJsMG2sueGGv95aykiK2U1F48zQDI1XMKwpVt DK/w== X-Gm-Message-State: AO0yUKX8bbfIcaZ+2dGa+SbxyDlrL1Dlpc4pTuhNiXrBQ1bX64nHiR7a NU+onOq5eNXJpqCPpWLNHfMYES3yDED6fm+S X-Received: by 2002:a05:600c:3c94:b0:3da:2a78:d7a4 with SMTP id bg20-20020a05600c3c9400b003da2a78d7a4mr9665379wmb.21.1675434581761; Fri, 03 Feb 2023 06:29:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/33] target/arm: All UNDEF-at-EL0 traps take priority over HSTR_EL2 traps Date: Fri, 3 Feb 2023 14:29:09 +0000 Message-Id: <20230203142927.834793-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org The HSTR_EL2 register has a collection of trap bits which allow trapping to EL2 for AArch32 EL0 or EL1 accesses to coprocessor registers. The specification of these bits is that when the bit is set we should trap * EL1 accesses * EL0 accesses, if the access is not UNDEFINED when the trap bit is 0 In other words, all UNDEF traps from EL0 to EL1 take precedence over the HSTR_EL2 trap to EL2. (Since this is all AArch32, the only kind of trap-to-EL1 is the UNDEF.) Our implementation doesn't quite get this right -- we check for traps in the order: * no such register * ARMCPRegInfo::access bits * HSTR_EL2 trap bits * ARMCPRegInfo::accessfn So UNDEFs that happen because of the access bits or because the register doesn't exist at all correctly take priority over the HSTR_EL2 trap, but where a register can UNDEF at EL0 because of the accessfn we are incorrectly always taking the HSTR_EL2 trap. There aren't many of these, but one example is the PMCR; if you look at the access pseudocode for this register you can see that UNDEFs taken because of the value of PMUSERENR.EN are checked before the HSTR_EL2 bit. Rearrange helper_access_check_cp_reg() so that we always call the accessfn, and use its return value if it indicates that the access traps to EL0 rather than continuing to do the HSTR_EL2 check. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-6-peter.maydell@linaro.org Message-id: 20230127175507.2895013-6-peter.maydell@linaro.org --- target/arm/op_helper.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index def5d3515e2..660dae696dd 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -640,10 +640,24 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, goto fail; } + if (ri->accessfn) { + res = ri->accessfn(env, ri, isread); + } + /* - * Check for an EL2 trap due to HSTR_EL2. We expect EL0 accesses - * to sysregs non accessible at EL0 to have UNDEF-ed already. + * If the access function indicates a trap from EL0 to EL1 then + * that always takes priority over the HSTR_EL2 trap. (If it indicates + * a trap to EL3, then the HSTR_EL2 trap takes priority; if it indicates + * a trap to EL2, then the syndrome is the same either way so we don't + * care whether technically the architecture says that HSTR_EL2 trap or + * the other trap takes priority. So we take the "check HSTR_EL2" path + * for all of those cases.) */ + if (res != CP_ACCESS_OK && ((res & CP_ACCESS_EL_MASK) == 0) && + arm_current_el(env) == 0) { + goto fail; + } + if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { uint32_t mask = 1 << ri->crn; @@ -661,9 +675,6 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, } } - if (ri->accessfn) { - res = ri->accessfn(env, ri, isread); - } if (likely(res == CP_ACCESS_OK)) { return ri; } From patchwork Fri Feb 3 14:29:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650061 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp852777pva; Fri, 3 Feb 2023 06:36:35 -0800 (PST) X-Google-Smtp-Source: AK7set8yw4wq4TGHL80xxok2w3YaaW4QwEZRq3wWK79W4DiEUMSve6ro1q+cvNIfMfajuFpGUALP X-Received: by 2002:a05:622a:254:b0:3b6:2fbb:1f8 with SMTP id c20-20020a05622a025400b003b62fbb01f8mr18396640qtx.61.1675434995534; Fri, 03 Feb 2023 06:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434995; cv=none; d=google.com; s=arc-20160816; b=samdfQPF93+UTIVokUGT+VC+10H/ccZXgiYE9gZ76W1LSOlgDFKeC43Xk56dCDqCcT 4XnsnHMfdeyTv+z3ICVUJgH6TztNhKCcKJXMPh6nUqc178r0NpJq5dYOjkNk1PznFxfi gtIQPcjv1n0a2NUx/QO0yOiTqsMxknxbChM93QLdbUgzY44sqd4ZUyJRjcKw9Tnpl97X CekwcPzjosL5RpRNMhW3rjMhifp7lFzI6kXwfAxt202Bn++DLYjc6Kd5whHERKVjLrAh ZllyjShj0blpPeftsOgPsCafDQurgGeRRmoxDuKWoB0jaD83aycQWeiIUgnYpCNU786G pYYg== 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=Ywpnf7dogvfNG28omNoMIAJoanzOfNSxnC/Zz1BiDLQ=; b=DgJcnpqV1OWKz3EUEkha+ejflfCebZsXXTHWj8nDqiJnJuKWFg2c9ZSI0kWO0H2+kV YYvW0EIlcholJoLJR62vpjJd9Dej3UrsKDKyNNOxCSmkbsrlOeMBPq79xBsZ5pmXutRJ HqWod4SVvzSzdz7ncIIEDHASEaHEasIezUD9t/5rnF5R53WvrG1DdtwvrZxboMVZ+Bdi UygDmDrgMAhPcZ/ZWdEkz68rBeOARIj23WWoSJRaeTSBT22cCBf90OA21CwaX5qSJmcI OD3/VDokM6SX/ZtmQaAifjF3um8QPxXzyd2tmGfnycuLIFrB7WFCy5wrMyv87gvyzmG1 WN5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yHY6XMDb; 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 bp39-20020a05622a1ba700b003b841353b9csi1978367qtb.324.2023.02.03.06.36.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:36:35 -0800 (PST) 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=yHY6XMDb; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4g-0006rQ-DW; Fri, 03 Feb 2023 09:29:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hq-PS for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4U-00053h-FR for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:50 -0500 Received: by mail-wm1-x32f.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso6160546wms.0 for ; Fri, 03 Feb 2023 06:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ywpnf7dogvfNG28omNoMIAJoanzOfNSxnC/Zz1BiDLQ=; b=yHY6XMDbMNnNzH2YnKv+x3pCY8Lu6hJR9q0HxZ8OfpJm+ptoEIyT6iaqKxAtzh1Wku Rh9wnEkI7g2WB1F/Zzg1+tVfohrbKnIwMPUxMLeL3vF96yQN9yF5Q8RCxoHT6LzukQoP yNMTePmUQiBcucmipXGXOOW8VzQuTn2KeNIhSadtTpU3+4YT3zGvX8ot2zqYQ3Zhr42Y 0gwqphuwGk5fVRwaWpZfCyimgwZj4fKadOZiMtbYJBeSvQiFcTBafEQG8pdmLorCVDWV WGGWZ6i/Pq5Joj4c8dsTVAognOeMyRShgSoOkIvLtLYR3yNzyAY/y9NCJC4bHkJXOT6r aDqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ywpnf7dogvfNG28omNoMIAJoanzOfNSxnC/Zz1BiDLQ=; b=e7TVNdoVc21TuaEINXboebJvSB8MrOzwtyNYliqc4+jo0yI9wmWvqo/8NRfYGTvzW8 T3se1pnYM2B9BjDo+P0sszO0I0OK0j26SaS7GW2FVbPTwq2d6TO2ErfGpgXcd461+pwN VvkAnTPv/V5uovl/nFZPycz0FQAkf5aBn2DcfEUL3yT4oNaEsjbDKZx3uJNX9TKTKeEq UPCoMLuvzEWrYptMSp3M3bgWOB47Xkh/plR75+gza7vsp1Qd9/aWEOkfY7N5UszvcRWT 505jTWodWTGXMJOWlx7OocTau9ox7nzoyPothYnOJsGtF87yORlJTfkViEFZ6siEtIjZ eiTw== X-Gm-Message-State: AO0yUKWq5veUFEQ0RvrdB3Qr7Vj6UIP7EK3qokSCgw23x/3c+sGbI/G0 adPsm+s/o6/hp4QJhB7eQUZyQ0qYSJjzz0qc X-Received: by 2002:a05:600c:4687:b0:3db:eb0:6f6 with SMTP id p7-20020a05600c468700b003db0eb006f6mr10139201wmo.13.1675434582584; Fri, 03 Feb 2023 06:29:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/33] target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1 Date: Fri, 3 Feb 2023 14:29:10 +0000 Message-Id: <20230203142927.834793-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 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-bounces+patch=linaro.org@nongnu.org The semantics of HSTR_EL2 require that it traps cpreg accesses to EL2 for: * EL1 accesses * EL0 accesses, if the access is not UNDEFINED when the trap bit is 0 (You can see this in the I_ZFGJP priority ordering, where HSTR_EL2 traps from EL1 to EL2 are priority 12, UNDEFs are priority 13, and HSTR_EL2 traps from EL0 are priority 15.) However, we don't get this right for EL1 accesses which UNDEF because the register doesn't exist at all or because its ri->access bits non-configurably forbid the access. At EL1, check for the HSTR_EL2 trap early, before either of these UNDEF reasons. We have to retain the HSTR_EL2 check in access_check_cp_reg(), because at EL0 any kind of UNDEF-to-EL1 (including "no such register", "bad ri->access" and "ri->accessfn returns 'trap to EL1'") takes precedence over the trap to EL2. But we only need to do that check for EL0 now. Signed-off-by: Peter Maydell Tested-by: Fuad Tabba Reviewed-by: Richard Henderson Message-id: 20230130182459.3309057-7-peter.maydell@linaro.org Message-id: 20230127175507.2895013-7-peter.maydell@linaro.org --- target/arm/op_helper.c | 6 +++++- target/arm/translate.c | 28 +++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 660dae696dd..7797a137af6 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -658,7 +658,11 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, goto fail; } - if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && + /* + * HSTR_EL2 traps from EL1 are checked earlier, in generated code; + * we only need to check here for traps from EL0. + */ + if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { uint32_t mask = 1 << ri->crn; diff --git a/target/arm/translate.c b/target/arm/translate.c index 9252a464a12..f4bfe55158e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4760,6 +4760,32 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, break; } + if (s->hstr_active && cpnum == 15 && s->current_el == 1) { + /* + * At EL1, check for a HSTR_EL2 trap, which must take precedence + * over the UNDEF for "no such register" or the UNDEF for "access + * permissions forbid this EL1 access". HSTR_EL2 traps from EL0 + * only happen if the cpreg doesn't UNDEF at EL0, so we do those in + * access_check_cp_reg(), after the checks for whether the access + * configurably trapped to EL1. + */ + uint32_t maskbit = is64 ? crm : crn; + + if (maskbit != 4 && maskbit != 14) { + /* T4 and T14 are RES0 so never cause traps */ + TCGv_i32 t; + DisasLabel over = gen_disas_label(s); + + t = load_cpu_offset(offsetoflow32(CPUARMState, cp15.hstr_el2)); + tcg_gen_andi_i32(t, t, 1u << maskbit); + tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); + tcg_temp_free_i32(t); + + gen_exception_insn(s, 0, EXCP_UDEF, syndrome); + set_disas_label(s, over); + } + } + if (!ri) { /* * Unknown register; this might be a guest error or a QEMU @@ -4788,7 +4814,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, return; } - if (s->hstr_active || ri->accessfn || + if ((s->hstr_active && s->current_el == 0) || ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { /* * Emit code to perform further access permissions checks at From patchwork Fri Feb 3 14:29:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650055 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp851103pva; Fri, 3 Feb 2023 06:33:32 -0800 (PST) X-Google-Smtp-Source: AK7set+qmZGLlCY9GfTbwd18fHNtZswGqaWKIWM8aRb6DT5yjdcs7lcUfbGvnKfpTLmxd+pXp6Ug X-Received: by 2002:a05:622a:1646:b0:3b8:2e36:9d28 with SMTP id y6-20020a05622a164600b003b82e369d28mr17985847qtj.55.1675434812172; Fri, 03 Feb 2023 06:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434812; cv=none; d=google.com; s=arc-20160816; b=f4XoM62Z+F2EDCWa9NHHQei/o9ucC4EnKKZS/azGhL8/2h01nPMQgCaZdfIvkBUW38 E0IwEtwro7MKIq1qQwAkURTnNU6m4LM8cv3pxDzaTrRN0n5W7gMUyy2xjqB9kQicUiIy 8H6ap66m1oKF6vmaUdsN5JROgKluPcQu5UxH9x2UycI8bnYHWmXSfOwO8v3gq20zBxLW Z+nCqMk1A+FX5MEWO0Mw4LXjqViuGn0tqjNcDlAQ0qzF+INxC43h9qBYe+mTH3RAQAls tpYIkIkut/Xc670Bynae9+LPZObbNb0865s0CN3xKOprG3/rf/OwQYAro8YA9I4/aZeC WY1w== 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=mxLk9UAVIvLrK+pxFU4lwUCPe5SiyMuXU578mmntVS4=; b=xfChlc3hlXgkzhFz/7xOsDNXzrJDkQ1eQv7mUNQbRMPrjJ1NZsHmhImAgxsYpRBfVi B4BgJc+r2XNijgVPd3b+9tR1fixeynHQoE8ecMpsmf219PRt4OvDHLvH6ye/1tQAqrm/ pSceTXbMabzpPEjPgYyJiji9QUYEGwWF+KfUKLFW9gbSQMx7qSkssxEQXfraig5I4HV/ DDl3QjCGM1mJrTAPZrGMxCtWmOZ2ZQfY5n4H45FWNjD/t6txpMna+3ERiogwKMYbm5v5 IL0VIjh+/UcpdMqecE2wW/4FD69RKp90yWazEwr9SaAUzX7ftEs1Apb40O8qLYyFCT74 xuvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XhmwRjzK; 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 v22-20020ac85796000000b003b6a098691csi1973025qta.147.2023.02.03.06.33.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:32 -0800 (PST) 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=XhmwRjzK; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4g-0006qo-7N; Fri, 03 Feb 2023 09:29:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-0006hm-M1 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4U-00056G-FH for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:49 -0500 Received: by mail-wm1-x333.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so4005857wms.1 for ; Fri, 03 Feb 2023 06:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mxLk9UAVIvLrK+pxFU4lwUCPe5SiyMuXU578mmntVS4=; b=XhmwRjzK31X5R9YD1XmKUTIz6wfW8bbCzHBF/xH72qBdmi9dhHZicnAh41q4rYn34I u7qj6o8hrG1HX6rWrE5AMV1QemcP24eRo86pwan9RP2l3n22NIkRkzKk/6oXXYnrQlw1 6nlYfumTkA6x5+3iRelpkPwxOav1dCodHuj/DFqsJEPgor2sB+DNJVKNIAbIffYvp6Fi vTblwMJ+E2vLFfZ29YMCsgha1nle2uIOdi5/17hDGneuxWP/qg+ZSLSrvRAJXRKJ+1K0 1pM2B7NE8eztbFG65lVZgLDJG+mbiFAUZmEVtEEmTR5K3fOvK34s0TIUKHkoLGK3Q5fV o1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mxLk9UAVIvLrK+pxFU4lwUCPe5SiyMuXU578mmntVS4=; b=NOiazYP2H+fcwDELKO24myJl2zrSKNC+giOoDz8OimmCxsFLF+jdMw5rQeFSvJPX6U yV9dWJyiRLMKSh3MYN0sYmVxlLmB5QKeSuoyTLCV0xaFtv9sR4mbCdG64j+giO78dUvY 2LCOm2GdG701yhPocjySBUJGM4s64AB5zmK4Z7b9cG45nTZ+ORRdjT2Dh6ARyffuEOzv Ubq/HyzhCIJey05M85MdygkPbpKi9pKMTmpJXvTJxNrNR7TeRvYhOg0hIEhX97auPJg4 VfZNDsNf1pVap3P2wsWO7LfiroJFpJWulPwTJ6LlrivB6MrfgZqsBKThP1Iu3fXbOBUF 44Bw== X-Gm-Message-State: AO0yUKWmy2GpyiPr91IYme0mgtvk8dOonDzl7BDWEJtQsTt6dI5mCgTe 8RGri6SiH/qbK7t+NuYNEct5azvMBcYnt0J7 X-Received: by 2002:a05:600c:4f96:b0:3cf:9844:7b11 with SMTP id n22-20020a05600c4f9600b003cf98447b11mr10832298wmq.23.1675434583478; Fri, 03 Feb 2023 06:29:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/33] target/arm: Disable HSTR_EL2 traps if EL2 is not enabled Date: Fri, 3 Feb 2023 14:29:11 +0000 Message-Id: <20230203142927.834793-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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 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-bounces+patch=linaro.org@nongnu.org The HSTR_EL2 register is not supposed to have an effect unless EL2 is enabled in the current security state. We weren't checking for this, which meant that if the guest set up the HSTR_EL2 register we would incorrectly trap even for accesses from Secure EL0 and EL1. Add the missing checks. (Other places where we look at HSTR_EL2 for the not-in-v8A bits TTEE and TJDBX are already checking that we are in NS EL0 or EL1, so there we alredy know EL2 is enabled.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-8-peter.maydell@linaro.org Message-id: 20230127175507.2895013-8-peter.maydell@linaro.org --- target/arm/helper.c | 2 +- target/arm/op_helper.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 6f6772d8e04..66966869218 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11716,7 +11716,7 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, DP_TBFLAG_A32(flags, VFPEN, 1); } - if (el < 2 && env->cp15.hstr_el2 && + if (el < 2 && env->cp15.hstr_el2 && arm_is_el2_enabled(env) && (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); } diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 7797a137af6..dec03310ad5 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -663,6 +663,7 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, * we only need to check here for traps from EL0. */ if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && + arm_is_el2_enabled(env) && (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { uint32_t mask = 1 << ri->crn; From patchwork Fri Feb 3 14:29:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650035 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp848976pva; Fri, 3 Feb 2023 06:30:02 -0800 (PST) X-Google-Smtp-Source: AK7set93EB44fgoN7YOmRGoIB4pag5fJHKGNYGaiDQOq8KiCkoJELtP55QddnjcLmBFSxPY6bF0f X-Received: by 2002:ac8:7d43:0:b0:3b6:89b7:3a9b with SMTP id h3-20020ac87d43000000b003b689b73a9bmr18447763qtb.36.1675434602506; Fri, 03 Feb 2023 06:30:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434602; cv=none; d=google.com; s=arc-20160816; b=MqMsUfhEK6F0ALzJiySg+cKZXxEIYI6hNKRVdXRFVh7VzV33SlEQm6IcrHioHvYOcb DnHGBP3Z1hh4MVkTESlbpxVEI+1emlHpWW/1dZ3VvsFT4dWxhD6P57Is9oRWAzCGqpEr 2N6ZicTD7OvOnQ084A+nRwtzEEX+GZ0i58UBKDbpYI+N6dmTe6Fi3eICPbQILOGlHts0 JsHouRl36aOMoJe2G2CdQLbiw8OpGfu7sQkxiVaJTA2Zshu3BlloObuPOYqFOtIcJeN/ pE7M8havuU+lpiBz5zIt9jOOyfm0lKMJkbPUkHnMjm4mNFFIFHVJxJclmgO11SxevvN/ JkwA== 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=ds4xseoNfbnQ7hbgUrM03/ZlS2pNinEaEuw8bi6heWo=; b=TKuCv/jx+O687caOyOw9zwCKEaZ+RCmT5WZ29SjnlzfISgDDdshRXb7PaJq5b4CGlj 5PmEdTSayqpFRA+q13pFBpCcK43mz1XN8Pk+BDXAfjR8dUYr2tSNhjWR93KFE1Xr9Iso rNjmHQuPobZcFE8eRExi/R0kdALLE2TGyTZ/7FnoS2z1h9XB8lxgVCYORgUSgayvKoOn Z6LVYa4XF6I+gQcEXYqIKVx/O8B5HZcJyDv3Gulc0OaueoTT7GiQUJ3CNGIQpX5Mkz8S 448B7o9LRWd9bh4GZvr4MJDbdeAN5wnckAXjp5JAjcRJgEHYiY8v8FM/9vWmx6Uhm8l8 NJQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J51u2ruU; 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 b10-20020ac87fca000000b003b86b6c1511si2075969qtk.249.2023.02.03.06.30.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:02 -0800 (PST) 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=J51u2ruU; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4j-0006uZ-AN; Fri, 03 Feb 2023 09:30:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4a-0006i4-GV for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:53 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4U-00056P-Ft for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:50 -0500 Received: by mail-wm1-x336.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so4005888wms.1 for ; Fri, 03 Feb 2023 06:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ds4xseoNfbnQ7hbgUrM03/ZlS2pNinEaEuw8bi6heWo=; b=J51u2ruUtmj113I8FD60d1SfuDsTTxcJgdc1cC1xW1cDlRbF+WKk5b+juBXhZrt4Yc pwdfn18HRM8oyOIisUyFZhVACZAN9ZMgXvyEaFm8/Vz/LS2Sxm/E5/YSnHptsyaPFlGB sAW3ipTKHH76aGXC0O37RvUK/fkIg8OAGBwJlq30oHoTcCDFn2hbxHmV1GMT2HLFx9Mb mawc/g4szLkLfaI5B2PUUusttTUcmtS84BOFIw2PEE+ixUaxeJY6ivmoeGeZGPpr5pbh wwXstKE2F2kodiQNUxup3d3VdKOL1JW45XhUxCUcT9eFmBvY5+lyQWCEXpG57gIixqny l+tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ds4xseoNfbnQ7hbgUrM03/ZlS2pNinEaEuw8bi6heWo=; b=zIrlKHX339k6R2yIP76zLQVeVWA1SxSRtcN1gt9qWo9a0XtYLS2o1EyvsHUprS9BzB 84uBQMis83BHQjB98A0uKfzktqYRSp1K2fPJz4WpOtW2cwYGqz0oxrQ4YhP2Mxggic0V wNjE3Odfx2ISxUCvw/KHc8z+ogfWHeuWclsUCxwBKnDJY+8l3pgSMoVDgkN3AMXjtxAJ htUg/Y910OjJEiNRjYxKmYvrat/qcX8kTMXAP8i8t4jXA+WT9slm5JTlxHr7NbeGJoil 128tlYLCYLELbMOlk5y5/RJQj8Te1meTdU6YDc9NKB/qT4etP8oycD1OtOGl1uHdW+Kt nEnw== X-Gm-Message-State: AO0yUKUMR0dPXN1ECY2CL7Wv2j5NX4lrN6qQ9WzNDMPPXoO9otxzyXKM 2OAUTc1TsglH1SpfONBUAb6NAYFi35A830Nt X-Received: by 2002:a7b:c8c6:0:b0:3df:9858:c03b with SMTP id f6-20020a7bc8c6000000b003df9858c03bmr4694978wml.16.1675434584300; Fri, 03 Feb 2023 06:29:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/33] target/arm: Define the FEAT_FGT registers Date: Fri, 3 Feb 2023 14:29:12 +0000 Message-Id: <20230203142927.834793-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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, UPPERCASE_50_75=0.008 autolearn=no 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-bounces+patch=linaro.org@nongnu.org Define the system registers which are provided by the FEAT_FGT fine-grained trap architectural feature: HFGRTR_EL2, HFGWTR_EL2, HDFGRTR_EL2, HDFGWTR_EL2, HFGITR_EL2 All these registers are a set of bit fields, where each bit is set for a trap and clear to not trap on a particular system register access. The R and W register pairs are for system registers, allowing trapping to be done separately for reads and writes; the I register is for system instructions where trapping is on instruction execution. The data storage in the CPU state struct is arranged as a set of arrays rather than separate fields so that when we're looking up the bits for a system register access we can just index into the array rather than having to use a switch to select a named struct member. The later FEAT_FGT2 will add extra elements to these arrays. The field definitions for the new registers are in cpregs.h because in practice the code that needs them is code that also needs the cpregs information; cpu.h is included in a lot more files. We're also going to add some FGT-specific definitions to cpregs.h in the next commit. We do not implement HAFGRTR_EL2, because we don't implement FEAT_AMUv1. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-9-peter.maydell@linaro.org Message-id: 20230127175507.2895013-9-peter.maydell@linaro.org --- target/arm/cpregs.h | 285 ++++++++++++++++++++++++++++++++++++++++++++ target/arm/cpu.h | 15 +++ target/arm/helper.c | 40 +++++++ 3 files changed, 340 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 9744179df01..cb3dc567819 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -230,6 +230,291 @@ typedef enum CPAccessResult { CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), } CPAccessResult; +/* Indexes into fgt_read[] */ +#define FGTREG_HFGRTR 0 +#define FGTREG_HDFGRTR 1 +/* Indexes into fgt_write[] */ +#define FGTREG_HFGWTR 0 +#define FGTREG_HDFGWTR 1 +/* Indexes into fgt_exec[] */ +#define FGTREG_HFGITR 0 + +FIELD(HFGRTR_EL2, AFSR0_EL1, 0, 1) +FIELD(HFGRTR_EL2, AFSR1_EL1, 1, 1) +FIELD(HFGRTR_EL2, AIDR_EL1, 2, 1) +FIELD(HFGRTR_EL2, AMAIR_EL1, 3, 1) +FIELD(HFGRTR_EL2, APDAKEY, 4, 1) +FIELD(HFGRTR_EL2, APDBKEY, 5, 1) +FIELD(HFGRTR_EL2, APGAKEY, 6, 1) +FIELD(HFGRTR_EL2, APIAKEY, 7, 1) +FIELD(HFGRTR_EL2, APIBKEY, 8, 1) +FIELD(HFGRTR_EL2, CCSIDR_EL1, 9, 1) +FIELD(HFGRTR_EL2, CLIDR_EL1, 10, 1) +FIELD(HFGRTR_EL2, CONTEXTIDR_EL1, 11, 1) +FIELD(HFGRTR_EL2, CPACR_EL1, 12, 1) +FIELD(HFGRTR_EL2, CSSELR_EL1, 13, 1) +FIELD(HFGRTR_EL2, CTR_EL0, 14, 1) +FIELD(HFGRTR_EL2, DCZID_EL0, 15, 1) +FIELD(HFGRTR_EL2, ESR_EL1, 16, 1) +FIELD(HFGRTR_EL2, FAR_EL1, 17, 1) +FIELD(HFGRTR_EL2, ISR_EL1, 18, 1) +FIELD(HFGRTR_EL2, LORC_EL1, 19, 1) +FIELD(HFGRTR_EL2, LOREA_EL1, 20, 1) +FIELD(HFGRTR_EL2, LORID_EL1, 21, 1) +FIELD(HFGRTR_EL2, LORN_EL1, 22, 1) +FIELD(HFGRTR_EL2, LORSA_EL1, 23, 1) +FIELD(HFGRTR_EL2, MAIR_EL1, 24, 1) +FIELD(HFGRTR_EL2, MIDR_EL1, 25, 1) +FIELD(HFGRTR_EL2, MPIDR_EL1, 26, 1) +FIELD(HFGRTR_EL2, PAR_EL1, 27, 1) +FIELD(HFGRTR_EL2, REVIDR_EL1, 28, 1) +FIELD(HFGRTR_EL2, SCTLR_EL1, 29, 1) +FIELD(HFGRTR_EL2, SCXTNUM_EL1, 30, 1) +FIELD(HFGRTR_EL2, SCXTNUM_EL0, 31, 1) +FIELD(HFGRTR_EL2, TCR_EL1, 32, 1) +FIELD(HFGRTR_EL2, TPIDR_EL1, 33, 1) +FIELD(HFGRTR_EL2, TPIDRRO_EL0, 34, 1) +FIELD(HFGRTR_EL2, TPIDR_EL0, 35, 1) +FIELD(HFGRTR_EL2, TTBR0_EL1, 36, 1) +FIELD(HFGRTR_EL2, TTBR1_EL1, 37, 1) +FIELD(HFGRTR_EL2, VBAR_EL1, 38, 1) +FIELD(HFGRTR_EL2, ICC_IGRPENN_EL1, 39, 1) +FIELD(HFGRTR_EL2, ERRIDR_EL1, 40, 1) +FIELD(HFGRTR_EL2, ERRSELR_EL1, 41, 1) +FIELD(HFGRTR_EL2, ERXFR_EL1, 42, 1) +FIELD(HFGRTR_EL2, ERXCTLR_EL1, 43, 1) +FIELD(HFGRTR_EL2, ERXSTATUS_EL1, 44, 1) +FIELD(HFGRTR_EL2, ERXMISCN_EL1, 45, 1) +FIELD(HFGRTR_EL2, ERXPFGF_EL1, 46, 1) +FIELD(HFGRTR_EL2, ERXPFGCTL_EL1, 47, 1) +FIELD(HFGRTR_EL2, ERXPFGCDN_EL1, 48, 1) +FIELD(HFGRTR_EL2, ERXADDR_EL1, 49, 1) +FIELD(HFGRTR_EL2, NACCDATA_EL1, 50, 1) +/* 51-53: RES0 */ +FIELD(HFGRTR_EL2, NSMPRI_EL1, 54, 1) +FIELD(HFGRTR_EL2, NTPIDR2_EL0, 55, 1) +/* 56-63: RES0 */ + +/* These match HFGRTR but bits for RO registers are RES0 */ +FIELD(HFGWTR_EL2, AFSR0_EL1, 0, 1) +FIELD(HFGWTR_EL2, AFSR1_EL1, 1, 1) +FIELD(HFGWTR_EL2, AMAIR_EL1, 3, 1) +FIELD(HFGWTR_EL2, APDAKEY, 4, 1) +FIELD(HFGWTR_EL2, APDBKEY, 5, 1) +FIELD(HFGWTR_EL2, APGAKEY, 6, 1) +FIELD(HFGWTR_EL2, APIAKEY, 7, 1) +FIELD(HFGWTR_EL2, APIBKEY, 8, 1) +FIELD(HFGWTR_EL2, CONTEXTIDR_EL1, 11, 1) +FIELD(HFGWTR_EL2, CPACR_EL1, 12, 1) +FIELD(HFGWTR_EL2, CSSELR_EL1, 13, 1) +FIELD(HFGWTR_EL2, ESR_EL1, 16, 1) +FIELD(HFGWTR_EL2, FAR_EL1, 17, 1) +FIELD(HFGWTR_EL2, LORC_EL1, 19, 1) +FIELD(HFGWTR_EL2, LOREA_EL1, 20, 1) +FIELD(HFGWTR_EL2, LORN_EL1, 22, 1) +FIELD(HFGWTR_EL2, LORSA_EL1, 23, 1) +FIELD(HFGWTR_EL2, MAIR_EL1, 24, 1) +FIELD(HFGWTR_EL2, PAR_EL1, 27, 1) +FIELD(HFGWTR_EL2, SCTLR_EL1, 29, 1) +FIELD(HFGWTR_EL2, SCXTNUM_EL1, 30, 1) +FIELD(HFGWTR_EL2, SCXTNUM_EL0, 31, 1) +FIELD(HFGWTR_EL2, TCR_EL1, 32, 1) +FIELD(HFGWTR_EL2, TPIDR_EL1, 33, 1) +FIELD(HFGWTR_EL2, TPIDRRO_EL0, 34, 1) +FIELD(HFGWTR_EL2, TPIDR_EL0, 35, 1) +FIELD(HFGWTR_EL2, TTBR0_EL1, 36, 1) +FIELD(HFGWTR_EL2, TTBR1_EL1, 37, 1) +FIELD(HFGWTR_EL2, VBAR_EL1, 38, 1) +FIELD(HFGWTR_EL2, ICC_IGRPENN_EL1, 39, 1) +FIELD(HFGWTR_EL2, ERRSELR_EL1, 41, 1) +FIELD(HFGWTR_EL2, ERXCTLR_EL1, 43, 1) +FIELD(HFGWTR_EL2, ERXSTATUS_EL1, 44, 1) +FIELD(HFGWTR_EL2, ERXMISCN_EL1, 45, 1) +FIELD(HFGWTR_EL2, ERXPFGCTL_EL1, 47, 1) +FIELD(HFGWTR_EL2, ERXPFGCDN_EL1, 48, 1) +FIELD(HFGWTR_EL2, ERXADDR_EL1, 49, 1) +FIELD(HFGWTR_EL2, NACCDATA_EL1, 50, 1) +FIELD(HFGWTR_EL2, NSMPRI_EL1, 54, 1) +FIELD(HFGWTR_EL2, NTPIDR2_EL0, 55, 1) + +FIELD(HFGITR_EL2, ICIALLUIS, 0, 1) +FIELD(HFGITR_EL2, ICIALLU, 1, 1) +FIELD(HFGITR_EL2, ICIVAU, 2, 1) +FIELD(HFGITR_EL2, DCIVAC, 3, 1) +FIELD(HFGITR_EL2, DCISW, 4, 1) +FIELD(HFGITR_EL2, DCCSW, 5, 1) +FIELD(HFGITR_EL2, DCCISW, 6, 1) +FIELD(HFGITR_EL2, DCCVAU, 7, 1) +FIELD(HFGITR_EL2, DCCVAP, 8, 1) +FIELD(HFGITR_EL2, DCCVADP, 9, 1) +FIELD(HFGITR_EL2, DCCIVAC, 10, 1) +FIELD(HFGITR_EL2, DCZVA, 11, 1) +FIELD(HFGITR_EL2, ATS1E1R, 12, 1) +FIELD(HFGITR_EL2, ATS1E1W, 13, 1) +FIELD(HFGITR_EL2, ATS1E0R, 14, 1) +FIELD(HFGITR_EL2, ATS1E0W, 15, 1) +FIELD(HFGITR_EL2, ATS1E1RP, 16, 1) +FIELD(HFGITR_EL2, ATS1E1WP, 17, 1) +FIELD(HFGITR_EL2, TLBIVMALLE1OS, 18, 1) +FIELD(HFGITR_EL2, TLBIVAE1OS, 19, 1) +FIELD(HFGITR_EL2, TLBIASIDE1OS, 20, 1) +FIELD(HFGITR_EL2, TLBIVAAE1OS, 21, 1) +FIELD(HFGITR_EL2, TLBIVALE1OS, 22, 1) +FIELD(HFGITR_EL2, TLBIVAALE1OS, 23, 1) +FIELD(HFGITR_EL2, TLBIRVAE1OS, 24, 1) +FIELD(HFGITR_EL2, TLBIRVAAE1OS, 25, 1) +FIELD(HFGITR_EL2, TLBIRVALE1OS, 26, 1) +FIELD(HFGITR_EL2, TLBIRVAALE1OS, 27, 1) +FIELD(HFGITR_EL2, TLBIVMALLE1IS, 28, 1) +FIELD(HFGITR_EL2, TLBIVAE1IS, 29, 1) +FIELD(HFGITR_EL2, TLBIASIDE1IS, 30, 1) +FIELD(HFGITR_EL2, TLBIVAAE1IS, 31, 1) +FIELD(HFGITR_EL2, TLBIVALE1IS, 32, 1) +FIELD(HFGITR_EL2, TLBIVAALE1IS, 33, 1) +FIELD(HFGITR_EL2, TLBIRVAE1IS, 34, 1) +FIELD(HFGITR_EL2, TLBIRVAAE1IS, 35, 1) +FIELD(HFGITR_EL2, TLBIRVALE1IS, 36, 1) +FIELD(HFGITR_EL2, TLBIRVAALE1IS, 37, 1) +FIELD(HFGITR_EL2, TLBIRVAE1, 38, 1) +FIELD(HFGITR_EL2, TLBIRVAAE1, 39, 1) +FIELD(HFGITR_EL2, TLBIRVALE1, 40, 1) +FIELD(HFGITR_EL2, TLBIRVAALE1, 41, 1) +FIELD(HFGITR_EL2, TLBIVMALLE1, 42, 1) +FIELD(HFGITR_EL2, TLBIVAE1, 43, 1) +FIELD(HFGITR_EL2, TLBIASIDE1, 44, 1) +FIELD(HFGITR_EL2, TLBIVAAE1, 45, 1) +FIELD(HFGITR_EL2, TLBIVALE1, 46, 1) +FIELD(HFGITR_EL2, TLBIVAALE1, 47, 1) +FIELD(HFGITR_EL2, CFPRCTX, 48, 1) +FIELD(HFGITR_EL2, DVPRCTX, 49, 1) +FIELD(HFGITR_EL2, CPPRCTX, 50, 1) +FIELD(HFGITR_EL2, ERET, 51, 1) +FIELD(HFGITR_EL2, SVC_EL0, 52, 1) +FIELD(HFGITR_EL2, SVC_EL1, 53, 1) +FIELD(HFGITR_EL2, DCCVAC, 54, 1) +FIELD(HFGITR_EL2, NBRBINJ, 55, 1) +FIELD(HFGITR_EL2, NBRBIALL, 56, 1) + +FIELD(HDFGRTR_EL2, DBGBCRN_EL1, 0, 1) +FIELD(HDFGRTR_EL2, DBGBVRN_EL1, 1, 1) +FIELD(HDFGRTR_EL2, DBGWCRN_EL1, 2, 1) +FIELD(HDFGRTR_EL2, DBGWVRN_EL1, 3, 1) +FIELD(HDFGRTR_EL2, MDSCR_EL1, 4, 1) +FIELD(HDFGRTR_EL2, DBGCLAIM, 5, 1) +FIELD(HDFGRTR_EL2, DBGAUTHSTATUS_EL1, 6, 1) +FIELD(HDFGRTR_EL2, DBGPRCR_EL1, 7, 1) +/* 8: RES0: OSLAR_EL1 is WO */ +FIELD(HDFGRTR_EL2, OSLSR_EL1, 9, 1) +FIELD(HDFGRTR_EL2, OSECCR_EL1, 10, 1) +FIELD(HDFGRTR_EL2, OSDLR_EL1, 11, 1) +FIELD(HDFGRTR_EL2, PMEVCNTRN_EL0, 12, 1) +FIELD(HDFGRTR_EL2, PMEVTYPERN_EL0, 13, 1) +FIELD(HDFGRTR_EL2, PMCCFILTR_EL0, 14, 1) +FIELD(HDFGRTR_EL2, PMCCNTR_EL0, 15, 1) +FIELD(HDFGRTR_EL2, PMCNTEN, 16, 1) +FIELD(HDFGRTR_EL2, PMINTEN, 17, 1) +FIELD(HDFGRTR_EL2, PMOVS, 18, 1) +FIELD(HDFGRTR_EL2, PMSELR_EL0, 19, 1) +/* 20: RES0: PMSWINC_EL0 is WO */ +/* 21: RES0: PMCR_EL0 is WO */ +FIELD(HDFGRTR_EL2, PMMIR_EL1, 22, 1) +FIELD(HDFGRTR_EL2, PMBLIMITR_EL1, 23, 1) +FIELD(HDFGRTR_EL2, PMBPTR_EL1, 24, 1) +FIELD(HDFGRTR_EL2, PMBSR_EL1, 25, 1) +FIELD(HDFGRTR_EL2, PMSCR_EL1, 26, 1) +FIELD(HDFGRTR_EL2, PMSEVFR_EL1, 27, 1) +FIELD(HDFGRTR_EL2, PMSFCR_EL1, 28, 1) +FIELD(HDFGRTR_EL2, PMSICR_EL1, 29, 1) +FIELD(HDFGRTR_EL2, PMSIDR_EL1, 30, 1) +FIELD(HDFGRTR_EL2, PMSIRR_EL1, 31, 1) +FIELD(HDFGRTR_EL2, PMSLATFR_EL1, 32, 1) +FIELD(HDFGRTR_EL2, TRC, 33, 1) +FIELD(HDFGRTR_EL2, TRCAUTHSTATUS, 34, 1) +FIELD(HDFGRTR_EL2, TRCAUXCTLR, 35, 1) +FIELD(HDFGRTR_EL2, TRCCLAIM, 36, 1) +FIELD(HDFGRTR_EL2, TRCCNTVRn, 37, 1) +/* 38, 39: RES0 */ +FIELD(HDFGRTR_EL2, TRCID, 40, 1) +FIELD(HDFGRTR_EL2, TRCIMSPECN, 41, 1) +/* 42: RES0: TRCOSLAR is WO */ +FIELD(HDFGRTR_EL2, TRCOSLSR, 43, 1) +FIELD(HDFGRTR_EL2, TRCPRGCTLR, 44, 1) +FIELD(HDFGRTR_EL2, TRCSEQSTR, 45, 1) +FIELD(HDFGRTR_EL2, TRCSSCSRN, 46, 1) +FIELD(HDFGRTR_EL2, TRCSTATR, 47, 1) +FIELD(HDFGRTR_EL2, TRCVICTLR, 48, 1) +/* 49: RES0: TRFCR_EL1 is WO */ +FIELD(HDFGRTR_EL2, TRBBASER_EL1, 50, 1) +FIELD(HDFGRTR_EL2, TRBIDR_EL1, 51, 1) +FIELD(HDFGRTR_EL2, TRBLIMITR_EL1, 52, 1) +FIELD(HDFGRTR_EL2, TRBMAR_EL1, 53, 1) +FIELD(HDFGRTR_EL2, TRBPTR_EL1, 54, 1) +FIELD(HDFGRTR_EL2, TRBSR_EL1, 55, 1) +FIELD(HDFGRTR_EL2, TRBTRG_EL1, 56, 1) +FIELD(HDFGRTR_EL2, PMUSERENR_EL0, 57, 1) +FIELD(HDFGRTR_EL2, PMCEIDN_EL0, 58, 1) +FIELD(HDFGRTR_EL2, NBRBIDR, 59, 1) +FIELD(HDFGRTR_EL2, NBRBCTL, 60, 1) +FIELD(HDFGRTR_EL2, NBRBDATA, 61, 1) +FIELD(HDFGRTR_EL2, NPMSNEVFR_EL1, 62, 1) +FIELD(HDFGRTR_EL2, PMBIDR_EL1, 63, 1) + +/* + * These match HDFGRTR_EL2, but bits for RO registers are RES0. + * A few bits are for WO registers, where the HDFGRTR_EL2 bit is RES0. + */ +FIELD(HDFGWTR_EL2, DBGBCRN_EL1, 0, 1) +FIELD(HDFGWTR_EL2, DBGBVRN_EL1, 1, 1) +FIELD(HDFGWTR_EL2, DBGWCRN_EL1, 2, 1) +FIELD(HDFGWTR_EL2, DBGWVRN_EL1, 3, 1) +FIELD(HDFGWTR_EL2, MDSCR_EL1, 4, 1) +FIELD(HDFGWTR_EL2, DBGCLAIM, 5, 1) +FIELD(HDFGWTR_EL2, DBGPRCR_EL1, 7, 1) +FIELD(HDFGWTR_EL2, OSLAR_EL1, 8, 1) +FIELD(HDFGWTR_EL2, OSLSR_EL1, 9, 1) +FIELD(HDFGWTR_EL2, OSECCR_EL1, 10, 1) +FIELD(HDFGWTR_EL2, OSDLR_EL1, 11, 1) +FIELD(HDFGWTR_EL2, PMEVCNTRN_EL0, 12, 1) +FIELD(HDFGWTR_EL2, PMEVTYPERN_EL0, 13, 1) +FIELD(HDFGWTR_EL2, PMCCFILTR_EL0, 14, 1) +FIELD(HDFGWTR_EL2, PMCCNTR_EL0, 15, 1) +FIELD(HDFGWTR_EL2, PMCNTEN, 16, 1) +FIELD(HDFGWTR_EL2, PMINTEN, 17, 1) +FIELD(HDFGWTR_EL2, PMOVS, 18, 1) +FIELD(HDFGWTR_EL2, PMSELR_EL0, 19, 1) +FIELD(HDFGWTR_EL2, PMSWINC_EL0, 20, 1) +FIELD(HDFGWTR_EL2, PMCR_EL0, 21, 1) +FIELD(HDFGWTR_EL2, PMBLIMITR_EL1, 23, 1) +FIELD(HDFGWTR_EL2, PMBPTR_EL1, 24, 1) +FIELD(HDFGWTR_EL2, PMBSR_EL1, 25, 1) +FIELD(HDFGWTR_EL2, PMSCR_EL1, 26, 1) +FIELD(HDFGWTR_EL2, PMSEVFR_EL1, 27, 1) +FIELD(HDFGWTR_EL2, PMSFCR_EL1, 28, 1) +FIELD(HDFGWTR_EL2, PMSICR_EL1, 29, 1) +FIELD(HDFGWTR_EL2, PMSIRR_EL1, 31, 1) +FIELD(HDFGWTR_EL2, PMSLATFR_EL1, 32, 1) +FIELD(HDFGWTR_EL2, TRC, 33, 1) +FIELD(HDFGWTR_EL2, TRCAUXCTLR, 35, 1) +FIELD(HDFGWTR_EL2, TRCCLAIM, 36, 1) +FIELD(HDFGWTR_EL2, TRCCNTVRn, 37, 1) +FIELD(HDFGWTR_EL2, TRCIMSPECN, 41, 1) +FIELD(HDFGWTR_EL2, TRCOSLAR, 42, 1) +FIELD(HDFGWTR_EL2, TRCPRGCTLR, 44, 1) +FIELD(HDFGWTR_EL2, TRCSEQSTR, 45, 1) +FIELD(HDFGWTR_EL2, TRCSSCSRN, 46, 1) +FIELD(HDFGWTR_EL2, TRCVICTLR, 48, 1) +FIELD(HDFGWTR_EL2, TRFCR_EL1, 49, 1) +FIELD(HDFGWTR_EL2, TRBBASER_EL1, 50, 1) +FIELD(HDFGWTR_EL2, TRBLIMITR_EL1, 52, 1) +FIELD(HDFGWTR_EL2, TRBMAR_EL1, 53, 1) +FIELD(HDFGWTR_EL2, TRBPTR_EL1, 54, 1) +FIELD(HDFGWTR_EL2, TRBSR_EL1, 55, 1) +FIELD(HDFGWTR_EL2, TRBTRG_EL1, 56, 1) +FIELD(HDFGWTR_EL2, PMUSERENR_EL0, 57, 1) +FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) +FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) +FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) + typedef struct ARMCPRegInfo ARMCPRegInfo; /* diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 8cf70693be4..063024508af 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -529,6 +529,16 @@ typedef struct CPUArchState { uint64_t disr_el1; uint64_t vdisr_el2; uint64_t vsesr_el2; + + /* + * Fine-Grained Trap registers. We store these as arrays so the + * access checking code doesn't have to manually select + * HFGRTR_EL2 vs HFDFGRTR_EL2 etc when looking up the bit to test. + * FEAT_FGT2 will add more elements to these arrays. + */ + uint64_t fgt_read[2]; /* HFGRTR, HDFGRTR */ + uint64_t fgt_write[2]; /* HFGWTR, HDFGWTR */ + uint64_t fgt_exec[1]; /* HFGITR */ } cp15; struct { @@ -4164,6 +4174,11 @@ static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); } +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; +} + static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; diff --git a/target/arm/helper.c b/target/arm/helper.c index 66966869218..20527995359 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1869,6 +1869,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) if (cpu_isar_feature(aa64_hcx, cpu)) { valid_mask |= SCR_HXEN; } + if (cpu_isar_feature(aa64_fgt, cpu)) { + valid_mask |= SCR_FGTEN; + } } else { valid_mask &= ~(SCR_RW | SCR_ST); if (cpu_isar_feature(aa32_ras, cpu)) { @@ -7546,6 +7549,39 @@ static const ARMCPRegInfo scxtnum_reginfo[] = { .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) }, }; + +static CPAccessResult access_fgt(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + if (arm_current_el(env) == 2 && + arm_feature(env, ARM_FEATURE_EL3) && !(env->cp15.scr_el3 & SCR_FGTEN)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + +static const ARMCPRegInfo fgt_reginfo[] = { + { .name = "HFGRTR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, + .access = PL2_RW, .accessfn = access_fgt, + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HFGRTR]) }, + { .name = "HFGWTR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 5, + .access = PL2_RW, .accessfn = access_fgt, + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HFGWTR]) }, + { .name = "HDFGRTR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 4, + .access = PL2_RW, .accessfn = access_fgt, + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HDFGRTR]) }, + { .name = "HDFGWTR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 5, + .access = PL2_RW, .accessfn = access_fgt, + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HDFGWTR]) }, + { .name = "HFGITR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 6, + .access = PL2_RW, .accessfn = access_fgt, + .fieldoffset = offsetof(CPUARMState, cp15.fgt_exec[FGTREG_HFGITR]) }, +}; #endif /* TARGET_AARCH64 */ static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, @@ -8933,6 +8969,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (cpu_isar_feature(aa64_scxtnum, cpu)) { define_arm_cp_regs(cpu, scxtnum_reginfo); } + + if (cpu_isar_feature(aa64_fgt, cpu)) { + define_arm_cp_regs(cpu, fgt_reginfo); + } #endif if (cpu_isar_feature(any_predinv, cpu)) { From patchwork Fri Feb 3 14:29:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650038 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849434pva; Fri, 3 Feb 2023 06:30:51 -0800 (PST) X-Google-Smtp-Source: AK7set+X9OptDOnqKQ3wee06SiZ50hXSrzCoLpt2gvEJDt0yN6T8vpUo2DjNhnxA4ZCN2XQv33Db X-Received: by 2002:a05:6214:29ca:b0:56a:e4d3:624e with SMTP id gh10-20020a05621429ca00b0056ae4d3624emr642821qvb.46.1675434651030; Fri, 03 Feb 2023 06:30:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434651; cv=none; d=google.com; s=arc-20160816; b=cMrQEgbBRsY2zSAmzzsa0u8v+5crydPZ11H5GcFEFiNlloxEH4x9O5pC3q/rIN09Uf 9jihVO1ZRhAGDWmsRPbbCpsBGI6Xii+EY5DSOwwSiKc4hv6YZKGX0OyFs2vr/OVYujkx erbJ/zSP0fUHNrfuKnxSMLWPffmxYatj1kMkq/UuHOmfAtPWCepJpKAJ4UsADZeepcKU jcWu9/vIquDDIj3vPkPdcWiTUZMYi9Ov+WsTGVcWJUsxZTpHAliaJmFzX5+zvkjxCtMx /yOuxkxYEJaNbZLEv3p7YjyODBZUeQ903ga5jhlirNsLLmbcKKy9GeVJ5qg6kGMP5ehr Q4Tw== 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=VBGtDc2wO9Pk/ZYyPMtUfkQ3djSTk8nYlVlddOC0ytw=; b=gT1sJQs8hPy487za1GBtQZ2qyKmKs+fVWTHz2rTEcx/BG4cTUW90i/6OGy9VuCfJ0S UvrivAX1tBNsfqK8PC0Sky/HKPIigHHiACjz5TxEyu+KnBWhlPsNMhuRrFo05IiZ62Df rrw8RYFXpI5TcBeafE5lZfJ5geFOqJYLez9Cf8ynZjWWxjf3nEScD7odU5YVqBD5eyQE N8icD2AS0R5J6LUAQzueWkU1FdTe4BLb0NMl13o8SSeDSWJqRPDar2P+3A+OEZejgsFZ VZQPHY8XVvjVxqAzisNJ4MsIoIPY/n5++YOs2VViTy1Z4WzzVfWiqv+4Og3lbxeIypT1 cxyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCUaoMW7; 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 u19-20020a0cb413000000b005374d4d5058si1712179qve.67.2023.02.03.06.30.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:51 -0800 (PST) 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=jCUaoMW7; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006sw-3D; Fri, 03 Feb 2023 09:29:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4a-0006i5-HG for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:53 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4W-00056k-0l for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:52 -0500 Received: by mail-wm1-x331.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so6145870wmb.2 for ; Fri, 03 Feb 2023 06:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VBGtDc2wO9Pk/ZYyPMtUfkQ3djSTk8nYlVlddOC0ytw=; b=jCUaoMW7ivOpngoOHqdg3DkwyWcFQyiXj1MO66B3H/BJUuvqfaUSrf+Hf/Jhuao2RK KQUxOD7g7EHmAaEKC+EHU6XughHMUsLVStBkDMWmM3yScT+We4V5dvZPZssIrDrdfSxD Rc/83m0wTE0puV4lR/Jom5mwTMWD/Cbm9Gf+dvD2YTJAUZIKT4ThaYm4j+xhw66uUsU2 BHDpV1imuUSeWBn6+He8GGpkKb3mazxedvT2r/EH+dLpMGFhhMBD+SP/iS+KGrj4wppN ulGYBJTSpSi9C7G/zdTsF/io6di5JDofvR0R6Kx9u+UwPgkf2A6MgCJNH10s/mNWxhuP QxEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VBGtDc2wO9Pk/ZYyPMtUfkQ3djSTk8nYlVlddOC0ytw=; b=B8G2FxpBPI3DbaSmPFrw39FGwDUk1ViDX7TDKRS4veZ+nm+0OcOjTsj+9mRELES00x 8T2urEt6XUr8CpYDaEbnqC/5qxyQe6oFkbTHs1Jmfd6wqpHOlyHa1NT38JMoQSSQ6Vhz gk7etZ+V+YkgI/cVHEw1qrD+tu3AGfLXOYFW2ujRcSnIjdeGcm7ntGv0oskRfgKzDG98 feEk87BPVsCebB1J0QxXZaVqsvM3T+bONvfzF0mVf9CUyqTUcZVduG/d6B1WGCUFuMU1 /btVRA+GER9BhYfPfR4yxgyeMld7KCC8AcKcG2jE3C6eXQhxSmKGjEsEM0K/lR7/7ptu /3GA== X-Gm-Message-State: AO0yUKVsUwhg6tTBB1QM/ZjyM8htuUtzGwB0aTCkI++xISGrder/MkLz LhTJju8xxNxbiI4fdSgPIdXV4MCQ89IvKyan X-Received: by 2002:a05:600c:c13:b0:3dc:496f:ad56 with SMTP id fm19-20020a05600c0c1300b003dc496fad56mr9707779wmb.14.1675434585138; Fri, 03 Feb 2023 06:29:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/33] target/arm: Implement FGT trapping infrastructure Date: Fri, 3 Feb 2023 14:29:13 +0000 Message-Id: <20230203142927.834793-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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 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-bounces+patch=linaro.org@nongnu.org Implement the machinery for fine-grained traps on normal sysregs. Any sysreg with a fine-grained trap will set the new field to indicate which FGT register bit it should trap on. FGT traps only happen when an AArch64 EL2 enables them for an AArch64 EL1. They therefore are only relevant for AArch32 cpregs when the cpreg can be accessed from EL0. The logic in access_check_cp_reg() will check this, so it is safe to add a .fgt marking to an ARM_CP_STATE_BOTH ARMCPRegInfo. The DO_BIT and DO_REV_BIT macros define enum constants FGT_##bitname which can be used to specify the FGT bit, eg .fgt = FGT_AFSR0_EL1 (We assume that there is no bit name duplication across the FGT registers, for brevity's sake.) Subsequent commits will add the .fgt fields to the relevant register definitions and define the FGT_nnn values for them. Note that some of the FGT traps are for instructions that we don't handle via the cpregs mechanisms (mostly these are instruction traps). Those we will have to handle separately. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-10-peter.maydell@linaro.org Message-id: 20230127175507.2895013-10-peter.maydell@linaro.org --- target/arm/cpregs.h | 72 ++++++++++++++++++++++++++++++++++++++ target/arm/cpu.h | 1 + target/arm/internals.h | 20 +++++++++++ target/arm/translate.h | 2 ++ target/arm/helper.c | 9 +++++ target/arm/op_helper.c | 30 ++++++++++++++++ target/arm/translate-a64.c | 3 +- target/arm/translate.c | 2 ++ 8 files changed, 138 insertions(+), 1 deletion(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index cb3dc567819..8cc12045af6 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -515,6 +515,73 @@ FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) +/* Which fine-grained trap bit register to check, if any */ +FIELD(FGT, TYPE, 10, 3) +FIELD(FGT, REV, 9, 1) /* Is bit sense reversed? */ +FIELD(FGT, IDX, 6, 3) /* Index within a uint64_t[] array */ +FIELD(FGT, BITPOS, 0, 6) /* Bit position within the uint64_t */ + +/* + * Macros to define FGT_##bitname enum constants to use in ARMCPRegInfo::fgt + * fields. We assume for brevity's sake that there are no duplicated + * bit names across the various FGT registers. + */ +#define DO_BIT(REG, BITNAME) \ + FGT_##BITNAME = FGT_##REG | R_##REG##_EL2_##BITNAME##_SHIFT + +/* Some bits have reversed sense, so 0 means trap and 1 means not */ +#define DO_REV_BIT(REG, BITNAME) \ + FGT_##BITNAME = FGT_##REG | FGT_REV | R_##REG##_EL2_##BITNAME##_SHIFT + +typedef enum FGTBit { + /* + * These bits tell us which register arrays to use: + * if FGT_R is set then reads are checked against fgt_read[]; + * if FGT_W is set then writes are checked against fgt_write[]; + * if FGT_EXEC is set then all accesses are checked against fgt_exec[]. + * + * For almost all bits in the R/W register pairs, the bit exists in + * both registers for a RW register, in HFGRTR/HDFGRTR for a RO register + * with the corresponding HFGWTR/HDFGTWTR bit being RES0, and vice-versa + * for a WO register. There are unfortunately a couple of exceptions + * (PMCR_EL0, TRFCR_EL1) where the register being trapped is RW but + * the FGT system only allows trapping of writes, not reads. + * + * Note that we arrange these bits so that a 0 FGTBit means "no trap". + */ + FGT_R = 1 << R_FGT_TYPE_SHIFT, + FGT_W = 2 << R_FGT_TYPE_SHIFT, + FGT_EXEC = 4 << R_FGT_TYPE_SHIFT, + FGT_RW = FGT_R | FGT_W, + /* Bit to identify whether trap bit is reversed sense */ + FGT_REV = R_FGT_REV_MASK, + + /* + * If a bit exists in HFGRTR/HDFGRTR then either the register being + * trapped is RO or the bit also exists in HFGWTR/HDFGWTR, so we either + * want to trap for both reads and writes or else it's harmless to mark + * it as trap-on-writes. + * If a bit exists only in HFGWTR/HDFGWTR then either the register being + * trapped is WO, or else it is one of the two oddball special cases + * which are RW but have only a write trap. We mark these as only + * FGT_W so we get the right behaviour for those special cases. + * (If a bit was added in future that provided only a read trap for an + * RW register we'd need to do something special to get the FGT_R bit + * only. But this seems unlikely to happen.) + * + * So for the DO_BIT/DO_REV_BIT macros: use FGT_HFGRTR/FGT_HDFGRTR if + * the bit exists in that register. Otherwise use FGT_HFGWTR/FGT_HDFGWTR. + */ + FGT_HFGRTR = FGT_RW | (FGTREG_HFGRTR << R_FGT_IDX_SHIFT), + FGT_HFGWTR = FGT_W | (FGTREG_HFGWTR << R_FGT_IDX_SHIFT), + FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), + FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), + FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), +} FGTBit; + +#undef DO_BIT +#undef DO_REV_BIT + typedef struct ARMCPRegInfo ARMCPRegInfo; /* @@ -569,6 +636,11 @@ struct ARMCPRegInfo { CPAccessRights access; /* Security state: ARM_CP_SECSTATE_* bits/values */ CPSecureState secure; + /* + * Which fine-grained trap register bit to check, if any. This + * value encodes both the trap register and bit within it. + */ + FGTBit fgt; /* * The opaque pointer passed to define_arm_cp_regs_with_opaque() when * this register was defined: can be used to hand data through to the diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 063024508af..5cc81bec9bf 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3170,6 +3170,7 @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) /* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) +FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) /* * Bit usage when in AArch32 state, both A- and M-profile. diff --git a/target/arm/internals.h b/target/arm/internals.h index d9555309df0..e1e018da463 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1377,4 +1377,24 @@ static inline uint64_t arm_mdcr_el2_eff(CPUARMState *env) ((1 << (1 - 1)) | (1 << (2 - 1)) | \ (1 << (4 - 1)) | (1 << (8 - 1)) | (1 << (16 - 1))) +/* + * Return true if it is possible to take a fine-grained-trap to EL2. + */ +static inline bool arm_fgt_active(CPUARMState *env, int el) +{ + /* + * The Arm ARM only requires the "{E2H,TGE} != {1,1}" test for traps + * that can affect EL0, but it is harmless to do the test also for + * traps on registers that are only accessible at EL1 because if the test + * returns true then we can't be executing at EL1 anyway. + * FGT traps only happen when EL2 is enabled and EL1 is AArch64; + * traps from AArch32 only happen for the EL0 is AArch32 case. + */ + return cpu_isar_feature(aa64_fgt, env_archcpu(env)) && + el < 2 && arm_is_el2_enabled(env) && + arm_el_is_aa64(env, 1) && + (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE) && + (!arm_feature(env, ARM_FEATURE_EL3) || (env->cp15.scr_el3 & SCR_FGTEN)); +} + #endif diff --git a/target/arm/translate.h b/target/arm/translate.h index f17f095cbe2..599902016dc 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -130,6 +130,8 @@ typedef struct DisasContext { bool is_nonstreaming; /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ bool mve_no_pred; + /* True if fine-grained traps are active */ + bool fgt_active; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index 20527995359..2389e41bd07 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11689,6 +11689,7 @@ static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, if (arm_singlestep_active(env)) { DP_TBFLAG_ANY(flags, SS_ACTIVE, 1); } + return flags; } @@ -11761,6 +11762,10 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); } + if (arm_fgt_active(env, el)) { + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); + } + if (env->uncached_cpsr & CPSR_IL) { DP_TBFLAG_ANY(flags, PSTATE__IL, 1); } @@ -11895,6 +11900,10 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, DP_TBFLAG_ANY(flags, PSTATE__IL, 1); } + if (arm_fgt_active(env, el)) { + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); + } + if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { /* * Set MTE_ACTIVE if any access may be Checked, and leave clear diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index dec03310ad5..3baf8004f64 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -680,6 +680,36 @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, } } + /* + * Fine-grained traps also are lower priority than undef-to-EL1, + * higher priority than trap-to-EL3, and we don't care about priority + * order with other EL2 traps because the syndrome value is the same. + */ + if (arm_fgt_active(env, arm_current_el(env))) { + uint64_t trapword = 0; + unsigned int idx = FIELD_EX32(ri->fgt, FGT, IDX); + unsigned int bitpos = FIELD_EX32(ri->fgt, FGT, BITPOS); + bool rev = FIELD_EX32(ri->fgt, FGT, REV); + bool trapbit; + + if (ri->fgt & FGT_EXEC) { + assert(idx < ARRAY_SIZE(env->cp15.fgt_exec)); + trapword = env->cp15.fgt_exec[idx]; + } else if (isread && (ri->fgt & FGT_R)) { + assert(idx < ARRAY_SIZE(env->cp15.fgt_read)); + trapword = env->cp15.fgt_read[idx]; + } else if (!isread && (ri->fgt & FGT_W)) { + assert(idx < ARRAY_SIZE(env->cp15.fgt_write)); + trapword = env->cp15.fgt_write[idx]; + } + + trapbit = extract64(trapword, bitpos, 1); + if (trapbit != rev) { + res = CP_ACCESS_TRAP_EL2; + goto fail; + } + } + if (likely(res == CP_ACCESS_OK)) { return ri; } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 52b1b8a1f0a..a47dab4f1dd 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1962,7 +1962,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, return; } - if (ri->accessfn) { + if (ri->accessfn || (ri->fgt && s->fgt_active)) { /* Emit code to perform further access permissions checks at * runtime; this may result in an exception. */ @@ -14741,6 +14741,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); 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; diff --git a/target/arm/translate.c b/target/arm/translate.c index f4bfe55158e..3f51dc6a6bf 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4815,6 +4815,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, } if ((s->hstr_active && s->current_el == 0) || ri->accessfn || + (ri->fgt && s->fgt_active) || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { /* * Emit code to perform further access permissions checks at @@ -9415,6 +9416,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); if (arm_feature(env, ARM_FEATURE_M)) { dc->vfp_enabled = 1; From patchwork Fri Feb 3 14:29:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650058 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp851652pva; Fri, 3 Feb 2023 06:34:30 -0800 (PST) X-Google-Smtp-Source: AK7set+Ctz70uSUz5uFhpSyiLNE/evmaABM73GCdS3i/GiP2gLJnbwbQ6YPHP7I7MxlHRzY1BpWm X-Received: by 2002:a0c:aa18:0:b0:537:648a:e735 with SMTP id d24-20020a0caa18000000b00537648ae735mr14085977qvb.5.1675434869869; Fri, 03 Feb 2023 06:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434869; cv=none; d=google.com; s=arc-20160816; b=Wocd7TtCs3/mC2TwHd25th0vxch/ZH8qq2rMTDElS8yOe5gApLuIHrbb+H3fx/TEtB rBwFbb9sQJMZC0uBfFm/bWmIQBRWxD1m7gjxyzQTlq7l90k+m/ptWbH5PVm+1n3756QQ KBEEaHQuI8Bnvg+lNtN2Cpgy2taku6PTNpMq+4wtslF82oRAchaI1IHDw/HryeneRxNZ CKOf2JIZQk2GBG0Ti4mwmYq7zGcetdg8hCJSosM6SEMi3lqe8W6eEJLGUgLg7ctlnC2n Wfuq5CD8Z2X+XsqHUieFM5CijDLKL5xceXbTVw+r8NCrO0MnbbwwAf+D4Wcl8x3wnt7S SnOA== 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=yQxmFDzxxFrhEVqQzCA0FWZTs2ofEI2+0Euyqm2fY1E=; b=jEH2HEi2JwBD5wxcKDz7pSrvDqHH0u4FKt5Fzt2r8/aKDol1XjFTvnpeKK/GSU5JCQ qd7WC4nZ8LW1NTIkDV3qGGo3RCdQBRo8MQpB2+g7tMyBcCesoelvaTNOtv9VW5Om+15j x/p7I0kU3DHR/TyzfhROZ/nGKofSZnKp4aY//dQHMkGANLV3SWR+nplmYBN+r4YPjE1d yOBdqyMRysioMYcFIZjovlmAyYybM9XSm0CrYvUBmPccjZntBppMMb+ufrUawoEXrazg zqz5M1AbKu/64BLQHnZpsfuCw8WPAUxZZFvd+vws/bVQTY2BZT3eRLpgffGUxyICV9V/ hOig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vn3ejJCB; 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 q2-20020a0c8cc2000000b00537685bb69bsi1753763qvb.69.2023.02.03.06.34.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:34:29 -0800 (PST) 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=vn3ejJCB; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006tW-OB; Fri, 03 Feb 2023 09:29:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4a-0006i6-Ht for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:53 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4X-000572-2d for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:51 -0500 Received: by mail-wm1-x334.google.com with SMTP id j32-20020a05600c1c2000b003dc4fd6e61dso6130144wms.5 for ; Fri, 03 Feb 2023 06:29:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yQxmFDzxxFrhEVqQzCA0FWZTs2ofEI2+0Euyqm2fY1E=; b=vn3ejJCBVKvfaKNXNgXAMDtPSngk3iqzBj1CwoqAauUWhW0GtxbxP/PuZlskIK1Dec 1WsmgsjFv68IFr1dSUDpMEmrC2QM60frjnLCKBnODw7clEyych1B3dKwbDz+GNDIo0rB T12tEg/HPGIvLv20CnSgbIoGpWSB6sGfazwGw9yzSrHgJA2zxyfFh4RtIhIUcut/EWJq 86yQ4NzvOPWlAENtGU1BkQBI7ltLlDNQTtjJecncdn9caLSAbWIaPIx2+JRPppwVXhTq XMA29uaOtIYP/yfPa9N1/UAP+jd6YFKXSdiWpq/2PrxaogTF80heGDxjqdn8i0q1ok2D Mp6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yQxmFDzxxFrhEVqQzCA0FWZTs2ofEI2+0Euyqm2fY1E=; b=LIEPqlE9Ivb7En7tTnSgiIvUAebxVz86sChjJk8h+xbHDU+aqNGhky4URxQiu8m3qu GE1lE+y3Wx9r07VzX6E/HjLHCIegMhtG7irqCqVvcVYXC3FYGU2KuCR6Q9f2kqpp6/lW VmrsS5k5+f4X9sg2MSenU3tDuOTVRZxetXigODVpsePa7q9HOQGKviDCEDIj/5MAVjYx IYJ17dlE5PynB58r0LCNScWKna9GecF8MxFsgs4W9j4CtiIKzUl9Ti+7LfP6KlZSBVWX hbNACdLoh4WP0rS/0fxaYcyhDr5UO24J67zrPr8trA3TxkzHNKRzFeQkHlUI5D+6t5XU tnig== X-Gm-Message-State: AO0yUKVbKE12ii0PlyJ50dh1s3hytYs2eYqOCri1/wwHiIwgM066drjl fyqS8p8ld0ELYjPTP3/2455cIYd9x7nmSuLe X-Received: by 2002:a05:600c:3c9b:b0:3dc:46e8:982 with SMTP id bg27-20020a05600c3c9b00b003dc46e80982mr9496370wmb.19.1675434586066; Fri, 03 Feb 2023 06:29:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/33] target/arm: Mark up sysregs for HFGRTR bits 0..11 Date: Fri, 3 Feb 2023 14:29:14 +0000 Message-Id: <20230203142927.834793-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the registers trapped by HFGRTR/HFGWTR bits 0..11. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-11-peter.maydell@linaro.org Message-id: 20230127175507.2895013-11-peter.maydell@linaro.org --- target/arm/cpregs.h | 14 ++++++++++++++ target/arm/helper.c | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 8cc12045af6..82f2cefff0a 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -577,6 +577,20 @@ typedef enum FGTBit { FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), + + /* Trap bits in HFGRTR_EL2 / HFGWTR_EL2, starting from bit 0. */ + DO_BIT(HFGRTR, AFSR0_EL1), + DO_BIT(HFGRTR, AFSR1_EL1), + DO_BIT(HFGRTR, AIDR_EL1), + DO_BIT(HFGRTR, AMAIR_EL1), + DO_BIT(HFGRTR, APDAKEY), + DO_BIT(HFGRTR, APDBKEY), + DO_BIT(HFGRTR, APGAKEY), + DO_BIT(HFGRTR, APIAKEY), + DO_BIT(HFGRTR, APIBKEY), + DO_BIT(HFGRTR, CCSIDR_EL1), + DO_BIT(HFGRTR, CLIDR_EL1), + DO_BIT(HFGRTR, CONTEXTIDR_EL1), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 2389e41bd07..30e54455ac7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -633,6 +633,7 @@ static const ARMCPRegInfo cp_reginfo[] = { { .name = "CONTEXTIDR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_CONTEXTIDR_EL1, .secure = ARM_CP_SECSTATE_NS, .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[1]), .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, @@ -2163,6 +2164,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, .access = PL1_R, .accessfn = access_tid4, + .fgt = FGT_CCSIDR_EL1, .readfn = ccsidr_read, .type = ARM_CP_NO_RAW }, { .name = "CSSELR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, @@ -2179,6 +2181,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid1, + .fgt = FGT_AIDR_EL1, .resetvalue = 0 }, /* * Auxiliary fault status registers: these also are IMPDEF, and we @@ -2187,10 +2190,12 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_AFSR0_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "AFSR1_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_AFSR1_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, /* * MAIR can just read-as-written because we don't implement caches @@ -4392,6 +4397,7 @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { { .name = "AMAIR0", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_AMAIR_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, /* AMAIR1 is mapped to AMAIR_EL1[63:32] */ { .name = "AMAIR1", .cp = 15, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 1, @@ -7041,42 +7047,52 @@ static const ARMCPRegInfo pauth_reginfo[] = { { .name = "APDAKEYLO_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 0, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APDAKEY, .fieldoffset = offsetof(CPUARMState, keys.apda.lo) }, { .name = "APDAKEYHI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 1, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APDAKEY, .fieldoffset = offsetof(CPUARMState, keys.apda.hi) }, { .name = "APDBKEYLO_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 2, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APDBKEY, .fieldoffset = offsetof(CPUARMState, keys.apdb.lo) }, { .name = "APDBKEYHI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 3, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APDBKEY, .fieldoffset = offsetof(CPUARMState, keys.apdb.hi) }, { .name = "APGAKEYLO_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 0, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APGAKEY, .fieldoffset = offsetof(CPUARMState, keys.apga.lo) }, { .name = "APGAKEYHI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 1, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APGAKEY, .fieldoffset = offsetof(CPUARMState, keys.apga.hi) }, { .name = "APIAKEYLO_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 0, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APIAKEY, .fieldoffset = offsetof(CPUARMState, keys.apia.lo) }, { .name = "APIAKEYHI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 1, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APIAKEY, .fieldoffset = offsetof(CPUARMState, keys.apia.hi) }, { .name = "APIBKEYLO_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 2, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APIBKEY, .fieldoffset = offsetof(CPUARMState, keys.apib.lo) }, { .name = "APIBKEYHI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 3, .access = PL1_RW, .accessfn = access_pauth, + .fgt = FGT_APIBKEY, .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, }; @@ -7940,6 +7956,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid4, + .fgt = FGT_CLIDR_EL1, .resetvalue = cpu->clidr }; define_one_arm_cp_reg(cpu, &clidr); From patchwork Fri Feb 3 14:29:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650053 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850951pva; Fri, 3 Feb 2023 06:33:17 -0800 (PST) X-Google-Smtp-Source: AK7set9LJDggGmxsMatBN1l1Cy24qqp/IlVAUdHTdMSDrrnTROhjW/hMQIHj1tSdGhzVFx2wCDki X-Received: by 2002:a0c:c447:0:b0:537:6e23:f34c with SMTP id t7-20020a0cc447000000b005376e23f34cmr14365191qvi.39.1675434797690; Fri, 03 Feb 2023 06:33:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434797; cv=none; d=google.com; s=arc-20160816; b=MjkhP9tePCQAo+R8CzhuhpFnIONr4atlZaYwLwnn+SzpzuxjYNleoYHOhCAd4bfMfK gps9KbzGK8T8y1Ow27ajLHL2j1tUPHO/eBZt65b6qf7vaWeybpUY0cx2bSzkNTLYLaBH 3CXQAKL3yDyIWYQwVZj6ARQB7mXjkp9AkjC6xuq5q3vmxnTr5iRpo6TflpbBxmXllzmt gmEotD2X4y7q+wsjoKniZPyBXiA2qm0fk+O6Tx125Ir3nq8Mv1morGUtCbGQj6+ZqDt0 KxRI7Y4xH/IKhiUzPYmrlyH4v19I2QS+nvXxCOXTPuGsNX6capDy7hVnwO00KavnQRYV gQOw== 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=p6ebWUhLxy1Vko9RKec4Spu2hlMYvJ/5ZZfi2NMMhLY=; b=mO8y7BTaZ8G3r/myKEg+xOOsT68Jl874LwAlKbYlCF8gLMVU3VWlLdh9LT1XrvE45f NtBIIS91OMF8R2XGoFoSgBtiq2iklqSP53IxZUqXAJYoRaIqmo6S1QTYOlwcZ+sB/nAP QE5RHEqEwiSHhbU9/OUfN200XcSzJRed9YWMKv/5L0ImNzewDlDLNepvQLvlBIgCdwrX 6K+BssbX9gxljuJztlQWMiSogVbi1XwQ9JOsBU+tAXoMgStbBB77E93hN6PAaG09n9J2 ZhS+IDhKkJZ/nBCWIf1lNS9VNph9Yi2gG1AZEuUrK9OpPBEYb7GsrRSODiWcMJuBM9Hx RAKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m3o7g7Lh; 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 jq5-20020ad45fc5000000b005355d405358si2001119qvb.474.2023.02.03.06.33.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:17 -0800 (PST) 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=m3o7g7Lh; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4j-0006uf-PO; Fri, 03 Feb 2023 09:30:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4c-0006jJ-0z for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-00057G-BY for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:53 -0500 Received: by mail-wm1-x334.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so6145934wmb.2 for ; Fri, 03 Feb 2023 06:29:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=p6ebWUhLxy1Vko9RKec4Spu2hlMYvJ/5ZZfi2NMMhLY=; b=m3o7g7LhK5q8cqpL4j091RrVmUQyFzUloPWMHfgS+aNbhLD14RDz9TMgnliR1aokHH 9qysRQNs0JHAsuijtYaouh4EUL8WTTmbd+rR5JLoO912pPfHcjx3CeCReigSecuvOCqW NNrb8JQvVbP5bj5KPq+YLd69xjtH14gv4kqUvI1qg/Z/hNF8xmYbxb4CP1dDeqCOyiyt KAPjS5jL8cC2GV3n3Jt6xV4ISU4vygfL/+srEAR7hQJkMz5faAUtB3fdFbqKJ0ssRccf Ho1WQlj64n9Qk39LgN7fSmeehOvsAxAfYVfuX7qFOSSoDHd8KlMDK7PUCv1cYB6IAVzY eOdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p6ebWUhLxy1Vko9RKec4Spu2hlMYvJ/5ZZfi2NMMhLY=; b=Me2y9esak2Rjo55hWDAachaL/aCNBGKseebG1yipo90fBBEPZJsWZRWYXUfRrvehhw tKjgUh5gqzBJYUSjAgfk+wa0DhyjJkn7VYk2iqAdWye9bFu4pfaFSAVLUqdeoirQW5ag XtOIPUcu7Z8PsVpE9yacDNgvNEBvb87DVlEcVpjV5SHsPOQ8eupdbJoliOVM/75jWey3 b5N4TGqCedJEmH9VVLHygtO4xail3QNSrlSkvgx0+r/6rvp5bq0dctE49DedCJVzMLge HmiuDh9Hapig+7GBrYfCKGoIB4Sh5ng0XrOThxKuv36wIKFM4M1uJfw2w8t/XpLAJlgV zS8A== X-Gm-Message-State: AO0yUKUayy8Kv3lyCY40NjasDNJt6gleZ8z7yh2V2g47nfRYhzVk7cPb KgDLcxNcd43A+4zJHgrRKYcZhhrujBNgAYxL X-Received: by 2002:a05:600c:1d83:b0:3cf:68d3:3047 with SMTP id p3-20020a05600c1d8300b003cf68d33047mr9499897wms.41.1675434586946; Fri, 03 Feb 2023 06:29:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/33] target/arm: Mark up sysregs for HFGRTR bits 12..23 Date: Fri, 3 Feb 2023 14:29:15 +0000 Message-Id: <20230203142927.834793-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the registers trapped by HFGRTR/HFGWTR bits 12..23. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-12-peter.maydell@linaro.org Message-id: 20230127175507.2895013-12-peter.maydell@linaro.org --- target/arm/cpregs.h | 12 ++++++++++++ target/arm/helper.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 82f2cefff0a..67d87ae8bf5 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -591,6 +591,18 @@ typedef enum FGTBit { DO_BIT(HFGRTR, CCSIDR_EL1), DO_BIT(HFGRTR, CLIDR_EL1), DO_BIT(HFGRTR, CONTEXTIDR_EL1), + DO_BIT(HFGRTR, CPACR_EL1), + DO_BIT(HFGRTR, CSSELR_EL1), + DO_BIT(HFGRTR, CTR_EL0), + DO_BIT(HFGRTR, DCZID_EL0), + DO_BIT(HFGRTR, ESR_EL1), + DO_BIT(HFGRTR, FAR_EL1), + DO_BIT(HFGRTR, ISR_EL1), + DO_BIT(HFGRTR, LORC_EL1), + DO_BIT(HFGRTR, LOREA_EL1), + DO_BIT(HFGRTR, LORID_EL1), + DO_BIT(HFGRTR, LORN_EL1), + DO_BIT(HFGRTR, LORSA_EL1), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 30e54455ac7..c059935d0e6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -869,6 +869,7 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0, }, { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, + .fgt = FGT_CPACR_EL1, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), .resetfn = cpacr_reset, .writefn = cpacr_write, .readfn = cpacr_read }, }; @@ -2170,6 +2171,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, .access = PL1_RW, .accessfn = access_tid4, + .fgt = FGT_CSSELR_EL1, .writefn = csselr_write, .resetvalue = 0, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s), offsetof(CPUARMState, cp15.csselr_ns) } }, @@ -2233,6 +2235,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .resetfn = arm_cp_reset_ignore }, { .name = "ISR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 0, + .fgt = FGT_ISR_EL1, .type = ARM_CP_NO_RAW, .access = PL1_R, .readfn = isr_read }, /* 32 bit ITLB invalidates */ { .name = "ITLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 0, @@ -4135,6 +4138,7 @@ static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { { .name = "FAR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_FAR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), .resetvalue = 0, }, }; @@ -4143,6 +4147,7 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { { .name = "ESR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .crn = 5, .crm = 2, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_ESR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.esr_el[1]), .resetvalue = 0, }, { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, @@ -5215,6 +5220,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0, .access = PL0_R, .type = ARM_CP_NO_RAW, + .fgt = FGT_DCZID_EL0, .readfn = aa64_dczid_read }, { .name = "DC_ZVA", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 1, @@ -7005,22 +7011,27 @@ static const ARMCPRegInfo lor_reginfo[] = { { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, .access = PL1_RW, .accessfn = access_lor_other, + .fgt = FGT_LORSA_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, .access = PL1_RW, .accessfn = access_lor_other, + .fgt = FGT_LOREA_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, .access = PL1_RW, .accessfn = access_lor_other, + .fgt = FGT_LORN_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, .access = PL1_RW, .accessfn = access_lor_other, + .fgt = FGT_LORC_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, .access = PL1_R, .accessfn = access_lor_ns, + .fgt = FGT_LORID_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, }; @@ -8619,6 +8630,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "CTR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 0, .crm = 0, .access = PL0_R, .accessfn = ctr_el0_access, + .fgt = FGT_CTR_EL0, .type = ARM_CP_CONST, .resetvalue = cpu->ctr }, /* TCMTR and TLBTR exist in v8 but have no 64-bit versions */ { .name = "TCMTR", From patchwork Fri Feb 3 14:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650066 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp853144pva; Fri, 3 Feb 2023 06:37:13 -0800 (PST) X-Google-Smtp-Source: AK7set9PBgT9bwxUt/fjfD23649Bk23D/pNiIJtM3G1n+iykRzLQdHh7OtHprvdVZ/LA66ZVXLS/ X-Received: by 2002:ac8:57d6:0:b0:3b8:6cd5:eda with SMTP id w22-20020ac857d6000000b003b86cd50edamr20705136qta.47.1675435032919; Fri, 03 Feb 2023 06:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675435032; cv=none; d=google.com; s=arc-20160816; b=uWSUyLJRVONBf735SN3E8VOwVoQw52uG1u0OOacNaJoMQilfX7ixLy3BH9JU5sLIEs ojp5G7473jEwzmOAsVcQMZCVue2C0Ewj0Nwk052ONJOGgUp6de6vCa4YiOg5k24hBPvW Js4ySD9VuzYL6xIrOQy0iRYl8TiBKThyeXuRpaEXfLUZKR2vjCyXxWdF+hCdLtwUO45N zq/qdxc4byvqfn32aPoAL2z1JsR9Sv5g9oux4IbvIA202Mbh09j6nNzGOw1nv6zYhy5f UI2osvYNyJXZF5omTBzJ/A/VbVY7rm5L1n2ZJCTrN4mIRDnjIAE+imEynkAfoGU6h2Z/ iEmQ== 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=0taStepCYELwMXmaZO+UXEgrJrJoHD0cnE+BYO0UISY=; b=Df827K0VWy9XhmoxRSdCLzLR5MmQCUDADkbQUqiNSETIfhhn6hPZkkaGi1+a0Gfjc6 PUuPBuiUrfsjBwyZ/eS4PKD57iCM6oLQi+xJZ3ojzN0PEitrdi3aMMZw1UYBiz+xu4S8 MaUHSYL4Mobr+UOMrRz8gzZR3HLY/4SOR5p+hZMOgR0p5Lj6qvBRx283xBzGJXWT1Nqa hcAeMo73TnPHttPL/aufLm96fpmWY+0DEnURiK8cbFbsFRUCP7iU7jscpDTC+EKY6X4d WL4MI/rso6I3ILPp/KladNaELaRJRzQ8p83vtBOsrvFCkIXxglS4E+LobJPjEm7CCKZr OFbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D+ME8HfP; 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 x1-20020a05622a000100b003b6955054a1si1702977qtw.424.2023.02.03.06.37.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:37:12 -0800 (PST) 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=D+ME8HfP; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx51-0007HI-ED; Fri, 03 Feb 2023 09:30:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4c-0006jK-3L for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-00057L-CA for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:53 -0500 Received: by mail-wm1-x330.google.com with SMTP id n13so4000889wmr.4 for ; Fri, 03 Feb 2023 06:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0taStepCYELwMXmaZO+UXEgrJrJoHD0cnE+BYO0UISY=; b=D+ME8HfPbqx0RC/0muSsblIOPi+U8igcLPeD9AIrrZ+MmRd3GZ/hdEoulajlunHPx1 RxT7+E7Pf502Tghcj/0nYAloxbdSc/sNDJZiBjhZY3sacVmmmlMsqCehPZqm44B5Jvqp 5/8pLAl3fjHkIftiSR1dnahRTBpW2yBfVVjygmp4HEVRIgXLseJjhp1XvZaXpzU9QaI1 hZogoBGVERbacHQdF1flpMHh2aYKLFdYhTTYzKOhQs97meJ87sQuRyEGOadgITSZX9dc 9EPqteNZeudTsYgZ67qNSK/n0ysLYMMVvxc5aNAHr3rOJ4XbcC+cH8noK69+JceLQp1u qBHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0taStepCYELwMXmaZO+UXEgrJrJoHD0cnE+BYO0UISY=; b=RJmvDkhVHtUezfaQkh8bjWw1fN5cNfuqIvwgGjCacuzbHppvGPiFpPor2AKX4OytfZ HP9Op02uRHcmIidltDE+ndrZhkw4n9ft1haXfOJUEAzp2VtPr1IDuCb9YRyAxzT/s3WD ATYGrCo1M/NJph+gUm5+iyH6a9ufoq/r+B8uPIBXiuG1PRS7bb5g9cJntjREdtgjI2mH r4nxCv4t0BPSzxo1C7trSE+9LX+qKPAmwSqLi7Pyyu+5N3uaVFMs25YcH+i58/s2Vkhk JwNIvo64NAZpYFOp+0wXa5fGvNA7+czUc6owsWK52CYxkifTtsQKQbeAe+yIrumTY7zt TDFw== X-Gm-Message-State: AO0yUKUNZf/jutcU4VjXw6Nn0QtACv4LrYQyWtVkDRsATTXTJ6zaxd53 x7sa5zoL0ZfNdMWJYjF7CRA1Aew7euh0KS0i X-Received: by 2002:a05:600c:3513:b0:3df:b5ae:5289 with SMTP id h19-20020a05600c351300b003dfb5ae5289mr6773942wmq.8.1675434587760; Fri, 03 Feb 2023 06:29:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/33] target/arm: Mark up sysregs for HFGRTR bits 24..35 Date: Fri, 3 Feb 2023 14:29:16 +0000 Message-Id: <20230203142927.834793-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the registers trapped by HFGRTR/HFGWTR bits 24..35. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-13-peter.maydell@linaro.org Message-id: 20230127175507.2895013-13-peter.maydell@linaro.org --- target/arm/cpregs.h | 12 ++++++++++++ target/arm/helper.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 67d87ae8bf5..1b219242d5d 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -603,6 +603,18 @@ typedef enum FGTBit { DO_BIT(HFGRTR, LORID_EL1), DO_BIT(HFGRTR, LORN_EL1), DO_BIT(HFGRTR, LORSA_EL1), + DO_BIT(HFGRTR, MAIR_EL1), + DO_BIT(HFGRTR, MIDR_EL1), + DO_BIT(HFGRTR, MPIDR_EL1), + DO_BIT(HFGRTR, PAR_EL1), + DO_BIT(HFGRTR, REVIDR_EL1), + DO_BIT(HFGRTR, SCTLR_EL1), + DO_BIT(HFGRTR, SCXTNUM_EL1), + DO_BIT(HFGRTR, SCXTNUM_EL0), + DO_BIT(HFGRTR, TCR_EL1), + DO_BIT(HFGRTR, TPIDR_EL1), + DO_BIT(HFGRTR, TPIDRRO_EL0), + DO_BIT(HFGRTR, TPIDR_EL0), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index c059935d0e6..9f6d9e2a3c9 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2206,6 +2206,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_MAIR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), .resetvalue = 0 }, { .name = "MAIR_EL3", .state = ARM_CP_STATE_AA64, @@ -2349,25 +2350,30 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { { .name = "TPIDR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 2, .crn = 13, .crm = 0, .access = PL0_RW, + .fgt = FGT_TPIDR_EL0, .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[0]), .resetvalue = 0 }, { .name = "TPIDRURW", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 2, .access = PL0_RW, + .fgt = FGT_TPIDR_EL0, .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrurw_s), offsetoflow32(CPUARMState, cp15.tpidrurw_ns) }, .resetfn = arm_cp_reset_ignore }, { .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0, .access = PL0_R | PL1_W, + .fgt = FGT_TPIDRRO_EL0, .fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el[0]), .resetvalue = 0}, { .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3, .access = PL0_R | PL1_W, + .fgt = FGT_TPIDRRO_EL0, .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s), offsetoflow32(CPUARMState, cp15.tpidruro_ns) }, .resetfn = arm_cp_reset_ignore }, { .name = "TPIDR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .opc2 = 4, .crn = 13, .crm = 0, .access = PL1_RW, + .fgt = FGT_TPIDR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[1]), .resetvalue = 0 }, { .name = "TPIDRPRW", .opc1 = 0, .cp = 15, .crn = 13, .crm = 0, .opc2 = 4, .access = PL1_RW, @@ -4164,6 +4170,7 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 2, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_TCR_EL1, .writefn = vmsa_tcr_el12_write, .raw_writefn = raw_write, .resetvalue = 0, @@ -5399,6 +5406,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .type = ARM_CP_ALIAS, .opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0, .access = PL1_RW, .resetvalue = 0, + .fgt = FGT_PAR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.par_el[1]), .writefn = par_write }, #endif @@ -7562,10 +7570,12 @@ static const ARMCPRegInfo scxtnum_reginfo[] = { { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7, .access = PL0_RW, .accessfn = access_scxtnum, + .fgt = FGT_SCXTNUM_EL0, .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) }, { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7, .access = PL1_RW, .accessfn = access_scxtnum, + .fgt = FGT_SCXTNUM_EL1, .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) }, { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7, @@ -8604,6 +8614,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "MIDR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 0, .access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, + .fgt = FGT_MIDR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), .readfn = midr_read }, /* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */ @@ -8614,6 +8625,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 6, .access = PL1_R, .accessfn = access_aa64_tid1, + .fgt = FGT_REVIDR_EL1, .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, }; ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { @@ -8785,6 +8797,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) ARMCPRegInfo mpidr_cp_reginfo[] = { { .name = "MPIDR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 5, + .fgt = FGT_MPIDR_EL1, .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, }; #ifdef CONFIG_USER_ONLY @@ -8884,6 +8897,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .name = "SCTLR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_SCTLR_EL1, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.sctlr_s), offsetof(CPUARMState, cp15.sctlr_ns) }, .writefn = sctlr_write, .resetvalue = cpu->reset_sctlr, From patchwork Fri Feb 3 14:29:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650045 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849823pva; Fri, 3 Feb 2023 06:31:26 -0800 (PST) X-Google-Smtp-Source: AK7set8BwFo/pgde78vys/2yrdEtMyWo/VmkhQcJSvb1XDRfF04fhjn1wFID+ihYv2f72pDUzo36 X-Received: by 2002:a05:6102:5126:b0:3fc:e612:5e59 with SMTP id bm38-20020a056102512600b003fce6125e59mr7694277vsb.1.1675434686203; Fri, 03 Feb 2023 06:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434686; cv=none; d=google.com; s=arc-20160816; b=f5yrb5ox80TOqgeZRKzDyFOfvT3VyeQnYSzAphdf8IBTK3/xejA9cnhE7fXYieIOJS nUGuGMJ7Xrim/0kZMfXbWrtmxaXS2gICB09XxGnAPUaZcSAVmDk+gU/qwJuhxgl0LOMN Yuv/sJJ0aQ1Ukf6sKP6hoPe9llnOI2bQWHjXtpA5/Io19qjWYEYPuwm0OrKNy5Xq8nsD qyBcgvVYkdMmIcLzQ1g9Sd6bC0nb5RggyxdD0XAHQbSCn7rFS65rNIJn1UGKb0dCETqG gIWT4Q5AwM1Di7Qap7QrmZXQqylpLbxeAXQpboCpo8QY2hdWBzyKyxhNRrN+pxamZ2pV 6pHg== 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=0VoPlZhHUdfCku+qw/NzX2OrIbw7jq7vrZk3olaLM5Q=; b=rCLPtn82khyVRFX9gw3w6aWf6+2olJg8MyJ4/NpXPHUW+Ne5IiAFUJHIdXXyMg8kp6 yHHwQ/jeggRsnC70hzwvrwxUz+FFKPhnwa/hvz0YPKdJsegD1Cu2YcjXGfOgxJNyt5w1 cIBiqLAAxpgQ/MJYyZyxv9QMP/1E7CoGzkdZkFWV16lhSOkfEZkxz7ikjtBq9CdtjRP9 Uova2FFySJ1EMPCtsHDv7FvlunG6j8R69V2GsFwj+Pn9K9qFteMzmLb9m81fIlvA4DX3 2XUN0Dta2vku1pLOT0LIbVmhn/hL7HLwJoE+xeLvVCPT2AsN2T73zxalfTxo8xLM9iWt zw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ymnWa+5x; 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 d14-20020a056102040e00b003faa6a13cdesi696379vsq.407.2023.02.03.06.31.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:26 -0800 (PST) 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=ymnWa+5x; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5K-0007mZ-Aa; Fri, 03 Feb 2023 09:30:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006jU-L8 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4Y-00057V-CN for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso3985559wms.4 for ; Fri, 03 Feb 2023 06:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0VoPlZhHUdfCku+qw/NzX2OrIbw7jq7vrZk3olaLM5Q=; b=ymnWa+5xocLrBnXKaVQcoVpW4/fShfrO4U9YRxRNaCq97lXhjc0wBuinAP7qhwxHiN eR/ziqrG7PvDr6ayBijVgSAxdhury9hoHg3a1pUhwP7jLjV3nn3wi1jzUBUlpwJoAeay 4Z8Hwm9N/YljlgtMX3yxSc5XTSyezRdV0dAAxRVzoc8HPEkLMyP6uhMBxBPtxd3eL4ee sxzR5biJtnY/dmrRwJDxJgCUTuKXk8HV+5//jRVD7QQZ2kwQ7JsR7irsbEAteCYFtCXK yda5liy0RkW3L+8qV5jDPehCCyamAcqbzRzjTqCt4vLwWnYnOs8cOWc7q81QnjRhtAUG rhVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0VoPlZhHUdfCku+qw/NzX2OrIbw7jq7vrZk3olaLM5Q=; b=R8+7SUOD8q7O1j1HBPvMSpFL0TuxJYD3E9tIfCr8BmRajAVST8JNrjP2P6CmSCIa41 KTpaSMDJDD1y3RzWKlOrLVsvAW4+oCh+3MRg18caJmqy8Bp1BQxl03hHgVD/YH2nnYlr Fi9Aupc/oHuWpC1hqEGmzJcDY/0wqzAH559kPOK/U4I5XxJnyz03rNmVSqKdu8eOT+pv IU7KInu/ROM1apdgISibj/Y5tH/mhHDpN224uTXGZ2FkxNgGuXdTL9XEUsWJh6vgWO+w Zn9p7Gh5p1bVrcTxxwcR8TCeGz1Mzj8USFjRCyfIxrpjkTn2vPeggj2dZB+JVqm5lwmN 2PCg== X-Gm-Message-State: AO0yUKU/XFuwTT6S4pRmjNhsygebhGj5TA28gBPHndgoeEFsaTkC4Br+ ZQN0m6HuRQw/2p+uU6jOmxN7CHqXm1vSHei1 X-Received: by 2002:a05:600c:474f:b0:3df:e57d:f4d0 with SMTP id w15-20020a05600c474f00b003dfe57df4d0mr2941024wmo.26.1675434588601; Fri, 03 Feb 2023 06:29:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/33] target/arm: Mark up sysregs for HFGRTR bits 36..63 Date: Fri, 3 Feb 2023 14:29:17 +0000 Message-Id: <20230203142927.834793-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the registers trapped by HFGRTR/HFGWTR bits 36..63. Of these, some correspond to RAS registers which we implement as always-UNDEF: these don't need any extra handling for FGT because the UNDEF-to-EL1 always takes priority over any theoretical FGT-trap-to-EL2. Bit 50 (NACCDATA_EL1) is for the ACCDATA_EL1 register which is part of the FEAT_LS64_ACCDATA feature which we don't yet implement. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-14-peter.maydell@linaro.org Message-id: 20230127175507.2895013-14-peter.maydell@linaro.org --- target/arm/cpregs.h | 7 +++++++ hw/intc/arm_gicv3_cpuif.c | 2 ++ target/arm/helper.c | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 1b219242d5d..fef8ad08acc 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -615,6 +615,13 @@ typedef enum FGTBit { DO_BIT(HFGRTR, TPIDR_EL1), DO_BIT(HFGRTR, TPIDRRO_EL0), DO_BIT(HFGRTR, TPIDR_EL0), + DO_BIT(HFGRTR, TTBR0_EL1), + DO_BIT(HFGRTR, TTBR1_EL1), + DO_BIT(HFGRTR, VBAR_EL1), + DO_BIT(HFGRTR, ICC_IGRPENN_EL1), + DO_BIT(HFGRTR, ERRIDR_EL1), + DO_REV_BIT(HFGRTR, NSMPRI_EL1), + DO_REV_BIT(HFGRTR, NTPIDR2_EL0), } FGTBit; #undef DO_BIT diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 9a7fc190994..d07b13eb270 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -2378,6 +2378,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 6, .type = ARM_CP_IO | ARM_CP_NO_RAW, .access = PL1_RW, .accessfn = gicv3_fiq_access, + .fgt = FGT_ICC_IGRPENN_EL1, .readfn = icc_igrpen_read, .writefn = icc_igrpen_write, }, @@ -2386,6 +2387,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 7, .type = ARM_CP_IO | ARM_CP_NO_RAW, .access = PL1_RW, .accessfn = gicv3_irq_access, + .fgt = FGT_ICC_IGRPENN_EL1, .readfn = icc_igrpen_read, .writefn = icc_igrpen_write, }, diff --git a/target/arm/helper.c b/target/arm/helper.c index 9f6d9e2a3c9..a48b022def6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4158,12 +4158,14 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_TTBR0_EL1, .writefn = vmsa_ttbr_write, .resetvalue = 0, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), offsetof(CPUARMState, cp15.ttbr0_ns) } }, { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, + .fgt = FGT_TTBR1_EL1, .writefn = vmsa_ttbr_write, .resetvalue = 0, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), offsetof(CPUARMState, cp15.ttbr1_ns) } }, @@ -6488,6 +6490,10 @@ static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val) * ERRSELR_EL1 * may generate UNDEFINED, which is the effect we get by not * listing them at all. + * + * These registers have fine-grained trap bits, but UNDEF-to-EL1 + * is higher priority than FGT-to-EL2 so we do not need to list them + * in order to check for an FGT. */ static const ARMCPRegInfo minimal_ras_reginfo[] = { { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH, @@ -6497,6 +6503,7 @@ static const ARMCPRegInfo minimal_ras_reginfo[] = { { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0, .access = PL1_R, .accessfn = access_terr, + .fgt = FGT_ERRIDR_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1, @@ -6819,6 +6826,7 @@ 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, + .fgt = FGT_NTPIDR2_EL0, .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, { .name = "SVCR", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 2, @@ -6856,6 +6864,7 @@ static const ARMCPRegInfo sme_reginfo[] = { { .name = "SMPRI_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 4, .access = PL1_RW, .accessfn = access_esm, + .fgt = FGT_NSMPRI_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "SMPRIMAP_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 5, @@ -8884,6 +8893,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "VBAR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .writefn = vbar_write, + .fgt = FGT_VBAR_EL1, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), offsetof(CPUARMState, cp15.vbar_ns) }, .resetvalue = 0 }, From patchwork Fri Feb 3 14:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650049 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850366pva; Fri, 3 Feb 2023 06:32:16 -0800 (PST) X-Google-Smtp-Source: AK7set8thHRzZx2M28hnyDI05X6XjId4fOIdwq2R2iI5CZOpSHZpak6rKFqza3xeaq4jJVuGR9x9 X-Received: by 2002:a05:622a:190e:b0:3a5:24ac:a175 with SMTP id w14-20020a05622a190e00b003a524aca175mr18677391qtc.56.1675434735909; Fri, 03 Feb 2023 06:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434735; cv=none; d=google.com; s=arc-20160816; b=DTwuIeM6i0s641Y+r7sV726o4K2LawL9a2I1CMH5FIVaRjwe3lQDFxvV37KC95Os7q nx9TqazcSDoVQx3Wdo7t63zTAM4r6ocXswwe5SRwjRYs5iZxuzT/1P+Gobcay21MfK9f NWaPiI5SNsCWLx6ve2khiONLxehkA9UEzXW0xIx3ZpI3dKnLUMcgQzeXmXTZ1kjYTaDW vZY4cnnuNpYf8CciUQvhU1EywYuCPbVjqyC2dKaMkRHfS4V5E65sL2q9s1vj32m+9d6c TJnUIDB1kdXo+wd9PkRZsq9yDCACIWeQWdgzEIkZL/MTS/kcrmatq7eSxft6BmpNcPsc iS/Q== 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=BhearbGMg07ixmxcVta7913JfgZva0wWKZfBDKaes20=; b=VG4811QPVCYVU0/LcI1La3yTCHiEY/AXf2uDCEFh9gcopUUjkSJW7DIYOTCf6gkSJD aPaJN55oRi+HdCG8Hm2Q3e61AhbVWPZAQkThrFyRGGr0ev1U/JW9VjE7PA6UlzsUHwUu o4iT8Zu20kwEdrX1Q43xDrvrHM0doLBl335s912chYdVcd4QlBNlDgny0bnylgyMcZbV O6/fmW4blok6P+7FG8xCmLSH1KAjzxybKk2V0KouVXk5LEdjrIetAPc8e7lYOUjFVIbo UgOYFSKeM7SimaZBJVJykLP9aJVJhoGhiMgWNmcUrFesqSRYM3QAZJrZBgdU+kOCA+y/ PilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p7NvEgSo; 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 d14-20020ac85ace000000b003b8509b59bbsi1938514qtd.354.2023.02.03.06.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:32:15 -0800 (PST) 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=p7NvEgSo; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5R-00085Y-A8; Fri, 03 Feb 2023 09:30:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006lB-Qc for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:56 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4a-00057e-85 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: by mail-wm1-x32a.google.com with SMTP id u10so953230wmj.3 for ; Fri, 03 Feb 2023 06:29:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BhearbGMg07ixmxcVta7913JfgZva0wWKZfBDKaes20=; b=p7NvEgSosXD4LYrwXJ4g74fQ+yZQPaezsBGjT2jGQNfO2d35npqIJ5Uu8KKwRSpXIC fsSedcPm4NT0bdd+h9OaXUoHGRN3gS4mLNvwawhpHHy2yVMEL88NKbEZs5EZi5dF/l6L /403ZexQ4/gZ9FssTW+djsXO2PdWsrAcj/92eoCCNqvPXWihyRG+m4CMDY3zQSiEulaE 42EDysb4MGQBjsqIZE7/zWWx4Gklb52iZyYOwtIjQRi6uIxfiqs73fEfyzF4lNKBR/na DN+z7ue5zmhNGqjH1vGhQHQmCQDFSXmI7lnYau1hFVpTB5lBCmvMO9mql5wxQtvkdVaT zAJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BhearbGMg07ixmxcVta7913JfgZva0wWKZfBDKaes20=; b=KFldb80Tu3kEsrjY8kS/07sBlWu6IsryeSuz3X4zG17vk6G1SpKJAv7gA20LvjbPkm wuOsNeNfyR0oSxYLoq9pkWQaG7ZGaU1xxzJN+StUX3WccTjfof/5JobgZZFCQoJbSk4M IXUXVNc2qGunCMhsiGNSDN8P18QePDckyDoxsc5WUKUxX3O42L69klwKVKF6nOCk7D9o rRzf1E9ShzATRO/CRGOpxAjyaXsqaYbRv8NNmUTse0AHzC2XzufJVoENVzULYWA6EnZw sOa7v5BybaayLN/JvtCqmv3rpm4/79UFqIlh7U0iJnXmkFlwawCVlJqWmvAzq266NTyt E/fg== X-Gm-Message-State: AO0yUKU+YknsSD77SFviGn/OY02603hao1172937ifj2LVyqNIaCDkFj TF2wAMGa8XMYM/AksIssRGSMhQ/Z24DszORE X-Received: by 2002:a05:600c:1c81:b0:3dc:5987:fe9 with SMTP id k1-20020a05600c1c8100b003dc59870fe9mr10183749wms.2.1675434589544; Fri, 03 Feb 2023 06:29:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/33] target/arm: Mark up sysregs for HDFGRTR bits 0..11 Date: Fri, 3 Feb 2023 14:29:18 +0000 Message-Id: <20230203142927.834793-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitons for the registers trapped by HDFGRTR/HDFGWTR bits 0..11. These cover various debug related registers. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-15-peter.maydell@linaro.org Message-id: 20230127175507.2895013-15-peter.maydell@linaro.org --- target/arm/cpregs.h | 12 ++++++++++++ target/arm/debug_helper.c | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index fef8ad08acc..7c4d07ed9c6 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -622,6 +622,18 @@ typedef enum FGTBit { DO_BIT(HFGRTR, ERRIDR_EL1), DO_REV_BIT(HFGRTR, NSMPRI_EL1), DO_REV_BIT(HFGRTR, NTPIDR2_EL0), + + /* Trap bits in HDFGRTR_EL2 / HDFGWTR_EL2, starting from bit 0. */ + DO_BIT(HDFGRTR, DBGBCRN_EL1), + DO_BIT(HDFGRTR, DBGBVRN_EL1), + DO_BIT(HDFGRTR, DBGWCRN_EL1), + DO_BIT(HDFGRTR, DBGWVRN_EL1), + DO_BIT(HDFGRTR, MDSCR_EL1), + DO_BIT(HDFGRTR, DBGCLAIM), + DO_BIT(HDFGWTR, OSLAR_EL1), + DO_BIT(HDFGRTR, OSLSR_EL1), + DO_BIT(HDFGRTR, OSECCR_EL1), + DO_BIT(HDFGRTR, OSDLR_EL1), } FGTBit; #undef DO_BIT diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index cced3f168d0..b106746b0e1 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -672,6 +672,7 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { { .name = "MDSCR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_MDSCR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.mdscr_el1), .resetvalue = 0 }, /* @@ -702,6 +703,7 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { { .name = "OSECCR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_OSECCR_EL1, .type = ARM_CP_CONST, .resetvalue = 0 }, /* * DBGDSCRint[15,12,5:2] map to MDSCR_EL1[15,12,5:2]. Map all bits as @@ -717,16 +719,19 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 4, .access = PL1_W, .type = ARM_CP_NO_RAW, .accessfn = access_tdosa, + .fgt = FGT_OSLAR_EL1, .writefn = oslar_write }, { .name = "OSLSR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 4, .access = PL1_R, .resetvalue = 10, .accessfn = access_tdosa, + .fgt = FGT_OSLSR_EL1, .fieldoffset = offsetof(CPUARMState, cp15.oslsr_el1) }, /* Dummy OSDLR_EL1: 32-bit Linux will read this */ { .name = "OSDLR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 4, .access = PL1_RW, .accessfn = access_tdosa, + .fgt = FGT_OSDLR_EL1, .writefn = osdlr_write, .fieldoffset = offsetof(CPUARMState, cp15.osdlr_el1) }, /* @@ -763,10 +768,12 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 6, .type = ARM_CP_ALIAS, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGCLAIM, .writefn = dbgclaimset_write, .readfn = dbgclaimset_read }, { .name = "DBGCLAIMCLR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 6, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGCLAIM, .writefn = dbgclaimclr_write, .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.dbgclaim) }, }; @@ -1127,12 +1134,14 @@ void define_debug_regs(ARMCPU *cpu) { .name = dbgbvr_el1_name, .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 4, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGBVRN_EL1, .fieldoffset = offsetof(CPUARMState, cp15.dbgbvr[i]), .writefn = dbgbvr_write, .raw_writefn = raw_write }, { .name = dbgbcr_el1_name, .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 5, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGBCRN_EL1, .fieldoffset = offsetof(CPUARMState, cp15.dbgbcr[i]), .writefn = dbgbcr_write, .raw_writefn = raw_write }, @@ -1149,12 +1158,14 @@ void define_debug_regs(ARMCPU *cpu) { .name = dbgwvr_el1_name, .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 6, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGWVRN_EL1, .fieldoffset = offsetof(CPUARMState, cp15.dbgwvr[i]), .writefn = dbgwvr_write, .raw_writefn = raw_write }, { .name = dbgwcr_el1_name, .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 7, .access = PL1_RW, .accessfn = access_tda, + .fgt = FGT_DBGWCRN_EL1, .fieldoffset = offsetof(CPUARMState, cp15.dbgwcr[i]), .writefn = dbgwcr_write, .raw_writefn = raw_write }, From patchwork Fri Feb 3 14:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650039 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849441pva; Fri, 3 Feb 2023 06:30:51 -0800 (PST) X-Google-Smtp-Source: AK7set9jLpD/ONRAiJpXsLsCXci/R3Kw2zpe7P3iXYVAhXgIYrEfKbmk7YozezPl44Xt/wYoIimz X-Received: by 2002:a67:72c6:0:b0:3d0:dc9c:e82e with SMTP id n189-20020a6772c6000000b003d0dc9ce82emr6011140vsc.7.1675434651569; Fri, 03 Feb 2023 06:30:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434651; cv=none; d=google.com; s=arc-20160816; b=pun8ansEZ3bqZTDl3O1We9noZ4jYKMxjmfjvFOHsnkJVxPCl+6gcliQgAtWUIjm9/Q oagswgoKB/ErEupiUQWCmjx+ueEDhbXph6puLCO8l4cr2lPTT6pnNKNs8bBe5VVlhKvi bYl+Qa+fsc0ziR1ySDAtglziqdz801m5y2hAPWFAb3XE8TOPJ2PVuNcxu4B7z0WFT1uG rFTaFiei8iWHqZfrFIdJ11gqQ9EHApLeaQvq6TXU1gepv4YcGlw/F6WSXWu1BCduTsah ZYo8cPPD6cM4ULXkVQ9Z5RFgADJwVk6gaiiXg1OMPSAzVE70Ne7OGTdgGNe6vCT0ltuv 1CJw== 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=wbeG3RqWepmqfpgsVO1uBd1T8UYDoP87EdSf0MfbsLw=; b=VqlxD3uHcQBvTLwRR4AKdvr1vAMIzI5B8kZm3ZGPxDhndLiL7EVv3NN7hQSo1ItbD9 BQHjvnko4AewWH+KwiSoEfDAJFOWj+J+tcIQLlefDLHu0/XuWAfuULiSbAdwPCRnF9iM 9PbQODgHF6GjmifJ9I+4fF+vMQjWk4BapcvhXGl7efZu9dlnsHsu/BLb7nKnwMQL5IU4 aDDhmHyj1WoKpbNQYZvoVPbGJ9gQcGrbUKsq3tsVsI7k1Nb/udVU091Fu3fOxPZBrp5b DqXDp8SR4ca4sgKhFN3/cI+WgUU2WH+/7IPowDWYZ7k1XvMUd2K431ksCgRY0mel/aYX 1GRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JiSPmtpu; 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 bt18-20020ab03f12000000b00516391f6ffasi964374uab.64.2023.02.03.06.30.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:30:51 -0800 (PST) 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=JiSPmtpu; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5S-0008GO-Hb; Fri, 03 Feb 2023 09:30:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4f-0006pi-SV for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:57 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4a-00058D-8e for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: by mail-wr1-x430.google.com with SMTP id r27so996461wrr.1 for ; Fri, 03 Feb 2023 06:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wbeG3RqWepmqfpgsVO1uBd1T8UYDoP87EdSf0MfbsLw=; b=JiSPmtpu0/QbG5yWmnQfYg7R8CCCGCSB8HEV/ZT+51UvNinajG9Sv25mZWyCeiG2wN r59lpdTGpqLuqDW1BvUbZXiOfF1kpryUZcdYc2xzXuLq0XG/0UwhbPyDz4dK0NUqnTnu IKbkNz81fjks5sA8Heuc2iOQkloHHE7F/45qBZhBq1Fv+QwyoUsqM/DM0IlHxsY67qpk 2AKuu/iLzqRfJDxJYdLqBWjMmHBYkZ7a0GKEaCRMblxaMjDwwCyv9AFwHa0IqLRocEmV 8nmlZjV3OjN1J9sVvc91RCWChsioxjFJZisHcfvPkf+wnImDlC7JUvWp8tyzZlkZmwhP lyzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wbeG3RqWepmqfpgsVO1uBd1T8UYDoP87EdSf0MfbsLw=; b=kD2BJiIEPWYq6yAM1ITFZzN8BQ45bd/32v27CGsDMszUPwizoEFlihhmeYw4O87iN8 x56fMkfaLlRBTuFRbB8pE2+Uz+sfd0x/RTMLmctlHgDK2vaQPHRokfjQ9fJslnOpLk14 KqIVRWfP8O2fSPL+czn+2DSPc0f77OvLj2LfINEhmnId5FjMzOKfg2tHmvjuQgusIGhI RRLoXFP4u6nqcDqVA7YxAl02urqdvwFdqNxaIsGlXM2/fkf0srE5HKGuMiXE3XBR1Z7E xdk4H0dDjczK0eEoCtOIgXpGgnrc1Qbjz1wmBeES1q730MAO5DNOSN5W3x3q40puiud+ h2Lw== X-Gm-Message-State: AO0yUKV7XnHVnBbwHmIBj2dPemIV+sqtfhAG9x8717tfjTSB/PovcfiX ANYqYgl169m57TBTpCI36WRY0WHsdEIrj0QG X-Received: by 2002:a05:6000:1007:b0:2c1:15b8:9eb7 with SMTP id a7-20020a056000100700b002c115b89eb7mr8348968wrx.59.1675434590353; Fri, 03 Feb 2023 06:29:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/33] target/arm: Mark up sysregs for HDFGRTR bits 12..63 Date: Fri, 3 Feb 2023 14:29:19 +0000 Message-Id: <20230203142927.834793-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the registers trapped by HDFGRTR/HDFGWTR bits 12..x. Bits 12..22 and bit 58 are for PMU registers. The remaining bits in HDFGRTR/HDFGWTR are for traps on registers that are part of features we don't implement: Bits 23..32 and 63 : FEAT_SPE Bits 33..48 : FEAT_ETE Bits 50..56 : FEAT_TRBE Bits 59..61 : FEAT_BRBE Bit 62 : FEAT_SPEv1p2. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-16-peter.maydell@linaro.org Message-id: 20230127175507.2895013-16-peter.maydell@linaro.org --- target/arm/cpregs.h | 12 ++++++++++++ target/arm/helper.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 7c4d07ed9c6..c37e013b8f3 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -634,6 +634,18 @@ typedef enum FGTBit { DO_BIT(HDFGRTR, OSLSR_EL1), DO_BIT(HDFGRTR, OSECCR_EL1), DO_BIT(HDFGRTR, OSDLR_EL1), + DO_BIT(HDFGRTR, PMEVCNTRN_EL0), + DO_BIT(HDFGRTR, PMEVTYPERN_EL0), + DO_BIT(HDFGRTR, PMCCFILTR_EL0), + DO_BIT(HDFGRTR, PMCCNTR_EL0), + DO_BIT(HDFGRTR, PMCNTEN), + DO_BIT(HDFGRTR, PMINTEN), + DO_BIT(HDFGRTR, PMOVS), + DO_BIT(HDFGRTR, PMSELR_EL0), + DO_BIT(HDFGWTR, PMSWINC_EL0), + DO_BIT(HDFGWTR, PMCR_EL0), + DO_BIT(HDFGRTR, PMMIR_EL1), + DO_BIT(HDFGRTR, PMCEIDN_EL0), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index a48b022def6..2e494b8f924 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2035,21 +2035,25 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), .writefn = pmcntenset_write, .accessfn = pmreg_access, + .fgt = FGT_PMCNTEN, .raw_writefn = raw_write }, { .name = "PMCNTENSET_EL0", .state = ARM_CP_STATE_AA64, .type = ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 1, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMCNTEN, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), .resetvalue = 0, .writefn = pmcntenset_write, .raw_writefn = raw_write }, { .name = "PMCNTENCLR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 2, .access = PL0_RW, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), .accessfn = pmreg_access, + .fgt = FGT_PMCNTEN, .writefn = pmcntenclr_write, .type = ARM_CP_ALIAS | ARM_CP_IO }, { .name = "PMCNTENCLR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 2, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMCNTEN, .type = ARM_CP_ALIAS | ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), .writefn = pmcntenclr_write }, @@ -2057,41 +2061,49 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .access = PL0_RW, .type = ARM_CP_IO, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), .accessfn = pmreg_access, + .fgt = FGT_PMOVS, .writefn = pmovsr_write, .raw_writefn = raw_write }, { .name = "PMOVSCLR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 3, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMOVS, .type = ARM_CP_ALIAS | ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), .writefn = pmovsr_write, .raw_writefn = raw_write }, { .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4, .access = PL0_W, .accessfn = pmreg_access_swinc, + .fgt = FGT_PMSWINC_EL0, .type = ARM_CP_NO_RAW | ARM_CP_IO, .writefn = pmswinc_write }, { .name = "PMSWINC_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 4, .access = PL0_W, .accessfn = pmreg_access_swinc, + .fgt = FGT_PMSWINC_EL0, .type = ARM_CP_NO_RAW | ARM_CP_IO, .writefn = pmswinc_write }, { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, .access = PL0_RW, .type = ARM_CP_ALIAS, + .fgt = FGT_PMSELR_EL0, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr), .accessfn = pmreg_access_selr, .writefn = pmselr_write, .raw_writefn = raw_write}, { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5, .access = PL0_RW, .accessfn = pmreg_access_selr, + .fgt = FGT_PMSELR_EL0, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr), .writefn = pmselr_write, .raw_writefn = raw_write, }, { .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0, .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_ALIAS | ARM_CP_IO, + .fgt = FGT_PMCCNTR_EL0, .readfn = pmccntr_read, .writefn = pmccntr_write32, .accessfn = pmreg_access_ccntr }, { .name = "PMCCNTR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 0, .access = PL0_RW, .accessfn = pmreg_access_ccntr, + .fgt = FGT_PMCCNTR_EL0, .type = ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c15_ccnt), .readfn = pmccntr_read, .writefn = pmccntr_write, @@ -2099,32 +2111,38 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .name = "PMCCFILTR", .cp = 15, .opc1 = 0, .crn = 14, .crm = 15, .opc2 = 7, .writefn = pmccfiltr_write_a32, .readfn = pmccfiltr_read_a32, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMCCFILTR_EL0, .type = ARM_CP_ALIAS | ARM_CP_IO, .resetvalue = 0, }, { .name = "PMCCFILTR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 15, .opc2 = 7, .writefn = pmccfiltr_write, .raw_writefn = raw_write, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMCCFILTR_EL0, .type = ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0), .resetvalue = 0, }, { .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1, .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, .accessfn = pmreg_access, + .fgt = FGT_PMEVTYPERN_EL0, .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1, .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, .accessfn = pmreg_access, + .fgt = FGT_PMEVTYPERN_EL0, .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, { .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2, .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, .accessfn = pmreg_access_xevcntr, + .fgt = FGT_PMEVCNTRN_EL0, .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, { .name = "PMXEVCNTR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 2, .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, .accessfn = pmreg_access_xevcntr, + .fgt = FGT_PMEVCNTRN_EL0, .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, { .name = "PMUSERENR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 0, .access = PL0_R | PL1_RW, .accessfn = access_tpm, @@ -2139,6 +2157,7 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .writefn = pmuserenr_write, .raw_writefn = raw_write }, { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tpm, + .fgt = FGT_PMINTEN, .type = ARM_CP_ALIAS | ARM_CP_IO, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), .resetvalue = 0, @@ -2146,18 +2165,21 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, .access = PL1_RW, .accessfn = access_tpm, + .fgt = FGT_PMINTEN, .type = ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), .writefn = pmintenset_write, .raw_writefn = raw_write, .resetvalue = 0x0 }, { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, .access = PL1_RW, .accessfn = access_tpm, + .fgt = FGT_PMINTEN, .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), .writefn = pmintenclr_write, }, { .name = "PMINTENCLR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 2, .access = PL1_RW, .accessfn = access_tpm, + .fgt = FGT_PMINTEN, .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), .writefn = pmintenclr_write }, @@ -2293,6 +2315,7 @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { /* PMOVSSET is not implemented in v7 before v7ve */ { .name = "PMOVSSET", .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 3, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMOVS, .type = ARM_CP_ALIAS | ARM_CP_IO, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), .writefn = pmovsset_write, @@ -2300,6 +2323,7 @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { { .name = "PMOVSSET_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 14, .opc2 = 3, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMOVS, .type = ARM_CP_ALIAS | ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), .writefn = pmovsset_write, @@ -6884,6 +6908,7 @@ static void define_pmu_regs(ARMCPU *cpu) ARMCPRegInfo pmcr = { .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, .access = PL0_RW, + .fgt = FGT_PMCR_EL0, .type = ARM_CP_IO | ARM_CP_ALIAS, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcr), .accessfn = pmreg_access, .writefn = pmcr_write, @@ -6893,6 +6918,7 @@ static void define_pmu_regs(ARMCPU *cpu) .name = "PMCR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 0, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMCR_EL0, .type = ARM_CP_IO, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), .resetvalue = cpu->isar.reset_pmcr_el0, @@ -6910,23 +6936,27 @@ static void define_pmu_regs(ARMCPU *cpu) { .name = pmevcntr_name, .cp = 15, .crn = 14, .crm = 8 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, + .fgt = FGT_PMEVCNTRN_EL0, .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, .accessfn = pmreg_access_xevcntr }, { .name = pmevcntr_el0_name, .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 8 | (3 & (i >> 3)), .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access_xevcntr, .type = ARM_CP_IO, + .fgt = FGT_PMEVCNTRN_EL0, .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, .raw_readfn = pmevcntr_rawread, .raw_writefn = pmevcntr_rawwrite }, { .name = pmevtyper_name, .cp = 15, .crn = 14, .crm = 12 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, + .fgt = FGT_PMEVTYPERN_EL0, .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, .accessfn = pmreg_access }, { .name = pmevtyper_el0_name, .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 12 | (3 & (i >> 3)), .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access, + .fgt = FGT_PMEVTYPERN_EL0, .type = ARM_CP_IO, .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, .raw_writefn = pmevtyper_rawwrite }, @@ -6942,10 +6972,12 @@ static void define_pmu_regs(ARMCPU *cpu) { .name = "PMCEID2", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 4, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = extract64(cpu->pmceid0, 32, 32) }, { .name = "PMCEID3", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 5, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = extract64(cpu->pmceid1, 32, 32) }, }; define_arm_cp_regs(cpu, v81_pmu_regs); @@ -6955,6 +6987,7 @@ static void define_pmu_regs(ARMCPU *cpu) .name = "PMMIR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 6, .access = PL1_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMMIR_EL1, .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &v84_pmmir); @@ -8251,18 +8284,22 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = extract64(cpu->pmceid0, 0, 32) }, { .name = "PMCEID0_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 6, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = cpu->pmceid0 }, { .name = "PMCEID1", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 7, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = extract64(cpu->pmceid1, 0, 32) }, { .name = "PMCEID1_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 7, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, + .fgt = FGT_PMCEIDN_EL0, .resetvalue = cpu->pmceid1 }, }; #ifdef CONFIG_USER_ONLY From patchwork Fri Feb 3 14:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650051 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850611pva; Fri, 3 Feb 2023 06:32:40 -0800 (PST) X-Google-Smtp-Source: AK7set/MEcHWojbeHQ/in4m5Sb0IawdH2nwhbmnyNAO6lktnYq+0PWqWmg7wqyMMYb/D9K3qnVkz X-Received: by 2002:a05:622a:1445:b0:3b8:4b00:575e with SMTP id v5-20020a05622a144500b003b84b00575emr19947410qtx.35.1675434760532; Fri, 03 Feb 2023 06:32:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434760; cv=none; d=google.com; s=arc-20160816; b=qoSEKe4Y6M0g/A1UMQ9kH2fpkoKpJu2oJUdmcOwSDVJmd07691iJclrAS13lu96R4V NdMrUwXLihUnI66wJe8e60z3z84OKXeAyuTN1zae0DASwtlDocKBk9LWrg9Mw7HjHf1B g+lzKbjlD2zn+SYrzHx5+0Q7fhQOU3qf9NmPpjxZsYoLTOC0fKQQ4bFC++0gnbBNeBID 3C+RHzmZz//yPRNppZsryh/iXh93moW8d5VQeFO9mtdKP+gpSuJyft0Qrjsefx2fuqjv jgy2sxsXLEQY1/KBilQy/ntwdX02haihX2ICSqSqm+Ia9ZlS+XVoDqK3yRk6O4AZwT8d y68A== 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=0kuEeOGJXchZ8ADATn7eDSLjUofIRhTU/h1wg7+RQIY=; b=ScioBw57K0ts5pmwAKLIjQWPo9PB5nVrlK5CixFHMNtBuP3kDPrLBhAJrhP7zMcVkJ 2y/c2ZnTj87kjEFFvdWJOGwMtSUWXLZQg47um9M9W3tAz6QsQO5RHIdbTx+2qSK1cYkA xKZkwWQuUnEGmw1Z4tBH2lngzCCzDwwnKxlvBZn4BU894Lk7BnsW2t84O9AiShCbhqhC zOQdRauFsa8yF/Acg0XNl94mHw9frA6/LqrNQaUXNdbTJGVQu7/74hT24hMDC7QLRExu PNilpmEpHBnTuPeJG+35keIObjdwNK7zFlV/sFphTJ6ySTbC/PVewf652d3tz9aTMww3 /JSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uwSrQabT; 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 n10-20020a05620a294a00b007023e988bdcsi2667018qkp.1.2023.02.03.06.32.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:32:40 -0800 (PST) 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=uwSrQabT; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5S-0008Bz-11; Fri, 03 Feb 2023 09:30:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006lY-U3 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:56 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4a-00058J-I2 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: by mail-wm1-x330.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso3975972wmq.5 for ; Fri, 03 Feb 2023 06:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0kuEeOGJXchZ8ADATn7eDSLjUofIRhTU/h1wg7+RQIY=; b=uwSrQabT/LxCgMKW7qSGI5DDQYZUCu7c9EQJHE8DH0cOfVec8vUofCtNKUWpydBNkG UIldJPeTIAcQKnfZPfZZiciGFh1pEyJmV+NZL1MlB3mnSQ0rZrNnJkpv1Ojq7q4ePhGN wkS/kRuhX0nNXq+qakoopBiTO6J++321UkxgBMgEAGk3bLKn6ePD2JyN85ZdRZncch+V a6Ag1w07X15WqUjGJ0m1U1k0dBfJ6CwkSwMztbeSBb322ZoTZnCI9D55DmVNGrnofl1g UFj5xC5piOwVik4h/FoHAC2Wj91mYFszrWFMYsaqNKdirVzck8buGOhc/Y+iCmEtZKA6 C37g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0kuEeOGJXchZ8ADATn7eDSLjUofIRhTU/h1wg7+RQIY=; b=udHbysjMQej0Kc5dukYZt7+dqM6d569YgYeZjOzvyt2Sv8JXXoFY2yFIRE9u9qNBAG HxV0PYw0FQB8HAyCsKz1AXzxMbUuY8gWwQBDYnhqHDc2rFBF8vJjPFhZy6F1RNFrJ538 RLdhYTji89IeoBkmfwMfBOeobTrF7Z7HMLnpiGZwSkFMMER9PbOT4KZh1UBW9oLLRuZ6 DVRwnxaDZ/g9XHS2BP0AOWT8zcJcHFpAlqgELrO73yLXyGS5Cld7aEGaTgnaZ+K7PNyg f+Kq7zpdeo7BlIXJGrfL8vta4VmPlS8hrJydQhuJFuALAelKfJFX4rZyhUjZb7yENexN elzg== X-Gm-Message-State: AO0yUKXUOda49MxQrRgROd5KuVHf1MAfxMX/fHaatSeZci8Mobni8vPb tILNeEHoSuUIg8HQX4YYviDgPxFe5UO0dZHz X-Received: by 2002:a05:600c:4fc8:b0:3df:e46c:7984 with SMTP id o8-20020a05600c4fc800b003dfe46c7984mr3755728wmq.38.1675434591211; Fri, 03 Feb 2023 06:29:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/33] target/arm: Mark up sysregs for HFGITR bits 0..11 Date: Fri, 3 Feb 2023 14:29:20 +0000 Message-Id: <20230203142927.834793-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 0..11. These bits cover various cache maintenance operations. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-17-peter.maydell@linaro.org Message-id: 20230127175507.2895013-17-peter.maydell@linaro.org --- target/arm/cpregs.h | 14 ++++++++++++++ target/arm/helper.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index c37e013b8f3..6596c2a1233 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -646,6 +646,20 @@ typedef enum FGTBit { DO_BIT(HDFGWTR, PMCR_EL0), DO_BIT(HDFGRTR, PMMIR_EL1), DO_BIT(HDFGRTR, PMCEIDN_EL0), + + /* Trap bits in HFGITR_EL2, starting from bit 0 */ + DO_BIT(HFGITR, ICIALLUIS), + DO_BIT(HFGITR, ICIALLU), + DO_BIT(HFGITR, ICIVAU), + DO_BIT(HFGITR, DCIVAC), + DO_BIT(HFGITR, DCISW), + DO_BIT(HFGITR, DCCSW), + DO_BIT(HFGITR, DCCISW), + DO_BIT(HFGITR, DCCVAU), + DO_BIT(HFGITR, DCCVAP), + DO_BIT(HFGITR, DCCVADP), + DO_BIT(HFGITR, DCCIVAC), + DO_BIT(HFGITR, DCZVA), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 2e494b8f924..51866ba70e9 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5261,6 +5261,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { #ifndef CONFIG_USER_ONLY /* Avoid overhead of an access check that always passes in user-mode */ .accessfn = aa64_zva_access, + .fgt = FGT_DCZVA, #endif }, { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64, @@ -5270,21 +5271,26 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NOP, + .fgt = FGT_ICIALLUIS, .accessfn = access_ticab }, { .name = "IC_IALLU", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NOP, + .fgt = FGT_ICIALLU, .accessfn = access_tocu }, { .name = "IC_IVAU", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NOP, + .fgt = FGT_ICIVAU, .accessfn = access_tocu }, { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, .access = PL1_W, .accessfn = aa64_cacheop_poc_access, + .fgt = FGT_DCIVAC, .type = ARM_CP_NOP }, { .name = "DC_ISW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, + .fgt = FGT_DCISW, .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, @@ -5292,17 +5298,21 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, + .fgt = FGT_DCCSW, .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, { .name = "DC_CVAU", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NOP, + .fgt = FGT_DCCVAU, .accessfn = access_tocu }, { .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NOP, + .fgt = FGT_DCCIVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CISW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, + .fgt = FGT_DCCISW, .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, /* TLBI operations */ { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, @@ -7413,6 +7423,7 @@ static const ARMCPRegInfo dcpop_reg[] = { { .name = "DC_CVAP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, + .fgt = FGT_DCCVAP, .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, }; @@ -7420,6 +7431,7 @@ static const ARMCPRegInfo dcpodp_reg[] = { { .name = "DC_CVADP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, + .fgt = FGT_DCCVADP, .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, }; #endif /*CONFIG_USER_ONLY*/ @@ -7499,28 +7511,36 @@ static const ARMCPRegInfo mte_reginfo[] = { { .name = "DC_IGVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 3, .type = ARM_CP_NOP, .access = PL1_W, + .fgt = FGT_DCIVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_IGSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 4, + .fgt = FGT_DCISW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, { .name = "DC_IGDVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 5, .type = ARM_CP_NOP, .access = PL1_W, + .fgt = FGT_DCIVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_IGDSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 6, + .fgt = FGT_DCISW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, { .name = "DC_CGSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 4, + .fgt = FGT_DCCSW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, { .name = "DC_CGDSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 6, + .fgt = FGT_DCCSW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, { .name = "DC_CIGSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 4, + .fgt = FGT_DCCISW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, { .name = "DC_CIGDSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 6, + .fgt = FGT_DCCISW, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, }; @@ -7542,26 +7562,32 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVAP, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CGDVAP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 5, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVAP, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CGVADP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 3, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVADP, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CGDVADP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 5, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVADP, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CIGVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 3, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCIVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CIGDVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 5, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCIVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_GVA", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 3, @@ -7569,6 +7595,7 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { #ifndef CONFIG_USER_ONLY /* Avoid overhead of an access check that always passes in user-mode */ .accessfn = aa64_zva_access, + .fgt = FGT_DCZVA, #endif }, { .name = "DC_GZVA", .state = ARM_CP_STATE_AA64, @@ -7577,6 +7604,7 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { #ifndef CONFIG_USER_ONLY /* Avoid overhead of an access check that always passes in user-mode */ .accessfn = aa64_zva_access, + .fgt = FGT_DCZVA, #endif }, }; From patchwork Fri Feb 3 14:29:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650046 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849869pva; Fri, 3 Feb 2023 06:31:30 -0800 (PST) X-Google-Smtp-Source: AK7set/51fSK1Fvu8Q/mzJojxefCxZnRXbgGpcPEc9zCFPV+qz2tuy5SG/PvNe8V5cnNtjfUGmZq X-Received: by 2002:a67:8c85:0:b0:401:192c:791d with SMTP id o127-20020a678c85000000b00401192c791dmr4207705vsd.4.1675434689890; Fri, 03 Feb 2023 06:31:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434689; cv=none; d=google.com; s=arc-20160816; b=lVDl5Ogw1CjoR1aSUM44X9SysA3PkFDwMx/ImbJ7eBiO1AAhBtcsGPOC//+qWcdsfT V1FUoY770iiBiQZp52oMkqNmCcTEw7XIiiJCX4icmX2VHwLn4pTsxVoVJfPDXxlBQQMw KzUdn1XF/0OfYGK03qZ3D7zOs19BCrjd7t/LK6zgH3aoeTg/hOhtJRZokexxo+eiZV2v 4KvW1jZ3HS9Ss5eddWLxq9MXYsCdjJrJo80i+Jneahb2MKTvcVeQTgsOOq0hxYaGiziv T8+mGtE1ZEBWCm8F+BbyVRQYqGhOIT8OmJ48kILYqCW6PerWd5cuKGzRCRbdsJ2dMLSn zfmg== 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=l4/0NpXlWNPM4wA8sqHiRSyY2vkB5nRmX1x8NuZEF3A=; b=F/Te0lEgPql8U+AznCHKaW9qasJP+WO+MNEYNYqqzFsO1cWfskj5cL0z+n/g9WfaA8 OC2W9FTRkW8bfpQ6DSix7CsUOsrIyPqjPt+cJukiXOv8mqndxXLIa9CzegnJ8AsAOCDG 5KjgCljuJgTeSdHB8civj1UslFTvq7imttgBgP3Z42mj7VrKcjTSUIiPIRK+Jav2uUys T2cB079CKlfPFI2/FtrA+L1EslYqvNiMmx5ugCBMm2iGeFqK1KUVFiBxn+ABquU00Ra9 Y/QJbJhkfcvzCqA4exNDcuVFamRa+0jBI0dzO8yI+TDdUPMtfSdSU52lLnXsulU40dAq OV1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JyAx3o6U; 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 dc27-20020a056102559b00b003ef9cd7ecabsi825355vsb.600.2023.02.03.06.31.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:29 -0800 (PST) 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=JyAx3o6U; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5P-0007qO-Ua; Fri, 03 Feb 2023 09:30:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4d-0006jT-HB for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4a-000545-Nf for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:55 -0500 Received: by mail-wm1-x32e.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4003019wms.2 for ; Fri, 03 Feb 2023 06:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=l4/0NpXlWNPM4wA8sqHiRSyY2vkB5nRmX1x8NuZEF3A=; b=JyAx3o6U2q/idHo43ZFCrSzVQmrCcWM4fYGUcuxqd+J/k4FVMyXq8UvD62YHwZlksA 5sue6GnON0MM59vG9jqRQ7DsE7Cj0Wl22qSiq7oH+vyzLdrGTEq725CpzALhwuVWevxm c7c4A6tE6HvDAbexinWmDnjRoopWeB0k4j4jQZ6HZ5gCMEUGTGeKpTBiQ2xE3aBjphOK zbM6FhyjJKaGXynAVcIgUU6ikesKAbLMb113zJkEpA7FrMlE/R7E+q67IvzyFLVVGP1s bIE1wMKvABtW7Z4ZhqJPaZGlsoFFzyEAnhU7nDTxybSnw/HkKsgfVx0lmvwF4BC3wVfa t0Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l4/0NpXlWNPM4wA8sqHiRSyY2vkB5nRmX1x8NuZEF3A=; b=TyTHyZSe7ejNryaRwb6u2ybfpkuJzhAB+FqO5xA+WgXpenlVBa0ybCRn+ekWMzQeGD 2avC1PbNjGDVTwMz+6hfgY+qs5/pj8lotSaFI0oVtw1VZcZokWOjQNss5z67dgOqPj2Z HDz35t/yL8MTG/vESvP8hN5bJMxkuU00lCSGAI7uhPMZpUoCKAWAP9AN80l0kiE+c5Aa t+YSmm0wCMNqPak9vyXCNn/oIDZUVEJyDPE5pSGK4R0mngwhJleqy4Ty/98jWOAOKjK1 lvjxEyQ87qE1Oh0ziwwd5zPTvg2JVxZORSpXWvVUrzSCxU5JFE66HUtEtUVZg2DTGpdL 3Q7Q== X-Gm-Message-State: AO0yUKWeUtGYqslHhjTDyxSg9z5AeCDXFA+5bhNfcEvoA6vKOyHmfs2B bNAkHtrXkSkAqswTOnkcS1edOsoAw+mdLUvK X-Received: by 2002:a05:600c:3d1b:b0:3db:fc3:6de4 with SMTP id bh27-20020a05600c3d1b00b003db0fc36de4mr10126056wmb.35.1675434592034; Fri, 03 Feb 2023 06:29:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/33] target/arm: Mark up sysregs for HFGITR bits 12..17 Date: Fri, 3 Feb 2023 14:29:21 +0000 Message-Id: <20230203142927.834793-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 12..17. These bits cover AT address translation instructions. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-18-peter.maydell@linaro.org Message-id: 20230127175507.2895013-18-peter.maydell@linaro.org --- target/arm/cpregs.h | 6 ++++++ target/arm/helper.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 6596c2a1233..1f74308ef5d 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -660,6 +660,12 @@ typedef enum FGTBit { DO_BIT(HFGITR, DCCVADP), DO_BIT(HFGITR, DCCIVAC), DO_BIT(HFGITR, DCZVA), + DO_BIT(HFGITR, ATS1E1R), + DO_BIT(HFGITR, ATS1E1W), + DO_BIT(HFGITR, ATS1E0R), + DO_BIT(HFGITR, ATS1E0W), + DO_BIT(HFGITR, ATS1E1RP), + DO_BIT(HFGITR, ATS1E1WP), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 51866ba70e9..8b9c7fcc3a4 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5400,18 +5400,22 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E1R, .writefn = ats_write64 }, { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E1W, .writefn = ats_write64 }, { .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E0R, .writefn = ats_write64 }, { .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E0W, .writefn = ats_write64 }, { .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4, @@ -7880,10 +7884,12 @@ static const ARMCPRegInfo ats1e1_reginfo[] = { { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E1RP, .writefn = ats_write64 }, { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, + .fgt = FGT_ATS1E1WP, .writefn = ats_write64 }, }; From patchwork Fri Feb 3 14:29:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650057 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp851182pva; Fri, 3 Feb 2023 06:33:37 -0800 (PST) X-Google-Smtp-Source: AK7set+ngDmUgYudB9wx77oPfoPNfJytMzU93sEDGkNy117EfLl3ZU1WUff4k4Y5qQuOCa1ZVqMW X-Received: by 2002:ac8:5b05:0:b0:3b6:3a58:912d with SMTP id m5-20020ac85b05000000b003b63a58912dmr18695105qtw.0.1675434817494; Fri, 03 Feb 2023 06:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434817; cv=none; d=google.com; s=arc-20160816; b=k3nclfAFBmX1nje5xubukRAUEfaN4SB4YTNosWpJCNS26a+06P3UtwwxQwVQxo/LhJ OQhRu+oemhxWRIr29hoU4hkxIcz+KzPdBj+t/anASCVbBXpuB2AOcuM2ZRuGTDnWJJsC kNf0wIfZ+Hg26SOV/KkFQyrrrfTSOKDce/GO14IST676x3DyJ1aofoF4japXN6KUIdVw eDWdsa9GmM47y0N30t9/4JmMzQF0zHrLOEC2bX8e8cCXRWLMPnIgaUYnqR0dgk5VCjcX 4Nr/gsmxRoWb8ic9/ZT9TrkHaE1yo6cAfVHrcmwL+6t0L2bPflJ5X5FdhAXfxZPKr7Qz VbJQ== 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=4Uw8/DYeISr8umhjp5MVaOTabiUrIqChl/nqNJJfyJA=; b=S0/J/+2QAYSaCuCw3fH8OorjcOZv4h7TipEMucMLLx4rhu4zrawYUHcWAUQbYFj6mB m3PnkaPsYvZKYRe3THVR7zrvRRB5SrAelLyvG7g426ZpkKHP7C/vaf3++tZsgaWmaO5w ecMARjBFlkKi9U6x+TpBBUODXe1vbsgMQmVwKhekqahqSPPkEfo6VciTk7JQbzPIZ53q n/K1S4rJk2heABWUPAgfeniQadMexVJJRh4B2c0AphXxHzRH7PJlonM7wO2S+p+fFdTE A3TGLsi2rl7PccrUYbVn5+3o+nFTxfRnJ4bZko72GYsU1udfocAMf6+cjTuV36wq4HCP 9rEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3viyOIt; 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 j9-20020ac84049000000b003b9c000ea1asi1852134qtl.410.2023.02.03.06.33.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:37 -0800 (PST) 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=P3viyOIt; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5R-0008Bf-VO; Fri, 03 Feb 2023 09:30:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4f-0006pb-Q0 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:57 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4b-00054B-Hg for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:57 -0500 Received: by mail-wm1-x330.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4003066wms.2 for ; Fri, 03 Feb 2023 06:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4Uw8/DYeISr8umhjp5MVaOTabiUrIqChl/nqNJJfyJA=; b=P3viyOItoCoLJM2S5ed6Ra84YjFop4hdoiD8mnJ3Ur6juFTUsRFcf1Q11Lduz2XltS Wz9shPrOvQ4YYO221fPRYT5KcmCEbuuK4/uwqxbznd3ev0HtUOqsccHLYTMDo4hlKi75 UpWfpcxpiLKlVVTbPkL2Ix3BCmScWVh1T9Ur4tiN9fiuXc3gJi6Z5c4EP5RkGW4dd+ti T90TuB+XXJnkipvVVlNhCvIzHf3qUOarzMQyttT7PGCz7IfsAVFcYWP1B833b9p6cO7q NkMqV5ScAVN4N0oKM9cX7SBBQcJj5B/87eauF1o/RCOIrsBJksEpnOq/AlRENH8uwjNy sISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Uw8/DYeISr8umhjp5MVaOTabiUrIqChl/nqNJJfyJA=; b=Zxl/Ml/C/LzAx73NM5A2P6PTAU8EcaXWoM1Q10jXexHrV/kwZG0IUzKR0BHMqH7OrS fEIKYtLPC113LvkOLou1HyKkLNuB+s8hZqreliCFF1ClWT+1u647UXd4jVfcNCd/W7ce XS1n8o+6dekWAuXN9h8kIWAuUvyU4zXpdXEPZUPJZI5zHWA09tNU2yqmGtnfZKyjGbBo XFDSHIo07NiSEQSZ7zHYtDDkT40JCCvKeS+Wv42Ok4MskL0I/uilbY1zR5qmpMbmHT8X c6f8jCF6W4b2mfQQPdrpAeW69cfF5Darw/MJiSoTCvNwN6KSz563Ojap0RZKXWfDZqED RvQg== X-Gm-Message-State: AO0yUKWXJsKB8ZPYkkYnNq27RN2mE3yMk91M9IEAsGRFIbPoQ406bafF CJpwIMWYqE25dwJ1zLdMHPu40Xji/Qsa2pDa X-Received: by 2002:a05:600c:154a:b0:3dc:3398:cf87 with SMTP id f10-20020a05600c154a00b003dc3398cf87mr10207759wmg.11.1675434592847; Fri, 03 Feb 2023 06:29:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/33] target/arm: Mark up sysregs for HFGITR bits 18..47 Date: Fri, 3 Feb 2023 14:29:22 +0000 Message-Id: <20230203142927.834793-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 18..47. These bits cover TLBI TLB maintenance instructions. (If we implemented FEAT_XS we would need to trap some of the instructions added by that feature using these bits; but we don't yet, so will need to add the .fgt markup when we do.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-19-peter.maydell@linaro.org Message-id: 20230127175507.2895013-19-peter.maydell@linaro.org --- target/arm/cpregs.h | 30 ++++++++++++++++++++++++++++++ target/arm/helper.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 1f74308ef5d..2e5ac6b4f98 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -666,6 +666,36 @@ typedef enum FGTBit { DO_BIT(HFGITR, ATS1E0W), DO_BIT(HFGITR, ATS1E1RP), DO_BIT(HFGITR, ATS1E1WP), + DO_BIT(HFGITR, TLBIVMALLE1OS), + DO_BIT(HFGITR, TLBIVAE1OS), + DO_BIT(HFGITR, TLBIASIDE1OS), + DO_BIT(HFGITR, TLBIVAAE1OS), + DO_BIT(HFGITR, TLBIVALE1OS), + DO_BIT(HFGITR, TLBIVAALE1OS), + DO_BIT(HFGITR, TLBIRVAE1OS), + DO_BIT(HFGITR, TLBIRVAAE1OS), + DO_BIT(HFGITR, TLBIRVALE1OS), + DO_BIT(HFGITR, TLBIRVAALE1OS), + DO_BIT(HFGITR, TLBIVMALLE1IS), + DO_BIT(HFGITR, TLBIVAE1IS), + DO_BIT(HFGITR, TLBIASIDE1IS), + DO_BIT(HFGITR, TLBIVAAE1IS), + DO_BIT(HFGITR, TLBIVALE1IS), + DO_BIT(HFGITR, TLBIVAALE1IS), + DO_BIT(HFGITR, TLBIRVAE1IS), + DO_BIT(HFGITR, TLBIRVAAE1IS), + DO_BIT(HFGITR, TLBIRVALE1IS), + DO_BIT(HFGITR, TLBIRVAALE1IS), + DO_BIT(HFGITR, TLBIRVAE1), + DO_BIT(HFGITR, TLBIRVAAE1), + DO_BIT(HFGITR, TLBIRVALE1), + DO_BIT(HFGITR, TLBIRVAALE1), + DO_BIT(HFGITR, TLBIVMALLE1), + DO_BIT(HFGITR, TLBIVAE1), + DO_BIT(HFGITR, TLBIASIDE1), + DO_BIT(HFGITR, TLBIVAAE1), + DO_BIT(HFGITR, TLBIVALE1), + DO_BIT(HFGITR, TLBIVAALE1), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 8b9c7fcc3a4..5b9cc087e28 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5318,50 +5318,62 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVMALLE1IS, .writefn = tlbi_aa64_vmalle1is_write }, { .name = "TLBI_VAE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAE1IS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_ASIDE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIASIDE1IS, .writefn = tlbi_aa64_vmalle1is_write }, { .name = "TLBI_VAAE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAAE1IS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_VALE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVALE1IS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_VAALE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAALE1IS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_VMALLE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVMALLE1, .writefn = tlbi_aa64_vmalle1_write }, { .name = "TLBI_VAE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 1, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAE1, .writefn = tlbi_aa64_vae1_write }, { .name = "TLBI_ASIDE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 2, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIASIDE1, .writefn = tlbi_aa64_vmalle1_write }, { .name = "TLBI_VAAE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAAE1, .writefn = tlbi_aa64_vae1_write }, { .name = "TLBI_VALE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVALE1, .writefn = tlbi_aa64_vae1_write }, { .name = "TLBI_VAALE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAALE1, .writefn = tlbi_aa64_vae1_write }, { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, @@ -7175,50 +7187,62 @@ static const ARMCPRegInfo tlbirange_reginfo[] = { { .name = "TLBI_RVAE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 1, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAE1IS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAAE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAAE1IS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVALE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVALE1IS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAALE1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAALE1IS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAE1OS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAAE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAAE1OS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVALE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVALE1OS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAALE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAALE1OS, .writefn = tlbi_aa64_rvae1is_write }, { .name = "TLBI_RVAE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 1, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAE1, .writefn = tlbi_aa64_rvae1_write }, { .name = "TLBI_RVAAE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAAE1, .writefn = tlbi_aa64_rvae1_write }, { .name = "TLBI_RVALE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVALE1, .writefn = tlbi_aa64_rvae1_write }, { .name = "TLBI_RVAALE1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIRVAALE1, .writefn = tlbi_aa64_rvae1_write }, { .name = "TLBI_RIPAS2E1IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 2, @@ -7290,26 +7314,32 @@ static const ARMCPRegInfo tlbios_reginfo[] = { { .name = "TLBI_VMALLE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 0, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVMALLE1OS, .writefn = tlbi_aa64_vmalle1is_write }, { .name = "TLBI_VAE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 1, + .fgt = FGT_TLBIVAE1OS, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_ASIDE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 2, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIASIDE1OS, .writefn = tlbi_aa64_vmalle1is_write }, { .name = "TLBI_VAAE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 3, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAAE1OS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_VALE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 5, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVALE1OS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_VAALE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 7, .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, + .fgt = FGT_TLBIVAALE1OS, .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0, From patchwork Fri Feb 3 14:29:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650041 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp849562pva; Fri, 3 Feb 2023 06:31:01 -0800 (PST) X-Google-Smtp-Source: AK7set8XzLgwpGSCJAlUyZcJxHssoO/0C+X/jEui9K5Ul/r1SuHgvYPju88zEjBBqEcnvh5zsNaD X-Received: by 2002:a05:6102:32c3:b0:3d0:c826:599 with SMTP id o3-20020a05610232c300b003d0c8260599mr7677898vss.11.1675434660889; Fri, 03 Feb 2023 06:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434660; cv=none; d=google.com; s=arc-20160816; b=z+Fkr48DLvf0TLehVnK0u+C+XgOu6vO4BXWcwTmNGW0FFbbrByyLeX9kScQAKeHAea wT9+hAiyYNu86AadwYOyGWcTTJYBNnZ3HXwUENm6fdphbYpHZSAX7/8RtMsXtsDfZD0f uL2KfMFOXy67oBkF0dH1u8fKR11AAx9YruEo7elW0oYeK3ZVX91UFA10QxFP1hS9zV1H JSVwOJhsePWswm9pLAzbjlN1iohSzRB+qr1QHckke7NTRtHwm0nslwtd0Muxx5JAyhhA +aONEp2Ow667f7smcI09ojNj3fjL2L5IAYvsDp/urpLJE2X2HRWJxu0aBWGorEzuHEc2 ZrWw== 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=K2xxnob3/roFGLD087p6MyGRfXODxkAp5LJkBKCgYJQ=; b=W2D6Rc1nZRB36CXWgJeCJxUCrpQ6zmCS5TsYtgEzRjDOVahnALd5z9Xr3796Gu4k4j PdcebGlpZPFpa7Y9BP0Huf2VSS51bpMDmN10KvUVy5DhL2WosnCIQ9naGBpSlcchPnOn dF643XbZ/3KVF48jnscxQeL7ytI2bKfU/gxkBHgTLKSlbGJDyX8q5a4mIsoYDpXKW1Fh EXRgReeJzpvGeHT6NSrdq4YSaE4V+RQgBs3AKp/KU40Y3DFzJb+JOzxSOV8I+JfcQo3N e7TATGtFDjb1bOnwwKwNCqm0emTafU1nMSsusUXO1CZKmbDXpQ44e5q5dXWVJlx6ZcAb uKog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PisbtmTP; 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 h23-20020a67f897000000b003f13e599481si737940vso.88.2023.02.03.06.31.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:31:00 -0800 (PST) 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=PisbtmTP; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5T-0008Mc-BU; Fri, 03 Feb 2023 09:30:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4f-0006pf-RW for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:57 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4d-000592-3N for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:56 -0500 Received: by mail-wm1-x335.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4003100wms.2 for ; Fri, 03 Feb 2023 06:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=K2xxnob3/roFGLD087p6MyGRfXODxkAp5LJkBKCgYJQ=; b=PisbtmTPlprY7uJgKO9dr130HwaV6I0k/581DvL/Ur1rRt1o9kX0WtKcKRfLAiO9dB uz+lDZtKar+gY/3EI8nmSVEg/mTvcOWTS0My/OMBsOhV5wwA2gKHsUBdPuwbLPqBwV1T mOybnQZwg+ZKNLK3pDud/yJHjw5WAiVBVvU4+NpyZBXEA/GHKM7bU/7JmlQcDhXr1Dsp 9pdS/fjYfr/9wxyAwBAVLu4ppPSPluAK8KJvgHtJg6M72j5+jQNpAZqj85bJzw6Na1Ua uSzodVHKnEMqfNWKiuK/TTTtFgX+NcrlH8YuXTpJswZiSIRB82FdYTqvOKo2UgJIzcTT o6Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K2xxnob3/roFGLD087p6MyGRfXODxkAp5LJkBKCgYJQ=; b=qsvlPlzjAL/BJKFwnJjsWqRdpUW1ZiVYSHZYXUIeA2YbSdmq+Xcc2jNL7W0+eQxDWY 1OWB3TqMAdf+ejY6+H39rGQTTvvzqGc09tIj8khfy6PpLBM4i0rC7jxoL1T7r19TGbpD 2KqPaCDeA3oMAXuaK1/Dpzyweo78na3swYlPWfqEm9R38GKxoxyfRIoT52Jul3bQmP2m Lr+dqfAAFs0CTFkQa03uDXIoE3WcYEKqnfYSZFRsk4eadQisdO1lt8PyaG+je1nG8OyN 6Q0xTQtnYUGMVN+71fPBq/OUpJrf4Xn5jSYsTgnCXOtmUfszuz4FtxkgioBXVSiAC9Sg kCGA== X-Gm-Message-State: AO0yUKWDbkEQHv7h7bL4eMMJOKAFGTqPeQPf3/8QjhDBJ0NnkT82L5AL sLk3BCjwahOUIN7N2KDN3L0Gn3vQt5tuOgos X-Received: by 2002:a05:600c:4e4e:b0:3dd:e621:d328 with SMTP id e14-20020a05600c4e4e00b003dde621d328mr12317510wmq.8.1675434593694; Fri, 03 Feb 2023 06:29:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/33] target/arm: Mark up sysregs for HFGITR bits 48..63 Date: Fri, 3 Feb 2023 14:29:23 +0000 Message-Id: <20230203142927.834793-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 48..63. Some of these bits are for trapping instructions which are not in the system instruction encoding (i.e. which are not handled by the ARMCPRegInfo mechanism): * ERET, ERETAA, ERETAB * SVC We will have to handle those separately and manually. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-20-peter.maydell@linaro.org Message-id: 20230127175507.2895013-20-peter.maydell@linaro.org --- target/arm/cpregs.h | 4 ++++ target/arm/helper.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 2e5ac6b4f98..efcf9181b97 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -696,6 +696,10 @@ typedef enum FGTBit { DO_BIT(HFGITR, TLBIVAAE1), DO_BIT(HFGITR, TLBIVALE1), DO_BIT(HFGITR, TLBIVAALE1), + DO_BIT(HFGITR, CFPRCTX), + DO_BIT(HFGITR, DVPRCTX), + DO_BIT(HFGITR, CPPRCTX), + DO_BIT(HFGITR, DCCVAC), } FGTBit; #undef DO_BIT diff --git a/target/arm/helper.c b/target/arm/helper.c index 5b9cc087e28..c0403aadae2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5295,6 +5295,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NOP, + .fgt = FGT_DCCVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, @@ -7588,10 +7589,12 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { { .name = "DC_CGVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 3, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CGDVAC", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 5, .type = ARM_CP_NOP, .access = PL0_W, + .fgt = FGT_DCCVAC, .accessfn = aa64_cacheop_poc_access }, { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, @@ -7747,24 +7750,30 @@ static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, static const ARMCPRegInfo predinv_reginfo[] = { { .name = "CFP_RCTX", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 4, + .fgt = FGT_CFPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, { .name = "DVP_RCTX", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 5, + .fgt = FGT_DVPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, { .name = "CPP_RCTX", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 7, + .fgt = FGT_CPPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, /* * Note the AArch32 opcodes have a different OPC1. */ { .name = "CFPRCTX", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 4, + .fgt = FGT_CFPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, { .name = "DVPRCTX", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 5, + .fgt = FGT_DVPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, { .name = "CPPRCTX", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 7, + .fgt = FGT_CPPRCTX, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, }; From patchwork Fri Feb 3 14:29:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650060 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp852307pva; Fri, 3 Feb 2023 06:35:39 -0800 (PST) X-Google-Smtp-Source: AK7set/PDQS5+NDNYGIPga2kmUlBveJzV1LBGXlNtg5m1nbfqI3KJwdXL9xj8f4p5UKj6muwi2LT X-Received: by 2002:a0c:c48f:0:b0:53c:e0cb:67ad with SMTP id u15-20020a0cc48f000000b0053ce0cb67admr11554107qvi.43.1675434939191; Fri, 03 Feb 2023 06:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434939; cv=none; d=google.com; s=arc-20160816; b=Z+BG7Ehc+rzBFlC0EADe13xROeH0pUFTtfM091eXaCQrDRuFhBZ8daAhsm5LUHnXOj cEbSJhnLOlrEnX+XvGYhF+gSyPHWa0oDFi7iFKFWBVR+iqQwY5XAhz8Dm331OARaekEv 9PwixkJDK61oFUTYfO6Bqo/99x7BFBzl2XoILC78fOTbGWH+aztixkLV7eWbQCrQb0HM kXuYfo+zQ+7f05Cyg/xqHgA2yFRJtG4M3L5VgcotjrCG3qzjJMms3ErlJMkJQ3SQwKTh kNy4ATcSTmkz4+y1fYfURxj+Okmtaj6qhLqGhvbdMaCcMbS0kdtLalzuFTECKl86Imx9 avpw== 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=UAP+fyEZ6YJZ2unHEOswKIVrra1c/Fd0zQr/S3C4us4=; b=PIjVrZldr4dvqV0HUyNESt5tUk9i6ogUVaAZCy+dmU57hrkZ9NZ5eZq35/CraeoXzD +XBwYjpeFxkNEreZWf6LDQWcvMzsrKqOOLz/XWXAveZB+8YSX0KYykq38a11vFQgRngl 6F80bY3rr+MCpXFKVlDGeL8fASiU8LqsQ63BM3iGbSulzDY3FBGfGy/PJXjpdk1vLw+I E2jqMOoB8Ch0zOXComt2Snc259I7kfja74QgxQTwd4cED1eMyCS3+57MmA9TEwEgePoB gxVlWL8lgcoRy1j9pQvUCdJJdhSI/OLd1QXC6ePbz6+vNh+GRl6eVfzte8KdZn7iuu7e z3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aKil9Sh1; 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 jp11-20020ad45f8b000000b00538a44133e7si2155623qvb.405.2023.02.03.06.35.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:35:39 -0800 (PST) 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=aKil9Sh1; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5V-0000Ds-4e; Fri, 03 Feb 2023 09:30:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006t4-BQ for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:59 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4f-000598-J3 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:59 -0500 Received: by mail-wm1-x334.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2509867wms.0 for ; Fri, 03 Feb 2023 06:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UAP+fyEZ6YJZ2unHEOswKIVrra1c/Fd0zQr/S3C4us4=; b=aKil9Sh1GkE65ytO0w6SNI8F27YJZstpRQKd1TZf4cGLTdNirsw3U2xIILuyFdwCId v1bGk9bRdv43eiuBpn8qEscGHTqGRy6Ry2RkJMZam9D+0ei7QT+mvTdM1QtT+acxjGrD vzdrttUy1YuMiAocC+WdQ82ww4AR4lmQu0iDYDQwNj5OmwHlVOdy+Mj9879KfF4B/p8r u+FN4ViqvclnCQRoYZ8Bu2yeGTfn7dvOygOo8mIw1/kSADZsIgXK+fHmlNs9fsyZ3opl YIwQHE8BrG9JcLKYIN9MomGE0/UN+VTpYaOHVO1A/miBxOg43Vm/xUgOJ6+ihzGcmoH0 JIzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UAP+fyEZ6YJZ2unHEOswKIVrra1c/Fd0zQr/S3C4us4=; b=XX8rE8FeBrQU8uvBZfgDxcwvFUk8/FsnynZYHrf/bjeJeovydUbqFv1MOjpf8T2q1E HMibXbLcfl8kWQGMHYjoOB01HN6Eo9R9keOhVeWGX273Bbkzh+/V4RxmM1nRlY19waw7 393bPYrPiqb3gPiKbfqRhy2bxWWmPosIy9TTDwJ9VJDkGPXDXg09f+Wt0SNK+PKVCgyU ed3PRBVFNAMD+ZrVZkfk+Bn7j91qbkz+9HzrHGExFPcYkrUBHCkmHjgfiMF5OjUN220+ rZeuYfaCYP/qR0ZpobmuQmSc9hLoBeaWK9ZXy82EZG82QSYOg1kHDO3F5NmUtkL5h5VA 2mLQ== X-Gm-Message-State: AO0yUKX4S1yTXLJLrb+kFn/iErbzVtBBMFlDsqZAkZFOQOL4pJ81XBPK 3vU2Wa331O0H4VJSWLWUqQL89g68IdbuN5kY X-Received: by 2002:a05:600c:a0d:b0:3dc:4f2c:c856 with SMTP id z13-20020a05600c0a0d00b003dc4f2cc856mr10468469wmp.32.1675434594556; Fri, 03 Feb 2023 06:29:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/33] target/arm: Implement the HFGITR_EL2.ERET trap Date: Fri, 3 Feb 2023 14:29:24 +0000 Message-Id: <20230203142927.834793-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Implement the HFGITR_EL2.ERET fine-grained trap. This traps execution from AArch64 EL1 of ERET, ERETAA and ERETAB. The trap is reported with a syndrome value of 0x1a. The trap must take precedence over a possible pointer-authentication trap for ERETAA and ERETAB. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-21-peter.maydell@linaro.org Message-id: 20230127175507.2895013-21-peter.maydell@linaro.org --- target/arm/cpu.h | 1 + target/arm/syndrome.h | 10 ++++++++++ target/arm/translate.h | 2 ++ target/arm/helper.c | 3 +++ target/arm/translate-a64.c | 10 ++++++++++ 5 files changed, 26 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 5cc81bec9bf..ec2a7716ce7 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3245,6 +3245,7 @@ FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) FIELD(TBFLAG_A64, SVL, 24, 4) /* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */ FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1) +FIELD(TBFLAG_A64, FGT_ERET, 29, 1) /* * Helpers for using the above. diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 73df5e37938..d27d1bc31f0 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_ERETTRAP = 0x1a, EC_SMETRAP = 0x1d, EC_INSNABORT = 0x20, EC_INSNABORT_SAME_EL = 0x21, @@ -215,6 +216,15 @@ static inline uint32_t syn_sve_access_trap(void) return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT; } +/* + * eret_op is bits [1:0] of the ERET instruction, so: + * 0 for ERET, 2 for ERETAA, 3 for ERETAB. + */ +static inline uint32_t syn_erettrap(int eret_op) +{ + return (EC_ERETTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | eret_op; +} + static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) { return (EC_SMETRAP << ARM_EL_EC_SHIFT) diff --git a/target/arm/translate.h b/target/arm/translate.h index 599902016dc..62a7706eabd 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -132,6 +132,8 @@ typedef struct DisasContext { bool mve_no_pred; /* True if fine-grained traps are active */ bool fgt_active; + /* True if fine-grained trap on ERET is enabled */ + bool fgt_eret; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index c0403aadae2..6151c775053 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12065,6 +12065,9 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, if (arm_fgt_active(env, el)) { DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); + if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { + DP_TBFLAG_A64(flags, FGT_ERET, 1); + } } if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a47dab4f1dd..11bfa3f717a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2385,6 +2385,10 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) if (op4 != 0) { goto do_unallocated; } + if (s->fgt_eret) { + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); + return; + } dst = tcg_temp_new_i64(); tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUARMState, elr_el[s->current_el])); @@ -2398,6 +2402,11 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) if (rn != 0x1f || op4 != 0x1f) { goto do_unallocated; } + /* The FGT trap takes precedence over an auth trap. */ + if (s->fgt_eret) { + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); + return; + } dst = tcg_temp_new_i64(); tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUARMState, elr_el[s->current_el])); @@ -14742,6 +14751,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->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); + dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); 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; From patchwork Fri Feb 3 14:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650056 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp851116pva; Fri, 3 Feb 2023 06:33:34 -0800 (PST) X-Google-Smtp-Source: AK7set8FR2xU2ZYqyecHJzZfDAi5ZsjB2R9FHeTnD1LtEc8IAp27lFzzrKnX6vWUJ2j9nF4ybwPK X-Received: by 2002:a05:6214:e8b:b0:532:2d0e:7e3b with SMTP id hf11-20020a0562140e8b00b005322d0e7e3bmr18369813qvb.37.1675434814095; Fri, 03 Feb 2023 06:33:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434814; cv=none; d=google.com; s=arc-20160816; b=yZOlsm0HAalHZ/laFWbKtAV4KVE74K46Njlx45TwPryk4Q7oVHEtIeUeiIP7ngvbX5 oG7p3TT34y7WfmAVi2n/XmGR+zYdDoFfWqzSYCNcN+jvXFDc47W3dMmI0o71RSK9tsMp qsgUee9Vn3SmgeN5iQbJ6vAW95AcWASJ8zFXppNjyZ9mJVkOsYZ4VUaZ/iTJR91PKVZM zSUW2AmT9q/Nii54lPN1JjyhTmq5Ne/CHD6Zg6lnWMM6Wz/OZNCpMLS9laAeFIpL5kFV PE7HohItVoHOw+o2Io08XImS3SM8B1rSHplPZX+5bFWPMLwxqN2Kxk89NLhIgvgZVxWT ZS1Q== 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=l0u5UibgcI5qnW9GrxT+wU1ixlLChLWV7gMBX8MNisg=; b=oSvevXIXv/G+bxg1iAne0tX19y6eAUv2Kf3x3YvOvWjUjtCgzVfQWNXIujKuvfK4Wh 5Qq7Dqizb8+I4YY+cesvE1LwzcnhEqEd4d5WYCQkVOIldObTKm53vom8WP3EID5xqjl+ 368P8v5r6puhMriyp7KSJGQt+4i1TEEDcd22MtqMPjCi4Nme5az02ao6A2bECg5JQIw9 U+DwxqDd/2GIgkfAlcGeBSP4nea0h8KS4yHeD1JG/mb4uqL/vB7ur1zvvytfX4ru8BwA rSTl62MTAu5hUH84CWzqQBoN2gmuSQ5LBv5pZ58gkpdAmQmlnt/zobZi4cLbtuOwSsZQ ohrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NIX3HPCc; 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 b5-20020a0cfb45000000b00535581c9429si1771051qvq.562.2023.02.03.06.33.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:34 -0800 (PST) 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=NIX3HPCc; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx56-0007Ph-ME; Fri, 03 Feb 2023 09:30:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4h-0006tK-HU for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:59 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4f-00059a-IY for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:29:59 -0500 Received: by mail-wm1-x32a.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso6131861wmp.3 for ; Fri, 03 Feb 2023 06:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=l0u5UibgcI5qnW9GrxT+wU1ixlLChLWV7gMBX8MNisg=; b=NIX3HPCcyhL1s/JRKSFZatiTI0/FkQsTH2xtnHnUeHI8zm3XsdmP0J7eKWy9oiWEHM WvF4YlY188KyBd+3IASUswUQeIMWa2jIHQrPJBif/yI0bkv+a8OslDr/U4S8mTlEgi78 3a1oZ8Hhc6dmli6LF2I9qaX8vxVdBcg7KbMis+VVxf68ZG4XuikXxQjn2aJzO2bkLE95 xJ6Gf+HZVgH/3NVZPKhhrfm84//WsX/7o2njAETOnTUav+3CxPgFWUCaWZttcMWJYbCB /4uvdd42uGJQRB0fCoev7xt63iq1mzHuamChsja7a3VBZ4eLUG0addZS5avmtGrznfq/ rCDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l0u5UibgcI5qnW9GrxT+wU1ixlLChLWV7gMBX8MNisg=; b=fttKeYRZ4qlDvimXDWIwMnlE7/0C+9LpD9wLeZrNjARmxUQDohNen6WrAzLAT9GMlm hhbbPQA9d3/PUp044SrXGi+DLTuuN/HMLPk0kQ2bDcQl2006hgaC6sEuUjZZMq9Yio65 BRHP4p9M5lAqgRcvxE5zLZ6vNWRzjILV7qA1/NDyxuN/w6jPiiYbgj7eJd+JNPspPkB3 rl8WtTTzhIqS7AGlRHR45wf6mzyQ0G+MwsKncF1BwqeiG4kqkQSfHTiiageHODM7xGKo 0dqNEqDFFn4Hgzs6sPxgciCRoUYi0Nbo4uXpljMKgMHe7d+GemGTkUccEL2l7IV6CPkr A/FA== X-Gm-Message-State: AO0yUKVSgEUsq1OIA3kcG1GsDOSOjDYnDK1GhOPbJBUJqL4n7R3Yob66 OmsDadJI9UpIOJmB47slNw/K0Npp8NgulJWO X-Received: by 2002:a05:600c:a297:b0:3dc:42e7:f626 with SMTP id hu23-20020a05600ca29700b003dc42e7f626mr9618890wmb.26.1675434595402; Fri, 03 Feb 2023 06:29:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/33] target/arm: Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 traps Date: Fri, 3 Feb 2023 14:29:25 +0000 Message-Id: <20230203142927.834793-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 fine-grained traps. These trap execution of the SVC instruction from AArch32 and AArch64. (As usual, AArch32 can only trap from EL0, as fine grained traps are disabled with an AArch32 EL1.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-22-peter.maydell@linaro.org Message-id: 20230127175507.2895013-22-peter.maydell@linaro.org --- target/arm/cpu.h | 1 + target/arm/translate.h | 2 ++ target/arm/helper.c | 20 ++++++++++++++++++++ target/arm/translate-a64.c | 9 ++++++++- target/arm/translate.c | 12 +++++++++--- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ec2a7716ce7..7bc97fece97 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3171,6 +3171,7 @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) +FIELD(TBFLAG_ANY, FGT_SVC, 13, 1) /* * Bit usage when in AArch32 state, both A- and M-profile. diff --git a/target/arm/translate.h b/target/arm/translate.h index 62a7706eabd..3717824b754 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -134,6 +134,8 @@ typedef struct DisasContext { bool fgt_active; /* True if fine-grained trap on ERET is enabled */ bool fgt_eret; + /* True if fine-grained trap on SVC is enabled */ + bool fgt_svc; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index 6151c775053..c62ed05c122 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11842,6 +11842,20 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) return arm_mmu_idx_el(env, arm_current_el(env)); } +static inline bool fgt_svc(CPUARMState *env, int el) +{ + /* + * Assuming fine-grained-traps are active, return true if we + * should be trapping on SVC instructions. Only AArch64 can + * trap on an SVC at EL1, but we don't need to special-case this + * because if this is AArch32 EL1 then arm_fgt_active() is false. + * We also know el is 0 or 1. + */ + return el == 0 ? + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) : + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1); +} + static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx, CPUARMTBFlags flags) @@ -11927,6 +11941,9 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, if (arm_fgt_active(env, el)) { DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); + if (fgt_svc(env, el)) { + DP_TBFLAG_ANY(flags, FGT_SVC, 1); + } } if (env->uncached_cpsr & CPSR_IL) { @@ -12068,6 +12085,9 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { DP_TBFLAG_A64(flags, FGT_ERET, 1); } + if (fgt_svc(env, el)) { + DP_TBFLAG_ANY(flags, FGT_SVC, 1); + } } if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 11bfa3f717a..bbfadb7c2e8 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2179,6 +2179,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) int opc = extract32(insn, 21, 3); int op2_ll = extract32(insn, 0, 5); int imm16 = extract32(insn, 5, 16); + uint32_t syndrome; switch (opc) { case 0: @@ -2189,8 +2190,13 @@ static void disas_exc(DisasContext *s, uint32_t insn) */ switch (op2_ll) { case 1: /* SVC */ + syndrome = syn_aa64_svc(imm16); + if (s->fgt_svc) { + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); + break; + } gen_ss_advance(s); - gen_exception_insn(s, 4, EXCP_SWI, syn_aa64_svc(imm16)); + gen_exception_insn(s, 4, EXCP_SWI, syndrome); break; case 2: /* HVC */ if (s->current_el == 0) { @@ -14751,6 +14757,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->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); diff --git a/target/arm/translate.c b/target/arm/translate.c index 3f51dc6a6bf..c23a3462bfc 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8834,9 +8834,14 @@ static bool trans_SVC(DisasContext *s, arg_SVC *a) (a->imm == semihost_imm)) { gen_exception_internal_insn(s, EXCP_SEMIHOST); } else { - gen_update_pc(s, curr_insn_len(s)); - s->svc_imm = a->imm; - s->base.is_jmp = DISAS_SWI; + if (s->fgt_svc) { + uint32_t syndrome = syn_aa32_svc(a->imm, s->thumb); + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); + } else { + gen_update_pc(s, curr_insn_len(s)); + s->svc_imm = a->imm; + s->base.is_jmp = DISAS_SWI; + } } return true; } @@ -9417,6 +9422,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); if (arm_feature(env, ARM_FEATURE_M)) { dc->vfp_enabled = 1; From patchwork Fri Feb 3 14:29:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650052 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp850867pva; Fri, 3 Feb 2023 06:33:10 -0800 (PST) X-Google-Smtp-Source: AK7set+0dqNulKHm2RWWKW9KXyS7E2vcrgqB2E1BxuKq5S0ZIvjGOOltbObOPsghG4H+cvq23jLd X-Received: by 2002:a0c:c608:0:b0:536:ba5e:6abf with SMTP id v8-20020a0cc608000000b00536ba5e6abfmr13185174qvi.39.1675434789952; Fri, 03 Feb 2023 06:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675434789; cv=none; d=google.com; s=arc-20160816; b=isxZZrjdy4AWkiAr2gF7ZXM493cDdQb3RH56B909EWVzvsaMV9CMc2KXkdJvzHg+kq oE7fqZw5RluJEv6P590sMv8n+zqo/PKKJlEZVTX0QwzpvlgITXTbFMIMNFGj93nnlDBm xq7O5jXT1e8/ftjEmqQ/Xoy+MRxdSgy5R1uFPM/J19E+jaGFThbuF2+qovMb7hYpKoAQ Lr1Od0DjIbPgePmGMdS2bQxe1XX3UxLgc+BQT5G6fWmSDYrNVkDEBDhBmCpGcItUkNCZ Pl0WnxRRStGqHoBO+UF0y/qdKG1K15aJQ0x/ZsLgsfJTbO2DF/orWs0xJ5WzvjarD24m 9kPQ== 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=xTqYZJo21mR+70Kxpz8qplBoPvCqRYvqTyvegNRGHKw=; b=bLm6tWpqk3sTpAMfSOmo6RUuIuwMwZhNNAxZ3d0aPYjZ+LUCyCZdd6E7sgve1s6q/i rNpRbWgNIxrrPS/gf4YAzVKzvspPuNBEtyaXYCbTaqpDHg9osiU46m1Tk6eSlNtCutK6 u1r1TcU7PKSTDjVU/TW8pttleZIQFoIYHKW9FYJNwYyMgn8Mmcytrnws70b1MpMgZPQe Qw1qCXiIWI2RQNwBNDSc29IUAEq9rSHhnAOm2z7Hrd+9iWbgTsQlxffVq85MTdFg7qD+ nN+panwuziba9ZRTqDl3XlqEP1fGtFnBhhRQLe94lInSUeBOhmL3K2DjJFoQYEORJPCH SsNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gwQqcCxw; 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 hu11-20020a056214234b00b00545107519fcsi2135863qvb.244.2023.02.03.06.33.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:33:09 -0800 (PST) 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=gwQqcCxw; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx4v-000707-0e; Fri, 03 Feb 2023 09:30:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4i-0006ts-Nx for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:30:00 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4f-00057V-JD for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:30:00 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso3985860wms.4 for ; Fri, 03 Feb 2023 06:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xTqYZJo21mR+70Kxpz8qplBoPvCqRYvqTyvegNRGHKw=; b=gwQqcCxwetDInQbd7fkMf567FsmZBD+fV5+OXeFc72CekDCvPo1vPHUGyfjkEygtqb /NLS6pRoSv3mTzXCIDcC7plXRIPKKLKaiBl1BuM9heL1/ZDf9PjIJ2KC6H2SarVGkvle FIGd+Pa9v9e61HWHnPQNoG5y+gFBVpjlOf7R/Wb+gPEFlRri4aXypinELPvaGoRGqB+d a88wJDKLnp9WKfSxn1LxxKCn19gygvdnwxep2sNTWGbOlNx0g3rDnnWUOsYY6RmWZrjO 76/J6iX2ptifSewiv1qQMi2TIXWCc1etjhudCkeHP1plSgdSICowKqHSEEyFeoSrM5yh xuWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xTqYZJo21mR+70Kxpz8qplBoPvCqRYvqTyvegNRGHKw=; b=ubF8mpsPkMk64LlbFOBp6pkIeIz/jPvrY6dYnw6A813eeJ+xEe6/sulRmVd2ra8v+V HLBWDQUTZAqUQSlcqILwCnOu4GoGNqB3AfgQv2eew1QfcDYPTiEltyU5brtO40kVBPXW iQhZlQ0r1VfH2SXYHOqphoiGerlF4gYWXOftA9fhWlD2KYIJvxTvoZ30C9xyn9ptIHqZ vjIrJSAmK0xv5Z+VjHKsjpeThyIGAjUEFzW0a9+KDCuUK3ae8su1yzL+dO96CDnJapJM MSzFY0gM/CYZ7LcASseehg1DuUYfNIFZVhpLOJ9daNyd4zPVXLvKFSpwRuzHk9Wwx3pB TFpQ== X-Gm-Message-State: AO0yUKWiJQFTrekhd1wCINzTHEybgbQ7xnCAgAS5Sse5ZzuQqDnwZtXn Bu4QgTrNS1/FdWE/HQ5+ng14D+N3SnS5+lbZ X-Received: by 2002:a05:600c:210a:b0:3df:12db:2779 with SMTP id u10-20020a05600c210a00b003df12db2779mr8940780wml.3.1675434596198; Fri, 03 Feb 2023 06:29:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/33] target/arm: Implement MDCR_EL2.TDCC and MDCR_EL3.TDCC traps Date: Fri, 3 Feb 2023 14:29:26 +0000 Message-Id: <20230203142927.834793-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org FEAT_FGT also implements an extra trap bit in the MDCR_EL2 and MDCR_EL3 registers: bit TDCC enables trapping of use of the Debug Comms Channel registers OSDTRRX_EL1, OSDTRTX_EL1, MDCCSR_EL0, MDCCINT_EL0, DBGDTR_EL0, DBGDTRRX_EL0 and DBGDTRTX_EL0 (and their AArch32 equivalents). This trapping is independent of whether fine-grained traps are enabled or not. Implement these extra traps. (We don't implement DBGDTR_EL0, DBGDTRRX_EL0 and DBGDTRTX_EL0.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-23-peter.maydell@linaro.org Message-id: 20230127175507.2895013-23-peter.maydell@linaro.org --- target/arm/debug_helper.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index b106746b0e1..3c671c88c1a 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -599,6 +599,33 @@ static CPAccessResult access_tda(CPUARMState *env, const ARMCPRegInfo *ri, return CP_ACCESS_OK; } +/* + * Check for traps to Debug Comms Channel registers. If FEAT_FGT + * is implemented then these are controlled by MDCR_EL2.TDCC for + * EL2 and MDCR_EL3.TDCC for EL3. They are also controlled by + * the general debug access trap bits MDCR_EL2.TDA and MDCR_EL3.TDA. + */ +static CPAccessResult access_tdcc(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + int el = arm_current_el(env); + uint64_t mdcr_el2 = arm_mdcr_el2_eff(env); + bool mdcr_el2_tda = (mdcr_el2 & MDCR_TDA) || (mdcr_el2 & MDCR_TDE) || + (arm_hcr_el2_eff(env) & HCR_TGE); + bool mdcr_el2_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && + (mdcr_el2 & MDCR_TDCC); + bool mdcr_el3_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && + (env->cp15.mdcr_el3 & MDCR_TDCC); + + if (el < 2 && (mdcr_el2_tda || mdcr_el2_tdcc)) { + return CP_ACCESS_TRAP_EL2; + } + if (el < 3 && ((env->cp15.mdcr_el3 & MDCR_TDA) || mdcr_el3_tdcc)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + static void oslar_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { @@ -681,7 +708,7 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { */ { .name = "MDCCSR_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 1, .opc2 = 0, - .access = PL0_R, .accessfn = access_tda, + .access = PL0_R, .accessfn = access_tdcc, .type = ARM_CP_CONST, .resetvalue = 0 }, /* * OSDTRRX_EL1/OSDTRTX_EL1 are used for save and restore of DBGDTRRX_EL0. @@ -689,11 +716,11 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { */ { .name = "OSDTRRX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 2, - .access = PL1_RW, .accessfn = access_tda, + .access = PL1_RW, .accessfn = access_tdcc, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "OSDTRTX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, - .access = PL1_RW, .accessfn = access_tda, + .access = PL1_RW, .accessfn = access_tdcc, .type = ARM_CP_CONST, .resetvalue = 0 }, /* * OSECCR_EL1 provides a mechanism for an operating system @@ -757,7 +784,7 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { */ { .name = "MDCCINT_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, - .access = PL1_RW, .accessfn = access_tda, + .access = PL1_RW, .accessfn = access_tdcc, .type = ARM_CP_NOP }, /* * Dummy DBGCLAIM registers. From patchwork Fri Feb 3 14:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650065 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp853124pva; Fri, 3 Feb 2023 06:37:10 -0800 (PST) X-Google-Smtp-Source: AK7set87ui4SqkYlp3JxJ3hQBla1f1BqXkVeS6C+XX2bsIglCdAM1+PQJq56oCw3V4S8/hyMDcgI X-Received: by 2002:ad4:4d88:0:b0:537:7c16:1775 with SMTP id cv8-20020ad44d88000000b005377c161775mr16079526qvb.44.1675435030562; Fri, 03 Feb 2023 06:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675435030; cv=none; d=google.com; s=arc-20160816; b=faTKtGZXf/7cQuE7M9aG7r8V2mGzFhn+c474YEOELKS7+ajA1zOienUPXw+WVTR2LZ mI8lB0zwWAdGZS4gDmIQeREWa61Z5rGtfNwbIBg3g1GNvLxaZnpCHMJM3WPnVU478ynM CWMIyTMq+A0eCzF2KkhjWpBYtVIo+Xle7tGsQKl011Eh4KsYJoSSav15CWTi//xYuyu+ TPso07gTr00Ktn2OBinHoMGF0ugI5q75tBLqsd5U5FndLsmLiNFo9Kf1Kz5eZ/kxiykX JyAODwz6jYoLhxBfA5nljt1fxPwT+Kmx9F5EmKz649uE/UrLMcjdhgTSGTdXWCMdc6Cm 7EWQ== 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=L2nnqzPfORcCpUIAV2HyeXVRQVeoYBVIUoJ05tbUvrM=; b=U5Fm3eysHwHV27cFmCtoDksV04qvMaCgF5dghFkuVbDD3Wn/Gq1NRw646WvpC7ZPZH nxvpQHl+wHER+9eCqO+4J2FDW9LMvewM9csov1A3Rp/50O8V8Xw7NRY1/6FChFF4+97s xj0sQMrOh7KfE6eBGHiAh9jTz1HRBauhGmLA4fjtwMxyw4F2Ke8C3et7wtz3TYeyU9hg JHOEA6qcaP7Q85LlvCoCCrYroUESi0r5KE/QLWvy3Udy13SIWVrwUvlBuh0RaGduKh7r /fAqi/IjTL7+kb9ufJFGGhqnSZJcfYpWKsYfhXiF94K6VdBjUxCHrEEHmOKVGBM/RJOq MhjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NT96SRFc; 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 ey15-20020a0562140b6f00b005376d8a8e5asi2182668qvb.433.2023.02.03.06.37.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:37:10 -0800 (PST) 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=NT96SRFc; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNx5X-0000Sq-BO; Fri, 03 Feb 2023 09:30:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNx4i-0006tr-Lc for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:30:00 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNx4f-00053Z-R0 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:30:00 -0500 Received: by mail-wm1-x334.google.com with SMTP id hn2-20020a05600ca38200b003dc5cb96d46so6125856wmb.4 for ; Fri, 03 Feb 2023 06:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=L2nnqzPfORcCpUIAV2HyeXVRQVeoYBVIUoJ05tbUvrM=; b=NT96SRFcdwVoomEJAZrxvJiJs9Ol0Sf83+iAGijF5aoM9Au4TEMvoZoh54e/JyuBOq wpIWezoU9k1i2/yATyrVbzM9BbZgD4djza81vYFcLtkf1gxrHufQDAh1bBpzSJ46hHri 1qihFAtHD+pvYOChTwkl0JlLxij4ZyHEOT1VhzMYaFaV5mbG4CAIdPirfcivFct7tFF7 WDG58J1Fxw68TmUzU46rbIW7umaINpwgZ82Q1bA6bprZYl55gm5tpe7y6X7hdv+kbot9 K0qsWyyhsTD91TIhknOVHSsa1A7DmkFX0r33qLjqHIoMkOcNqsqBxvapUhHon77lXnCh 7FRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L2nnqzPfORcCpUIAV2HyeXVRQVeoYBVIUoJ05tbUvrM=; b=AESzYs+4zxjwPzPT4cnjbw/d0Y/9AHeCzvFWxhF+u978CYc3Ua62Arh7iTNfM4yBve ibzq/x70M8dxMA+7aoJmkPgy3SDAIhYSFRemG9spC3nXPUM4TGxaIo2p0Zlu6gxpKXk7 79elt5gs9RtYjB+yV0SqM3eKhkC4d+eygHlu3qUwbX79blkan6gQxUZ9G6aFuXAhr+WH dTyVi0R7CPVpXsrWJtp6L18weivV6Cp8VP2sZ+P1a5mj4y9MdsIxaYNBJjI6XF3rJIBF 7F614J5jeHG28fInzvWusN2AVPL4sGGgM1lcFRJtp0g1arl3ffgbi96xLWxCffP7+uNe cR8w== X-Gm-Message-State: AO0yUKVUtczpQBMo4UW1mCtZGEA/RwaBMjHGN54MXO//UYGQaKY/qPbE Z+MG8KKkUTo8mQ2jgnaDN/KjC+nedi8MgDof X-Received: by 2002:a7b:cd17:0:b0:3dc:4f65:553e with SMTP id f23-20020a7bcd17000000b003dc4f65553emr10745119wmj.3.1675434597097; Fri, 03 Feb 2023 06:29:57 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c130e00b003df241f52e8sm2578492wmf.42.2023.02.03.06.29.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 06:29:56 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/33] target/arm: Enable FEAT_FGT on '-cpu max' Date: Fri, 3 Feb 2023 14:29:27 +0000 Message-Id: <20230203142927.834793-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203142927.834793-1-peter.maydell@linaro.org> References: <20230203142927.834793-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 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-bounces+patch=linaro.org@nongnu.org Update the ID registers for TCG's '-cpu max' to report the presence of FEAT_FGT Fine-Grained Traps support. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Fuad Tabba Message-id: 20230130182459.3309057-24-peter.maydell@linaro.org Message-id: 20230127175507.2895013-24-peter.maydell@linaro.org --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index b87e064d9dc..2062d712610 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -30,6 +30,7 @@ the following architecture extensions: - FEAT_ETS (Enhanced Translation Synchronization) - FEAT_EVT (Enhanced Virtualization Traps) - FEAT_FCMA (Floating-point complex number instructions) +- FEAT_FGT (Fine-Grained Traps) - FEAT_FHM (Floating-point half-precision multiplication instructions) - FEAT_FP16 (Half-precision floating-point data processing) - FEAT_FRINTTS (Floating-point to integer instructions) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 0e021960fb5..4066950da15 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -1224,6 +1224,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 2); /* 16k stage2 supported */ t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN64_2, 2); /* 64k stage2 supported */ t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 2); /* 4k stage2 supported */ + t = FIELD_DP64(t, ID_AA64MMFR0, FGT, 1); /* FEAT_FGT */ cpu->isar.id_aa64mmfr0 = t; t = cpu->isar.id_aa64mmfr1;