iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu: DMAR reporting table needs at least one DRHD
@ 2013-05-20  7:57 Li, Zhen-Hua
       [not found] ` <1369036652-20022-1-git-send-email-zhen-hual-VXdhtT5mjnY@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Li, Zhen-Hua @ 2013-05-20  7:57 UTC (permalink / raw)
  To: Ingo Molnar, Joerg Roedel, Donald Dutile, Linn Crosetto,
	linux-kernel, iommu
  Cc: Li, Zhen-Hua

In intel vt-d spec , chapter 8.1 , DMA Remapping Reporting Structure.
In the end of the table, it says:

Remapping Structures[]
-
A list of structures. The list will contain one or
more DMA Remapping Hardware Unit Definition
(DRHD) structures, and zero or more Reserved
Memory Region Reporting (RMRR) and Root Port
ATS Capability Reporting (ATSR) structures.
These structures are described below.

So, there should be at least one DRHD structure in DMA Remapping
reporting table. If there is no DRHD found, a warning is necessary.

Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>
---
 drivers/iommu/dmar.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index a7967ce..4739211 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -309,6 +309,7 @@ parse_dmar_table(void)
 	struct acpi_table_dmar *dmar;
 	struct acpi_dmar_header *entry_header;
 	int ret = 0;
+	int drhd_count = 0;
 
 	/*
 	 * Do it again, earlier dmar_tbl mapping could be mapped with
@@ -347,6 +348,7 @@ parse_dmar_table(void)
 
 		switch (entry_header->type) {
 		case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+			drhd_count++;
 			ret = dmar_parse_one_drhd(entry_header);
 			break;
 		case ACPI_DMAR_TYPE_RESERVED_MEMORY:
@@ -371,6 +373,8 @@ parse_dmar_table(void)
 
 		entry_header = ((void *)entry_header + entry_header->length);
 	}
+	if (drhd_count == 0)
+		pr_warn("There is no DRHD structure.");
 	return ret;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] iommu: DMAR reporting table needs at least one DRHD
       [not found] ` <1369036652-20022-1-git-send-email-zhen-hual-VXdhtT5mjnY@public.gmane.org>
@ 2013-06-20 14:40   ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2013-06-20 14:40 UTC (permalink / raw)
  To: Li, Zhen-Hua
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Ingo Molnar,
	Linn Crosetto

On Mon, May 20, 2013 at 03:57:32PM +0800, Li, Zhen-Hua wrote:
> In intel vt-d spec , chapter 8.1 , DMA Remapping Reporting Structure.
> In the end of the table, it says:
> 
> Remapping Structures[]
> -
> A list of structures. The list will contain one or
> more DMA Remapping Hardware Unit Definition
> (DRHD) structures, and zero or more Reserved
> Memory Region Reporting (RMRR) and Root Port
> ATS Capability Reporting (ATSR) structures.
> These structures are described below.
> 
> So, there should be at least one DRHD structure in DMA Remapping
> reporting table. If there is no DRHD found, a warning is necessary.
> 
> Signed-off-by: Li, Zhen-Hua <zhen-hual-VXdhtT5mjnY@public.gmane.org>

Tweaked the error message a bit and applied to x86/vt-d, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-20 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20  7:57 [PATCH 1/1] iommu: DMAR reporting table needs at least one DRHD Li, Zhen-Hua
     [not found] ` <1369036652-20022-1-git-send-email-zhen-hual-VXdhtT5mjnY@public.gmane.org>
2013-06-20 14:40   ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).