Skip to contentSkip to conversation

drm/amdgpu: fix undefined preprocessor identifier 'CONFIG_ARM64'

PATCH New Alex Deucher 2 participants 3 messages Jan 27, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: fix undefined preprocessor identifier 'CONFIG_ARM64'

Check if the identifer is defined.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
index 40803aab136f..645093610aa0 100644
@@ -294,9 +294,9 @@ struct amdgpu_video_codec_info;
 
 static inline bool is_virtual_machine(void)
 {
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86)
 	return boot_cpu_has(X86_FEATURE_HYPERVISOR);
-#elif CONFIG_ARM64
+#elif defined(CONFIG_ARM64)
 	return !is_kernel_in_hyp_mode();
 #else
 	return false;
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/1 drm/amdgpu/swsmu/i2c: return an error if the SMU is not running

Return an error if someone tries to use the i2c bus when the SMU is not running. Otherwise we can end up sending commands to the SMU which will either get ignored or could cause other issues depending on what state the GPU and SMU are in.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c       | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c      | 3 +++
 4 files changed, 12 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +3 -0
index 2c78d04d5611..bc20d0da4393 100644
@@ -2070,6 +2070,9 @@ static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +3 -0
index 84834c24a7e9..47a75f9c453e 100644
@@ -2754,6 +2754,9 @@ static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 -0
index 651fe748e423..bca622ca9af4 100644
@@ -3449,6 +3449,9 @@ static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +3 -0
index 8c02adbf446a..08415de45e16 100644
@@ -1473,6 +1473,9 @@ static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] drm/amdgpu/swsmu/i2c: return an error if the SMU is not running

Regards,
Luben

Quoted 61 lines · Alex Deucher

Return an error if someone tries to use the i2c bus when the SMU is not running. Otherwise we can end up sending commands to the SMU which will either get ignored or could cause other issues depending on what state the GPU and SMU are in.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c       | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c      | 3 +++
 4 files changed, 12 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +3 -0
index 2c78d04d5611..bc20d0da4393 100644
@@ -2070,6 +2070,9 @@ static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +3 -0
index 84834c24a7e9..47a75f9c453e 100644
@@ -2754,6 +2754,9 @@ static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 -0
index 651fe748e423..bca622ca9af4 100644
@@ -3449,6 +3449,9 @@ static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
index 8c02adbf446a..08415de45e16 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap, · line 1481

Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +3 -0
@@ -1473,6 +1473,9 @@ static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i, j, r, c;
 	u16 dir;
 
+	if (!adev->pm.dpm_enabled)
+		return -EBUSY;
+
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
 		return -ENOMEM;

Regards,

Signature · 1 line
Luben