From nobody Thu Oct 30 15:21:19 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; dkim=fail; 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525861438992720.1859139802255; Wed, 9 May 2018 03:23:58 -0700 (PDT) Received: from localhost ([::1]:55544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGMGE-00038A-Ot for importer@patchew.org; Wed, 09 May 2018 06:23:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGMEe-0002HP-Qz for qemu-devel@nongnu.org; Wed, 09 May 2018 06:22:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGMEd-000431-7D for qemu-devel@nongnu.org; Wed, 09 May 2018 06:22:12 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:39067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGMEd-000425-0N for qemu-devel@nongnu.org; Wed, 09 May 2018 06:22:11 -0400 Received: by mail-pf0-x242.google.com with SMTP id a22so11311147pfn.6 for ; Wed, 09 May 2018 03:22:10 -0700 (PDT) Received: from localhost.localdomain (122-58-167-38-fibre.bb.spark.co.nz. [122.58.167.38]) by smtp.gmail.com with ESMTPSA id q62sm50086498pfd.172.2018.05.09.03.22.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 03:22:09 -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; bh=47yxZp5RQJisSZM6EmazIPkrCG4NFFd5tAx3HJkDg/8=; b=Fb+H94pRDPLR/RwGT5aT5QYMXSkDsgjFR0PXpVEsh42qsA5onuAJyuyd24JIGmrY8z bIHwk0+9x0qkm6weAN2R55utBTunJv/Jqj6kE0ntfageufVkid0zCUdUOe0SYvPPDSiQ KVYve2oxGJXfgEIey+17dHJREnpoJCQKnH4wPg12yvwFsow7oNBEdr6BPCh6GUqiX+Mw +KTMYjsAj28svv18NFcehIzUnh5nqHlEXtxqZa3dyGmWQLOsXZWAMA3W8PCi4qOaNq7Q t8mkzg+sfGEVqNSR/2eZiMNe6rHGf7JoJGjnqGpmRlVixMpZVCpgxD7qoaeqyjc0aPci /ujQ== 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=47yxZp5RQJisSZM6EmazIPkrCG4NFFd5tAx3HJkDg/8=; b=mC2BTHcyumIivBU3NmzJtYHpYbme3jXa+Yk3YloyrKqSCZr998XkSR8ja3vEo6cDFO ob4dj4FzxF+PFOkRjVptK1jAZhbMcQt9n0NDQU6bq4tP8SxhKOj6SCQ2BeHrN5NFo5G2 yq5jc6aY9UK7g+kOdeD3LeSo/MO7d/2Q7a2GT1/EeMOKu0GA/T1BSpm072SsK7FVFugg r7Z+9R1wx5iVAoA80yHQ1psk5DQlEWqBU2JkyjamTX5EvoUo4ry+U+0GJWpU4vIF+ryw XwIJvJlJ/XMZCwwUUfx/m6sT5WO2YsB0Wkit86LzM4UZcV3UzWnrU52znzSG9Giqa7fC EAPA== X-Gm-Message-State: ALQs6tBm9gxLeKj1czvVmK1K/iui4CO0aubg9mIK5T/g2833L8zEQDyi km5bAcYLkeIaX62J2Qm0A95WrxQ8nlU= X-Google-Smtp-Source: AB8JxZqVEf+Q8i39jiJmLHV8oRnVu/3pZ+pICQsYQSDLiv0U5jPsF4qEh47w14q//8kwj9pJSfGgfg== X-Received: by 10.98.55.69 with SMTP id e66mr25026640pfa.43.1525861330052; Wed, 09 May 2018 03:22:10 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 22:20:38 +1200 Message-Id: <1525861240-4130-2-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1525861240-4130-1-git-send-email-mjc@sifive.com> References: <1525861240-4130-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::242 Subject: [Qemu-devel] [PULL 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: patches@groups.riscv.org, KONRAD Frederic , Michael Clark Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: KONRAD Frederic 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 Signed-off-by: Michael Clark Message-Id: <1525360636-18229-2-git-send-email-frederic.konrad@adacore.com> --- 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 3e17f3025106..be252ec8cce9 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 2.7.0