Skip to contentSkip to conversation

drm/amdkfd: Allow building KFD on ARM64

PATCH In review Kuehling, Felix 3 participants 3 messages Jan 2, 2019 – Jan 3, 2019 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Allow building KFD on ARM64

ifdef x86_64 specific code.
Allow enabling CONFIG_HSA_AMD on ARM64.

---
 drivers/gpu/drm/amd/amdkfd/Kconfig        | 4 ++--
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c     | 8 ++++++++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 +++++---
 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/Kconfig +2 -2
index fbf0ee5..c361360 100644
@@ -4,8 +4,8 @@
 
 config HSA_AMD
 	bool "HSA kernel driver for AMD GPU devices"
-	depends on DRM_AMDGPU && X86_64
-	imply AMD_IOMMU_V2
+	depends on DRM_AMDGPU && (X86_64 || ARM64)
+	imply AMD_IOMMU_V2 if X86_64
 	select MMU_NOTIFIER
 	help
 	  Enable this if you want to use HSA features on AMD GPU devices.
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +8 -0
index c02adbb..d7ddb35 100644
@@ -863,6 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size,
 	return 0;
 }
 
+#if CONFIG_X86_64
 static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
 				uint32_t *num_entries,
 				struct crat_subtype_iolink *sub_type_hdr)
@@ -905,6 +906,7 @@ static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
 
 	return 0;
 }
+#endif
 
 /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU
  *
@@ -920,7 +922,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
 	struct crat_subtype_generic *sub_type_hdr;
 	int avail_size = *size;
 	int numa_node_id;
+#ifdef CONFIG_X86_64
 	uint32_t entries = 0;
+#endif
 	int ret = 0;
 
 	if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU)
@@ -982,6 +986,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
 			sub_type_hdr->length);
 
 		/* Fill in Subtype: IO Link */
+#ifdef CONFIG_X86_64
 		ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size,
 				&entries,
 				(struct crat_subtype_iolink *)sub_type_hdr);
@@ -992,6 +997,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
 
 		sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
 				sub_type_hdr->length * entries);
+#else
+		pr_info("IO link not available for non x86 platforms\n");
+#endif
 
 		crat_table->num_domains++;
 	}
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 -3
index 5f5b2ac..8afc592 100644
@@ -1400,9 +1400,11 @@ static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
 	first_cpu_of_numa_node = cpumask_first(cpumask);
 	if (first_cpu_of_numa_node >= nr_cpu_ids)
 		return -1;
-	cpuinfo = &cpu_data(first_cpu_of_numa_node);
-
-	return cpuinfo->apicid;
+#ifdef CONFIG_X86_64
+	return cpu_data(first_cpu_of_numa_node).apicid;
+#else
+	return first_cpu_of_numa_node;
+#endif
 }
 
 /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1546467974-20232-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org

Acked-by
#2 lore raw
Quoted 6 lines · Felix

ifdef x86_64 specific code.
Allow enabling CONFIG_HSA_AMD on ARM64.

Quoted 91 lines
---
 drivers/gpu/drm/amd/amdkfd/Kconfig        | 4 ++--
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c     | 8 ++++++++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 +++++---
 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/Kconfig +2 -2
index fbf0ee5..c361360 100644
@@ -4,8 +4,8 @@
 
 config HSA_AMD
        bool "HSA kernel driver for AMD GPU devices"
-       depends on DRM_AMDGPU && X86_64
-       imply AMD_IOMMU_V2
+       depends on DRM_AMDGPU && (X86_64 || ARM64)
+       imply AMD_IOMMU_V2 if X86_64
        select MMU_NOTIFIER
        help
          Enable this if you want to use HSA features on AMD GPU devices.
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +8 -0
index c02adbb..d7ddb35 100644
@@ -863,6 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size,
        return 0;
 }
 
+#if CONFIG_X86_64
 static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
                                uint32_t *num_entries,
                                struct crat_subtype_iolink *sub_type_hdr)
@@ -905,6 +906,7 @@ static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
 
        return 0;
 }
+#endif
 
 /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU
  *
@@ -920,7 +922,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
        struct crat_subtype_generic *sub_type_hdr;
        int avail_size = *size;
        int numa_node_id;
