From patchwork Mon Mar 19 21:18:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10295159 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 EEE6F602C2 for ; Mon, 19 Mar 2018 21:21:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0132294EF for ; Mon, 19 Mar 2018 21:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D131F294F4; Mon, 19 Mar 2018 21:21:27 +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 5DBC6294EF for ; Mon, 19 Mar 2018 21:21:27 +0000 (UTC) Received: from localhost ([::1]:43984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2De-0002lt-DH for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 17:21:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2C6-0001KB-2r for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey2C2-0002ZZ-0l for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:50 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:39370) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey2C1-0002YV-RQ for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:19:45 -0400 Received: by mail-pl0-x241.google.com with SMTP id k22-v6so10205902pls.6 for ; Mon, 19 Mar 2018 14:19:45 -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 :mime-version:content-transfer-encoding; bh=iQkLw7e7jDGRvqEWGlEj0fd4xyCWiis5BdoY3u6ygN0=; b=RKL4Ysvc2Hc01IJiwm4lbjELt8OmLRB4RnIGl4Uk2ppd3vBagj90ceZS/ilXjygSIQ VAOk78bhm6b1LX3W2FyrbngEr4F+/QZ+kETqT8QPzE6HKEjWLAU3HE8X9PQHS2r/pEV9 sC0KALqzw0R3PDUSVa7pXVacBTTdwhnTvOekO9bR/2kzqXgy09JlX662DTkUrumPhKE2 nhtyGTklTG6oWnqXENEBPnprxk0LC3f5oUFaD9wDB33ouFAN1j4xJNj8/eHqNTJYF8Sy IFRDgKDzAajW52v/KKFSbEVJ2Y8vRuaMwIWPhXNPr+V/xIgxhXdVNFFvi1uFqfRUGlpi 62Lw== 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=m1MLBvqM9gdEcxKHpQAbXq3E2tfegHF6RhlVbqXe7NP7myGsmMejZhwZb3/uc4oBcE PsjjVdOX2zhOCRz6qGPnoh36DhS6SZ5XpwoUvUT+FfoWZhfhoMUOUaFNpwlYg+kg0AkS ZXvDqvI9vZ+4Edf0iJ+AhNLhzalBNKh6fogWiHn5GnRUwHrnqYzqsGjrYlzvOSPefaNp kcw7hx6Ufszqe4WZluBUpzWHT1UJrKxHXaE9W0E3DocRA08zECezL+V5FoG9EttLJw3y WpymdWiKXx5QRCVfOLpAY6aiIM/Ak6cce61amKCjL3i+hBxgQ6qJKuXJgeSI4bBiDub2 B2dw== X-Gm-Message-State: AElRT7H7/yigc34wgUEwAKlnVm0RN+OXNcOSXJWp7QNq5st2jSTAdVI7 QVXijlRYxzm7s4DS8DwZQZsuGiWI8Qg= X-Google-Smtp-Source: AG47ELt6lMYeffZkCZHOWAOdTHI7GW2iV8+pU1dmrQLZdSY69lgX/FVCv1PYC1SYoRLwYiFtqpE6BA== X-Received: by 2002:a17:902:481:: with SMTP id e1-v6mr13772155ple.377.1521494384896; Mon, 19 Mar 2018 14:19:44 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i127sm120500pfc.136.2018.03.19.14.19.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 14:19:44 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 14:18:28 -0700 Message-Id: <1521494329-19546-6-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521494329-19546-1-git-send-email-mjc@sifive.com> References: <1521494329-19546-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:c01::241 Subject: [Qemu-devel] [PATCH v4 05/26] 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: patches@groups.riscv.org, Michael Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann 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);