From patchwork Fri Mar 9 04:12: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: 10269633 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 D28E3602BD for ; Fri, 9 Mar 2018 04:19:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C745D29BE3 for ; Fri, 9 Mar 2018 04:19:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B99DB29CB8; Fri, 9 Mar 2018 04:19:09 +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 22B4729BE3 for ; Fri, 9 Mar 2018 04:19:09 +0000 (UTC) Received: from localhost ([::1]:43115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9Uq-0007cz-BI for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 23:19:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9QI-0003vs-Qm for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eu9QH-0006se-6R for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:26 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:44793) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eu9QH-0006sM-0b for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:14:25 -0500 Received: by mail-pg0-x241.google.com with SMTP id l4so3116524pgp.11 for ; Thu, 08 Mar 2018 20:14:24 -0800 (PST) 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=iQkLw7e7jDGRvqEWGlEj0fd4xyCWiis5BdoY3u6ygN0=; b=bBvIMShgKA1jJOyPpJ1Dpu6iyLGvW3CAWs0Kr2H/K/yYRkdFAFLtaDJz5/CJFD8a7W vToSSive/O1zvO4XXtgXZTsyId7sAVq1mOqOBQuevhuJIhygbpMAFxdBd37WOi2K2UOP QE+BSR3QwRLT8RWex7DbTNrBsQXMhlyiqjLvqqbLnJFEzPA4AoR+KY52dSvvsZKJKXLy Rdz5R3fF+C1We786DUxAgAHbe9t996u2r3fAYrfmW9MYbTVnfhjnsF339q+rzFZfY910 Cd/aqUfq3rSO4f2Tc34uPZiLVNarZXtiEEWcCdNU43WOm4ky7KqZ1fDNpA+sRZWpXhaW obiw== 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=iQkLw7e7jDGRvqEWGlEj0fd4xyCWiis5BdoY3u6ygN0=; b=YBiG7ArWYhITuiphEs31p6kwAn4ka0k4wIiBFYNeMwAT6jEd2UudESJn4dCB/Fp3gG 7s5WAul20E5w0+i+ACKUzRh445yz/ObCjRwaOI3sssWnSvEyWdROFbRPaDsiC/dQqQgh 2881547gcga/MHt1ROj1rBJB5hYwfl5SxE9O2xhP19K4CEzdLWaLfjrn1V2UM+Zcg5DM Mn5bYncCVHSWjqNRMqp+Z7LxcBDswl9VcLb+gqzhqGS+d6i4M6FJIOGjq5Fl5DAYFFK0 O971iIdm2t6LlKEpaM7kUtaVpRhNkH1xWvnVZq9hF5LzLW6CRMTRe//rTEh63N85lfuy jhCQ== X-Gm-Message-State: APf1xPCV6EFnd1X/wcCE4sxi6NJjpdLEqJRdFyx6g1tCcahUC/qPm4VT 4D6cHEqr6tzmd8i1Fr4JbyV74YOnZLU= X-Google-Smtp-Source: AG47ELt3xXkBN1Fqm3hkuegKTyID9WR9XH8fCzXRMvoIevAETkWwaqY5cFMMQdOXTVXRiRSjebLLBA== X-Received: by 10.99.183.5 with SMTP id t5mr23530517pgf.416.1520568864082; Thu, 08 Mar 2018 20:14:24 -0800 (PST) Received: from localhost.localdomain (125-237-39-90-fibre.bb.spark.co.nz. [125.237.39.90]) by smtp.gmail.com with ESMTPSA id h15sm334141pfi.56.2018.03.08.20.14.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 20:14:23 -0800 (PST) From: Michael Clark To: qemu-devel@nongnu.org Date: Fri, 9 Mar 2018 17:12:27 +1300 Message-Id: <1520568765-58189-6-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1520568765-58189-1-git-send-email-mjc@sifive.com> References: <1520568765-58189-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:c05::241 Subject: [Qemu-devel] [PATCH v2 05/23] RISC-V: Remove identity_translate from load_elf 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: Bastian Koppelmann , Michael Clark , Palmer Dabbelt , Sagar Karandikar Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When load_elf is called with NULL as an argument to the address translate callback, it does an identity translation. This commit removes the redundant identity_translate callback. Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Michael Clark Signed-off-by: Palmer Dabbelt Reviewed-by: Philippe Mathieu-Daudé --- hw/riscv/sifive_e.c | 7 +------ hw/riscv/sifive_u.c | 7 +------ hw/riscv/spike.c | 7 +------ hw/riscv/virt.c | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 19eca36..09c9d49 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -82,16 +82,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len) } } -static uint64_t identity_translate(void *opaque, uint64_t addr) -{ - return addr; -} - static uint64_t load_kernel(const char *kernel_filename) { uint64_t kernel_entry, kernel_high; - if (load_elf(kernel_filename, identity_translate, NULL, + if (load_elf(kernel_filename, NULL, NULL, &kernel_entry, NULL, &kernel_high, 0, ELF_MACHINE, 1, 0) < 0) { error_report("qemu: could not load kernel '%s'", kernel_filename); diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index f3f7615..6116c38 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -68,16 +68,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len) } } -static uint64_t identity_translate(void *opaque, uint64_t addr) -{ - return addr; -} - static uint64_t load_kernel(const char *kernel_filename) { uint64_t kernel_entry, kernel_high; - if (load_elf(kernel_filename, identity_translate, NULL, + if (load_elf(kernel_filename, NULL, NULL, &kernel_entry, NULL, &kernel_high, 0, ELF_MACHINE, 1, 0) < 0) { error_report("qemu: could not load kernel '%s'", kernel_filename); diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 4c233ec..7710333 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -59,16 +59,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len) } } -static uint64_t identity_translate(void *opaque, uint64_t addr) -{ - return addr; -} - static uint64_t load_kernel(const char *kernel_filename) { uint64_t kernel_entry, kernel_high; - if (load_elf_ram_sym(kernel_filename, identity_translate, NULL, + if (load_elf_ram_sym(kernel_filename, NULL, NULL, &kernel_entry, NULL, &kernel_high, 0, ELF_MACHINE, 1, 0, NULL, true, htif_symbol_callback) < 0) { error_report("qemu: could not load kernel '%s'", kernel_filename); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 0d101fc..f8c19b4 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -62,16 +62,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len) } } -static uint64_t identity_translate(void *opaque, uint64_t addr) -{ - return addr; -} - static uint64_t load_kernel(const char *kernel_filename) { uint64_t kernel_entry, kernel_high; - if (load_elf(kernel_filename, identity_translate, NULL, + if (load_elf(kernel_filename, NULL, NULL, &kernel_entry, NULL, &kernel_high, 0, ELF_MACHINE, 1, 0) < 0) { error_report("qemu: could not load kernel '%s'", kernel_filename);