From nobody Tue Nov 18 02:53:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.208.68 as permitted sender) client-ip=209.85.208.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1607120792; cv=none; d=zohomail.com; s=zohoarc; b=TqUEOTG+qJzqGOtaiSvkQ5mNFNNTMcMjNlhq1LbJr9m+5hr+tm+Rmsc7lsL014gV23dIq4LD8n/qy+Rs1DG8heqAiWCHIUiHC8uqyWXm0rBHCkpJ8aN1mgwZ5jbvbAV66Mw0MoMSzMDb4NGxMQpnJIjVyUTzKolNk0NgPXn7qs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607120792; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JGlIiXLZJkT4GiPWL5pmDBgkId7TCXyztkSEPETsoi4=; b=NIxCMuNIwLGtkVFch4NTu3RHOaWIoxwp3YQIgkQKT5vnA1a03zstU/O2/+4sZoxaMxnm4hp4hfYfVFV133RxyPEaze82kSc+o+/Mj5USk53gEAv10nnqs+cWDIJSopbze8muJkb2Xq0IxbLHX0CKfhnFXoAcmsBRe6bXCf5JgwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by mx.zohomail.com with SMTPS id 1607120792335258.0463421841423; Fri, 4 Dec 2020 14:26:32 -0800 (PST) Received: by mail-ed1-f68.google.com with SMTP id dk8so4563845edb.1 for ; Fri, 04 Dec 2020 14:26:31 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (111.red-88-21-205.staticip.rima-tde.net. [88.21.205.111]) by smtp.gmail.com with ESMTPSA id ch30sm4318562edb.8.2020.12.04.14.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JGlIiXLZJkT4GiPWL5pmDBgkId7TCXyztkSEPETsoi4=; b=DFk79CltjsKdhEIvMgOg+QcNzNhGu6ffDSNsM5SZSPpGhjCrpJiIM0D37AdmNdJ+oI gm5xQAHdWZEiNCJhdTRpqjoy9ECjC6N+SyDqTRZ7whMwWSS0KD4OEZmTKJNz/zXC9fRQ By9ZW3M2V6qQqnePuwdPxpbOX81kyY5q9UUAkYZdi9dQXqwXbC6gkQT0gIuMcoTsm9X7 xEOcLJjI+pj7vVaX+0LfALoAdStq8DoYrrj2oqsGFujtMBYb3HGpz12POEBRcJmFHRS6 1JGrTupLS1GsuuMueUWfEqCDPk2UX9ikyzszqTtHA0r2KxoTcY0XX771klRC18GDjFWl J0rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=JGlIiXLZJkT4GiPWL5pmDBgkId7TCXyztkSEPETsoi4=; b=OWY/4QWjUvVk3KLNanrcZBRZ3CxIySBS5WCErtwJQwCJ3e0txHMV2O5Doat6FNvA86 QF/8M974hE1kuP55STWA+8llkIkVLRHHw+l486bHBpxzYSIpq81Dtz3R50/me9XptxLa fAnBD6AaDeeikjkzrKSaoac0EW9fnDIWbkATsTwTtYTDelXBle90oubk+TrYlkNCoPgu 3Idfapdu+aqyG60nRASrEWEy9oqwUCQBNpYkJ09LoMuoBg7promGqOeaTepyHVDb9yoe Qc2+OplFyXZ1lJqeujF70OdM7tfEUgqlwXtJvmDbKOxBHif4MtYH2O7LoJnhjWv5F/TI v9vw== X-Gm-Message-State: AOAM531sq4rLWDiUXyXLORQu6kktFXp3oqy1sU0lmuKw4e56yzvpj7LH epedW2yAZi6tYeoE4Eni22A= X-Google-Smtp-Source: ABdhPJylbM4m8HxpleqxYEO3eboSL/U+VdadWcQh3NMuaQX/XYYHVGMncb+T414b5FHbpJ8pPi3iyQ== X-Received: by 2002:aa7:cf8f:: with SMTP id z15mr6343705edx.17.1607120790374; Fri, 04 Dec 2020 14:26:30 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jiaxun Yang , Huacai Chen , qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH 1/5] target/mips: Remove mips_def_t unused argument from mvp_init() Date: Fri, 4 Dec 2020 23:26:18 +0100 Message-Id: <20201204222622.2743175-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201204222622.2743175-1-f4bug@amsat.org> References: <20201204222622.2743175-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) mvp_init() doesn't require any CPU definition (beside the information accessible via CPUMIPSState). Remove the unused argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/mips/translate.c | 2 +- target/mips/translate_init.c.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index c64a1bc42e1..0db032fc5fb 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -31767,7 +31767,7 @@ void cpu_mips_realize_env(CPUMIPSState *env) mmu_init(env, env->cpu_model); #endif fpu_init(env, env->cpu_model); - mvp_init(env, env->cpu_model); + mvp_init(env); } =20 bool cpu_supports_cps_smp(const char *cpu_type) diff --git a/target/mips/translate_init.c.inc b/target/mips/translate_init.= c.inc index 79f75ed863c..5a926bc6df3 100644 --- a/target/mips/translate_init.c.inc +++ b/target/mips/translate_init.c.inc @@ -989,7 +989,7 @@ static void fpu_init (CPUMIPSState *env, const mips_def= _t *def) memcpy(&env->active_fpu, &env->fpus[0], sizeof(env->active_fpu)); } =20 -static void mvp_init (CPUMIPSState *env, const mips_def_t *def) +static void mvp_init(CPUMIPSState *env) { env->mvp =3D g_malloc0(sizeof(CPUMIPSMVPContext)); =20 --=20 2.26.2 From nobody Tue Nov 18 02:53:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) client-ip=209.85.218.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607120797; cv=none; d=zohomail.com; s=zohoarc; b=Lf4gszpA8nWowp1T2f3fA+lOVzgEdKkf0wwIXhuuKuS7Vi3B+gSN08E3Loz6CDM9ZAK8l2xLLr32ZuQb0o4ZeTzByCgh8l1Irpd6D2WJZulzkc91fjEEIpjR8sRgWMP1d3PBje9pfcn0YMIxHgDOAAaaHhXAA/C5cG+03bDOXJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607120797; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F/yHM9sV3U4iOKbuGdiODvNyEhg16gBWDYuuHF5veyA=; b=BsU5yXhlu5ICHwsa0UPp8utFmuHD8lQUNXPiuHgPVRR7ZCvh5dLPe2AERbu2G3+hrWh96nnPTnIfR1eO6/V8+yYJ05x5N/puPxFEqxRNmyBFgrv3XslRjyr02hiEK4ED/WXVMOdhpJuTTyaVhLX8HE9ODouKgukrT1YZ8bkKzdI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by mx.zohomail.com with SMTPS id 1607120797532557.3059971049755; Fri, 4 Dec 2020 14:26:37 -0800 (PST) Received: by mail-ej1-f66.google.com with SMTP id x16so10894661ejj.7 for ; Fri, 04 Dec 2020 14:26:36 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (111.red-88-21-205.staticip.rima-tde.net. [88.21.205.111]) by smtp.gmail.com with ESMTPSA id ng1sm3123587ejb.112.2020.12.04.14.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F/yHM9sV3U4iOKbuGdiODvNyEhg16gBWDYuuHF5veyA=; b=PhGBhwcg3ofPOv6DTFo2X+ZUN0ufMzPe4hKyEclqi/chkjlMar0QpjeRMQO+hOTMXQ t2DsLBWcGNvJP+sbbUDKgXdDepAyHVBIt3aY7FYJmMSdeJLUhWSVj2OOkGfKYbAD5JLR eRFkSOrCu+vrLK671n7qsyIpbyAG9CZ3eSq+/Vwq0v6EI8h20VVZaN49UJS/Je+E38dT WokKLGcHFC4Cpqx6I8w6G/2eIM+uno9srmvMogmrFkaf8wh8yMvy1n0DgkknrN2ZzZyv VpPmxqOboLRa9+iuxyoNNLxBsm2WUyyZLF8iIZyEZb8Mzj1+6yEeP1NQaqdUmmS5nKKI wgjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=F/yHM9sV3U4iOKbuGdiODvNyEhg16gBWDYuuHF5veyA=; b=jlEMm1dsjkKPLMGJjZA1ii1ExBixubTjTIklhilKQoccCZu7HFqd5PNAtkLY1bDGO9 a16wWkA9OX8Kryzl90wox6tujCLhVtvidxAt8PcGgh3xvrZcLHXHB0CT3wbbkoWzu/CA 1c2f8adxPuq9XJ9ky1/YYVOZq69Cf2Vk4Jb+YODWmPkaqoYOyH659AwGnhs//00YO4qs j6JYzmZYT1dAZgIOvUuWEjiLbNhL4ipGToRB1L6UgewLu8TdRWvsmeMITgmQ9KdrRHgm fiqX22jkzqK7Oy3sWkqUP7US0iLSMvav8Fzk/HMDNT8aWAmzf4weR08UH7uzbzfOaW4F A7Ig== X-Gm-Message-State: AOAM533hD1JBqn7KbEn8Hb9VZBYgphOVK/RY2p6b0y2cSr3LWY7eHMl9 /PV9KKjrb3jWULTkmkRuI+NwGC59EI4= X-Google-Smtp-Source: ABdhPJy/1Dr9Q3mUc80fvxJoOQA59NnPMM6x7RqcK7vXA2G2GjPSSEPh4qIthtl1EockkCuvvmqvDw== X-Received: by 2002:a17:907:6e9:: with SMTP id yh9mr9135349ejb.131.1607120795708; Fri, 04 Dec 2020 14:26:35 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jiaxun Yang , Huacai Chen , qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH 2/5] target/mips: Introduce ase_mt_available() helper Date: Fri, 4 Dec 2020 23:26:19 +0100 Message-Id: <20201204222622.2743175-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201204222622.2743175-1-f4bug@amsat.org> References: <20201204222622.2743175-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Instead of accessing CP0_Config3 directly and checking the 'Multi-Threading Present' bit, introduce an helper to simplify code review. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/mips/cpu.h | 7 +++++++ hw/mips/cps.c | 3 +-- target/mips/cp0_helper.c | 2 +- target/mips/cpu.c | 2 +- target/mips/helper.c | 2 +- target/mips/translate.c | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 2639b0ea06c..82c60a34751 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1289,6 +1289,13 @@ int cpu_mips_signal_handler(int host_signum, void *p= info, void *puc); =20 bool cpu_supports_cps_smp(const char *cpu_type); bool cpu_supports_isa(const char *cpu_type, uint64_t isa); + +/* Check presence of multi-threading ASE implementation */ +static inline bool ase_mt_available(CPUMIPSState *env) +{ + return env->CP0_Config3 & (1 << CP0C3_MT); +} + void cpu_set_exception_base(int vp_index, target_ulong address); =20 /* mips_int.c */ diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 962b1b0b87c..7a0d289efaf 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -58,8 +58,7 @@ static void main_cpu_reset(void *opaque) =20 static bool cpu_mips_itu_supported(CPUMIPSState *env) { - bool is_mt =3D (env->CP0_Config5 & (1 << CP0C5_VP)) || - (env->CP0_Config3 & (1 << CP0C3_MT)); + bool is_mt =3D (env->CP0_Config5 & (1 << CP0C5_VP)) || ase_mt_availabl= e(env); =20 return is_mt && !kvm_enabled(); } diff --git a/target/mips/cp0_helper.c b/target/mips/cp0_helper.c index caaaefcc8ad..9718c93d18c 100644 --- a/target/mips/cp0_helper.c +++ b/target/mips/cp0_helper.c @@ -1166,7 +1166,7 @@ void helper_mtc0_entryhi(CPUMIPSState *env, target_ul= ong arg1) old =3D env->CP0_EntryHi; val =3D (arg1 & mask) | (old & ~mask); env->CP0_EntryHi =3D val; - if (env->CP0_Config3 & (1 << CP0C3_MT)) { + if (ase_mt_available(env)) { sync_c0_entryhi(env, env->current_tc); } /* If the ASID changes, flush qemu's TLB. */ diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 76d50b00b42..c03e5acf5bc 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -74,7 +74,7 @@ static bool mips_cpu_has_work(CPUState *cs) } =20 /* MIPS-MT has the ability to halt the CPU. */ - if (env->CP0_Config3 & (1 << CP0C3_MT)) { + if (ase_mt_available(env)) { /* * The QEMU model will issue an _WAKE request whenever the CPUs * should be woken up. diff --git a/target/mips/helper.c b/target/mips/helper.c index cc46ea887e5..608fe1512a3 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -419,7 +419,7 @@ void cpu_mips_store_status(CPUMIPSState *env, target_ul= ong val) tlb_flush(env_cpu(env)); } #endif - if (env->CP0_Config3 & (1 << CP0C3_MT)) { + if (ase_mt_available(env)) { sync_c0_status(env, env, env->current_tc); } else { compute_hflags(env); diff --git a/target/mips/translate.c b/target/mips/translate.c index 0db032fc5fb..ee45dce9a50 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -31921,7 +31921,7 @@ void cpu_state_reset(CPUMIPSState *env) =20 cpu_mips_store_count(env, 1); =20 - if (env->CP0_Config3 & (1 << CP0C3_MT)) { + if (ase_mt_available(env)) { int i; =20 /* Only TC0 on VPE 0 starts as active. */ --=20 2.26.2 From nobody Tue Nov 18 02:53:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.65 as permitted sender) client-ip=209.85.218.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1607120802; cv=none; d=zohomail.com; s=zohoarc; b=LnzbkAWjezrDjnFjWwNTnYBz6CIRWKvf27PjEnf9NguUlvBzzvn44N0MLJHAWS7N77Iw1h5pwvuK2XrvcnXw04DxebqFSTkOSYihOqWfJYrU7Wm0oSBskgxLUW4arTc16wcRmdyOS5CKOheXfSowB9LBZrdWzTklVRkZXIzKMW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607120802; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0iMc1U7Wr361oFMAzFxSwxjYvRlBdQYyBbE2x1GpfLY=; b=cSKWJShXeKVg3Diny7nPmKMgGNqvsiPeJUE/8x7NaNKWRiwNPwTeivedPkbng9OOHIk5piFZutyehfr+lP15YJdOEql6WE7zN7uuChCKxnNnbYnslWQVCX+Zk9++7ype/ViY3j+23Avtc4mwsDkb7hmokA91HRt4jk3Hm0Ykd3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by mx.zohomail.com with SMTPS id 1607120802691137.01615426720775; Fri, 4 Dec 2020 14:26:42 -0800 (PST) Received: by mail-ej1-f65.google.com with SMTP id qw4so10869609ejb.12 for ; Fri, 04 Dec 2020 14:26:42 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (111.red-88-21-205.staticip.rima-tde.net. [88.21.205.111]) by smtp.gmail.com with ESMTPSA id lz17sm3989348ejb.19.2020.12.04.14.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0iMc1U7Wr361oFMAzFxSwxjYvRlBdQYyBbE2x1GpfLY=; b=cOJh4EpcQddvYd+em79PFhqU0Io2qESFHQBdQ8yxfP/tyRFNzED6DaGwchRPCMxBZi APM0Io94qqn7jnuD2SMX00YiQT/mDUSOv5wK0muE78vi3m9T0R/Rw+RcVOiNrAOzwx19 B3z/SPNsijzb772pvf8CvRHOoOF2QJYtmFBIE5TBAZRDlMegEqm+s+YnP6AVz9ivAPWi 9lr10aKIBFtGXiUTJz30YbaDfTT2/4G4jOUnBjmj9y2/wp9A6L4g826B4fDunHibYX7u SyKzPuD7dB2WqkXRZ8DDCpuBHLfkkytApuuCagNvynQbS/EVAqhilSEUdfT5Pm2H+cUV tgAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0iMc1U7Wr361oFMAzFxSwxjYvRlBdQYyBbE2x1GpfLY=; b=SEsgaIPPr7H4euIq08jvHWTEi8E3/zx8QfSjXGbTBF7HNduFhKLP33oiwcEMUfzlJq f4tGFVhBTpTezm55grzQNTRH2KEkPRVLYOzOeE/TtE8QK/maqWH1lg+fRDpq37guBaF2 HPADNgqTuVaYheq0lQkZ6dq+pIOEDeGbk+oP4I/2GQE+l5qAb6n3fKVnN6I4Z4a8DDMM uvMtn840sD9gORcwG94vGmRnoJZcEt5pb34Ssrx4jA0xmaKD4gGIGiRo6v5QRZS92+D+ RsKg14ycx8cnmGsl5ESF9in8gOmt9c9sGI17f6f9kHu1Ko+/NLD7ooVhWngcnqYdS8El rK7Q== X-Gm-Message-State: AOAM532OW2+/QigSAvitigDVw4VjNRKa2j/HiJIWGY3IbTgKwiu9UYki lI1s63zDH9ZvYECIOQ+8lnE= X-Google-Smtp-Source: ABdhPJwig11YAraxAu9UTLlVDbDCJv8YRpFzxGkxBy7pWl080A5kCOLDwhymcIaWsk0+sFRmItMK6w== X-Received: by 2002:a17:906:8c7:: with SMTP id o7mr9538671eje.413.1607120800813; Fri, 04 Dec 2020 14:26:40 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jiaxun Yang , Huacai Chen , qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH 3/5] target/mips: Do not initialize MT registers if MT ASE absent Date: Fri, 4 Dec 2020 23:26:20 +0100 Message-Id: <20201204222622.2743175-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201204222622.2743175-1-f4bug@amsat.org> References: <20201204222622.2743175-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Do not initialize MT-related config registers if the MT ASE is not present. As some functions access the 'mvp' structure, we still zero-allocate it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/mips/translate_init.c.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/mips/translate_init.c.inc b/target/mips/translate_init.= c.inc index 5a926bc6df3..f72fee3b40a 100644 --- a/target/mips/translate_init.c.inc +++ b/target/mips/translate_init.c.inc @@ -993,6 +993,10 @@ static void mvp_init(CPUMIPSState *env) { env->mvp =3D g_malloc0(sizeof(CPUMIPSMVPContext)); =20 + if (!ase_mt_available(env)) { + return; + } + /* MVPConf1 implemented, TLB sharable, no gating storage support, programmable cache partitioning implemented, number of allocatable and shareable TLB entries, MVP has allocatable TCs, 2 VPEs --=20 2.26.2 From nobody Tue Nov 18 02:53:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.67 as permitted sender) client-ip=209.85.218.67; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f67.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607120807; cv=none; d=zohomail.com; s=zohoarc; b=gNVsn8t9Zz3Y/xaUoKdkYE9WG1qAP1ijXWcw4BxI0aI/DlJDDPrELVvQsYOhnUfd39p/ohyI48Qv1mUDy3xZS3WAJGBnpYUIJLMalVb4G5NpKaRpIALf4NIXbKT+gggP5P0gj0CTNGzruocQVEB0M/mwBuD2pgpoHmWF2kIyhIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607120807; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iBDSNPx6upyqlkELqBQhoWx867Jz/cWDyzTe3RAU9b8=; b=RCfp9fX5bkgFU0lqpX1GhtMAf0TRjZJIxuPE6UbowZB3dHaHBA4EDI542VORteAOmw1Kfb351+ONtKMllRcCamixdk50yE7UbbyqCbnVpcn7jRyC1EkawLaYQkGzy5n2mNT10lpF/aHWB7f322pH8jZCYgYJzxEGME2dxd9QznY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by mx.zohomail.com with SMTPS id 1607120807743269.01854007496365; Fri, 4 Dec 2020 14:26:47 -0800 (PST) Received: by mail-ej1-f67.google.com with SMTP id x16so10895217ejj.7 for ; Fri, 04 Dec 2020 14:26:47 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (111.red-88-21-205.staticip.rima-tde.net. [88.21.205.111]) by smtp.gmail.com with ESMTPSA id u5sm4278374edp.5.2020.12.04.14.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iBDSNPx6upyqlkELqBQhoWx867Jz/cWDyzTe3RAU9b8=; b=b9qV7og8yhStX9J0BYu/dFxAg3Q00NrrtbTgwPJSmdFVAdlb8nL+ycjlG/rD+1kEgO ELHB/U2AdUTnsyK5NbJa3BVcAY0AbAz3u8TmsWYHu26R6AUxlZNJnXP9ZAGsXfWs7ApK hTIdBbJIot6gafxr0ynz0afrtAuFfAjExVHCPPB/bewPWOJAYBdxSiJL8dx3wXIDgwEp 2U3jPUJuFNyiAZABFZEMCSDXpJg3XEEciXCs8BEOmILRnQgJWWLRqxkjhBVJkVvhhi+3 Ptl6Zxw8lx3LoCuKAjJbIoaI9jzbYzen8c/oalDo1VLxC45qiA3gMGU0wGZ+siduALw4 rVHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iBDSNPx6upyqlkELqBQhoWx867Jz/cWDyzTe3RAU9b8=; b=cHD8lp61vJ8G3sQFpzIYnL66UYgchhuVqhySODBEXhutait3T8YQUWIRzG6KaZF5zX T/IGHC5KdzJur0eaeSUQkd1f8y+xNBFTz/lznZv9WGO+SCDYlHcT6B0Ba/9jtp2U9r4t MTnAFcDX0oC+fYPqbCD7vlyNcFzplma5ZoAYs1GrLE3G+vZ/WU7/MirHMPLEshucH0hp 2Ea9FUvj3uVWzcpwuE0j8eZGi/ndS07jsENiR7mI7whaAKxIL3clpSvpBi74QXYBMPgh scY92QyNrrvj4T1Z531kNqZQKPLYDCdGW36ZNo4A2cAnogR79sGcqIAuvC/jXAiCkO7o og6Q== X-Gm-Message-State: AOAM533VK4UkkRn2e+TQVzpN1ucT6SK1XfHxRhYVKVuHkyUML0Nj51UM pGJCR3L+gA0C8L3ChNa7POc= X-Google-Smtp-Source: ABdhPJwc1o2SYoyGu68hmhbMc66POYC/AVJbKYqnFbpf+OyVPmtQmtC03igKeaaO6yPxqhosqZFNKA== X-Received: by 2002:a17:906:d19b:: with SMTP id c27mr9420847ejz.234.1607120806010; Fri, 04 Dec 2020 14:26:46 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jiaxun Yang , Huacai Chen , qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH 4/5] hw/mips/malta: Do not initialize MT registers if MT ASE absent Date: Fri, 4 Dec 2020 23:26:21 +0100 Message-Id: <20201204222622.2743175-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201204222622.2743175-1-f4bug@amsat.org> References: <20201204222622.2743175-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Do not initialize MT-related config register if the MT ASE is not present. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/mips/malta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 9d1a3b50b7a..350b92b4d79 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1134,8 +1134,10 @@ static void malta_mips_config(MIPSCPU *cpu) CPUMIPSState *env =3D &cpu->env; CPUState *cs =3D CPU(cpu); =20 - env->mvp->CP0_MVPConf0 |=3D ((smp_cpus - 1) << CP0MVPC0_PVPE) | + if (ase_mt_available(env)) { + env->mvp->CP0_MVPConf0 |=3D ((smp_cpus - 1) << CP0MVPC0_PVPE) | ((smp_cpus * cs->nr_threads - 1) << CP0MVPC0_PTC); + } } =20 static void main_cpu_reset(void *opaque) --=20 2.26.2 From nobody Tue Nov 18 02:53:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) client-ip=209.85.218.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607120812; cv=none; d=zohomail.com; s=zohoarc; b=NFpKCPdkCEtV9QiyWxCSwsiDNkGwrF7lYakL9hHL9Y6cO3Jzx3E2bveGD3Wr8knpmrN6Umu88Ko2flHZ+FxKD7TfmhfjemSX9HNPErariQGT0m3tAAsq7q/M6t4OF0io+Lwzr4otCNPtUmql8MJwU5fW3bDNIXH0qsxRkkldpMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607120812; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yPVQZVrJYHV9VRQKq9oG2AAR4beoTafSJ17RxMCvpOk=; b=YwFmPD2l9hivvtVhtfsfQIbgJW0sXWjfpfIsRdnZT/vRu4BHcTN3CO9Q00JOKadfzLwR9i1OA50fYTCQZbxfIaaS+E36ldyc7RoWWfNkT+puZ0wRNLptnvFABE4/u5KvKodYa+ElaEyz0vQCnqKvazF1VbpmbC1ki4OzQ5cVh7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by mx.zohomail.com with SMTPS id 1607120812967430.7305729874531; Fri, 4 Dec 2020 14:26:52 -0800 (PST) Received: by mail-ej1-f66.google.com with SMTP id jx16so10879551ejb.10 for ; Fri, 04 Dec 2020 14:26:52 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (111.red-88-21-205.staticip.rima-tde.net. [88.21.205.111]) by smtp.gmail.com with ESMTPSA id p22sm3896344ejx.59.2020.12.04.14.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 14:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yPVQZVrJYHV9VRQKq9oG2AAR4beoTafSJ17RxMCvpOk=; b=Bb+fncHR/1kTHmi2VJPpS7u6w0kDJt4JaWbYIuzHTOzo6mnPEID9spQrGXNYlJ/CDg JfA1pJfRX1p+Qk55P0EN6vXZlRe+oxSNaP3hxfeQlsEiL/JeNLecDsidOdYWGMiebjkH iMixCbadpiaOZptlCTw43sQfsvAq6I2S/eczF5zDbBVd2AbLFyFEQpWEGv/qUAuUlSTO D7Xx1bu7S1qbdOg8EThn3ZKv0Bjnlq55u9RpfTmoRH6jahGP0Xtla0nOPb23EtnHaM8/ Cguy3xZOpAoh737Ncj7CoDY4EE/HQmumMdBV9ck6D3OTvl7RJ/XOQMYNS9cEw6A9un9q 9ppA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yPVQZVrJYHV9VRQKq9oG2AAR4beoTafSJ17RxMCvpOk=; b=axuatiO+mZCn0bXWe2GM+zXhw9X3VcWOpb9LR90p60i/8p2spI4xj6lTjBBHEHhJR0 cn8ihO2prZsINVzl5O41askOQE9M9e9bF725+uZNTerWkzYuL1CxHA7+XjUygrCr9Asb r1leKSroNz6PTJveSiycoJ2agVjv7WLyPS8OyihGfCZQHB3Dq1EQGbyr1EjbF26wZv3c Fib8Xtbiv3plRHh8R3UFIbwX2JiXhFe1h1OPFj1+YRScCgOD9YW2xVIewAg+9O5uxud3 V9iS4mmqBIXyXuS+sVC3AgXgG6fMZoKDvUw8befFGnMHP7GXxRQoXC1F7L3ntAFbvQLY qCFw== X-Gm-Message-State: AOAM533HgyhA4HKHTq8bKN+FbY2ypIhikiM9u4jEnk9PNdLkB7hqCXvt Ip0Tc3VUnrMyIKog2ldQVjE= X-Google-Smtp-Source: ABdhPJznyaEiLXNVRdJ+jnvNs6rKjbzwldBEb83ibl9Am7rdn29z6610yrZX1+X4suaKzSozg+JCfg== X-Received: by 2002:a17:906:7104:: with SMTP id x4mr9343458ejj.141.1607120811094; Fri, 04 Dec 2020 14:26:51 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jiaxun Yang , Huacai Chen , qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH 5/5] hw/mips/malta: Rewrite CP0_MVPConf0 access using deposit() Date: Fri, 4 Dec 2020 23:26:22 +0100 Message-Id: <20201204222622.2743175-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201204222622.2743175-1-f4bug@amsat.org> References: <20201204222622.2743175-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) PTC field has 8 bits, PVPE has 4. We plan to use the "hw/registerfields.h" API with MIPS CPU definitions (target/mips/cpu.h). Meanwhile we use magic 8 and 4. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- We want to move that to mips_cpu_reset() later, because this is not Malta specific but cpu-specific. However SMP 'cpus' come from MachineState ("hw/boards.h"). So meanwhile this is early review. --- hw/mips/malta.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 350b92b4d79..c35fbf97272 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/bitops.h" #include "qemu-common.h" #include "cpu.h" #include "hw/clock.h" @@ -1135,8 +1136,11 @@ static void malta_mips_config(MIPSCPU *cpu) CPUState *cs =3D CPU(cpu); =20 if (ase_mt_available(env)) { - env->mvp->CP0_MVPConf0 |=3D ((smp_cpus - 1) << CP0MVPC0_PVPE) | - ((smp_cpus * cs->nr_threads - 1) << CP0MVPC0_PTC); + env->mvp->CP0_MVPConf0 =3D deposit32(env->mvp->CP0_MVPConf0, + CP0MVPC0_PTC, 8, + smp_cpus * cs->nr_threads - 1); + env->mvp->CP0_MVPConf0 =3D deposit32(env->mvp->CP0_MVPConf0, + CP0MVPC0_PVPE, 4, smp_cpus - 1); } } =20 --=20 2.26.2