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.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 1C2A3C49ED6 for ; Wed, 11 Sep 2019 16:36:09 +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 9902F207FC for ; Wed, 11 Sep 2019 16:36:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9902F207FC 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 bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46T6wP6n5NzF3kj for ; Thu, 12 Sep 2019 02:36:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=kaod.org (client-ip=178.32.116.78; helo=8.mo5.mail-out.ovh.net; envelope-from=groug@kaod.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org X-Greylist: delayed 4658 seconds by postgrey-1.36 at bilbo; Thu, 12 Sep 2019 01:58:39 AEST Received: from 8.mo5.mail-out.ovh.net (8.mo5.mail-out.ovh.net [178.32.116.78]) (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 46T65C5K8XzF3ZQ for ; Thu, 12 Sep 2019 01:58:38 +1000 (AEST) Received: from player688.ha.ovh.net (unknown [10.108.57.183]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 13F2F24DD18 for ; Wed, 11 Sep 2019 16:40:52 +0200 (CEST) Received: from kaod.org (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player688.ha.ovh.net (Postfix) with ESMTPSA id 4ED3C99ECC49; Wed, 11 Sep 2019 14:40:44 +0000 (UTC) Date: Wed, 11 Sep 2019 16:40:43 +0200 From: Greg Kurz To: Michael Ellerman Subject: Re: [PATCH] powerpc/xive: Fix bogus error code returned by OPAL Message-ID: <20190911164043.5548afa1@bahia.lan> In-Reply-To: <87k1aezz78.fsf@mpe.ellerman.id.au> References: <156812362556.1866243.7399893138425681517.stgit@bahia.tls.ibm.com> <87k1aezz78.fsf@mpe.ellerman.id.au> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 537054258809641393 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrtdefgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, =?UTF-8?B?Q8OpZHJpYw==?= Le Goater , David Gibson Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, 12 Sep 2019 00:26:19 +1000 Michael Ellerman wrote: > Hi Greg, > Bom dia ! :) > Couple of comments ... > > Greg Kurz writes: > > There's a bug in skiboot that causes the OPAL_XIVE_ALLOCATE_IRQ call > > to return the 32-bit value 0xffffffff when OPAL has run out of IRQs. > > Unfortunatelty, OPAL return values are signed 64-bit entities and > > errors are supposed to be negative. If that happens, the linux code > > confusingly treats 0xffffffff as a valid IRQ number and panics at some > > point. > > > > A fix was recently merged in skiboot: > > > > e97391ae2bb5 ("xive: fix return value of opal_xive_allocate_irq()") > > > > but we need a workaround anyway to support older skiboots already > > on the field. > ^ > in > > > > > Internally convert 0xffffffff to OPAL_RESOURCE which is the usual error > > returned upon resource exhaustion. > > This should go to stable, any idea what versions it should go back to? > Probably whenever the xive code was introduced? > Yes I guess so. This would mean v4.12. I'll add the appropriate stable tag before re-posting, and address all the other remarks of course. > > Signed-off-by: Greg Kurz > > --- > > arch/powerpc/sysdev/xive/native.c | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c > > index 37987c815913..c35583f84f9f 100644 > > --- a/arch/powerpc/sysdev/xive/native.c > > +++ b/arch/powerpc/sysdev/xive/native.c > > @@ -231,6 +231,15 @@ static bool xive_native_match(struct device_node *node) > > return of_device_is_compatible(node, "ibm,opal-xive-vc"); > > } > > > > +static int64_t opal_xive_allocate_irq_fixup(uint32_t chip_id) > ^ ^ > Can you use s64 here and u32 here .... > > Instead of calling this opal_xive_allocate_irq_fixup() and relying on > all callers to call the fixup, can we rename the opal wrapper and leave > this function's name unchanged, eg: > > -OPAL_CALL(opal_xive_allocate_irq, OPAL_XIVE_ALLOCATE_IRQ); > +OPAL_CALL(opal_xive_allocate_irq_raw, OPAL_XIVE_ALLOCATE_IRQ); > > > > +{ > > + s64 irq = opal_xive_allocate_irq(chip_id); > > + > > +#define XIVE_ALLOC_NO_SPACE 0xffffffff /* No possible space */ > > + return > > + irq == XIVE_ALLOC_NO_SPACE ? OPAL_RESOURCE : irq; > > +} > > I don't really like the #define and the weird indenting and so on, can > we instead do it like: > > /* > * Old versions of skiboot can incorrectly return 0xffffffff to > * indicate no space, fix it up here. > */ > return irq == 0xffffffff ? OPAL_RESOURCE : irq; > > cheers