diff mbox series

[RFC,09/14] exec/cpu: Restrict user-specific page definitions

Message ID 20240427155714.53669-10-philmd@linaro.org
State New
Headers show
Series exec: Rework around CPUState user fields | expand

Commit Message

Philippe Mathieu-Daudé April 27, 2024, 3:57 p.m. UTC
User-specific PAGE definitions shouldn't be used on system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/page-prot-common.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Richard Henderson April 28, 2024, 6:31 p.m. UTC | #1
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote:
> User-specific PAGE definitions shouldn't be used on system emulation.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/page-prot-common.h | 8 ++++++++
>   1 file changed, 8 insertions(+)

Come to that, PAGE_WRITE_INV is system only.

Does this clarify or simply spread ifdefs around?
They aren't particularly common at this point...


r~
Philippe Mathieu-Daudé April 28, 2024, 8:11 p.m. UTC | #2
On 28/4/24 20:31, Richard Henderson wrote:
> On 4/27/24 08:57, Philippe Mathieu-Daudé wrote:
>> User-specific PAGE definitions shouldn't be used on system emulation.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/exec/page-prot-common.h | 8 ++++++++
>>   1 file changed, 8 insertions(+)
> 
> Come to that, PAGE_WRITE_INV is system only.
> 
> Does this clarify or simply spread ifdefs around?
> They aren't particularly common at this point...

OK, I removed this patch, renamed as "exec/page-protection.h"
in previous patch and added an entry in the "Overall TCG CPUs"
section in MAINTAINERS.
diff mbox series

Patch

diff --git a/include/exec/page-prot-common.h b/include/exec/page-prot-common.h
index 2722ded724..b1fce45c15 100644
--- a/include/exec/page-prot-common.h
+++ b/include/exec/page-prot-common.h
@@ -17,16 +17,22 @@ 
 /*
  * Original state of the write flag (used when tracking self-modifying code)
  */
+#if defined(CONFIG_USER_ONLY)
 #define PAGE_WRITE_ORG 0x0010
+#endif
 /*
  * Invalidate the TLB entry immediately, helpful for s390x
  * Low-Address-Protection. Used with PAGE_WRITE in tlb_set_page_with_attrs()
  */
 #define PAGE_WRITE_INV 0x0020
 /* For use with page_set_flags: page is being replaced; target_data cleared. */
+#if defined(CONFIG_USER_ONLY)
 #define PAGE_RESET     0x0040
+#endif
 /* For linux-user, indicates that the page is MAP_ANON. */
+#if defined(CONFIG_USER_ONLY)
 #define PAGE_ANON      0x0080
+#endif
 
 /* Target-specific bits that will be used via page_get_flags().  */
 #define PAGE_TARGET_1  0x0200
@@ -36,6 +42,8 @@ 
  * For linux-user, indicates that the page is mapped with the same semantics
  * in both guest and host.
  */
+#if defined(CONFIG_USER_ONLY)
 #define PAGE_PASSTHROUGH 0x0800
+#endif
 
 #endif