🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.netbsd.source-changes
Article #24

Re: CVS commit: src/sys/dev/nvmm/x86

#24
From: Takashi YAMAMOTO
Date: Sun, 15 Nov 2026 23:23
87 lines
6963 bytes
hi,

sorry for very late reply.

On Sat, Jul 18, 2026 at 11:16 PM Taylor R Campbell <riastradh@netbsd.org> wrote:
>
> > Date: Sat, 18 Jul 2026 22:04:30 +0900
> > From: Takashi YAMAMOTO <yamt9999@gmail.com>
> >
> > On Wed, Jul 15, 2026 at 10:22 AM Taylor R Campbell <riastradh@netbsd.org> wrote:
> > >
> > > nvmm: Add support for extended CPU state (XSAVE) beyond x87/SSE.
> >
> > i have been using a similar patch for a while. but i haven't committed
> > it because
> > i was not happy to implement cpuid emulation bits in kernel like this.
>
> Sorry, didn't realize you were working on this already!
>
> > it's simpler to make qemu provide them via NVMM_VCPU_CONF_CPUID
> > or something similar. (in addition to xcr0)
> > cpuid emulation is quite complex and will likely be more complex in future.
> > it's better to leverage what qemu already has.
> > what do you think?
>
> No opinion, sounds reasonable on its face -- while it is sometimes
> nice to just expose all (safe) host features to the guest, I would
> also want it to be easy to specify the exact features up front for
> reliable migration.  Would this require adding a hook to let qemu
> completely override the CPUID visible to the guest, or can qemu use
> the existing CPUID overrides to manage it?  I think they might be
> limited in space.
>
> > > Instead, we can expose the XSAVE area in another location in the
> > > virtual machine uvm object, and create an ioctl for querying its
> > > object address and size so userland can mmap it.  TBD.
> >
> > i was thinking of having a new NVMM_IOC_VCPU_xxx to get the extra MD state.
>
> Yes, that's what I had in mind.  Something like:
>
>         struct nvmm_ioc_vcpu_xstate xstate = {
>                 .thingamajig = NVMM_X86_VCPU_XSTATE_XSAVE,
>         };
>         void *vxsave;
>         struct xsave_header *xsave;
>
>         if (ioctl(nvmm_fd, NVMM_IOC_VCPU_MAP_XSTATE, &xstate) == -1)
>                 goto fail;
>         vxsave = mmap(NULL, roundup(xstate.size, PAGE_SIZE),
>             PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FILE, nvmm_fd,
>             xstate.offset);
>         if (vxsave == MAP_FAILED)
>                 goto fail;
>         xsave = vxsave;
>
> Then NVMM_IOC_VCPU_GETSTATE/NVMM_IOC_VCPU_SETSTATE with the flag
> NVMM_X86_STATE_XSAVE, or setting the flag in comm->state_wanted /
> comm->state_cached, would arrange to make it available in the mmapped
> region, just like the other state is already made available in the
> mmapped comm page.
>
> Except we should probably consider how it might look on Arm (with SVE
> and SME) or RISC-V before committing to this ioctl interface.

i meant something separeted from NVMM_IOC_VCPU_GETSTATE/NVMM_IOC_VCPU_SETSTATE,
because i don't see much benefits to put xstate in comm page.

puttinng something this big and even variable-sized in the comm page
without breaking abi seems
quite cumbersome. i'm not sure if it pays off.

(i personally think the "bump NVMM_KERN_VERSION and break abi"
approach is good enough for nvmm.
but you are not happy with it, right?)

