Skip to contentSkip to conversation

xen/arm: domain_build: introduce dom0_lowmem bootargs

RFC In review Peng Fan 2 participants 6 messages Sep 13, 2016 – Sep 14, 2016

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

RFC 1/1 xen/arm: domain_build: introduce dom0_lowmem bootargs

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

 xen/arch/arm/domain_build.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +29 -1
index 35ab08d..0f53bba 100644
@@ -33,6 +33,8 @@ int dom0_11_mapping = 1;
 
 #define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
 static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
+/* Only for AArch64 */
+static u64 __initdata dom0_lowmem;
 
 static void __init parse_dom0_mem(const char *s)
 {
@@ -42,6 +44,12 @@ static void __init parse_dom0_mem(const char *s)
 }
 custom_param("dom0_mem", parse_dom0_mem);
 
+static void __init parse_dom0_lowmem(const char *s)
+{
+    dom0_lowmem = parse_size_and_unit(s, &s);
+}
+custom_param("dom0_lowmem", parse_dom0_lowmem);
+
 //#define DEBUG_11_ALLOCATION
 #ifdef DEBUG_11_ALLOCATION
 # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
@@ -244,7 +252,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
     unsigned int order = get_11_allocation_size(kinfo->unassigned_mem);
     int i;
 
-    bool_t lowmem = is_32bit_domain(d);
+    bool_t lowmem = is_32bit_domain(d) || !!dom0_lowmem;
     unsigned int bits;
 
     /*
@@ -263,6 +271,9 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
      * First try and allocate the largest thing we can as low as
      * possible to be bank 0.
      */
+    if ( dom0_lowmem )
+        order = get_order_from_bytes(dom0_lowmem);
+
     while ( order >= min_low_order )
     {
         for ( bits = order ; bits <= (lowmem ? 32 : PADDR_BITS); bits++ )
@@ -278,6 +289,11 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
 
  got_bank0:
 
+    if ( dom0_lowmem ) {
+        dom0_lowmem -= pfn_to_paddr((1 << order));
+        lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+    }
+
     if ( !insert_11_bank(d, kinfo, pg, order) )
         BUG(); /* Cannot fail for first bank */
 
@@ -325,6 +341,16 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
             }
         }
 
+        if ( dom0_lowmem && lowmem )
+        {
+            dom0_lowmem -= pfn_to_paddr((1 << order));
+            lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+        }
+	else
+        {
+            lowmem = false;
+        }
+
         /*
          * Success, next time around try again to get the largest order
          * allocation possible.
@@ -2098,6 +2124,8 @@ int construct_dom0(struct domain *d)
 
     d->max_pages = ~0U;
 
+    BUG_ON(dom0_mem < dom0_lowmem);
+
     kinfo.unassigned_mem = dom0_mem;
 
     rc = kernel_probe(&kinfo);
Signature · 7 lines
2.6.6


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

Hello Peng,

Quoted 18 lines · Peng Fan

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Quoted 6 lines

---

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

Please test any patch send upstream on 4.8-unstable. The code may have changed.

Quoted 5 lines

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

Why? IPs passthrough to DomU will have to be protected by an SMMU so it does not matter whether Dom0 is using all the lowmem or not.

Regards,

Quoted 88 lines
 xen/arch/arm/domain_build.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +29 -1
index 35ab08d..0f53bba 100644
@@ -33,6 +33,8 @@ int dom0_11_mapping = 1;
 
 #define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
 static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
+/* Only for AArch64 */
+static u64 __initdata dom0_lowmem;
 
 static void __init parse_dom0_mem(const char *s)
 {
@@ -42,6 +44,12 @@ static void __init parse_dom0_mem(const char *s)
 }
 custom_param("dom0_mem", parse_dom0_mem);
 
+static void __init parse_dom0_lowmem(const char *s)
+{
+    dom0_lowmem = parse_size_and_unit(s, &s);
+}
+custom_param("dom0_lowmem", parse_dom0_lowmem);
+
 //#define DEBUG_11_ALLOCATION
 #ifdef DEBUG_11_ALLOCATION
 # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
@@ -244,7 +252,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
     unsigned int order = get_11_allocation_size(kinfo->unassigned_mem);
     int i;
 
