From patchwork Fri Aug 23 05:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110571 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 336DA14DB for ; Fri, 23 Aug 2019 05:18:23 +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 0A056206BA for ; Fri, 23 Aug 2019 05:18:23 +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="sJWRh/qL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A056206BA 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]:51478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11xt-00036i-0x for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44687) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11r9-0003tD-2n for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r7-0002S5-QE for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:22 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:38646) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r7-0002RX-Ke; Fri, 23 Aug 2019 01:11:21 -0400 Received: by mail-pf1-x443.google.com with SMTP id o70so5655002pfg.5; Thu, 22 Aug 2019 22:11:21 -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:mime-version :content-transfer-encoding; bh=B1KQDewiIqWoczh5/bBYafCJNsskXVqW6qCHzgZ2uY4=; b=sJWRh/qLj+jGjoUMTLj0dLI86/YMMrG9qceJQxeb8wzS8CfZLXCMbms/fscK+fktar gZHLluZ1/07jZp69GF84HBbj4ID+VTjICirpfF3JqWrBhQijSQNpRuUQpVVLbfBDYP5S 6NtmxgdcRKx3RvREJllOSob2geRX1M4ylnLmgZJwhvrtEyeVWjXk4y7RB3nV1EGD1Wd3 o78a3xw6+djLMjWJwOboLzikyFVqdLEn+x7SDx8pCt86EhNSF7zlPn40OPKwo9NuUAgA sVz03VITBcphzY74cX5xe/EOoSBWa0fe/5XjrmfSH6wxMzzBeW4ljenMKSQee+vg159u J7nw== 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:mime-version:content-transfer-encoding; bh=B1KQDewiIqWoczh5/bBYafCJNsskXVqW6qCHzgZ2uY4=; b=c9BegO7WBlBWScygFcLbNyzOzO+Tp1L3vcpq91p1inM+unxb0AALIZNyJheYIzFdGE U0jSkl9uwnrRha/Z8yBaaGvmZ4lD+ncK5FY7nV8K9yV++IUTP223+qg8cNfsmNww1vXV LInZqRm2qRYr5lVHhVt3QYQ3hZ98gcNX7C6iNwXWDwh2qiyxxUusPSU7xyDtBbxe4SaJ t4H0EWGcpZ3z4M/buga6Jh5NySm6GZrKGd3/7ZqC5RVEjisDbe3ohDCwFxZqohTXPAnP Ir14dcaiesZkXiGga9yK2M1MqDwjf6vWMdkBVxz9K/nWLj/81RmXfE60VXmgREsz1UYE 2raw== X-Gm-Message-State: APjAAAWpe9QmX+B35Nb5QmSwqJV3+VCaYpIimygitVwhRdiz0zJJtPtA r4K9xgtEgoSZJYrUIJnhcSo= X-Google-Smtp-Source: APXvYqzHrTR+ERKwRSpZWpV0pmdvSqAzJVzXmZfyWXP0EZH296uZTkPFdNJ86b2+3Yw0EWu6wQUVqQ== X-Received: by 2002:a65:5144:: with SMTP id g4mr2360809pgq.202.1566537080740; Thu, 22 Aug 2019 22:11:20 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.19 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:20 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:43 -0700 Message-Id: <1566537069-22741-5-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v5 04/30] riscv: hw: Change create_fdt() to return void 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" There is no need to return fdt at the end of create_fdt() because it's already saved in s->fdt. Signed-off-by: Bin Meng Reviewed-by: Chih-Min Chao Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - change create_fdt() to return void in sifive_u.c too, after rebasing on Palmer's QEMU RISC-V tree Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 11 ++++------- hw/riscv/virt.c | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 5fe0033..e22803b 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -67,7 +67,7 @@ static const struct MemmapEntry { #define GEM_REVISION 0x10070109 -static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, +static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint64_t mem_size, const char *cmdline) { void *fdt; @@ -253,14 +253,11 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/aliases", "serial0", nodename); g_free(nodename); - - return fdt; } static void riscv_sifive_u_init(MachineState *machine) { const struct MemmapEntry *memmap = sifive_u_memmap; - void *fdt; SiFiveUState *s = g_new0(SiFiveUState, 1); MemoryRegion *system_memory = get_system_memory(); @@ -281,7 +278,7 @@ static void riscv_sifive_u_init(MachineState *machine) main_mem); /* create device tree */ - fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); + create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); riscv_find_and_load_firmware(machine, BIOS_FILENAME, memmap[SIFIVE_U_DRAM].base); @@ -294,9 +291,9 @@ static void riscv_sifive_u_init(MachineState *machine) hwaddr end = riscv_load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(fdt, "/chosen", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-start", start); - qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", end); } } diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 2f75195..6bfa721 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -112,7 +112,7 @@ static void create_pcie_irq_map(void *fdt, char *nodename, 0x1800, 0, 0, 0x7); } -static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, +static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, uint64_t mem_size, const char *cmdline) { void *fdt; @@ -316,8 +316,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline); } g_free(nodename); - - return fdt; } @@ -373,7 +371,6 @@ static void riscv_virt_board_init(MachineState *machine) size_t plic_hart_config_len; int i; unsigned int smp_cpus = machine->smp.cpus; - void *fdt; /* Initialize SOC */ object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), @@ -392,7 +389,7 @@ static void riscv_virt_board_init(MachineState *machine) main_mem); /* create device tree */ - fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); + create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); /* boot rom */ memory_region_init_rom(mask_rom, NULL, "riscv_virt_board.mrom", @@ -411,9 +408,9 @@ static void riscv_virt_board_init(MachineState *machine) hwaddr end = riscv_load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(fdt, "/chosen", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-start", start); - qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", end); } }