From patchwork Wed Apr 25 23:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10364377 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 83DFB602D6 for ; Wed, 25 Apr 2018 23:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7259F28841 for ; Wed, 25 Apr 2018 23:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 646D528854; Wed, 25 Apr 2018 23:52:45 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 BA5D628841 for ; Wed, 25 Apr 2018 23:52:44 +0000 (UTC) Received: from localhost ([::1]:39573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBUDL-0000cc-HH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Apr 2018 19:52:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBU8B-0004Wq-Ev for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:47:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBU8A-0004oK-EX for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:47:23 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:46818) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fBU8A-0004o0-7n for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:47:22 -0400 Received: by mail-pf0-x243.google.com with SMTP id p12so592279pff.13 for ; Wed, 25 Apr 2018 16:47:22 -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=7ofpvnGElWgJ6TVqWiOWQYdr2Fw0JUiqaJGBqKmGf4Y=; b=Sr4+uaF1f0K+tiUreMdZ/QkQrAmsv9bVj1D43XxhFgFrFn8dmZlzEd72jTVFsqPTMz SvCVrMpQShkSZuU+wgxpH7xl9ywhXgpVe+X/c/oMsT2jzewNavEisS+0IrbCA29ARrGO p+bhYUNL0tSnCDz1Ba1D/+vUDboWIE2H56LJuRJVn5P0CUuQOOBm1OXNXyvskRcjzOUe 0/4LCTrOboAx17uEHWqnY1bON4tJ9J8FJGiEl7byiol3AdAg2eHHmeyFtLnbp/MIpM5C 1aSKl6D5t6qkkZR4Dz/n9nRh5clgMFz0wqi5c0rx96aaxCwgJ0IgMXQnwE83dkwzOtH5 O8qw== 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=7ofpvnGElWgJ6TVqWiOWQYdr2Fw0JUiqaJGBqKmGf4Y=; b=k77LwHUbq6hb/UQ8vt366u3SvdqUPlFoBirhlk421ffaejjoJkJCnVb37R1HoObXgI noYq6c87ioOgMfMybhzuVTQ/ltmLFkPpK/iEvagsah/EBRGRi5gjjHptpnCVA1L17kAi gvDqN6a0kRRabdz5pdWoFseCI9gmzBHvkP+7O0Q4nQELp/gFl6faUMc30Ylr5oqi+QTk HFUiAi1LnhzFL+obhfsjPWTs0/le1/t7ywRxlLWonaCYBL47FsKIqj+0AUsgvCDYV8Yd E8i8kqV8tI78PLZsIJp15Up02H0Fj/wZC93KVQjN7GXJXRTdt/HRoeICVAeTtllXbNd1 zezw== X-Gm-Message-State: ALQs6tBjWn6MNZ13qAH5Dexi9iTIXtpHFSraqLDnbZujogC638S0Gr2u 96fWgg4ZpkmRW7HVTE1OHnO9jNwTIqc= X-Google-Smtp-Source: AB8JxZrKK/DD+9Gp5iiW1rwJXjwTzyDE7Mfo3rA6pLj2rFW4/M93DgmXVpLHYoZ5KqgjXNGKsr/jlQ== X-Received: by 2002:a17:902:82ca:: with SMTP id u10-v6mr8327709plz.160.1524700041244; Wed, 25 Apr 2018 16:47:21 -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 e10sm29577549pfn.67.2018.04.25.16.47.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 16:47:20 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Thu, 26 Apr 2018 11:45:07 +1200 Message-Id: <1524699938-6764-5-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1524699938-6764-1-git-send-email-mjc@sifive.com> References: <1524699938-6764-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:c00::243 Subject: [Qemu-devel] [PATCH v8 04/35] 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 ac0106e..6311675 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);