From patchwork Wed Mar 3 18:22:09 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: 1446783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ae3559uE; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DrMvm6z4Tz9s1l for ; Thu, 4 Mar 2021 05:28:52 +1100 (AEDT) Received: from localhost ([::1]:43602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHWEs-00066M-VS for incoming@patchwork.ozlabs.org; Wed, 03 Mar 2021 13:28:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHW9h-0006AR-Ip for qemu-devel@nongnu.org; Wed, 03 Mar 2021 13:23:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHW9e-0000hz-AU for qemu-devel@nongnu.org; Wed, 03 Mar 2021 13:23:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795805; 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=bsBSf6h5clRIGLmrmL5o7OQtiQ2QaVSKYYOrh/pYYJA=; b=Ae3559uEKpZ3ow58aO1yboqhg57EomLxx+xn3P5I7qOcFv5ROOqOe9xvVxl05z1iquWinY UUSeGu1tW++8pKMrIRQLNiLpC3ICVl6aNuj3/k9Nm0WVInUY7Fv8XES1rEBn/80pu1h4w8 gNtEzvxYhjuWt1qwV2F+T3oM+x2wtAg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-KRTk6BzvPwWpEPk3ngiJgw-1; Wed, 03 Mar 2021 13:23:24 -0500 X-MC-Unique: KRTk6BzvPwWpEPk3ngiJgw-1 Received: by mail-wr1-f69.google.com with SMTP id 75so816651wrl.3 for ; Wed, 03 Mar 2021 10:23:24 -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=bsBSf6h5clRIGLmrmL5o7OQtiQ2QaVSKYYOrh/pYYJA=; b=EZH7eSTmOf0XjvDY63YprS1at6sP1yCK8o6LmrIpy1EN92Zdoa2vUAUtFjM29zP9Rn 1EGvsYNeT1x0ztUs7c7kPuYl6N9rjl18Ard/lMYOG6vXJN53uinDx/PSekFnxvbhi2sG MMi5KeJlaGCJPiyaGoBDo+YZ5yCqPfyfdvAA3ddyA/GRBkQ2+gXBH18LOHWLjwBBC/BD aV5PsHWkgnG8uy6ahRenp5tnxprYgl09wtiKBpqgZaFeIm70yZhkOhhjzBCGavmpwGe1 d8zEDcP70qsbtA4DoHB7tr7q3IQBEp6dfb/RMSPnwhLkN0UATeUBLdE+BttM6OUguTVS Nvqg== X-Gm-Message-State: AOAM533QvEnYx8lPi25/deGimNvke6hcYh3gzfJI7IGibnTFDAdu21qA VpPA9gy7fHP1BK0ZP4J4dIuODlbVLdF6JRxdLK3waUoaLUOf8a9sh3qXG45Ifuj/hgyRP1+o4tg FgRA5QTX2xK/65QXGkIZbvSF0oAIJtY2HxuAMpkE+8ued/XTf/yuJzVmn2FbXQcij X-Received: by 2002:a05:6000:24b:: with SMTP id m11mr20773907wrz.393.1614795802987; Wed, 03 Mar 2021 10:23:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxT5Mnr/cqn4T3oI+iCl7/2qqSUUEQiDL1NAilJKbe4aa2BGoAiTwZhjp0yFdIrhN8U4ftx4Q== X-Received: by 2002:a05:6000:24b:: with SMTP id m11mr20773870wrz.393.1614795802788; Wed, 03 Mar 2021 10:23:22 -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 n6sm13487477wrt.1.2021.03.03.10.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 10:23:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 09/19] accel/hax: Add typedef for 'struct hax_vcpu_state' Date: Wed, 3 Mar 2021 19:22:09 +0100 Message-Id: <20210303182219.1631042-10-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use the 'hax_vcpu_state' typedef instead of 'struct hax_vcpu_state'. This will make the next commits easier to review. Beside the typedef addition, patch created mechanically using: $ sed -i s/struct\ hax_vcpu_state/hax_vcpu_state/ \ $(git grep -l 'struct hax_vcpu_state') Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hax/hax-i386.h | 8 +++++--- target/i386/hax/hax-all.c | 18 +++++++++--------- target/i386/hax/hax-posix.c | 4 ++-- target/i386/hax/hax-windows.c | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/target/i386/hax/hax-i386.h b/target/i386/hax/hax-i386.h index efbb3462389..ee77406a6a6 100644 --- a/target/i386/hax/hax-i386.h +++ b/target/i386/hax/hax-i386.h @@ -25,6 +25,8 @@ typedef HANDLE hax_fd; #endif extern struct hax_state hax_global; + +typedef struct hax_vcpu_state hax_vcpu_state; struct hax_vcpu_state { hax_fd fd; int vcpu_id; @@ -46,7 +48,7 @@ struct hax_vm { hax_fd fd; int id; int numvcpus; - struct hax_vcpu_state **vcpus; + hax_vcpu_state **vcpus; }; #ifdef NEED_CPU_H @@ -58,7 +60,7 @@ int valid_hax_tunnel_size(uint16_t size); int hax_mod_version(struct hax_state *hax, struct hax_module_version *version); int hax_inject_interrupt(CPUArchState *env, int vector); struct hax_vm *hax_vm_create(struct hax_state *hax, int max_cpus); -int hax_vcpu_run(struct hax_vcpu_state *vcpu); +int hax_vcpu_run(hax_vcpu_state *vcpu); int hax_vcpu_create(int id); void hax_kick_vcpu_thread(CPUState *cpu); @@ -78,7 +80,7 @@ int hax_host_create_vm(struct hax_state *hax, int *vm_id); hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id); int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid); hax_fd hax_host_open_vcpu(int vmid, int vcpuid); -int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu); +int hax_host_setup_vcpu_channel(hax_vcpu_state *vcpu); hax_fd hax_mod_open(void); void hax_memory_init(void); diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index bf65ed6fa92..08c2b60b437 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -68,7 +68,7 @@ int valid_hax_tunnel_size(uint16_t size) hax_fd hax_vcpu_get_fd(CPUArchState *env) { - struct hax_vcpu_state *vcpu = env_cpu(env)->hax_vcpu; + hax_vcpu_state *vcpu = env_cpu(env)->hax_vcpu; if (!vcpu) { return HAX_INVALID_FD; } @@ -142,7 +142,7 @@ static int hax_version_support(struct hax_state *hax) int hax_vcpu_create(int id) { - struct hax_vcpu_state *vcpu = NULL; + hax_vcpu_state *vcpu = NULL; int ret; if (!hax_global.vm) { @@ -155,7 +155,7 @@ int hax_vcpu_create(int id) return 0; } - vcpu = g_new0(struct hax_vcpu_state, 1); + vcpu = g_new0(hax_vcpu_state, 1); ret = hax_host_create_vcpu(hax_global.vm->fd, id); if (ret) { @@ -194,7 +194,7 @@ int hax_vcpu_create(int id) int hax_vcpu_destroy(CPUState *cpu) { - struct hax_vcpu_state *vcpu = cpu->hax_vcpu; + hax_vcpu_state *vcpu = cpu->hax_vcpu; if (!hax_global.vm) { fprintf(stderr, "vcpu %x destroy failed, vm is null\n", vcpu->vcpu_id); @@ -225,7 +225,7 @@ int hax_init_vcpu(CPUState *cpu) exit(-1); } - cpu->hax_vcpu = hax_global.vm->vcpus[cpu->cpu_index]; + cpu->accel_vcpu = hax_global.vm->vcpus[cpu->cpu_index]; cpu->vcpu_dirty = true; qemu_register_reset(hax_reset_vcpu_state, (CPUArchState *) (cpu->env_ptr)); @@ -265,7 +265,7 @@ struct hax_vm *hax_vm_create(struct hax_state *hax, int max_cpus) } vm->numvcpus = max_cpus; - vm->vcpus = g_new0(struct hax_vcpu_state *, vm->numvcpus); + vm->vcpus = g_new0(hax_vcpu_state *, vm->numvcpus); for (i = 0; i < vm->numvcpus; i++) { vm->vcpus[i] = NULL; } @@ -414,7 +414,7 @@ static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, static int hax_vcpu_interrupt(CPUArchState *env) { CPUState *cpu = env_cpu(env); - struct hax_vcpu_state *vcpu = cpu->hax_vcpu; + hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_tunnel *ht = vcpu->tunnel; /* @@ -446,7 +446,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) void hax_raise_event(CPUState *cpu) { - struct hax_vcpu_state *vcpu = cpu->hax_vcpu; + hax_vcpu_state *vcpu = cpu->hax_vcpu; if (!vcpu) { return; @@ -467,7 +467,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) int ret = 0; CPUState *cpu = env_cpu(env); X86CPU *x86_cpu = X86_CPU(cpu); - struct hax_vcpu_state *vcpu = cpu->hax_vcpu; + hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_tunnel *ht = vcpu->tunnel; if (!hax_enabled()) { diff --git a/target/i386/hax/hax-posix.c b/target/i386/hax/hax-posix.c index ac1a51096eb..8ee247845b7 100644 --- a/target/i386/hax/hax-posix.c +++ b/target/i386/hax/hax-posix.c @@ -205,7 +205,7 @@ hax_fd hax_host_open_vcpu(int vmid, int vcpuid) return fd; } -int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) +int hax_host_setup_vcpu_channel(hax_vcpu_state *vcpu) { int ret; struct hax_tunnel_info info; @@ -227,7 +227,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) return 0; } -int hax_vcpu_run(struct hax_vcpu_state *vcpu) +int hax_vcpu_run(hax_vcpu_state *vcpu) { return ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL); } diff --git a/target/i386/hax/hax-windows.c b/target/i386/hax/hax-windows.c index 59afa213a6d..08ec93a256c 100644 --- a/target/i386/hax/hax-windows.c +++ b/target/i386/hax/hax-windows.c @@ -301,7 +301,7 @@ hax_fd hax_host_open_vcpu(int vmid, int vcpuid) return hDeviceVCPU; } -int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) +int hax_host_setup_vcpu_channel(hax_vcpu_state *vcpu) { hax_fd hDeviceVCPU = vcpu->fd; int ret; @@ -327,7 +327,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) return 0; } -int hax_vcpu_run(struct hax_vcpu_state *vcpu) +int hax_vcpu_run(hax_vcpu_state *vcpu) { int ret; HANDLE hDeviceVCPU = vcpu->fd;