From: KONRAD Frederic <frederic.konrad@adacore.com>
To: qemu-devel@nongnu.org
Cc: frederic.konrad@adacore.com, mjc@sifive.com, palmer@sifive.com,
sagark@eecs.berkeley.edu, kbastian@mail.uni-paderborn.de
Subject: [Qemu-devel] [PATCH v1 1/2] riscv: spike: allow base == 0
Date: Wed, 18 Apr 2018 12:16:47 +0200 [thread overview]
Message-ID: <1524046608-12906-2-git-send-email-frederic.konrad@adacore.com> (raw)
In-Reply-To: <1524046608-12906-1-git-send-email-frederic.konrad@adacore.com>
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.
Signed-off-by: KONRAD Frederic <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 3e17f30..6e687f2 100644
--- a/hw/riscv/riscv_htif.c
+++ b/hw/riscv/riscv_htif.c
@@ -41,17 +41,20 @@
} while (0)
static uint64_t fromhost_addr, tohost_addr;
+static int address_symbol_set;
void htif_symbol_callback(const char *st_name, int st_info, uint64_t st_value,
- uint64_t st_size)
+ uint64_t st_size)
{
if (strcmp("fromhost", st_name) == 0) {
+ address_symbol_set = 1;
fromhost_addr = st_value;
if (st_size != 8) {
error_report("HTIF fromhost must be 8 bytes");
exit(1);
}
} else if (strcmp("tohost", st_name) == 0) {
+ address_symbol_set = 1;
tohost_addr = st_value;
if (st_size != 8) {
error_report("HTIF tohost must be 8 bytes");
@@ -248,7 +251,7 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *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) {
memory_region_init_io(&s->mmio, NULL, &htif_mm_ops, s,
TYPE_HTIF_UART, size);
memory_region_add_subregion(address_space, base, &s->mmio);
--
1.8.3.1
next prev parent reply other threads:[~2018-04-18 10:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 10:16 [Qemu-devel] [PATCH v1 0/2] riscv: htif fixes KONRAD Frederic
2018-04-18 10:16 ` KONRAD Frederic [this message]
2018-04-18 10:16 ` [Qemu-devel] [PATCH v1 2/2] riscv: htif: increase the priority of the htif subregion KONRAD Frederic
2018-04-20 0:57 ` Michael Clark
2018-04-24 15:46 ` KONRAD Frederic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524046608-12906-2-git-send-email-frederic.konrad@adacore.com \
--to=frederic.konrad@adacore.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=mjc@sifive.com \
--cc=palmer@sifive.com \
--cc=qemu-devel@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).