From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: qemu-devel@nongnu.org Cc: "Eduardo Habkost" <ehabkost@redhat.com>, "Cornelia Huck" <cohuck@redhat.com>, "Richard Henderson" <richard.henderson@linaro.org>, "Sunil Muthuswamy" <sunilmut@microsoft.com>, "Marcelo Tosatti" <mtosatti@redhat.com>, "David Gibson" <david@gibson.dropbear.id.au>, "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>, kvm@vger.kernel.org, "Wenchao Wang" <wenchao.wang@intel.com>, "Thomas Huth" <thuth@redhat.com>, "Cameron Esfahani" <dirty@apple.com>, "Paolo Bonzini" <pbonzini@redhat.com>, "David Hildenbrand" <david@redhat.com>, "Roman Bolshakov" <r.bolshakov@yadro.com>, "Peter Maydell" <peter.maydell@linaro.org>, "Greg Kurz" <groug@kaod.org>, qemu-arm@nongnu.org, "Halil Pasic" <pasic@linux.ibm.com>, "Colin Xu" <colin.xu@intel.com>, "Claudio Fontana" <cfontana@suse.de>, qemu-ppc@nongnu.org, "Christian Borntraeger" <borntraeger@de.ibm.com>, qemu-s390x@nongnu.org, haxm-team@intel.com, "Philippe Mathieu-Daudé" <philmd@redhat.com> Subject: [RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu' Date: Wed, 3 Mar 2021 19:22:06 +0100 [thread overview] Message-ID: <20210303182219.1631042-7-philmd@redhat.com> (raw) In-Reply-To: <20210303182219.1631042-1-philmd@redhat.com> Use the 'whpx_vcpu' typedef instead of 'struct whpx_vcpu'. This will make the next commits easier to review. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- target/i386/whpx/whpx-all.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f0a35df3bba..6469e388b6d 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -148,6 +148,8 @@ struct whpx_register_set { WHV_REGISTER_VALUE values[RTL_NUMBER_OF(whpx_register_names)]; }; +typedef struct whpx_vcpu whpx_vcpu; + struct whpx_vcpu { WHV_EMULATOR_HANDLE emulator; bool window_registered; @@ -173,9 +175,9 @@ struct WHPDispatch whp_dispatch; * VP support */ -static struct whpx_vcpu *get_whpx_vcpu(CPUState *cpu) +static whpx_vcpu *get_whpx_vcpu(CPUState *cpu) { - return (struct whpx_vcpu *)cpu->hax_vcpu; + return (whpx_vcpu *)cpu->hax_vcpu; } static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86, @@ -259,7 +261,7 @@ static int whpx_set_tsc(CPUState *cpu) static void whpx_set_registers(CPUState *cpu, int level) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -448,7 +450,7 @@ static int whpx_get_tsc(CPUState *cpu) static void whpx_get_registers(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -712,7 +714,7 @@ static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = { static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) { HRESULT hr; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryMmioEmulation( @@ -737,7 +739,7 @@ static int whpx_handle_portio(CPUState *cpu, WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx) { HRESULT hr; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryIoEmulation( @@ -780,7 +782,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); int irq; @@ -902,7 +904,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) static void whpx_vcpu_post_run(CPUState *cpu) { - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); @@ -929,7 +931,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { @@ -968,7 +970,7 @@ static int whpx_vcpu_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); int ret; whpx_vcpu_process_async_events(cpu); @@ -1331,7 +1333,7 @@ int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = NULL; + whpx_vcpu *vcpu = NULL; Error *local_error = NULL; struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); @@ -1356,7 +1358,7 @@ int whpx_init_vcpu(CPUState *cpu) } } - vcpu = g_malloc0(sizeof(struct whpx_vcpu)); + vcpu = g_malloc0(sizeof(whpx_vcpu)); if (!vcpu) { error_report("WHPX: Failed to allocte VCPU context."); @@ -1475,7 +1477,7 @@ int whpx_vcpu_exec(CPUState *cpu) void whpx_destroy_vcpu(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index); whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); -- 2.26.2
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: qemu-devel@nongnu.org Cc: "Peter Maydell" <peter.maydell@linaro.org>, "Cornelia Huck" <cohuck@redhat.com>, kvm@vger.kernel.org, "David Hildenbrand" <david@redhat.com>, haxm-team@intel.com, "Colin Xu" <colin.xu@intel.com>, "Halil Pasic" <pasic@linux.ibm.com>, "Christian Borntraeger" <borntraeger@de.ibm.com>, "Claudio Fontana" <cfontana@suse.de>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Thomas Huth" <thuth@redhat.com>, "Eduardo Habkost" <ehabkost@redhat.com>, "Richard Henderson" <richard.henderson@linaro.org>, "Greg Kurz" <groug@kaod.org>, "Cameron Esfahani" <dirty@apple.com>, "Roman Bolshakov" <r.bolshakov@yadro.com>, qemu-arm@nongnu.org, "Sunil Muthuswamy" <sunilmut@microsoft.com>, "David Gibson" <david@gibson.dropbear.id.au>, "Marcelo Tosatti" <mtosatti@redhat.com>, qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, "Wenchao Wang" <wenchao.wang@intel.com>, "Paolo Bonzini" <pbonzini@redhat.com> Subject: [RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu' Date: Wed, 3 Mar 2021 19:22:06 +0100 [thread overview] Message-ID: <20210303182219.1631042-7-philmd@redhat.com> (raw) In-Reply-To: <20210303182219.1631042-1-philmd@redhat.com> Use the 'whpx_vcpu' typedef instead of 'struct whpx_vcpu'. This will make the next commits easier to review. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- target/i386/whpx/whpx-all.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f0a35df3bba..6469e388b6d 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -148,6 +148,8 @@ struct whpx_register_set { WHV_REGISTER_VALUE values[RTL_NUMBER_OF(whpx_register_names)]; }; +typedef struct whpx_vcpu whpx_vcpu; + struct whpx_vcpu { WHV_EMULATOR_HANDLE emulator; bool window_registered; @@ -173,9 +175,9 @@ struct WHPDispatch whp_dispatch; * VP support */ -static struct whpx_vcpu *get_whpx_vcpu(CPUState *cpu) +static whpx_vcpu *get_whpx_vcpu(CPUState *cpu) { - return (struct whpx_vcpu *)cpu->hax_vcpu; + return (whpx_vcpu *)cpu->hax_vcpu; } static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86, @@ -259,7 +261,7 @@ static int whpx_set_tsc(CPUState *cpu) static void whpx_set_registers(CPUState *cpu, int level) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -448,7 +450,7 @@ static int whpx_get_tsc(CPUState *cpu) static void whpx_get_registers(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -712,7 +714,7 @@ static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = { static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) { HRESULT hr; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryMmioEmulation( @@ -737,7 +739,7 @@ static int whpx_handle_portio(CPUState *cpu, WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx) { HRESULT hr; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryIoEmulation( @@ -780,7 +782,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); int irq; @@ -902,7 +904,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) static void whpx_vcpu_post_run(CPUState *cpu) { - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); @@ -929,7 +931,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { @@ -968,7 +970,7 @@ static int whpx_vcpu_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); int ret; whpx_vcpu_process_async_events(cpu); @@ -1331,7 +1333,7 @@ int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = NULL; + whpx_vcpu *vcpu = NULL; Error *local_error = NULL; struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); @@ -1356,7 +1358,7 @@ int whpx_init_vcpu(CPUState *cpu) } } - vcpu = g_malloc0(sizeof(struct whpx_vcpu)); + vcpu = g_malloc0(sizeof(whpx_vcpu)); if (!vcpu) { error_report("WHPX: Failed to allocte VCPU context."); @@ -1475,7 +1477,7 @@ int whpx_vcpu_exec(CPUState *cpu) void whpx_destroy_vcpu(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + whpx_vcpu *vcpu = get_whpx_vcpu(cpu); whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index); whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); -- 2.26.2
next prev parent reply other threads:[~2021-03-04 0:30 UTC|newest] Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-03 18:22 [RFC PATCH 00/19] accel: Introduce AccelvCPUState opaque structure Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [PATCH 01/19] target/i386/hvf: Use boolean value for vcpu_dirty Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [PATCH 02/19] target/s390x/kvm: Simplify debug code Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-04 6:24 ` Thomas Huth 2021-03-04 6:24 ` Thomas Huth 2021-03-04 16:05 ` Cornelia Huck 2021-03-04 16:05 ` Cornelia Huck 2021-03-03 18:22 ` [PATCH 03/19] target/s390x/kvm: Reduce deref by declaring 'struct kvm_run' on stack Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [PATCH 04/19] cpu: Croup accelerator-specific fields altogether Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-04 13:26 ` Philippe Mathieu-Daudé 2021-03-04 13:26 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 05/19] cpu: Introduce AccelvCPUState opaque structure Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé [this message] 2021-03-03 18:22 ` [RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu' Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 07/19] accel/whpx: Rename struct whpx_vcpu -> AccelvCPUState Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 08/19] accel/whpx: Use 'accel_vcpu' generic pointer Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 09/19] accel/hax: Add typedef for 'struct hax_vcpu_state' Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 10/19] accel/hax: Use 'accel_vcpu' generic pointer Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 11/19] accel/kvm: Introduce kvm_vcpu_state() helper Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 12/19] accel/kvm: Use kvm_vcpu_state() when possible Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 13/19] accel/kvm: Declare and allocate AccelvCPUState struct Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 14/19] accel/kvm: Move the 'kvm_fd' field to AccelvCPUState Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 15/19] accel/kvm: Move the 'kvm_state' " Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 16/19] accel/kvm: Move the 'kvm_run' " Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 17/19] accel/hvf: Reduce deref by declaring 'hv_vcpuid_t hvf_fd' on stack Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 18/19] accel/hvf: Declare and allocate AccelvCPUState struct Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-03 18:22 ` [RFC PATCH 19/19] accel/hvf: Move the 'hvf_fd' field to AccelvCPUState Philippe Mathieu-Daudé 2021-03-03 18:22 ` Philippe Mathieu-Daudé 2021-03-04 13:56 ` [RFC PATCH 00/19] accel: Introduce AccelvCPUState opaque structure Paolo Bonzini 2021-03-04 13:56 ` Paolo Bonzini 2021-03-04 14:54 ` Philippe Mathieu-Daudé 2021-03-04 14:54 ` Philippe Mathieu-Daudé 2021-03-04 15:40 ` Paolo Bonzini 2021-03-04 15:40 ` Paolo Bonzini 2021-03-04 16:42 ` Philippe Mathieu-Daudé 2021-03-04 16:42 ` Philippe Mathieu-Daudé
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=20210303182219.1631042-7-philmd@redhat.com \ --to=philmd@redhat.com \ --cc=borntraeger@de.ibm.com \ --cc=cfontana@suse.de \ --cc=cohuck@redhat.com \ --cc=colin.xu@intel.com \ --cc=david@gibson.dropbear.id.au \ --cc=david@redhat.com \ --cc=dirty@apple.com \ --cc=ehabkost@redhat.com \ --cc=groug@kaod.org \ --cc=haxm-team@intel.com \ --cc=kvm@vger.kernel.org \ --cc=marcel.apfelbaum@gmail.com \ --cc=mtosatti@redhat.com \ --cc=pasic@linux.ibm.com \ --cc=pbonzini@redhat.com \ --cc=peter.maydell@linaro.org \ --cc=qemu-arm@nongnu.org \ --cc=qemu-devel@nongnu.org \ --cc=qemu-ppc@nongnu.org \ --cc=qemu-s390x@nongnu.org \ --cc=r.bolshakov@yadro.com \ --cc=richard.henderson@linaro.org \ --cc=sunilmut@microsoft.com \ --cc=thuth@redhat.com \ --cc=wenchao.wang@intel.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.