From nobody Tue Feb 10 12:59:32 2026 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=1591260983; cv=none; d=zohomail.com; s=zohoarc; b=hREfEX5qNFFjqiIHR4SgvaFaCaWPMBpCZxtFtrBV3ZWD8mqTz5e4dTy++kmhY9MXq3CZ8rYAWUg+EeftEDd/LIMpjSrf7psZ2YlLFmX0bO2i+MiSScGT9Al8/kzTc9auE5a4QnO3hvox/w5quWo2U5MHnQDGoOlWcbfQxWNqzis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591260983; 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=z29k5ofXDZaXW51Qot4mmMVhd5Gd8SetC6RahsmCg7Y=; b=gTAdj6HkbImiBDWOtE+/gIhkievQIjQyfCIkuMBI82OG4XmedZUzSW9fvaxlsQv1oiUDO3NYpfpXGC8G6X1RLYnBiPy8gvKFDaxY2ak7fwz8yQTbyMMFcNj78Tcb0pZyYQ7iENd0pV8r7vNSGSxDkSh1OX9eGE4AEiPWRg0yX8w= 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 1591260983197888.0178095303734; Thu, 4 Jun 2020 01:56:23 -0700 (PDT) Received: from localhost ([::1]:36174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jglfh-0001Vl-Uh for importer@patchew.org; Thu, 04 Jun 2020 04:56:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgleP-00085T-Hh for qemu-devel@nongnu.org; Thu, 04 Jun 2020 04:55:01 -0400 Received: from shirlock.uni-paderborn.de ([2001:638:502:c003::15]:42306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgleO-0002Du-Iu for qemu-devel@nongnu.org; Thu, 04 Jun 2020 04:55:01 -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=z29k5ofXDZaXW51Qot4mmMVhd5Gd8SetC6RahsmCg7Y=; b=Nylyvi9cvxtZAosLvoNNKaFeNq ETYGVrxUCv5G88LG4Ir7KzNQ70dTmE7zJwagevee9OzTuYCFHxVSXv9GEgdxlkF5Z+sgplk51K7PS ZeoKyULCvWNxtzkrkzSCheynnazTSfOY07Gy+IkmG2filel6ekxw81z4b3qANfLiiXr0=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PATCH v2 04/15] hw/tricore: Add testdevice for tests in tests/tcg/ Date: Thu, 4 Jun 2020 10:54:30 +0200 Message-Id: <20200604085441.103087-5-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200604085441.103087-1-kbastian@mail.uni-paderborn.de> References: <20200604085441.103087-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.4.84518, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.4.5740000 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6898282, da=78869963, mc=175, sc=3, hc=172, sp=1, fso=6898282, re=0, sd=0, hd=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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: alex.bennee@linaro.org 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" this device is used to verify the correctness of regression tests by allowing guests to write their exit status to this device. This is then used by qemu to exit using the written status. Signed-off-by: Bastian Koppelmann Reviewed-by: Alex Benn=C3=A9e --- hw/tricore/Makefile.objs | 2 +- hw/tricore/tricore_testboard.c | 8 +++ hw/tricore/tricore_testdevice.c | 82 +++++++++++++++++++++++++ include/hw/tricore/tricore_testdevice.h | 38 ++++++++++++ 4 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 hw/tricore/tricore_testdevice.c create mode 100644 include/hw/tricore/tricore_testdevice.h diff --git a/hw/tricore/Makefile.objs b/hw/tricore/Makefile.objs index 5501f6c1a8..163148d04a 100644 --- a/hw/tricore/Makefile.objs +++ b/hw/tricore/Makefile.objs @@ -1 +1 @@ -obj-$(CONFIG_TRICORE) +=3D tricore_testboard.o +obj-$(CONFIG_TRICORE) +=3D tricore_testboard.o tricore_testdevice.o diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 8ec2b5bddd..b826c99b5f 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -28,6 +28,7 @@ #include "exec/address-spaces.h" #include "elf.h" #include "hw/tricore/tricore.h" +#include "hw/tricore/tricore_testdevice.h" #include "qemu/error-report.h" =20 =20 @@ -57,6 +58,7 @@ static void tricore_testboard_init(MachineState *machine,= int board_id) { TriCoreCPU *cpu; CPUTriCoreState *env; + TriCoreTestDeviceState *test_dev; =20 MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *ext_cram =3D g_new(MemoryRegion, 1); @@ -88,6 +90,12 @@ static void tricore_testboard_init(MachineState *machine= , int board_id) memory_region_add_subregion(sysmem, 0xf0050000, pcp_data); memory_region_add_subregion(sysmem, 0xf0060000, pcp_text); =20 + /* test device */ + test_dev =3D g_new(TriCoreTestDeviceState, 1); + object_initialize(test_dev, sizeof(TriCoreTestDeviceState), + TYPE_TRICORE_TESTDEVICE); + memory_region_add_subregion(sysmem, 0xf0000000, &test_dev->iomem); + tricoretb_binfo.ram_size =3D machine->ram_size; tricoretb_binfo.kernel_filename =3D machine->kernel_filename; =20 diff --git a/hw/tricore/tricore_testdevice.c b/hw/tricore/tricore_testdevic= e.c new file mode 100644 index 0000000000..676e00b465 --- /dev/null +++ b/hw/tricore/tricore_testdevice.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2018 Bastian Koppelmann Paderborn University + * + * 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 "hw/sysbus.h" +#include "hw/qdev-properties.h" +#include "hw/tricore/tricore_testdevice.h" + +static void tricore_testdevice_write(void *opaque, hwaddr offset, + uint64_t value, unsigned size) +{ + exit(value); +} + +static uint64_t tricore_testdevice_read(void *opaque, hwaddr offset, + unsigned size) +{ + return 0xdeadbeef; +} + +static void tricore_testdevice_reset(DeviceState *dev) +{ +} + +static const MemoryRegionOps tricore_testdevice_ops =3D { + .read =3D tricore_testdevice_read, + .write =3D tricore_testdevice_write, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, + .endianness =3D DEVICE_NATIVE_ENDIAN, +}; + +static void tricore_testdevice_init(Object *obj) +{ + TriCoreTestDeviceState *s =3D TRICORE_TESTDEVICE(obj); + /* map memory */ + memory_region_init_io(&s->iomem, OBJECT(s), &tricore_testdevice_ops, s, + "tricore_testdevice", 0x4); +} + +static Property tricore_testdevice_properties[] =3D { + DEFINE_PROP_END_OF_LIST() +}; + +static void tricore_testdevice_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + device_class_set_props(dc, tricore_testdevice_properties); + dc->reset =3D tricore_testdevice_reset; +} + +static const TypeInfo tricore_testdevice_info =3D { + .name =3D TYPE_TRICORE_TESTDEVICE, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(TriCoreTestDeviceState), + .instance_init =3D tricore_testdevice_init, + .class_init =3D tricore_testdevice_class_init, +}; + +static void tricore_testdevice_register_types(void) +{ + type_register_static(&tricore_testdevice_info); +} + +type_init(tricore_testdevice_register_types) diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/t= ricore_testdevice.h new file mode 100644 index 0000000000..5b2df219e3 --- /dev/null +++ b/include/hw/tricore/tricore_testdevice.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 Bastian Koppelmann Paderborn University + * + * 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 HW_TRICORE_TESTDEV_H +#define HW_TRICORE_TESTDEV_H + +#include "hw/sysbus.h" +#include "hw/hw.h" + +#define TYPE_TRICORE_TESTDEVICE "tricore_testdevice" +#define TRICORE_TESTDEVICE(obj) \ + OBJECT_CHECK(TriCoreTestDeviceState, (obj), TYPE_TRICORE_TESTDEVICE) + +typedef struct { + /* */ + SysBusDevice parent_obj; + + /* */ + MemoryRegion iomem; + +} TriCoreTestDeviceState; + +#endif --=20 2.26.2