From nobody Wed Oct 29 11:58:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152536092929370.53401459351744; Thu, 3 May 2018 08:22:09 -0700 (PDT) Received: from localhost ([::1]:57230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEG3c-0007c1-JR for importer@patchew.org; Thu, 03 May 2018 11:22:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEFz9-0004Tp-HZ for qemu-devel@nongnu.org; Thu, 03 May 2018 11:17:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEFz5-0003Db-D2 for qemu-devel@nongnu.org; Thu, 03 May 2018 11:17:31 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:54871 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fEFz5-0003D5-6K; Thu, 03 May 2018 11:17:27 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 321E08139C; Thu, 3 May 2018 17:17:26 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LuDLXCQCJRZY; Thu, 3 May 2018 17:17:26 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2a02:2ab8:224:100::1003]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id D0FA78138C; Thu, 3 May 2018 17:17:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com From: KONRAD Frederic To: qemu-devel@nongnu.org, qemu-stable@nongnu.org Date: Thu, 3 May 2018 17:17:14 +0200 Message-Id: <1525360636-18229-2-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525360636-18229-1-git-send-email-frederic.konrad@adacore.com> References: <1525360636-18229-1-git-send-email-frederic.konrad@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH V2 1/3] riscv: spike: allow base == 0 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: kbastian@mail.uni-paderborn.de, frederic.konrad@adacore.com, mjc@sifive.com, f4bug@amsat.org, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The sanity check on base doesn't allow htif to be mapped @0. Check if the symbol exists instead so we can map it where we want. Reviewed-by: Michael Clark Signed-off-by: KONRAD Frederic --- V1 -> V2: * Check that both symbols are set as suggested by Michael. --- hw/riscv/riscv_htif.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/riscv/riscv_htif.c b/hw/riscv/riscv_htif.c index 3e17f30..be252ec 100644 --- a/hw/riscv/riscv_htif.c +++ b/hw/riscv/riscv_htif.c @@ -41,17 +41,20 @@ } while (0) =20 static uint64_t fromhost_addr, tohost_addr; +static int address_symbol_set; =20 void htif_symbol_callback(const char *st_name, int st_info, uint64_t st_va= lue, - uint64_t st_size) + uint64_t st_size) { if (strcmp("fromhost", st_name) =3D=3D 0) { + address_symbol_set |=3D 1; fromhost_addr =3D st_value; if (st_size !=3D 8) { error_report("HTIF fromhost must be 8 bytes"); exit(1); } } else if (strcmp("tohost", st_name) =3D=3D 0) { + address_symbol_set |=3D 2; tohost_addr =3D st_value; if (st_size !=3D 8) { error_report("HTIF tohost must be 8 bytes"); @@ -248,7 +251,7 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, Me= moryRegion *main_mem, qemu_chr_fe_init(&s->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&s->chr, htif_can_recv, htif_recv, htif_event, htif_be_change, s, NULL, true); - if (base) { + if (address_symbol_set =3D=3D 3) { memory_region_init_io(&s->mmio, NULL, &htif_mm_ops, s, TYPE_HTIF_UART, size); memory_region_add_subregion(address_space, base, &s->mmio); --=20 1.8.3.1