From owner-svn-src-all@freebsd.org Tue Oct 13 23:41:08 2015 Return-Path: Delivered-To: svn-src-all@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 17AA6A13066; Tue, 13 Oct 2015 23:41:08 +0000 (UTC) (envelope-from cem@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 mx1.freebsd.org (Postfix) with ESMTPS id C8C6619B1; Tue, 13 Oct 2015 23:41:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9DNf6lF014384; Tue, 13 Oct 2015 23:41:06 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9DNf6nq014382; Tue, 13 Oct 2015 23:41:06 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201510132341.t9DNf6nq014382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 13 Oct 2015 23:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289271 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head 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.20 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: Tue, 13 Oct 2015 23:41:08 -0000 Author: cem Date: Tue Oct 13 23:41:06 2015 New Revision: 289271 URL: https://svnweb.freebsd.org/changeset/base/289271 Log: NTB: MFV c529aa30: Xeon Doorbell errata workaround Modifications to the 14th bit of the B2BDOORBELL register will not be mirrored to the remote system due to a hardware issue. To get around the issue, shrink the number of available doorbell bits by 1. The max number of doorbells was being used as a way to referencing the Link Doorbell bit. Since this would no longer work, the driver must now explicitly reference that bit. This does not affect the xeon_errata_workaround case, as it is not using the b2bdoorbell register. Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c head/sys/dev/ntb/ntb_hw/ntb_regs.h Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 13 23:30:54 2015 (r289270) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 13 23:41:06 2015 (r289271) @@ -479,7 +479,7 @@ ntb_setup_interrupts(struct ntb_softc *n ntb_reg_write(8, ntb->reg_ofs.ldb_mask, ~0); else ntb_reg_write(2, ntb->reg_ofs.ldb_mask, - ~(1 << ntb->limits.max_db_bits)); + (uint16_t) ~(1 << XEON_LINK_DB)); num_vectors = MIN(pci_msix_count(ntb->device), ntb->limits.max_db_bits); @@ -616,7 +616,7 @@ handle_xeon_event_irq(void *arg) device_printf(ntb->device, "Error determining link status\n"); /* bit 15 is always the link bit */ - ntb_reg_write(2, ntb->reg_ofs.ldb, 1 << ntb->limits.max_db_bits); + ntb_reg_write(2, ntb->reg_ofs.ldb, 1 << XEON_LINK_DB); } static void @@ -784,6 +784,19 @@ ntb_setup_xeon(struct ntb_softc *ntb) ntb->limits.msix_cnt = XEON_MSIX_CNT; ntb->bits_per_vector = XEON_DB_BITS_PER_VEC; + /* + * HW Errata on bit 14 of b2bdoorbell register. Writes will not be + * mirrored to the remote system. Shrink the number of bits by one, + * since bit 14 is the last bit. + * + * On REGS_THRU_MW errata mode, we don't use the b2bdoorbell register + * anyway. Nor for non-B2B connection types. + */ + if (HAS_FEATURE(NTB_B2BDOORBELL_BIT14) && + !HAS_FEATURE(NTB_REGS_THRU_MW) && + connection_type == NTB_CONN_B2B) + ntb->limits.max_db_bits = XEON_MAX_DB_BITS - 1; + configure_xeon_secondary_side_bars(ntb); /* Enable Bus Master and Memory Space on the secondary side */ Modified: head/sys/dev/ntb/ntb_hw/ntb_regs.h ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_regs.h Tue Oct 13 23:30:54 2015 (r289270) +++ head/sys/dev/ntb/ntb_hw/ntb_regs.h Tue Oct 13 23:41:06 2015 (r289271) @@ -38,6 +38,7 @@ #define XEON_MAX_COMPAT_SPADS 16 /* Reserve the uppermost bit for link interrupt */ #define XEON_MAX_DB_BITS 15 +#define XEON_LINK_DB 15 #define XEON_DB_BITS_PER_VEC 5 #define XEON_DB_HW_LINK 0x8000