From patchwork Mon Mar 19 21:18:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10295157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1CD00602C2 for ; Mon, 19 Mar 2018 21:21:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BD6729351 for ; Mon, 19 Mar 2018 21:21:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2B2D294F5; Mon, 19 Mar 2018 21:21:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F95229351 for ; Mon, 19 Mar 2018 21:21:23 +0000 (UTC) Received: from localhost ([::1]:43983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2Da-0002hM-E8 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 17:21:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2C2-0001Jm-5u for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey2By-0002WD-DU for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:46 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:34943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey2By-0002Vk-56 for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:42 -0400 Received: by mail-pl0-x243.google.com with SMTP id p9-v6so8502426pls.2 for ; Mon, 19 Mar 2018 14:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bAnmiNe0Jq/bKPe/yscQG8mYo4LaV7stvbgTiCOkIvc=; b=jVV2TjM6OxcoMzLqRCuPf5QUSSU+gU5ZN8FtLKmipWjU5w8CWeJuD6baYbwQsBviHX Y5/vLMHTyrVNAAksE8TWe+ExIdC0ddhCXxmK+2tGbKN/10AeGYN6JRub7OlkMjsBvVUk W68tJ35FGdySpyxgxquXmVIWAw0gDkMYjaBbr9u77IRjtK6Omy8FZenkvYrt8hvcqPqM eFkpKdYqFrPYeH2sO/u97ktdxGXFwjlFbkcKcVYk5N4/jS/5YfcNXYvR6TiLqRt/UleI hYiyr6WpMatLiiMg+geNh1eNu/k0SXd1QPNT+fZsDbIPMcGX2Wnu4+HYMFeSwJaHXdOU DLqg== 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=bAnmiNe0Jq/bKPe/yscQG8mYo4LaV7stvbgTiCOkIvc=; b=oWS6tiHUp72pJyxKgUZm7cyOEPYksZWzE+9zc2IIyeSYnj1k2hKSGqyoL0ujC0ee8P NppkV2dsD/8h2m1oQSsHKo6pMCLZ72Qoolu4G46odYMXrthE2e5q4+IWSXrynJYFYvGl 3OjVkhrq2X6kvGrc2aRvdgGExq8G+TzoR5OB0Z/yXSWJ9XfGTyYIXpe/MRAVMQCTc7AA ZKPJvii2bY6OqTR1dr2cr7yZNQfT9yBdwZC5ghFLIcFou4df0mEOJb80h0feNTvvAWvA K0VLLeSvYo5e5Fi1KcEOZ0w5vT0qu3EQqyCKsM0hKW/7tNst5eJ2EXFRHy54e4XiMRmT LENA== X-Gm-Message-State: AElRT7F5U/tHhd7Ulf4jxw4v0MvCqfGSAnWwVN+8QY/KWnXJO5W5qglI HFgfD3DwNwMSu3T6rUkFe2Br/iM9RBg= X-Google-Smtp-Source: AG47ELtpzC5Z17KXtm2sSRyKxxnPjZa2JFhFcuUGG7dtSe3RELKuoVFlJBqYITwCNcb6Fx+R230GNQ== X-Received: by 2002:a17:902:3f83:: with SMTP id a3-v6mr5709406pld.279.1521494381042; Mon, 19 Mar 2018 14:19:41 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i127sm120500pfc.136.2018.03.19.14.19.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 14:19:40 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 14:18:24 -0700 Message-Id: <1521494329-19546-2-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521494329-19546-1-git-send-email-mjc@sifive.com> References: <1521494329-19546-1-git-send-email-mjc@sifive.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH v4 01/26] RISC-V: Make virt create_fdt interface consistent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@groups.riscv.org, Michael Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in https://github.com/riscv/riscv-qemu/pull/109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Michael Clark Signed-off-by: Palmer Dabbelt Reviewed-by: Philippe Mathieu-Daudé --- hw/riscv/virt.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index e2c214e..37968d2 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -108,7 +108,7 @@ static hwaddr load_initrd(const char *filename, uint64_t mem_size, return *start + size; } -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; @@ -264,8 +264,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", nodename); qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline); g_free(nodename); - - return fdt; } static void riscv_virt_board_init(MachineState *machine) @@ -279,7 +277,6 @@ static void riscv_virt_board_init(MachineState *machine) char *plic_hart_config; size_t plic_hart_config_len; int i; - void *fdt; /* Initialize SOC */ object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY); @@ -299,7 +296,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_ram(boot_rom, NULL, "riscv_virt_board.bootrom", @@ -314,9 +311,9 @@ static void riscv_virt_board_init(MachineState *machine) hwaddr end = load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(fdt, "/chosen", - "linux,initrd-start", start); - qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-start", + start); + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", end); } }