diff mbox series

[Xen-devel,1/7] xen/arm: Remove the variable dom0_11_mapping and open-code the value

Message ID 20180605171237.30601-2-julien.grall@arm.com
State Superseded
Headers show
Series xen/arm: Shrink down Xen on Arm | expand

Commit Message

Julien Grall June 5, 2018, 5:12 p.m. UTC
Dom0 (aka hardware domain on Arm) is always direct mapped. Rather than
using a global variable to store a const, directly open-code it or
replace the use with is_domain_direct_mapped(...) macros.

This will also help a follow-up patch to move all domain_build.c in
init.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/domain_build.c  | 4 +---
 xen/include/asm-arm/domain.h | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini June 12, 2018, 7:22 p.m. UTC | #1
On Tue, 5 Jun 2018, Julien Grall wrote:
> Dom0 (aka hardware domain on Arm) is always direct mapped. Rather than
> using a global variable to store a const, directly open-code it or
> replace the use with is_domain_direct_mapped(...) macros.
> 
> This will also help a follow-up patch to move all domain_build.c in
> init.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/domain_build.c  | 4 +---
>  xen/include/asm-arm/domain.h | 4 ++--
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 11cdf05091..3c414c7f73 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -28,8 +28,6 @@
>  static unsigned int __initdata opt_dom0_max_vcpus;
>  integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
>  
> -int dom0_11_mapping = 1;
> -
>  static u64 __initdata dom0_mem;
>  
>  static int __init parse_dom0_mem(const char *s)
> @@ -261,7 +259,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
>       * TODO: Implement memory bank allocation when DOM0 is not direct
>       * mapped
>       */
> -    BUG_ON(!dom0_11_mapping);
> +    BUG_ON(!is_domain_direct_mapped(d));
>  
>      printk("Allocating 1:1 mappings totalling %ldMB for dom0:\n",
>             /* Don't want format this as PRIpaddr (16 digit hex) */
> diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
> index 7ba6528a74..280c3951fd 100644
> --- a/xen/include/asm-arm/domain.h
> +++ b/xen/include/asm-arm/domain.h
> @@ -31,8 +31,8 @@ enum domain_type {
>  #define is_64bit_domain(d) (0)
>  #endif
>  
> -extern int dom0_11_mapping;
> -#define is_domain_direct_mapped(d) ((d) == hardware_domain && dom0_11_mapping)
> +/* The hardware domain has always its memory direct mapped. */
> +#define is_domain_direct_mapped(d) ((d) == hardware_domain)
>  
>  struct vtimer {
>          struct vcpu *v;
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 11cdf05091..3c414c7f73 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -28,8 +28,6 @@ 
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
-int dom0_11_mapping = 1;
-
 static u64 __initdata dom0_mem;
 
 static int __init parse_dom0_mem(const char *s)
@@ -261,7 +259,7 @@  static void allocate_memory(struct domain *d, struct kernel_info *kinfo)
      * TODO: Implement memory bank allocation when DOM0 is not direct
      * mapped
      */
-    BUG_ON(!dom0_11_mapping);
+    BUG_ON(!is_domain_direct_mapped(d));
 
     printk("Allocating 1:1 mappings totalling %ldMB for dom0:\n",
            /* Don't want format this as PRIpaddr (16 digit hex) */
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 7ba6528a74..280c3951fd 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -31,8 +31,8 @@  enum domain_type {
 #define is_64bit_domain(d) (0)
 #endif
 
-extern int dom0_11_mapping;
-#define is_domain_direct_mapped(d) ((d) == hardware_domain && dom0_11_mapping)
+/* The hardware domain has always its memory direct mapped. */
+#define is_domain_direct_mapped(d) ((d) == hardware_domain)
 
 struct vtimer {
         struct vcpu *v;