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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 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 3C85CC433EA for ; Tue, 28 Jul 2020 15:35:32 +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 077F62074F for ; Tue, 28 Jul 2020 15:35:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bO76Dqo2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 077F62074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=Huawei.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:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cZHZGcFQHYCwpmNL2anIktaVUvSVhzQVg7Z4nmZQSV8=; b=bO76Dqo2DBhOfWLV6jT+W8YrX MOq3snDp6J4ba3ZXxFyVCsI1IoeEp8heDCQmot3PVvBwtIs6bEa9EWQYVMQLXoSGDiEGIckY8ZlhQ IyzBfpqPEV5W/k744mFrQSbIbBALnSItolzAiyxTtTILpF7VgOw5uo3rkqy6ZlspQg+jgJTa/5ccG 9qTNJHszNgPSmKmZ09ajhg/A1UPnDU+Jx1LsfGed6jMsQ2j+jccPPd6MOhPTc3HqhPrRvZCb4oc4x awSgzc7H57j7RoPJY6Bdd2fWWf1EoXkmC6oqazpcc5H7zmL1tDB2rnjLp5JzN3lHkXXhlJE7hWcHZ J4CHyCqYw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0Rc9-0002j8-Bo; Tue, 28 Jul 2020 15:34:01 +0000 Received: from lhrrgout.huawei.com ([185.176.76.210] helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0Rc5-0002hP-T4 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2020 15:33:59 +0000 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id E8AAB84CE31D06798980; Tue, 28 Jul 2020 16:33:49 +0100 (IST) Received: from localhost (10.52.121.35) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 28 Jul 2020 16:33:49 +0100 Date: Tue, 28 Jul 2020 16:32:25 +0100 From: Jonathan Cameron To: Gavin Shan Subject: Re: [PATCH v3 11/15] drivers/firmware/sdei: Introduce sdei_do_local_call() Message-ID: <20200728163225.00004a00@Huawei.com> In-Reply-To: <20200728025955.144913-12-gshan@redhat.com> References: <20200728025955.144913-1-gshan@redhat.com> <20200728025955.144913-12-gshan@redhat.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.52.121.35] X-ClientProxiedBy: lhreml716-chm.china.huawei.com (10.201.108.67) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200728_113358_060743_C789188B X-CRM114-Status: GOOD ( 20.17 ) 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: mark.rutland@arm.com, catalin.marinas@arm.com, james.morse@arm.com, shan.gavin@gmail.com, will@kernel.org, linux-arm-kernel@lists.infradead.org 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 On Tue, 28 Jul 2020 12:59:51 +1000 Gavin Shan wrote: > During the CPU hotplug, the private events are registered, enabled > or unregistered on the specific CPU. It repeats the same steps: > initializing cross call argument, make function call on local CPU, > check the returned error. > > This introduces sdei_do_local_call() to cover the first steps. The > other benefit is to make CROSSCALL_INIT and struct sdei_crosscall_args > are only visible to sddi_do_{cross, local}_call(). > > Signed-off-by: Gavin Shan Hi Gavin, I'm not totally convinced with the use of smp_call_func_t here. It sort of feels a little confusing as type naming goes. It gets used in similar places as smp_call_func_t would be, but not really smp paths perhaps? Still I'm not that bothered hence if everyone else is happy it's fine by me. Reviewed-by: Jonathan Cameron > --- > v3: Use smp_call_func_t for @fn argument in sdei_do_local_call() > --- > drivers/firmware/arm_sdei.c | 41 ++++++++++++++++++++++--------------- > 1 file changed, 25 insertions(+), 16 deletions(-) > > diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c > index 5560c8880631..7f4309039513 100644 > --- a/drivers/firmware/arm_sdei.c > +++ b/drivers/firmware/arm_sdei.c > @@ -85,6 +85,17 @@ struct sdei_crosscall_args { > atomic_set(&arg.errors, 0); \ > } while (0) > > +static inline int sdei_do_local_call(smp_call_func_t fn, > + struct sdei_event *event) > +{ > + struct sdei_crosscall_args arg; > + > + CROSSCALL_INIT(arg, event); > + fn(&arg); > + > + return arg.first_error; > +} > + > static inline int sdei_do_cross_call(smp_call_func_t fn, > struct sdei_event *event) > { > @@ -677,7 +688,7 @@ static int sdei_reregister_shared(void) > static int sdei_cpuhp_down(unsigned int cpu) > { > struct sdei_event *event; > - struct sdei_crosscall_args arg; > + int err; > > /* un-register private events */ > spin_lock(&sdei_list_lock); > @@ -685,12 +696,11 @@ static int sdei_cpuhp_down(unsigned int cpu) > if (event->type == SDEI_EVENT_TYPE_SHARED) > continue; > > - CROSSCALL_INIT(arg, event); > - /* call the cross-call function locally... */ > - _local_event_unregister(&arg); > - if (arg.first_error) > + err = sdei_do_local_call(_local_event_unregister, event); > + if (err) { > pr_err("Failed to unregister event %u: %d\n", > - event->event_num, arg.first_error); > + event->event_num, err); > + } > } > spin_unlock(&sdei_list_lock); > > @@ -700,7 +710,7 @@ static int sdei_cpuhp_down(unsigned int cpu) > static int sdei_cpuhp_up(unsigned int cpu) > { > struct sdei_event *event; > - struct sdei_crosscall_args arg; > + int err; > > /* re-register/enable private events */ > spin_lock(&sdei_list_lock); > @@ -709,20 +719,19 @@ static int sdei_cpuhp_up(unsigned int cpu) > continue; > > if (event->reregister) { > - CROSSCALL_INIT(arg, event); > - /* call the cross-call function locally... */ > - _local_event_register(&arg); > - if (arg.first_error) > + err = sdei_do_local_call(_local_event_register, event); > + if (err) { > pr_err("Failed to re-register event %u: %d\n", > - event->event_num, arg.first_error); > + event->event_num, err); > + } > } > > if (event->reenable) { > - CROSSCALL_INIT(arg, event); > - _local_event_enable(&arg); > - if (arg.first_error) > + err = sdei_do_local_call(_local_event_enable, event); > + if (err) { > pr_err("Failed to re-enable event %u: %d\n", > - event->event_num, arg.first_error); > + event->event_num, err); > + } > } > } > spin_unlock(&sdei_list_lock); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel