From patchwork Fri Feb 2 05:46:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 868517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 3zXmFb5n1mz9sBW for ; Fri, 2 Feb 2018 16:46:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y1f2FebI"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zXmFb0LSZzF0bS for ; Fri, 2 Feb 2018 16:46:43 +1100 (AEDT) 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="Y1f2FebI"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::242; helo=mail-pg0-x242.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y1f2FebI"; dkim-atps=neutral Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (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 3zXmFT2N0szF0Xk for ; Fri, 2 Feb 2018 16:46:36 +1100 (AEDT) Received: by mail-pg0-x242.google.com with SMTP id 141so2962059pgd.8 for ; Thu, 01 Feb 2018 21:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=n44xg43QvbpWGHBqnYrYbldoPWSPq8elIhn29pzIufc=; b=Y1f2FebILMbrmnK/J/UGfLXgf7/pIoq4GLEpDSThhgZi/N0z5k9PzAS3HzZNX9WXqz hz3Ji3YlndYCO5ikOaLW6Cx1qdbou5Of1pfsd2hwqXKgukOqc1DVzM7JELoMKy1wjXGN oYjLWtdxMN3FOUeBAeAVh7ClV+UFlUww+3HPz929gE9rPDYep3ZJeyopStbPHPpNv1cR pwHhbgxl1sKxgWbPqlIdNOLpIzpmRIjRZ54PXcybzGRZyfW5Ta+3nzGa6Dw43O3DInAl rb7zBZVOuJ2dx9HlD/oeGSRyqjFhscPVC22remUNloRIFYlPuRXS4SlZHrALP9K1KrdZ eRpA== 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; bh=n44xg43QvbpWGHBqnYrYbldoPWSPq8elIhn29pzIufc=; b=h0MwsKNW41nyqirTZm0ZN9eHtq/F6VpsQKU8aqanB8f5mSRu0TItUGFjppT78cISwZ kshxlLnLi+xPaVFKcoXoc8SJJ3n18I6nLu5ghPBnIUn4/B7jwWLQ6yqtkBPMk48/ksxh m9V8/ko/J+KA2Zv0pjw80MHuXiGCXsQBw7mTtIn3J9mbvxOsHSSe3FLAsnDqpV79Q936 +W6juoQdtZbTdx74a1KPJ8zwEMs+kfX4YoYIxYlpxC+eDKeNtqVT0wiBKcQItN+bAjFV vkcA7jQ7vsSSa3sEfwTXjFcDMxO9hySkOJ171pg8OmGI2isvyxtV0BHqb4nbTNZTWr+P SD+A== X-Gm-Message-State: AKwxytci7gg5/G9Q87kRemf51ch+EmTy1M+QhWulZ2Z45ERd316ra7FJ c+yHnRyjLYnK1WDnV6Av/rLqof3E X-Google-Smtp-Source: AH8x226o3xfahN5XMxhICBSluVnteP24QZcv07RFRNxQbY02h7l4Yt9NVHnhWxZ6DsOHVlUrdcZVPg== X-Received: by 10.98.248.1 with SMTP id d1mr39186623pfh.222.1517550393910; Thu, 01 Feb 2018 21:46:33 -0800 (PST) Received: from roar.au.ibm.com (60-240-234-161.tpgi.com.au. [60.240.234.161]) by smtp.gmail.com with ESMTPSA id z85sm1769354pfk.110.2018.02.01.21.46.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 21:46:32 -0800 (PST) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Fri, 2 Feb 2018 15:46:24 +1000 Message-Id: <20180202054624.18552-1-npiggin@gmail.com> X-Mailer: git-send-email 2.15.1 Subject: [Skiboot] [PATCH] fast-reboot: move pci_reset error handling into fast-reboot code X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" pci_reset() currently does a platform reboot if it fails. It should not know about fast-reboot at this level, so instead have it return an error, and the fast reboot caller will do the platform reboot. The code essentially does the same thing, but flexibility is improved. Ideally the fast reboot code should perform pci_reset and all such fail-able operations before the CPU resets itself and destroys its own stack. That's not the case now, but that should be the goal. Signed-off-by: Nicholas Piggin Acked-by: Vaidyanathan Srinivasan --- core/fast-reboot.c | 13 ++++++++++++- core/pci.c | 11 +++++------ include/pci.h | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/fast-reboot.c b/core/fast-reboot.c index 1c76c0891..382e781ae 100644 --- a/core/fast-reboot.c +++ b/core/fast-reboot.c @@ -348,7 +348,18 @@ void __noreturn fast_reboot_entry(void) } /* Remove all PCI devices */ - pci_reset(); + if (pci_reset()) { + prlog(PR_NOTICE, "RESET: Fast reboot failed to reset PCI\n"); + + /* + * Can't return to caller here because we're past no-return. + * Attempt an IPL here which is what the caller would do. + */ + if (platform.cec_reboot) + platform.cec_reboot(); + for (;;) + ; + } ipmi_set_fw_progress_sensor(IPMI_FW_PCI_INIT); diff --git a/core/pci.c b/core/pci.c index 0809521f8..494a33a45 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1668,7 +1668,7 @@ static void __pci_reset(struct list_head *list) } } -void pci_reset(void) +int64_t pci_reset(void) { unsigned int i; struct pci_slot *slot; @@ -1695,11 +1695,9 @@ void pci_reset(void) rc = slot->ops.run_sm(slot); } if (rc < 0) { - PCIERR(phb, 0, "Complete reset failed, aborting" - "fast reboot (rc=%lld)\n", rc); - if (platform.cec_reboot) - platform.cec_reboot(); - while (true) {} + PCIERR(phb, 0, "Complete reset failed " + "(rc=%lld)\n", rc); + return rc; } } @@ -1710,6 +1708,7 @@ void pci_reset(void) /* Re-Initialize all discovered PCI slots */ pci_init_slots(); + return 0; } static void pci_do_jobs(void (*fn)(void *)) diff --git a/include/pci.h b/include/pci.h index c085b6b86..508ebf45f 100644 --- a/include/pci.h +++ b/include/pci.h @@ -475,7 +475,7 @@ extern void pci_std_swizzle_irq_map(struct dt_node *dt_node, /* Initialize all PCI slots */ extern void pci_init_slots(void); -extern void pci_reset(void); +extern int64_t pci_reset(void); extern void opal_pci_eeh_set_evt(uint64_t phb_id); extern void opal_pci_eeh_clear_evt(uint64_t phb_id);