From nobody Mon Feb 9 20:12:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614795817; cv=none; d=zohomail.com; s=zohoarc; b=fxXfdmI/bPTB+/zgfpZjukHaJ3tb+dNQ6QRSUwq5K4Eu1y8MfcWrcVwjxL9CLF1aYp59uxHFGpL91c0sSMRw4D+4YoKM6ZOgZqhg7OnclY+dCy8S9Ju+Pi7pmGbQmErwO/9IGaBA09DggASMpHDQJfGDyPo6d0drgQ/lgHn1Gnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795817; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=QekL+lZ5BnBNsP996/ujwa8S4r0MydEApZGppEXSzVI=; b=juxmHHxXgqA+bQRrFmB4Q2ccNSGD2Nb9xzgBaMQN9hJDS7BwvHW2sbC6Egi3eEBwjGB0T0IoU0xbSkJw3iQzXREkMSffq+8inuwvDHcS0E0QpPe2Pbj+gZl8zCQo2wk7t70zrHVfZyKaT+6J11siLqcVVH/ywOS6oOr2UqIinNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614795817309437.8887505068683; Wed, 3 Mar 2021 10:23:37 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-599-bvrrNVUMMUm3AElHqFqgow-1; Wed, 03 Mar 2021 13:23:34 -0500 Received: by mail-wr1-f72.google.com with SMTP id r12so9089010wro.15 for ; Wed, 03 Mar 2021 10:23:34 -0800 (PST) Return-Path: Return-Path: 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 1sm6435516wmj.2.2021.03.03.10.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 10:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795816; 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=QekL+lZ5BnBNsP996/ujwa8S4r0MydEApZGppEXSzVI=; b=NWteHce6p78xm8nGu+MudIDn63yYVEvJM5arE+p9LNpNn226/AwQ0NnBhMHzRT+KJNfNNN DTgx24YOW1EkBPeCHemixsA3Dvu0CVDjEgREO2LiujKKwueckHwGrW86fR4Lgxgdj2RYAg rMrJ2ecrbLpNJPSNTg7edc1o4VFg7Ds= X-MC-Unique: bvrrNVUMMUm3AElHqFqgow-1 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=QekL+lZ5BnBNsP996/ujwa8S4r0MydEApZGppEXSzVI=; b=kuXwBCBSbo/XOqzKyDo9N9FRx3qysfXbBY3QCVcnVTCEbhdkrmE12IwCy+7W6GXNWJ O/CiR3N3p229Geki+rxC27dYLFnP+HfANh/wGnuAxtc17+lbL8sPfjj83WGn/6EBPHq+ aG/+OX+w/AXAmoRFEQZzE7oC4GiEhD2fzZnGlY+pvSX84JDmkV7E+iLRyQ3715h8fqa7 WZO+W2J+yjxQv1NzWxqKXFpFZc2oNQomzKFrI7D/t+3Lzng2ksgomicM2DzH/vB/JD95 67DLjnvU0h1K8xC6xIgFPnwM+4WxmSSaeLsThwx2j1voroDalVoCFSotHBdV6h6sKrSS E8fw== X-Gm-Message-State: AOAM5320kMFEURenWh+o7+gyXg4tq2ZDMXyyStcl5jir00UZNk0xd4mE W7MKweExvgfMG615+RqBCbQMwyQLRGQ3H3uhs8jsZ+3c6KQMlqsNEItkV6pNdgtrKDSL5CGUmsY ONWTnrDxumy+wTQ== X-Received: by 2002:a05:6000:18a:: with SMTP id p10mr24162wrx.166.1614795813577; Wed, 03 Mar 2021 10:23:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJygnk/F+pfVCMu6jAojHIo6THJyDiFCiZ/rv0+FX+yhcbewuYsSOKLGoO8+tY/jOc1YMyvUIQ== X-Received: by 2002:a05:6000:18a:: with SMTP id p10mr24137wrx.166.1614795813286; Wed, 03 Mar 2021 10:23:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Cornelia Huck , Richard Henderson , Sunil Muthuswamy , Marcelo Tosatti , David Gibson , Marcel Apfelbaum , kvm@vger.kernel.org, Wenchao Wang , Thomas Huth , Cameron Esfahani , Paolo Bonzini , David Hildenbrand , Roman Bolshakov , Peter Maydell , Greg Kurz , qemu-arm@nongnu.org, Halil Pasic , Colin Xu , Claudio Fontana , qemu-ppc@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, haxm-team@intel.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 10/19] accel/hax: Use 'accel_vcpu' generic pointer Date: Wed, 3 Mar 2021 19:22:10 +0100 Message-Id: <20210303182219.1631042-11-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Use the 'accel_vcpu' field which is meant for accelerators. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 3 --- target/i386/hax/hax-i386.h | 4 ++-- target/i386/hax/hax-all.c | 14 +++++++------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d807645af2b..65ff8d86dbc 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -244,8 +244,6 @@ typedef struct SavedIOTLB { struct KVMState; struct kvm_run; =20 -struct hax_vcpu_state; - #define TB_JMP_CACHE_BITS 12 #define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS) =20 @@ -421,7 +419,6 @@ struct CPUState { int kvm_fd; struct KVMState *kvm_state; struct kvm_run *kvm_run; - struct hax_vcpu_state *hax_vcpu; int hvf_fd; /* shared by kvm, hax and hvf */ bool vcpu_dirty; diff --git a/target/i386/hax/hax-i386.h b/target/i386/hax/hax-i386.h index ee77406a6a6..61ff0d84f2b 100644 --- a/target/i386/hax/hax-i386.h +++ b/target/i386/hax/hax-i386.h @@ -26,8 +26,8 @@ typedef HANDLE hax_fd; =20 extern struct hax_state hax_global; =20 -typedef struct hax_vcpu_state hax_vcpu_state; -struct hax_vcpu_state { +typedef struct AccelvCPUState hax_vcpu_state; +struct AccelvCPUState { hax_fd fd; int vcpu_id; struct hax_tunnel *tunnel; diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index 08c2b60b437..ce671760e64 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) =20 hax_fd hax_vcpu_get_fd(CPUArchState *env) { - hax_vcpu_state *vcpu =3D env_cpu(env)->hax_vcpu; + hax_vcpu_state *vcpu =3D env_cpu(env)->accel_vcpu; if (!vcpu) { return HAX_INVALID_FD; } @@ -194,7 +194,7 @@ int hax_vcpu_create(int id) =20 int hax_vcpu_destroy(CPUState *cpu) { - hax_vcpu_state *vcpu =3D cpu->hax_vcpu; + hax_vcpu_state *vcpu =3D cpu->accel_vcpu; =20 if (!hax_global.vm) { fprintf(stderr, "vcpu %x destroy failed, vm is null\n", vcpu->vcpu= _id); @@ -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 =3D env_cpu(env); - hax_vcpu_state *vcpu =3D cpu->hax_vcpu; + hax_vcpu_state *vcpu =3D cpu->accel_vcpu; struct hax_tunnel *ht =3D vcpu->tunnel; =20 /* @@ -446,7 +446,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) =20 void hax_raise_event(CPUState *cpu) { - hax_vcpu_state *vcpu =3D cpu->hax_vcpu; + hax_vcpu_state *vcpu =3D cpu->accel_vcpu; =20 if (!vcpu) { return; @@ -467,7 +467,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) int ret =3D 0; CPUState *cpu =3D env_cpu(env); X86CPU *x86_cpu =3D X86_CPU(cpu); - hax_vcpu_state *vcpu =3D cpu->hax_vcpu; + hax_vcpu_state *vcpu =3D cpu->accel_vcpu; struct hax_tunnel *ht =3D vcpu->tunnel; =20 if (!hax_enabled()) { @@ -1113,8 +1113,8 @@ void hax_reset_vcpu_state(void *opaque) { CPUState *cpu; for (cpu =3D first_cpu; cpu !=3D NULL; cpu =3D CPU_NEXT(cpu)) { - cpu->hax_vcpu->tunnel->user_event_pending =3D 0; - cpu->hax_vcpu->tunnel->ready_for_interrupt_injection =3D 0; + cpu->accel_vcpu->tunnel->user_event_pending =3D 0; + cpu->accel_vcpu->tunnel->ready_for_interrupt_injection =3D 0; } } =20 --=20 2.26.2