Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/server/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -5274,9 +5274,15 @@ func (d *qemu) addTPMDeviceConfig(conf *[]cfg.Section, tpmConfig []deviceConfig.

tpmFD := d.addFileDescriptor(fdFiles, os.NewFile(uintptr(fd), socketPath))

tpmDriver := "tpm-tis-device"
if d.architecture == osarch.ARCH_64BIT_INTEL_X86 {
tpmDriver = "tpm-crb"
}

tpmOpts := qemuTPMOpts{
devName: devName,
path: fmt.Sprintf("/proc/self/fd/%d", tpmFD),
driver: tpmDriver,
}
*conf = append(*conf, qemuTPM(&tpmOpts)...)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ func TestQemuConfigTemplates(t *testing.T) {
qemuTPMOpts{
devName: "myTpm",
path: "/dev/my/tpm",
driver: "tpm-crb",
},
`[chardev "qemu_tpm-chardev_myTpm"]
backend = "socket"
Expand Down
3 changes: 2 additions & 1 deletion internal/server/instance/drivers/driver_qemu_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ func qemuUSB(opts *qemuUSBOpts) []cfg.Section {
type qemuTPMOpts struct {
devName string
path string
driver string
}

func qemuTPM(opts *qemuTPMOpts) []cfg.Section {
Expand All @@ -952,7 +953,7 @@ func qemuTPM(opts *qemuTPMOpts) []cfg.Section {
}, {
Name: fmt.Sprintf(`device "%s%s"`, qemuDeviceIDPrefix, opts.devName),
Entries: map[string]string{
"driver": "tpm-crb",
"driver": opts.driver,
"tpmdev": tpmdev,
},
}}
Expand Down