diff mbox series

[v2,3/5] xen: Rename CONFIG_DOMAIN_PAGE to CONFIG_ARCH_MAP_DOMAIN_PAGE and...

Message ID 20220720184459.51582-4-julien@xen.org (mailing list archive)
State New, archived
Headers show
Series xen/arm: mm: Bunch of clean-ups | expand

Commit Message

Julien Grall July 20, 2022, 6:44 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

move it to Kconfig.

The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
helpers to map/unmap a domain page. Rename it to the define to
CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that this will not remove
support for domain page (this is not a concept that Xen can't get
away with).

Take the opportunity to move CONFIG_MAP_DOMAIN_PAGE to Kconfig as this
will soon be necessary to use it in the Makefile.

Signed-off-by: Julien Grall <jgrall@amazon.com>

----
    Changes in v2:
        - New patch
---
 xen/arch/arm/Kconfig              | 1 +
 xen/arch/arm/include/asm/config.h | 1 -
 xen/arch/arm/mm.c                 | 2 +-
 xen/arch/x86/Kconfig              | 1 +
 xen/arch/x86/include/asm/config.h | 1 -
 xen/common/Kconfig                | 3 +++
 xen/include/xen/domain_page.h     | 6 +++---
 7 files changed, 9 insertions(+), 6 deletions(-)

Comments

Bertrand Marquis July 21, 2022, 8:40 a.m. UTC | #1
Hi Julien,


> On 20 Jul 2022, at 19:44, Julien Grall <julien@xen.org> wrote:
> 
> From: Julien Grall <jgrall@amazon.com>
> 
> move it to Kconfig.
> 
> The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
> helpers to map/unmap a domain page. Rename it to the define to

Maybe “the define to” can be removed in this sentence or it needs some rephrasing.

> CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that this will not remove
> support for domain page (this is not a concept that Xen can't get
> away with).
> 
> Take the opportunity to move CONFIG_MAP_DOMAIN_PAGE to Kconfig as this
> will soon be necessary to use it in the Makefile.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

With this fixed:
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> #arm part

Cheers
Bertrand

