qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Roman Bolshakov <r.bolshakov@yadro.com>
To: Claudio Fontana <cfontana@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org, Cameron Esfahani <dirty@apple.com>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH 12/13] i386: hvf: Move mmio_buf into CPUX86State
Date: Thu, 11 Jun 2020 18:02:27 +0300	[thread overview]
Message-ID: <20200611150227.GA76007@SPB-NB-133.local> (raw)
In-Reply-To: <3101f615-e1c9-2cf4-7a7b-6e30c7942c53@suse.de>

On Thu, Jun 11, 2020 at 03:24:31PM +0200, Claudio Fontana wrote:
> On 6/4/20 8:27 PM, Paolo Bonzini wrote:
> > On 28/05/20 21:37, Roman Bolshakov wrote:
> >> There's no similar field in CPUX86State, but it's needed for MMIO traps.
> >>
> >> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> >> ---
> >>  target/i386/cpu.h         |  1 +
> >>  target/i386/hvf/hvf.c     |  5 +++++
> >>  target/i386/hvf/x86.h     |  1 -
> >>  target/i386/hvf/x86_emu.c | 12 ++++++------
> >>  4 files changed, 12 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> >> index 7e6566565a..be44e19154 100644
> >> --- a/target/i386/cpu.h
> >> +++ b/target/i386/cpu.h
> >> @@ -1593,6 +1593,7 @@ typedef struct CPUX86State {
> >>  #endif
> >>  #if defined(CONFIG_HVF)
> >>      hvf_lazy_flags hvf_lflags;
> >> +    void *hvf_mmio_buf;
> >>      HVFX86EmulatorState *hvf_emul;
> >>  #endif
> >>  
> >> diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> >> index 4cee496d71..57696c46c7 100644
> >> --- a/target/i386/hvf/hvf.c
> >> +++ b/target/i386/hvf/hvf.c
> >> @@ -533,7 +533,11 @@ void hvf_reset_vcpu(CPUState *cpu) {
> >>  
> >>  void hvf_vcpu_destroy(CPUState *cpu)
> >>  {
> >> +    X86CPU *x86_cpu = X86_CPU(cpu);
> >> +    CPUX86State *env = &x86_cpu->env;
> >> +
> >>      hv_return_t ret = hv_vcpu_destroy((hv_vcpuid_t)cpu->hvf_fd);
> >> +    g_free(env->hvf_mmio_buf);
> >>      assert_hvf_ok(ret);
> >>  }
> >>  
> >> @@ -563,6 +567,7 @@ int hvf_init_vcpu(CPUState *cpu)
> >>      init_decoder();
> >>  
> >>      hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
> >> +    env->hvf_mmio_buf = g_new(char, 4096);
> >>      env->hvf_emul = g_new0(HVFX86EmulatorState, 1);
> >>  
> >>      r = hv_vcpu_create((hv_vcpuid_t *)&cpu->hvf_fd, HV_VCPU_DEFAULT);
> >> diff --git a/target/i386/hvf/x86.h b/target/i386/hvf/x86.h
> >> index 2363616c07..483fcea762 100644
> >> --- a/target/i386/hvf/x86.h
> >> +++ b/target/i386/hvf/x86.h
> >> @@ -230,7 +230,6 @@ typedef struct x68_segment_selector {
> >>  
> >>  /* Definition of hvf_x86_state is here */
> >>  struct HVFX86EmulatorState {
> >> -    uint8_t mmio_buf[4096];
> >>  };
> >>  
> >>  /* useful register access  macros */
> >> diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c
> >> index 1ad2c30e16..d3e289ed87 100644
> >> --- a/target/i386/hvf/x86_emu.c
> >> +++ b/target/i386/hvf/x86_emu.c
> >> @@ -187,8 +187,8 @@ void write_val_ext(struct CPUX86State *env, target_ulong ptr, target_ulong val,
> >>  
> >>  uint8_t *read_mmio(struct CPUX86State *env, target_ulong ptr, int bytes)
> >>  {
> >> -    vmx_read_mem(env_cpu(env), env->hvf_emul->mmio_buf, ptr, bytes);
> >> -    return env->hvf_emul->mmio_buf;
> >> +    vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, ptr, bytes);
> >> +    return env->hvf_mmio_buf;
> >>  }
> >>  
> >>  
> >> @@ -489,9 +489,9 @@ static void exec_ins_single(struct CPUX86State *env, struct x86_decode *decode)
> >>      target_ulong addr = linear_addr_size(env_cpu(env), RDI(env),
> >>                                           decode->addressing_size, R_ES);
> >>  
> >> -    hvf_handle_io(env_cpu(env), DX(env), env->hvf_emul->mmio_buf, 0,
> >> +    hvf_handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 0,
> >>                    decode->operand_size, 1);
> >> -    vmx_write_mem(env_cpu(env), addr, env->hvf_emul->mmio_buf,
> >> +    vmx_write_mem(env_cpu(env), addr, env->hvf_mmio_buf,
> >>                    decode->operand_size);
> >>  
> >>      string_increment_reg(env, R_EDI, decode);
> >> @@ -512,9 +512,9 @@ static void exec_outs_single(struct CPUX86State *env, struct x86_decode *decode)
> >>  {
> >>      target_ulong addr = decode_linear_addr(env, decode, RSI(env), R_DS);
> >>  
> >> -    vmx_read_mem(env_cpu(env), env->hvf_emul->mmio_buf, addr,
> >> +    vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, addr,
> >>                   decode->operand_size);
> >> -    hvf_handle_io(env_cpu(env), DX(env), env->hvf_emul->mmio_buf, 1,
> >> +    hvf_handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 1,
> >>                    decode->operand_size, 1);
> >>  
> >>      string_increment_reg(env, R_ESI, decode);
> >>
> > 
> > It should be possible to get rid of the buffer altogether, but it's ok
> > to do it separately.
> > 
> > I queued the series, thanks.
> > 
> > Paolo
> > 
> > 
> 
> Thanks Paolo, I am waiting for this (and maybe another series from Roman) to be able to do the cpus refactoring.
> 
> Incidentally, would it not be great to have some machinery that automatically tracks which series is already queued where?
> Maybe there is already a mechanism I am unaware of?
> 
> Ciao,
> 
> Claudio

Hi Claudio,

I also had the same question earlier today on IRC but I've just recalled
that PULL requests typically have a reference to the queue repo/branch:

https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg06825.html

I'll rebase on it and prepare the series.

Regards,
Roman


  reply	other threads:[~2020-06-11 15:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 19:37 [PATCH 00/13] i386: hvf: Remove HVFX86EmulatorState Roman Bolshakov
2020-05-28 19:37 ` [PATCH 01/13] i386: hvf: Move HVFState definition into hvf Roman Bolshakov
2020-06-05 14:19   ` Claudio Fontana
2020-05-28 19:37 ` [PATCH 02/13] i386: hvf: Drop useless declarations in sysemu Roman Bolshakov
2020-06-04  6:35   ` Philippe Mathieu-Daudé
2020-06-04  9:53   ` Claudio Fontana
2020-06-05 16:30     ` Roman Bolshakov
2020-05-28 19:37 ` [PATCH 03/13] i386: hvf: Clean stray includes " Roman Bolshakov
2020-06-05 14:20   ` Claudio Fontana
2020-05-28 19:37 ` [PATCH 04/13] i386: hvf: Drop unused variable Roman Bolshakov
2020-06-04  6:35   ` Philippe Mathieu-Daudé
2020-05-28 19:37 ` [PATCH 05/13] i386: hvf: Use ins_len to advance IP Roman Bolshakov
2020-06-04  6:39   ` Philippe Mathieu-Daudé
2020-06-04 18:15     ` Paolo Bonzini
2020-06-05 14:29       ` Philippe Mathieu-Daudé
2020-05-28 19:37 ` [PATCH 06/13] i386: hvf: Use IP from CPUX86State Roman Bolshakov
2020-06-04  6:47   ` Philippe Mathieu-Daudé
2020-06-04  9:06   ` Claudio Fontana
2020-05-28 19:37 ` [PATCH 07/13] i386: hvf: Drop fetch_rip from HVFX86EmulatorState Roman Bolshakov
2020-05-28 19:37 ` [PATCH 08/13] i386: hvf: Drop rflags " Roman Bolshakov
2020-05-28 19:37 ` [PATCH 09/13] i386: hvf: Drop copy of RFLAGS defines Roman Bolshakov
2020-05-28 19:37 ` [PATCH 10/13] i386: hvf: Drop regs in HVFX86EmulatorState Roman Bolshakov
2020-05-28 19:37 ` [PATCH 11/13] i386: hvf: Move lazy_flags into CPUX86State Roman Bolshakov
2020-06-04  6:43   ` Philippe Mathieu-Daudé
2020-05-28 19:37 ` [PATCH 12/13] i386: hvf: Move mmio_buf " Roman Bolshakov
2020-06-04 18:27   ` Paolo Bonzini
2020-06-05 17:24     ` Roman Bolshakov
2020-06-11 13:24     ` Claudio Fontana
2020-06-11 15:02       ` Roman Bolshakov [this message]
2020-05-28 19:37 ` [PATCH 13/13] i386: hvf: Drop HVFX86EmulatorState Roman Bolshakov
2020-05-29  2:57 ` [PATCH 00/13] i386: hvf: Remove HVFX86EmulatorState no-reply
2020-06-04  1:53 ` Cameron Esfahani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611150227.GA76007@SPB-NB-133.local \
    --to=r.bolshakov@yadro.com \
    --cc=cfontana@suse.de \
    --cc=dirty@apple.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).