From patchwork Tue Jul 12 01:42:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 647164 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rpPpN2rpGz9s36 for ; Tue, 12 Jul 2016 11:42:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=gmoJjxXw; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rpPpN1mmxzDqyj for ; Tue, 12 Jul 2016 11:42:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=gmoJjxXw; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rpPj632FSzDqxM for ; Tue, 12 Jul 2016 11:37:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=gmoJjxXw; dkim-atps=neutral Received: by mail-pa0-x233.google.com with SMTP id hu1so755156pad.3 for ; Mon, 11 Jul 2016 18:37:30 -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=Q/dh70pEFK7Mw7rOb8pHiqVApuTDwqKPUloB9/q9Yp0=; b=gmoJjxXwVZfG105hYncKQw5AT3szk1A3w4F2NuOaQOp1MB6UMGGzrjlnPiJG7PGhSb lHV+Hv06iipIQKZAmZ7xxyXfXsv1CQGXwP/6K2uUlvKO4ggvje7BFHZVZF/JI+l6faLD U7ol6MIM7iQPcNgAv/53aDQK3H7r8gG+rOw4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q/dh70pEFK7Mw7rOb8pHiqVApuTDwqKPUloB9/q9Yp0=; b=bA3QCCXoMUCqz2a3q/u0K+c1H02/ypim0wvyoD1NEJl32kC0a2j/8AFB/fAGPtoIOL NMjMX2jNoN7WakwrGoAKoOuPb4XARWInA7og4ofpASXiXIQjOMO5lVEE+HNBBZP37zKd NUwfcElwlOl8xZ1iHHVQhOf4lfSuALqPCxUAQxHa2VrGcZo6cPk9UFB/gAN5poLGMGpL BGCVwzaPVExAZiKgoCT8DHZaflzWNViI7hFvryjp6srRoyJCr+uXA89lOC/+zVM/uOj8 1sLv1+Eyv/OuDNPe8cnN4IRWGzyK6UujPAje3D2AMDoA036ymQzdFfXOjP9B7XuQmWAW 9cGw== X-Gm-Message-State: ALyK8tJi/ZAgD+JlEJUQB+fr+PWH8r8m3Cr/jdLmqre+X2dOsNGA5G/I8AfP3DkDzJ4GnC0o X-Received: by 10.66.80.2 with SMTP id n2mr32970092pax.134.1468287448500; Mon, 11 Jul 2016 18:37:28 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id n17sm6807750pfb.38.2016.07.11.18.37.27 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 11 Jul 2016 18:37:28 -0700 (PDT) From: AKASHI Takahiro To: ebiederm@xmission.com, vgoyal@redhat.com, dyoung@redhat.com, bhe@redhat.com, bauerman@linux.vnet.ibm.com, arnd@arndb.de Subject: [RFC 2/3] kexec: add dtb info to struct kimage Date: Tue, 12 Jul 2016 10:42:00 +0900 Message-Id: <20160712014201.11456-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160712014201.11456-1-takahiro.akashi@linaro.org> References: <20160712014201.11456-1-takahiro.akashi@linaro.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AKASHI Takahiro MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Device tree blob must be passed to a second kernel on DTB-capable archs, like powerpc and arm64, but the current kernel interface lacks this support. This patch adds dtb buffer information to struct kimage. When users don't specify dtb explicitly and the one used for the current kernel can be re-used, this change will be good enough for implementing kexec_file_load feature. Signed-off-by: AKASHI Takahiro --- include/linux/kexec.h | 3 +++ kernel/kexec_file.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index e8acb2b..554c848 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -190,6 +190,9 @@ struct kimage { char *cmdline_buf; unsigned long cmdline_buf_len; + void *dtb_buf; + unsigned long dtb_buf_len; + /* File operations provided by image loader */ struct kexec_file_ops *fops; diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 9891464..7278329 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -96,6 +96,11 @@ void kimage_file_post_load_cleanup(struct kimage *image) image->initrd_buf = NULL; } + if (image->dtb_buf) { + vfree(image->dtb_buf); + image->dtb_buf = NULL; + } + if (image->cmdline_buf) { kfree(image->cmdline_buf); image->cmdline_buf = NULL;