-    bool_t lowmem = is_32bit_domain(d);
+    bool_t lowmem = is_32bit_domain(d) || !!dom0_lowmem;
     unsigned int bits;
 
     /*
@@ -263,6 +271,9 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
      * First try and allocate the largest thing we can as low as
      * possible to be bank 0.
      */
+    if ( dom0_lowmem )
+        order = get_order_from_bytes(dom0_lowmem);
+
     while ( order >= min_low_order )
     {
         for ( bits = order ; bits <= (lowmem ? 32 : PADDR_BITS); bits++ )
@@ -278,6 +289,11 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
 
  got_bank0:
 
+    if ( dom0_lowmem ) {
+        dom0_lowmem -= pfn_to_paddr((1 << order));
+        lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+    }
+
     if ( !insert_11_bank(d, kinfo, pg, order) )
         BUG(); /* Cannot fail for first bank */
 
@@ -325,6 +341,16 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
             }
         }
 
+        if ( dom0_lowmem && lowmem )
+        {
+            dom0_lowmem -= pfn_to_paddr((1 << order));
+            lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+        }
+	else
+        {
+            lowmem = false;
+        }
+
         /*
          * Success, next time around try again to get the largest order
          * allocation possible.
@@ -2098,6 +2124,8 @@ int construct_dom0(struct domain *d)
 
     d->max_pages = ~0U;
 
+    BUG_ON(dom0_mem < dom0_lowmem);
+
     kinfo.unassigned_mem = dom0_mem;
 
     rc = kernel_probe(&kinfo);
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#2 lore raw

Hi Julien,

Quoted 23 lines · Julien Grall

Hello Peng,

Quoted 20 lines · Peng Fan

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

Quoted 7 lines
Quoted 4 lines

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

Please test any patch send upstream on 4.8-unstable. The code may have changed.

I have rebase this patch based on 4.8-unstable.
latest commit:
"
commit a3fe74e4345e66ddb7aa514395260a5e5f8b0cdc

Author: Tamas K Lengyel <[email protected]>
Date:   Mon Aug 1 11:59:14 2016 -0600

arm/vm_event: get/set registers
"

Since I have not rebased my platform patches to 4.8-unstable, so have not tested.

Please kindly comments whether introudcing "dom0_lowmem" is acceptable or not
to resolve the issue I met in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html.

I'll rebase my platform patches and do some test.

Quoted 9 lines
Quoted 6 lines

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

Why? IPs passthrough to DomU will have to be protected by an SMMU so it does not matter whether Dom0 is using all the lowmem or not.

I just think there maybe some cases that some physical memory need to be reserved for DomU usage.
SMMU is not a must when we passthrough a non DMA capable device to DomU. So I think an DRAM area can be encoded in dts, and passthrough to DomU.

Thanks,
Peng.

Quoted 83 lines

Regards,

Quoted 80 lines

xen/arch/arm/domain_build.c | 30 +++++++++++++++++++++++++++++-

1 file changed, 29 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +27 -1
index 35ab08d..0f53bba 100644
@@ -33,6 +33,8 @@ int dom0_11_mapping = 1;
 
 #define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
 static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
+/* Only for AArch64 */
+static u64 __initdata dom0_lowmem;
 
 static void __init parse_dom0_mem(const char *s)
 {
@@ -42,6 +44,12 @@ static void __init parse_dom0_mem(const char *s)
 }
 custom_param("dom0_mem", parse_dom0_mem);
 
+static void __init parse_dom0_lowmem(const char *s)
+{
+    dom0_lowmem = parse_size_and_unit(s, &s);
+}
+custom_param("dom0_lowmem", parse_dom0_lowmem);
+
 //#define DEBUG_11_ALLOCATION
 #ifdef DEBUG_11_ALLOCATION
 # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
@@ -244,7 +252,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
    unsigned int order = get_11_allocation_size(kinfo->unassigned_mem);
    int i;
 
-    bool_t lowmem = is_32bit_domain(d);
+    bool_t lowmem = is_32bit_domain(d) || !!dom0_lowmem;
    unsigned int bits;
 
    /*
@@ -263,6 +271,9 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
     * First try and allocate the largest thing we can as low as
     * possible to be bank 0.
     */
