From patchwork Tue Aug 27 14:58:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11117173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D10F314DE for ; Tue, 27 Aug 2019 15:12:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4BAE2070B for ; Tue, 27 Aug 2019 15:12:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LlpFlNiW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4BAE2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2d95-0000eO-9B for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Aug 2019 11:12:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46764) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2cwE-0003L0-CB for qemu-devel@nongnu.org; Tue, 27 Aug 2019 10:59:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2cw7-0003jN-L9 for qemu-devel@nongnu.org; Tue, 27 Aug 2019 10:59:09 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2cw1-0003Wk-4b; Tue, 27 Aug 2019 10:59:02 -0400 Received: by mail-pg1-x544.google.com with SMTP id d1so12842449pgp.4; Tue, 27 Aug 2019 07:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=o5G5QsojHpHLZ4b2+LQv6vJDJLY5Fa7mmuwFQaJWcVM=; b=LlpFlNiWY1rkY43jpTpQb7MD/cZqjwYD+2VXSMjc2SgP2yUCX/jrCuZaioZQdHfobH rkecDGA3fiNMd+A/q+DHv+prxjkMn/V8ENPeK3qr3XRZuQ7+DQkISfQxmYDBY6xtTp4g uP5P+Ac7TO4jnceH5piPvZ/QAYr1/1eSIdow5UTJnNB+ZeZQf8NrpzlFPnZlCc1sb4pK AtWs6TpOK85favCoiShr07RmPpBn0SjjhKaXqDiMli3gX7zhQnwi6gIb66mNANbrdv3t rhLbywihuQio49spRPh4neqr3vJq+r/3z3lKeBBBVJuninJmuQjXcgsM4I6yZqDxCei3 dtHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=o5G5QsojHpHLZ4b2+LQv6vJDJLY5Fa7mmuwFQaJWcVM=; b=i81C86a35V408iHMaCE4cW6NzMc7BQ/3LphbKDgOmoIjKSLXn967oKKJJoggNihJk+ lKMkl/+EKfxKf1jJDt/eTmNZ54bVzpHKOZZq3BC5LYXPnCcreBDiKrped947gIpaeLXQ v+jRtHt8m+Hn2fi8GZeET3POmsgg3jlulp8gLYcnF3fg7UxPmY1mZNygTgmZv9mmM5Ro ByPe4fbM4HIDC/+89ASCi7UQxHP6Rbjr4wVLE328B3RedSDxsTX5+hyDNAmAZGnAUpyC lkB+DPS2U5bzYydztzHiG2g1adCou75Qw0oB/kK6zHHnqAyeZemC/vou4POO7SZ1DpS9 a0WA== X-Gm-Message-State: APjAAAUpQOtQD3/CBYGmGKd3+zxDsuWuQi0fnbyIky79uZkGX6bfPsuX 1iNNoqdahHoEKR3Kq4F98pY= X-Google-Smtp-Source: APXvYqxYFc1ev1IVwtO9KjiW1BMXoZ66pm1AVfh5A5412bmWba0v/QLJGXZjcgO+dlGcUMEiD7QrdA== X-Received: by 2002:a63:1046:: with SMTP id 6mr22169466pgq.111.1566917938209; Tue, 27 Aug 2019 07:58:58 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id j15sm14839344pfr.146.2019.08.27.07.58.57 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Aug 2019 07:58:57 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Tue, 27 Aug 2019 07:58:21 -0700 Message-Id: <1566917919-25381-13-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566917919-25381-1-git-send-email-bmeng.cn@gmail.com> References: <1566917919-25381-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v6 12/30] riscv: sifive_e: Drop sifive_mmio_emulate() 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Use create_unimplemented_device() instead. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - drop patch "riscv: sifive: Move sifive_mmio_emulate() to a common place" - new patch "riscv: sifive_e: Drop sifive_mmio_emulate()" hw/riscv/sifive_e.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 2d67670..040d59f 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -37,6 +37,7 @@ #include "hw/loader.h" #include "hw/sysbus.h" #include "hw/char/serial.h" +#include "hw/misc/unimp.h" #include "target/riscv/cpu.h" #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_plic.h" @@ -74,14 +75,6 @@ static const struct MemmapEntry { [SIFIVE_E_DTIM] = { 0x80000000, 0x4000 } }; -static void sifive_mmio_emulate(MemoryRegion *parent, const char *name, - uintptr_t offset, uintptr_t length) -{ - MemoryRegion *mock_mmio = g_new(MemoryRegion, 1); - memory_region_init_ram(mock_mmio, NULL, name, length, &error_fatal); - memory_region_add_subregion(parent, offset, mock_mmio); -} - static void riscv_sifive_e_init(MachineState *machine) { const struct MemmapEntry *memmap = sifive_e_memmap; @@ -172,7 +165,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp) sifive_clint_create(memmap[SIFIVE_E_CLINT].base, memmap[SIFIVE_E_CLINT].size, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.aon", + create_unimplemented_device("riscv.sifive.e.aon", memmap[SIFIVE_E_AON].base, memmap[SIFIVE_E_AON].size); sifive_e_prci_create(memmap[SIFIVE_E_PRCI].base); @@ -199,19 +192,19 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp) sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART0].base, serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART0_IRQ)); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.qspi0", + create_unimplemented_device("riscv.sifive.e.qspi0", memmap[SIFIVE_E_QSPI0].base, memmap[SIFIVE_E_QSPI0].size); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.pwm0", + create_unimplemented_device("riscv.sifive.e.pwm0", memmap[SIFIVE_E_PWM0].base, memmap[SIFIVE_E_PWM0].size); sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART1].base, serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART1_IRQ)); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.qspi1", + create_unimplemented_device("riscv.sifive.e.qspi1", memmap[SIFIVE_E_QSPI1].base, memmap[SIFIVE_E_QSPI1].size); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.pwm1", + create_unimplemented_device("riscv.sifive.e.pwm1", memmap[SIFIVE_E_PWM1].base, memmap[SIFIVE_E_PWM1].size); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.qspi2", + create_unimplemented_device("riscv.sifive.e.qspi2", memmap[SIFIVE_E_QSPI2].base, memmap[SIFIVE_E_QSPI2].size); - sifive_mmio_emulate(sys_mem, "riscv.sifive.e.pwm2", + create_unimplemented_device("riscv.sifive.e.pwm2", memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); /* Flash memory */