From nobody Sat Feb 7 08:28:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1632644218607240.53919422650188; Sun, 26 Sep 2021 01:16:58 -0700 (PDT) Received: from localhost ([::1]:34262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUPLE-0001ib-T1 for importer@patchew.org; Sun, 26 Sep 2021 04:16:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUOac-0005Ab-So for qemu-devel@nongnu.org; Sun, 26 Sep 2021 03:28:46 -0400 Received: from mail.netbsd.org ([199.233.217.200]:56686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUOab-0005KX-1t for qemu-devel@nongnu.org; Sun, 26 Sep 2021 03:28:46 -0400 Received: by mail.netbsd.org (Postfix, from userid 1524) id 467B484EA4; Sun, 26 Sep 2021 07:28:42 +0000 (UTC) Date: Sun, 26 Sep 2021 07:28:42 +0000 From: nia To: qemu-devel@nongnu.org Subject: nvmm: Fix support for stable version (NVMM_USER_VERSION 1) Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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=199.233.217.200; envelope-from=nia@netbsd.org; helo=mail.netbsd.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 26 Sep 2021 04:11:49 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1632644221035100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" NVMM user version 1 is the version being shipped with netbsd-9, which is the most recent stable branch of NetBSD. This makes it possible to use the NVMM accelerator on the most recent NetBSD release, 9.2, which lacks nvmm_cpu_stop. Signed-off-by: Nia Alarie --- meson.build | 4 +--- target/i386/nvmm/nvmm-all.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 15ef4d3c41..6e4d9b919a 100644 --- a/meson.build +++ b/meson.build @@ -244,9 +244,7 @@ if not get_option('hax').disabled() endif endif if targetos =3D=3D 'netbsd' - if cc.has_header_symbol('nvmm.h', 'nvmm_cpu_stop', required: get_option(= 'nvmm')) - nvmm =3D cc.find_library('nvmm', required: get_option('nvmm')) - endif + nvmm =3D cc.find_library('nvmm', required: get_option('nvmm')) if nvmm.found() accelerators +=3D 'CONFIG_NVMM' endif diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index a488b00e90..4a10412427 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -750,7 +750,11 @@ nvmm_vcpu_loop(CPUState *cpu) nvmm_vcpu_pre_run(cpu); =20 if (qatomic_read(&cpu->exit_request)) { +#if NVMM_USER_VERSION >=3D 2 nvmm_vcpu_stop(vcpu); +#else + qemu_cpu_kick_self(); +#endif } =20 /* Read exit_request before the kernel reads the immediate exit fl= ag */ @@ -767,6 +771,7 @@ nvmm_vcpu_loop(CPUState *cpu) switch (exit->reason) { case NVMM_VCPU_EXIT_NONE: break; +#if NVMM_USER_VERSION >=3D 2 case NVMM_VCPU_EXIT_STOPPED: /* * The kernel cleared the immediate exit flag; cpu->exit_reque= st @@ -775,6 +780,7 @@ nvmm_vcpu_loop(CPUState *cpu) smp_wmb(); qcpu->stop =3D true; break; +#endif case NVMM_VCPU_EXIT_MEMORY: ret =3D nvmm_handle_mem(mach, vcpu); break; @@ -888,8 +894,12 @@ nvmm_ipi_signal(int sigcpu) { if (current_cpu) { struct qemu_vcpu *qcpu =3D get_qemu_vcpu(current_cpu); +#if NVMM_USER_VERSION >=3D 2 struct nvmm_vcpu *vcpu =3D &qcpu->vcpu; nvmm_vcpu_stop(vcpu); +#else + qcpu->stop =3D true; +#endif } } =20 --=20 2.33.0