Skip to contentSkip to conversation

drm/amdgpu: add a xgmi supported flag

PATCH In review Alex Deucher 2 participants 4 messages Nov 30, 2018 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu: add a xgmi supported flag

Use this to track whether an asic supports xgmi rather than checking the asic type everywhere.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h  | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c       | 3 +++
 4 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
index 8c57924c075f..81e6070d255b 100644
@@ -99,6 +99,7 @@ struct amdgpu_xgmi {
 	unsigned num_physical_nodes;
 	/* gpu list in the same hive */
 	struct list_head head;
+	bool supported;
 };
 
 struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +2 -2
index fb37e69f1bba..f8c86d0593dd 100644
@@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 
 	int count = 0, ret = -EINVAL;
 
-	if ((adev->asic_type < CHIP_VEGA20) ||
-		(adev->flags & AMD_IS_APU) )
+	if (!adev->gmc.xgmi.supported)
 		return 0;
+
 	adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
 	adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 3a4e5d8d5162..ed3145b2a596 100644
@@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
 	}
 	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
 
-	if (adev->asic_type == CHIP_VEGA20) {
+	if (adev->gmc.xgmi.supported) {
 		r = gfxhub_v1_1_get_xgmi_info(adev);
 		if (r)
 			return r;
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
index 83624e150ca7..8849b74078d6 100644
@@ -507,6 +507,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
+	if (adev->asic_type == CHIP_VEGA20)
+		adev->gmc.xgmi.supported = true;
+
 	if (adev->flags & AMD_IS_APU)
 		adev->nbio_funcs = &nbio_v7_0_funcs;
 	else if (adev->asic_type == CHIP_VEGA20)
Signature · 6 lines
2.13.6

_______________________________________________
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): 20181130203042.16298-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 28 lines · Alex Deucher

Use this to track whether an asic supports xgmi rather than checking the asic type everywhere.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h  | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/soc15.c       | 3 +++
  4 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
index 8c57924c075f..81e6070d255b 100644
@@ -99,6 +99,7 @@ struct amdgpu_xgmi {
  	unsigned num_physical_nodes;
  	/* gpu list in the same hive */
  	struct list_head head;
+	bool supported;
  };
 
  struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index fb37e69f1bba..f8c86d0593dd 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · line 98

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -2
@@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 
  	int count = 0, ret = -EINVAL;
 
-	if ((adev->asic_type < CHIP_VEGA20) ||
-		(adev->flags & AMD_IS_APU) )
+	if (!adev->gmc.xgmi.supported)
  		return 0;

What about the (adev->flags & AMD_IS_APU) part ?

Andrey

Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -0
+
  	adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
  	adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 3a4e5d8d5162..ed3145b2a596 100644
@@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
  	}
  	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
 
-	if (adev->asic_type == CHIP_VEGA20) {
+	if (adev->gmc.xgmi.supported) {
  		r = gfxhub_v1_1_get_xgmi_info(adev);
  		if (r)
  			return r;
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 83624e150ca7..8849b74078d6 100644

drivers/gpu/drm/amd/amdgpu/soc15.c int soc15_set_ip_blocks(struct amdgpu_device *adev) · line 515

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
@@ -507,6 +507,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
  		return -EINVAL;
  	}
 
+	if (adev->asic_type == CHIP_VEGA20)
+		adev->gmc.xgmi.supported = true;
+
  	if (adev->flags & AMD_IS_APU)
  		adev->nbio_funcs = &nbio_v7_0_funcs;
  	else if (adev->asic_type == CHIP_VEGA20)

_______________________________________________
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): 0c02b1dd-90a0-96ca-71a7-8fe6a9255511-5C7GfCeVMHo@public.gmane.org

#4 lore raw
Quoted 33 lines · Andrey
Quoted 29 lines · Alex Deucher

Use this to track whether an asic supports xgmi rather than checking the asic type everywhere.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h  | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/soc15.c       | 3 +++
  4 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
