From patchwork Mon May 7 23:14:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 909979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="ghUsPV7N"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fz6g43zBz9s0W for ; Tue, 8 May 2018 09:17:30 +1000 (AEST) Received: from localhost ([::1]:48499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFpNm-0008BK-OQ for incoming@patchwork.ozlabs.org; Mon, 07 May 2018 19:17:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFpMy-0008AR-I2 for qemu-devel@nongnu.org; Mon, 07 May 2018 19:16:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFpMw-0006mf-2F for qemu-devel@nongnu.org; Mon, 07 May 2018 19:16:36 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFpMv-0006m0-Ry for qemu-devel@nongnu.org; Mon, 07 May 2018 19:16:33 -0400 Received: by mail-pg0-x243.google.com with SMTP id j11-v6so20313821pgf.2 for ; Mon, 07 May 2018 16:16:33 -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=uAZp5rdj6Yi45P9mm0e2gcV0m+8SDt3+UxMHEzLv/ks=; b=ghUsPV7NAtwqjH1V7NhlJiJTsMleMXce97/+BXf14BHyFDgZh7v/uU8t0OvfDE7mzw xHqXGc8xyb7rfFK+T6/q5rekkIbc8IvT5XRO4WtO4V03UjlBE8rfxMqLyZwu6iW/DC/2 zPnPGnlUoWj7jcrqovgrX+d/cMG/1ZLuGshoCXU3lOm+tSfF/bq37EupSGehauU7N2We zXYUu0v/T1QZ1er4cjsHyyM0d1bkGOKsfoil/tVji6TCQ6aG4KzQ2D3fR0xWawUFQ2QD fzwR38k3PEYxnx/mBAxAh1h8xYGtEVWrbOYJiHvFw9iUQHSp4EvXMzUqOis8UMwqX3jI 6org== 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=uAZp5rdj6Yi45P9mm0e2gcV0m+8SDt3+UxMHEzLv/ks=; b=fbf+ldQDPC9ck5vWGGNaVNa4BxzOG+B/DnS6pGAbU/k9cPqI5MsnQGcw55Zwx2/6VS vwkpQIrUQ6LUkfsFiVj3UvrExH7Kr0iZQxBS+EKoBKeM0mKlumQp4AvntHp86GtrLCst cvjOzcs78qDziLeQNa/Hj2TiCmgaTMjw1N2JIE11GJkGXpq5Gyi4GLF1I7f3RU62rocq 3ZqSF58CPfQgUzK0DgqAsTQddBoWOSVoe47PhBHl428fBggh+5pAhdfZBkGKPHC70n/u 9CIML4ypVMk6Bu/SYyPkkElaXRxFzWLB8HZ9qyOw0Y4haDk5qcyWzBw0CrpqVy4rTg4A JrmQ== X-Gm-Message-State: ALQs6tDrRh249ZETCqAnaIhy1is+v9Xf33pKsa2y3+wGcHuJ9CyuACDS ZN/Eu7OIYisjX9Ke29xtHMwrJlN4qu8= X-Google-Smtp-Source: AB8JxZpMMaqIpXmWLyWddzLRuGUQr+zkueh4vKrWd7jzKb/mHQwSFHqoTEEOgkctSSXXcu6GKzmikw== X-Received: by 2002:a63:618b:: with SMTP id v133-v6mr30149616pgb.285.1525734992849; Mon, 07 May 2018 16:16:32 -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 q64sm42659569pfg.180.2018.05.07.16.16.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 May 2018 16:16:32 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Tue, 8 May 2018 11:14:51 +1200 Message-Id: <1525734893-10299-2-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1525734893-10299-1-git-send-email-mjc@sifive.com> References: <1525734893-10299-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:c05::243 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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) 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 |= 2; 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 == 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);