Page MenuHomeFreeBSD

bhyve nvme: Add Temperature Threshold support
ClosedPublic

Authored by chuck on Dec 19 2021, 4:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 5, 1:04 AM
Unknown Object (File)
Sun, Oct 26, 12:37 AM
Unknown Object (File)
Sat, Oct 25, 7:52 AM
Unknown Object (File)
Tue, Oct 21, 9:52 AM
Unknown Object (File)
Sep 29 2025, 2:03 AM
Unknown Object (File)
Sep 11 2025, 8:02 PM
Unknown Object (File)
Sep 11 2025, 6:45 PM
Unknown Object (File)
Sep 11 2025, 1:17 PM

Details

Summary

This adds the ability for a guest OS to send Set / Get Feature,
Temperature Threshold commands. The implementation assumes a constant
temperature and will generate an Asynchronous Event Notification if the
specified threshold is above/below this value. Although the
specification allows 9 temperature values, this implementation only
implements the Composite Temperature.

While in the neighborhood, move the clear of the CSTS register in the
reset function after all other cleanup. This avoids a race with the
guest thinking the reset is complete (i.e. CSTS.RDY = 0) before the NVMe
emulation is actually complete with the reset.

Fixes UNH IOL 16.0 Test 1.7, cases 1, 2, and 4.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43574
Build 40462: arc lint + arc unit

Event Timeline

chuck requested review of this revision.Dec 19 2021, 4:17 PM

Do we need to keep the first temperature warning timestamp? Later we can calculate the following warning time in the healthy log.
Warning Temp Composite Time:
Error Temp Composite Time:

usr.sbin/bhyve/pci_nvme.c
1694

uint8_t for tmpsel is enough.

1706

how about ((thsel != NVME_TEMP_THRESH_OVER) && (thsel != NVME_TEMP_THRESH_UNDER)) for easy understanding?

allanjude added inline comments.
usr.sbin/bhyve/pci_nvme.c
685

This changes the value from 310 to 296, is that intentional?

I like wanpengqian_gmail.com's suggestions as well.
310 vs 296 isn't a meaningful change. 37C vs 23C
Personally, I'd report 303 since that's 30C, but the actual number really doesn't matter.

usr.sbin/bhyve/pci_nvme.c
549

how are these numbers computed?

1068

seems unrelated, but good.

chuck added inline comments.
usr.sbin/bhyve/pci_nvme.c
549

NVMe 2.0, Figure 275 includes in the description for WCTEMP

It is recommended that implementations report a value of 0157h in this field.

685

Yes, the change was intentional. Both values are arbitrary, but 296 is room temperature, which I liked better.

usr.sbin/bhyve/pci_nvme.c
1706

No, because unsupported TMPSEL values need to return an error.

usr.sbin/bhyve/pci_nvme.c
1706

sorry, I mean this part ' (thsel > NVME_TEMP_THRESH_UNDER)'
first time I read it I have to check specification to find out what it means. Its fine, I understand now.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 29 2022, 11:18 PM
This revision was automatically updated to reflect the committed changes.