From nobody Tue Feb 10 23:13:45 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1620815245; cv=none; d=zohomail.com; s=zohoarc; b=jFJK221r7wweLGUgNEEgJwFUn3MahXYDdjjgkHPrSSqu9fX6lR6VBisaPkHEj4Ey44XHeXARdFdeEcp0N05tWyjZkvUGptXV7GOy7n9dnuizNkKQ/FV+4xpmXngVXll9uYk4lP0HKRheHyoSEl3e7XraM9RUO1wu/NquSAsAEeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620815245; 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=Ci7dPAMJyayfYNj3hZaWT3hefWzNQwgkwFzrMvlg9Tw=; b=muWjSh+j/IpM0kYLubYB3RibcMRn4DMWQXIBSdLY/FXoJ1UXlKhA3arqwpOI+MjpWbrVUUZMfOSpM/RMBBhz4TnI+fo3gLoed6nMIAKswRCjV0mCVcNbEukxqRb0yxyw+a7Op+ozLHo9ZxPlmR6L9Q/yA2B4DL6AAXCB9gudxnc= 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 1620815245603536.3190625799443; Wed, 12 May 2021 03:27:25 -0700 (PDT) Received: from localhost ([::1]:51558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgm5M-0003x7-Hn for importer@patchew.org; Wed, 12 May 2021 06:27:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lglzP-0003wh-K8 for qemu-devel@nongnu.org; Wed, 12 May 2021 06:21:15 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lglzM-0003j0-B0 for qemu-devel@nongnu.org; Wed, 12 May 2021 06:21:15 -0400 Received: by mail-wr1-x42a.google.com with SMTP id l14so23048415wrx.5 for ; Wed, 12 May 2021 03:21:11 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z19sm5675472wmf.47.2021.05.12.03.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 03:21:04 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6C4BB1FF9C; Wed, 12 May 2021 11:20:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ci7dPAMJyayfYNj3hZaWT3hefWzNQwgkwFzrMvlg9Tw=; b=wjGXFKQiONlWrNse72AnFaY8Xj3EW/pUeX/sE+GqlbN0/DrOnbjV1ZLSOTnnEA00j0 jRStMNr3MOKWR/itQBE4g13hmlPp9O2gHFxNPvPNNBZHNdK8PaW6yYxO/+1IXRKF9zlw TbK/57UsiqffEck13efWt7Q8ZqxR4G9D2++YL0AYElT9wI0NKNyeo4CHXvT7COIcjgsZ lhIqMxd7oThCq3Qi7YJDFXsa4GLHYrMTH4q9necZy3k22kHpHAY8+9FgS5IgaUKqaHBI /jezt8MDpnUZPbQZUDTJvyJ9YcigDgVmD7PNusAH8aMHKDjDt9LEoxvrzTGnEC8WT2hl WbLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ci7dPAMJyayfYNj3hZaWT3hefWzNQwgkwFzrMvlg9Tw=; b=i2LNr0QWtpCkwP/JyyDV0p2+wOJhjaZjXbrr1YPBUkMnvUWomUMkPoo3Pto+VGHXMn BHXEdsnZgbzBmUdT37vMJbAzz1OYY2KwcHcfSzdPjySa3XJeCf4xiehK3Oli8s3GHy+T 7hOtX2AmnApzwoObpAcoN+3ijps938TGOjyU+PytFR+AMlVERZp0F/h9cTdvEkup23es we/FpxlgEv0tCdXgsjpBJZiOIHRSW6D4AeBcb1eEhw7p7Lv4sF49uq91kcVxPAE1CEN8 jYYt3Az7TFmKxUcu3yzOMAh/PwiTzJfSSCkKNEukYzSvQloSuTj++Ybjw7+3nWFBK3qV K7QQ== X-Gm-Message-State: AOAM531WtdDpTW4EbCQ3jmcUIxB2OUvI4Q/v/s8vBOSYaHptsZ4B/Mlt c8gcvku3GV5QS8JZacb8DWmghw== X-Google-Smtp-Source: ABdhPJyWOs7NLS7cjcfjaPbcs5jlbBZqOzW3hegM1Rp9mFTzV+Ex606xuONxmaHWis6pMquColwOCw== X-Received: by 2002:adf:e707:: with SMTP id c7mr2271441wrm.137.1620814870985; Wed, 12 May 2021 03:21:10 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 13/31] hw/tricore: Add testdevice for tests in tests/tcg/ Date: Wed, 12 May 2021 11:20:33 +0100 Message-Id: <20210512102051.12134-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210512102051.12134-1-alex.bennee@linaro.org> References: <20210512102051.12134-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-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: fam@euphon.net, berrange@redhat.com, Bastian Koppelmann , f4bug@amsat.org, stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Bastian Koppelmann 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. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Bastian Koppelmann Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210305170045.869437-4-kbastian@mail.uni-paderborn.de> --- include/hw/tricore/tricore_testdevice.h | 38 ++++++++++++ hw/tricore/tricore_testboard.c | 8 +++ hw/tricore/tricore_testdevice.c | 82 +++++++++++++++++++++++++ hw/tricore/meson.build | 1 + 4 files changed, 129 insertions(+) create mode 100644 include/hw/tricore/tricore_testdevice.h create mode 100644 hw/tricore/tricore_testdevice.c diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/t= ricore_testdevice.h new file mode 100644 index 0000000000..2c56c51bcb --- /dev/null +++ b/include/hw/tricore/tricore_testdevice.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018-2021 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 diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 51658d9e37..b6810e3be0 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -27,6 +27,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/tricore/tricore.h" +#include "hw/tricore/tricore_testdevice.h" #include "qemu/error-report.h" =20 =20 @@ -56,6 +57,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); @@ -87,6 +89,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_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..a1563aa568 --- /dev/null +++ b/hw/tricore/tricore_testdevice.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2018-2021 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/hw/tricore/meson.build b/hw/tricore/meson.build index 77ff6fd137..47e36bb077 100644 --- a/hw/tricore/meson.build +++ b/hw/tricore/meson.build @@ -1,5 +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_TRICORE', if_true: files('tricore_testdevice.= 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 --=20 2.20.1