Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 2021 03:10:30 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d9eb1e0c9084 - stable/13 - cxgbe(4): make it safe to call setup_memwin repeatedly.
Message-ID:  <202105160310.14G3AUtt089240@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=d9eb1e0c90849b9f0f65a8dc9261ae0f187d5ff8

commit d9eb1e0c90849b9f0f65a8dc9261ae0f187d5ff8
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2021-03-19 19:30:57 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2021-05-16 03:08:51 +0000

    cxgbe(4): make it safe to call setup_memwin repeatedly.
    
    A repeat call will recreate the memory windows in the hardware and move
    them to their last-known positions without repeating any of the software
    initialization.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit a1d803c162067b6cd334fc8a44a89f26cc82d83b)
---
 sys/dev/cxgbe/t4_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 370c5dcf3ebe..7f25d0f7bcff 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -3031,16 +3031,18 @@ setup_memwin(struct adapter *sc)
 	}
 
 	for (i = 0, mw = &sc->memwin[0]; i < NUM_MEMWIN; i++, mw_init++, mw++) {
-		rw_init(&mw->mw_lock, "memory window access");
-		mw->mw_base = mw_init->base;
-		mw->mw_aperture = mw_init->aperture;
-		mw->mw_curpos = 0;
+		if (!rw_initialized(&mw->mw_lock)) {
+			rw_init(&mw->mw_lock, "memory window access");
+			mw->mw_base = mw_init->base;
+			mw->mw_aperture = mw_init->aperture;
+			mw->mw_curpos = 0;
+		}
 		t4_write_reg(sc,
 		    PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, i),
 		    (mw->mw_base + bar0) | V_BIR(0) |
 		    V_WINDOW(ilog2(mw->mw_aperture) - 10));
 		rw_wlock(&mw->mw_lock);
-		position_memwin(sc, i, 0);
+		position_memwin(sc, i, mw->mw_curpos);
 		rw_wunlock(&mw->mw_lock);
 	}
 



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