From patchwork Thu Aug 11 23:03:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 73824 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp346947qga; Thu, 11 Aug 2016 16:04:52 -0700 (PDT) X-Received: by 10.98.81.1 with SMTP id f1mr21564075pfb.35.1470956692795; Thu, 11 Aug 2016 16:04:52 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b64si5361568pfc.170.2016.08.11.16.04.52; Thu, 11 Aug 2016 16:04:52 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342AbcHKXEe (ORCPT + 27 others); Thu, 11 Aug 2016 19:04:34 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:10946 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbcHKXEc (ORCPT ); Thu, 11 Aug 2016 19:04:32 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7BN4Etn031741 for ; Thu, 11 Aug 2016 19:04:32 -0400 Received: from e24smtp01.br.ibm.com (e24smtp01.br.ibm.com [32.104.18.85]) by mx0a-001b2d01.pphosted.com with ESMTP id 24qm9v7dhp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 11 Aug 2016 19:04:31 -0400 Received: from localhost by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Aug 2016 20:04:29 -0300 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 11 Aug 2016 20:04:26 -0300 X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: bauerman@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id D7F791DC0051 for ; Thu, 11 Aug 2016 19:04:16 -0400 (EDT) Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7BN4Puv33816958 for ; Thu, 11 Aug 2016 20:04:25 -0300 Received: from d24av04.br.ibm.com (localhost [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7BN4NEX019223 for ; Thu, 11 Aug 2016 20:04:25 -0300 Received: from hactar.ibm.com (mwramos.br.ibm.com [9.18.201.183] (may be forged)) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7BN4KWK019189; Thu, 11 Aug 2016 20:04:22 -0300 From: Thiago Jung Bauermann To: kexec@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro , Eric Biederman , Dave Young , Vivek Goyal , Baoquan He , David Laight , Michael Ellerman , Benjamin Herrenschmidt , Stewart Smith , Arnd Bergmann , Mark Rutland , Russell King - ARM Linux , Andrew Morton Subject: [PATCH v2 1/2] kexec: add dtb info to struct kimage Date: Thu, 11 Aug 2016 20:03:57 -0300 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470956638-3589-1-git-send-email-bauerman@linux.vnet.ibm.com> References: <1470956638-3589-1-git-send-email-bauerman@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081123-1523-0000-0000-00000212FFA6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081123-1524-0000-0000-000027CBFCA7 Message-Id: <1470956638-3589-2-git-send-email-bauerman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-11_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=13 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608110297 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AKASHI Takahiro 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 | 3 +++ 2 files changed, 6 insertions(+) -- 1.9.1 diff --git a/include/linux/kexec.h b/include/linux/kexec.h index d7437777baaa..4f85d284ed0b 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -192,6 +192,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 503bc2d348e5..113af2f219b9 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -92,6 +92,9 @@ void kimage_file_post_load_cleanup(struct kimage *image) vfree(image->initrd_buf); image->initrd_buf = NULL; + vfree(image->dtb_buf); + image->dtb_buf = NULL; + kfree(image->cmdline_buf); image->cmdline_buf = NULL;