[PATCH 03/18] target/i386: limit a20 to system emulation

Paolo Bonzini posted 18 patches 1 week ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Riku Voipio <riku.voipio@iki.fi>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Laurent Vivier <laurent@vivier.eu>, Brian Cain <brian.cain@oss.qualcomm.com>, "Alex Bennée" <alex.bennee@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, Marcelo Tosatti <mtosatti@redhat.com>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>, Stafford Horne <shorne@gmail.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
[PATCH 03/18] target/i386: limit a20 to system emulation
Posted by Paolo Bonzini 1 week ago
It is not used by user-mode emulation and is the only caller of
cpu_interrupt() in qemu-i386 and qemu-x86_64.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/i386/helper.c b/target/i386/helper.c
index e0aaed3c4c4..651041ccfa6 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -110,6 +110,7 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env)
 /* x86 mmu */
 /* XXX: add PGE support */
 
+#ifndef CONFIG_USER_ONLY
 void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
 {
     CPUX86State *env = &cpu->env;
@@ -129,6 +130,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
         env->a20_mask = ~(1 << 20) | (a20_state << 20);
     }
 }
+#endif
 
 void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0)
 {
-- 
2.51.0
Re: [PATCH 03/18] target/i386: limit a20 to system emulation
Posted by Igor Mammedov 4 days, 14 hours ago
On Fri, 29 Aug 2025 17:28:54 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> It is not used by user-mode emulation and is the only caller of
> cpu_interrupt() in qemu-i386 and qemu-x86_64.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  target/i386/helper.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index e0aaed3c4c4..651041ccfa6 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -110,6 +110,7 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env)
>  /* x86 mmu */
>  /* XXX: add PGE support */
>  
> +#ifndef CONFIG_USER_ONLY
>  void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>  {
>      CPUX86State *env = &cpu->env;
> @@ -129,6 +130,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>          env->a20_mask = ~(1 << 20) | (a20_state << 20);
>      }
>  }
> +#endif
>  
>  void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0)
>  {
Re: [PATCH 03/18] target/i386: limit a20 to system emulation
Posted by Philippe Mathieu-Daudé 4 days, 20 hours ago
On 29/8/25 17:28, Paolo Bonzini wrote:
> It is not used by user-mode emulation and is the only caller of
> cpu_interrupt() in qemu-i386 and qemu-x86_64.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/helper.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index e0aaed3c4c4..651041ccfa6 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -110,6 +110,7 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env)
>   /* x86 mmu */
>   /* XXX: add PGE support */
>   
> +#ifndef CONFIG_USER_ONLY
>   void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>   {
>       CPUX86State *env = &cpu->env;
> @@ -129,6 +130,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>           env->a20_mask = ~(1 << 20) | (a20_state << 20);
>       }
>   }
> +#endif

Directly move to target/i386/cpu-system.c?

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH 03/18] target/i386: limit a20 to system emulation
Posted by Richard Henderson 1 week ago
On 8/30/25 01:28, Paolo Bonzini wrote:
> It is not used by user-mode emulation and is the only caller of
> cpu_interrupt() in qemu-i386 and qemu-x86_64.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/helper.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index e0aaed3c4c4..651041ccfa6 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -110,6 +110,7 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env)
>   /* x86 mmu */
>   /* XXX: add PGE support */
>   
> +#ifndef CONFIG_USER_ONLY
>   void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>   {
>       CPUX86State *env = &cpu->env;
> @@ -129,6 +130,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>           env->a20_mask = ~(1 << 20) | (a20_state << 20);
>       }
>   }
> +#endif
>   
>   void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0)
>   {

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~