From patchwork Fri Apr 29 04:58:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 616601 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qx1gx0LJ8z9t3p for ; Fri, 29 Apr 2016 14:59:09 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3qx1gw6q9DzDqBQ for ; Fri, 29 Apr 2016 14:59:08 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3qx1gm2jsTzDqB2 for ; Fri, 29 Apr 2016 14:59:00 +1000 (AEST) Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Apr 2016 22:58:57 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 Apr 2016 22:58:55 -0600 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 1720219D803F for ; Thu, 28 Apr 2016 22:58:39 -0600 (MDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u3T4wsMK33816826 for ; Fri, 29 Apr 2016 04:58:54 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u3T4wsUl025279 for ; Fri, 29 Apr 2016 00:58:54 -0400 Received: from birb.localdomain (birb.au.ibm.com [9.185.16.86]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u3T4wrKm025248; Fri, 29 Apr 2016 00:58:53 -0400 Received: by birb.localdomain (Postfix, from userid 1000) id C2BF2229DB26; Fri, 29 Apr 2016 14:58:14 +1000 (AEST) From: Stewart Smith To: Gavin Shan , skiboot@lists.ozlabs.org In-Reply-To: <1461635814-4623-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1461635814-4623-1-git-send-email-gwshan@linux.vnet.ibm.com> User-Agent: Notmuch/0.21+24~gbceb651 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-redhat-linux-gnu) Date: Fri, 29 Apr 2016 14:58:14 +1000 Message-ID: <87oa8tf1uh.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16042904-0009-0000-0000-000027C14166 Subject: Re: [Skiboot] [PATCH 1/4] PHB3: Fix corruption of pref window register X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair@popple.id.au Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Gavin Shan writes: > On P8+ Garrison platform, the root port's pref window register might > be not writable and we have to emulate the window because of hardware > defect. In order to detect that, we read the register content, write > inversed value and read the register content again. The register is > regarded as read-only if the values from the two continuous read are > same. However, the original register content isn't written back and > it causes corruption on pref window register if it's writable. > > This fixes the above issue by writing the original content back to > the register at the end. > > Fixes: d40160f6 ("PHB3: Emulate root complex pref 64-bits window") > Signed-off-by: Gavin Shan Following IM discussion on the topic, merged to 5.2.x as of a2c5ede master as of f849108 I also added some comments around what the vendor/device IDs are there, because it turns out I'm unable to keep that mapping in my head. Patch below: --- a/hw/phb3.c +++ b/hw/phb3.c @@ -505,7 +505,7 @@ static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev) * adjust some settings for performances */ xscom_read(p->chip_id, p->pe_xscom + 0x0b, &modectl); - if (vendor == 0x15b3 && + if (vendor == 0x15b3 && /* Mellanox */ (device == 0x1003 || /* Travis3-EN (CX3) */ device == 0x1011 || /* HydePark (ConnectIB) */ device == 0x1013)) { /* GlacierPark (CX4) */ @@ -518,7 +518,8 @@ static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev) xscom_write(p->chip_id, p->pe_xscom + 0x0b, modectl); } else if (dev->primary_bus == 0) { - if (vendor == 0x1014 && device == 0x03dc) { + if (vendor == 0x1014 && /* IBM */ + device == 0x03dc) { /* P8/P8E/P8NVL Root port */ uint32_t pref_hi, tmp; pci_cfg_read32(phb, dev->bdfn,