Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1078808ybe; Wed, 11 Sep 2019 09:03:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiClg0Hr+5kq3w3NR2NjFdiHlx2QvVTKhx3My73NC85Ozb/gakLEyvvuiQcUGeNWA7Se02 X-Received: by 2002:a50:c101:: with SMTP id l1mr38147477edf.157.1568217831166; Wed, 11 Sep 2019 09:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568217831; cv=none; d=google.com; s=arc-20160816; b=hrlSaYqjEbEo4lX3IHCJ1I6Xqz1AK/kfGHHXYZErf23/0h9xHLbGPgYjmNZljvfmPU oYD7UeFvjoMHG8yw5AK7p2yln/eOdu0F0wCrpfJCkxP4uAD3x/WfGmOQCM7FFkNUtHnb bQkPGVk9ysXRGSJK4rwLVAgndqOsO6c5ImfV/wYHasFbM8GdmvPv50Tb0cM9f8fwjmTh ERRpxC4XWfh3aTJYSaghmMg45flha388cLREnXe90FFu6lIC079ZTcHKr2QADm2z+Brc bj+WMYDDSLPelQxf33/72b7SsA9Va83hhXKFigDdJGOnxZZ0DFZgdWaJpiduziwevnZw V4iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=VBNxumRT/TPrUjxg8h3mdAP9vikqURLLAEne8PFGRAk=; b=jucNh53ql89qfjbk9mUmQEcl6wQ6v0ARk8pgV3W8vdEHIr/8Ta3MY6ZMphSEYH8J/m y1CdT05gDMpa4CSbNAwiq3i4dy9cLOm+w0aS3JfoQ3RpIzsJMutj8F3Yq8YXpArQeQ0t EptOgiw1YeEwr+Z80WGgi9D/kTbgGtFmcy2/gKH4+0SptkrtXCnb21kudvo5lUhT5hLd 0ND9f/sQzBtucotsvUbM8g6ZOMi+gdjYQVV0A8c5r/KCsthkoHEPvEoc2NLifd7m/7EW 4vPRzwctP7dXL6eKKHC4pwtSjW/uAVH5cuKMyUgJSG3g9iHc0ullZQB/86RCMabS8FAK zQrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si7393476edy.388.2019.09.11.09.03.26; Wed, 11 Sep 2019 09:03:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbfIKP60 (ORCPT + 99 others); Wed, 11 Sep 2019 11:58:26 -0400 Received: from 9.mo68.mail-out.ovh.net ([46.105.78.111]:47529 "EHLO 9.mo68.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbfIKP60 (ORCPT ); Wed, 11 Sep 2019 11:58:26 -0400 X-Greylist: delayed 3601 seconds by postgrey-1.27 at vger.kernel.org; Wed, 11 Sep 2019 11:58:25 EDT Received: from player688.ha.ovh.net (unknown [10.109.143.249]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id BB5F4142F53 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 Cc: Paul Mackerras , =?UTF-8?B?Q8OpZHJpYw==?= Le Goater , David Gibson , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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