[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.13] xen/arm: mm: Allow generic xen page-tables helpers to be called early



(+ Andrew and Jan)

Hi,

On 11/10/2019 01:27, Stefano Stabellini wrote:
On Thu, 10 Oct 2019, Julien Grall wrote:
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index be23acfe26..a6637ce347 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -964,11 +964,40 @@ static int create_xen_table(lpae_t *entry)
static lpae_t *xen_map_table(mfn_t mfn)
  {
+    /*
+     * We may require to map the page table before map_domain_page() is
+     * useable. The requirements here is it must be useable as soon as
+     * page-tables are allocated dynamically via alloc_boot_pages().
+     *
+     * We need to do the check on physical address rather than virtual
+     * address to avoid truncation on Arm32. Therefore is_kernel() cannot
+     * be used.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+    {
+        const mfn_t mstart = virt_to_mfn(_start);
+        const mfn_t mend = virt_to_mfn(_end);
+
+        if ( (mfn_x(mstart) <= mfn_x(mfn)) && (mfn_x(mfn) < mfn_x(mend)) )
+        {

The patch is good. Actually I noticed that we already have
is_xen_fixed_mfn(), looks like it is made for this. I think we should
use it here, except that is_xen_fixed_mfn has:

Thanks, I thought we had one but I couldn't remember the name :(.


      (mfn_to_maddr(mfn) <= virt_to_maddr(&_end)))

I think it should actually be:

      (mfn_to_maddr(mfn) < virt_to_maddr(&_end)))

Maybe we could fix that at the same time in one patch? However, it is
the same definition as on x86, so I don't know what is going on there.

For Arm we should definitely use < and not <=.

I am assuming this is the same for x86. Andrew? Jan?

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.