From owner-svn-src-all@freebsd.org Sat Aug 3 01:55:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE3FDA2717; Sat, 3 Aug 2019 01:55:51 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 460nDl61NPz3H1Y; Sat, 3 Aug 2019 01:55:51 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98573BCF9; Sat, 3 Aug 2019 01:55:51 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x731tpUP008030; Sat, 3 Aug 2019 01:55:51 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x731tpSt008029; Sat, 3 Aug 2019 01:55:51 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908030155.x731tpSt008029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 3 Aug 2019 01:55:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350552 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 350552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Aug 2019 01:55:52 -0000 Author: jhibbits Date: Sat Aug 3 01:55:51 2019 New Revision: 350552 URL: https://svnweb.freebsd.org/changeset/base/350552 Log: powerpc/powernv: Fix OPAL cfgread/cfgwrite error handling Freeze clearing needs to heppen any time OPAL reads return either an error (except OPAL_HARDWARE), AND any time it returns 0xff for all bytes. For cfgwrite, any error that's not OPAL_HARDWARE should be cleaned up. Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Sat Aug 3 01:36:05 2019 (r350551) +++ head/sys/powerpc/powernv/opal_pci.c Sat Aug 3 01:55:51 2019 (r350552) @@ -531,16 +531,16 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo default: error = OPAL_SUCCESS; word = 0xffffffff; + width = 4; } /* * Poking config state for non-existant devices can make * the host bridge hang up. Clear any errors. - * - * XXX: Make this conditional on the existence of a freeze */ - if (error != OPAL_SUCCESS) { + if (error != OPAL_SUCCESS || + (word == ((1UL << (8 * width)) - 1))) { if (error != OPAL_HARDWARE) { opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id, OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state), @@ -550,7 +550,8 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo sc->phb_id, OPAL_PCI_DEFAULT_PE, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); } - word = 0xffffffff; + if (error != OPAL_SUCCESS) + word = 0xffffffff; } return (word); @@ -563,8 +564,6 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl struct opalpci_softc *sc; uint64_t config_addr; int error = OPAL_SUCCESS; - uint16_t err_type; - uint8_t eeh_state; sc = device_get_softc(dev); @@ -591,13 +590,9 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl * the host bridge hang up. Clear any errors. */ if (error != OPAL_HARDWARE) { - opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id, - OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state), - vtophys(&err_type), NULL); - if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN) - opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, - sc->phb_id, OPAL_PCI_DEFAULT_PE, - OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); + opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, + sc->phb_id, OPAL_PCI_DEFAULT_PE, + OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); } } }