Date: Sun, 10 Jul 2016 20:22:04 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302531 - head/sys/dev/ntb/ntb_hw Message-ID: <201607102022.u6AKM4MY021319@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sun Jul 10 20:22:04 2016 New Revision: 302531 URL: https://svnweb.freebsd.org/changeset/base/302531 Log: 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: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 19:52:26 2016 (r302530) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 20:22:04 2016 (r302531) @@ -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?201607102022.u6AKM4MY021319>