From nobody Sat Nov 23 20:07:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731433180; cv=none; d=zohomail.com; s=zohoarc; b=SbF8ifMNNHzgBkRE9E1XHG5e+8/29kWO54rhLctQOxTgPoOUWio7hhEDQ2Tx+jV5qCI0T2hJBE4rUMYOXJJF+eT5lAwy7k87kdkzH5cN9p+hld/sKsTJ6w8tIwQfLkGRMvzr/qcvy/AKmmnvfZDIohxeU0MIf29Kez5RqURZwEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731433180; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Vgup44yY9AzwZEVS1bUWUEFU3T5oYiAM4TzncaEuWhY=; b=cCTyUaDxG83cma7Loc/X3C8gXkKlB4Yd0eC+nD8WYubI6iRzCWfDlzecl5ODbhYZ31MHmX0/MC5wrKDRN6bUeXkizoTEcWpHV8h4ejthUdzq3iXGNPnubw9l3ZFpWUgFRlyaz5gyId4ZCc7Yfe44uVzW3eGyzkWE4FOQCwHw6sM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731433180945676.0977747715597; Tue, 12 Nov 2024 09:39:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAupg-0003Kp-2G; Tue, 12 Nov 2024 12:37: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 1tAtyO-0000LV-5R for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:37 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAtyK-0007NM-5U for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:35 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5cebbbbaeceso151336a12.3 for ; Tue, 12 Nov 2024 08:42:29 -0800 (PST) Received: from L-H2N0CV05D839062.. ([193.104.68.137]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c8130dsm6137004a12.88.2024.11.12.08.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 08:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731429748; x=1732034548; darn=nongnu.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=Vgup44yY9AzwZEVS1bUWUEFU3T5oYiAM4TzncaEuWhY=; b=KO9dqpuWlRvL1/Z32AzVagNn5Jma3G39o1HnM73kWREs6Z1FelkRFI6Ep3bSjtivtK ccLQByFssLsJh4GMlAPHM6AvWJqzOMaU4Ayml39WMwBWk8Kz2F6z8kRJQCSgV03Xz07A 6XhfeJ+w8yxDlWPrQCEtz//RS6Hz+BhvSEL9YmQDUK3G/0B7ovDfUwrkHT9BGpnUMgKd A01cwJbk4AYSq2WFbZWoYOCjhNO6Sfvibwm+c3g6ZjSg4n6vycIM3vOOVonJLAVnTzrQ Sye9LchpZD6zYMnYu+sxDZ+4DNYyrpASOeSnZNv9az7MoaOuLOv+xR6WhrlWzspL19N3 9KHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731429748; x=1732034548; 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=Vgup44yY9AzwZEVS1bUWUEFU3T5oYiAM4TzncaEuWhY=; b=NLxacTOJOGAALgkDKv2LXc8ebiRPbZTK+kjBFg1rp5EGXc0SIVybUTMf16ddzKOBO/ DFdLR/VnrowXoNFP4+rceUeKRvK1YOOm2azPXxUmBbPuT2RS/HYIVnCUHWBkNj0xdH9V YTaQLfX70rXNyEWfnDFvuhLdCb+mhGXHSLb/xFbuHOwSWDNRwwdu+UuIg8nhp6/9YNgK ETQdY1TxNie7kFlos+S3JkqJIHuH/vLACwNKERatHxMjKho0TpZABUxXkORN20bAL1Gn qftqzcjGAefxNdM0+Fr2UZSqDw8oU70rUUCvmbvyISCYuxWLYDlLySKSGW2i5/wd7+pS SAkQ== X-Gm-Message-State: AOJu0YxLNb19dwW+EDKP5W+UU9QpP+bsaeEg4HU8TMYfhn/KXux7DnJP RYAExWk3cSt9RCYvJ+P1kGp08PzHla18PlpoBQUWBGLNPu0ELSPwigMD/TC+ X-Google-Smtp-Source: AGHT+IHhX+C/lp1sAo0GZbwBR0i23l0Jcn66J0OZJfXehj8od43wXyo0aKSbyX/QAJ7at2NrQvb2eg== X-Received: by 2002:a05:6402:5213:b0:5ce:fa24:fbaf with SMTP id 4fb4d7f45d1cf-5cf0a45c722mr5456318a12.9.1731429747584; Tue, 12 Nov 2024 08:42:27 -0800 (PST) From: Aleksandar Rakic X-Google-Original-From: Aleksandar Rakic To: qemu-devel@nongnu.org Cc: aleksandar.rakic@htecgroup.com, djordje.todorovic@htecgroup.com, cfu@mips.com, arikalo@gmail.com, peter.maydell@linaro.org, philmd@linaro.org, aurelien@aurel32.net, jiaxun.yang@flygoat.com, kwolf@redhat.com, hreitz@redhat.com, pbonzini@redhat.com, alex.bennee@linaro.org, pierrick.bouvier@linaro.org, berrange@redhat.com, Yongbok Kim , Aleksandar Markovic Subject: [PATCH v3 1/4] Add support for emulation of CRC32 instructions Date: Tue, 12 Nov 2024 17:41:27 +0100 Message-Id: <20241112164130.2396737-3-aleksandar.rakic@htecgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> References: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=rakicaleksandar1999@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Tue, 12 Nov 2024 12:37:38 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731433183398116600 Content-Type: text/plain; charset="utf-8" Add emulation of MIPS' CRC32 (Cyclic Redundancy Check) instructions. Reuse zlib crc32() and Linux crc32c(). Cherry-picked 4cc974938aee1588f852590509004e340c072940 from https://github.com/MIPS/gnutools-qemu Signed-off-by: Yongbok Kim Signed-off-by: Aleksandar Markovic Signed-off-by: Aleksandar Rakic Reviewed-by: Aleksandar Rikalo --- target/mips/helper.h | 2 ++ target/mips/meson.build | 1 + target/mips/tcg/op_helper.c | 26 ++++++++++++++++++++++++++ target/mips/tcg/rel6.decode | 5 +++++ target/mips/tcg/rel6_translate.c | 14 ++++++++++++++ target/mips/tcg/translate.c | 25 +++++++++++++++++++++++++ target/mips/tcg/translate.h | 3 +++ 7 files changed, 76 insertions(+) diff --git a/target/mips/helper.h b/target/mips/helper.h index 0f8462febb..752748d5e6 100644 --- a/target/mips/helper.h +++ b/target/mips/helper.h @@ -21,6 +21,8 @@ DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(dbitswap, TCG_CALL_NO_RWG_SE, tl, tl) #endif =20 +DEF_HELPER_3(crc32, tl, tl, tl, i32) +DEF_HELPER_3(crc32c, tl, tl, tl, i32) DEF_HELPER_FLAGS_4(rotx, TCG_CALL_NO_RWG_SE, tl, tl, i32, i32, i32) =20 /* microMIPS functions */ diff --git a/target/mips/meson.build b/target/mips/meson.build index a26d1e1f79..d2d686fc0c 100644 --- a/target/mips/meson.build +++ b/target/mips/meson.build @@ -7,6 +7,7 @@ mips_ss.add(files( 'gdbstub.c', 'msa.c', )) +mips_ss.add(zlib) =20 if have_system subdir('sysemu') diff --git a/target/mips/tcg/op_helper.c b/target/mips/tcg/op_helper.c index 65403f1a87..22600697f0 100644 --- a/target/mips/tcg/op_helper.c +++ b/target/mips/tcg/op_helper.c @@ -25,6 +25,8 @@ #include "exec/exec-all.h" #include "exec/memop.h" #include "fpu_helper.h" +#include "qemu/crc32c.h" +#include =20 static inline target_ulong bitswap(target_ulong v) { @@ -143,6 +145,30 @@ target_ulong helper_rotx(target_ulong rs, uint32_t shi= ft, uint32_t shiftx, return (int64_t)(int32_t)(uint32_t)tmp5; } =20 +/* these crc32 functions are based on target/arm/helper-a64.c */ +target_ulong helper_crc32(target_ulong val, target_ulong m, uint32_t sz) +{ + uint8_t buf[8]; + target_ulong mask =3D ((sz * 8) =3D=3D 64) ? + (target_ulong) -1ULL : + ((1ULL << (sz * 8)) - 1); + + m &=3D mask; + stq_le_p(buf, m); + return (int32_t) (crc32(val ^ 0xffffffff, buf, sz) ^ 0xffffffff); +} + +target_ulong helper_crc32c(target_ulong val, target_ulong m, uint32_t sz) +{ + uint8_t buf[8]; + target_ulong mask =3D ((sz * 8) =3D=3D 64) ? + (target_ulong) -1ULL : + ((1ULL << (sz * 8)) - 1); + m &=3D mask; + stq_le_p(buf, m); + return (int32_t) (crc32c(val, buf, sz) ^ 0xffffffff); +} + void helper_fork(target_ulong arg1, target_ulong arg2) { /* diff --git a/target/mips/tcg/rel6.decode b/target/mips/tcg/rel6.decode index d6989cf56e..5074338aa5 100644 --- a/target/mips/tcg/rel6.decode +++ b/target/mips/tcg/rel6.decode @@ -16,11 +16,16 @@ =20 &r rs rt rd sa =20 +&special3_crc rs rt c sz + @lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &r +@crc32 ...... rs:5 rt:5 ..... c:3 sz:2 ...... &special3_crc =20 LSA 000000 ..... ..... ..... 000 .. 000101 @lsa DLSA 000000 ..... ..... ..... 000 .. 010101 @lsa =20 +CRC32 011111 ..... ..... 00000 ... .. 001111 @crc32 + REMOVED 010011 ----- ----- ----- ----- ------ # COP1X (COP3) =20 REMOVED 011100 ----- ----- ----- ----- ------ # SPECIAL2 diff --git a/target/mips/tcg/rel6_translate.c b/target/mips/tcg/rel6_transl= ate.c index 59f237ba3b..423b323ba7 100644 --- a/target/mips/tcg/rel6_translate.c +++ b/target/mips/tcg/rel6_translate.c @@ -33,3 +33,17 @@ static bool trans_DLSA(DisasContext *ctx, arg_r *a) } return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa); } + +static bool trans_CRC32(DisasContext *ctx, arg_special3_crc *a) +{ + if (unlikely(!ctx->crcp) || + unlikely((a->sz =3D=3D 3) && + (!(ctx->hflags & MIPS_HFLAG_64))) || + unlikely((a->c >=3D 2))) { + gen_reserved_instruction(ctx); + return true; + } + gen_crc32(ctx, a->rt, a->rs, a->rt, + a->sz, a->c); + return true; +} diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index de7045874d..c97d1d37bd 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -13448,6 +13448,30 @@ static void decode_opc_special2_legacy(CPUMIPSStat= e *env, DisasContext *ctx) } } =20 +void gen_crc32(DisasContext *ctx, int rd, int rs, int rt, int sz, + int crc32c) +{ + TCGv t0; + TCGv t1; + TCGv_i32 tsz =3D tcg_constant_i32(1 << sz); + if (rd =3D=3D 0) { + /* Treat as NOP. */ + return; + } + t0 =3D tcg_temp_new(); + t1 =3D tcg_temp_new(); + + gen_load_gpr(t0, rt); + gen_load_gpr(t1, rs); + + if (crc32c) { + gen_helper_crc32c(cpu_gpr[rd], t0, t1, tsz); + } else { + gen_helper_crc32(cpu_gpr[rd], t0, t1, tsz); + } + +} + static void decode_opc_special3_r6(CPUMIPSState *env, DisasContext *ctx) { int rs, rt, rd, sa; @@ -15094,6 +15118,7 @@ static void mips_tr_init_disas_context(DisasContext= Base *dcbase, CPUState *cs) ctx->abs2008 =3D (env->active_fpu.fcr31 >> FCR31_ABS2008) & 1; ctx->mi =3D (env->CP0_Config5 >> CP0C5_MI) & 1; ctx->gi =3D (env->CP0_Config5 >> CP0C5_GI) & 3; + ctx->crcp =3D (env->CP0_Config5 >> CP0C5_CRCP) & 1; restore_cpu_state(env, ctx); #ifdef CONFIG_USER_ONLY ctx->mem_idx =3D MIPS_HFLAG_UM; diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index 1bf153d183..cb27ae78ae 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -51,6 +51,7 @@ typedef struct DisasContext { bool abs2008; bool mi; int gi; + bool crcp; } DisasContext; =20 #define DISAS_STOP DISAS_TARGET_0 @@ -181,6 +182,8 @@ bool gen_lsa(DisasContext *ctx, int rd, int rt, int rs,= int sa); bool gen_dlsa(DisasContext *ctx, int rd, int rt, int rs, int sa); =20 void gen_rdhwr(DisasContext *ctx, int rt, int rd, int sel); +void gen_crc32(DisasContext *ctx, int rd, int rs, int rt, int sz, + int crc32c); =20 extern TCGv cpu_gpr[32], cpu_PC; #if defined(TARGET_MIPS64) --=20 2.34.1 From nobody Sat Nov 23 20:07:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731433194; cv=none; d=zohomail.com; s=zohoarc; b=ZwcamSnbw5HVlD/rjb2YqmNU8oqBAwf/VyRqP9AGPvVRy5kQaP3l2Kns62pQSmG42fpS47rSdyASHzI9QaJeys5Lq0GgDAdLnyiJVSlpqslLGzifPZHXa6TFBVITUONE5hd/nkkn9gqzNO02GGgKbNqSNgeLs3g5BxfeI8yoD5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731433194; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CoPkJ0wMhnW0S/o/HYXprlPhCaTxkHpkjlxptT6glCk=; b=ZTF9SpuOvR/8Z0qzbbhdcmrLPs+yzCgL/rkm9jTQD6IMOBOnmpGSPnvfxcNHHOI82TzNT7npgn6y5NGNrK5Mxs8Dv8q1QZFeDotpQOXGVlpW3jvEH+983dmDYMDNX2mNQDNc/buQ/37zxK/df3NJqyMg9Noge8FusKoEN3HVOI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731433194779137.32584206536478; Tue, 12 Nov 2024 09:39:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAupg-0003La-L8; Tue, 12 Nov 2024 12:37: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 1tAtyO-0000LU-5B for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:36 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAtyK-0007NS-5h for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:34 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5cf0ffe6db2so100652a12.3 for ; Tue, 12 Nov 2024 08:42:30 -0800 (PST) Received: from L-H2N0CV05D839062.. ([193.104.68.137]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c8130dsm6137004a12.88.2024.11.12.08.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 08:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731429749; x=1732034549; darn=nongnu.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=CoPkJ0wMhnW0S/o/HYXprlPhCaTxkHpkjlxptT6glCk=; b=ZVkF99iOze+yRupDJ4SD/IA4OlRespi0F3uOnXJhF3LzxLOoUaw8H8M1NLcTCSl0Ei sgtSJGpZZLHXnHH6e+HPRGvnj6NZR50p3+a+p2HwZjDNuIU3qITKrs5iZMN6iZH04lt9 SxSOa0EMocwFh/cSYLAa0DfYNnt/dtOBrSLN0bzqdfHsKNx+2Sp0Q0jtHgAz0tuvWycW UnbjGG+zUCmIIczSICiBhgB+vIdpOBFPqvHyR7fhRk5cUErjRlFudfn5HtcoqAwqUsN/ Uf7mZJkguTewITWmzF5DVav9kzFf+QC7RQIJ8zHF2QWV9u8r8f0FUQiY7mU7vRUNZYbj 23nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731429749; x=1732034549; 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=CoPkJ0wMhnW0S/o/HYXprlPhCaTxkHpkjlxptT6glCk=; b=koeMRu96/O/1luaavKRwnUFPtnJQ1sc4E/OYBU4XH2NP7NLUonMzvxLjrF75U0BmvB gbS5mnWQVInYMuSxoP8e88ZmEfe9+NHptKevbDttpnrVtiobafJXhhlQGJZSrVnZTF3F Nsj+1b6QX6rNHpu6tRBfzdVpbaXj1SJjnaucx1UVuLu7w7ediLoVb3/9D6BG0QUPWxMZ z32BqPuuQZNMo09Yyu8CWLvhtwzLZWYJGAwrazZkl5MsJK2lt/jinpnfCusTraB359oF +vLNJs9y5Ta9GtiQ3ieIAFm0oGLz8nyfZsxdYRquHyxQzussYJjSiw1d2EuFyq5gS7Tv k6Jw== X-Gm-Message-State: AOJu0YxPKPlaeT8HPynuQeM5u0po/WEG9BibrRf+22Fs9xjHiY4MG02r 3+9VnYdVFOoRzEyTwFmaBaJNrCK15Ofg2BxDZ0Z8dGJ5jqJz0PP2QkF7T3YK X-Google-Smtp-Source: AGHT+IGJj/z6S8yaqnOsrJ21WuYaAXFYiVMMms+v8ua1iGSfU3TLEhGWqFDWdQas1Et6WgqxGzPpWg== X-Received: by 2002:a05:6402:210a:b0:5ce:debb:6446 with SMTP id 4fb4d7f45d1cf-5cf0a446838mr5524957a12.8.1731429749233; Tue, 12 Nov 2024 08:42:29 -0800 (PST) From: Aleksandar Rakic X-Google-Original-From: Aleksandar Rakic To: qemu-devel@nongnu.org Cc: aleksandar.rakic@htecgroup.com, djordje.todorovic@htecgroup.com, cfu@mips.com, arikalo@gmail.com, peter.maydell@linaro.org, philmd@linaro.org, aurelien@aurel32.net, jiaxun.yang@flygoat.com, kwolf@redhat.com, hreitz@redhat.com, pbonzini@redhat.com, alex.bennee@linaro.org, pierrick.bouvier@linaro.org, berrange@redhat.com, Faraz Shahbazker Subject: [PATCH v3 2/4] Skip NaN mode check for soft-float Date: Tue, 12 Nov 2024 17:41:28 +0100 Message-Id: <20241112164130.2396737-4-aleksandar.rakic@htecgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> References: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=rakicaleksandar1999@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Tue, 12 Nov 2024 12:37:38 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731433195189116600 Content-Type: text/plain; charset="utf-8" Skip NaN mode check for soft-float since NaN mode is irrelevant if an ELF binary's FPU mode is soft-float, i.e. it doesn't utilize a FPU. Cherry-picked 63492a56485f6b755fccf7ad623f7a189bfc79b6 from https://github.com/MIPS/gnutools-qemu Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- linux-user/mips/cpu_loop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 462387a073..07c1ebe287 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -304,8 +304,10 @@ void target_cpu_copy_regs(CPUArchState *env, struct ta= rget_pt_regs *regs) if (env->insn_flags & ISA_NANOMIPS32) { return; } - if (((info->elf_flags & EF_MIPS_NAN2008) !=3D 0) !=3D - ((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) !=3D 0)) { + if (info->fp_abi !=3D MIPS_ABI_FP_SOFT + && ((info->elf_flags & EF_MIPS_NAN2008) !=3D 0) !=3D + ((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) !=3D 0)) + { if ((env->active_fpu.fcr31_rw_bitmask & (1 << FCR31_NAN2008)) =3D=3D 0) { fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n"= ); --=20 2.34.1 From nobody Sat Nov 23 20:07:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731433199; cv=none; d=zohomail.com; s=zohoarc; b=hmitduaQhu+bex5wqnPhZPwLiDAxX242vBbUda+CG9rl1UE6MI0pc+BaAH6xyXCupnmfeTv/Jo+JBCl4gAKRl4KlGUoIuLhJknxLjk/tjpfYIsosd68182lqmxHEs5ncn0Vsa/50jmXJCcMuo5u90FMEnBtTvAhwDQaP9g+yYa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731433199; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f+1BQf8G2eZx/1JinIHQgfkNWVxgozYsbBIWJv0+lgk=; b=G/3IbdWtMPrt/RGzVm0Y0H2Y9Vw39MEBgfnl1XrKLsT9J8bs0bwDFQEB7TPZTV2ol9jKnNVlOVFr/m8GxjjZcWq+OoQ4SMylB5ceGaLIocsuT3g37j5ylZIo2TjZ+41orYGajE+07RE0GoI8H3fs6aCeIoK//E+DMrWPIbYNidM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731433199029968.1683607724423; Tue, 12 Nov 2024 09:39:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAuph-0003Ln-1S; Tue, 12 Nov 2024 12:37:41 -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 1tAtyO-0000LX-5s for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:38 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAtyL-0007NZ-2K for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:35 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5c937982445so141335a12.2 for ; Tue, 12 Nov 2024 08:42:32 -0800 (PST) Received: from L-H2N0CV05D839062.. ([193.104.68.137]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c8130dsm6137004a12.88.2024.11.12.08.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 08:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731429751; x=1732034551; darn=nongnu.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=f+1BQf8G2eZx/1JinIHQgfkNWVxgozYsbBIWJv0+lgk=; b=OmNQt2srF2PwwWbrMnxmoquqqmRSOT0sstN8lkl+aIRKLre43lGgw12M+0QIBAozbR 1QXpIndiw9BrrDLy2Ar7baXDllsEGBhf8fjPjwV9FWgqccd4o7EmSxX/FRbiu6Ehwg+c HzOLItf3/gPrdO98Hc1OwYSVB+0Pagj2Vq4LEDfYoAtaNiFZUSxl9lDsltljo8MssY/D QSzbmQCxL7Tnz6kTPR1Vy/BuxLvNK7ujMFvsDJd/Eu2RZDbEz6g31sY3Gm6BZdz6PFMl R51e/QDITS3NgBkQZ96fR2EuUj9cxDQbpOQE3Le3kzf6XxufzGh30GGVHB93tNygq2sX GCpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731429751; x=1732034551; 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=f+1BQf8G2eZx/1JinIHQgfkNWVxgozYsbBIWJv0+lgk=; b=iCBYA2FRVTwVwxztkBgUDZ9JBJdhmokAH+Dduf/8r5LGVRpwmkVUqr6xVWc4BtY+ED ExJH07pzq2MMLz5IeNfzpsVlSUqUspZ/2sZrIcyb2dr01VHhVPIAsK7Oyc28KK6IKrAw VAdxjNcUBIe0/JzhiisADevraCBTcLE/GUZgUDrA+mOaSEp49VVY0qBoOQzirt3WwCXU rBzD1Bndq2SSUxk9+kMw1HPrWgHpFBbtA7aZlcPVRp+C9lf/WX/gBtlA/WDclSvHBB1c wrFzjPKmftPnGEjgNNEWmoVkGMe/PYT2Y/83xjU0wQf+opLBYTaOMzlpGLjZj8roRjeC wo4A== X-Gm-Message-State: AOJu0YwBMRQyZyC07y54Rg0gGvUahQNjXgcejh75Vkpyuw3aK+v+jonh tR+XLFrUDU3zbdaMURjx53uJnWnyvsDGI4TlEE0lm8laJp3sWe3L+5s+lhLL X-Google-Smtp-Source: AGHT+IExJQ3f831p0cGzbLoPqrRATvDEd164hjnR4PzOXE6kSKaCbXgeZPoDYQO2bcIBVSsBpfFscQ== X-Received: by 2002:a05:6402:5213:b0:5ce:fa24:fbaf with SMTP id 4fb4d7f45d1cf-5cf0a45c722mr5456386a12.9.1731429750874; Tue, 12 Nov 2024 08:42:30 -0800 (PST) From: Aleksandar Rakic X-Google-Original-From: Aleksandar Rakic To: qemu-devel@nongnu.org Cc: aleksandar.rakic@htecgroup.com, djordje.todorovic@htecgroup.com, cfu@mips.com, arikalo@gmail.com, peter.maydell@linaro.org, philmd@linaro.org, aurelien@aurel32.net, jiaxun.yang@flygoat.com, kwolf@redhat.com, hreitz@redhat.com, pbonzini@redhat.com, alex.bennee@linaro.org, pierrick.bouvier@linaro.org, berrange@redhat.com Subject: [PATCH v3 3/4] target/mips: Enable MSA ASE using a CLI flag Date: Tue, 12 Nov 2024 17:41:29 +0100 Message-Id: <20241112164130.2396737-5-aleksandar.rakic@htecgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> References: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=rakicaleksandar1999@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Tue, 12 Nov 2024 12:37:38 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731433201151116600 Content-Type: text/plain; charset="utf-8" Enable MSA ASE using a CLI flag -cpu ,msa=3Don. Signed-off-by: Aleksandar Rakic --- target/mips/cpu.c | 16 ++++++++++++++++ target/mips/cpu.h | 1 + target/mips/internal.h | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index d0a43b6d5c..8e12d303de 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -494,8 +494,24 @@ static void mips_cpu_realizefn(DeviceState *dev, Error= **errp) mcc->parent_realize(dev, errp); } =20 +static bool mips_get_msa_on(Object *obj, Error **errp) +{ + MIPSCPU *cpu =3D MIPS_CPU(obj); + CPUMIPSState *env =3D &cpu->env; + return env->msa_on; +} + +static void mips_set_msa_on(Object *obj, bool value, Error **errp) +{ + MIPSCPU *cpu =3D MIPS_CPU(obj); + CPUMIPSState *env =3D &cpu->env; + env->msa_on =3D value; +} + static void mips_cpu_initfn(Object *obj) { + object_property_add_bool(obj, "msa", mips_get_msa_on, mips_set_msa_on); + object_property_set_bool(obj, "msa", false, NULL); MIPSCPU *cpu =3D MIPS_CPU(obj); CPUMIPSState *env =3D &cpu->env; MIPSCPUClass *mcc =3D MIPS_CPU_GET_CLASS(obj); diff --git a/target/mips/cpu.h b/target/mips/cpu.h index f6877ece8b..3e636535c6 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1191,6 +1191,7 @@ typedef struct CPUArchState { QEMUTimer *timer; /* Internal timer */ Clock *count_clock; /* CP0_Count clock */ target_ulong exception_base; /* ExceptionBase input to the core */ + bool msa_on; /* Enable MSA using a CLI flag -cpu ...,msa=3Don/off */ } CPUMIPSState; =20 /** diff --git a/target/mips/internal.h b/target/mips/internal.h index 91c786cff8..bbe2acffe2 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -399,7 +399,7 @@ static inline void compute_hflags(CPUMIPSState *env) } } if (ase_msa_available(env)) { - if (env->CP0_Config5 & (1 << CP0C5_MSAEn)) { + if ((env->CP0_Config5 & (1 << CP0C5_MSAEn)) || (env->msa_on)) { env->hflags |=3D MIPS_HFLAG_MSA; } } --=20 2.34.1 From nobody Sat Nov 23 20:07:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731433116; cv=none; d=zohomail.com; s=zohoarc; b=gdSveQv1P6gU/NqY4ynOQ7fe0cLtIqlGqPuhMLaQ2/zrBCltadCEfkjfjzhh7qC1p7UNdCsZ/UIVttyDDKmjG+3p353OyOk6WuFJ6GGm4esO+YAWKRwEBj92OJdMadf2BciL3zpxPJgjbfoREk9okMm7ZZT1fJ16nY29z9HsUcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731433116; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WRUAZltYZCx2K3m7pNvdKL4Y2gbZxFyPpCK3IX9jN3U=; b=cRhEWE/roWXK3tnk3aElyrEDPC1F3UZsWImh9pnYmyB30G7bcgtlLsUFTiPTG92N7K88oSMWEusy6io8PudA9SIvO05q+9Sq26HEMPVf5l46j6NTWXdGZNPqzw2MMOJVtnp1mWsJBB3ELTP5WrMroRa4TcmMM5sJEcF2VS+CNJI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731433116337288.4289590390506; Tue, 12 Nov 2024 09:38:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAuph-0003Lw-KZ; Tue, 12 Nov 2024 12:37:41 -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 1tAtyS-0000Lv-0I for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:40 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAtyO-0007Ny-2l for qemu-devel@nongnu.org; Tue, 12 Nov 2024 11:42:39 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5cec9acefb8so436352a12.3 for ; Tue, 12 Nov 2024 08:42:35 -0800 (PST) Received: from L-H2N0CV05D839062.. ([193.104.68.137]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c8130dsm6137004a12.88.2024.11.12.08.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 08:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731429753; x=1732034553; darn=nongnu.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=WRUAZltYZCx2K3m7pNvdKL4Y2gbZxFyPpCK3IX9jN3U=; b=Nz8rEq7tAoWNalMDgwiu62T3RXDgu+A/Sp1olX7C+Mi5DKK9rZYQY7sxED62t2oaLi mZtDcpOIOamB2YniSP8r73VL2pf4IH4aMLG7CMGgY0I8ptehShK26QCYKqaMbwkgbz0z 6x2qLav5GiD1RvBKy8eJbGFlXBhwbI/LuDmP04SMrbOnKH1UgFOK6Ys+EIK67xtpEJXY pJ+ywOlNxHTD+n9LtdASrqNFqCeFh9NEjoRCK3og1/mS+Ula9UDLCV8pLswgMwaUFW1H 5uewpvs+G/XfxTTQTtMLBhbcxwy9ODmsaZBSq/vU+4ITLKitebB3+k2jeKbqng1QAYWX d+/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731429753; x=1732034553; 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=WRUAZltYZCx2K3m7pNvdKL4Y2gbZxFyPpCK3IX9jN3U=; b=h7BYNewsD5Wh44nRTitLNI5wkKo8pm8dFkUTkx1WpmxZr9eWgp68h26kvUD7Q93SA7 /TY/ahtkW87R8uRmUFgaplbvGK0d80rL4WPW9m4MXy7pZTx8DFzb5JshdBZHTLOtWeBG QB3E8m0iCNkpqg8yI9n7bmUP5Lex3AawWOC+D/0d6JQ7qW3wh538BpBGQPZLvqqwLSe2 jtEl/n5mlMjTuOxauLAMqBCd+iFtucj/9cvgdPX3B7R6OnUkyZ4w4JQAUJVhiUoBzCGj HAaupEMlBtwuFEMZBevQcANQyWOH++e+hfQimR3Twc6pOqecXqrRqOfPxBzvjZZioug+ t1MQ== X-Gm-Message-State: AOJu0YwB7kzn8mHjFdu3y+I/hrahoHh8OCaNQEmzF5VFwz3WRX49zkoA rc434HhmABnTVrP1ZgjcfsMGuKQMpOZH+l1y5nxN12yNZIWbLsb7bHMfasIT X-Google-Smtp-Source: AGHT+IEJr0ShrYl5CNYi9tWuUsJRY7ryOB/z4PRYxEoJKvMGj19DzA9QIECemvHvBCu6QhQGl9RGJw== X-Received: by 2002:a05:6402:2794:b0:5ce:d264:a425 with SMTP id 4fb4d7f45d1cf-5cf0a32021cmr5026346a12.5.1731429753380; Tue, 12 Nov 2024 08:42:33 -0800 (PST) From: Aleksandar Rakic X-Google-Original-From: Aleksandar Rakic To: qemu-devel@nongnu.org Cc: aleksandar.rakic@htecgroup.com, djordje.todorovic@htecgroup.com, cfu@mips.com, arikalo@gmail.com, peter.maydell@linaro.org, philmd@linaro.org, aurelien@aurel32.net, jiaxun.yang@flygoat.com, kwolf@redhat.com, hreitz@redhat.com, pbonzini@redhat.com, alex.bennee@linaro.org, pierrick.bouvier@linaro.org, berrange@redhat.com, Faraz Shahbazker Subject: [PATCH v3 4/4] target/mips: Enable MSA ASE for mips64R2-generic Date: Tue, 12 Nov 2024 17:41:30 +0100 Message-Id: <20241112164130.2396737-6-aleksandar.rakic@htecgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> References: <20241112164130.2396737-1-aleksandar.rakic@htecgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=rakicaleksandar1999@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Tue, 12 Nov 2024 12:37:38 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731433116733116600 Content-Type: text/plain; charset="utf-8" Enable MSA ASE for mips64R2-generic CPU. Cherry-picked 60f6ae8d3d685ba1ea5d301222fb72b67f39264f from https://github.com/MIPS/gnutools-qemu Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- target/mips/cpu-defs.c.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc index 922fc39138..e77a327422 100644 --- a/target/mips/cpu-defs.c.inc +++ b/target/mips/cpu-defs.c.inc @@ -678,7 +678,9 @@ const mips_def_t mips_defs[] =3D (2 << CP0C1_DS) | (4 << CP0C1_DL) | (3 << CP0C1_DA)= | (1 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), .CP0_Config2 =3D MIPS_CONFIG2, - .CP0_Config3 =3D MIPS_CONFIG3 | (1 << CP0C3_LPA), + .CP0_Config3 =3D MIPS_CONFIG3 | (1 << CP0C3_LPA) | + (1 << CP0C3_VInt) | (1 << CP0C3_MSAP), + .CP0_Config5_rw_bitmask =3D (1 << CP0C5_MSAEn), .CP0_LLAddr_rw_bitmask =3D 0, .CP0_LLAddr_shift =3D 0, .SYNCI_Step =3D 32, --=20 2.34.1