From patchwork Tue Jun 5 17:12:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 137787 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1217199lji; Tue, 5 Jun 2018 10:15:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJa/rt/jHEp2ZVmWQIQg7VILBGzQebFEtv6GUqRUgJm6VNMQEUzrlwI9TUJ8nPpsBJkb/H4 X-Received: by 2002:a24:a104:: with SMTP id y4-v6mr92906ite.68.1528218935040; Tue, 05 Jun 2018 10:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528218935; cv=none; d=google.com; s=arc-20160816; b=KjKPNKMNHu8YlQNTojW6F/0a7TrcxcyJtHhin6FjA56CuZN9AqRFHgNAEPkrSEhyfe Ay4O35Gz5vRBjb+t8eidrWHGqsw0BU5zI1g6vQT815uNP/BnSlNIfWeJRhQX+86LGnJZ 3kC3ddQlYKT46o17AcIpfEJzEQLDlRyLcxIRM/IEpw9017/RrnEeL+N7UBXbQFJ0RdDv 71QqaV/aIZcwhGUj54+fDZQ12ERnXmBXshfWP5ctG7xlUuvcTUZD4+PvQx8x4DfFerFc sK/nw7WctZXYucY9+mVaTyIviFblXES2XfQlrX0xIQiWcNzmt9aahirlQcOkfjn70m3U pbMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=H1SXsNzlmzfe+9Zwd/pAIgth+GDygNWfwg6EM//fjps=; b=kCAqQFfoxTBiYsIm5N2uTCh4JE7ELszc7HV8as/h1rx4fQ9UYJA1szuq60uzsAuVbo zOAZeGl0OxFTsTpv7RsO6Uhi24VIx+2Xcfc2IaRi8DanygqwVj9GILil9JGruhSzKfT9 7vlPpUbcGoFi/g/ESP0SPBUXQ6WNtemyN4h2PFpF/iGkPybxKfkvc+UvT6UkTjvJVDHZ EPUzUpQ+lv9fcWeIcOIuME+87JBFKsbWBtSc+MIDYpaj4Fb9MuavGyoiRFYgDI9A0jtm 5exS4cnINtQrIohZJTlDNk1zLSLANBg6ZSYumxe3p1yuEN/hWJXavjqqMZNuX6T9b9sU vESQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h184-v6si1966032itg.119.2018.06.05.10.15.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 10:15:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQFVx-0007xG-Eh; Tue, 05 Jun 2018 17:12:57 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQFVv-0007w7-Nw for xen-devel@lists.xen.org; Tue, 05 Jun 2018 17:12:55 +0000 X-Inumbo-ID: 5f17bf87-68e3-11e8-9728-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 5f17bf87-68e3-11e8-9728-bc764e045a96; Tue, 05 Jun 2018 19:10:39 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A5771596; Tue, 5 Jun 2018 10:12:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 600F53F25D; Tue, 5 Jun 2018 10:12:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org, xen-devel@lists.xen.org Date: Tue, 5 Jun 2018 18:12:34 +0100 Message-Id: <20180605171237.30601-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180605171237.30601-1-julien.grall@arm.com> References: <20180605171237.30601-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 4/7] xen/arm: Drop support for loading ELF Dom0 kernel X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The code has been around since the beginning of Xen Arm. However, I am not aware of any user and the code is pretty bogus: 1) It is assuming virtual address == physical address. 2) The cache is not cleaned after the Image is loaded but the Image is started with Cache disabled. 3) There are not clear ABI with the guest. Xen is currently supporting 3 other formats (zImage, Image, U-boot Image) as well as gzip compressed version of each formats. All of them are well documented and widely use. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Given the state, I doubt anyone is using the ELF format with Xen on Arm. By dropping this code, it also allows us to remove the built-in libelf (~1.2K lines) from Xen. --- xen/arch/arm/kernel.c | 77 --------------------------------------------------- xen/arch/arm/kernel.h | 10 +------ 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index b29028f7d0..000d9397e1 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -421,81 +421,6 @@ static int __init kernel_zimage32_probe(struct kernel_info *info, return 0; } -static void __init kernel_elf_load(struct kernel_info *info) -{ - /* - * TODO: can the ELF header be used to find the physical address - * to load the image to? Instead of assuming virt == phys. - */ - info->entry = info->elf.parms.virt_entry; - - place_modules(info, - info->elf.parms.virt_kstart, - info->elf.parms.virt_kend); - - printk("Loading ELF image into guest memory\n"); - info->elf.elf.dest_base = (void*)(unsigned long)info->elf.parms.virt_kstart; - info->elf.elf.dest_size = - info->elf.parms.virt_kend - info->elf.parms.virt_kstart; - - elf_load_binary(&info->elf.elf); - - printk("Free temporary kernel buffer\n"); - free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order); -} - -static int __init kernel_elf_probe(struct kernel_info *info, - paddr_t addr, paddr_t size) -{ - int rc; - - memset(&info->elf.elf, 0, sizeof(info->elf.elf)); - - info->elf.kernel_order = get_order_from_bytes(size); - info->elf.kernel_img = alloc_xenheap_pages(info->elf.kernel_order, 0); - if ( info->elf.kernel_img == NULL ) - panic("Cannot allocate temporary buffer for kernel"); - - copy_from_paddr(info->elf.kernel_img, addr, size); - - if ( (rc = elf_init(&info->elf.elf, info->elf.kernel_img, size )) != 0 ) - goto err; -#ifdef CONFIG_VERBOSE_DEBUG - elf_set_verbose(&info->elf.elf); -#endif - elf_parse_binary(&info->elf.elf); - if ( (rc = elf_xen_parse(&info->elf.elf, &info->elf.parms)) != 0 ) - goto err; - -#ifdef CONFIG_ARM_64 - if ( elf_32bit(&info->elf.elf) ) - info->type = DOMAIN_32BIT; - else if ( elf_64bit(&info->elf.elf) ) - info->type = DOMAIN_64BIT; - else - { - printk("Unknown ELF class\n"); - rc = -EINVAL; - goto err; - } -#endif - - info->load = kernel_elf_load; - - if ( elf_check_broken(&info->elf.elf) ) - printk("Xen: warning: ELF kernel broken: %s\n", - elf_check_broken(&info->elf.elf)); - - return 0; -err: - if ( elf_check_broken(&info->elf.elf) ) - printk("Xen: ELF kernel broken: %s\n", - elf_check_broken(&info->elf.elf)); - - free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order); - return rc; -} - int __init kernel_probe(struct kernel_info *info) { struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL); @@ -528,8 +453,6 @@ int __init kernel_probe(struct kernel_info *info) rc = kernel_uimage_probe(info, mod->start, mod->size); if (rc < 0) rc = kernel_zimage32_probe(info, mod->start, mod->size); - if (rc < 0) - rc = kernel_elf_probe(info, mod->start, mod->size); return rc; } diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h index 6d695097b5..47eacb5ba9 100644 --- a/xen/arch/arm/kernel.h +++ b/xen/arch/arm/kernel.h @@ -6,7 +6,6 @@ #ifndef __ARCH_ARM_KERNEL_H__ #define __ARCH_ARM_KERNEL_H__ -#include #include #include @@ -45,13 +44,6 @@ struct kernel_info { #endif paddr_t start; /* 32-bit zImage only */ } zimage; - - struct { - struct elf_binary elf; - struct elf_dom_parms parms; - unsigned kernel_order; - void *kernel_img; - } elf; }; }; @@ -60,7 +52,7 @@ struct kernel_info { * * Sets in info: * ->type - * ->load hook, and sets loader specific variables ->{zimage,elf} + * ->load hook, and sets loader specific variables ->zimage */ int kernel_probe(struct kernel_info *info);