btw, do you have qemu bits corresponding to this commit?
or whatever using NVMM_VCPU_CONF_XCR0_MASK.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <CAKDaYtDEvO5NsvsKcgMCw-CRNmPCNcR816-iGXfno955Rgs9XA@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <20260718141620.9916984D55@mail.netbsd.org> <>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Takashi YAMAMOTO <yamt9999@gmail.com>
Newsgroups: muc.lists.netbsd.source-changes
Subject: Re: CVS commit: src/sys/dev/nvmm/x86
Date: Mon, 16 Nov 2026 08:23:51 +0900
Organization: Newsgate at muc.de e.V.
Sender: source-changes-d-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAKDaYtDEvO5NsvsKcgMCw-CRNmPCNcR816-iGXfno955Rgs9XA@mail.gmail.com>
References: <20260718141620.9916984D55@mail.netbsd.org> <>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="58380"; mail-complaints-to="news-admin@muc.de"
Authentication-Results: mail.netbsd.org (amavisd-new);
	dkim=pass (2048-bit key) header.d=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794785045; x=1795389845; darn=netbsd.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=YjeLAODGKQ0zmtmPodTQspQw1NLF8x6msbD+0N40ze8=;
        b=nmJfjW3BMB4nUTqOzJtapuQ+m07P2YViydlhuXeMhue6stUVM+F/gvnoC/87C8lDEk
         agspZiLdYYmPs0YCZydr14gASLD8n/Sf5HrDk8dtT3UwCYZAVQhFX8YUCYWN0pyhhuDs
         0FqlTmK2s5k61LUBeOp7ogLCBGpM+4cUQf0rmovOmI3/cYq9H8vN4W1QCSdpk56RnMzH
         TYzzH5Sudu2tqrT3l6WSLPI50vsoRqig2tuRWWY8vK/PXAJIZCXBQbXx9Vmg230w05jY
         TjPKXm4sG/GuF7qTE6WjjhqvrrIPXSiIaoGn67xwNUc32M5D3lbyJuCW1X1/eCeEyVQK
         qDDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794785045; x=1795389845;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=YjeLAODGKQ0zmtmPodTQspQw1NLF8x6msbD+0N40ze8=;
        b=GHFU0EDrFOZK2M7AxcSDs6TzDzGEX35LqoqkqaIFz56gwxe7c+JCRsBC4S1sZFiLtO
         +4TYu00tiyV0fDKx/24nmXfec9Q/gvyfyQAkHnSCtQKMHqkwmMLEBOImeL/WW8OfZ8P5
         HL9NHOtrSqVqe/9fs+u57xBqNAjRRtJjAmYDZbFOnpXL0+tSdy57zUoHy1EI5SiwdKob
         qV0KAyFXXFyi554ll5JFQsZXWlZj2XF8hSlV238LOXIk/LuR2iuwIfx5tuOvLUm4t0Pv
         Hpe1zARdpmG+ikCEBmaqst+LBWakKWxy7cyS5DFvnaW/E7b/rlt95K4JOfivqgJoKbaa
         3tMA==
X-Gm-Message-State: APuU4Z/HWIQsAx9roT5KkeDuXqZT7ncJ+gKPivPZFiP+8MAeeu2OTg+z
	beXCFIb2pkd4DKHlJWyhxHzQXcDZe1WMvoLJLd5yE78fUv6RhFzG6wE1ZqNKan6ZSL4aCpQRkvx
	votwyDsIr8afL8IYtAQA9jz4ipxTh+28=
X-Gm-Gg: AYBFou3GhfbzwfAomViKYJJtrGnGESlr0A9eesWIC5M3sPrUb23SOf+C9Q4klWTi5Kv
	GaQwEz6iCFYBtRfGcxh9UMpS9aCDo7Qc+n7wSyHmeZrZtxjVsbdTgxUT4hHPgaZc4i0ThsondcT
	ZMsylV7HU4UuDtLH70mdTSFxaUDMDjB0hDDzj24HFLgoIEtlv5DiaFWrDTLuTafXDfh9tg+C7RZ
	NToKQXzA6it4zIL06QWba3hGJKl4ljQ7WrGYn2YWaKyvWMB4Q+AqFM6kCWSw89I47lijoMYV60m
	sKWuuvoJBoM/xj1ARAPDkMu74AjDXgdKJ7v/8qsdrwIws97JfqqVruTRjgcdPv16NGzVXjv1CyY
	TMSSNx62uSy2gs72hsgVl5rLuPOXr5ovGY4gpDLE=
In-Reply-To: <20260718141620.9916984D55@mail.netbsd.org>
X-Gm-Features: AclHuK8EtMn-dYIBJ8GskpZOOprTbelkD3D4GadbC8BLMfIqTlBoMXp8DlCbbMY
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes