[PATCH 25/83] hsa/radeon: fix the OEMID assignment in kfd_topology

2014-07-10 Thread Oded Gabbay
From: Evgeny Pinchuk 

The assignment of OEMID from the CRAT table is into a 64 variable. The OEMID is 
48bit wide in the CRAT.
This fix makes sure that only 48bit are assigned for the OEMID value from the 
CRAT table.

Signed-off-by: Evgeny Pinchuk 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/hsa/radeon/kfd_crat.h | 2 ++
 drivers/gpu/hsa/radeon/kfd_topology.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/hsa/radeon/kfd_crat.h 
b/drivers/gpu/hsa/radeon/kfd_crat.h
index 587455d..a374fa3 100644
--- a/drivers/gpu/hsa/radeon/kfd_crat.h
+++ b/drivers/gpu/hsa/radeon/kfd_crat.h
@@ -42,6 +42,8 @@
 #define CRAT_OEMTABLEID_LENGTH 8
 #define CRAT_RESERVED_LENGTH   6
 
+#define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1)
+
 struct crat_header {
uint32_tsignature;
uint32_tlength;
diff --git a/drivers/gpu/hsa/radeon/kfd_topology.c 
b/drivers/gpu/hsa/radeon/kfd_topology.c
index 6acac25..2ee5444 100644
--- a/drivers/gpu/hsa/radeon/kfd_topology.c
+++ b/drivers/gpu/hsa/radeon/kfd_topology.c
@@ -467,10 +467,10 @@ static int kfd_parse_crat_table(void *crat_image)
if (!top_dev) {
kfd_release_live_view();
return -ENOMEM;
+   }
}
-}
 
-   sys_props.platform_id = *((uint64_t *)crat_table->oem_id);
+   sys_props.platform_id = (*((uint64_t *)crat_table->oem_id)) & 
CRAT_OEMID_64BIT_MASK;
sys_props.platform_oem = *((uint64_t *)crat_table->oem_table_id);
sys_props.platform_rev = crat_table->revision;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 25/83] hsa/radeon: fix the OEMID assignment in kfd_topology

2014-07-10 Thread Oded Gabbay
From: Evgeny Pinchuk evgeny.pinc...@amd.com

The assignment of OEMID from the CRAT table is into a 64 variable. The OEMID is 
48bit wide in the CRAT.
This fix makes sure that only 48bit are assigned for the OEMID value from the 
CRAT table.

Signed-off-by: Evgeny Pinchuk evgeny.pinc...@amd.com
Signed-off-by: Oded Gabbay oded.gab...@amd.com
---
 drivers/gpu/hsa/radeon/kfd_crat.h | 2 ++
 drivers/gpu/hsa/radeon/kfd_topology.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/hsa/radeon/kfd_crat.h 
b/drivers/gpu/hsa/radeon/kfd_crat.h
index 587455d..a374fa3 100644
--- a/drivers/gpu/hsa/radeon/kfd_crat.h
+++ b/drivers/gpu/hsa/radeon/kfd_crat.h
@@ -42,6 +42,8 @@
 #define CRAT_OEMTABLEID_LENGTH 8
 #define CRAT_RESERVED_LENGTH   6
 
+#define CRAT_OEMID_64BIT_MASK ((1ULL  (CRAT_OEMID_LENGTH * 8)) - 1)
+
 struct crat_header {
uint32_tsignature;
uint32_tlength;
diff --git a/drivers/gpu/hsa/radeon/kfd_topology.c 
b/drivers/gpu/hsa/radeon/kfd_topology.c
index 6acac25..2ee5444 100644
--- a/drivers/gpu/hsa/radeon/kfd_topology.c
+++ b/drivers/gpu/hsa/radeon/kfd_topology.c
@@ -467,10 +467,10 @@ static int kfd_parse_crat_table(void *crat_image)
if (!top_dev) {
kfd_release_live_view();
return -ENOMEM;
+   }
}
-}
 
-   sys_props.platform_id = *((uint64_t *)crat_table-oem_id);
+   sys_props.platform_id = (*((uint64_t *)crat_table-oem_id))  
CRAT_OEMID_64BIT_MASK;
sys_props.platform_oem = *((uint64_t *)crat_table-oem_table_id);
sys_props.platform_rev = crat_table-revision;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/