iommu/vt-d: allow NVS regions in arch_rmrr_sanity_check()
PATCH 1/1 iommu/vt-d: allow NVS regions in arch_rmrr_sanity_check()
arch_rmrr_sanity_check() warns if the RMRR is not covered by an ACPI Reserved region, but it seems like it should accept an NVS region as well. The ACPI spec
https://uefi.org/specs/ACPI/6.5/15_System_Address_Map_Interfaces.html
uses similar wording for "Reserved" and "NVS" region types; for NVS regions it says "This range of addresses is in use or reserved by the system and must not be used by the operating system."
There is an old comment on this mailing list that also suggests NVS regions should pass the arch_rmrr_sanity_check() test:
Quoted 4 lines
The warnings come from
arch_rmrr_sanity_check()since it checks whether the region isE820_TYPE_RESERVED. However, if the purpose of the check is to detect RMRR has regions that may be used by OS as free memory, isn'tE820_TYPE_NVSsafe, too?
https://lore.kernel.org/linux-iommu/[email protected]/
This patch overlaps with another proposed patch that would add the region type to the log since sometimes the bug reporter sees this log on the console but doesn't know to include the kernel log:
https://lore.kernel.org/lkml/[email protected]/
Here's an example of the "Firmware Bug" apparent false positive:
Quoted 2 lines
DMAR: [Firmware Bug]: No firmware reserved region can cover this RMRR [0x000000006f760000-0x000000006f762fff], contact BIOS vendor for fixes
DMAR: [Firmware Bug]: Your BIOS is broken; bad RMRR [0x000000006f760000-0x000000006f762fff]
This is the snippet from the e820 table:
Quoted 3 lines
BIOS-e820: [mem 0x0000000068bff000-0x000000006ebfefff] reserved
BIOS-e820: [mem 0x000000006ebff000-0x000000006f9fefff] ACPI NVS
BIOS-e820: [mem 0x000000006f9ff000-0x000000006fffefff] ACPI data
There are more details at https://bugzilla.kernel.org/show_bug.cgi?id=216443
--- arch/x86/include/asm/iommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/iommu.h +3 -1
@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))return 0 ; pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n",
Signature · 1 line
2.17.1
Quoted 64 lines · Charlotte Tan
arch_rmrr_sanity_check()warns if the RMRR is not covered by an ACPI Reserved region, but it seems like it should accept an NVS region as well. The ACPI spec
https://uefi.org/specs/ACPI/6.5/15_System_Address_Map_Interfaces.html
uses similar wording for "Reserved" and "NVS" region types; for NVS regions it says "This range of addresses is in use or reserved by the system and must not be used by the operating system."There is an old comment on this mailing list that also suggests NVS regions should pass the
arch_rmrr_sanity_check()test:Quoted 4 lines
The warnings come from
arch_rmrr_sanity_check()since it checks whether the region isE820_TYPE_RESERVED. However, if the purpose of the check is to detect RMRR has regions that may be used by OS as free memory, isn'tE820_TYPE_NVSsafe, too?https://lore.kernel.org/linux-iommu/[email protected]/
This patch overlaps with another proposed patch that would add the region type to the log since sometimes the bug reporter sees this log on the console but doesn't know to include the kernel log:
https://lore.kernel.org/lkml/[email protected]/
Here's an example of the "Firmware Bug" apparent false positive:
Quoted 2 lines
DMAR: [Firmware Bug]: No firmware reserved region can cover this RMRR [0x000000006f760000-0x000000006f762fff], contact BIOS vendor for fixes
DMAR: [Firmware Bug]: Your BIOS is broken; bad RMRR [0x000000006f760000-0x000000006f762fff]This is the snippet from the e820 table:
Quoted 3 lines
BIOS-e820: [mem 0x0000000068bff000-0x000000006ebfefff] reserved
BIOS-e820: [mem 0x000000006ebff000-0x000000006f9fefff] ACPI NVS
BIOS-e820: [mem 0x000000006f9ff000-0x000000006fffefff] ACPI dataThere are more details at https://bugzilla.kernel.org/show_bug.cgi?id=216443
Fixes f036c7fa0ab6 ("iommu/vt-d: Check VT-d RMRR region in BIOS is reported as reserved")Cc Will Mortensen <[email protected]>Signed-off-by Charlotte Tan <[email protected]>--- arch/x86/include/asm/iommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/x86/include/asm/iommu.h +3
-1@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))return 0 ; pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n",Signature · 1 line
2.17.1
Hi Charlotte,
Looks good to me!
Signature · 1 line
Aaron Tomlin
arch/x86/include/asm/iommu.h arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) · line 31
Quoted 13 lines · Charlotte Tan
arch/x86/include/asm/iommu.h +3
-1@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))
Thank you for the patch.
scripts/checkpatch.pl complains:
CHECK: Unnecessary parentheses around 'entry_type == E820_TYPE_RESERVED' #71: FILE: arch/x86/include/asm/iommu.h:31:
+ if ((entry_type == E820_TYPE_RESERVED) || (entry_type == E820_TYPE_NVS))
CHECK: Unnecessary parentheses around 'entry_type == E820_TYPE_NVS' #71: FILE: arch/x86/include/asm/iommu.h:31:
+ if ((entry_type == E820_TYPE_RESERVED) || (entry_type == E820_TYPE_NVS))
No need to send a new version. I will remove the unnecessary parentheses (if you agree).
I will also refine the commit message to avoid long lines.
Best regards,
baolu
Quoted 13 lines · Baolu Lu
arch/x86/include/asm/iommu.h arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) · line 30
Quoted 12 lines · Charlotte Tan
arch/x86/include/asm/iommu.h +3
-1@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))
Hi Baolu,
Quoted 1 line
Thank you for the patch.
Thank you for the review.
Quoted 10 lines
scripts/checkpatch.plcomplains:CHECK: Unnecessary parentheses around '
entry_type==E820_TYPE_RESERVED' #71: FILE:arch/x86/include/asm/iommu.h:31:arch/x86/include/asm/iommu.h +1
-0+if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))CHECK: Unnecessary parentheses around '
entry_type==E820_TYPE_NVS' #71: FILE:arch/x86/include/asm/iommu.h:31:arch/x86/include/asm/iommu.h +1
-0+if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))
Quoted 2 lines
No need to send a new version. I will remove the unnecessary parentheses (if you agree).
Yes please.
Quoted 1 line
I will also refine the commit message to avoid long lines.
Much appreciated!
Kind regards,
Signature · 1 line
Aaron Tomlin
Quoted 17 lines · Aaron Tomlin
Quoted 13 lines · Baolu Lu
arch/x86/include/asm/iommu.h arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) · line 30
Quoted 12 lines · Charlotte Tan
arch/x86/include/asm/iommu.h +3
-1@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))Hi Baolu,
Quoted 3 lines
Quoted 1 line
Thank you for the patch.
Thank you for the review.
Hi Baolu,
Please note that I only responded as I offered the Reviewed-by. Indeed, Charlotte's feedback is final.
Kind regards,
Signature · 1 line
Aaron Tomlin
A message that is not in the archive (sent off-list or not yet received): CA+N19e6+Qab5qhQOj_QDGU60Ef_V4eJzCydmM_Qa0LGxn8_JvQ@mail.gmail.com
Oops, sorry for not using checkpatch.
Quoted 2 lines
No need to send a new version. I will remove the unnecessary parentheses (if you agree).
Yep, thanks!
Quoted 1 line
I will also refine the commit message to avoid long lines.
Yep, please make any other changes as needed.
Quoted 52 lines · Charlotte Tan
Quoted 3 lines
No need to send a new version. I will remove the unnecessary parentheses (if you agree).
Ah sorry I didn't use checkpatch. Yes please make that change and any others to the commit message as needed.
Thanks!
Quoted 25 lines · Aaron Tomlin
Quoted 17 lines · Aaron Tomlin
Quoted 13 lines · Baolu Lu
arch/x86/include/asm/iommu.h arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) · line 30
Quoted 12 lines · Charlotte Tan
arch/x86/include/asm/iommu.h +3
-1@@ -25,8 +25,10 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) {u64 start = rmrr->base_address;u64 end = rmrr->end_address +1 ; +int entry_type; -if (e820__mapped_all (start, end,E820_TYPE_RESERVED )) + entry_type =e820__get_entry_type (start, end); +if ((entry_type ==E820_TYPE_RESERVED ) || (entry_type ==E820_TYPE_NVS ))Hi Baolu,
Quoted 3 lines
Quoted 1 line
Thank you for the patch.
Thank you for the review.
Hi Baolu,
Quoted 8 lines
Please note that I only responded as I offered the Reviewed-by. Indeed, Charlotte's feedback is final.
Kind regards,
--
Aaron Tomlin--
CHARLOTTE TAN (she/her)
Principal Software Engineer | Platform & Framework
________________________________
[email protected]
Signature · 4 lines
CHARLOTTE TAN (she/her) Principal Software Engineer | Platform & Framework ________________________________ [email protected]
Quoted 31 lines · Charlotte Tan
arch_rmrr_sanity_check()warns if the RMRR is not covered by an ACPI Reserved region, but it seems like it should accept an NVS region as well. The ACPI spec
https://uefi.org/specs/ACPI/6.5/15_System_Address_Map_Interfaces.html
uses similar wording for "Reserved" and "NVS" region types; for NVS regions it says "This range of addresses is in use or reserved by the system and must not be used by the operating system."There is an old comment on this mailing list that also suggests NVS regions should pass the
arch_rmrr_sanity_check()test:Quoted 4 lines
The warnings come from
arch_rmrr_sanity_check()since it checks whether the region isE820_TYPE_RESERVED. However, if the purpose of the check is to detect RMRR has regions that may be used by OS as free memory, isn'tE820_TYPE_NVSsafe, too?https://lore.kernel.org/linux-iommu/[email protected]/
This patch overlaps with another proposed patch that would add the region type to the log since sometimes the bug reporter sees this log on the console but doesn't know to include the kernel log:
https://lore.kernel.org/lkml/[email protected]/
Here's an example of the "Firmware Bug" apparent false positive:
Quoted 2 lines
DMAR: [Firmware Bug]: No firmware reserved region can cover this RMRR [0x000000006f760000-0x000000006f762fff], contact BIOS vendor for fixes
DMAR: [Firmware Bug]: Your BIOS is broken; bad RMRR [0x000000006f760000-0x000000006f762fff]This is the snippet from the e820 table:
Quoted 3 lines
BIOS-e820: [mem 0x0000000068bff000-0x000000006ebfefff] reserved
BIOS-e820: [mem 0x000000006ebff000-0x000000006f9fefff] ACPI NVS
BIOS-e820: [mem 0x000000006f9ff000-0x000000006fffefff] ACPI data
Quoted 7 lines
There are more details athttps://bugzilla.kernel.org/show_bug.cgi?id=216443
Fixes f036c7fa0ab6 ("iommu/vt-d: Check VT-d RMRR region in BIOS is reported as reserved")Cc Will Mortensen<[email protected]>Signed-off-by Charlotte Tan<[email protected]>
Thanks for the patch. It has been queued for v6.1.
https://lore.kernel.org/linux-iommu/[email protected]/
Best regards,
baolu