From patchwork Fri Mar 9 04:12:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10269625 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 A50386016D for ; Fri, 9 Mar 2018 04:15:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EF2E29B9D for ; Fri, 9 Mar 2018 04:15:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9386329CB8; Fri, 9 Mar 2018 04:15:48 +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 AB6B029B9D for ; Fri, 9 Mar 2018 04:15:47 +0000 (UTC) Received: from localhost ([::1]:43092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9RZ-0003pg-Vs for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 23:15:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9Q6-0003pF-OG for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eu9Q5-0006oK-Im for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:14 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:43673) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eu9Q5-0006o2-C4 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:13 -0500 Received: by mail-pf0-x243.google.com with SMTP id j2so831848pff.10 for ; Thu, 08 Mar 2018 20:14:13 -0800 (PST) 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; bh=sZu9amHft6wew0OyJ4XWOSGVSF4sKnLeBx/7kRVhuhA=; b=EGWmvCSO6cuwCratwQpnQ9sijBEjpPS2SZf5KnZEf635KB61+5rDSwIKUnG+LZrwlG nvHFUMX/5ykDBwnfhMGpxu4iCLfwk5PgpnylVfcG/Np9N2aThu1VsGRf5ohFoM7+GsFo AhCvS7B3IuRJXis5La1UCm01uc5B3gPHWoOFaMpbKKbXTklf1k6cgclqO5DRwFg76qUB aijI1vYRTYRqu9l3NsWplvt5mDXIqhemw4VrOSRC7xpadZekRiuMWp2yogleqi2AKbWD TV3myo0WVjk/ber5S1hqm+pBdIdHiPgo9d6Lk9z62HgH7ywGH1ZKHTnTMNRDjSWiDluU T6Lg== 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; bh=sZu9amHft6wew0OyJ4XWOSGVSF4sKnLeBx/7kRVhuhA=; b=uf2MKu4ToiK30x/6tVnClJWsu20KRgFck+03NL8wxF1m0zxf/75O70SFAM1X9Xs9Xh L9HOAPcR5cDXUd/xH/QFSfTorYI9ipmlnq1cshrl/IPBbKSyX+lGVtPhovO8Qr89Dttc YYwWQeSL7NfeYA5PjIG7LydfJulSWRvlAnE3LDKankEL9IoMKRe1TwQuNQQWD/SODvhI S8IViGjPrT7KQWY5Zs1+kW+xXPFMBF+vIV75RZ4dSBJCIEOJuI+sY5JEfWBL/YmwJOnt oN2mVtbC0RClatGDKOXMhnyHJ7QYNQdo+0jmbgX2tXnRR+xf/7vchkQnO8Dsx3odXnam BzJg== X-Gm-Message-State: APf1xPA1CsRa/2LsP1KxuG0oD1dqzeGvT9tUTA26kQD0AokqpWK11Ev9 WmMiL6CyCbJujSSwo5GPMsGhkMur0Tk= X-Google-Smtp-Source: AG47ELs1i+MSYUi6gWj95bs7piHRRRauBLq7+3f1jCsKNKMwzBS9ddS7/pHTYIk6q2lHghRLdLlCXQ== X-Received: by 10.99.1.148 with SMTP id 142mr23687242pgb.24.1520568852267; Thu, 08 Mar 2018 20:14:12 -0800 (PST) Received: from localhost.localdomain (125-237-39-90-fibre.bb.spark.co.nz. [125.237.39.90]) by smtp.gmail.com with ESMTPSA id h15sm334141pfi.56.2018.03.08.20.14.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 20:14:11 -0800 (PST) From: Michael Clark To: qemu-devel@nongnu.org Date: Fri, 9 Mar 2018 17:12:23 +1300 Message-Id: <1520568765-58189-2-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1520568765-58189-1-git-send-email-mjc@sifive.com> References: <1520568765-58189-1-git-send-email-mjc@sifive.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v2 01/23] 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: Bastian Koppelmann , Michael Clark , Palmer Dabbelt , Sagar Karandikar 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); } }