> 
> ----
>    Changes in v2:
>        - New patch
> ---
> xen/arch/arm/Kconfig              | 1 +
> xen/arch/arm/include/asm/config.h | 1 -
> xen/arch/arm/mm.c                 | 2 +-
> xen/arch/x86/Kconfig              | 1 +
> xen/arch/x86/include/asm/config.h | 1 -
> xen/common/Kconfig                | 3 +++
> xen/include/xen/domain_page.h     | 6 +++---
> 7 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index be9eff014120..33e004d702bf 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -1,6 +1,7 @@
> config ARM_32
> 	def_bool y
> 	depends on "$(ARCH)" = "arm32"
> +	select ARCH_MAP_DOMAIN_PAGE
> 
> config ARM_64
> 	def_bool y
> diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
> index 66db618b34e7..2fafb9f2283c 100644
> --- a/xen/arch/arm/include/asm/config.h
> +++ b/xen/arch/arm/include/asm/config.h
> @@ -122,7 +122,6 @@
> 
> #ifdef CONFIG_ARM_32
> 
> -#define CONFIG_DOMAIN_PAGE 1
> #define CONFIG_SEPARATE_XENHEAP 1
> 
> #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 9311f3530066..7a722d6c86c6 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -371,7 +371,7 @@ void clear_fixmap(unsigned int map)
>     BUG_ON(res != 0);
> }
> 
> -#ifdef CONFIG_DOMAIN_PAGE
> +#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
> /*
>  * Prepare the area that will be used to map domheap pages. They are
>  * mapped in 2MB chunks, so we need to allocate the page-tables up to
> diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
> index 6bed72b79141..6a7825f4ba3c 100644
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -8,6 +8,7 @@ config X86
> 	select ACPI_LEGACY_TABLES_LOOKUP
> 	select ACPI_NUMA
> 	select ALTERNATIVE_CALL
> +	select ARCH_MAP_DOMAIN_PAGE
> 	select ARCH_SUPPORTS_INT128
> 	select CORE_PARKING
> 	select HAS_ALTERNATIVE
> diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
> index 07bcd158314b..fbc4bb3416bd 100644
> --- a/xen/arch/x86/include/asm/config.h
> +++ b/xen/arch/x86/include/asm/config.h
> @@ -22,7 +22,6 @@
> #define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 1
> #define CONFIG_DISCONTIGMEM 1
> #define CONFIG_NUMA_EMU 1
> -#define CONFIG_DOMAIN_PAGE 1
> 
> #define CONFIG_PAGEALLOC_MAX_ORDER (2 * PAGETABLE_ORDER)
> #define CONFIG_DOMU_MAX_ORDER      PAGETABLE_ORDER
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index 41a67891bcc8..f1ea3199c8eb 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -25,6 +25,9 @@ config GRANT_TABLE
> config ALTERNATIVE_CALL
> 	bool
> 
> +config ARCH_MAP_DOMAIN_PAGE
> +	bool
> +
> config HAS_ALTERNATIVE
> 	bool
> 
> diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
> index a182d33b6701..149b217b9619 100644
> --- a/xen/include/xen/domain_page.h
> +++ b/xen/include/xen/domain_page.h
> @@ -17,7 +17,7 @@
> void clear_domain_page(mfn_t mfn);
> void copy_domain_page(mfn_t dst, const mfn_t src);
> 
> -#ifdef CONFIG_DOMAIN_PAGE
> +#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
> 
> /*
>  * Map a given page frame, returning the mapped virtual address. The page is
> @@ -51,7 +51,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)
>     return map_domain_page_global(page_to_mfn(pg));
> }
> 
> -#else /* !CONFIG_DOMAIN_PAGE */
> +#else /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
> 
> #define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
> #define __map_domain_page(pg)               page_to_virt(pg)
> @@ -70,7 +70,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)
> 
> static inline void unmap_domain_page_global(const void *va) {};
> 
> -#endif /* !CONFIG_DOMAIN_PAGE */
> +#endif /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
> 
> #define UNMAP_DOMAIN_PAGE(p) do {   \
>     unmap_domain_page(p);           \
> -- 
> 2.32.0
>
Jan Beulich July 25, 2022, 3:51 p.m. UTC | #2
On 20.07.2022 20:44, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> move it to Kconfig.
> 
> The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
> helpers to map/unmap a domain page. Rename it to the define to
> CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that this will not remove
> support for domain page (this is not a concept that Xen can't get
> away with).

Especially the part in parentheses reads odd, if not backwards.

> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -371,7 +371,7 @@ void clear_fixmap(unsigned int map)
>      BUG_ON(res != 0);
>  }
>  
> -#ifdef CONFIG_DOMAIN_PAGE
> +#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
>  /*
>   * Prepare the area that will be used to map domheap pages. They are
>   * mapped in 2MB chunks, so we need to allocate the page-tables up to

What about the other #ifdef in build_assertions()? With that also
converted (and preferably with the description adjusted)
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Julien Grall July 29, 2022, 9:53 p.m. UTC | #3
Hi Jan,

On 25/07/2022 16:51, Jan Beulich wrote:
> On 20.07.2022 20:44, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> move it to Kconfig.
>>
>> The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
>> helpers to map/unmap a domain page. Rename it to the define to
>> CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that this will not remove
>> support for domain page (this is not a concept that Xen can't get
>> away with).
> 
> Especially the part in parentheses reads odd, if not backwards.

Indeed. I tweaked the sentence to:

Rename it to CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that support 
for domain page is not something that can be disabled in Xen.

> 
>> --- a/xen/arch/arm/mm.c
>> +++ b/xen/arch/arm/mm.c
>> @@ -371,7 +371,7 @@ void clear_fixmap(unsigned int map)
>>       BUG_ON(res != 0);
>>   }
>>   
>> -#ifdef CONFIG_DOMAIN_PAGE
>> +#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
>>   /*
>>    * Prepare the area that will be used to map domheap pages. They are
>>    * mapped in 2MB chunks, so we need to allocate the page-tables up to
> 
> What about the other #ifdef in build_assertions()? With that also
> converted (and preferably with the description adjusted)

Good catch. I update the patch.

> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks for the review!

Cheers,
Julien Grall July 29, 2022, 9:54 p.m. UTC | #4
On 21/07/2022 09:40, Bertrand Marquis wrote:
> Hi Julien,

Hi Bertrand,

>> On 20 Jul 2022, at 19:44, Julien Grall <julien@xen.org> wrote:
>>
>> From: Julien Grall <jgrall@amazon.com>
>>
>> move it to Kconfig.
>>
>> The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
>> helpers to map/unmap a domain page. Rename it to the define to
> 
> Maybe “the define to” can be removed in this sentence or it needs some rephrasing.

I have removed "the define to".

> 
>> CONFIG_ARCH_MAP_DOMAIN_PAGE so it is clearer that this will not remove
>> support for domain page (this is not a concept that Xen can't get
>> away with).
>>
>> Take the opportunity to move CONFIG_MAP_DOMAIN_PAGE to Kconfig as this
>> will soon be necessary to use it in the Makefile.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
> 
> With this fixed:
> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> #arm part

Thanks!

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index be9eff014120..33e004d702bf 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -1,6 +1,7 @@ 
 config ARM_32
 	def_bool y
 	depends on "$(ARCH)" = "arm32"
+	select ARCH_MAP_DOMAIN_PAGE
 
 config ARM_64
 	def_bool y
diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 66db618b34e7..2fafb9f2283c 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -122,7 +122,6 @@ 
 
 #ifdef CONFIG_ARM_32
 
-#define CONFIG_DOMAIN_PAGE 1
 #define CONFIG_SEPARATE_XENHEAP 1
 
 #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 9311f3530066..7a722d6c86c6 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -371,7 +371,7 @@  void clear_fixmap(unsigned int map)
     BUG_ON(res != 0);
 }
 
-#ifdef CONFIG_DOMAIN_PAGE
+#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
 /*
  * Prepare the area that will be used to map domheap pages. They are
  * mapped in 2MB chunks, so we need to allocate the page-tables up to
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6bed72b79141..6a7825f4ba3c 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -8,6 +8,7 @@  config X86
 	select ACPI_LEGACY_TABLES_LOOKUP
 	select ACPI_NUMA
 	select ALTERNATIVE_CALL
+	select ARCH_MAP_DOMAIN_PAGE
 	select ARCH_SUPPORTS_INT128
 	select CORE_PARKING
 	select HAS_ALTERNATIVE
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 07bcd158314b..fbc4bb3416bd 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -22,7 +22,6 @@ 
 #define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 1
 #define CONFIG_DISCONTIGMEM 1
 #define CONFIG_NUMA_EMU 1
-#define CONFIG_DOMAIN_PAGE 1
 
 #define CONFIG_PAGEALLOC_MAX_ORDER (2 * PAGETABLE_ORDER)
 #define CONFIG_DOMU_MAX_ORDER      PAGETABLE_ORDER
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 41a67891bcc8..f1ea3199c8eb 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -25,6 +25,9 @@  config GRANT_TABLE
 config ALTERNATIVE_CALL
 	bool
 
+config ARCH_MAP_DOMAIN_PAGE
+	bool
+
 config HAS_ALTERNATIVE
 	bool
 
diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
index a182d33b6701..149b217b9619 100644
--- a/xen/include/xen/domain_page.h
+++ b/xen/include/xen/domain_page.h
@@ -17,7 +17,7 @@ 
 void clear_domain_page(mfn_t mfn);
 void copy_domain_page(mfn_t dst, const mfn_t src);
 
-#ifdef CONFIG_DOMAIN_PAGE
+#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
 
 /*
  * Map a given page frame, returning the mapped virtual address. The page is
@@ -51,7 +51,7 @@  static inline void *__map_domain_page_global(const struct page_info *pg)
     return map_domain_page_global(page_to_mfn(pg));
 }
 
-#else /* !CONFIG_DOMAIN_PAGE */
+#else /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
 
 #define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
 #define __map_domain_page(pg)               page_to_virt(pg)
@@ -70,7 +70,7 @@  static inline void *__map_domain_page_global(const struct page_info *pg)
 
 static inline void unmap_domain_page_global(const void *va) {};
 
-#endif /* !CONFIG_DOMAIN_PAGE */
+#endif /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
 
 #define UNMAP_DOMAIN_PAGE(p) do {   \
     unmap_domain_page(p);           \