Page MenuHomeFreeBSD

bhyve: add qemu ppi emulation for tpm devices
ClosedPublic

Authored by corvink on Jun 7 2023, 12:08 PM.
Tags
None
Referenced Files
F162902910: D40462.diff
Sat, Jul 18, 3:53 AM
Unknown Object (File)
Sat, Jul 4, 5:10 PM
Unknown Object (File)
Thu, Jun 25, 1:21 PM
Unknown Object (File)
Jun 15 2026, 8:02 AM
Unknown Object (File)
Jun 13 2026, 7:54 PM
Unknown Object (File)
Jun 9 2026, 8:58 PM
Unknown Object (File)
May 22 2026, 8:52 AM
Unknown Object (File)
May 19 2026, 5:21 AM
Subscribers

Details

Summary

Windows requires a physical presence interface to recognize the tpm
device. Qemu has an implementation for the ppi which can reuse. Using
the qemu ppi makes it very easy because we don't have to implement new
ppi functionality into ovmf. The qemu implementation is already there.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51954
Build 48845: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/tpm_ppi_qemu.c
116

These switch statements can be replaced by calls to memcpy().

133

Same comment everywhere else.

163

mr_name is unused. There is no need to use a stack buffer for a string which is known at compile time.

200

Same bug as elsewhere, mr.name must not be a pointer to a stack buffer. Please just use a string literal.

  • use memcpy for mmio
  • remove \n from warn calls
  • add mmio registration helper

The warnx() strings do not need newlines.

usr.sbin/bhyve/tpm_ppi_qemu.c
100

If you make this a global variable, then this function isn't needed. Callers can call (un)register_mem() directly and we don't need the extra registration flag variable.

This revision is now accepted and ready to land.Aug 11 2023, 3:37 PM