Skip to contentSkip to conversation

spapr_pci: fix the path while fetching loc-code from host DT

PATCH In review Seeteena Thoufeek 4 participants 5 messages Nov 7, 2017 – Nov 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr_pci: fix the path while fetching loc-code from host DT

The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT

this is the call that needs to be fixed:
/* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);

---
 hw/ppc/spapr_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 5a3122a..ae86322 100644
@@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     g_free(path);
 
     /* Construct and read from host device tree the loc-code */
-    path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
+    path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf);
     g_free(buf);
     if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · Seeteena Thoufeek

The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT

this is the call that needs to be fixed:
/* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);

I do not see why would extra '/' hurt but where does it really fail?

My machines have leading '/' in devspec, do not yours?

aik@garrison2:~$ cat /sys/bus/pci/devices/0009:03:00.0/devspec && echo -e '\n'
/pciex@3fffe40500000/pci@0/pci@0/pci@1/usb-xhci@0
Quoted 20 lines
---
 hw/ppc/spapr_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 5a3122a..ae86322 100644
@@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     g_free(path);
 
     /* Construct and read from host device tree the loc-code */
-    path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
+    path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf);
     g_free(buf);
     if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;
Signature · 1 line
Alexey
#2 lore raw
Quoted 9 lines · Alexey Kardashevskiy
Quoted 6 lines · Seeteena Thoufeek

The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT

this is the call that needs to be fixed:
/* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);

Quoted 6 lines

I do not see why would extra '/' hurt but where does it really fail?

My machines have leading '/' in devspec, do not yours?

aik@garrison2:~$ cat /sys/bus/pci/devices/0009:03:00.0/devspec && echo -e '\n'
/pciex@3fffe40500000/pci@0/pci@0/pci@1/usb-xhci@0

Right, what Alexey said. I see no reason to change this.

Quoted 26 lines
Quoted 24 lines
---
 hw/ppc/spapr_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 5a3122a..ae86322 100644
@@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     g_free(path);
 
     /* Construct and read from host device tree the loc-code */
-    path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
+    path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf);
     g_free(buf);
     if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#3 lore raw
In reply to Alexey Kardashevskiy

Apologize for the confusion. I thought devspec is not having leading '/'.

I checked devspec in my system and it works as expected.

Quoted 38 lines · Alexey Kardashevskiy
Quoted 6 lines · Seeteena Thoufeek

The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT

this is the call that needs to be fixed:
/* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);

I do not see why would extra '/' hurt but where does it really fail?

My machines have leading '/' in devspec, do not yours?

aik@garrison2:~$ cat /sys/bus/pci/devices/0009:03:00.0/devspec && echo -e '\n'
/pciex@3fffe40500000/pci@0/pci@0/pci@1/usb-xhci@0
Quoted 19 lines
---
  hw/ppc/spapr_pci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 5a3122a..ae86322 100644
@@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
      g_free(path);
 
      /* Construct and read from host device tree the loc-code */
-    path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
+    path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf);
      g_free(buf);
      if (!g_file_get_contents(path, &buf, NULL, NULL)) {
          goto err_out;
#4 lore raw
In reply to Seeteena Thoufeek
Quoted 3 lines · On Tue, 7 Nov 2017 18:48:58 +0530 Seeteena Thoufeek…

The function spapr_phb_vfio_get_loc_code uses wrong path for fetching loc-code from host DT

Why is it wrong ? Are you experiencing actual issues ?

Quoted 4 lines

this is the call that needs to be fixed:
/* Construct and read from host device tree the loc-code */ path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);

This statement is useless, especially with such a trivial patch.

Have a look at the following page:

https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message

Cheers,

--
Greg

Quoted 18 lines
---
 hw/ppc/spapr_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 5a3122a..ae86322 100644
@@ -762,7 +762,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     g_free(path);
 
     /* Construct and read from host device tree the loc-code */
-    path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
+    path = g_strdup_printf("/proc/device-tree/%s/ibm,loc-code", buf);
     g_free(buf);
     if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;