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 36696C433E4 for ; Thu, 23 Jul 2020 15:29:03 +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 04A732067D for ; Thu, 23 Jul 2020 15:29:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h1fE5BTO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04A732067D 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=gP6AGNouDNNvd6uJeV4QeR+3j/JTslYJxbzi6J5F08o=; b=h1fE5BTODAwBDD9K0u6+emWzv yU6AWki2xMsvcX/VwdGL3Py1iRTrVsOgz0KeVICHUDCEWvIIefOBXAhRIEfXK24KIFLjBqr9pDVBA tbd4X2nGd0fbhuggN5LU/LcSlgGqXKaHtjrMzJnLYLJmhBPtuP1jeHNfKTEWYLF+JmNoeLl0Csk7K KvHT/X9qyUmLLMoNcztZz70GqAQ4Ej0cWgVkU2BSLYRMVltL6RG+bSAnFp8JOzg9TTmpauuAlPxXa 0RXJzaZ+F/8yRhkujiw3aAQAVW9nhQXJURQfdnNs3M0MHoWkA16Oqh+nIF3SY9TK6gBWBGKmH9R3U hcLI72c0Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7q-0007Zr-T2; Thu, 23 Jul 2020 15:27:15 +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 1jyd7Y-0007SQ-Vv for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:26:58 +0000 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 1E0A034B8AA304E6AD28; Thu, 23 Jul 2020 16:26:56 +0100 (IST) Received: from localhost (10.52.125.229) 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; Thu, 23 Jul 2020 16:26:55 +0100 Date: Thu, 23 Jul 2020 16:25:35 +0100 From: Jonathan Cameron To: Gavin Shan Subject: Re: [PATCH v2 11/17] drivers/firmware/sdei: Introduce sdei_do_local_call() Message-ID: <20200723162535.00006d91@Huawei.com> In-Reply-To: <20200722095740.28560-12-gshan@redhat.com> References: <20200722095740.28560-1-gshan@redhat.com> <20200722095740.28560-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.125.229] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) 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-20200723_112657_275076_E3EA8976 X-CRM114-Status: GOOD ( 18.91 ) 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 Wed, 22 Jul 2020 19:57:34 +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 One comment inline. Jonathan > --- > drivers/firmware/arm_sdei.c | 43 ++++++++++++++++++++++--------------- > 1 file changed, 26 insertions(+), 17 deletions(-) > > diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c > index 04dc144a8f31..da0e0d5591a8 100644 > --- a/drivers/firmware/arm_sdei.c > +++ b/drivers/firmware/arm_sdei.c > @@ -85,7 +85,18 @@ struct sdei_crosscall_args { > atomic_set(&arg.errors, 0); \ > } while (0) > > -static inline int sdei_do_cross_call(void *fn, struct sdei_event * event) > +static inline int sdei_do_local_call(void *fn, struct sdei_event *event) Can we now give the function parameter it's full type and avoid the nasty looking cast below? > +{ > + struct sdei_crosscall_args arg; > + void (*func)(void *) = fn; > + > + CROSSCALL_INIT(arg, event); > + func(&arg); > + > + return arg.first_error; > +} > + > +static inline int sdei_do_cross_call(void *fn, struct sdei_event *event) > { > struct sdei_crosscall_args arg; > > @@ -675,7 +686,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); > @@ -683,12 +694,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); > > @@ -698,7 +708,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); > @@ -707,20 +717,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