Thread (34 messages) 34 messages, 4 authors, 2016-04-07

[PATCH v10 06/17] Xen: ARM: Add support for mapping platform device mmio

From: Julien Grall <hidden>
Date: 2016-04-07 10:33:29
Also in: linux-devicetree, linux-efi, lkml

Hi Shannon,

On 07/04/16 02:37, Shannon Zhao wrote:

On 2016/4/6 20:16, Julien Grall wrote:
quoted
quoted
+            gpfns[j] = XEN_PFN_DOWN(r->start) + j;
+            idxs[j] = XEN_PFN_DOWN(r->start) + j;
+        }
+
+        xatp.domid = DOMID_SELF;
+        xatp.size = nr;
+        xatp.space = XENMAPSPACE_dev_mmio;
+
+        set_xen_guest_handle(xatp.gpfns, gpfns);
+        set_xen_guest_handle(xatp.idxs, idxs);
+        set_xen_guest_handle(xatp.errs, errs);
+
+        rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp);
+        kfree(gpfns);
+        kfree(idxs);
+        kfree(errs);
+        if (rc)
+            return rc;
Shouldn't we redo the mapping if the hypercall fails?
Hmm, why? If it fails again when we redo the mapping, what should we do
then? Redo again?
Because the device MMIO region is left half mapped in DOM0 address space.

After having another look to your patch, if an error occurs, the 
notifier will still return NOTIFY_OK. This will lead to random data 
abort when the driver is accessing the MMIO regions as the device will 
be considered fully functional.

However, even if the notifier return NOTIFY_BAD, the function device_add 
doesn't care about the return value of blocking_notifier_call_chain. I 
think this need to be fixed.
I think if it fails at the first time it will always fail no matter how
many times we do.
I was speaking about the mappings that succeeded. They will unlikely 
fail during removal. If they ever fail you can just ignore the error.

Regards,

-- 
Julien Grall
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help