From patchwork Fri Feb 3 10:05:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 650017 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp731024pva; Fri, 3 Feb 2023 02:06:57 -0800 (PST) X-Google-Smtp-Source: AK7set88hkDHAhn2hHjPc19ibxwBY2hnTLhxK8fgXX/xcmiF2omhD53n7zKvSOwIYbAX+UV7PjBf X-Received: by 2002:ac8:5886:0:b0:3b9:b297:5ec5 with SMTP id t6-20020ac85886000000b003b9b2975ec5mr16913365qta.13.1675418817424; Fri, 03 Feb 2023 02:06:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675418817; cv=none; d=google.com; s=arc-20160816; b=lt1Dlcq7hUpgkdkix9YizELoagAJGbJBUWbQo3s3bGIHqTkR5kjkw6wIwrPXG/29WC CO8539gvhDsrdgwRZ+Cx3eHng3Q/83IzpaIEEVRXHYuWu/iAQvjLAJeZFiWWEoP4mCXE w/9/rVng0uO5YC/4RiVWBm2RN/mjg5gZ0bW8OgSNxPKHNaanXg6KTb7htpc7NdHMjBHf dHLMHXWR1oQotSUlhtn+qtRM+TBxjUTkIR+5rUWaIp6+hisxXFhM+XZsurOFP5Lhztdl ELdh7mv0F43OkVoXcgmy+DBXC63MljfRVPYQuSpPs34pr47zRbmx9DKu65pxnzeb0aTr oGrQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=JIztgTFKNmYfw6eD33E2XqY06f9D3nI1NFOrxnPLPOA=; b=E0wT+1tOPhFsPmnGJGlogGN1Itn3cWnhJt48QwE3z1v2CVrg2B01SHDHpOpzV1tBKi 60I1KH/P2ck8qnSQV7prNtFxz8+S9zl+Lx05fDxQZa75CU/vHgu6iYdWNsDAMHQUnFKr LBKffYulGROIn5/br/VIZRLvHkBUY/k7vBffdte/wjoDOibKar28LRv+W+c3kLf7Ed2I rLF8Krrp/c93lV7SEWWwMIwLZz+9VtDmHaEAW+9uyKohgYSL6liJGdOB0uwWH/x+B6bF Ey+8wrUgVpWy7fcbNpjricMvFWV7mGHSQs8qyI2hCMHo22OOdbUwTBmvLq0B8UyLxUWY y5BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvCSjkHf; 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 1-20020a370501000000b007169c14b660si1800172qkf.167.2023.02.03.02.06.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 02:06:57 -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=FvCSjkHf; 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 1pNsxF-00065K-Tz; Fri, 03 Feb 2023 05:06: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 1pNsxE-00064T-AE for qemu-devel@nongnu.org; Fri, 03 Feb 2023 05:06:00 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNsxC-00084k-Mr for qemu-devel@nongnu.org; Fri, 03 Feb 2023 05:05:59 -0500 Received: by mail-wr1-x436.google.com with SMTP id y1so4171493wru.2 for ; Fri, 03 Feb 2023 02:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JIztgTFKNmYfw6eD33E2XqY06f9D3nI1NFOrxnPLPOA=; b=FvCSjkHfK4t9oEO5Ic9b/p6Ug5I0U25BAquq5L8AhswQqqUiDGx0kUd6uw7TsjBKVY LYSH5mfKMN8BQjrEQK3QcVQ8sveY3Kz7vlvdSZyELSjdCbRoELf/aB73cRuP0ugfcVMZ fuETkU8gmmcDyp2jhaVZAaZpjtWsQnQklEW1SNgaQ+XUd3SsvdN+B5JV8Dvy44qZLl0H qh39pwjrB+Fo4kpxrd4/xdgiK4rUTVt7FAJk7fZO51rOWWtQnW0XSaEeyAGazqXXHmsp 7MOe9NwTZ4ky6Moj73pJEC8PlsN0rgruuay5ILfbE3GAwQ1xlqz9ZYDHOcsd0XgtixOC KHrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JIztgTFKNmYfw6eD33E2XqY06f9D3nI1NFOrxnPLPOA=; b=II+Iuk7B1TrYqdNJXkifTAmrpih4TckA2rTnFBUQZfiMZwCYj7qdbXgwrrN/zOrutq xkeNcPg/vfD30+OtAWuR3sJ2CjVW7OM52Wr0E3Woc0O47CWY1gZVRh3HYTXssNCV5r45 q3gKE9lRtXEzc3LBcOdI5HRo4dm5gX4WpqxaVmAE9Jb0FMgPBTBXYw0jHcVA/ysnTvwD oUR7qpvgsyrL9tPDxRE4Zqqxaj7+vIOrW0xqcLIY6Nzcdv0MAgvMJolNMUtDXZOzw/1X jsLejrcUdZ3FWwwnNg8+QR8aiLR+X1ndIRhsvX6uaLJdo0xfT1p3S/I90JyV/n4bwT43 uM3w== X-Gm-Message-State: AO0yUKXOKDYMSylxlneXeKNH3l2gRiLzPw/Kgtjl3If17kXyknLJLRmF taYQjEmiyTXCchArMqJZO8CWMA== X-Received: by 2002:a5d:4389:0:b0:2c3:d719:4fb with SMTP id i9-20020a5d4389000000b002c3d71904fbmr1544879wrq.43.1675418756831; Fri, 03 Feb 2023 02:05:56 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id o1-20020a5d4a81000000b002c3d67aac74sm980093wrq.88.2023.02.03.02.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 02:05:56 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EF8E31FFB7; Fri, 3 Feb 2023 10:05:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Ilias Apalodimas , Peter Maydell Subject: [RFC PATCH] target/arm: disable FEAT_SME if we turn off SVE Date: Fri, 3 Feb 2023 10:05:51 +0000 Message-Id: <20230203100551.2445547-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 Before this change booting a -cpu max,sve=off would trigger and assert: qemu-system-aarch64: ../../target/arm/helper.c:6647: sve_vqm1_for_el_sm: Assertion `sm' failed. when the guest attempts to write to SMCR which shouldn't even exist if SVE has been turned off. Signed-off-by: Alex Bennée Cc: Ilias Apalodimas --- target/arm/cpu64.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 0e021960fb..a38d43421a 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -409,6 +409,13 @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) t = cpu->isar.id_aa64pfr0; t = FIELD_DP64(t, ID_AA64PFR0, SVE, value); cpu->isar.id_aa64pfr0 = t; + + /* FEAT_SME requires SVE, so disable it if no SVE */ + if (!value) { + t = cpu->isar.id_aa64pfr1; + t = FIELD_DP64(t, ID_AA64PFR1, SME, 0); + cpu->isar.id_aa64pfr1 = t; + } } void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)