From patchwork Wed Jun 3 01:12:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187413 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp73345ilo; Tue, 2 Jun 2020 18:19:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfXFVQJCPZJDX8DCd/8CAOhmHx/ZhZFUiuvxScDPrbh3ShqveKxdlAMG5sstR+g0CgvKkJ X-Received: by 2002:a25:d8d5:: with SMTP id p204mr33188417ybg.28.1591147199020; Tue, 02 Jun 2020 18:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591147199; cv=none; d=google.com; s=arc-20160816; b=qx0va6KbgX5hTgib0oknp/V0H+o/qWsxnYDuo0R5bgMsDh2/iL7lNY7JrDMT9sxwsq IzvO5wUpWgQ1Q01TGz4WoMdg8F2L+F05cUyLDVZOPW4AeTWhcB3EXMwzWjauNLTp1fxv kzrTW91yl9oHTdS0IanvYI3zg0uzqJwXOB0RSuGmGkN3ceAEOG3VQvFXJNySeVL2SuJN giXQsOseblsrkHZeNgKQm3/1qoMnRHRfdfbp6H/WRuODWpB/YjVkI+KaadoVlOK2SitN DLqSQS1TPteESIRip3QcakFep4GuGqCUUl7WIV6EciVqX/Al7wGgS/BWaGyHrcaGBQI9 fSFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=C4qDuL752EiiSk3nsMH6iLKPjyLVOQMWVDOC2KEux/s=; b=aUM2jpYYhrb7/2rkNFMqmQOpK9+kJHA/RIgQbYPMQhoR0k18treMxYAYmncO4rkPjN uhs5OpKoa8dL3VkF0iRk1THLZTc0ngwpVzMZ1i2rFBhdLRRC4BA5vXWQjNy7XzE5UCkQ IRNGUhFh6236FGvPjemZ0ESADzTPzy8ddHa1tyjyztHHMl6AwVCAaFlIBUR4oXrZq5Ds eq0Mijs0YeCid41eiDQuOn8gQdITB6f8bq70m4YKtIHWtmY8hS+LxCDmQGUxKWahCIv7 Fs20uMaLIVK9A8RvLjfLC4L1K0qftCVVykx/Q8WNUnmamwkpNQ1X77vAHS6gATAsIp/3 WPjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AkB3uzpT; 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=fail (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 n63si349076ybc.276.2020.06.02.18.19.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jun 2020 18:19:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AkB3uzpT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgI4U-0007bs-4e for patch@linaro.org; Tue, 02 Jun 2020 21:19:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgHyW-00042o-7C for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:48 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:33271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgHyR-0003a2-5M for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:47 -0400 Received: by mail-pl1-x641.google.com with SMTP id t7so209481plr.0 for ; Tue, 02 Jun 2020 18:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4qDuL752EiiSk3nsMH6iLKPjyLVOQMWVDOC2KEux/s=; b=AkB3uzpTGuxEieVSjMGtHxWwJlZmAJJoRb0uBkEqwza+LNGxNHjYgyjCmUNVa0gd6t iSKf+2SNR57eagpHllanngZWVqzWfV0cRdc91jOJZt529NQFne0GYs2+0oyqWA9K5wz9 P0KZ6zE0EXyOJu5kCzNc/aJ/DyJ6avuxVcLBQZOpX3iYW5qqKGc4qC/nO3wIbpsmzx1W IGxzJK0uYMPZl3Y8AmsHqoxsmxLOeD0FAt5lGq5QYQQyCZVlaCMxt5aTMOmmyUDbAUkn DkanfPaCxZRqTS2Mc05PSHwKll2yGR3r80uJpQqCIKSPk8IzrML90PzwP+seXFevG7fa Na8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C4qDuL752EiiSk3nsMH6iLKPjyLVOQMWVDOC2KEux/s=; b=SREb6Ry3pcDxmIdd3ndAYx5baiVUZN8Px/gTEUnw/tyfsDi+DwDahaYYgC4BnhRzcH BVQlHMSb6pPdiU1xebubxFmfMw45kvhh6tZgYhSqfpi9RZgWJkMQpO/pRFG26Mf8y8F6 7uD5YlpXjTIhM3+mZ9J22QmFHZc2LNGeL4XlUiK2i1ENhAcFSVtf1GpEfKfCa3A8mWH2 iLCYgm207Vvzmp+64aWR9jm0wbaurj5NpRPLNyyksgl8+gvJZKBjDHEkhFIM0slHh+LT 3GiYpXc/eoclmF7QruHoGcruRMKFDBmvLwnaCb1HMg1TCWxkRfPr/cVRGSBTAnX3HyPH kung== X-Gm-Message-State: AOAM530lj3HWzjpVIxDZhwBWE6N6aA+KtH3QohPRrHAhOrmOuG7PbsRk kH3Whdt/vYMAUtty0TDE4SxPpRpleC8= X-Received: by 2002:a17:902:9a43:: with SMTP id x3mr27532907plv.332.1591146820716; Tue, 02 Jun 2020 18:13:40 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id 3sm290067pfe.85.2020.06.02.18.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 18:13:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 17/42] target/arm: Restrict the values of DCZID.BS under TCG Date: Tue, 2 Jun 2020 18:12:52 -0700 Message-Id: <20200603011317.473934-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200603011317.473934-1-richard.henderson@linaro.org> References: <20200603011317.473934-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.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_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: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, steplong@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0f1a46f531..8e6d4371cb 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1754,6 +1754,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);