From patchwork Mon Mar 19 21:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10295189 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 49532602C2 for ; Mon, 19 Mar 2018 21:24:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3908429432 for ; Mon, 19 Mar 2018 21:24:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DBEE2943B; Mon, 19 Mar 2018 21:24:20 +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 CA09B29432 for ; Mon, 19 Mar 2018 21:24:19 +0000 (UTC) Received: from localhost ([::1]:43998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2GR-0005Kz-2b for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 17:24:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2C5-0001Jz-3Z for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey2C0-0002YE-UZ for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:49 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:45259) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey2C0-0002XY-O0 for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:44 -0400 Received: by mail-pl0-x244.google.com with SMTP id n15-v6so3304565plp.12 for ; Mon, 19 Mar 2018 14:19:44 -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=etZGfs2I6eIUVzklmG0XvLcDBBdWMcIvQq939Ceof5k=; b=Y0i/h+X1mffp4L4rDr3yne65XU9zfEN8m/QzVPqfR8/YnOr1XxTSmP8MTrdzFWeJ20 2Rt3MadUcsfcLtMQdOI+gsloGauhjT5i34LCmp1noDkE6hFePrH4myT+MDP74XZ5F+Ne QQiXRWazWiJ9WEp5cbs8RV11Mc2M1qZAph71K0/8XbYqCSRQ0rhrX4bBwNN22WyXlXir UdW1eNCWnZTh3mp4lK+9Qcb4a4okvj5yAvzNeya+knqqg/Ph02X7l5oQNwMdwAHTyCjA 9agDP8P9dp2qPBA0/VEAI49wLA1waFc2g5l7aMFSPhWM5NOAuzpaaZsVOR0bzU0un5bv 2Jgg== 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=etZGfs2I6eIUVzklmG0XvLcDBBdWMcIvQq939Ceof5k=; b=hOPI3boh+MSJN55QWJQQPj/zFZZBDzVcezqPVjYrcfO7Szkv5aR5EmguaNJxyrT1EQ HJi4DiRUvusqXk42r8O0tWjDN9Ie10w041tJxr3MgNlKzCQiBS5DNAgM1C5EC9nPc5Pl ss2oZnAc+JEgOifX0GZj94HpfiyQc/d+0dUnKz/KD2Ygm0r0mb9oPpNxVARweN2nKEtl g8yUs8XEXLfRrE6dT9v/dgNf2wEr6YmoBOQYu2anxtwQrlA0F37TVFfSNkKFtBgrholY BJ+XpzlCs9Eux9YdAwEUFvvhRef+dupJPBivlSGZATMnb11vhK9nyKf4f6nbDikKYfcU JRow== X-Gm-Message-State: AElRT7GCHPPBICbyRVj3j7SWhdIUDofB69285+M4zMtpk9GV7onONvuB sluaqK+1UAGrn5V7gccR+wg4sTncd8M= X-Google-Smtp-Source: AG47ELuKrkUWRjYP5rv8GvKS4fRfh4wj1JbCh87LnCxdQK4ERj0Sfuw+ihEo2mYUSq844MQbfF8g+g== X-Received: by 2002:a17:902:7b95:: with SMTP id w21-v6mr14222096pll.260.1521494383869; Mon, 19 Mar 2018 14:19:43 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i127sm120500pfc.136.2018.03.19.14.19.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 14:19:43 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 14:18:27 -0700 Message-Id: <1521494329-19546-5-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::244 Subject: [Qemu-devel] [PATCH v4 04/26] RISC-V: Use ROM base address and size from memmap 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 Another case of replacing hard coded constants, this time referring to the definition in the virt machine's memmap. 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 | 4 ++-- include/hw/riscv/virt.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 0055439..0d101fc 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -338,11 +338,11 @@ static void riscv_virt_board_init(MachineState *machine) }; /* copy in the reset vector */ - copy_le32_to_phys(ROM_BASE, reset_vec, sizeof(reset_vec)); + copy_le32_to_phys(memmap[VIRT_MROM].base, reset_vec, sizeof(reset_vec)); /* copy in the device tree */ qemu_fdt_dumpdtb(s->fdt, s->fdt_size); - cpu_physical_memory_write(ROM_BASE + sizeof(reset_vec), + cpu_physical_memory_write(memmap[VIRT_MROM].base + sizeof(reset_vec), s->fdt, s->fdt_size); /* create PLIC hart topology configuration string */ diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 2fbe808..655e85d 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -23,8 +23,6 @@ #define VIRT(obj) \ OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_BOARD) -enum { ROM_BASE = 0x1000 }; - typedef struct { /*< private >*/ SysBusDevice parent_obj;