From nobody Sat Sep 28 01:33:47 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