From owner-freebsd-arm@freebsd.org Sun Nov 29 22:42:52 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFADEA3C703 for ; Sun, 29 Nov 2015 22:42:52 +0000 (UTC) (envelope-from daemon-user@freebsd.org) Received: from mxrelay.isc.freebsd.org (mxrelay.isc.freebsd.org [149.20.53.13]) by mx1.freebsd.org (Postfix) with ESMTP id 9300213AD for ; Sun, 29 Nov 2015 22:42:52 +0000 (UTC) (envelope-from daemon-user@freebsd.org) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) by mxrelay.isc.freebsd.org (Postfix) with ESMTP id 24485A698 for ; Sun, 29 Nov 2015 22:42:50 +0000 (UTC) (envelope-from daemon-user@freebsd.org) Received: by phabric-backend.isc.freebsd.org (Postfix, from userid 1346) id 9D5143324497; Fri, 27 Nov 2015 11:57:26 +0000 (UTC) Date: Fri, 27 Nov 2015 11:57:26 +0000 To: freebsd-arm@freebsd.org From: "jpa-semihalf.com (Jakub Palider)" Reply-to: D4301+327+85ed060601cc771b@reviews.freebsd.org Subject: [Differential] [Request, 35 lines] D4301: Disable MSI-x for AHCI on Alpine plaftrorm Message-ID: X-Priority: 3 X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , Thread-Topic: D4301: Disable MSI-x for AHCI on Alpine plaftrorm X-Herald-Rules: none X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: Precedence: bulk Thread-Index: YTRjZTZhNzJjMzc2NjMyNWU1ZDQwN2EyNmZk MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_ceffba8be4d83b3b2c582c2b899af6b6" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2015 22:42:52 -0000 --b1_ceffba8be4d83b3b2c582c2b899af6b6 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit jpa-semihalf.com created this revision. jpa-semihalf.com added reviewers: imp, andrew, zbb. jpa-semihalf.com added a subscriber: freebsd-arm-list. REVISION SUMMARY Changes introduced to AHCI code adding support for MSI-x caused interrupt storm on Alpine boards. This is unintended behaviour so added quirk to omit this functionality. This is a small and non-intrusive patch so I hope no problems will arise, anyway, have a look at this, please. REVISION DETAIL https://reviews.freebsd.org/D4301 AFFECTED FILES sys/dev/ahci/ahci.h sys/dev/ahci/ahci_pci.c CHANGE DETAILS diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -293,7 +293,7 @@ {0x11851039, 0x00, "SiS 968", 0}, {0x01861039, 0x00, "SiS 968", 0}, {0xa01c177d, 0x00, "ThunderX", AHCI_Q_ABAR0|AHCI_Q_1MSI}, - {0x00311c36, 0x00, "Annapurna", AHCI_Q_FORCE_PI|AHCI_Q_RESTORE_CAP}, + {0x00311c36, 0x00, "Annapurna", AHCI_Q_FORCE_PI|AHCI_Q_RESTORE_CAP|AHCI_Q_NOMSIX}, {0x00000000, 0x00, NULL, 0} }; @@ -437,6 +437,9 @@ &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + if (ctlr->quirks & AHCI_Q_NOMSIX) + msix_count = 0; + /* Read MSI-x BAR IDs if supported */ if (msix_count > 0) { error = ahci_pci_read_msix_bars(dev, &table_bar, &pba_bar); diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -576,13 +576,14 @@ #define AHCI_Q_NOCOUNT 0x00000400 #define AHCI_Q_ALTSIG 0x00000800 #define AHCI_Q_NOMSI 0x00001000 -#define AHCI_Q_ATI_PMP_BUG 0x00002000 -#define AHCI_Q_MAXIO_64K 0x00004000 -#define AHCI_Q_SATA1_UNIT0 0x00008000 /* need better method for this */ -#define AHCI_Q_ABAR0 0x00010000 -#define AHCI_Q_1MSI 0x00020000 -#define AHCI_Q_FORCE_PI 0x00040000 -#define AHCI_Q_RESTORE_CAP 0x00080000 +#define AHCI_Q_NOMSIX 0x00002000 +#define AHCI_Q_ATI_PMP_BUG 0x00004000 +#define AHCI_Q_MAXIO_64K 0x00008000 +#define AHCI_Q_SATA1_UNIT0 0x00010000 /* need better method for this */ +#define AHCI_Q_ABAR0 0x00020000 +#define AHCI_Q_1MSI 0x00040000 +#define AHCI_Q_FORCE_PI 0x00080000 +#define AHCI_Q_RESTORE_CAP 0x00100000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -599,13 +600,14 @@ "\013NOCOUNT" \ "\014ALTSIG" \ "\015NOMSI" \ - "\016ATI_PMP_BUG" \ - "\017MAXIO_64K" \ - "\020SATA1_UNIT0" \ - "\021ABAR0" \ - "\0221MSI" \ - "\023FORCE_PI" \ - "\024RESTORE_CAP" + "\016NOMSIX" \ + "\017ATI_PMP_BUG" \ + "\018MAXIO_64K" \ + "\019SATA1_UNIT0" \ + "\020ABAR0" \ + "\0211MSI" \ + "\022FORCE_PI" \ + "\023RESTORE_CAP" int ahci_attach(device_t dev); int ahci_detach(device_t dev); EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: jpa-semihalf.com, imp, andrew, zbb Cc: freebsd-arm-list --b1_ceffba8be4d83b3b2c582c2b899af6b6 Content-Type: text/x-patch; charset=utf-8; name="D4301.10542.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D4301.10542.patch" ZGlmZiAtLWdpdCBhL3N5cy9kZXYvYWhjaS9haGNpX3BjaS5jIGIvc3lzL2Rldi9haGNpL2F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