From patchwork Fri Jun 26 15:13:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 191846 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp593267ilg; Fri, 26 Jun 2020 08:32:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZqTxvAG1Rr5HvvyQvxntiNkA4oUNSw5O8+ebmOa6Vod8KcfaWzo83d1gIQXVa4hUL4XU+ X-Received: by 2002:a5b:108:: with SMTP id 8mr5875306ybx.285.1593185544879; Fri, 26 Jun 2020 08:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593185544; cv=none; d=google.com; s=arc-20160816; b=gSCoI1NAJwfRDIbb5XRNMrDBVSBwhXef9q70Gi0JwOoZSWN2Qn73EhizFQ29F2bei3 FRK4dsMnyVewOcUX8DFjR+IAEbNqP6DgTp/ZhFUP61mIEmPE63ORcLpJ707f5uqhtQ/J folc28o9O0rzOh2EJNwCp7WKdddzgTO8BMqzJDTAvh54Vkb3hcmCr/idc8EoDEYUxJVy vMRteeq6ruuV0E8IJCUSmyvydvk8tR+/NjHrggRv9IQE091k8ou0waE9Dij7bIlJ7SRt 0yltrzyXPTlm/9UIUlZaTrA//Z6Eh5hJPVYu/wpBfYJwV23CoyuVyX4ZIXCjzhCNpw7x Gwwg== 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=qsOodnm1qeB+KB+yqVxO1rsPzGD5oxJ366HcOjFmYxY=; b=Wumqfj0dsths2o7y1KGMSkcii51n92zeyN8xipsxZggZBi0R1FJT/Psi9Rc42nWGDS cVSW/veRW3ybU4NP21g786XYp18WhuALO5tSERiIuJm9gx6v7pI88JNnh5vmdU21xcL1 CQTa/1qFdrh+LN9RWweL7kqFh6LPSE4y+rB7RjWioILMntClCWBhWpDHm8Zr7yV1f0nD njH0KnVctvdaKqX0D6BIH/p9dROgGDIAsAcehybAiF5X8qmDyiCrNaOc1Gq1RxboNjm2 r5K4UnUpYhnjPTz8CUh55Xh99HyBvZOepIgSkyVnoQXHxY/Lvtrl2eB+U3XZGOXLnB5C 2sYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bThhGxWp; 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 c203si25618484yba.431.2020.06.26.08.32.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jun 2020 08:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bThhGxWp; 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]:34696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joqL2-00082v-CB for patch@linaro.org; Fri, 26 Jun 2020 11:32:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joq4F-0002kY-5X for qemu-devel@nongnu.org; Fri, 26 Jun 2020 11:15:03 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:52629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joq4D-0006Wj-Bh for qemu-devel@nongnu.org; Fri, 26 Jun 2020 11:15:02 -0400 Received: by mail-wm1-x344.google.com with SMTP id q15so9160623wmj.2 for ; Fri, 26 Jun 2020 08:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qsOodnm1qeB+KB+yqVxO1rsPzGD5oxJ366HcOjFmYxY=; b=bThhGxWpM5LrXTuqeCmS/UersBa4sqSxfaHVpgv6LfMWv8X51cQy+5JXnCW1BhMKo3 ueToEZ5USep9XA9lei5pn83/l1D7nCjiMRyFF0Baz6W1WP9bptMjvhqO59T772F49qMl vearV8hib7mmCRPsBK5SFnJROWCwqoiWBGaZyMuQE7x5e4ZQwsCCAXEHVoSbawzBi7o1 vheRdiUx73rdLlRHjvAT2gG+UTg+Mj+yI1hpzWS2Y4x7p4AgJFFv5k3eN8v72Fv0RNpw xQrbFg1u/3SmMNa5clfEb6WF6HcHZutLxXWx9TzK3PV3I7sHWNGfLdJfoqPlgYsdF+N8 KZlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qsOodnm1qeB+KB+yqVxO1rsPzGD5oxJ366HcOjFmYxY=; b=amp5d0z7HDZDH/yNO+V+rv7HTGG4zaXIIT+kB8/Qt0LnImJYbp2SQeVrDCSEknOiVn hI9J40DkZ7G7k6CHX4X/gRGoliXmrFJWaCLkkth4P4i3EmH809waUesW7Cks9UnCLuGF qjUKFFU77M9LmQFcWLi+COjl6vVJkF8hdq6e49RY2XINDe85Xah4osFBZqCxkt1WPs1b 60ZjPCQ89irm39oR8GE+vsuw7PBbxJJ19c5oPl5omj3MYtssO7UDmNaz6cFSk6m84nnF 0c8FjHej8b0gKf/ySajAPfcFrPRfTLXgBDRQcAvd9z+YFJEJw/VW+xT51wZuoeIad67P 134g== X-Gm-Message-State: AOAM532N2dGYOLTSloXYvg+L9ipBw8s6jJMOzsrxkR5E8kAgtoqGn6fS db6v7UDAtzi4yWocIVe6vahJ6eWnsQ1zrA== X-Received: by 2002:a1c:2d54:: with SMTP id t81mr4249439wmt.154.1593184499755; Fri, 26 Jun 2020 08:14:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w13sm37838852wrr.67.2020.06.26.08.14.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 08:14:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/57] target/arm: Restrict the values of DCZID.BS under TCG Date: Fri, 26 Jun 2020 16:13:56 +0100 Message-Id: <20200626151424.30117-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200626151424.30117-1-peter.maydell@linaro.org> References: <20200626151424.30117-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We can simplify our DC_ZVA if we recognize that the largest BS that we actually use in system mode is 64. Let us just assert that it fits within TARGET_PAGE_SIZE. For DC_GVA and STZGM, we want to be able to write whole bytes of tag memory, so assert that BS is >= 2 * TAG_GRANULE, or 32. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20200626033144.790098-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) -- 2.20.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d9b8ec791ed..d9876337c05 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1758,6 +1758,30 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) } #endif + if (tcg_enabled()) { + int dcz_blocklen = 4 << cpu->dcz_blocksize; + + /* + * We only support DCZ blocklen that fits on one page. + * + * Architectually this is always true. However TARGET_PAGE_SIZE + * is variable and, for compatibility with -machine virt-2.7, + * is only 1KiB, as an artifact of legacy ARMv5 subpage support. + * But even then, while the largest architectural DCZ blocklen + * is 2KiB, no cpu actually uses such a large blocklen. + */ + assert(dcz_blocklen <= TARGET_PAGE_SIZE); + + /* + * We only support DCZ blocksize >= 2*TAG_GRANULE, which is to say + * both nibbles of each byte storing tag data may be written at once. + * Since TAG_GRANULE is 16, this means that blocklen must be >= 32. + */ + if (cpu_isar_feature(aa64_mte, cpu)) { + assert(dcz_blocklen >= 2 * TAG_GRANULE); + } + } + qemu_init_vcpu(cs); cpu_reset(cs);