From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 907B0C433EF for ; Thu, 18 Nov 2021 16:03:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C74CA61220 for ; Thu, 18 Nov 2021 16:03:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C74CA61220 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=NetBSD.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnjtE-0006Vw-7v for qemu-devel@archiver.kernel.org; Thu, 18 Nov 2021 11:03:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnjp2-0004bC-9i for qemu-devel@nongnu.org; Thu, 18 Nov 2021 10:59:36 -0500 Received: from [2001:470:a085:999::25] (port=55988 helo=mail.netbsd.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnjoz-0002lh-Uh for qemu-devel@nongnu.org; Thu, 18 Nov 2021 10:59:35 -0500 Received: by mail.netbsd.org (Postfix, from userid 1524) id 408C984ED3; Thu, 18 Nov 2021 15:50:12 +0000 (UTC) Date: Thu, 18 Nov 2021 15:50:12 +0000 From: nia To: Kamil Rytarowski Subject: Re: [PATCH] nvmm: Fix support for stable version Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:470:a085:999::25 (failed) Received-SPF: pass client-ip=2001:470:a085:999::25; envelope-from=nia@netbsd.org; helo=mail.netbsd.org X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RDNS_NONE=0.793, 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: , Cc: Paolo Bonzini , reinoud@netbsd.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Ping? It would be very nice if this could make it into 6.2 so we don't have to continue patching around this. On Tue, Nov 02, 2021 at 10:12:28AM +0100, Kamil Rytarowski wrote: > Reviewed-by: Kamil Rytarowski > > Paolo, could you please merge it? > > On 13.10.2021 15:54, nia wrote: > > 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. > > > > (CC'ing maintainers) > > > > 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 == 'netbsd' > > - if cc.has_header_symbol('nvmm.h', 'nvmm_cpu_stop', required: get_option('nvmm')) > > - nvmm = cc.find_library('nvmm', required: get_option('nvmm')) > > - endif > > + nvmm = cc.find_library('nvmm', required: get_option('nvmm')) > > if nvmm.found() > > accelerators += '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); > > > > if (qatomic_read(&cpu->exit_request)) { > > +#if NVMM_USER_VERSION >= 2 > > nvmm_vcpu_stop(vcpu); > > +#else > > + qemu_cpu_kick_self(); > > +#endif > > } > > > > /* Read exit_request before the kernel reads the immediate exit flag */ > > @@ -767,6 +771,7 @@ nvmm_vcpu_loop(CPUState *cpu) > > switch (exit->reason) { > > case NVMM_VCPU_EXIT_NONE: > > break; > > +#if NVMM_USER_VERSION >= 2 > > case NVMM_VCPU_EXIT_STOPPED: > > /* > > * The kernel cleared the immediate exit flag; cpu->exit_request > > @@ -775,6 +780,7 @@ nvmm_vcpu_loop(CPUState *cpu) > > smp_wmb(); > > qcpu->stop = true; > > break; > > +#endif > > case NVMM_VCPU_EXIT_MEMORY: > > ret = nvmm_handle_mem(mach, vcpu); > > break; > > @@ -888,8 +894,12 @@ nvmm_ipi_signal(int sigcpu) > > { > > if (current_cpu) { > > struct qemu_vcpu *qcpu = get_qemu_vcpu(current_cpu); > > +#if NVMM_USER_VERSION >= 2 > > struct nvmm_vcpu *vcpu = &qcpu->vcpu; > > nvmm_vcpu_stop(vcpu); > > +#else > > + qcpu->stop = true; > > +#endif > > } > > } > > > > >