From patchwork Thu Nov 15 05:52:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 151165 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6593528ljp; Wed, 14 Nov 2018 21:52:29 -0800 (PST) X-Google-Smtp-Source: AJdET5e+MNvYgV1PD03gStN8EfnE8qaIExf2DJnSHBO4d4OUHYdXFjK4fx6cyZyVuTLWSziiHzqL X-Received: by 2002:a63:5f41:: with SMTP id t62mr4599559pgb.76.1542261148903; Wed, 14 Nov 2018 21:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542261148; cv=none; d=google.com; s=arc-20160816; b=Ss1ca6kWV5a+jefjhA57tjqR6j1YJn1j+4sw9IfYCN5BtQAeZiR7uAKrg1nSHASxX/ T3ygN3ANrAAFiLvY64ek18W9aNHIDBh+XyOexAr2H65VauGNdS07dksryFy/dhZw1p9U HrjHDHyXPVrEIY7fcd8JED6w9nCaiMLeWfCXXF6H2NAfrQ28Hwvdg7L99L2pVXLhqcBF xoKko4Qu9TUS/AnHLeyUodjgEZUecILbQr8gPbwqIA9lD3pv/xBe2c2+vnHlLlOnAu9a 6Mcw1VFe6BQoCTCjK8kDERBDqwv7sTTA/h4XzcMK/j5NysXjURwXNPz/jSo0Bo1o8Jbn 0P5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eQVF/NE5LgDyDCoQh0ftmhN/0hZKHUsKcfSHpKIBIX8=; b=zfjcaeYxO34n9Tm1OVu/XN6EiwEDejRCj+y+XegdRvI6Ph3jMMNGxPeIwSZTPAupLo o5FITyERDEx5vTg2yX6RXG9+pIwFGH903IxdV79FDT7I5OjSDH+BTNB/Q35TBMAqPCkx 4pqXCrkhCFhi9Ls41VUSWSlQkPin+sgKoW6Y0s60ei1BmfthHDHJ/96DnnnHxXjdz8kx 5SDIhHkGE2LRRqg6uALDEf7nb4glScTnMjmWRr3AlS4YVLQTdk6helbShLgoDtGm1Fm5 hN5Q8b6vxRVt/AUNbYG+juT9zXbS40YJBRjOs/J3olMLx6DiE9u+SeR+7kAN312J8nv8 sYDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SWInm5I8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k186si8561089pgc.576.2018.11.14.21.52.28; Wed, 14 Nov 2018 21:52:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SWInm5I8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728681AbeKOP6w (ORCPT + 32 others); Thu, 15 Nov 2018 10:58:52 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:45819 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728645AbeKOP6v (ORCPT ); Thu, 15 Nov 2018 10:58:51 -0500 Received: by mail-yb1-f196.google.com with SMTP id 131-v6so7889194ybe.12 for ; Wed, 14 Nov 2018 21:52:26 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=eQVF/NE5LgDyDCoQh0ftmhN/0hZKHUsKcfSHpKIBIX8=; b=SWInm5I83ZSSOs6Oky+TLdEe+XVLwX+bqxuLVQQgTl88XpOcoinPwkYI+tOOOTsO7n am1IVi9JIJYDZ6Ew3fn3vMEfaOurkJV/Lq1FVbuFxPN/BqJUd1dWb5lwbD9suCMIZ42u XVhdIVsHj37uVaAxN1tR5PVJ2GURTvxxka/94= 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=eQVF/NE5LgDyDCoQh0ftmhN/0hZKHUsKcfSHpKIBIX8=; b=KsRkJuQD1xbpvLwj7j9yYfYMVfsmt2R4eiqoeclLSmq6XIniGLqFScgNhLTfi86I4T p/snNq+1v6omHuRBuv2wcNKT4hxqUNGitKcXEcGVoav4gmTw0QJ+jij3hb2pt9HqJ3+9 X79xgbJAWvAVrRBJcy0AKkvNN/dnFKw8QodSxk67FVvMgxd2OmwEc6f+Zo1isrK2gxam jyVHx3+STX5UXOe/rKTyNSUGutX0+DelWUQOmcnbqfqxUZgjkB4Wa3b028yjeftoBYYz VlTa01FmkdoXEGFvPWR1tccVOKMua1YcOpUhptJv0XUfgs8YTooB2vOLM/+0tgdEHx77 B4LA== X-Gm-Message-State: AGRZ1gIstYnj2v4aXqeeEt7R19HmMb2PKcyZd3UlKvZXDKhRcHkYMvYF O5EvYWAFVcEJdZmSJT+NeRKEKQ== X-Received: by 2002:a25:ae92:: with SMTP id b18-v6mr4695234ybj.286.1542261145471; Wed, 14 Nov 2018 21:52:25 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id j185-v6sm7067497ywf.4.2018.11.14.21.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 21:52:25 -0800 (PST) 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 Cc: prudo@linux.ibm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v16 03/16] s390, kexec_file: drop arch_kexec_mem_walk() Date: Thu, 15 Nov 2018 14:52:42 +0900 Message-Id: <20181115055254.2812-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181115055254.2812-1-takahiro.akashi@linaro.org> References: <20181115055254.2812-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.19.0 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 9ce6672f4fa3..9e6529da12ed 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -532,6 +532,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;