From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730449; cv=none; d=zohomail.com; s=zohoarc; b=GzA976ZC6QDYQOisUlOdOG0925LqIjmSvBioLDosOyhTJfHfU8EGlpqSvUSX7IoOHxL0ZNIorafrqCTIfS4hmKFNIsa2YJeI4i8B+0tvW/y5UGw0Qj2EnGZLMEcRAt35ftxGlsoopG1QrW6xb82CoTXV0l9GFG1hao7I1jPAiPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730449; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OsDfYowhO6cI6OMUoBZtRqd/8LgnQ0VUZuwF/VUEFAM=; b=BV02EWw5LTyIszG6CQX8BigtqYm+EIskIKiD/AXzrh263WlyuPCy0wrkLhFYJwnjuAcacvPsG5cmUp8XuovKvq4ZUk5uWY9AwvNfVYoJGMlEJFFS7/zCqfF+ZOkG/b4ZcrOCEiMkPOnqVP9LaBaT7pfGkKYu/UZI28KP70wkJB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615730449866524.7412019158028; Sun, 14 Mar 2021 07:00:49 -0700 (PDT) Received: from localhost ([::1]:57120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRIQ-0007t2-AO for importer@patchew.org; Sun, 14 Mar 2021 10:00:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF3-0003Ah-EZ for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:13 -0400 Received: from hoth.uni-paderborn.de ([2001:638:502:c003::19]:45844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLREy-000315-Nk for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OsDfYowhO6cI6OMUoBZtRqd/8LgnQ0VUZuwF/VUEFAM=; b=AiTgCCHVVDzyqv5MwEgcA8BhwX xa7DRPkP3WvG/2S7UHVYBxFkvBLwMsJx2gG6hHqgKeFJ1Co3UA0ESlzrBHF1NKovHeScHxqRqjcKl Jr38AL6aZTwWvpVkwx6qFi/hkpQ6zPA07GshnGKp4Wmxz/DSqM8wYeFCE5lPdwjTz900=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 1/7] tricore: added triboard with tc27x_soc Date: Sun, 14 Mar 2021 14:55:07 +0100 Message-Id: <20210314135513.1369871-2-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367608, da=103339289, mc=563, sc=4, hc=559, sp=0, fso=31367608, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::19; envelope-from=kbastian@mail.uni-paderborn.de; helo=hoth.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, Lars Biermanski , Georg Hofstetter , David Brenken , Robert Rasche , Andreas Konopik Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Andreas Konopik Reviewed-by: Bastian Koppelmann Signed-off-by: Andreas Konopik Signed-off-by: David Brenken Signed-off-by: Georg Hofstetter Signed-off-by: Robert Rasche Signed-off-by: Lars Biermanski Message-Id: <20201109165055.10508-2-david.brenken@efs-auto.org> Signed-off-by: Bastian Koppelmann --- default-configs/devices/tricore-softmmu.mak | 2 +- hw/tricore/Kconfig | 8 + hw/tricore/meson.build | 2 + hw/tricore/tc27x_soc.c | 246 ++++++++++++++++++++ hw/tricore/triboard.c | 98 ++++++++ include/hw/tricore/tc27x_soc.h | 129 ++++++++++ include/hw/tricore/triboard.h | 50 ++++ 7 files changed, 534 insertions(+), 1 deletion(-) create mode 100644 hw/tricore/tc27x_soc.c create mode 100644 hw/tricore/triboard.c create mode 100644 include/hw/tricore/tc27x_soc.h create mode 100644 include/hw/tricore/triboard.h diff --git a/default-configs/devices/tricore-softmmu.mak b/default-configs/= devices/tricore-softmmu.mak index c397cff38a..5cc91cebce 100644 --- a/default-configs/devices/tricore-softmmu.mak +++ b/default-configs/devices/tricore-softmmu.mak @@ -1 +1 @@ -CONFIG_TRICORE=3Dy +CONFIG_TRIBOARD=3Dy diff --git a/hw/tricore/Kconfig b/hw/tricore/Kconfig index 9313409309..506e6183c1 100644 --- a/hw/tricore/Kconfig +++ b/hw/tricore/Kconfig @@ -1,2 +1,10 @@ config TRICORE bool + +config TRIBOARD + bool + select TRICORE + select TC27X_SOC + +config TC27X_SOC + bool diff --git a/hw/tricore/meson.build b/hw/tricore/meson.build index 579aa13c78..77ff6fd137 100644 --- a/hw/tricore/meson.build +++ b/hw/tricore/meson.build @@ -1,4 +1,6 @@ tricore_ss =3D ss.source_set() tricore_ss.add(when: 'CONFIG_TRICORE', if_true: files('tricore_testboard.c= ')) +tricore_ss.add(when: 'CONFIG_TRIBOARD', if_true: files('triboard.c')) +tricore_ss.add(when: 'CONFIG_TC27X_SOC', if_true: files('tc27x_soc.c')) =20 hw_arch +=3D {'tricore': tricore_ss} diff --git a/hw/tricore/tc27x_soc.c b/hw/tricore/tc27x_soc.c new file mode 100644 index 0000000000..8af079e6b2 --- /dev/null +++ b/hw/tricore/tc27x_soc.c @@ -0,0 +1,246 @@ +/* + * Infineon tc27x SoC System emulation. + * + * Copyright (c) 2020 Andreas Konopik + * Copyright (c) 2020 David Brenken + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/sysbus.h" +#include "hw/boards.h" +#include "hw/loader.h" +#include "qemu/units.h" +#include "hw/misc/unimp.h" +#include "exec/address-spaces.h" +#include "qemu/log.h" +#include "cpu.h" + +#include "hw/tricore/tc27x_soc.h" +#include "hw/tricore/triboard.h" + +const MemmapEntry tc27x_soc_memmap[] =3D { + [TC27XD_DSPR2] =3D { 0x50000000, 120 * KiB }, + [TC27XD_DCACHE2] =3D { 0x5001E000, 8 * KiB }, + [TC27XD_DTAG2] =3D { 0x500C0000, 0xC00 }, + [TC27XD_PSPR2] =3D { 0x50100000, 32 * KiB }, + [TC27XD_PCACHE2] =3D { 0x50108000, 16 * KiB }, + [TC27XD_PTAG2] =3D { 0x501C0000, 0x1800 }, + [TC27XD_DSPR1] =3D { 0x60000000, 120 * KiB }, + [TC27XD_DCACHE1] =3D { 0x6001E000, 8 * KiB }, + [TC27XD_DTAG1] =3D { 0x600C0000, 0xC00 }, + [TC27XD_PSPR1] =3D { 0x60100000, 32 * KiB }, + [TC27XD_PCACHE1] =3D { 0x60108000, 16 * KiB }, + [TC27XD_PTAG1] =3D { 0x601C0000, 0x1800 }, + [TC27XD_DSPR0] =3D { 0x70000000, 112 * KiB }, + [TC27XD_PSPR0] =3D { 0x70100000, 24 * KiB }, + [TC27XD_PCACHE0] =3D { 0x70106000, 8 * KiB }, + [TC27XD_PTAG0] =3D { 0x701C0000, 0xC00 }, + [TC27XD_PFLASH0_C] =3D { 0x80000000, 2 * MiB }, + [TC27XD_PFLASH1_C] =3D { 0x80200000, 2 * MiB }, + [TC27XD_OLDA_C] =3D { 0x8FE70000, 32 * KiB }, + [TC27XD_BROM_C] =3D { 0x8FFF8000, 32 * KiB }, + [TC27XD_LMURAM_C] =3D { 0x90000000, 32 * KiB }, + [TC27XD_EMEM_C] =3D { 0x9F000000, 1 * MiB }, + [TC27XD_PFLASH0_U] =3D { 0xA0000000, 0x0 }, + [TC27XD_PFLASH1_U] =3D { 0xA0200000, 0x0 }, + [TC27XD_DFLASH0] =3D { 0xAF000000, 1 * MiB + 16 * KiB }, + [TC27XD_DFLASH1] =3D { 0xAF110000, 64 * KiB }, + [TC27XD_OLDA_U] =3D { 0xAFE70000, 0x0 }, + [TC27XD_BROM_U] =3D { 0xAFFF8000, 0x0 }, + [TC27XD_LMURAM_U] =3D { 0xB0000000, 0x0 }, + [TC27XD_EMEM_U] =3D { 0xBF000000, 0x0 }, + [TC27XD_PSPRX] =3D { 0xC0000000, 0x0 }, + [TC27XD_DSPRX] =3D { 0xD0000000, 0x0 }, +}; + +/* + * Initialize the auxiliary ROM region @mr and map it into + * the memory map at @base. + */ +static void make_rom(MemoryRegion *mr, const char *name, + hwaddr base, hwaddr size) +{ + memory_region_init_rom(mr, NULL, name, size, &error_fatal); + memory_region_add_subregion(get_system_memory(), base, mr); +} + +/* + * Initialize the auxiliary RAM region @mr and map it into + * the memory map at @base. + */ +static void make_ram(MemoryRegion *mr, const char *name, + hwaddr base, hwaddr size) +{ + memory_region_init_ram(mr, NULL, name, size, &error_fatal); + memory_region_add_subregion(get_system_memory(), base, mr); +} + +/* + * Create an alias of an entire original MemoryRegion @orig + * located at @base in the memory map. + */ +static void make_alias(MemoryRegion *mr, const char *name, + MemoryRegion *orig, hwaddr base) +{ + memory_region_init_alias(mr, NULL, name, orig, 0, + memory_region_size(orig)); + memory_region_add_subregion(get_system_memory(), base, mr); +} + +static void tc27x_soc_init_memory_mapping(DeviceState *dev_soc) +{ + TC27XSoCState *s =3D TC27X_SOC(dev_soc); + TC27XSoCClass *sc =3D TC27X_SOC_GET_CLASS(s); + + make_ram(&s->cpu0mem.dspr, "CPU0.DSPR", + sc->memmap[TC27XD_DSPR0].base, sc->memmap[TC27XD_DSPR0].size); + make_ram(&s->cpu0mem.pspr, "CPU0.PSPR", + sc->memmap[TC27XD_PSPR0].base, sc->memmap[TC27XD_PSPR0].size); + make_ram(&s->cpu1mem.dspr, "CPU1.DSPR", + sc->memmap[TC27XD_DSPR1].base, sc->memmap[TC27XD_DSPR1].size); + make_ram(&s->cpu1mem.pspr, "CPU1.PSPR", + sc->memmap[TC27XD_PSPR1].base, sc->memmap[TC27XD_PSPR1].size); + make_ram(&s->cpu2mem.dspr, "CPU2.DSPR", + sc->memmap[TC27XD_DSPR2].base, sc->memmap[TC27XD_DSPR2].size); + make_ram(&s->cpu2mem.pspr, "CPU2.PSPR", + sc->memmap[TC27XD_PSPR2].base, sc->memmap[TC27XD_PSPR2].size); + + /* TODO: Control Cache mapping with Memory Test Unit (MTU) */ + make_ram(&s->cpu2mem.dcache, "CPU2.DCACHE", + sc->memmap[TC27XD_DCACHE2].base, sc->memmap[TC27XD_DCACHE2].size); + make_ram(&s->cpu2mem.dtag, "CPU2.DTAG", + sc->memmap[TC27XD_DTAG2].base, sc->memmap[TC27XD_DTAG2].size); + make_ram(&s->cpu2mem.pcache, "CPU2.PCACHE", + sc->memmap[TC27XD_PCACHE2].base, sc->memmap[TC27XD_PCACHE2].size); + make_ram(&s->cpu2mem.ptag, "CPU2.PTAG", + sc->memmap[TC27XD_PTAG2].base, sc->memmap[TC27XD_PTAG2].size); + + make_ram(&s->cpu1mem.dcache, "CPU1.DCACHE", + sc->memmap[TC27XD_DCACHE1].base, sc->memmap[TC27XD_DCACHE1].size); + make_ram(&s->cpu1mem.dtag, "CPU1.DTAG", + sc->memmap[TC27XD_DTAG1].base, sc->memmap[TC27XD_DTAG1].size); + make_ram(&s->cpu1mem.pcache, "CPU1.PCACHE", + sc->memmap[TC27XD_PCACHE1].base, sc->memmap[TC27XD_PCACHE1].size); + make_ram(&s->cpu1mem.ptag, "CPU1.PTAG", + sc->memmap[TC27XD_PTAG1].base, sc->memmap[TC27XD_PTAG1].size); + + make_ram(&s->cpu0mem.pcache, "CPU0.PCACHE", + sc->memmap[TC27XD_PCACHE0].base, sc->memmap[TC27XD_PCACHE0].size); + make_ram(&s->cpu0mem.ptag, "CPU0.PTAG", + sc->memmap[TC27XD_PTAG0].base, sc->memmap[TC27XD_PTAG0].size); + + /* + * TriCore QEMU executes CPU0 only, thus it is sufficient to map + * LOCAL.PSPR/LOCAL.DSPR exclusively onto PSPR0/DSPR0. + */ + make_alias(&s->psprX, "LOCAL.PSPR", &s->cpu0mem.pspr, + sc->memmap[TC27XD_PSPRX].base); + make_alias(&s->dsprX, "LOCAL.DSPR", &s->cpu0mem.dspr, + sc->memmap[TC27XD_DSPRX].base); + + make_ram(&s->flashmem.pflash0_c, "PF0", + sc->memmap[TC27XD_PFLASH0_C].base, sc->memmap[TC27XD_PFLASH0_C].si= ze); + make_ram(&s->flashmem.pflash1_c, "PF1", + sc->memmap[TC27XD_PFLASH1_C].base, sc->memmap[TC27XD_PFLASH1_C].si= ze); + make_ram(&s->flashmem.dflash0, "DF0", + sc->memmap[TC27XD_DFLASH0].base, sc->memmap[TC27XD_DFLASH0].size); + make_ram(&s->flashmem.dflash1, "DF1", + sc->memmap[TC27XD_DFLASH1].base, sc->memmap[TC27XD_DFLASH1].size); + make_ram(&s->flashmem.olda_c, "OLDA", + sc->memmap[TC27XD_OLDA_C].base, sc->memmap[TC27XD_OLDA_C].size); + make_rom(&s->flashmem.brom_c, "BROM", + sc->memmap[TC27XD_BROM_C].base, sc->memmap[TC27XD_BROM_C].size); + make_ram(&s->flashmem.lmuram_c, "LMURAM", + sc->memmap[TC27XD_LMURAM_C].base, sc->memmap[TC27XD_LMURAM_C].size= ); + make_ram(&s->flashmem.emem_c, "EMEM", + sc->memmap[TC27XD_EMEM_C].base, sc->memmap[TC27XD_EMEM_C].size); + + make_alias(&s->flashmem.pflash0_u, "PF0.U", &s->flashmem.pflash0_c, + sc->memmap[TC27XD_PFLASH0_U].base); + make_alias(&s->flashmem.pflash1_u, "PF1.U", &s->flashmem.pflash1_c, + sc->memmap[TC27XD_PFLASH1_U].base); + make_alias(&s->flashmem.olda_u, "OLDA.U", &s->flashmem.olda_c, + sc->memmap[TC27XD_OLDA_U].base); + make_alias(&s->flashmem.brom_u, "BROM.U", &s->flashmem.brom_c, + sc->memmap[TC27XD_BROM_U].base); + make_alias(&s->flashmem.lmuram_u, "LMURAM.U", &s->flashmem.lmuram_c, + sc->memmap[TC27XD_LMURAM_U].base); + make_alias(&s->flashmem.emem_u, "EMEM.U", &s->flashmem.emem_c, + sc->memmap[TC27XD_EMEM_U].base); +} + +static void tc27x_soc_realize(DeviceState *dev_soc, Error **errp) +{ + TC27XSoCState *s =3D TC27X_SOC(dev_soc); + Error *err =3D NULL; + + qdev_realize(DEVICE(&s->cpu), NULL, &err); + if (err) { + error_propagate(errp, err); + return; + } + + tc27x_soc_init_memory_mapping(dev_soc); +} + +static void tc27x_soc_init(Object *obj) +{ + TC27XSoCState *s =3D TC27X_SOC(obj); + TC27XSoCClass *sc =3D TC27X_SOC_GET_CLASS(s); + + object_initialize_child(obj, "tc27x", &s->cpu, sc->cpu_type); +} + +static Property tc27x_soc_properties[] =3D { + DEFINE_PROP_END_OF_LIST(), +}; + +static void tc27x_soc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D tc27x_soc_realize; + device_class_set_props(dc, tc27x_soc_properties); +} + +static void tc277d_soc_class_init(ObjectClass *oc, void *data) +{ + TC27XSoCClass *sc =3D TC27X_SOC_CLASS(oc); + + sc->name =3D "tc277d-soc"; + sc->cpu_type =3D TRICORE_CPU_TYPE_NAME("tc27x"); + sc->memmap =3D tc27x_soc_memmap; + sc->num_cpus =3D 1; +} + +static const TypeInfo tc27x_soc_types[] =3D { + { + .name =3D "tc277d-soc", + .parent =3D TYPE_TC27X_SOC, + .class_init =3D tc277d_soc_class_init, + }, { + .name =3D TYPE_TC27X_SOC, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(TC27XSoCState), + .instance_init =3D tc27x_soc_init, + .class_size =3D sizeof(TC27XSoCClass), + .class_init =3D tc27x_soc_class_init, + .abstract =3D true, + }, +}; + +DEFINE_TYPES(tc27x_soc_types) diff --git a/hw/tricore/triboard.c b/hw/tricore/triboard.c new file mode 100644 index 0000000000..16e2fd7e27 --- /dev/null +++ b/hw/tricore/triboard.c @@ -0,0 +1,98 @@ +/* + * Infineon TriBoard System emulation. + * + * Copyright (c) 2020 Andreas Konopik + * Copyright (c) 2020 David Brenken + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qapi/error.h" +#include "hw/qdev-properties.h" +#include "cpu.h" +#include "net/net.h" +#include "hw/boards.h" +#include "hw/loader.h" +#include "exec/address-spaces.h" +#include "elf.h" +#include "hw/tricore/tricore.h" +#include "qemu/error-report.h" + +#include "hw/tricore/triboard.h" +#include "hw/tricore/tc27x_soc.h" + +static void tricore_load_kernel(const char *kernel_filename) +{ + uint64_t entry; + long kernel_size; + TriCoreCPU *cpu; + CPUTriCoreState *env; + + kernel_size =3D load_elf(kernel_filename, NULL, + NULL, NULL, &entry, NULL, + NULL, NULL, 0, + EM_TRICORE, 1, 0); + if (kernel_size <=3D 0) { + error_report("no kernel file '%s'", kernel_filename); + exit(1); + } + cpu =3D TRICORE_CPU(first_cpu); + env =3D &cpu->env; + env->PC =3D entry; +} + + +static void triboard_machine_init(MachineState *machine) +{ + TriBoardMachineState *ms =3D TRIBOARD_MACHINE(machine); + TriBoardMachineClass *amc =3D TRIBOARD_MACHINE_GET_CLASS(machine); + + object_initialize_child(OBJECT(machine), "soc", &ms->tc27x_soc, + amc->soc_name); + sysbus_realize(SYS_BUS_DEVICE(&ms->tc27x_soc), &error_fatal); + + if (machine->kernel_filename) { + tricore_load_kernel(machine->kernel_filename); + } +} + +static void triboard_machine_tc277d_class_init(ObjectClass *oc, + void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + TriBoardMachineClass *amc =3D TRIBOARD_MACHINE_CLASS(oc); + + mc->init =3D triboard_machine_init; + mc->desc =3D "Infineon AURIX TriBoard TC277 (D-Step)"; + mc->max_cpus =3D 1; + amc->soc_name =3D "tc277d-soc"; +}; + +static const TypeInfo triboard_machine_types[] =3D { + { + .name =3D MACHINE_TYPE_NAME("KIT_AURIX_TC277_TRB"), + .parent =3D TYPE_TRIBOARD_MACHINE, + .class_init =3D triboard_machine_tc277d_class_init, + }, { + .name =3D TYPE_TRIBOARD_MACHINE, + .parent =3D TYPE_MACHINE, + .instance_size =3D sizeof(TriBoardMachineState), + .class_size =3D sizeof(TriBoardMachineClass), + .abstract =3D true, + }, +}; + +DEFINE_TYPES(triboard_machine_types) diff --git a/include/hw/tricore/tc27x_soc.h b/include/hw/tricore/tc27x_soc.h new file mode 100644 index 0000000000..6a7e5b54f5 --- /dev/null +++ b/include/hw/tricore/tc27x_soc.h @@ -0,0 +1,129 @@ +/* + * Infineon tc27x SoC System emulation. + * + * Copyright (c) 2020 Andreas Konopik + * Copyright (c) 2020 David Brenken + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef TC27X_SoC_H +#define TC27X_SoC_H + +#include "hw/sysbus.h" +#include "target/tricore/cpu.h" +#include "qom/object.h" + +#define TYPE_TC27X_SOC ("tc27x-soc") +OBJECT_DECLARE_TYPE(TC27XSoCState, TC27XSoCClass, TC27X_SOC) + +typedef struct TC27XSoCCPUMemState { + + MemoryRegion dspr; + MemoryRegion pspr; + + MemoryRegion dcache; + MemoryRegion dtag; + MemoryRegion pcache; + MemoryRegion ptag; + +} TC27XSoCCPUMemState; + +typedef struct TC27XSoCFlashMemState { + + MemoryRegion pflash0_c; + MemoryRegion pflash1_c; + MemoryRegion pflash0_u; + MemoryRegion pflash1_u; + MemoryRegion dflash0; + MemoryRegion dflash1; + MemoryRegion olda_c; + MemoryRegion olda_u; + MemoryRegion brom_c; + MemoryRegion brom_u; + MemoryRegion lmuram_c; + MemoryRegion lmuram_u; + MemoryRegion emem_c; + MemoryRegion emem_u; + +} TC27XSoCFlashMemState; + +typedef struct TC27XSoCState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + TriCoreCPU cpu; + + MemoryRegion dsprX; + MemoryRegion psprX; + + TC27XSoCCPUMemState cpu0mem; + TC27XSoCCPUMemState cpu1mem; + TC27XSoCCPUMemState cpu2mem; + + TC27XSoCFlashMemState flashmem; + +} TC27XSoCState; + +typedef struct MemmapEntry { + hwaddr base; + hwaddr size; +} MemmapEntry; + +typedef struct TC27XSoCClass { + DeviceClass parent_class; + + const char *name; + const char *cpu_type; + const MemmapEntry *memmap; + uint32_t num_cpus; +} TC27XSoCClass; + +enum { + TC27XD_DSPR2, + TC27XD_DCACHE2, + TC27XD_DTAG2, + TC27XD_PSPR2, + TC27XD_PCACHE2, + TC27XD_PTAG2, + TC27XD_DSPR1, + TC27XD_DCACHE1, + TC27XD_DTAG1, + TC27XD_PSPR1, + TC27XD_PCACHE1, + TC27XD_PTAG1, + TC27XD_DSPR0, + TC27XD_PSPR0, + TC27XD_PCACHE0, + TC27XD_PTAG0, + TC27XD_PFLASH0_C, + TC27XD_PFLASH1_C, + TC27XD_OLDA_C, + TC27XD_BROM_C, + TC27XD_LMURAM_C, + TC27XD_EMEM_C, + TC27XD_PFLASH0_U, + TC27XD_PFLASH1_U, + TC27XD_DFLASH0, + TC27XD_DFLASH1, + TC27XD_OLDA_U, + TC27XD_BROM_U, + TC27XD_LMURAM_U, + TC27XD_EMEM_U, + TC27XD_PSPRX, + TC27XD_DSPRX, +}; + +#endif diff --git a/include/hw/tricore/triboard.h b/include/hw/tricore/triboard.h new file mode 100644 index 0000000000..f3844be447 --- /dev/null +++ b/include/hw/tricore/triboard.h @@ -0,0 +1,50 @@ +/* + * Infineon TriBoard System emulation. + * + * Copyright (c) 2020 Andreas Konopik + * Copyright (c) 2020 David Brenken + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/boards.h" +#include "hw/arm/boot.h" +#include "sysemu/sysemu.h" +#include "exec/address-spaces.h" +#include "qom/object.h" + +#include "hw/tricore/tc27x_soc.h" + +#define TYPE_TRIBOARD_MACHINE MACHINE_TYPE_NAME("triboard") +typedef struct TriBoardMachineState TriBoardMachineState; +typedef struct TriBoardMachineClass TriBoardMachineClass; +DECLARE_OBJ_CHECKERS(TriBoardMachineState, TriBoardMachineClass, + TRIBOARD_MACHINE, TYPE_TRIBOARD_MACHINE) + + +struct TriBoardMachineState { + MachineState parent; + + TC27XSoCState tc27x_soc; +}; + +struct TriBoardMachineClass { + MachineClass parent_obj; + + const char *name; + const char *desc; + const char *soc_name; +}; --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730320; cv=none; d=zohomail.com; s=zohoarc; b=FRDv7ulib1pANZrDikpc5PI8wTkHno3lD9PC74PLUkNW2tvguDynPDE1esw/12ERJrm+jEcQ3VW7TwsG96ZKPM/ZdMZhWwQRCvsvh1eXFiP7pmzUJQJwxAFSTiREy9FZl6AubBGOisUdGg5EMz8HgFuC4Tx2Cyde5Nc0dVI6VFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=owezkjHf4VzNBvks64g9mNyjJxWdEo5teJUV2aCrJuE=; b=mGGHejrFyOE47mY6KeiZAr3HW/ZKjUo9VaaPLXZgjwbH/Xblcsoxv3sttzd2PH4KGFQR5uAmXycao87QMEs7mKGTdIC8Lwxlwtv5hVcJeQt8LGtUB7NQo87+Ilvd9dLeuyIIeJDH9/2o9WtbFrEvmNpvrN3MGcR1rZpK+cQovQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615730319587886.207867073914; Sun, 14 Mar 2021 06:58:39 -0700 (PDT) Received: from localhost ([::1]:49510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRGP-0004mE-4k for importer@patchew.org; Sun, 14 Mar 2021 09:58:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF0-000382-Rr for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:10 -0400 Received: from hoth.uni-paderborn.de ([2001:638:502:c003::19]:45848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLREz-00032l-3R for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=owezkjHf4VzNBvks64g9mNyjJxWdEo5teJUV2aCrJuE=; b=R8HqKk4sqcijC+7ywoG5cDP20n cPDKqIlKiJ24vUVq+ZrR3DbhDzSmemhp5T53I+aC4h4gtxfK3xmfGvHgjSkZlP6P3HGU9BfcAjSGm wM20oiJwGUspBS+BMtw80yR/boCQ+OSoFNjhk5WD9LhPhNjF5wk3TQxYRxIJEbBGdAfQ=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 2/7] target/tricore: Replace magic value by MMU_DATA_LOAD definition Date: Sun, 14 Mar 2021 14:55:08 +0100 Message-Id: <20210314135513.1369871-3-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367610, da=103339291, mc=565, sc=4, hc=561, sp=0, fso=31367610, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::19; envelope-from=kbastian@mail.uni-paderborn.de; helo=hoth.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type. Reviewed-by: Bastian Koppelmann Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210127224255.3505711-2-f4bug@amsat.org> Signed-off-by: Bastian Koppelmann --- target/tricore/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 7715293263..81171db833 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -50,7 +50,8 @@ hwaddr tricore_cpu_get_phys_page_debug(CPUState *cs, vadd= r addr) int prot; int mmu_idx =3D cpu_mmu_index(&cpu->env, false); =20 - if (get_physical_address(&cpu->env, &phys_addr, &prot, addr, 0, mmu_id= x)) { + if (get_physical_address(&cpu->env, &phys_addr, &prot, addr, + MMU_DATA_LOAD, mmu_idx)) { return -1; } return phys_addr; --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730321; cv=none; d=zohomail.com; s=zohoarc; b=SdL2NQynfRGmTiQ5YPtCxLVo8wOUugZtios/2EqejkDuYHHyauh58CYEkIl3qzj9DfvU40/fHC2hCNLU4HRu15/jnnCAS0MbXcCrfAD4YQCNpFM6W+nyt1UwoqCBU92w53ufty7I0mITp0JuGmf57pt/zOtesrrUuUhCkPB06os= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730321; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k9ZlXKOyc2IW4Ig6UfUilFIVrDCIcDzf6/Kocp8tSLc=; b=dNOvCGOl5n8Sz30bP4y0ggpz3n/bjvKnF8RKC4P6NRsb3o7cJiAxM4xCkzhxmrRdCSQGo2iMtusR6uoPVFAZqEJbbY949kEY8zPIs34hjFvvnu03yCVQYjcfd/teUozTpzVd/a/1ZwArcrUT2q85i9UCHt49/o5rYCLLNQGqNn0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615730321452223.1946999508499; Sun, 14 Mar 2021 06:58:41 -0700 (PDT) Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRGS-0004sA-AO for importer@patchew.org; Sun, 14 Mar 2021 09:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF4-0003CP-I1 for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:14 -0400 Received: from doohan.uni-paderborn.de ([2001:638:502:c003::16]:47808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF1-00033W-Mb for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k9ZlXKOyc2IW4Ig6UfUilFIVrDCIcDzf6/Kocp8tSLc=; b=A8lbJ0IqaDi/86o827ewygNaJD 3h67k5x4fi/+zVxJj97BBcRbmvAACAooxjw8W7Riy0YfEE8k+H7eCVC8lqRyNGHDbVPH0V2yYxHtb Yxw7zPn3Uz3//aIAptMfL1VekqxhoMZuFPW6Cp/X/L8a/gdhrCHdcDoR5S8hfVb6365s=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 3/7] target/tricore: Pass MMUAccessType to get_physical_address() Date: Sun, 14 Mar 2021 14:55:09 +0100 Message-Id: <20210314135513.1369871-4-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800002 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367612, da=103339293, mc=567, sc=4, hc=563, sp=0, fso=31367612, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::16; envelope-from=kbastian@mail.uni-paderborn.de; helo=doohan.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 'int access_type' and ACCESS_INT are unused, drop them. Provide the mmu_idx argument to match other targets. 'int rw' is actually the MMUAccessType, rename it. Reviewed-by: Bastian Koppelmann Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210127224255.3505711-3-f4bug@amsat.org> Signed-off-by: Bastian Koppelmann --- target/tricore/helper.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 81171db833..c5e997f321 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -33,7 +33,7 @@ enum { #if defined(CONFIG_SOFTMMU) static int get_physical_address(CPUTriCoreState *env, hwaddr *physical, int *prot, target_ulong address, - int rw, int access_type) + MMUAccessType access_type, int mmu_idx) { int ret =3D TLBRET_MATCH; =20 @@ -72,13 +72,11 @@ bool tricore_cpu_tlb_fill(CPUState *cs, vaddr address, = int size, CPUTriCoreState *env =3D &cpu->env; hwaddr physical; int prot; - int access_type; int ret =3D 0; =20 rw &=3D 1; - access_type =3D ACCESS_INT; ret =3D get_physical_address(env, &physical, &prot, - address, rw, access_type); + address, rw, mmu_idx); =20 qemu_log_mask(CPU_LOG_MMU, "%s address=3D" TARGET_FMT_lx " ret %d phys= ical " TARGET_FMT_plx " prot %d\n", --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730322; cv=none; d=zohomail.com; s=zohoarc; b=i7rFvdymsRsHqW9uH+ebjkfv7q301YhMN+Yyac2321qxZncDOgifeyqxI1TMEHMKxoRPF9mnsfpk3ELN0nqMOQOWcUskhUabhdDgewN0BYSqeCFPkMMvhQyjBt8EbZwg1zVhh/JyGPMjK1QayZEd9ze93M71x/IAPxhn6Z5pHLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730322; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AS2ETiqdM7stz5NUuo8/gGVsH/130bF3ICMCajRUuxU=; b=C6MlVq8jAqKv91Bd9jKF3qDlyMYrwDPH6MgMzPVB2F2HDIHuwQxY4tgw2UZO5j2jMdKGlx/kp2fhjhnt84lzI7w1e1IAtMRNSP8tteNSVO3NVBPFYRgU7cRfyBNg54QtbE1pdsoAyZUrOTiaCHI14PVJC94LJLqz5rGoBdYK3OY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161573032203821.19214977350407; Sun, 14 Mar 2021 06:58:42 -0700 (PDT) Received: from localhost ([::1]:49898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRGT-0004vj-0i for importer@patchew.org; Sun, 14 Mar 2021 09:58:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF3-0003B2-Ok for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:13 -0400 Received: from doohan.uni-paderborn.de ([2001:638:502:c003::16]:47814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF2-000357-7W for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AS2ETiqdM7stz5NUuo8/gGVsH/130bF3ICMCajRUuxU=; b=K/zfANP7OzLILfEj0gzvJXTH8P YSbR8WRy+P8oBD0YEmryNvukkYaXMV9iTOkPbNf+B2+bvy1A7LI1zARcTff8fM4fPZB4shbsbGoDL EUgpFOPsyW0uM+qo8IQX6037UdIIbgkKvOG2b4sQ4KzMTKOBX+g7v8dM8ArXqRpU8fbE=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 4/7] target/tricore: Remove unused definitions Date: Sun, 14 Mar 2021 14:55:10 +0100 Message-Id: <20210314135513.1369871-5-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367613, da=103339294, mc=569, sc=4, hc=565, sp=0, fso=31367613, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::16; envelope-from=kbastian@mail.uni-paderborn.de; helo=doohan.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Remove these confusing and unused definitions. Reviewed-by: Bastian Koppelmann Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210127224255.3505711-4-f4bug@amsat.org> Signed-off-by: Bastian Koppelmann --- target/tricore/cpu.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index b82349d1b1..4b61a2c03f 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -375,18 +375,6 @@ typedef TriCoreCPU ArchCPU; =20 #include "exec/cpu-all.h" =20 -enum { - /* 1 bit to define user level / supervisor access */ - ACCESS_USER =3D 0x00, - ACCESS_SUPER =3D 0x01, - /* 1 bit to indicate direction */ - ACCESS_STORE =3D 0x02, - /* Type of instruction that generated the access */ - ACCESS_CODE =3D 0x10, /* Code fetch access */ - ACCESS_INT =3D 0x20, /* Integer load/store access */ - ACCESS_FLOAT =3D 0x30, /* floating point load/store access */ -}; - void cpu_state_reset(CPUTriCoreState *s); void tricore_tcg_init(void); int cpu_tricore_signal_handler(int host_signum, void *pinfo, void *puc); --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730541; cv=none; d=zohomail.com; s=zohoarc; b=n8hGtdwFkrVwBFa/U/an8oWwWQ7g21i/rfOu4eCoD8wVd9XrGPTgFHm53qcTonGmL3uM/6nNmHIi+/HP9bszANzG9VYPQ1HXJf/tGDORUJO86Ctda2m5Pz6m9SYV2azPkpa3qkN05Q9rqCGNGMcvo2q3BdyTw54NOwTOzZsQ8Ws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730541; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+r3W8n+jEsKThlthwd3p6JTyqA9iau1iDI8UQsyjNKI=; b=MA+K5PFfU/1dPzGEFpjACJ5W4fs2HnTKI5I88UTrgs/pEA+OYc3+Zb4A8MBJhrQTlqR3aeUHlzrYValJbkFCSNOM0MixTQ0bYk4l3fiuEyG25jaSVckkx2irwzbb0gJUTpZSF7R9zaQFe6B5A7EYo7+Ra/y37I+JjY8iJ5qhfvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615730541272129.60898088236263; Sun, 14 Mar 2021 07:02:21 -0700 (PDT) Received: from localhost ([::1]:60306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRK0-0000vg-0d for importer@patchew.org; Sun, 14 Mar 2021 10:02:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF5-0003Er-So for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:15 -0400 Received: from hoth.uni-paderborn.de ([2001:638:502:c003::19]:45854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF3-00036E-Ue for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+r3W8n+jEsKThlthwd3p6JTyqA9iau1iDI8UQsyjNKI=; b=MyuUMPXFxyWlk/QdZK9oxnOg1Z Rv42WG/0TDAXYf3H5jVYGAj+jE2oJtw3i3oLd7ytmqqal6u+OJfxSkefqEH5ya+snULRC8LT1p6eJ ZGYB7jnuQscDwiQ8TdOOYqx4lTX+N9BszqGHi9PNbmxPcUtXAfa93XW9OcilGhN5yjsI=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 5/7] tricore: fixed faulty conditions for extr and imask Date: Sun, 14 Mar 2021 14:55:11 +0100 Message-Id: <20210314135513.1369871-6-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367615, da=103339296, mc=571, sc=4, hc=567, sp=0, fso=31367615, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::19; envelope-from=kbastian@mail.uni-paderborn.de; helo=hoth.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, David Brenken , Georg Hofstetter , Andreas Konopik Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Andreas Konopik According to the TC 1.3.1. Architecture Manual [1; page 174], results are undefined, if pos + width > 32 and not 31 or if width =3D 0. We found this error because of a different behavior between qemu-tricore and the real tricore processor. For pos + width =3D 32, qemu-tricore did not generate any intermediate code and ran into a different state compared to the real hardware. [1] https://www.infineon.com/dgdl/tc_v131_instructionset_v138.pdf?fileId=3D= db3a304412b407950112b409b6dd0352 [BK: Add the why to the commit message] Reviewed-by: Bastian Koppelmann Signed-off-by: Andreas Konopik Signed-off-by: Georg Hofstetter Signed-off-by: David Brenken Message-Id: <20210211115329.8984-2-david.brenken@efs-auto.org> Signed-off-by: Bastian Koppelmann --- target/tricore/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 7752630ac1..ebeddf8f4a 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -5777,8 +5777,8 @@ static void decode_rcpw_insert(DisasContext *ctx) switch (op2) { case OPC2_32_RCPW_IMASK: CHECK_REG_PAIR(r2); - /* if pos + width > 31 undefined result */ - if (pos + width <=3D 31) { + /* if pos + width > 32 undefined result */ + if (pos + width <=3D 32) { tcg_gen_movi_tl(cpu_gpr_d[r2+1], ((1u << width) - 1) << pos); tcg_gen_movi_tl(cpu_gpr_d[r2], (const4 << pos)); } @@ -6999,7 +6999,7 @@ static void decode_rrpw_extract_insert(DisasContext *= ctx) =20 switch (op2) { case OPC2_32_RRPW_EXTR: - if (pos + width <=3D 31) { + if (pos + width <=3D 32) { /* optimize special cases */ if ((pos =3D=3D 0) && (width =3D=3D 8)) { tcg_gen_ext8s_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); @@ -7021,7 +7021,7 @@ static void decode_rrpw_extract_insert(DisasContext *= ctx) break; case OPC2_32_RRPW_IMASK: CHECK_REG_PAIR(r3); - if (pos + width <=3D 31) { + if (pos + width <=3D 32) { tcg_gen_movi_tl(cpu_gpr_d[r3+1], ((1u << width) - 1) << pos); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r2], pos); } --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730457; cv=none; d=zohomail.com; s=zohoarc; b=crlHaax9LzibMC2L1sV1m7krsfrExm09wYVT7rFGy+BppVSlRMx1YpEi7JvQU2CDzFD7R1wyWgcMzze34UiFQKVtNnyrPAUtBRxSgtLzT+WUwtinr6+Iem0d80F/k/7VUsf11JfEgZuWSKNM5cPgjRr9a/UcsIoqKtCybuglkVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730457; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3aSRTte9ZULWzk/90FhqfstR77buAGw2N/S+ncvPqJo=; b=cmfjIeG4k1YNTENkfDQqBiQbfAxFiJZ2NqvOsSinX9fcb4Zgc4w8UIzLX/rdK10YPJzATVBcOi/f1J8IybUuRfo940ZPWxbzsAZtCZE01lwd7sq+DbJDDHsKtWJthZ70DVrBDGEmpzFPy4K54sj8xCc3SXdu6ML/PjsFbPxIubA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161573045780650.064300437815746; Sun, 14 Mar 2021 07:00:57 -0700 (PDT) Received: from localhost ([::1]:57246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRIc-0007wF-Vg for importer@patchew.org; Sun, 14 Mar 2021 10:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF7-0003Im-LY for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:17 -0400 Received: from shirlock.uni-paderborn.de ([2001:638:502:c003::15]:36904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF5-00037R-Vb for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3aSRTte9ZULWzk/90FhqfstR77buAGw2N/S+ncvPqJo=; b=l2J5qIQzJJu0Wbp3NazzSCLOjG JLS3XroX3itBZF8HEcA+KWCqXlzt1VCGZFaKfK8VDnA2T8r6m4ZkO9ojMBWieLOryrGGRACbKrLi0 +dTCXkN/oVZqfW0rkCway/jiP52rS53wQijmuLjrleqAnw9RrS6MoVrAd6ircfuk/lbA=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 6/7] target/tricore: Fix imask OPC2_32_RRPW_IMASK for r3+1 == r2 Date: Sun, 14 Mar 2021 14:55:12 +0100 Message-Id: <20210314135513.1369871-7-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.3.13.5800002 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367616, da=103339297, mc=573, sc=4, hc=569, sp=0, fso=31367616, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::15; envelope-from=kbastian@mail.uni-paderborn.de; helo=shirlock.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" if r3+1 and r2 are the same then we would overwrite r2 with our first move and use the wrong result for the shift. Thus we store the result from the mov in a temp. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann --- target/tricore/translate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index ebeddf8f4a..5b7ed70e39 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -6989,6 +6989,7 @@ static void decode_rrpw_extract_insert(DisasContext *= ctx) uint32_t op2; int r1, r2, r3; int32_t pos, width; + TCGv temp; =20 op2 =3D MASK_OP_RRPW_OP2(ctx->opcode); r1 =3D MASK_OP_RRPW_S1(ctx->opcode); @@ -7021,10 +7022,15 @@ static void decode_rrpw_extract_insert(DisasContext= *ctx) break; case OPC2_32_RRPW_IMASK: CHECK_REG_PAIR(r3); + if (pos + width <=3D 32) { - tcg_gen_movi_tl(cpu_gpr_d[r3+1], ((1u << width) - 1) << pos); + temp =3D tcg_temp_new(); + tcg_gen_movi_tl(temp, ((1u << width) - 1) << pos); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r2], pos); + tcg_gen_mov_tl(cpu_gpr_d[r3 + 1], temp); + tcg_temp_free(temp); } + break; case OPC2_32_RRPW_INSERT: if (pos + width <=3D 32) { --=20 2.30.1 From nobody Sun May 19 03:54:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1615730626; cv=none; d=zohomail.com; s=zohoarc; b=LfhmqYTGhZxAXMB5FRnF8lj1Q5r/JJ8ZGd3Xqj8TjRX/itnIVXz3lQYW02TmpmbcBKQo6Ghj0AUzhCf23ANEIu90OOOqNiswVyUHySfJsbYJno3jFh4EU84+L3hDdxiLgFULoeMzNMJSwS+LOesTqnDrKqMlnusgGl/y3woVbqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615730626; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oUmowQ9d9iCIHAcueK7Re3aZKbvA5OZOA2lY3aK4+Bc=; b=VE+qGrjAU8oQxD5ee3B4UuVNyqBTSnvhd1V9z6LgON14Bk9EF9jm8lxA01o0rNOK1RSL5Pq+AcHuFn9IRBqPuxjjA8rNxUP1nbIwjOhFMyVn1anGftYfAL3dhgDL5GMiS5hvNYTCl2IY9xbLrttMdofvEoGk//hb3y/aDiDnuAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615730626646394.98729905386006; Sun, 14 Mar 2021 07:03:46 -0700 (PDT) Received: from localhost ([::1]:35300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLRLN-0002IE-JM for importer@patchew.org; Sun, 14 Mar 2021 10:03:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRFA-0003PE-El for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:20 -0400 Received: from hoth.uni-paderborn.de ([2001:638:502:c003::19]:45862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLRF7-00038m-Km for qemu-devel@nongnu.org; Sun, 14 Mar 2021 09:57:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oUmowQ9d9iCIHAcueK7Re3aZKbvA5OZOA2lY3aK4+Bc=; b=UG9URUqb5paY+4RFgwKch01fqG nSncTbtuzHoUGKrLi86X6RcgL1Cz9BcEGCBn7FcQL4seo54OvuLaWoaqueMcVp4PNmNFcArMAk47q IMwwez6FwCqPRdGmWc8pIfvF5JF0YVhGFY/x7gxdENG+j22XSqPdZQ6SZKGo3wIRE808=; X-Envelope-From: From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 7/7] target/tricore: Fix OPC2_32_RRPW_EXTR for width=0 Date: Sun, 14 Mar 2021 14:55:13 +0100 Message-Id: <20210314135513.1369871-8-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> References: <20210314135513.1369871-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2021.3.14.134815, AntiVirus-Engine: 5.80.0, AntiVirus-Data: 2021.2.8.5800000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=31367618, da=103339299, mc=575, sc=4, hc=571, sp=0, fso=31367618, re=0, sd=0, hd=0 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de 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=2001:638:502:c003::19; envelope-from=kbastian@mail.uni-paderborn.de; helo=hoth.uni-paderborn.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: kbastian@mail.uni-paderborn.de, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) if width was 0 we would run into the assertion: qemu-system-tricore: tcg/tcg-op.c:217: tcg_gen_sari_i32: Assertion `arg2 >= =3D 0 && arg2 < 32' failed.o The instruction manual specifies undefined behaviour for this case. So we bring this in line with the golden Infineon simlator 'tsim', which simply writes 0 to the result in case of width=3D0. Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Bastian Koppelmann --- target/tricore/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 5b7ed70e39..2a814263de 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -7000,6 +7000,11 @@ static void decode_rrpw_extract_insert(DisasContext = *ctx) =20 switch (op2) { case OPC2_32_RRPW_EXTR: + if (width =3D=3D 0) { + tcg_gen_movi_tl(cpu_gpr_d[r3], 0); + break; + } + if (pos + width <=3D 32) { /* optimize special cases */ if ((pos =3D=3D 0) && (width =3D=3D 8)) { --=20 2.30.1