From patchwork Wed Apr 5 10:18:03 2023 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: 670311 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp187303wrt; Wed, 5 Apr 2023 03:19:58 -0700 (PDT) X-Google-Smtp-Source: AKy350YH8/KIvCfngxsCf7MeeAoOhdk6xghwSRFf/4IAY7G/JT0pcwVYlV2EdMpgh8gPyxkLhGsA X-Received: by 2002:ac8:7d95:0:b0:3df:a280:b60f with SMTP id c21-20020ac87d95000000b003dfa280b60fmr3185003qtd.14.1680689998674; Wed, 05 Apr 2023 03:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680689998; cv=none; d=google.com; s=arc-20160816; b=w7XBFG322ULeGA1mXveqh/Uwh8OzIuNGWmIxnjdLPXR/XbnsQg30BrkbowPeJtZTaM RB5eI2Z7whynCxLl9E/XCEOL6maF8n6TfEfR+SPIdzj/tKGai5KkqnuzHVwMhJkeFNnV WGFi6KpKKDNF6LLunXxLE/F10K7VxIkM3eBx65QhtFr+iqOtFIFjZOpU5440EBz04k2z iKmkoZKzcUgD2s7rLmzXQFM9XQ75H7xFmHFCskSjJPsOnIRirE8pP8Q2Ktyespg+H11E NKF1xb8aC1ThlMcLtcAwV/5wP0uvrl9649weooGUpzkUyJP5swBizbl3i6+MV/iG9lqz mwJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6tftOh0BEcl8WGCnB6MC//b/5zdxDYjL5goslSUZJws=; b=OExYyWVyT77U1JNmCGjpZEVQro4NhE2ttOWhLbk6zI482tq6pI0wIgryw9LfMUu14W Se5gcMKoLOJ4U0Mk41d9Om9lKYVO4ezuDKAEitOalxEz99HJ2hzITLHTSjm3001oIRzy FOGKxJzbJDTYFw4KZQmCwB02BxLTKuHuxHXC4ojv5klL8HeNnDdie5RNGGPd0Yq6Jwby axdGX5sHlKiF4EsvyVqSfrcVycgnFdwBSnr/2SkLH16AUWfxhG5qFlaGtoLJAhOyjsPR FZQmfgCJp68dwuak1wdRneoKeUsLUSa/a3i6tiq0ugYxKdlAtKn068jM+TWLh5f2UXR0 ErhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yPbFhCwG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id br36-20020a05620a462400b0074881920d00si9695426qkb.703.2023.04.05.03.19.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Apr 2023 03:19:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yPbFhCwG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pk0EI-0007Ph-RY; Wed, 05 Apr 2023 06:19:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pk0EH-0007Nz-Dz for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:19:01 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pk0EF-0002oq-2S for qemu-devel@nongnu.org; Wed, 05 Apr 2023 06:19:01 -0400 Received: by mail-wr1-x42a.google.com with SMTP id i9so35654807wrp.3 for ; Wed, 05 Apr 2023 03:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680689936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6tftOh0BEcl8WGCnB6MC//b/5zdxDYjL5goslSUZJws=; b=yPbFhCwGeiCV4thDFylzfI/HwDyG5hzAj4MOzixAzKF25y0uzdJIpFxXuplWi9vjHl /pOllACxcM9z8xuQDdRw6M+2mhe134Dj+vuHZkVEnkH+iEToGCJ/gsI/e1vCCyvskKgL u3Mvtb6MFtubWA04wRDH74PCwnCAY/i2SngbnxTxDSfmMlutOwruOtZ/lxg1P8mD8QYc drS8XHL8crBE+lDtcMRmYU91Oi0ecrSiQz2TIPt5ieGnpP+PuypBCXiw3EMqe02ST1rI wsMGZCOdiVWLzTUX7Ca+wgJTbV5lZ6+mNbhvpM8NJsdWCvazgFD200r/8aPIN7ho8VP6 onNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680689936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6tftOh0BEcl8WGCnB6MC//b/5zdxDYjL5goslSUZJws=; b=jOTuvlkU73HSYB3shYZJ0Ycu4NF0sdy5s2exrirQG+ePOdTmxqe3BrZ/4G8j9ft62R dhmXOGFrCOvT36Hf0L2bR2e+XipjUDoN/hBrayNqX0Mit8oywIO06NoMA05JUeOTLbzi 2kURfyT/IV6xkqe3zA4IQNU7v2hobqTx9pF346PKm5b72TW1KeOo1aOaQvFkcvvDjYLk +4llmrcvf6IzWWlZmaqQhRrkHbewXA3P1Zi3+w/XXzpQC8eR1Mf+w5YRdkIq8FVHmiNH mQ8eqwRy0NzW+43c9BOICP6lM3FSGXMSP2DB6mh1ccg8/DOWxfj4xJZvvWsNNdGT3Kk+ LunQ== X-Gm-Message-State: AAQBX9eOrX8Cz3hbZQDa7sST5z878eOiNbvDIzXTY9vXbxDVSpL/iguw ifZDNSFTebCdhMo6s90B9pfDu/FDdww0F0LGzlw= X-Received: by 2002:a5d:610a:0:b0:2d5:553a:93ac with SMTP id v10-20020a5d610a000000b002d5553a93acmr3978963wrt.7.1680689936532; Wed, 05 Apr 2023 03:18:56 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id l18-20020adfe592000000b002c5534db60bsm14659802wrm.71.2023.04.05.03.18.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 03:18:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , xen-devel@lists.xenproject.org, kvm@vger.kernel.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH 06/14] accel: Use a typedef for struct hax_vcpu_state Date: Wed, 5 Apr 2023 12:18:03 +0200 Message-Id: <20230405101811.76663-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405101811.76663-1-philmd@linaro.org> References: <20230405101811.76663-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use a type definition instead of explicit structure. Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hax/hax-i386.h | 10 +++++----- target/i386/hax/hax-all.c | 16 ++++++++-------- target/i386/hax/hax-posix.c | 4 ++-- target/i386/hax/hax-windows.c | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/target/i386/hax/hax-i386.h b/target/i386/hax/hax-i386.h index 409ebdb4af..3cb3b9bbd0 100644 --- a/target/i386/hax/hax-i386.h +++ b/target/i386/hax/hax-i386.h @@ -25,12 +25,12 @@ typedef HANDLE hax_fd; #endif extern struct hax_state hax_global; -struct hax_vcpu_state { +typedef struct hax_vcpu_state { hax_fd fd; int vcpu_id; struct hax_tunnel *tunnel; unsigned char *iobuf; -}; +} hax_vcpu_state; struct hax_state { hax_fd fd; /* the global hax device interface */ @@ -46,7 +46,7 @@ struct hax_vm { hax_fd fd; int id; int numvcpus; - struct hax_vcpu_state **vcpus; + hax_vcpu_state **vcpus; }; /* Functions exported to host specific mode */ @@ -57,7 +57,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); @@ -76,7 +76,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 3865ff9419..a55b18f353 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -62,7 +62,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)->accel; + hax_vcpu_state *vcpu = env_cpu(env)->accel; if (!vcpu) { return HAX_INVALID_FD; } @@ -136,7 +136,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) { @@ -149,7 +149,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) { @@ -188,7 +188,7 @@ int hax_vcpu_create(int id) int hax_vcpu_destroy(CPUState *cpu) { - struct hax_vcpu_state *vcpu = cpu->accel; + hax_vcpu_state *vcpu = cpu->accel; if (!hax_global.vm) { fprintf(stderr, "vcpu %x destroy failed, vm is null\n", vcpu->vcpu_id); @@ -263,7 +263,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; } @@ -415,7 +415,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->accel; + hax_vcpu_state *vcpu = cpu->accel; struct hax_tunnel *ht = vcpu->tunnel; /* @@ -447,7 +447,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) void hax_raise_event(CPUState *cpu) { - struct hax_vcpu_state *vcpu = cpu->accel; + hax_vcpu_state *vcpu = cpu->accel; if (!vcpu) { return; @@ -468,7 +468,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->accel; + hax_vcpu_state *vcpu = cpu->accel; 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 ac1a51096e..8ee247845b 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 59afa213a6..08ec93a256 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;