From nobody Fri Sep 27 23:13:57 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603489654; cv=none; d=zohomail.com; s=zohoarc; b=ISmlwe766gSo1eZx5AYtdGtBLT8E2TC+1zX10tzlX4+6+JO/Lpu9ZH9PdVqjBBZvTkjUumCFbrgk07mcW1e5cROYEL2DqHbAwXoR/TUdzIAa/l2OspQ9KcAqT2jSZtI5emllx9dsWteRAclPjW4s+IjgAF9q9KNzehHBbzi+sZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603489654; 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:Reply-To:References:Sender:Subject:To; bh=ZxPrQDUF+CH6Kj+sM+Y63GSAdpUzHvKBDgmTzZiwrdQ=; b=aCbrq11S5js1Jw1rUD4fdoPyn2yO6e6ylH9eDH6S2cCryMyXUk2CwEeM9xFqF4rpJFWW8cbbihCk+UJEFpNU2LYwFAtC1kALeAIafQNqnSOKlvfMRdRO24eqrIJaY4YRBbF7TC78JLI/X5n+FVqQPbjAJlwj62O2qy65N5jxZOM= 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=pass 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 1603489654088466.0419149946167; Fri, 23 Oct 2020 14:47:34 -0700 (PDT) Received: from localhost ([::1]:33178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW4uL-0006Iw-1s for importer@patchew.org; Fri, 23 Oct 2020 17:47:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW4sF-0005H7-Nl for qemu-devel@nongnu.org; Fri, 23 Oct 2020 17:45:23 -0400 Received: from home.keithp.com ([63.227.221.253]:42418 helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW4sA-0007G1-B3 for qemu-devel@nongnu.org; Fri, 23 Oct 2020 17:45:23 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 896C23F2DD15 for ; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uXvQ_44UuN9a; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 3B4A13F2DD11; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 0726915821A2; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1603489513; bh=o9FSc9IqFdAVRsYbyKeZduUk4m6kW9TmMdzQOXB/0Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9S7XY+mRROGKh0fL8fe1LvmiDJYV/JvgnIhsm9BUlZQrZX3G8HDYfXnoCsXhpzqs vg8kpxl1mOPEtKfFoktaz2NAcf1OmCnNcRtd0qi+uDEBRIt8W4yDBvmCMz7x/iA/fS W8mRS3D+AER0gl15B11H35mXTpAkyVdfQPOzXaMjUZfuu4HyGHOiMzIS1ygIQXqD7D JiqqGvznboHoV/sXvZl2xVlqGepWfnlHcM/d0myX5nJpXW0+J0gYRMQcsNe3j08WUn +ynd+zhDBHculPpLAjbN3v6GTsmZIELKQ/J7BNMeDMYfjmZSbb+7hSdBDBFLFmrKor UI+35QtBlpiUA== X-Virus-Scanned: Debian amavisd-new at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1603489513; bh=o9FSc9IqFdAVRsYbyKeZduUk4m6kW9TmMdzQOXB/0Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9S7XY+mRROGKh0fL8fe1LvmiDJYV/JvgnIhsm9BUlZQrZX3G8HDYfXnoCsXhpzqs vg8kpxl1mOPEtKfFoktaz2NAcf1OmCnNcRtd0qi+uDEBRIt8W4yDBvmCMz7x/iA/fS W8mRS3D+AER0gl15B11H35mXTpAkyVdfQPOzXaMjUZfuu4HyGHOiMzIS1ygIQXqD7D JiqqGvznboHoV/sXvZl2xVlqGepWfnlHcM/d0myX5nJpXW0+J0gYRMQcsNe3j08WUn +ynd+zhDBHculPpLAjbN3v6GTsmZIELKQ/J7BNMeDMYfjmZSbb+7hSdBDBFLFmrKor UI+35QtBlpiUA== To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 1/2] riscv: Add sifive test device to sifive_e target Date: Fri, 23 Oct 2020 14:45:05 -0700 Message-Id: <20201023214506.917601-2-keithp@keithp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023214506.917601-1-keithp@keithp.com> References: <20201023214506.917601-1-keithp@keithp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/23 17:45:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Keith Packard From: Keith Packard via X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The SiFive test device provides a mechanism for terminating the qemu instance from the emulated system. This patch adds that device to the sifive_e target. Signed-off-by: Keith Packard --- hw/riscv/sifive_e.c | 4 ++++ include/hw/riscv/sifive_e.h | 1 + 2 files changed, 5 insertions(+) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index fcfac16816..417e3a5409 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -11,6 +11,7 @@ * 3) PRCI (Power, Reset, Clock, Interrupt) * 4) Registers emulated as RAM: AON, GPIO, QSPI, PWM * 5) Flash memory emulated as RAM + * 6) TEST (Test device) * * The Mask ROM reset vector jumps to the flash payload at 0x2040_0000. * The OTP ROM and Flash boot code will be emulated in a future version. @@ -45,6 +46,7 @@ #include "hw/intc/sifive_clint.h" #include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_e_prci.h" +#include "hw/misc/sifive_test.h" #include "chardev/char.h" #include "sysemu/arch_init.h" #include "sysemu/sysemu.h" @@ -57,6 +59,7 @@ static const struct MemmapEntry { [SIFIVE_E_DEV_DEBUG] =3D { 0x0, 0x1000 }, [SIFIVE_E_DEV_MROM] =3D { 0x1000, 0x2000 }, [SIFIVE_E_DEV_OTP] =3D { 0x20000, 0x2000 }, + [SIFIVE_E_DEV_TEST] =3D { 0x100000, 0x1000 }, [SIFIVE_E_DEV_CLINT] =3D { 0x2000000, 0x10000 }, [SIFIVE_E_DEV_PLIC] =3D { 0xc000000, 0x4000000 }, [SIFIVE_E_DEV_AON] =3D { 0x10000000, 0x8000 }, @@ -216,6 +219,7 @@ static void sifive_e_soc_realize(DeviceState *dev, Erro= r **errp) memmap[SIFIVE_E_DEV_CLINT].size, 0, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, SIFIVE_CLINT_TIMEBASE_FREQ, false); + sifive_test_create(memmap[SIFIVE_E_DEV_TEST].base); create_unimplemented_device("riscv.sifive.e.aon", memmap[SIFIVE_E_DEV_AON].base, memmap[SIFIVE_E_DEV_AON].size); sifive_e_prci_create(memmap[SIFIVE_E_DEV_PRCI].base); diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index 83604da805..92bab6d0d4 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -56,6 +56,7 @@ enum { SIFIVE_E_DEV_DEBUG, SIFIVE_E_DEV_MROM, SIFIVE_E_DEV_OTP, + SIFIVE_E_DEV_TEST, SIFIVE_E_DEV_CLINT, SIFIVE_E_DEV_PLIC, SIFIVE_E_DEV_AON, --=20 2.28.0 From nobody Fri Sep 27 23:13:57 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603489748; cv=none; d=zohomail.com; s=zohoarc; b=kK+a5ZLTzWqymqnWUXnGq9/pM4WuPO75cDuR0Npjv8vcKEu9SCBTwbM6REJZZx3M78YhB5v5MPeu1tEuxV3qsCoJ6zfv8CtQjZoa0Rs5PRxDqt8C0S907wUiD+hkfumsiU5gte32si51mQHKmmfBkDpZ8O6qqPDrzuERvo2cfyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603489748; 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:Reply-To:References:Sender:Subject:To; bh=7trUlEndUx28b15GRdWCGLhbCy3/xOc93y7sFQ3uSkA=; b=TiQ3ZmT3zS52sGiyBWaUmQtvaZNs+uBXlkciocsDek5Z7H8qWtEgTr9v9f4mktntCW/A2CQvc/F0PEzpm+VXD00Pkx1lmZWTDvqz+ZCe+vFfZiaAu+L4uw/oLJXIBOG3Mh5yn41b4r4WBfxkry3CShVRhW6m8Coy7ERIogWQW/Y= 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=pass 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 1603489748438360.8635374461239; Fri, 23 Oct 2020 14:49:08 -0700 (PDT) Received: from localhost ([::1]:36450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW4vr-0007nU-Di for importer@patchew.org; Fri, 23 Oct 2020 17:49:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW4sH-0005HX-2J for qemu-devel@nongnu.org; Fri, 23 Oct 2020 17:45:25 -0400 Received: from home.keithp.com ([63.227.221.253]:42420 helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW4sA-0007G2-Aq for qemu-devel@nongnu.org; Fri, 23 Oct 2020 17:45:24 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id DFE1E3F2DD11 for ; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9s8bwTYW_TUN; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 3B4F73F2DD12; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 0E35415821A8; Fri, 23 Oct 2020 14:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1603489513; bh=DmcK7hvUL57Bb6vQP0V4uayY6PWIubyTh96C95EW67g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nm8SIOxjqBGO/QEB5rE5g7plREOiJ+nMj4YNUtXX3iLxhRUWWg81GNjLPz55uIT27 ADb/6z3/mzrn7BRxW0kVw5wTwwiPMIxfuWp1PoG2SQpF/2GvcMMCcWSUa2yBWwgR6P uPlwEi1wJvQ8Z1ZocDqmz5hVIEUkIjHf6FTrTwLScJXl5suUdVHFxQSjB+2LHQiDbA EfLhysp2UKeIzZrl+Bl3/T5iMXFNeROj2zzabuVzj3gp73STS/bTAQhlLaAZDj9ldU FOhAmdSGjtyC9QmJ9jIkg64uEQREnf4pWALQd1VAy7IumlnjIlQQWgFyRp16N71Itk J32E1Op3Ia3Ew== X-Virus-Scanned: Debian amavisd-new at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1603489513; bh=DmcK7hvUL57Bb6vQP0V4uayY6PWIubyTh96C95EW67g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nm8SIOxjqBGO/QEB5rE5g7plREOiJ+nMj4YNUtXX3iLxhRUWWg81GNjLPz55uIT27 ADb/6z3/mzrn7BRxW0kVw5wTwwiPMIxfuWp1PoG2SQpF/2GvcMMCcWSUa2yBWwgR6P uPlwEi1wJvQ8Z1ZocDqmz5hVIEUkIjHf6FTrTwLScJXl5suUdVHFxQSjB+2LHQiDbA EfLhysp2UKeIzZrl+Bl3/T5iMXFNeROj2zzabuVzj3gp73STS/bTAQhlLaAZDj9ldU FOhAmdSGjtyC9QmJ9jIkg64uEQREnf4pWALQd1VAy7IumlnjIlQQWgFyRp16N71Itk J32E1Op3Ia3Ew== To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 2/2] riscv: Add sifive test device to sifive_u target Date: Fri, 23 Oct 2020 14:45:06 -0700 Message-Id: <20201023214506.917601-3-keithp@keithp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023214506.917601-1-keithp@keithp.com> References: <20201023214506.917601-1-keithp@keithp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/23 17:45:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Keith Packard From: Keith Packard via X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The SiFive test device provides a mechanism for terminating the qemu instance from the emulated system. This patch adds that device to the sifive_u target, including constructing a suitable FDT node. Signed-off-by: Keith Packard --- hw/riscv/sifive_u.c | 15 +++++++++++++++ include/hw/riscv/sifive_u.h | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 6ad975d692..8d803fe7c0 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -15,6 +15,7 @@ * 5) OTP (One-Time Programmable) memory with stored serial number * 6) GEM (Gigabit Ethernet Controller) and management block * 7) DMA (Direct Memory Access Controller) + * 8) TEST (Test device) * * This board currently generates devicetree dynamically that indicates at= least * two harts and up to five harts. @@ -44,6 +45,7 @@ #include "hw/char/serial.h" #include "hw/cpu/cluster.h" #include "hw/misc/unimp.h" +#include "hw/misc/sifive_test.h" #include "target/riscv/cpu.h" #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_u.h" @@ -72,6 +74,7 @@ static const struct MemmapEntry { } sifive_u_memmap[] =3D { [SIFIVE_U_DEV_DEBUG] =3D { 0x0, 0x100 }, [SIFIVE_U_DEV_MROM] =3D { 0x1000, 0xf000 }, + [SIFIVE_U_DEV_TEST] =3D { 0x100000, 0x1000 }, [SIFIVE_U_DEV_CLINT] =3D { 0x2000000, 0x10000 }, [SIFIVE_U_DEV_L2CC] =3D { 0x2010000, 0x1000 }, [SIFIVE_U_DEV_PDMA] =3D { 0x3000000, 0x100000 }, @@ -397,6 +400,16 @@ static void create_fdt(SiFiveUState *s, const struct M= emmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/aliases", "serial0", nodename); =20 g_free(nodename); + + nodename =3D g_strdup_printf("/soc/test@%lx", + (long)memmap[SIFIVE_U_DEV_TEST].base); + qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,test0"); + qemu_fdt_setprop_cells(fdt, nodename, "reg", + 0x0, memmap[SIFIVE_U_DEV_TEST].base, + 0x0, memmap[SIFIVE_U_DEV_TEST].size); + + g_free(nodename); } =20 static void sifive_u_machine_reset(void *opaque, int n, int level) @@ -780,6 +793,8 @@ static void sifive_u_soc_realize(DeviceState *dev, Erro= r **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0, qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_GEM_IRQ)= ); =20 + sifive_test_create(memmap[SIFIVE_U_DEV_TEST].base); + create_unimplemented_device("riscv.sifive.u.gem-mgmt", memmap[SIFIVE_U_DEV_GEM_MGMT].base, memmap[SIFIVE_U_DEV_GEM_MGMT].= size); =20 diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 22e7e6efa1..4b3ebc3fc6 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -72,6 +72,7 @@ typedef struct SiFiveUState { enum { SIFIVE_U_DEV_DEBUG, SIFIVE_U_DEV_MROM, + SIFIVE_U_DEV_TEST, SIFIVE_U_DEV_CLINT, SIFIVE_U_DEV_L2CC, SIFIVE_U_DEV_PDMA, --=20 2.28.0