From nobody Sat Nov 15 01:19:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1758041449; cv=none; d=zohomail.com; s=zohoarc; b=kg9Jsy6niodZ4Morc/UwCTS1an7vaUjqxis5DSJo5707a0+p41coGSEMLGcpD1HPyUgwM6IYfTG5qiyz7fO2lYgypN2HDs0HkJZYZNCFILnQoJPlHOIr8eoPvvMn7Ih9fk8Y6NkDQO93HZgvJg8wKUpuRJnx566ZZNflS6TU/kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758041449; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FBfPjrtiE0YuxZHFIm9SF+e04OrNxovcu8CUedOUYHk=; b=Ne8K2VadL6x7tTOmbGT2DPFHWZco34opkBzJ9aSebmOW691onalkHf1J9JlPAkz6YB+wjfUDrwRrUqDGjhfC9tSYbMBIcvd1BQ8SKTMb39ZWwGwPHcnfuawcX/Y2eBQiLQ1g6ZP9hVQN6po97jW44u17eMfi+D9X7j+Q3FS1jZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758041449544889.0687418796673; Tue, 16 Sep 2025 09:50:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uyYss-0001JJ-L5; Tue, 16 Sep 2025 12:50:26 -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 1uyYsr-0001IT-Jh for qemu-devel@nongnu.org; Tue, 16 Sep 2025 12:50:25 -0400 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uyYsp-0006n0-SX for qemu-devel@nongnu.org; Tue, 16 Sep 2025 12:50:25 -0400 Received: from localhost.localdomain (unknown [167.220.208.43]) by linux.microsoft.com (Postfix) with ESMTPSA id 8A86220154ED; Tue, 16 Sep 2025 09:50:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8A86220154ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1758041422; bh=FBfPjrtiE0YuxZHFIm9SF+e04OrNxovcu8CUedOUYHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipXiacMdL/bhR1AbM5+WjfUIwiyCydmfPfQ8MY0x+wYqcGpINM71VkmmG/d8BFkpa nW5FFh38nsz+qqL+hpBpbJfvX6TLTNta3mQCR4nysENjBXln0J+l8OwRaH9zB/MW9A R1i3FMjXc6CmenSe2ATFnorF6h2uiejDJB+pSVOs= From: Magnus Kulke To: qemu-devel@nongnu.org Cc: Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Paolo Bonzini , Thomas Huth , Richard Henderson , Wei Liu , Cornelia Huck , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Roman Bolshakov , Phil Dennis-Jordan , Marcel Apfelbaum , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Zhao Liu , Eduardo Habkost , Magnus Kulke , Wei Liu , Eric Blake , Yanan Wang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v4 12/27] target/i386/mshv: Add CPU create and remove logic Date: Tue, 16 Sep 2025 18:48:32 +0200 Message-Id: <20250916164847.77883-13-magnuskulke@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250916164847.77883-1-magnuskulke@linux.microsoft.com> References: <20250916164847.77883-1-magnuskulke@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=13.77.154.182; envelope-from=magnuskulke@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linux.microsoft.com) X-ZM-MESSAGEID: 1758041450246116600 Content-Type: text/plain; charset="utf-8" Implement MSHV-specific hooks for vCPU creation and teardown in the i386 target. Signed-off-by: Magnus Kulke --- target/i386/mshv/mshv-cpu.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c index 04938c2776..e848461c0e 100644 --- a/target/i386/mshv/mshv-cpu.c +++ b/target/i386/mshv/mshv-cpu.c @@ -29,6 +29,8 @@ #include "trace-accel_mshv.h" #include "trace.h" =20 +#include + int mshv_store_regs(CPUState *cpu) { error_report("unimplemented"); @@ -61,20 +63,29 @@ int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message = *msg, MshvVmExit *exit) =20 void mshv_remove_vcpu(int vm_fd, int cpu_fd) { - error_report("unimplemented"); - abort(); + close(cpu_fd); } =20 + int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd) { - error_report("unimplemented"); - abort(); + int ret; + struct mshv_create_vp vp_arg =3D { + .vp_index =3D vp_index, + }; + ret =3D ioctl(vm_fd, MSHV_CREATE_VP, &vp_arg); + if (ret < 0) { + error_report("failed to create mshv vcpu: %s", strerror(errno)); + return -1; + } + + *cpu_fd =3D ret; + + return 0; } =20 void mshv_init_mmio_emu(void) { - error_report("unimplemented"); - abort(); } =20 void mshv_arch_init_vcpu(CPUState *cpu) --=20 2.34.1