From patchwork Mon Jan 22 14:55:51 2024 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: 13525578 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 752D440C15 for ; Mon, 22 Jan 2024 14:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935375; cv=none; b=rZ59rGydlhX+ZBi5wvzd5X2A0+LWF9Sa5cNJxFoWu7xHjazb9NzSN7YlczIcAKyR6BsBCKdvYdpawfz3mpngkRYX1PQxZCiszdrssjhlGYCwlT2bHVGzi+1JzZ6XaavXlLW7Geo0yx9/OtX+ii1UxPSl+E90P7QEn33E8YtCnIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935375; c=relaxed/simple; bh=/q3WotByoMxOEGevneI3urcma2zOpwILzd6qjtA+yw0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=AwcOZwbyZ35WiBWDSymarv+//jt2qJb2Sdt6hG9ZhPlelfJFJAp6G9AqBwogiLsfddZc0y5OJJUA/fe+/NKZm03li6KGlbOODL2FIpNomN0q19oKrQtK1cUKFwkJ1mcNbwZzgjRxv5h5bKhYcPGC6ORpjJhoUCdxR/GCaXgJQ50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ONeNU7lb; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ONeNU7lb" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40e76626170so37300055e9.2 for ; Mon, 22 Jan 2024 06:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705935371; x=1706540171; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IRv4SBF4SdvyJZdy4aQdPUfxtEWcXSgRKnlpZ6CRBD8=; b=ONeNU7lbeScXfA5GrFS9LuTjZXRS1/lyxzJN6vSOBsiPSwFy2WtZXz0M5Rzshu56yL w2CnkEgDfckI0C2gKE+pnEAsGhysDLvPHs0/4hB7hiaD1Qu4Wrlir9WCQtTV3pRCKJyg IVgrzRZu2M8UHlKAb8kfK25rTTj1knRD5jdF85FsUAe19Ek8WZsAJFvSCa+M0IVuHsj1 XWYkPpQRFfLLO5/rONwR/f2/zf3pOCD56wOixWcCaCtW7qJS59XNwMVzMsU+BVLLDNcJ gWtVfUiSdF2oCt0n+iBG2L8AWdg0lF0yMUXy6Qlzxms8rvci799AqiFTWPmtSTy3gg2k +CBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705935371; x=1706540171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IRv4SBF4SdvyJZdy4aQdPUfxtEWcXSgRKnlpZ6CRBD8=; b=msLazkNRHtsz1GofXjzj5G5m+g0udj6uQTIFJEfvXLyQPwUwVj6ZwZRL688nBlujpc WBx5buRVDnYL0SWlYRVaDdN6fS9GjdVGl8NPFWFNo9rxkmujZiTpBXKuLXj90r2yYNCb xeegJgldqeIrUT6OBX284auYEMXKoaBdhsTuLrWgxRobCV6fMyb7/ATKpJxFkSWXtJaW wW7RM4/3OEjSJ3d4uivUpuoOUFKiUwOuP3Bp9GR+B/bBf1f+skK6gby9hz3WlDDZ2jRB 7QrjN0GBA3QR/Ve7hEBI4dVmIgyql0CC8+kKZ3p/y66AP5DdjPW9/WUpGk0eBh5zEeDW Zh+w== X-Gm-Message-State: AOJu0YydWAM19Mfip8yukPfnSxF9SPGphGkSNemCSjQEdj06gQPInhHn GJAtMHlhyyH7xtvkvSb05qrpLM9IuUlmybuec859MC63s2ppy1djsGZv4g+FzNw= X-Google-Smtp-Source: AGHT+IEI/8OQuTgWAAtHYY/RGBmmrjbYNv2PqtIPslS/7kIEuhat1NwmamoxH19fkcYhs5XBsdqGHA== X-Received: by 2002:a7b:ce8f:0:b0:40e:4db4:9c4a with SMTP id q15-20020a7bce8f000000b0040e4db49c4amr2500364wmj.50.1705935371725; Mon, 22 Jan 2024 06:56:11 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c35c700b0040d1bd0e716sm39720140wmq.9.2024.01.22.06.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:56:11 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F37E45F8F7; Mon, 22 Jan 2024 14:56:10 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Edgar E. Iglesias" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Michael Rolnik , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Laurent Vivier , kvm@vger.kernel.org, Yoshinori Sato , Pierrick Bouvier , Palmer Dabbelt , Liu Zhiwei , Laurent Vivier , Yanan Wang , qemu-ppc@nongnu.org, Weiwei Li , qemu-s390x@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?C=C3=A9dri?= =?utf-8?q?c_Le_Goater?= , Peter Maydell , Alexandre Iooss , John Snow , Mahmoud Mandour , Wainer dos Santos Moschetta , Richard Henderson , Ilya Leoshkevich , Alistair Francis , David Woodhouse , Cleber Rosa , Beraldo Leal , Bin Meng , Nicholas Piggin , Aurelien Jarno , Daniel Henrique Barboza , Daniel Henrique Barboza , Thomas Huth , David Hildenbrand , qemu-riscv@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , Song Gao , Eduardo Habkost , Brian Cain , Paul Durrant , Akihiko Odaki Subject: [PATCH v3 02/21] target/riscv: Remove misa_mxl validation Date: Mon, 22 Jan 2024 14:55:51 +0000 Message-Id: <20240122145610.413836-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240122145610.413836-1-alex.bennee@linaro.org> References: <20240122145610.413836-1-alex.bennee@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Akihiko Odaki It is initialized with a simple assignment and there is little room for error. In fact, the validation is even more complex. Signed-off-by: Akihiko Odaki Acked-by: LIU Zhiwei Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis Message-Id: <20240103173349.398526-24-alex.bennee@linaro.org> Message-Id: <20231213-riscv-v7-2-a760156a337f@daynix.com> Signed-off-by: Alex Bennée --- target/riscv/tcg/tcg-cpu.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 994ca1cdf9f..635b5fae576 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -268,7 +268,7 @@ static void riscv_cpu_validate_misa_priv(CPURISCVState *env, Error **errp) } } -static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp) +static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu) { RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu); CPUClass *cc = CPU_CLASS(mcc); @@ -288,11 +288,6 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp) default: g_assert_not_reached(); } - - if (env->misa_mxl_max != env->misa_mxl) { - error_setg(errp, "misa_mxl_max must be equal to misa_mxl"); - return; - } } static void riscv_cpu_validate_priv_spec(RISCVCPU *cpu, Error **errp) @@ -932,7 +927,6 @@ static bool riscv_cpu_is_vendor(Object *cpu_obj) static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp) { RISCVCPU *cpu = RISCV_CPU(cs); - Error *local_err = NULL; if (!riscv_cpu_tcg_compatible(cpu)) { g_autofree char *name = riscv_cpu_get_name(cpu); @@ -941,14 +935,11 @@ static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp) return false; } - riscv_cpu_validate_misa_mxl(cpu, &local_err); - if (local_err != NULL) { - error_propagate(errp, local_err); - return false; - } + riscv_cpu_validate_misa_mxl(cpu); #ifndef CONFIG_USER_ONLY CPURISCVState *env = &cpu->env; + Error *local_err = NULL; CPU(cs)->tcg_cflags |= CF_PCREL;