+#ifdef CONFIG_X86_64
        uint32_t entries = 0;
+#endif
        int ret = 0;
 
        if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU)
@@ -982,6 +986,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
                        sub_type_hdr->length);
 
                /* Fill in Subtype: IO Link */
+#ifdef CONFIG_X86_64
                ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size,
                                &entries,
                                (struct crat_subtype_iolink *)sub_type_hdr);
@@ -992,6 +997,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
 
                sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
                                sub_type_hdr->length * entries);
+#else
+               pr_info("IO link not available for non x86 platforms\n");
+#endif
 
                crat_table->num_domains++;
        }
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 -4
index 5f5b2ac..8afc592 100644
@@ -1400,9 +1400,11 @@ static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
        first_cpu_of_numa_node = cpumask_first(cpumask);
        if (first_cpu_of_numa_node >= nr_cpu_ids)
                return -1;
-       cpuinfo = &cpu_data(first_cpu_of_numa_node);
-
-       return cpuinfo->apicid;
+#ifdef CONFIG_X86_64
+       return cpu_data(first_cpu_of_numa_node).apicid;
+#else
+       return first_cpu_of_numa_node;
+#endif
 }
 
 /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_OOH3Z3hO2-cZ0ZKvzqSmB22XMLtBkhjdHtE7Yd0rzdqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Am 03.01.19 um 04:42 schrieb Alex Deucher:

Quoted 7 lines · Felix
Quoted 5 lines

ifdef x86_64 specific code.
Allow enabling CONFIG_HSA_AMD on ARM64.

Nice to see that we finally pick up some ARM support.

Quoted 92 lines
Quoted 92 lines
---
  drivers/gpu/drm/amd/amdkfd/Kconfig        | 4 ++--
  drivers/gpu/drm/amd/amdkfd/kfd_crat.c     | 8 ++++++++
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 +++++---
  3 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/Kconfig +2 -2
index fbf0ee5..c361360 100644
@@ -4,8 +4,8 @@
 
  config HSA_AMD
         bool "HSA kernel driver for AMD GPU devices"
-       depends on DRM_AMDGPU && X86_64
-       imply AMD_IOMMU_V2
+       depends on DRM_AMDGPU && (X86_64 || ARM64)
+       imply AMD_IOMMU_V2 if X86_64
         select MMU_NOTIFIER
         help
           Enable this if you want to use HSA features on AMD GPU devices.
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +8 -0
index c02adbb..d7ddb35 100644
@@ -863,6 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size,
         return 0;
  }
 
+#if CONFIG_X86_64
  static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
                                 uint32_t *num_entries,
                                 struct crat_subtype_iolink *sub_type_hdr)
@@ -905,6 +906,7 @@ static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size,
 
         return 0;
  }
+#endif
 
  /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU
   *
@@ -920,7 +922,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
         struct crat_subtype_generic *sub_type_hdr;
         int avail_size = *size;
         int numa_node_id;
+#ifdef CONFIG_X86_64
         uint32_t entries = 0;
+#endif
         int ret = 0;
 
         if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU)
@@ -982,6 +986,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
                         sub_type_hdr->length);
 
                 /* Fill in Subtype: IO Link */
+#ifdef CONFIG_X86_64
                 ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size,
                                 &entries,
                                 (struct crat_subtype_iolink *)sub_type_hdr);
@@ -992,6 +997,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
 
                 sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
                                 sub_type_hdr->length * entries);
+#else
+               pr_info("IO link not available for non x86 platforms\n");
+#endif
 
                 crat_table->num_domains++;
         }
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +5 -4
index 5f5b2ac..8afc592 100644
@@ -1400,9 +1400,11 @@ static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
         first_cpu_of_numa_node = cpumask_first(cpumask);
         if (first_cpu_of_numa_node >= nr_cpu_ids)
                 return -1;
-       cpuinfo = &cpu_data(first_cpu_of_numa_node);
-
-       return cpuinfo->apicid;
+#ifdef CONFIG_X86_64
+       return cpu_data(first_cpu_of_numa_node).apicid;
+#else
+       return first_cpu_of_numa_node;
+#endif
  }
 
  /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor
--

2.7.4

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx