Page MenuHomeFreeBSD

bhyve: Fix the wrong Number of Power States Support value also set a reasonable Max Power for NVMe controller
ClosedPublic

Authored by wanpengqian_gmail.com on Oct 26 2021, 5:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 2:00 AM
Unknown Object (File)
Mar 7 2024, 1:58 AM
Unknown Object (File)
Mar 7 2024, 1:58 AM
Unknown Object (File)
Mar 7 2024, 1:58 AM
Unknown Object (File)
Mar 7 2024, 12:52 AM
Unknown Object (File)
Mar 7 2024, 12:00 AM
Unknown Object (File)
Mar 4 2024, 7:03 AM
Unknown Object (File)
Mar 4 2024, 7:03 AM

Details

Summary

Number of Power States Support is a 0's based value.
0 indicate 1 power state.

This patch will set 1 power state, also set the Max Power to 10 Watts.
(Max Power Scale is 0, means 0.01 Watts based)

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>

Test Plan

Within FreeBSD/Linux guests, list the number of power states and check the Max Power value.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wanpengqian_gmail.com retitled this revision from bhyve: correct the Number of Power States Support and set a reasonable Max Power for NVMe controller to bhyve: Fix the wrong Number of Power States Support value also set a reasonable Max Power for NVMe controller.Nov 25 2021, 8:57 AM
markj added a subscriber: markj.

Looks ok. I'd explicitly initialize MXPS and NOPS to zero as well.

This revision is now accepted and ready to land.Nov 29 2021, 4:45 PM

explicitly initialize MXPS and NOPS to zero as well

This revision now requires review to proceed.Nov 29 2021, 9:26 PM

explicitly initialize MXPS and NOPS to zero as well

Thank you very much. Now initialize the mps_nops to zero as well.

Sorry to nitpick a bit more. Please let me know if you'd like me to commit the change.

usr.sbin/bhyve/pci_nvme.c
553–557

I think the comment should also clarify that the value is zero-indexed, otherwise this line looks wrong.

This revision is now accepted and ready to land.Nov 29 2021, 9:48 PM
This revision now requires review to proceed.Nov 29 2021, 9:59 PM

Yes, please commit this for me. thank you.

Give me a few days to check on some wording in the specification.

After getting some clarification on the wording in the specification (which generated an ECN ...), my preference would be to set NPSS to zero but not report any power state information. I.e. all fields of power_state[0] would be zero. Since pci_nvme_init() uses calloc to allocate the softc (which includes the struct nvme_controller_data), I believe all initialization of cd->power_state can be removed from pci_nvme_init_ctrldata().

I will commit the change to npss but drop the power_state[] changes

This revision is now accepted and ready to land.Aug 14 2022, 3:51 PM