From nobody Thu Nov 14 17:04:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602263396; cv=none; d=zohomail.com; s=zohoarc; b=T4ffbnyonZzoOuwladrJHD4LXgxghIuLumV/oWGQCAy30QCnuPS0rxuITAa/WmwgGFLKrcr5Z8Iy+LThXVG3Z4LdFRfX2il2heVGbuHQliDjfOIf84jZINExNQmJb7otZfcDYZ7Ki9Te9EtVKWmIvtvvO4udf/gBl1g3QT24F3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602263396; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H1zBaXIPUFkoRX522wNIGvBuniNlrLtU+nW3sIqZkhk=; b=eB+YkpzuQQCwfFz83XwoslBoz4jjrT4P6hPGcB0FrAlPi9abfBQdA7x3k4wEgAwZROfcTrnGGLZB4UA8+1knrqn5frdB+1gDauOy6vVJqDyluDob/vHq5ZbFhis0+ivb6q7vKbEHMjiFZBFX5VfvXDfN90lmL/qyp+z/ARlsoRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602263396585981.6129942281889; Fri, 9 Oct 2020 10:09:56 -0700 (PDT) Received: from localhost ([::1]:55114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQvtz-0006Fe-5v for importer@patchew.org; Fri, 09 Oct 2020 13:09:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQvrx-0004Kc-Mm for qemu-devel@nongnu.org; Fri, 09 Oct 2020 13:07:49 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:37562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQvrv-0001J1-VR for qemu-devel@nongnu.org; Fri, 09 Oct 2020 13:07:49 -0400 Received: by mail-wm1-x344.google.com with SMTP id j136so10534341wmj.2 for ; Fri, 09 Oct 2020 10:07:47 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p9sm12037660wmm.4.2020.10.09.10.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 10:07:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 360001FF8C; Fri, 9 Oct 2020 18:07:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H1zBaXIPUFkoRX522wNIGvBuniNlrLtU+nW3sIqZkhk=; b=a1UJY9UUndOq/LM+zjcD4nSmLuV1s0Xc6DJ1lJbq8GujJOJKZ9agpdBHdtM1rQyArc Y7SUFRAjetL3Aq9jM7ulzCeBA7kZMCXx7NjJkWJ5+/6qjExXr89fEzfNBpnxd31jUgrE kp1A/GiNWKr2TERmq0A0q+H6LuZRIURRVzhaFKSgG+N9ADvfHqvk5Ej0BGZqMto/wIIQ 2jELF/Pn9i8FLna2zd7RzgcUBUh2ORV3jrbPqIfa5mtMblQ9OQRBj+Geq/Y7U5Owl/B+ fkTqcBVyu1lyG5O6soA2zDA290qCgF1sNb/4noOmPB4DxaMwvc6zRm0iEuJCiX5Wi/IA JTPw== 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=H1zBaXIPUFkoRX522wNIGvBuniNlrLtU+nW3sIqZkhk=; b=BbA89aV0bbzfW8Sw8OQyjppDyVsxgQt/oiy2IKd807QFcKwm7/h95ikoyAG7YfEqfp c3jHjCEZ4DVEnrc/q8Ur8A9WQsfVisL7afsHLL+EQ2qeq5r8LjPH5FIji4QDoE/msZlY b8QZhJAIkhWFpLUPfn8zvCx38LJ0Rmt7mQVpFSmhE05ZBgN2OwgVdrqLEPVZhjeTRjW5 RaA0b9I1pJo+1qHJG4ht4DmXdUIzVRNzq+UtIXrdjwj70FC/K9XTVIctKM6ceFzUNLrF ZYk1BslwxNzzjct+7IU6OtDNntm+9xtrabIp2jbtCq+PTXW/+VsWm+gWYBrqGpmTOC0/ 8kDQ== X-Gm-Message-State: AOAM532EYhEeghZ3CTgCRgcdbXoqVq3MD3MdpXmb1yvY0OtEUZU1wOyO zLJ4MEv0V+T1f4DISbXDenQ0LA== X-Google-Smtp-Source: ABdhPJw8FRMgfC7wNrTD6RRMQN2j4IoWnGsmeodKV4EKmU7C84r/n8cbeIQE+V1x4aXKRgAEu00miQ== X-Received: by 2002:a1c:35c5:: with SMTP id c188mr15663479wma.11.1602263266496; Fri, 09 Oct 2020 10:07:46 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 2/4] hw/riscv: migrate fdt field to generic MachineState Date: Fri, 9 Oct 2020 18:07:40 +0100 Message-Id: <20201009170742.23695-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201009170742.23695-1-alex.bennee@linaro.org> References: <20201009170742.23695-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: julien@xen.org, Sagar Karandikar , masami.hiramatsu@linaro.org, andre.przywara@arm.com, stefano.stabellini@linaro.org, takahiro.akashi@linaro.org, Palmer Dabbelt , Bastian Koppelmann , Alistair Francis , stefano.stabellini@xilinx.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , "open list:RISC-V TCG CPUs" , stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This is a mechanical change to make the fdt available through MachineState. Signed-off-by: Alex Benn=C3=A9e --- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index b4ed9a32eb..6505ae8d23 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -41,7 +41,6 @@ struct RISCVVirtState { DeviceState *plic[VIRT_SOCKETS_MAX]; PFlashCFI01 *flash[2]; =20 - void *fdt; int fdt_size; }; =20 diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 41bd2f38ba..17c0706156 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -194,7 +194,7 @@ static void create_fdt(RISCVVirtState *s, const struct = MemmapEntry *memmap, hwaddr flashsize =3D virt_memmap[VIRT_FLASH].size / 2; hwaddr flashbase =3D virt_memmap[VIRT_FLASH].base; =20 - fdt =3D s->fdt =3D create_device_tree(&s->fdt_size); + fdt =3D mc->fdt =3D create_device_tree(&s->fdt_size); if (!fdt) { error_report("create_device_tree() failed"); exit(1); @@ -434,12 +434,12 @@ static void create_fdt(RISCVVirtState *s, const struc= t MemmapEntry *memmap, g_free(name); =20 name =3D g_strdup_printf("/soc/flash@%" PRIx64, flashbase); - qemu_fdt_add_subnode(s->fdt, name); - qemu_fdt_setprop_string(s->fdt, name, "compatible", "cfi-flash"); - qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", + qemu_fdt_add_subnode(mc->fdt, name); + qemu_fdt_setprop_string(mc->fdt, name, "compatible", "cfi-flash"); + qemu_fdt_setprop_sized_cells(mc->fdt, name, "reg", 2, flashbase, 2, flashsize, 2, flashbase + flashsize, 2, flashsize); - qemu_fdt_setprop_cell(s->fdt, name, "bank-width", 4); + qemu_fdt_setprop_cell(mc->fdt, name, "bank-width", 4); g_free(name); } =20 @@ -613,9 +613,9 @@ static void virt_machine_init(MachineState *machine) hwaddr end =3D riscv_load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(s->fdt, "/chosen", + qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-start", start); - qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-e= nd", end); } } else { @@ -636,11 +636,11 @@ static void virt_machine_init(MachineState *machine) =20 /* Compute the fdt load address in dram */ fdt_load_addr =3D riscv_load_fdt(memmap[VIRT_DRAM].base, - machine->ram_size, s->fdt); + machine->ram_size, machine->fdt); /* load the reset vector */ riscv_setup_rom_reset_vec(start_addr, virt_memmap[VIRT_MROM].base, virt_memmap[VIRT_MROM].size, kernel_entry, - fdt_load_addr, s->fdt); + fdt_load_addr, machine->fdt); =20 /* SiFive Test MMIO device */ sifive_test_create(memmap[VIRT_TEST].base); --=20 2.20.1