Skip to contentSkip to conversation

VT-d/RMRR: Adjust the return values of register_one_rmrr()

PATCH In review Venu Busireddy 3 participants 3 messages Feb 2, 2017 – Feb 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 VT-d/RMRR: Adjust the return values of register_one_rmrr()

Adjust/manage the return values of register_one_rmrr() such that new callers log errors for non-debug builds too, while not affecting the behavior of the original callers.

---
 xen/drivers/passthrough/vtd/dmar.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

v2:
- Reimplement the adjustment as suggested by Jan.

xen/drivers/passthrough/vtd/dmar.c +11 -0
index 1143a9d..9484f3b 100644
@@ -619,6 +619,7 @@ static int register_one_rmrr(struct acpi_rmrr_unit *rmrru)
                 rmrru->base_address, rmrru->end_address);
         scope_devices_free(&rmrru->scope);
         xfree(rmrru);
+        return 1;
     }
     else if ( rmrru->base_address > rmrru->end_address )
     {
@@ -691,7 +692,17 @@ acpi_parse_one_rmrr(struct acpi_dmar_header *header)
                                &rmrru->scope, RMRR_TYPE, rmrr->segment);
 
     if ( !ret && (rmrru->scope.devices_cnt != 0) )
+    {
         ret = register_one_rmrr(rmrru);
+        /*
+         * register_one_rmrr() returns greater than 0 when a specified
+         * PCIe device cannot be detected. To prevent VT-d from being
+         * disabled in such cases, reset the return value to 0 here.
+         */
+        if ( ret > 0 )
+            ret = 0;
+
+    }
     else
         xfree(rmrru);
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 02.02.17 at 16:08, <[email protected]> wrote:

Adjust/manage the return values of register_one_rmrr() such that new callers log errors for non-debug builds too, while not affecting the behavior of the original callers.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v2 1/1
#2 lore raw
In reply to Venu Busireddy
Quoted 8 lines

From: Venu Busireddy [mailto:[email protected]]
Sent: Thursday, February 02, 2017 11:08 PM

Adjust/manage the return values of register_one_rmrr() such that new callers log errors for non-debug builds too, while not affecting the behavior of the original callers.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel