summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2015-10-13 23:41:06 +0000
committercem <cem@FreeBSD.org>2015-10-13 23:41:06 +0000
commitbc762f4426d89a794efd0f55bffc42691d6b1b85 (patch)
treef28aae012dac223abaa41b1330561ad620d425e3
parentf704bed62801656e7361875052f75afba0bd97bb (diff)
downloadFreeBSD-src-bc762f4426d89a794efd0f55bffc42691d6b1b85.zip
FreeBSD-src-bc762f4426d89a794efd0f55bffc42691d6b1b85.tar.gz
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
-rw-r--r--sys/dev/ntb/ntb_hw/ntb_hw.c17
-rw-r--r--sys/dev/ntb/ntb_hw/ntb_regs.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw.c b/sys/dev/ntb/ntb_hw/ntb_hw.c
index 66d0d74..5bd0025 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw.c
@@ -479,7 +479,7 @@ ntb_setup_interrupts(struct ntb_softc *ntb)
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 */
diff --git a/sys/dev/ntb/ntb_hw/ntb_regs.h b/sys/dev/ntb/ntb_hw/ntb_regs.h
index 2567f83..d97d504 100644
--- a/sys/dev/ntb/ntb_hw/ntb_regs.h
+++ b/sys/dev/ntb/ntb_hw/ntb_regs.h
@@ -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
OpenPOWER on IntegriCloud