+    if ( dom0_lowmem )
+        order = get_order_from_bytes(dom0_lowmem);
+
    while ( order >= min_low_order )
    {
        for ( bits = order ; bits <= (lowmem ? 32 : PADDR_BITS); bits++ )
@@ -278,6 +289,11 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
 
 got_bank0:
 
+    if ( dom0_lowmem ) {
+        dom0_lowmem -= pfn_to_paddr((1 << order));
+        lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+    }
+
    if ( !insert_11_bank(d, kinfo, pg, order) )
        BUG(); /* Cannot fail for first bank */
 
@@ -325,6 +341,16 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
            }
        }
 
+        if ( dom0_lowmem && lowmem )
+        {
+            dom0_lowmem -= pfn_to_paddr((1 << order));
+            lowmem = is_32bit_domain(d) || !!dom0_lowmem;
+        }
+	else
+        {
+            lowmem = false;
+        }
+
        /*
         * Success, next time around try again to get the largest order
         * allocation possible.
@@ -2098,6 +2124,8 @@ int construct_dom0(struct domain *d)
 
Quoted 11 lines
Quoted 8 lines
xen/arch/arm/domain_build.c +2 -0
    d->max_pages = ~0U;
 
+    BUG_ON(dom0_mem < dom0_lowmem);
+
    kinfo.unassigned_mem = dom0_mem;
 
    rc = kernel_probe(&kinfo);
Signature · 1 line
Julien Grall

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

#3 lore raw
Quoted 57 lines · Peng Fan

Hi Julien,

Quoted 23 lines · Julien Grall

Hello Peng,

Quoted 20 lines · Peng Fan

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

Quoted 7 lines
Quoted 4 lines

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

Please test any patch send upstream on 4.8-unstable. The code may have changed.

I have rebase this patch based on 4.8-unstable.
latest commit:
"
commit a3fe74e4345e66ddb7aa514395260a5e5f8b0cdc

Author: Tamas K Lengyel <[email protected]>
Date:   Mon Aug 1 11:59:14 2016 -0600

arm/vm_event: get/set registers
"

Since I have not rebased my platform patches to 4.8-unstable, so have not tested.

Please kindly comments whether introudcing "dom0_lowmem" is acceptable or not
to resolve the issue I met in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html.

I'll rebase my platform patches and do some test.

Quoted 7 lines
Quoted 6 lines

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

Quoted 7 lines
Quoted 2 lines

Why? IPs passthrough to DomU will have to be protected by an SMMU so it does not matter whether Dom0 is using all the lowmem or not.

I just think there maybe some cases that some physical memory need to be reserved for DomU usage.
SMMU is not a must when we passthrough a non DMA capable device to DomU. So I think an DRAM area can be encoded in dts, and passthrough to DomU.

How do you make sure that DomU will program the device with the correct address? A malicious DomU could decide to use a physical address belonging to another DomU or even Xen and would be able to read/write on it.

So if a device needs to access the physical memory it either needs to be protected by an SMMU or Xen/DOM0 is programming the device on behalf of the guest. All other solutions are IHMO unsafe.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#4 lore raw
Quoted 63 lines · Julien Grall
Quoted 60 lines · Peng Fan

Hi Julien,

Quoted 23 lines · Julien Grall

Hello Peng,

Quoted 20 lines · Peng Fan

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

Quoted 7 lines
Quoted 4 lines

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

Please test any patch send upstream on 4.8-unstable. The code may have changed.

I have rebase this patch based on 4.8-unstable.
latest commit:
"
commit a3fe74e4345e66ddb7aa514395260a5e5f8b0cdc

Author: Tamas K Lengyel <[email protected]>
Date:   Mon Aug 1 11:59:14 2016 -0600

arm/vm_event: get/set registers
"

Since I have not rebased my platform patches to 4.8-unstable, so have not tested.

Please kindly comments whether introudcing "dom0_lowmem" is acceptable or not
to resolve the issue I met in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html.

I'll rebase my platform patches and do some test.

Quoted 9 lines
Quoted 6 lines

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

Why? IPs passthrough to DomU will have to be protected by an SMMU so it does not matter whether Dom0 is using all the lowmem or not.

Quoted 8 lines
Quoted 4 lines

I just think there maybe some cases that some physical memory need to be reserved for DomU usage.
SMMU is not a must when we passthrough a non DMA capable device to DomU. So I think an DRAM area can be encoded in dts, and passthrough to DomU.

How do you make sure that DomU will program the device with the correct address? A malicious DomU could decide to use a physical address belonging to another DomU or even Xen and would be able to read/write on it.

When I debug DomU, I use a uart port as an early console for DomU. I just marked the uart with xen,passthrough and status disabled in Dom0 dts, then in DomU dts, I create a uart node, and in xl cfg, I mapped the address space. I did not use SMMU here. Just mapped the uart physical address to DomU uart guest physical address. And DomU can access the uart for my debug usage.

Quoted 4 lines

So if a device needs to access the physical memory it either needs to be protected by an SMMU or Xen/DOM0 is programming the device on behalf of the guest. All other solutions are IHMO unsafe.

My understanding about reserve lowmem for DomU maybe not that correct. I'll test this patch based on 4.8 and send out V2 later.

Thanks,
Peng.

Quoted 5 lines

Regards,

Signature · 1 line
Julien Grall

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

#5 lore raw

Hello Peng,

Quoted 73 lines · Peng Fan
Quoted 63 lines · Julien Grall
Quoted 60 lines · Peng Fan

Hi Julien,

Quoted 23 lines · Julien Grall

Hello Peng,

Quoted 20 lines · Peng Fan

On AArch64 SoCs, some IPs may only have the capability to access 32bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly.

Introduce dom0_lowmem bootargs, user could pass "dom0_lowmem=xx" to xen. It means how much memory user would like to be allocated in lower 4GB memory space. If there is not enough memory for dom0_lowmem, higher memory will be allocated.

Thinking such a memory layout on an AArch64 SoC:
Region 0: 2GB(0x80000000 - 0xffffffff)
Region 1: 4GB(0x880000000 - 0x97fffffff)
If user would like to assign 2GB for Dom0 and 1GB of the 2GB memory in Region 0, user could pass "dom0=2048M dom0_lowmem=1024M" to xen.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

Quoted 7 lines
Quoted 4 lines

This patch is to resolve the issue mentioned in
https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html
This patch not tested on latest 4.8-unstable, I only tested similar patch on xen 4.7 on AArch64 platform.

Please test any patch send upstream on 4.8-unstable. The code may have changed.

I have rebase this patch based on 4.8-unstable.
latest commit:
"
commit a3fe74e4345e66ddb7aa514395260a5e5f8b0cdc

Author: Tamas K Lengyel <[email protected]>
Date:   Mon Aug 1 11:59:14 2016 -0600

arm/vm_event: get/set registers
"

Since I have not rebased my platform patches to 4.8-unstable, so have not tested.

Please kindly comments whether introudcing "dom0_lowmem" is acceptable or not
to resolve the issue I met in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html.

I'll rebase my platform patches and do some test.

Quoted 9 lines
Quoted 6 lines

The idea of patch is that user could specify the lowmem that user would
like to use. I rethought the ideas in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00487.html,
but that is not good. lowmem is precise, it maybe used for some IPs that maybe passthrough to DomU, so we only allocate the needed memory for Dom0.

Why? IPs passthrough to DomU will have to be protected by an SMMU so it does not matter whether Dom0 is using all the lowmem or not.

Quoted 8 lines
Quoted 4 lines

I just think there maybe some cases that some physical memory need to be reserved for DomU usage.
SMMU is not a must when we passthrough a non DMA capable device to DomU. So I think an DRAM area can be encoded in dts, and passthrough to DomU.

How do you make sure that DomU will program the device with the correct address? A malicious DomU could decide to use a physical address belonging to another DomU or even Xen and would be able to read/write on it.

Quoted 6 lines

When I debug DomU, I use a uart port as an early console for DomU. I just marked the uart with xen,passthrough and status disabled in Dom0 dts, then in DomU dts, I create a uart node, and in xl cfg, I mapped the address space. I did not use SMMU here. Just mapped the uart physical address to DomU uart guest physical address. And DomU can access the uart for my debug usage.

That's a different use case which does not involve UART reading directly the memory. Hence, there is no obligation to allocate lowmem for DomU.

Regards,

Signature · 6 lines
Julien Grall

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