index 8c57924c075f..81e6070d255b 100644
@@ -99,6 +99,7 @@ struct amdgpu_xgmi {
      unsigned num_physical_nodes;
      /* gpu list in the same hive */
      struct list_head head;
+     bool supported;
  };
 
  struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index fb37e69f1bba..f8c86d0593dd 100644
@@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · line 98

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -2
      int count = 0, ret = -EINVAL;
 
-     if ((adev->asic_type < CHIP_VEGA20) ||
-             (adev->flags & AMD_IS_APU) )
+     if (!adev->gmc.xgmi.supported)
              return 0;

What about the (adev->flags & AMD_IS_APU) part ?

It's covered by the check. Only vega20 has the flag set.

Alex

Quoted 28 lines

Andrey

Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -0
+
      adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
      adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 3a4e5d8d5162..ed3145b2a596 100644
@@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
      }
      adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
 
-     if (adev->asic_type == CHIP_VEGA20) {
+     if (adev->gmc.xgmi.supported) {
              r = gfxhub_v1_1_get_xgmi_info(adev);
              if (r)
                      return r;
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 83624e150ca7..8849b74078d6 100644
@@ -507,6 +507,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
              return -EINVAL;
      }
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/soc15.c int soc15_set_ip_blocks(struct amdgpu_device *adev) · line 515

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
+     if (adev->asic_type == CHIP_VEGA20)
+             adev->gmc.xgmi.supported = true;
+
      if (adev->flags & AMD_IS_APU)
              adev->nbio_funcs = &nbio_v7_0_funcs;
      else if (adev->asic_type == CHIP_VEGA20)

_______________________________________________
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_PB49_A8Qmw6huEyq_kL3TfMj5dAU8b2+FCXXdYo7hf9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by Andrey Grodzovsky
#6 lore raw

Andrey

Quoted 72 lines · Alex Deucher
Quoted 32 lines · Andrey
Quoted 29 lines · Alex Deucher

Use this to track whether an asic supports xgmi rather than checking the asic type everywhere.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h  | 1 +
   drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 2 +-
   drivers/gpu/drm/amd/amdgpu/soc15.c       | 3 +++
   4 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
index 8c57924c075f..81e6070d255b 100644
@@ -99,6 +99,7 @@ struct amdgpu_xgmi {
       unsigned num_physical_nodes;
       /* gpu list in the same hive */
       struct list_head head;
+     bool supported;
   };
 
   struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +0 -0
index fb37e69f1bba..f8c86d0593dd 100644
@@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · line 98

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -2
       int count = 0, ret = -EINVAL;
 
-     if ((adev->asic_type < CHIP_VEGA20) ||
-             (adev->flags & AMD_IS_APU) )
+     if (!adev->gmc.xgmi.supported)
               return 0;

What about the (adev->flags & AMD_IS_APU) part ?

It's covered by the check. Only vega20 has the flag set.

Alex

Quoted 27 lines

Andrey

Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -0
+
       adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
       adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
index 3a4e5d8d5162..ed3145b2a596 100644
@@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
       }
       adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
 
-     if (adev->asic_type == CHIP_VEGA20) {
+     if (adev->gmc.xgmi.supported) {
               r = gfxhub_v1_1_get_xgmi_info(adev);
               if (r)
                       return r;
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 83624e150ca7..8849b74078d6 100644
@@ -507,6 +507,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
               return -EINVAL;
       }
 
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/soc15.c int soc15_set_ip_blocks(struct amdgpu_device *adev) · line 515

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
+     if (adev->asic_type == CHIP_VEGA20)
+             adev->gmc.xgmi.supported = true;
+
       if (adev->flags & AMD_IS_APU)
               adev->nbio_funcs = &nbio_v7_0_funcs;
       else if (adev->asic_type == CHIP_VEGA20)

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