Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Aug 2016 09:29:35 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r304363 - stable/11/sys/dev/ntb/ntb_hw
Message-ID:  <201608180929.u7I9TZph094459@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Aug 18 09:29:35 2016
New Revision: 304363
URL: https://svnweb.freebsd.org/changeset/base/304363

Log:
  MFC r302531: Revert odd change, setting limit registers before base.
  
  I don't know what errata is mentioned there, I was unable to find it, but
  setting limit before the base simply does not work at all.  According to
  specification attempt to set limit out of the present window range resets
  it to zero, effectively disabling it.  And that is what I see in practice.
  
  Fixing this properly disables access for remote side to our memory until
  respective xlat is negotiated and set.  As I see, Linux does the same.

Modified:
  stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c
==============================================================================
--- stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c	Thu Aug 18 09:28:59 2016	(r304362)
+++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c	Thu Aug 18 09:29:35 2016	(r304363)
@@ -1699,26 +1699,22 @@ xeon_set_sbar_base_and_limit(struct ntb_
 			bar_addr = 0;
 	}
 
-	/*
-	 * Set limit registers first to avoid an errata where setting the base
-	 * registers locks the limit registers.
-	 */
 	if (!bar_is_64bit(ntb, idx)) {
-		ntb_reg_write(4, lmt_reg, bar_addr);
-		reg_val = ntb_reg_read(4, lmt_reg);
-		(void)reg_val;
-
 		ntb_reg_write(4, base_reg, bar_addr);
 		reg_val = ntb_reg_read(4, base_reg);
 		(void)reg_val;
-	} else {
-		ntb_reg_write(8, lmt_reg, bar_addr);
-		reg_val = ntb_reg_read(8, lmt_reg);
-		(void)reg_val;
 
+		ntb_reg_write(4, lmt_reg, bar_addr);
+		reg_val = ntb_reg_read(4, lmt_reg);
+		(void)reg_val;
+	} else {
 		ntb_reg_write(8, base_reg, bar_addr);
 		reg_val = ntb_reg_read(8, base_reg);
 		(void)reg_val;
+
+		ntb_reg_write(8, lmt_reg, bar_addr);
+		reg_val = ntb_reg_read(8, lmt_reg);
+		(void)reg_val;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608180929.u7I9TZph094459>