git: 2449e9c5e777 - stable/13 - bhyve: Fix Number of Power States Supported value

From: Chuck Tuffli <chuck_at_FreeBSD.org>
Date: Sat, 19 Nov 2022 17:55:24 UTC
The branch stable/13 has been updated by chuck:

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

commit 2449e9c5e777876cd0989ece96e4352b45cf5115
Author:     WanpengQian <wanpengqian@gmail.com>
AuthorDate: 2022-08-14 15:26:42 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-11-20 01:52:01 +0000

    bhyve: Fix Number of Power States Supported value
    
    Summary:
    Set Number of Power States Supported to indicate 1 power state. Keep the
    Power State Descriptor data structures as zero to indicate "Not
    reported".
    
    Test Plan:
    Within FreeBSD/Linux guests, list the number of power states and check
    the Max Power value.
    
    (cherry picked from commit eae0210cdd2e22c2eb9bc652f2136b3386a663a4)
---
 usr.sbin/bhyve/pci_nvme.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 1b2ad6177f40..4b0920860e5b 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -549,7 +549,11 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc)
 	    (1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT);
 	cd->lpa = 0;	/* TODO: support some simple things like SMART */
 	cd->elpe = 0;	/* max error log page entries */
-	cd->npss = 1;	/* number of power states support */
+	/*
+	 * Report a single power state (zero-based value)
+	 * power_state[] values are left as zero to indicate "Not reported"
+	 */
+	cd->npss = 0;
 
 	/* Warning Composite Temperature Threshold */
 	cd->wctemp = 0x0157;
@@ -578,8 +582,6 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc)
 	    NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT;
 
 	cd->vwc = NVME_CTRLR_DATA_VWC_ALL_NO << NVME_CTRLR_DATA_VWC_ALL_SHIFT;
-
-	cd->power_state[0].mp = 10;
 }
 
 /*