From patchwork Wed Mar 3 18:22:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E54BCC433DB for ; Wed, 3 Mar 2021 18:25:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5812164EBD for ; Wed, 3 Mar 2021 18:25:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5812164EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHWBm-0000vP-C0 for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 13:25:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHW9O-0005Vq-5W for qemu-devel@nongnu.org; Wed, 03 Mar 2021 13:23:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHW9L-0000cH-EX for qemu-devel@nongnu.org; Wed, 03 Mar 2021 13:23:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JSKZ4U4zBdXHSKAtMYPcidB9tymokaAa3vsPtMUAjQM=; b=fAuXMcBm5NKSBkUQfzdpXkaF7H7xUE/u0rvJQhL6HkGkNQTdu/5C+l3sHuG2AtbBzrYp63 GZAzcNYI2MrnUrqxxgxhfpI4qb2DaB9R9yJFI9T6r4mMyyQR+Uo3LeLDqj3icYkJpZ64yn R4AK9HtgC6mfFHq5NzHP6ta4xfTZUJc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-KZgNugTQMPKxYPIJf22rmA-1; Wed, 03 Mar 2021 13:23:02 -0500 X-MC-Unique: KZgNugTQMPKxYPIJf22rmA-1 Received: by mail-wm1-f72.google.com with SMTP id q24so3402215wmc.1 for ; Wed, 03 Mar 2021 10:23:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JSKZ4U4zBdXHSKAtMYPcidB9tymokaAa3vsPtMUAjQM=; b=qTjjwyJCoE2/s296/O9euicjGTpSjHmdP8ul43ei+n2oS+cGTQ/WMcTgkC7Ob9jGZn zmksJYq5Qa99Kx8H/i5ZCT7x6NwCKfMKJ+dZ+lzeYI3O9phIPYtafwYRNtxXAQL+nAgP c3ESoLzlO/1JbBuJYJeYNsjMyDZpC5ySmfqMfF6V6AMzmX/nVrbNSdEFdGoTu/HygKTr ttqV3kPlax2nbpjVvCFIyUjRbgZuqx9Bv05Q73NEmWzwvRI6STfyVh5y/gA41mmP0Dds OHfYesVYPi1AHSxO8l0vVFPMNY2NOQFyZW6Vg8A28BJDbecRigQyR3OBsOStK8wTqA46 YGrQ== X-Gm-Message-State: AOAM531PtkfCjYbY6IVgBiUoOjMd9IwPaycP6kif7ndX2pDMat9uivj7 sXJ8ib8D1rSsfFJsfy9PQhov+H/2AypyCiV4pr7qykgrjHlKL4ab2/m7MIhH87Dyk3hXbO/fL14 +OvCltULWkcoyDA1ZDSj6OhpaP5VRDTFVKfCfz6PasMcMs8/jmrqKwr3yhVNYm1xV X-Received: by 2002:a05:600c:4ec7:: with SMTP id g7mr295372wmq.56.1614795781361; Wed, 03 Mar 2021 10:23:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkfTopuTz8+rr5+ZCkXuINfRYff1lmKq7JTlmgWuTa8IXYSH/Sikf55e2yiTGalQ+YvZXOhQ== X-Received: by 2002:a05:600c:4ec7:: with SMTP id g7mr295331wmq.56.1614795781060; Wed, 03 Mar 2021 10:23:01 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id a131sm6749075wmc.48.2021.03.03.10.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 10:23:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 06/19] accel/whpx: Add typedef for 'struct whpx_vcpu' Date: Wed, 3 Mar 2021 19:22:06 +0100 Message-Id: <20210303182219.1631042-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303182219.1631042-1-philmd@redhat.com> References: <20210303182219.1631042-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , kvm@vger.kernel.org, David Hildenbrand , haxm-team@intel.com, Colin Xu , Halil Pasic , Christian Borntraeger , Claudio Fontana , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Richard Henderson , Greg Kurz , Cameron Esfahani , Roman Bolshakov , qemu-arm@nongnu.org, Sunil Muthuswamy , David Gibson , Marcelo Tosatti , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Wenchao Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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);