From patchwork Fri Sep 7 07:56:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10591835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7FFA112B for ; Fri, 7 Sep 2018 08:05:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C943C2AA89 for ; Fri, 7 Sep 2018 08:05:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD19B2AD5B; Fri, 7 Sep 2018 08:05:57 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 141772AA89 for ; Fri, 7 Sep 2018 08:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=SR4uPc0+2vXY2cfqo796YhxA30Lq4y46mpCObk0wprE=; b=l1BTRa8jzvszc9tyeDMbqftR/D PzWfGWyCW4SHxbgF4NBhyAnxOBuRoN8P0pPrLK4xrMf6AxAkHvQ1qsN7kofz5LXtpC1FaUHSL1E9v AQewMTlBTLTCNTt0ZBcTAyWDMmhP1YpVu5MJauudaDq6Mbxs1xMBiP7r9EbxtKRUiBP007WADuadK 8W5xaCu8HDZbuAAxRDkl74rszP728X8Xi26nqD4msAFpWTYrTZBWJhT3LzjBNxmQGr4jaecws2gsb Gf3sMlb7XLLtjGTbhVV64vHl9pa8mJPL7GYeAxbe3AOt70il3ReCQTr8U3bfRmBG7fbBpXKeQfgQU QviwcCQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyBlq-0005Vq-JL; Fri, 07 Sep 2018 08:05:38 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyBhT-0002sM-Ru for linux-arm-kernel@bombadil.infradead.org; Fri, 07 Sep 2018 08:01:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UFZdSzOBCDhCucMx9QLxaQGXbSUDnlXX6wiHP7BXxqU=; b=zvLqg86WNG2rGYcCsa1GkRhNo tpXV4QGcivwpZClQ8NrqQHCeKlmqEI1q9P8reYF1HaZfcaPMcUcQ3iD8u3CtROmB49CaRCRAQdIcK t2yumIfcseGrt/Vn2siZEgdcF+IUtbhmSME1H5mgkbIKLHhV3d+BlvOYAzE9aejR5KV8Yog2HnM4A 7mdi4/ISgluCtB9hOR94nC8JEQmm+kd2I6YWlAq7r3G/gEUl3gS6DHUoOZI8Sb2aD6aK7/3L68QOw yZzcReLMVaONpRvXV53xnBnX3e1beScXuxyI34lv5n8YlTB7Ak9LzED1/G6+XPFfKFhVl4Yp47a8R LB7q8eF4A==; Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyBfM-0007wq-Ma for linux-arm-kernel@lists.infradead.org; Fri, 07 Sep 2018 07:58:57 +0000 Received: by mail-pl1-x62b.google.com with SMTP id f6-v6so6241969plo.1 for ; Fri, 07 Sep 2018 00:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UFZdSzOBCDhCucMx9QLxaQGXbSUDnlXX6wiHP7BXxqU=; b=NcvFPXdYdZnDZNUVaQmm1LA4c2cwtD4jx3+WjEo8Va01rghMCP75wL98HCDEiKEYvr gafPvWw6Fq5vvgw1w6y3oLFWGyMnKqI+8chfWup9dmIjcNopmB2AM6xhsOdh1VACxtHz mIx7zRckOMd9qDkvOk9BiiHRfQ7z7O5wM+3TU= 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=UFZdSzOBCDhCucMx9QLxaQGXbSUDnlXX6wiHP7BXxqU=; b=c2Bd0l+XKGWtxNvID6FMnMeclf6MeaOIxts6sYu6T19Xcs48ElSOyI7qSAneSmclwq rny0SHaci3zrwTZiLf/OBe5LiBGY1k6biErSybzz034+DbXtXncPZBH9zYGD2Fl7gg2c QZM+3GXPJwtiw2YNsqmwD+LMORlQAx1XODDVo57NJOeCUNc9thvWDM9QudNiW4EZ6paJ wvdKTm91cNHuMmGpoNg6Rt+5PijHj+9+3UaK0Vi82c/pZ+JI2S9k+SwT/oCq/Hhk3lvD 2ZNSPra2URaBW0erUcc5r2qWqVHAlETRMT7w11FN/UUUZXTJgk5wkap2O4tnplHZouf/ IMOg== X-Gm-Message-State: APzg51CwpEflvemVSx3+8PV19KfE+aFzmHFvh9D0bgOD+WIMkD/uJTyS lZ1SRVrXlAge+OOjg2qTW1GK7Q== X-Google-Smtp-Source: ANB0VdZfil51JUnpmyhtdzSSLzTm0D/G1dShFjmbF9UAvtCZSnPX7baPMcWHq0drrGHkqyRQMTA8jQ== X-Received: by 2002:a17:902:5a87:: with SMTP id r7-v6mr6601602pli.247.1536307060716; Fri, 07 Sep 2018 00:57:40 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id f87-v6sm19872299pfh.168.2018.09.07.00.57.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:57:40 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: [PATCH v14 03/16] s390, kexec_file: drop arch_kexec_mem_walk() Date: Fri, 7 Sep 2018 16:56:40 +0900 Message-Id: <20180907075653.4696-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907075653.4696-1-takahiro.akashi@linaro.org> References: <20180907075653.4696-1-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180907_035856_756353_3268F0B1 X-CRM114-Status: GOOD ( 20.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, prudo@linux.ibm.com, AKASHI Takahiro , james.morse@arm.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since s390 already knows where to locate buffers, calling arch_kexec_mem_walk() has no sense. So we can just drop it as kbuf->mem indicates this while all other architectures sets it to 0 initially. This change is a preparatory work for the next patch, where all the variant memory walks, either on system resource or memblock, will be put in one common place so that it will satisfy all the architectures' need. Signed-off-by: AKASHI Takahiro Reviewed-by: Philipp Rudo Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- arch/s390/kernel/machine_kexec_file.c | 10 ---------- include/linux/kexec.h | 8 ++++++++ kernel/kexec_file.c | 4 ++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c index f413f57f8d20..32023b4f9dc0 100644 --- a/arch/s390/kernel/machine_kexec_file.c +++ b/arch/s390/kernel/machine_kexec_file.c @@ -134,16 +134,6 @@ int kexec_file_add_initrd(struct kimage *image, struct s390_load_data *data, return ret; } -/* - * The kernel is loaded to a fixed location. Turn off kexec_locate_mem_hole - * and provide kbuf->mem by hand. - */ -int arch_kexec_walk_mem(struct kexec_buf *kbuf, - int (*func)(struct resource *, void *)) -{ - return 1; -} - int arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section, const Elf_Shdr *relsec, diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 49ab758f4d91..f378cb786f1b 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -145,6 +145,14 @@ int kexec_image_probe_default(struct kimage *image, void *buf, unsigned long buf_len); int kexec_image_post_load_cleanup_default(struct kimage *image); +/* + * If kexec_buf.mem is set to this value, kexec_locate_mem_hole() + * will try to allocate free memory. Arch may overwrite it. + */ +#ifndef KEXEC_BUF_MEM_UNKNOWN +#define KEXEC_BUF_MEM_UNKNOWN 0 +#endif + /** * struct kexec_buf - parameters for finding a place for a buffer in memory * @image: kexec image in which memory to search. diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 63c7ce1c0c3e..0fcaa86219d1 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -534,6 +534,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf) { int ret; + /* Arch knows where to place */ + if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN) + return 0; + ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback); return ret == 1 ? 0 : -EADDRNOTAVAIL;