From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A879FC433E0 for ; Fri, 19 Feb 2021 18:12:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47AB364E44 for ; Fri, 19 Feb 2021 18:12:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47AB364E44 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:In-reply-to:Subject:To: From:References:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LmKG5MxgUmH94W6FplJelDMOBMNmYJRj+HE5C1X7aD0=; b=hk4TiVCCdSMoC0UO9dCZ0vW4f Xj+6aJgU8XQfgeBSOnaz5OPhWa5ZsR65ixerRdU4k+mQRpDhv5MBrEAN0DNTq9txdx7FKDsHAVcIN ym0YKjPOAvE0QHSbjEi/6r6KJOaPabAnWFhrDFR7CWC1sl5B4nrXrBPqmMG+vbi+GJ0nQLOA572VR n+rsR+XzE09yWmOOeZGmgNAImUZyaJL6FAXI+Xduy3tscXgLs7EHL0LsiyJj85NzV0nsJQ0mDBawl crphbera2owcX2w98YrvWpo9JEKgyEOGjcY4Kw5UOGqf5w9b6VGSTA4ODprItmwMyDZin5HfJdZkJ /mxEx1VtA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDAEO-0008KL-89; Fri, 19 Feb 2021 18:10:20 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDAEK-0008Je-Nx for linux-arm-kernel@lists.infradead.org; Fri, 19 Feb 2021 18:10:17 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 11JI3iZ3190477; Fri, 19 Feb 2021 13:10:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=references : from : to : cc : subject : in-reply-to : date : message-id : mime-version : content-type; s=pp1; bh=J7UWlaf9kMo+UKARDNZDIBFXIQD2zBBRv3Q3Imq3uPs=; b=YHAxmcQ/7S+SVSRxKsQ7TGtwdBcw+GCzTIDi+ySAP7qhbhq6p9cSojuymYnvat8/mf+4 YhsNWSfcod4NzY03WGgMzXpmjXBrrc7NOScsS3cVxyO+yPdZn2JzhmoAMC8v3noCUoW6 oYnYnMOpnHAZ//dqt+MoIGfvinI/zd64GZ8eGMRBTTnH/fa78Bh+ZX/A0v06g0lVVWm/ hGSjiqse0Jz+QKeocjWYeXzCXdeiWq5xKk4bUrYw9fCL4VTCHt4NERI+3CfmdrlNh2dP ujp1dfNRw8Ew2fjDzhvpJ4llVkUUzvvyzwgjGeMoC1t7Etl+4lsT/ffwXN5w0R5CzcgQ fw== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 36thye0qj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 13:10:03 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11JI89ls019718; Fri, 19 Feb 2021 18:10:02 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma04dal.us.ibm.com with ESMTP id 36p6dab3fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 18:10:02 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11JIA1I928770680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 18:10:01 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04E99C6059; Fri, 19 Feb 2021 18:10:01 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD248C6057; Fri, 19 Feb 2021 18:09:56 +0000 (GMT) Received: from manicouagan.localdomain (unknown [9.85.174.98]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTPS; Fri, 19 Feb 2021 18:09:56 +0000 (GMT) References: <20210218223305.2044-1-nramas@linux.microsoft.com> <8b8c0b70-c7ab-33f3-b66c-9ea03388497b@linux.microsoft.com> <87k0r4yi4s.fsf@manicouagan.localdomain> <3ca0aa87-ca83-8024-4067-c2382a360db9@linux.microsoft.com> <98a061d1-05ea-eff2-5c5c-a59f491fe924@linux.microsoft.com> <6a197963deb8e44c71384ea9b89d7f3f13c947bf.camel@linux.ibm.com> User-agent: mu4e 1.4.10; emacs 27.1 From: Thiago Jung Bauermann To: Mimi Zohar Subject: Re: [PATCH] of: error: 'const struct kimage' has no member named 'arch' In-reply-to: <6a197963deb8e44c71384ea9b89d7f3f13c947bf.camel@linux.ibm.com> Date: Fri, 19 Feb 2021 15:09:54 -0300 Message-ID: <87blcgx72l.fsf@manicouagan.localdomain> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-19_08:2021-02-18, 2021-02-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 impostorscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190137 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210219_131016_887160_C06A3AF7 X-CRM114-Status: GOOD ( 46.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Rob Herring , Benjamin Herrenschmidt , Lakshmi Ramasubramanian , Greg Kroah-Hartman , linuxppc-dev , "linux-kernel@vger.kernel.org" , "AKASHI, Takahiro" , devicetree@vger.kernel.org, James Morse , Michael Ellerman , Catalin Marinas , Joe Perches , Stephen Rothwell , linux-integrity@vger.kernel.org, Will Deacon , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mimi Zohar writes: > On Fri, 2021-02-19 at 11:43 -0600, Rob Herring wrote: >> On Fri, Feb 19, 2021 at 10:57 AM Lakshmi Ramasubramanian >> wrote: >> > >> > On 2/19/21 6:16 AM, Rob Herring wrote: >> > > On Thu, Feb 18, 2021 at 8:53 PM Lakshmi Ramasubramanian >> > > wrote: >> > >> >> > >> On 2/18/21 5:13 PM, Thiago Jung Bauermann wrote: >> > >>> >> > >>> Lakshmi Ramasubramanian writes: >> > >>> >> > >>>> On 2/18/21 4:07 PM, Mimi Zohar wrote: >> > >>>> >> > >>>> Hi Mimi, >> > >>>> >> > >>>>> On Thu, 2021-02-18 at 14:33 -0800, Lakshmi Ramasubramanian wrote: >> > >>>>>> of_kexec_alloc_and_setup_fdt() defined in drivers/of/kexec.c builds >> > >>>>>> a new device tree object that includes architecture specific data >> > >>>>>> for kexec system call. This should be defined only if the architecture >> > >>>>>> being built defines kexec architecture structure "struct kimage_arch". >> > >>>>>> >> > >>>>>> Define a new boolean config OF_KEXEC that is enabled if >> > >>>>>> CONFIG_KEXEC_FILE and CONFIG_OF_FLATTREE are enabled, and >> > >>>>>> the architecture is arm64 or powerpc64. Build drivers/of/kexec.c >> > >>>>>> if CONFIG_OF_KEXEC is enabled. >> > >>>>>> >> > >>>>>> Signed-off-by: Lakshmi Ramasubramanian >> > >>>>>> Fixes: 33488dc4d61f ("of: Add a common kexec FDT setup function") >> > >>>>>> Reported-by: kernel test robot >> > >>>>>> --- >> > >>>>>> drivers/of/Kconfig | 6 ++++++ >> > >>>>>> drivers/of/Makefile | 7 +------ >> > >>>>>> 2 files changed, 7 insertions(+), 6 deletions(-) >> > >>>>>> >> > >>>>>> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig >> > >>>>>> index 18450437d5d5..f2e8fa54862a 100644 >> > >>>>>> --- a/drivers/of/Kconfig >> > >>>>>> +++ b/drivers/of/Kconfig >> > >>>>>> @@ -100,4 +100,10 @@ config OF_DMA_DEFAULT_COHERENT >> > >>>>>> # arches should select this if DMA is coherent by default for OF devices >> > >>>>>> bool >> > >>>>>> +config OF_KEXEC >> > >>>>>> + bool >> > >>>>>> + depends on KEXEC_FILE >> > >>>>>> + depends on OF_FLATTREE >> > >>>>>> + default y if ARM64 || PPC64 >> > >>>>>> + >> > >>>>>> endif # OF >> > >>>>>> diff --git a/drivers/of/Makefile b/drivers/of/Makefile >> > >>>>>> index c13b982084a3..287579dd1695 100644 >> > >>>>>> --- a/drivers/of/Makefile >> > >>>>>> +++ b/drivers/of/Makefile >> > >>>>>> @@ -13,11 +13,6 @@ obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o >> > >>>>>> obj-$(CONFIG_OF_RESOLVE) += resolver.o >> > >>>>>> obj-$(CONFIG_OF_OVERLAY) += overlay.o >> > >>>>>> obj-$(CONFIG_OF_NUMA) += of_numa.o >> > >>>>>> - >> > >>>>>> -ifdef CONFIG_KEXEC_FILE >> > >>>>>> -ifdef CONFIG_OF_FLATTREE >> > >>>>>> -obj-y += kexec.o >> > >>>>>> -endif >> > >>>>>> -endif >> > >>>>>> +obj-$(CONFIG_OF_KEXEC) += kexec.o >> > >>>>>> obj-$(CONFIG_OF_UNITTEST) += unittest-data/ >> > >>>>> Is it possible to reuse CONFIG_HAVE_IMA_KEXEC here? >> > >>>>> >> > >>>> >> > >>>> For ppc64 CONFIG_HAVE_IMA_KEXEC is selected when CONFIG_KEXEC_FILE is enabled. >> > >>>> So I don't see a problem in reusing CONFIG_HAVE_IMA_KEXEC for ppc. >> > >>>> >> > >>>> But for arm64, CONFIG_HAVE_IMA_KEXEC is enabled in the final patch in the patch >> > >>>> set (the one for carrying forward IMA log across kexec for arm64). arm64 calls >> > >>>> of_kexec_alloc_and_setup_fdt() prior to enabling CONFIG_HAVE_IMA_KEXEC and hence >> > >>>> breaks the build for arm64. >> > >>> >> > >>> One problem is that I believe that this patch won't placate the robot, >> > >>> because IIUC it generates config files at random and this change still >> > >>> allows hppa and s390 to enable CONFIG_OF_KEXEC. >> > >> >> > >> I enabled CONFIG_OF_KEXEC for s390. With my patch applied, >> > >> CONFIG_OF_KEXEC is removed. So I think the robot enabling this config >> > >> would not be a problem. >> > >> >> > >>> >> > >>> Perhaps a new CONFIG_HAVE_KIMAGE_ARCH option? Not having that option >> > >>> would still allow building kexec.o, but would be used inside kexec.c to >> > >>> avoid accessing kimage.arch members. >> > >>> >> > >> >> > >> I think this is a good idea - a new CONFIG_HAVE_KIMAGE_ARCH, which will >> > >> be selected by arm64 and ppc for now. I tried this, and it fixes the >> > >> build issue. >> > >> >> > >> Although, the name for the new config can be misleading since PARISC, >> > >> for instance, also defines "struct kimage_arch". Perhaps, >> > >> CONFIG_HAVE_ELF_KIMAGE_ARCH since of_kexec_alloc_and_setup_fdt() is >> > >> accessing ELF specific fields in "struct kimage_arch"? >> > >> >> > >> Rob/Mimi - please let us know which approach you think is better. >> > > >> > > I'd just move the fields to kimage. >> > > >> > >> > I think Mimi's suggestion to use CONFIG_HAVE_IMA_KEXEC for building >> > drivers/of/kexec.c would work and also avoid the bisect issue if we do >> > the following: >> >> That seems wrong given only a portion of the file depends on IMA. And >> it reduces our compile coverage. > > I agree with you this is the wrong solution. Lakshmi's patch > introduced a new option to prevent other arch's from including kexec.o, > which is the same functionality as CONFIG_HAVE_IMA_KEXEC. I'm just not > sure what the right solution would be. I think Rob's suggestion of just moving the elf_load_addr, elf_headers_sz fields (and for consistency, elf_headers as well even though it isn't used in tihs file) from kimage_arch to kimage. The downside is that these fields will go unused on a number of architectures, but it's not worth complicating the code just because of it. The patch to do that would have to go before "of: Add a common kexec FDT setup function". That should be enough to preserve bisectability for all arches. -- Thiago Jung Bauermann IBM Linux Technology Center _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel