From patchwork Wed Mar 21 20:46:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10300373 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 163D260386 for ; Wed, 21 Mar 2018 20:52:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F4075290A6 for ; Wed, 21 Mar 2018 20:52:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E875C290B0; Wed, 21 Mar 2018 20:52:37 +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 52183290A6 for ; Wed, 21 Mar 2018 20:52:37 +0000 (UTC) Received: from localhost ([::1]:57372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykiq-0006M9-Gw for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Mar 2018 16:52:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykeH-0001zv-Em for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eykeF-000228-3L for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:53 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:45291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eykeE-00021n-Sx for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:51 -0400 Received: by mail-pf0-x242.google.com with SMTP id l27so2455425pfk.12 for ; Wed, 21 Mar 2018 13:47:50 -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=LkBzYZsp36kjJCkDzELq/DKiVskttbq4Cb7kzzTQWZSd1i/8c1eBNoDR51vZ69K9L0 G6QD89rGuMIAInfzJnO0vyCOOBX24Z5WJ0StS9oYoHEBaaA25TJxxIV3yclaC7+mOCUe yLjDi1Excm5ic7gwoaLfkOsDihJgsmQIi+xaBKBY89Fm+eGf0nVomYJjeLrRUTvxJGLT uTHW8mZ9qChkrAr7v27z3FHUUgEBMjT4uR0citG1aNgYsQjQRjcp6a302g1TzVWpR8Tn Ib7g5wtzu2vBu3hIZwtBDTrI3z1V4gtEr0riHJyyK2h3eqmR5ZkNDtrH9e00jIV8Ejjv 7weQ== 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=B2H8Rb7emtW7YWC9jXcEFqGZtGVOoBzzDmsGBpoze/A8mdN5ESsDuNB2ju3Ij31scn MkUJ4/I/EPt4GKICL8gRE7NLGqZr9wuoIj8dPgKDbctiYT4bjJLOq0lDeOGt5SQSSY3T SRcMHSsm5wluz3v6025pBZ+Ah6TfI4/yKjhSdIiQ3/+p7XmEUHf4yI7w4UwFus9MHL/F IwAHhU2aRUghou98HPPBSox9SbGkaOXh2HZlG7lW61pYTMtmh6DEmvv7svVkdv0tk/8P N8BnHrryvGDKwt3gdQZklVaZqGqKL6WaLqL1K/WvAjo81exUfrS/NnORH6HTVkwdIm3E CeRg== X-Gm-Message-State: AElRT7ErDk4In00Qu8mkZ+HwHPcWVPYbbIZlUBS0fY4KsUsiUgSd+tjG 0E2ZgEziKbOCo4wRwCx/xaZWZa8NkrE= X-Google-Smtp-Source: AG47ELuNEtXAQG+v8KWJEo8bvpSMGKWcAknjvgreXNLhSRrA1idPxY6kArg+qKDj1F5aTiWU6Q8nMg== X-Received: by 10.101.76.207 with SMTP id n15mr16301909pgt.313.1521665269843; Wed, 21 Mar 2018 13:47:49 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w10sm8244499pgr.57.2018.03.21.13.47.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Mar 2018 13:47:49 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 21 Mar 2018 13:46:37 -0700 Message-Id: <1521665220-3869-2-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521665220-3869-1-git-send-email-mjc@sifive.com> References: <1521665220-3869-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:c00::242 Subject: [Qemu-devel] [PULL 01/24] 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); } }