From patchwork Mon Apr 9 05:24:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 896122 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40KK9Y3D1Lz9s1s for ; Mon, 9 Apr 2018 15:48:49 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZfvU+Moe"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40KK9Y1jDfzDrJw for ; Mon, 9 Apr 2018 15:48:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZfvU+Moe"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZfvU+Moe"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40KJgB6b3HzDrZf for ; Mon, 9 Apr 2018 15:25:58 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id y12-v6so4375485plt.1 for ; Sun, 08 Apr 2018 22:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vy83XFgY5NDGzNgfNo1BASlYdRBQRZuEFCN0chrQISU=; b=ZfvU+MoeYpYF8MuU6/g4CdtfsAI1DPHQcsH61YZ86GBXzn/d0LCv6S3CLRkdKXO/5O wio1JzucuZjIvHKHkiC1gCjm8nMeLafVzX0d4wVxfRpTuUwusZkj5dU0oxh4Jn67Ax54 D5PRpJetloSyPA5b/B9JsUpzYkUIaZdEaF/3tEz+XoIJjuBb2AXkEXdv3pplVlZiPNR+ dpMTxZR9/GC0S3DatY2s10wdZf0M1hfiHcyNDAFqmC78r4cgtJCdur6M+83DYsufTPgX MMbkTOA8l2j9NWy4eOi+exsoc5n1SRfgQ5Mbrv8cm0yylJ0O1BMfvDF3yKd0WpfdzYIU hyIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Vy83XFgY5NDGzNgfNo1BASlYdRBQRZuEFCN0chrQISU=; b=Swcfy9ubqfrDwHuAgrL7KyXi9JchgbQnl43jSxJu8kd4egpMYrRoBZ8qtsTMREUjbF 1O2z3s/9KIkhA92Gk3dVTAE5beyB4pQMTSHphCmK2PdfWzXjN5RoEsFYjUVW6vkF50bW epJUVfswr42lJmndcw9KCEFKilLIlHbCmHGxAmtiYGOuttd7dhMUFU0yDOK26U947qWI FIJFCr33DFQGZhojONipmv5HkcQ0NbfjQWaaxX+1M1LpLIaJQ1TBRUhy1Spp8WPawtKU kYX6rYSfeSxMo6vDd8Rnkmc4i32ALllCw4WhCbUaOISJFT7VmenLxdaJbEdrjYBszdq6 EQjg== X-Gm-Message-State: AElRT7EoQIaTtAqfoKQ+HsDqshKN6Mc0mDXRpVaJ6ZXJxwArVPXJZelk 5GUq6jFK1lrJOWzQ72gX9Cb4DQ== X-Google-Smtp-Source: AIpwx48jGpPVNpHz4/Z5gWhpbQOTCkk0y2UL7PxVyD8DtCJmJ09ebWVHBZ3IVh0ehy4BPn/BqYJRBQ== X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr37992544pld.104.1523251557012; Sun, 08 Apr 2018 22:25:57 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id v7sm24464425pfm.147.2018.04.08.22.25.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 22:25:56 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 9/9] powerpc/powernv: opal-kmsg standardise OPAL_BUSY handling Date: Mon, 9 Apr 2018 15:24:31 +1000 Message-Id: <20180409052431.26405-10-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180409052431.26405-1-npiggin@gmail.com> References: <20180409052431.26405-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" OPAL_CONSOLE_FLUSH is documented as being able to return OPAL_BUSY, so implement the standard OPAL_BUSY handling for it. Cc: Russell Currey Signed-off-by: Nicholas Piggin Reviewed-by: Russell Currey --- arch/powerpc/platforms/powernv/opal-kmsg.c | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c index 6f1214d4de92..f8f41ccce75f 100644 --- a/arch/powerpc/platforms/powernv/opal-kmsg.c +++ b/arch/powerpc/platforms/powernv/opal-kmsg.c @@ -12,6 +12,7 @@ */ #include +#include #include #include @@ -26,8 +27,7 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) { - int i; - int64_t ret; + s64 rc; /* * Outside of a panic context the pollers will continue to run, @@ -37,14 +37,22 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper, return; if (opal_check_token(OPAL_CONSOLE_FLUSH)) { - ret = opal_console_flush(0); + do { + rc = OPAL_BUSY; + while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { + rc = opal_console_flush(0); + if (rc == OPAL_BUSY_EVENT) { + mdelay(OPAL_BUSY_DELAY_MS); + opal_poll_events(NULL); + } else if (rc == OPAL_BUSY) { + mdelay(OPAL_BUSY_DELAY_MS); + } + } + } while (rc == OPAL_PARTIAL); /* More to flush */ - if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER) - return; - - /* Incrementally flush until there's nothing left */ - while (opal_console_flush(0) != OPAL_SUCCESS); } else { + int i; + /* * If OPAL_CONSOLE_FLUSH is not implemented in the firmware, * the console can still be flushed by calling the polling