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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 35E76C4332B for ; Mon, 23 Mar 2020 08:55:32 +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 E216020663 for ; Mon, 23 Mar 2020 08:55:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E216020663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48m7WP4V8kzDqwP for ; Mon, 23 Mar 2020 19:55:29 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kaod.org (client-ip=87.98.172.162; helo=18.mo3.mail-out.ovh.net; envelope-from=clg@kaod.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from 18.mo3.mail-out.ovh.net (18.mo3.mail-out.ovh.net [87.98.172.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48m7SZ516KzDqx5 for ; Mon, 23 Mar 2020 19:53:01 +1100 (AEDT) Received: from player711.ha.ovh.net (unknown [10.110.208.83]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 8D80E23DED9 for ; Mon, 23 Mar 2020 09:52:56 +0100 (CET) Received: from kaod.org (82-64-250-170.subs.proxad.net [82.64.250.170]) (Authenticated sender: clg@kaod.org) by player711.ha.ovh.net (Postfix) with ESMTPSA id 0556C108C31B4; Mon, 23 Mar 2020 08:52:29 +0000 (UTC) Subject: Re: [PATCH v8 02/14] powerpc/xive: Define xive_native_alloc_get_irq_info() To: Haren Myneni , mpe@ellerman.id.au References: <1584598120.9256.15237.camel@hbabu-laptop> <1584598402.9256.15244.camel@hbabu-laptop> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Mon, 23 Mar 2020 09:52:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1584598402.9256.15244.camel@hbabu-laptop> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 8712213482220719097 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrudegjedguddugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdekvddrieegrddvhedtrddujedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeduuddrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehlihhnuhigphhptgdquggvvheslhhishhtshdrohiilhgrsghsrdhorhhg 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: mikey@neuling.org, herbert@gondor.apana.org.au, Frederic Barrat , npiggin@gmail.com, hch@infradead.org, oohall@gmail.com, sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, ajd@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 3/19/20 7:13 AM, Haren Myneni wrote: > > pnv_ocxl_alloc_xive_irq() in ocxl.c allocates IRQ and gets trigger port > address. VAS also needs this function, but based on chip ID. So moved > this common function to xive/native.c. We now have two drivers using the lowlevel routines of the machine irqchip driver. I am not sure OCXL is doing the right thing by calling opal_xive_get_irq_info() and not xive_native_populate_irq_data(). C. > Signed-off-by: Haren Myneni > --- > arch/powerpc/include/asm/xive.h | 2 ++ > arch/powerpc/platforms/powernv/ocxl.c | 20 ++------------------ > arch/powerpc/sysdev/xive/native.c | 23 +++++++++++++++++++++++ > 3 files changed, 27 insertions(+), 18 deletions(-) > > diff --git a/arch/powerpc/include/asm/xive.h b/arch/powerpc/include/asm/xive.h > index d08ea11..fd337da 100644 > --- a/arch/powerpc/include/asm/xive.h > +++ b/arch/powerpc/include/asm/xive.h > @@ -139,6 +139,8 @@ int xive_native_set_queue_state(u32 vp_id, uint32_t prio, u32 qtoggle, > int xive_native_get_vp_state(u32 vp_id, u64 *out_state); > bool xive_native_has_queue_state_support(void); > extern u32 xive_native_alloc_irq_on_chip(u32 chip_id); > +extern int xive_native_alloc_get_irq_info(u32 chip_id, u32 *irq, > + u64 *trigger_addr); > > static inline u32 xive_native_alloc_irq(void) > { > diff --git a/arch/powerpc/platforms/powernv/ocxl.c b/arch/powerpc/platforms/powernv/ocxl.c > index 8c65aac..fb8f99a 100644 > --- a/arch/powerpc/platforms/powernv/ocxl.c > +++ b/arch/powerpc/platforms/powernv/ocxl.c > @@ -487,24 +487,8 @@ int pnv_ocxl_spa_remove_pe_from_cache(void *platform_data, int pe_handle) > > int pnv_ocxl_alloc_xive_irq(u32 *irq, u64 *trigger_addr) > { > - __be64 flags, trigger_page; > - s64 rc; > - u32 hwirq; > - > - hwirq = xive_native_alloc_irq(); > - if (!hwirq) > - return -ENOENT; > - > - rc = opal_xive_get_irq_info(hwirq, &flags, NULL, &trigger_page, NULL, > - NULL); > - if (rc || !trigger_page) { > - xive_native_free_irq(hwirq); > - return -ENOENT; > - } > - *irq = hwirq; > - *trigger_addr = be64_to_cpu(trigger_page); > - return 0; > - > + return xive_native_alloc_get_irq_info(OPAL_XIVE_ANY_CHIP, irq, > + trigger_addr); > } > EXPORT_SYMBOL_GPL(pnv_ocxl_alloc_xive_irq); > > diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c > index 14d4406..abdd892 100644 > --- a/arch/powerpc/sysdev/xive/native.c > +++ b/arch/powerpc/sysdev/xive/native.c > @@ -295,6 +295,29 @@ u32 xive_native_alloc_irq_on_chip(u32 chip_id) > } > EXPORT_SYMBOL_GPL(xive_native_alloc_irq_on_chip); > > +int xive_native_alloc_get_irq_info(u32 chip_id, u32 *irq, u64 *trigger_addr) > +{ > + __be64 flags, trigger_page; > + u32 hwirq; > + s64 rc; > + > + hwirq = xive_native_alloc_irq_on_chip(chip_id); > + if (!hwirq) > + return -ENOENT; > + > + rc = opal_xive_get_irq_info(hwirq, &flags, NULL, &trigger_page, NULL, > + NULL); > + if (rc || !trigger_page) { > + xive_native_free_irq(hwirq); > + return -ENOENT; > + } > + *irq = hwirq; > + *trigger_addr = be64_to_cpu(trigger_page); > + > + return 0; > +} > +EXPORT_SYMBOL(xive_native_alloc_get_irq_info); > + > void xive_native_free_irq(u32 irq) > { > for (;;) { >