git: 956f15e74d66 - stable/12 - Fix mpr(4) panic during a firmware update.

From: Kenneth D. Merry <ken_at_FreeBSD.org>
Date: Thu, 20 Oct 2022 15:00:00 UTC
The branch stable/12 has been updated by ken:

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

commit 956f15e74d66c7f9cfd35a8ac553c48fb5624b56
Author:     Kenneth D. Merry <ken@FreeBSD.org>
AuthorDate: 2022-10-17 16:48:34 +0000
Commit:     Kenneth D. Merry <ken@FreeBSD.org>
CommitDate: 2022-10-20 14:57:55 +0000

    Fix mpr(4) panic during a firmware update.
    
    Issue Description:
    The RequestCredits field of IOCFacts got changed between the Phase23
    firmware to Phase24 firmware. So as part of firmware update operation,
    driver has to free the resources & pools which are created with the Phase23
    Firmware's IOCFacts data (i.e. during driver load time) and has to
    reallocate the resources and pools using Phase24's IOCFacts data. Here
    driver has freed the interrupts but missed to reallocate the interrupts and
    hence config page read operation is getting timed out and controller is
    going for recursive reinit (controller reset) operations and leading to
    kernel panic.
    
    Fix:
    Reallocate the interrupts if the interrupts are disabled as part of
    firmware update/downgrade operation.
    
    Submitted by:   Sreekanth Ready <sreekanth.reddy@broadcom.com>
    Tested by:      ken
    MFC after:      3 days
    
    (cherry picked from commit 11778fca4a83f5e3b597c75785aa5c0ee0dc518e)
---
 sys/dev/mpr/mpr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c
index 82e3e552f21e..308c88112168 100644
--- a/sys/dev/mpr/mpr.c
+++ b/sys/dev/mpr/mpr.c
@@ -737,7 +737,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t attaching)
 	 * XXX If the number of MSI-X vectors changes during re-init, this
 	 * won't see it and adjust.
 	 */
-	if (attaching && (error = mpr_pci_setup_interrupts(sc)) != 0) {
+	if ((attaching || reallocating) && (error = mpr_pci_setup_interrupts(sc)) != 0) {
 		mpr_dprint(sc, MPR_INIT|MPR_ERROR,
 		    "Failed to setup interrupts\n");
 		mpr_free(sc);