tpm: Add missing ACPI device identification objects
PATCH v5 1/3 tests: acpi: prepare for updated TPM related tables
In reply to Stefan BergerReplace existing TPM related tables, that are about to change, with empty files.
Message-id: [email protected]
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ 1 file changed, 2 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +2 -0
@@ -1 +1,3 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.tis.tpm12" , +"tests/data/acpi/q35/DSDT.tis.tpm2",
Signature · 1 line
2.31.1
PATCH v5 3/3 tests: acpi: Add updated TPM related tables
In reply to Stefan BergerThe updated TPM related tables have the following additions:
Device (TPM)
{
Name (_HID, "MSFT0101" /* TPM 2.0 Security Device */) // _HID: Hardware ID+ Name (_STR, "TPM 2.0 Device") // _STR: Description String
+ Name (_UID, One) // _UID: Unique ID
Name (_STA, 0x0F) // _STA: Status
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
Message-id: [email protected]
--- tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8894 -> 8900 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8894 -> 8921 bytes tests/qtest/bios-tables-test-allowed-diff.h | 2 -- 3 files changed, 2 deletions(-)
tests/data/acpi/q35/DSDT.tis.tpm12 binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm2 binary +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +0 -2
@@ -1,3 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.tis.tpm12" , -"tests/data/acpi/q35/DSDT.tis.tpm2",
Signature · 1 line
2.31.1
PATCH v5 2/3 acpi: tpm: Add missing device identification objects
In reply to Stefan BergerAdd missing TPM device identification objects _STR and _UID. They will appear as files 'description' and 'uid' under Linux sysfs.
Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
Cc: Shannon Zhao <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Ani Sinha <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/708
Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 1 + hw/i386/acpi-build.c | 7 +++++++ 2 files changed, 8 insertions(+)
hw/arm/virt-acpi-build.c +1 -0
@@ -229,6 +229,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)Aml *dev =aml_device ("TPM0" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" ,aml_string ("TPM 2.0 Device" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (0 )));Aml *crs =aml_resource_template ();
hw/i386/acpi-build.c +7 -0
@@ -1812,11 +1812,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev, +aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); }else { dev =aml_device ("ISA.TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0C31" ))); } +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xF ))); crs =aml_resource_template ();
@@ -1844,12 +1848,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,if (TPM_IS_CRB (tpm)) { dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (TPM_CRB_ADDR_BASE ,TPM_CRB_ADDR_SIZE ,AML_READ_WRITE ));aml_append (dev,aml_name_decl ("_CRS" , crs));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));tpm_build_ppi_acpi (tpm, dev);
Signature · 1 line
2.31.1
v5 cover tpm: Add missing ACPI device identification objects
This series of patches adds missing ACPI device identification objects _STR and _UID to TPM 1.2 and TPM 2 ACPI tables.
Stefan
v5:
- Changed Fixes: tag to Resolves:
- Mentioned in 2/3 that choice of uid '1' is based on inspection of hardware TPMs' sysfs entries
v4:
- Rebased on current master: regenerated binaries in patch 3
v3:
- Dropped replacement of ACPI tables with empty files in 1/3.
- Reduced ignored files
Stefan Berger (3):
tests: acpi: prepare for updated TPM related tables
acpi: tpm: Add missing device identification objects
tests: acpi: Add updated TPM related tables
hw/arm/virt-acpi-build.c | 1 + hw/i386/acpi-build.c | 7 +++++++ tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8894 -> 8900 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8894 -> 8921 bytes 4 files changed, 8 insertions(+)
Signature · 1 line
2.31.1
Quoted 2 lines · Stefan Berger
This series of patches adds missing ACPI device identification objects
_STRand_UIDto TPM 1.2 and TPM 2 ACPI tables.
What was the practical impact on guests (if any) from these ACPI objects being missing ?
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 5 lines · Daniel P. Berrangé
Quoted 2 lines · Stefan Berger
This series of patches adds missing ACPI device identification objects
_STRand_UIDto TPM 1.2 and TPM 2 ACPI tables.What was the practical impact on guests (if any) from these ACPI objects being missing ?
As discussed in v4: I don't know if there's software relying on this or just a user who found these to be missing:
https://gitlab.com/qemu-project/qemu/-/issues/708
I can only say that these entries were missing, so I added them. It makes TPM ACPI more complete, for sure. Maybe someone else knows more if there's something out there that actually needs this. I'd be curious as well.
Stefan
Quoted 3 lines
Regards,
Daniel
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
In reply to Stefan BergerQuoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
Quoted 62 lines
Cc: Shannon Zhao <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Ani Sinha <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/708Signed-off-by Stefan Berger <[email protected]>Reviewed-by Ani Sinha <[email protected]>Reviewed-by Shannon Zhao <[email protected]>Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 1 + hw/i386/acpi-build.c | 7 +++++++ 2 files changed, 8 insertions(+)hw/arm/virt-acpi-build.c +1
-0@@ -229,6 +229,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)Aml *dev =aml_device ("TPM0" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" ,aml_string ("TPM 2.0 Device" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (0 )));Aml *crs =aml_resource_template ();hw/i386/acpi-build.c +7
-0@@ -1812,11 +1812,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev, +aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); }else { dev =aml_device ("ISA.TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0C31" ))); } +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xF ))); crs =aml_resource_template ();@@ -1844,12 +1848,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,if (TPM_IS_CRB (tpm)) { dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (TPM_CRB_ADDR_BASE ,TPM_CRB_ADDR_SIZE ,AML_READ_WRITE ));aml_append (dev,aml_name_decl ("_CRS" , crs));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));tpm_build_ppi_acpi (tpm, dev);
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
Quoted 13 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 5 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
Given out experience with these things, I would add compat machinery and avoid changing things for existing machine types. Should be sufficient to address these concerns right Igor?
Quoted 63 lines
Quoted 63 lines
Cc: Shannon Zhao <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Ani Sinha <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/708Signed-off-by Stefan Berger <[email protected]>Reviewed-by Ani Sinha <[email protected]>Reviewed-by Shannon Zhao <[email protected]>Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 1 + hw/i386/acpi-build.c | 7 +++++++ 2 files changed, 8 insertions(+)hw/arm/virt-acpi-build.c +1
-0@@ -229,6 +229,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)Aml *dev =aml_device ("TPM0" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" ,aml_string ("TPM 2.0 Device" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (0 )));Aml *crs =aml_resource_template ();hw/i386/acpi-build.c +7
-0@@ -1812,11 +1812,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev, +aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); }else { dev =aml_device ("ISA.TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0C31" ))); } +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xF ))); crs =aml_resource_template ();@@ -1844,12 +1848,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,if (TPM_IS_CRB (tpm)) { dev =aml_device ("TPM" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("MSFT0101" ))); +aml_append (dev,aml_name_decl ("_STR" , +aml_string ("TPM 2.0 Device" ))); crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (TPM_CRB_ADDR_BASE ,TPM_CRB_ADDR_SIZE ,AML_READ_WRITE ));aml_append (dev,aml_name_decl ("_CRS" , crs));aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xf ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (1 )));tpm_build_ppi_acpi (tpm, dev);
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
In reply to Igor MammedovQuoted 12 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
I smoke tested it with the posted patches applied to v6.2.0 and started 3 VMs with it:
- Linux shows uid = 1 and the description "TPM 2.0 Device" in sysfs
- Win 10 and Win 11 tpm.msc tool are both showing that the TPM is 'ready for use'
Stefan
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
Quoted 23 lines · Stefan Berger
Quoted 12 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
I smoke tested it with the posted patches applied to v6.2.0 and started 3 VMs with it:
Quoted 7 lines
- Linux shows uid = 1 and the description "TPM 2.0 Device" in sysfs
- Win 10 and Win 11 tpm.msc tool are both showing that the TPM is 'ready for use'
Stefan
Just to make sure, what Igor was concerned about is issues like we had with e.g. network devices, when changing UID makes windows think it's a new device and lose configuration created on old qemu on boot with a new qemu.
Not sure what can be configured with a TPM device though ...
Signature · 1 line
MST
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Stefan Berger
Quoted 12 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
I smoke tested it with the posted patches applied to v6.2.0 and started 3 VMs with it:
- Linux shows uid = 1 and the description "TPM 2.0 Device" in sysfs
- Win 10 and Win 11 tpm.msc tool are both showing that the TPM is 'ready for use'
Quoted 7 lines
Quoted 2 lines
Stefan
Just to make sure, what Igor was concerned about is issues like we had with e.g. network devices, when changing UID makes windows think it's a new device and lose configuration created on old qemu on boot with a new qemu.
Not sure what can be configured with a TPM device though ...
The VMs were all created on an old qemu and booted into the patched qemu. They hadn't seen the new ACPI entries before, for sure not when they were installed.
Quoted 1 line
Igor Mammedov
Reviewed-byRe: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
Quoted 37 lines · On Thu, 6 Jan 2022 09:01:36 -0500 Stefan Berger <[email protected]> wrote:
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Stefan Berger
Quoted 12 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
I smoke tested it with the posted patches applied to v6.2.0 and started 3 VMs with it:
- Linux shows uid = 1 and the description "TPM 2.0 Device" in sysfs
- Win 10 and Win 11 tpm.msc tool are both showing that the TPM is 'ready for use'
Quoted 7 lines
Quoted 2 lines
Stefan
Just to make sure, what Igor was concerned about is issues like we had with e.g. network devices, when changing UID makes windows think it's a new device and lose configuration created on old qemu on boot with a new qemu.
Not sure what can be configured with a TPM device though ...
Quoted 3 lines
The VMs were all created on an old qemu and booted into the patched qemu. They hadn't seen the new ACPI entries before, for sure not when they were installed.
In that case I would not bother with compat machinery
(my stance on APCI and compat knobs haven't changed and it is avoid it if possible, sometimes that backfires but overall keeps code simpler, otherwise it would be unreadable mess (it's already complex enough))
Re: [PATCH v5 1/3] tests: acpi: prepare for updated TPM related tables
In reply to Stefan BergerQuoted 9 lines · On Tue, 4 Jan 2022 12:58:04 -0500 Stefan Berger <[email protected]> wrote:
Replace existing TPM related tables, that are about to change, with empty files.
Cc Michael S. Tsirkin <[email protected]>Cc Igor Mammedov <[email protected]>Cc Ani Sinha <[email protected]>Signed-off-by Stefan Berger <[email protected]>Acked-by Ani Sinha <[email protected]>Message-id: [email protected]
Quoted 12 lines
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ 1 file changed, 2 insertions(+)tests/qtest/bios-tables-test-allowed-diff.h +2
-0@@ -1 +1,3 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.tis.tpm12" , +"tests/data/acpi/q35/DSDT.tis.tpm2",
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
In reply to Stefan BergerQuoted 10 lines · On Thu, Jan 6, 2022 at 19:31 Stefan Berger <[email protected]> wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
The VMs were all created on an old qemu and booted into the patched qemu.
Stupid question - should we also check the other way as well? Install on patches qemu and try to boot on the old unpatched qemu?
Re: [PATCH v5 2/3] acpi: tpm: Add missing device identification objects
In reply to Igor MammedovQuoted 42 lines · Igor Mammedov
Quoted 31 lines · On Thu, 6 Jan 2022 09:01:36 -0500 Stefan Berger <[email protected]> wrote:
Quoted 30 lines · Michael S. Tsirkin
Quoted 29 lines · Stefan Berger
Quoted 12 lines · Igor Mammedov
Quoted 5 lines · On Tue, 4 Jan 2022 12:58:05 -0500 Stefan Berger <[email protected]> wrote:
Add missing TPM device identification objects
_STRand_UID. They will appear as files 'description' and 'uid' under Linux sysfs.Following inspection of sysfs entries for hardware TPMs we chose uid '1'.
My guess would be that buy default (in case of missing UID), OSPM will start enumerate from 0. So I think 0 is more safer choice when it comes to compatibility.
Quoted 6 lines
Can you smoke test TPM with Windows, and check if adding UID doesn't break anything if VM actually uses TMP (though I'm not sure how to check it on Windows, maybe install Windows 11 without this patch and then see if it still boots pre-installed VM and nothing is broken after this patch)?
I smoke tested it with the posted patches applied to v6.2.0 and started 3 VMs with it:
- Linux shows uid = 1 and the description "TPM 2.0 Device" in sysfs
- Win 10 and Win 11 tpm.msc tool are both showing that the TPM is 'ready for use'
Stefan
Quoted 8 lines
Quoted 5 lines
Just to make sure, what Igor was concerned about is issues like we had with e.g. network devices, when changing UID makes windows think it's a new device and lose configuration created on old qemu on boot with a new qemu.
Not sure what can be configured with a TPM device though ...The VMs were all created on an old qemu and booted into the patched qemu. They hadn't seen the new ACPI entries before, for sure not when they were installed.
Quoted 9 lines
In that case I would not bother with compat machinery
(my stance on APCI and compat knobs haven't changed and it is avoid it if possible, sometimes that backfires but overall keeps code simpler, otherwise it would be unreadable mess (it's already complex enough))
Reviewed-by Igor Mammedov <[email protected]>
Another test I did was to remove the TPM 2, boot the win 10 and 11 VMs ran tpm.msc (no TPM there), shut them down, added the TPM 2 and ran tpm.msc again. Same result: TPM is 'ready for use'.