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

Re: [Xen-devel] arm64: incorrect pa setup cause dom0 boot failure



Hi,

On 11/05/17 19:24, Feng Kan wrote:
Ian:

Ian left Citrix a year ago. I would recommend you to CC ARM maintainers (Stefano and I) if you want to get a prompt answer.


Just a quick question regarding the table below in xen/arch/arm/p2m.c
@@ -1479,7 +1487,7 @@ void __init setup_virt_paging(void)
        [0] = { 32,      32/*32*/,  0,          1 },
        [1] = { 36,      28/*28*/,  0,          1 },
        [2] = { 40,      24/*24*/,  1,          1 },
-        [3] = { 42,      24/*22*/,  1,          1 },
+        [3] = { 42,      22/*22*/,  1,          1 },
^^^ Is this just a typo, or its there for a reason, as I see you made
a comment regarding this later.

Which comment are you referring to? If it is the one in the commit message that introduce this code (1c92a2aaf8):

"Systems with 42-bits are an interesting case, since they only support 3 levels of paging, implying that 8 pages are required at the root level. So far I am not aware of any systems with peripheral located so high up (the only 42-bit system I've seen has nothing above 40-bits), so such systems remain configured for 40-bit IPA with a pair of pages at the root of the p2m."

My understanding is Ian decided to configure guest with only 40 bits to avoid allocate a big root level (they have to be allocated at domain creation).

We do have a system that PA is 42 bits, so I think that would make the
statement below invalid?
        [4] = { 44,      20/*20*/,  0,          2 },
        [5] = { 48,      16/*16*/,  0,          2 },
        [6] = { 0 }, /* Invalid */


@@ -220,9 +222,11 @@ static lpae_t *p2m_get_root_pointer(struct p2m_domain *p2m,
    root_table = gfn_x(gfn) >> (level_orders[P2M_ROOT_LEVEL - 1]);
    root_table &= LPAE_ENTRY_MASK;

-    if ( root_table >= P2M_ROOT_PAGES )
-        return NULL;
+    //if ( root_table >= P2M_ROOT_PAGES )
+    //    return NULL;
^^^ at least for 42 bit case?

A guest would be free to pass any IPA via hypercall. So this is here for a sanity check, to avoid dereferencing non-existing page.

If you want to support 42 bits, you would have to update the root-order (3rd field in pa_range_info) to 3. So the code will allocate the correct amount of root pages when the domain is created.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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