Skip to contentSkip to conversation

uacce: add print information if not enable sva

PATCH Superseded Kai Ye 3 participants 5 messages Jun 4, 2021 – Jun 9, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kai Ye

author
#0 lore raw

PATCH 1/1 uacce: add print information if not enable sva

Add print information necessary if user not enable sva.

---
 drivers/misc/uacce/uacce.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/misc/uacce/uacce.c +9 -2
index bae18ef0..fe38af8 100644
@@ -387,15 +387,22 @@ static void uacce_release(struct device *dev)
 
 static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags)
 {
+	int ret;
+
 	if (!(flags & UACCE_DEV_SVA))
 		return flags;
 
 	flags &= ~UACCE_DEV_SVA;
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF))
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF);
+	if (ret) {
+		dev_err(parent, "failed to enable IOPF feature! ret = %d\n", ret);
 		return flags;
+	}
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA)) {
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA);
+	if (ret) {
+		dev_err(parent, "failed to enable SVA feature! ret = %d\n", ret);
 		iommu_dev_disable_feature(parent, IOMMU_DEV_FEAT_IOPF);
 		return flags;
 	}
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 16 lines · Kai Ye

Add print information necessary if user not enable sva.

---
 drivers/misc/uacce/uacce.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/misc/uacce/uacce.c +1 -0
index bae18ef0..fe38af8 100644
@@ -387,15 +387,22 @@ static void uacce_release(struct device *dev)
 
 static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags)
 {
+	int ret;

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 399

Quoted 10 lines
drivers/misc/uacce/uacce.c +4 -1
+
 	if (!(flags & UACCE_DEV_SVA))
 		return flags;
 
 	flags &= ~UACCE_DEV_SVA;
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF))
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF);
+	if (ret) {
+		dev_err(parent, "failed to enable IOPF feature! ret = %d\n", ret);

Why is this needed? Has this ever happened in real life such that the log message is now required?

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 405

Quoted 7 lines
drivers/misc/uacce/uacce.c +4 -1
 		return flags;
+	}
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA)) {
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA);
+	if (ret) {
+		dev_err(parent, "failed to enable SVA feature! ret = %d\n", ret);

Same here, does this happen in real systems?

thanks,

greg k-h

author
#2 lore raw
Quoted 43 lines · Greg KH
Quoted 16 lines · Kai Ye

Add print information necessary if user not enable sva.

---
 drivers/misc/uacce/uacce.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/misc/uacce/uacce.c +1 -0
index bae18ef0..fe38af8 100644
@@ -387,15 +387,22 @@ static void uacce_release(struct device *dev)
 
 static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags)
 {
+	int ret;

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 399

Quoted 10 lines
drivers/misc/uacce/uacce.c +4 -1
+
 	if (!(flags & UACCE_DEV_SVA))
 		return flags;
 
 	flags &= ~UACCE_DEV_SVA;
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF))
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF);
+	if (ret) {
+		dev_err(parent, "failed to enable IOPF feature! ret = %d\n", ret);

Why is this needed? Has this ever happened in real life such that the log message is now required?

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 405

Quoted 7 lines
drivers/misc/uacce/uacce.c +4 -1
 		return flags;
+	}
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA)) {
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA);
+	if (ret) {
+		dev_err(parent, "failed to enable SVA feature! ret = %d\n", ret);

Same here, does this happen in real systems?

Quoted 5 lines

thanks,

greg k-h
.

In a other debug version, the SVA feature failed to be enabled, and no related information was printed. we don't know the cause of the problem. Finally, Although, it's not the problem here. but we find that the sva enable function doesn't have debug information. Therefore, it is inconvenient to locate the fault. so i think the log message is required.

thanks

Kai

maintainer
#3 lore raw
Quoted 51 lines · yekai(A)
Quoted 43 lines · Greg KH
Quoted 16 lines · Kai Ye

Add print information necessary if user not enable sva.

---
 drivers/misc/uacce/uacce.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/misc/uacce/uacce.c +1 -0
index bae18ef0..fe38af8 100644
@@ -387,15 +387,22 @@ static void uacce_release(struct device *dev)
 
 static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags)
 {
+	int ret;

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 399

Quoted 10 lines
drivers/misc/uacce/uacce.c +4 -1
+
 	if (!(flags & UACCE_DEV_SVA))
 		return flags;
 
 	flags &= ~UACCE_DEV_SVA;
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF))
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF);
+	if (ret) {
+		dev_err(parent, "failed to enable IOPF feature! ret = %d\n", ret);

Why is this needed? Has this ever happened in real life such that the log message is now required?

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 405

Quoted 7 lines
drivers/misc/uacce/uacce.c +4 -1
 		return flags;
+	}
 
-	if (iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA)) {
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA);
+	if (ret) {
+		dev_err(parent, "failed to enable SVA feature! ret = %d\n", ret);

Same here, does this happen in real systems?

Quoted 5 lines

thanks,

greg k-h
.

Quoted 6 lines

In a other debug version, the SVA feature failed to be enabled, and no related information was printed. we don't know the cause of the problem. Finally, Although, it's not the problem here. but we find that the sva enable function doesn't have debug information. Therefore, it is inconvenient to locate the fault.
so i think the log message is required.

Ok, can you resend with the changes that Joe suggested to make this even easier to use?

thanks,

greg k-h

#4 lore raw
In reply to Kai Ye
Quoted 1 line · Kai Ye

Add print information necessary if user not enable sva.

[]

drivers/misc/uacce/uacce.c

Quoted 1 line
drivers/misc/uacce/uacce.c +0 -0

[]

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 390

Quoted 6 lines
drivers/misc/uacce/uacce.c +0 -0
@@ -387,15 +387,22 @@ static void uacce_release(struct device *dev)

 static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags) {

drivers/misc/uacce/uacce.c +1 -0
+	int ret;

[]

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 399

Quoted 3 lines
drivers/misc/uacce/uacce.c +3 -0
+	ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_IOPF);
+	if (ret) {
+		dev_err(parent, "failed to enable IOPF feature! ret = %d\n", ret);

Perhaps use %pe, ERR_PTR(ret) to get descriptive error output

drivers/misc/uacce/uacce.c static void uacce_release(struct device *dev) · line 405

Quoted 1 line
drivers/misc/uacce/uacce.c +1 -0
+		dev_err(parent, "failed to enable SVA feature! ret = %d\n", ret);

here too