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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 1B3A4C3A5A2 for ; Tue, 3 Sep 2019 11:12:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 14B6522CF8 for ; Tue, 3 Sep 2019 11:12:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14B6522CF8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46N46H6H97zDqXb for ; Tue, 3 Sep 2019 21:12:07 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46N43h2ShkzDqVZ for ; Tue, 3 Sep 2019 21:09:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Received: by ozlabs.org (Postfix) id 46N43h1cMKz9sDB; Tue, 3 Sep 2019 21:09:52 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46N43g57Ypz9s7T; Tue, 3 Sep 2019 21:09:51 +1000 (AEST) From: Michael Ellerman To: Hari Bathini , linuxppc-dev Subject: Re: [PATCH v5 02/31] powerpc/fadump: move internal code to a new file In-Reply-To: <156630266000.8896.13603358349585118846.stgit@hbathini.in.ibm.com> References: <156630261682.8896.3418665808003586786.stgit@hbathini.in.ibm.com> <156630266000.8896.13603358349585118846.stgit@hbathini.in.ibm.com> Date: Tue, 03 Sep 2019 21:09:47 +1000 Message-ID: <871rwxskjo.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ananth N Mavinakayanahalli , Mahesh J Salgaonkar , Vasant Hegde , Oliver , Nicholas Piggin , Daniel Axtens Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hari Bathini writes: > Make way for refactoring platform specific FADump code by moving code > that could be referenced from multiple places to fadump-common.c file. > > Signed-off-by: Hari Bathini > --- > arch/powerpc/kernel/Makefile | 2 > arch/powerpc/kernel/fadump-common.c | 140 ++++++++++++++++++++++++++++++++++ > arch/powerpc/kernel/fadump-common.h | 8 ++ > arch/powerpc/kernel/fadump.c | 146 ++--------------------------------- > 4 files changed, 158 insertions(+), 138 deletions(-) > create mode 100644 arch/powerpc/kernel/fadump-common.c I don't understand why we need fadump.c and fadump-common.c? They're both common/shared across pseries & powernv aren't they? By the end of the series we end up with 149 lines in fadump-common.c which seems like a waste of time. Just put it all in fadump.c. > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile > index 56dfa7a..439d548 100644 > --- a/arch/powerpc/kernel/Makefile > +++ b/arch/powerpc/kernel/Makefile > @@ -78,7 +78,7 @@ obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \ > eeh_driver.o eeh_event.o eeh_sysfs.o > obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o > obj-$(CONFIG_CRASH_DUMP) += crash_dump.o > -obj-$(CONFIG_FA_DUMP) += fadump.o > +obj-$(CONFIG_FA_DUMP) += fadump.o fadump-common.o > ifdef CONFIG_PPC32 > obj-$(CONFIG_E500) += idle_e500.o > endif > diff --git a/arch/powerpc/kernel/fadump-common.c b/arch/powerpc/kernel/fadump-common.c > new file mode 100644 > index 0000000..7f39e4f > --- /dev/null > +++ b/arch/powerpc/kernel/fadump-common.c > @@ -0,0 +1,140 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Firmware-Assisted Dump internal code. > + * > + * Copyright 2011, IBM Corporation > + * Author: Mahesh Salgaonkar Can we not put emails in C files anymore please, they just bitrot, just the names is fine. > + * Copyright 2019, IBM Corp. > + * Author: Hari Bathini These can just be: * Copyright 2011, Mahesh Salgaonkar, IBM Corporation. * Copyright 2019, Hari Bathini, IBM Corporation. > + */ > + > +#undef DEBUG Don't undef DEBUG please. > +#define pr_fmt(fmt) "fadump: " fmt > + > +#include > +#include > +#include > +#include > + > +#include "fadump-common.h" > + > +void *fadump_cpu_notes_buf_alloc(unsigned long size) > +{ > + void *vaddr; > + struct page *page; > + unsigned long order, count, i; > + > + order = get_order(size); > + vaddr = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, order); > + if (!vaddr) > + return NULL; > + > + count = 1 << order; > + page = virt_to_page(vaddr); > + for (i = 0; i < count; i++) > + SetPageReserved(page + i); > + return vaddr; > +} I realise you're just moving this code, but why do we need all this hand rolled allocation stuff? cheers