From win-pv-devel-bounces@lists.xenproject.org Fri Aug 01 08:52:23 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 01 Aug 2025 08:52:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1066964.1431966 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uhlUz-0002tj-2k; Fri, 01 Aug 2025 08:52:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1066964.1431966; Fri, 01 Aug 2025 08:52:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uhlUz-0002tc-01; Fri, 01 Aug 2025 08:52:21 +0000
Received: by outflank-mailman (input) for mailman id 1066964;
 Fri, 01 Aug 2025 08:52:19 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BbD+=2N=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1uhlUx-0002tW-C7
 for win-pv-devel@lists.xenproject.org; Fri, 01 Aug 2025 08:52:19 +0000
Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com
 [2a00:1450:4864:20::134])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id d176245f-6eb4-11f0-b895-0df219b8e170;
 Fri, 01 Aug 2025 10:52:13 +0200 (CEST)
Received: by mail-lf1-x134.google.com with SMTP id
 2adb3069b0e04-55b827aba01so653049e87.0
 for <win-pv-devel@lists.xenproject.org>; Fri, 01 Aug 2025 01:52:13 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d176245f-6eb4-11f0-b895-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754038333; x=1754643133; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=mHRxBA6LzZ5xiHcgoBF813hpKqvR1V+6L/Ss7+5IRw0=;
        b=JzcIZ5i2WiItxGVj8yOY7cZ1gW+NC87+Seffi2q+MCfOju1iFzqi/1HiufdCCTXOdJ
         bh363ykUZo1lZnO0pJHQgwFR4CO6HgWmYO9QHj2pVekhw4xeU32QGUTUd2/BhnaQVRCx
         4dpuYEwBBTofHwKGRkVm2cCDXKlYjpmRg+ohw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754038333; x=1754643133;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=mHRxBA6LzZ5xiHcgoBF813hpKqvR1V+6L/Ss7+5IRw0=;
        b=ddbNNdwV6cGYjr2O7UeDDDrGaLXkRPQfAUpKkmIaD1HXGQXdd3Raqo6ONblg/6u45j
         MNMEwMnFln2vLuH9hnrLTnfy8NraTfCvmyd+HmxNYG5lzJ+SD+0yb5gGxI0lplmOoPbl
         2LaUUw+eg/qjE1g04XPwo5DJjkjWDsmxupgx+rK0eemOIbvHD2lAz7gUV5VCfMQVMyTc
         rBWpRFZVddK8PSA8XtXs+Dz6aQBVZb8Pp7Qjiw5F8hwZqGm25suQiSJOEWsU7/sZWX7x
         65uNjA+yC3U2qRBJSPVHQDb/dYJ+op08SDtpbmCHS/SGmEcDBWjuCJMaSJKLqAQn6OpR
         m7AA==
X-Gm-Message-State: AOJu0YydnlEaeojCtFs82/xC9yaKZRcGo0puZXS/QnlzguqtTkUnuIj7
	p6V7z9L5xq9O3DMw4iqqHbrDMLlkjaFnyogPyBAU+IutsSYZRtp4KmNeAlx6J685hu/6qIAPBPq
	SjCnqQfVSozGzLzobab3yL+vD4cOv+o52SbFdaI1V
X-Gm-Gg: ASbGncsW+RMa+OU8AmlivMZyYXzuVZIVcMuYYvwJSrXG5XUVHWSVkNX8vkzut3JuqYy
	pPmccM3IGTGFuryW9/3oi/BPHHzMW74QsT9Mpcl5Bom2mglQ4SH710nGSvv0NLcy8GbWIGfwlPK
	aGxipZPp12H0e8mVc8DEfsxKHUz/7JoFcD18fMB4LrM35ju0clqnpYiBoP/YuFSqEMt4od+16Da
	jEvvu4=
X-Google-Smtp-Source: AGHT+IF4jabN71yVFyFHtcK8/dLB5ULzWZ7q4x0Mgi+4xHUzp+q2Izzrnfxo7znLsP6Pvxm7PcfbM7dbT2MS6U/R1zQ=
X-Received: by 2002:a05:6512:4022:b0:55b:87a8:6014 with SMTP id
 2adb3069b0e04-55b87a862c2mr1693466e87.25.1754038332729; Fri, 01 Aug 2025
 01:52:12 -0700 (PDT)
MIME-Version: 1.0
References: <20250723135819.988-1-ngoc-tu.dinh@vates.tech> <CAC_UY88Gftfmu-Bqz-axFyOmAu5Fqur4=OL_QTPLG0LdfA3GWg@mail.gmail.com>
 <d433745f-a580-4435-8505-ffcb96574f84@vates.tech>
In-Reply-To: <d433745f-a580-4435-8505-ffcb96574f84@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Fri, 1 Aug 2025 09:52:01 +0100
X-Gm-Features: Ac12FXz4k8JzQKBfbKReXhi0azjwaITLELc87cyYC-9PUOo-y9tfO4uv9paS76o
Message-ID: <CAC_UY88OxN81KssUSnGx79cXq3wqwRnq21oYqgou+6y6GWzdHw@mail.gmail.com>
Subject: Re: [PATCH v2 0/7] Implement forced unplug and forced activation
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000bec8c6063b49dfab"

--000000000000bec8c6063b49dfab
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It may be possible to change the PDO's DeviceID to not include the full
XenBus DeviceID, only the VENDOR_PREFIX_STR (to avoid compatibility issues
between different vendor driver sets) and the device type.
e.g. DeviceID =3D "XENBUS\VEN_XP&DEV_VBD"
Keep the CompatibleIDs including the XenBus DeviceID would allow vendors to
limit Windows Update distribution to their VENDOR_PREFIX_STR +
VENDOR_DEVICE_ID. The INF files would require an exact match against a
CompatibleID, which would also include the REV part, preventing child
devices installing on parent devices that dont expose the correct interface
versions.

Then this change and a combination of ForceActivate and ForceUnplug should
cover most edge cases.

Owen

On Thu, Jul 31, 2025 at 4:03=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> On 31/07/2025 16:26, Owen Smith wrote:
> > Having played with this a bit, there seems to be several edge cases tha=
t
> > are fatal.
> > 1) installing on 1 device (e.g. 0002) without any others seems to work.
> > Shutting down, and changing the device (e.g. to 0001) and booting, will
> > trigger an 0x7B bugcheck (emulated disk is unplugged, but the PV disk
> > has not bound to the 0001 device nodes)
> > 2) installing on 1 device (e.g. 0002), shutting down and adding the
> > vendor device will trigger a 0x7B bugcheck on boot (as the emulated dis=
k
> > is unplugged, but the driver stack has not reinstalled on the vendor
> device)
> > There may well be more problem cases, but I've not investigated further=
.
> >
> > Owen
> >
>
> It's something I've been looking at as well.
>
> Basically, when the driver is installed online, it will only populate
> the registry keys
> HKLM\SYSTEM\DriverDatabase\DriverPackages\xenbus.inf_*\Descriptors\PCI\*
> corresponding to the active device.
> Once another device is installed, Windows is unable to pick up and
> install the driver. So forced unplug/activation and vendor device
> binding are incompatible at the moment.
>
> Interestingly, the problem will not exist when the driver is installed
> offline via Dism, as it will populate the registry with all the
> supported device IDs.
>
> One way to fix this is to (only when forced unplug/activation is set):
> - make xenbus.inf bind to PCI\VEN_5853 or something equivalent instead
> of a list of branded device IDs;
> - for each child PDO, add a compatible ID without the vendor device ID
> (e.g. XENBUS\VEN_@VENDOR_PREFIX@&DEV_VBD&REV_0900000B);
> - make xenvbd.inf bind to that compatible ID
>
> This should make sure that the full driver chain is available during
> boot time, at the cost of potentially breaking Windows Update delivery.
>
> I've tested this on Server 2022 and it seems to work.
>
> Related:
>
> https://community.osr.com/t/hklm-system-driverdatabase-driverpackages-bus=
-driver-inf-not-properly-configured/52214
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000bec8c6063b49dfab
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">It may be possible to change the PDO&#39;s DeviceID to not include the f=
ull XenBus DeviceID, only the VENDOR_PREFIX_STR (to avoid compatibility=C2=
=A0issues between different vendor driver sets) and the device type.=C2=A0<=
br>e.g. DeviceID =3D &quot;XENBUS\VEN_XP&amp;DEV_VBD&quot;<br>Keep the Comp=
atibleIDs including the XenBus DeviceID would allow vendors to limit Window=
s Update distribution to their VENDOR_PREFIX_STR=C2=A0+ VENDOR_DEVICE_ID. T=
he INF files would require an exact match against a CompatibleID, which wou=
ld also include the REV part, preventing child devices installing on parent=
 devices that dont expose the correct interface versions.<br><br>Then this =
change and a combination of ForceActivate and ForceUnplug should cover most=
 edge=C2=A0cases.<br><br>Owen</div></div><br><div class=3D"gmail_quote gmai=
l_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jul 31, 20=
25 at 4:03=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">On 31/07/2025 16:26, O=
wen Smith wrote:<br>
&gt; Having played with this a bit, there seems to be several edge cases th=
at <br>
&gt; are fatal.<br>
&gt; 1) installing on 1 device (e.g. 0002) without any others seems to work=
. <br>
&gt; Shutting down, and changing the device (e.g. to 0001) and booting, wil=
l <br>
&gt; trigger an 0x7B bugcheck (emulated disk is unplugged, but the PV disk =
<br>
&gt; has not bound to the 0001 device nodes)<br>
&gt; 2) installing on 1 device (e.g. 0002), shutting down and adding the <b=
r>
&gt; vendor device will trigger a 0x7B bugcheck on boot (as the emulated di=
sk <br>
&gt; is unplugged, but the driver stack has not reinstalled on the vendor d=
evice)<br>
&gt; There may well be more problem cases, but I&#39;ve not investigated fu=
rther.<br>
&gt; <br>
&gt; Owen<br>
&gt; <br>
<br>
It&#39;s something I&#39;ve been looking at as well.<br>
<br>
Basically, when the driver is installed online, it will only populate <br>
the registry keys <br>
HKLM\SYSTEM\DriverDatabase\DriverPackages\xenbus.inf_*\Descriptors\PCI\*<br=
>
corresponding to the active device.<br>
Once another device is installed, Windows is unable to pick up and <br>
install the driver. So forced unplug/activation and vendor device <br>
binding are incompatible at the moment.<br>
<br>
Interestingly, the problem will not exist when the driver is installed <br>
offline via Dism, as it will populate the registry with all the <br>
supported device IDs.<br>
<br>
One way to fix this is to (only when forced unplug/activation is set):<br>
- make xenbus.inf bind to PCI\VEN_5853 or something equivalent instead <br>
of a list of branded device IDs;<br>
- for each child PDO, add a compatible ID without the vendor device ID <br>
(e.g. XENBUS\VEN_@VENDOR_PREFIX@&amp;DEV_VBD&amp;REV_0900000B);<br>
- make xenvbd.inf bind to that compatible ID<br>
<br>
This should make sure that the full driver chain is available during <br>
boot time, at the cost of potentially breaking Windows Update delivery.<br>
<br>
I&#39;ve tested this on Server 2022 and it seems to work.<br>
<br>
Related: <br>
<a href=3D"https://community.osr.com/t/hklm-system-driverdatabase-driverpac=
kages-bus-driver-inf-not-properly-configured/52214" rel=3D"noreferrer" targ=
et=3D"_blank">https://community.osr.com/t/hklm-system-driverdatabase-driver=
packages-bus-driver-inf-not-properly-configured/52214</a><br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--000000000000bec8c6063b49dfab--


From win-pv-devel-bounces@lists.xenproject.org Fri Aug 01 09:31:07 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 01 Aug 2025 09:31:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1067045.1432010 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uhm6T-0001Gs-Um; Fri, 01 Aug 2025 09:31:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1067045.1432010; Fri, 01 Aug 2025 09:31:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uhm6T-0001Gl-SD; Fri, 01 Aug 2025 09:31:05 +0000
Received: by outflank-mailman (input) for mailman id 1067045;
 Fri, 01 Aug 2025 09:31:04 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5uPS=2N=bounce.vates.tech=bounce-md_30504962.688c8950.v1-90ee5966de724e6db8ececbe50dba7fe@srs-se1.protection.inumbo.net>)
 id 1uhm6S-0001FT-8T
 for win-pv-devel@lists.xenproject.org; Fri, 01 Aug 2025 09:31:04 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 3a641e9e-6eba-11f0-b895-0df219b8e170;
 Fri, 01 Aug 2025 11:30:57 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4btgg41qfTzNCd9RR
 for <win-pv-devel@lists.xenproject.org>; Fri,  1 Aug 2025 09:30:56 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 90ee5966de724e6db8ececbe50dba7fe; Fri, 01 Aug 2025 09:30:56 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3a641e9e-6eba-11f0-b895-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754040656; x=1754310656;
	bh=H5tTqRxgHyF7VcM4Ow/BiECImkLUMf+5oVgcjuINsbs=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=etSkXnVTQtyn/W7gpgdcwlt582HoOmVfVoseOlsMkp026UwMcTWLd38qHeJcSs+Iz
	 m8FU4mMFUUSIhJ8XnNYsR/RvpI37iZx0baCCIOdEPjLpnRShKcdUaRVrLkeuj1AhPu
	 ghM2LUAx+JcDvmjG+ddiPlncY10kQnMB39T5QJe1rbKxMO3phlCcICzY3Vf6XrkimV
	 1smdbQD2MBpULqmWhVSUSeSen+mWbPAkHMhNnqOUvZbU3tiUQgCD43RLIo71b8GILr
	 8U0Z7MIopwkA6FMc2NVq1vWYb5Jfa8TMBzhL5IzJPZeqGuES3Dgfhj28GpXHeG9f22
	 W20gtnZT6M0ew==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754040656; x=1754301156; i=ngoc-tu.dinh@vates.tech;
	bh=H5tTqRxgHyF7VcM4Ow/BiECImkLUMf+5oVgcjuINsbs=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=hKB/ZnNZW1Cwufj1LVieoq07fAKT/WZ3hkdaJv4zSpX4kla8voXUzQOqd1ON8WRn6
	 +P0lBXUH11yWgEBVqcnSOKlIS/7yCcVYI0xaoqYzSoGbT125uNT1hjthlsRq/qJgOp
	 kE1jH1MasLRUufmt+jJ/FfF1KzUS4lFH9LSF1fKJe/agK4SUj7DDe/DY2L9gliWf2h
	 wNo/7x16gDVlzhJKB8E8vxL1yuTi5nmxZ6V89YjmIkvW7fk0FpM1jfa5u3Pk+e1r3o
	 i/O8Csfc+gsUaNVOxEarHZlBwirtmb/K609z367AVWd21hjeK8YLfjdxwsDMBBk25F
	 E5hxD/dlkOnbQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH=20v2=200/7]=20Implement=20forced=20unplug=20and=20forced=20activation?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754040655398
Message-Id: <d806925b-0086-42b5-84a5-5bc6b2f0c0a2@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org
References: <20250723135819.988-1-ngoc-tu.dinh@vates.tech> <CAC_UY88Gftfmu-Bqz-axFyOmAu5Fqur4=OL_QTPLG0LdfA3GWg@mail.gmail.com> <d433745f-a580-4435-8505-ffcb96574f84@vates.tech> <CAC_UY88OxN81KssUSnGx79cXq3wqwRnq21oYqgou+6y6GWzdHw@mail.gmail.com>
In-Reply-To: <CAC_UY88OxN81KssUSnGx79cXq3wqwRnq21oYqgou+6y6GWzdHw@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.90ee5966de724e6db8ececbe50dba7fe?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250801:md
Date: Fri, 01 Aug 2025 09:30:56 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 01/08/2025 10:52, Owen Smith wrote:
> It may be possible to change the PDO's DeviceID to not include the full 
> XenBus DeviceID, only the VENDOR_PREFIX_STR (to avoid 
> compatibility=C2=A0issues between different vendor driver sets) and the 
> device type.
> e.g. DeviceID =3D "XENBUS\VEN_XP&DEV_VBD"
> Keep the CompatibleIDs including the XenBus DeviceID would allow vendors 
> to limit Windows Update distribution to their VENDOR_PREFIX_STR=C2=A0+ 
> VENDOR_DEVICE_ID. The INF files would require an exact match against a 
> CompatibleID, which would also include the REV part, preventing child 
> devices installing on parent devices that dont expose the correct 
> interface versions.
> 
> Then this change and a combination of ForceActivate and ForceUnplug 
> should cover most edge=C2=A0cases.
> 
> Owen
> 
Thanks Owen. It's a good solution for the Xenbus PDO issue. Although now 
that I reviewed the documentation I think we might need some changes to 
the feature scores of Xenvbd.inf to make sure that Windows Update 
drivers will bind preferentially over non-Windows Update ones.

I also have a concern with the platform device binding, as this will 
also need to be under one device/compatible ID for Windows to pick up 
the Xenbus driver on boot once the device ID changes. Namely, binding 
xenbus.inf to PCI\VEN_5853 will lead to a worse ranking than the 
previous drivers that bound to PCI\VEN_5853&DEV_000x / 
PCI\VEN_5853&DEV_Cyyy&SUBSYS_Cyyy5853&REV_01, and so we might need to 
set the feature score to compensate.

I noticed that there are some devices under PCI\VEN_5853 that are not 
platform or vendor devices (5853:c110 and 5853:c147). Are they currently 
being used? Increasing the feature score will cause Xenbus.inf to bind 
instead of these drivers and break these devices.

I'll try to suss out the INF changes needed to see how driver selection 
would be impacted by the series.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069551.1433414 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDq-0006aP-T3; Mon, 04 Aug 2025 15:35:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069551.1433414; Mon, 04 Aug 2025 15:35:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDq-0006aH-Oe; Mon, 04 Aug 2025 15:35:34 +0000
Received: by outflank-mailman (input) for mailman id 1069551;
 Mon, 04 Aug 2025 15:35:33 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xwLf=2Q=bounce.vates.tech=bounce-md_30504962.6890d33f.v1-bc8775114fd74eee8395e9263d817376@srs-se1.protection.inumbo.net>)
 id 1uixDp-0006Ww-Rs
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:33 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a5979eaa-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:30 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcH17wFzNCd96k
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:27 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 bc8775114fd74eee8395e9263d817376; Mon, 04 Aug 2025 15:35:27 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a5979eaa-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321727; x=1754591727;
	bh=EDbZjw8zBplW27vyMxzAEVkuB+RqAQpytVZ4C91S0/E=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=y1WhpgTaelCnstONW8qqngc6MMv5k61xfVYeNSN7Bv7Z1bXbQ+nzJ6PyucP0iU1GP
	 UO8sF+lmlaOeDWuE2SzEs0BMYllQ6r9ve87Nscl/AUx0I/YvqW9MRo+BQg+Hm6DfB5
	 qL1t5VHNPrPOgzeaGtJVWKiOKm2SCco/AKxJwbkVk+xUAC03GUpefDED0Ifcejr8Jd
	 oJw2FFIX7A3v3jzZdObcy3p201zolYQMc3kSQDCgOf8KScnwWnj3SD849Ye+8bF43a
	 V6EEaJBEJr6s6tVv0pIhNAS4ccFdzLLiOB+bH7Gvrj8AbBCOfHaa/SfwqCdPnZPNgV
	 znBi+jhSWeDFw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321727; x=1754582227; i=ngoc-tu.dinh@vates.tech;
	bh=EDbZjw8zBplW27vyMxzAEVkuB+RqAQpytVZ4C91S0/E=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=Sp/BH4jSLiKzjVv6QHUnGKKfBh8lunByner+TV/WOqS+O/GHC9Z1Nwy3Tvi3qXcwJ
	 lOk6E2t1Ey3OizjLwX54CzABoRRv5nUmsiOi/t90pYxyxjJ8nBnOjzYH5r9HWvE7PD
	 bCIa9V5y6Ei8Nns2h3U7WFLP9bxh0+zaIqzVUdBYaBO1abHNA0dPtAfDLsq8FH34i2
	 vF1uLwx9Z4QgQJTTtAxPheKhLwvmisUu+2aoB7fiwlZQRmEp2QN0DKIoJRw8ynx7+G
	 9hFP/zF4vYqSXuqSUzu4c0gcqcyYN0nxup6XBixQtKuzrGZUIlmMTkeRcKOgiSnHvz
	 gVK3/hjXZY/+Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=200/9]=20Implement=20forced=20unplug=20and=20forced=20activation?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321725907
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.bc8775114fd74eee8395e9263d817376?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:27 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The goal of these two features is to simplify driver servicing and avoid
requiring storing driver state in Registry.

Forced unplug, as name implies, forcefully unplugs emulated devices when
a driver is present, rather than when it's active. It defines a Registry
key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced
unplug by creating an appropriate value (DISKS/NICS) in this key.

Note that since it's no longer possible to guarantee removal of Registry
values during driver uninstallation by Windows, driver uninstallers are
expected to remove these values themselves.

Forced activation is the companion to forced unplug. It aims to make
activation of Xenbus FDOs deterministic and stateless, using a
precedence mapping based on device IDs, prioritizing the vendor device
over the generic ones. This avoids situations where the wrong FDO is
activated, which will prevent Windows Update from working.

With forced activation, Xenfilt is now installed via INF on top of the
current installation routines. This means PV drivers can be injected
offline without needing another reboot to be reconfigured.

Care is taken to keep compatibility with older drivers. The two features
are also conditioned behind new build environment variables FORCE_UNPLUG
and FORCE_ACTIVATE.

Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.
Deprecate PDO revisions 0x09000007 and earlier to make room for the new
revision.

With forced unplug/activation, the whole boot chain of boot-critical
drivers must be available in the driver store to avoid
INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware
IDs into one INF Models entry.

The following scenarios have been successfully tested, requiring only
one reboot each:
* Offline driver installation via DISM
* Fresh install, followed by switching from device 0001 to 0002
* Fresh install, followed by toggling vendor device
* Xenbus/Xenvbd update

Other tested scenarios:
* Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling
  device ID
* Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2)

Changes in v3:
* Deprecated PDO revisions 0x09000007 and earlier to make room for
  0x0900000C
* Merged all hardware IDs into one INF Models entry to avoid BSODs when
  changing platform device IDs and toggling vendor device
* Added a note mentioning the role of driver uninstallers in cleanup of
  forced unplug/activation drivers.

v2: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.html
* Added forced activation

v1: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.html

Tu Dinh (9):
  Deprecate PDO revisions 0x09000007 and earlier
  Merge all hardware IDs into one Models entry
  Add forced unplug support
  xenfilt: Add Xenbus device precedence mechanism
  Add EMULATED v3
  xenbus: Use nonpaged pool in FdoQueryId
  Use EMULATED v3 to force activate Xenbus FDOs
  Enable Xenbus precedence
  Install Xenfilt with INF AddReg

 include/cache_interface.h       |  32 +-----
 include/emulated_interface.h    |  57 +++++++----
 include/evtchn_interface.h      |  96 +-----------------
 include/gnttab_interface.h      |  48 +--------
 include/revision.h              |  11 +--
 include/shared_info_interface.h |  23 +----
 scripts/genfiles.ps1            |   2 +
 src/xen/driver.c                |  79 ++++++++++++---
 src/xen/driver.h                |   5 +
 src/xen/unplug.c                |  13 ++-
 src/xenbus.inf                  |  25 +++--
 src/xenbus/cache.c              |  54 -----------
 src/xenbus/evtchn.c             | 166 --------------------------------
 src/xenbus/fdo.c                | 122 ++++++++++++++++-------
 src/xenbus/gnttab.c             |  82 ----------------
 src/xenbus/shared_info.c        |  41 --------
 src/xenfilt/driver.c            |  51 +++++++++-
 src/xenfilt/driver.h            |   7 ++
 src/xenfilt/emulated.c          |  87 +++++++++--------
 src/xenfilt/emulated.h          |   1 +
 src/xenfilt/fdo.c               |  25 ++++-
 src/xenfilt/pdo.c               |  80 ++++++++++++---
 src/xenfilt/pdo.h               |  10 +-
 23 files changed, 428 insertions(+), 689 deletions(-)

-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069549.1433403 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDp-0006XE-Ol; Mon, 04 Aug 2025 15:35:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069549.1433403; Mon, 04 Aug 2025 15:35:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDp-0006X7-Lw; Mon, 04 Aug 2025 15:35:33 +0000
Received: by outflank-mailman (input) for mailman id 1069549;
 Mon, 04 Aug 2025 15:35:32 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=b9wV=2Q=bounce.vates.tech=bounce-md_30504962.6890d33f.v1-cf4b3991b2c745f0903fd9ca60ebe2c4@srs-se1.protection.inumbo.net>)
 id 1uixDo-0006Ww-5q
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:32 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a5ce5f19-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:30 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcH733gzBsThjH
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:27 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 cf4b3991b2c745f0903fd9ca60ebe2c4; Mon, 04 Aug 2025 15:35:27 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a5ce5f19-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321728; x=1754591728;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=wPBi81HRjt1O2wl27ZOVPFzTuET+7oByRtncB7NuN0h84RAgL57h6NeFftNV9r4oN
	 EQjjaJDW1MTRWW7/Md0yCZ5Fnw6z8hny/4gYhcbEIgHfjTGw/3xLKsK63RHOJN9ZKc
	 VBtXR4eGIUjw16FQk1OHVZ/1PY1dJJdrRzgPOcg+HHZUJ6RpCnw7yKbyKA2F9NyUV6
	 +WD4Hj2kfbGLdhuDHNhEA2ltH90N+Z1ryQnd+nG10MGpB28v9ILZxJ+Dl/4lT5IZil
	 bi9tOIyYl5ZLGKL+joqImTBJO1N65+L4rIY9AG4DPdEzXafObLkvVMgITiRvMjHBX9
	 sxHHAHWzh1gdQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321728; x=1754582228; i=ngoc-tu.dinh@vates.tech;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Ta0bZVvoAqm5aT7TWQSP7apDu67xfpj5B37GoWi/A4l0kbdCCOf6TWmeXieJSoqqE
	 dP+yuECC9jYxNo94Apjbkca+xTR0BY7slX3fUwvcWcsCbtUHWZlOdDTKJ7vWLxaYAy
	 XyGunFK6djEjx4sh1Maid7zlX6T1cH/Qsq8vvUSkLE17JkUS0mtGKQYqSQ/z47iLwM
	 2wCcqIUP6XVLDeL+mIdOGLlDnANZKt3e/61wf/e9cvUElq+gLXSfTfR88RN1i405KA
	 k+3B0s/mkXpklQNcKqiT26ksmJvAlMQHr9Z05QYD24ENmDcr0lP9GMB07YizUvhdp0
	 yQudgJJ2c2XoQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=203/9]=20Add=20forced=20unplug=20support?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321726964
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.cf4b3991b2c745f0903fd9ca60ebe2c4?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:27 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Forced unplug aims to simplify driver servicing by, as its name implies,
forcefully unplugging emulated devices when a driver is present, rather
than when it's active.

Create a Registry key at CurrentControlSet\XEN\ForceUnplug. Drivers can
opt into forced unplug by creating an appropriate value (DISKS/NICS)
in this key.

Older drivers are not affected.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xen/driver.c | 79 ++++++++++++++++++++++++++++++++++++++----------
 src/xen/driver.h |  5 +++
 src/xen/unplug.c | 13 ++++++--
 3 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/src/xen/driver.c b/src/xen/driver.c
index b44753c..7b2621b 100644
--- a/src/xen/driver.c
+++ b/src/xen/driver.c
@@ -63,6 +63,7 @@ typedef struct _XEN_DRIVER {
     PLOG_DISPOSITION    QemuDisposition;
     HANDLE              ParametersKey;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     HANDLE              MemoryKey;
 } XEN_DRIVER, *PXEN_DRIVER;
 
@@ -144,6 +145,30 @@ DriverGetUnplugKey(
     return __DriverGetUnplugKey();
 }
 
+static FORCEINLINE VOID
+__DriverSetForceUnplugKey(
+    _In_opt_ HANDLE Key
+    )
+{
+    Driver.ForceUnplugKey = Key;
+}
+
+static FORCEINLINE HANDLE
+__DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return Driver.ForceUnplugKey;
+}
+
+HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return __DriverGetForceUnplugKey();
+}
+
 static FORCEINLINE VOID
 __DriverSetMemoryKey(
     _In_opt_ HANDLE Key
@@ -500,6 +525,7 @@ DllInitialize(
     HANDLE                  ServiceKey;
     HANDLE                  ParametersKey;
     HANDLE                  UnplugKey;
+    HANDLE                  ForceUnplugKey;
     HANDLE                  MemoryKey;
     LOG_LEVEL               LogLevel;
     NTSTATUS                status;
@@ -577,12 +603,21 @@ DllInitialize(
 
     __DriverSetUnplugKey(UnplugKey);
 
+    status = RegistryCreateSubKey(ServiceKey,
+                                  "ForceUnplug",
+                                  REG_OPTION_NON_VOLATILE,
+                                  &ForceUnplugKey);
+    if (!NT_SUCCESS(status))
+        goto fail6;
+
+    __DriverSetForceUnplugKey(ForceUnplugKey);
+
     status = RegistryCreateSubKey(ServiceKey,
                                   "Memory",
                                   REG_OPTION_VOLATILE,
                                   &MemoryKey);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     __DriverSetMemoryKey(MemoryKey);
 
@@ -590,27 +625,27 @@ DllInitialize(
 
     status = AcpiInitialize();
     if (!NT_SUCCESS(status))
-        goto fail7;
+        goto fail8;
 
     status = SystemInitialize();
     if (!NT_SUCCESS(status))
-        goto fail8;
+        goto fail9;
 
     status = BugCheckInitialize();
     if (!NT_SUCCESS(status))
-        goto fail9;
+        goto fail10;
 
     status = ModuleInitialize();
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = ProcessInitialize();
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = UnplugInitialize();
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     RegistryCloseKey(ServiceKey);
 
@@ -618,39 +653,45 @@ DllInitialize(
 
     return STATUS_SUCCESS;
 
+fail13:
+    Error("fail13\n");
+
+    ProcessTeardown();
+
 fail12:
     Error("fail12\n");
 
-    ProcessTeardown();
+    ModuleTeardown();
 
 fail11:
     Error("fail11\n");
 
-    ModuleTeardown();
+    BugCheckTeardown();
 
 fail10:
     Error("fail10\n");
 
-    BugCheckTeardown();
+    SystemTeardown();
 
 fail9:
     Error("fail9\n");
 
-    SystemTeardown();
+    AcpiTeardown();
 
 fail8:
     Error("fail8\n");
 
-    AcpiTeardown();
-
-fail7:
-    Error("fail7\n");
-
     HypercallTeardown();
 
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+fail7:
+    Error("fail7\n");
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
 fail6:
     Error("fail6\n");
 
@@ -698,6 +739,7 @@ DllUnload(
     )
 {
     HANDLE  MemoryKey;
+    HANDLE  ForceUnplugKey;
     HANDLE  UnplugKey;
     HANDLE  ParametersKey;
 
@@ -722,6 +764,11 @@ DllUnload(
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+    ForceUnplugKey = __DriverGetForceUnplugKey();
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
     UnplugKey = __DriverGetUnplugKey();
 
     RegistryCloseKey(UnplugKey);
diff --git a/src/xen/driver.h b/src/xen/driver.h
index 21df779..6851e01 100644
--- a/src/xen/driver.h
+++ b/src/xen/driver.h
@@ -43,6 +43,11 @@ DriverGetUnplugKey(
     VOID
     );
 
+extern HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    );
+
 extern PMDL
 DriverGetNamedPages(
     _In_ PSTR   Name,
diff --git a/src/xen/unplug.c b/src/xen/unplug.c
index dbd9a2e..282ed93 100644
--- a/src/xen/unplug.c
+++ b/src/xen/unplug.c
@@ -266,6 +266,7 @@ UnplugSetRequest(
 {
     PUNPLUG_CONTEXT     Context = &UnplugContext;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     PSTR                ValueName;
     PSTR                EnumName;
     ULONG               Value;
@@ -277,6 +278,7 @@ UnplugSetRequest(
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
     UnplugKey = DriverGetUnplugKey();
+    ForceUnplugKey = DriverGetForceUnplugKey();
 
     switch (Type) {
     case UNPLUG_DISKS:
@@ -293,17 +295,24 @@ UnplugSetRequest(
         ASSERT(FALSE);
     }
 
+    status = RegistryQueryDwordValue(ForceUnplugKey,
+                                     ValueName,
+                                     &Value);
+    if (NT_SUCCESS(status) && Value)
+        goto unplug;
+
     status = RegistryQueryDwordValue(UnplugKey,
                                      ValueName,
                                      &Value);
     if (!NT_SUCCESS(status))
         goto done;
 
-    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
-
     if (Value != 0)
         (VOID) UnplugCheckEnumKey(EnumName, &Value);
 
+unplug:
+    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
+
     Info("%s (%u)\n", ValueName, Value);
 
     AcquireHighLock(&Context->Lock, &Irql);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069550.1433407 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDp-0006XX-SN; Mon, 04 Aug 2025 15:35:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069550.1433407; Mon, 04 Aug 2025 15:35:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDp-0006XJ-NH; Mon, 04 Aug 2025 15:35:33 +0000
Received: by outflank-mailman (input) for mailman id 1069550;
 Mon, 04 Aug 2025 15:35:33 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zmHu=2Q=bounce.vates.tech=bounce-md_30504962.6890d33f.v1-1de0a38ba427411fbeb1ffd521d11fb4@srs-se1.protection.inumbo.net>)
 id 1uixDo-0006Ww-VY
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:32 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a5d9a0c8-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:30 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcH5Q8PzBsThh3
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:27 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 1de0a38ba427411fbeb1ffd521d11fb4; Mon, 04 Aug 2025 15:35:27 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a5d9a0c8-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321727; x=1754591727;
	bh=l30qDCLHDDfrbo0tMgJwuV2Z8FlhffPhglM2kxFbGnc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=EMO9QNUfmmFQjiCm7cabL+HGDRU1q4aoijeMOI+NxwoWi1Ln+LPIGNhNCcARkxsR4
	 TgWGmr3GoNLp0x1Cs43Oiu96W8x5frap8cep2lzE/+ev6H1jJOlULYYdnyaoG0xG99
	 V/631sgEB3t4xSmaX60gQjtT0b4FzCLaHmYIK+P0eqZimZaFMbeQyqcsv9sb88W+f5
	 o6jmhBC4OwLsMJ83Alyy4L0U5V7VGBQG16WnS2y9MKBssy7Fw8Anl/TWGKXUtYaB4x
	 FPQ4hC4W95ep7tfqmHdB35eH9ufjAdTcmSbseD4av2BfgHyLxT/wZvkTsSOpNbbJdP
	 n2KTerlp+KTRQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321727; x=1754582227; i=ngoc-tu.dinh@vates.tech;
	bh=l30qDCLHDDfrbo0tMgJwuV2Z8FlhffPhglM2kxFbGnc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=A+jdr1odZy5XalzD9Yach9KBVwPwQpo0mrYiHPW/tul74DfMkxJ9KxN04cZrDEdAt
	 iSmYRUS/TujB1YQhqVlgeagaxPK5QQBuAsTD1HuAy+D7KFL8jgSo5d6T00KaW0xbWc
	 7Qf4vltuhZP4h8veAlRkbkIj0S7+96R8KRoMiwew0mscpIfXqrK753tS76WoXbTXiA
	 k+rbdu7Z/oJ+xCD5WfNz1CO+d2p+TC9boZwYHLYHR7ipSrlDbfw7ZIL/HcL+mVEKK+
	 9XOVZk/JSTdcZBBmoO1Cu4WmM6jogrzLepiKOnAclaQDWot+5J/t+YrDMFbppdkb4t
	 rK1ysMekFhAYA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=202/9]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321726580
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.1de0a38ba427411fbeb1ffd521d11fb4?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:27 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index 7cc9ac2..bbd22a0 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dl
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenBusName_VEND%	=XenBus_Inst,	PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
-%XenBusName_0002%	=XenBus_Inst,	PCI\VEN_5853&DEV_0002
-%XenBusName_0001%	=XenBus_Inst,	PCI\VEN_5853&DEV_0001
+%XenBusName%=XenBus_Inst,\
+PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01\
+,PCI\VEN_5853&DEV_0002\
+,PCI\VEN_5853&DEV_0001
 
 [XenBus_Inst] 
 CopyFiles=XenBus_CopyFiles
 CopyFiles=Monitor_CopyFiles
+FeatureScore=0xFE
 
 [XenBus_Inst.Services]
 AddService=xenbus_monitor,%SPSVCSINST_STARTSERVICE%,Monitor_Service,Monitor_EventLog
@@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@" 
 DiskDesc="@PRODUCT_NAME@ PV Bus Package" 
 XenBusName="@PRODUCT_NAME@ PV Bus"
-XenBusName_VEND="@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)"
-XenBusName_0002="@PRODUCT_NAME@ PV Bus (0002)"
-XenBusName_0001="@PRODUCT_NAME@ PV Bus (0001)"
 XenFiltName="@PRODUCT_NAME@ Generic Bus Filter"
 MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069552.1433416 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDr-0006ch-TQ; Mon, 04 Aug 2025 15:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069552.1433416; Mon, 04 Aug 2025 15:35:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDr-0006cZ-Q0; Mon, 04 Aug 2025 15:35:35 +0000
Received: by outflank-mailman (input) for mailman id 1069552;
 Mon, 04 Aug 2025 15:35:34 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=m632=2Q=bounce.vates.tech=bounce-md_30504962.6890d340.v1-cb5435ae378b4ff8b4f1ef9c04b7995b@srs-se1.protection.inumbo.net>)
 id 1uixDq-0006Ww-SD
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:34 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a8041162-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:32 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcJ10w6zBsThkS
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:28 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 cb5435ae378b4ff8b4f1ef9c04b7995b; Mon, 04 Aug 2025 15:35:28 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8041162-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321728; x=1754591728;
	bh=fSh5mM9Vwv2+CVlaeX+a4NI7z0y1ZHC2forMfoa7G2Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=ANZ8w3pepClPJIo0Y6xtoaJk9COsOh7uu0LZWmyqPYE3g1aqqjBUVrDk4jqJSMwzz
	 jDnWmI16l1aA/bkbRpLiRaC8TB8mvM+sEpItJ95+6Tar6Zk5X4JT6q2MUM/vOmWAKD
	 sl/zXfFWJvQ5OjBdj6qcskzWWrcAtBEOm2xd6KLMys/2s2g5m8S+8EnEouz6MCqqLq
	 lQw46tGJ9NZzugeL5cpUspTULAf5T1fgFrX3YoZiaPcWR5Y2K2yvTO/AYKJeQl3EgX
	 mG+N97tSnkU9blrD3XZ7wtokCAYnedd0s5Zvbqqw8kXQKyoic/YeiQEFxcGV1WKMSA
	 akBOWZCFBkFlA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321728; x=1754582228; i=ngoc-tu.dinh@vates.tech;
	bh=fSh5mM9Vwv2+CVlaeX+a4NI7z0y1ZHC2forMfoa7G2Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Ph0i28X88EpZbq/6TuTa8m9tzAEEdog8LF1tMOY/O+E7pinvz6jXzN0yqEIobOXfd
	 SFsGbA+3fyS9E97brRuRJuBDHq3doImK6bvju4VMTYK7X/vcyRNsh+rz7VVuZekfjT
	 7Dsftr0extZDWawg1Sytxxv55Mju5PMOdUB880hRTMGBncDogaZq4wVH9Gl0N6RClb
	 khM4nSBbNLa9PCVjOqsiLk6F60Mil9CE3rY+nbsg5krjF9KUEJV6EhyvYiD05hjbzb
	 jNDghLyHeg0vPpF/3X+CtVE74VSrgoEPYjn6f+sVmoFbhiwNui3acDFn7f9zVH9Sli
	 R5MX0t/b1yFeg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=204/9]=20xenfilt:=20Add=20Xenbus=20device=20precedence=20mechanism?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321727180
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.cb5435ae378b4ff8b4f1ef9c04b7995b?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:28 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define registry values in xenfilt\Parameters with the names being
compatible IDs and values being numeric precedences.

The Xenbus device with the highest precedence should always be activated
over devices with lower precedence, ignoring Active* values.

If a device is force-activated, get its IDs directly instead of via
Active* values.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenfilt/driver.c | 35 ++++++++++++++++++++
 src/xenfilt/driver.h |  7 ++++
 src/xenfilt/fdo.c    | 25 +++++++++++++-
 src/xenfilt/pdo.c    | 79 ++++++++++++++++++++++++++++++++++++--------
 src/xenfilt/pdo.h    | 10 +++++-
 5 files changed, 141 insertions(+), 15 deletions(-)

diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 16e4deb..8f39b8d 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -279,6 +279,41 @@ DriverGetActive(
     return __DriverGetActive(Key, Value);
 }
 
+_On_failure_(_Post_satisfies_(*Value == 0))
+NTSTATUS
+DriverGetPrecedence(
+    _In_ PCSTR      Id,
+    _Out_ PULONG    Value
+    )
+{
+    HANDLE          ParametersKey;
+    NTSTATUS        status;
+
+    status = RegistryOpenParametersKey(KEY_READ, &ParametersKey);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = RegistryQueryDwordValue(ParametersKey,
+                                     (PSTR)Id,
+                                     Value);
+    if (!NT_SUCCESS(status))
+        goto fail2;
+
+    Info("%s found precedence %04lX\n", Id, *Value);
+
+    RegistryCloseKey(ParametersKey);
+
+    return STATUS_SUCCESS;
+
+fail2:
+    RegistryCloseKey(ParametersKey);
+
+fail1:
+    *Value = 0;
+
+    return status;
+}
+
 static BOOLEAN
 DriverIsActivePresent(
     VOID
diff --git a/src/xenfilt/driver.h b/src/xenfilt/driver.h
index 9c703c1..01ab5b7 100644
--- a/src/xenfilt/driver.h
+++ b/src/xenfilt/driver.h
@@ -54,6 +54,13 @@ DriverGetActive(
     _Outptr_result_z_ PSTR  *Value
     );
 
+_On_failure_(_Post_satisfies_(*Value == 0))
+extern NTSTATUS
+DriverGetPrecedence(
+    _In_ PCSTR      Id,
+    _Out_ PULONG    Value
+    );
+
 typedef enum _XENFILT_FILTER_STATE {
     XENFILT_FILTER_ENABLED = 0,
     XENFILT_FILTER_PENDING,
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 594da4a..250f1ab 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -404,6 +404,8 @@ FdoEnumerate(
     ULONG                   Count;
     PLIST_ENTRY             ListEntry;
     ULONG                   Index;
+    ULONG                   ActiveIndex;
+    ULONG                   Precedence;
     NTSTATUS                status;
 
     Count = Relations->Count;
@@ -458,11 +460,32 @@ FdoEnumerate(
         ListEntry = Next;
     }
 
+    ActiveIndex = Precedence = 0;
+    for (Index = 0; Index < Count; Index++) {
+        ULONG   ThisPrecedence;
+
+        if (PhysicalDeviceObject[Index] != NULL) {
+            status = PdoGetPrecedence(PhysicalDeviceObject[Index],
+                                      &ThisPrecedence);
+            if (ThisPrecedence > Precedence) {
+                ActiveIndex = Index;
+                Precedence = ThisPrecedence;
+            }
+        }
+    }
+
     // Walk the list and create PDO filters for any new devices
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            (VOID) PdoCreate(Fdo, PhysicalDeviceObject[Index], Fdo->Type);
+            LONG    ForceActivate = 0;
+
+            if (Precedence > 0)
+                ForceActivate = Index == ActiveIndex ? 1 : -1;
+            (VOID) PdoCreate(Fdo,
+                             PhysicalDeviceObject[Index],
+                             Fdo->Type,
+                             ForceActivate);
             ObDereferenceObject(PhysicalDeviceObject[Index]);
         }
     }
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 4f40c4f..48ae3a3 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -249,7 +249,8 @@ __PdoGetFdo(
 
 static NTSTATUS
 PdoSetDeviceInformation(
-    _In_ PXENFILT_PDO   Pdo
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ LONG           ForceActivate
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -265,19 +266,23 @@ PdoSetDeviceInformation(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    status = DriverGetActive("DeviceID",
-                             &ActiveDeviceID);
-    if (NT_SUCCESS(status)) {
-        Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
-                      TRUE :
-                      FALSE;
-
-        ExFreePool(ActiveDeviceID);
+    if (ForceActivate) {
+        Pdo->Active = ForceActivate > 0;
     } else {
-        Pdo->Active = FALSE;
+        status = DriverGetActive("DeviceID",
+                                &ActiveDeviceID);
+        if (NT_SUCCESS(status)) {
+            Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
+                        TRUE :
+                        FALSE;
+
+            ExFreePool(ActiveDeviceID);
+        } else {
+            Pdo->Active = FALSE;
+        }
     }
 
-    if (Pdo->Active) {
+    if (Pdo->Active && !ForceActivate) {
         status = DriverGetActive("InstanceID",
                                  &InstanceID);
         if (!NT_SUCCESS(status))
@@ -1618,11 +1623,59 @@ PdoSuspend(
     UNREFERENCED_PARAMETER(Pdo);
 }
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+NTSTATUS
+PdoGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    )
+{
+    PSTR                CompatibleIDs;
+    ULONG               Index;
+    NTSTATUS            status;
+
+    status = DriverQueryId(PhysicalDeviceObject,
+                           BusQueryCompatibleIDs,
+                           &CompatibleIDs);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    Index = 0;
+
+    do {
+        ULONG           Length;
+
+        Length = (ULONG)strlen(&CompatibleIDs[Index]);
+        if (Length == 0)
+            break;
+
+        status = DriverGetPrecedence(&CompatibleIDs[Index],
+                                     Precedence);
+        if (NT_SUCCESS(status))
+            goto done;
+
+        Index += Length + 1;
+    } while (1);
+
+    *Precedence = 0;
+
+done:
+    ExFreePool(CompatibleIDs);
+
+    return STATUS_SUCCESS;
+
+fail1:
+    *Precedence = 0;
+
+    return status;
+}
+
 NTSTATUS
 PdoCreate(
     _In_ PXENFILT_FDO                   Fdo,
     _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ LONG                           ForceActivate
     )
 {
     PDEVICE_OBJECT                      LowerDeviceObject;
@@ -1680,7 +1733,7 @@ PdoCreate(
     Pdo->LowerDeviceObject = LowerDeviceObject;
     Pdo->Type = Type;
 
-    status = PdoSetDeviceInformation(Pdo);
+    status = PdoSetDeviceInformation(Pdo, ForceActivate);
     if (!NT_SUCCESS(status))
         goto fail4;
 
diff --git a/src/xenfilt/pdo.h b/src/xenfilt/pdo.h
index 85bc07f..75a1412 100644
--- a/src/xenfilt/pdo.h
+++ b/src/xenfilt/pdo.h
@@ -78,11 +78,19 @@ PdoGetDeviceObject(
     _In_ PXENFILT_PDO   Pdo
     );
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+extern NTSTATUS
+PdoGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    );
+
 extern NTSTATUS
 PdoCreate(
     _In_ PXENFILT_FDO                   Fdo,
     _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ LONG                           ForceActivate
     );
 
 extern VOID
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:37 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069553.1433420 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDs-0006ez-VE; Mon, 04 Aug 2025 15:35:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069553.1433420; Mon, 04 Aug 2025 15:35:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDs-0006eq-S6; Mon, 04 Aug 2025 15:35:36 +0000
Received: by outflank-mailman (input) for mailman id 1069553;
 Mon, 04 Aug 2025 15:35:35 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VdCy=2Q=bounce.vates.tech=bounce-md_30504962.6890d33f.v1-ce158e576a9344e09f857a6b4daa5abf@srs-se1.protection.inumbo.net>)
 id 1uixDr-0006bt-8Z
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:35 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id a5962436-7148-11f0-b898-0df219b8e170;
 Mon, 04 Aug 2025 17:35:29 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcH2jymzNCd98X
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:27 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 ce158e576a9344e09f857a6b4daa5abf; Mon, 04 Aug 2025 15:35:27 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a5962436-7148-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321727; x=1754591727;
	bh=IQrylPklfnIEWJMvdfLktrS3P91oSckPsLnoeLUqEe4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=AnUuZlP+lIALLaMALEyrZy1MM7aiYXcSbwRL4reu06MDenZKOOoGy19L6CdtiOhAU
	 G/RgixqlhXl/IUzy5S0LUrWj3X0qHMsMKa14QfEFAsaqtldvqWqgtjX2wg6rWlDAQp
	 zrGQ72Iu4EOeYaQsAOJpNft/0aCOuGXCxLz3bYcc3iEtJNsZMMJGIrShbbEUjAqTKk
	 QWBtXdtpQuqR/2W7P/4Ki1kP9ZTW1PLORz1tAcMluOTpTtuIFILqypMc8lUcQluZ9n
	 jAs7LJRkyU20vHWA9TeG8ASoLEVY1Sy78Z540BdXcyqet524QpThNUpynjqLBeDqS/
	 ZKHvvllFMC/9w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321727; x=1754582227; i=ngoc-tu.dinh@vates.tech;
	bh=IQrylPklfnIEWJMvdfLktrS3P91oSckPsLnoeLUqEe4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=bJA/gmfOvBUHVHd/WGTUHxOY8vhxoQkoZyRwT5NQP2v3UumxlhhWFCRTRhV4i1LDB
	 AC0yCPjXt8MS7Fc5OjL2OfNa8oCSWm0ZPvwu82wfiQbh0RRKhbqjHBI+KOSnjx1AZ7
	 VVJwSpK8Lzb4eQEV2rAYU+Ef8eu6R0B7O+97JjfH2PxOGzMnY1WNGaHulsSiXOelPu
	 rlBkh9slxTzdbXjYBB2vFBBb4esCcQPQpZJ9R8h+lqFhTDDaBRmoa4u0qMNGbHbdlz
	 Kje6PAFRSIXHjsGBXCTEFQvhnSr8UkJNAECXGRQcg92puq0oWJULWCyNuhMcYrpygS
	 6CUXHHWM0RLcA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=201/9]=20Deprecate=20PDO=20revisions=200x09000007=20and=20earlier?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321726350
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.ce158e576a9344e09f857a6b4daa5abf?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:27 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

0x09000008 has been available since 2021.

Deprecate the old PDO revisions to make space for new revisions.

The following interface versions are removed as a result:
* SHARED_INFO v2
* EVTCHN v5-v8
* CACHE v1
* GNTTAB v2-v3
* EMULATED v1

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/cache_interface.h       |  32 +-----
 include/emulated_interface.h    |  21 +---
 include/evtchn_interface.h      |  96 +-----------------
 include/gnttab_interface.h      |  48 +--------
 include/revision.h              |   8 --
 include/shared_info_interface.h |  23 +----
 src/xenbus/cache.c              |  54 -----------
 src/xenbus/evtchn.c             | 166 --------------------------------
 src/xenbus/gnttab.c             |  82 ----------------
 src/xenbus/shared_info.c        |  41 --------
 src/xenfilt/emulated.c          |  45 ---------
 11 files changed, 6 insertions(+), 610 deletions(-)

diff --git a/include/cache_interface.h b/include/cache_interface.h
index e5f4ce9..eb233d3 100644
--- a/include/cache_interface.h
+++ b/include/cache_interface.h
@@ -124,20 +124,6 @@ typedef VOID
     _In_ PVOID  Argument
     );
 
-typedef NTSTATUS
-(*XENBUS_CACHE_CREATE_V1)(
-    _In_ PINTERFACE                 Interface,
-    _In_ PCSTR                      Name,
-    _In_ ULONG                      Size,
-    _In_ ULONG                      Reservation,
-    _In_ XENBUS_CACHE_CTOR          Ctor,
-    _In_ XENBUS_CACHE_DTOR          Dtor,
-    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
-    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
-    _In_opt_ PVOID                  Argument,
-    _Outptr_ PXENBUS_CACHE          *Cache
-    );
-
 /*! \typedef XENBUS_CACHE_CREATE
     \brief Create a cache of objects of the given \a Size
 
@@ -220,22 +206,8 @@ typedef VOID
 DEFINE_GUID(GUID_XENBUS_CACHE_INTERFACE,
 0xa98dfd78, 0x416a, 0x4949, 0x92, 0xa5, 0xe0, 0x84, 0xf2, 0xf4, 0xb4, 0x4e);
 
-/*! \struct _XENBUS_CACHE_INTERFACE_V1
-    \brief CACHE interface version 1
-    \ingroup interfaces
-*/
-struct _XENBUS_CACHE_INTERFACE_V1 {
-    INTERFACE               Interface;
-    XENBUS_CACHE_ACQUIRE    CacheAcquire;
-    XENBUS_CACHE_RELEASE    CacheRelease;
-    XENBUS_CACHE_CREATE_V1  CacheCreateVersion1;
-    XENBUS_CACHE_GET        CacheGet;
-    XENBUS_CACHE_PUT        CachePut;
-    XENBUS_CACHE_DESTROY    CacheDestroy;
-};
-
 /*! \struct _XENBUS_CACHE_INTERFACE_V2
-    \brief CACHE interface version 1
+    \brief CACHE interface version 2
     \ingroup interfaces
 */
 struct _XENBUS_CACHE_INTERFACE_V2 {
@@ -258,7 +230,7 @@ typedef struct _XENBUS_CACHE_INTERFACE_V2 XENBUS_CACHE_INTERFACE, *PXENBUS_CACHE
 
 #endif  // _WINDLL
 
-#define XENBUS_CACHE_INTERFACE_VERSION_MIN  1
+#define XENBUS_CACHE_INTERFACE_VERSION_MIN  2
 #define XENBUS_CACHE_INTERFACE_VERSION_MAX  2
 
 #endif  // _XENBUS_CACHE_INTERFACE_H
diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index ead9c14..a6c79f9 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -79,13 +79,6 @@ typedef BOOLEAN
     _In_opt_ PSTR   InstanceID
     );
 
-typedef BOOLEAN
-(*XENFILT_EMULATED_IS_DISK_PRESENT_V1)(
-    _In_ PVOID  Context,
-    _In_ ULONG  Controller,
-    _In_ ULONG  Target,
-    _In_ ULONG  Lun
-    );
 /*! \typedef XENFILT_EMULATED_IS_DISK_PRESENT
     \brief Determine whether a given emulated disk is present in the VM
 
@@ -105,18 +98,6 @@ typedef BOOLEAN
 DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
 0x959027a1, 0xfcce, 0x4e78, 0xbc, 0xf4, 0x63, 0x73, 0x84, 0xf4, 0x99, 0xc5);
 
-/*! \struct _XENFILT_EMULATED_INTERFACE_V1
-    \brief EMULATED interface version 1
-    \ingroup interfaces
-*/
-struct _XENFILT_EMULATED_INTERFACE_V1 {
-    INTERFACE                           Interface;
-    XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
-    XENFILT_EMULATED_RELEASE            EmulatedRelease;
-    XENFILT_EMULATED_IS_DEVICE_PRESENT  EmulatedIsDevicePresent;
-    XENFILT_EMULATED_IS_DISK_PRESENT_V1 EmulatedIsDiskPresentVersion1;
-};
-
 /*! \struct _XENFILT_EMULATED_INTERFACE_V2
     \brief EMULATED interface version 2
     \ingroup interfaces
@@ -139,7 +120,7 @@ typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENF
 
 #endif  // _WINDLL
 
-#define XENFILT_EMULATED_INTERFACE_VERSION_MIN  1
+#define XENFILT_EMULATED_INTERFACE_VERSION_MIN  2
 #define XENFILT_EMULATED_INTERFACE_VERSION_MAX  2
 
 #endif  // _XENFILT_EMULATED_INTERFACE_H
diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h
index 5c46f97..250b9d4 100644
--- a/include/evtchn_interface.h
+++ b/include/evtchn_interface.h
@@ -131,13 +131,6 @@ typedef NTSTATUS
     _In_ UCHAR                  Number
     );
 
-typedef VOID
-(*XENBUS_EVTCHN_UNMASK_V4)(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
-    _In_ BOOLEAN                InCallback
-    );
-
 /*! \typedef XENBUS_EVTCHN_UNMASK
     \brief Unmask an event channel
 
@@ -154,12 +147,6 @@ typedef BOOLEAN
     _In_ BOOLEAN                Force
     );
 
-typedef VOID
-(*XENBUS_EVTCHN_SEND_V1)(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel
-    );
-
 /*! \typedef XENBUS_EVTCHN_SEND
     \brief Send an event to the remote end of the channel
 
@@ -200,13 +187,6 @@ typedef ULONG
     _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
-typedef NTSTATUS
-(*XENBUS_EVTCHN_WAIT_V5)(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
-    _In_opt_ PLARGE_INTEGER     Timeout
-    );
-
 /*! \typedef XENBUS_EVTCHN_WAIT
     \brief Wait for events to the local end of the channel
 
@@ -252,80 +232,6 @@ typedef VOID
 DEFINE_GUID(GUID_XENBUS_EVTCHN_INTERFACE,
 0xbe2440ac, 0x1098, 0x4150, 0xaf, 0x4d, 0x45, 0x2f, 0xad, 0xce, 0xf9, 0x23);
 
-/*! \struct _XENBUS_EVTCHN_INTERFACE_V5
-    \brief EVTCHN interface version 5
-    \ingroup interfaces
-*/
-struct _XENBUS_EVTCHN_INTERFACE_V5 {
-    INTERFACE               Interface;
-    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
-    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
-    XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
-    XENBUS_EVTCHN_SEND_V1   EvtchnSendVersion1;
-    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
-    XENBUS_EVTCHN_WAIT_V5   EvtchnWaitVersion5;
-    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
-    XENBUS_EVTCHN_CLOSE     EvtchnClose;
-};
-
-/*! \struct _XENBUS_EVTCHN_INTERFACE_V6
-    \brief EVTCHN interface version 6
-    \ingroup interfaces
-*/
-struct _XENBUS_EVTCHN_INTERFACE_V6 {
-    INTERFACE               Interface;
-    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
-    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
-    XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
-    XENBUS_EVTCHN_SEND      EvtchnSend;
-    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
-    XENBUS_EVTCHN_WAIT_V5   EvtchnWaitVersion5;
-    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
-    XENBUS_EVTCHN_CLOSE     EvtchnClose;
-};
-
-/*! \struct _XENBUS_EVTCHN_INTERFACE_V7
-    \brief EVTCHN interface version 7
-    \ingroup interfaces
-*/
-struct _XENBUS_EVTCHN_INTERFACE_V7 {
-    INTERFACE               Interface;
-    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
-    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
-    XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
-    XENBUS_EVTCHN_SEND      EvtchnSend;
-    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
-    XENBUS_EVTCHN_GET_COUNT EvtchnGetCount;
-    XENBUS_EVTCHN_WAIT      EvtchnWait;
-    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
-    XENBUS_EVTCHN_CLOSE     EvtchnClose;
-};
-
-/*! \struct _XENBUS_EVTCHN_INTERFACE_V8
-    \brief EVTCHN interface version 8
-    \ingroup interfaces
-*/
-struct _XENBUS_EVTCHN_INTERFACE_V8 {
-    INTERFACE               Interface;
-    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
-    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
-    XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
-    XENBUS_EVTCHN_SEND      EvtchnSend;
-    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
-    XENBUS_EVTCHN_GET_COUNT EvtchnGetCount;
-    XENBUS_EVTCHN_WAIT      EvtchnWait;
-    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
-    XENBUS_EVTCHN_CLOSE     EvtchnClose;
-};
-
 /*! \struct _XENBUS_EVTCHN_INTERFACE_V9
     \brief EVTCHN interface version 9
     \ingroup interfaces
@@ -355,7 +261,7 @@ typedef struct _XENBUS_EVTCHN_INTERFACE_V9 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVT
 
 #endif  // _WINDLL
 
-#define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 5
+#define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 9
 #define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 9
 
 #endif  // _XENBUS_EVTCHN_INTERFACE_H
diff --git a/include/gnttab_interface.h b/include/gnttab_interface.h
index 92a95a7..9d8357b 100644
--- a/include/gnttab_interface.h
+++ b/include/gnttab_interface.h
@@ -73,17 +73,6 @@ typedef VOID
     _In_ PINTERFACE Interface
     );
 
-typedef NTSTATUS
-(*XENBUS_GNTTAB_CREATE_CACHE_V1)(
-    _In_ PINTERFACE                 Interface,
-    _In_ PCSTR                      Name,
-    _In_ ULONG                      Reservation,
-    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
-    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
-    _In_opt_ PVOID                  Argument,
-    _Outptr_ PXENBUS_GNTTAB_CACHE   *Cache
-    );
-
 /*! \typedef XENBUS_GNTTAB_CREATE_CACHE
     \brief Create a cache of grant table entries
 
@@ -234,41 +223,6 @@ typedef NTSTATUS
 DEFINE_GUID(GUID_XENBUS_GNTTAB_INTERFACE,
 0x763679c5, 0xe5c2, 0x4a6d, 0x8b, 0x88, 0x6b, 0xb0, 0x2e, 0xc4, 0x2d, 0x8e);
 
-/*! \struct _XENBUS_GNTTAB_INTERFACE_V2
-    \brief GNTTAB interface version 2
-    \ingroup interfaces
-*/
-struct _XENBUS_GNTTAB_INTERFACE_V2 {
-    INTERFACE                           Interface;
-    XENBUS_GNTTAB_ACQUIRE               GnttabAcquire;
-    XENBUS_GNTTAB_RELEASE               GnttabRelease;
-    XENBUS_GNTTAB_CREATE_CACHE_V1       GnttabCreateCacheVersion1;
-    XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess;
-    XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess;
-    XENBUS_GNTTAB_GET_REFERENCE         GnttabGetReference;
-    XENBUS_GNTTAB_DESTROY_CACHE         GnttabDestroyCache;
-    XENBUS_GNTTAB_MAP_FOREIGN_PAGES     GnttabMapForeignPages;
-    XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES   GnttabUnmapForeignPages;
-};
-
-/*! \struct _XENBUS_GNTTAB_INTERFACE_V3
-    \brief GNTTAB interface version 3
-    \ingroup interfaces
-*/
-struct _XENBUS_GNTTAB_INTERFACE_V3 {
-    INTERFACE                           Interface;
-    XENBUS_GNTTAB_ACQUIRE               GnttabAcquire;
-    XENBUS_GNTTAB_RELEASE               GnttabRelease;
-    XENBUS_GNTTAB_CREATE_CACHE_V1       GnttabCreateCacheVersion1;
-    XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess;
-    XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess;
-    XENBUS_GNTTAB_GET_REFERENCE         GnttabGetReference;
-    XENBUS_GNTTAB_QUERY_REFERENCE       GnttabQueryReference;
-    XENBUS_GNTTAB_DESTROY_CACHE         GnttabDestroyCache;
-    XENBUS_GNTTAB_MAP_FOREIGN_PAGES     GnttabMapForeignPages;
-    XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES   GnttabUnmapForeignPages;
-};
-
 /*! \struct _XENBUS_GNTTAB_INTERFACE_V4
     \brief GNTTAB interface version 4
     \ingroup interfaces
@@ -297,7 +251,7 @@ typedef struct _XENBUS_GNTTAB_INTERFACE_V4 XENBUS_GNTTAB_INTERFACE, *PXENBUS_GNT
 
 #endif  // _WINDLL
 
-#define XENBUS_GNTTAB_INTERFACE_VERSION_MIN 2
+#define XENBUS_GNTTAB_INTERFACE_VERSION_MIN 4
 #define XENBUS_GNTTAB_INTERFACE_VERSION_MAX 4
 
 #endif  // _XENBUS_GNTTAB_INTERFACE_H
diff --git a/include/revision.h b/include/revision.h
index 4c5607a..e9e62e6 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -48,14 +48,6 @@
 
 //                    REVISION   S  SI   E   D  ST   R   C   G   U  CO  EM
 #define DEFINE_REVISION_TABLE                                                \
-    DEFINE_REVISION(0x09000000,  1,  2,  5,  1,  2,  1,  1,  2,  1,  0,  1), \
-    DEFINE_REVISION(0x09000001,  1,  2,  6,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000002,  1,  2,  7,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000003,  1,  2,  8,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000004,  1,  2,  8,  1,  2,  1,  1,  3,  1,  1,  1), \
-    DEFINE_REVISION(0x09000005,  1,  2,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000006,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000007,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
diff --git a/include/shared_info_interface.h b/include/shared_info_interface.h
index 5fdedfd..a14b545 100644
--- a/include/shared_info_interface.h
+++ b/include/shared_info_interface.h
@@ -123,11 +123,6 @@ typedef BOOLEAN
     _In_ ULONG      Port
     );
 
-typedef LARGE_INTEGER
-(*XENBUS_SHARED_INFO_GET_TIME_V2)(
-    _In_ PINTERFACE Interface
-    );
-
 /*! \typedef XENBUS_SHARED_INFO_GET_TIME
     \brief Retrieve the wallclock time from the shared info
 
@@ -146,22 +141,6 @@ typedef VOID
 DEFINE_GUID(GUID_XENBUS_SHARED_INFO_INTERFACE,
 0x7e73c34f, 0x1640, 0x4649, 0xa8, 0xf3, 0x26, 0x3b, 0xc9, 0x30, 0xa0, 0x4);
 
-/*! \struct _XENBUS_SHARED_INFO_INTERFACE_V2
-    \brief SHARED_INFO interface version 2
-    \ingroup interfaces
-*/
-struct _XENBUS_SHARED_INFO_INTERFACE_V2 {
-    INTERFACE                           Interface;
-    XENBUS_SHARED_INFO_ACQUIRE          SharedInfoAcquire;
-    XENBUS_SHARED_INFO_RELEASE          SharedInfoRelease;
-    XENBUS_SHARED_INFO_UPCALL_PENDING   SharedInfoUpcallPending;
-    XENBUS_SHARED_INFO_EVTCHN_POLL      SharedInfoEvtchnPoll;
-    XENBUS_SHARED_INFO_EVTCHN_ACK       SharedInfoEvtchnAck;
-    XENBUS_SHARED_INFO_EVTCHN_MASK      SharedInfoEvtchnMask;
-    XENBUS_SHARED_INFO_EVTCHN_UNMASK    SharedInfoEvtchnUnmask;
-    XENBUS_SHARED_INFO_GET_TIME_V2      SharedInfoGetTimeVersion2;
-};
-
 /*! \struct _XENBUS_SHARED_INFO_INTERFACE_V3
     \brief SHARED_INFO interface version 3
     \ingroup interfaces
@@ -205,7 +184,7 @@ typedef struct _XENBUS_SHARED_INFO_INTERFACE_V4 XENBUS_SHARED_INFO_INTERFACE, *P
 
 #endif  // _WINDLL
 
-#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MIN    2
+#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MIN    3
 #define XENBUS_SHARED_INFO_INTERFACE_VERSION_MAX    4
 
 #endif  // _XENBUS_SHARED_INFO_H
diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index d60ae29..2123ed0 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -943,33 +943,6 @@ fail1:
     return status;
 }
 
-static NTSTATUS
-CacheCreateVersion1(
-    _In_ PINTERFACE         Interface,
-    _In_ PCSTR              Name,
-    _In_ ULONG              Size,
-    _In_ ULONG              Reservation,
-    _In_ NTSTATUS           (*Ctor)(PVOID, PVOID),
-    _In_ VOID               (*Dtor)(PVOID, PVOID),
-    _In_ VOID               (*AcquireLock)(PVOID),
-    _In_ VOID               (*ReleaseLock)(PVOID),
-    _In_ PVOID              Argument,
-    _Outptr_ PXENBUS_CACHE  *Cache
-    )
-{
-    return CacheCreate(Interface,
-                       Name,
-                       Size,
-                       Reservation,
-                       0,
-                       Ctor,
-                       Dtor,
-                       AcquireLock,
-                       ReleaseLock,
-                       Argument,
-                       Cache);
-}
-
 static VOID
 CacheDestroy(
     _In_ PINTERFACE         Interface,
@@ -1210,16 +1183,6 @@ done:
     KeReleaseSpinLock(&Context->Lock, Irql);
 }
 
-static struct _XENBUS_CACHE_INTERFACE_V1 CacheInterfaceVersion1 = {
-    { sizeof (struct _XENBUS_CACHE_INTERFACE_V1), 1, NULL, NULL, NULL },
-    CacheAcquire,
-    CacheRelease,
-    CacheCreateVersion1,
-    CacheGet,
-    CachePut,
-    CacheDestroy
-};
-
 static struct _XENBUS_CACHE_INTERFACE_V2 CacheInterfaceVersion2 = {
     { sizeof (struct _XENBUS_CACHE_INTERFACE_V2), 2, NULL, NULL, NULL },
     CacheAcquire,
@@ -1294,23 +1257,6 @@ CacheGetInterface(
     ASSERT(Context != NULL);
 
     switch (Version) {
-    case 1: {
-        struct _XENBUS_CACHE_INTERFACE_V1   *CacheInterface;
-
-        CacheInterface = (struct _XENBUS_CACHE_INTERFACE_V1 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_CACHE_INTERFACE_V1))
-            break;
-
-        *CacheInterface = CacheInterfaceVersion1;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
     case 2: {
         struct _XENBUS_CACHE_INTERFACE_V2   *CacheInterface;
 
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index 7d6d69e..250790d 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -886,16 +886,6 @@ done:
     return Pending;
 }
 
-static VOID
-EvtchnUnmaskVersion4(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
-    _In_ BOOLEAN                InUpcall
-    )
-{
-    EvtchnUnmask(Interface, Channel, InUpcall, TRUE);
-}
-
 static VOID
 EvtchnSend(
     _In_ PINTERFACE             Interface,
@@ -912,19 +902,6 @@ EvtchnSend(
         (VOID) EventChannelSend(Channel->LocalPort);
 }
 
-static VOID
-EvtchnSendVersion1(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel
-    )
-{
-    KIRQL                       Irql;
-
-    KeRaiseIrql(DISPATCH_LEVEL, &Irql);
-    EvtchnSend(Interface, Channel);
-    KeLowerIrql(Irql);
-}
-
 static VOID
 EvtchnClose(
     _In_ PINTERFACE             Interface,
@@ -1067,23 +1044,6 @@ EvtchnWait(
     return status;
 }
 
-static NTSTATUS
-EvtchnWaitVersion5(
-    _In_ PINTERFACE             Interface,
-    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
-    _In_ PLARGE_INTEGER         Timeout
-    )
-{
-    ULONG                       Count;
-
-    Count = EvtchnGetCount(Interface, Channel);
-
-    return EvtchnWait(Interface,
-                      Channel,
-                      Count + 1,
-                      Timeout);
-}
-
 _Function_class_(KSERVICE_ROUTINE)
 _IRQL_requires_(HIGH_LEVEL)
 _IRQL_requires_same_
@@ -1816,64 +1776,6 @@ done:
     KeReleaseSpinLock(&Context->Lock, Irql);
 }
 
-static struct _XENBUS_EVTCHN_INTERFACE_V5 EvtchnInterfaceVersion5 = {
-    { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V5), 5, NULL, NULL, NULL },
-    EvtchnAcquire,
-    EvtchnRelease,
-    EvtchnOpen,
-    EvtchnBind,
-    EvtchnUnmaskVersion4,
-    EvtchnSendVersion1,
-    EvtchnTrigger,
-    EvtchnWaitVersion5,
-    EvtchnGetPort,
-    EvtchnClose,
-};
-
-static struct _XENBUS_EVTCHN_INTERFACE_V6 EvtchnInterfaceVersion6 = {
-    { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V6), 6, NULL, NULL, NULL },
-    EvtchnAcquire,
-    EvtchnRelease,
-    EvtchnOpen,
-    EvtchnBind,
-    EvtchnUnmaskVersion4,
-    EvtchnSend,
-    EvtchnTrigger,
-    EvtchnWaitVersion5,
-    EvtchnGetPort,
-    EvtchnClose,
-};
-
-static struct _XENBUS_EVTCHN_INTERFACE_V7 EvtchnInterfaceVersion7 = {
-    { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V7), 7, NULL, NULL, NULL },
-    EvtchnAcquire,
-    EvtchnRelease,
-    EvtchnOpen,
-    EvtchnBind,
-    EvtchnUnmaskVersion4,
-    EvtchnSend,
-    EvtchnTrigger,
-    EvtchnGetCount,
-    EvtchnWait,
-    EvtchnGetPort,
-    EvtchnClose,
-};
-
-static struct _XENBUS_EVTCHN_INTERFACE_V8 EvtchnInterfaceVersion8 = {
-    { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V8), 8, NULL, NULL, NULL },
-    EvtchnAcquire,
-    EvtchnRelease,
-    EvtchnOpen,
-    EvtchnBind,
-    EvtchnUnmask,
-    EvtchnSend,
-    EvtchnTrigger,
-    EvtchnGetCount,
-    EvtchnWait,
-    EvtchnGetPort,
-    EvtchnClose,
-};
-
 static struct _XENBUS_EVTCHN_INTERFACE_V9 EvtchnInterfaceVersion9 = {
     { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V9), 9, NULL, NULL, NULL },
     EvtchnAcquire,
@@ -2006,74 +1908,6 @@ EvtchnGetInterface(
     ASSERT(Context != NULL);
 
     switch (Version) {
-    case 5: {
-        struct _XENBUS_EVTCHN_INTERFACE_V5  *EvtchnInterface;
-
-        EvtchnInterface = (struct _XENBUS_EVTCHN_INTERFACE_V5 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_EVTCHN_INTERFACE_V5))
-            break;
-
-        *EvtchnInterface = EvtchnInterfaceVersion5;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
-    case 6: {
-        struct _XENBUS_EVTCHN_INTERFACE_V6  *EvtchnInterface;
-
-        EvtchnInterface = (struct _XENBUS_EVTCHN_INTERFACE_V6 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_EVTCHN_INTERFACE_V6))
-            break;
-
-        *EvtchnInterface = EvtchnInterfaceVersion6;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
-    case 7: {
-        struct _XENBUS_EVTCHN_INTERFACE_V7  *EvtchnInterface;
-
-        EvtchnInterface = (struct _XENBUS_EVTCHN_INTERFACE_V7 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_EVTCHN_INTERFACE_V7))
-            break;
-
-        *EvtchnInterface = EvtchnInterfaceVersion7;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
-    case 8: {
-        struct _XENBUS_EVTCHN_INTERFACE_V8  *EvtchnInterface;
-
-        EvtchnInterface = (struct _XENBUS_EVTCHN_INTERFACE_V8 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_EVTCHN_INTERFACE_V8))
-            break;
-
-        *EvtchnInterface = EvtchnInterfaceVersion8;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
     case 9: {
         struct _XENBUS_EVTCHN_INTERFACE_V9  *EvtchnInterface;
 
diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 693e9b3..240d5a4 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -443,27 +443,6 @@ fail1:
     return status;
 }
 
-static NTSTATUS
-GnttabCreateCacheVersion1(
-    _In_ PINTERFACE                 Interface,
-    _In_ PCSTR                      Name,
-    _In_ ULONG                      Reservation,
-    _In_ VOID                       (*AcquireLock)(PVOID),
-    _In_ VOID                       (*ReleaseLock)(PVOID),
-    _In_ PVOID                      Argument,
-    _Outptr_ PXENBUS_GNTTAB_CACHE   *Cache
-    )
-{
-    return GnttabCreateCache(Interface,
-                             Name,
-                             Reservation,
-                             0,
-                             AcquireLock,
-                             ReleaseLock,
-                             Argument,
-                             Cache);
-}
-
 static VOID
 GnttabDestroyCache(
     _In_ PINTERFACE             Interface,
@@ -1038,33 +1017,6 @@ done:
     KeReleaseSpinLock(&Context->Lock, Irql);
 }
 
-static struct _XENBUS_GNTTAB_INTERFACE_V2   GnttabInterfaceVersion2 = {
-    { sizeof (struct _XENBUS_GNTTAB_INTERFACE_V2), 2, NULL, NULL, NULL },
-    GnttabAcquire,
-    GnttabRelease,
-    GnttabCreateCacheVersion1,
-    GnttabPermitForeignAccess,
-    GnttabRevokeForeignAccess,
-    GnttabGetReference,
-    GnttabDestroyCache,
-    GnttabMapForeignPages,
-    GnttabUnmapForeignPages
-};
-
-static struct _XENBUS_GNTTAB_INTERFACE_V3   GnttabInterfaceVersion3 = {
-    { sizeof (struct _XENBUS_GNTTAB_INTERFACE_V3), 3, NULL, NULL, NULL },
-    GnttabAcquire,
-    GnttabRelease,
-    GnttabCreateCacheVersion1,
-    GnttabPermitForeignAccess,
-    GnttabRevokeForeignAccess,
-    GnttabGetReference,
-    GnttabQueryReference,
-    GnttabDestroyCache,
-    GnttabMapForeignPages,
-    GnttabUnmapForeignPages
-};
-
 static struct _XENBUS_GNTTAB_INTERFACE_V4   GnttabInterfaceVersion4 = {
     { sizeof (struct _XENBUS_GNTTAB_INTERFACE_V4), 4, NULL, NULL, NULL },
     GnttabAcquire,
@@ -1158,40 +1110,6 @@ GnttabGetInterface(
     ASSERT(Context != NULL);
 
     switch (Version) {
-    case 2: {
-        struct _XENBUS_GNTTAB_INTERFACE_V2  *GnttabInterface;
-
-        GnttabInterface = (struct _XENBUS_GNTTAB_INTERFACE_V2 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_GNTTAB_INTERFACE_V2))
-            break;
-
-        *GnttabInterface = GnttabInterfaceVersion2;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
-    case 3: {
-        struct _XENBUS_GNTTAB_INTERFACE_V3  *GnttabInterface;
-
-        GnttabInterface = (struct _XENBUS_GNTTAB_INTERFACE_V3 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_GNTTAB_INTERFACE_V3))
-            break;
-
-        *GnttabInterface = GnttabInterfaceVersion3;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
     case 4: {
         struct _XENBUS_GNTTAB_INTERFACE_V4  *GnttabInterface;
 
diff --git a/src/xenbus/shared_info.c b/src/xenbus/shared_info.c
index 06e0aec..82fe766 100644
--- a/src/xenbus/shared_info.c
+++ b/src/xenbus/shared_info.c
@@ -442,18 +442,6 @@ SharedInfoGetTime(
 #undef NS_PER_S
 }
 
-static LARGE_INTEGER
-SharedInfoGetTimeVersion2(
-    _In_ PINTERFACE Interface
-    )
-{
-    LARGE_INTEGER   Time;
-
-    SharedInfoGetTime(Interface, &Time, NULL);
-
-    return Time;
-}
-
 static VOID
 SharedInfoMap(
     _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
@@ -805,18 +793,6 @@ done:
     KeReleaseSpinLock(&Context->Lock, Irql);
 }
 
-static struct _XENBUS_SHARED_INFO_INTERFACE_V2 SharedInfoInterfaceVersion2 = {
-    { sizeof (struct _XENBUS_SHARED_INFO_INTERFACE_V2), 2, NULL, NULL, NULL },
-    SharedInfoAcquire,
-    SharedInfoRelease,
-    SharedInfoUpcallPending,
-    SharedInfoEvtchnPoll,
-    SharedInfoEvtchnAck,
-    SharedInfoEvtchnMask,
-    SharedInfoEvtchnUnmask,
-    SharedInfoGetTimeVersion2
-};
-
 static struct _XENBUS_SHARED_INFO_INTERFACE_V3 SharedInfoInterfaceVersion3 = {
     { sizeof (struct _XENBUS_SHARED_INFO_INTERFACE_V3), 3, NULL, NULL, NULL },
     SharedInfoAcquire,
@@ -899,23 +875,6 @@ SharedInfoGetInterface(
     ASSERT(Context != NULL);
 
     switch (Version) {
-    case 2: {
-        struct _XENBUS_SHARED_INFO_INTERFACE_V2 *SharedInfoInterface;
-
-        SharedInfoInterface = (struct _XENBUS_SHARED_INFO_INTERFACE_V2 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENBUS_SHARED_INFO_INTERFACE_V2))
-            break;
-
-        *SharedInfoInterface = SharedInfoInterfaceVersion2;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
     case 3: {
         struct _XENBUS_SHARED_INFO_INTERFACE_V3 *SharedInfoInterface;
 
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index 9065364..ca358c7 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -390,26 +390,6 @@ EmulatedIsDiskPresent(
     return (ListEntry != &Context->List) ? TRUE : FALSE;
 }
 
-static BOOLEAN
-EmulatedIsDiskPresentVersion1(
-    _In_ PINTERFACE             Interface,
-    _In_ ULONG                  Controller,
-    _In_ ULONG                  Target,
-    _In_ ULONG                  Lun
-    )
-{
-    UNREFERENCED_PARAMETER(Controller);
-    UNREFERENCED_PARAMETER(Lun);
-
-    //
-    // XENVBD erroneously passes the disk number of the PV disk as
-    // the IDE target number (i.e. in can pass a value > 1), with
-    // Controller always set to 0. So, simply treat the Target argument
-    // as the PV disk number and call the new method.
-    //
-    return EmulatedIsDiskPresent(Interface, Target);
-}
-
 NTSTATUS
 EmulatedAcquire(
     _In_ PINTERFACE             Interface
@@ -450,14 +430,6 @@ done:
     KeReleaseSpinLock(&Context->Lock, Irql);
 }
 
-static struct _XENFILT_EMULATED_INTERFACE_V1 EmulatedInterfaceVersion1 = {
-    { sizeof (struct _XENFILT_EMULATED_INTERFACE_V1), 1, NULL, NULL, NULL },
-    EmulatedAcquire,
-    EmulatedRelease,
-    EmulatedIsDevicePresent,
-    EmulatedIsDiskPresentVersion1
-};
-
 static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
@@ -507,23 +479,6 @@ EmulatedGetInterface(
     ASSERT(Context != NULL);
 
     switch (Version) {
-    case 1: {
-        struct _XENFILT_EMULATED_INTERFACE_V1   *EmulatedInterface;
-
-        EmulatedInterface = (struct _XENFILT_EMULATED_INTERFACE_V1 *)Interface;
-
-        status = STATUS_BUFFER_OVERFLOW;
-        if (Size < sizeof (struct _XENFILT_EMULATED_INTERFACE_V1))
-            break;
-
-        *EmulatedInterface = EmulatedInterfaceVersion1;
-
-        ASSERT3U(Interface->Version, ==, Version);
-        Interface->Context = Context;
-
-        status = STATUS_SUCCESS;
-        break;
-    }
     case 2: {
         struct _XENFILT_EMULATED_INTERFACE_V2   *EmulatedInterface;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:37 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069554.1433426 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDt-0006fN-7e; Mon, 04 Aug 2025 15:35:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069554.1433426; Mon, 04 Aug 2025 15:35:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDs-0006f7-Tw; Mon, 04 Aug 2025 15:35:36 +0000
Received: by outflank-mailman (input) for mailman id 1069554;
 Mon, 04 Aug 2025 15:35:35 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zx7B=2Q=bounce.vates.tech=bounce-md_30504962.6890d340.v1-f8688b6974674808848fcd57468fd420@srs-se1.protection.inumbo.net>)
 id 1uixDr-0006Ww-SJ
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:35 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a8d6c3dc-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:33 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcJ4W1KzBsTkKy
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:28 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 f8688b6974674808848fcd57468fd420; Mon, 04 Aug 2025 15:35:28 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8d6c3dc-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321728; x=1754591728;
	bh=zUrUGcrJf9Vd/BVYWvvdObiM419KDj6B3XF4EgzB4q0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=J3buamRfcWxbbQFU9Rny6EXXZYTjZSTbsU3cBF5MKnc0/W+mnaZ5A+wchUZX4FGcR
	 jomGi5Q3rR//8AwNgz0g9frUZUG5ZvcTV+DMKFKQ7hfd3OdzBstIlKTt7KXoLVDtlc
	 SzN18fl1Khm9PlRJi3aUzjqUu/r0zssJ4wrBDK7t+GecZ/cIyhCBZCD5xtfAVNp6l2
	 WbpCvJ6aECAuiiil1jbQrdEklDVsiqtFt93amxzu6RL21KwHeoeXVYUwNkaVduspbk
	 55NzxV3qZxOlGgaiXp7uDwsOnbi9BnoOIldcIWCmRtamcnuKI32iNLx6YnJvNGg3ww
	 nzInXe4tU9IDQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321728; x=1754582228; i=ngoc-tu.dinh@vates.tech;
	bh=zUrUGcrJf9Vd/BVYWvvdObiM419KDj6B3XF4EgzB4q0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=CF9hbLn094Fs0hImxmOUUZVKaqKAGuxLGta2j/v950ZkH4JqJubfq9+c5Hgpb+dou
	 2mS0Zmeg60Jk/sAQjlNyKuv0qBxuLZ0Gr8gcuhCLTtMUiSQWDoz3B0w/rvyjdw3xGQ
	 Gum+SM0nCYD+s9wn6jJpeROy2vg6XUNDfr0mwzZV7HxisqEo+yOIv4XPLV+eU37dPI
	 3nn3Fx4KwVLvutncEbbr1LmEqlyhg90n/VFXBjFnKVu7HfYt561KNiQMzHgb/+7DON
	 7UYDVBLheno5MGwpFUldaArGVGKzDkvQmj9C8foUHyVneimbI7eAsfiHySKTLFzpQb
	 6ANty2Eeunx9A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=206/9]=20xenbus:=20Use=20nonpaged=20pool=20in=20FdoQueryId?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321727676
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-7-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f8688b6974674808848fcd57468fd420?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:28 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow the DeviceID result to eventually be accessed from DISPATCH_LEVEL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 2a61db7..432e907 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -627,7 +627,7 @@ FdoQueryId(
     Buffer = (PWSTR)StatusBlock.Information;
     Length = (ULONG)(wcslen(Buffer) + 1) * sizeof (CHAR);
 
-    *Id = __AllocatePoolWithTag(PagedPool, Length, 'SUB');
+    *Id = __AllocatePoolWithTag(NonPagedPool, Length, 'SUB');
 
     status = STATUS_NO_MEMORY;
     if (*Id == NULL)
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:37 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069555.1433428 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDt-0006fu-7q; Mon, 04 Aug 2025 15:35:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069555.1433428; Mon, 04 Aug 2025 15:35:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDs-0006fL-Vd; Mon, 04 Aug 2025 15:35:36 +0000
Received: by outflank-mailman (input) for mailman id 1069555;
 Mon, 04 Aug 2025 15:35:36 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xpxq=2Q=bounce.vates.tech=bounce-md_30504962.6890d340.v1-0bee9971d6644d76997af4efa0fa18c1@srs-se1.protection.inumbo.net>)
 id 1uixDr-0006bt-Us
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:35 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id a8b01329-7148-11f0-b898-0df219b8e170;
 Mon, 04 Aug 2025 17:35:33 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcJ2WpczBsTjXL
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:28 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0bee9971d6644d76997af4efa0fa18c1; Mon, 04 Aug 2025 15:35:28 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8b01329-7148-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321728; x=1754591728;
	bh=FxKDXXAnE53cR3/WRSVgBzihrM6BHmbQxlXKac2KQv4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=OUchkla36RWX9si8OrITt0Obhdk0spjaxpKQcotY0aVtNmZq1IKOhUjRY3F9In2p2
	 fb37ihNJ2wWaXNhqNzcncpDZS4VZN6g/GIzbPQTcT8bJHK1lHDw9F/UUeRXuuFMPub
	 cOf531Wg0I09ztOJ6aG4crWGuoL/WGMxq8jP3vlYWcoAbAg+8BhyLjZXdcIU1uCmGd
	 p70y+Wlpf54x9R0LiJ+ZNgdpN1gIUXOtHpjhcNav4D9UH8E+oMpV/xvbHH6eVfbZHU
	 ZPDvP4sKmZ2VcrSmiDnjK1YKm4JQCH9UjESh9SMUhgturBQ8U6uxsgf7ULOTupnOCf
	 1h7DXGpDXWuZw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321728; x=1754582228; i=ngoc-tu.dinh@vates.tech;
	bh=FxKDXXAnE53cR3/WRSVgBzihrM6BHmbQxlXKac2KQv4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=MH1/xpStVuttlVjsGDl8pqvjSTJsEoGYMHtXmlb36E7662B6OtMSpHHLqS+losvGi
	 uGBhvx9xp0vqMlYmU3dcVIKD+5pnri9bddC5irBk3qEfZeF0chqH/LmNki0s5ZVqBv
	 Ej0DOli62BRCmjwYhpyUncHe8O0VUkiUHyGLfdzroOWUegzR6t32x+nDeBzU5btKx6
	 SWhE51Cid3Pgq5qOApOowqfcbyhKweee6CyB7VrxlShAshrmRLJzRhLZYND1J4FcNc
	 VWA1P2KAu+gS0nh1YLwdKSyD+Xo6O0ii2pStFrrDRvM16ZN3LbsvqE3SHNdyph+s5N
	 U8NWcuOSSDmzQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=205/9]=20Add=20EMULATED=20v3?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321727409
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0bee9971d6644d76997af4efa0fa18c1?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:28 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow querying the current active device's forced-activation status by
calling EmulatedIsDevicePresent with DeviceID=NULL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h | 42 ++++++++++++++++++++++---
 include/revision.h           |  3 +-
 src/xenfilt/emulated.c       | 60 ++++++++++++++++++++++++++++++++----
 src/xenfilt/emulated.h       |  1 +
 src/xenfilt/pdo.c            |  1 +
 5 files changed, 96 insertions(+), 11 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index a6c79f9..1c24ecb 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -62,7 +62,7 @@ typedef VOID
     _In_ PINTERFACE Interface
     );
 
-/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT_V1
     \brief Determine whether a given device is present in the VM
 
     \param Interface The interface header
@@ -73,12 +73,34 @@ typedef VOID
     FALSE if it is not
 */
 typedef BOOLEAN
-(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT_V1)(
     _In_ PVOID      Context,
     _In_ PSTR       DeviceID,
     _In_opt_ PSTR   InstanceID
     );
 
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+    \brief Determine whether a given device is present in the VM
+
+    \param Interface The interface header
+    \param DeviceID The DeviceID of the device, or NULL to query the force-
+           activated device
+    \param InstanceID The (un-prefixed) InstanceID of the device or
+           NULL to match any device instance
+    \param IsForceActivated Returns 1 if the device was force-activated, -1 if
+           the device was not active and another device was force-activated,
+           and 0 otherwise
+    \return TRUE if the specified device is present in the system or
+            FALSE if it is not
+*/
+typedef BOOLEAN
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+    _In_ PVOID      Context,
+    _In_opt_ PSTR   DeviceID,
+    _In_opt_ PSTR   InstanceID,
+    _Out_opt_ PLONG IsForceActivated
+    );
+
 /*! \typedef XENFILT_EMULATED_IS_DISK_PRESENT
     \brief Determine whether a given emulated disk is present in the VM
 
@@ -103,6 +125,18 @@ DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V2 {
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT        EmulatedIsDiskPresent;
+};
+
+/*! \struct _XENFILT_EMULATED_INTERFACE_V3
+    \brief EMULATED interface version 3
+    \ingroup interfaces
+*/
+struct _XENFILT_EMULATED_INTERFACE_V3 {
     INTERFACE                           Interface;
     XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
     XENFILT_EMULATED_RELEASE            EmulatedRelease;
@@ -110,7 +144,7 @@ struct _XENFILT_EMULATED_INTERFACE_V2 {
     XENFILT_EMULATED_IS_DISK_PRESENT    EmulatedIsDiskPresent;
 };
 
-typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
+typedef struct _XENFILT_EMULATED_INTERFACE_V3 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
 
 /*! \def XENFILT_EMULATED
     \brief Macro at assist in method invocation
@@ -121,6 +155,6 @@ typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENF
 #endif  // _WINDLL
 
 #define XENFILT_EMULATED_INTERFACE_VERSION_MIN  2
-#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  2
+#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  3
 
 #endif  // _XENFILT_EMULATED_INTERFACE_H
diff --git a/include/revision.h b/include/revision.h
index e9e62e6..a63e550 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -51,6 +51,7 @@
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2)
+    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2), \
+    DEFINE_REVISION(0x0900000C,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  3)
 
 #endif  // _REVISION_H
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index ca358c7..8485b23 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -48,6 +48,7 @@ typedef struct _XENFILT_EMULATED_DEVICE_DATA {
     CHAR    DeviceID[MAXNAMELEN];
     CHAR    InstanceID[MAXNAMELEN];
     CHAR    CompatibleID[MAXNAMELEN];
+    LONG    ForceActivate;
 } XENFILT_EMULATED_DEVICE_DATA, *PXENFILT_EMULATED_DEVICE_DATA;
 
 typedef struct _XENFILT_EMULATED_DISK_DATA {
@@ -227,6 +228,7 @@ EmulatedAddObject(
     _In_ PSTR                           InstanceID,
     _In_opt_ PSTR                       CompatibleIDs,
     _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ LONG                           ForceActivate,
     _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
     )
 {
@@ -267,6 +269,8 @@ EmulatedAddObject(
         goto fail2;
 
     (*EmulatedObject)->Type = Type;
+    if (Type == XENFILT_EMULATED_OBJECT_TYPE_PCI)
+        (*EmulatedObject)->Data.Device.ForceActivate = ForceActivate;
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
     InsertTailList(&Context->List, &(*EmulatedObject)->ListEntry);
@@ -305,8 +309,9 @@ EmulatedRemoveObject(
 static BOOLEAN
 EmulatedIsDevicePresent(
     _In_ PINTERFACE             Interface,
-    _In_ PSTR                   DeviceID,
-    _In_opt_ PSTR               InstanceID
+    _In_opt_ PSTR               DeviceID,
+    _In_opt_ PSTR               InstanceID,
+    _Out_opt_ PLONG             IsForceActivated
     )
 {
     PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
@@ -314,24 +319,32 @@ EmulatedIsDevicePresent(
     PLIST_ENTRY                 ListEntry;
 
     Trace("====> (%s %s)\n",
-          DeviceID,
+          (DeviceID != NULL) ? DeviceID : "ACTIVE",
           (InstanceID != NULL) ? InstanceID : "ANY");
 
+    if (IsForceActivated)
+        *IsForceActivated = 0;
+
     KeAcquireSpinLock(&Context->Lock, &Irql);
 
     ListEntry = Context->List.Flink;
     while (ListEntry != &Context->List) {
-        PXENFILT_EMULATED_OBJECT    EmulatedObject;
+        PXENFILT_EMULATED_OBJECT        EmulatedObject;
+        PXENFILT_EMULATED_DEVICE_DATA   Device;
 
         EmulatedObject = CONTAINING_RECORD(ListEntry,
                                            XENFILT_EMULATED_OBJECT,
                                            ListEntry);
+        Device = &EmulatedObject->Data.Device;
 
         if (EmulatedObject->Type == XENFILT_EMULATED_OBJECT_TYPE_PCI &&
-            _stricmp(DeviceID, EmulatedObject->Data.Device.DeviceID) == 0 &&
+            ((DeviceID == NULL && Device->ForceActivate > 0) ||
+             (DeviceID != NULL && _stricmp(DeviceID, Device->DeviceID) == 0)) &&
             (InstanceID == NULL ||
-             _stricmp(InstanceID, EmulatedObject->Data.Device.InstanceID) == 0)) {
+             _stricmp(InstanceID, Device->InstanceID) == 0)) {
             Trace("FOUND\n");
+            if (IsForceActivated)
+                *IsForceActivated = Device->ForceActivate;
             break;
         }
 
@@ -345,6 +358,16 @@ EmulatedIsDevicePresent(
     return (ListEntry != &Context->List) ? TRUE : FALSE;
 }
 
+static BOOLEAN
+EmulatedIsDevicePresentVersion1(
+    _In_ PINTERFACE             Interface,
+    _In_ PSTR                   DeviceID,
+    _In_opt_ PSTR               InstanceID
+    )
+{
+    return EmulatedIsDevicePresent(Interface, DeviceID, InstanceID, NULL);
+}
+
 static BOOLEAN
 EmulatedIsDiskPresent(
     _In_ PINTERFACE             Interface,
@@ -434,6 +457,14 @@ static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
+    EmulatedIsDevicePresentVersion1,
+    EmulatedIsDiskPresent
+};
+
+static struct _XENFILT_EMULATED_INTERFACE_V3 EmulatedInterfaceVersion3 = {
+    { sizeof (struct _XENFILT_EMULATED_INTERFACE_V3), 3, NULL, NULL, NULL },
+    EmulatedAcquire,
+    EmulatedRelease,
     EmulatedIsDevicePresent,
     EmulatedIsDiskPresent
 };
@@ -496,6 +527,23 @@ EmulatedGetInterface(
         status = STATUS_SUCCESS;
         break;
     }
+    case 3: {
+        struct _XENFILT_EMULATED_INTERFACE_V3   *EmulatedInterface;
+
+        EmulatedInterface = (struct _XENFILT_EMULATED_INTERFACE_V3 *)Interface;
+
+        status = STATUS_BUFFER_OVERFLOW;
+        if (Size < sizeof (struct _XENFILT_EMULATED_INTERFACE_V3))
+            break;
+
+        *EmulatedInterface = EmulatedInterfaceVersion3;
+
+        ASSERT3U(Interface->Version, ==, Version);
+        Interface->Context = Context;
+
+        status = STATUS_SUCCESS;
+        break;
+    }
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
index 9b02268..c01ff6a 100644
--- a/src/xenfilt/emulated.h
+++ b/src/xenfilt/emulated.h
@@ -72,6 +72,7 @@ EmulatedAddObject(
     _In_ PSTR                           InstanceID,
     _In_opt_ PSTR                       CompatibleIDs,
     _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ LONG                           ForceActivate,
     _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
     );
 
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 48ae3a3..946c1c5 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -1748,6 +1748,7 @@ PdoCreate(
                                __PdoGetInstanceID(Pdo),
                                CompatibleIDs,
                                __PdoGetType(Pdo),
+                               ForceActivate,
                                &Pdo->EmulatedObject);
     if (!NT_SUCCESS(status))
         goto fail5;
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:38 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069556.1433431 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDu-0006lC-4m; Mon, 04 Aug 2025 15:35:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069556.1433431; Mon, 04 Aug 2025 15:35:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDu-0006kz-1h; Mon, 04 Aug 2025 15:35:38 +0000
Received: by outflank-mailman (input) for mailman id 1069556;
 Mon, 04 Aug 2025 15:35:37 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1gDh=2Q=bounce.vates.tech=bounce-md_30504962.6890d341.v1-dc1aef1a0915404fbc18007e79ae59eb@srs-se1.protection.inumbo.net>)
 id 1uixDs-0006Ww-SZ
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:36 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a926391c-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:33 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcK39GVzBsTkLP
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:29 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 dc1aef1a0915404fbc18007e79ae59eb; Mon, 04 Aug 2025 15:35:29 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a926391c-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321729; x=1754591729;
	bh=ukvDzWlcuX1GTOHzKfAPQQU03JB68wIp3UXCft56n3U=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=MXxrEv3AXDLl2dyQYdDwLns024/NIzkWZe/8QNHLgQaOV/RESECgkfSyxdlIlYtd4
	 QUQ8o+LxslFl5ayIt1qxDBnKaenL+rdsRNiLy343W7ZiTk5eumb9oq2XsSTAh545o4
	 3ZYS1Nnh76y4ZbYqWQkzWlI2K96JSjSW+rg5wNJoHRhNwse0tTU3vHzp7n5aOTJb37
	 D7BFfyeWfvWpqpADff5+FihNzfqrpCxJzA/G9IGWDA1qzSFimu64MTbic8rAlvds5s
	 g3s4Uz9h13J5qvBePVbaHFZRio29YZBz6+nszqE0xw5o5T+6+aNX5ftJm4vz6sKjYS
	 o1cBVHzLlnXcw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321729; x=1754582229; i=ngoc-tu.dinh@vates.tech;
	bh=ukvDzWlcuX1GTOHzKfAPQQU03JB68wIp3UXCft56n3U=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=MqX1HQEL+Fww5akULJmk+pSfuZBPfvsSgbZd2deIYKJL0i2WKfYdwucZ38Z567z2+
	 +ErJt03sVeWeu1KqOBaynM7pKOuAvI01afRezpApDiXZLE8Jv50A1FlbCBQ0xHHTQB
	 m6DJs2AkKGhojCiu/QTYIC1h3izzbEZYvIPW9FhNZG0ZOLd0SRssmHGnfWDvi3TDe4
	 Sigzvi1UM72qYRHgIXELB/9eO713FeXRewAiJTexlQNBrDBx+PJN4tMf2ZCVArQXa6
	 zlI74ufJUdjMkaPuTtNQjvAvb+mWFfyjoRCHqF8Y0sYmCMcj18PnS6zO3HlKEjDmZo
	 v2r2iiIgYslkg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=209/9]=20Install=20Xenfilt=20with=20INF=20AddReg?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321728403
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-10-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.dc1aef1a0915404fbc18007e79ae59eb?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:29 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

With forced-activation Xenbus, there's little reason not to install
Xenfilt.

Add a new INF section to this effect, also conditioned on the
FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index 81bfce2..2849843 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -114,6 +114,8 @@ ErrorControl=%SERVICE_ERROR_NORMAL%
 ServiceBinary=%12%\xenfilt.sys 
 LoadOrderGroup="Boot Bus Extender"
 AddReg = XenFilt_Parameters
+; Attention: XenFilt_Filters should only be used with forced-activation Xenbus
+AddReg = XenFilt_Filters  ; @FORCE_ACTIVATE@
 
 [XenFilt_Parameters]
 HKR,"Parameters",,0x00000010
@@ -123,6 +125,10 @@ HKR,"Parameters","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_ACTIVATE@
 HKR,"Parameters","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
 HKR,"Parameters","PCI\VEN_5853&DEV_C000",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
+[XenFilt_Filters]  ; @FORCE_ACTIVATE@
+HKLM,%SystemClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+HKLM,%HDCClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+
 [Monitor_Service]
 DisplayName=%MonitorName%
 Description=%MonitorDesc%
@@ -156,6 +162,8 @@ MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
 RequestKey="SYSTEM\CurrentControlSet\Services\xenbus_monitor\Request"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+SystemClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e97d-e325-11ce-bfc1-08002be10318}"
+HDCClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e96a-e325-11ce-bfc1-08002be10318}"
 DialogTitle="@PRODUCT_NAME@"
 DialogText="needs to restart the system to complete installation."
 DialogQuestion="Press 'Yes' to restart the system now or 'No' if you plan to restart the system later."
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:39 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069557.1433435 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDv-0006nx-6Y; Mon, 04 Aug 2025 15:35:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069557.1433435; Mon, 04 Aug 2025 15:35:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDv-0006np-3C; Mon, 04 Aug 2025 15:35:39 +0000
Received: by outflank-mailman (input) for mailman id 1069557;
 Mon, 04 Aug 2025 15:35:37 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=YW8L=2Q=bounce.vates.tech=bounce-md_30504962.6890d340.v1-6e5a907a18b642f9b2600204946b79f0@srs-se1.protection.inumbo.net>)
 id 1uixDt-0006Ww-Sr
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:37 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a8d378ed-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:34 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcJ5tGxzNCd9GJ
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:28 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 6e5a907a18b642f9b2600204946b79f0; Mon, 04 Aug 2025 15:35:28 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8d378ed-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321728; x=1754591728;
	bh=WkYMsK6zHTBhuT3QfyEKx8n3uPt5IHS4QNb+6Hgbftk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=yvuxJw0Aol/Do5NoC/d4Qk5Dq2U5vUk8315VI1Zz9PiWR74elbA8ZGaSUBY7/05Ft
	 M9sg3nbrEm1/pVWY1R8StsJBAyTDxnTzhPwqTtSVYHLBynR8mT6FMn3D3+XlZ+i6Ec
	 EWWsZlHv0m/kaFbeiegFzh3Y8D1jfBOSAjhMg7zd51r1AITMu284+jQ7kGjHgoa/Xh
	 cA2Kr6InR6dT/rLm1hW9jaICUpRQBiHmKH/SspGaQBrippdfIQoWVs7ZwJjDezDjAw
	 +gmnLsj21dJjUEr45jl6krphtwR+QAxSCBrrvNCPEBgXyLwEutpwzsvQ36quLMiHlL
	 YW5oqpCxORRJA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321728; x=1754582228; i=ngoc-tu.dinh@vates.tech;
	bh=WkYMsK6zHTBhuT3QfyEKx8n3uPt5IHS4QNb+6Hgbftk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=cVsnY8TuncoTnw7j6sCTya0t8IcfJOkOqy9a5NFzgGVRvBhjm75kOK/IY2KX3W/3c
	 0GmH/8uVL1b7yTy7xOGJ+KwcW9U+sQR+ntSJzxLyXaUANnfintzSszAV+VhvCzRqpg
	 j621tuSRhvRHIJQnVX7HMxlKnK6cWeZ3BEALQgFtvKs3FPpINLJx1QPXdBMY5hzIrd
	 5OMDnyNboJMdWL6EKNxiUYWcyXqEZNM4dVji5sV5BxGhRKX9dToYxSUFp2cbYkvYsn
	 7SpRsBDKJQsr2H0L5qH4gScyJeAD067v8rTgi8xPVmi71WsiQ2ohtKNQHO8iZwsRGd
	 rbb4FeaPqKg0w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=207/9]=20Use=20EMULATED=20v3=20to=20force=20activate=20Xenbus=20FDOs?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321727902
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-8-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.6e5a907a18b642f9b2600204946b79f0?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:28 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Use EmulatedIsDevicePresent in FdoSetActive to determine FDO forced-
activation status and set Fdo->Active + call ConfigSetActive as
appropriate.

Also use EmulatedIsDevicePresent in xenfilt!DriverIsActivePresent.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c     | 120 +++++++++++++++++++++++++++++++------------
 src/xenfilt/driver.c |  16 ++++--
 2 files changed, 99 insertions(+), 37 deletions(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 432e907..f867511 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -48,6 +48,7 @@
 #include "thread.h"
 #include "high.h"
 #include "mutex.h"
+#include "emulated_interface.h"
 #include "shared_info.h"
 #include "evtchn.h"
 #include "debug.h"
@@ -134,6 +135,8 @@ struct _XENBUS_FDO {
     PCM_PARTIAL_RESOURCE_LIST       RawResourceList;
     PCM_PARTIAL_RESOURCE_LIST       TranslatedResourceList;
 
+    XENFILT_EMULATED_INTERFACE      EmulatedInterface;
+
     BOOLEAN                         Active;
 
     PXENBUS_SUSPEND_CONTEXT         SuspendContext;
@@ -746,6 +749,8 @@ FdoSetActive(
     PSTR                InstanceID;
     PSTR                ActiveDeviceID;
     PSTR                LocationInformation;
+    BOOLEAN             Present;
+    LONG                IsForceActivated;
     NTSTATUS            status;
 
     status = FdoQueryId(Fdo,
@@ -766,6 +771,34 @@ FdoSetActive(
     if (!NT_SUCCESS(status))
         goto fail3;
 
+    if (Fdo->EmulatedInterface.Interface.Context == NULL)
+        goto fallback;
+
+    status = XENFILT_EMULATED(Acquire, &Fdo->EmulatedInterface);
+    if (!NT_SUCCESS(status))
+        goto fallback;
+
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Fdo->EmulatedInterface,
+                               DeviceID,
+                               NULL,
+                               &IsForceActivated);
+    BUG_ON(!Present);
+
+    XENFILT_EMULATED(Release, &Fdo->EmulatedInterface);
+
+    if (IsForceActivated == 0)
+        goto fallback;
+
+    Fdo->Active = IsForceActivated > 0;
+    Info("FDO %s force %sactivated\n", DeviceID, Fdo->Active ? "" : "de");
+
+    if (Fdo->Active)
+        (VOID) ConfigSetActive(DeviceID, InstanceID, LocationInformation);
+
+    goto done;
+
+fallback:
     status = ConfigGetActive("DeviceID", &ActiveDeviceID);
     if (NT_SUCCESS(status)) {
         Fdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ? TRUE : FALSE;
@@ -780,6 +813,7 @@ FdoSetActive(
             Fdo->Active = TRUE;
     }
 
+done:
     ExFreePool(LocationInformation);
     ExFreePool(InstanceID);
     ExFreePool(DeviceID);
@@ -5822,10 +5856,19 @@ FdoCreate(
 
     __FdoSetName(Fdo);
 
-    status = FdoSetActive(Fdo);
+    status = FDO_QUERY_INTERFACE(Fdo,
+                                 XENFILT,
+                                 EMULATED,
+                                 (PINTERFACE)&Fdo->EmulatedInterface,
+                                 sizeof (Fdo->EmulatedInterface),
+                                 TRUE);
     if (!NT_SUCCESS(status))
         goto fail9;
 
+    status = FdoSetActive(Fdo);
+    if (!NT_SUCCESS(status))
+        goto fail10;
+
     if (!__FdoIsActive(Fdo))
         goto done;
 
@@ -5841,47 +5884,47 @@ FdoCreate(
 
     status = DebugInitialize(Fdo, &Fdo->DebugContext);
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = SuspendInitialize(Fdo, &Fdo->SuspendContext);
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = SharedInfoInitialize(Fdo, &Fdo->SharedInfoContext);
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     status = EvtchnInitialize(Fdo, &Fdo->EvtchnContext);
     if (!NT_SUCCESS(status))
-        goto fail13;
+        goto fail14;
 
     status = RangeSetInitialize(Fdo, &Fdo->RangeSetContext);
     if (!NT_SUCCESS(status))
-        goto fail14;
+        goto fail15;
 
     status = CacheInitialize(Fdo, &Fdo->CacheContext);
     if (!NT_SUCCESS(status))
-        goto fail15;
+        goto fail16;
 
     status = GnttabInitialize(Fdo, &Fdo->GnttabContext);
     if (!NT_SUCCESS(status))
-        goto fail16;
+        goto fail17;
 
     status = StoreInitialize(Fdo, &Fdo->StoreContext);
     if (!NT_SUCCESS(status))
-        goto fail17;
+        goto fail18;
 
     status = ConsoleInitialize(Fdo, &Fdo->ConsoleContext);
     if (!NT_SUCCESS(status))
-        goto fail18;
+        goto fail19;
 
     status = UnplugInitialize(Fdo, &Fdo->UnplugContext);
     if (!NT_SUCCESS(status))
-        goto fail19;
+        goto fail20;
 
     status = FdoBalloonInitialize(Fdo);
     if (!NT_SUCCESS(status))
-        goto fail20;
+        goto fail21;
 
     status = DebugGetInterface(__FdoGetDebugContext(Fdo),
                                XENBUS_DEBUG_INTERFACE_VERSION_MAX,
@@ -5950,68 +5993,68 @@ done:
 
     return STATUS_SUCCESS;
 
-fail20:
-    Error("fail20\n");
+fail21:
+    Error("fail21\n");
 
     UnplugTeardown(Fdo->UnplugContext);
     Fdo->UnplugContext = NULL;
 
-fail19:
-    Error("fail19\n");
+fail20:
+    Error("fail20\n");
 
     ConsoleTeardown(Fdo->ConsoleContext);
     Fdo->ConsoleContext = NULL;
 
-fail18:
-    Error("fail18\n");
+fail19:
+    Error("fail19\n");
 
     StoreTeardown(Fdo->StoreContext);
     Fdo->StoreContext = NULL;
 
-fail17:
-    Error("fail17\n");
+fail18:
+    Error("fail18\n");
 
     GnttabTeardown(Fdo->GnttabContext);
     Fdo->GnttabContext = NULL;
 
-fail16:
-    Error("fail16\n");
+fail17:
+    Error("fail17\n");
 
     CacheTeardown(Fdo->CacheContext);
     Fdo->CacheContext = NULL;
 
-fail15:
-    Error("fail15\n");
+fail16:
+    Error("fail16\n");
 
     RangeSetTeardown(Fdo->RangeSetContext);
     Fdo->RangeSetContext = NULL;
 
-fail14:
-    Error("fail14\n");
+fail15:
+    Error("fail15\n");
 
     EvtchnTeardown(Fdo->EvtchnContext);
     Fdo->EvtchnContext = NULL;
 
-fail13:
-    Error("fail13\n");
+fail14:
+    Error("fail14\n");
 
     SharedInfoTeardown(Fdo->SharedInfoContext);
     Fdo->SharedInfoContext = NULL;
 
-fail12:
-    Error("fail12\n");
+fail13:
+    Error("fail13\n");
 
     SuspendTeardown(Fdo->SuspendContext);
     Fdo->SuspendContext = NULL;
 
-fail11:
-    Error("fail11\n");
+fail12:
+    Error("fail12\n");
 
     DebugTeardown(Fdo->DebugContext);
     Fdo->DebugContext = NULL;
 
-fail10:
-    Error("fail10\n");
+fail11:
+    Error("fail11\n");
 
     Fdo->UseMemoryHole = 0;
 
@@ -6021,6 +6064,12 @@ fail10:
     //
     Fdo->Active = FALSE;
 
+fail10:
+    Error("fail10\n");
+
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
 fail9:
     Error("fail9\n");
 
@@ -6159,6 +6208,9 @@ FdoDestroy(
         FdoClearActive(Fdo);
     }
 
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
     RtlZeroMemory(Fdo->VendorName, MAXNAMELEN);
 
     FdoReleaseLowerBusInterface(Fdo);
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 8f39b8d..370ee6e 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -321,13 +321,20 @@ DriverIsActivePresent(
 {
     PSTR        ActiveDeviceID;
     BOOLEAN     Present;
+    LONG        IsForceActivated;
     NTSTATUS    status;
 
     status = XENFILT_EMULATED(Acquire, &Driver.EmulatedInterface);
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    Present = FALSE;
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Driver.EmulatedInterface,
+                               NULL,
+                               NULL,
+                               &IsForceActivated);
+    if (NT_SUCCESS(status) && Present)
+        goto done;
 
     status = __DriverGetActive("DeviceID",
                                &ActiveDeviceID);
@@ -337,14 +344,17 @@ DriverIsActivePresent(
     Present = XENFILT_EMULATED(IsDevicePresent,
                                &Driver.EmulatedInterface,
                                ActiveDeviceID,
-                               NULL);
+                               NULL,
+                               &IsForceActivated);
 
     ExFreePool(ActiveDeviceID);
 
 done:
     XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
 
-    Info("ACTIVE DEVICE %sPRESENT\n", (!Present) ? "NOT " : "");
+    Info("ACTIVE DEVICE %sPRESENT%s\n",
+         (!Present) ? "NOT " : "",
+         IsForceActivated > 0 ? " (FORCED)" : "");
 
     return Present;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:40 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069558.1433440 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDw-0006r1-8m; Mon, 04 Aug 2025 15:35:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069558.1433440; Mon, 04 Aug 2025 15:35:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDw-0006qq-5W; Mon, 04 Aug 2025 15:35:40 +0000
Received: by outflank-mailman (input) for mailman id 1069558;
 Mon, 04 Aug 2025 15:35:38 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=EmO5=2Q=bounce.vates.tech=bounce-md_30504962.6890d341.v1-5c901d76f87e4c55ade4c509a5d9b6c2@srs-se1.protection.inumbo.net>)
 id 1uixDu-0006Ww-T6
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:38 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a98ca66f-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:34 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcL00hmzBsTyWV
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:30 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5c901d76f87e4c55ade4c509a5d9b6c2; Mon, 04 Aug 2025 15:35:29 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a98ca66f-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321730; x=1754591730;
	bh=0662Me/zHSZ9Bd478d39IQB811fwjDBJzXDB2OGeBmU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=DqPyMlJYxmEPCDEREOmqrIhPeThPaCxvaKC7A2nNMX3QUAH70m6jdHAbp4ei55bVF
	 o/9bxDTbNz7l+JJxvQ1YWqSF9ymmDShKDxsG/FaFPqI+N6OUaYNW5lCY+8+vWc873q
	 IcfCt7uM6CJqJd2HfAND88FYnPZEvbmnqnhD6viWPiZXVXZ0826Hd17XUKxP/w5wes
	 BHF66PZuiUPP2TYNX0M3UvFa5WNbu/OSnG9BgeSTXV/Ydkz+1gVWUKV/U5yEy2eAMK
	 nkGDUr0+nJYCRwRlkrgfOscp7ryp70vDcL12EymVBWg/XdcTrucNnNdohS5oULU3AM
	 Vp4B5gNDQkPjw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321730; x=1754582230; i=ngoc-tu.dinh@vates.tech;
	bh=0662Me/zHSZ9Bd478d39IQB811fwjDBJzXDB2OGeBmU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=of9+0jvtSEhuJhWPx8/2eEPKw+t5cPtxZIppb/MPQ/UW2non5YpNfalckRYgXz0v0
	 iCAMw6ODYAtIHyGsl8RpksC6vUPe/WSKIw84d2E9gO3/Q2FmTTV6NQus7LtPJ/DmSA
	 PbnsPOv46XH5XkQJhpJk0sdq/H4L4NXUUohowqA785UphhbnVLPTU8jbMkakevclSP
	 i/7Uq0kEf4nsV//1UB/GbNjzs58TQpFwjGsHxHmRxYJ5pV/QvlG/yRDLOrjJIIQMPF
	 VadHtbY05omzIzduqVq0LZKDW9dBn+KylNem8sg/RHRQXgQ5d95pFP3Kc+YrInYyYg
	 0D6gF3spDGM+g==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v3=201/2]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321728835
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-12-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5c901d76f87e4c55ade4c509a5d9b6c2?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:29 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenvbd.inf       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 093b5ee..8b0b14b 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index dfde613..0de71d1 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -106,6 +106,7 @@ HKR,"Parameters","multi-queue-max-queues",0x00010001,0x00000002
 
 [XenVbd_Unplug]
 HKLM,%UnplugKey%,"DISKS",0x00010001,0
+HKLM,%ForceUnplugKey%,"DISKS",0x00010001,1  ; @FORCE_UNPLUG@
 
 [XenVbd_Extras]
 HKLM,%PnpKey%,"DisableCDDB",0x00010001,0
@@ -120,6 +121,7 @@ DiskDesc = "@PRODUCT_NAME@ PV Storage Host Adapter Package"
 XenVbdName= "@PRODUCT_NAME@ PV Storage Host Adapter"
 XenDiskName= "@PRODUCT_NAME@ PV Storage Filter"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 PnpKey="SYSTEM\CurrentControlSet\Control\Pnp"
 PartMgrKey="SYSTEM\CurrentControlSet\Services\PartMgr\Parameters"
 DiskKey="SYSTEM\CurrentControlSet\Services\Disk"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:41 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069559.1433444 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDx-0006to-AD; Mon, 04 Aug 2025 15:35:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069559.1433444; Mon, 04 Aug 2025 15:35:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDx-0006tc-6w; Mon, 04 Aug 2025 15:35:41 +0000
Received: by outflank-mailman (input) for mailman id 1069559;
 Mon, 04 Aug 2025 15:35:39 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Sakg=2Q=bounce.vates.tech=bounce-md_30504962.6890d341.v1-134ffd73923e4589ac7b388455ad1579@srs-se1.protection.inumbo.net>)
 id 1uixDv-0006Ww-T7
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:39 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a9b9071d-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:34 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcK4HrZzNCd9KT
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:29 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 134ffd73923e4589ac7b388455ad1579; Mon, 04 Aug 2025 15:35:29 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a9b9071d-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321729; x=1754591729;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Yti1s6tSDC7Q4OYo6sqsaXie17VRgerSlp3807jO5YKd2l0mLcKva/g/R0reveAV3
	 TomaFQk5kfwHnvOK4i+uRKM0gHyn3TJwveD/lcsTaZYUo3lE1LYXRcaOSKeWuLg03z
	 j+y0OLI1mv5qCvOZKzmbFARxtxuLLyh8BamtHkplsxfkHSsO26WSTfdg4ZdPV86eUH
	 EQ56PYkEpr/Nuc7eeKrE8F8i+gK9GNKLVPXs18tptmtz5MHexDcLRGTSB5R7qWIhLU
	 GQN5h9B12PAu1Rl3DiJ9RrlYek5tvHqIqKl20PedmaToHxuQ+lW3dAGJJpjbU4+gAT
	 7VOyRW3SQ/sTQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321729; x=1754582229; i=ngoc-tu.dinh@vates.tech;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=q4Zceycf13xpXshqMZ7hjc3rm5QUZ7ajUNaesqZCXn1RjmnaBbam9s9HCktpjDC4l
	 5CttnBASe/jMlEHYPIxUeXH0TuJyN60vTfwdx4ndVVc+sTkaFC7jpaIiLQusHKk9m1
	 5/Y7w6wr+G6BRn87fSkhaIHasEC60s6LaJ7DgvMgS5l3++tTaMfAEtWUR47bS/414G
	 hnCGJipO35fxxZOjnD7nF/SxPV+3eAHvsLKNitLEJ8kYM422O3gl+iAaDxUSHVkg4/
	 8WWg608owM/pl7ur9Vr2aZhWs8kxT0CNi2PYBWZQ71v2VEgdYcCwFaQHkXov6/X6Si
	 yo6BIPX6CY+rQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENNET=20PATCH=20v3]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321728620
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-11-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.134ffd73923e4589ac7b388455ad1579?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:29 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xennet.inf       | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 6991440..a0faed5 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xennet.inf b/src/xennet.inf
index 4923388..b684219 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -179,11 +179,14 @@ StartType=%SERVICE_DEMAND_START%
 ErrorControl=%SERVICE_ERROR_NORMAL% 
 ServiceBinary=%12%\xennet.sys 
 LoadOrderGroup="NDIS"
-AddReg = XenNet_BootFlags
+AddReg = XenNet_BootFlags,XenNet_Unplug
 
 [XenNet_BootFlags]
 HKR,,"BootFlags",0x00010003,0x81
 
+[XenNet_Unplug]
+HKLM,%ForceUnplugKey%,"NICS",0x00010001,1  ; @FORCE_UNPLUG@
+
 [XenNet_EventLog]
 AddReg=XenNet_EventLog_AddReg
 
@@ -196,6 +199,7 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@"
 DiskDesc="@PRODUCT_NAME@ PV Network Device Package" 
 XenNetName="@PRODUCT_NAME@ PV Network Device"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 IPChecksumOffloadIPv4="IPv4 Checksum Offload"
 TCPChecksumOffloadIPv4="TCP Checksum Offload (IPv4)"
 UDPChecksumOffloadIPv4="UDP Checksum Offload (IPv4)"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:35:42 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:35:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069560.1433448 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDy-0006wK-Bw; Mon, 04 Aug 2025 15:35:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069560.1433448; Mon, 04 Aug 2025 15:35:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixDy-0006wD-92; Mon, 04 Aug 2025 15:35:42 +0000
Received: by outflank-mailman (input) for mailman id 1069560;
 Mon, 04 Aug 2025 15:35:40 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=24c6=2Q=bounce.vates.tech=bounce-md_30504962.6890d342.v1-0283f5c5042d448b80d267a7e2a9103d@srs-se1.protection.inumbo.net>)
 id 1uixDw-0006Ww-TM
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:40 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a9ed25b5-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:35 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcL1W2mzBsThWT
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:30 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0283f5c5042d448b80d267a7e2a9103d; Mon, 04 Aug 2025 15:35:30 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a9ed25b5-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321730; x=1754591730;
	bh=nA8dwVHUEfM/wfSjl485RpErNmlZKlvJuLcW0RYaIVM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=VWFTeKYptImWRQQC/MnhMSDN0GyAUGuT8dIZni49ZH3d68PO8x9LuHqfxibjevvwB
	 Wgpf8ej09OQDvbp0ggd/B0vvuwDaV1Y3WXvxtJkas71kPweBGERBskhUpaUB1kw4Ax
	 Qf4A7+w0/2OnuU3AfVKwHicsIK/qoOjqsl18O0mFAD5/n4a4Xf+jGVfgFeENWrNqu1
	 3PyocfBTL2YKMsFyMs1hxQ1E2yK5AB90MBjrRLskUIk5Tc3oxCuCCQNcprSq1jcp5p
	 N3R6GEvusrmtmVRRurJIPhenc/wNRz3o3BUmc1MB/9Pu13FoMnSlUMDejyCDvlBbr1
	 kDjO/HQI4o/8g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321730; x=1754582230; i=ngoc-tu.dinh@vates.tech;
	bh=nA8dwVHUEfM/wfSjl485RpErNmlZKlvJuLcW0RYaIVM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Q3yULH3pTcSrBJOKWqoGkXBWuck/qo6+C9MGwnF80v/+0mtizUaUAUFLcl8TBBbnA
	 YM1oOiQlY2bLBMon/jIe1bUNLcjA/Hm+t82higHwqxmNXgV/iPpMzim4qnzJp7eR+p
	 vfZrIafm1ENVA+LZvER3K7m66Q99QBu/fHhOGQhO15K5tG7AT+k4B41SgBDshjGK5T
	 cRlUmBPnI06xJGOzUcJsCWN2BsShOI6WKX7J/LA0/yPxvkCxUjq/p9a/FRfU6DfuOa
	 GmeZrqDBfm9iM6QwQsp+FOAMfmY9q7Cv22fPcXVZoL5i/mcDkOiwoZtLkL3e8fsxhc
	 57kroJFEo16iA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v3=202/2]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321729061
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-13-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0283f5c5042d448b80d267a7e2a9103d?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:30 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvbd.inf | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index 0de71d1..d397210 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -54,12 +54,15 @@ xendisk.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
+%XenVbdName%=XenVbd_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B\
+,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B\
+,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
 
 [XenVbd_Inst] 
 CopyFiles=XenVbd_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenVbd_Copyfiles]
 xenvbd.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 15:41:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 15:41:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069655.1433451 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixJe-0001E5-Px; Mon, 04 Aug 2025 15:41:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069655.1433451; Mon, 04 Aug 2025 15:41:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uixJe-0001E0-ND; Mon, 04 Aug 2025 15:41:34 +0000
Received: by outflank-mailman (input) for mailman id 1069655;
 Mon, 04 Aug 2025 15:41:33 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/gJW=2Q=bounce.vates.tech=bounce-md_30504962.6890d342.v1-16cd2c57b1fd4b2689f4c5b7adc3a074@srs-se1.protection.inumbo.net>)
 id 1uixDx-0006Ww-Te
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 15:35:41 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a9dd7c15-7148-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 17:35:35 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwgcL0w19zNCd9K9
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 15:35:30 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 16cd2c57b1fd4b2689f4c5b7adc3a074; Mon, 04 Aug 2025 15:35:30 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a9dd7c15-7148-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754321730; x=1754591730;
	bh=KEsADyBuPZutcaPUl5YGucc9tObPCggy9czcCwCnOzM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=HZ4BLbgyec3h1rcnIOLm6agzkujOXZsFcxKtO9EGfI19582y50k6W5btCWTAJMeid
	 PBaoR1aFfT1qaWy3ljONYUoUdnmB7mXA19VE8PYoSbrcf4HdR4T2FPZzT6mXFjPp0P
	 OoW3LjcxL+vYHBbCzuRpaGVm2Es4lI/GOO1KJhzNQJd0gGAJaxDSZJM2LiVWi3YbtA
	 bJPtYcrrB77CIdpPrU3VOJlClL24BLtbhDdPaFYuvc1/H7aMTuwhmILcf6aFtsOHlD
	 Sib6fz2pjH8EqfnX31N8k8jg6tFKl/KrvIMPpQRfSP3+1C73v0/ioB636cJfy2i5YE
	 IZKb+2YTpliug==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754321730; x=1754582230; i=ngoc-tu.dinh@vates.tech;
	bh=KEsADyBuPZutcaPUl5YGucc9tObPCggy9czcCwCnOzM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=wKB3aKhT9fHnqQKoYVUsTYgKjL+5Z/BstYoL3dMe+BocYKTJO52Wf80FNw0z3Fob0
	 9zkfOZeGhV/dMz/j2Czivqd6npxP76AfimF60VkIkw4RK3Qvp6dqQ43uxzDbIJ44q1
	 lVH/p3KpECU32NZv8qusM5qDKIb4FF4btPe0/eC2Yy5nflEQvs+MZtmX5cbdsFnX4N
	 dtNpbTam/3KxckvqHqzm+xZYRLb2GWlnpTp6XjjA1MJyOONm5GZJp5/rJ+qQZlAWH5
	 jksGLfvcvKQ/E8br10GXln9KK3KukRsOPi1au6MJrjPOMxD3xsx5RQZE3sRto6HUoa
	 9yeWl8dU+9srQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=208/9]=20Enable=20Xenbus=20precedence?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754321728118
To: win-pv-devel@lists.xenproject.org
Cc: "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804153516.2038-9-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.16cd2c57b1fd4b2689f4c5b7adc3a074?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 15:35:30 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define precedence values based on each device's numeric device ID.

This ensures that vendor devices always get activated instead of the
generic ones.

Condition the precedence on the FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenbus.inf       | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 4c58f03..5b99728 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_ACTIVATE' = $Env:FORCE_ACTIVATE;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenbus.inf b/src/xenbus.inf
index bbd22a0..81bfce2 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -119,6 +119,9 @@ AddReg = XenFilt_Parameters
 HKR,"Parameters",,0x00000010
 HKR,"Parameters","*PNP0A03",0x00000000,"PCI"
 HKR,"Parameters","Internal_IDE_Channel",0x00000000,"IDE"
+HKR,"Parameters","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_ACTIVATE@
+HKR,"Parameters","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
+HKR,"Parameters","PCI\VEN_5853&DEV_C000",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
 [Monitor_Service]
 DisplayName=%MonitorName%
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 18:50:13 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 18:50:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069773.1433506 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0GA-0004Uq-Qz; Mon, 04 Aug 2025 18:50:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069773.1433506; Mon, 04 Aug 2025 18:50:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0GA-0004Uj-OH; Mon, 04 Aug 2025 18:50:10 +0000
Received: by outflank-mailman (input) for mailman id 1069773;
 Mon, 04 Aug 2025 18:50:10 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dtik=2Q=bounce.vates.tech=bounce-md_30504962.689100da.v1-128a4d818ba04d0fb47a8ad17cc224d0@srs-se1.protection.inumbo.net>)
 id 1uj0G9-0004Ud-U6
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 18:50:10 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id d49f1a39-7163-11f0-b898-0df219b8e170;
 Mon, 04 Aug 2025 20:50:03 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bwlwp2G8nzNCd9Ng
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 18:50:02 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 128a4d818ba04d0fb47a8ad17cc224d0; Mon, 04 Aug 2025 18:50:02 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d49f1a39-7163-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754333402; x=1754603402;
	bh=QJfjTzep9b+TW+5o/VNc2N0+xo42JlXP0fNmR4SwCD4=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=hu4aBe6AsEiF0rWR5dkx+YfFWKnAGbVkUrpST8M5WepEZ1WmSTfJwz5sN9yIYKTN7
	 BMHlFMpAa8BWXcXmHQxq2rZKyUi8aDpYZifvWsXtRpRLAvJiMRLc1gZuEUKIj4M7kR
	 yeIR79wIkiU1C86X6z3LQmQ3cR/FSu2gCO1L7pwoCVmHsfXzARNzzYGKpvYJNn8kZ0
	 THojB5lYgt2rQitTjbPlG9258w/AhycqSFYjTIXACPlS8YSygU8FCRYQ/k9CmIjHpx
	 h5vMKV8Tcat2rd6bfTMBMKxE7HrB+KsNRa9hAQ6nv9g4elLmQRMbjiG3QnOY/a88x0
	 IaPAF+3c13JXw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754333402; x=1754593902; i=ngoc-tu.dinh@vates.tech;
	bh=QJfjTzep9b+TW+5o/VNc2N0+xo42JlXP0fNmR4SwCD4=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=aEg+4KrLcRRXuQ7JCue31fDmLuG1NTRpRLQo64YW3cZeIkgzdAOJQ72ugABxermOD
	 vfF/26JT+FzXv/HRCMvSuTHkxp1wbLMJaiWOMuzIR4apYQ2MofWAq8MTT1XG9zgUu5
	 WfgScVgWN8qxiqxhAF0PxJQnoTUu1+zuRL7SWK5a9lMNmwygzEu9tjwLUpML/E+w20
	 Sjo7Q/BGb+Wz6Cj8v3x6HmaUYJeU98lknFhjpT26NiGav8xn3ftiyu/UDTejpMDzFB
	 4Iu0xxO5zSLGniHFX5jXhbiqxHZxXw5slymnL92wHMZlhRfmixbxa06sO8Z9tsGVQP
	 k2QrLdjq4T0ng==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v3=2010/10]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754333399537
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804184956.382-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.128a4d818ba04d0fb47a8ad17cc224d0?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 18:50:02 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 5b99728..79abf1e 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
 				Write-Host "Skipping Line Containing " $_.Name
 				$line = $null
 			}
-			$line = $line -replace $key, $_.Value
+			if ($null -ne $line) {
+				$line = $line -replace $key, $_.Value
+			}
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 18:50:42 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 18:50:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069780.1433509 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0Gg-0004cO-TG; Mon, 04 Aug 2025 18:50:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069780.1433509; Mon, 04 Aug 2025 18:50:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0Gg-0004cH-Qe; Mon, 04 Aug 2025 18:50:42 +0000
Received: by outflank-mailman (input) for mailman id 1069780;
 Mon, 04 Aug 2025 18:50:42 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=AY2o=2Q=bounce.vates.tech=bounce-md_30504962.689100ff.v1-16514669f5aa48eba4596a8c27900203@srs-se1.protection.inumbo.net>)
 id 1uj0Gf-0004XT-Vq
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 18:50:41 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id ea65b84a-7163-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 20:50:40 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwlxW64cNzBsV1tY
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 18:50:39 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 16514669f5aa48eba4596a8c27900203; Mon, 04 Aug 2025 18:50:39 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ea65b84a-7163-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754333439; x=1754603439;
	bh=QJfjTzep9b+TW+5o/VNc2N0+xo42JlXP0fNmR4SwCD4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=n1+ijDbW1XF74gOs8U28qD3ALb9eyoSks2lOkucJ9JmLkwbhc0pInBQe/rU7s2zWw
	 hpI2kJ7rDRqGXpwZHin0qYvT61ktICn/1bAaoOkZis/UYvctUx3t+3sPEWcCimjClz
	 cvfRFIliogXzP36po73aq0yW9AN0ELx5eR29dr6gDNNv85U+BSvgwcLS3QCvvWJshE
	 YuGX78GpY68aH1WNLHtOuwQxubzWm/Zkghc4LLiQB4ZyVLvqKjpkcNKumf5Ys+63Na
	 DYr7R9m4Ay5YGUHPx3LERevR9fSLX+VW1aGsQyfJaEPnNcXpqszKzgqJJWN+DfOPuU
	 F7zinQe4tV5bw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754333439; x=1754593939; i=ngoc-tu.dinh@vates.tech;
	bh=QJfjTzep9b+TW+5o/VNc2N0+xo42JlXP0fNmR4SwCD4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=i/vTNPzFM5xMNWdXII2M7a3rVloyWMapwrCvXq4quM/LC29P2l2CfmZBeX11G82DB
	 oQKp5Fr0DFjQEeNPidRm24pMbtLk/tQHsW/AZahmUzFWTQe2glQ5qU1GlQCJTXU+4Q
	 kdWMg8JVf5SQ4GF8UxgT8HyIIRbGx0UtGRcIZzCOQl2D+HErTOKU048K3QnFdKGh+B
	 o6omT6BbYspp1Em7lMOn7AQzqJI02/4kbmldEvgQ8tXFreHP4AeLwm1UeYVIXrIpt7
	 +LhxyfYvSCtNu5R1yAsAtRKu/uxF8bxxaRvZUK/a9V8yCD6Qj8l9Hyre1edqfZ6JkN
	 O4fm0d+ndiHFg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v3=2010/10]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754333438911
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804185037.1973-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.16514669f5aa48eba4596a8c27900203?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 18:50:39 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 5b99728..79abf1e 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
 				Write-Host "Skipping Line Containing " $_.Name
 				$line = $null
 			}
-			$line = $line -replace $key, $_.Value
+			if ($null -ne $line) {
+				$line = $line -replace $key, $_.Value
+			}
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 18:51:19 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 18:51:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069793.1433514 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0HH-0004ko-0s; Mon, 04 Aug 2025 18:51:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069793.1433514; Mon, 04 Aug 2025 18:51:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0HG-0004kh-U4; Mon, 04 Aug 2025 18:51:18 +0000
Received: by outflank-mailman (input) for mailman id 1069793;
 Mon, 04 Aug 2025 18:51:17 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BBqB=2Q=bounce.vates.tech=bounce-md_30504962.68910124.v1-d95a6052cb614653a82bab3c3415a479@srs-se1.protection.inumbo.net>)
 id 1uj0HF-0004XT-UT
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 18:51:17 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 003cbe2b-7164-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 20:51:17 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwlyD3WxjzBsV1tW
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 18:51:16 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d95a6052cb614653a82bab3c3415a479; Mon, 04 Aug 2025 18:51:16 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 003cbe2b-7164-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754333476; x=1754603476;
	bh=PSzbkhu8qv6r9E18h1kZn0Kv0+6GFQVtnmPzOtDYaWE=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=yppS8nvGYJ6H/SseqzvXg+PGxpXgiZmWWqPJBGy0V/iZXLMolxC033po1adSs3GBc
	 UEQoud2nFNpL/NyfS5g3Cz55iLyXyE/aLjtEybjeV1x+0TaB7UY/XD4oIzJ/eIbPzc
	 joN0NhAOfXmhY3rJGRSESy8yS1ZRfIukx5p6w4O10G2qLJbtuGGPZMhITZJXkCxlq6
	 Bnz6/kyelpLJ3KTUg0biavMkRdF8t8SaWxsMKdyG+LNfDiLvLyprTQrfN4TaCRWUkv
	 gRLiXw08OXTxAigRLcwCcRGvESiHrwKecnCi5SETC7BntxW12yzkE2lkyJu1qEbbgO
	 iSignB4PJbS9Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754333476; x=1754593976; i=ngoc-tu.dinh@vates.tech;
	bh=PSzbkhu8qv6r9E18h1kZn0Kv0+6GFQVtnmPzOtDYaWE=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=W1nR8g2l83P+euSkdJzy3eCrJ4HbdqEOvz4mcK5uN5dfS6Sg6DXL2buN3aLOG09Es
	 ffEmhZ44wpHfgYw4mxm9xmm6wZBSyQys6vo3Yz1a4fHWOmNz0t/V4ZoyknhdRP9C7d
	 RY2HTHHTUOlJeqS38fQnaAe5P2qVvs78FGFtSecWKl5NQ7aUCH1eiiEweSHA02lur+
	 0cn9Au3m6fHPgnEdrJiwL9/Bnb/OikupYbXW6sdsrekXYN1anfPeiHcq8FTht+T0HB
	 DI/62fxVqJamzG/sv1wSav8HoIDdHW/CkfwDLb6rr+KWIUVY52W/y0Vn1ET/e8kpyz
	 0FLHeF1JA0K/w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v3=203/3]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754333475699
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250804185114.932-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d95a6052cb614653a82bab3c3415a479?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 18:51:16 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 8b0b14b..a7d13ae 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
 				Write-Host "Skipping Line Containing " $_.Name
 				$line = $null
 			}
-			$line = $line -replace $key, $_.Value
+			if ($null -ne $line) {
+				$line = $line -replace $key, $_.Value
+			}
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 04 18:52:22 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Aug 2025 18:52:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1069803.1433517 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0II-0004pk-3u; Mon, 04 Aug 2025 18:52:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1069803.1433517; Mon, 04 Aug 2025 18:52:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uj0II-0004pd-1T; Mon, 04 Aug 2025 18:52:22 +0000
Received: by outflank-mailman (input) for mailman id 1069803;
 Mon, 04 Aug 2025 18:52:21 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Gzez=2Q=bounce.vates.tech=bounce-md_30504962.68910162.v1-5bc6a88a1a214140811a2b2a362a484d@srs-se1.protection.inumbo.net>)
 id 1uj0IH-0004pX-7i
 for win-pv-devel@lists.xenproject.org; Mon, 04 Aug 2025 18:52:21 +0000
Received: from mail177-1.suw61.mandrillapp.com
 (mail177-1.suw61.mandrillapp.com [198.2.177.1])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 25c1d859-7164-11f0-a321-13f23c93f187;
 Mon, 04 Aug 2025 20:52:20 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-1.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bwlzQ6pfrzBsV1tl
 for <win-pv-devel@lists.xenproject.org>; Mon,  4 Aug 2025 18:52:18 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5bc6a88a1a214140811a2b2a362a484d; Mon, 04 Aug 2025 18:52:18 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 25c1d859-7164-11f0-a321-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754333539; x=1754603539;
	bh=I8sRzCbWF8gXIJvGNvRE849FvXCsyXKcLMTja5ylSLM=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=gm4WmpbU20BVK7XkML1QiWK5Er5vxlaF0r4KpSrskeigxgWXa4O2Bc/rT8jEAwy85
	 2i+Ngvir425gwPawAfdQbNC3MR29VPn7iIBPSpQDbO/VNUBApfdt3iL9vjzNvSwBT6
	 VmyH52p/2yo5nrMRIn06WlCVjjF/kpdH7WYQ9OXOjh1AODtWv9WIpd+pfjW5qZfEAE
	 MavQAtujgp0/fcaIi1eqx37bUCYZ4HVZbAgrv0R9rMWxMEJdP8cf3BqRWvFtlo1bNw
	 Ib+tva31uu/FewFPaB9O+dIebTcSOlTv/ckk3iVmu80AFIseQQE+RH2FTqPokEmy+P
	 vKSRc4HPz6fUw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754333538; x=1754594038; i=ngoc-tu.dinh@vates.tech;
	bh=I8sRzCbWF8gXIJvGNvRE849FvXCsyXKcLMTja5ylSLM=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=E7qUODiN+EhPZDi4T5CxFc+n3lG0YVXtI62ssVl434aI4Yu67dJq9qb0TuhPaPUX2
	 ZxM2QNRsScIMjIJgKncXqTdMcCQuCsv6sCKbBRQTsrPf6nA8F3VonZLwTwf6lGk5WC
	 2+dEZPOOELdr/NlnWoCUtlt/q6e5jHL47NAxWV25GbTrxrdd90t36zxQaXBtddk0En
	 97gTfvQ1uPjuLKnG7cJP+oe3OBzZhcUFiBO5sm4GDYTzG0rZpr7Nz+yzXAIb3V5swt
	 tporpor59BtgYitaaq2jzpq3deIuA/TQMW+UjrqzXJJ25up9EXX+rtidTxGED9s+tb
	 azcIPRjKX4fBA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH=20v3=2010/10]=20Collapse=20skipped=20template=20lines?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754333538320
Message-Id: <5ae54c54-42ec-44a6-adbc-c83c2384c615@vates.tech>
To: win-pv-devel@lists.xenproject.org
References: <20250804184956.382-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804184956.382-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5bc6a88a1a214140811a2b2a362a484d?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250804:md
Date: Mon, 04 Aug 2025 18:52:18 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 04/08/2025 20:50, Tu Dinh wrote:
> This is needed to correctly generate multiline INF directives.
> 
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>   scripts/genfiles.ps1 | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
> index 5b99728..79abf1e 100644
> --- a/scripts/genfiles.ps1
> +++ b/scripts/genfiles.ps1
> @@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
>   				Write-Host "Skipping Line Containing " $_.Name
>   				$line = $null
>   			}
> -			$line = $line -replace $key, $_.Value
> +			if ($null -ne $line) {
> +				$line = $line -replace $key, $_.Value
> +			}
>   		}
>   		$line
>   	} |

Please disregard this one, I forgot to add In-Reply-To.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 07:57:15 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 07:57:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071291.1434787 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZ1N-0003vl-9y; Wed, 06 Aug 2025 07:57:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071291.1434787; Wed, 06 Aug 2025 07:57:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZ1N-0003ve-7P; Wed, 06 Aug 2025 07:57:13 +0000
Received: by outflank-mailman (input) for mailman id 1071291;
 Wed, 06 Aug 2025 07:57:12 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZ1M-0003vY-1n
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 07:57:12 +0000
Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com
 [2a00:1450:4864:20::12d])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id f402c071-729a-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 09:57:10 +0200 (CEST)
Received: by mail-lf1-x12d.google.com with SMTP id
 2adb3069b0e04-55b88369530so7931105e87.0
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 00:57:09 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f402c071-729a-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754467029; x=1755071829; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=QDoCn1uJ4/3vRabUTqyq5D7P2TgCavBpQen6SXhuv88=;
        b=ZVphgWkjnbctHBcBwMTj6VvS4AArzDGJT757UDXGXyvj21ZkeQlNo4H97TOP0EXEUg
         Q2Cdma6ugVuabBelBFsey9+jCJGEMdu4SVFOnJO/AaMx2tMOv+UtptOvVboTHuOpzF6l
         ye42cKd7q0L92h51CdlAuk2sWN4c1v9pD3yVk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754467029; x=1755071829;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=QDoCn1uJ4/3vRabUTqyq5D7P2TgCavBpQen6SXhuv88=;
        b=FNbfXHWpx81PDyQmwHb2EiLJFZ7pSrhSmF9cLufSz8al0DGmUy/Yc8YY83WHLIzrOt
         cGOZw9+3n4gaBQJTaELui03bLcDuJdPmSlm+c9fd8OeKfWsPJH4NU1fupS/5eU2Pr0Qc
         /P7lS32ZAG3ifvCH9k6OnP011t5WP7HgF1TqsyJBGbLaPbTL/FC5wS0m5e0/vt48sIMv
         A5+bwYv1opLjkjtGvZ5pTZM1u0uwjNR3vDtWawZYs0fTuL7IqxymS5N9ma5//2D3bTOB
         1nHzgU8WRLcDPirpPOyIG7hJ6waeOq1agg3lxsFN5Lag3E1qoneX1nqab3mYLwDZHkkW
         aI+A==
X-Gm-Message-State: AOJu0Yy/GAOqVamggewMoUrsJuOBgs/v6I0NxmW8CbqvQILJd8UmVn0h
	pXIDSRN1v5kW25qHaOi3INUWtXLRPKGBDO+MYsMfERKluqy4oS+/l00T+NWkMzYTTsHtBywl8yt
	GpFkAb1fXJN6T/jgOaQ4XThqlndJUYF6fjoUCmHmtGfMbeFGgpdk=
X-Gm-Gg: ASbGncuhTNAk8fkNPiU9PxTU+6VbrHADyrKJGggyr0o6Z2ibjURXhhuyDDUGrY0bo/i
	uktLnG+I+hCbPFjz4NtKikM84uGXRc0+QpGWdk6YPvNpKJ6Y9/oMVjxt1CrSxDhajZVmhbe37Wl
	YS+5f7Uc+sROqHzoe1knJXUolydVo2QXd1Y+AMvxvWks0eru1GH68NgxMDXHdfajqVHEcomEnDG
	Rrzqw==
X-Google-Smtp-Source: AGHT+IGqlHbYdI5UWXKgKDsOv7cpSZTfWnyGsKBPADNRZfIiuWRhgn2mNQ5WlHjzwjQ6c8ejhJZIkSjknpTrM7nqI+Q=
X-Received: by 2002:a05:6512:12c9:b0:55b:9274:ad2a with SMTP id
 2adb3069b0e04-55caf2f14f1mr578882e87.5.1754467028631; Wed, 06 Aug 2025
 00:57:08 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-3-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 08:56:57 +0100
X-Gm-Features: Ac12FXyJVlW9uq8lRy2Z1XlM4qo7T1s7WbmI117uoVuGPQ4akzFhdn2UQA2T9fA
Message-ID: <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 2/9] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="000000000000031ba6063badb0fe"

--000000000000031ba6063badb0fe
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

>  [Inst.NT@INF_ARCH@]
> -; DisplayName          Section         DeviceID
> -; -----------          -------         --------
> -
> -%XenBusName_VEND%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_@VENDOR_DEVICE=
_ID
> @&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
> -%XenBusName_0002%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_0002
> -%XenBusName_0001%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_0001
> +%XenBusName%=3DXenBus_Inst,\
>

Comma should be on the vendor device ID line, so if VENDOR_DEVICE_ID is not
defined, then the INF section is still valid, although it 'promotes' 0002
to HWID from CompatID



> +PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01=
\
> +,PCI\VEN_5853&DEV_0002\
> +,PCI\VEN_5853&DEV_0001
>
>  [XenBus_Inst]
>  CopyFiles=3DXenBus_CopyFiles
>  CopyFiles=3DMonitor_CopyFiles
> +FeatureScore=3D0xFE
>
>
The main potential issue here is determining if Microsoft / Windows Update
will allow an update distribution to the vendor device ID without
distributing for the compatible IDs, so drivers will only install via
Windows Update on the vendor device, not on others - if this is not
possible, then an alternate method is needed. I've so far not been able to
confirm this either way, but it would appear that driver distributions are
enabled for a specific HWID.

Owen

--000000000000031ba6063badb0fe
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at =
4:35=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">=C2=A0[Inst.NT@INF_ARCH@]<br=
>
-; DisplayName=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Section=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0DeviceID<br>
-; -----------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -------=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0--------<br>
-<br>
-%XenBusName_VEND%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@5853&amp;REV_0=
1<br>
-%XenBusName_0002%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_0002<br>
-%XenBusName_0001%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_0001<br>
+%XenBusName%=3DXenBus_Inst,\<br></blockquote><div><br></div><div><div clas=
s=3D"gmail_default" style=3D"font-family:monospace">Comma should be on the =
vendor device ID line, so if VENDOR_DEVICE_ID is not defined, then the INF =
section is still valid, although it &#39;promotes&#39; 0002 to HWID from Co=
mpatID</div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">
+PCI\VEN_5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@5853&=
amp;REV_01\<br>
+,PCI\VEN_5853&amp;DEV_0002\<br>
+,PCI\VEN_5853&amp;DEV_0001<br>
<br>
=C2=A0[XenBus_Inst] <br>
=C2=A0CopyFiles=3DXenBus_CopyFiles<br>
=C2=A0CopyFiles=3DMonitor_CopyFiles<br>
+FeatureScore=3D0xFE<br><br></blockquote><div><br></div><div class=3D"gmail=
_default" style=3D"font-family:monospace">The main potential issue here is =
determining if Microsoft / Windows Update will allow an update distribution=
 to the vendor device ID without distributing for the compatible IDs, so dr=
ivers will only install via Windows Update on the vendor device, not on oth=
ers - if this is not possible, then an alternate method is needed. I&#39;ve=
 so far not been able to confirm this either way, but it would appear that =
driver distributions are enabled for a specific HWID.</div><div class=3D"gm=
ail_default" style=3D"font-family:monospace"><br></div><div class=3D"gmail_=
default" style=3D"font-family:monospace">Owen=C2=A0=C2=A0</div></div></div>

--000000000000031ba6063badb0fe--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:00:55 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:00:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071315.1434791 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZ4x-0005cS-NN; Wed, 06 Aug 2025 08:00:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071315.1434791; Wed, 06 Aug 2025 08:00:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZ4x-0005cL-Ko; Wed, 06 Aug 2025 08:00:55 +0000
Received: by outflank-mailman (input) for mailman id 1071315;
 Wed, 06 Aug 2025 08:00:54 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZ4w-0005cF-Q2
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:00:54 +0000
Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com
 [2a00:1450:4864:20::230])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 799d230e-729b-11f0-a322-13f23c93f187;
 Wed, 06 Aug 2025 10:00:54 +0200 (CEST)
Received: by mail-lj1-x230.google.com with SMTP id
 38308e7fff4ca-32f1df58f21so57026231fa.3
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:00:53 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 799d230e-729b-11f0-a322-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754467253; x=1755072053; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=gdIqbAmjh0iOb+5yVnV2S7jhERd/BTZto9nCkA5AUdI=;
        b=N1Y00uMxgboCzKhEG1gg/T1NfEkJiu1Zt0pSnaabph16EIiDXPa1FHm0uUYMeJou9U
         OAkb9JN5uYsk1yAkuS7MUOzyHcxuISEGvcpGN4bVYCEd509cErVVRXDwy7Frsw2T6bKX
         G0MJPdXV2/bFwfliYe/X4MYO7EbFEIufxa8K4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754467253; x=1755072053;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=gdIqbAmjh0iOb+5yVnV2S7jhERd/BTZto9nCkA5AUdI=;
        b=Qhy5erbFEYZbpsHN3mmQfXsHT+CcgjVBum3uaRQFMSEJBPFkMncJZhynwrxliYBjEK
         9VUFO5kf+ckt6hAquE7jvNDscQWqOXkQ8VAeL2BH1EqRSJ3hRmvwoeBLqVR2xw4lMYE2
         OmgUnjqdiUePmQhZDngvm5AGG0nckar2qQsIecxPrc2Ow/ZCP6z1NqCbI/s5g0bwmds2
         Zto9iMHVAMcpMHF5wI1oHvsEGtBsecO/fViMa0EFaeW5Ik4G74suBQCMa00KPnNgePXk
         ALDD0GJ/bC4w705RZBiV/O/zqXB+zgS49UEZI2f+1dVuEtwZInrCbzKFBIM0S4GMyXsk
         hLxA==
X-Gm-Message-State: AOJu0YyONjeTLGz+KmucFOnvJsYhGcbyl8a1Vu2VGZjH8C/72kOc8/3+
	yxY9nkWtVW+usm/e1S6lN1OAtPrPO+x88wOhMWleRuGegopOszJdzpPqkS315fyjhiPv5OES5DU
	uI6hYoUhV3GAVNQXDuqjpvw2FupYbMyD0yWuBHmHj
X-Gm-Gg: ASbGncsX7ATKEOblwbn6G9/n3HvmPDZMjyxh6EhZjhtiUpWPsLndscLIAtbzDwgDT2q
	vSyM19JWv3U7xcKCS79omYaBw1shAGf108NWt8+ylkf5JBz5h3aDbGv8qpj7HbZwQyDali5l/jG
	jRHDH3xF5gzXm3j/zscsbpnBWLWLTEppJSk0FRskUfYjj090kOT7fAGktGYF2Uj8dsGYDxNWSBW
	v2Afw==
X-Google-Smtp-Source: AGHT+IFFLS25Xa+uBXdNSQ9ixDu0nkKBPXB38GgMe55OmwEEg4X2AAczDw8tAelarRftbY/CBa5poLq9nfAGh3fYlEs=
X-Received: by 2002:a05:651c:1987:b0:32f:3e83:4379 with SMTP id
 38308e7fff4ca-33381452f4amr3817541fa.38.1754467252691; Wed, 06 Aug 2025
 01:00:52 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
 <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com>
In-Reply-To: <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:00:40 +0100
X-Gm-Features: Ac12FXwe2qaB5ElX1sn9wfCitP0Js4LEVelQFW1qEotjIJksef2lVs6v3omTCGY
Message-ID: <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 2/9] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="0000000000005e0274063badbdb7"

--0000000000005e0274063badbdb7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The XenVbd changes seem fine, but there is a problem if older xenvbd is
loaded on this xenbus, where the devices do not cope with a change in the
device_id or presence of the vendor device. To work around this, I had to
set xenbus's PDOs DeviceID to exclude the PCI vendor ID (e.g.
"XENBUS\VEN_XP&DEV_VBD")

Owen


On Wed, Aug 6, 2025 at 8:56=E2=80=AFAM Owen Smith <owen.smith@cloud.com> wr=
ote:

>
>
> On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:
>
>>  [Inst.NT@INF_ARCH@]
>> -; DisplayName          Section         DeviceID
>> -; -----------          -------         --------
>> -
>> -%XenBusName_VEND%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_@VENDOR_DEVIC=
E_ID
>> @&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
>> -%XenBusName_0002%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_0002
>> -%XenBusName_0001%      =3DXenBus_Inst,   PCI\VEN_5853&DEV_0001
>> +%XenBusName%=3DXenBus_Inst,\
>>
>
> Comma should be on the vendor device ID line, so if VENDOR_DEVICE_ID is
> not defined, then the INF section is still valid, although it 'promotes'
> 0002 to HWID from CompatID
>
>
>
>> +PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID
>> @5853&REV_01\
>> +,PCI\VEN_5853&DEV_0002\
>> +,PCI\VEN_5853&DEV_0001
>>
>>  [XenBus_Inst]
>>  CopyFiles=3DXenBus_CopyFiles
>>  CopyFiles=3DMonitor_CopyFiles
>> +FeatureScore=3D0xFE
>>
>>
> The main potential issue here is determining if Microsoft / Windows Updat=
e
> will allow an update distribution to the vendor device ID without
> distributing for the compatible IDs, so drivers will only install via
> Windows Update on the vendor device, not on others - if this is not
> possible, then an alternate method is needed. I've so far not been able t=
o
> confirm this either way, but it would appear that driver distributions ar=
e
> enabled for a specific HWID.
>
> Owen
>

--0000000000005e0274063badbdb7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">The XenVbd changes seem fine, but there is a problem if older xenvbd is =
loaded on this xenbus, where the devices do not cope with a change in the d=
evice_id or presence of the vendor device. To work around this, I had to se=
t xenbus&#39;s PDOs DeviceID to exclude the PCI vendor ID (e.g. &quot;XENBU=
S\VEN_XP&amp;DEV_VBD&quot;)</div><div class=3D"gmail_default" style=3D"font=
-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-fam=
ily:monospace">Owen</div><div class=3D"gmail_default" style=3D"font-family:=
monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quote_contai=
ner"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 6, 2025 at 8:56=E2=
=80=AFAM Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen.smith@=
cloud.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" s=
tyle=3D"font-family:monospace"><br></div></div><br><div class=3D"gmail_quot=
e"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at 4:35=E2=80=
=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">=C2=A0[Inst.NT@INF_ARCH@]<br>
-; DisplayName=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Section=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0DeviceID<br>
-; -----------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -------=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0--------<br>
-<br>
-%XenBusName_VEND%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@5853&amp;REV_0=
1<br>
-%XenBusName_0002%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_0002<br>
-%XenBusName_0001%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_=
5853&amp;DEV_0001<br>
+%XenBusName%=3DXenBus_Inst,\<br></blockquote><div><br></div><div><div clas=
s=3D"gmail_default" style=3D"font-family:monospace">Comma should be on the =
vendor device ID line, so if VENDOR_DEVICE_ID is not defined, then the INF =
section is still valid, although it &#39;promotes&#39; 0002 to HWID from Co=
mpatID</div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">
+PCI\VEN_5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@5853&=
amp;REV_01\<br>
+,PCI\VEN_5853&amp;DEV_0002\<br>
+,PCI\VEN_5853&amp;DEV_0001<br>
<br>
=C2=A0[XenBus_Inst] <br>
=C2=A0CopyFiles=3DXenBus_CopyFiles<br>
=C2=A0CopyFiles=3DMonitor_CopyFiles<br>
+FeatureScore=3D0xFE<br><br></blockquote><div><br></div><div class=3D"gmail=
_default" style=3D"font-family:monospace">The main potential issue here is =
determining if Microsoft / Windows Update will allow an update distribution=
 to the vendor device ID without distributing for the compatible IDs, so dr=
ivers will only install via Windows Update on the vendor device, not on oth=
ers - if this is not possible, then an alternate method is needed. I&#39;ve=
 so far not been able to confirm this either way, but it would appear that =
driver distributions are enabled for a specific HWID.</div><div class=3D"gm=
ail_default" style=3D"font-family:monospace"><br></div><div class=3D"gmail_=
default" style=3D"font-family:monospace">Owen=C2=A0=C2=A0</div></div></div>
</blockquote></div>

--0000000000005e0274063badbdb7--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:08:58 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:08:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071334.1434806 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZCj-0006K9-Hm; Wed, 06 Aug 2025 08:08:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071334.1434806; Wed, 06 Aug 2025 08:08:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZCj-0006K2-Ek; Wed, 06 Aug 2025 08:08:57 +0000
Received: by outflank-mailman (input) for mailman id 1071334;
 Wed, 06 Aug 2025 08:08:56 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZCi-0005ql-Ny
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:08:56 +0000
Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com
 [2a00:1450:4864:20::131])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 989c0240-729c-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 10:08:55 +0200 (CEST)
Received: by mail-lf1-x131.google.com with SMTP id
 2adb3069b0e04-55b7e35a452so7927538e87.2
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:08:55 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 989c0240-729c-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754467734; x=1755072534; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=VSZ6LqYRd2Tr0j3GAhvRvUcemg4RQ+T5Hfs5EST41Tc=;
        b=IXG4hQYYorp9AMdO+s7b36I1n/UahZuHsfY7DPcmjeMd92SYK9PHjk3J4z6ovbcMXR
         wO3ryLUrlP9a5Qt3hKSmLZv1joOZs/RbRSDN7+F+kJohM+Z+30iOyXj/vQclMNhR2O/E
         CFnNRrYCHAYTaGWWk+D7jMLce6/rRqbMGURwM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754467734; x=1755072534;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=VSZ6LqYRd2Tr0j3GAhvRvUcemg4RQ+T5Hfs5EST41Tc=;
        b=a6llvKBcgal1OfprULOVOZKg3kYKf/xK2eeoZ2PRN6cfYfodKmMMv5QoLkM1JdIksW
         4ZGrdQXYeRPfy3YIPFipImeGknj/8creElxlaxKgbHz8F5MP42tCAEAxTMKHecJp4UXN
         D7Dkxdmro59vnQup79y877yoNughXKFwOxbT0SvknFjBx8pbrHTWVWyxJKTl6STeiYui
         q3JIYGkH6FE3zUDavtWVuGr0zzbU9FJZwxasQQgee+n7EUjPeC/6K9NZf9rZx5FYTwBH
         VLZaHQqaRHjg8aziNNvodyzoaQ4GxhwX+2Ju2IBHGHAQxR1+5y6jlWcJDsBYkbg8jrrd
         3TCg==
X-Gm-Message-State: AOJu0YynhxQgfYeTp8/1gZolz+dhNO1HUtK87pzrI7mjWhHHIM3xxuLq
	jyAT3nuEBZY1qEWHtH//S5wmh6ZqDC0L2Bqx1SQt5wVYViJpS6G2BpNBYapIAc/jh1vZA1HHxjs
	RvYB6I2M+GLOmSYqHbf5BogYwn9bJXjIrvsy6k9cs
X-Gm-Gg: ASbGnctkxKhC0WIcICy3yX1+geVFLIoBgXMqTPdQ7zxsO4/axEqrnZmOByzu94fp76l
	MjRIoO56fmuPZUOJRKktMu7YX5GcUbAdezHlarbZx6rI8E+J8FpQsrcF7KFMSm+bmHVR8sO02yZ
	yN6H2u1tlUAXiRMJO670HnzsMXPmwKSjxBv0JquAf9jdBSIkJMfwPB1B6E46Jh4h3pss4haPS23
	aAd2is=
X-Google-Smtp-Source: AGHT+IH+DvQAMRVNLMEkTV02j6rjjMPxR6YeOqAx3Axt+smR3Of0mC+3mFJRJnGxf/BSx1urltbLBpWxUyINuuUOqU8=
X-Received: by 2002:a05:6512:10c3:b0:55b:8afb:e638 with SMTP id
 2adb3069b0e04-55caf37aaa3mr683497e87.28.1754467734306; Wed, 06 Aug 2025
 01:08:54 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-5-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:08:43 +0100
X-Gm-Features: Ac12FXxOWRaYugK0emttjbAZKMzhCl4h7CFi0vpuZuplzTZLO4eUOuDc47lIUic
Message-ID: <CAC_UY89AU0wwgxFKf-QhgcOYpFUbPKT9N=Y5k5RwHETF+UacUw@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 4/9] xenfilt: Add Xenbus device precedence mechanism
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="00000000000012ddba063baddaf4"

--00000000000012ddba063baddaf4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

>
>      Count =3D Relations->Count;
> @@ -458,11 +460,32 @@ FdoEnumerate(
>          ListEntry =3D Next;
>      }
>
> +    ActiveIndex =3D Precedence =3D 0;
> +    for (Index =3D 0; Index < Count; Index++) {
> +        ULONG   ThisPrecedence;
> +
> +        if (PhysicalDeviceObject[Index] !=3D NULL) {
> +            status =3D PdoGetPrecedence(PhysicalDeviceObject[Index],
>

There doesnt seem to be a reason for this call to be in pdo.c (it
doesnt access a PXENFILT_PDO object) - it could be contained in driver.c,
keeping most of the changes in fewer locations.



> +                                      &ThisPrecedence);
> +            if (ThisPrecedence > Precedence) {
> +                ActiveIndex =3D Index;
> +                Precedence =3D ThisPrecedence;
> +            }
> +        }
> +    }
> +
>      // Walk the list and create PDO filters for any new devices
>      for (Index =3D 0; Index < Count; Index++) {
>  #pragma warning(suppress:6385)  // Reading invalid data from
> 'PhysicalDeviceObject'
>          if (PhysicalDeviceObject[Index] !=3D NULL) {
> -            (VOID) PdoCreate(Fdo, PhysicalDeviceObject[Index], Fdo->Type=
);
> +            LONG    ForceActivate =3D 0;
>

I'd prefer an enum to LONG, which should make it easier to identify force
activation states at a glance.



> +
> +            if (Precedence > 0)
> +                ForceActivate =3D Index =3D=3D ActiveIndex ? 1 : -1;
> +            (VOID) PdoCreate(Fdo,
> +                             PhysicalDeviceObject[Index],
> +                             Fdo->Type,
> +                             ForceActivate);
>              ObDereferenceObject(PhysicalDeviceObject[Index]);
>          }
>      }
>
> Moving and renaming PdoGetPrecedence to driver.c and making the current
DriverGetPrecidence only visible inside the driver.c file, would help with
readability.

Owen

--00000000000012ddba063baddaf4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at =
4:35=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex"><br>
=C2=A0 =C2=A0 =C2=A0Count =3D Relations-&gt;Count;<br>
@@ -458,11 +460,32 @@ FdoEnumerate(<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ListEntry =3D Next;<br>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
+=C2=A0 =C2=A0 ActiveIndex =3D Precedence =3D 0;<br>
+=C2=A0 =C2=A0 for (Index =3D 0; Index &lt; Count; Index++) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0ThisPrecedence;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (PhysicalDeviceObject[Index] !=3D NULL) {<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D <span class=3D"gmail_=
default" style=3D"font-family:monospace"></span>PdoGetPrecedence(PhysicalDe=
viceObject[Index],<br></blockquote><div><br></div><div><div class=3D"gmail_=
default" style=3D"font-family:monospace">There doesnt=C2=A0seem to be a rea=
son for this call to be in pdo.c (it doesnt=C2=A0access a PXENFILT_PDO obje=
ct) - it could be contained in driver.c, keeping most of the changes in few=
er locations.</div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp;ThisPreced=
ence);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ThisPrecedence &gt; Preceden=
ce) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ActiveIndex =3D In=
dex;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Precedence =3D Thi=
sPrecedence;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 }<br>
+<br>
=C2=A0 =C2=A0 =C2=A0// Walk the list and create PDO filters for any new dev=
ices<br>
=C2=A0 =C2=A0 =C2=A0for (Index =3D 0; Index &lt; Count; Index++) {<br>
=C2=A0#pragma warning(suppress:6385)=C2=A0 // Reading invalid data from &#3=
9;PhysicalDeviceObject&#39;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (PhysicalDeviceObject[Index] !=3D NULL=
) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (VOID) PdoCreate(Fdo, PhysicalDe=
viceObject[Index], Fdo-&gt;Type);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LONG=C2=A0 =C2=A0 ForceActivate =
=3D 0;<br></blockquote><div><br></div><div><div class=3D"gmail_default" sty=
le=3D"font-family:monospace">I&#39;d prefer an enum to LONG, which should m=
ake it easier to identify force activation states at a glance.</div><br></d=
iv><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (Precedence &gt; 0)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ForceActivate =3D =
Index =3D=3D ActiveIndex ? 1 : -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (VOID) PdoCreate(Fdo,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PhysicalDeviceObject[Index],<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fdo-&gt;Type,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ForceActivate);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ObDereferenceObject(Physica=
lDeviceObject[Index]);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
=C2=A0 =C2=A0 =C2=A0}<br><br></blockquote><div class=3D"gmail_default" styl=
e=3D"font-family:monospace">Moving and renaming=C2=A0<span style=3D"font-fa=
mily:Arial,Helvetica,sans-serif">PdoGetPrecedence to driver.c and making th=
e current DriverGetPrecidence only visible inside the driver.c file, would =
help with readability.</span></div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif"=
><br></span></div><div class=3D"gmail_default" style=3D"font-family:monospa=
ce"><span style=3D"font-family:Arial,Helvetica,sans-serif">Owen</span></div=
><div class=3D"gmail_default" style=3D"font-family:monospace"><span style=
=3D"font-family:Arial,Helvetica,sans-serif"><br></span></div></div></div>

--00000000000012ddba063baddaf4--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:11:08 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071343.1434810 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZEq-0007ZA-Nd; Wed, 06 Aug 2025 08:11:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071343.1434810; Wed, 06 Aug 2025 08:11:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZEq-0007Z3-Ks; Wed, 06 Aug 2025 08:11:08 +0000
Received: by outflank-mailman (input) for mailman id 1071343;
 Wed, 06 Aug 2025 08:11:07 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZEp-0007Yx-Im
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:11:07 +0000
Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com
 [2a00:1450:4864:20::132])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id e5920f89-729c-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 10:11:04 +0200 (CEST)
Received: by mail-lf1-x132.google.com with SMTP id
 2adb3069b0e04-55b82db8fd4so7300104e87.2
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:11:04 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e5920f89-729c-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754467864; x=1755072664; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=cgWgJeccCNYCmSKGkFW4h8gcWOYGUb5VfRqB9ycJ8Ek=;
        b=Zt66yJSb6RKFwCNAQO791No8nWyvYZrbzPKc5bWcZZqxyrPBeIAvsGOa/1m+Puyg7V
         IRPTtjnSuBVjpeeIR5hE+n/UJEuvlLAC6NzDbBd0qQvDu6U+QY85uVk5eDjUGwA3SReM
         MYYjovPD8R/63paaLfkSQLAxraswCOVKV/LdA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754467864; x=1755072664;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=cgWgJeccCNYCmSKGkFW4h8gcWOYGUb5VfRqB9ycJ8Ek=;
        b=EfJwXuGP4iidoCGdYFr35+04W83R3ypZtfWBEpkMueHNeKT8oYRMVyk2e9EsRMkBQx
         9qpTAJ4AODTZiu/5BfgH9ftp7CZUICUoNewpVdCgpP+P4P3G45irp4ianduX7N/nlxQQ
         V/tw4sSvPO/7LFqVyQCOlvKHk6TkU/5bKXy3SqcaPi471mKx7O2oK2XvGz6baM43oEKp
         Zc3ZfpgiW/pLD0yHXJ/4t0f8ebvlSGZsX5PWZLhnc3avAYTVhJ+COFSwYyCYOG+F04lc
         mDNLbm4qdPSoDG+HQZi1SNq5uvuYJRKI875ss5DDx0YHiQsgOP1I2h6jySNTpYNJvL1F
         7pVQ==
X-Gm-Message-State: AOJu0Yybej2onRsrITDHgZtG2hsPRP+z7wru0jw0OLi0td36RpDIY2fc
	Oi2vyEL7nKtekaHJRdDy9nFQmMqesg++nC4GfI6ax0rTwQ3BM+UzgHwIuK8oKMJJPx56TicAUf1
	cCvUIjqtjBpx1hz5lo/LWNAkL5Y7dRwh/H50qNrFb5pOqKB/DvzU=
X-Gm-Gg: ASbGncujgGXgMb+RsWO/FMjadshrm5kcVKrmVfazoJ0mkvUqrTXFVR9nUZE8zVl0TH9
	vgwBuDMP1HRT518aTZbydVMcoOY75sNerNEG/wCpW0OZlFWsOYRufxOo7McpusPhoweZLvxRfMD
	HxvyyTWwVfy0OGCFhdo4jozvTq0KLjRvP9ws5eLjCEkn2vQ8WmnI95jmruTBEFMjaWg8/UcxVU+
	PFh4Qg=
X-Google-Smtp-Source: AGHT+IHWyOEZg4gPIR53GL82ASn0TVei7wE4hoYyimWDZ2HiUiLawCflEmS9Jnj7sGNyacLiwbYHMt+2oxt4xKEQv0Y=
X-Received: by 2002:a05:6512:3ba8:b0:553:37a7:b217 with SMTP id
 2adb3069b0e04-55caf5b7d95mr627646e87.35.1754467863492; Wed, 06 Aug 2025
 01:11:03 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-6-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:10:52 +0100
X-Gm-Features: Ac12FXyXzgcJkKMWfFdf8fua1v69eBsLMkPCI3pRxfJtZoA3F5gNkHY8mkNg66M
Message-ID: <CAC_UY8-djxjVyaZT4R2SuJ31XJFuzOJ8O+bfuFdRVHK-cmV+cA@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 5/9] Add EMULATED v3
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="000000000000c615d5063bade12c"

--000000000000c615d5063bade12c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> +/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
> +    \brief Determine whether a given device is present in the VM
> +
> +    \param Interface The interface header
> +    \param DeviceID The DeviceID of the device, or NULL to query the
> force-
> +           activated device
> +    \param InstanceID The (un-prefixed) InstanceID of the device or
> +           NULL to match any device instance
> +    \param IsForceActivated Returns 1 if the device was force-activated,
> -1 if
> +           the device was not active and another device was
> force-activated,
> +           and 0 otherwise
> +    \return TRUE if the specified device is present in the system or
> +            FALSE if it is not
> +*/
> +typedef BOOLEAN
> +(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
> +    _In_ PVOID      Context,
> +    _In_opt_ PSTR   DeviceID,
> +    _In_opt_ PSTR   InstanceID,
> +    _Out_opt_ PLONG IsForceActivated
> +    );
> +
>
> Making IsForceActivated an enum would help with clarity. The enum probabl=
y
needs defining in the emulated_interface.h file, so reordering patches or
defining the enum first may help.

Owen

--000000000000c615d5063bade12c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at =
4:35=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">+/*! \typedef XENFILT_EMULAT=
ED_IS_DEVICE_PRESENT<br>
+=C2=A0 =C2=A0 \brief Determine whether a given device is present in the VM=
<br>
+<br>
+=C2=A0 =C2=A0 \param Interface The interface header<br>
+=C2=A0 =C2=A0 \param DeviceID The DeviceID of the device, or NULL to query=
 the force-<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0activated device<br>
+=C2=A0 =C2=A0 \param InstanceID The (un-prefixed) InstanceID of the device=
 or<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL to match any device instance=
<br>
+=C2=A0 =C2=A0 \param IsForceActivated Returns 1 if the device was force-ac=
tivated, -1 if<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the device was not active and ano=
ther device was force-activated,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0and 0 otherwise<br>
+=C2=A0 =C2=A0 \return TRUE if the specified device is present in the syste=
m or<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FALSE if it is not<br>
+*/<br>
+typedef BOOLEAN<br>
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(<br>
+=C2=A0 =C2=A0 _In_ PVOID=C2=A0 =C2=A0 =C2=A0 Context,<br>
+=C2=A0 =C2=A0 _In_opt_ PSTR=C2=A0 =C2=A0DeviceID,<br>
+=C2=A0 =C2=A0 _In_opt_ PSTR=C2=A0 =C2=A0InstanceID,<br>
+=C2=A0 =C2=A0 _Out_opt_ PLONG IsForceActivated<br>
+=C2=A0 =C2=A0 );<br>
+<br><br></blockquote><div><span class=3D"gmail_default" style=3D"font-fami=
ly:monospace">Making IsForceActivated an enum would help with clarity. The =
enum probably needs defining in the emulated_interface.h file, so reorderin=
g patches or defining the enum first may help.</span><span style=3D"font-fa=
mily:monospace">=C2=A0</span></div><div><br></div><div class=3D"gmail_defau=
lt" style=3D"font-family:monospace">Owen</div></div></div>

--000000000000c615d5063bade12c--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:13:39 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:13:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071368.1434843 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZHG-0000ft-IG; Wed, 06 Aug 2025 08:13:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071368.1434843; Wed, 06 Aug 2025 08:13:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZHG-0000fm-Fn; Wed, 06 Aug 2025 08:13:38 +0000
Received: by outflank-mailman (input) for mailman id 1071368;
 Wed, 06 Aug 2025 08:13:36 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZHE-0000fd-E5
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:13:36 +0000
Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com
 [2a00:1450:4864:20::131])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 3d2ba715-729d-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 10:13:31 +0200 (CEST)
Received: by mail-lf1-x131.google.com with SMTP id
 2adb3069b0e04-55b859545c3so946679e87.0
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:13:31 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3d2ba715-729d-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754468010; x=1755072810; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=yIWJoUf2JTAVWBrECGOuZlv4gjQSdcmmurKqdz0PTb0=;
        b=ceKfo60deo9RcQqerweCrKd/M7OC5YcQK3iaQ/pVWLvtLugX0goCy0HnFlwGNcXVDA
         lq8DPdM/eiHP7kGyrNyurJu+2RvKl6U5Uzr+d9oMY5zXrNTLb7qBoY0bUxq3vaTPeRvR
         JSdVY+3QseSEg/+qt+jfey0TIkisGlCbKsybQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754468010; x=1755072810;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=yIWJoUf2JTAVWBrECGOuZlv4gjQSdcmmurKqdz0PTb0=;
        b=NoeNUsDEHEn/0TN+k+WqyfY8HCz6+ux8eYI8s98tK4MF5WLvbb/G4NV+MaLepa+3/I
         9RzS1+MfOGdcexb+cgXJxkzEKyImaTQi9REJwTfejhNtaWXFh6JYuDZ8SJRgDNCDUGIG
         aDDI7X3rA4pXqRVEFvkeHNlP6GMWRrNdf/+DA7eFA4Z3cMnoqmlxXO12DrA8v8uEuum/
         LYMG8y6VdI3e/z3LRIEzxs+I4IglITkYw8mj/glB09bApFvXhCBylH3E1e3N+W10cLGj
         SjPx8R6PEb2FQNaPQwRPfrYjDC03zaBnaKqr6VFLu52nm+Gp+kGGZVbbwvuSuSsZ7bvi
         a3uw==
X-Gm-Message-State: AOJu0YzwCR+/GNFCwHOF9qGyJp5inhrxxyVp2Op2XdmEM+Ixp4EVqJkS
	+qFZwbKTXLr+uBDVKz3GU0KOUG+kjlUPBfhJpxSr48L4zedBiUx9H/OOXm10KV5G+t7KWGpa1oQ
	Se4ytp5VxOu3RvS8wPTc+AsyXYlWgVn21OqrhvNbB
X-Gm-Gg: ASbGncvg+o1ev/p/rg1sR54SPx/N5F/EeZiuYLph/lGMyjFJHDe4i9dd+IidgOo+XK5
	ajsk30ZmL9Y88zhQnev1hO4q8CWS7xUwD8phvq7GObm2JwvWrXOKRAREUfaj2rHAqYUndeFsxAI
	c/0euBvErYY4Crj3gupoQPEMgW+h1HImr+cOMfP2F9LTLvWtpVJK7VGUEwexQ2sEcghJb/ovRBJ
	r+A13Q=
X-Google-Smtp-Source: AGHT+IGuBsp01OgLKWNPuB6ohkr/Ht8oshRmImoaTi9gzZFmGXivFy4znwEwYqd+SG3aW/UpI236mSsX2BC5NtIC1co=
X-Received: by 2002:a05:6512:ba8:b0:554:f82f:181a with SMTP id
 2adb3069b0e04-55caf21f5e5mr716974e87.2.1754468010202; Wed, 06 Aug 2025
 01:13:30 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-8-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-8-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:13:18 +0100
X-Gm-Features: Ac12FXyEJArEt3rh0-jExSgVr2BIXukjC2OeiNF6sW-Mzt-4gW9xAv4Lqpnfv2E
Message-ID: <CAC_UY8-ewRKpPEuL_R39dyAf_aFW5Lu_P26npgKfO2J79Je2Gw@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 7/9] Use EMULATED v3 to force activate Xenbus FDOs
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="00000000000084b168063badeaa5"

--00000000000084b168063badeaa5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Until this patch is applied, ForceActivate will cause issues - xenfilt and
xenbus's active device could differ and result in 0x7F bugchecks. Can this
get called out in the cover letter

Owen

On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> Use EmulatedIsDevicePresent in FdoSetActive to determine FDO forced-
> activation status and set Fdo->Active + call ConfigSetActive as
> appropriate.
>
> Also use EmulatedIsDevicePresent in xenfilt!DriverIsActivePresent.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  src/xenbus/fdo.c     | 120 +++++++++++++++++++++++++++++++------------
>  src/xenfilt/driver.c |  16 ++++--
>  2 files changed, 99 insertions(+), 37 deletions(-)
>
> diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
> index 432e907..f867511 100644
> --- a/src/xenbus/fdo.c
> +++ b/src/xenbus/fdo.c
> @@ -48,6 +48,7 @@
>  #include "thread.h"
>  #include "high.h"
>  #include "mutex.h"
> +#include "emulated_interface.h"
>  #include "shared_info.h"
>  #include "evtchn.h"
>  #include "debug.h"
> @@ -134,6 +135,8 @@ struct _XENBUS_FDO {
>      PCM_PARTIAL_RESOURCE_LIST       RawResourceList;
>      PCM_PARTIAL_RESOURCE_LIST       TranslatedResourceList;
>
> +    XENFILT_EMULATED_INTERFACE      EmulatedInterface;
> +
>      BOOLEAN                         Active;
>
>      PXENBUS_SUSPEND_CONTEXT         SuspendContext;
> @@ -746,6 +749,8 @@ FdoSetActive(
>      PSTR                InstanceID;
>      PSTR                ActiveDeviceID;
>      PSTR                LocationInformation;
> +    BOOLEAN             Present;
> +    LONG                IsForceActivated;
>      NTSTATUS            status;
>
>      status =3D FdoQueryId(Fdo,
> @@ -766,6 +771,34 @@ FdoSetActive(
>      if (!NT_SUCCESS(status))
>          goto fail3;
>
> +    if (Fdo->EmulatedInterface.Interface.Context =3D=3D NULL)
> +        goto fallback;
> +
> +    status =3D XENFILT_EMULATED(Acquire, &Fdo->EmulatedInterface);
> +    if (!NT_SUCCESS(status))
> +        goto fallback;
> +
> +    Present =3D XENFILT_EMULATED(IsDevicePresent,
> +                               &Fdo->EmulatedInterface,
> +                               DeviceID,
> +                               NULL,
> +                               &IsForceActivated);
> +    BUG_ON(!Present);
> +
> +    XENFILT_EMULATED(Release, &Fdo->EmulatedInterface);
> +
> +    if (IsForceActivated =3D=3D 0)
> +        goto fallback;
> +
> +    Fdo->Active =3D IsForceActivated > 0;
> +    Info("FDO %s force %sactivated\n", DeviceID, Fdo->Active ? "" : "de"=
);
> +
> +    if (Fdo->Active)
> +        (VOID) ConfigSetActive(DeviceID, InstanceID, LocationInformation=
);
> +
> +    goto done;
> +
> +fallback:
>      status =3D ConfigGetActive("DeviceID", &ActiveDeviceID);
>      if (NT_SUCCESS(status)) {
>          Fdo->Active =3D (_stricmp(DeviceID, ActiveDeviceID) =3D=3D 0) ? =
TRUE :
> FALSE;
> @@ -780,6 +813,7 @@ FdoSetActive(
>              Fdo->Active =3D TRUE;
>      }
>
> +done:
>      ExFreePool(LocationInformation);
>      ExFreePool(InstanceID);
>      ExFreePool(DeviceID);
> @@ -5822,10 +5856,19 @@ FdoCreate(
>
>      __FdoSetName(Fdo);
>
> -    status =3D FdoSetActive(Fdo);
> +    status =3D FDO_QUERY_INTERFACE(Fdo,
> +                                 XENFILT,
> +                                 EMULATED,
> +                                 (PINTERFACE)&Fdo->EmulatedInterface,
> +                                 sizeof (Fdo->EmulatedInterface),
> +                                 TRUE);
>      if (!NT_SUCCESS(status))
>          goto fail9;
>
> +    status =3D FdoSetActive(Fdo);
> +    if (!NT_SUCCESS(status))
> +        goto fail10;
> +
>      if (!__FdoIsActive(Fdo))
>          goto done;
>
> @@ -5841,47 +5884,47 @@ FdoCreate(
>
>      status =3D DebugInitialize(Fdo, &Fdo->DebugContext);
>      if (!NT_SUCCESS(status))
> -        goto fail10;
> +        goto fail11;
>
>      status =3D SuspendInitialize(Fdo, &Fdo->SuspendContext);
>      if (!NT_SUCCESS(status))
> -        goto fail11;
> +        goto fail12;
>
>      status =3D SharedInfoInitialize(Fdo, &Fdo->SharedInfoContext);
>      if (!NT_SUCCESS(status))
> -        goto fail12;
> +        goto fail13;
>
>      status =3D EvtchnInitialize(Fdo, &Fdo->EvtchnContext);
>      if (!NT_SUCCESS(status))
> -        goto fail13;
> +        goto fail14;
>
>      status =3D RangeSetInitialize(Fdo, &Fdo->RangeSetContext);
>      if (!NT_SUCCESS(status))
> -        goto fail14;
> +        goto fail15;
>
>      status =3D CacheInitialize(Fdo, &Fdo->CacheContext);
>      if (!NT_SUCCESS(status))
> -        goto fail15;
> +        goto fail16;
>
>      status =3D GnttabInitialize(Fdo, &Fdo->GnttabContext);
>      if (!NT_SUCCESS(status))
> -        goto fail16;
> +        goto fail17;
>
>      status =3D StoreInitialize(Fdo, &Fdo->StoreContext);
>      if (!NT_SUCCESS(status))
> -        goto fail17;
> +        goto fail18;
>
>      status =3D ConsoleInitialize(Fdo, &Fdo->ConsoleContext);
>      if (!NT_SUCCESS(status))
> -        goto fail18;
> +        goto fail19;
>
>      status =3D UnplugInitialize(Fdo, &Fdo->UnplugContext);
>      if (!NT_SUCCESS(status))
> -        goto fail19;
> +        goto fail20;
>
>      status =3D FdoBalloonInitialize(Fdo);
>      if (!NT_SUCCESS(status))
> -        goto fail20;
> +        goto fail21;
>
>      status =3D DebugGetInterface(__FdoGetDebugContext(Fdo),
>                                 XENBUS_DEBUG_INTERFACE_VERSION_MAX,
> @@ -5950,68 +5993,68 @@ done:
>
>      return STATUS_SUCCESS;
>
> -fail20:
> -    Error("fail20\n");
> +fail21:
> +    Error("fail21\n");
>
>      UnplugTeardown(Fdo->UnplugContext);
>      Fdo->UnplugContext =3D NULL;
>
> -fail19:
> -    Error("fail19\n");
> +fail20:
> +    Error("fail20\n");
>
>      ConsoleTeardown(Fdo->ConsoleContext);
>      Fdo->ConsoleContext =3D NULL;
>
> -fail18:
> -    Error("fail18\n");
> +fail19:
> +    Error("fail19\n");
>
>      StoreTeardown(Fdo->StoreContext);
>      Fdo->StoreContext =3D NULL;
>
> -fail17:
> -    Error("fail17\n");
> +fail18:
> +    Error("fail18\n");
>
>      GnttabTeardown(Fdo->GnttabContext);
>      Fdo->GnttabContext =3D NULL;
>
> -fail16:
> -    Error("fail16\n");
> +fail17:
> +    Error("fail17\n");
>
>      CacheTeardown(Fdo->CacheContext);
>      Fdo->CacheContext =3D NULL;
>
> -fail15:
> -    Error("fail15\n");
> +fail16:
> +    Error("fail16\n");
>
>      RangeSetTeardown(Fdo->RangeSetContext);
>      Fdo->RangeSetContext =3D NULL;
>
> -fail14:
> -    Error("fail14\n");
> +fail15:
> +    Error("fail15\n");
>
>      EvtchnTeardown(Fdo->EvtchnContext);
>      Fdo->EvtchnContext =3D NULL;
>
> -fail13:
> -    Error("fail13\n");
> +fail14:
> +    Error("fail14\n");
>
>      SharedInfoTeardown(Fdo->SharedInfoContext);
>      Fdo->SharedInfoContext =3D NULL;
>
> -fail12:
> -    Error("fail12\n");
> +fail13:
> +    Error("fail13\n");
>
>      SuspendTeardown(Fdo->SuspendContext);
>      Fdo->SuspendContext =3D NULL;
>
> -fail11:
> -    Error("fail11\n");
> +fail12:
> +    Error("fail12\n");
>
>      DebugTeardown(Fdo->DebugContext);
>      Fdo->DebugContext =3D NULL;
>
> -fail10:
> -    Error("fail10\n");
> +fail11:
> +    Error("fail11\n");
>
>      Fdo->UseMemoryHole =3D 0;
>
> @@ -6021,6 +6064,12 @@ fail10:
>      //
>      Fdo->Active =3D FALSE;
>
> +fail10:
> +    Error("fail10\n");
> +
> +    RtlZeroMemory(&Fdo->EmulatedInterface,
> +                  sizeof (Fdo->EmulatedInterface));
> +
>  fail9:
>      Error("fail9\n");
>
> @@ -6159,6 +6208,9 @@ FdoDestroy(
>          FdoClearActive(Fdo);
>      }
>
> +    RtlZeroMemory(&Fdo->EmulatedInterface,
> +                  sizeof (Fdo->EmulatedInterface));
> +
>      RtlZeroMemory(Fdo->VendorName, MAXNAMELEN);
>
>      FdoReleaseLowerBusInterface(Fdo);
> diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
> index 8f39b8d..370ee6e 100644
> --- a/src/xenfilt/driver.c
> +++ b/src/xenfilt/driver.c
> @@ -321,13 +321,20 @@ DriverIsActivePresent(
>  {
>      PSTR        ActiveDeviceID;
>      BOOLEAN     Present;
> +    LONG        IsForceActivated;
>      NTSTATUS    status;
>
>      status =3D XENFILT_EMULATED(Acquire, &Driver.EmulatedInterface);
>      if (!NT_SUCCESS(status))
>          goto fail1;
>
> -    Present =3D FALSE;
> +    Present =3D XENFILT_EMULATED(IsDevicePresent,
> +                               &Driver.EmulatedInterface,
> +                               NULL,
> +                               NULL,
> +                               &IsForceActivated);
> +    if (NT_SUCCESS(status) && Present)
> +        goto done;
>
>      status =3D __DriverGetActive("DeviceID",
>                                 &ActiveDeviceID);
> @@ -337,14 +344,17 @@ DriverIsActivePresent(
>      Present =3D XENFILT_EMULATED(IsDevicePresent,
>                                 &Driver.EmulatedInterface,
>                                 ActiveDeviceID,
> -                               NULL);
> +                               NULL,
> +                               &IsForceActivated);
>
>      ExFreePool(ActiveDeviceID);
>
>  done:
>      XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
>
> -    Info("ACTIVE DEVICE %sPRESENT\n", (!Present) ? "NOT " : "");
> +    Info("ACTIVE DEVICE %sPRESENT%s\n",
> +         (!Present) ? "NOT " : "",
> +         IsForceActivated > 0 ? " (FORCED)" : "");
>
>      return Present;
>
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--00000000000084b168063badeaa5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Until this patch is applied, ForceActivate will cause issues - xenfilt a=
nd xenbus&#39;s active device could differ and result in 0x7F bugchecks. Ca=
n this get called out in the cover letter</div><div class=3D"gmail_default"=
 style=3D"font-family:monospace"><br></div><div class=3D"gmail_default" sty=
le=3D"font-family:monospace">Owen</div></div><br><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at 4:35=E2=80=AF=
PM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex">Use EmulatedIsDevicePresent in FdoSetActi=
ve to determine FDO forced-<br>
activation status and set Fdo-&gt;Active + call ConfigSetActive as<br>
appropriate.<br>
<br>
Also use EmulatedIsDevicePresent in xenfilt!DriverIsActivePresent.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0src/xenbus/fdo.c=C2=A0 =C2=A0 =C2=A0| 120 +++++++++++++++++++++++++++=
++++------------<br>
=C2=A0src/xenfilt/driver.c |=C2=A0 16 ++++--<br>
=C2=A02 files changed, 99 insertions(+), 37 deletions(-)<br>
<br>
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c<br>
index 432e907..f867511 100644<br>
--- a/src/xenbus/fdo.c<br>
+++ b/src/xenbus/fdo.c<br>
@@ -48,6 +48,7 @@<br>
=C2=A0#include &quot;thread.h&quot;<br>
=C2=A0#include &quot;high.h&quot;<br>
=C2=A0#include &quot;mutex.h&quot;<br>
+#include &quot;emulated_interface.h&quot;<br>
=C2=A0#include &quot;shared_info.h&quot;<br>
=C2=A0#include &quot;evtchn.h&quot;<br>
=C2=A0#include &quot;debug.h&quot;<br>
@@ -134,6 +135,8 @@ struct _XENBUS_FDO {<br>
=C2=A0 =C2=A0 =C2=A0PCM_PARTIAL_RESOURCE_LIST=C2=A0 =C2=A0 =C2=A0 =C2=A0Raw=
ResourceList;<br>
=C2=A0 =C2=A0 =C2=A0PCM_PARTIAL_RESOURCE_LIST=C2=A0 =C2=A0 =C2=A0 =C2=A0Tra=
nslatedResourceList;<br>
<br>
+=C2=A0 =C2=A0 XENFILT_EMULATED_INTERFACE=C2=A0 =C2=A0 =C2=A0 EmulatedInter=
face;<br>
+<br>
=C2=A0 =C2=A0 =C2=A0BOOLEAN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Active;<br>
<br>
=C2=A0 =C2=A0 =C2=A0PXENBUS_SUSPEND_CONTEXT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0SuspendContext;<br>
@@ -746,6 +749,8 @@ FdoSetActive(<br>
=C2=A0 =C2=A0 =C2=A0PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 InstanceID;<br>
=C2=A0 =C2=A0 =C2=A0PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 ActiveDeviceID;<br>
=C2=A0 =C2=A0 =C2=A0PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 LocationInformation;<br>
+=C2=A0 =C2=A0 BOOLEAN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Prese=
nt;<br>
+=C2=A0 =C2=A0 LONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
IsForceActivated;<br>
=C2=A0 =C2=A0 =C2=A0NTSTATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 statu=
s;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D FdoQueryId(Fdo,<br>
@@ -766,6 +771,34 @@ FdoSetActive(<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail3;<br>
<br>
+=C2=A0 =C2=A0 if (Fdo-&gt;EmulatedInterface.Interface.Context =3D=3D NULL)=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fallback;<br>
+<br>
+=C2=A0 =C2=A0 status =3D XENFILT_EMULATED(Acquire, &amp;Fdo-&gt;EmulatedIn=
terface);<br>
+=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fallback;<br>
+<br>
+=C2=A0 =C2=A0 Present =3D XENFILT_EMULATED(IsDevicePresent,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Fdo-&gt;EmulatedInterface,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DeviceID,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;IsForceActivated);<br>
+=C2=A0 =C2=A0 BUG_ON(!Present);<br>
+<br>
+=C2=A0 =C2=A0 XENFILT_EMULATED(Release, &amp;Fdo-&gt;EmulatedInterface);<b=
r>
+<br>
+=C2=A0 =C2=A0 if (IsForceActivated =3D=3D 0)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fallback;<br>
+<br>
+=C2=A0 =C2=A0 Fdo-&gt;Active =3D IsForceActivated &gt; 0;<br>
+=C2=A0 =C2=A0 Info(&quot;FDO %s force %sactivated\n&quot;, DeviceID, Fdo-&=
gt;Active ? &quot;&quot; : &quot;de&quot;);<br>
+<br>
+=C2=A0 =C2=A0 if (Fdo-&gt;Active)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 (VOID) ConfigSetActive(DeviceID, InstanceID, L=
ocationInformation);<br>
+<br>
+=C2=A0 =C2=A0 goto done;<br>
+<br>
+fallback:<br>
=C2=A0 =C2=A0 =C2=A0status =3D ConfigGetActive(&quot;DeviceID&quot;, &amp;A=
ctiveDeviceID);<br>
=C2=A0 =C2=A0 =C2=A0if (NT_SUCCESS(status)) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fdo-&gt;Active =3D (_stricmp(DeviceID, Ac=
tiveDeviceID) =3D=3D 0) ? TRUE : FALSE;<br>
@@ -780,6 +813,7 @@ FdoSetActive(<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fdo-&gt;Active =3D TRUE;<br=
>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
+done:<br>
=C2=A0 =C2=A0 =C2=A0ExFreePool(LocationInformation);<br>
=C2=A0 =C2=A0 =C2=A0ExFreePool(InstanceID);<br>
=C2=A0 =C2=A0 =C2=A0ExFreePool(DeviceID);<br>
@@ -5822,10 +5856,19 @@ FdoCreate(<br>
<br>
=C2=A0 =C2=A0 =C2=A0__FdoSetName(Fdo);<br>
<br>
-=C2=A0 =C2=A0 status =3D FdoSetActive(Fdo);<br>
+=C2=A0 =C2=A0 status =3D FDO_QUERY_INTERFACE(Fdo,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0XENFILT,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EMULATED,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(PINTERFACE)&amp;Fdo-&gt;Emula=
tedInterface,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sizeof (Fdo-&gt;EmulatedInterf=
ace),<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TRUE);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail9;<br>
<br>
+=C2=A0 =C2=A0 status =3D FdoSetActive(Fdo);<br>
+=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail10;<br>
+<br>
=C2=A0 =C2=A0 =C2=A0if (!__FdoIsActive(Fdo))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto done;<br>
<br>
@@ -5841,47 +5884,47 @@ FdoCreate(<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D DebugInitialize(Fdo, &amp;Fdo-&gt;DebugConte=
xt);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail10;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail11;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D SuspendInitialize(Fdo, &amp;Fdo-&gt;SuspendC=
ontext);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail11;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail12;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D SharedInfoInitialize(Fdo, &amp;Fdo-&gt;Share=
dInfoContext);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail12;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail13;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D EvtchnInitialize(Fdo, &amp;Fdo-&gt;EvtchnCon=
text);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail13;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail14;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D RangeSetInitialize(Fdo, &amp;Fdo-&gt;RangeSe=
tContext);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail14;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail15;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D CacheInitialize(Fdo, &amp;Fdo-&gt;CacheConte=
xt);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail15;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail16;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D GnttabInitialize(Fdo, &amp;Fdo-&gt;GnttabCon=
text);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail16;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail17;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D StoreInitialize(Fdo, &amp;Fdo-&gt;StoreConte=
xt);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail17;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail18;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D ConsoleInitialize(Fdo, &amp;Fdo-&gt;ConsoleC=
ontext);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail18;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail19;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D UnplugInitialize(Fdo, &amp;Fdo-&gt;UnplugCon=
text);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail19;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail20;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D FdoBalloonInitialize(Fdo);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail20;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail21;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D DebugGetInterface(__FdoGetDebugContext(Fdo),=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 XENBUS_DEBUG_INTERFACE_VERSION_MAX,<=
br>
@@ -5950,68 +5993,68 @@ done:<br>
<br>
=C2=A0 =C2=A0 =C2=A0return STATUS_SUCCESS;<br>
<br>
-fail20:<br>
-=C2=A0 =C2=A0 Error(&quot;fail20\n&quot;);<br>
+fail21:<br>
+=C2=A0 =C2=A0 Error(&quot;fail21\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0UnplugTeardown(Fdo-&gt;UnplugContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;UnplugContext =3D NULL;<br>
<br>
-fail19:<br>
-=C2=A0 =C2=A0 Error(&quot;fail19\n&quot;);<br>
+fail20:<br>
+=C2=A0 =C2=A0 Error(&quot;fail20\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0ConsoleTeardown(Fdo-&gt;ConsoleContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;ConsoleContext =3D NULL;<br>
<br>
-fail18:<br>
-=C2=A0 =C2=A0 Error(&quot;fail18\n&quot;);<br>
+fail19:<br>
+=C2=A0 =C2=A0 Error(&quot;fail19\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0StoreTeardown(Fdo-&gt;StoreContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;StoreContext =3D NULL;<br>
<br>
-fail17:<br>
-=C2=A0 =C2=A0 Error(&quot;fail17\n&quot;);<br>
+fail18:<br>
+=C2=A0 =C2=A0 Error(&quot;fail18\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0GnttabTeardown(Fdo-&gt;GnttabContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;GnttabContext =3D NULL;<br>
<br>
-fail16:<br>
-=C2=A0 =C2=A0 Error(&quot;fail16\n&quot;);<br>
+fail17:<br>
+=C2=A0 =C2=A0 Error(&quot;fail17\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0CacheTeardown(Fdo-&gt;CacheContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;CacheContext =3D NULL;<br>
<br>
-fail15:<br>
-=C2=A0 =C2=A0 Error(&quot;fail15\n&quot;);<br>
+fail16:<br>
+=C2=A0 =C2=A0 Error(&quot;fail16\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0RangeSetTeardown(Fdo-&gt;RangeSetContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;RangeSetContext =3D NULL;<br>
<br>
-fail14:<br>
-=C2=A0 =C2=A0 Error(&quot;fail14\n&quot;);<br>
+fail15:<br>
+=C2=A0 =C2=A0 Error(&quot;fail15\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0EvtchnTeardown(Fdo-&gt;EvtchnContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;EvtchnContext =3D NULL;<br>
<br>
-fail13:<br>
-=C2=A0 =C2=A0 Error(&quot;fail13\n&quot;);<br>
+fail14:<br>
+=C2=A0 =C2=A0 Error(&quot;fail14\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0SharedInfoTeardown(Fdo-&gt;SharedInfoContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;SharedInfoContext =3D NULL;<br>
<br>
-fail12:<br>
-=C2=A0 =C2=A0 Error(&quot;fail12\n&quot;);<br>
+fail13:<br>
+=C2=A0 =C2=A0 Error(&quot;fail13\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0SuspendTeardown(Fdo-&gt;SuspendContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;SuspendContext =3D NULL;<br>
<br>
-fail11:<br>
-=C2=A0 =C2=A0 Error(&quot;fail11\n&quot;);<br>
+fail12:<br>
+=C2=A0 =C2=A0 Error(&quot;fail12\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0DebugTeardown(Fdo-&gt;DebugContext);<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;DebugContext =3D NULL;<br>
<br>
-fail10:<br>
-=C2=A0 =C2=A0 Error(&quot;fail10\n&quot;);<br>
+fail11:<br>
+=C2=A0 =C2=A0 Error(&quot;fail11\n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;UseMemoryHole =3D 0;<br>
<br>
@@ -6021,6 +6064,12 @@ fail10:<br>
=C2=A0 =C2=A0 =C2=A0//<br>
=C2=A0 =C2=A0 =C2=A0Fdo-&gt;Active =3D FALSE;<br>
<br>
+fail10:<br>
+=C2=A0 =C2=A0 Error(&quot;fail10\n&quot;);<br>
+<br>
+=C2=A0 =C2=A0 RtlZeroMemory(&amp;Fdo-&gt;EmulatedInterface,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof (Fdo=
-&gt;EmulatedInterface));<br>
+<br>
=C2=A0fail9:<br>
=C2=A0 =C2=A0 =C2=A0Error(&quot;fail9\n&quot;);<br>
<br>
@@ -6159,6 +6208,9 @@ FdoDestroy(<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0FdoClearActive(Fdo);<br>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
+=C2=A0 =C2=A0 RtlZeroMemory(&amp;Fdo-&gt;EmulatedInterface,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof (Fdo=
-&gt;EmulatedInterface));<br>
+<br>
=C2=A0 =C2=A0 =C2=A0RtlZeroMemory(Fdo-&gt;VendorName, MAXNAMELEN);<br>
<br>
=C2=A0 =C2=A0 =C2=A0FdoReleaseLowerBusInterface(Fdo);<br>
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c<br>
index 8f39b8d..370ee6e 100644<br>
--- a/src/xenfilt/driver.c<br>
+++ b/src/xenfilt/driver.c<br>
@@ -321,13 +321,20 @@ DriverIsActivePresent(<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 ActiveDeviceID;<br>
=C2=A0 =C2=A0 =C2=A0BOOLEAN=C2=A0 =C2=A0 =C2=A0Present;<br>
+=C2=A0 =C2=A0 LONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 IsForceActivated;<br>
=C2=A0 =C2=A0 =C2=A0NTSTATUS=C2=A0 =C2=A0 status;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D XENFILT_EMULATED(Acquire, &amp;Driver.Emulat=
edInterface);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail1;<br>
<br>
-=C2=A0 =C2=A0 Present =3D FALSE;<br>
+=C2=A0 =C2=A0 Present =3D XENFILT_EMULATED(IsDevicePresent,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Driver.EmulatedInterface,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;IsForceActivated);<br>
+=C2=A0 =C2=A0 if (NT_SUCCESS(status) &amp;&amp; Present)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
<br>
=C2=A0 =C2=A0 =C2=A0status =3D __DriverGetActive(&quot;DeviceID&quot;,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp;ActiveDeviceID);<br>
@@ -337,14 +344,17 @@ DriverIsActivePresent(<br>
=C2=A0 =C2=A0 =C2=A0Present =3D XENFILT_EMULATED(IsDevicePresent,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp;Driver.EmulatedInterface,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ActiveDeviceID,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;IsForceActivated);<br>
<br>
=C2=A0 =C2=A0 =C2=A0ExFreePool(ActiveDeviceID);<br>
<br>
=C2=A0done:<br>
=C2=A0 =C2=A0 =C2=A0XENFILT_EMULATED(Release, &amp;Driver.EmulatedInterface=
);<br>
<br>
-=C2=A0 =C2=A0 Info(&quot;ACTIVE DEVICE %sPRESENT\n&quot;, (!Present) ? &qu=
ot;NOT &quot; : &quot;&quot;);<br>
+=C2=A0 =C2=A0 Info(&quot;ACTIVE DEVICE %sPRESENT%s\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(!Present) ? &quot;NOT &quot; : &quot;&q=
uot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0IsForceActivated &gt; 0 ? &quot; (FORCED=
)&quot; : &quot;&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0return Present;<br>
<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--00000000000084b168063badeaa5--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:14:26 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071378.1434848 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZI1-0000mq-M2; Wed, 06 Aug 2025 08:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071378.1434848; Wed, 06 Aug 2025 08:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZI1-0000mj-Iq; Wed, 06 Aug 2025 08:14:25 +0000
Received: by outflank-mailman (input) for mailman id 1071378;
 Wed, 06 Aug 2025 08:14:23 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZHz-0000kp-J7
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:14:23 +0000
Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com
 [2a00:1450:4864:20::130])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 5c364f44-729d-11f0-a322-13f23c93f187;
 Wed, 06 Aug 2025 10:14:23 +0200 (CEST)
Received: by mail-lf1-x130.google.com with SMTP id
 2adb3069b0e04-55b8f1a13e9so5110304e87.1
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:14:23 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5c364f44-729d-11f0-a322-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754468062; x=1755072862; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=3qULpZt9MXrJ4xhyg62iRgbP4tb8Zxcga4GY6NWzMPg=;
        b=jxAYF7Hg7jtDsbw95HAmgysRS/8m3lyPh+NBca4lz46U8t+3RFTZsMmw3/eJo/alrJ
         LJ0RT1A4evgjXRVUakIltaxRr3TJgEv+SCbukQMFndFOc5I/KiHCm7jwjoJs5v6RKSDE
         WE1ReZLiygmsG+AhQkB/xM4gaLFKPM2/luEoU=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754468062; x=1755072862;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=3qULpZt9MXrJ4xhyg62iRgbP4tb8Zxcga4GY6NWzMPg=;
        b=l7bJ/zjN3KI1yq4ilaxBAOx6mC94OTenDX2o+pGNDM6FG8TTk7e+tcinRpZRrjcRhk
         YSE8Lp1sFOC+YLUrmrBVsAJY9DJ9f/4e1EJPPLHE2yQ/nJzBZYJYRIJT3C6iPT4/QG9o
         O8lQSyTx4lf6S6km4pksU7C9MjQ/nm5wKGYN+kfKAoXLBr5FScytt0ZMLTgnplMjqmcY
         SF/ycnDK3h974f6914KNBIgYfA7NNJbGJo6KVHweop7C4l9/TzwC85C3BSiBplR7rtWf
         LRRzDtAlSbEy/0cmc5S+XxWkpQs0qx8SQ8z4ghEHp7fmk8saJLTEOoHY28SpbAwvU6GQ
         363w==
X-Gm-Message-State: AOJu0Yxq5mkyvAPgh5AJE+ipsLZMvgCmo7dD0tju1b0MptMge05K02if
	GJgQzP5gZ5WSLU72+3VA9JE+nb2IXxsLR211oMwOWDop63dJpzVu3Suxo+sc62i3mNyFXu87eWX
	8pCoityV2Tp7u7/ck7Xg3Ovt0LXx8zRHzxdQMpeI5LGwvwN4P6Mm84g==
X-Gm-Gg: ASbGnctQfbMe22RlCZ3XG1fSB/fMZiLtpmorRZC5xBPd7GJPz9cj1NJ8gV1MfIs56p+
	0ycwatUYCy3tu+EhqL0VmO3UkGOLivWFm5hquv3P/s1/EYe53X5ZCHs1ygUcac6x+ejsP9evk6Q
	JrwqvsFiJ/3zoVXNNG8pmWCA9sd4bu/eyiFa9KLC/F2NPRq30fMhMZhgpTytTGvMn9UwPw8Bn8o
	VtU+60=
X-Google-Smtp-Source: AGHT+IHO0Yc2nTF7hea2l3lOBO87MeS+31W3jGOeVcj2LVVpF6ETLRKHtFUIrbxd2Ql9Lvd1WTWLiMohaewysAq/b30=
X-Received: by 2002:a05:6512:3d21:b0:55b:95a2:d70f with SMTP id
 2adb3069b0e04-55caf564b32mr690330e87.18.1754468062445; Wed, 06 Aug 2025
 01:14:22 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-9-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804153516.2038-9-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:14:09 +0100
X-Gm-Features: Ac12FXwG4V-GJGoVESyoT_T6GK1w6gab78nl2CiFA4POzWZ9wKDy2dKTJEmUBgE
Message-ID: <CAC_UY89rp=brPFMvUQ_=qAF9FpTTKR9OeSUEVnXc_ZSTNom3vw@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 8/9] Enable Xenbus precedence
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="000000000000a1d960063badedcc"

--000000000000a1d960063badedcc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 4, 2025 at 4:41=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

>
>  HKR,"Parameters","Internal_IDE_Channel",0x00000000,"IDE"
> +HKR,"Parameters","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ;
> @FORCE_ACTIVATE@
> +HKR,"Parameters","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ;
> @FORCE_ACTIVATE@
> +HKR,"Parameters","PCI\VEN_5853&DEV_C000",0x00010001,0x@VENDOR_DEVICE_ID@
> ; @FORCE_ACTIVATE@
>
> replace DEV_C000 with @VENDOR_DEVICE_ID@

--000000000000a1d960063badedcc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 4, 2025 at =
4:41=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex"><br>
=C2=A0HKR,&quot;Parameters&quot;,&quot;Internal_IDE_Channel&quot;,0x0000000=
0,&quot;IDE&quot;<br>
+HKR,&quot;Parameters&quot;,&quot;PCI\VEN_5853&amp;DEV_0001&quot;,0x0001000=
1,0x0001=C2=A0 ; @FORCE_ACTIVATE@<br>
+HKR,&quot;Parameters&quot;,&quot;PCI\VEN_5853&amp;DEV_0002&quot;,0x0001000=
1,0x0002=C2=A0 ; @FORCE_ACTIVATE@<br>
+HKR,&quot;Parameters&quot;,&quot;PCI\VEN_5853&amp;<span class=3D"gmail_def=
ault" style=3D"font-family:monospace"></span>DEV_C000&quot;,0x00010001,0x<s=
pan class=3D"gmail_default" style=3D"font-family:monospace"></span>@VENDOR_=
DEVICE_ID@=C2=A0 ; @FORCE_ACTIVATE@<br><br></blockquote><div class=3D"gmail=
_default" style=3D"font-family:monospace">replace=C2=A0<span style=3D"font-=
family:Arial,Helvetica,sans-serif">DEV_C000 with=C2=A0</span><span style=3D=
"font-family:Arial,Helvetica,sans-serif">@VEND</span><span style=3D"font-fa=
mily:Arial,Helvetica,sans-serif">OR_DEVICE_ID@</span></div></div></div>

--000000000000a1d960063badedcc--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 08:16:11 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 08:16:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071391.1434852 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZJj-0000wB-Rp; Wed, 06 Aug 2025 08:16:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071391.1434852; Wed, 06 Aug 2025 08:16:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujZJj-0000w3-Os; Wed, 06 Aug 2025 08:16:11 +0000
Received: by outflank-mailman (input) for mailman id 1071391;
 Wed, 06 Aug 2025 08:16:09 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujZJh-0000vx-Sb
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 08:16:09 +0000
Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com
 [2a00:1450:4864:20::22a])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 9b6a384d-729d-11f0-a322-13f23c93f187;
 Wed, 06 Aug 2025 10:16:09 +0200 (CEST)
Received: by mail-lj1-x22a.google.com with SMTP id
 38308e7fff4ca-32b5931037eso53459211fa.2
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 01:16:09 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9b6a384d-729d-11f0-a322-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754468169; x=1755072969; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=OE2PF5RKWAJq3Blpuk+hMiSVAti73ezazYKPcz+6jNc=;
        b=fYiMRG4kXn7HI3Nm5IGrZm4z4K3KBEgPv1gQbp8psSB+a6JJX95SxAF9pQ5okECGab
         xWLE9IEFLWEg1kGA/JPNb4VZYoqrcUacgd+vQTcTIitHOPadB9DejJqR+eLZclUrL5KH
         7FfmfFKvbjdPGPacspmXqTgxzPrEfzlLckphk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754468169; x=1755072969;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=OE2PF5RKWAJq3Blpuk+hMiSVAti73ezazYKPcz+6jNc=;
        b=i8dMaxh61q4BGGxb33aOl5WYM7m6qo2IJJTzeq3hxShBA7snGVb/LmkSKqaZvuvDG7
         6pUv2Z7VgSSSDat5QwNtUVbCdIcIbbUPUvvF7pQvugNpFRraBROID8iTGVWUkwA52ar0
         y1iNGZl0la9eohux2sY7D3+TkeO6YbI0LmsXU4qTp/1M0A9xzGOcm508n3Uk7OLZaN/b
         efScCxSdZuhisnBTH4l1bYk8WzSG1G+26puazCCMuVlZGNREQ+pUfk1tmLSJjKSeeZ2S
         QBNuHFRU3H5asMVsOXWccfRR3mKdLN0oLAFnwnJMdMX6jiUykJr09XxBYXwR3S4XM2Sl
         JdNg==
X-Gm-Message-State: AOJu0YwR3RH8MnmBX+v/kSfwKucwZgP5URFmDO82+ZRwuSKuOhPWrFyc
	q1Cb0gLp0n5NoMroxydG712hdlkogA4n6kAuj7ADcMVscCtgDiuNlnOdCuoCL/RaXpQDPYP5zZ8
	b7Id4E6SHndhNIUkLmwC5lJ+mE3zf7aXh+LWfwIV3BKee0kk8+Ck=
X-Gm-Gg: ASbGncuCN8p+UxQXEoact1PZCO2av/pidr3w6vxSpKX11l3sOX0Z/bf+0BWHPz9btjE
	g7PP/FrmC8geSkud6DoTGLwfjkLNTT09F7e78OdEGSZth7iDTke4aVHzgMMi81AZAUx3ygkvywc
	FD3P4KDDJ4btu0KewXEc5Y+U5dkE1YgcMwn31n4Tyj1xPjwvK0qoqoun//D5Dlho/cr1QLv7Ehx
	sMT8yk=
X-Google-Smtp-Source: AGHT+IGwGmxua2wpZa4rI9WiBovuAILqNHrOe39VKM8PyKx645oA7GcCZ8xlCWaasGv2G+CqKprSv/iaho1Vz7FWgbU=
X-Received: by 2002:a2e:bc15:0:b0:32b:a9a4:cd4b with SMTP id
 38308e7fff4ca-3338120cc83mr5344241fa.4.1754468168402; Wed, 06 Aug 2025
 01:16:08 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804185114.932-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250804185114.932-1-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 09:15:57 +0100
X-Gm-Features: Ac12FXyMACzIk9VS3iD0Ha7QQNFIIhl3h3WtnjBFSPlvNIMXbL9Tes6PHqT7NTo
Message-ID: <CAC_UY8_FdPCGyM3RPb6cwwhr3ypTJmbQOK725AjgTY_dD_BPaQ@mail.gmail.com>
Subject: Re: [XENVBD PATCH v3 3/3] Collapse skipped template lines
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000f2a324063badf345"

--000000000000f2a324063badf345
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

While I believe this patch is only required for xenbus (possibly xenvbd) -
I will apply it to all drivers, to maintain consistency

Owen

On Mon, Aug 4, 2025 at 7:51=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> This is needed to correctly generate multiline INF directives.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  scripts/genfiles.ps1 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
> index 8b0b14b..a7d13ae 100644
> --- a/scripts/genfiles.ps1
> +++ b/scripts/genfiles.ps1
> @@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
>                                 Write-Host "Skipping Line Containing "
> $_.Name
>                                 $line =3D $null
>                         }
> -                       $line =3D $line -replace $key, $_.Value
> +                       if ($null -ne $line) {
> +                               $line =3D $line -replace $key, $_.Value
> +                       }
>                 }
>                 $line
>         } |
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000f2a324063badf345
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">While I believe this patch is only required for xenbus (possibly xenvbd)=
 - I will apply it to all drivers, to maintain consistency</div><div class=
=3D"gmail_default" style=3D"font-family:monospace"><br></div><div class=3D"=
gmail_default" style=3D"font-family:monospace">Owen</div></div><br><div cla=
ss=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_at=
tr">On Mon, Aug 4, 2025 at 7:51=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.t=
ech&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">T=
his is needed to correctly generate multiline INF directives.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0scripts/genfiles.ps1 | 4 +++-<br>
=C2=A01 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1<br>
index 8b0b14b..a7d13ae 100644<br>
--- a/scripts/genfiles.ps1<br>
+++ b/scripts/genfiles.ps1<br>
@@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Write-Host &quot;Skipping Line Conta=
ining &quot; $_.Name<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 $line =3D $null<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 }<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0$line =3D $line -replace $key, $_.Value<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0if ($null -ne $line) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0$line =3D $line -replace $key, $_.Val=
ue<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0}<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 $line<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 } |<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--000000000000f2a324063badf345--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 12:27:42 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 12:27:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071731.1435129 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujdF5-0006X4-Qg; Wed, 06 Aug 2025 12:27:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071731.1435129; Wed, 06 Aug 2025 12:27:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujdF5-0006Wx-Nq; Wed, 06 Aug 2025 12:27:39 +0000
Received: by outflank-mailman (input) for mailman id 1071731;
 Wed, 06 Aug 2025 12:27:38 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iN8Y=2S=bounce.vates.tech=bounce-md_30504962.68934a36.v1-aefd39ca8169459282a83076af3e8c7e@srs-se1.protection.inumbo.net>)
 id 1ujdF4-0006Wr-NC
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 12:27:38 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id bb5cb4f7-72c0-11f0-a322-13f23c93f187;
 Wed, 06 Aug 2025 14:27:35 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bxqLZ4WpMzNCd9hV
 for <win-pv-devel@lists.xenproject.org>; Wed,  6 Aug 2025 12:27:34 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 aefd39ca8169459282a83076af3e8c7e; Wed, 06 Aug 2025 12:27:34 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bb5cb4f7-72c0-11f0-a322-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754483254; x=1754753254;
	bh=S/3IYnn8Ji1k7cFWG6Nv3E7KQjucv2+Oa1O+JZFDOMg=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=hbqiquVFaNRTb0udT+85Pxe9MisbqEd0FSgcNgAWeiR3hAkUjZAUV1h9KOjtMmfgB
	 r2pSEh9xGVO50YF9wuzC6xr5lGtT6A7xAXtl6CDx5Zof5w9LmVo8lWDtrsXJ/n4quq
	 m3CNyyIXrvEvShwoFZDL40keqb69HGaIWAS2SuZuj6y8OZvdRFcyNRJ/CuWcaJgDQt
	 JJx50YeTBFdEX9kstLRJi+FWRacYGziPd5eEZuadDcQThfKKf+NkPn1g9DqJew4bWA
	 oZb6Yuqo1K0as4W8lheQMYKylcTqQPjmdYfBTTCztYK5S22yHOYs88wuO+NNFgolau
	 jYQpHkoAt5nqA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754483254; x=1754743754; i=ngoc-tu.dinh@vates.tech;
	bh=S/3IYnn8Ji1k7cFWG6Nv3E7KQjucv2+Oa1O+JZFDOMg=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=fNiObwsChv0D/knt/eRqGib/f5qof8KzMR5g2FVq4K0lYwlO6rjggKwhbHdNHr9Ej
	 1ahCQGeRhzF3p9VA+DIXdqg89tAdKhSHQqDIfrgKEi1SlhsfVa8+lNDv2Q6FNXsAfJ
	 rZBLgxFdKFTBtVjgeRXaTH7a9t5qTdRGz/6gbHz6gILXUinmyEFHqCUsAZu9agDAmu
	 w4Zw2orahTby2m+QOgJ81i5nhgGT4aY4Jbv7NHhGXvSVDMHAT+7vVI9qSZFzUSUyoY
	 O/QdpY+N01TURXCFLza1S6a4aI8TgL5Wc5djHV75zhL/9BogA9Oc872rtsrMTHi/qx
	 9h6EGvP3GBNjA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=20v3=202/9]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754483253396
Message-Id: <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org, "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com> <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com>
In-Reply-To: <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.aefd39ca8169459282a83076af3e8c7e?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250806:md
Date: Wed, 06 Aug 2025 12:27:34 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 06/08/2025 10:01, Owen Smith wrote:
> The XenVbd changes seem fine, but there is a problem if older xenvbd is 
> loaded on this xenbus, where the devices do not cope with a change in 
> the device_id or presence of the vendor device. To work around this, I 
> had to set xenbus's PDOs DeviceID to exclude the PCI vendor ID (e.g. 
> "XENBUS\VEN_XP&DEV_VBD")

Could you elaborate on the problem? Old xenvbd wouldn't have forced 
unplug so I figured they wouldn't be affected. Maybe it has something to 
do with the Active registry value, in which case something like this 
would help?

 From 90357f56f2dd99b489bfe04f67dbf219de896894 Mon Sep 17 00:00:00 2001
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
Date: Sun, 3 Aug 2025 07:11:35 +0200
Subject: [PATCH] Early-set active device during Xenfilt PdoCreate

There is a (theoretical) edge case where combining new Xenfilt and old
Xenbus (e.g. due to different driver versions between platform and
vendor devices) causes Xenbus to fall back to the in-registry Active
setting.

If this active value does not match that of the force-activated old
Xenbus, it will deactivate itself during its own check in FdoSetActive.
This will lead to an INACCESSIBLE_BOOT_DEVICE BSOD.

Fix this by setting the active value directly during the Xenfilt PDO
enumeration phase.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
  src/xenfilt/pdo.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 946c1c5..6c30f06 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -1753,6 +1753,11 @@ PdoCreate(
      if (!NT_SUCCESS(status))
          goto fail5;

+    if (ForceActivate > 0)
+        (VOID) ConfigSetActive(__PdoGetDeviceID(Pdo),
+                               __PdoGetInstanceID(Pdo),
+                               __PdoGetLocationInformation(Pdo));
+
      if (CompatibleIDs)
          ExFreePool(CompatibleIDs);

-- 
2.50.1.windows.1

> 
> Owen
> 
> 
> On Wed, Aug 6, 2025 at 8:56=E2=80=AFAM Owen Smith <owen.smith@cloud.com 
> <mailto:owen.smith@cloud.com>> wrote:
> 
> 
> 
>     On Mon, Aug 4, 2025 at 4:35=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.te=
ch> wrote:
> 
>          =C2=A0[Inst.NT@INF_ARCH@]
>         -; DisplayName=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Section=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0DeviceID
>         -; -----------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -------=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0--------
>         -
>         -%XenBusName_VEND%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst, 
>          =C2=A0PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_=
ID@5853&REV_01
>         -%XenBusName_0002%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=
=A0PCI\VEN_5853&DEV_0002
>         -%XenBusName_0001%=C2=A0 =C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=
=A0PCI\VEN_5853&DEV_0001
>         +%XenBusName%=3DXenBus_Inst,\
> 
> 
>     Comma should be on the vendor device ID line, so if VENDOR_DEVICE_ID
>     is not defined, then the INF section is still valid, although it
>     'promotes' 0002 to HWID from CompatID

 From MS documentation, the INF Models section allows for a blank HWID. 
So I did that to make sure that the platform IDs remain as compatible 
IDs in the INF, since I'd prefer to avoid having identifier scores 
change depending on the build configuration.

> 
>         +PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@585=
3&REV_01\
>         +,PCI\VEN_5853&DEV_0002\
>         +,PCI\VEN_5853&DEV_0001
> 
>          =C2=A0[XenBus_Inst]
>          =C2=A0CopyFiles=3DXenBus_CopyFiles
>          =C2=A0CopyFiles=3DMonitor_CopyFiles
>         +FeatureScore=3D0xFE
> 
> 
>     The main potential issue here is determining if Microsoft / Windows
>     Update will allow an update distribution to the vendor device ID
>     without distributing for the compatible IDs, so drivers will only
>     install via Windows Update on the vendor device, not on others - if
>     this is not possible, then an alternate method is needed. I've so
>     far not been able to confirm this either way, but it would appear
>     that driver distributions are enabled for a specific HWID.

I hope that the driver distributions are bound to INF model HWID and not 
compatible IDs. But I can't test that myself ATM.

> 
>     Owen
> 



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 13:29:15 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 13:29:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071777.1435147 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujeCf-00069R-9r; Wed, 06 Aug 2025 13:29:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071777.1435147; Wed, 06 Aug 2025 13:29:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujeCf-00069K-6x; Wed, 06 Aug 2025 13:29:13 +0000
Received: by outflank-mailman (input) for mailman id 1071777;
 Wed, 06 Aug 2025 13:29:11 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujeCd-00069E-Kr
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 13:29:11 +0000
Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com
 [2a00:1450:4864:20::22a])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 552d05de-72c9-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 15:29:09 +0200 (CEST)
Received: by mail-lj1-x22a.google.com with SMTP id
 38308e7fff4ca-32cd0dfbdb8so51888161fa.0
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 06:29:09 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 552d05de-72c9-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754486949; x=1755091749; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=EvC/+YG5DYczfjGYMd6xfxWH2reSgnnH4nRS5iJw+zI=;
        b=Kt1LYx62g2LQGhoachEb4Es9gcV+t7Sn0Kksg1OqzvKJXNvn1NNmhNjkTfsXBwrzmY
         uFkfbNnXXKLpMeY7yD1Lxqrlb2X5j8oB3MWvyAdowWJQz/3ZOvI0/6eEXV9d5opx4rDT
         0J2tvDFPfww/iDhU9dQ85m+VmVmz8gj/BRx3M=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754486949; x=1755091749;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=EvC/+YG5DYczfjGYMd6xfxWH2reSgnnH4nRS5iJw+zI=;
        b=SnndDfqYBrM7o4W5k86uOlCumlMIcq16K5cXHJGfwbMuiXzwDmzKM/ZLxRFMP1ceOi
         goRuAgmEpaWt791XXmM/5FSx607zewragHscrcNQbp3ULmbij+lPVtz+iZhKGBBOR+hc
         GEZoB/C8q95C0BGaDqPFJi9C1buJ2n1ilrXjizOJwCCGh/4hhAsvmGI5dYtiqXvUD50W
         5aVhllFFHOuaJgjavqaDxExeIOFpz2s1SIGGZmsfw1xP6zhq14C++Bsd4jDPT9L+Ddha
         2c2B6Nc2VwL4vOf4nVOJib4MTwgvzc72+40a5tBcL1dv5YFrCD+qhC7bha3yatVjVy2O
         aBFg==
X-Gm-Message-State: AOJu0Yz11LXq8JNouxY3ROxbp/W1xhZhCbso43CGzheItOwbdSe5qABU
	VBWBlJja+T1E4kTJIm+mDtbbCTU4TTbQJQHlGcdA2xtHGx4lpk7PPVa5C/dtJRxvEl1rdY41yg6
	x9byqOATtrkngAHDFlx/bg4oluFPYwOg+4JGVnYXHLI+xeHDphRA=
X-Gm-Gg: ASbGncvrjN6CHgl+kONjATW8Cj72xiRZZAntWZO9dnO8OyKbL98Z1jVfBInLGlMvCuK
	A85DdIA4WSVRR/ZIsp7KSqGIafLP4QLsAb+CwZZQd8aOoxo0Cs2ywDZWL31fUsiXDQd1Mh3SrUc
	Hf+fmb//1Dgx5PO0N7JNwRZ/pnLWBj4047m7MqXEXRnLm73a7y+vKzEDTy3uoaxMpHkpuAwKf5s
	Wmzcqo=
X-Google-Smtp-Source: AGHT+IH2GWOyf4QnH0aSdS+whIDyH4KSIzhk704Q45pnBQulxf8yP4XsZ9QDCcnmh2ojUdxsvv6n14FXsEXLMFS2s4c=
X-Received: by 2002:a2e:b888:0:b0:32c:ab57:126b with SMTP id
 38308e7fff4ca-333812c5168mr8920791fa.16.1754486948426; Wed, 06 Aug 2025
 06:29:08 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
 <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com>
 <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com> <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech>
In-Reply-To: <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 14:28:56 +0100
X-Gm-Features: Ac12FXyniyYWZ0Pl6Gm9Eul1znoI4H6DhIujhBEK1x2u36cG-DCfxytFrul48mE
Message-ID: <CAC_UY8-gL_C-UYigzfdBiA2E8QWf6MNWm1hY58Tspo94NqY2xg@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 2/9] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="0000000000005310b0063bb25362"

--0000000000005310b0063bb25362
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 6, 2025 at 1:27=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> On 06/08/2025 10:01, Owen Smith wrote:
> > The XenVbd changes seem fine, but there is a problem if older xenvbd is
> > loaded on this xenbus, where the devices do not cope with a change in
> > the device_id or presence of the vendor device. To work around this, I
> > had to set xenbus's PDOs DeviceID to exclude the PCI vendor ID (e.g.
> > "XENBUS\VEN_XP&DEV_VBD")
>
> Could you elaborate on the problem? Old xenvbd wouldn't have forced
> unplug so I figured they wouldn't be affected. Maybe it has something to
> do with the Active registry value, in which case something like this
> would help?
>
>
Using old xenvbd, no force unplug value was set, but the standard unplug
key was set. When the VM was shut down, device_id changed, and restarted,
the unplug still occurred, but the xenvbd driver was not installed on
the new xenbus device_id and could not be installed from the driver store
during boot.
Using this scheme in xenvif would also be advantageous, as it would mean
xennet devices are not reinstalled when reparenting xenbus. If xennet doesn=
t
reinstall, then Windows does not create a new network connection, which
defaults to DHCP, improving user experience when a static IP or similar
settings have been applied.



> >
> >     Comma should be on the vendor device ID line, so if VENDOR_DEVICE_I=
D
> >     is not defined, then the INF section is still valid, although it
> >     'promotes' 0002 to HWID from CompatID
>
>  From MS documentation, the INF Models section allows for a blank HWID.
> So I did that to make sure that the platform IDs remain as compatible
> IDs in the INF, since I'd prefer to avoid having identifier scores
> change depending on the build configuration.
>
>
That makes sense.

Owen

--0000000000005310b0063bb25362
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_defa=
ult" style=3D"font-family:monospace"><br></div></div><br><div class=3D"gmai=
l_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 6, 2025 at 1:27=
=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex">On 06/08/2025 10:01, Owen Smith =
wrote:<br>
&gt; The XenVbd changes seem fine, but there is a problem if older xenvbd i=
s <br>
&gt; loaded on this xenbus, where the devices do not cope with a change in =
<br>
&gt; the device_id or presence of the vendor device. To work around this, I=
 <br>
&gt; had to set xenbus&#39;s PDOs DeviceID to exclude the PCI vendor ID (e.=
g. <br>
&gt; &quot;XENBUS\VEN_XP&amp;DEV_VBD&quot;)<br>
<br>
Could you elaborate on the problem? Old xenvbd wouldn&#39;t have forced <br=
>
unplug so I figured they wouldn&#39;t be affected. Maybe it has something t=
o <br>
do with the Active registry value, in which case something like this <br>
would help?<br>
<br></blockquote><div><br></div><div><div class=3D"gmail_default" style=3D"=
font-family:monospace">Using old xenvbd, no force unplug value was set, but=
 the standard unplug</div><div class=3D"gmail_default" style=3D"font-family=
:monospace">key was set. When the VM was shut down, device_id changed, and =
restarted,</div><div class=3D"gmail_default" style=3D"font-family:monospace=
">the unplug still occurred, but the xenvbd driver was not installed on</di=
v><div class=3D"gmail_default" style=3D"font-family:monospace">the new xenb=
us device_id and could not be installed from the driver store</div><div cla=
ss=3D"gmail_default" style=3D"font-family:monospace">during boot.</div><div=
 class=3D"gmail_default" style=3D"font-family:monospace">Using this scheme=
=C2=A0in xenvif would also be advantageous, as it would mean</div><div clas=
s=3D"gmail_default" style=3D"font-family:monospace">xennet devices are not =
reinstalled when reparenting xenbus. If xennet doesnt</div><div class=3D"gm=
ail_default" style=3D"font-family:monospace">reinstall, then Windows does n=
ot create a new network connection, which</div><div class=3D"gmail_default"=
 style=3D"font-family:monospace">defaults to DHCP, improving user experienc=
e when a static IP or similar</div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace">settings have been applied.</div><br></div><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Comma should be on the vendor device ID line, so if=
 VENDOR_DEVICE_ID<br>
&gt;=C2=A0 =C2=A0 =C2=A0is not defined, then the INF section is still valid=
, although it<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;promotes&#39; 0002 to HWID from CompatID<br>
<br>
=C2=A0From MS documentation, the INF Models section allows for a blank HWID=
. <br>
So I did that to make sure that the platform IDs remain as compatible <br>
IDs in the INF, since I&#39;d prefer to avoid having identifier scores <br>
change depending on the build configuration.<br>
<br></blockquote><div><br></div><div class=3D"gmail_default" style=3D"font-=
family:monospace">That makes sense.</div><div class=3D"gmail_default" style=
=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=3D"=
font-family:monospace">Owen</div></div></div>
</div>

--0000000000005310b0063bb25362--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 14:24:10 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 14:24:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071848.1435205 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujf3p-00083i-Ax; Wed, 06 Aug 2025 14:24:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071848.1435205; Wed, 06 Aug 2025 14:24:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujf3p-00083b-8L; Wed, 06 Aug 2025 14:24:09 +0000
Received: by outflank-mailman (input) for mailman id 1071848;
 Wed, 06 Aug 2025 14:24:07 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=fWXc=2S=bounce.vates.tech=bounce-md_30504962.68936584.v1-e41aa877962644b69f89fd7e7136d803@srs-se1.protection.inumbo.net>)
 id 1ujf3n-00083V-QS
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 14:24:07 +0000
Received: from mail333.us4.mandrillapp.com (mail333.us4.mandrillapp.com
 [205.201.137.77]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 01c2151d-72d1-11f0-a322-13f23c93f187;
 Wed, 06 Aug 2025 16:24:05 +0200 (CEST)
Received: from pmta17.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail333.us4.mandrillapp.com (Mailchimp) with ESMTP id 4bxsx04yXWzNCd9hX
 for <win-pv-devel@lists.xenproject.org>; Wed,  6 Aug 2025 14:24:04 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 e41aa877962644b69f89fd7e7136d803; Wed, 06 Aug 2025 14:24:04 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 01c2151d-72d1-11f0-a322-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754490244; x=1754760244;
	bh=xzwI9etti03nwIhLmNReIuAofcChl6Dcu5v9MewfrCg=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=TGF3PojZEnuIuxfw8VwdozED+w41ig4rA/Sbfg4YmtQ9G/skZ0XEhR5fhxIq4n8wN
	 WydIqBkYOgoZH8g6OP5h0xh7HnXS851E9y5I4azuYuONh4V74DMcr2MFV7GfXCCfI5
	 lfUPU7V9mA6qjg6Q8pvNm4CQfFkswH7QsTyD0QiiFGhJvyVWFEI/cXAj39bDO83lEs
	 vMum2NUPsqIvnpPOCMbQRbc39Rwk5zKOCvTIWMBVx+arnPUGRJpIZ466pwOZ6Mz6+v
	 p9aEr1OhdPmhdLymuuB4LwWPVhzKFk45UnbDVqpaQx9sTxhVMuQyAiyInPWZhalfcO
	 Mm2MSmwTRIhTg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754490244; x=1754750744; i=ngoc-tu.dinh@vates.tech;
	bh=xzwI9etti03nwIhLmNReIuAofcChl6Dcu5v9MewfrCg=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=sd6utOxebww9/nQVhxBVt4Vbrrrzyo+yqbtXRbw4givAWXWoEW6NLQmu6daQJez/f
	 CGDJDJRazMBZi5Yjpgaow6eYfgibZ1WOxYyS+z8PeC6COHIbnO9s2/vEgGvxnpEBTb
	 Okvv6k8xWV5K2miS4bBdoFXTubJv9rhl+YlT4KDWZELiBmTYT3Loc4XiaOi6d35DxD
	 rfr7TCLDo0+NiT9cLkAJoFmVQ/XUR8R7R5XI9g4CCRWvt+sXRHWcxarnb3vY7iRjdT
	 UJjOe4zMa8MkSk4a/NQABXo7tINWGkq1Op8dhOoILmglFPfpJfTaWvCQNVgCAeP7JJ
	 PGbEw0KKfDiWA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=20v3=202/9]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754490243733
Message-Id: <b95a628f-e132-4eec-a3c4-6ee0b459a970@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org, "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com> <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com> <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech> <CAC_UY8-gL_C-UYigzfdBiA2E8QWf6MNWm1hY58Tspo94NqY2xg@mail.gmail.com>
In-Reply-To: <CAC_UY8-gL_C-UYigzfdBiA2E8QWf6MNWm1hY58Tspo94NqY2xg@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.e41aa877962644b69f89fd7e7136d803?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250806:md
Date: Wed, 06 Aug 2025 14:24:04 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 06/08/2025 15:29, Owen Smith wrote:
> 
> 
> On Wed, Aug 6, 2025 at 1:27=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:
> 
>     On 06/08/2025 10:01, Owen Smith wrote:
>      > The XenVbd changes seem fine, but there is a problem if older
>     xenvbd is
>      > loaded on this xenbus, where the devices do not cope with a
>     change in
>      > the device_id or presence of the vendor device. To work around
>     this, I
>      > had to set xenbus's PDOs DeviceID to exclude the PCI vendor ID (e.=
g.
>      > "XENBUS\VEN_XP&DEV_VBD")
> 
>     Could you elaborate on the problem? Old xenvbd wouldn't have forced
>     unplug so I figured they wouldn't be affected. Maybe it has
>     something to
>     do with the Active registry value, in which case something like this
>     would help?
> 
> 
> Using old xenvbd, no force unplug value was set, but the standard unplug
> key was set. When the VM was shut down, device_id changed, and restarted,
> the unplug still occurred, but the xenvbd driver was not installed on
> the new xenbus device_id and could not be installed from the driver store
> during boot.
> Using this scheme=C2=A0in xenvif would also be advantageous, as it would =
mean
> xennet devices are not reinstalled when reparenting xenbus. If xennet doe=
snt
> reinstall, then Windows does not create a new network connection, which
> defaults to DHCP, improving user experience when a static IP or similar
> settings have been applied.

So it sounds like it's rather forced activation that ended up breaking 
old xenvbd. I can integrate the DeviceID change, but I don't see how it 
would fix old xenvbd as they'll be stuck with the old binding list of 
XENBUS\VEN_XXyyyy&DEV_VBD anyway, and any xenvbd released afterwards 
(forced unplug or not) may as well use the single-line INF binding. 
Perhaps forced-activation xenbus could cut off PDO revisions below 
0900000C via #ifdef, then any xenvbd which can't cope with the change 
simply won't be loaded?

> 
>      >
>      >=C2=A0 =C2=A0 =C2=A0Comma should be on the vendor device ID line, s=
o if
>     VENDOR_DEVICE_ID
>      >=C2=A0 =C2=A0 =C2=A0is not defined, then the INF section is still v=
alid, although it
>      >=C2=A0 =C2=A0 =C2=A0'promotes' 0002 to HWID from CompatID
> 
>      =C2=A0From MS documentation, the INF Models section allows for a bla=
nk
>     HWID.
>     So I did that to make sure that the platform IDs remain as compatible
>     IDs in the INF, since I'd prefer to avoid having identifier scores
>     change depending on the build configuration.
> 
> 
> That makes sense.
> 
> Owen



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Wed Aug 06 15:11:36 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Aug 2025 15:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1071922.1435268 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujfni-00011a-4a; Wed, 06 Aug 2025 15:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1071922.1435268; Wed, 06 Aug 2025 15:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ujfni-00011T-25; Wed, 06 Aug 2025 15:11:34 +0000
Received: by outflank-mailman (input) for mailman id 1071922;
 Wed, 06 Aug 2025 15:11:33 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aP4K=2S=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ujfnh-00011N-Dy
 for win-pv-devel@lists.xenproject.org; Wed, 06 Aug 2025 15:11:33 +0000
Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com
 [2a00:1450:4864:20::131])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id a1f10c13-72d7-11f0-b898-0df219b8e170;
 Wed, 06 Aug 2025 17:11:31 +0200 (CEST)
Received: by mail-lf1-x131.google.com with SMTP id
 2adb3069b0e04-5561ab55c4dso7410921e87.2
 for <win-pv-devel@lists.xenproject.org>; Wed, 06 Aug 2025 08:11:31 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a1f10c13-72d7-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754493090; x=1755097890; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=S3xOmdzK+F3Jrr1bgdHwof7O3XSySw89PM2FkT3HpWc=;
        b=Erwspk47g5OeyVUASjZO+6tkxyo6G+T83b7ij9LzaoQTGcgmQk5oE2l67G8a7X+98U
         tLvGhmELjzlU1/umO87tmFRqf40j7HqxilPzK80cJSLmUvG853bJvXaaEEpwPchT/i9B
         jjUTeaYsxgJd2jqBj2sDBThkQJNFq7dAU6riI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754493090; x=1755097890;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=S3xOmdzK+F3Jrr1bgdHwof7O3XSySw89PM2FkT3HpWc=;
        b=PKs61fVeLcg7dlj4KldAnjn9zkYz8htJQZitQYugVNib/xHeh1dCptQibgd8spnnt/
         1bK88PJ/zf0UVWTvQo0Dul6yXHf2OgA6Y0RWFNEpLUmP1FB6hm9E1sPXn9wW3o0UwqEn
         dam94uD2xlsz9VHLS0hFzuNJf50AesWWrE4yeIdaoQigEw4KuiDwX9pUcElqWKxW/7Hy
         /6+J5NI//i+VIZdapN9FpuxW+Kyp0LuAmz4X7+z3UFmvR44Se20CETZIfH6Beg/V9L0w
         WyrP23ir9WmzRa1MIeKQfrJ8LfsCyps+Ps8honfzLG0kO2esJxym8my6d9F1vX/pa+2Q
         JcLA==
X-Gm-Message-State: AOJu0YyDyQKEsVwP3U/UX1CRegNI9kx4rVRl1NK0K4k/FJqv9pchk3Bb
	Br5yxNFbEJoLhdmRvTpInSdXRUCFGs7EKgOD8jQu2n/09hL+k1cyNPFABki187RoMO598Rouiii
	Vq+72rE+e9xz1bCrEFwLir4/BjRm1nXOxA5JVUI92
X-Gm-Gg: ASbGncsVx+OC5qOsI0TZBgRInoFBlZnWHGbPLD6tISXFys7n8xZM8UxAd8VH9GcjJ4U
	a38RXVfLaQHG+6wAhyOyldDEbZ0qfmtAihN//X0Lzn4FlvsGrrA/JnONmIY8BUTW6ts4cjJaMeM
	kv2P0jywqp+gnnbjyfYSxNmlxtZnyEsO1kUlmDNB+FOvBx3p1c/+QeFZoLNWO7w3yj8utCAUgWR
	szFM+4=
X-Google-Smtp-Source: AGHT+IEreePTOv2hWlBifrgvt38M/iMLbahGeptY4BLot+uiBdxdtCrxhc5fkfr/kr9wmAX2XKBSDR4wAy1iiaJbBNQ=
X-Received: by 2002:a05:6512:4018:b0:55b:9192:319b with SMTP id
 2adb3069b0e04-55caf37b113mr1029837e87.53.1754493090214; Wed, 06 Aug 2025
 08:11:30 -0700 (PDT)
MIME-Version: 1.0
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech>
 <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com>
 <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com>
 <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech> <CAC_UY8-gL_C-UYigzfdBiA2E8QWf6MNWm1hY58Tspo94NqY2xg@mail.gmail.com>
 <b95a628f-e132-4eec-a3c4-6ee0b459a970@vates.tech>
In-Reply-To: <b95a628f-e132-4eec-a3c4-6ee0b459a970@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 6 Aug 2025 16:11:18 +0100
X-Gm-Features: Ac12FXyBgxT0KeE66AXIGwzvYftIoa350bd2WESOhRsQmkx_KkqwU9Jl9H9K_II
Message-ID: <CAC_UY8_As=t73nwdcsLREXKprSMq41TusxoJhn_wOJuSX0ei=w@mail.gmail.com>
Subject: Re: [XENBUS PATCH v3 2/9] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org, 
	=?UTF-8?Q?Marek_Marczykowski=2DG=C3=B3recki?= <marmarek@invisiblethingslab.com>
Content-Type: multipart/alternative; boundary="000000000000674b80063bb3c1a9"

--000000000000674b80063bb3c1a9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

This was forced activation, as I used unchanged xenvbd builds (I missed the
patch you'd submitted for this test).
With a vendor device and xen platform device present, the order in which
these are installed mattered. Installing xenbus on the xen platform device
(0002) first means the PDOs are enumerated from the xen platform device,
and xenvbd will bind to the 0002 DeviceID variants. The 0002 device will be
active until the reboot, where force activation takes over and makes the
Vendor Device active, enumerating new child nodes that have not got xenvbd
installed. Force unplug was not an issue (as I forgot to set the values),
but the standard unplug mechanism triggered an unplug, but xenvbd did not
load in time to avoid a 0x7B.

With the DeviceID change, both 0002 xenbus and VendorID xenbus enumerate
the same child nodes, so xenvbd is correctly installed at boot time.

I think the xenbus PDO DeviceID change is needed to allow older drivers to
load, and the single line INF binding in xenvbd.inf can simplify this going
forwards.

Owen


On Wed, Aug 6, 2025 at 3:24=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> On 06/08/2025 15:29, Owen Smith wrote:
> >
> >
> > On Wed, Aug 6, 2025 at 1:27=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech=
> wrote:
> >
> >     On 06/08/2025 10:01, Owen Smith wrote:
> >      > The XenVbd changes seem fine, but there is a problem if older
> >     xenvbd is
> >      > loaded on this xenbus, where the devices do not cope with a
> >     change in
> >      > the device_id or presence of the vendor device. To work around
> >     this, I
> >      > had to set xenbus's PDOs DeviceID to exclude the PCI vendor ID
> (e.g.
> >      > "XENBUS\VEN_XP&DEV_VBD")
> >
> >     Could you elaborate on the problem? Old xenvbd wouldn't have forced
> >     unplug so I figured they wouldn't be affected. Maybe it has
> >     something to
> >     do with the Active registry value, in which case something like thi=
s
> >     would help?
> >
> >
> > Using old xenvbd, no force unplug value was set, but the standard unplu=
g
> > key was set. When the VM was shut down, device_id changed, and restarte=
d,
> > the unplug still occurred, but the xenvbd driver was not installed on
> > the new xenbus device_id and could not be installed from the driver sto=
re
> > during boot.
> > Using this scheme in xenvif would also be advantageous, as it would mea=
n
> > xennet devices are not reinstalled when reparenting xenbus. If xennet
> doesnt
> > reinstall, then Windows does not create a new network connection, which
> > defaults to DHCP, improving user experience when a static IP or similar
> > settings have been applied.
>
> So it sounds like it's rather forced activation that ended up breaking
> old xenvbd. I can integrate the DeviceID change, but I don't see how it
> would fix old xenvbd as they'll be stuck with the old binding list of
> XENBUS\VEN_XXyyyy&DEV_VBD anyway, and any xenvbd released afterwards
> (forced unplug or not) may as well use the single-line INF binding.
> Perhaps forced-activation xenbus could cut off PDO revisions below
> 0900000C via #ifdef, then any xenvbd which can't cope with the change
> simply won't be loaded?
>
> >
> >      >
> >      >     Comma should be on the vendor device ID line, so if
> >     VENDOR_DEVICE_ID
> >      >     is not defined, then the INF section is still valid, althoug=
h
> it
> >      >     'promotes' 0002 to HWID from CompatID
> >
> >       From MS documentation, the INF Models section allows for a blank
> >     HWID.
> >     So I did that to make sure that the platform IDs remain as compatib=
le
> >     IDs in the INF, since I'd prefer to avoid having identifier scores
> >     change depending on the build configuration.
> >
> >
> > That makes sense.
> >
> > Owen
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--000000000000674b80063bb3c1a9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">This was forced activation, as I used unchanged xenvbd builds (I missed =
the patch you&#39;d submitted for this test).</div><div class=3D"gmail_defa=
ult" style=3D"font-family:monospace">With a vendor device and xen platform =
device present, the order in which these are installed mattered. Installing=
 xenbus on the xen platform device (0002) first means the PDOs are enumerat=
ed from the xen platform device, and xenvbd will bind to the 0002 DeviceID =
variants. The 0002 device will be active until the reboot, where force acti=
vation takes over and makes the Vendor Device active, enumerating new child=
 nodes that have not got xenvbd installed. Force unplug was not an issue (a=
s I forgot to set the values), but the standard unplug mechanism triggered =
an unplug, but xenvbd did not load in time to avoid a 0x7B.</div><div class=
=3D"gmail_default" style=3D"font-family:monospace"><br></div><div class=3D"=
gmail_default" style=3D"font-family:monospace">With the DeviceID change, bo=
th 0002 xenbus and VendorID xenbus enumerate the same child nodes, so xenvb=
d is correctly installed at boot time.</div><div class=3D"gmail_default" st=
yle=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">I think the xenbus PDO DeviceID change is needed=
 to allow older drivers to load, and the single line INF binding in xenvbd.=
inf can simplify this going forwards.</div><div class=3D"gmail_default" sty=
le=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">Owen</div><div class=3D"gmail_default" style=3D"=
font-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_=
quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 6, 2025 =
at 3:24=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">On 06/08/2025 15:29, Owen=
 Smith wrote:<br>
&gt; <br>
&gt; <br>
&gt; On Wed, Aug 6, 2025 at 1:27=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.=
tech&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 06/08/2025 10:01, Owen Smith wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; The XenVbd changes seem fine, but there is a =
problem if older<br>
&gt;=C2=A0 =C2=A0 =C2=A0xenvbd is<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; loaded on this xenbus, where the devices do n=
ot cope with a<br>
&gt;=C2=A0 =C2=A0 =C2=A0change in<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; the device_id or presence of the vendor devic=
e. To work around<br>
&gt;=C2=A0 =C2=A0 =C2=A0this, I<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; had to set xenbus&#39;s PDOs DeviceID to excl=
ude the PCI vendor ID (e.g.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; &quot;XENBUS\VEN_XP&amp;DEV_VBD&quot;)<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Could you elaborate on the problem? Old xenvbd woul=
dn&#39;t have forced<br>
&gt;=C2=A0 =C2=A0 =C2=A0unplug so I figured they wouldn&#39;t be affected. =
Maybe it has<br>
&gt;=C2=A0 =C2=A0 =C2=A0something to<br>
&gt;=C2=A0 =C2=A0 =C2=A0do with the Active registry value, in which case so=
mething like this<br>
&gt;=C2=A0 =C2=A0 =C2=A0would help?<br>
&gt; <br>
&gt; <br>
&gt; Using old xenvbd, no force unplug value was set, but the standard unpl=
ug<br>
&gt; key was set. When the VM was shut down, device_id changed, and restart=
ed,<br>
&gt; the unplug still occurred, but the xenvbd driver was not installed on<=
br>
&gt; the new xenbus device_id and could not be installed from the driver st=
ore<br>
&gt; during boot.<br>
&gt; Using this scheme=C2=A0in xenvif would also be advantageous, as it wou=
ld mean<br>
&gt; xennet devices are not reinstalled when reparenting xenbus. If xennet =
doesnt<br>
&gt; reinstall, then Windows does not create a new network connection, whic=
h<br>
&gt; defaults to DHCP, improving user experience when a static IP or simila=
r<br>
&gt; settings have been applied.<br>
<br>
So it sounds like it&#39;s rather forced activation that ended up breaking =
<br>
old xenvbd. I can integrate the DeviceID change, but I don&#39;t see how it=
 <br>
would fix old xenvbd as they&#39;ll be stuck with the old binding list of <=
br>
XENBUS\VEN_XXyyyy&amp;DEV_VBD anyway, and any xenvbd released afterwards <b=
r>
(forced unplug or not) may as well use the single-line INF binding. <br>
Perhaps forced-activation xenbus could cut off PDO revisions below <br>
0900000C via #ifdef, then any xenvbd which can&#39;t cope with the change <=
br>
simply won&#39;t be loaded?<br>
<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0Comma should be on the ven=
dor device ID line, so if<br>
&gt;=C2=A0 =C2=A0 =C2=A0VENDOR_DEVICE_ID<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0is not defined, then the I=
NF section is still valid, although it<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0&#39;promotes&#39; 0002 to=
 HWID from CompatID<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0From MS documentation, the INF Models sectio=
n allows for a blank<br>
&gt;=C2=A0 =C2=A0 =C2=A0HWID.<br>
&gt;=C2=A0 =C2=A0 =C2=A0So I did that to make sure that the platform IDs re=
main as compatible<br>
&gt;=C2=A0 =C2=A0 =C2=A0IDs in the INF, since I&#39;d prefer to avoid havin=
g identifier scores<br>
&gt;=C2=A0 =C2=A0 =C2=A0change depending on the build configuration.<br>
&gt; <br>
&gt; <br>
&gt; That makes sense.<br>
&gt; <br>
&gt; Owen<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
<br>
</blockquote></div>

--000000000000674b80063bb3c1a9--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 07 14:54:16 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Aug 2025 14:54:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1073180.1436099 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uk20U-0001xy-FT; Thu, 07 Aug 2025 14:54:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1073180.1436099; Thu, 07 Aug 2025 14:54:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uk20U-0001xr-Ci; Thu, 07 Aug 2025 14:54:14 +0000
Received: by outflank-mailman (input) for mailman id 1073180;
 Thu, 07 Aug 2025 14:54:13 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=byWE=2T=bounce.vates.tech=bounce-md_30504962.6894be0d.v1-00e1a88da2774fb39d4e2a08dd6292c0@srs-se1.protection.inumbo.net>)
 id 1uk20T-0001xl-Iw
 for win-pv-devel@lists.xenproject.org; Thu, 07 Aug 2025 14:54:13 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 5db02eff-739e-11f0-b898-0df219b8e170;
 Thu, 07 Aug 2025 16:54:07 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4byVY91hylzS62H1t
 for <win-pv-devel@lists.xenproject.org>; Thu,  7 Aug 2025 14:54:05 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 00e1a88da2774fb39d4e2a08dd6292c0; Thu, 07 Aug 2025 14:54:05 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5db02eff-739e-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754578445; x=1754848445;
	bh=PkSib5R4eavBwcjmVubmaDw2tCjYZGddT2tA4UChK+0=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=qTWneoIphHyeqXOn1kE2QvD3U+Gw2OlfBTo9bxv5QOhHx4O/ZBaXkNWuWkQsf4s85
	 6p/4ucbLiNX/yGksHUDPU9OVXGdWi1cQPkNKlldW2gXKeaT9XIrJTyDPqLPboMo45F
	 A1BZnbY+ThxzhOeDRx6lIGgW6JGZofv2jSZJsgQaWijpXJo2zJeUXM9AsB3LSXRvOw
	 QUMN8TXDCDV/Q0UFiFckAGjofETCw4ekvJmAFZ4YNhiF+ZrY+fYpRJdXpMBJMYvI2c
	 e4Nb9dF/yhNc9umm2AnRNxdcl34fBQveP791TMvRqPzF0Lcaz5V2XeRLCyKzeUS/wX
	 UEKUiMTOD31tg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754578445; x=1754838945; i=ngoc-tu.dinh@vates.tech;
	bh=PkSib5R4eavBwcjmVubmaDw2tCjYZGddT2tA4UChK+0=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=CnacgHUNFNSAyEvpIPpoNHp9Z24EhL1YuDNFLaqGEi33b2ErAvgvH3gqiRDdiOgve
	 Ypt0Dz35pAqE/0ZZXgD4qV1yMlHt3rHxcZPrVzNHc2UCEqyh+ZJEPSluOQ1bvpWHGj
	 QNGvMBeODm5KWZ9nEGgWfQnnraE0HV6NaHv8OPwQFiVgisdgerxPNFfPVhJqwYPUO/
	 okL1uV5jtnqvzi3pj0SNrrkQzGhD4vQqvZyncWhDBSHGJmaBHz41Zax2ql7JBYfH+Y
	 yL9m+Si3ZaLCy9GSz7cQ9//sP4iOaZitAkKb4yFw+/l7IgseMtURVA4CfS5/+SboIj
	 cF3gARjyXBNCA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=20v3=202/9]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754578441394
Message-Id: <1ef99e0d-4597-4e7f-8473-dd554d09d806@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org, "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" <marmarek@invisiblethingslab.com>
References: <20250804153516.2038-1-ngoc-tu.dinh@vates.tech> <20250804153516.2038-3-ngoc-tu.dinh@vates.tech> <CAC_UY89q1ZASgvbuFZsQes3sKLb7rPNxZe46FOq8GB8w-CVJyA@mail.gmail.com> <CAC_UY8_ouB=Uu04jf2fmTOH+kuefX33Nn+6j3Q41x+brH+p=0Q@mail.gmail.com> <ed8c437f-39a8-4b46-b20c-202c59d71c4b@vates.tech> <CAC_UY8-gL_C-UYigzfdBiA2E8QWf6MNWm1hY58Tspo94NqY2xg@mail.gmail.com> <b95a628f-e132-4eec-a3c4-6ee0b459a970@vates.tech> <CAC_UY8_As=t73nwdcsLREXKprSMq41TusxoJhn_wOJuSX0ei=w@mail.gmail.com>
In-Reply-To: <CAC_UY8_As=t73nwdcsLREXKprSMq41TusxoJhn_wOJuSX0ei=w@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.00e1a88da2774fb39d4e2a08dd6292c0?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250807:md
Date: Thu, 07 Aug 2025 14:54:05 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 06/08/2025 17:11, Owen Smith wrote:
> This was forced activation, as I used unchanged xenvbd builds (I missed 
> the patch you'd submitted for this test).
> With a vendor device and xen platform device present, the order in which 
> these are installed mattered. Installing xenbus on the xen platform 
> device (0002) first means the PDOs are enumerated from the xen platform 
> device, and xenvbd will bind to the 0002 DeviceID variants. The 0002 
> device will be active until the reboot, where force activation takes 
> over and makes the Vendor Device active, enumerating new child nodes 
> that have not got xenvbd installed. Force unplug was not an issue (as I 
> forgot to set the values), but the standard unplug mechanism triggered 
> an unplug, but xenvbd did not load in time to avoid a 0x7B.
> 
> With the DeviceID change, both 0002 xenbus and VendorID xenbus enumerate 
> the same child nodes, so xenvbd is correctly installed at boot time.
> 
> I think the xenbus PDO DeviceID change is needed to allow older drivers 
> to load, and the single line INF binding in xenvbd.inf can simplify this 
> going forwards.
> 
> Owen

Thanks, I've tested the DeviceID fix, which works well. I'll add it to v4.

> 
> 
> On Wed, Aug 6, 2025 at 3:24=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:
> 
>     On 06/08/2025 15:29, Owen Smith wrote:
>      >
>      >
>      > On Wed, Aug 6, 2025 at 1:27=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates=
.tech>
>     wrote:
>      >
>      >=C2=A0 =C2=A0 =C2=A0On 06/08/2025 10:01, Owen Smith wrote:
>      >=C2=A0 =C2=A0 =C2=A0 > The XenVbd changes seem fine, but there is a=
 problem if older
>      >=C2=A0 =C2=A0 =C2=A0xenvbd is
>      >=C2=A0 =C2=A0 =C2=A0 > loaded on this xenbus, where the devices do =
not cope with a
>      >=C2=A0 =C2=A0 =C2=A0change in
>      >=C2=A0 =C2=A0 =C2=A0 > the device_id or presence of the vendor devi=
ce. To work around
>      >=C2=A0 =C2=A0 =C2=A0this, I
>      >=C2=A0 =C2=A0 =C2=A0 > had to set xenbus's PDOs DeviceID to exclude=
 the PCI
>     vendor ID (e.g.
>      >=C2=A0 =C2=A0 =C2=A0 > "XENBUS\VEN_XP&DEV_VBD")
>      >
>      >=C2=A0 =C2=A0 =C2=A0Could you elaborate on the problem? Old xenvbd =
wouldn't have
>     forced
>      >=C2=A0 =C2=A0 =C2=A0unplug so I figured they wouldn't be affected. =
Maybe it has
>      >=C2=A0 =C2=A0 =C2=A0something to
>      >=C2=A0 =C2=A0 =C2=A0do with the Active registry value, in which cas=
e something
>     like this
>      >=C2=A0 =C2=A0 =C2=A0would help?
>      >
>      >
>      > Using old xenvbd, no force unplug value was set, but the standard
>     unplug
>      > key was set. When the VM was shut down, device_id changed, and
>     restarted,
>      > the unplug still occurred, but the xenvbd driver was not installed=
 on
>      > the new xenbus device_id and could not be installed from the
>     driver store
>      > during boot.
>      > Using this scheme=C2=A0in xenvif would also be advantageous, as it
>     would mean
>      > xennet devices are not reinstalled when reparenting xenbus. If
>     xennet doesnt
>      > reinstall, then Windows does not create a new network connection,
>     which
>      > defaults to DHCP, improving user experience when a static IP or
>     similar
>      > settings have been applied.
> 
>     So it sounds like it's rather forced activation that ended up breakin=
g
>     old xenvbd. I can integrate the DeviceID change, but I don't see how =
it
>     would fix old xenvbd as they'll be stuck with the old binding list of
>     XENBUS\VEN_XXyyyy&DEV_VBD anyway, and any xenvbd released afterwards
>     (forced unplug or not) may as well use the single-line INF binding.
>     Perhaps forced-activation xenbus could cut off PDO revisions below
>     0900000C via #ifdef, then any xenvbd which can't cope with the change
>     simply won't be loaded?
> 
>      >
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0Comma should be on the ve=
ndor device ID line, so if
>      >=C2=A0 =C2=A0 =C2=A0VENDOR_DEVICE_ID
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0is not defined, then the =
INF section is still valid,
>     although it
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 =C2=A0'promotes' 0002 to HWID f=
rom CompatID
>      >
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0From MS documentation, the INF Models se=
ction allows for a
>     blank
>      >=C2=A0 =C2=A0 =C2=A0HWID.
>      >=C2=A0 =C2=A0 =C2=A0So I did that to make sure that the platform ID=
s remain as
>     compatible
>      >=C2=A0 =C2=A0 =C2=A0IDs in the INF, since I'd prefer to avoid havin=
g identifier
>     scores
>      >=C2=A0 =C2=A0 =C2=A0change depending on the build configuration.
>      >
>      >
>      > That makes sense.
>      >
>      > Owen
> 
> 
> 
>     Ngoc Tu Dinh | Vates XCP-ng Developer
> 
>     XCP-ng & Xen Orchestra - Vates solutions
> 
>     web: https://vates.tech <https://vates.tech>
> 
> 



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:28 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074395.1437023 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgt-0005vP-01; Fri, 08 Aug 2025 14:03:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074395.1437023; Fri, 08 Aug 2025 14:03:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgs-0005vB-Ol; Fri, 08 Aug 2025 14:03:26 +0000
Received: by outflank-mailman (input) for mailman id 1074395;
 Fri, 08 Aug 2025 14:03:25 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rtTB=2U=bounce.vates.tech=bounce-md_30504962.689603a9.v1-ec32e769b03240589b57bb850194817b@srs-se1.protection.inumbo.net>)
 id 1ukNgr-0005ul-8B
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:25 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 7156e357-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:22 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5N93Q8LzS62H1g
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:21 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 ec32e769b03240589b57bb850194817b; Fri, 08 Aug 2025 14:03:21 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7156e357-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661801; x=1754931801;
	bh=l30qDCLHDDfrbo0tMgJwuV2Z8FlhffPhglM2kxFbGnc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=q122fVGTwRMz3X9LTcKMJuj/Rwcn7Kip/u+qehedq6CIuAUzvJs01Y9sAxpZjwJTF
	 f9NHwLBZMA/V8JhUdhNxvhH4l99TvANPsla76j18dPvbzzVbgZIo9uzDpe6a3PoieZ
	 fg2m2l8OAdIAexWJBs4V9pcfLr/wqKSTj4gUMMSG0u7S3yJLAtDdoOB9+Ng2Gt46S6
	 epzDYzTD1kCQ2ivj0LM9MphxlK6Ga+nUzJGhvdb090RbReSEZUPfx18ztmoPBkiE3Q
	 MPQCC75xs7S5GzVNkt0dK6B/HlIaM4qXP91tPj/knyZw1PS7evaWK4Z/9K0pLkdYI+
	 Z0M5MgF8scnTg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661801; x=1754922301; i=ngoc-tu.dinh@vates.tech;
	bh=l30qDCLHDDfrbo0tMgJwuV2Z8FlhffPhglM2kxFbGnc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=JsCpG+TY64rmwQA7zUAgKkcvxNa+noXuXCB7dcKHTUutrzH6XuXqI6lzAQU+b598Z
	 pAMpq0Lj4mbPz4snUTfsnFLXmjH9LQFB9JNh0oW5lMHb00vulKaVY8bPOA4M79y3Nd
	 ErwD0XF8VQ54YFAfemjIecEGJCNtORQWyxQ1YS5w9+T0TLizscQPJgEr9UUeWXLXeb
	 n2GTkQSS5AgEec52Lcxmf3kxJvlu7jks2eTRqGF2JfyK1OUGlgPTn4fhTjXZouga7U
	 QJulgvdgQk4pePI2/O0X+mUTZ6SAqp+i6YQnimsdlgjPjpcdFAYlOV8aLPz9mjr3J0
	 bqK7HtZw8CICw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2002/11]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661800554
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.ec32e769b03240589b57bb850194817b?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:21 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index 7cc9ac2..bbd22a0 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dl
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenBusName_VEND%	=XenBus_Inst,	PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
-%XenBusName_0002%	=XenBus_Inst,	PCI\VEN_5853&DEV_0002
-%XenBusName_0001%	=XenBus_Inst,	PCI\VEN_5853&DEV_0001
+%XenBusName%=XenBus_Inst,\
+PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01\
+,PCI\VEN_5853&DEV_0002\
+,PCI\VEN_5853&DEV_0001
 
 [XenBus_Inst] 
 CopyFiles=XenBus_CopyFiles
 CopyFiles=Monitor_CopyFiles
+FeatureScore=0xFE
 
 [XenBus_Inst.Services]
 AddService=xenbus_monitor,%SPSVCSINST_STARTSERVICE%,Monitor_Service,Monitor_EventLog
@@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@" 
 DiskDesc="@PRODUCT_NAME@ PV Bus Package" 
 XenBusName="@PRODUCT_NAME@ PV Bus"
-XenBusName_VEND="@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)"
-XenBusName_0002="@PRODUCT_NAME@ PV Bus (0002)"
-XenBusName_0001="@PRODUCT_NAME@ PV Bus (0001)"
 XenFiltName="@PRODUCT_NAME@ Generic Bus Filter"
 MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:28 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074397.1437030 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgt-0005zl-Uk; Fri, 08 Aug 2025 14:03:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074397.1437030; Fri, 08 Aug 2025 14:03:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgt-0005ze-RV; Fri, 08 Aug 2025 14:03:27 +0000
Received: by outflank-mailman (input) for mailman id 1074397;
 Fri, 08 Aug 2025 14:03:27 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=JAXw=2U=bounce.vates.tech=bounce-md_30504962.689603a9.v1-2e212448f7a8422da30a44699b387595@srs-se1.protection.inumbo.net>)
 id 1ukNgs-0005ul-T9
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:26 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 71e722f0-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:23 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5N94lbvz1XLVCP
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:21 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 2e212448f7a8422da30a44699b387595; Fri, 08 Aug 2025 14:03:21 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 71e722f0-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661801; x=1754931801;
	bh=//tVa+UVEKgLwta7EEX0SSnDY1OYu1qGMAqDq4EXEdU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=l1Qwlt/iDvxJHPZbQ8iVTs/hhtmzlTmTZp4zWEhlR13kb7wzOb0mXOMyrB35gtyZY
	 ktzapVdNj2lEVBF8NuV1BlZ1I+41BAnM4QzKJJEFXFoGcNSJCQQy1j/6hYR+T96qoi
	 q2uUl/5JVxzaFNSch8uuZISjg7QP+kg4seNnb3kODH694QzUIeGYi91oUHSy8241IJ
	 CecOIWb2tupL4KbR0uQZav2a7OP1gfFsDed3ezk4dYPoBbKbPG1mRN+03oNgdAXbWa
	 pLFcjITP5Agq3CILEPAfMivUSF0zSlGrtQoDo7rd3rMz/vqFrmnty2GkLeU1H1y/aB
	 Won3PUkxqv9sw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661801; x=1754922301; i=ngoc-tu.dinh@vates.tech;
	bh=//tVa+UVEKgLwta7EEX0SSnDY1OYu1qGMAqDq4EXEdU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=ew/FSVODMm3Xq7N57DTVbU/msKg31Bdl7t0yOHYDgsQoeBEAPetUbjCKB71v4viUd
	 /KTlOIe8sudJSH/vPyr1Z1zPyB0GJ6zJsg3HVKKM3PZcxMZio19jaYZTROiM8/xlcf
	 BJ136wAMwsH5NObyE7MSg9G+LdYl1Dib3yAFflWntQb+DtYi4zNjoeuSMEtA3wrzcY
	 MH7P2/lumyVLkdweYFbPVD+IiHJg5aidqq58fnBjhISip/Zgg8jsPAKR5CPLI2lhnm
	 rEdxX5QhaoBHTZbPYaZD/znoNX7G33XUv3HOHwNahFR6CNbXH3QgUtzVOK06R+SHzv
	 tgB+cp2I6AFaA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2003/11]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661800925
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.2e212448f7a8422da30a44699b387595?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:21 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenbus/pdo.c b/src/xenbus/pdo.c
index ec2fb5e..d23af50 100644
--- a/src/xenbus/pdo.c
+++ b/src/xenbus/pdo.c
@@ -1420,8 +1420,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENBUS\\VEN_%hs&DEV_%hs",
-                                    __PdoGetVendorName(Pdo),
+                                    L"XENBUS\\VEN_" VENDOR_PREFIX_STR "&DEV_%hs",
                                     __PdoGetName(Pdo));
         ASSERT(NT_SUCCESS(status));
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:28 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074398.1437035 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgu-00060N-3H; Fri, 08 Aug 2025 14:03:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074398.1437035; Fri, 08 Aug 2025 14:03:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgt-0005zp-Sr; Fri, 08 Aug 2025 14:03:27 +0000
Received: by outflank-mailman (input) for mailman id 1074398;
 Fri, 08 Aug 2025 14:03:27 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CEQe=2U=bounce.vates.tech=bounce-md_30504962.689603aa.v1-c984fbd5a1a9491ca752b5025e4e9d47@srs-se1.protection.inumbo.net>)
 id 1ukNgt-0005um-30
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:27 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 739d8cc1-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:26 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5NB5WsXzS62KcP
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c984fbd5a1a9491ca752b5025e4e9d47; Fri, 08 Aug 2025 14:03:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 739d8cc1-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661802; x=1754931802;
	bh=ITUwon2amJ2pB6phztHDUfOVNIk3CTn/Gc0IUndkVkA=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=cauc5nVK+prpNp9VHFSUtxwq/1RMe89i9uGfLeaZsOYUgiGnlgLIVZdAZ7eI7isU8
	 K6AsnD8d+mYgzepA7DylA59ZyDK5sWDN076WlbEgW01fA6a4lJDKjAaCIiXrHt6z/Y
	 RMwxysyVTI4kqt5++JJ7xtW41ogns1HoBgsg6AbJ+dzzgK1myYC08pNX5O5X2+FmAj
	 IWp7piuqH1fdiBPvF02qjlJxiDShDlwRvFee1JeWeiS0oxZerVSseEMnv6wmSF2Qz0
	 hV8TyDyu3YVm8KXWrGPvwwVdPrdFVEAcZts/+iPCMtJmHLeI+yttOjji5JAPQk1Xrs
	 jZC/vqdzV70gg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661802; x=1754922302; i=ngoc-tu.dinh@vates.tech;
	bh=ITUwon2amJ2pB6phztHDUfOVNIk3CTn/Gc0IUndkVkA=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=D8FekDXvywtbZ6p+yJWVpevhpBAcEA3BxxB1QXU4XHSgcllxOzNlFyPyZibhK0/Lr
	 9UruxQBkSpoD3lJrBX0HEfWJzjPR5MUFfg6T9eqB/lVC+/ewsVOAbf3tCgWpDzO1ZW
	 JruvoI/P0SrOz9/qQDarV3WZKZudKjKUiTsDcon7P7gilYirD3CEOysniGdQKoxR2A
	 EChDnxSq1GOS0zGJHQkgDp/+k7en2tSV1kLLPPPEHCBo3LPLyZ9/tz0NQT84m9BKlZ
	 p/jUzHfUVywsHxLCa4EOP40lbAdu1WUqAy9ulJjMQVotAvHr0CSRUZMSDGD6dECyhr
	 6W9UDvxH3c+kQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2008/11]=20Add=20EMULATED=20v3?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661802060
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-9-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c984fbd5a1a9491ca752b5025e4e9d47?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow querying the current active device's forced-activation status by
calling EmulatedIsDevicePresent with DeviceID=NULL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h |  51 +++++++++++++---
 include/revision.h           |   3 +-
 src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++++++-------
 src/xenfilt/emulated.h       |   1 +
 src/xenfilt/fdo.c            |   6 +-
 src/xenfilt/pdo.c            |   1 +
 6 files changed, 142 insertions(+), 35 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index 86a9e06..7d47707 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -72,7 +72,7 @@ typedef VOID
     _In_ PINTERFACE Interface
     );
 
-/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT_V1
     \brief Determine whether a given device is present in the VM
 
     \param Interface The interface header
@@ -83,12 +83,33 @@ typedef VOID
     FALSE if it is not
 */
 typedef BOOLEAN
-(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT_V1)(
     _In_ PVOID      Context,
     _In_ PSTR       DeviceID,
     _In_opt_ PSTR   InstanceID
     );
 
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+    \brief Determine whether a given device is present in the VM
+
+    \param Interface The interface header
+    \param DeviceID The DeviceID of the device, or NULL to query the force-
+           activated device
+    \param InstanceID The (un-prefixed) InstanceID of the device or
+           NULL to match any device instance
+    \param IsForceActivated If the device was force-activated, force-deactivated
+           or otherwise.
+    \return TRUE if the specified device is present in the system or
+            FALSE if it is not
+*/
+typedef BOOLEAN
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+    _In_ PVOID                                      Context,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
+    );
+
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DISK_PRESENT_V1)(
     _In_ PVOID  Context,
@@ -120,11 +141,11 @@ DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V1 {
-    INTERFACE                           Interface;
-    XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
-    XENFILT_EMULATED_RELEASE            EmulatedRelease;
-    XENFILT_EMULATED_IS_DEVICE_PRESENT  EmulatedIsDevicePresent;
-    XENFILT_EMULATED_IS_DISK_PRESENT_V1 EmulatedIsDiskPresentVersion1;
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT_V1     EmulatedIsDiskPresentVersion1;
 };
 
 /*! \struct _XENFILT_EMULATED_INTERFACE_V2
@@ -132,6 +153,18 @@ struct _XENFILT_EMULATED_INTERFACE_V1 {
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V2 {
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT        EmulatedIsDiskPresent;
+};
+
+/*! \struct _XENFILT_EMULATED_INTERFACE_V3
+    \brief EMULATED interface version 3
+    \ingroup interfaces
+*/
+struct _XENFILT_EMULATED_INTERFACE_V3 {
     INTERFACE                           Interface;
     XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
     XENFILT_EMULATED_RELEASE            EmulatedRelease;
@@ -139,7 +172,7 @@ struct _XENFILT_EMULATED_INTERFACE_V2 {
     XENFILT_EMULATED_IS_DISK_PRESENT    EmulatedIsDiskPresent;
 };
 
-typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
+typedef struct _XENFILT_EMULATED_INTERFACE_V3 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
 
 /*! \def XENFILT_EMULATED
     \brief Macro at assist in method invocation
@@ -150,6 +183,6 @@ typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENF
 #endif  // _WINDLL
 
 #define XENFILT_EMULATED_INTERFACE_VERSION_MIN  1
-#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  2
+#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  3
 
 #endif  // _XENFILT_EMULATED_INTERFACE_H
diff --git a/include/revision.h b/include/revision.h
index e9e62e6..a63e550 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -51,6 +51,7 @@
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2)
+    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2), \
+    DEFINE_REVISION(0x0900000C,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  3)
 
 #endif  // _REVISION_H
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index 9065364..4205cc5 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -45,9 +45,10 @@
 #define MAXNAMELEN  128
 
 typedef struct _XENFILT_EMULATED_DEVICE_DATA {
-    CHAR    DeviceID[MAXNAMELEN];
-    CHAR    InstanceID[MAXNAMELEN];
-    CHAR    CompatibleID[MAXNAMELEN];
+    CHAR                                DeviceID[MAXNAMELEN];
+    CHAR                                InstanceID[MAXNAMELEN];
+    CHAR                                CompatibleID[MAXNAMELEN];
+    XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 } XENFILT_EMULATED_DEVICE_DATA, *PXENFILT_EMULATED_DEVICE_DATA;
 
 typedef struct _XENFILT_EMULATED_DISK_DATA {
@@ -222,16 +223,17 @@ fail1:
 
 NTSTATUS
 EmulatedAddObject(
-    _In_ PXENFILT_EMULATED_CONTEXT      Context,
-    _In_ PSTR                           DeviceID,
-    _In_ PSTR                           InstanceID,
-    _In_opt_ PSTR                       CompatibleIDs,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
-    _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT          Context,
+    _In_ PSTR                               DeviceID,
+    _In_ PSTR                               InstanceID,
+    _In_opt_ PSTR                           CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate,
+    _Outptr_ PXENFILT_EMULATED_OBJECT       *EmulatedObject
     )
 {
-    KIRQL                               Irql;
-    NTSTATUS                            status;
+    KIRQL                                   Irql;
+    NTSTATUS                                status;
 
     Trace("====>\n");
 
@@ -267,6 +269,8 @@ EmulatedAddObject(
         goto fail2;
 
     (*EmulatedObject)->Type = Type;
+    if (Type == XENFILT_EMULATED_OBJECT_TYPE_PCI)
+        (*EmulatedObject)->Data.Device.ForceActivate = ForceActivate;
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
     InsertTailList(&Context->List, &(*EmulatedObject)->ListEntry);
@@ -302,36 +306,66 @@ EmulatedRemoveObject(
     __EmulatedFree(EmulatedObject);
 }
 
+static inline BOOLEAN
+EmulatedDeviceMatchesDeviceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       DeviceID
+    )
+{
+    // EmulatedIsDevicePresent: DeviceID == NULL matches the force-activated device
+    if (DeviceID)
+        return _stricmp(DeviceID, Device->DeviceID) == 0;
+    else
+        return Device->ForceActivate == XENBUS_EMULATED_FORCE_ACTIVATED;
+}
+
+static inline BOOLEAN
+EmulatedDeviceMatchesInstanceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       InstanceID
+    )
+{
+    // EmulatedIsDevicePresent: InstanceID == NULL matches any device instance
+    return InstanceID == NULL || _stricmp(InstanceID, Device->InstanceID) == 0;
+}
+
 static BOOLEAN
 EmulatedIsDevicePresent(
-    _In_ PINTERFACE             Interface,
-    _In_ PSTR                   DeviceID,
-    _In_opt_ PSTR               InstanceID
+    _In_ PINTERFACE                                 Interface,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
     )
 {
-    PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
-    KIRQL                       Irql;
-    PLIST_ENTRY                 ListEntry;
+    PXENFILT_EMULATED_CONTEXT                       Context = Interface->Context;
+    KIRQL                                           Irql;
+    PLIST_ENTRY                                     ListEntry;
 
     Trace("====> (%s %s)\n",
-          DeviceID,
+          (DeviceID != NULL) ? DeviceID : "ACTIVE",
           (InstanceID != NULL) ? InstanceID : "ANY");
 
+    if (IsForceActivated)
+        *IsForceActivated = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
     KeAcquireSpinLock(&Context->Lock, &Irql);
 
     ListEntry = Context->List.Flink;
     while (ListEntry != &Context->List) {
-        PXENFILT_EMULATED_OBJECT    EmulatedObject;
+        PXENFILT_EMULATED_OBJECT        EmulatedObject;
+        PXENFILT_EMULATED_DEVICE_DATA   Device;
 
         EmulatedObject = CONTAINING_RECORD(ListEntry,
                                            XENFILT_EMULATED_OBJECT,
                                            ListEntry);
+        Device = &EmulatedObject->Data.Device;
 
         if (EmulatedObject->Type == XENFILT_EMULATED_OBJECT_TYPE_PCI &&
-            _stricmp(DeviceID, EmulatedObject->Data.Device.DeviceID) == 0 &&
-            (InstanceID == NULL ||
-             _stricmp(InstanceID, EmulatedObject->Data.Device.InstanceID) == 0)) {
+            EmulatedDeviceMatchesDeviceID(Device, DeviceID) &&
+            EmulatedDeviceMatchesInstanceID(Device, InstanceID)) {
             Trace("FOUND\n");
+            if (IsForceActivated)
+                *IsForceActivated = Device->ForceActivate;
             break;
         }
 
@@ -345,6 +379,16 @@ EmulatedIsDevicePresent(
     return (ListEntry != &Context->List) ? TRUE : FALSE;
 }
 
+static BOOLEAN
+EmulatedIsDevicePresentVersion1(
+    _In_ PINTERFACE             Interface,
+    _In_ PSTR                   DeviceID,
+    _In_opt_ PSTR               InstanceID
+    )
+{
+    return EmulatedIsDevicePresent(Interface, DeviceID, InstanceID, NULL);
+}
+
 static BOOLEAN
 EmulatedIsDiskPresent(
     _In_ PINTERFACE             Interface,
@@ -454,7 +498,7 @@ static struct _XENFILT_EMULATED_INTERFACE_V1 EmulatedInterfaceVersion1 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V1), 1, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
-    EmulatedIsDevicePresent,
+    EmulatedIsDevicePresentVersion1,
     EmulatedIsDiskPresentVersion1
 };
 
@@ -462,6 +506,14 @@ static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
+    EmulatedIsDevicePresentVersion1,
+    EmulatedIsDiskPresent
+};
+
+static struct _XENFILT_EMULATED_INTERFACE_V3 EmulatedInterfaceVersion3 = {
+    { sizeof (struct _XENFILT_EMULATED_INTERFACE_V3), 3, NULL, NULL, NULL },
+    EmulatedAcquire,
+    EmulatedRelease,
     EmulatedIsDevicePresent,
     EmulatedIsDiskPresent
 };
@@ -541,6 +593,23 @@ EmulatedGetInterface(
         status = STATUS_SUCCESS;
         break;
     }
+    case 3: {
+        struct _XENFILT_EMULATED_INTERFACE_V3   *EmulatedInterface;
+
+        EmulatedInterface = (struct _XENFILT_EMULATED_INTERFACE_V3 *)Interface;
+
+        status = STATUS_BUFFER_OVERFLOW;
+        if (Size < sizeof (struct _XENFILT_EMULATED_INTERFACE_V3))
+            break;
+
+        *EmulatedInterface = EmulatedInterfaceVersion3;
+
+        ASSERT3U(Interface->Version, ==, Version);
+        Interface->Context = Context;
+
+        status = STATUS_SUCCESS;
+        break;
+    }
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
index 9b02268..c01ff6a 100644
--- a/src/xenfilt/emulated.h
+++ b/src/xenfilt/emulated.h
@@ -72,6 +72,7 @@ EmulatedAddObject(
     _In_ PSTR                           InstanceID,
     _In_opt_ PSTR                       CompatibleIDs,
     _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ LONG                           ForceActivate,
     _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
     );
 
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 87302bb..ad57c95 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -478,13 +478,15 @@ FdoEnumerate(
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate =
-                                                XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 
             if (Precedence > 0)
                 ForceActivate = Index == ActiveIndex ?
                                 XENBUS_EMULATED_FORCE_ACTIVATED :
                                 XENBUS_EMULATED_FORCE_DEACTIVATED;
+            else
+                ForceActivate = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
             (VOID) PdoCreate(Fdo,
                              PhysicalDeviceObject[Index],
                              Fdo->Type,
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 58c9ef0..5327230 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -1701,6 +1701,7 @@ PdoCreate(
                                __PdoGetInstanceID(Pdo),
                                CompatibleIDs,
                                __PdoGetType(Pdo),
+                               ForceActivate,
                                &Pdo->EmulatedObject);
     if (!NT_SUCCESS(status))
         goto fail5;
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:28 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074396.1437026 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgt-0005vk-0m; Fri, 08 Aug 2025 14:03:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074396.1437026; Fri, 08 Aug 2025 14:03:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgs-0005vT-Q7; Fri, 08 Aug 2025 14:03:26 +0000
Received: by outflank-mailman (input) for mailman id 1074396;
 Fri, 08 Aug 2025 14:03:25 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vYcg=2U=bounce.vates.tech=bounce-md_30504962.689603a9.v1-62ca1b2fed9b466ca9ecd85e3731d9ea@srs-se1.protection.inumbo.net>)
 id 1ukNgr-0005ul-T0
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:25 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 71e6ef04-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:23 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5N95Xg7z1XLVCT
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:21 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 62ca1b2fed9b466ca9ecd85e3731d9ea; Fri, 08 Aug 2025 14:03:21 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 71e6ef04-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661801; x=1754931801;
	bh=WcXKhwp/UQZia8jYdWG81n9igqBme8E/hDvwjHE8zvM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=R+ewYswQlMybbmVAL7mBDyIPfntYUJ7AadV1OHp+FrPOwHNHX5uKhQwY/+njWwHCj
	 h9HsdWt/olGyLDlLK3gZIZHes/SncDAXbGXELlh8USZuOB54lTzfqxQ72SIip8VSbA
	 wibLL6rEq98Ef4LFCfLpmxrDsOouQorowBelmW4jxD/jNdOdiNZTXIirhnWFbf+v9K
	 QxWEWsiyAGonO+2vJ/L968ARlKgvCBGfikWO8Lz0PTmLSaL7wP7kP1rN1jjdNWrGLa
	 ojuOE2KXxk3p0gyJhMejqWdBp5ZA5qWFAMJSz5FQxvYpQTsXcBaWRm8UTsNDCng1Rc
	 ZwsF8RgIly7pw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661801; x=1754922301; i=ngoc-tu.dinh@vates.tech;
	bh=WcXKhwp/UQZia8jYdWG81n9igqBme8E/hDvwjHE8zvM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=yRLkqaeRsneXpKAOFT3stMYOaddKnRMvJOndDkX02cznBxzh8XPaPRS+fZhqiG+tc
	 C5on4c4G9uP6a1N2aQwfX+E7nWj/ej1LX2JcAHPpY7/+RP304RzVVtckmTHep9xcvm
	 9UT23EUXMsP8LLh7tUducovc4R/A6R4mE5JMvcK6LIFQFt+WP+2FYLdrsZIHm/k/6l
	 YGcsoDZYo1B8YsMBOxVz5gNZhTbXed8QZWq1VzM+rEOHez0qAbXZzuUjQyBPZjaak/
	 wGxfl0+DGSaGNA+WB1TM6mnBEakF05j5gzTsa9AU5JDIPh0VbG44bsIHmqPo5oOyad
	 AqUZe/v6zy2GQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v4=2001/18]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661800355
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.62ca1b2fed9b466ca9ecd85e3731d9ea?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:21 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
To be applied to all repositories.
---
 scripts/genfiles.ps1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 4c58f03..836f019 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -32,7 +32,9 @@ Function Copy-FileWithReplacements {
 				Write-Host "Skipping Line Containing " $_.Name
 				$line = $null
 			}
-			$line = $line -replace $key, $_.Value
+			if ($null -ne $line) {
+				$line = $line -replace $key, $_.Value
+			}
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:28 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074394.1437019 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgs-0005vC-Ri; Fri, 08 Aug 2025 14:03:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074394.1437019; Fri, 08 Aug 2025 14:03:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgs-0005v2-NV; Fri, 08 Aug 2025 14:03:26 +0000
Received: by outflank-mailman (input) for mailman id 1074394;
 Fri, 08 Aug 2025 14:03:25 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=e8nT=2U=bounce.vates.tech=bounce-md_30504962.689603a8.v1-15f14f37f26040a4957c9aabb8a96cdf@srs-se1.protection.inumbo.net>)
 id 1ukNgr-0005um-AF
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:25 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 713067bb-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:23 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5N85HCnzS62Gs2
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:20 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 15f14f37f26040a4957c9aabb8a96cdf; Fri, 08 Aug 2025 14:03:20 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 713067bb-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661800; x=1754931800;
	bh=DAlOCyh8PvPPg1CLh55l+XF3gb3tB6Vc+TZyuk8rNXA=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=ZcChfxJCV71uCxPLlmPrs1EYM1l6JawV+znj7h3A52DQbfvYsse7t5Gq+ZB7lZe5X
	 mGYxVVj+YQfgQkWFwf4OwvIip1nEg3W0Vm1ngwvJXnuWO0AX/hGnGNegM2pSQrsUs0
	 6xTTgBS+dp4fc/s527omn71HRY+0ZzoiVWi4Mg6Ek1j++sVWLVxXfHT0ItqnumH+EP
	 QiS6g4T7BvEkOzkZLhqmlpVDqrBjVbWrUrCAUQhFjtxEcOSMkk6KJhhhWvv9UAKsbF
	 Na3XsBlv9Zx7bz8u/YzVlCQrZEbyJZ0rTQqNP9A90TTKrJ0LQyf3X9dl26MeqvlpUg
	 jUBNtGFfKoedQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661800; x=1754922300; i=ngoc-tu.dinh@vates.tech;
	bh=DAlOCyh8PvPPg1CLh55l+XF3gb3tB6Vc+TZyuk8rNXA=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=xV1IyLcUE8p17LUejpIr0Fn7Zm2mcgZ5VFRh3PMkHNy04RJ6vlwn/zMesYvcPbnJ+
	 nM8+Oa+0guFibnNK2vPyiH3rs5qHCPXY0d6qW3o+utjRqLVYWygSw+mq+k0dqKZi1V
	 rc6iDczCxFqq1TRt2SiI8PFOriPguQjysa8XLa4S8fHrIWOyYqcHNiqo/+Z0HUBdTQ
	 F6xbUc85lxfxc52PAecgyVhdZbYm4FhL8mAUTLnIaOUkqXMtT/Ojr+EFpwuLsefWh4
	 xEsr1T2OTV3VLR7N+YNTq727HLjoSYwH6AkHzD10UIB3zJGIZ2n+/8l8wDk/81rGWh
	 lDtFXjmC3hKjw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v4=2000/18]=20Implement=20forced=20unplug=20and=20forced=20activation?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661799972
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.15f14f37f26040a4957c9aabb8a96cdf?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:20 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The goal of these two features is to simplify driver servicing and avoid
requiring storing driver state in Registry.

Forced unplug, as name implies, forcefully unplugs emulated devices when
a driver is present, rather than when it's active. It defines a Registry
key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced
unplug by creating an appropriate value (DISKS/NICS) in this key.

Note that since it's no longer possible to guarantee removal of Registry
values during driver uninstallation by Windows, driver uninstallers are
expected to remove these values themselves.

Forced activation is the companion to forced unplug. It aims to make
activation of Xenbus FDOs deterministic and stateless, using a
precedence mapping based on device IDs, prioritizing the vendor device
over the generic ones. This avoids situations where the wrong FDO is
activated, which will prevent Windows Update from working.

Like forced unplug, the precedence mapping of forced activation is also
expected to be removed by driver uninstallers.

With forced activation, Xenfilt is now installed via INF on top of the
current installation routines. This means PV drivers can be injected
offline without needing another reboot to be reconfigured.

Care is taken to keep compatibility with older drivers. The two features
are also conditioned behind new build environment variables FORCE_UNPLUG
and FORCE_ACTIVATE.

Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.
Deprecate PDO revisions 0x09000007 and earlier to make room for the new
revision.
Xenvif 0x09000000 is also removed due to the deprecation of CACHE v1.

With forced unplug/activation, the whole boot chain of boot-critical
drivers must be available in the driver store to avoid
INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware
IDs into one INF Models entry.

Finally, since forced activation can cause the active device to change
without prior notice, such a change will cause old drivers to lose their
bindings due to a change in the device instance path. Drop the vendor
device ID from DeviceID to make sure that device instance paths remain
stable across vendor device changes.

The following scenarios have been successfully tested, requiring only
one reboot each:
* Offline driver installation via DISM
* Fresh install, followed by switching from device 0001 to 0002
* Fresh install, followed by toggling vendor device
* Xenbus/Xenvbd update

Other tested scenarios:
* Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling
  device ID (v4)
* Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2)

Commit notes:
* Patch 1 "Collapse skipped template lines" is for all repos.
* These forced-activation commits are linked and cannot be separated:
  * xenfilt: Add Xenbus device precedence mechanism
  * Add EMULATED v3
  * Use EMULATED v3 to force activate Xenbus FDOs

Changes in v4:
* Restored interfaces deprecated in v3 to allow old drivers to work with
  existing binding, while still removing old PDO revisions
* Converted IsForceActivated LONG value to a proper enum
* Stripped vendor device ID from device ID strings
  * The same was done for Xencons, Xenvif and Xenvkbd
* Fixed mistakenly-left-in DEV_C000 in forced-activation Xenbus.inf
* Moved PdoGetPrecedence to driver.c and merged into DriverGetPrecedence
* Refactored EmulatedIsDevicePresent condition checking
* Removed Xenvif revision 0x09000000 due to the deprecation of CACHE v1

v3: https://lists.xenproject.org/archives/html/win-pv-devel/2025-08/msg00002.html
* Deprecated PDO revisions 0x09000007 and earlier to make room for
  0x0900000C
* Merged all hardware IDs into one INF Models entry to avoid BSODs when
  changing platform device IDs and toggling vendor device
* Added a note mentioning the role of driver uninstallers in cleanup of
  forced unplug/activation drivers.

v2: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.html
* Added forced activation

v1: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.html

Xenbus:

Tu Dinh (11):
  Collapse skipped template lines
  Merge all hardware IDs into one Models entry
  Remove vendor device ID from DeviceID
  Deprecate PDO revisions 0x09000007 and earlier
  xenbus: Use nonpaged pool in FdoQueryId
  Add forced unplug support
  xenfilt: Add Xenbus device precedence mechanism
  Add EMULATED v3
  Use EMULATED v3 to force activate Xenbus FDOs
  Enable Xenbus precedence
  Install Xenfilt with INF AddReg

 include/emulated_interface.h |  61 +++++++++++++---
 include/revision.h           |  11 +--
 scripts/genfiles.ps1         |   6 +-
 src/xen/driver.c             |  79 ++++++++++++++++-----
 src/xen/driver.h             |   5 ++
 src/xen/unplug.c             |  13 +++-
 src/xenbus.inf               |  25 ++++---
 src/xenbus/fdo.c             | 134 ++++++++++++++++++++++++-----------
 src/xenbus/pdo.c             |   3 +-
 src/xenfilt/driver.c         |  81 +++++++++++++++++++--
 src/xenfilt/driver.h         |   7 ++
 src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++------
 src/xenfilt/emulated.h       |   1 +
 src/xenfilt/fdo.c            |  30 +++++++-
 src/xenfilt/pdo.c            |  63 ++++++++--------
 src/xenfilt/pdo.h            |   7 +-
 16 files changed, 491 insertions(+), 150 deletions(-)

Xencons:

Tu Dinh (2):
  Collapse skipped template lines
  Remove vendor device ID from DeviceID

 scripts/genfiles.ps1 | 4 +++-
 src/xencons/pdo.c    | 3 +--
 2 files changed, 4 insertions(+), 3 deletions(-)

Xennet:

Tu Dinh (2):
  Collapse skipped template lines
  Opt into forced unplug

 scripts/genfiles.ps1 | 6 +++++-
 src/xennet.inf       | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

Xenvbd:

Tu Dinh (3):
  Collapse skipped template lines
  Opt into forced unplug
  Merge all hardware IDs into one Models entry

 scripts/genfiles.ps1 |  6 +++++-
 src/xenvbd.inf       | 11 ++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

Xenvif:

Tu Dinh (3):
  Collapse skipped template lines
  Remove vendor device ID from DeviceID
  Deprecate PDO revisions 0x09000000

 include/revision.h   | 1 -
 scripts/genfiles.ps1 | 4 +++-
 src/xenvif/pdo.c     | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

Xenvkbd:

Tu Dinh (2):
  Collapse skipped template lines
  Remove vendor device ID from DeviceID

 scripts/genfiles.ps1 | 4 +++-
 src/xenvkbd/pdo.c    | 3 +--
 2 files changed, 4 insertions(+), 3 deletions(-)

--
2.50.1.windows.1


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074400.1437040 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgv-00064E-4y; Fri, 08 Aug 2025 14:03:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074400.1437040; Fri, 08 Aug 2025 14:03:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgv-000643-0P; Fri, 08 Aug 2025 14:03:29 +0000
Received: by outflank-mailman (input) for mailman id 1074400;
 Fri, 08 Aug 2025 14:03:28 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1q/Q=2U=bounce.vates.tech=bounce-md_30504962.689603aa.v1-ea45561ab1a94bd7b86121274670c829@srs-se1.protection.inumbo.net>)
 id 1ukNgt-0005ul-T9
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:27 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 73550b6d-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:25 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5NB0JQNz1XLW0F
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 ea45561ab1a94bd7b86121274670c829; Fri, 08 Aug 2025 14:03:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 73550b6d-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661802; x=1754931802;
	bh=zUrUGcrJf9Vd/BVYWvvdObiM419KDj6B3XF4EgzB4q0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=qZpjF3CoOiVgw10rOAwLZG9x+2Uoh4OH3wQBK08NTHBHYtzsu0+YNKkbATh/mGo5W
	 uGK1ZeNTE/26Jj9QzRPEaQA41JsE6WX4jm8LRXWZG0y7iZS93OQz+j5birNcrYxpNA
	 qi+rELuBeFw6PInOeqxoQa6dzuYMncQt3wAgIcNjSqr3WxBfe0ntKht0deLhk3Pg3z
	 Bje0HNInBAuOchtiQqdQIKGxeX4G6ZrmcVZvtnWyMBAYobC0Wfnx1jHMmDUSnkGMNM
	 Wqx2YXHnBChD4w8W9cIs/IS5kSQt8SU5nMuYjGnSsKhllkZk1CyKrQ6T5EmT0IAPsT
	 n9Oj+uYD9De8Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661802; x=1754922302; i=ngoc-tu.dinh@vates.tech;
	bh=zUrUGcrJf9Vd/BVYWvvdObiM419KDj6B3XF4EgzB4q0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=XsDO9NTGw/QSdPyS5dAT9ihqExRR2VXk6kcpT+EwkhBI+kzes2379b5Y3feCSvOnq
	 K+gn4MKHIy/usAK48BAeST+hUr+kXbKqUr/6YAblN59Y2IOyVUUDTEyCwtxFHXhgj/
	 wxK0STxRJsI8KVS/Ef34mZKLTx1p7+OvPsGiLG4wHXibB6QLyuO+WEmROST98wp9Ah
	 Z34UdL9SGH3SCCih0mXpiQQrK5xxGxvilO7FEc6v3hr6ViugGHZVI2w17Q2SWS4Zze
	 nj1HFsITA09IxdpujHmkGVzC1MllK6MW+GQFXP41aIMo6zPYkv12fYUYYXCmY50ouj
	 BVGrv9Vxtkrig==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2005/11]=20xenbus:=20Use=20nonpaged=20pool=20in=20FdoQueryId?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661801430
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.ea45561ab1a94bd7b86121274670c829?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow the DeviceID result to eventually be accessed from DISPATCH_LEVEL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 2a61db7..432e907 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -627,7 +627,7 @@ FdoQueryId(
     Buffer = (PWSTR)StatusBlock.Information;
     Length = (ULONG)(wcslen(Buffer) + 1) * sizeof (CHAR);
 
-    *Id = __AllocatePoolWithTag(PagedPool, Length, 'SUB');
+    *Id = __AllocatePoolWithTag(NonPagedPool, Length, 'SUB');
 
     status = STATUS_NO_MEMORY;
     if (*Id == NULL)
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074399.1437039 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgv-000640-4s; Fri, 08 Aug 2025 14:03:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074399.1437039; Fri, 08 Aug 2025 14:03:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgu-00063s-V8; Fri, 08 Aug 2025 14:03:28 +0000
Received: by outflank-mailman (input) for mailman id 1074399;
 Fri, 08 Aug 2025 14:03:28 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=I4M2=2U=bounce.vates.tech=bounce-md_30504962.689603ab.v1-c15b82912b6c4979b5523153d87ccc78@srs-se1.protection.inumbo.net>)
 id 1ukNgt-0005um-Tg
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:27 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 74ae67e2-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:27 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5NC1qzVzS62GqN
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:23 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c15b82912b6c4979b5523153d87ccc78; Fri, 08 Aug 2025 14:03:23 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 74ae67e2-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661803; x=1754931803;
	bh=u1b+0Q3PGjNgBHB4qf8OdQaaMDXaO0RmVtdP0ehbBR4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=pDN9cQ5mWfGSMxuwRRiyM3/NSOKjJA79bdMTgg8P6xKj7A/Sde8OshJ7T8gjrZLWJ
	 Pn3US+JORucN1ApS6Q5AomIDye0Ex1ZlttKKb7aT/YIePkZ0KgTH9xf4MSYDMTi9Cb
	 vsIS2Mdivms53ZbyNGFvXYCj408Kq9e96RpTiRFGeqnFiM9N0SgpD6rF9NSzr5DW6s
	 8JRGmnQYfmW9MPkP5li72TlWOUCnLZVv6jMm7zgmTcAacZGzzpQblfFccXtHkWS3HC
	 M0KgIO4mCuC2gkWmCzz68Z1W7VE2yPUBBIgfyJS0VXr52chHIFYSl7yFKptSwbmROe
	 h9S6vcPglD+Zg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661803; x=1754922303; i=ngoc-tu.dinh@vates.tech;
	bh=u1b+0Q3PGjNgBHB4qf8OdQaaMDXaO0RmVtdP0ehbBR4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=elnWqJxwRu4bnPyoFH8EJgGKa/G5h2nKW3mi9vwmxv2QZNX2o0BdMwNT9Y/IPuk2D
	 +7eB5qncFIfG2vV+ghguwiztquKEcnr3iLraASzR0dFDf6BMzEV1abw1Ilp/KvC8UJ
	 iEUM10Yn2eZ696yx5Yx7rmSFvZ/7MCA4fMfl7JRdGxaJrYdicYDpxF79e/HfM0P29a
	 Hu5oCdTMsYRu7UQsR2QbAL81Q8m/C8xdtZhQ42NRIQo7uzWuOTyb53/biOeoIhVk99
	 1nwp5VYvDpnronxWWPb1U3dWmqXbpg9E2EmwWSjISNl3y6m2oP21+0ZErm7vv7OBxQ
	 QJK/f9550BDGw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2010/11]=20Enable=20Xenbus=20precedence?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661802484
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-11-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c15b82912b6c4979b5523153d87ccc78?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define precedence values based on each device's numeric device ID.

This ensures that vendor devices always get activated instead of the
generic ones.

Condition the precedence on the FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenbus.inf       | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 836f019..79abf1e 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -70,6 +70,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_ACTIVATE' = $Env:FORCE_ACTIVATE;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenbus.inf b/src/xenbus.inf
index bbd22a0..a0b4402 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -119,6 +119,9 @@ AddReg = XenFilt_Parameters
 HKR,"Parameters",,0x00000010
 HKR,"Parameters","*PNP0A03",0x00000000,"PCI"
 HKR,"Parameters","Internal_IDE_Channel",0x00000000,"IDE"
+HKR,"Parameters","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_ACTIVATE@
+HKR,"Parameters","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
+HKR,"Parameters","PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
 [Monitor_Service]
 DisplayName=%MonitorName%
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074401.1437049 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgv-00064f-B7; Fri, 08 Aug 2025 14:03:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074401.1437049; Fri, 08 Aug 2025 14:03:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgv-00064I-2L; Fri, 08 Aug 2025 14:03:29 +0000
Received: by outflank-mailman (input) for mailman id 1074401;
 Fri, 08 Aug 2025 14:03:28 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=95AZ=2U=bounce.vates.tech=bounce-md_30504962.689603ab.v1-3c50097ee203469bbd50b71bcfacc648@srs-se1.protection.inumbo.net>)
 id 1ukNgu-0005um-K9
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:28 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 75174e88-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:27 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5NC5kjczS62Gqs
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:23 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 3c50097ee203469bbd50b71bcfacc648; Fri, 08 Aug 2025 14:03:23 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 75174e88-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661803; x=1754931803;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=auZOzxrPTFBt23q31Hda6cYs1hixy/o9GAEQgK7j5eEwUAA8/pphJeYgAUZk1SXqX
	 wUADKntpKNIdv47ocRf1I82/rjUN0k4MxYON/nqvEy2B2wpe5MbwS4u2/Qg1Uy4UYn
	 JCT/XP5Idb7SURSopv1+HYAPEEPxK2R2xFqK9ePcIXtsvr7wgfdDKuqKOiJ83tFPHE
	 wbBB9babuSIT1GCK399KBsWzCg7pBEtMG6OOFBZE4ESzhBiwSrr6059Wm27Q2lDO/z
	 jqlZEbEaRJwjiJpYfHBPoS7/DJdQ2F/oNd/g0Wi6KRr76u1dWbAy6pFdKWPOkHRFqe
	 p/6a1M1hUn/4Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661803; x=1754922303; i=ngoc-tu.dinh@vates.tech;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=vnMr2Lq6/afUW0at6dLMvqY0txGNgWuo9VDGpGYm28CBouO/piDyTbFSziweK84YX
	 k/yk2lbfby+9r57/Nyj+YWRQXQmhvi96gpKN/8NWYUF3fEw6dU+lHDRbpq8HqNFezJ
	 qTBMBjUky9utKlJqIbaaUXTZsfTfpCCxbJGXq562E9j3ba3BnSjRJcrGIhD46YYtZ1
	 q8Nlgd6i7YFgWaXQMQgqQUlCQPM8QmJ/dQVk6ZAQRwE3CSaATiezJcyz2AbLZtw34p
	 8Gal8JNOSRO3Duxiau8oL0/ZtDWuYn/YO4WSLsue26BA+eakCpsGqSzGvEH16gbWr2
	 H75bRhktTElbg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENNET=20PATCH=20v4=2013/13]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661803181
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-14-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.3c50097ee203469bbd50b71bcfacc648?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xennet.inf       | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 6991440..a0faed5 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xennet.inf b/src/xennet.inf
index 4923388..b684219 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -179,11 +179,14 @@ StartType=%SERVICE_DEMAND_START%
 ErrorControl=%SERVICE_ERROR_NORMAL% 
 ServiceBinary=%12%\xennet.sys 
 LoadOrderGroup="NDIS"
-AddReg = XenNet_BootFlags
+AddReg = XenNet_BootFlags,XenNet_Unplug
 
 [XenNet_BootFlags]
 HKR,,"BootFlags",0x00010003,0x81
 
+[XenNet_Unplug]
+HKLM,%ForceUnplugKey%,"NICS",0x00010001,1  ; @FORCE_UNPLUG@
+
 [XenNet_EventLog]
 AddReg=XenNet_EventLog_AddReg
 
@@ -196,6 +199,7 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@"
 DiskDesc="@PRODUCT_NAME@ PV Network Device Package" 
 XenNetName="@PRODUCT_NAME@ PV Network Device"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 IPChecksumOffloadIPv4="IPv4 Checksum Offload"
 TCPChecksumOffloadIPv4="TCP Checksum Offload (IPv4)"
 UDPChecksumOffloadIPv4="UDP Checksum Offload (IPv4)"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:30 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074402.1437051 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgw-00069j-7k; Fri, 08 Aug 2025 14:03:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074402.1437051; Fri, 08 Aug 2025 14:03:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgw-00069c-3o; Fri, 08 Aug 2025 14:03:30 +0000
Received: by outflank-mailman (input) for mailman id 1074402;
 Fri, 08 Aug 2025 14:03:28 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=z5NZ=2U=bounce.vates.tech=bounce-md_30504962.689603aa.v1-ddff490a3390487f89104f70f8f90d83@srs-se1.protection.inumbo.net>)
 id 1ukNgu-0005ul-TD
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:28 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 73612485-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:25 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5NB1rKlz1XLW0M
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 ddff490a3390487f89104f70f8f90d83; Fri, 08 Aug 2025 14:03:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 73612485-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661802; x=1754931802;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lZbKHheosk9CwzOsptIobeXMfu5tNV1Rui4XHkRgiBqi7gSRJLPeGTn2m3z7ogsQK
	 VZQ7478PWEtbnNRBAXjfSCYckvJvzKv/IpPkP2jWFX6nR6vufNXJwKoTPOjQ/LhMBB
	 KtaGEurasFa/AXLPSO3lAUrHbexc4iYvjEX69FdV7hnSsBScSP1dXpTZnM/tnDNGdL
	 wFa0KcDPgIq9nzuAqZ6yv9qHMy5KwZwoDGcm4P9s5wuaSCWJc1dldrl7RaWMZ5dF10
	 +V5xYY3We/iTYqZ3XOBh0AWJBALbB9LZ6OumDWKdHDEOsBNF3NqTj4MvIo4bU1fzyX
	 GkwElvwjGbzaw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661802; x=1754922302; i=ngoc-tu.dinh@vates.tech;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=HxZTIeMFo4Jf/oY+k4JYUFK9DZv9rqNykzJc3DdxX9u1KnUQqooUh1fdD49ZL7ife
	 BI7F0gwLJFXU0tfvWc2ElDz+cU1W6V/ylEbjwVbUwT9nq+cTb5RN3xQylNuLNg4frm
	 9pasK2bpKWaNl9MyB6/fDXLtZ2ioDsfV0FW78EzKJfyiwJLz6Ptz4/VDyDeycVvdD+
	 BfQZnX2SUwh+teR4ovAAy1eLANUEkuPiTBL0VFozlSz2mfF4PDVL+th3QFiZDUw8bn
	 XDh4RmSGf8pvwgs/DYBQsG9mNacheYyr6GAP0GWqJ+ygSTpQLmXP/wDMZC9G8QQUUm
	 aJRonFaBuyWKQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2006/11]=20Add=20forced=20unplug=20support?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661801635
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-7-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.ddff490a3390487f89104f70f8f90d83?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Forced unplug aims to simplify driver servicing by, as its name implies,
forcefully unplugging emulated devices when a driver is present, rather
than when it's active.

Create a Registry key at CurrentControlSet\XEN\ForceUnplug. Drivers can
opt into forced unplug by creating an appropriate value (DISKS/NICS)
in this key.

Older drivers are not affected.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xen/driver.c | 79 ++++++++++++++++++++++++++++++++++++++----------
 src/xen/driver.h |  5 +++
 src/xen/unplug.c | 13 ++++++--
 3 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/src/xen/driver.c b/src/xen/driver.c
index b44753c..7b2621b 100644
--- a/src/xen/driver.c
+++ b/src/xen/driver.c
@@ -63,6 +63,7 @@ typedef struct _XEN_DRIVER {
     PLOG_DISPOSITION    QemuDisposition;
     HANDLE              ParametersKey;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     HANDLE              MemoryKey;
 } XEN_DRIVER, *PXEN_DRIVER;
 
@@ -144,6 +145,30 @@ DriverGetUnplugKey(
     return __DriverGetUnplugKey();
 }
 
+static FORCEINLINE VOID
+__DriverSetForceUnplugKey(
+    _In_opt_ HANDLE Key
+    )
+{
+    Driver.ForceUnplugKey = Key;
+}
+
+static FORCEINLINE HANDLE
+__DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return Driver.ForceUnplugKey;
+}
+
+HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return __DriverGetForceUnplugKey();
+}
+
 static FORCEINLINE VOID
 __DriverSetMemoryKey(
     _In_opt_ HANDLE Key
@@ -500,6 +525,7 @@ DllInitialize(
     HANDLE                  ServiceKey;
     HANDLE                  ParametersKey;
     HANDLE                  UnplugKey;
+    HANDLE                  ForceUnplugKey;
     HANDLE                  MemoryKey;
     LOG_LEVEL               LogLevel;
     NTSTATUS                status;
@@ -577,12 +603,21 @@ DllInitialize(
 
     __DriverSetUnplugKey(UnplugKey);
 
+    status = RegistryCreateSubKey(ServiceKey,
+                                  "ForceUnplug",
+                                  REG_OPTION_NON_VOLATILE,
+                                  &ForceUnplugKey);
+    if (!NT_SUCCESS(status))
+        goto fail6;
+
+    __DriverSetForceUnplugKey(ForceUnplugKey);
+
     status = RegistryCreateSubKey(ServiceKey,
                                   "Memory",
                                   REG_OPTION_VOLATILE,
                                   &MemoryKey);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     __DriverSetMemoryKey(MemoryKey);
 
@@ -590,27 +625,27 @@ DllInitialize(
 
     status = AcpiInitialize();
     if (!NT_SUCCESS(status))
-        goto fail7;
+        goto fail8;
 
     status = SystemInitialize();
     if (!NT_SUCCESS(status))
-        goto fail8;
+        goto fail9;
 
     status = BugCheckInitialize();
     if (!NT_SUCCESS(status))
-        goto fail9;
+        goto fail10;
 
     status = ModuleInitialize();
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = ProcessInitialize();
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = UnplugInitialize();
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     RegistryCloseKey(ServiceKey);
 
@@ -618,39 +653,45 @@ DllInitialize(
 
     return STATUS_SUCCESS;
 
+fail13:
+    Error("fail13\n");
+
+    ProcessTeardown();
+
 fail12:
     Error("fail12\n");
 
-    ProcessTeardown();
+    ModuleTeardown();
 
 fail11:
     Error("fail11\n");
 
-    ModuleTeardown();
+    BugCheckTeardown();
 
 fail10:
     Error("fail10\n");
 
-    BugCheckTeardown();
+    SystemTeardown();
 
 fail9:
     Error("fail9\n");
 
-    SystemTeardown();
+    AcpiTeardown();
 
 fail8:
     Error("fail8\n");
 
-    AcpiTeardown();
-
-fail7:
-    Error("fail7\n");
-
     HypercallTeardown();
 
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+fail7:
+    Error("fail7\n");
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
 fail6:
     Error("fail6\n");
 
@@ -698,6 +739,7 @@ DllUnload(
     )
 {
     HANDLE  MemoryKey;
+    HANDLE  ForceUnplugKey;
     HANDLE  UnplugKey;
     HANDLE  ParametersKey;
 
@@ -722,6 +764,11 @@ DllUnload(
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+    ForceUnplugKey = __DriverGetForceUnplugKey();
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
     UnplugKey = __DriverGetUnplugKey();
 
     RegistryCloseKey(UnplugKey);
diff --git a/src/xen/driver.h b/src/xen/driver.h
index 21df779..6851e01 100644
--- a/src/xen/driver.h
+++ b/src/xen/driver.h
@@ -43,6 +43,11 @@ DriverGetUnplugKey(
     VOID
     );
 
+extern HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    );
+
 extern PMDL
 DriverGetNamedPages(
     _In_ PSTR   Name,
diff --git a/src/xen/unplug.c b/src/xen/unplug.c
index dbd9a2e..282ed93 100644
--- a/src/xen/unplug.c
+++ b/src/xen/unplug.c
@@ -266,6 +266,7 @@ UnplugSetRequest(
 {
     PUNPLUG_CONTEXT     Context = &UnplugContext;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     PSTR                ValueName;
     PSTR                EnumName;
     ULONG               Value;
@@ -277,6 +278,7 @@ UnplugSetRequest(
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
     UnplugKey = DriverGetUnplugKey();
+    ForceUnplugKey = DriverGetForceUnplugKey();
 
     switch (Type) {
     case UNPLUG_DISKS:
@@ -293,17 +295,24 @@ UnplugSetRequest(
         ASSERT(FALSE);
     }
 
+    status = RegistryQueryDwordValue(ForceUnplugKey,
+                                     ValueName,
+                                     &Value);
+    if (NT_SUCCESS(status) && Value)
+        goto unplug;
+
     status = RegistryQueryDwordValue(UnplugKey,
                                      ValueName,
                                      &Value);
     if (!NT_SUCCESS(status))
         goto done;
 
-    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
-
     if (Value != 0)
         (VOID) UnplugCheckEnumKey(EnumName, &Value);
 
+unplug:
+    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
+
     Info("%s (%u)\n", ValueName, Value);
 
     AcquireHighLock(&Context->Lock, &Irql);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:30 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074403.1437055 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgw-0006A6-Ak; Fri, 08 Aug 2025 14:03:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074403.1437055; Fri, 08 Aug 2025 14:03:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgw-00069n-5H; Fri, 08 Aug 2025 14:03:30 +0000
Received: by outflank-mailman (input) for mailman id 1074403;
 Fri, 08 Aug 2025 14:03:29 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=nEl0=2U=bounce.vates.tech=bounce-md_30504962.689603ab.v1-e13f194c90d04d2f9101a0bf109a55f7@srs-se1.protection.inumbo.net>)
 id 1ukNgv-0005um-FF
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:29 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 759b7fd1-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:28 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5ND0GcNzS62Gx3
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 e13f194c90d04d2f9101a0bf109a55f7; Fri, 08 Aug 2025 14:03:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 759b7fd1-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661804; x=1754931804;
	bh=0662Me/zHSZ9Bd478d39IQB811fwjDBJzXDB2OGeBmU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=NEMdIO6efhVMNqDjIzMKZnTkW/UuAN64qD4syFcSIL7QX0MZRh2TlE4h6L8PvIaqT
	 FuPaaIs9/Ze7cufL8hSBy/kYd5d0hv54vTgb/ojD5Bcemzlt8m6dl2XN52BYCrqWis
	 5Ys6HH0I3tIf5VJxBSsIfTVlEe87QrLXxK3Q4SSBPUaBdLVAj6MmUKZTDUrCqw67Aa
	 ZVKKcL4Jg/WNJlVg27jRqD1YFW3CWw2+EnmeOp74eQYjnbgy6KbOTwWTp099Ob8O4/
	 ooFUXLO7LwBGKUxxiGLdS8j+sCJO2IZz/sldVO9WN2IvLusHD5bBmKwVtuKY/8JtBz
	 Kr67Lauc3GJuw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661804; x=1754922304; i=ngoc-tu.dinh@vates.tech;
	bh=0662Me/zHSZ9Bd478d39IQB811fwjDBJzXDB2OGeBmU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Oo02CuXzcx+vzGjZFxF58fr+47V8vtSZ3QeqjGkWETk+XLMl8+tcknuKk9loLYbBT
	 ExHgsE5xYS0AZ5zqFmTfWcvKlDkbaRrwkLEcv85FrV5XL2Turw71AxYtlG94iDKnab
	 bycCqkqMjbspT+x5ee5ZveKpNk3e9tAexid39ddKT18TDaMvRc8unfKTL/bT36l1u4
	 BOb0XxMH93q5n1TJt1N5QuxLYTJgU0a8t5xaMitxrVBUzl+1KuX+katgnS6D7/n3WY
	 oiB9y6t7eAyenw/8vc5/Hc0Rv6VehZLvDRVIQkV51k3HWjUSWK46XZnE0814BuG9i7
	 Jo3DK1V23ohjw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v4=2014/15]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661803397
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-15-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.e13f194c90d04d2f9101a0bf109a55f7?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenvbd.inf       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 093b5ee..8b0b14b 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index dfde613..0de71d1 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -106,6 +106,7 @@ HKR,"Parameters","multi-queue-max-queues",0x00010001,0x00000002
 
 [XenVbd_Unplug]
 HKLM,%UnplugKey%,"DISKS",0x00010001,0
+HKLM,%ForceUnplugKey%,"DISKS",0x00010001,1  ; @FORCE_UNPLUG@
 
 [XenVbd_Extras]
 HKLM,%PnpKey%,"DisableCDDB",0x00010001,0
@@ -120,6 +121,7 @@ DiskDesc = "@PRODUCT_NAME@ PV Storage Host Adapter Package"
 XenVbdName= "@PRODUCT_NAME@ PV Storage Host Adapter"
 XenDiskName= "@PRODUCT_NAME@ PV Storage Filter"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 PnpKey="SYSTEM\CurrentControlSet\Control\Pnp"
 PartMgrKey="SYSTEM\CurrentControlSet\Services\PartMgr\Parameters"
 DiskKey="SYSTEM\CurrentControlSet\Services\Disk"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:31 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074404.1437059 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgx-0006E0-Aj; Fri, 08 Aug 2025 14:03:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074404.1437059; Fri, 08 Aug 2025 14:03:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgx-0006Ds-7F; Fri, 08 Aug 2025 14:03:31 +0000
Received: by outflank-mailman (input) for mailman id 1074404;
 Fri, 08 Aug 2025 14:03:29 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Lgox=2U=bounce.vates.tech=bounce-md_30504962.689603a9.v1-a3b009b87e2d4b3dbda968cbfde0a945@srs-se1.protection.inumbo.net>)
 id 1ukNgv-0005ul-TU
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:29 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 7382b375-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:25 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5N96JY0zS62KcK
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:21 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 a3b009b87e2d4b3dbda968cbfde0a945; Fri, 08 Aug 2025 14:03:21 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7382b375-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661801; x=1754931801;
	bh=pVfQ6/yUldW6t+mvk/cJksdV+O7sGd4mJMKFvlChY+Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=W5JY9tGfjmGFdVQ+EzMeKHlmDRLqs7QNXLP9N4qjGOgrODoG6eUb3Xfp9VqCnVck5
	 mlF4HbntgjnWuY10Ad87vjF3PpNm6tCq+GyK5yzZHU4RTnMhTMK/0kzM/4dvuCaP2O
	 Z7wpSBsbzfu7agsOpzo5NzyQXXKOpgp1qL4f1QMQ6hee9hdtF5MXgCn6rDT/b2cA8P
	 uneOAyy3OM9MI1S0cXhrQhsr5Y2Qgr3IiMkSyQ+B0U49xyt/oIeMCvxK55ei1VaVUg
	 oeEOI4mR9ODfeh/ZDmdSW1xowYOKVwRwETODBKQu87JLreKO+0lwRcVMX76VvDsTRV
	 DHQYDWL1+Tp/w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661801; x=1754922301; i=ngoc-tu.dinh@vates.tech;
	bh=pVfQ6/yUldW6t+mvk/cJksdV+O7sGd4mJMKFvlChY+Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lr9jP2mmIzxehVL5XqNsJ+vD6dcuq9VikbDTSLpXEmTNaj4qtpqcoajZjYE+2bLw2
	 1zMEuJ5uyajULmE9F8VAhhBwPRwB+C+ffQ6ErD7fVcO5VXvm1rOr7mT+N8I6oKEHHv
	 DJJjryN8qUO3HOuLKOW9OT9H08v7FB3psRwXdPeb8nDJ/l7AXl9geJsM/2lA3x42EL
	 NIH3O+C87UuMgnYuxIz8EuAcoENukv3veHRm5kxnokWBjRoW7F8693IxkKgIsITH+e
	 WfQGatYSiWXxVr9tuf/t/Pu0bNJZwhAqEWZYzSrhiRNHOP/abMqkYsIHUdIozJ1f08
	 HE8z6smZnV+ag==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2004/11]=20Deprecate=20PDO=20revisions=200x09000007=20and=20earlier?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661801190
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.a3b009b87e2d4b3dbda968cbfde0a945?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:21 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

0x09000008 has been available since 2021.

Deprecate the old PDO revisions to make space for new revisions.

Due to b0b9cc139600 removing REV from DeviceID, it's no longer safe to
remove interfaces even if they're not exposed by the revision list, as
old drivers could have bound to older revisions and not aware of updated
Xenbus.

The following interface versions are deprecated but not removed:
* SHARED_INFO v2
* EVTCHN v5-v8
* CACHE v1
* GNTTAB v2-v3
* EMULATED v1

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/revision.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/include/revision.h b/include/revision.h
index 4c5607a..e9e62e6 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -48,14 +48,6 @@
 
 //                    REVISION   S  SI   E   D  ST   R   C   G   U  CO  EM
 #define DEFINE_REVISION_TABLE                                                \
-    DEFINE_REVISION(0x09000000,  1,  2,  5,  1,  2,  1,  1,  2,  1,  0,  1), \
-    DEFINE_REVISION(0x09000001,  1,  2,  6,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000002,  1,  2,  7,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000003,  1,  2,  8,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000004,  1,  2,  8,  1,  2,  1,  1,  3,  1,  1,  1), \
-    DEFINE_REVISION(0x09000005,  1,  2,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000006,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000007,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:31 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074405.1437065 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgx-0006EQ-F7; Fri, 08 Aug 2025 14:03:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074405.1437065; Fri, 08 Aug 2025 14:03:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgx-0006E8-8t; Fri, 08 Aug 2025 14:03:31 +0000
Received: by outflank-mailman (input) for mailman id 1074405;
 Fri, 08 Aug 2025 14:03:30 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rwmB=2U=bounce.vates.tech=bounce-md_30504962.689603ac.v1-a074637104f9488daa792d5a263a816b@srs-se1.protection.inumbo.net>)
 id 1ukNgw-0005um-6Z
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:30 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 76043db9-7460-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:03:29 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5NF09hpzS62Kbl
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:25 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 a074637104f9488daa792d5a263a816b; Fri, 08 Aug 2025 14:03:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 76043db9-7460-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661805; x=1754931805;
	bh=si6Rcpi0+Uz0DUcam+qWEAI0Yhk1kH870v9tmh4JfqU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=RMB8d9dWRIDQiargzBf9tpkc92/OmwFNQUD3IdjikoM3gXVDJx45bjYdVmDPqnHYQ
	 ECHo3m4qEokPsAKQnO6j4oYcOmvfDpO3nCdNFBCPSEz4UP6WNAGgoaKsTusfo+Xdaz
	 wHvPWbB5yCoBZrdEH43s4HG1WyueO5uwXzC27t8l0dMiI9zX3cekQ+qM8OJoU9RGGX
	 5Au+wMbmD90L4uJtCLXEiV0cCJeN+uLxeZubbWK1N1VZJPHFxBG0A5jlieGFZwNAwG
	 bIlKnXYeoG/j6EjJcxARe6/Tkwka53rzk9408OQDE8453ngo9S17xiLfW2k/18c5Ss
	 HRpBEVvI31/IQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661805; x=1754922305; i=ngoc-tu.dinh@vates.tech;
	bh=si6Rcpi0+Uz0DUcam+qWEAI0Yhk1kH870v9tmh4JfqU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=YVAGE/wwyuZpLeLjJ+ruHNaFofTClVXvuTi0hS20mWVDo+u/SuT8sw2eROVhGeJPB
	 kIhgQard27Jo+Fhrma3lP7sHah3L34jH06sETKMkISSWvC4Fwrqzcr65eHdUys30fl
	 b3xjYxwesdl5xDw8z/O/Ba+tJL3mIq6CbsvDR9GB1TQw8lZMchP+0xoUa6PcsuhR3R
	 ldhzRCJ5zhpDj/To+T8u+iKB1N9RFa5gwarp561Q3jEOqwDqYD6vBodICZTlIOeQYR
	 1VTjwe5hzpZwrfdRZK19mOBHZZhR3IY0FX7w1tQSmUHsLk56dsVhE1eXLQKOht9CnT
	 3Z9A1hPPEJrUA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVKBD=20PATCH=20v4=2018/18]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661804424
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-19-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.a074637104f9488daa792d5a263a816b?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvkbd/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenvkbd/pdo.c b/src/xenvkbd/pdo.c
index f10aca0..adb8353 100644
--- a/src/xenvkbd/pdo.c
+++ b/src/xenvkbd/pdo.c
@@ -1318,8 +1318,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENVKBD\\VEN_%hs&DEV_HID",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENVKBD\\VEN_" VENDOR_PREFIX_STR "&DEV_HID");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:32 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074406.1437067 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgy-0006Ik-Dc; Fri, 08 Aug 2025 14:03:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074406.1437067; Fri, 08 Aug 2025 14:03:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgy-0006IZ-AX; Fri, 08 Aug 2025 14:03:32 +0000
Received: by outflank-mailman (input) for mailman id 1074406;
 Fri, 08 Aug 2025 14:03:30 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GD4g=2U=bounce.vates.tech=bounce-md_30504962.689603aa.v1-949cde0b735c4e1f8a8e6ef4676ff848@srs-se1.protection.inumbo.net>)
 id 1ukNgw-0005ul-Tk
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:30 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 74ab452d-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:27 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5NB3qMHz1XLW0R
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 949cde0b735c4e1f8a8e6ef4676ff848; Fri, 08 Aug 2025 14:03:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 74ab452d-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661802; x=1754931802;
	bh=KUUV+isw+ZeaPIY5qwof4UCVWeG2D/q6dyxVlQqwnro=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=XaDSMgwb1CSeXcCCvejVzn+vUkgMKwvwEKzyAQwJ2kkAVty/oiE9VrMGdmGhpya3g
	 tAMKPJze8lcT9qYiZIzY+Qyx1JK0abR0wpIb5MCF1v19cWKaTtyGF76c8rNeZdKlF7
	 Gk4p/ywaEcgK5kknaQCTpD2l3LjXALg/kghFlZD37apDrZ8bzNhkYEhcuaSC1IAYWU
	 tjZHW8WhTpuYe3zgo/PUZVyarkB66Ebnj0En45HN87deXBUn6qEeZLgt9d7Hx6PEZN
	 UvH3b/bA+EHT+rflK3NoUaT2+y0/Fql033gtqsMFONiIkSrAcosaMQ/NzR/UgGnS+v
	 cDcgSSUHugHtg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661802; x=1754922302; i=ngoc-tu.dinh@vates.tech;
	bh=KUUV+isw+ZeaPIY5qwof4UCVWeG2D/q6dyxVlQqwnro=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=LYg3IWtzXUhgL2KRN3AoMcwP5QK3xG5PR4hdDGTT5k3khpqvTe0DUpD+riGcKiZg6
	 tf8y3l04zNlQewGY0XYqAXe4G58dO/2JEsIenpofxg2IuaUmnOnD4xRaK48y1Kj0Gn
	 o0GZRSYvnev+UdVPt0CHlx6UdJm0brCKmwHX/Mr1KnUwO4kZOXqN3jVV6qIL8+lD25
	 cBvtmVcdxjKAMAXgnQpXhvWR9EbRSM3NNeaq4xRwIm0ZUWHLhM8Lri/FANgH58fc1O
	 PTN0Mzzn/NOA5s09+yeomnLpU69EepbtB8CAvajbbofHoWr8DUQkMI2ulnJAbfBkn1
	 RoCwNpsKLcVeg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2007/11]=20xenfilt:=20Add=20Xenbus=20device=20precedence=20mechanism?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661801841
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-8-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.949cde0b735c4e1f8a8e6ef4676ff848?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define registry values in xenfilt\Parameters with the names being
compatible IDs and values being numeric precedences.

The Xenbus device with the highest precedence should always be activated
over devices with lower precedence, ignoring Active* values.

If a device is force-activated, get its IDs directly instead of via
Active* values.

Define XENBUS_EMULATED_ACTIVATION_STATUS in emulated_interface.h for
latter use.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h | 10 ++++++
 src/xenfilt/driver.c         | 59 ++++++++++++++++++++++++++++++++++
 src/xenfilt/driver.h         |  7 ++++
 src/xenfilt/fdo.c            | 28 +++++++++++++++-
 src/xenfilt/pdo.c            | 62 ++++++++++++++++++++----------------
 src/xenfilt/pdo.h            |  7 ++--
 6 files changed, 141 insertions(+), 32 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index ead9c14..86a9e06 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -42,6 +42,16 @@
 
 #ifndef _WINDLL
 
+/*! \typedef XENBUS_EMULATED_ACTIVATION_STATUS
+    \brief If the device was force-activated, force-deactivated or
+           otherwise.
+*/
+typedef enum _XENBUS_EMULATED_ACTIVATION_STATUS {
+    XENBUS_EMULATED_ACTIVATE_NEUTRAL = 0,
+    XENBUS_EMULATED_FORCE_ACTIVATED = 1,
+    XENBUS_EMULATED_FORCE_DEACTIVATED = 2,
+} XENBUS_EMULATED_ACTIVATION_STATUS, *PXENBUS_EMULATED_ACTIVATION_STATUS;
+
 /*! \typedef XENFILT_EMULATED_ACQUIRE
     \brief Acquire a reference to the EMULATED interface
 
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 16e4deb..4b69568 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -279,6 +279,65 @@ DriverGetActive(
     return __DriverGetActive(Key, Value);
 }
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+NTSTATUS
+DriverGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    )
+{
+    HANDLE              ParametersKey;
+    PSTR                CompatibleIDs;
+    ULONG               Index;
+    NTSTATUS            status;
+
+    status = RegistryOpenParametersKey(KEY_READ, &ParametersKey);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = DriverQueryId(PhysicalDeviceObject,
+                           BusQueryCompatibleIDs,
+                           &CompatibleIDs);
+    if (!NT_SUCCESS(status))
+        goto fail2;
+
+    Index = 0;
+
+    do {
+        ULONG   Length = (ULONG)strlen(&CompatibleIDs[Index]);
+
+        if (Length == 0)
+            break;
+
+        status = RegistryQueryDwordValue(ParametersKey,
+                                         &CompatibleIDs[Index],
+                                         Precedence);
+        if (NT_SUCCESS(status))
+            goto done;
+
+        Index += Length + 1;
+    } while (1);
+
+    *Precedence = 0;
+
+done:
+    if (*Precedence)
+        Info("%s found precedence %lX\n", CompatibleIDs, *Precedence);
+
+    ExFreePool(CompatibleIDs);
+    RegistryCloseKey(ParametersKey);
+
+    return STATUS_SUCCESS;
+
+fail2:
+    RegistryCloseKey(ParametersKey);
+
+fail1:
+    *Precedence = 0;
+
+    return status;
+}
+
 static BOOLEAN
 DriverIsActivePresent(
     VOID
diff --git a/src/xenfilt/driver.h b/src/xenfilt/driver.h
index 9c703c1..cf6a2d6 100644
--- a/src/xenfilt/driver.h
+++ b/src/xenfilt/driver.h
@@ -54,6 +54,13 @@ DriverGetActive(
     _Outptr_result_z_ PSTR  *Value
     );
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+extern NTSTATUS
+DriverGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    );
+
 typedef enum _XENFILT_FILTER_STATE {
     XENFILT_FILTER_ENABLED = 0,
     XENFILT_FILTER_PENDING,
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 594da4a..87302bb 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -404,6 +404,8 @@ FdoEnumerate(
     ULONG                   Count;
     PLIST_ENTRY             ListEntry;
     ULONG                   Index;
+    ULONG                   ActiveIndex;
+    ULONG                   Precedence;
     NTSTATUS                status;
 
     Count = Relations->Count;
@@ -458,11 +460,35 @@ FdoEnumerate(
         ListEntry = Next;
     }
 
+    ActiveIndex = Precedence = 0;
+    for (Index = 0; Index < Count; Index++) {
+        ULONG   ThisPrecedence;
+
+        if (PhysicalDeviceObject[Index] != NULL) {
+            status = DriverGetPrecedence(PhysicalDeviceObject[Index],
+                                         &ThisPrecedence);
+            if (ThisPrecedence > Precedence) {
+                ActiveIndex = Index;
+                Precedence = ThisPrecedence;
+            }
+        }
+    }
+
     // Walk the list and create PDO filters for any new devices
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            (VOID) PdoCreate(Fdo, PhysicalDeviceObject[Index], Fdo->Type);
+            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate =
+                                                XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
+            if (Precedence > 0)
+                ForceActivate = Index == ActiveIndex ?
+                                XENBUS_EMULATED_FORCE_ACTIVATED :
+                                XENBUS_EMULATED_FORCE_DEACTIVATED;
+            (VOID) PdoCreate(Fdo,
+                             PhysicalDeviceObject[Index],
+                             Fdo->Type,
+                             ForceActivate);
             ObDereferenceObject(PhysicalDeviceObject[Index]);
         }
     }
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 4f40c4f..58c9ef0 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -249,15 +249,16 @@ __PdoGetFdo(
 
 static NTSTATUS
 PdoSetDeviceInformation(
-    _In_ PXENFILT_PDO   Pdo
+    _In_ PXENFILT_PDO                       Pdo,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     )
 {
-    PXENFILT_DX         Dx = Pdo->Dx;
-    PSTR                DeviceID;
-    PSTR                ActiveDeviceID;
-    PSTR                InstanceID;
-    PSTR                LocationInformation;
-    NTSTATUS            status;
+    PXENFILT_DX                             Dx = Pdo->Dx;
+    PSTR                                    DeviceID;
+    PSTR                                    ActiveDeviceID;
+    PSTR                                    InstanceID;
+    PSTR                                    LocationInformation;
+    NTSTATUS                                status;
 
     status = DriverQueryId(Pdo->LowerDeviceObject,
                            BusQueryDeviceID,
@@ -265,19 +266,23 @@ PdoSetDeviceInformation(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    status = DriverGetActive("DeviceID",
-                             &ActiveDeviceID);
-    if (NT_SUCCESS(status)) {
-        Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
-                      TRUE :
-                      FALSE;
-
-        ExFreePool(ActiveDeviceID);
+    if (ForceActivate != XENBUS_EMULATED_ACTIVATE_NEUTRAL) {
+        Pdo->Active = ForceActivate == XENBUS_EMULATED_FORCE_ACTIVATED;
     } else {
-        Pdo->Active = FALSE;
+        status = DriverGetActive("DeviceID",
+                                &ActiveDeviceID);
+        if (NT_SUCCESS(status)) {
+            Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
+                        TRUE :
+                        FALSE;
+
+            ExFreePool(ActiveDeviceID);
+        } else {
+            Pdo->Active = FALSE;
+        }
     }
 
-    if (Pdo->Active) {
+    if (Pdo->Active && ForceActivate == XENBUS_EMULATED_ACTIVATE_NEUTRAL) {
         status = DriverGetActive("InstanceID",
                                  &InstanceID);
         if (!NT_SUCCESS(status))
@@ -1620,18 +1625,19 @@ PdoSuspend(
 
 NTSTATUS
 PdoCreate(
-    _In_ PXENFILT_FDO                   Fdo,
-    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ PXENFILT_FDO                       Fdo,
+    _In_ PDEVICE_OBJECT                     PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     )
 {
-    PDEVICE_OBJECT                      LowerDeviceObject;
-    ULONG                               DeviceType;
-    PDEVICE_OBJECT                      FilterDeviceObject;
-    PXENFILT_DX                         Dx;
-    PXENFILT_PDO                        Pdo;
-    PSTR                                CompatibleIDs;
-    NTSTATUS                            status;
+    PDEVICE_OBJECT                          LowerDeviceObject;
+    ULONG                                   DeviceType;
+    PDEVICE_OBJECT                          FilterDeviceObject;
+    PXENFILT_DX                             Dx;
+    PXENFILT_PDO                            Pdo;
+    PSTR                                    CompatibleIDs;
+    NTSTATUS                                status;
 
     ASSERT(Type != XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN);
 
@@ -1680,7 +1686,7 @@ PdoCreate(
     Pdo->LowerDeviceObject = LowerDeviceObject;
     Pdo->Type = Type;
 
-    status = PdoSetDeviceInformation(Pdo);
+    status = PdoSetDeviceInformation(Pdo, ForceActivate);
     if (!NT_SUCCESS(status))
         goto fail4;
 
diff --git a/src/xenfilt/pdo.h b/src/xenfilt/pdo.h
index 85bc07f..c0c06a4 100644
--- a/src/xenfilt/pdo.h
+++ b/src/xenfilt/pdo.h
@@ -80,9 +80,10 @@ PdoGetDeviceObject(
 
 extern NTSTATUS
 PdoCreate(
-    _In_ PXENFILT_FDO                   Fdo,
-    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ PXENFILT_FDO                       Fdo,
+    _In_ PDEVICE_OBJECT                     PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     );
 
 extern VOID
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:33 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074407.1437071 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgz-0006Lv-GD; Fri, 08 Aug 2025 14:03:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074407.1437071; Fri, 08 Aug 2025 14:03:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNgz-0006Lo-Bw; Fri, 08 Aug 2025 14:03:33 +0000
Received: by outflank-mailman (input) for mailman id 1074407;
 Fri, 08 Aug 2025 14:03:31 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=7Naa=2U=bounce.vates.tech=bounce-md_30504962.689603ab.v1-5fc4628c20aa439da9da43d429d51d71@srs-se1.protection.inumbo.net>)
 id 1ukNgx-0005ul-U2
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:31 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 74ed403c-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:27 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5NC3m4bzS62Gqj
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:23 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5fc4628c20aa439da9da43d429d51d71; Fri, 08 Aug 2025 14:03:23 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 74ed403c-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661803; x=1754931803;
	bh=WLJA4sbyjEDrhrdWpfyY1L6PYGbpAk12Lwt74MLjVPU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=b/UPw0Gp5BN0eU7kTnBik+52pRwPRXje3EolZma9wOlUc3rQJcEiqlVG3IGmAEIsI
	 BKEzD9WLUoXm8YB+WZQvA6Hj3IJUbcrCTJreWaz2C0dDToxosnk2YEX51IxUjlC+kc
	 RhbRwHL7vCDgQC+4DEB9jVl3YMW1csggvlUerFM92oaWveTZrilujlIiU0EA9nwAj5
	 PPTFSfMetuX0ZC9CxoAMNRtymJgSRyFjBFyiUwvDieFkd3ToSuzl2ij0eTYdm7YYiS
	 XdDQLT21NTw+kV6S1Nyynkd7F4kxdDr4Ajkn8y6NtilbzHGhqjsponGuQqUmFk9QEj
	 XrtcXg1nLs1pA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661803; x=1754922303; i=ngoc-tu.dinh@vates.tech;
	bh=WLJA4sbyjEDrhrdWpfyY1L6PYGbpAk12Lwt74MLjVPU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=dBZ0Q8b0qlmu2ePdq64wSWG4ixAC1zEYb+Z26k5+AQYOInRe5NJc03zmptucRsZxA
	 JqIqcArKqxDbAO4fRQdcIEsdBlsrxdlsZ7scLD9Mf5fZVy7MjbpC7r6tPdWnMR0EuX
	 tlKxpPLYBHxW777LWQ8asir8eBI1mlutkZKpH1xsPZxsEpNuW3nL3cmIb/7UcVK4Q+
	 x7XK7b8vQDUteGXtrDbELGCH2ofQqZiK1N2RZA/Y6FgP40bfue8aOLOQwZcl7Gx/mJ
	 8Cg3gGHKgRwMgVqXX85O+mJb7gSGeHVP8JowsJl6yS4y5colYwPOOb6+Smz7DTACvq
	 pvl2kOPcEHfKQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2011/11]=20Install=20Xenfilt=20with=20INF=20AddReg?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661802763
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-12-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5fc4628c20aa439da9da43d429d51d71?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

With forced-activation Xenbus, there's little reason not to install
Xenfilt.

Add a new INF section to this effect, also conditioned on the
FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index a0b4402..1f3fc45 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -114,6 +114,8 @@ ErrorControl=%SERVICE_ERROR_NORMAL%
 ServiceBinary=%12%\xenfilt.sys 
 LoadOrderGroup="Boot Bus Extender"
 AddReg = XenFilt_Parameters
+; Attention: XenFilt_Filters should only be used with forced-activation Xenbus
+AddReg = XenFilt_Filters  ; @FORCE_ACTIVATE@
 
 [XenFilt_Parameters]
 HKR,"Parameters",,0x00000010
@@ -123,6 +125,10 @@ HKR,"Parameters","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_ACTIVATE@
 HKR,"Parameters","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
 HKR,"Parameters","PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
+[XenFilt_Filters]  ; @FORCE_ACTIVATE@
+HKLM,%SystemClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+HKLM,%HDCClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+
 [Monitor_Service]
 DisplayName=%MonitorName%
 Description=%MonitorDesc%
@@ -156,6 +162,8 @@ MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
 RequestKey="SYSTEM\CurrentControlSet\Services\xenbus_monitor\Request"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+SystemClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e97d-e325-11ce-bfc1-08002be10318}"
+HDCClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e96a-e325-11ce-bfc1-08002be10318}"
 DialogTitle="@PRODUCT_NAME@"
 DialogText="needs to restart the system to complete installation."
 DialogQuestion="Press 'Yes' to restart the system now or 'No' if you plan to restart the system later."
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:34 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074408.1437075 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNh0-0006Op-HL; Fri, 08 Aug 2025 14:03:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074408.1437075; Fri, 08 Aug 2025 14:03:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNh0-0006Oh-EM; Fri, 08 Aug 2025 14:03:34 +0000
Received: by outflank-mailman (input) for mailman id 1074408;
 Fri, 08 Aug 2025 14:03:32 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PEsZ=2U=bounce.vates.tech=bounce-md_30504962.689603aa.v1-55416552c59c48daa128d8a098c34381@srs-se1.protection.inumbo.net>)
 id 1ukNgy-0005ul-U2
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:32 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 7536b2cc-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:28 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5NB6NN3z1XLX8p
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 55416552c59c48daa128d8a098c34381; Fri, 08 Aug 2025 14:03:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7536b2cc-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661802; x=1754931802;
	bh=+3In6RdxKr+69Jd9zYDn2W2fh1T/6NXMKZcDbVanzrs=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=IryKpHfbU0sHUwtbjxmMCXLVmu1Wnk0S8BJn6bp6OFg+bXrx9fMumWEm4OSxbaDqJ
	 dW7B9b6RN699h9wXvnUTm3UcusiOY8iGQabTCTM19CDm1Ehn0FvxbrCIPvgAM9RdVe
	 jajrcpqFPDCh82GmeaNzgjC5cFooodHPy46G1Yf8kfgdvSOfyFL8RkwP4GDy935DFt
	 faCiE2l5O7DI/n2ABa2pxDNbOlpQ6Ti/83xTN9HKsg1KE0aR0siImA+Ims4f7RrDN2
	 YHd/4XgSqPIPI0ziJ3j+FW+yu6AxiWBMr5ef9ttGf1dREozMSkZrB/0E9VuZE96uu1
	 EhTy61AEQZQEw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661802; x=1754922302; i=ngoc-tu.dinh@vates.tech;
	bh=+3In6RdxKr+69Jd9zYDn2W2fh1T/6NXMKZcDbVanzrs=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=zGMBnop0W+TbdkB2/0ytABy9uFazRH+FXnVcDsRafC98j5fxkLLCXQ8Iai1u6nH2Q
	 NBv9DVbu1gT6L3bL3JxvXBABygWgGS8DyYWlCqMdBsgWoPGWZg1GXIccc5wjQl6lq2
	 guDfCeqTZs4hUInPkLpaXYgsj8lkovLehWecZr9e6s0T+4uXmBYV6PZtGZPrYYnwuU
	 YysMUWA/Ib+TKd/3ETpfiiv4aVr9V9u8dtQcvlVBkWAF9nOmUfsiygHGPnHGMpaZNJ
	 KMM10IEYoN8J+u/9AnIanrYWShocBkIwm6rUn0eHwpux+LWSAXUrUt1RIGJxnUW8AF
	 o9qY8KGEV/9lw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v4=2009/11]=20Use=20EMULATED=20v3=20to=20force=20activate=20Xenbus=20FDOs?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661802271
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-10-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.55416552c59c48daa128d8a098c34381?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Use EmulatedIsDevicePresent in FdoSetActive to determine FDO forced-
activation status and set Fdo->Active + call ConfigSetActive as
appropriate.

Also use EmulatedIsDevicePresent in xenfilt!DriverIsActivePresent.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c     | 132 ++++++++++++++++++++++++++++++-------------
 src/xenfilt/driver.c |  22 ++++++--
 2 files changed, 108 insertions(+), 46 deletions(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 432e907..92a83b6 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -48,6 +48,7 @@
 #include "thread.h"
 #include "high.h"
 #include "mutex.h"
+#include "emulated_interface.h"
 #include "shared_info.h"
 #include "evtchn.h"
 #include "debug.h"
@@ -134,6 +135,8 @@ struct _XENBUS_FDO {
     PCM_PARTIAL_RESOURCE_LIST       RawResourceList;
     PCM_PARTIAL_RESOURCE_LIST       TranslatedResourceList;
 
+    XENFILT_EMULATED_INTERFACE      EmulatedInterface;
+
     BOOLEAN                         Active;
 
     PXENBUS_SUSPEND_CONTEXT         SuspendContext;
@@ -739,14 +742,16 @@ fail1:
 
 static NTSTATUS
 FdoSetActive(
-    _In_ PXENBUS_FDO    Fdo
+    _In_ PXENBUS_FDO                    Fdo
     )
 {
-    PSTR                DeviceID;
-    PSTR                InstanceID;
-    PSTR                ActiveDeviceID;
-    PSTR                LocationInformation;
-    NTSTATUS            status;
+    PSTR                                DeviceID;
+    PSTR                                InstanceID;
+    PSTR                                ActiveDeviceID;
+    PSTR                                LocationInformation;
+    BOOLEAN                             Present;
+    XENBUS_EMULATED_ACTIVATION_STATUS   IsForceActivated;
+    NTSTATUS                            status;
 
     status = FdoQueryId(Fdo,
                         BusQueryDeviceID,
@@ -766,6 +771,34 @@ FdoSetActive(
     if (!NT_SUCCESS(status))
         goto fail3;
 
+    if (Fdo->EmulatedInterface.Interface.Context == NULL)
+        goto fallback;
+
+    status = XENFILT_EMULATED(Acquire, &Fdo->EmulatedInterface);
+    if (!NT_SUCCESS(status))
+        goto fallback;
+
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Fdo->EmulatedInterface,
+                               DeviceID,
+                               NULL,
+                               &IsForceActivated);
+    BUG_ON(!Present);
+
+    XENFILT_EMULATED(Release, &Fdo->EmulatedInterface);
+
+    if (IsForceActivated == XENBUS_EMULATED_ACTIVATE_NEUTRAL)
+        goto fallback;
+
+    Fdo->Active = IsForceActivated == XENBUS_EMULATED_FORCE_ACTIVATED;
+    Info("FDO %s force %sactivated\n", DeviceID, Fdo->Active ? "" : "de");
+
+    if (Fdo->Active)
+        (VOID) ConfigSetActive(DeviceID, InstanceID, LocationInformation);
+
+    goto done;
+
+fallback:
     status = ConfigGetActive("DeviceID", &ActiveDeviceID);
     if (NT_SUCCESS(status)) {
         Fdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ? TRUE : FALSE;
@@ -780,6 +813,7 @@ FdoSetActive(
             Fdo->Active = TRUE;
     }
 
+done:
     ExFreePool(LocationInformation);
     ExFreePool(InstanceID);
     ExFreePool(DeviceID);
@@ -5822,10 +5856,19 @@ FdoCreate(
 
     __FdoSetName(Fdo);
 
-    status = FdoSetActive(Fdo);
+    status = FDO_QUERY_INTERFACE(Fdo,
+                                 XENFILT,
+                                 EMULATED,
+                                 (PINTERFACE)&Fdo->EmulatedInterface,
+                                 sizeof (Fdo->EmulatedInterface),
+                                 TRUE);
     if (!NT_SUCCESS(status))
         goto fail9;
 
+    status = FdoSetActive(Fdo);
+    if (!NT_SUCCESS(status))
+        goto fail10;
+
     if (!__FdoIsActive(Fdo))
         goto done;
 
@@ -5841,47 +5884,47 @@ FdoCreate(
 
     status = DebugInitialize(Fdo, &Fdo->DebugContext);
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = SuspendInitialize(Fdo, &Fdo->SuspendContext);
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = SharedInfoInitialize(Fdo, &Fdo->SharedInfoContext);
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     status = EvtchnInitialize(Fdo, &Fdo->EvtchnContext);
     if (!NT_SUCCESS(status))
-        goto fail13;
+        goto fail14;
 
     status = RangeSetInitialize(Fdo, &Fdo->RangeSetContext);
     if (!NT_SUCCESS(status))
-        goto fail14;
+        goto fail15;
 
     status = CacheInitialize(Fdo, &Fdo->CacheContext);
     if (!NT_SUCCESS(status))
-        goto fail15;
+        goto fail16;
 
     status = GnttabInitialize(Fdo, &Fdo->GnttabContext);
     if (!NT_SUCCESS(status))
-        goto fail16;
+        goto fail17;
 
     status = StoreInitialize(Fdo, &Fdo->StoreContext);
     if (!NT_SUCCESS(status))
-        goto fail17;
+        goto fail18;
 
     status = ConsoleInitialize(Fdo, &Fdo->ConsoleContext);
     if (!NT_SUCCESS(status))
-        goto fail18;
+        goto fail19;
 
     status = UnplugInitialize(Fdo, &Fdo->UnplugContext);
     if (!NT_SUCCESS(status))
-        goto fail19;
+        goto fail20;
 
     status = FdoBalloonInitialize(Fdo);
     if (!NT_SUCCESS(status))
-        goto fail20;
+        goto fail21;
 
     status = DebugGetInterface(__FdoGetDebugContext(Fdo),
                                XENBUS_DEBUG_INTERFACE_VERSION_MAX,
@@ -5950,68 +5993,68 @@ done:
 
     return STATUS_SUCCESS;
 
-fail20:
-    Error("fail20\n");
+fail21:
+    Error("fail21\n");
 
     UnplugTeardown(Fdo->UnplugContext);
     Fdo->UnplugContext = NULL;
 
-fail19:
-    Error("fail19\n");
+fail20:
+    Error("fail20\n");
 
     ConsoleTeardown(Fdo->ConsoleContext);
     Fdo->ConsoleContext = NULL;
 
-fail18:
-    Error("fail18\n");
+fail19:
+    Error("fail19\n");
 
     StoreTeardown(Fdo->StoreContext);
     Fdo->StoreContext = NULL;
 
-fail17:
-    Error("fail17\n");
+fail18:
+    Error("fail18\n");
 
     GnttabTeardown(Fdo->GnttabContext);
     Fdo->GnttabContext = NULL;
 
-fail16:
-    Error("fail16\n");
+fail17:
+    Error("fail17\n");
 
     CacheTeardown(Fdo->CacheContext);
     Fdo->CacheContext = NULL;
 
-fail15:
-    Error("fail15\n");
+fail16:
+    Error("fail16\n");
 
     RangeSetTeardown(Fdo->RangeSetContext);
     Fdo->RangeSetContext = NULL;
 
-fail14:
-    Error("fail14\n");
+fail15:
+    Error("fail15\n");
 
     EvtchnTeardown(Fdo->EvtchnContext);
     Fdo->EvtchnContext = NULL;
 
-fail13:
-    Error("fail13\n");
+fail14:
+    Error("fail14\n");
 
     SharedInfoTeardown(Fdo->SharedInfoContext);
     Fdo->SharedInfoContext = NULL;
 
-fail12:
-    Error("fail12\n");
+fail13:
+    Error("fail13\n");
 
     SuspendTeardown(Fdo->SuspendContext);
     Fdo->SuspendContext = NULL;
 
-fail11:
-    Error("fail11\n");
+fail12:
+    Error("fail12\n");
 
     DebugTeardown(Fdo->DebugContext);
     Fdo->DebugContext = NULL;
 
-fail10:
-    Error("fail10\n");
+fail11:
+    Error("fail11\n");
 
     Fdo->UseMemoryHole = 0;
 
@@ -6021,6 +6064,12 @@ fail10:
     //
     Fdo->Active = FALSE;
 
+fail10:
+    Error("fail10\n");
+
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
 fail9:
     Error("fail9\n");
 
@@ -6159,6 +6208,9 @@ FdoDestroy(
         FdoClearActive(Fdo);
     }
 
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
     RtlZeroMemory(Fdo->VendorName, MAXNAMELEN);
 
     FdoReleaseLowerBusInterface(Fdo);
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 4b69568..95a421c 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -343,15 +343,22 @@ DriverIsActivePresent(
     VOID
     )
 {
-    PSTR        ActiveDeviceID;
-    BOOLEAN     Present;
-    NTSTATUS    status;
+    PSTR                                ActiveDeviceID;
+    BOOLEAN                             Present;
+    XENBUS_EMULATED_ACTIVATION_STATUS   IsForceActivated;
+    NTSTATUS                            status;
 
     status = XENFILT_EMULATED(Acquire, &Driver.EmulatedInterface);
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    Present = FALSE;
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Driver.EmulatedInterface,
+                               NULL,
+                               NULL,
+                               &IsForceActivated);
+    if (NT_SUCCESS(status) && Present)
+        goto done;
 
     status = __DriverGetActive("DeviceID",
                                &ActiveDeviceID);
@@ -361,14 +368,17 @@ DriverIsActivePresent(
     Present = XENFILT_EMULATED(IsDevicePresent,
                                &Driver.EmulatedInterface,
                                ActiveDeviceID,
-                               NULL);
+                               NULL,
+                               &IsForceActivated);
 
     ExFreePool(ActiveDeviceID);
 
 done:
     XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
 
-    Info("ACTIVE DEVICE %sPRESENT\n", (!Present) ? "NOT " : "");
+    Info("ACTIVE DEVICE %sPRESENT%s\n",
+         (!Present) ? "NOT " : "",
+         IsForceActivated == XENBUS_EMULATED_FORCE_ACTIVATED ? " (FORCED)" : "");
 
     return Present;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:03:35 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:03:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074409.1437078 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNh1-0006Rz-Iq; Fri, 08 Aug 2025 14:03:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074409.1437078; Fri, 08 Aug 2025 14:03:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNh1-0006Ro-Fw; Fri, 08 Aug 2025 14:03:35 +0000
Received: by outflank-mailman (input) for mailman id 1074409;
 Fri, 08 Aug 2025 14:03:33 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=z3R2=2U=bounce.vates.tech=bounce-md_30504962.689603ab.v1-a6c32c8458ac45fb8f55266ab6947b4e@srs-se1.protection.inumbo.net>)
 id 1ukNgz-0005ul-UM
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:33 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 75ce4ed2-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:29 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5NC6614z1XLRtR
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:23 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 a6c32c8458ac45fb8f55266ab6947b4e; Fri, 08 Aug 2025 14:03:23 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 75ce4ed2-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661803; x=1754931803;
	bh=yezSdmrrQTjKPu9BNqcoVf9LgT+mxmBHkelNFwUSkak=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=aMCzvfL+WJDXQxjddpCnmeqQ83TYfUhTJXDforLETvfnKOMTvk4i9XTFT3NoimUNd
	 hwkCWPi3ro83z0sRmwdtoGdAYkFLOZL+9n6OkYqt1BZC1xDaIz6fZkjKeDnqyu+QFb
	 dgGjiRMwXX5lgSpKKi1aJPgzmH6EJBNkM9iFvGJo+ic3R1MOXS9ebrNi+Xxvux8lJN
	 2uLk9vZ2mtSTm5BCO6+nHDkPhIPqeqQ+JRT5ALFw5C6P3gmyCnwQHum4jdtojfBxvA
	 1twmNXZrMkj88x9As+0V8ZEBLNAftdkxN7LwvQoLdut4Gs00lZNS4pPQirsTstvFl/
	 0XBCh6GfZspbg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661803; x=1754922303; i=ngoc-tu.dinh@vates.tech;
	bh=yezSdmrrQTjKPu9BNqcoVf9LgT+mxmBHkelNFwUSkak=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=kxeqsKimerji6OySH17DHKZA+rCsd4qbt9FToYPVLqe2Eodu8jUq8ns5C3GFBRw3b
	 RlAAB2OofcRYIUiTYeRSFXD97U5/4aCjenzeWOvdybSp96iZDmTTgo/8/nxbeiyKLJ
	 gM7+iUFDR+qq0VSsHQH1O/I8Te3oGL3QkGw1dqvkMOE/j+w3FdQbny9fmN/xd/4xvo
	 sskHbC5AYBq1DYOdsfiLGk6fTGGA9cY0JSNub4nZz6MTQ6jsptRkmZHakSeuEYtFd9
	 D/CtT6AZUZJsmo5HGSag61TrL51hHU1yVEMLPtkRGhdjwCp+oOLybk7+BE4visC5GV
	 Je6i/ofy5eP2A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENCONS=20PATCH=20v4=2012/12]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661802982
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-13-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.a6c32c8458ac45fb8f55266ab6947b4e?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xencons/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c
index 8726f7d..388eabb 100644
--- a/src/xencons/pdo.c
+++ b/src/xencons/pdo.c
@@ -1087,8 +1087,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENCONS\\VEN_%hs&DEV_CONSOLE",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENCONS\\VEN_" VENDOR_PREFIX_STR "&DEV_CONSOLE");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:10:46 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:10:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074478.1437083 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNnx-00082t-3f; Fri, 08 Aug 2025 14:10:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074478.1437083; Fri, 08 Aug 2025 14:10:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNnx-00082l-0P; Fri, 08 Aug 2025 14:10:45 +0000
Received: by outflank-mailman (input) for mailman id 1074478;
 Fri, 08 Aug 2025 14:10:43 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ssRK=2U=bounce.vates.tech=bounce-md_30504962.689603ac.v1-44a69acc289b4d549a4300760ec32f33@srs-se1.protection.inumbo.net>)
 id 1ukNh2-0005ul-UT
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:36 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 77591441-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:31 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5ND6yGzz1XLVCP
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 44a69acc289b4d549a4300760ec32f33; Fri, 08 Aug 2025 14:03:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 77591441-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661805; x=1754931805;
	bh=DkghtosW0POqimHuhIf/fYSuFU9xUaKD9vYoTLPFcP4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=yjJ2YYkR/tDSYC+lRxGk2qzIoBUlMLjatNHWnRt4xnLpJ/iAK9p8PYHLLnk+rjVa7
	 Zs5G7S8DWZqafxvvYB75K8FT7mdDYQ95RbO6kQQitLN3ist+Zcdae5qbRPqqlgdk6v
	 gyuqHi4rNYkvkSvGTIz03ln43LldmuDPZtcxvMKEfNyfTZRxi1adO9W2lZJU9Ea8Km
	 pNFL+7JHgBQqrDjuzR7L/wqXtmejwdI+k86dIP+4cMLB3dtYo+zPSejYQ6BQMFzjN/
	 y7pcp45+v28sT4DmaOwR4i1aWj09Wj3Yao3gQvqJ8EAtSYXZTwSvjAeDk6J7p3t9/v
	 XMH4cjgqLmQgg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661805; x=1754922305; i=ngoc-tu.dinh@vates.tech;
	bh=DkghtosW0POqimHuhIf/fYSuFU9xUaKD9vYoTLPFcP4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=LPjOqOGnE/FqRE+KMPznR8rEooKnCdpU6nrKSpeusBbVH0SqMrkk6pNR/s8l9hNJ2
	 tngbtzQFKtG+ax6UQxo4TER+WovxcEI6qqxbBzIwzClFh8K89IBk3KPCFWh2uu30a2
	 9NqyG0/YePvuhurwjJu5Fz4e+pke12AVOKgmM0nHgFWmpbj1LCpCYO3rrQcTv5MiX7
	 WcFhppKtmlCwDs00e9ULRGs2b5r6jEtk27f8hc9os5agfF9AlwDmZn1OUcbxa9nrsX
	 X1t0UHcOdJNZUIKlWG6zdfJaMddDTypK5YSjdSkQtU1ZI/KPeojcl+R1ABDZGCmjwJ
	 BJZwYouNVkY+g==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH=20v4=2017/17]=20Deprecate=20PDO=20revisions=200x09000000?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661804222
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-18-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.44a69acc289b4d549a4300760ec32f33?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

CACHE v1 has been deprecated by the removal of Xenbus 0x09000007.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/revision.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/revision.h b/include/revision.h
index 656f171..d23639f 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -42,7 +42,6 @@
 
 //                    REVISION   C   V    ST  SU   U
 #define DEFINE_REVISION_TABLE                           \
-    DEFINE_REVISION(0x09000000,  1,  8,   2,  1,   1),  \
     DEFINE_REVISION(0x09000001,  2,  8,   2,  1,   1),  \
     DEFINE_REVISION(0x09000002,  2,  9,   2,  1,   1),  \
     DEFINE_REVISION(0x09000003,  2,  10,  2,  1,   1),  \
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:10:51 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:10:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074516.1437087 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNo3-0008FY-5D; Fri, 08 Aug 2025 14:10:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074516.1437087; Fri, 08 Aug 2025 14:10:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNo3-0008FQ-20; Fri, 08 Aug 2025 14:10:51 +0000
Received: by outflank-mailman (input) for mailman id 1074516;
 Fri, 08 Aug 2025 14:10:49 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=YtfM=2U=bounce.vates.tech=bounce-md_30504962.689603ac.v1-5950708f7ccc4060996d65a6811c8363@srs-se1.protection.inumbo.net>)
 id 1ukNh0-0005ul-UQ
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:34 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 76553346-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:30 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5ND3JGPz1XLTQC
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5950708f7ccc4060996d65a6811c8363; Fri, 08 Aug 2025 14:03:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 76553346-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661804; x=1754931804;
	bh=nA8dwVHUEfM/wfSjl485RpErNmlZKlvJuLcW0RYaIVM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=R3TUJj0fxC56ZBziAEuQEZ/6AwzjMcvomMs76reBwNPYONeb00ZSpAQzgiXOBI27m
	 v0V+J01uQy3G2q15/eTVwTyT0cI6+OlQWnuV/BPOFxLmc57w99nnPwF+TblvQ6PubX
	 PIZRyBDxifOi7XrTP38rLtk3FuWHfo1iiJGKyQ2S8XnBkVSDbwEPxCoKIDTrzfGzBO
	 uemZJNgNrRQ3Px7VG62sZcLfcTZBzqoxas56Gj1kaRjJlji7wKhqvHlF59nZAvQqFu
	 5368uXQyv7BJUyRw0s9A4s6K/07oQ5nJX1Cwa8s4m/9Ni3uIh/Ubt/AKthd5ZPJHuO
	 LdNFveVbJ8ZUw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661804; x=1754922304; i=ngoc-tu.dinh@vates.tech;
	bh=nA8dwVHUEfM/wfSjl485RpErNmlZKlvJuLcW0RYaIVM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=XS7cZ6t9Ew5kZeZ1onx4UX3lzlkSeCE2ccIQsj8c+lNlZ/uk7AbS+0mAjiYuVelR9
	 0UHtyawUHvkdCcVDL1Ua3m1Bb2enW0CFTMv9dskrN1NMQplptxxjTacIXF9GfrqfgO
	 mmxA8R2fj3R0izMd9b4niKvy+lrzODjfpzpNsBsyWIvcXXHFfqlpszQ5FouGDmd1vU
	 kwILbaIoleFtmLCxkGwK6409v/JFvG3cB9Jv0vIFgSH4ShNGZVakcmTI66O6wmPjwb
	 VMIe9mXg7xenwBUw7SGwy4DSaGllVT3J7HuivSCKaTwqCwdg3SRtrpD/JjbWjr6Tgs
	 A1twsehw95Cpg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v4=2015/15]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661803605
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-16-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5950708f7ccc4060996d65a6811c8363?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvbd.inf | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index 0de71d1..d397210 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -54,12 +54,15 @@ xendisk.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
+%XenVbdName%=XenVbd_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B\
+,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B\
+,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
 
 [XenVbd_Inst] 
 CopyFiles=XenVbd_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenVbd_Copyfiles]
 xenvbd.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:10:52 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:10:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074522.1437091 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNo4-0008JH-6I; Fri, 08 Aug 2025 14:10:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074522.1437091; Fri, 08 Aug 2025 14:10:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNo4-0008Ix-3G; Fri, 08 Aug 2025 14:10:52 +0000
Received: by outflank-mailman (input) for mailman id 1074522;
 Fri, 08 Aug 2025 14:10:50 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=7dYY=2U=bounce.vates.tech=bounce-md_30504962.689603ac.v1-c6a3655d453748abb96c0e1b4d80f44e@srs-se1.protection.inumbo.net>)
 id 1ukNh1-0005ul-UP
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:03:35 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 76e00ae3-7460-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 16:03:30 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4bz5ND4mXFz1XLTQD
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:03:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c6a3655d453748abb96c0e1b4d80f44e; Fri, 08 Aug 2025 14:03:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 76e00ae3-7460-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754661804; x=1754931804;
	bh=yM2qmQLG4ZCX4mwQa0ABsCteAJ/JVFbqWEyHJ1jI+V0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=K7Lf96CtzvQWfHrkp2qsxxkNIXcZFHJKDQmLGsCRJnXE79cX+I6bjkh4kRAHX3lh4
	 h9EzFvHJxulHBNAQ4Ocb6Js+esVgUeRCrbl/LvM4hRZJfhFyOU+f4XbTrdTQwtraMW
	 jYw0YNhPoV8FKsJK4EqRQIf7mfszI5ncv+HNo5Q1VkUNJov6ch1l470ckwR6a2Dn8K
	 k/amPG7Q8PhVe7r/OGnjkGa0k2mGq3pSLEKx2v/QS8P0+7esx/BRsTRNiQVHRjkDNT
	 I7FEy4W2ixolt4haQGDd0ZQ1rWTix02UDLmok8KWX/On2HwuYFM5KHrSuUhno3Jdj+
	 A5keVXfumLT6Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754661804; x=1754922304; i=ngoc-tu.dinh@vates.tech;
	bh=yM2qmQLG4ZCX4mwQa0ABsCteAJ/JVFbqWEyHJ1jI+V0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lWPTRk6DaI0ybdcoowYu4kpff4LuTZceNiwbysU2aqbd1pfmMhkHRADB5LnEiQVyd
	 s/N8WFbL1USWkoQCeajQqUtUGnSapQZ2qCVQ1izMcgg4IrE3MaU+0bCP9R/N9/3vI4
	 QY72UIfz09CtP81fTAW+FmjhSo98l4pP3J9MC+oIc4837wG7TjBcoeMPKg/UT/tGss
	 Le4WJ7fKB7lNcT8opWp81RVurTDY5OkbBhqzKCK4Ul/aWzC0CnPjfCwgQb2bkP8aDh
	 Gnzx9SJkn9YKwT2ttw79Tr6hA9LIZbC3g2cc75smwsLPi3M09pS+LCAypc+jj5hyZV
	 CfoCmxgvJQ9hg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH=20v4=2016/17]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754661803979
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808140314.1170-17-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c6a3655d453748abb96c0e1b4d80f44e?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:03:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 28121ac..405506e 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -2117,8 +2117,7 @@ PdoQueryId(
         Type = REG_SZ;
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENVIF\\VEN_%hs&DEV_NET",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENVIF\\VEN_" VENDOR_PREFIX_STR "&DEV_NET");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:14:31 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:14:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074591.1437094 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNra-0000F3-Fv; Fri, 08 Aug 2025 14:14:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074591.1437094; Fri, 08 Aug 2025 14:14:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukNra-0000Ew-DQ; Fri, 08 Aug 2025 14:14:30 +0000
Received: by outflank-mailman (input) for mailman id 1074591;
 Fri, 08 Aug 2025 14:14:29 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g+C3=2U=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ukNrZ-0000Em-A9
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:14:29 +0000
Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com
 [2a00:1450:4864:20::530])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fe2eac0c-7461-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:14:27 +0200 (CEST)
Received: by mail-ed1-x530.google.com with SMTP id
 4fb4d7f45d1cf-615622ed677so2645539a12.1
 for <win-pv-devel@lists.xenproject.org>; Fri, 08 Aug 2025 07:14:27 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-615a8eff596sm13622408a12.5.2025.08.08.07.14.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 08 Aug 2025 07:14:25 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fe2eac0c-7461-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754662466; x=1755267266; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=gZQcysZ9XEBUVWjNbvvZ8Y7itJ/KsyjgY9ot6mTS/HM=;
        b=OG/0tx9AJEynjrIEzVHQ9dLSOUH2nuJBIaaor6tJbzGNTYhmUNRxkCe263cfWICUrV
         HHZ3pSle1HO5p9RFyeGZtRJDbw/NtcNJQswrIb6Ae4oJzz3rNqaaG94/Ix3nqXtwfBMr
         Ar9DLVgi+pqllshcVGHpTq1kX2fEZhSNNDsC4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754662466; x=1755267266;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=gZQcysZ9XEBUVWjNbvvZ8Y7itJ/KsyjgY9ot6mTS/HM=;
        b=u0i6jFOh8twR4YnMWad9H2QX0tLt/JlG1hH9lJvxpRmE40ZgPDTuIPaq8OWbHh1l8f
         M8ClGftRPDhVv9E2tb5663rj25ZZrqTWqSl3Fs2QqGqBgw2DCegQS5XqaT03aER2l1TS
         WP8cdnbX7Wb+IH1Hv4ynW+5fikXa484RkcnT2SBCKgG6r/MRaATp/0ZmO0SL8LlrX2Ke
         FpSdlgwQOPsXL2MYDhetrdm06HeeZnxPr61bkcmbNnUxJnq6iAjRfbQ3nRavfpbVUjn5
         ILi5F8Bkcj5HNk8jxyTOPo0OvqL/rcN5GRXlA10tr3lPC3AB+0bhV1eBt9iWejli87JK
         83cg==
X-Gm-Message-State: AOJu0Yx3l1wkf7HAaZEVVE2L6pgianLmmizcrg3nlYL5K33u0AfCQGS1
	EAE5VVgVCLMugQoFzwa8dWcgZqpUHJ9lsa2yGOyiamWukL0dM3ce9c3/C6XoTp+jtugPvb1nHbe
	kLjc=
X-Gm-Gg: ASbGnctsRSAhpGncqsr2ZNEp+xtNyuZATRF3U5Tp9aBPPJT1E5EyWMbJ70UM6Y7ZKK9
	nTaIeL4+a8lnsNmDInge0zmF6ngoag0PPjalGIuw/o9C0j6nSEYYhrg5tVi/CUg6UPNU5TXxndY
	QlIwk2CZUKBa1OmfnLB+gfImJKRsflM42tJOiF9ALHfCG8YxeqzDMDuPY5CqGVNjQ1mDBYzP8CE
	Xa8XjyGWyqhaeQHkqR3ettcWAPh+CMx27i0GFj6sPF+IkFQYdAk7vLBbVkXuVkeDekVqc0ybU8D
	mc+ZlYGkE9fnPvBESoToP7xs6wIdVfX9qmIDMpdnxyB/hSL0jKm1glIPM5X4YHbMAye8Qoh32Nk
	cbukysCtwU4Rz7E+HvyHB2S7kYvFK8WMYL3Hw0dshW37aPiEHfBQBYA==
X-Google-Smtp-Source: AGHT+IEIQ4yszxOImBlFtMRbXYtIog/vddltTNWeYjoGck6V9VcP2C3XCjN4a7TfFRoJruOh4BhjjQ==
X-Received: by 2002:a05:6402:2810:b0:617:c6b1:70f9 with SMTP id 4fb4d7f45d1cf-617e2b9cb52mr2911356a12.4.1754662466392;
        Fri, 08 Aug 2025 07:14:26 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] Avoid AdapterDisable bugcheck on a disabled Adapter
Date: Fri,  8 Aug 2025 15:13:29 +0100
Message-ID: <20250808141329.910-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

MiniportShutdownEx maybe called when the miniport is in any state, including
the Paused state after MiniportPause. Both MiniportPause and MiniportShutdownEx
call AdapterDisable. The first call will unregister the suspend callback, and
the second call will bugcheck, as the SuspendCallbackLate handle is now NULL.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xennet/adapter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index 67ced3e..840e7a8 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -1965,6 +1965,8 @@ AdapterDisable(
     )
 {
     ASSERT(Adapter->Enabled);
+    if (!Adapter->Enabled)
+        return;
     Adapter->Enabled = FALSE;
 
     ReceiverDisable(Adapter->Receiver);
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 14:28:17 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 14:28:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074609.1437098 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukO4t-0001nv-E7; Fri, 08 Aug 2025 14:28:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074609.1437098; Fri, 08 Aug 2025 14:28:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukO4t-0001no-Bh; Fri, 08 Aug 2025 14:28:15 +0000
Received: by outflank-mailman (input) for mailman id 1074609;
 Fri, 08 Aug 2025 14:28:14 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=fv2R=2U=bounce.vates.tech=bounce-md_30504962.6896097a.v1-b2eac744c8384d63b5840d1e0632a514@srs-se1.protection.inumbo.net>)
 id 1ukO4r-0001ni-P4
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 14:28:14 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id e90a688e-7463-11f0-a324-13f23c93f187;
 Fri, 08 Aug 2025 16:28:11 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz5wp28QgzS62Kbl
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 14:28:10 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 b2eac744c8384d63b5840d1e0632a514; Fri, 08 Aug 2025 14:28:10 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e90a688e-7463-11f0-a324-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754663290; x=1754933290;
	bh=zuRpZUyF3kRthKNxZVa0ycBDozp3/ZeQOhDV1CnXZu0=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=V6Xho5lOctSkx1jFGIevColK6zVmSz4gNfHyX5kl6o8gi1xN9k3+VYGPZSzRGHhVU
	 Nb/FgY8S/NMf9XKzjFexD0GNEfnAtdxK/eheVE+96P46mFHVAtmnXqzMp/dWB0XXYM
	 oxXJT4x8sx/Q7cpzbrlyn/G3tdeMkK3ihVrOn3ke6cJp7MaekkeGqczewXBHf2SfK7
	 7c7iH0alj4nxbQLSm4Ybz4jTPw0rWG+BmVC1v05p6j1/mGReWIg9Ko6JcpF0io1smH
	 X8gFAVW1PQvy/PUK1sxM09zf1WawFlgFOfT2QZcbLHVStxDtwThyc/Oy3RI780FZl7
	 XKBCb84kt5Qjw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754663290; x=1754923790; i=ngoc-tu.dinh@vates.tech;
	bh=zuRpZUyF3kRthKNxZVa0ycBDozp3/ZeQOhDV1CnXZu0=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Qn7qoOGN7A46LQfK04GfhCZax9ODeardOynYV0jvJ8YWqhWaqyRhscDX8CgVg1H8e
	 ZSXwlIjMxpfaVaEZeDq6TDcyvgGduHAhFMwKDaPB3S1WKpRHMdoMqoGfZk4DiTx9Eu
	 xH5MNys+qICCTdSCjUN+tA/r4d9b/QbJv7SEMrpnxC1GcyLAfTkLZFOrU6cl+f1MpR
	 J8aaHIqVOHfMONsDgRHj0aqx4WJ+OigGsog/T+5wgkLtG2Pxo0+yTrbCLRSF287uee
	 a74VC6IZ87mkChMr4DwrqfbQeKOlYYxVKAHPv6iiLko2S5LtqRdqZjb5njD+kmh2WO
	 Ji9UXDPgSDIsA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Avoid=20AdapterDisable=20bugcheck=20on=20a=20disabled=20Adapter?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754663289368
Message-Id: <abe86f56-585b-41b4-912b-a73a383ae153@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250808141329.910-1-owen.smith@cloud.com>
In-Reply-To: <20250808141329.910-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.b2eac744c8384d63b5840d1e0632a514?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 14:28:10 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 08/08/2025 16:14, Owen Smith wrote:
> MiniportShutdownEx maybe called when the miniport is in any state, including
> the Paused state after MiniportPause. Both MiniportPause and MiniportShutdownEx
> call AdapterDisable. The first call will unregister the suspend callback, and
> the second call will bugcheck, as the SuspendCallbackLate handle is now NULL.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xennet/adapter.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
> index 67ced3e..840e7a8 100644
> --- a/src/xennet/adapter.c
> +++ b/src/xennet/adapter.c
> @@ -1965,6 +1965,8 @@ AdapterDisable(
>       )
>   {
>       ASSERT(Adapter->Enabled);
> +    if (!Adapter->Enabled)
> +        return;
>       Adapter->Enabled = FALSE;
>   
>       ReceiverDisable(Adapter->Receiver);

ASSERT(Adapter->Enabled); should be removed.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 15:05:33 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 15:05:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074765.1437263 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukOex-0007cj-Gv; Fri, 08 Aug 2025 15:05:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074765.1437263; Fri, 08 Aug 2025 15:05:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukOex-0007ce-Dz; Fri, 08 Aug 2025 15:05:31 +0000
Received: by outflank-mailman (input) for mailman id 1074765;
 Fri, 08 Aug 2025 15:05:30 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g+C3=2U=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ukOew-0007cY-Ay
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 15:05:30 +0000
Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com
 [2607:f8b0:4864:20::630])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 1d1ea47a-7469-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 17:05:28 +0200 (CEST)
Received: by mail-pl1-x630.google.com with SMTP id
 d9443c01a7336-24003ed822cso13265335ad.1
 for <win-pv-devel@lists.xenproject.org>; Fri, 08 Aug 2025 08:05:26 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1d1ea47a-7469-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754665525; x=1755270325; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=sBCKRSWB1iBRN2mabtDevssEt+rj+G33+oKoFg9vFck=;
        b=djaGJqrWK8n1U7JoPmHQp6l954I5kh7MO7IkzyQN/rk/uBJu08Z6KMm+3g7s3OKlAg
         bNBkMuwj02G2CTU1feJPIx4htiYkYHJFbYx6wA2cZl0+vg+9iIDX+hAd3wiRSJcRrMz7
         MWzioNgZVRRXc+8jw8oj1zOdTILvfXcHUSPd4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754665525; x=1755270325;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=sBCKRSWB1iBRN2mabtDevssEt+rj+G33+oKoFg9vFck=;
        b=Cxn3ldUad914OWkMhyh3vQVgCisXoC9We4h00p18U3hU6jqUR9gMzTnPHr8fxxotha
         nqwmmxuZUIokSEY9WFiDAIkvW2W7HjGRWnJogiakRI4xHQBfafphQyLhabNXX+z1U/G7
         fJE6bgESgIx9T0xEO5uU7UKAGMYUWbfboikOpscHtoapIAj0YRq4uS13WeeDWHSA0PhA
         9VzwvfpWnjgSSuhWNlhirHL/HI5WhRp5Q11+KYY3q7boBFBNkm0oa+mRmgrA8jWLksiY
         HB7b/NUSho/oP0MjmTxgkP1ktkdGsBNX8DpZD9Pah5nTAxx4QQIlBzpu8rW7KXBCIvAA
         4ooA==
X-Gm-Message-State: AOJu0YxhVvEAD0BdEO5hcs8mjcc+ycL+slghZirvRJn37FqQD9Bdr4EL
	erBluMb+v/tnaQWGidCaFYtk7Lfd5ZNZKgWdb7EcgLI+0BFi9hqEf+spHcZ6f5CefiSZLrBuhxj
	zZP/Dn1IjhEt9bazDon4TRh0kL5NxKK2rlRKecGLl
X-Gm-Gg: ASbGncs0WDlYxhNlb8gdqB4B0OGptXHJHH87diHhGs5V+YZY2qnUW2/hxpxtHOEAk2c
	mWPNlI28dEm2rX8vBwOjhrOTlkNURcu1zbxkLLjAotlpao7wQNPfv4OO55qXGC87qKNL/hIYgET
	6KyNWCmtXK/wfOwQ0BwFU4Tmn1xMi0jjhUB4/xtqGm3Tl/wMjR7NWtk+WlYvJxOWdJdZzAY/jjb
	RDOysVEBjON8jDHKg==
X-Google-Smtp-Source: AGHT+IEeva//FSChMfP5EqG1W41bpAy9tvhvdcAzegoLX1mWyvZ+Nm0fTE2m+atA87wQf+5u+g3vbCed7W8Jn0RnfWk=
X-Received: by 2002:a17:902:ef0b:b0:235:e76c:4362 with SMTP id
 d9443c01a7336-242c2005259mr53236725ad.18.1754665524927; Fri, 08 Aug 2025
 08:05:24 -0700 (PDT)
MIME-Version: 1.0
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech> <20250808140314.1170-9-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-9-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Fri, 8 Aug 2025 16:05:13 +0100
X-Gm-Features: Ac12FXzchQOOjO3p8VgqVxThmZHUDt3maGiP4r78YM6BwGKlNJw313YgZwVAJRc
Message-ID: <CAC_UY89G1wJ9N6w1M=zA74WwycuhtOvDpVx_dyxe3bcDzWinEw@mail.gmail.com>
Subject: Re: [XENBUS PATCH v4 08/11] Add EMULATED v3
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000503c77063bdbe712"

--000000000000503c77063bdbe712
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Aug 8, 2025 at 3:03=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> wr=
ote:

> diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
> index 9b02268..c01ff6a 100644
> --- a/src/xenfilt/emulated.h
> +++ b/src/xenfilt/emulated.h
> @@ -72,6 +72,7 @@ EmulatedAddObject(
>      _In_ PSTR                           InstanceID,
>      _In_opt_ PSTR                       CompatibleIDs,
>      _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
> +    _In_ LONG                           ForceActivate,
>      _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
>      );
>

This should be XENBUS_EMULATED_ACTIVATION_STATUS


Owen

--000000000000503c77063bdbe712
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Aug 8, 2025 at =
3:03=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">diff --git a/src/xenfilt/emu=
lated.h b/src/xenfilt/emulated.h<br>
index 9b02268..c01ff6a 100644<br>
--- a/src/xenfilt/emulated.h<br>
+++ b/src/xenfilt/emulated.h<br>
@@ -72,6 +72,7 @@ EmulatedAddObject(<br>
=C2=A0 =C2=A0 =C2=A0_In_ PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0InstanceID,<br>
=C2=A0 =C2=A0 =C2=A0_In_opt_ PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CompatibleIDs,<br>
=C2=A0 =C2=A0 =C2=A0_In_ XENFILT_EMULATED_OBJECT_TYPE=C2=A0 =C2=A0Type,<br>
+=C2=A0 =C2=A0 _In_ LONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ForceActivate,<br>
=C2=A0 =C2=A0 =C2=A0_Outptr_ PXENFILT_EMULATED_OBJECT=C2=A0 =C2=A0*Emulated=
Object<br>
=C2=A0 =C2=A0 =C2=A0);<br><span class=3D"gmail_default" style=3D"font-famil=
y:monospace"></span></blockquote><div>=C2=A0<span style=3D"font-family:mono=
space"></span></div><div><div class=3D"gmail_default" style=3D"font-family:=
monospace">This should be=C2=A0XENBUS_EMULATED_ACTIVATION_STATUS</div><div =
class=3D"gmail_default" style=3D"font-family:monospace"><br></div><br></div=
><div class=3D"gmail_default" style=3D"font-family:monospace">Owen</div></d=
iv></div>

--000000000000503c77063bdbe712--


From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 15:13:39 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 15:13:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074775.1437267 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukOmo-0000fv-2C; Fri, 08 Aug 2025 15:13:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074775.1437267; Fri, 08 Aug 2025 15:13:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukOmn-0000fo-Vk; Fri, 08 Aug 2025 15:13:37 +0000
Received: by outflank-mailman (input) for mailman id 1074775;
 Fri, 08 Aug 2025 15:13:37 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g+C3=2U=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ukOmn-0000fi-1W
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 15:13:37 +0000
Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com
 [2607:f8b0:4864:20::636])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 403c9af8-746a-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 17:13:35 +0200 (CEST)
Received: by mail-pl1-x636.google.com with SMTP id
 d9443c01a7336-2403c13cac3so24576525ad.0
 for <win-pv-devel@lists.xenproject.org>; Fri, 08 Aug 2025 08:13:35 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 403c9af8-746a-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754666013; x=1755270813; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=vQjTjLkUUrlCNXhAP32DO1wOKHdFfK0E7WpqMu2szsg=;
        b=NitiSvTmaGQ2Iu0f5icEe2w1Tjg8R90txK5PO9+wTzRNhnznsJXNyAqKYWQocQu6cG
         GO1G9GYWLkzXEveuGKkEd7rVFYxDip4f8SVWB4vcbukp9rgcyg1g2Rvkio28TjhtkHjz
         eRjKoHQ/1On9RKCK6tm2kytCkjDflmYcuMW4w=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754666013; x=1755270813;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=vQjTjLkUUrlCNXhAP32DO1wOKHdFfK0E7WpqMu2szsg=;
        b=OQCI6PKwoKYB9dJHRCOZvzBwIoXal3NIA3i+tTgh2HXYjd5r0lKqdcrYSS9xg5h/YE
         TqHlUb/qesJp1B3VAeSxMRAcGMa4RLbMRFVZRCsg1x4gLiiOO8lGszLKb/bu0N0a1HGa
         ZBNd8+hxfWRTRzVU8IWxeH73s1vwBDThN0MFZKAyuuv1TonHwSp2/439XREd/5MXL+kk
         mWysf6A671G2SLxgq2mqsyyck58+bYwDOnf4//oQ99hb9qOSHQlpyJoG5Rzavx32eGMp
         EeX6ala+tNl4Lu+G1C1JhNqDuL6qwLNfq9uPBB2R9Rj98JWiI6573FtfRjBZEQstzBD2
         6ykg==
X-Gm-Message-State: AOJu0YzSDwG3z37uYW1MB0myBOCpbfNSG/D4MwXdbDs1hp2jFnVqXFan
	ADGU04SLUWxwju7q4Nkbd2Ndy4BkmzSQOiAcTwIYtMDOAvPf2ZerusDIa79EF9tuylWy8/FDHso
	6u6F4C1BR8+8AipA/Onp5WFpzEFzfZLtpqg5vb1RRTOsCJ8KZRIXqRw==
X-Gm-Gg: ASbGnctTQ/Gz3KuP3+i3f523bx0imY7FfnbDWZVTHd2VSrlqRvxAf3MczmSpkihAR1s
	auLF86hFGttYLP+iu9cEjWknoiZrtlyLFGQ0XSkCnwEwlpyVsmMqk9kgtMNZWEkdgaHqzEqvbAX
	lVW4IlLMUYlY5qNSQ/lk/SsbrIrLwGpe2JLfxSVNlv8kUbd6aMZxj2Y2/d5mtjVln/kqyIcKwcm
	CjKM98=
X-Google-Smtp-Source: AGHT+IGsE6XYuj07YI8cjblvrq8SGn1DnsG67xH+X37SLFiV/u8M5KrXQaAtDgvGMWeqYvhi+0m12ObGpjx14cqy5W0=
X-Received: by 2002:a17:902:cf0b:b0:234:8a4a:ad89 with SMTP id
 d9443c01a7336-242c29cdd45mr51552235ad.1.1754666013387; Fri, 08 Aug 2025
 08:13:33 -0700 (PDT)
MIME-Version: 1.0
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech> <20250808140314.1170-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-2-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Fri, 8 Aug 2025 16:13:22 +0100
X-Gm-Features: Ac12FXwtLLD67MmOT_J1-4DvRB_hSUowpxyn6cUGvqUsO_nvymxZDXIsfRaBXM8
Message-ID: <CAC_UY88fiU+Sp_vC4DY3kWMkm4fy39CHXTHCkTV2ZxqJhqBiHw@mail.gmail.com>
Subject: Re: [PATCH v4 01/18] Collapse skipped template lines
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="0000000000006da21a063bdc04d5"

--0000000000006da21a063bdc04d5
Content-Type: text/plain; charset="UTF-8"

The previous comparison can be wrong now, as the code iterates over the
replacements.

if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Contains($key))) {

$line could be null on the next iteration after $line = $null gets assigned

Owen

--0000000000006da21a063bdc04d5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace">The previous comparison can be wrong now, as the code i=
terates over the replacements.</div><div class=3D"gmail_default" style=3D"f=
ont-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-=
family:monospace">if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Conta=
ins($key))) {<br><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:monospace">$line could be null on the next iteration after $line =3D $nul=
l gets assigned</div><div class=3D"gmail_default" style=3D"font-family:mono=
space"><br></div><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Owen</div></div></div>

--0000000000006da21a063bdc04d5--


From win-pv-devel-bounces@lists.xenproject.org Fri Aug 08 15:49:14 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Aug 2025 15:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1074826.1437316 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukPLF-00076q-CH; Fri, 08 Aug 2025 15:49:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1074826.1437316; Fri, 08 Aug 2025 15:49:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ukPLF-00076j-9i; Fri, 08 Aug 2025 15:49:13 +0000
Received: by outflank-mailman (input) for mailman id 1074826;
 Fri, 08 Aug 2025 15:49:12 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dLES=2U=bounce.vates.tech=bounce-md_30504962.68961c73.v1-c06b5dbe8acd49cbbb5f1cef0a466f2b@srs-se1.protection.inumbo.net>)
 id 1ukPLD-00076d-WC
 for win-pv-devel@lists.xenproject.org; Fri, 08 Aug 2025 15:49:12 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 3874c305-746f-11f0-b898-0df219b8e170;
 Fri, 08 Aug 2025 17:49:09 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4bz7kC6kCdzS62Gq0
 for <win-pv-devel@lists.xenproject.org>; Fri,  8 Aug 2025 15:49:07 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c06b5dbe8acd49cbbb5f1cef0a466f2b; Fri, 08 Aug 2025 15:49:07 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3874c305-746f-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754668147; x=1754938147;
	bh=Dx6kcGk1WccYLmTbbLqt3Tl3T4J4wgaI+3tWyAZcLgM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=QKOT/+XHUtL7C63V+yKdm7Zz5z3zE5vEcMpa8OcvRXubw1LFZ6L4iL8c8AUzsmYDA
	 ogjVTrXANvLRwq66yev1+cj7B1Nw8AeZ42ksPp+QGXnzP4DuWCADQdpw7e52qLCIWF
	 OGZqE8HEHQAYtPFmY4SiRh1LhvQKrINOpeaTVaz3DQNubO4olV2yYAf7Alc/DWcGEB
	 eZbhL08FcB28Wx8gPihdMlofdPseqDClbtkP5gKrGgboWAxrS3g9e5FmUIpaLruL0r
	 m1pijbbgSL9StmZ9sYgjuDfyJXO8ZRKOB0JtHF6Hc6UMiUpzJAFwqGdeUX0cD//byB
	 AiC30suXNqaFA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754668147; x=1754928647; i=ngoc-tu.dinh@vates.tech;
	bh=Dx6kcGk1WccYLmTbbLqt3Tl3T4J4wgaI+3tWyAZcLgM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=sJaL2ZAFQ4B//FtBw8nJZAMi+xiBjmYMvmiOrsDgPG5oOZ83MkyCbS3+sbtDYKyXz
	 KK7Wv7lGLl5bJkNh3zUomFmieTXPCHO7dhMjsNzEeEOyg3xKNS84pQzbGJlHnyewhG
	 sYO+gU+VXNWuhQQbnpBo5TLMch3FNGsSm/aV14DXiYGNf2VNamweSRKO5ZWb2P4f4J
	 6HelvDjKDMLYLW3wsrfohAMMB5fazEIeR7uXxpOVOaKtGPmOj1la4BQBc1ImHCYBkW
	 g3Oe+77J3tw4g4LOfCi/Tz+/nUJmXDOCRyzBIoImZtkAL1HoB2I849qmKQIh4ma1Fp
	 Ua9W+FJtrxt1Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v5]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754668147011
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250808154859.216-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <CAC_UY88fiU+Sp_vC4DY3kWMkm4fy39CHXTHCkTV2ZxqJhqBiHw@mail.gmail.com>
References: <CAC_UY88fiU+Sp_vC4DY3kWMkm4fy39CHXTHCkTV2ZxqJhqBiHw@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c06b5dbe8acd49cbbb5f1cef0a466f2b?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250808:md
Date: Fri, 08 Aug 2025 15:49:07 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 4c58f03..be12087 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -27,12 +27,15 @@ Function Copy-FileWithReplacements {
 	ForEach-Object {
 		$line = $_
 		$Replacements.GetEnumerator() | ForEach-Object {
-			$key = [string]::Format("{0}{1}{2}", $Token, $_.Name, $Token)
-			if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Contains($key))) {
-				Write-Host "Skipping Line Containing " $_.Name
-				$line = $null
+			if ($null -ne $line) {
+				$key = [string]::Format("{0}{1}{2}", $Token, $_.Name, $Token)
+				if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Contains($key))) {
+					Write-Host "Skipping Line Containing " $_.Name
+					$line = $null
+				} else {
+					$line = $line -replace $key, $_.Value
+				}
 			}
-			$line = $line -replace $key, $_.Value
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 11 06:59:18 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 11 Aug 2025 06:59:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1076924.1438031 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulMV1-0000KH-Gw; Mon, 11 Aug 2025 06:59:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1076924.1438031; Mon, 11 Aug 2025 06:59:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulMV1-0000K8-Dd; Mon, 11 Aug 2025 06:59:15 +0000
Received: by outflank-mailman (input) for mailman id 1076924;
 Mon, 11 Aug 2025 06:59:13 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ToB7=2X=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1ulMUz-0000K2-SX
 for win-pv-devel@lists.xenproject.org; Mon, 11 Aug 2025 06:59:13 +0000
Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com
 [2a00:1450:4864:20::531])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id af1a08d7-7680-11f0-a325-13f23c93f187;
 Mon, 11 Aug 2025 08:59:12 +0200 (CEST)
Received: by mail-ed1-x531.google.com with SMTP id
 4fb4d7f45d1cf-6157c81ff9eso6162924a12.3
 for <win-pv-devel@lists.xenproject.org>; Sun, 10 Aug 2025 23:59:11 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-af91ee3c1f7sm1905627266b.68.2025.08.10.23.59.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 10 Aug 2025 23:59:09 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: af1a08d7-7680-11f0-a325-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1754895551; x=1755500351; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to;
        bh=OoDvAn8FVdFoh17i6WTQE8JpHVvVUCH32GQygE2RaQs=;
        b=Zzw2CLj2r3ruPYeP6/Q/aPhQNSj7COty5ULsEAbjQM2rWjz412k5FuJD67azaCbiS1
         G5wr5L40eZOLgEKMHR7pX5SavW7ob935c7hqTtXah8fBlsTEsD2t7MFifmRNkEUevlKB
         ZTCCZHeJZjVKwUzjM95gaIBEHnZD8IKUOvfLg=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1754895551; x=1755500351;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=OoDvAn8FVdFoh17i6WTQE8JpHVvVUCH32GQygE2RaQs=;
        b=YTBT2kt/S1+8JdOqY5qUKG2Xwbn3tQIRFlPxTXElNkPJhqTKxw4mZBQ5bR9+DjTEKf
         qjQjCwJwPo/7iIiFPevULLPdkYPErklAIx2yz6wEoTdYQO23vJmjDPSLE0iDJQApnKH7
         t6sQ5YKc5pkttf8Y8x8z4152yMSRn/26pfESZ4QOrMxJRXkaqMLSoJZR/tQm5EDnlV4D
         iDrd1iD3hRIz7XPEwxE48sbBDojW81SYo4aoPHbW+pQ8ev8+QmdjQ4lh8J54d1OGtNvP
         lSS7r3nI60LbrZqdnAKl/uZe0Bna31dJWZhu2kQaeSsN44AT5I/jLd2TkM3dwTto9/QG
         0SYA==
X-Gm-Message-State: AOJu0YxAXO6+dCcoeSgHciJ7on+6zhDtbzQAqG7SbNrWm32BstSNXLlk
	V3NutJ9340lBhcRrQIvEErethud02twCZEcK32BiYqV+o3X0MVjf5T/DlElLELus/V06T9VVqRQ
	J3g0=
X-Gm-Gg: ASbGncuIN7Vn5QIY/QKOzuezcD/4SCy+NDyZQE9UgDjw2g3RVp6OBk92OUZGZw1n6rT
	L84xiyxGruY/MCTr1/6BwrxsaWYg2XlEMs2j7bOaKO90P51rUvTTpxXnZFgqq2WEm08QE2m+AjG
	v1i2LkkVvZEu0SogCik4+gM+ZnupWVUHaOz4WmmpMklLABXZ6wAzUCwj/hkkWwMNxexkakbmI0W
	SUgibIhXK2U0kyQ/4k1QDu/l5grXyILKspozqPyEAwXxfzqD4v02a+wneniidWO1xlqUtyZRLzZ
	a5dKVabcsA3gWjflidYM3l/E+PaMn7VngtXF/RQOwC0qFfgQzU+rJebevsBjR58IqZbj7CptbXs
	ta3IzNJlhbVgS89E8SQbBdrDOLXguoSIvoZK6BExWE9uG97pCkCyBJuOe/QU9PIuK
X-Google-Smtp-Source: AGHT+IEhgajcL2TWpytD+QDPErcnp0i7iYu662ueuISDjf9/bW/sgl7mfPhDW/oXOXRZY3rN8B3ATA==
X-Received: by 2002:a17:907:3c88:b0:af9:237c:bb1c with SMTP id a640c23a62f3a-af9c64f446bmr1219311666b.43.1754895550612;
        Sun, 10 Aug 2025 23:59:10 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] Avoid AdapterDisable bugcheck on a disabled Adapter
Date: Mon, 11 Aug 2025 07:59:02 +0100
Message-ID: <20250811065902.1308-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
In-Reply-To: <abe86f56-585b-41b4-912b-a73a383ae153@vates.tech>
References: <abe86f56-585b-41b4-912b-a73a383ae153@vates.tech>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

MiniportShutdownEx maybe called when the miniport is in any state, including
the Paused state after MiniportPause. Both MiniportPause and MiniportShutdownEx
call AdapterDisable. The first call will unregister the suspend callback, and
the second call will bugcheck, as the SuspendCallbackLate handle is now NULL.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xennet/adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index 67ced3e..cbca7f0 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -1964,7 +1964,8 @@ AdapterDisable(
     IN  PXENNET_ADAPTER     Adapter
     )
 {
-    ASSERT(Adapter->Enabled);
+    if (!Adapter->Enabled)
+        return;
     Adapter->Enabled = FALSE;
 
     ReceiverDisable(Adapter->Receiver);
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 11 09:11:49 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 11 Aug 2025 09:11:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1077136.1438214 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulOZG-0002kp-P0; Mon, 11 Aug 2025 09:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1077136.1438214; Mon, 11 Aug 2025 09:11:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulOZG-0002ki-MV; Mon, 11 Aug 2025 09:11:46 +0000
Received: by outflank-mailman (input) for mailman id 1077136;
 Mon, 11 Aug 2025 09:11:45 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iwno=2X=bounce.vates.tech=bounce-md_30504962.6899b3cd.v1-bc6875123191419fa7bcd5c4ff755500@srs-se1.protection.inumbo.net>)
 id 1ulOZF-0002kc-5e
 for win-pv-devel@lists.xenproject.org; Mon, 11 Aug 2025 09:11:45 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 326fc040-7693-11f0-a325-13f23c93f187;
 Mon, 11 Aug 2025 11:11:43 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c0pmF48ywz1XLJLy
 for <win-pv-devel@lists.xenproject.org>; Mon, 11 Aug 2025 09:11:41 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 bc6875123191419fa7bcd5c4ff755500; Mon, 11 Aug 2025 09:11:41 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 326fc040-7693-11f0-a325-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754903501; x=1755173501;
	bh=VdDUV1n3sWrb1wxo51CH9em/R5ut6Vi9Ft9F82IKEnw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=q+njHXbAPNRfeFArGG6vrPjmLxr+LMBwFVGHeS4eXtP2NavrshX7abRAxVAJAXdCO
	 u4BwqmqJa6XgMI3il2Z5m82fAajXT08p7LviwPEaF7IoItTwF66yHi8H35oqQs9cBz
	 zDDVfweK98DToKnaNQsYU7fLQfq2a7Vl4cME0Nq0Hmjy3+o1uyVKVIaOwkre7G7P/o
	 q9BqQH/cZUwbUOMAaHy7hDq7T64pCsuIoRuDQLxa4Fz1XzGBeOvxSpDjUJB5wrTOi4
	 zpE+ZGz8pTHF+Ki5bKSFCljdWNstAL9U1IXZMZz63tJsecQYLQjo5lu9VzCuraAqH+
	 8Bdejb/uPQbjQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754903501; x=1755164001; i=ngoc-tu.dinh@vates.tech;
	bh=VdDUV1n3sWrb1wxo51CH9em/R5ut6Vi9Ft9F82IKEnw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=krxHljcjZ8hXn5fppsYZcY2lgCh8o2uhAtoJIq4sIMOy7MTrPCBAcFoHDw5kzIyhY
	 gwu3VpskJUfQkvczikdzvCEd6KmxkD4cxMgbBx6HwdC6iCunR4ikfkhI05OoQeKR1q
	 KHSWkR9+fF2pnNYnAZITzot/v+3oqXr0sNNoVeYAsCxvuBOe0VWze9hDBF5EsVgFcn
	 ITwqpIt67kQvirvFTBXphaIIzcnGPb0CVcHQf9r5eHx8TVcoAEN4sMF6tAbDj1EdXl
	 09OlyAJHe+LwPEefNqKzIixrGexSQDo/JvP4WxsCJ3L5XXFg4wjsbBkIhrB/EADiX7
	 IBERxkj15I3aA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Avoid=20AdapterDisable=20bugcheck=20on=20a=20disabled=20Adapter?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754903500831
Message-Id: <3ab7796c-67ac-4c2b-bd41-c9a3f9cee732@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <abe86f56-585b-41b4-912b-a73a383ae153@vates.tech> <20250811065902.1308-1-owen.smith@cloud.com>
In-Reply-To: <20250811065902.1308-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.bc6875123191419fa7bcd5c4ff755500?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250811:md
Date: Mon, 11 Aug 2025 09:11:41 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 11/08/2025 08:59, Owen Smith wrote:
> MiniportShutdownEx maybe called when the miniport is in any state, including
> the Paused state after MiniportPause. Both MiniportPause and MiniportShutdownEx
> call AdapterDisable. The first call will unregister the suspend callback, and
> the second call will bugcheck, as the SuspendCallbackLate handle is now NULL.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xennet/adapter.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
> index 67ced3e..cbca7f0 100644
> --- a/src/xennet/adapter.c
> +++ b/src/xennet/adapter.c
> @@ -1964,7 +1964,8 @@ AdapterDisable(
>       IN  PXENNET_ADAPTER     Adapter
>       )
>   {
> -    ASSERT(Adapter->Enabled);
> +    if (!Adapter->Enabled)
> +        return;
>       Adapter->Enabled = FALSE;
>   
>       ReceiverDisable(Adapter->Receiver);

Thanks,

Reviewed-by: Tu Dinh <ngoc-tu.dinh@vates.tech>


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 11 10:43:03 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 11 Aug 2025 10:43:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1077262.1438329 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulPzZ-0003Ap-GV; Mon, 11 Aug 2025 10:43:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1077262.1438329; Mon, 11 Aug 2025 10:43:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulPzZ-0003Ai-Dm; Mon, 11 Aug 2025 10:43:01 +0000
Received: by outflank-mailman (input) for mailman id 1077262;
 Mon, 11 Aug 2025 10:42:59 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NaX7=2X=bounce.vates.tech=bounce-md_30504962.6899c92f.v1-1719f7ab7cbf41aa81527cbd052051c4@srs-se1.protection.inumbo.net>)
 id 1ulPzX-0003Ac-FS
 for win-pv-devel@lists.xenproject.org; Mon, 11 Aug 2025 10:42:59 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id f12bb55f-769f-11f0-a325-13f23c93f187;
 Mon, 11 Aug 2025 12:42:57 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c0rnW5gMcz1XLF57
 for <win-pv-devel@lists.xenproject.org>; Mon, 11 Aug 2025 10:42:55 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 1719f7ab7cbf41aa81527cbd052051c4; Mon, 11 Aug 2025 10:42:55 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f12bb55f-769f-11f0-a325-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1754908975; x=1755178975;
	bh=2+Ma7HerTQ4tDqdUzwS1UNB2f3TSAn7Iu+lG8k6yyCg=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=0QTeMougBGSSGhNvQUt4Zr36c73P8X3OkkCanfomG8+LFCjJ7ROq8Nn0k0hPvxojs
	 e+JAqDRtInSSQWWYUDXLDhEgnzgLQiuu2RHyCXTIu51eCSKnlCexl2CqmbhEFVyRpE
	 TY8bI5qQT57j/nZNu0ihO4fwiJCYKaCYmV2n6OiHnEslvkuf9i+QgKpBYIF9qzdMok
	 DhS+NsvE7q0cv85bYmlu7F8+FK+5kt6KAi3nwt3bsPBYSxxdh/UK89Nm/RtX+gTNgM
	 ZjusWenwZMXl7N7M/41nl851A0d9W2yF2i63kNteUfpbSwAi/52bCtTzlfVH7gU1i6
	 Fm8UKyJ6Yf9SQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1754908975; x=1755169475; i=ngoc-tu.dinh@vates.tech;
	bh=2+Ma7HerTQ4tDqdUzwS1UNB2f3TSAn7Iu+lG8k6yyCg=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=qx/esgoS3SXXGsNMZ+0hEmu+q6AU/I7kqSY/EaXppvE/rSXc/5TRURmIaL4Ne4puN
	 5bcUSa2+RHqzFSoyiXQfmvAYCiltleuvomYs49gzCwAlSLR3Iy0qGDqlBGgVdXTeIA
	 obW09GYX/LmGnFAO+DHzNR+yt17uflZzCBHkkyE9LczAiPqf5RuxjxyHNP3UTcH+Sd
	 ZvAfeHjzaL3K10RW4D3CRst0zFkYPHn3vsopIGiw846Lob5U9ovH+E0MsLNtTsv4/+
	 Cl/BJkoMW3YnAUoRYScmTBcxTSlgYuOq+Ehi84Ru4UXDgODWY6gSq/PcPGaddoF4DY
	 wm5OLTjX0C6zQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v5]=20Add=20EMULATED=20v3?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1754908974986
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250811104251.1833-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <CAC_UY89G1wJ9N6w1M=zA74WwycuhtOvDpVx_dyxe3bcDzWinEw@mail.gmail.com>
References: <CAC_UY89G1wJ9N6w1M=zA74WwycuhtOvDpVx_dyxe3bcDzWinEw@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.1719f7ab7cbf41aa81527cbd052051c4?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250811:md
Date: Mon, 11 Aug 2025 10:42:55 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow querying the current active device's forced-activation status by
calling EmulatedIsDevicePresent with DeviceID=NULL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h |  51 +++++++++++++---
 include/revision.h           |   3 +-
 src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++++++-------
 src/xenfilt/emulated.h       |  13 ++--
 src/xenfilt/fdo.c            |   6 +-
 src/xenfilt/pdo.c            |   1 +
 6 files changed, 148 insertions(+), 41 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index 86a9e06..7d47707 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -72,7 +72,7 @@ typedef VOID
     _In_ PINTERFACE Interface
     );
 
-/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT_V1
     \brief Determine whether a given device is present in the VM
 
     \param Interface The interface header
@@ -83,12 +83,33 @@ typedef VOID
     FALSE if it is not
 */
 typedef BOOLEAN
-(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT_V1)(
     _In_ PVOID      Context,
     _In_ PSTR       DeviceID,
     _In_opt_ PSTR   InstanceID
     );
 
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+    \brief Determine whether a given device is present in the VM
+
+    \param Interface The interface header
+    \param DeviceID The DeviceID of the device, or NULL to query the force-
+           activated device
+    \param InstanceID The (un-prefixed) InstanceID of the device or
+           NULL to match any device instance
+    \param IsForceActivated If the device was force-activated, force-deactivated
+           or otherwise.
+    \return TRUE if the specified device is present in the system or
+            FALSE if it is not
+*/
+typedef BOOLEAN
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+    _In_ PVOID                                      Context,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
+    );
+
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DISK_PRESENT_V1)(
     _In_ PVOID  Context,
@@ -120,11 +141,11 @@ DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V1 {
-    INTERFACE                           Interface;
-    XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
-    XENFILT_EMULATED_RELEASE            EmulatedRelease;
-    XENFILT_EMULATED_IS_DEVICE_PRESENT  EmulatedIsDevicePresent;
-    XENFILT_EMULATED_IS_DISK_PRESENT_V1 EmulatedIsDiskPresentVersion1;
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT_V1     EmulatedIsDiskPresentVersion1;
 };
 
 /*! \struct _XENFILT_EMULATED_INTERFACE_V2
@@ -132,6 +153,18 @@ struct _XENFILT_EMULATED_INTERFACE_V1 {
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V2 {
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT        EmulatedIsDiskPresent;
+};
+
+/*! \struct _XENFILT_EMULATED_INTERFACE_V3
+    \brief EMULATED interface version 3
+    \ingroup interfaces
+*/
+struct _XENFILT_EMULATED_INTERFACE_V3 {
     INTERFACE                           Interface;
     XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
     XENFILT_EMULATED_RELEASE            EmulatedRelease;
@@ -139,7 +172,7 @@ struct _XENFILT_EMULATED_INTERFACE_V2 {
     XENFILT_EMULATED_IS_DISK_PRESENT    EmulatedIsDiskPresent;
 };
 
-typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
+typedef struct _XENFILT_EMULATED_INTERFACE_V3 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
 
 /*! \def XENFILT_EMULATED
     \brief Macro at assist in method invocation
@@ -150,6 +183,6 @@ typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENF
 #endif  // _WINDLL
 
 #define XENFILT_EMULATED_INTERFACE_VERSION_MIN  1
-#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  2
+#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  3
 
 #endif  // _XENFILT_EMULATED_INTERFACE_H
diff --git a/include/revision.h b/include/revision.h
index e9e62e6..a63e550 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -51,6 +51,7 @@
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2)
+    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2), \
+    DEFINE_REVISION(0x0900000C,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  3)
 
 #endif  // _REVISION_H
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index 9065364..4205cc5 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -45,9 +45,10 @@
 #define MAXNAMELEN  128
 
 typedef struct _XENFILT_EMULATED_DEVICE_DATA {
-    CHAR    DeviceID[MAXNAMELEN];
-    CHAR    InstanceID[MAXNAMELEN];
-    CHAR    CompatibleID[MAXNAMELEN];
+    CHAR                                DeviceID[MAXNAMELEN];
+    CHAR                                InstanceID[MAXNAMELEN];
+    CHAR                                CompatibleID[MAXNAMELEN];
+    XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 } XENFILT_EMULATED_DEVICE_DATA, *PXENFILT_EMULATED_DEVICE_DATA;
 
 typedef struct _XENFILT_EMULATED_DISK_DATA {
@@ -222,16 +223,17 @@ fail1:
 
 NTSTATUS
 EmulatedAddObject(
-    _In_ PXENFILT_EMULATED_CONTEXT      Context,
-    _In_ PSTR                           DeviceID,
-    _In_ PSTR                           InstanceID,
-    _In_opt_ PSTR                       CompatibleIDs,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
-    _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT          Context,
+    _In_ PSTR                               DeviceID,
+    _In_ PSTR                               InstanceID,
+    _In_opt_ PSTR                           CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate,
+    _Outptr_ PXENFILT_EMULATED_OBJECT       *EmulatedObject
     )
 {
-    KIRQL                               Irql;
-    NTSTATUS                            status;
+    KIRQL                                   Irql;
+    NTSTATUS                                status;
 
     Trace("====>\n");
 
@@ -267,6 +269,8 @@ EmulatedAddObject(
         goto fail2;
 
     (*EmulatedObject)->Type = Type;
+    if (Type == XENFILT_EMULATED_OBJECT_TYPE_PCI)
+        (*EmulatedObject)->Data.Device.ForceActivate = ForceActivate;
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
     InsertTailList(&Context->List, &(*EmulatedObject)->ListEntry);
@@ -302,36 +306,66 @@ EmulatedRemoveObject(
     __EmulatedFree(EmulatedObject);
 }
 
+static inline BOOLEAN
+EmulatedDeviceMatchesDeviceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       DeviceID
+    )
+{
+    // EmulatedIsDevicePresent: DeviceID == NULL matches the force-activated device
+    if (DeviceID)
+        return _stricmp(DeviceID, Device->DeviceID) == 0;
+    else
+        return Device->ForceActivate == XENBUS_EMULATED_FORCE_ACTIVATED;
+}
+
+static inline BOOLEAN
+EmulatedDeviceMatchesInstanceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       InstanceID
+    )
+{
+    // EmulatedIsDevicePresent: InstanceID == NULL matches any device instance
+    return InstanceID == NULL || _stricmp(InstanceID, Device->InstanceID) == 0;
+}
+
 static BOOLEAN
 EmulatedIsDevicePresent(
-    _In_ PINTERFACE             Interface,
-    _In_ PSTR                   DeviceID,
-    _In_opt_ PSTR               InstanceID
+    _In_ PINTERFACE                                 Interface,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
     )
 {
-    PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
-    KIRQL                       Irql;
-    PLIST_ENTRY                 ListEntry;
+    PXENFILT_EMULATED_CONTEXT                       Context = Interface->Context;
+    KIRQL                                           Irql;
+    PLIST_ENTRY                                     ListEntry;
 
     Trace("====> (%s %s)\n",
-          DeviceID,
+          (DeviceID != NULL) ? DeviceID : "ACTIVE",
           (InstanceID != NULL) ? InstanceID : "ANY");
 
+    if (IsForceActivated)
+        *IsForceActivated = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
     KeAcquireSpinLock(&Context->Lock, &Irql);
 
     ListEntry = Context->List.Flink;
     while (ListEntry != &Context->List) {
-        PXENFILT_EMULATED_OBJECT    EmulatedObject;
+        PXENFILT_EMULATED_OBJECT        EmulatedObject;
+        PXENFILT_EMULATED_DEVICE_DATA   Device;
 
         EmulatedObject = CONTAINING_RECORD(ListEntry,
                                            XENFILT_EMULATED_OBJECT,
                                            ListEntry);
+        Device = &EmulatedObject->Data.Device;
 
         if (EmulatedObject->Type == XENFILT_EMULATED_OBJECT_TYPE_PCI &&
-            _stricmp(DeviceID, EmulatedObject->Data.Device.DeviceID) == 0 &&
-            (InstanceID == NULL ||
-             _stricmp(InstanceID, EmulatedObject->Data.Device.InstanceID) == 0)) {
+            EmulatedDeviceMatchesDeviceID(Device, DeviceID) &&
+            EmulatedDeviceMatchesInstanceID(Device, InstanceID)) {
             Trace("FOUND\n");
+            if (IsForceActivated)
+                *IsForceActivated = Device->ForceActivate;
             break;
         }
 
@@ -345,6 +379,16 @@ EmulatedIsDevicePresent(
     return (ListEntry != &Context->List) ? TRUE : FALSE;
 }
 
+static BOOLEAN
+EmulatedIsDevicePresentVersion1(
+    _In_ PINTERFACE             Interface,
+    _In_ PSTR                   DeviceID,
+    _In_opt_ PSTR               InstanceID
+    )
+{
+    return EmulatedIsDevicePresent(Interface, DeviceID, InstanceID, NULL);
+}
+
 static BOOLEAN
 EmulatedIsDiskPresent(
     _In_ PINTERFACE             Interface,
@@ -454,7 +498,7 @@ static struct _XENFILT_EMULATED_INTERFACE_V1 EmulatedInterfaceVersion1 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V1), 1, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
-    EmulatedIsDevicePresent,
+    EmulatedIsDevicePresentVersion1,
     EmulatedIsDiskPresentVersion1
 };
 
@@ -462,6 +506,14 @@ static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
+    EmulatedIsDevicePresentVersion1,
+    EmulatedIsDiskPresent
+};
+
+static struct _XENFILT_EMULATED_INTERFACE_V3 EmulatedInterfaceVersion3 = {
+    { sizeof (struct _XENFILT_EMULATED_INTERFACE_V3), 3, NULL, NULL, NULL },
+    EmulatedAcquire,
+    EmulatedRelease,
     EmulatedIsDevicePresent,
     EmulatedIsDiskPresent
 };
@@ -541,6 +593,23 @@ EmulatedGetInterface(
         status = STATUS_SUCCESS;
         break;
     }
+    case 3: {
+        struct _XENFILT_EMULATED_INTERFACE_V3   *EmulatedInterface;
+
+        EmulatedInterface = (struct _XENFILT_EMULATED_INTERFACE_V3 *)Interface;
+
+        status = STATUS_BUFFER_OVERFLOW;
+        if (Size < sizeof (struct _XENFILT_EMULATED_INTERFACE_V3))
+            break;
+
+        *EmulatedInterface = EmulatedInterfaceVersion3;
+
+        ASSERT3U(Interface->Version, ==, Version);
+        Interface->Context = Context;
+
+        status = STATUS_SUCCESS;
+        break;
+    }
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
index 9b02268..c60020f 100644
--- a/src/xenfilt/emulated.h
+++ b/src/xenfilt/emulated.h
@@ -67,12 +67,13 @@ EmulatedTeardown(
 
 extern NTSTATUS
 EmulatedAddObject(
-    _In_ PXENFILT_EMULATED_CONTEXT      Context,
-    _In_ PSTR                           DeviceID,
-    _In_ PSTR                           InstanceID,
-    _In_opt_ PSTR                       CompatibleIDs,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
-    _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT          Context,
+    _In_ PSTR                               DeviceID,
+    _In_ PSTR                               InstanceID,
+    _In_opt_ PSTR                           CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate,
+    _Outptr_ PXENFILT_EMULATED_OBJECT       *EmulatedObject
     );
 
 extern VOID
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 87302bb..ad57c95 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -478,13 +478,15 @@ FdoEnumerate(
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate =
-                                                XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 
             if (Precedence > 0)
                 ForceActivate = Index == ActiveIndex ?
                                 XENBUS_EMULATED_FORCE_ACTIVATED :
                                 XENBUS_EMULATED_FORCE_DEACTIVATED;
+            else
+                ForceActivate = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
             (VOID) PdoCreate(Fdo,
                              PhysicalDeviceObject[Index],
                              Fdo->Type,
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 58c9ef0..5327230 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -1701,6 +1701,7 @@ PdoCreate(
                                __PdoGetInstanceID(Pdo),
                                CompatibleIDs,
                                __PdoGetType(Pdo),
+                               ForceActivate,
                                &Pdo->EmulatedObject);
     if (!NT_SUCCESS(status))
         goto fail5;
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Tue Aug 12 16:14:49 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 12 Aug 2025 16:14:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1078897.1439925 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulreA-0003gg-Ro; Tue, 12 Aug 2025 16:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1078897.1439925; Tue, 12 Aug 2025 16:14:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1ulreA-0003gZ-PH; Tue, 12 Aug 2025 16:14:46 +0000
Received: by outflank-mailman (input) for mailman id 1078897;
 Tue, 12 Aug 2025 16:14:46 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=6yfn=2Y=bounce.vates.tech=bounce-md_30504962.689b6871.v1-d150c2f9a17540b6afb765d7fe2fdf30@srs-se1.protection.inumbo.net>)
 id 1ulre9-0003gT-Td
 for win-pv-devel@lists.xenproject.org; Tue, 12 Aug 2025 16:14:46 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 7451c1ac-7797-11f0-a327-13f23c93f187;
 Tue, 12 Aug 2025 18:14:44 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c1c5s2zLjz1XLF3m
 for <win-pv-devel@lists.xenproject.org>; Tue, 12 Aug 2025 16:14:41 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d150c2f9a17540b6afb765d7fe2fdf30; Tue, 12 Aug 2025 16:14:41 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7451c1ac-7797-11f0-a327-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755015281; x=1755285281;
	bh=hT2cTNYAzE5Yn0CRRKFUzRNEOyE6LeHi5LDtFEQvN9w=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=O6allfiPeNTMFATy8jK37LbbZdODHnVl5MOhigukEw82rEGxqjNwkvZpB6pqVHKKr
	 oL6HEMTlkjcJb1GNZ6rj0IxUHama0xAbpMSyLZiYcebBlJru8rHBIiwDBiR534KZHn
	 qB5Hr/Wk+10n0FllJEcBbe3M/iigXPh1EbtVWLfL1XZZwMhqJJxqjzAJooLWzDaStM
	 G5tpVp7Agrj1vsf3zE3AMwWljAoap+0ogTtK8J3v+YuZ9DVxFe+P2gTYYeLWIYKB/W
	 WbsIg1rVLkuXjLWLV8CcwCkuCWodYSyXZRGTjdj3gxX0TFZaCoqxvtbPS7V+gdnD9E
	 thBwQMw/FrSAA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755015281; x=1755275781; i=ngoc-tu.dinh@vates.tech;
	bh=hT2cTNYAzE5Yn0CRRKFUzRNEOyE6LeHi5LDtFEQvN9w=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=mRpU2ao0zhEmM6vJAPaNdHCv09g3LQPmkzTXtUWWDG4XaRUkcmtZUjqSkpAtiOpkH
	 6dYc6fdwzsviSYZ9MblN4Ojm2ijEzXlhrJqVJmutHgPYI5Wv+wuRyuB588LWxYa2aW
	 RbYJCTySS2vOzMg2wIzitnxqqKNodJJpRKHfAMAIPkYqjgUaWi8zHFK72WWqWkpCOc
	 qF2HTtaSGqC3+cZo6PTOrX9OGqDEF0Q9pt9g9a08Z5cej03cd+wcwVjPqwqi7hMa5Y
	 v076OXwg+xl96hxB/E0uEKqTx7WT21Bn50SDCLaWdKgAp3ESVdZloIvH3Ssvw1YVUe
	 9dk91MKlAlpcg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=20v4=2007/11]=20xenfilt:=20Add=20Xenbus=20device=20precedence=20mechanism?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755015280542
Message-Id: <c3f80d79-4920-4dab-b53d-78ac653f936c@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech> <20250808140314.1170-8-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-8-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d150c2f9a17540b6afb765d7fe2fdf30?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250812:md
Date: Tue, 12 Aug 2025 16:14:41 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 08/08/2025 16:03, Tu Dinh wrote:
> Define registry values in xenfilt\Parameters with the names being
> compatible IDs and values being numeric precedences.
> 
> The Xenbus device with the highest precedence should always be activated
> over devices with lower precedence, ignoring Active* values.
> 
> If a device is force-activated, get its IDs directly instead of via
> Active* values.
> 
> Define XENBUS_EMULATED_ACTIVATION_STATUS in emulated_interface.h for
> latter use.
> 
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---

I wonder if it's better to move the precedence values to a dedicated key 
under Parameters, e.g. xenfilt\Parameters\Precedence.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 08:03:08 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 08:03:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079535.1440351 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1um6Ru-0005W3-9E; Wed, 13 Aug 2025 08:03:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079535.1440351; Wed, 13 Aug 2025 08:03:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1um6Ru-0005Vw-6T; Wed, 13 Aug 2025 08:03:06 +0000
Received: by outflank-mailman (input) for mailman id 1079535;
 Wed, 13 Aug 2025 08:03:04 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=A5Bz=2Z=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1um6Rs-0005Vq-BV
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 08:03:04 +0000
Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com
 [2607:f8b0:4864:20::531])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id ef86f7f7-781b-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 10:03:03 +0200 (CEST)
Received: by mail-pg1-x531.google.com with SMTP id
 41be03b00d2f7-b271f3ae786so5181682a12.3
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 01:03:03 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ef86f7f7-781b-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755072182; x=1755676982; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=HkokvEDCsrK4c0gavhKE9kchBjJmmhRQvqvFLp8pCjo=;
        b=Fz5UziUydbvkBRRzCs4t0a7katfPBR1ZOBA3aMbCWrzEufcwQUUIWqqPQ+4nB78cEr
         Iq4exbr/FwwNLDotxY8y4Mc7ShGLrnlfCvpni3M7wiCCeIfRsqRLB3c2iJ0/MOm3a+7U
         HMmJnPQg8HOLBd1IZ1l+KiAF8FtLO2VavV53o=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755072182; x=1755676982;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=HkokvEDCsrK4c0gavhKE9kchBjJmmhRQvqvFLp8pCjo=;
        b=nDX+uGI7na52t9XwwjqFfnCaZWZKOGyIYt+OL0Y8Dkq914NU9OWo7O+GKgcBwIY3gs
         qoa2dBc8+exWvfMjT8dmp249t3yDwDhIYo3GPk7+OjTDpwpuHN1bNrmaML9Y64ew6Hzw
         zQE0XEFrzseUyMlmK+oy+YH05BFUfHWDtelK2cZOwnjR7rtcttliRLfeYjy8oBzOfDB0
         gNmn0JFCTk+XFeGNOA6znA0J5Y2gnRKEvY/BUko7Ro75hfvyfmCfAGz6P92aGtsPLkI3
         IQITspQta1e0Ocy+C0M7ml7aiBPd8FOZKe1Fv14RveBst84GfJgtpuXJSjUFeMX29BUb
         RiFg==
X-Gm-Message-State: AOJu0YwXALFBWb4rJzexGRivX4lNwPZ0a6LMUO86TEVhHQJbinymg6Kf
	eqSScZOT4QAJ/nyl/xrZhKOXwKRL80PXK6Q06QQTgLMafe2f3VshXAXjYzT+4MNWHJWELQSgDm5
	9ib2Z8U0mZxJcuNaBSjD2RJciYfhjNxQzXXyvYkcX4DysGi/O+Fs=
X-Gm-Gg: ASbGncsZ9Sz7rZ62zWUQRkcq/DgZ3+0tLD3Pi9qhkegR01NHfM/rZ06tbWQraVGoD3a
	hxozLtFqox8Gb+Jd8ZRSPL1oSCHjm8Cs8AlWEnJT71vVtvORTtneGWE4OTCHXITbDrraLrJOv2N
	Yeo6Sm33wPLNod6e7Jzn5w1B4PoMAiA17TU3cRdYRw0Qfau5TSHU4IAcn3+fsSCMRsXTrrcFe7e
	naTxaQ=
X-Google-Smtp-Source: AGHT+IGjTVnOXlPmlEQ1oJwHNOB1oVWSWptnl3bS7zqgoiPKvb8Fh/iRIfSyvVyUW6s4khxyp6Dhy9b5WYC/YFNzgBs=
X-Received: by 2002:a17:902:dac8:b0:234:1163:ff99 with SMTP id
 d9443c01a7336-2430d233efcmr35804665ad.43.1755072181819; Wed, 13 Aug 2025
 01:03:01 -0700 (PDT)
MIME-Version: 1.0
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
 <20250808140314.1170-8-ngoc-tu.dinh@vates.tech> <c3f80d79-4920-4dab-b53d-78ac653f936c@vates.tech>
In-Reply-To: <c3f80d79-4920-4dab-b53d-78ac653f936c@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 13 Aug 2025 09:02:50 +0100
X-Gm-Features: Ac12FXyd7NbSlrIK1wP4TlKxD5AVjnOsjRkFxAgZngw9P1C8vgE_ePSOWla-zPg
Message-ID: <CAC_UY8_=LriD5xwVW0__OZjE9uD1Evve51N=sRMwkPTVf8zGhA@mail.gmail.com>
Subject: Re: [XENBUS PATCH v4 07/11] xenfilt: Add Xenbus device precedence mechanism
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000f4022e063c3a9572"

--000000000000f4022e063c3a9572
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I think the separation here would be helpful - keeping the
precedence values separate from the parent-id to emulated type mappings
could help.

Owen

On Tue, Aug 12, 2025 at 5:14=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> On 08/08/2025 16:03, Tu Dinh wrote:
> > Define registry values in xenfilt\Parameters with the names being
> > compatible IDs and values being numeric precedences.
> >
> > The Xenbus device with the highest precedence should always be activate=
d
> > over devices with lower precedence, ignoring Active* values.
> >
> > If a device is force-activated, get its IDs directly instead of via
> > Active* values.
> >
> > Define XENBUS_EMULATED_ACTIVATION_STATUS in emulated_interface.h for
> > latter use.
> >
> > Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> > ---
>
> I wonder if it's better to move the precedence values to a dedicated key
> under Parameters, e.g. xenfilt\Parameters\Precedence.
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000f4022e063c3a9572
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">I think the separation here would be helpful - keeping the precedence=C2=
=A0values separate from the parent-id to emulated type mappings could help.=
<br><br>Owen</div></div><br><div class=3D"gmail_quote gmail_quote_container=
"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Aug 12, 2025 at 5:14=E2=80=
=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">On 08/08/2025 16:03, Tu Dinh wrote:<br=
>
&gt; Define registry values in xenfilt\Parameters with the names being<br>
&gt; compatible IDs and values being numeric precedences.<br>
&gt; <br>
&gt; The Xenbus device with the highest precedence should always be activat=
ed<br>
&gt; over devices with lower precedence, ignoring Active* values.<br>
&gt; <br>
&gt; If a device is force-activated, get its IDs directly instead of via<br=
>
&gt; Active* values.<br>
&gt; <br>
&gt; Define XENBUS_EMULATED_ACTIVATION_STATUS in emulated_interface.h for<b=
r>
&gt; latter use.<br>
&gt; <br>
&gt; Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
&gt; ---<br>
<br>
I wonder if it&#39;s better to move the precedence values to a dedicated ke=
y <br>
under Parameters, e.g. xenfilt\Parameters\Precedence.<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--000000000000f4022e063c3a9572--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 09:54:18 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 09:54:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079679.1440415 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1um8BU-0004Qh-C0; Wed, 13 Aug 2025 09:54:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079679.1440415; Wed, 13 Aug 2025 09:54:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1um8BU-0004Qa-9L; Wed, 13 Aug 2025 09:54:16 +0000
Received: by outflank-mailman (input) for mailman id 1079679;
 Wed, 13 Aug 2025 09:54:14 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GLRq=2Z=bounce.vates.tech=bounce-md_30504962.689c60bf.v1-f2d8ee3c39104c418e6f734c6144db08@srs-se1.protection.inumbo.net>)
 id 1um8BS-0004QU-Qy
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 09:54:14 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 7475971a-782b-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 11:54:09 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c23cH4BpvzS62Gq0
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 09:54:07 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 f2d8ee3c39104c418e6f734c6144db08; Wed, 13 Aug 2025 09:54:07 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7475971a-782b-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755078847; x=1755348847;
	bh=VNnwDSDcFHMRAWBkHfZQWoU98cPUVv+H9SEwQDjPaL8=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=k0nziZ9czmH/qMqvTApLqgPqT+qIXqHbZRLdeWmgthhHCpdCteEpucgMvdcCrFBsT
	 dpsFE91svfrDkuh9MK4g0DFmqJAei0gEfm+/d/JPcj9BYXIcTdkt5VxqJ7REgp0/mN
	 igLznH7l3dZC8rxtm33ToNcYjlSkhX73BA/ePBnARhViAkKpXbs+2cAeOkhULD1ZiM
	 VRzkLDBIux2VV9xSoDcxpv2ybOE1lxZEsyUIrV7qgUiREOeRFrl7ay8MZGOYe8aBab
	 +sYLHs5G6zzwSHCkaVlYOvQqjz0zONK8Ar4MXXBt/ZuT04ibBTNDlYypq5nmoVQmA8
	 NVen5WT7kjZ6Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755078847; x=1755339347; i=ngoc-tu.dinh@vates.tech;
	bh=VNnwDSDcFHMRAWBkHfZQWoU98cPUVv+H9SEwQDjPaL8=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=YXD3Xc2MUEWRcYZlAR+rZ5Bt2EMzrFtszi0Tv+kYHCX2IublzorS6Yn+oLyLpgDlc
	 TCWb7jtnJOeW1NZwxEzTEezaFmhTr1zsG9ifH0d3qxnF835upt05pc1k2gsAIm4Zcc
	 QuvIcjTKDO4UPTXZcNOSnlSSwZhLfv5xsSj0XrdE0FBrDrMmtgGu1eDxs7Ig5ljfvJ
	 i7fjeBxfMaHGjfraumNoZXfdf2RaDr0Zyzo4tEmdUNeaPRmS8QtjDXKO0p2GcT0yEF
	 L8kotvyxMdFLv2Qz4rjwhXN5bZKOK580JMmFEdBOzKRBmRJZgV9BnARDJ5GlRBjk4N
	 Z6nfSqZVsm4oQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=20v4=2002/11]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755078846465
Message-Id: <0666a8c5-71f5-46e5-8fd7-faeb00fc5063@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech> <20250808140314.1170-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250808140314.1170-3-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f2d8ee3c39104c418e6f734c6144db08?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 09:54:07 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 08/08/2025 16:03, Tu Dinh wrote:
> This makes sure that on driver installation, all supported hardware IDs
> will be populated into the driver database, thus allowing the device ID
> to be freely switched without causing boot installation issues.
> 
> Bump the feature score to compensate for the resulting degradation of
> identifier-match-type score.
> 
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>   src/xenbus.inf | 14 +++++---------
>   1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/src/xenbus.inf b/src/xenbus.inf
> index 7cc9ac2..bbd22a0 100644
> --- a/src/xenbus.inf
> +++ b/src/xenbus.inf
> @@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dl
>   %Vendor%=Inst,NT@INF_ARCH@
>   
>   [Inst.NT@INF_ARCH@]
> -; DisplayName		Section		DeviceID
> -; -----------		-------		--------
> -
> -%XenBusName_VEND%	=XenBus_Inst,	PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
> -%XenBusName_0002%	=XenBus_Inst,	PCI\VEN_5853&DEV_0002
> -%XenBusName_0001%	=XenBus_Inst,	PCI\VEN_5853&DEV_0001
> +%XenBusName%=XenBus_Inst,\
> +PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01\
> +,PCI\VEN_5853&DEV_0002\
> +,PCI\VEN_5853&DEV_0001
>   
>   [XenBus_Inst]
>   CopyFiles=XenBus_CopyFiles
>   CopyFiles=Monitor_CopyFiles
> +FeatureScore=0xFE
>   
>   [XenBus_Inst.Services]
>   AddService=xenbus_monitor,%SPSVCSINST_STARTSERVICE%,Monitor_Service,Monitor_EventLog
> @@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7
>   Vendor="@VENDOR_NAME@"
>   DiskDesc="@PRODUCT_NAME@ PV Bus Package"
>   XenBusName="@PRODUCT_NAME@ PV Bus"
> -XenBusName_VEND="@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)"
> -XenBusName_0002="@PRODUCT_NAME@ PV Bus (0002)"
> -XenBusName_0001="@PRODUCT_NAME@ PV Bus (0001)"
>   XenFiltName="@PRODUCT_NAME@ Generic Bus Filter"
>   MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
>   MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"

This ended up causing an Inf2Cat warning:

22.9.3: Missing hardware ID (cannot have just compatible ID) in line 
%xenbusname%=xenbus_inst,,,pci\ven_5853&dev_0001 in section 
[inst.ntamd64] of package\xenbus.inf


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 12:46:43 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 12:46:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079884.1440570 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsM-0006OR-C0; Wed, 13 Aug 2025 12:46:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079884.1440570; Wed, 13 Aug 2025 12:46:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsM-0006OK-9I; Wed, 13 Aug 2025 12:46:42 +0000
Received: by outflank-mailman (input) for mailman id 1079884;
 Wed, 13 Aug 2025 12:46:41 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IGx1=2Z=bounce.vates.tech=bounce-md_30504962.689c892e.v1-122ecb97e131455bb8b0cda027cf2d94@srs-se1.protection.inumbo.net>)
 id 1umAsL-0006Km-8j
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 12:46:41 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 8e51a42a-7843-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 14:46:40 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c27RM022czS62Gqs
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 12:46:39 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 122ecb97e131455bb8b0cda027cf2d94; Wed, 13 Aug 2025 12:46:38 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8e51a42a-7843-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755089199; x=1755359199;
	bh=9GwDazuan9UmCOBScGl5sq5LbKkAYlf4qrnzPTS54f0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=seCYUpfrwdV2YmgoiWIjw6LNpKcKAUij+gCXAFVX3kIuZkkve3CA9p3UEdhFoXobq
	 yjdFst/Q2iLf7BVbzioNnT/kGk8P3PetmFbGIO7tf4r5rv6giT/gNdltQGmtszpfo2
	 ds0dTgynuaGhUPbzABvsCFlYNqs0ImyyYwNzxtskkvMpw2x85XEc8tho5SN5i3fTtM
	 OGSfAHaPej1vHGqiZOgs2vd/FOkC2relC41OBklPHjhKiafgfqCteMqNPZUvGn5lgi
	 tQ2Y2a25YImhJrNkNOgOuRKQz7PDBdMvF2qClrjKurh73eYnfpupfrQIJErNIrrdwd
	 jXqcfmQcEO1XQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755089199; x=1755349699; i=ngoc-tu.dinh@vates.tech;
	bh=9GwDazuan9UmCOBScGl5sq5LbKkAYlf4qrnzPTS54f0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lCArtsh+qiCvSGL6xCs3V9rmwyCvusIiKlID2vhaUeRjDlbXzM4nAsHF2lpwTwLmz
	 whOmK5+f8V/rGVegW43LueqHyz5fkha/ihYy5b2J69c7Euw15EWOehvS3eB3caoMBy
	 s5TfE8hNw3AfyhmKVfLvZ5cyu+AoAUsLOv6hHTP3ieHjj8+WTf5EIqOE9xAZNrE/eu
	 Qbld29AWPPw9zdXg8Fm2Ss7JZmzh5uaX7lGcqO/Clc14KcLbDnxjwZLOBpQ0jEwGgt
	 sVxcD3z2HMfzT5Sa3X1NG2olkFx4A2Gf3uoYWObZYHll8T2wkr+rX/+8aDBUByuHYI
	 9OlHk6mynXq5A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=201/4]=20Check=20for=20memory=20hypercall=20failure?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755089198388
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813124630.1007-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.122ecb97e131455bb8b0cda027cf2d94?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 12:46:38 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

XENMEM_decrease_reservation and XENMEM_populate_physmap can return a
negative value on failure. Add a check for these cases.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/xen.h        | 18 ++++++++--------
 src/xen/memory.c     | 40 ++++++++++++++++++++++++++++++------
 src/xenbus/balloon.c | 49 +++++++++++++++++++++++++++++---------------
 src/xenbus/fdo.c     | 24 ++++++++++++++++++----
 4 files changed, 96 insertions(+), 35 deletions(-)

diff --git a/include/xen.h b/include/xen.h
index 6f28e55..7016c86 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -140,20 +140,22 @@ MemoryRemoveFromPhysmap(
 
 _Check_return_
 XEN_API
-ULONG
+NTSTATUS
 MemoryDecreaseReservation(
-    _In_ ULONG          Order,
-    _In_ ULONG          Count,
-    _In_ PPFN_NUMBER    PfnArray
+    _In_ ULONG                      Order,
+    _In_ ULONG                      Count,
+    _In_ PPFN_NUMBER                PfnArray,
+    _Out_ PULONG                    Result
     );
 
 _Check_return_
 XEN_API
-ULONG
+NTSTATUS
 MemoryPopulatePhysmap(
-    _In_ ULONG          Order,
-    _In_ ULONG          Count,
-    _In_ PPFN_NUMBER    PfnArray
+    _In_ ULONG                      Order,
+    _In_ ULONG                      Count,
+    _In_ PPFN_NUMBER                PfnArray,
+    _Out_ PULONG                    Result
     );
 
 // EVENT CHANNEL
diff --git a/src/xen/memory.c b/src/xen/memory.c
index 6a3a3d0..114e9ac 100644
--- a/src/xen/memory.c
+++ b/src/xen/memory.c
@@ -112,15 +112,17 @@ fail1:
 
 _Check_return_
 XEN_API
-ULONG
+NTSTATUS
 MemoryDecreaseReservation(
     _In_ ULONG                      Order,
     _In_ ULONG                      Count,
-    _In_ PPFN_NUMBER                PfnArray
+    _In_ PPFN_NUMBER                PfnArray,
+    _Out_ PULONG                    Result
     )
 {
     struct xen_memory_reservation   op;
     LONG_PTR                        rc;
+    NTSTATUS                        status;
 
     set_xen_guest_handle(op.extent_start, PfnArray);
     op.extent_order = Order;
@@ -130,20 +132,34 @@ MemoryDecreaseReservation(
 
     rc = MemoryOp(XENMEM_decrease_reservation, &op);
 
-    return (ULONG)rc;
+    if (rc < 0) {
+        ERRNO_TO_STATUS(-rc, status);
+        goto fail1;
+    }
+
+    *Result = (ULONG)rc;
+
+    return STATUS_SUCCESS;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
 }
 
 _Check_return_
 XEN_API
-ULONG
+NTSTATUS
 MemoryPopulatePhysmap(
     _In_ ULONG                      Order,
     _In_ ULONG                      Count,
-    _In_ PPFN_NUMBER                PfnArray
+    _In_ PPFN_NUMBER                PfnArray,
+    _Out_ PULONG                    Result
     )
 {
     struct xen_memory_reservation   op;
     LONG_PTR                        rc;
+    NTSTATUS                        status;
 
     set_xen_guest_handle(op.extent_start, PfnArray);
     op.extent_order = Order;
@@ -153,5 +169,17 @@ MemoryPopulatePhysmap(
 
     rc = MemoryOp(XENMEM_populate_physmap, &op);
 
-    return (ULONG)rc;
+    if (rc < 0) {
+        ERRNO_TO_STATUS(-rc, status);
+        goto fail1;
+    }
+
+    *Result = (ULONG)rc;
+
+    return STATUS_SUCCESS;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
 }
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index 4affef5..fb4fceb 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -369,10 +369,11 @@ done:
     return Count;
 }
 
-static ULONG
+static NTSTATUS
 BalloonPopulatePhysmap(
     _In_ ULONG          Requested,
-    _In_ PPFN_NUMBER    PfnArray
+    _In_ PPFN_NUMBER    PfnArray,
+    _Out_ PULONG        Populated
     )
 {
     LARGE_INTEGER       Start;
@@ -380,12 +381,18 @@ BalloonPopulatePhysmap(
     ULONGLONG           TimeDelta;
     ULONGLONG           Rate;
     ULONG               Count;
+    NTSTATUS            status;
 
     ASSERT(Requested != 0);
 
     KeQuerySystemTime(&Start);
 
-    Count = MemoryPopulatePhysmap(PAGE_ORDER_4K, Requested, PfnArray);
+    status = MemoryPopulatePhysmap(PAGE_ORDER_4K,
+                                   Requested,
+                                   PfnArray,
+                                   &Count);
+    if (!NT_SUCCESS(status))
+        return status;
 
     KeQuerySystemTime(&End);
     TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
@@ -393,7 +400,8 @@ BalloonPopulatePhysmap(
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
 
     Info("%u page(s) at %llu pages/s\n", Count, Rate);
-    return Count;
+    *Populated = Count;
+    return STATUS_SUCCESS;
 }
 
 static ULONG
@@ -408,6 +416,7 @@ BalloonPopulatePfnArray(
     ULONGLONG                       Rate;
     ULONG                           Index;
     ULONG                           Count;
+    NTSTATUS                        status;
 
     ASSERT(Requested != 0);
     ASSERT3U(Requested, <=, XENBUS_BALLOON_PFN_ARRAY_SIZE);
@@ -417,7 +426,6 @@ BalloonPopulatePfnArray(
 
     for (Index = 0; Index < Requested; Index++) {
         LONGLONG    Pfn;
-        NTSTATUS    status;
 
         status = XENBUS_RANGE_SET(Pop,
                                   &Context->RangeSetInterface,
@@ -429,12 +437,12 @@ BalloonPopulatePfnArray(
         Context->PfnArray[Index] = (PFN_NUMBER)Pfn;
     }
 
-    Count = BalloonPopulatePhysmap(Requested, Context->PfnArray);
+    status = BalloonPopulatePhysmap(Requested, Context->PfnArray, &Count);
+    if (!NT_SUCCESS(status))
+        Count = 0;
 
     Index = Count;
     while (Index < Requested) {
-        NTSTATUS    status;
-
         status = XENBUS_RANGE_SET(Put,
                                   &Context->RangeSetInterface,
                                   Context->RangeSet,
@@ -456,10 +464,11 @@ BalloonPopulatePfnArray(
     return Count;
 }
 
-static ULONG
+static NTSTATUS
 BalloonDecreaseReservation(
     _In_ ULONG          Requested,
-    _In_ PPFN_NUMBER    PfnArray
+    _In_ PPFN_NUMBER    PfnArray,
+    _Out_ PULONG        Decreased
     )
 {
     LARGE_INTEGER       Start;
@@ -467,12 +476,18 @@ BalloonDecreaseReservation(
     ULONGLONG           TimeDelta;
     ULONGLONG           Rate;
     ULONG               Count;
+    NTSTATUS            status;
 
     ASSERT(Requested != 0);
 
     KeQuerySystemTime(&Start);
 
-    Count = MemoryDecreaseReservation(PAGE_ORDER_4K, Requested, PfnArray);
+    status = MemoryDecreaseReservation(PAGE_ORDER_4K,
+                                       Requested,
+                                       PfnArray,
+                                       &Count);
+    if (!NT_SUCCESS(status))
+        return status;
 
     KeQuerySystemTime(&End);
     TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
@@ -480,7 +495,8 @@ BalloonDecreaseReservation(
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
 
     Info("%u page(s) at %llu pages/s\n", Count, Rate);
-    return Count;
+    *Decreased = Count;
+    return STATUS_SUCCESS;
 }
 
 static ULONG
@@ -495,6 +511,7 @@ BalloonReleasePfnArray(
     ULONGLONG                       Rate;
     ULONG                           Index;
     ULONG                           Count;
+    NTSTATUS                        status;
 
     ASSERT3U(Requested, <=, XENBUS_BALLOON_PFN_ARRAY_SIZE);
 
@@ -506,8 +523,6 @@ BalloonReleasePfnArray(
 
     Index = 0;
     while (Index < Requested) {
-        NTSTATUS    status;
-
         status = XENBUS_RANGE_SET(Put,
                                   &Context->RangeSetInterface,
                                   Context->RangeSet,
@@ -520,13 +535,13 @@ BalloonReleasePfnArray(
     }
     Requested = Index;
 
-    Count = BalloonDecreaseReservation(Requested, Context->PfnArray);
+    status = BalloonDecreaseReservation(Requested, Context->PfnArray, &Count);
+    if (!NT_SUCCESS(status))
+        Count = 0;
 
     RtlZeroMemory(Context->PfnArray, Count * sizeof (PFN_NUMBER));
 
     for (Index = Count; Index < Requested; Index++) {
-        NTSTATUS    status;
-
         status = XENBUS_RANGE_SET(Get,
                                   &Context->RangeSetInterface,
                                   Context->RangeSet,
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 92a83b6..4e87727 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -3400,6 +3400,7 @@ FdoMemoryHoleAllocate(
 {
     PMDL                Mdl;
     PPFN_NUMBER         PfnArray;
+    ULONG               Decreased;
     NTSTATUS            status;
 
     UNREFERENCED_PARAMETER(Fdo);
@@ -3412,12 +3413,21 @@ FdoMemoryHoleAllocate(
 
     PfnArray = MmGetMdlPfnArray(Mdl);
 
-    status = STATUS_UNSUCCESSFUL;
-    if (MemoryDecreaseReservation(PAGE_ORDER_4K, Count, PfnArray) != Count)
+    status = MemoryDecreaseReservation(PAGE_ORDER_4K,
+                                       Count,
+                                       PfnArray,
+                                       &Decreased);
+    if (!NT_SUCCESS(status))
         goto fail2;
 
+    status = STATUS_UNSUCCESSFUL;
+    if (Decreased != Count)
+        goto fail3;
+
     return Mdl;
 
+fail3:
+
 fail2:
     Error("fail2\n");
 
@@ -3437,14 +3447,20 @@ FdoMemoryHoleFree(
 {
     ULONG               Count;
     PPFN_NUMBER         PfnArray;
+    ULONG               Populated;
+    NTSTATUS            status;
 
     UNREFERENCED_PARAMETER(Fdo);
 
     Count = Mdl->ByteCount >> PAGE_SHIFT;
     PfnArray = MmGetMdlPfnArray(Mdl);
 
-    if (MemoryPopulatePhysmap(PAGE_ORDER_4K, Count, PfnArray) != Count)
-        BUG("FAILED TO RE-POPULATE HOLE");
+    status = MemoryPopulatePhysmap(PAGE_ORDER_4K,
+                                   Count,
+                                   PfnArray,
+                                   &Populated);
+    BUG_ON(!NT_SUCCESS(status));
+    BUG_ON(Populated != Count);
 
     __FreePages(Mdl);
 }
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 12:46:43 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 12:46:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079887.1440579 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsN-0006RH-FN; Wed, 13 Aug 2025 12:46:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079887.1440579; Wed, 13 Aug 2025 12:46:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsN-0006R9-CD; Wed, 13 Aug 2025 12:46:43 +0000
Received: by outflank-mailman (input) for mailman id 1079887;
 Wed, 13 Aug 2025 12:46:42 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=pdQn=2Z=bounce.vates.tech=bounce-md_30504962.689c892f.v1-362efa72e6a64ace9157e8847568f7a0@srs-se1.protection.inumbo.net>)
 id 1umAsM-0006Km-UP
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 12:46:42 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 8f8ec08b-7843-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 14:46:42 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c27RM2sSPzS62Gr3
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 12:46:39 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 362efa72e6a64ace9157e8847568f7a0; Wed, 13 Aug 2025 12:46:39 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8f8ec08b-7843-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755089199; x=1755359199;
	bh=xGp4gbon1hBN5wJK13b955yr+Z9pfQJgk7BwpFnBnIc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=OvkPTwmzKN0M6rECQRVgfNzNgZS7cXnFS6daZKzVrumzksHzVoNvWO8qwgBQAawo9
	 EgZaVnqfaXa9VaRXe3JBSbBilsNlSQt40tNKrHDLSWCV5UbGAV/+qYHKj8AubjgafB
	 WAj7DSSyVf+M5Yr44Zi0rzD6pmym9Wd9TnxmRQnkKVqoKHNUae6ic6GRa9B1GPzyp2
	 QrRZuV9sj67W2OznCi1n9TFatcI06B6YVxCeooeYZr/W98DxRmk8YL6LG/IMJ+c4da
	 +dMafeJd/Ib3mhHTfYcnToW1kerJ/TMAedxNQ6G90YGzw6VNM1x07HIhXpaTHz139u
	 +gNmVRx4gQ8DQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755089199; x=1755349699; i=ngoc-tu.dinh@vates.tech;
	bh=xGp4gbon1hBN5wJK13b955yr+Z9pfQJgk7BwpFnBnIc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=OPEDS1ThkODpYYUpwyGRX7IpryzrEeIluanYDV3LJKJbrvNQHMXU8gjP0NJ0SPYY3
	 5qDjC62uQdIyXoas33rByKHHdNHKi1p9o2nbr+vwZ1QAyx8UCj/wq7i0MyA8LEibDx
	 EwaZTbQcyLpDkTbQT81WScTbntLybbPQvfzIcAYyU+fqn0/+AuyMHBKFOmnE93lIi3
	 Pjaw9Lg/ZViWWTDk5z0XBTDm8KNuhEAZRXlNvvDKBl24UeO2IE6+VqmzLdartxeN76
	 1bGe6P9B2X5BtGbF9UlUZHvQ4qIzJv74ui242pNftMPiaAi9Fe4Xz7QCRKOQx2ohvd
	 7s87pWZl4+ChQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=203/4]=20balloon:=20Stop=20using=20fake=20MDL=20to=20store=20PFN=20array?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755089198802
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813124630.1007-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.362efa72e6a64ace9157e8847568f7a0?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 12:46:39 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The mapping sanity check has only ever been done in checked builds.

Remove the check, which also lets us stop using/messing with fake MDLs.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/balloon.c | 128 +++++++------------------------------------
 1 file changed, 20 insertions(+), 108 deletions(-)

diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index 2b657ce..029fff5 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -41,10 +41,7 @@
 #include "assert.h"
 #include "util.h"
 
-#define MDL_SIZE_MAX        ((1 << (RTL_FIELD_SIZE(MDL, Size) * 8)) - 1)
-#define MAX_PAGES_PER_MDL   ((MDL_SIZE_MAX - sizeof(MDL)) / sizeof(PFN_NUMBER))
-
-#define XENBUS_BALLOON_PFN_ARRAY_SIZE  (MAX_PAGES_PER_MDL)
+#define XENBUS_BALLOON_PFN_ARRAY_SIZE  8192
 
 typedef struct _XENBUS_BALLOON_FIST {
     BOOLEAN Inflation;
@@ -58,7 +55,6 @@ struct _XENBUS_BALLOON_CONTEXT {
     PKEVENT                     LowMemoryEvent;
     HANDLE                      LowMemoryHandle;
     ULONGLONG                   Size;
-    MDL                         Mdl;
     PFN_NUMBER                  PfnArray[XENBUS_BALLOON_PFN_ARRAY_SIZE];
     XENBUS_RANGE_SET_INTERFACE  RangeSetInterface;
     PXENBUS_RANGE_SET           RangeSet;
@@ -204,7 +200,6 @@ BalloonAllocatePagesForMdl(
     LARGE_INTEGER   HighAddress;
     LARGE_INTEGER   SkipBytes;
     SIZE_T          TotalBytes;
-    PMDL            Mdl;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -213,90 +208,31 @@ BalloonAllocatePagesForMdl(
     SkipBytes.QuadPart = 0ull;
     TotalBytes = (SIZE_T)Count << PAGE_SHIFT;
 
-    Mdl = MmAllocatePagesForMdlEx(LowAddress,
-                                  HighAddress,
-                                  SkipBytes,
-                                  TotalBytes,
-                                  MmCached,
-                                  MM_DONT_ZERO_ALLOCATION |
-                                  MM_ALLOCATE_PREFER_CONTIGUOUS |
-                                  MM_ALLOCATE_AND_HOT_REMOVE);
-    if (Mdl == NULL)
-        goto done;
-
-    ASSERT((Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA |
-                             MDL_PARTIAL_HAS_BEEN_MAPPED |
-                             MDL_PARTIAL |
-                             MDL_PARENT_MAPPED_SYSTEM_VA |
-                             MDL_SOURCE_IS_NONPAGED_POOL)) == 0);
-
-done:
-    return Mdl;
+    return MmAllocatePagesForMdlEx(LowAddress,
+                                   HighAddress,
+                                   SkipBytes,
+                                   TotalBytes,
+                                   MmCached,
+                                   MM_DONT_ZERO_ALLOCATION |
+                                   MM_ALLOCATE_PREFER_CONTIGUOUS |
+                                   MM_ALLOCATE_AND_HOT_REMOVE);
 }
 
 static VOID
-BalloonFreePagesFromMdl(
-    _In_ PMDL       Mdl,
-    _In_ BOOLEAN    Check
+BalloonFreePages(
+    _In_ PPFN_NUMBER    Pfn,
+    _In_ ULONG          Count
     )
 {
-    volatile UCHAR  *Mapping;
-    ULONG           Index;
-    PPFN_NUMBER     Pfn;
-    PFN_NUMBER      RangeStart, RangeEnd;
-    NTSTATUS        Status;
-
-    if (!Check)
-        goto done;
-
-    // Sanity check:
-    //
-    // Make sure that things written to the page really do stick.
-    // If the page is still ballooned out at the hypervisor level
-    // then writes will be discarded and reads will give back
-    // all 1s.
-
-    Mapping = MmMapLockedPagesSpecifyCache(Mdl,
-                                           KernelMode,
-                                           MmCached,
-                                           NULL,
-                                           FALSE,
-                                           LowPagePriority);
-    if (Mapping == NULL)
-        // Windows couldn't map the memory. That's kind of sad, but not
-        // really an error: it might be that we're very low on kernel
-        // virtual address space.
-        goto done;
-
-    // Write and read the first byte in each page to make sure it's backed
-    // by RAM.
-    ASSERT((Mdl->ByteCount & (PAGE_SIZE - 1)) == 0);
-
-    for (Index = 0; Index < (Mdl->ByteCount >> PAGE_SHIFT); Index++) {
-        UCHAR   Byte;
-
-        ASSERT3U(Index << PAGE_SHIFT, <, Mdl->ByteCount);
-        Mapping[Index << PAGE_SHIFT] = (UCHAR)Index;
-
-        KeMemoryBarrier();
-        Byte = Mapping[Index << PAGE_SHIFT];
-
-        ASSERT3U(Byte, ==, (UCHAR)Index);
-    }
-
-    MmUnmapLockedPages((PVOID)Mapping, Mdl);
-
-done:
-    Pfn = MmGetMdlPfnArray(Mdl);
+    PFN_NUMBER          RangeStart, RangeEnd;
+    NTSTATUS            Status;
 
     RangeStart = 0;
-    while (RangeStart < (MmGetMdlByteCount(Mdl) >> PAGE_SHIFT)) {
+    while (RangeStart < Count) {
         PHYSICAL_ADDRESS    StartAddress;
         LARGE_INTEGER       NumberOfBytes;
 
-        for (RangeEnd = RangeStart;
-             RangeEnd < (MmGetMdlByteCount(Mdl) >> PAGE_SHIFT);
-             RangeEnd++) {
+        for (RangeEnd = RangeStart; RangeEnd < Count; RangeEnd++) {
             if (Pfn[RangeEnd] != Pfn[RangeStart] + (RangeEnd - RangeStart))
                 break;
         }
@@ -345,8 +281,6 @@ BalloonAllocatePfnArray(
     if (Mdl == NULL)
         goto done;
 
-    ASSERT(Mdl->ByteOffset == 0);
-    ASSERT((Mdl->ByteCount & (PAGE_SIZE - 1)) == 0);
     ASSERT(Mdl->MdlFlags & MDL_PAGES_LOCKED);
 
     Count = Mdl->ByteCount >> PAGE_SHIFT;
@@ -501,8 +435,7 @@ done:
 static ULONG
 BalloonFreePfnArray(
     _In_ PXENBUS_BALLOON_CONTEXT    Context,
-    _In_ ULONG                      Requested,
-    _In_ BOOLEAN                    Check
+    _In_ ULONG                      Requested
     )
 {
     LARGE_INTEGER                   Start;
@@ -511,7 +444,6 @@ BalloonFreePfnArray(
     ULONGLONG                       Rate;
     ULONG                           Index;
     ULONG                           Count;
-    PMDL                            Mdl;
 
     ASSERT3U(Requested, <=, XENBUS_BALLOON_PFN_ARRAY_SIZE);
 
@@ -521,32 +453,12 @@ BalloonFreePfnArray(
     if (Requested == 0)
         goto done;
 
-    ASSERT(IsZeroMemory(&Context->Mdl, sizeof (MDL)));
-
     for (Index = 0; Index < Requested; Index++)
         ASSERT(Context->PfnArray[Index] != 0);
 
-    Mdl = &Context->Mdl;
-
-#pragma warning(push)
-#pragma warning(disable:28145)  // The opaque MDL structure should not be modified by a driver
-
-    Mdl->Next = NULL;
-    Mdl->Size = (SHORT)(sizeof(MDL) + (sizeof(PFN_NUMBER) * Requested));
-    Mdl->MdlFlags = MDL_PAGES_LOCKED | MDL_IO_SPACE;
-    Mdl->Process = NULL;
-    Mdl->MappedSystemVa = NULL;
-    Mdl->StartVa = NULL;
-    Mdl->ByteCount = Requested << PAGE_SHIFT;
-    Mdl->ByteOffset = 0;
-
-#pragma warning(pop)
-
-    BalloonFreePagesFromMdl(Mdl, Check);
+    BalloonFreePages(Context->PfnArray, Requested);
     Count = Requested;
 
-    RtlZeroMemory(&Context->Mdl, sizeof (MDL));
-
     RtlZeroMemory(Context->PfnArray, Count * sizeof (PFN_NUMBER));
 
 done:
@@ -612,7 +524,7 @@ BalloonDeflate(
         if (Populated < ThisTime)
             status = STATUS_RETRY;
 
-        Freed = BalloonFreePfnArray(Context, Populated, TRUE);
+        Freed = BalloonFreePfnArray(Context, Populated);
         ASSERT(Freed == Populated);
 
         Count += Freed;
@@ -675,7 +587,7 @@ BalloonInflate(
                           &(Context->PfnArray[Released]),
                           (Allocated - Released) * sizeof (PFN_NUMBER));
 
-            Freed = BalloonFreePfnArray(Context, Allocated - Released, FALSE);
+            Freed = BalloonFreePfnArray(Context, Allocated - Released);
             ASSERT3U(Freed, ==, Allocated - Released);
         }
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 12:46:43 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 12:46:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079886.1440574 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsM-0006Ok-F5; Wed, 13 Aug 2025 12:46:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079886.1440574; Wed, 13 Aug 2025 12:46:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsM-0006OX-Ad; Wed, 13 Aug 2025 12:46:42 +0000
Received: by outflank-mailman (input) for mailman id 1079886;
 Wed, 13 Aug 2025 12:46:41 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2NJ+=2Z=bounce.vates.tech=bounce-md_30504962.689c892e.v1-0d6ddb27892f40889f1f46a244124e68@srs-se1.protection.inumbo.net>)
 id 1umAsL-0006No-Pf
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 12:46:41 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 8e27e800-7843-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 14:46:39 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c27RL5hqgzS62GqN
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 12:46:38 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0d6ddb27892f40889f1f46a244124e68; Wed, 13 Aug 2025 12:46:38 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8e27e800-7843-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755089198; x=1755359198;
	bh=KU7jS4prr5hj0j0RNw/IqPbWAt54GpuTMxwsMN+jFvM=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=UAinEi3n4bhNJC5Gu5i2P8QCp8U7xzX5/H5BubUNq5Uou72xSKqAUv781FM1F6wcY
	 vEVRJIEjx4v8YRkEoA8OZZXVvZFUPp9glIZtgvu2dzL8sB/gsT1KA2tkuYGzjkPek+
	 OvIsFzZXHBcTH3hyIBuM33CVeNAIPN+3YriPfAuehXrtoLbcs4gn/s3XZCmM2ZTeKW
	 21tqzLZp2JL4x8wbXWreV5zLnDIVwMn+K4cfiOw7KmlxnEtggemMK4vuxRHmSbhCO4
	 pA3sV3m68agaNkE3/XuWcD3qgeTSRUonHCkKFWhyQNGab1LQMJPTvh7eRt0IVGOVee
	 EtOUHB9Nhe9Lw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755089198; x=1755349698; i=ngoc-tu.dinh@vates.tech;
	bh=KU7jS4prr5hj0j0RNw/IqPbWAt54GpuTMxwsMN+jFvM=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=ETlZRRMJjqo5q6sWCQMcJiSOVNCLT7FJhQS1JPh1mFLX5CCOIV+TtgkCFtno9tEnh
	 fgqyLjB94R76Di26KpI7De84kpK1Oo2JA+YyNrILRm/3CjsgNHoIYTAYZ0lwv0Rtlv
	 ADh3bOiPh/AvA+1/eohAy1EnFSqeqvjIi6alR4uoQjCym9rUd/bbWPxtgHebzN18E3
	 ii7MB7B/zGtXypGYDV6mk3TWr8MsJ7zR1ANfPX/6lqcEdExRDcfUGDd0YSZC51Af1y
	 JLZfhKaUAqIx0NkGlc6+DWr9xcFOEVZAuoaSjrhCoOhnksatvPCtioz72HcMVkKl2q
	 Ov3Xl7lOBWymg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=200/4]=20Clean=20up=20ballooning=20code?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755089198133
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0d6ddb27892f40889f1f46a244124e68?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 12:46:38 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The series started by noticing that MemoryDecreaseReservation and
MemoryPopulatePhysmap did not have error checking.

Balloon logging was mostly removed to make the xen_platform_log less
chatty. Additionally, the whole fake MDL code path was removed.

Tu Dinh (4):
  Check for memory hypercall failure
  balloon: Remove allocation/deallocation wrappers
  balloon: Stop using fake MDL to store PFN array
  balloon: Report ballooning speed in trace log

 include/xen.h        |  18 ++--
 src/xen/memory.c     |  40 ++++++--
 src/xenbus/balloon.c | 213 ++++++++-----------------------------------
 src/xenbus/fdo.c     |  24 ++++-
 4 files changed, 102 insertions(+), 193 deletions(-)

-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 12:46:44 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 12:46:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079888.1440582 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsO-0006Ur-HX; Wed, 13 Aug 2025 12:46:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079888.1440582; Wed, 13 Aug 2025 12:46:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsO-0006Uk-EQ; Wed, 13 Aug 2025 12:46:44 +0000
Received: by outflank-mailman (input) for mailman id 1079888;
 Wed, 13 Aug 2025 12:46:43 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=U0Fc=2Z=bounce.vates.tech=bounce-md_30504962.689c892f.v1-9487d6fd4b764c849bf66408b3fd2a89@srs-se1.protection.inumbo.net>)
 id 1umAsN-0006Km-Io
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 12:46:43 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 90625025-7843-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 14:46:43 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c27RM4VFDzS62GrC
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 12:46:39 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 9487d6fd4b764c849bf66408b3fd2a89; Wed, 13 Aug 2025 12:46:39 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 90625025-7843-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755089199; x=1755359199;
	bh=/Nf4QERQFyeqmrjwqRaneAnPMig+waJB7KvpvXhbU4E=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=V9Q2XdcJeGz9o6EgBK4EVNP/I3gZ++mQlmnNoB6Zq/iaCEak0mhwhr/6KgLt+tAD5
	 VaCwRn9W4WOTlywIsgRh2MNI8r1uxnY0ho+GelR+eeVjMOkP3cODiWYkslug3qi+BD
	 nmjKOpAfHYYdZfXZWYtR98PdEIZ8s+wjq3/HtSG6r0hbhsr6JzpneW0abb7XwG3GTK
	 0aKUBQvOBDTEnwzdhqrZJYiC0WBbWvSD/atVe/qLA0jVRcOOrin22oEdvCzycHU1sn
	 pDMJYs+1JDLNl5qpGjhKmbty9RrBGjepHRNrb9L7Hrn8rSQDivK2vXcqI2LhFK3s4P
	 qb57bwXPoed0g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755089199; x=1755349699; i=ngoc-tu.dinh@vates.tech;
	bh=/Nf4QERQFyeqmrjwqRaneAnPMig+waJB7KvpvXhbU4E=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Z74NexVR8NKQjyKfI+FtH8M4lNSJRCs0RBfEjALG844f+QM9wF5ehDbVE40DYFZRc
	 +rZYaoULEtDeT7TcjK2iak23jt3ZC4Q7+giKlBZefd/y2d49Ikt9fVsZvJ3gMBt2an
	 9wITEPZGgCbJU3bkW/oWpM0L5icvOrKasbPLkN/6KG3nh2kxbqB01Xsnc6NeR4hx2r
	 qnKBhptCv1axuv4lclAuG9oRqPmNP4Qa0SaPKeeIZrAPCMWLy0bh1TOTgBsQdUjJh7
	 CwRg356q1B14W7QbHXGtQdflVDiHk1FHE8mcYORHh0/AJRzbfFSe3ad1ASoJ6gxzTR
	 MqL+F8K/jK7ZQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=204/4]=20balloon:=20Report=20ballooning=20speed=20in=20trace=20log?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755089199005
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813124630.1007-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.9487d6fd4b764c849bf66408b3fd2a89?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 12:46:39 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Ballooning will constantly spam the xen_platform_log, especially if the
balloon is large.

Reduce the log spamming by reporting balloon function times in the trace
log instead.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/balloon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index 029fff5..f041a04 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -299,7 +299,7 @@ done:
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
     *Slow = (Rate < XENBUS_BALLOON_MIN_PAGES_PER_S) ? TRUE : FALSE;
 
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
+    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
     return Count;
 }
 
@@ -362,7 +362,7 @@ BalloonPopulatePfnArray(
 
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
 
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
+    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
     return Count;
 }
 
@@ -428,7 +428,7 @@ done:
 
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
 
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
+    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
     return Count;
 }
 
@@ -469,7 +469,7 @@ done:
 
     Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
 
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
+    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
     return Count;
 }
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 12:46:44 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 12:46:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079889.1440587 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsO-0006VE-LB; Wed, 13 Aug 2025 12:46:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079889.1440587; Wed, 13 Aug 2025 12:46:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umAsO-0006Ux-Fn; Wed, 13 Aug 2025 12:46:44 +0000
Received: by outflank-mailman (input) for mailman id 1079889;
 Wed, 13 Aug 2025 12:46:43 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=eYwP=2Z=bounce.vates.tech=bounce-md_30504962.689c892f.v1-60d8bb0c02ea44cd826f01e40994199e@srs-se1.protection.inumbo.net>)
 id 1umAsN-0006No-Oh
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 12:46:43 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 8f72664c-7843-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 14:46:42 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c27RM1cp9zS62Gr1
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 12:46:39 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 60d8bb0c02ea44cd826f01e40994199e; Wed, 13 Aug 2025 12:46:39 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8f72664c-7843-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755089199; x=1755359199;
	bh=OeLdBAQOqlSPM5eLB9jRVff3JNz4++lKwqSQwA39cIc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Iq5ttlhhuUd31LDXGIuwcrRdxB1/0lER6GukXJZQG3CuGc8bdmtrG0xYu8AmwNykh
	 O/LRNQIwsVjSIUQiBFss/ZHmh76zAqPKDME36uN0OBpY3AelP7+PX29wpIzxcVJz3K
	 HrR6iG9WNe2UKSMXerqp1Ge6EpIHcZ/Dzs2K2KHpmRhfsNkWzQIufUhEZjcWxWFBSg
	 ED0+vhmoA6sJGKJW4CrL154H80OfBsxovmWlt3yDnGdmrvkwU+PW/wPXK26FPA3Z03
	 fXaTE8b8i4S/1sNlai6PV27lAqRSid6Ltb9mLGzzpEivnrNMwT7vTxfEzGHzOf2yRs
	 YJknNrOWSlDQQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755089199; x=1755349699; i=ngoc-tu.dinh@vates.tech;
	bh=OeLdBAQOqlSPM5eLB9jRVff3JNz4++lKwqSQwA39cIc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=YgG4n9Bb85ov5KvofXET0kW6qZ/WYfgZ6gphTKJ34iGqdeXyxIlVaE3P+CA3w6myn
	 kUPvNU/ZemMNdhiqNkVgsw7INdpg7Duwdj7UXSh2S+9uh/Li5SiIWDsrkm5wHdxXqi
	 BU9bdlx1J7H/Odai1qpE+8uKaTqFglwIHGwsUuymHcJc0/8JuzGlkzuqx39672yQlP
	 8+xPbNOoGGJwXq/Mc6zyYz4xb23TQ81H4wgFnPaRjOIWnVDVKJey6nsyIo4LlMVEWl
	 IXuO7Lotyy5bzt8425fdd6kpctJEseeNMyO94y8uvih1+nKL03pMWS0JBUM+/cf/UN
	 K7wsJVtRLQ7XA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=202/4]=20balloon:=20Remove=20allocation/deallocation=20wrappers?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755089198597
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813124630.1007-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.60d8bb0c02ea44cd826f01e40994199e?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 12:46:39 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

BalloonPopulatePhysmap and BalloonDecreaseReservation only measure the
time taken by the corresponding Memory* functions, but that's already
done in BalloonPopulatePfnArray/BalloonReleasePfnArray (among other
places).

Remove these functions to simplify the code.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/balloon.c | 80 +++++---------------------------------------
 1 file changed, 8 insertions(+), 72 deletions(-)

diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index fb4fceb..2b657ce 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -369,41 +369,6 @@ done:
     return Count;
 }
 
-static NTSTATUS
-BalloonPopulatePhysmap(
-    _In_ ULONG          Requested,
-    _In_ PPFN_NUMBER    PfnArray,
-    _Out_ PULONG        Populated
-    )
-{
-    LARGE_INTEGER       Start;
-    LARGE_INTEGER       End;
-    ULONGLONG           TimeDelta;
-    ULONGLONG           Rate;
-    ULONG               Count;
-    NTSTATUS            status;
-
-    ASSERT(Requested != 0);
-
-    KeQuerySystemTime(&Start);
-
-    status = MemoryPopulatePhysmap(PAGE_ORDER_4K,
-                                   Requested,
-                                   PfnArray,
-                                   &Count);
-    if (!NT_SUCCESS(status))
-        return status;
-
-    KeQuerySystemTime(&End);
-    TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
-
-    Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
-
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
-    *Populated = Count;
-    return STATUS_SUCCESS;
-}
-
 static ULONG
 BalloonPopulatePfnArray(
     _In_ PXENBUS_BALLOON_CONTEXT    Context,
@@ -437,7 +402,10 @@ BalloonPopulatePfnArray(
         Context->PfnArray[Index] = (PFN_NUMBER)Pfn;
     }
 
-    status = BalloonPopulatePhysmap(Requested, Context->PfnArray, &Count);
+    status = MemoryPopulatePhysmap(PAGE_ORDER_4K,
+                                   Requested,
+                                   Context->PfnArray,
+                                   &Count);
     if (!NT_SUCCESS(status))
         Count = 0;
 
@@ -464,41 +432,6 @@ BalloonPopulatePfnArray(
     return Count;
 }
 
-static NTSTATUS
-BalloonDecreaseReservation(
-    _In_ ULONG          Requested,
-    _In_ PPFN_NUMBER    PfnArray,
-    _Out_ PULONG        Decreased
-    )
-{
-    LARGE_INTEGER       Start;
-    LARGE_INTEGER       End;
-    ULONGLONG           TimeDelta;
-    ULONGLONG           Rate;
-    ULONG               Count;
-    NTSTATUS            status;
-
-    ASSERT(Requested != 0);
-
-    KeQuerySystemTime(&Start);
-
-    status = MemoryDecreaseReservation(PAGE_ORDER_4K,
-                                       Requested,
-                                       PfnArray,
-                                       &Count);
-    if (!NT_SUCCESS(status))
-        return status;
-
-    KeQuerySystemTime(&End);
-    TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
-
-    Rate = (ULONGLONG)(Count * 1000) / TimeDelta;
-
-    Info("%u page(s) at %llu pages/s\n", Count, Rate);
-    *Decreased = Count;
-    return STATUS_SUCCESS;
-}
-
 static ULONG
 BalloonReleasePfnArray(
     _In_ PXENBUS_BALLOON_CONTEXT    Context,
@@ -535,7 +468,10 @@ BalloonReleasePfnArray(
     }
     Requested = Index;
 
-    status = BalloonDecreaseReservation(Requested, Context->PfnArray, &Count);
+    status = MemoryDecreaseReservation(PAGE_ORDER_4K,
+                                       Requested,
+                                       Context->PfnArray,
+                                       &Count);
     if (!NT_SUCCESS(status))
         Count = 0;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 13:32:50 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 13:32:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079954.1440617 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBaz-00059R-9p; Wed, 13 Aug 2025 13:32:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079954.1440617; Wed, 13 Aug 2025 13:32:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBaz-000599-3h; Wed, 13 Aug 2025 13:32:49 +0000
Received: by outflank-mailman (input) for mailman id 1079954;
 Wed, 13 Aug 2025 13:32:47 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UoCk=2Z=bounce.vates.tech=bounce-md_30504962.689c93fb.v1-5bcedfd86e7f4b7685b9082825fc8b59@srs-se1.protection.inumbo.net>)
 id 1umBax-00058o-FD
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 13:32:47 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fe4b02bc-7849-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 15:32:45 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c28SW31dMz1XLLjP
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 13:32:43 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5bcedfd86e7f4b7685b9082825fc8b59; Wed, 13 Aug 2025 13:32:43 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fe4b02bc-7849-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755091963; x=1755361963;
	bh=S39hbkn2ua1SuWFceAChuNskye32RqeF/T11G0EhRPA=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=L9THdtSM+O17PUXFjpvfg0YCcKxJjoyO6+vyDs370cy8QiPpeEuJEoq4/5x0WVS9k
	 5YLTzVJG+fYCbRZEJBBP8dl8d1yt4B0wj3pF5nq3LeXSdQfRoxUCUvXa633N0/wsRR
	 UE5z4ihW0XLnZreaOTHxEXP71qyP1eav87QbidPn5T3AHiSRfHygLZeHgeXff+qFw+
	 6YoRaF6Tj/hchV0sQ0gNhyDp/jcNzn/a6Hw9hQ2+27/bBHFlj2+H7Zg5yJg8jzr5Mo
	 +XYVZRyOGicLbWL7BncOFVC750Ny/vniCEjNV8QomTfAcdD1BhAbp34Y3CZ3yfEc7Y
	 9bZWl70vlicxQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755091963; x=1755352463; i=ngoc-tu.dinh@vates.tech;
	bh=S39hbkn2ua1SuWFceAChuNskye32RqeF/T11G0EhRPA=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=fWmecTAYcXf9hmG75AcwpsSyiz7/ZJwkyaf8H3vUCYKe/zYXkm0kv/AGqKlNyJX/w
	 G9e7y2mM13J+P1RIeVqr7W+8Uq5awVtatlefKRVWyoDWp6lDSN5CcXh4ErI7CLrewr
	 UwvdPObzgtJTHY83/goRCOtxOqB/l4AiGf64HfrUG587K5oZFnX4ZEPyj6QHD4SArv
	 FnILONxTlbI9G8+uQBGriKRvN5y2TNjzeurgUgM6HgbxBKgtkhEACQOT0et7Tgesni
	 urN+YmuqIWaif401aaaJCEgax67wGlp2W7QF8IMRYSwVJ/TdsbeUex5nwskpFK7fs/
	 CMCU44lc0vx7g==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=200/2]=20Be=20more=20tolerant=20of=20RealTimeIsUniversal=20values?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755091962672
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5bcedfd86e7f4b7685b9082825fc8b59?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 13:32:43 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Tu Dinh (2):
  Add RegistryQueryQwordValue
  Be more tolerant of RealTimeIsUniversal values

 src/common/registry.c | 70 +++++++++++++++++++++++++++++++++++++++++++
 src/common/registry.h |  7 +++++
 src/xen/system.c      | 41 ++++++++++++-------------
 3 files changed, 98 insertions(+), 20 deletions(-)

-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 13:32:50 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 13:32:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079953.1440610 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBaz-000595-4w; Wed, 13 Aug 2025 13:32:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079953.1440610; Wed, 13 Aug 2025 13:32:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBaz-00058y-2G; Wed, 13 Aug 2025 13:32:49 +0000
Received: by outflank-mailman (input) for mailman id 1079953;
 Wed, 13 Aug 2025 13:32:47 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=fxPX=2Z=bounce.vates.tech=bounce-md_30504962.689c93fb.v1-0f59ad19a34d41f69019defcc07ed0b1@srs-se1.protection.inumbo.net>)
 id 1umBaw-00058m-UR
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 13:32:47 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fe458dad-7849-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 15:32:45 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c28SW4pgMz1XLLjh
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 13:32:43 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0f59ad19a34d41f69019defcc07ed0b1; Wed, 13 Aug 2025 13:32:43 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fe458dad-7849-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755091963; x=1755361963;
	bh=o6y61ivQnwwEJq0ri0CqRG6AnkJRnBwfwuoYd3arD4A=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=fRGMq/L5SE8Y+zm3FlPrrUwllzZ/PQh2W4DAXHoIftDcD7cmZNY8V9cUJxWBhOtLn
	 mRHLSv6pRlqtKNRshf8UwFkaj254BpNShi9b+n0v2wtj21WoWFFG1l8F0nCd6Iw9Ca
	 n6/Iytn8REW23uU3F3wQu93qXFJ2uLHY7GtnOEMJNBxlUACy43rdqoWvMVMqEygPBe
	 Bz4CZy/fz2d405FHAYQ5Y+cVHU8KtlX8n5cefoWmDONvWPh4TH9D750LIh+bnsbg+h
	 4qiAHCydcGurz8JcfsuHIJjW1DsAhebeqE23dLcYAEmxoP4NlrzXrLLkd4sy40Kn2T
	 HwS3ONUfFmXdw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755091963; x=1755352463; i=ngoc-tu.dinh@vates.tech;
	bh=o6y61ivQnwwEJq0ri0CqRG6AnkJRnBwfwuoYd3arD4A=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=YzTiYkKd5WWcayIWBNQIAYCQxOguzob2KTQhrx82aOA0VTMshkjWmFZUpTPSofyix
	 T/LYQQlA5I9Vs1IjupQHb2S8lI5nuTZbui93XEEt1IVYL5vI6qiFuyDrdi2T5q8yPt
	 r1AVCILtvBN92JOSbhLsaX7jtbdhr5JYpz6J//YPaf6tnHd+KCD6IMesiv9seqbd0m
	 5xKb2Rc3usa8kwnYVbhXp03BlpjqmIOziEpwf2yxHBTjDFw9e8mXEb8XkoKRELvMHw
	 OTIjhn5Fcl0yEqZ3lTCxCbHtlTBf1C04AkW+7isSYDTxPsz/HaE5+2K9fSwdw+BL3Z
	 GnQp1MeGeZvAg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=201/2]=20Add=20RegistryQueryQwordValue?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755091962978
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813133205.1800-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0f59ad19a34d41f69019defcc07ed0b1?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 13:32:43 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/common/registry.c | 70 +++++++++++++++++++++++++++++++++++++++++++
 src/common/registry.h |  7 +++++
 2 files changed, 77 insertions(+)

diff --git a/src/common/registry.c b/src/common/registry.c
index 7965233..1f7a73c 100644
--- a/src/common/registry.c
+++ b/src/common/registry.c
@@ -853,6 +853,76 @@ fail1:
     return status;
 }
 
+NTSTATUS
+RegistryQueryQwordValue(
+    _In_ HANDLE                     Key,
+    _In_ PSTR                       Name,
+    _Out_ PULONGLONG                Value
+    )
+{
+    ANSI_STRING                     Ansi;
+    UNICODE_STRING                  Unicode;
+    PKEY_VALUE_PARTIAL_INFORMATION  Partial;
+    ULONG                           Size;
+    NTSTATUS                        status;
+
+    RtlInitAnsiString(&Ansi, Name);
+
+    status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = ZwQueryValueKey(Key,
+                             &Unicode,
+                             KeyValuePartialInformation,
+                             NULL,
+                             0,
+                             &Size);
+    if (!NT_SUCCESS(status) &&
+        status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
+        goto fail2;
+
+    Partial = __RegistryAllocate(Size);
+
+    status = STATUS_NO_MEMORY;
+    if (Partial == NULL)
+        goto fail3;
+
+    status = ZwQueryValueKey(Key,
+                             &Unicode,
+                             KeyValuePartialInformation,
+                             Partial,
+                             Size,
+                             &Size);
+    if (!NT_SUCCESS(status))
+        goto fail4;
+
+    status = STATUS_INVALID_PARAMETER;
+    if (Partial->Type != REG_QWORD ||
+        Partial->DataLength != sizeof (ULONGLONG))
+        goto fail5;
+
+    *Value = *(PULONGLONG)Partial->Data;
+
+    __RegistryFree(Partial);
+
+    RtlFreeUnicodeString(&Unicode);
+
+    return STATUS_SUCCESS;
+
+fail5:
+fail4:
+    __RegistryFree(Partial);
+
+fail3:
+fail2:
+    RtlFreeUnicodeString(&Unicode);
+
+fail1:
+    return status;
+}
+
 NTSTATUS
 RegistryUpdateDwordValue(
     _In_ HANDLE                     Key,
diff --git a/src/common/registry.h b/src/common/registry.h
index e70a6ed..26bc0c6 100644
--- a/src/common/registry.h
+++ b/src/common/registry.h
@@ -142,6 +142,13 @@ RegistryQueryDwordValue(
     _Out_ PULONG        Value
     );
 
+extern NTSTATUS
+RegistryQueryQwordValue(
+    _In_ HANDLE         Key,
+    _In_ PSTR           Name,
+    _Out_ PULONGLONG    Value
+    );
+
 extern NTSTATUS
 RegistryUpdateDwordValue(
     _In_ HANDLE         Key,
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 13:33:00 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 13:33:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1079955.1440618 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBbA-0005DW-80; Wed, 13 Aug 2025 13:33:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1079955.1440618; Wed, 13 Aug 2025 13:33:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umBbA-0005DP-5K; Wed, 13 Aug 2025 13:33:00 +0000
Received: by outflank-mailman (input) for mailman id 1079955;
 Wed, 13 Aug 2025 13:32:58 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aKUe=2Z=bounce.vates.tech=bounce-md_30504962.689c93fb.v1-59b7861bf0a64a93b0f408bd3509c34b@srs-se1.protection.inumbo.net>)
 id 1umBb8-00058o-Em
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 13:32:58 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fe4d41fc-7849-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 15:32:45 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c28SW5xCJzS62Gr3
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 13:32:43 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 59b7861bf0a64a93b0f408bd3509c34b; Wed, 13 Aug 2025 13:32:43 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fe4d41fc-7849-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755091963; x=1755361963;
	bh=qEnfsvEhvgk33xg/koCopmpiTQH6wFlLK9FwfA2kpfI=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=RDQCrWXNfqwBuAunAJ43RCcv0BIXje70ArmxXyo6Tm8CaYBUf/Qi3l4lWE8DwnMic
	 8oQTnaBiTVWlCak9qqLSyKYu0xnGUr9l2CJVTf4ausCD3jo7jNXv8U2e0eFnQTxGuL
	 acJ5k2F91LE1dqUKl3OmlTES8uS5Ep+/uUEN32hwQWKlv6k8u8P/04Ktv6aJCqimWJ
	 kYz9h2UA5PcGzuT1/wOEPU28iwFTLcHv0YyQajHkaewvijKsTvEzc7KlwLwVWFiWFS
	 plHALir86coO6Sj1GvffLDE1kIrAvKle/ZKSvbRAAt1dpOGqn8KJ8gFE2CrkDp28as
	 lXzULe34Q+wGQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755091963; x=1755352463; i=ngoc-tu.dinh@vates.tech;
	bh=qEnfsvEhvgk33xg/koCopmpiTQH6wFlLK9FwfA2kpfI=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=BGNiW0N2OfBMcwLazkGBA/yG8M70IJvyvZS3fM5WBSgJ6LHRJDqrt5heSfasvNFCt
	 08XDlzCMeGcNgXRJlT8AB8OVM4eMMzGD2lr2WcaCu4DvAbLSGwO2MD2YOHeeyaKpne
	 gjgu4AWN8PK3k0vHRGjA1RI41w6JdxQ/moj4MQLwDf1QpwjAekMUBmq5XkyTohB0Sl
	 MfS3IzPJSDHQOolHSX9TMN+8xRoOpI3BoZGzoyUynYHcsFam1PYkIMB1KTkBTWoC/0
	 WYUVFizsyi1x2RQjhtdoP5+a/VsH2/VoT5aUfj6P+IT/emPasAdzWox801owXTA3fJ
	 ECPTEh2JQu7qg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=202/2]=20Be=20more=20tolerant=20of=20RealTimeIsUniversal=20values?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755091963185
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250813133205.1800-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.59b7861bf0a64a93b0f408bd3509c34b?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 13:32:43 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Tolerate RealTimeIsUniversal having the REG_QWORD value type.

In addition, don't fail SystemInitialize when SystemGetTimeInformation
fails to read RealTimeIsUniversal as critical boot drivers (e.g. xenvbd)
may fail to load otherwise.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xen/system.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/xen/system.c b/src/xen/system.c
index 48f9af0..16bbca7 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -1183,7 +1183,8 @@ SystemGetTimeInformation(
     PSYSTEM_CONTEXT Context = &SystemContext;
     UNICODE_STRING  Unicode;
     HANDLE          Key;
-    ULONG           RealTimeIsUniversal;
+    ULONG           ValueDword;
+    ULONGLONG       ValueQword;
     NTSTATUS        status;
 
     RtlInitUnicodeString(&Unicode, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation");
@@ -1192,27 +1193,30 @@ SystemGetTimeInformation(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
-                                     &RealTimeIsUniversal);
-    if (!NT_SUCCESS(status)) {
-        if (status != STATUS_OBJECT_NAME_NOT_FOUND)
-            goto fail2;
+    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal", &ValueDword);
+    if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+        Context->RealTimeIsUniversal = FALSE;
+        goto done;
+    } else if (NT_SUCCESS(status)) {
+        Context->RealTimeIsUniversal = !!ValueDword;
+        goto done;
+    }
 
-        RealTimeIsUniversal = 0;
+    status = RegistryQueryQwordValue(Key, "RealTimeIsUniversal", &ValueQword);
+    if (NT_SUCCESS(status)) {
+        Context->RealTimeIsUniversal = !!ValueQword;
+        goto done;
     }
 
-    Context->RealTimeIsUniversal = RealTimeIsUniversal ? TRUE : FALSE;
+    status = STATUS_UNSUCCESSFUL;
+    Context->RealTimeIsUniversal = FALSE;
 
+done:
     Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
 
     RegistryCloseKey(Key);
 
-    return STATUS_SUCCESS;
-
-fail2:
-    Error("fail2\n");
-
-    RegistryCloseKey(Key);
+    return status;
 
 fail1:
     Error("fail1 (%08x)\n", status);
@@ -1318,19 +1322,16 @@ SystemInitialize(
     if (!NT_SUCCESS(status))
         goto fail8;
 
-    status = SystemGetTimeInformation();
+    status = SystemCheckProcessors();
     if (!NT_SUCCESS(status))
         goto fail9;
 
-    status = SystemCheckProcessors();
+    status = SystemGetTimeInformation();
     if (!NT_SUCCESS(status))
-        goto fail10;
+        Error("Cannot read RealTimeIsUniversal, clock may be incorrect!\n");
 
     return STATUS_SUCCESS;
 
-fail10:
-    Error("fail10\n");
-
 fail9:
     Error("fail9\n");
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 16:09:21 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 16:09:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1080104.1440705 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umE2R-0001M0-CU; Wed, 13 Aug 2025 16:09:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1080104.1440705; Wed, 13 Aug 2025 16:09:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umE2R-0001Lt-9x; Wed, 13 Aug 2025 16:09:19 +0000
Received: by outflank-mailman (input) for mailman id 1080104;
 Wed, 13 Aug 2025 16:09:17 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=A5Bz=2Z=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umE2P-0001Ln-PP
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 16:09:17 +0000
Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com
 [2607:f8b0:4864:20::431])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id db76f6f9-785f-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 18:09:15 +0200 (CEST)
Received: by mail-pf1-x431.google.com with SMTP id
 d2e1a72fcca58-76e2e8e54f8so76722b3a.1
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 09:09:15 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: db76f6f9-785f-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755101354; x=1755706154; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=As4SF8gYw8RkWWJNRz4wl7SKls9inznoMKDvZ/8xhEY=;
        b=JubL75mzONBa4mgiHefHdMx9Y+dIMWIpD4WmtR+vmQlqtxJ0OuZFZ5aQUX2pJ/IXVU
         Dowcj5Ku1mXEkjsVXHe+hf86hcVtedT70mvbFHav5XjogxVp4YMRP9qMiSD9rpQb+Sq2
         4MhZVjUEL8TPieHHqy1KxQ0jFbME4wKogAA2U=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755101354; x=1755706154;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=As4SF8gYw8RkWWJNRz4wl7SKls9inznoMKDvZ/8xhEY=;
        b=dgIj5HI1yIcRIoHSnAo8MEuTUPAu196SsG+ElprI/Cf5hy3A1IGu2b182wrBV0UU6a
         sp81zz+mR9Vl6nsuGl8o1sIuIVUL/qc10EcSWNuh1/VUzW4aFy3Ui5IsBg9BXu2hFp/Q
         o99zQ+EnfBGqXNfO0JLwqXz5uA8T29ZQZV1kgfjf2SC/69hQzzZjg+vH0KayJsaR+EjF
         QK+lq/h3T0Tp32nt0PPFLCHt1pDmoE1JIc1XfHLGH4ART0UOICWVerddchZHFXoHsACI
         Y9ClHAguFm7n6BtlqZgchJHhFwUBvjifh9Ny3NzaV6WcbNUXIdbDaB6BbeuQm+tn/hkt
         L0Hw==
X-Gm-Message-State: AOJu0YzR6SUveNmIMdEmVudUhNshcTQ0XehjB45+sOAMLd8dVULdU5jK
	NI6sMJFf8PQ7I/GAJ52jS/S47gcfeLfWhKqb819uLtfwTAsm9OdTtSTcekzRnu/0jX4leIv12f/
	Qz7zcgCO1zbIrfbNMiDHawUi7w+/1cLRFt5KQuLH3
X-Gm-Gg: ASbGncsUmSs0qphZZWZRjmeAO42JGYX40rFsR6iuUicwwcWv4E/c5eaGVnXkwyvHLBD
	Ne9Y5mCzJa+NyiH3oMgJ4IyrYFtG43uQjA0ulVfWY7el/EBQeUCwjhkkOSjTtex/Q2cwhh2Pe5q
	SdQI3FVsnSgJSekaeth+OWQgnH/5ohOsZE3I2NMdbwWojRtM0R3O0g+rK/qxTN9IQ1yU0eJnJQ+
	RZTofM=
X-Google-Smtp-Source: AGHT+IHHrTCeUs/3U00a+z0cV4DQT2LKmWZ6HRxAswBr8h28F0zYe4jyRDx7hz83XfmFOxYwubqcEBrNFH6ajR7lYhA=
X-Received: by 2002:a17:903:1ae8:b0:240:99da:f0b1 with SMTP id
 d9443c01a7336-2430d1cc9e5mr57517085ad.36.1755101353937; Wed, 13 Aug 2025
 09:09:13 -0700 (PDT)
MIME-Version: 1.0
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech> <20250813133205.1800-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813133205.1800-3-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 13 Aug 2025 17:09:01 +0100
X-Gm-Features: Ac12FXzLCDdHJHFp5Z6P512EpK_-yhrbffxYNY19hfqOvNy7knQPgw2zVgQ8K7Y
Message-ID: <CAC_UY8-UTaa3bqvLPkA9FKV68SihFfPido4zyrx+08GdS54Oag@mail.gmail.com>
Subject: Re: [XENBUS PATCH 2/2] Be more tolerant of RealTimeIsUniversal values
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000bf3781063c4160ec"

--000000000000bf3781063c4160ec
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

>
> -    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> -                                     &RealTimeIsUniversal);
> -    if (!NT_SUCCESS(status)) {
> -        if (status !=3D STATUS_OBJECT_NAME_NOT_FOUND)
> -            goto fail2;
> +    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> &ValueDword);
> +    if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {
> +        Context->RealTimeIsUniversal =3D FALSE;
> +        goto done;
> +    } else if (NT_SUCCESS(status)) {
> +        Context->RealTimeIsUniversal =3D !!ValueDword;
> +        goto done;
> +    }
>
> -        RealTimeIsUniversal =3D 0;
> +    status =3D RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
> &ValueQword);
> +    if (NT_SUCCESS(status)) {
> +        Context->RealTimeIsUniversal =3D !!ValueQword;
> +        goto done;
>      }
>
> -    Context->RealTimeIsUniversal =3D RealTimeIsUniversal ? TRUE : FALSE;
> +    status =3D STATUS_UNSUCCESSFUL;
> +    Context->RealTimeIsUniversal =3D FALSE;
>
> +done:
>      Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
>
> The logic here seems more complicated than required. Would something like

    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
&ValueDword);
    if (NT_SUCCESS(status)) {
        Context->RealTimeIsUniversal =3D !!ValueDword;
        goto done;
    }

    status =3D RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
&ValueQword);
    if (NT_SUCCESS(status)) {
        Context->RealTimeIsUniversal =3D !!ValueQword;
        goto done;
    }

    Context->RealTimeIsUniversal =3D FALSE;

done:
    Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");

be cleaner?

Owen

--000000000000bf3781063c4160ec
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at=
 2:32=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex"><br>
-=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;RealTimeIsU=
niversal);<br>
-=C2=A0 =C2=A0 if (!NT_SUCCESS(status)) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (status !=3D STATUS_OBJECT_NAME_NOT_FOUND)<=
br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail2;<br>
+=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;, &amp;ValueDword);<br>
+=C2=A0 =C2=A0 if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D FALSE;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
+=C2=A0 =C2=A0 } else if (NT_SUCCESS(status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueDwo=
rd;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
+=C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 RealTimeIsUniversal =3D 0;<br>
+=C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;, &amp;ValueQword);<br>
+=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueQwo=
rd;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
-=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D RealTimeIsUniversal ? TR=
UE : FALSE;<br>
+=C2=A0 =C2=A0 status =3D STATUS_UNSUCCESSFUL;<br>
+=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D FALSE;<br>
<br>
+done:<br>
=C2=A0 =C2=A0 =C2=A0Info(&quot;%s\n&quot;, Context-&gt;RealTimeIsUniversal =
? &quot;TRUE&quot; : &quot;FALSE&quot;);<br><br></blockquote><div><span cla=
ss=3D"gmail_default" style=3D"font-family:monospace">The logic here seems m=
ore complicated than required. Would something like</span></div><div><br></=
div><div class=3D"gmail_default" style=3D"font-family:monospace"><span styl=
e=3D"font-family:Arial,Helvetica,sans-serif">=C2=A0 =C2=A0 status =3D Regis=
tryQueryDwordValue(Key, &quot;RealTimeIsUniversal&quot;, &amp;ValueDword);<=
/span></div>=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueDword;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 goto done;<br>=C2=A0 =C2=A0 }<br><br>=C2=A0 =C2=A0 status =3D=
 RegistryQueryQwordValue(Key, &quot;RealTimeIsUniversal&quot;, &amp;ValueQw=
ord);<br>=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueQword;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 goto done;<br>=C2=A0 =C2=A0 }<br><br>=C2=A0 =C2=A0 Context-&g=
t;RealTimeIsUniversal =3D FALSE;<br><br>done:<br>=C2=A0 =C2=A0 Info(&quot;%=
s\n&quot;, Context-&gt;RealTimeIsUniversal ? &quot;TRUE&quot; : &quot;FALSE=
&quot;);</div><div class=3D"gmail_quote gmail_quote_container"><br></div><d=
iv class=3D"gmail_quote gmail_quote_container"><div class=3D"gmail_default"=
 style=3D"font-family:monospace">be cleaner?</div><div class=3D"gmail_defau=
lt" style=3D"font-family:monospace"><br></div><div class=3D"gmail_default" =
style=3D"font-family:monospace">Owen</div><br></div></div>

--000000000000bf3781063c4160ec--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 16:12:08 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 16:12:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1080107.1440709 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umE5A-0002VY-Jm; Wed, 13 Aug 2025 16:12:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1080107.1440709; Wed, 13 Aug 2025 16:12:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umE5A-0002VR-HH; Wed, 13 Aug 2025 16:12:08 +0000
Received: by outflank-mailman (input) for mailman id 1080107;
 Wed, 13 Aug 2025 16:12:07 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Q2kK=2Z=bounce.vates.tech=bounce-md_30504962.689cb953.v1-328991059709447f83d05ce7baa8464a@srs-se1.protection.inumbo.net>)
 id 1umE59-0002VL-F3
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 16:12:07 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 40b7316f-7860-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 18:12:05 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c2D0M6jG0zS62Kc7
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 16:12:03 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 328991059709447f83d05ce7baa8464a; Wed, 13 Aug 2025 16:12:03 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 40b7316f-7860-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755101523; x=1755371523;
	bh=v0XxhTFgYwb5rkgKlSNi1/fARRAIQrsPcdw5QwYuWnc=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=kofzv5hCDhgsPflJ0yKvl6N+//dlZ/GFPjPr1KgEs74spcAK/YKpnmUXwbvqIUShP
	 8y5bQSTU6KA3+SX2eA5Pd1yKnRnMA+Y8xFa62sXgZHtRPxggEPxcmR7GOn+Db9dkOR
	 YEbTD2swTVTkqrq2kPiZQss0io4flCxGZDEffL8BSCmj+GCuOrZrHcFORYavPc3wJ8
	 wDyXKDJZN8N8iXoWBvyQO/Tof6QhkALt/baK4w+Tpf3iZy5tek1z8xL8ujQ4S2kVCE
	 eISby5ZHI8RiXmJoI0ktLPaBNBI9Z5S1/F8OqG0NZLvjX1G5DMRze6c0fE6B4cDLxZ
	 fPTI3S3wCa0RQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755101523; x=1755362023; i=ngoc-tu.dinh@vates.tech;
	bh=v0XxhTFgYwb5rkgKlSNi1/fARRAIQrsPcdw5QwYuWnc=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=BcC/7BMd+R7qyxA1IqXwpohOXolIQ5PpPG2k8CSJjxpsHXLmqgBMI4SsjO/DXXRcz
	 x417fNBsLcQKlleOmu8eA6Y20ieJ4QOtgL9xmGUlncvJTAWZc7y0SnrY13VKc1PuYT
	 nvHNNzfGGDv1/jcwvs3r3IjDAzjLtF6HxFy/lbtifPLTMsPYsh8nV77hbnH4B1sCew
	 J18GZ7MDZxPgxDOMIk/WbCUQRO32YGNo/xeecve8HNw30aVDlZMAvO5kBFz/Bibyiv
	 NVV/MS0VXmBs91E8yZ0RhMNMuYEJzNio0v+YvfmwwrsvOTFuTnWCqRCOcSaJAKxwyA
	 blgGTYmiFZ1bQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=202/2]=20Be=20more=20tolerant=20of=20RealTimeIsUniversal=20values?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755101523135
Message-Id: <e78f52c1-23f1-4f8d-ba64-61d21f824b8e@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech> <20250813133205.1800-3-ngoc-tu.dinh@vates.tech> <CAC_UY8-UTaa3bqvLPkA9FKV68SihFfPido4zyrx+08GdS54Oag@mail.gmail.com>
In-Reply-To: <CAC_UY8-UTaa3bqvLPkA9FKV68SihFfPido4zyrx+08GdS54Oag@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.328991059709447f83d05ce7baa8464a?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 16:12:03 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 13/08/2025 18:09, Owen Smith wrote:
> 
> 
> On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech>=
 wrote:
> 
> 
>     -=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, "RealTimeIsUni=
versal",
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&RealTime=
IsUniversal);
>     -=C2=A0 =C2=A0 if (!NT_SUCCESS(status)) {
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (status !=3D STATUS_OBJECT_NAME_NOT_F=
OUND)
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail2;
>     +=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, "RealTimeIsUni=
versal",
>     &ValueDword);
>     +=C2=A0 =C2=A0 if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D FALSE;
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>     +=C2=A0 =C2=A0 } else if (NT_SUCCESS(status)) {
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D !!Value=
Dword;
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>     +=C2=A0 =C2=A0 }
> 
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 RealTimeIsUniversal =3D 0;
>     +=C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, "RealTimeIsUni=
versal",
>     &ValueQword);
>     +=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D !!Value=
Qword;
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      =C2=A0 =C2=A0 =C2=A0}
> 
>     -=C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D RealTimeIsUniversal ?=
 TRUE : FALSE;
>     +=C2=A0 =C2=A0 status =3D STATUS_UNSUCCESSFUL;
>     +=C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D FALSE;
> 
>     +done:
>      =C2=A0 =C2=A0 =C2=A0Info("%s\n", Context->RealTimeIsUniversal ? "TRU=
E" : "FALSE");
> 
> The logic here seems more complicated than required. Would something like
> 
>  =C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, "RealTimeIsUnivers=
al", 
> &ValueDword);
>  =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D !!ValueDwor=
d;
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>  =C2=A0 =C2=A0 }
> 
>  =C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, "RealTimeIsUnivers=
al", 
> &ValueQword);
>  =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D !!ValueQwor=
d;
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>  =C2=A0 =C2=A0 }
> 
>  =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D FALSE;
> 
> done:
>  =C2=A0 =C2=A0 Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALS=
E");
> 
> be cleaner?
> 
> Owen
> 

I didn't want SystemGetTimeInformation to error out when the 
RealTimeIsUniversal value is absent since its status code is used later 
on for error reporting. But I can also ignore the status code of 
SystemGetTimeInformation instead. What do you prefer?


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 16:17:42 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 16:17:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1080110.1440714 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEAX-0002ct-11; Wed, 13 Aug 2025 16:17:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1080110.1440714; Wed, 13 Aug 2025 16:17:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEAW-0002cm-UU; Wed, 13 Aug 2025 16:17:40 +0000
Received: by outflank-mailman (input) for mailman id 1080110;
 Wed, 13 Aug 2025 16:17:39 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=A5Bz=2Z=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umEAV-0002cf-Gj
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 16:17:39 +0000
Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com
 [2607:f8b0:4864:20::636])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 045f19a8-7861-11f0-b898-0df219b8e170;
 Wed, 13 Aug 2025 18:17:33 +0200 (CEST)
Received: by mail-pl1-x636.google.com with SMTP id
 d9443c01a7336-2406fe901c4so43364665ad.1
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 09:17:33 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 045f19a8-7861-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755101852; x=1755706652; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=bIUJaFYS4KvCYklBLP70Q6rZz9c2fmkKfbUsdonEUo8=;
        b=YggL3RBxde58R+Z5LvvfGmo9gZs1JZCHKCBcWE5WPp4uNpBsrjjA2T8Ob1kpcb+h6z
         Y1QFMI8R0ttFr9Eke7XneJ+nRLbubuX3xV3JZ9cPcTEFxfIvif1I1zo1VRUI3OCZDGPG
         vpL/T8B09fGx1PvzusF3sQA0rKyOItqXuVcRk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755101852; x=1755706652;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=bIUJaFYS4KvCYklBLP70Q6rZz9c2fmkKfbUsdonEUo8=;
        b=H/i2BT1TgLzd4qMJB7bcRg73HHtIdK0zo0jIhuB1RwlgopgD85/jB98g2HhcEwtaHh
         127EvcEnFYCXJ58AK+BEqYx9otjdks9rEzHGVy1jmC3eiJ33Ek2C1xiTceFwLlqdeqbC
         xBMgR4meguCaroMpHmRoieUoPCnOCTIxwU4lH2j5XYie31X6H8RJyopepOuArDqqqJHw
         2+63lqVin2ARM9rNd+3Mpy02+bIXrq2c4+d99P0Ku2PFHn2/D+P8sdRN8EBaW5aejcfY
         JMjXr5vBVbCV57j3a0apsVTSD+cA9hEGI+AABUHo5hUVJOfWzDn+cpoEywCY6TZLZqCa
         90Dw==
X-Gm-Message-State: AOJu0YyKFkk4bLCa9tIDE356r995kdqurZ0g/wAbl8wI1YBI+AD11a3Y
	qI2s82QKG5yBqPr6f429hGwouXXO+wsnJyGOT64RKu1fvw2C/Zg/45UcYeMBK9/0wZGE866Sceb
	g1lYnJda0ml1MI/p1j7Uc5rSXirg48/KyXpSqmov1D4k2/oqUAwm0zQ==
X-Gm-Gg: ASbGncuYSDbODrooZJ6j6rNRXjjRc7pIeN2xeCQLTLfYU9CqYNqpXCIUE52omjdysDh
	VKpaHrmr567ryaKjWYODI1+7XSt+SYBjuU5YIVHGyY+WNpnpEehyeeFhF0Kch0TZqxeudwu3VLe
	2BqvDTgpxLpWPGAJ+oxuXN7gTvdJtarrzVX9AWARtjWwtigFktImm0s+kB7IUL/ellv2ClmkVty
	Gv3TUQ=
X-Google-Smtp-Source: AGHT+IFzA4JXBbNGW68xyfK2wIqq8LAxOEyX6r0dvhMNTy+ID770jPQncxLg07zOnF3l9YMA557YZB37jNBL7+rBgsQ=
X-Received: by 2002:a17:903:1b03:b0:240:a559:be6a with SMTP id
 d9443c01a7336-2430d1a8ea2mr48818945ad.34.1755101851928; Wed, 13 Aug 2025
 09:17:31 -0700 (PDT)
MIME-Version: 1.0
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech>
 <20250813133205.1800-3-ngoc-tu.dinh@vates.tech> <CAC_UY8-UTaa3bqvLPkA9FKV68SihFfPido4zyrx+08GdS54Oag@mail.gmail.com>
 <e78f52c1-23f1-4f8d-ba64-61d21f824b8e@vates.tech>
In-Reply-To: <e78f52c1-23f1-4f8d-ba64-61d21f824b8e@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 13 Aug 2025 17:17:20 +0100
X-Gm-Features: Ac12FXyed-D_6v0pjem6hd-sM4gB8evojew41r2bEV8FZadyrwSc7fmNLBiC6wY
Message-ID: <CAC_UY8-6JDLAOamY8v4mocoFUxhu0E6OWh7FpPByuAVaYjsj8g@mail.gmail.com>
Subject: Re: [XENBUS PATCH 2/2] Be more tolerant of RealTimeIsUniversal values
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="0000000000006df182063c417e8f"

--0000000000006df182063c417e8f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

    status =3D SystemGetTimeInformation();
    if (!NT_SUCCESS(status))
        Error("Cannot read RealTimeIsUniversal, clock may be incorrect!\n")=
;

doesnt log the error code, and still returns STATUS_SUCCESS from this
function (SystemInitialize).

Owen

On Wed, Aug 13, 2025 at 5:12=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> On 13/08/2025 18:09, Owen Smith wrote:
> >
> >
> > On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tec=
h> wrote:
> >
> >
> >     -    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> >     -                                     &RealTimeIsUniversal);
> >     -    if (!NT_SUCCESS(status)) {
> >     -        if (status !=3D STATUS_OBJECT_NAME_NOT_FOUND)
> >     -            goto fail2;
> >     +    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> >     &ValueDword);
> >     +    if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {
> >     +        Context->RealTimeIsUniversal =3D FALSE;
> >     +        goto done;
> >     +    } else if (NT_SUCCESS(status)) {
> >     +        Context->RealTimeIsUniversal =3D !!ValueDword;
> >     +        goto done;
> >     +    }
> >
> >     -        RealTimeIsUniversal =3D 0;
> >     +    status =3D RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
> >     &ValueQword);
> >     +    if (NT_SUCCESS(status)) {
> >     +        Context->RealTimeIsUniversal =3D !!ValueQword;
> >     +        goto done;
> >           }
> >
> >     -    Context->RealTimeIsUniversal =3D RealTimeIsUniversal ? TRUE :
> FALSE;
> >     +    status =3D STATUS_UNSUCCESSFUL;
> >     +    Context->RealTimeIsUniversal =3D FALSE;
> >
> >     +done:
> >           Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE")=
;
> >
> > The logic here seems more complicated than required. Would something li=
ke
> >
> >      status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> > &ValueDword);
> >      if (NT_SUCCESS(status)) {
> >          Context->RealTimeIsUniversal =3D !!ValueDword;
> >          goto done;
> >      }
> >
> >      status =3D RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
> > &ValueQword);
> >      if (NT_SUCCESS(status)) {
> >          Context->RealTimeIsUniversal =3D !!ValueQword;
> >          goto done;
> >      }
> >
> >      Context->RealTimeIsUniversal =3D FALSE;
> >
> > done:
> >      Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
> >
> > be cleaner?
> >
> > Owen
> >
>
> I didn't want SystemGetTimeInformation to error out when the
> RealTimeIsUniversal value is absent since its status code is used later
> on for error reporting. But I can also ignore the status code of
> SystemGetTimeInformation instead. What do you prefer?
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--0000000000006df182063c417e8f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e"><br>=C2=A0 =C2=A0 status =3D SystemGetTimeInformation();<br>=C2=A0 =C2=
=A0 if (!NT_SUCCESS(status))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 Error(&quot;Can=
not read RealTimeIsUniversal, clock may be incorrect!\n&quot;);</div><div c=
lass=3D"gmail_default" style=3D"font-family:monospace"><br></div><div class=
=3D"gmail_default" style=3D"font-family:monospace">doesnt=C2=A0log the erro=
r code, and still returns STATUS_SUCCESS from this function (SystemInitiali=
ze).<br></div><div class=3D"gmail_default" style=3D"font-family:monospace">=
<br></div><div class=3D"gmail_default" style=3D"font-family:monospace">Owen=
</div></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=
=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at 5:12=E2=80=AFPM Tu Di=
nh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">On 13/08/2025 18:09, Owen Smith wrote:<br>
&gt; <br>
&gt; <br>
&gt; On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates=
.tech&gt; wrote:<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(K=
ey, &quot;RealTimeIsUniversal&quot;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&amp;RealTimeIsUniversal);<br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 if (!NT_SUCCESS(status)) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (status !=3D STATUS=
_OBJECT_NAME_NOT_FOUND)<br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fai=
l2;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(K=
ey, &quot;RealTimeIsUniversal&quot;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&amp;ValueDword);<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 if (status =3D=3D STATUS_OBJECT_NAME=
_NOT_FOUND) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIs=
Universal =3D FALSE;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 } else if (NT_SUCCESS(status)) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIs=
Universal =3D !!ValueDword;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 }<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 RealTimeIsUniversal =
=3D 0;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(K=
ey, &quot;RealTimeIsUniversal&quot;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&amp;ValueQword);<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIs=
Universal =3D !!ValueQword;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D =
RealTimeIsUniversal ? TRUE : FALSE;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D STATUS_UNSUCCESSFUL;<br>
&gt;=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D =
FALSE;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0+done:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Info(&quot;%s\n&quot;, Context=
-&gt;RealTimeIsUniversal ? &quot;TRUE&quot; : &quot;FALSE&quot;);<br>
&gt; <br>
&gt; The logic here seems more complicated than required. Would something l=
ike<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, &quot;Real=
TimeIsUniversal&quot;, <br>
&gt; &amp;ValueDword);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D =
!!ValueDword;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 }<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, &quot;Real=
TimeIsUniversal&quot;, <br>
&gt; &amp;ValueQword);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D =
!!ValueQword;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 }<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D FALSE;<br>
&gt; <br>
&gt; done:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 Info(&quot;%s\n&quot;, Context-&gt;RealTimeIsUnive=
rsal ? &quot;TRUE&quot; : &quot;FALSE&quot;);<br>
&gt; <br>
&gt; be cleaner?<br>
&gt; <br>
&gt; Owen<br>
&gt; <br>
<br>
I didn&#39;t want SystemGetTimeInformation to error out when the <br>
RealTimeIsUniversal value is absent since its status code is used later <br=
>
on for error reporting. But I can also ignore the status code of <br>
SystemGetTimeInformation instead. What do you prefer?<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
<br>
</blockquote></div>

--0000000000006df182063c417e8f--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 16:19:13 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 16:19:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1080113.1440717 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEC1-0002hD-5i; Wed, 13 Aug 2025 16:19:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1080113.1440717; Wed, 13 Aug 2025 16:19:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEC1-0002h6-2p; Wed, 13 Aug 2025 16:19:13 +0000
Received: by outflank-mailman (input) for mailman id 1080113;
 Wed, 13 Aug 2025 16:19:11 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=A5Bz=2Z=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umEBz-0002h0-Op
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 16:19:11 +0000
Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com
 [2607:f8b0:4864:20::62a])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 3d332410-7861-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 18:19:10 +0200 (CEST)
Received: by mail-pl1-x62a.google.com with SMTP id
 d9443c01a7336-24306318aeeso16744295ad.1
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 09:19:09 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3d332410-7861-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755101947; x=1755706747; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=+RciGrBK8dmhrDQoR0NQKK5uwI0iFmcG+by6/9lQS+U=;
        b=XFYqCXMODsMaMsF4Td3qzfwyscXxilP0DoCiNKyGSxiDVfrXDgDIZLXk+MBE6O9w/3
         WktRoYLAhoVc2ETIQn8lUU6e30k3IKEuM0PhoWHB8T6USSZzjWBnAty8twG7TL/xgNbb
         L/RuQMfwMXrrmOtEV2GwaSbuwh5g8dPbf3etI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755101947; x=1755706747;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=+RciGrBK8dmhrDQoR0NQKK5uwI0iFmcG+by6/9lQS+U=;
        b=BTTY6yuyqlL+w8cqiYPVBtaxdvfTdTGqkgB60e9RGGoLzvJS/kdybnMJvdNVoCtlza
         oJxypi5B0MML7naPk6DBFydL8kOtlmGMctVRzAsVh6zo2fKw69LjkSIaVzzNKdNtTFK+
         Vmg95UZFQyIv9wmTSicB7PtoA0VRCz4ph50bUUYbIs74N1Ms58Cm5BCbQLHbam1UIR4M
         Bxewb7AwVI0pwa3SHHwlM55U/4WGxZ4XUwl58WfNmIMGXUTwER4+zEoCwumZe3ouv/CK
         YV3vs7xbK22AQvR7ubtOJDVZrQQw/QaeR+5LRHELlOS1IHj8ThGkMbxQDQy1dwjwMuUx
         TTtw==
X-Gm-Message-State: AOJu0YybxFtTt8NJxQpUpAlqbJ6KALE/TTDa7mRObi2nCA7i6vjiq+HN
	gRI571+uhIjoKQroFdtK4t9dwi0O03goNwcpqb+feojJQGipdRZDL4omnD9tpneUByo4gpU65vQ
	Ufy42jErWWdmo8Pmeo4GpFjgIvB4ZT7yFcoIGDDod
X-Gm-Gg: ASbGncufvXcwDRlt36PrKoR7+MpgX+IekoSAsub+CoLeMADvlaYVmmchnCRmGRFXhEy
	Y9VBM1Jl8UT2rfuT0CMv7i7FTpjICIhDjsemHaRSR3PIqcRitWw1IROzoekAnzioUGg2iQqcP6A
	9jy/N+n/aBIwoXe+cI00swuo2TYdzL/sa5yH+fDOUTPutqDSrlokzdEZDPB7RiEezgg9b12PR+g
	uohZYA=
X-Google-Smtp-Source: AGHT+IEBADfl/kV3ivD9ruwkqO1JM0lO84rIK1NxRw5rGH7VEZYotf64PwWjZ2MRJvA8m8JIw1DLuAtQ8egZ01tbCgo=
X-Received: by 2002:a17:902:e78e:b0:240:71ad:a442 with SMTP id
 d9443c01a7336-2430d0b3d07mr57330585ad.9.1755101947373; Wed, 13 Aug 2025
 09:19:07 -0700 (PDT)
MIME-Version: 1.0
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech> <20250813133205.1800-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813133205.1800-2-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 13 Aug 2025 17:18:56 +0100
X-Gm-Features: Ac12FXzLPJuV2zOK8KpQ0vSyWV01-GKUB5pGHHbgyml5eF8ghOH5EDHnSwY0G60
Message-ID: <CAC_UY8-28DVf9azwHQ_sRc_ESmvD=kXCR-vd+wMDeuLtcmZXZA@mail.gmail.com>
Subject: Re: [XENBUS PATCH 1/2] Add RegistryQueryQwordValue
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="0000000000001e47cb063c418496"

--0000000000001e47cb063c418496
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  src/common/registry.c | 70 +++++++++++++++++++++++++++++++++++++++++++
>  src/common/registry.h |  7 +++++
>  2 files changed, 77 insertions(+)
>
> diff --git a/src/common/registry.c b/src/common/registry.c
> index 7965233..1f7a73c 100644
> --- a/src/common/registry.c
> +++ b/src/common/registry.c
> @@ -853,6 +853,76 @@ fail1:
>      return status;
>  }
>
> +NTSTATUS
> +RegistryQueryQwordValue(
> +    _In_ HANDLE                     Key,
> +    _In_ PSTR                       Name,
> +    _Out_ PULONGLONG                Value
> +    )
> +{
> +    ANSI_STRING                     Ansi;
> +    UNICODE_STRING                  Unicode;
> +    PKEY_VALUE_PARTIAL_INFORMATION  Partial;
> +    ULONG                           Size;
> +    NTSTATUS                        status;
> +
> +    RtlInitAnsiString(&Ansi, Name);
> +
> +    status =3D RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
> +    status =3D ZwQueryValueKey(Key,
> +                             &Unicode,
> +                             KeyValuePartialInformation,
> +                             NULL,
> +                             0,
> +                             &Size);
> +    if (!NT_SUCCESS(status) &&
> +        status !=3D STATUS_BUFFER_OVERFLOW &&
> +        status !=3D STATUS_BUFFER_TOO_SMALL)
> +        goto fail2;
> +
> +    Partial =3D __RegistryAllocate(Size);
> +
> +    status =3D STATUS_NO_MEMORY;
> +    if (Partial =3D=3D NULL)
> +        goto fail3;
> +
> +    status =3D ZwQueryValueKey(Key,
> +                             &Unicode,
> +                             KeyValuePartialInformation,
> +                             Partial,
> +                             Size,
> +                             &Size);
> +    if (!NT_SUCCESS(status))
> +        goto fail4;
> +
> +    status =3D STATUS_INVALID_PARAMETER;
> +    if (Partial->Type !=3D REG_QWORD ||
> +        Partial->DataLength !=3D sizeof (ULONGLONG))
> +        goto fail5;
> +
> +    *Value =3D *(PULONGLONG)Partial->Data;
> +
> +    __RegistryFree(Partial);
> +
> +    RtlFreeUnicodeString(&Unicode);
> +
> +    return STATUS_SUCCESS;
> +
> +fail5:
> +fail4:
> +    __RegistryFree(Partial);
> +
> +fail3:
> +fail2:
> +    RtlFreeUnicodeString(&Unicode);
> +
> +fail1:
> +    return status;
> +}
> +
>  NTSTATUS
>  RegistryUpdateDwordValue(
>      _In_ HANDLE                     Key,
> diff --git a/src/common/registry.h b/src/common/registry.h
> index e70a6ed..26bc0c6 100644
> --- a/src/common/registry.h
> +++ b/src/common/registry.h
> @@ -142,6 +142,13 @@ RegistryQueryDwordValue(
>      _Out_ PULONG        Value
>      );
>
> +extern NTSTATUS
> +RegistryQueryQwordValue(
> +    _In_ HANDLE         Key,
> +    _In_ PSTR           Name,
> +    _Out_ PULONGLONG    Value
> +    );
> +
>  extern NTSTATUS
>  RegistryUpdateDwordValue(
>      _In_ HANDLE         Key,
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--0000000000001e47cb063c418496
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen=
.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at=
 2:32=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Tu Dinh &lt;=
ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0src/common/registry.c | 70 ++++++++++++++++++++++++++++++++++++++++++=
+<br>
=C2=A0src/common/registry.h |=C2=A0 7 +++++<br>
=C2=A02 files changed, 77 insertions(+)<br>
<br>
diff --git a/src/common/registry.c b/src/common/registry.c<br>
index 7965233..1f7a73c 100644<br>
--- a/src/common/registry.c<br>
+++ b/src/common/registry.c<br>
@@ -853,6 +853,76 @@ fail1:<br>
=C2=A0 =C2=A0 =C2=A0return status;<br>
=C2=A0}<br>
<br>
+NTSTATUS<br>
+RegistryQueryQwordValue(<br>
+=C2=A0 =C2=A0 _In_ HANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0Key,<br>
+=C2=A0 =C2=A0 _In_ PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Name,<br>
+=C2=A0 =C2=A0 _Out_ PULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 Value<br>
+=C2=A0 =C2=A0 )<br>
+{<br>
+=C2=A0 =C2=A0 ANSI_STRING=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0Ansi;<br>
+=C2=A0 =C2=A0 UNICODE_STRING=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 Unicode;<br>
+=C2=A0 =C2=A0 PKEY_VALUE_PARTIAL_INFORMATION=C2=A0 Partial;<br>
+=C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size;<br>
+=C2=A0 =C2=A0 NTSTATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status;<br>
+<br>
+=C2=A0 =C2=A0 RtlInitAnsiString(&amp;Ansi, Name);<br>
+<br>
+=C2=A0 =C2=A0 status =3D RtlAnsiStringToUnicodeString(&amp;Unicode, &amp;A=
nsi, TRUE);<br>
+=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail1;<br>
+<br>
+=C2=A0 =C2=A0 status =3D ZwQueryValueKey(Key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Unicode,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KeyValuePartialInformation,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Size);<br>
+=C2=A0 =C2=A0 if (!NT_SUCCESS(status) &amp;&amp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 status !=3D STATUS_BUFFER_OVERFLOW &amp;&amp;<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 status !=3D STATUS_BUFFER_TOO_SMALL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail2;<br>
+<br>
+=C2=A0 =C2=A0 Partial =3D __RegistryAllocate(Size);<br>
+<br>
+=C2=A0 =C2=A0 status =3D STATUS_NO_MEMORY;<br>
+=C2=A0 =C2=A0 if (Partial =3D=3D NULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail3;<br>
+<br>
+=C2=A0 =C2=A0 status =3D ZwQueryValueKey(Key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Unicode,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KeyValuePartialInformation,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Partial,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Size);<br>
+=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail4;<br>
+<br>
+=C2=A0 =C2=A0 status =3D STATUS_INVALID_PARAMETER;<br>
+=C2=A0 =C2=A0 if (Partial-&gt;Type !=3D REG_QWORD ||<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Partial-&gt;DataLength !=3D sizeof (ULONGLONG)=
)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail5;<br>
+<br>
+=C2=A0 =C2=A0 *Value =3D *(PULONGLONG)Partial-&gt;Data;<br>
+<br>
+=C2=A0 =C2=A0 __RegistryFree(Partial);<br>
+<br>
+=C2=A0 =C2=A0 RtlFreeUnicodeString(&amp;Unicode);<br>
+<br>
+=C2=A0 =C2=A0 return STATUS_SUCCESS;<br>
+<br>
+fail5:<br>
+fail4:<br>
+=C2=A0 =C2=A0 __RegistryFree(Partial);<br>
+<br>
+fail3:<br>
+fail2:<br>
+=C2=A0 =C2=A0 RtlFreeUnicodeString(&amp;Unicode);<br>
+<br>
+fail1:<br>
+=C2=A0 =C2=A0 return status;<br>
+}<br>
+<br>
=C2=A0NTSTATUS<br>
=C2=A0RegistryUpdateDwordValue(<br>
=C2=A0 =C2=A0 =C2=A0_In_ HANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Key,<br>
diff --git a/src/common/registry.h b/src/common/registry.h<br>
index e70a6ed..26bc0c6 100644<br>
--- a/src/common/registry.h<br>
+++ b/src/common/registry.h<br>
@@ -142,6 +142,13 @@ RegistryQueryDwordValue(<br>
=C2=A0 =C2=A0 =C2=A0_Out_ PULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 Value<br>
=C2=A0 =C2=A0 =C2=A0);<br>
<br>
+extern NTSTATUS<br>
+RegistryQueryQwordValue(<br>
+=C2=A0 =C2=A0 _In_ HANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Key,<br>
+=C2=A0 =C2=A0 _In_ PSTR=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Name,<br>
+=C2=A0 =C2=A0 _Out_ PULONGLONG=C2=A0 =C2=A0 Value<br>
+=C2=A0 =C2=A0 );<br>
+<br>
=C2=A0extern NTSTATUS<br>
=C2=A0RegistryUpdateDwordValue(<br>
=C2=A0 =C2=A0 =C2=A0_In_ HANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Key,<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--0000000000001e47cb063c418496--


From win-pv-devel-bounces@lists.xenproject.org Wed Aug 13 16:20:37 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 13 Aug 2025 16:20:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1080116.1440721 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEDN-0003ha-AH; Wed, 13 Aug 2025 16:20:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1080116.1440721; Wed, 13 Aug 2025 16:20:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umEDN-0003hT-7j; Wed, 13 Aug 2025 16:20:37 +0000
Received: by outflank-mailman (input) for mailman id 1080116;
 Wed, 13 Aug 2025 16:20:35 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=F4Xr=2Z=bounce.vates.tech=bounce-md_30504962.689cbb50.v1-5ce8f502641c4002bc8fd4f75c7578b5@srs-se1.protection.inumbo.net>)
 id 1umEDL-0003hN-GA
 for win-pv-devel@lists.xenproject.org; Wed, 13 Aug 2025 16:20:35 +0000
Received: from mail145-23.atl61.mandrillapp.com
 (mail145-23.atl61.mandrillapp.com [198.2.145.23])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 702413d9-7861-11f0-a328-13f23c93f187;
 Wed, 13 Aug 2025 18:20:34 +0200 (CEST)
Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail145-23.atl61.mandrillapp.com (Mailchimp) with ESMTP id
 4c2DB857nCz1XNJj7
 for <win-pv-devel@lists.xenproject.org>; Wed, 13 Aug 2025 16:20:32 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 5ce8f502641c4002bc8fd4f75c7578b5; Wed, 13 Aug 2025 16:20:32 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 702413d9-7861-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755102032; x=1755372032;
	bh=421jb76wr3zYV0jFNi4hdD2V+0pwVpKgxWwhQ1mEXmA=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lZreVn6hZW1MvfmlBlZftzJHyX4eB7HohNftDgoCbAoMrkHn2+ZbRgYs25KnmFMuY
	 /LJQlCn7ziPwhyyfzfTt455rkIsrprQI1B3r2/z2PsKcnxTwz4sF6kfTI4T9jmypSd
	 8Htb2/HSmLf4uD5xZ2DuJvbEyPMKJyMzIJlPyAdLRbigxyAbheHO7UyVAyxIOVYKyX
	 He+SnG+5LbMA/pb3Wd4il3poj3R2AB3ozzm//z9agKY1JORqLs0j1hhq6OqTOt5vzQ
	 cZLyC0T/6svjYMnd89tRvGkr80qIHrUm1G5dZcWVhKSqqHliNk7bKTrkykq4GiUJCb
	 O9pPivqmrYT4Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755102032; x=1755362532; i=ngoc-tu.dinh@vates.tech;
	bh=421jb76wr3zYV0jFNi4hdD2V+0pwVpKgxWwhQ1mEXmA=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=0DLJBzKzZMTxn7XpPqEkYUYX7Fn3a5ovFcDvyFU8hsEXSUAurSXV3t96UT33FhSK4
	 GTjcLVGVBxIQhVXUmQIX4SefXy51xzF1TYtL2aQzBNcGyzU6GFRFLWtosKGn5Npp+5
	 PT4J+B9cdYijZKDFDxq6ANaKgX1081lLfdM/rRXItyv34UaFTS+WSsUc2LlQISw6EC
	 Ol8ARlpHusHsHhKUjRlDrRrHVV0SUnHAAaHIxZvABASNqk8yAVHTaWe4KVSUHpOkYg
	 RL948ow3ExkwoxnRCNl6c4C6nkhjuoaJSZdXR6OKAS+XeY0enEneqq5ZJcliTVgDLP
	 xETJlPuAVEJ/w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=202/2]=20Be=20more=20tolerant=20of=20RealTimeIsUniversal=20values?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755102032039
Message-Id: <66597c82-d777-446c-b886-edff16ff6da9@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org
References: <20250813133205.1800-1-ngoc-tu.dinh@vates.tech> <20250813133205.1800-3-ngoc-tu.dinh@vates.tech> <CAC_UY8-UTaa3bqvLPkA9FKV68SihFfPido4zyrx+08GdS54Oag@mail.gmail.com> <e78f52c1-23f1-4f8d-ba64-61d21f824b8e@vates.tech> <CAC_UY8-6JDLAOamY8v4mocoFUxhu0E6OWh7FpPByuAVaYjsj8g@mail.gmail.com>
In-Reply-To: <CAC_UY8-6JDLAOamY8v4mocoFUxhu0E6OWh7FpPByuAVaYjsj8g@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.5ce8f502641c4002bc8fd4f75c7578b5?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250813:md
Date: Wed, 13 Aug 2025 16:20:32 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 13/08/2025 18:17, Owen Smith wrote:
> 
>  =C2=A0 =C2=A0 status =3D SystemGetTimeInformation();
>  =C2=A0 =C2=A0 if (!NT_SUCCESS(status))
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 Error("Cannot read RealTimeIsUniversal, cloc=
k may be incorrect! 
> \n");
> 
> doesnt=C2=A0log the error code, and still returns STATUS_SUCCESS from thi=
s 
> function (SystemInitialize).
> 
> Owen

That's intentional to not fail the bootup when RealTimeIsUniversal is 
misconfigured. I'll add the status code to the log entry.

> 
> On Wed, Aug 13, 2025 at 5:12=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech>=
 wrote:
> 
>     On 13/08/2025 18:09, Owen Smith wrote:
>      >
>      >
>      > On Wed, Aug 13, 2025 at 2:32=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vate=
s.tech>
>     wrote:
>      >
>      >
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 status =3D RegistryQueryDwordVal=
ue(Key, "RealTimeIsUniversal",
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0&RealTimeIsUniversal);
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 if (!NT_SUCCESS(status)) {
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (status !=3D ST=
ATUS_OBJECT_NAME_NOT_FOUND)
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto=
 fail2;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D RegistryQueryDwordVal=
ue(Key, "RealTimeIsUniversal",
>      >=C2=A0 =C2=A0 =C2=A0&ValueDword);
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 if (status =3D=3D STATUS_OBJECT_=
NAME_NOT_FOUND) {
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeI=
sUniversal =3D FALSE;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 } else if (NT_SUCCESS(status)) {
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeI=
sUniversal =3D !!ValueDword;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 }
>      >
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 RealTimeIsUniversa=
l =3D 0;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D RegistryQueryQwordVal=
ue(Key, "RealTimeIsUniversal",
>      >=C2=A0 =C2=A0 =C2=A0&ValueQword);
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeI=
sUniversal =3D !!ValueQword;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>      >
>      >=C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D=
 RealTimeIsUniversal ?
>     TRUE : FALSE;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 status =3D STATUS_UNSUCCESSFUL;
>      >=C2=A0 =C2=A0 =C2=A0+=C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D=
 FALSE;
>      >
>      >=C2=A0 =C2=A0 =C2=A0+done:
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Info("%s\n", Context->Real=
TimeIsUniversal ? "TRUE" :
>     "FALSE");
>      >
>      > The logic here seems more complicated than required. Would
>     something like
>      >
>      >=C2=A0 =C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, "RealT=
imeIsUniversal",
>      > &ValueDword);
>      >=C2=A0 =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D=
 !!ValueDword;
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      >=C2=A0 =C2=A0 =C2=A0 }
>      >
>      >=C2=A0 =C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, "RealT=
imeIsUniversal",
>      > &ValueQword);
>      >=C2=A0 =C2=A0 =C2=A0 if (NT_SUCCESS(status)) {
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D=
 !!ValueQword;
>      >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>      >=C2=A0 =C2=A0 =C2=A0 }
>      >
>      >=C2=A0 =C2=A0 =C2=A0 Context->RealTimeIsUniversal =3D FALSE;
>      >
>      > done:
>      >=C2=A0 =C2=A0 =C2=A0 Info("%s\n", Context->RealTimeIsUniversal ? "T=
RUE" : "FALSE");
>      >
>      > be cleaner?
>      >
>      > Owen
>      >
> 
>     I didn't want SystemGetTimeInformation to error out when the
>     RealTimeIsUniversal value is absent since its status code is used lat=
er
>     on for error reporting. But I can also ignore the status code of
>     SystemGetTimeInformation instead. What do you prefer?
> 
> 
>     Ngoc Tu Dinh | Vates XCP-ng Developer
> 
>     XCP-ng & Xen Orchestra - Vates solutions
> 
>     web: https://vates.tech <https://vates.tech>
> 
> 



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 09:37:21 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 09:37:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081172.1441295 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umUOd-0005aA-Ip; Thu, 14 Aug 2025 09:37:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081172.1441295; Thu, 14 Aug 2025 09:37:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umUOd-0005a2-Fv; Thu, 14 Aug 2025 09:37:19 +0000
Received: by outflank-mailman (input) for mailman id 1081172;
 Thu, 14 Aug 2025 09:37:18 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umUOc-0005Zw-Dn
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 09:37:18 +0000
Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com
 [2607:f8b0:4864:20::631])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 440415bb-78f2-11f0-a328-13f23c93f187;
 Thu, 14 Aug 2025 11:37:17 +0200 (CEST)
Received: by mail-pl1-x631.google.com with SMTP id
 d9443c01a7336-24458272c00so10045785ad.3
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 02:37:17 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 440415bb-78f2-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755164236; x=1755769036; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=tyvVtcUrSSJ/q3l5SjvGHPlex/PN9ZawuJEF68mnHFY=;
        b=FD2jBUqaMygwT7FnHAXy+Dg6NHO7rPtk5oMwc3XJqEXTA8rklha0b1f6zVaQjOUqLQ
         u07T8wWv1iVwIjPLEmz1HMkwl51P3+/hDRoBgG1F8LDsdAKwxN+6v+wQVijZ+Qw8yzbk
         r7IgEu/C/uxpPXIk8aoy7RZ+Vt5SCdzSUy1T4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755164236; x=1755769036;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=tyvVtcUrSSJ/q3l5SjvGHPlex/PN9ZawuJEF68mnHFY=;
        b=adqJbCJUQkZz04F4HeE+7nVcZD2t6oz69sftByp1CbSft5EbCgvQlq8Rfb+t0TERvn
         oVijLZyk1l8ziEmJjYpifJSRVgkh9uxDHPmoJ1qjWPvtwAWgCg0NBjm6gdMMLjwtdERy
         WH9w7cG8plwSCo4IOPIR0HvU6kUIx9RZUstiaLOwr/m8SUxAcFbA9Mjaqnjr57CASLl0
         wCewuogKjH7rbweweEZmiLRaS/YjmabnrDf8Tgb+cvHSquZCQZPh52yOpzhV0luJKOS/
         VJUrHxUCX+X7kS647geY6BTFBYg0jMtLjORpS1zGcJDKSiHz/9JePm1bjPlbgXYVq0U5
         /pBw==
X-Gm-Message-State: AOJu0Yzeu0Irs8viOpfRGPqx7s+BTCCO3Jh2I4uf78ON83/sElYT+ttA
	qVmvix91IRtGhq3MamAMD3rGjr81ZIduucV8UZR6z9PewYTqb8UrM53FoixP8xIJ77enXVnRHoN
	tjSZUgcFr0Fs9BhMBmrfgl2uTAV/67oWK6df0SZrqjetYvfNuq4U=
X-Gm-Gg: ASbGncvpMdnKgt10r0ubcO275bhRql52eCC312zfhfFOAOKRvOmy2F/WnR50vF8fc20
	rHwErQKi/iL4UF4Ezi2IrWNapPAROvY/SEu4mtakgNZcCZcFV3SBMLaU3uO3h1O6+aCGcTD5MVQ
	Bm2xRlYJL9Jjf7XZav2CrUiVDduczAt6iJhJURXSnnr2Y7T4OIUCLmfwsIw8oq97jlVJzW1WM6A
	+I7rEc=
X-Google-Smtp-Source: AGHT+IEZNXaGSv6sa0ddwoUDDdu7S/u+Tcrzwp4O3o0vFEGenbxuu/ZEW1isLUdxia3L5cKHu1FSB6znS9qjv2WhFlo=
X-Received: by 2002:a17:903:234b:b0:244:5311:8ed4 with SMTP id
 d9443c01a7336-244586f7d3fmr33515615ad.55.1755164235820; Thu, 14 Aug 2025
 02:37:15 -0700 (PDT)
MIME-Version: 1.0
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech> <20250813124630.1007-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-4-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 10:37:04 +0100
X-Gm-Features: Ac12FXwojUIgh9tOuVzd8VB7L399mLYNlX_hkHuVlN1q2HkvpxCiyjYUymvCyh4
Message-ID: <CAC_UY8_e4Tf6MJRLn7evJ3_6AajmuabcmuSXOdJ6bCWsMPaftw@mail.gmail.com>
Subject: Re: [XENBUS PATCH 3/4] balloon: Stop using fake MDL to store PFN array
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000cc8f0e063c50044f"

--000000000000cc8f0e063c50044f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> @@ -213,90 +208,31 @@ BalloonAllocatePagesForMdl(
>      SkipBytes.QuadPart =3D 0ull;
>      TotalBytes =3D (SIZE_T)Count << PAGE_SHIFT;
>
> -    Mdl =3D MmAllocatePagesForMdlEx(LowAddress,
> -                                  HighAddress,
> -                                  SkipBytes,
> -                                  TotalBytes,
> -                                  MmCached,
> -                                  MM_DONT_ZERO_ALLOCATION |
> -                                  MM_ALLOCATE_PREFER_CONTIGUOUS |
> -                                  MM_ALLOCATE_AND_HOT_REMOVE);
> -    if (Mdl =3D=3D NULL)
> -        goto done;
> -
> -    ASSERT((Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA |
> -                             MDL_PARTIAL_HAS_BEEN_MAPPED |
> -                             MDL_PARTIAL |
> -                             MDL_PARENT_MAPPED_SYSTEM_VA |
> -                             MDL_SOURCE_IS_NONPAGED_POOL)) =3D=3D 0);
> -
> -done:
> -    return Mdl;
> +    return MmAllocatePagesForMdlEx(LowAddress,
> +                                   HighAddress,
> +                                   SkipBytes,
> +                                   TotalBytes,
> +                                   MmCached,
> +                                   MM_DONT_ZERO_ALLOCATION |
> +                                   MM_ALLOCATE_PREFER_CONTIGUOUS |
> +                                   MM_ALLOCATE_AND_HOT_REMOVE);
>  }
>
The only change in this chunk is skipping the ASSERT - how important is the
ASSERT?

Owen

--000000000000cc8f0e063c50044f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64

PGRpdiBkaXI9Imx0ciI+PGRpdiBkaXI9Imx0ciI+PGRpdiBjbGFzcz0iZ21haWxfZGVmYXVsdCIg
c3R5bGU9ImZvbnQtZmFtaWx5Om1vbm9zcGFjZSI+PGJyPjwvZGl2PjwvZGl2Pjxicj48ZGl2IGNs
YXNzPSJnbWFpbF9xdW90ZSBnbWFpbF9xdW90ZV9jb250YWluZXIiPjxkaXYgZGlyPSJsdHIiIGNs
YXNzPSJnbWFpbF9hdHRyIj5PbiBXZWQsIEF1ZyAxMywgMjAyNSBhdCAxOjQ24oCvUE0gVHUgRGlu
aCAmbHQ7bmdvYy10dS5kaW5oQHZhdGVzLnRlY2gmZ3Q7IHdyb3RlOjwvZGl2PjxibG9ja3F1b3Rl
IGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhleDtib3Jk
ZXItbGVmdDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4Ij4NCkBA
IC0yMTMsOTAgKzIwOCwzMSBAQCBCYWxsb29uQWxsb2NhdGVQYWdlc0Zvck1kbCg8YnI+DQrCoCDC
oCDCoFNraXBCeXRlcy5RdWFkUGFydCA9IDB1bGw7PGJyPg0KwqAgwqAgwqBUb3RhbEJ5dGVzID0g
KFNJWkVfVClDb3VudCAmbHQ7Jmx0OyBQQUdFX1NISUZUOzxicj4NCjxicj4NCi3CoCDCoCBNZGwg
PSA8c3BhbiBjbGFzcz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFtaWx5Om1vbm9zcGFj
ZSI+PC9zcGFuPk1tQWxsb2NhdGVQYWdlc0Zvck1kbEV4KExvd0FkZHJlc3MsPGJyPg0KLcKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIEhpZ2hBZGRyZXNz
LDxicj4NCi3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBTa2lwQnl0ZXMsPGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIFRvdGFsQnl0ZXMsPGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIE1tQ2FjaGVkLDxicj4NCi3CoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBNTV9ET05UX1pFUk9fQUxMT0NBVElP
TiB8PGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIE1NX0FMTE9DQVRFX1BSRUZFUl9DT05USUdVT1VTIHw8YnI+DQotwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgTU1fQUxMT0NBVEVfQU5EX0hPVF9S
RU1PVkUpOzxicj4NCi3CoCDCoCBpZiAoTWRsID09IE5VTEwpPGJyPg0KLcKgIMKgIMKgIMKgIGdv
dG8gZG9uZTs8YnI+DQotPGJyPg0KLcKgIMKgIEFTU0VSVCgoTWRsLSZndDtNZGxGbGFncyAmYW1w
OyAoTURMX01BUFBFRF9UT19TWVNURU1fVkEgfDxicj4NCi3CoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1ETF9QQVJUSUFMX0hBU19CRUVOX01BUFBFRCB8PGJyPg0K
LcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgTURMX1BBUlRJQUwg
fDxicj4NCi3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1ETF9Q
QVJFTlRfTUFQUEVEX1NZU1RFTV9WQSB8PGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgTURMX1NPVVJDRV9JU19OT05QQUdFRF9QT09MKSkgPT0gMCk7PGJy
Pg0KLTxicj4NCi1kb25lOjxicj4NCi3CoCDCoCByZXR1cm4gTWRsOzxicj4NCivCoCDCoCByZXR1
cm4gTW1BbGxvY2F0ZVBhZ2VzRm9yTWRsRXgoTG93QWRkcmVzcyw8YnI+DQorwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBIaWdoQWRkcmVzcyw8YnI+
DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBT
a2lwQnl0ZXMsPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgVG90YWxCeXRlcyw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBNbUNhY2hlZCw8YnI+DQorwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBNTV9ET05UX1pFUk9fQUxMT0NB
VElPTiB8PGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgTU1fQUxMT0NBVEVfUFJFRkVSX0NPTlRJR1VPVVMgfDxicj4NCivCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1NX0FMTE9DQVRFX0FO
RF9IT1RfUkVNT1ZFKTs8YnI+DQrCoH08YnI+DQo8L2Jsb2NrcXVvdGU+PGRpdj48c3BhbiBjbGFz
cz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFtaWx5Om1vbm9zcGFjZSI+VGhlIG9ubHkg
Y2hhbmdlIGluIHRoaXMgY2h1bmsgaXMgc2tpcHBpbmcgdGhlIEFTU0VSVCAtIGhvdyBpbXBvcnRh
bnQgaXMgdGhlIEFTU0VSVD88L3NwYW4+PC9kaXY+PGRpdj48c3BhbiBjbGFzcz0iZ21haWxfZGVm
YXVsdCIgc3R5bGU9ImZvbnQtZmFtaWx5Om1vbm9zcGFjZSI+PGJyPjwvc3Bhbj48L2Rpdj48ZGl2
PjxzcGFuIGNsYXNzPSJnbWFpbF9kZWZhdWx0IiBzdHlsZT0iZm9udC1mYW1pbHk6bW9ub3NwYWNl
Ij5Pd2VuPC9zcGFuPjwvZGl2PjwvZGl2PjwvZGl2Pg0K
--000000000000cc8f0e063c50044f--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:21:25 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:21:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081343.1441458 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umV5I-0003KH-FZ; Thu, 14 Aug 2025 10:21:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081343.1441458; Thu, 14 Aug 2025 10:21:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umV5I-0003KA-CS; Thu, 14 Aug 2025 10:21:24 +0000
Received: by outflank-mailman (input) for mailman id 1081343;
 Thu, 14 Aug 2025 10:21:22 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BcIR=22=bounce.vates.tech=bounce-md_30504962.689db895.v1-0b1842573dc94ffab0e1a599f8a62241@srs-se1.protection.inumbo.net>)
 id 1umV5G-0001Tw-L9
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:21:22 +0000
Received: from mail177-2.suw61.mandrillapp.com
 (mail177-2.suw61.mandrillapp.com [198.2.177.2])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 65d17be7-78f8-11f0-a328-13f23c93f187;
 Thu, 14 Aug 2025 12:21:11 +0200 (CEST)
Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail177-2.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4c2h915dWgzS62L0V
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 10:21:09 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0b1842573dc94ffab0e1a599f8a62241; Thu, 14 Aug 2025 10:21:09 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 65d17be7-78f8-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755166869; x=1755436869;
	bh=9p7lAzqBgbrOmxBNC+XADNRKGGXpr5yfl6OJryx12p0=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Qd8kXkp/UnSJMeudl6cHcbU/vEY1drcG9CT4VRQo2m5CCSi3h0M/ckcszvEbYEU1V
	 DUCQezw5wfintL2ENqOxDa10v/5TL36KMZQrB5WDW6f/cY7T90APuv7s0kLzE3ZWed
	 nrQ/cKrgr1zioJBDBBELhMEuTlN2zsTzuhYYSsy0KVwj2t+NxtSwJw1mvsxbxBj4i5
	 R8v66f28NEONoWcMjTFohaYiiWCJfRnJZCQEHop2WPnAxmllkHYonMQ9mA6ogM1snX
	 0OLRilh3gkgwjUhbFYr4RKGpKG6gkM3SykYbjTSUlUE8+C1ZQNCDgpc+EAf98jpzVw
	 sHV9HA34Tzwbw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755166869; x=1755427369; i=ngoc-tu.dinh@vates.tech;
	bh=9p7lAzqBgbrOmxBNC+XADNRKGGXpr5yfl6OJryx12p0=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=U2a5/8w6k6gB/eetP6xrwsKuGVJvorDJLCwNKzsrxZSNunR3Vln1V6xRetB3EY+Kr
	 9QZ+tra93Xa/L9pudnaQZyW9VS854+O6lX7R7iBj3nMkUzUOXhpAyg2L9S+XWsdcn1
	 huKt7uHKo7ZMs259mGLkhxDbLSCPDFwX/yx4ZLcuWi30CY0LBZbyDGViAA5920jnN/
	 tvYo03EZCev5gqz67TrzwbgjsPIEyr6+Um5nser+tEBo1LYpAqbCONJw20eICz83yG
	 uH3VRPc4TiVPIih+EbxQecHNhcD57p1tKyXqbhe1Q0CPlYdXH/XoC/HUQ4h1z49Q/K
	 Um1vpqtS32yxA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[XENBUS=20PATCH=203/4]=20balloon:=20Stop=20using=20fake=20MDL=20to=20store=20PFN=20array?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755166868907
Message-Id: <477d82bc-c6bc-48f9-8637-a630fb071e2a@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech> <20250813124630.1007-4-ngoc-tu.dinh@vates.tech> <CAC_UY8_e4Tf6MJRLn7evJ3_6AajmuabcmuSXOdJ6bCWsMPaftw@mail.gmail.com>
In-Reply-To: <CAC_UY8_e4Tf6MJRLn7evJ3_6AajmuabcmuSXOdJ6bCWsMPaftw@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0b1842573dc94ffab0e1a599f8a62241?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250814:md
Date: Thu, 14 Aug 2025 10:21:09 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 14/08/2025 11:37, Owen Smith wrote:
> 
> 
> On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech>=
 wrote:
> 
>     @@ -213,90 +208,31 @@ BalloonAllocatePagesForMdl(
>      =C2=A0 =C2=A0 =C2=A0SkipBytes.QuadPart =3D 0ull;
>      =C2=A0 =C2=A0 =C2=A0TotalBytes =3D (SIZE_T)Count << PAGE_SHIFT;
> 
>     -=C2=A0 =C2=A0 Mdl =3D MmAllocatePagesForMdlEx(LowAddress,
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 HighAddress,
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SkipBytes,
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TotalBytes,
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MmCached,
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MM_DONT_ZERO_ALLOCATIO=
N |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MM_ALLOCATE_PREFER_CON=
TIGUOUS |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MM_ALLOCATE_AND_HOT_RE=
MOVE);
>     -=C2=A0 =C2=A0 if (Mdl =3D=3D NULL)
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;
>     -
>     -=C2=A0 =C2=A0 ASSERT((Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MDL_PARTIAL_HAS_BEEN_MAPPED |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MDL_PARTIAL |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MDL_PARENT_MAPPED_SYSTEM_VA |
>     -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MDL_SOURCE_IS_NONPAGED_POOL)) =3D=3D =
0);
>     -
>     -done:
>     -=C2=A0 =C2=A0 return Mdl;
>     +=C2=A0 =C2=A0 return MmAllocatePagesForMdlEx(LowAddress,
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0HighAddress,
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SkipBytes,
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TotalBytes,
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MmCached,
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MM_DONT_ZERO_ALL=
OCATION |
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MM_ALLOCATE_PREF=
ER_CONTIGUOUS |
>     +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MM_ALLOCATE_AND_=
HOT_REMOVE);
>      =C2=A0}
> 
> The only change in this chunk is skipping the ASSERT - how important is 
> the ASSERT?
> 
> Owen

The MDL is taken straight from 
MmAllocatePagesForMdlEx(MM_ALLOCATE_AND_HOT_REMOVE), so the assert 
doesn't look important at all to me. I've tested a debug build with 
verifier and saw no crashes.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:31:57 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:31:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081442.1441533 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVFU-0000xH-2F; Thu, 14 Aug 2025 10:31:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081442.1441533; Thu, 14 Aug 2025 10:31:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVFT-0000xA-Vh; Thu, 14 Aug 2025 10:31:55 +0000
Received: by outflank-mailman (input) for mailman id 1081442;
 Thu, 14 Aug 2025 10:31:55 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umVFT-0000vl-05
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:31:55 +0000
Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com
 [2607:f8b0:4864:20::529])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id e509a846-78f9-11f0-a328-13f23c93f187;
 Thu, 14 Aug 2025 12:31:54 +0200 (CEST)
Received: by mail-pg1-x529.google.com with SMTP id
 41be03b00d2f7-b47156b3b79so623358a12.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 03:31:54 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e509a846-78f9-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755167512; x=1755772312; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=Qy+t7ZaWHcEMVyaOtVrgyYetRFrqxqbYH2ZIHZ+wpr4=;
        b=HE6BZyHaY5Q4mwOPh2OiTSuq5Ht7WDXJWtFLQpQcMELcnpESFsV7XMKSbLfnzsuWqZ
         lEoMsDepfvJaMbkbVtDrri98TzG6ywuA09PmparyzjLd8GYeYkleHD+UZEzRLDmyxOt9
         Rjc4X8BDjjE9g9kC1rR0fJPmelbtP9xeouaIc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755167512; x=1755772312;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=Qy+t7ZaWHcEMVyaOtVrgyYetRFrqxqbYH2ZIHZ+wpr4=;
        b=XCOr80BBxlAP0Yub809UnG3ci0/EJJb+iKNdmc4BEi9pk5bn7Ji+A+cMLUKSarscr2
         DX4pH2q3/trTtv+isgvbn0uNhyyuh3+Wytc4YGD1pxFJgFoLaNKzcyaubv81IC9mE4XR
         m0A48Tn/JXQhQQ/a2EUssETVW3N4Sdo6xxpeS4iwyxKl2S3oWmZZTldCMBw+WePe8rtq
         s0ZSln3bhX/5W+a7Kj3e3rtl9mDiYyZ2lazamRvM9jS/goTus/y3fkyxy880iwi11Mt6
         CnT/YYJfQy/K6k1Uc/tcUGa1BhiFIa58HZv9iHV/eJJ3Ybj0Iz6imO7BviJMlJqsXbpV
         wHfw==
X-Gm-Message-State: AOJu0YyANGxoBE8JQpw58nlpGyUQTlttFNg6IKfy9zs43ggmsZVocd8O
	OpQLXIGz8p8tc/mslfZKyIuJeXHExPrfK/+xo2QCVnvgqD4+E11BOVd2ubnNvECJcWsZua4p7KT
	prlaAOVSl93mZ+/VzFlr5f1x+25UPGT+bdH6iExv+CgOxDnCQlIeTWQ==
X-Gm-Gg: ASbGncu7w9mGboE3Fz8GSagd3LMaaehwdNn6rM/7OJ4RcaH86alzRXlJLgg+eb/ke3H
	L9sBtsIyUHWL1IHaHoSJOtHDg00Mvjjvd8rLBH7iQL6I5YAp3YiC7kSgcJkMkj16ghFUm9TyYrJ
	cGHR0SDYFDxPiOLu5lhKumlRAdGOOwuJb3BXExyCa3DJ3KYM/Zk5lGKQTugiGdpZky9yhQYCMEG
	FsgAMcvK2XZuK1+
X-Google-Smtp-Source: AGHT+IEbgZqmbOC8alCDrpozEbNzKius3zu49z/6nOot4iCXdrxIgBo0bJVJUJ9FuYcJfJSZOi/l2ZrfFS81ZwRTU3c=
X-Received: by 2002:a17:903:983:b0:240:4d19:8774 with SMTP id
 d9443c01a7336-2445c67240amr25219305ad.24.1755167512340; Thu, 14 Aug 2025
 03:31:52 -0700 (PDT)
MIME-Version: 1.0
References: <20250808140314.1170-1-ngoc-tu.dinh@vates.tech>
 <20250808140314.1170-3-ngoc-tu.dinh@vates.tech> <0666a8c5-71f5-46e5-8fd7-faeb00fc5063@vates.tech>
In-Reply-To: <0666a8c5-71f5-46e5-8fd7-faeb00fc5063@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 11:31:40 +0100
X-Gm-Features: Ac12FXyM8_xCcnSLsmnfFYXS3tUg7e-0g67DsWHh7hzPl_C1Z3NUeJW1oIIkISs
Message-ID: <CAC_UY88vo0HbJqq6gwK4cagLCrw4Hc7Hdx7+zsd2pvNQoABKVQ@mail.gmail.com>
Subject: Re: [XENBUS PATCH v4 02/11] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000184c32063c50c846"

--000000000000184c32063c50c846
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Odd...

%XenBusName%=3DXenBus_Inst,\
PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_ @VENDOR_DEVICE_ID@5853&REV_01,\
PCI\VEN_5853&DEV_0002,\
PCI\VEN_5853&DEV_0001

parses correctly, but moving the commas from the end of the line, to the
start of the next line fails to parse and generates the warning.
Putting all entries on the same line is fine, but that doesnt work when
VENDOR_DEVICE_ID is null.

The commas may have to be at the end of lines, and just deal with the
'promotion' of 0002 to Hardware ID if VENDOR_DEVICE_ID is null.

Owen

On Wed, Aug 13, 2025 at 10:54=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:

> On 08/08/2025 16:03, Tu Dinh wrote:
> > This makes sure that on driver installation, all supported hardware IDs
> > will be populated into the driver database, thus allowing the device ID
> > to be freely switched without causing boot installation issues.
> >
> > Bump the feature score to compensate for the resulting degradation of
> > identifier-match-type score.
> >
> > Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> > ---
> >   src/xenbus.inf | 14 +++++---------
> >   1 file changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/xenbus.inf b/src/xenbus.inf
> > index 7cc9ac2..bbd22a0 100644
> > --- a/src/xenbus.inf
> > +++ b/src/xenbus.inf
> > @@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@
> _@MICRO_VERSION@_@BUILD_NUMBER@.dl
> >   %Vendor%=3DInst,NT@INF_ARCH@
> >
> >   [Inst.NT@INF_ARCH@]
> > -; DisplayName                Section         DeviceID
> > -; -----------                -------         --------
> > -
> > -%XenBusName_VEND%    =3DXenBus_Inst,   PCI\VEN_5853&DEV_@VENDOR_DEVICE=
_ID
> @&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
> > -%XenBusName_0002%    =3DXenBus_Inst,   PCI\VEN_5853&DEV_0002
> > -%XenBusName_0001%    =3DXenBus_Inst,   PCI\VEN_5853&DEV_0001
> > +%XenBusName%=3DXenBus_Inst,\
> > +PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID
> @5853&REV_01\
> > +,PCI\VEN_5853&DEV_0002\
> > +,PCI\VEN_5853&DEV_0001
> >
> >   [XenBus_Inst]
> >   CopyFiles=3DXenBus_CopyFiles
> >   CopyFiles=3DMonitor_CopyFiles
> > +FeatureScore=3D0xFE
> >
> >   [XenBus_Inst.Services]
> >
>  AddService=3Dxenbus_monitor,%SPSVCSINST_STARTSERVICE%,Monitor_Service,Mo=
nitor_EventLog
> > @@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7
> >   Vendor=3D"@VENDOR_NAME@"
> >   DiskDesc=3D"@PRODUCT_NAME@ PV Bus Package"
> >   XenBusName=3D"@PRODUCT_NAME@ PV Bus"
> > -XenBusName_VEND=3D"@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)"
> > -XenBusName_0002=3D"@PRODUCT_NAME@ PV Bus (0002)"
> > -XenBusName_0001=3D"@PRODUCT_NAME@ PV Bus (0001)"
> >   XenFiltName=3D"@PRODUCT_NAME@ Generic Bus Filter"
> >   MonitorName=3D"@PRODUCT_NAME@ PV Driver Monitor"
> >   MonitorDesc=3D"Provides support for @PRODUCT_NAME@ PV drivers"
>
> This ended up causing an Inf2Cat warning:
>
> 22.9.3: Missing hardware ID (cannot have just compatible ID) in line
> %xenbusname%=3Dxenbus_inst,,,pci\ven_5853&dev_0001 in section
> [inst.ntamd64] of package\xenbus.inf
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000184c32063c50c846
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Odd...</div><div class=3D"gmail_default" style=3D"font-family:monospace"=
><br></div><div class=3D"gmail_default" style=3D"font-family:monospace">%Xe=
nBusName%=3DXenBus_Inst,\<br>PCI\VEN_5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SU=
BSYS_

@VENDOR_DEVICE_ID@5853&amp;REV_01,\<br>PCI\VEN_5853&amp;DEV_0002,\<br>PCI\V=
EN_5853&amp;DEV_0001<br></div><div class=3D"gmail_default" style=3D"font-fa=
mily:monospace"><br></div><div class=3D"gmail_default" style=3D"font-family=
:monospace">parses correctly, but moving the commas from the end of the lin=
e, to the start of the next line fails to parse and generates the warning.<=
br>Putting all entries on the same line is fine, but that doesnt=C2=A0work =
when VENDOR_DEVICE_ID is null.<br><br>The commas may have to be at the end =
of lines, and just deal with the &#39;promotion&#39; of 0002 to Hardware ID=
 if VENDOR_DEVICE_ID is null.</div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-f=
amily:monospace">Owen</div></div><br><div class=3D"gmail_quote gmail_quote_=
container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at 10=
:54=E2=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex">On 08/08/2025 16:03, Tu Dinh =
wrote:<br>
&gt; This makes sure that on driver installation, all supported hardware ID=
s<br>
&gt; will be populated into the driver database, thus allowing the device I=
D<br>
&gt; to be freely switched without causing boot installation issues.<br>
&gt; <br>
&gt; Bump the feature score to compensate for the resulting degradation of<=
br>
&gt; identifier-match-type score.<br>
&gt; <br>
&gt; Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
&gt; ---<br>
&gt;=C2=A0 =C2=A0src/xenbus.inf | 14 +++++---------<br>
&gt;=C2=A0 =C2=A01 file changed, 5 insertions(+), 9 deletions(-)<br>
&gt; <br>
&gt; diff --git a/src/xenbus.inf b/src/xenbus.inf<br>
&gt; index 7cc9ac2..bbd22a0 100644<br>
&gt; --- a/src/xenbus.inf<br>
&gt; +++ b/src/xenbus.inf<br>
&gt; @@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MI=
CRO_VERSION@_@BUILD_NUMBER@.dl<br>
&gt;=C2=A0 =C2=A0%Vendor%=3DInst,NT@INF_ARCH@<br>
&gt;=C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0[Inst.NT@INF_ARCH@]<br>
&gt; -; DisplayName=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
Section=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DeviceID<br>
&gt; -; -----------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
-------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--------<br>
&gt; -<br>
&gt; -%XenBusName_VEND%=C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_58=
53&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@5853&amp;REV_01<=
br>
&gt; -%XenBusName_0002%=C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_58=
53&amp;DEV_0002<br>
&gt; -%XenBusName_0001%=C2=A0 =C2=A0 =3DXenBus_Inst,=C2=A0 =C2=A0PCI\VEN_58=
53&amp;DEV_0001<br>
&gt; +%XenBusName%=3DXenBus_Inst,\<br>
&gt; +PCI\VEN_5853&amp;DEV_@VENDOR_DEVICE_ID@&amp;SUBSYS_@VENDOR_DEVICE_ID@=
5853&amp;REV_01\<br>
&gt; +,PCI\VEN_5853&amp;DEV_0002\<br>
&gt; +,PCI\VEN_5853&amp;DEV_0001<br>
&gt;=C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0[XenBus_Inst]<br>
&gt;=C2=A0 =C2=A0CopyFiles=3DXenBus_CopyFiles<br>
&gt;=C2=A0 =C2=A0CopyFiles=3DMonitor_CopyFiles<br>
&gt; +FeatureScore=3D0xFE<br>
&gt;=C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0[XenBus_Inst.Services]<br>
&gt;=C2=A0 =C2=A0AddService=3Dxenbus_monitor,%SPSVCSINST_STARTSERVICE%,Moni=
tor_Service,Monitor_EventLog<br>
&gt; @@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7<br>
&gt;=C2=A0 =C2=A0Vendor=3D&quot;@VENDOR_NAME@&quot;<br>
&gt;=C2=A0 =C2=A0DiskDesc=3D&quot;@PRODUCT_NAME@ PV Bus Package&quot;<br>
&gt;=C2=A0 =C2=A0XenBusName=3D&quot;@PRODUCT_NAME@ PV Bus&quot;<br>
&gt; -XenBusName_VEND=3D&quot;@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)&qu=
ot;<br>
&gt; -XenBusName_0002=3D&quot;@PRODUCT_NAME@ PV Bus (0002)&quot;<br>
&gt; -XenBusName_0001=3D&quot;@PRODUCT_NAME@ PV Bus (0001)&quot;<br>
&gt;=C2=A0 =C2=A0XenFiltName=3D&quot;@PRODUCT_NAME@ Generic Bus Filter&quot=
;<br>
&gt;=C2=A0 =C2=A0MonitorName=3D&quot;@PRODUCT_NAME@ PV Driver Monitor&quot;=
<br>
&gt;=C2=A0 =C2=A0MonitorDesc=3D&quot;Provides support for @PRODUCT_NAME@ PV=
 drivers&quot;<br>
<br>
This ended up causing an Inf2Cat warning:<br>
<br>
22.9.3: Missing hardware ID (cannot have just compatible ID) in line <br>
%xenbusname%=3Dxenbus_inst,,,pci\ven_5853&amp;dev_0001 in section <br>
[inst.ntamd64] of package\xenbus.inf<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--000000000000184c32063c50c846--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:34:22 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:34:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081454.1441536 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVHq-0001r1-9V; Thu, 14 Aug 2025 10:34:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081454.1441536; Thu, 14 Aug 2025 10:34:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVHq-0001qu-6l; Thu, 14 Aug 2025 10:34:22 +0000
Received: by outflank-mailman (input) for mailman id 1081454;
 Thu, 14 Aug 2025 10:34:21 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umVHo-0001qn-Um
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:34:21 +0000
Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com
 [2607:f8b0:4864:20::529])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 3a9e35e4-78fa-11f0-b898-0df219b8e170;
 Thu, 14 Aug 2025 12:34:18 +0200 (CEST)
Received: by mail-pg1-x529.google.com with SMTP id
 41be03b00d2f7-b4716fb2295so459776a12.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 03:34:17 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3a9e35e4-78fa-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755167656; x=1755772456; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=D1+t+Y/ilFUELVqtDf31ecQ9mZGxUaGwV4p+2SKw49U=;
        b=PmkIy4BP5dD65vxJEqRJxr0cTOtxiN6z6GlZJFt8jWnnv6uUkcKY2QzvSdNIvJdqNU
         zuKN3Ja/E54hnCtFQyjbPlxem2+wjD4YgtCfh8YvDBd33hSUOx0x0d0Rcdynja22R+wo
         feDxZgKAK4du/9CUIYQnUW23+YnMkqLCT0Bqo=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755167656; x=1755772456;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=D1+t+Y/ilFUELVqtDf31ecQ9mZGxUaGwV4p+2SKw49U=;
        b=RN86Ubi5Xjk7fXrquoZtJwuJNN2d1pAT6bC95oZwjH22YDq6oAR30BT+sljbu5/ELp
         Mw6JFTeUmHXWtgW80DrNnmad2QIW/T+APzfash4rFonqBwtGHHGxayb6nLd80pZ2iMc5
         n0zovVD3e+i3ns/DRuY10N+cOQ78METXOgxkCdd6n4xzx34oRQldEcZVRdXgzNE9T6sp
         oC4D+Tdo+JSJHCEjRy48hBygSH5hPP23G6lKU5I9oIs56gYap3IMMFL5KgBTzTXt7Ylh
         noZKcXC21YhowzsAejWZP4TKBNWG8CmTtX2XtE799H+Uucs0MNJsLkwiXfMHRV1tUDmF
         DuZw==
X-Gm-Message-State: AOJu0Yx6QY79a0prNCQPsdhOAdFYzFsD3YJ5oOSqwdy+w0m78sgm67tr
	hJGatHyPzSzhWIcU5lB07FVF+ICongcHA3HcdZb1q+IVm0quMp+SuVJQojtDmAHyMWKMoT/XSpu
	HtKelJQ3WXfbnmZZQMi0Y8cqJG3ZoLLBmc+Lg9penCkCdJjM3RKM=
X-Gm-Gg: ASbGncvo8R8Yeb4oejIUWbYWyjcqFC2bporSty9HQlLY9LooXctOU2u5DR1Ol8BygY5
	OYOKJD54P1G9ubbGiDHL976R9eT4jpYbo5q+sA7BSRa3CROA/mVLykrkNTzkrmG7uvD3O8gyoiM
	mCsAe5Q14Y1s+qcq5m3ooPtQN1STqICS/+rzCMUf6VQaSLGu5fYisKALKl6eV7FSnsTPue+JPoc
	ynG8A==
X-Google-Smtp-Source: AGHT+IGcw6g+t48L583tNh9+XOP71Sq5TriyfazggiVlDrt51Pe+IqpH5AIztDUY1Acd6d7gc/hD1NK65zLu12T1DSo=
X-Received: by 2002:a17:902:f550:b0:242:9bc4:f1c7 with SMTP id
 d9443c01a7336-244586e0821mr39822615ad.54.1755167656146; Thu, 14 Aug 2025
 03:34:16 -0700 (PDT)
MIME-Version: 1.0
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech> <20250813124630.1007-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-2-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 11:34:04 +0100
X-Gm-Features: Ac12FXyAYfDB0TDscySLNElfiT6dyp-AWZ3AhqywvzAYUhzM1D8qvxo8jdbRdCg
Message-ID: <CAC_UY88NGH_xtkd7Yq6ZHk8G1n1VviRuy23b51qbcTA2pn=LAA@mail.gmail.com>
Subject: Re: [XENBUS PATCH 1/4] Check for memory hypercall failure
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000aaa09f063c50d05b"

--000000000000aaa09f063c50d05b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> XENMEM_decrease_reservation and XENMEM_populate_physmap can return a
> negative value on failure. Add a check for these cases.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  include/xen.h        | 18 ++++++++--------
>  src/xen/memory.c     | 40 ++++++++++++++++++++++++++++++------
>  src/xenbus/balloon.c | 49 +++++++++++++++++++++++++++++---------------
>  src/xenbus/fdo.c     | 24 ++++++++++++++++++----
>  4 files changed, 96 insertions(+), 35 deletions(-)
>
> diff --git a/include/xen.h b/include/xen.h
> index 6f28e55..7016c86 100644
> --- a/include/xen.h
> +++ b/include/xen.h
> @@ -140,20 +140,22 @@ MemoryRemoveFromPhysmap(
>
>  _Check_return_
>  XEN_API
> -ULONG
> +NTSTATUS
>  MemoryDecreaseReservation(
> -    _In_ ULONG          Order,
> -    _In_ ULONG          Count,
> -    _In_ PPFN_NUMBER    PfnArray
> +    _In_ ULONG                      Order,
> +    _In_ ULONG                      Count,
> +    _In_ PPFN_NUMBER                PfnArray,
> +    _Out_ PULONG                    Result
>      );
>
>  _Check_return_
>  XEN_API
> -ULONG
> +NTSTATUS
>  MemoryPopulatePhysmap(
> -    _In_ ULONG          Order,
> -    _In_ ULONG          Count,
> -    _In_ PPFN_NUMBER    PfnArray
> +    _In_ ULONG                      Order,
> +    _In_ ULONG                      Count,
> +    _In_ PPFN_NUMBER                PfnArray,
> +    _Out_ PULONG                    Result
>      );
>
>  // EVENT CHANNEL
> diff --git a/src/xen/memory.c b/src/xen/memory.c
> index 6a3a3d0..114e9ac 100644
> --- a/src/xen/memory.c
> +++ b/src/xen/memory.c
> @@ -112,15 +112,17 @@ fail1:
>
>  _Check_return_
>  XEN_API
> -ULONG
> +NTSTATUS
>  MemoryDecreaseReservation(
>      _In_ ULONG                      Order,
>      _In_ ULONG                      Count,
> -    _In_ PPFN_NUMBER                PfnArray
> +    _In_ PPFN_NUMBER                PfnArray,
> +    _Out_ PULONG                    Result
>      )
>  {
>      struct xen_memory_reservation   op;
>      LONG_PTR                        rc;
> +    NTSTATUS                        status;
>
>      set_xen_guest_handle(op.extent_start, PfnArray);
>      op.extent_order =3D Order;
> @@ -130,20 +132,34 @@ MemoryDecreaseReservation(
>
>      rc =3D MemoryOp(XENMEM_decrease_reservation, &op);
>
> -    return (ULONG)rc;
> +    if (rc < 0) {
> +        ERRNO_TO_STATUS(-rc, status);
> +        goto fail1;
> +    }
> +
> +    *Result =3D (ULONG)rc;
> +
> +    return STATUS_SUCCESS;
> +
> +fail1:
> +    Error("fail1 (%08x)\n", status);
> +
> +    return status;
>  }
>
>  _Check_return_
>  XEN_API
> -ULONG
> +NTSTATUS
>  MemoryPopulatePhysmap(
>      _In_ ULONG                      Order,
>      _In_ ULONG                      Count,
> -    _In_ PPFN_NUMBER                PfnArray
> +    _In_ PPFN_NUMBER                PfnArray,
> +    _Out_ PULONG                    Result
>      )
>  {
>      struct xen_memory_reservation   op;
>      LONG_PTR                        rc;
> +    NTSTATUS                        status;
>
>      set_xen_guest_handle(op.extent_start, PfnArray);
>      op.extent_order =3D Order;
> @@ -153,5 +169,17 @@ MemoryPopulatePhysmap(
>
>      rc =3D MemoryOp(XENMEM_populate_physmap, &op);
>
> -    return (ULONG)rc;
> +    if (rc < 0) {
> +        ERRNO_TO_STATUS(-rc, status);
> +        goto fail1;
> +    }
> +
> +    *Result =3D (ULONG)rc;
> +
> +    return STATUS_SUCCESS;
> +
> +fail1:
> +    Error("fail1 (%08x)\n", status);
> +
> +    return status;
>  }
> diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
> index 4affef5..fb4fceb 100644
> --- a/src/xenbus/balloon.c
> +++ b/src/xenbus/balloon.c
> @@ -369,10 +369,11 @@ done:
>      return Count;
>  }
>
> -static ULONG
> +static NTSTATUS
>  BalloonPopulatePhysmap(
>      _In_ ULONG          Requested,
> -    _In_ PPFN_NUMBER    PfnArray
> +    _In_ PPFN_NUMBER    PfnArray,
> +    _Out_ PULONG        Populated
>      )
>  {
>      LARGE_INTEGER       Start;
> @@ -380,12 +381,18 @@ BalloonPopulatePhysmap(
>      ULONGLONG           TimeDelta;
>      ULONGLONG           Rate;
>      ULONG               Count;
> +    NTSTATUS            status;
>
>      ASSERT(Requested !=3D 0);
>
>      KeQuerySystemTime(&Start);
>
> -    Count =3D MemoryPopulatePhysmap(PAGE_ORDER_4K, Requested, PfnArray);
> +    status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,
> +                                   Requested,
> +                                   PfnArray,
> +                                   &Count);
> +    if (!NT_SUCCESS(status))
> +        return status;
>
>      KeQuerySystemTime(&End);
>      TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1)=
;
> @@ -393,7 +400,8 @@ BalloonPopulatePhysmap(
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>
>      Info("%u page(s) at %llu pages/s\n", Count, Rate);
> -    return Count;
> +    *Populated =3D Count;
> +    return STATUS_SUCCESS;
>  }
>
>  static ULONG
> @@ -408,6 +416,7 @@ BalloonPopulatePfnArray(
>      ULONGLONG                       Rate;
>      ULONG                           Index;
>      ULONG                           Count;
> +    NTSTATUS                        status;
>
>      ASSERT(Requested !=3D 0);
>      ASSERT3U(Requested, <=3D, XENBUS_BALLOON_PFN_ARRAY_SIZE);
> @@ -417,7 +426,6 @@ BalloonPopulatePfnArray(
>
>      for (Index =3D 0; Index < Requested; Index++) {
>          LONGLONG    Pfn;
> -        NTSTATUS    status;
>
>          status =3D XENBUS_RANGE_SET(Pop,
>                                    &Context->RangeSetInterface,
> @@ -429,12 +437,12 @@ BalloonPopulatePfnArray(
>          Context->PfnArray[Index] =3D (PFN_NUMBER)Pfn;
>      }
>
> -    Count =3D BalloonPopulatePhysmap(Requested, Context->PfnArray);
> +    status =3D BalloonPopulatePhysmap(Requested, Context->PfnArray, &Cou=
nt);
> +    if (!NT_SUCCESS(status))
> +        Count =3D 0;
>
>      Index =3D Count;
>      while (Index < Requested) {
> -        NTSTATUS    status;
> -
>          status =3D XENBUS_RANGE_SET(Put,
>                                    &Context->RangeSetInterface,
>                                    Context->RangeSet,
> @@ -456,10 +464,11 @@ BalloonPopulatePfnArray(
>      return Count;
>  }
>
> -static ULONG
> +static NTSTATUS
>  BalloonDecreaseReservation(
>      _In_ ULONG          Requested,
> -    _In_ PPFN_NUMBER    PfnArray
> +    _In_ PPFN_NUMBER    PfnArray,
> +    _Out_ PULONG        Decreased
>      )
>  {
>      LARGE_INTEGER       Start;
> @@ -467,12 +476,18 @@ BalloonDecreaseReservation(
>      ULONGLONG           TimeDelta;
>      ULONGLONG           Rate;
>      ULONG               Count;
> +    NTSTATUS            status;
>
>      ASSERT(Requested !=3D 0);
>
>      KeQuerySystemTime(&Start);
>
> -    Count =3D MemoryDecreaseReservation(PAGE_ORDER_4K, Requested, PfnArr=
ay);
> +    status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,
> +                                       Requested,
> +                                       PfnArray,
> +                                       &Count);
> +    if (!NT_SUCCESS(status))
> +        return status;
>
>      KeQuerySystemTime(&End);
>      TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1)=
;
> @@ -480,7 +495,8 @@ BalloonDecreaseReservation(
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>
>      Info("%u page(s) at %llu pages/s\n", Count, Rate);
> -    return Count;
> +    *Decreased =3D Count;
> +    return STATUS_SUCCESS;
>  }
>
>  static ULONG
> @@ -495,6 +511,7 @@ BalloonReleasePfnArray(
>      ULONGLONG                       Rate;
>      ULONG                           Index;
>      ULONG                           Count;
> +    NTSTATUS                        status;
>
>      ASSERT3U(Requested, <=3D, XENBUS_BALLOON_PFN_ARRAY_SIZE);
>
> @@ -506,8 +523,6 @@ BalloonReleasePfnArray(
>
>      Index =3D 0;
>      while (Index < Requested) {
> -        NTSTATUS    status;
> -
>          status =3D XENBUS_RANGE_SET(Put,
>                                    &Context->RangeSetInterface,
>                                    Context->RangeSet,
> @@ -520,13 +535,13 @@ BalloonReleasePfnArray(
>      }
>      Requested =3D Index;
>
> -    Count =3D BalloonDecreaseReservation(Requested, Context->PfnArray);
> +    status =3D BalloonDecreaseReservation(Requested, Context->PfnArray,
> &Count);
> +    if (!NT_SUCCESS(status))
> +        Count =3D 0;
>
>      RtlZeroMemory(Context->PfnArray, Count * sizeof (PFN_NUMBER));
>
>      for (Index =3D Count; Index < Requested; Index++) {
> -        NTSTATUS    status;
> -
>          status =3D XENBUS_RANGE_SET(Get,
>                                    &Context->RangeSetInterface,
>                                    Context->RangeSet,
> diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
> index 92a83b6..4e87727 100644
> --- a/src/xenbus/fdo.c
> +++ b/src/xenbus/fdo.c
> @@ -3400,6 +3400,7 @@ FdoMemoryHoleAllocate(
>  {
>      PMDL                Mdl;
>      PPFN_NUMBER         PfnArray;
> +    ULONG               Decreased;
>      NTSTATUS            status;
>
>      UNREFERENCED_PARAMETER(Fdo);
> @@ -3412,12 +3413,21 @@ FdoMemoryHoleAllocate(
>
>      PfnArray =3D MmGetMdlPfnArray(Mdl);
>
> -    status =3D STATUS_UNSUCCESSFUL;
> -    if (MemoryDecreaseReservation(PAGE_ORDER_4K, Count, PfnArray) !=3D
> Count)
> +    status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,
> +                                       Count,
> +                                       PfnArray,
> +                                       &Decreased);
> +    if (!NT_SUCCESS(status))
>          goto fail2;
>
> +    status =3D STATUS_UNSUCCESSFUL;
> +    if (Decreased !=3D Count)
> +        goto fail3;
> +
>      return Mdl;
>
> +fail3:
> +
>  fail2:
>      Error("fail2\n");
>
> @@ -3437,14 +3447,20 @@ FdoMemoryHoleFree(
>  {
>      ULONG               Count;
>      PPFN_NUMBER         PfnArray;
> +    ULONG               Populated;
> +    NTSTATUS            status;
>
>      UNREFERENCED_PARAMETER(Fdo);
>
>      Count =3D Mdl->ByteCount >> PAGE_SHIFT;
>      PfnArray =3D MmGetMdlPfnArray(Mdl);
>
> -    if (MemoryPopulatePhysmap(PAGE_ORDER_4K, Count, PfnArray) !=3D Count=
)
> -        BUG("FAILED TO RE-POPULATE HOLE");
> +    status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,
> +                                   Count,
> +                                   PfnArray,
> +                                   &Populated);
> +    BUG_ON(!NT_SUCCESS(status));
> +    BUG_ON(Populated !=3D Count);
>
>      __FreePages(Mdl);
>  }
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000aaa09f063c50d05b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64

PGRpdiBkaXI9Imx0ciI+PGRpdiBjbGFzcz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFt
aWx5Om1vbm9zcGFjZSI+UmV2aWV3ZWQtYnk6IE93ZW4gU21pdGggJmx0OzxhIGhyZWY9Im1haWx0
bzpvd2VuLnNtaXRoQGNsb3VkLmNvbSI+b3dlbi5zbWl0aEBjbG91ZC5jb208L2E+Jmd0OzwvZGl2
PjwvZGl2Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSBnbWFpbF9xdW90ZV9jb250YWluZXIi
PjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBXZWQsIEF1ZyAxMywgMjAyNSBh
dCAxOjQ24oCvUE0gVHUgRGluaCAmbHQ7bmdvYy10dS5kaW5oQHZhdGVzLnRlY2gmZ3Q7IHdyb3Rl
Ojxicj48L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46
MHB4IDBweCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7
cGFkZGluZy1sZWZ0OjFleCI+WEVOTUVNX2RlY3JlYXNlX3Jlc2VydmF0aW9uIGFuZCBYRU5NRU1f
cG9wdWxhdGVfcGh5c21hcCBjYW4gcmV0dXJuIGE8YnI+DQpuZWdhdGl2ZSB2YWx1ZSBvbiBmYWls
dXJlLiBBZGQgYSBjaGVjayBmb3IgdGhlc2UgY2FzZXMuPGJyPg0KPGJyPg0KU2lnbmVkLW9mZi1i
eTogVHUgRGluaCAmbHQ7bmdvYy10dS5kaW5oQHZhdGVzLnRlY2gmZ3Q7PGJyPg0KLS0tPGJyPg0K
wqBpbmNsdWRlL3hlbi5owqAgwqAgwqAgwqAgfCAxOCArKysrKysrKy0tLS0tLS0tPGJyPg0KwqBz
cmMveGVuL21lbW9yeS5jwqAgwqAgwqB8IDQwICsrKysrKysrKysrKysrKysrKysrKysrKysrKysr
Ky0tLS0tLTxicj4NCsKgc3JjL3hlbmJ1cy9iYWxsb29uLmMgfCA0OSArKysrKysrKysrKysrKysr
KysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0tLTxicj4NCsKgc3JjL3hlbmJ1cy9mZG8uY8KgIMKg
IMKgfCAyNCArKysrKysrKysrKysrKysrKystLS0tPGJyPg0KwqA0IGZpbGVzIGNoYW5nZWQsIDk2
IGluc2VydGlvbnMoKyksIDM1IGRlbGV0aW9ucygtKTxicj4NCjxicj4NCmRpZmYgLS1naXQgYS9p
bmNsdWRlL3hlbi5oIGIvaW5jbHVkZS94ZW4uaDxicj4NCmluZGV4IDZmMjhlNTUuLjcwMTZjODYg
MTAwNjQ0PGJyPg0KLS0tIGEvaW5jbHVkZS94ZW4uaDxicj4NCisrKyBiL2luY2x1ZGUveGVuLmg8
YnI+DQpAQCAtMTQwLDIwICsxNDAsMjIgQEAgTWVtb3J5UmVtb3ZlRnJvbVBoeXNtYXAoPGJyPg0K
PGJyPg0KwqBfQ2hlY2tfcmV0dXJuXzxicj4NCsKgWEVOX0FQSTxicj4NCi1VTE9ORzxicj4NCitO
VFNUQVRVUzxicj4NCsKgTWVtb3J5RGVjcmVhc2VSZXNlcnZhdGlvbig8YnI+DQotwqAgwqAgX0lu
XyBVTE9OR8KgIMKgIMKgIMKgIMKgIE9yZGVyLDxicj4NCi3CoCDCoCBfSW5fIFVMT05HwqAgwqAg
wqAgwqAgwqAgQ291bnQsPGJyPg0KLcKgIMKgIF9Jbl8gUFBGTl9OVU1CRVLCoCDCoCBQZm5BcnJh
eTxicj4NCivCoCDCoCBfSW5fIFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
T3JkZXIsPGJyPg0KK8KgIMKgIF9Jbl8gVUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCBDb3VudCw8YnI+DQorwqAgwqAgX0luXyBQUEZOX05VTUJFUsKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIFBmbkFycmF5LDxicj4NCivCoCDCoCBfT3V0XyBQVUxPTkfCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCBSZXN1bHQ8YnI+DQrCoCDCoCDCoCk7PGJyPg0KPGJyPg0KwqBfQ2hlY2tf
cmV0dXJuXzxicj4NCsKgWEVOX0FQSTxicj4NCi1VTE9ORzxicj4NCitOVFNUQVRVUzxicj4NCsKg
TWVtb3J5UG9wdWxhdGVQaHlzbWFwKDxicj4NCi3CoCDCoCBfSW5fIFVMT05HwqAgwqAgwqAgwqAg
wqAgT3JkZXIsPGJyPg0KLcKgIMKgIF9Jbl8gVUxPTkfCoCDCoCDCoCDCoCDCoCBDb3VudCw8YnI+
DQotwqAgwqAgX0luXyBQUEZOX05VTUJFUsKgIMKgIFBmbkFycmF5PGJyPg0KK8KgIMKgIF9Jbl8g
VUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBPcmRlciw8YnI+DQorwqAgwqAg
X0luXyBVTE9OR8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIENvdW50LDxicj4NCivC
oCDCoCBfSW5fIFBQRk5fTlVNQkVSwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgUGZuQXJyYXksPGJy
Pg0KK8KgIMKgIF9PdXRfIFBVTE9OR8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFJlc3Vs
dDxicj4NCsKgIMKgIMKgKTs8YnI+DQo8YnI+DQrCoC8vIEVWRU5UIENIQU5ORUw8YnI+DQpkaWZm
IC0tZ2l0IGEvc3JjL3hlbi9tZW1vcnkuYyBiL3NyYy94ZW4vbWVtb3J5LmM8YnI+DQppbmRleCA2
YTNhM2QwLi4xMTRlOWFjIDEwMDY0NDxicj4NCi0tLSBhL3NyYy94ZW4vbWVtb3J5LmM8YnI+DQor
KysgYi9zcmMveGVuL21lbW9yeS5jPGJyPg0KQEAgLTExMiwxNSArMTEyLDE3IEBAIGZhaWwxOjxi
cj4NCjxicj4NCsKgX0NoZWNrX3JldHVybl88YnI+DQrCoFhFTl9BUEk8YnI+DQotVUxPTkc8YnI+
DQorTlRTVEFUVVM8YnI+DQrCoE1lbW9yeURlY3JlYXNlUmVzZXJ2YXRpb24oPGJyPg0KwqAgwqAg
wqBfSW5fIFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgT3JkZXIsPGJyPg0K
wqAgwqAgwqBfSW5fIFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgQ291bnQs
PGJyPg0KLcKgIMKgIF9Jbl8gUFBGTl9OVU1CRVLCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBQZm5B
cnJheTxicj4NCivCoCDCoCBfSW5fIFBQRk5fTlVNQkVSwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
UGZuQXJyYXksPGJyPg0KK8KgIMKgIF9PdXRfIFBVTE9OR8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIFJlc3VsdDxicj4NCsKgIMKgIMKgKTxicj4NCsKgezxicj4NCsKgIMKgIMKgc3RydWN0
IHhlbl9tZW1vcnlfcmVzZXJ2YXRpb27CoCDCoG9wOzxicj4NCsKgIMKgIMKgTE9OR19QVFLCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCByYzs8YnI+DQorwqAgwqAgTlRTVEFUVVPC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBzdGF0dXM7PGJyPg0KPGJyPg0KwqAg
wqAgwqBzZXRfeGVuX2d1ZXN0X2hhbmRsZShvcC5leHRlbnRfc3RhcnQsIFBmbkFycmF5KTs8YnI+
DQrCoCDCoCDCoG9wLmV4dGVudF9vcmRlciA9IE9yZGVyOzxicj4NCkBAIC0xMzAsMjAgKzEzMiwz
NCBAQCBNZW1vcnlEZWNyZWFzZVJlc2VydmF0aW9uKDxicj4NCjxicj4NCsKgIMKgIMKgcmMgPSBN
ZW1vcnlPcChYRU5NRU1fZGVjcmVhc2VfcmVzZXJ2YXRpb24sICZhbXA7b3ApOzxicj4NCjxicj4N
Ci3CoCDCoCByZXR1cm4gKFVMT05HKXJjOzxicj4NCivCoCDCoCBpZiAocmMgJmx0OyAwKSB7PGJy
Pg0KK8KgIMKgIMKgIMKgIEVSUk5PX1RPX1NUQVRVUygtcmMsIHN0YXR1cyk7PGJyPg0KK8KgIMKg
IMKgIMKgIGdvdG8gZmFpbDE7PGJyPg0KK8KgIMKgIH08YnI+DQorPGJyPg0KK8KgIMKgICpSZXN1
bHQgPSAoVUxPTkcpcmM7PGJyPg0KKzxicj4NCivCoCDCoCByZXR1cm4gU1RBVFVTX1NVQ0NFU1M7
PGJyPg0KKzxicj4NCitmYWlsMTo8YnI+DQorwqAgwqAgRXJyb3IoJnF1b3Q7ZmFpbDEgKCUwOHgp
XG4mcXVvdDssIHN0YXR1cyk7PGJyPg0KKzxicj4NCivCoCDCoCByZXR1cm4gc3RhdHVzOzxicj4N
CsKgfTxicj4NCjxicj4NCsKgX0NoZWNrX3JldHVybl88YnI+DQrCoFhFTl9BUEk8YnI+DQotVUxP
Tkc8YnI+DQorTlRTVEFUVVM8YnI+DQrCoE1lbW9yeVBvcHVsYXRlUGh5c21hcCg8YnI+DQrCoCDC
oCDCoF9Jbl8gVUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBPcmRlciw8YnI+
DQrCoCDCoCDCoF9Jbl8gVUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBDb3Vu
dCw8YnI+DQotwqAgwqAgX0luXyBQUEZOX05VTUJFUsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFBm
bkFycmF5PGJyPg0KK8KgIMKgIF9Jbl8gUFBGTl9OVU1CRVLCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBQZm5BcnJheSw8YnI+DQorwqAgwqAgX091dF8gUFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgUmVzdWx0PGJyPg0KwqAgwqAgwqApPGJyPg0KwqB7PGJyPg0KwqAgwqAgwqBzdHJ1
Y3QgeGVuX21lbW9yeV9yZXNlcnZhdGlvbsKgIMKgb3A7PGJyPg0KwqAgwqAgwqBMT05HX1BUUsKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHJjOzxicj4NCivCoCDCoCBOVFNUQVRV
U8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHN0YXR1czs8YnI+DQo8YnI+DQrC
oCDCoCDCoHNldF94ZW5fZ3Vlc3RfaGFuZGxlKG9wLmV4dGVudF9zdGFydCwgUGZuQXJyYXkpOzxi
cj4NCsKgIMKgIMKgb3AuZXh0ZW50X29yZGVyID0gT3JkZXI7PGJyPg0KQEAgLTE1Myw1ICsxNjks
MTcgQEAgTWVtb3J5UG9wdWxhdGVQaHlzbWFwKDxicj4NCjxicj4NCsKgIMKgIMKgcmMgPSBNZW1v
cnlPcChYRU5NRU1fcG9wdWxhdGVfcGh5c21hcCwgJmFtcDtvcCk7PGJyPg0KPGJyPg0KLcKgIMKg
IHJldHVybiAoVUxPTkcpcmM7PGJyPg0KK8KgIMKgIGlmIChyYyAmbHQ7IDApIHs8YnI+DQorwqAg
wqAgwqAgwqAgRVJSTk9fVE9fU1RBVFVTKC1yYywgc3RhdHVzKTs8YnI+DQorwqAgwqAgwqAgwqAg
Z290byBmYWlsMTs8YnI+DQorwqAgwqAgfTxicj4NCis8YnI+DQorwqAgwqAgKlJlc3VsdCA9IChV
TE9ORylyYzs8YnI+DQorPGJyPg0KK8KgIMKgIHJldHVybiBTVEFUVVNfU1VDQ0VTUzs8YnI+DQor
PGJyPg0KK2ZhaWwxOjxicj4NCivCoCDCoCBFcnJvcigmcXVvdDtmYWlsMSAoJTA4eClcbiZxdW90
Oywgc3RhdHVzKTs8YnI+DQorPGJyPg0KK8KgIMKgIHJldHVybiBzdGF0dXM7PGJyPg0KwqB9PGJy
Pg0KZGlmZiAtLWdpdCBhL3NyYy94ZW5idXMvYmFsbG9vbi5jIGIvc3JjL3hlbmJ1cy9iYWxsb29u
LmM8YnI+DQppbmRleCA0YWZmZWY1Li5mYjRmY2ViIDEwMDY0NDxicj4NCi0tLSBhL3NyYy94ZW5i
dXMvYmFsbG9vbi5jPGJyPg0KKysrIGIvc3JjL3hlbmJ1cy9iYWxsb29uLmM8YnI+DQpAQCAtMzY5
LDEwICszNjksMTEgQEAgZG9uZTo8YnI+DQrCoCDCoCDCoHJldHVybiBDb3VudDs8YnI+DQrCoH08
YnI+DQo8YnI+DQotc3RhdGljIFVMT05HPGJyPg0KK3N0YXRpYyBOVFNUQVRVUzxicj4NCsKgQmFs
bG9vblBvcHVsYXRlUGh5c21hcCg8YnI+DQrCoCDCoCDCoF9Jbl8gVUxPTkfCoCDCoCDCoCDCoCDC
oCBSZXF1ZXN0ZWQsPGJyPg0KLcKgIMKgIF9Jbl8gUFBGTl9OVU1CRVLCoCDCoCBQZm5BcnJheTxi
cj4NCivCoCDCoCBfSW5fIFBQRk5fTlVNQkVSwqAgwqAgUGZuQXJyYXksPGJyPg0KK8KgIMKgIF9P
dXRfIFBVTE9OR8KgIMKgIMKgIMKgIFBvcHVsYXRlZDxicj4NCsKgIMKgIMKgKTxicj4NCsKgezxi
cj4NCsKgIMKgIMKgTEFSR0VfSU5URUdFUsKgIMKgIMKgIMKgU3RhcnQ7PGJyPg0KQEAgLTM4MCwx
MiArMzgxLDE4IEBAIEJhbGxvb25Qb3B1bGF0ZVBoeXNtYXAoPGJyPg0KwqAgwqAgwqBVTE9OR0xP
TkfCoCDCoCDCoCDCoCDCoCDCoFRpbWVEZWx0YTs8YnI+DQrCoCDCoCDCoFVMT05HTE9OR8KgIMKg
IMKgIMKgIMKgIMKgUmF0ZTs8YnI+DQrCoCDCoCDCoFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqBDb3VudDs8YnI+DQorwqAgwqAgTlRTVEFUVVPCoCDCoCDCoCDCoCDCoCDCoCBzdGF0dXM7PGJy
Pg0KPGJyPg0KwqAgwqAgwqBBU1NFUlQoUmVxdWVzdGVkICE9IDApOzxicj4NCjxicj4NCsKgIMKg
IMKgS2VRdWVyeVN5c3RlbVRpbWUoJmFtcDtTdGFydCk7PGJyPg0KPGJyPg0KLcKgIMKgIENvdW50
ID0gTWVtb3J5UG9wdWxhdGVQaHlzbWFwKFBBR0VfT1JERVJfNEssIFJlcXVlc3RlZCwgUGZuQXJy
YXkpOzxicj4NCivCoCDCoCBzdGF0dXMgPSBNZW1vcnlQb3B1bGF0ZVBoeXNtYXAoUEFHRV9PUkRF
Ul80Syw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqBSZXF1ZXN0ZWQsPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgUGZuQXJyYXksPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgJmFtcDtDb3VudCk7PGJyPg0KK8KgIMKg
IGlmICghTlRfU1VDQ0VTUyhzdGF0dXMpKTxicj4NCivCoCDCoCDCoCDCoCByZXR1cm4gc3RhdHVz
Ozxicj4NCjxicj4NCsKgIMKgIMKgS2VRdWVyeVN5c3RlbVRpbWUoJmFtcDtFbmQpOzxicj4NCsKg
IMKgIMKgVGltZURlbHRhID0gX19tYXgoKChFbmQuUXVhZFBhcnQgLSBTdGFydC5RdWFkUGFydCkg
LyAxMDAwMHVsbCksIDEpOzxicj4NCkBAIC0zOTMsNyArNDAwLDggQEAgQmFsbG9vblBvcHVsYXRl
UGh5c21hcCg8YnI+DQrCoCDCoCDCoFJhdGUgPSAoVUxPTkdMT05HKShDb3VudCAqIDEwMDApIC8g
VGltZURlbHRhOzxicj4NCjxicj4NCsKgIMKgIMKgSW5mbygmcXVvdDsldSBwYWdlKHMpIGF0ICVs
bHUgcGFnZXMvc1xuJnF1b3Q7LCBDb3VudCwgUmF0ZSk7PGJyPg0KLcKgIMKgIHJldHVybiBDb3Vu
dDs8YnI+DQorwqAgwqAgKlBvcHVsYXRlZCA9IENvdW50Ozxicj4NCivCoCDCoCByZXR1cm4gU1RB
VFVTX1NVQ0NFU1M7PGJyPg0KwqB9PGJyPg0KPGJyPg0KwqBzdGF0aWMgVUxPTkc8YnI+DQpAQCAt
NDA4LDYgKzQxNiw3IEBAIEJhbGxvb25Qb3B1bGF0ZVBmbkFycmF5KDxicj4NCsKgIMKgIMKgVUxP
TkdMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBSYXRlOzxicj4NCsKgIMKg
IMKgVUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoEluZGV4Ozxi
cj4NCsKgIMKgIMKgVUxPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oENvdW50Ozxicj4NCivCoCDCoCBOVFNUQVRVU8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIHN0YXR1czs8YnI+DQo8YnI+DQrCoCDCoCDCoEFTU0VSVChSZXF1ZXN0ZWQgIT0gMCk7
PGJyPg0KwqAgwqAgwqBBU1NFUlQzVShSZXF1ZXN0ZWQsICZsdDs9LCBYRU5CVVNfQkFMTE9PTl9Q
Rk5fQVJSQVlfU0laRSk7PGJyPg0KQEAgLTQxNyw3ICs0MjYsNiBAQCBCYWxsb29uUG9wdWxhdGVQ
Zm5BcnJheSg8YnI+DQo8YnI+DQrCoCDCoCDCoGZvciAoSW5kZXggPSAwOyBJbmRleCAmbHQ7IFJl
cXVlc3RlZDsgSW5kZXgrKykgezxicj4NCsKgIMKgIMKgIMKgIMKgTE9OR0xPTkfCoCDCoCBQZm47
PGJyPg0KLcKgIMKgIMKgIMKgIE5UU1RBVFVTwqAgwqAgc3RhdHVzOzxicj4NCjxicj4NCsKgIMKg
IMKgIMKgIMKgc3RhdHVzID0gWEVOQlVTX1JBTkdFX1NFVChQb3AsPGJyPg0KwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAmYW1wO0NvbnRleHQtJmd0
O1JhbmdlU2V0SW50ZXJmYWNlLDxicj4NCkBAIC00MjksMTIgKzQzNywxMiBAQCBCYWxsb29uUG9w
dWxhdGVQZm5BcnJheSg8YnI+DQrCoCDCoCDCoCDCoCDCoENvbnRleHQtJmd0O1BmbkFycmF5W0lu
ZGV4XSA9IChQRk5fTlVNQkVSKVBmbjs8YnI+DQrCoCDCoCDCoH08YnI+DQo8YnI+DQotwqAgwqAg
Q291bnQgPSBCYWxsb29uUG9wdWxhdGVQaHlzbWFwKFJlcXVlc3RlZCwgQ29udGV4dC0mZ3Q7UGZu
QXJyYXkpOzxicj4NCivCoCDCoCBzdGF0dXMgPSBCYWxsb29uUG9wdWxhdGVQaHlzbWFwKFJlcXVl
c3RlZCwgQ29udGV4dC0mZ3Q7UGZuQXJyYXksICZhbXA7Q291bnQpOzxicj4NCivCoCDCoCBpZiAo
IU5UX1NVQ0NFU1Moc3RhdHVzKSk8YnI+DQorwqAgwqAgwqAgwqAgQ291bnQgPSAwOzxicj4NCjxi
cj4NCsKgIMKgIMKgSW5kZXggPSBDb3VudDs8YnI+DQrCoCDCoCDCoHdoaWxlIChJbmRleCAmbHQ7
IFJlcXVlc3RlZCkgezxicj4NCi3CoCDCoCDCoCDCoCBOVFNUQVRVU8KgIMKgIHN0YXR1czs8YnI+
DQotPGJyPg0KwqAgwqAgwqAgwqAgwqBzdGF0dXMgPSBYRU5CVVNfUkFOR0VfU0VUKFB1dCw8YnI+
DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCZh
bXA7Q29udGV4dC0mZ3Q7UmFuZ2VTZXRJbnRlcmZhY2UsPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBDb250ZXh0LSZndDtSYW5nZVNldCw8
YnI+DQpAQCAtNDU2LDEwICs0NjQsMTEgQEAgQmFsbG9vblBvcHVsYXRlUGZuQXJyYXkoPGJyPg0K
wqAgwqAgwqByZXR1cm4gQ291bnQ7PGJyPg0KwqB9PGJyPg0KPGJyPg0KLXN0YXRpYyBVTE9ORzxi
cj4NCitzdGF0aWMgTlRTVEFUVVM8YnI+DQrCoEJhbGxvb25EZWNyZWFzZVJlc2VydmF0aW9uKDxi
cj4NCsKgIMKgIMKgX0luXyBVTE9OR8KgIMKgIMKgIMKgIMKgIFJlcXVlc3RlZCw8YnI+DQotwqAg
wqAgX0luXyBQUEZOX05VTUJFUsKgIMKgIFBmbkFycmF5PGJyPg0KK8KgIMKgIF9Jbl8gUFBGTl9O
VU1CRVLCoCDCoCBQZm5BcnJheSw8YnI+DQorwqAgwqAgX091dF8gUFVMT05HwqAgwqAgwqAgwqAg
RGVjcmVhc2VkPGJyPg0KwqAgwqAgwqApPGJyPg0KwqB7PGJyPg0KwqAgwqAgwqBMQVJHRV9JTlRF
R0VSwqAgwqAgwqAgwqBTdGFydDs8YnI+DQpAQCAtNDY3LDEyICs0NzYsMTggQEAgQmFsbG9vbkRl
Y3JlYXNlUmVzZXJ2YXRpb24oPGJyPg0KwqAgwqAgwqBVTE9OR0xPTkfCoCDCoCDCoCDCoCDCoCDC
oFRpbWVEZWx0YTs8YnI+DQrCoCDCoCDCoFVMT05HTE9OR8KgIMKgIMKgIMKgIMKgIMKgUmF0ZTs8
YnI+DQrCoCDCoCDCoFVMT05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBDb3VudDs8YnI+DQorwqAg
wqAgTlRTVEFUVVPCoCDCoCDCoCDCoCDCoCDCoCBzdGF0dXM7PGJyPg0KPGJyPg0KwqAgwqAgwqBB
U1NFUlQoUmVxdWVzdGVkICE9IDApOzxicj4NCjxicj4NCsKgIMKgIMKgS2VRdWVyeVN5c3RlbVRp
bWUoJmFtcDtTdGFydCk7PGJyPg0KPGJyPg0KLcKgIMKgIENvdW50ID0gTWVtb3J5RGVjcmVhc2VS
ZXNlcnZhdGlvbihQQUdFX09SREVSXzRLLCBSZXF1ZXN0ZWQsIFBmbkFycmF5KTs8YnI+DQorwqAg
wqAgc3RhdHVzID0gTWVtb3J5RGVjcmVhc2VSZXNlcnZhdGlvbihQQUdFX09SREVSXzRLLDxicj4N
CivCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoFJlcXVlc3RlZCw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBQZm5BcnJheSw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAmYW1wO0NvdW50KTs8YnI+
DQorwqAgwqAgaWYgKCFOVF9TVUNDRVNTKHN0YXR1cykpPGJyPg0KK8KgIMKgIMKgIMKgIHJldHVy
biBzdGF0dXM7PGJyPg0KPGJyPg0KwqAgwqAgwqBLZVF1ZXJ5U3lzdGVtVGltZSgmYW1wO0VuZCk7
PGJyPg0KwqAgwqAgwqBUaW1lRGVsdGEgPSBfX21heCgoKEVuZC5RdWFkUGFydCAtIFN0YXJ0LlF1
YWRQYXJ0KSAvIDEwMDAwdWxsKSwgMSk7PGJyPg0KQEAgLTQ4MCw3ICs0OTUsOCBAQCBCYWxsb29u
RGVjcmVhc2VSZXNlcnZhdGlvbig8YnI+DQrCoCDCoCDCoFJhdGUgPSAoVUxPTkdMT05HKShDb3Vu
dCAqIDEwMDApIC8gVGltZURlbHRhOzxicj4NCjxicj4NCsKgIMKgIMKgSW5mbygmcXVvdDsldSBw
YWdlKHMpIGF0ICVsbHUgcGFnZXMvc1xuJnF1b3Q7LCBDb3VudCwgUmF0ZSk7PGJyPg0KLcKgIMKg
IHJldHVybiBDb3VudDs8YnI+DQorwqAgwqAgKkRlY3JlYXNlZCA9IENvdW50Ozxicj4NCivCoCDC
oCByZXR1cm4gU1RBVFVTX1NVQ0NFU1M7PGJyPg0KwqB9PGJyPg0KPGJyPg0KwqBzdGF0aWMgVUxP
Tkc8YnI+DQpAQCAtNDk1LDYgKzUxMSw3IEBAIEJhbGxvb25SZWxlYXNlUGZuQXJyYXkoPGJyPg0K
wqAgwqAgwqBVTE9OR0xPTkfCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFJhdGU7
PGJyPg0KwqAgwqAgwqBVTE9OR8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgSW5kZXg7PGJyPg0KwqAgwqAgwqBVTE9OR8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgQ291bnQ7PGJyPg0KK8KgIMKgIE5UU1RBVFVTwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgc3RhdHVzOzxicj4NCjxicj4NCsKgIMKgIMKgQVNTRVJUM1UoUmVx
dWVzdGVkLCAmbHQ7PSwgWEVOQlVTX0JBTExPT05fUEZOX0FSUkFZX1NJWkUpOzxicj4NCjxicj4N
CkBAIC01MDYsOCArNTIzLDYgQEAgQmFsbG9vblJlbGVhc2VQZm5BcnJheSg8YnI+DQo8YnI+DQrC
oCDCoCDCoEluZGV4ID0gMDs8YnI+DQrCoCDCoCDCoHdoaWxlIChJbmRleCAmbHQ7IFJlcXVlc3Rl
ZCkgezxicj4NCi3CoCDCoCDCoCDCoCBOVFNUQVRVU8KgIMKgIHN0YXR1czs8YnI+DQotPGJyPg0K
wqAgwqAgwqAgwqAgwqBzdGF0dXMgPSBYRU5CVVNfUkFOR0VfU0VUKFB1dCw8YnI+DQrCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCZhbXA7Q29udGV4
dC0mZ3Q7UmFuZ2VTZXRJbnRlcmZhY2UsPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBDb250ZXh0LSZndDtSYW5nZVNldCw8YnI+DQpAQCAt
NTIwLDEzICs1MzUsMTMgQEAgQmFsbG9vblJlbGVhc2VQZm5BcnJheSg8YnI+DQrCoCDCoCDCoH08
YnI+DQrCoCDCoCDCoFJlcXVlc3RlZCA9IEluZGV4Ozxicj4NCjxicj4NCi3CoCDCoCBDb3VudCA9
IEJhbGxvb25EZWNyZWFzZVJlc2VydmF0aW9uKFJlcXVlc3RlZCwgQ29udGV4dC0mZ3Q7UGZuQXJy
YXkpOzxicj4NCivCoCDCoCBzdGF0dXMgPSBCYWxsb29uRGVjcmVhc2VSZXNlcnZhdGlvbihSZXF1
ZXN0ZWQsIENvbnRleHQtJmd0O1BmbkFycmF5LCAmYW1wO0NvdW50KTs8YnI+DQorwqAgwqAgaWYg
KCFOVF9TVUNDRVNTKHN0YXR1cykpPGJyPg0KK8KgIMKgIMKgIMKgIENvdW50ID0gMDs8YnI+DQo8
YnI+DQrCoCDCoCDCoFJ0bFplcm9NZW1vcnkoQ29udGV4dC0mZ3Q7UGZuQXJyYXksIENvdW50ICog
c2l6ZW9mIChQRk5fTlVNQkVSKSk7PGJyPg0KPGJyPg0KwqAgwqAgwqBmb3IgKEluZGV4ID0gQ291
bnQ7IEluZGV4ICZsdDsgUmVxdWVzdGVkOyBJbmRleCsrKSB7PGJyPg0KLcKgIMKgIMKgIMKgIE5U
U1RBVFVTwqAgwqAgc3RhdHVzOzxicj4NCi08YnI+DQrCoCDCoCDCoCDCoCDCoHN0YXR1cyA9IFhF
TkJVU19SQU5HRV9TRVQoR2V0LDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgJmFtcDtDb250ZXh0LSZndDtSYW5nZVNldEludGVyZmFjZSw8
YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oENvbnRleHQtJmd0O1JhbmdlU2V0LDxicj4NCmRpZmYgLS1naXQgYS9zcmMveGVuYnVzL2Zkby5j
IGIvc3JjL3hlbmJ1cy9mZG8uYzxicj4NCmluZGV4IDkyYTgzYjYuLjRlODc3MjcgMTAwNjQ0PGJy
Pg0KLS0tIGEvc3JjL3hlbmJ1cy9mZG8uYzxicj4NCisrKyBiL3NyYy94ZW5idXMvZmRvLmM8YnI+
DQpAQCAtMzQwMCw2ICszNDAwLDcgQEAgRmRvTWVtb3J5SG9sZUFsbG9jYXRlKDxicj4NCsKgezxi
cj4NCsKgIMKgIMKgUE1ETMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIE1kbDs8YnI+DQrCoCDCoCDC
oFBQRk5fTlVNQkVSwqAgwqAgwqAgwqAgwqBQZm5BcnJheTs8YnI+DQorwqAgwqAgVUxPTkfCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoERlY3JlYXNlZDs8YnI+DQrCoCDCoCDCoE5UU1RBVFVTwqAgwqAg
wqAgwqAgwqAgwqAgc3RhdHVzOzxicj4NCjxicj4NCsKgIMKgIMKgVU5SRUZFUkVOQ0VEX1BBUkFN
RVRFUihGZG8pOzxicj4NCkBAIC0zNDEyLDEyICszNDEzLDIxIEBAIEZkb01lbW9yeUhvbGVBbGxv
Y2F0ZSg8YnI+DQo8YnI+DQrCoCDCoCDCoFBmbkFycmF5ID0gTW1HZXRNZGxQZm5BcnJheShNZGwp
Ozxicj4NCjxicj4NCi3CoCDCoCBzdGF0dXMgPSBTVEFUVVNfVU5TVUNDRVNTRlVMOzxicj4NCi3C
oCDCoCBpZiAoTWVtb3J5RGVjcmVhc2VSZXNlcnZhdGlvbihQQUdFX09SREVSXzRLLCBDb3VudCwg
UGZuQXJyYXkpICE9IENvdW50KTxicj4NCivCoCDCoCBzdGF0dXMgPSBNZW1vcnlEZWNyZWFzZVJl
c2VydmF0aW9uKFBBR0VfT1JERVJfNEssPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgQ291bnQsPGJyPg0KK8KgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgUGZuQXJyYXks
PGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgJmFtcDtEZWNyZWFzZWQpOzxicj4NCivCoCDCoCBpZiAoIU5UX1NVQ0NFU1Moc3Rh
dHVzKSk8YnI+DQrCoCDCoCDCoCDCoCDCoGdvdG8gZmFpbDI7PGJyPg0KPGJyPg0KK8KgIMKgIHN0
YXR1cyA9IFNUQVRVU19VTlNVQ0NFU1NGVUw7PGJyPg0KK8KgIMKgIGlmIChEZWNyZWFzZWQgIT0g
Q291bnQpPGJyPg0KK8KgIMKgIMKgIMKgIGdvdG8gZmFpbDM7PGJyPg0KKzxicj4NCsKgIMKgIMKg
cmV0dXJuIE1kbDs8YnI+DQo8YnI+DQorZmFpbDM6PGJyPg0KKzxicj4NCsKgZmFpbDI6PGJyPg0K
wqAgwqAgwqBFcnJvcigmcXVvdDtmYWlsMlxuJnF1b3Q7KTs8YnI+DQo8YnI+DQpAQCAtMzQzNywx
NCArMzQ0NywyMCBAQCBGZG9NZW1vcnlIb2xlRnJlZSg8YnI+DQrCoHs8YnI+DQrCoCDCoCDCoFVM
T05HwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBDb3VudDs8YnI+DQrCoCDCoCDCoFBQRk5fTlVNQkVS
wqAgwqAgwqAgwqAgwqBQZm5BcnJheTs8YnI+DQorwqAgwqAgVUxPTkfCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoFBvcHVsYXRlZDs8YnI+DQorwqAgwqAgTlRTVEFUVVPCoCDCoCDCoCDCoCDCoCDCoCBz
dGF0dXM7PGJyPg0KPGJyPg0KwqAgwqAgwqBVTlJFRkVSRU5DRURfUEFSQU1FVEVSKEZkbyk7PGJy
Pg0KPGJyPg0KwqAgwqAgwqBDb3VudCA9IE1kbC0mZ3Q7Qnl0ZUNvdW50ICZndDsmZ3Q7IFBBR0Vf
U0hJRlQ7PGJyPg0KwqAgwqAgwqBQZm5BcnJheSA9IE1tR2V0TWRsUGZuQXJyYXkoTWRsKTs8YnI+
DQo8YnI+DQotwqAgwqAgaWYgKE1lbW9yeVBvcHVsYXRlUGh5c21hcChQQUdFX09SREVSXzRLLCBD
b3VudCwgUGZuQXJyYXkpICE9IENvdW50KTxicj4NCi3CoCDCoCDCoCDCoCBCVUcoJnF1b3Q7RkFJ
TEVEIFRPIFJFLVBPUFVMQVRFIEhPTEUmcXVvdDspOzxicj4NCivCoCDCoCBzdGF0dXMgPSBNZW1v
cnlQb3B1bGF0ZVBoeXNtYXAoUEFHRV9PUkRFUl80Syw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBDb3VudCw8YnI+DQorwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBQZm5BcnJheSw8YnI+
DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAm
YW1wO1BvcHVsYXRlZCk7PGJyPg0KK8KgIMKgIEJVR19PTighTlRfU1VDQ0VTUyhzdGF0dXMpKTs8
YnI+DQorwqAgwqAgQlVHX09OKFBvcHVsYXRlZCAhPSBDb3VudCk7PGJyPg0KPGJyPg0KwqAgwqAg
wqBfX0ZyZWVQYWdlcyhNZGwpOzxicj4NCsKgfTxicj4NCi0tIDxicj4NCjIuNTAuMS53aW5kb3dz
LjE8YnI+DQo8YnI+DQo8YnI+DQo8YnI+DQpOZ29jIFR1IERpbmggfCBWYXRlcyBYQ1AtbmcgRGV2
ZWxvcGVyPGJyPg0KPGJyPg0KWENQLW5nICZhbXA7IFhlbiBPcmNoZXN0cmEgLSBWYXRlcyBzb2x1
dGlvbnM8YnI+DQo8YnI+DQp3ZWI6IDxhIGhyZWY9Imh0dHBzOi8vdmF0ZXMudGVjaCIgcmVsPSJu
b3JlZmVycmVyIiB0YXJnZXQ9Il9ibGFuayI+aHR0cHM6Ly92YXRlcy50ZWNoPC9hPjxicj4NCjxi
cj4NCjwvYmxvY2txdW90ZT48L2Rpdj4NCg==
--000000000000aaa09f063c50d05b--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:34:30 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:34:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081455.1441541 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVHy-0001x5-C8; Thu, 14 Aug 2025 10:34:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081455.1441541; Thu, 14 Aug 2025 10:34:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVHy-0001wy-9K; Thu, 14 Aug 2025 10:34:30 +0000
Received: by outflank-mailman (input) for mailman id 1081455;
 Thu, 14 Aug 2025 10:34:29 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umVHx-0001qn-52
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:34:29 +0000
Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com
 [2607:f8b0:4864:20::436])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 404c011c-78fa-11f0-b898-0df219b8e170;
 Thu, 14 Aug 2025 12:34:27 +0200 (CEST)
Received: by mail-pf1-x436.google.com with SMTP id
 d2e1a72fcca58-76e2ead794eso582751b3a.2
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 03:34:27 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 404c011c-78fa-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755167666; x=1755772466; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=Ng/pGzYt6vZpkjzh2GsBiaEag3xxvVl+eB+hRBOELKU=;
        b=PJ1m+aCaEwlnpo8fZCwlNCgpIktmcBUK/2K3TUAixDqWLy3gNrWdPePgTMQKedg7Tc
         iK9Zv4S1DHaUAl7nsY8D8YYZD1QYnAmLUoUMxt8VaGbTfSDEBiQ0ZqMOVSnHFdPIK3yo
         8KIOXavqRJc+nIzc95KjMc2onvIYaj21cO1Ws=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755167666; x=1755772466;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=Ng/pGzYt6vZpkjzh2GsBiaEag3xxvVl+eB+hRBOELKU=;
        b=fHgb7H2U4H06IfZH7OSMcCoa+Iv2udthWydKIEyMhbDx58U7xz2tgDdp5oWI25eEIy
         w7/Zq7LSylBUOpkN5pjkphn5vLvD6N/s3Vp+el4KslB77fp88Z1ckqsi/YkLYAzkJszB
         cJQYVZ85C0DOG9zk5SRvml2KFGQYX/3IKRDR5wLDr3c4QnpnXfvt8wgSknyXu+Naf+dF
         PJlF4zVbjBjOnG0ZdUpwzFcCJPFwx14Kf9xHt3d7j76dwZvZPOy3dpwgpXLub+XyN4//
         dpSW5hPwiyddIVbQrtbGxPydTedGbmQuvDUIlQiXvru29me+kFiO7Hyv21Ub2p5JrnrB
         9lqQ==
X-Gm-Message-State: AOJu0Yz6tReueGlIU2d8Z9a98i17j3KQWBYl0fH5hdVxuvY1230Mw3A0
	27heFzEKTqX5wDsuTW+1xD0hrNq8nEFZakIGUAP2SJLxHbOuLgOHPhVVhuuHTXPj1qgRFdq8wVS
	fR4znm9VTM3gUXEmnSHtH62kADrF6iJXcomjnv/iH
X-Gm-Gg: ASbGncuDdcDWzlXRFxQeTMby4zaTimA4LAOSEM0S3Ggh1q2EChQM0EfdkbV+HYPoauE
	iNFSFsWxz+vpbkIklEIfzRoBUB3D6jc+PMWgLhSr8aWfJ70c05hGJsjt9kiU2fMObERF7l3Iutq
	cV+pft3lbWnGquHGuoMAtL1wj9X8pEAgGReCJM2b4B4tIIxGtOYriCqmAOtgShrNDA4U1XJxM2P
	s5kZskaEJovp5Tn
X-Google-Smtp-Source: AGHT+IEhLMVUsHIiUZvUYaaEIYtVE9mOO70YY114TJbvpglIWyFvSmXyk+79+UFwk3xdkeUZI0h3ksqMIpoXvko+29Y=
X-Received: by 2002:a17:902:ef06:b0:240:3239:21c7 with SMTP id
 d9443c01a7336-2445868bc91mr37871945ad.37.1755167665668; Thu, 14 Aug 2025
 03:34:25 -0700 (PDT)
MIME-Version: 1.0
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech> <20250813124630.1007-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-3-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 11:34:14 +0100
X-Gm-Features: Ac12FXxvHBV_7cNJfo2mzd30pu5yM7z6gwhSg95YiQaxqSuNRoVELGry9ZzydNg
Message-ID: <CAC_UY89_TU_6guS2OL0mH_qY3sst_cOno4KOxkoTaQsWGP1kQA@mail.gmail.com>
Subject: Re: [XENBUS PATCH 2/4] balloon: Remove allocation/deallocation wrappers
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="0000000000003be150063c50d1c6"

--0000000000003be150063c50d1c6
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> BalloonPopulatePhysmap and BalloonDecreaseReservation only measure the
> time taken by the corresponding Memory* functions, but that's already
> done in BalloonPopulatePfnArray/BalloonReleasePfnArray (among other
> places).
>
> Remove these functions to simplify the code.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  src/xenbus/balloon.c | 80 +++++---------------------------------------
>  1 file changed, 8 insertions(+), 72 deletions(-)
>
> diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
> index fb4fceb..2b657ce 100644
> --- a/src/xenbus/balloon.c
> +++ b/src/xenbus/balloon.c
> @@ -369,41 +369,6 @@ done:
>      return Count;
>  }
>
> -static NTSTATUS
> -BalloonPopulatePhysmap(
> -    _In_ ULONG          Requested,
> -    _In_ PPFN_NUMBER    PfnArray,
> -    _Out_ PULONG        Populated
> -    )
> -{
> -    LARGE_INTEGER       Start;
> -    LARGE_INTEGER       End;
> -    ULONGLONG           TimeDelta;
> -    ULONGLONG           Rate;
> -    ULONG               Count;
> -    NTSTATUS            status;
> -
> -    ASSERT(Requested !=3D 0);
> -
> -    KeQuerySystemTime(&Start);
> -
> -    status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,
> -                                   Requested,
> -                                   PfnArray,
> -                                   &Count);
> -    if (!NT_SUCCESS(status))
> -        return status;
> -
> -    KeQuerySystemTime(&End);
> -    TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1)=
;
> -
> -    Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
> -
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> -    *Populated =3D Count;
> -    return STATUS_SUCCESS;
> -}
> -
>  static ULONG
>  BalloonPopulatePfnArray(
>      _In_ PXENBUS_BALLOON_CONTEXT    Context,
> @@ -437,7 +402,10 @@ BalloonPopulatePfnArray(
>          Context->PfnArray[Index] =3D (PFN_NUMBER)Pfn;
>      }
>
> -    status =3D BalloonPopulatePhysmap(Requested, Context->PfnArray, &Cou=
nt);
> +    status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,
> +                                   Requested,
> +                                   Context->PfnArray,
> +                                   &Count);
>      if (!NT_SUCCESS(status))
>          Count =3D 0;
>
> @@ -464,41 +432,6 @@ BalloonPopulatePfnArray(
>      return Count;
>  }
>
> -static NTSTATUS
> -BalloonDecreaseReservation(
> -    _In_ ULONG          Requested,
> -    _In_ PPFN_NUMBER    PfnArray,
> -    _Out_ PULONG        Decreased
> -    )
> -{
> -    LARGE_INTEGER       Start;
> -    LARGE_INTEGER       End;
> -    ULONGLONG           TimeDelta;
> -    ULONGLONG           Rate;
> -    ULONG               Count;
> -    NTSTATUS            status;
> -
> -    ASSERT(Requested !=3D 0);
> -
> -    KeQuerySystemTime(&Start);
> -
> -    status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,
> -                                       Requested,
> -                                       PfnArray,
> -                                       &Count);
> -    if (!NT_SUCCESS(status))
> -        return status;
> -
> -    KeQuerySystemTime(&End);
> -    TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1)=
;
> -
> -    Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
> -
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> -    *Decreased =3D Count;
> -    return STATUS_SUCCESS;
> -}
> -
>  static ULONG
>  BalloonReleasePfnArray(
>      _In_ PXENBUS_BALLOON_CONTEXT    Context,
> @@ -535,7 +468,10 @@ BalloonReleasePfnArray(
>      }
>      Requested =3D Index;
>
> -    status =3D BalloonDecreaseReservation(Requested, Context->PfnArray,
> &Count);
> +    status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,
> +                                       Requested,
> +                                       Context->PfnArray,
> +                                       &Count);
>      if (!NT_SUCCESS(status))
>          Count =3D 0;
>
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--0000000000003be150063c50d1c6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen=
.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at=
 1:46=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">BalloonPopulatePhysmap and =
BalloonDecreaseReservation only measure the<br>
time taken by the corresponding Memory* functions, but that&#39;s already<b=
r>
done in BalloonPopulatePfnArray/BalloonReleasePfnArray (among other<br>
places).<br>
<br>
Remove these functions to simplify the code.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0src/xenbus/balloon.c | 80 +++++--------------------------------------=
-<br>
=C2=A01 file changed, 8 insertions(+), 72 deletions(-)<br>
<br>
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c<br>
index fb4fceb..2b657ce 100644<br>
--- a/src/xenbus/balloon.c<br>
+++ b/src/xenbus/balloon.c<br>
@@ -369,41 +369,6 @@ done:<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
-static NTSTATUS<br>
-BalloonPopulatePhysmap(<br>
-=C2=A0 =C2=A0 _In_ ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Requested,<br>
-=C2=A0 =C2=A0 _In_ PPFN_NUMBER=C2=A0 =C2=A0 PfnArray,<br>
-=C2=A0 =C2=A0 _Out_ PULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 Populated<br>
-=C2=A0 =C2=A0 )<br>
-{<br>
-=C2=A0 =C2=A0 LARGE_INTEGER=C2=A0 =C2=A0 =C2=A0 =C2=A0Start;<br>
-=C2=A0 =C2=A0 LARGE_INTEGER=C2=A0 =C2=A0 =C2=A0 =C2=A0End;<br>
-=C2=A0 =C2=A0 ULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TimeDelta;=
<br>
-=C2=A0 =C2=A0 ULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Rate;<br>
-=C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
Count;<br>
-=C2=A0 =C2=A0 NTSTATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status;<br=
>
-<br>
-=C2=A0 =C2=A0 ASSERT(Requested !=3D 0);<br>
-<br>
-=C2=A0 =C2=A0 KeQuerySystemTime(&amp;Start);<br>
-<br>
-=C2=A0 =C2=A0 status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Requested,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PfnArray,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Count);<br>
-=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 return status;<br>
-<br>
-=C2=A0 =C2=A0 KeQuerySystemTime(&amp;End);<br>
-=C2=A0 =C2=A0 TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000=
ull), 1);<br>
-<br>
-=C2=A0 =C2=A0 Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
-<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
-=C2=A0 =C2=A0 *Populated =3D Count;<br>
-=C2=A0 =C2=A0 return STATUS_SUCCESS;<br>
-}<br>
-<br>
=C2=A0static ULONG<br>
=C2=A0BalloonPopulatePfnArray(<br>
=C2=A0 =C2=A0 =C2=A0_In_ PXENBUS_BALLOON_CONTEXT=C2=A0 =C2=A0 Context,<br>
@@ -437,7 +402,10 @@ BalloonPopulatePfnArray(<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Context-&gt;PfnArray[Index] =3D (PFN_NUMB=
ER)Pfn;<br>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
-=C2=A0 =C2=A0 status =3D BalloonPopulatePhysmap(Requested, Context-&gt;Pfn=
Array, &amp;Count);<br>
+=C2=A0 =C2=A0 status =3D MemoryPopulatePhysmap(PAGE_ORDER_4K,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Requested,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Context-&gt;PfnArray,<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Count);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Count =3D 0;<br>
<br>
@@ -464,41 +432,6 @@ BalloonPopulatePfnArray(<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
-static NTSTATUS<br>
-BalloonDecreaseReservation(<br>
-=C2=A0 =C2=A0 _In_ ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Requested,<br>
-=C2=A0 =C2=A0 _In_ PPFN_NUMBER=C2=A0 =C2=A0 PfnArray,<br>
-=C2=A0 =C2=A0 _Out_ PULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 Decreased<br>
-=C2=A0 =C2=A0 )<br>
-{<br>
-=C2=A0 =C2=A0 LARGE_INTEGER=C2=A0 =C2=A0 =C2=A0 =C2=A0Start;<br>
-=C2=A0 =C2=A0 LARGE_INTEGER=C2=A0 =C2=A0 =C2=A0 =C2=A0End;<br>
-=C2=A0 =C2=A0 ULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TimeDelta;=
<br>
-=C2=A0 =C2=A0 ULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Rate;<br>
-=C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
Count;<br>
-=C2=A0 =C2=A0 NTSTATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status;<br=
>
-<br>
-=C2=A0 =C2=A0 ASSERT(Requested !=3D 0);<br>
-<br>
-=C2=A0 =C2=A0 KeQuerySystemTime(&amp;Start);<br>
-<br>
-=C2=A0 =C2=A0 status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Requested=
,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PfnArray,=
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Coun=
t);<br>
-=C2=A0 =C2=A0 if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 return status;<br>
-<br>
-=C2=A0 =C2=A0 KeQuerySystemTime(&amp;End);<br>
-=C2=A0 =C2=A0 TimeDelta =3D __max(((End.QuadPart - Start.QuadPart) / 10000=
ull), 1);<br>
-<br>
-=C2=A0 =C2=A0 Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
-<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
-=C2=A0 =C2=A0 *Decreased =3D Count;<br>
-=C2=A0 =C2=A0 return STATUS_SUCCESS;<br>
-}<br>
-<br>
=C2=A0static ULONG<br>
=C2=A0BalloonReleasePfnArray(<br>
=C2=A0 =C2=A0 =C2=A0_In_ PXENBUS_BALLOON_CONTEXT=C2=A0 =C2=A0 Context,<br>
@@ -535,7 +468,10 @@ BalloonReleasePfnArray(<br>
=C2=A0 =C2=A0 =C2=A0}<br>
=C2=A0 =C2=A0 =C2=A0Requested =3D Index;<br>
<br>
-=C2=A0 =C2=A0 status =3D BalloonDecreaseReservation(Requested, Context-&gt=
;PfnArray, &amp;Count);<br>
+=C2=A0 =C2=A0 status =3D MemoryDecreaseReservation(PAGE_ORDER_4K,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Requested=
,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Context-&=
gt;PfnArray,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;Coun=
t);<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Count =3D 0;<br>
<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--0000000000003be150063c50d1c6--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:35:31 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:35:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081465.1441545 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVIx-0002M5-G3; Thu, 14 Aug 2025 10:35:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081465.1441545; Thu, 14 Aug 2025 10:35:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVIx-0002Ly-D6; Thu, 14 Aug 2025 10:35:31 +0000
Received: by outflank-mailman (input) for mailman id 1081465;
 Thu, 14 Aug 2025 10:35:30 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umVIw-0002G6-G4
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:35:30 +0000
Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com
 [2607:f8b0:4864:20::62a])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 64deeee8-78fa-11f0-b898-0df219b8e170;
 Thu, 14 Aug 2025 12:35:28 +0200 (CEST)
Received: by mail-pl1-x62a.google.com with SMTP id
 d9443c01a7336-24457fe9704so5701545ad.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 03:35:28 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 64deeee8-78fa-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755167727; x=1755772527; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=76Z2XUVFuAEj+4dRq4rc1mubaUAln0/lewiHM48Qq1M=;
        b=Mz90/bYXq86Z20W1bF8362FlfjldzCp8I/NexGZPliWO8cImP2N1yzBykao1321lav
         AlG16smLLmXEOaAIJm5s27l3XRfko3aLeJkMELY5j1LOTAxb1L3ZSBtvex3pGfoWGi+M
         fik5Xu0h9B+cC8RJW0MhPkzEdRoMuFOA7djAM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755167727; x=1755772527;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=76Z2XUVFuAEj+4dRq4rc1mubaUAln0/lewiHM48Qq1M=;
        b=bnxSSUHPKt2lTBMBNGK//j9uw44QufNl3Vl0Z24+PVjg8nSCLhDW2F/eGq3iivsfTN
         P4ZfgK6YhxOI1vyhilfYP36DcciNV9j5NA5dM2nx4rNWX0Dpre3r9pOAuPhVr0N26vnI
         9Ly1hDv362Z+sD90uKgMvKQypGL6LbOlDWWMyJzTgLgn6hdm5mUQ3kgkumYlLzubJyUO
         rj7gTSPjswFxHrKNW/XRK6y723X4zAZIZUeorTpHreXLUZ7xSuRdF2ar/XcoozFcbRCy
         AeWCJpY0nDuCFnhf4/ckK72uy1T7XO4ubzCgBijMCeH15XfCZFETZF/nQQKVt4TOunD7
         1xMw==
X-Gm-Message-State: AOJu0Yy67xROHkzvKOvcZE6pcz7lSz7drtpod/JMDN3A/t/dbDDssJtV
	MgS14/h9o5Fh8LIsFSpxtwjfuETrMs7o/cdfLf0MGRMrpLpv1TwC40UUiw/I/qmbThxlOCXEYdR
	Vc13ltVo/uCF1R0eiYIq+f9T97S1N3hCE269a6Shs
X-Gm-Gg: ASbGncskvtADcdYAnlhnMzr31RWoTR/KyelxNdX+v9fP2DMkT+oBwaSMZzvO6gu92sa
	Yx0lThz7iLbLYoKbjBL/ZxlW2Hghlvx4l0JHheJBgDNspHWnrCjhWxpX7kYHBRil+Muj2gRmvWk
	m2pkDZrvuVrImn9+UBIPOSxcdPdQGTYcFNMsQfBIEd+TME96NDWuOe2GcPndZ5BwWm15f7hju2y
	pIOIg==
X-Google-Smtp-Source: AGHT+IFby3XTAx89xRikalFbgPSRzlAldER7uERv5wCPbLXsNwbBD7nyQKi0P0Lkzqpn8PCnuyguvo7VBsXj+hRLI68=
X-Received: by 2002:a17:902:dac1:b0:240:3db8:9adc with SMTP id
 d9443c01a7336-244584a3000mr35300635ad.4.1755167726951; Thu, 14 Aug 2025
 03:35:26 -0700 (PDT)
MIME-Version: 1.0
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech>
 <20250813124630.1007-4-ngoc-tu.dinh@vates.tech> <CAC_UY8_e4Tf6MJRLn7evJ3_6AajmuabcmuSXOdJ6bCWsMPaftw@mail.gmail.com>
 <477d82bc-c6bc-48f9-8637-a630fb071e2a@vates.tech>
In-Reply-To: <477d82bc-c6bc-48f9-8637-a630fb071e2a@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 11:35:15 +0100
X-Gm-Features: Ac12FXxFuygHYrvb4HIvjk_dJufeOIsX16BwCbDF67qTrt5B87o_rg9ZuS2Fj2M
Message-ID: <CAC_UY8-39ZzVa+e8H0RYxTYEzmf8vc8FobSn6NL5=py1Y59r+w@mail.gmail.com>
Subject: Re: [XENBUS PATCH 3/4] balloon: Stop using fake MDL to store PFN array
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000e3010f063c50d40e"

--000000000000e3010f063c50d40e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Sounds good, just checking the ASSERT isnt vital

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Thu, Aug 14, 2025 at 11:21=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:

> On 14/08/2025 11:37, Owen Smith wrote:
> >
> >
> > On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tec=
h> wrote:
> >
> >     @@ -213,90 +208,31 @@ BalloonAllocatePagesForMdl(
> >           SkipBytes.QuadPart =3D 0ull;
> >           TotalBytes =3D (SIZE_T)Count << PAGE_SHIFT;
> >
> >     -    Mdl =3D MmAllocatePagesForMdlEx(LowAddress,
> >     -                                  HighAddress,
> >     -                                  SkipBytes,
> >     -                                  TotalBytes,
> >     -                                  MmCached,
> >     -                                  MM_DONT_ZERO_ALLOCATION |
> >     -                                  MM_ALLOCATE_PREFER_CONTIGUOUS |
> >     -                                  MM_ALLOCATE_AND_HOT_REMOVE);
> >     -    if (Mdl =3D=3D NULL)
> >     -        goto done;
> >     -
> >     -    ASSERT((Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA |
> >     -                             MDL_PARTIAL_HAS_BEEN_MAPPED |
> >     -                             MDL_PARTIAL |
> >     -                             MDL_PARENT_MAPPED_SYSTEM_VA |
> >     -                             MDL_SOURCE_IS_NONPAGED_POOL)) =3D=3D =
0);
> >     -
> >     -done:
> >     -    return Mdl;
> >     +    return MmAllocatePagesForMdlEx(LowAddress,
> >     +                                   HighAddress,
> >     +                                   SkipBytes,
> >     +                                   TotalBytes,
> >     +                                   MmCached,
> >     +                                   MM_DONT_ZERO_ALLOCATION |
> >     +                                   MM_ALLOCATE_PREFER_CONTIGUOUS |
> >     +                                   MM_ALLOCATE_AND_HOT_REMOVE);
> >       }
> >
> > The only change in this chunk is skipping the ASSERT - how important is
> > the ASSERT?
> >
> > Owen
>
> The MDL is taken straight from
> MmAllocatePagesForMdlEx(MM_ALLOCATE_AND_HOT_REMOVE), so the assert
> doesn't look important at all to me. I've tested a debug build with
> verifier and saw no crashes.
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--000000000000e3010f063c50d40e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64

PGRpdiBkaXI9Imx0ciI+PGRpdiBjbGFzcz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFt
aWx5Om1vbm9zcGFjZSI+U291bmRzIGdvb2QsIGp1c3QgY2hlY2tpbmcgdGhlIEFTU0VSVCBpc250
wqB2aXRhbDwvZGl2PjxkaXYgY2xhc3M9ImdtYWlsX2RlZmF1bHQiIHN0eWxlPSJmb250LWZhbWls
eTptb25vc3BhY2UiPjxicj48L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9kZWZhdWx0IiBzdHlsZT0i
Zm9udC1mYW1pbHk6bW9ub3NwYWNlIj5SZXZpZXdlZC1ieTogT3dlbiBTbWl0aCAmbHQ7PGEgaHJl
Zj0ibWFpbHRvOm93ZW4uc21pdGhAY2xvdWQuY29tIj5vd2VuLnNtaXRoQGNsb3VkLmNvbTwvYT4m
Z3Q7PC9kaXY+PC9kaXY+PGJyPjxkaXYgY2xhc3M9ImdtYWlsX3F1b3RlIGdtYWlsX3F1b3RlX2Nv
bnRhaW5lciI+PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIFRodSwgQXVnIDE0
LCAyMDI1IGF0IDExOjIx4oCvQU0gVHUgRGluaCAmbHQ7bmdvYy10dS5kaW5oQHZhdGVzLnRlY2gm
Z3Q7IHdyb3RlOjxicj48L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxl
PSJtYXJnaW46MHB4IDBweCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQs
MjA0LDIwNCk7cGFkZGluZy1sZWZ0OjFleCI+T24gMTQvMDgvMjAyNSAxMTozNywgT3dlbiBTbWl0
aCB3cm90ZTo8YnI+DQomZ3Q7IDxicj4NCiZndDsgPGJyPg0KJmd0OyBPbiBXZWQsIEF1ZyAxMywg
MjAyNSBhdCAxOjQ24oCvUE0gVHUgRGluaCAmbHQ7bmdvYy10dS5kaW5oQHZhdGVzLnRlY2gmZ3Q7
IHdyb3RlOjxicj4NCiZndDsgPGJyPg0KJmd0O8KgIMKgIMKgQEAgLTIxMyw5MCArMjA4LDMxIEBA
IEJhbGxvb25BbGxvY2F0ZVBhZ2VzRm9yTWRsKDxicj4NCiZndDvCoCDCoCDCoCDCoCDCoCDCoFNr
aXBCeXRlcy5RdWFkUGFydCA9IDB1bGw7PGJyPg0KJmd0O8KgIMKgIMKgIMKgIMKgIMKgVG90YWxC
eXRlcyA9IChTSVpFX1QpQ291bnQgJmx0OyZsdDsgUEFHRV9TSElGVDs8YnI+DQomZ3Q7IDxicj4N
CiZndDvCoCDCoCDCoC3CoCDCoCBNZGwgPSBNbUFsbG9jYXRlUGFnZXNGb3JNZGxFeChMb3dBZGRy
ZXNzLDxicj4NCiZndDvCoCDCoCDCoC3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCBIaWdoQWRkcmVzcyw8YnI+DQomZ3Q7wqAgwqAgwqAtwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgU2tpcEJ5dGVzLDxicj4N
CiZndDvCoCDCoCDCoC3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCBUb3RhbEJ5dGVzLDxicj4NCiZndDvCoCDCoCDCoC3CoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBNbUNhY2hlZCw8YnI+DQomZ3Q7wqAgwqAg
wqAtwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgTU1f
RE9OVF9aRVJPX0FMTE9DQVRJT04gfDxicj4NCiZndDvCoCDCoCDCoC3CoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBNTV9BTExPQ0FURV9QUkVGRVJfQ09O
VElHVU9VUyB8PGJyPg0KJmd0O8KgIMKgIMKgLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIE1NX0FMTE9DQVRFX0FORF9IT1RfUkVNT1ZFKTs8YnI+DQom
Z3Q7wqAgwqAgwqAtwqAgwqAgaWYgKE1kbCA9PSBOVUxMKTxicj4NCiZndDvCoCDCoCDCoC3CoCDC
oCDCoCDCoCBnb3RvIGRvbmU7PGJyPg0KJmd0O8KgIMKgIMKgLTxicj4NCiZndDvCoCDCoCDCoC3C
oCDCoCBBU1NFUlQoKE1kbC0mZ3Q7TWRsRmxhZ3MgJmFtcDsgKE1ETF9NQVBQRURfVE9fU1lTVEVN
X1ZBIHw8YnI+DQomZ3Q7wqAgwqAgwqAtwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqBNRExfUEFSVElBTF9IQVNfQkVFTl9NQVBQRUQgfDxicj4NCiZndDvCoCDCoCDC
oC3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1ETF9QQVJUSUFM
IHw8YnI+DQomZ3Q7wqAgwqAgwqAtwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqBNRExfUEFSRU5UX01BUFBFRF9TWVNURU1fVkEgfDxicj4NCiZndDvCoCDCoCDCoC3C
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1ETF9TT1VSQ0VfSVNf
Tk9OUEFHRURfUE9PTCkpID09IDApOzxicj4NCiZndDvCoCDCoCDCoC08YnI+DQomZ3Q7wqAgwqAg
wqAtZG9uZTo8YnI+DQomZ3Q7wqAgwqAgwqAtwqAgwqAgcmV0dXJuIE1kbDs8YnI+DQomZ3Q7wqAg
wqAgwqArwqAgwqAgcmV0dXJuIE1tQWxsb2NhdGVQYWdlc0Zvck1kbEV4KExvd0FkZHJlc3MsPGJy
Pg0KJmd0O8KgIMKgIMKgK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgSGlnaEFkZHJlc3MsPGJyPg0KJmd0O8KgIMKgIMKgK8KgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgU2tpcEJ5dGVzLDxicj4NCiZn
dDvCoCDCoCDCoCvCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoFRvdGFsQnl0ZXMsPGJyPg0KJmd0O8KgIMKgIMKgK8KgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgTW1DYWNoZWQsPGJyPg0KJmd0O8KgIMKg
IMKgK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
TU1fRE9OVF9aRVJPX0FMTE9DQVRJT04gfDxicj4NCiZndDvCoCDCoCDCoCvCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoE1NX0FMTE9DQVRFX1BSRUZF
Ul9DT05USUdVT1VTIHw8YnI+DQomZ3Q7wqAgwqAgwqArwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBNTV9BTExPQ0FURV9BTkRfSE9UX1JFTU9WRSk7
PGJyPg0KJmd0O8KgIMKgIMKgIMKgfTxicj4NCiZndDsgPGJyPg0KJmd0OyBUaGUgb25seSBjaGFu
Z2UgaW4gdGhpcyBjaHVuayBpcyBza2lwcGluZyB0aGUgQVNTRVJUIC0gaG93IGltcG9ydGFudCBp
cyA8YnI+DQomZ3Q7IHRoZSBBU1NFUlQ/PGJyPg0KJmd0OyA8YnI+DQomZ3Q7IE93ZW48YnI+DQo8
YnI+DQpUaGUgTURMIGlzIHRha2VuIHN0cmFpZ2h0IGZyb20gPGJyPg0KTW1BbGxvY2F0ZVBhZ2Vz
Rm9yTWRsRXgoTU1fQUxMT0NBVEVfQU5EX0hPVF9SRU1PVkUpLCBzbyB0aGUgYXNzZXJ0IDxicj4N
CmRvZXNuJiMzOTt0IGxvb2sgaW1wb3J0YW50IGF0IGFsbCB0byBtZS4gSSYjMzk7dmUgdGVzdGVk
IGEgZGVidWcgYnVpbGQgd2l0aCA8YnI+DQp2ZXJpZmllciBhbmQgc2F3IG5vIGNyYXNoZXMuPGJy
Pg0KPGJyPg0KPGJyPg0KTmdvYyBUdSBEaW5oIHwgVmF0ZXMgWENQLW5nIERldmVsb3Blcjxicj4N
Cjxicj4NClhDUC1uZyAmYW1wOyBYZW4gT3JjaGVzdHJhIC0gVmF0ZXMgc29sdXRpb25zPGJyPg0K
PGJyPg0Kd2ViOiA8YSBocmVmPSJodHRwczovL3ZhdGVzLnRlY2giIHJlbD0ibm9yZWZlcnJlciIg
dGFyZ2V0PSJfYmxhbmsiPmh0dHBzOi8vdmF0ZXMudGVjaDwvYT48YnI+DQo8YnI+DQo8YnI+DQo8
L2Jsb2NrcXVvdGU+PC9kaXY+DQo=
--000000000000e3010f063c50d40e--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 10:35:41 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 10:35:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081467.1441550 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVJ7-0002Rt-Hh; Thu, 14 Aug 2025 10:35:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081467.1441550; Thu, 14 Aug 2025 10:35:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umVJ7-0002Rl-Ei; Thu, 14 Aug 2025 10:35:41 +0000
Received: by outflank-mailman (input) for mailman id 1081467;
 Thu, 14 Aug 2025 10:35:40 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umVJ6-0002G6-9v
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 10:35:40 +0000
Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com
 [2607:f8b0:4864:20::62e])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 6ac2f83f-78fa-11f0-b898-0df219b8e170;
 Thu, 14 Aug 2025 12:35:38 +0200 (CEST)
Received: by mail-pl1-x62e.google.com with SMTP id
 d9443c01a7336-244581d87bdso4659695ad.2
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 03:35:38 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6ac2f83f-78fa-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755167737; x=1755772537; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=4RJ8OAcQmOqghyNjmsDwNdUBOdc1T+QitR+mCuIqvC0=;
        b=A59ouEiWc1g0TWxmGk4yZU93r/WZtezOYrAkw1krSW16TsonzEUwaQ04CeS1tBmzWn
         G1euVplU4uVkYWvJz7sg8qfoCCh00nSfZ51LBzKWlLsoFw2+gW9sLGqtRkEEg7j7djSr
         tjiorc4ClZaK3fAqANXy1pIGnsSWK8e32eFpM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755167737; x=1755772537;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=4RJ8OAcQmOqghyNjmsDwNdUBOdc1T+QitR+mCuIqvC0=;
        b=YjBuZ1RzY/YrXpwluQb0OzR0bEe+zpQnXZyoYnjkPPwxPmuFHRRfnOR+9j5wYe0uG7
         S/MCeNIibYwJgXXhaRP3tLwQtzCVxrMGiDJdeU3f5WMMGEKr5k3dplFApqz2vCfSkTaX
         abSmXfoiE8MpzvI6fKvVtEEoFrJ12tFvZPHmkV716Hj9qDzBzlaE93AxKnhqdalstcn2
         6TlclHkTNWdM1tR/n8ligP3aN1N8JCQDEyhi3IhHqlwylgeDRMTiKJ9UjIjQeWaePEkm
         2ueKUyA4QWI85RCvLG0L2zaSmOIFs7y6UbALT88xL28Qr1i2HeDpcMciQrVSln+gozbS
         dWoA==
X-Gm-Message-State: AOJu0Yw8Le0hJDq0GSXPOhe7bqQUzom6OsoRR3MVaVLVoRLbra5aJPUz
	Ul74ErtqlWPf1aMy0PiQ8XgoHDSHhZBoS7lfYGQm2BiaXDSpZFZu5qwQE5Yud8tWdwvE/CeuXxV
	y8Cfg2gBuhx3c0iW5W2doVKv7h+puBNyX6avIJm0V
X-Gm-Gg: ASbGncto1DiQ66mnY8xbPyJQrzv0FoabYOUYcmcuyl2VLoR5G3Q/eeX7Lep5J5H4MFX
	CjYGZFSuA6l7gobmiVKfAzHNZC3HI2ISGEcwOw3vJAhlJTn2PpA5XvxB51Iaj/nsHInRduEvUqX
	IuZSdSmsaE/FG9MDSqVOc2heQ1a0y7uVbiRjV9NRobEX3wv98+TzNJbwXmPwg2osStz88QrDPE/
	tmzlg==
X-Google-Smtp-Source: AGHT+IFT57eW40hvArC+GlVGC3TfHoC2XtKJYd4qR/hQMTgYFJ3ffqiLnwPaZCdcC4MDxGOoOwEZPe9yZR5ctf6Q4dw=
X-Received: by 2002:a17:902:f550:b0:242:9bc4:f1c7 with SMTP id
 d9443c01a7336-244586e0821mr39878785ad.54.1755167736788; Thu, 14 Aug 2025
 03:35:36 -0700 (PDT)
MIME-Version: 1.0
References: <20250813124630.1007-1-ngoc-tu.dinh@vates.tech> <20250813124630.1007-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250813124630.1007-5-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Thu, 14 Aug 2025 11:35:25 +0100
X-Gm-Features: Ac12FXznUxjiIW--9q29SNOHPer_JIbG0Up8Qxo0ipytKChiwWmdmupl_cKDNRc
Message-ID: <CAC_UY88eEOUvH4cep4Y-Z_EaCZUJE4DSBNoKCri3UGprTUQFiQ@mail.gmail.com>
Subject: Re: [XENBUS PATCH 4/4] balloon: Report ballooning speed in trace log
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000790b9b063c50d55c"

--000000000000790b9b063c50d55c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Wed, Aug 13, 2025 at 1:46=E2=80=AFPM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> Ballooning will constantly spam the xen_platform_log, especially if the
> balloon is large.
>
> Reduce the log spamming by reporting balloon function times in the trace
> log instead.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  src/xenbus/balloon.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
> index 029fff5..f041a04 100644
> --- a/src/xenbus/balloon.c
> +++ b/src/xenbus/balloon.c
> @@ -299,7 +299,7 @@ done:
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>      *Slow =3D (Rate < XENBUS_BALLOON_MIN_PAGES_PER_S) ? TRUE : FALSE;
>
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> +    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
>      return Count;
>  }
>
> @@ -362,7 +362,7 @@ BalloonPopulatePfnArray(
>
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> +    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
>      return Count;
>  }
>
> @@ -428,7 +428,7 @@ done:
>
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> +    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
>      return Count;
>  }
>
> @@ -469,7 +469,7 @@ done:
>
>      Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;
>
> -    Info("%u page(s) at %llu pages/s\n", Count, Rate);
> +    Trace("%u page(s) at %llu pages/s\n", Count, Rate);
>      return Count;
>  }
>
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--000000000000790b9b063c50d55c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen=
.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Aug 13, 2025 at=
 1:46=E2=80=AFPM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">Ballooning will constantly =
spam the xen_platform_log, especially if the<br>
balloon is large.<br>
<br>
Reduce the log spamming by reporting balloon function times in the trace<br=
>
log instead.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0src/xenbus/balloon.c | 8 ++++----<br>
=C2=A01 file changed, 4 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c<br>
index 029fff5..f041a04 100644<br>
--- a/src/xenbus/balloon.c<br>
+++ b/src/xenbus/balloon.c<br>
@@ -299,7 +299,7 @@ done:<br>
=C2=A0 =C2=A0 =C2=A0Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
=C2=A0 =C2=A0 =C2=A0*Slow =3D (Rate &lt; XENBUS_BALLOON_MIN_PAGES_PER_S) ? =
TRUE : FALSE;<br>
<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
+=C2=A0 =C2=A0 Trace(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate)=
;<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
@@ -362,7 +362,7 @@ BalloonPopulatePfnArray(<br>
<br>
=C2=A0 =C2=A0 =C2=A0Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
+=C2=A0 =C2=A0 Trace(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate)=
;<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
@@ -428,7 +428,7 @@ done:<br>
<br>
=C2=A0 =C2=A0 =C2=A0Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
+=C2=A0 =C2=A0 Trace(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate)=
;<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
@@ -469,7 +469,7 @@ done:<br>
<br>
=C2=A0 =C2=A0 =C2=A0Rate =3D (ULONGLONG)(Count * 1000) / TimeDelta;<br>
<br>
-=C2=A0 =C2=A0 Info(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate);=
<br>
+=C2=A0 =C2=A0 Trace(&quot;%u page(s) at %llu pages/s\n&quot;, Count, Rate)=
;<br>
=C2=A0 =C2=A0 =C2=A0return Count;<br>
=C2=A0}<br>
<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--000000000000790b9b063c50d55c--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 13:47:56 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 13:47:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081748.1441758 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umYJ8-0003IU-FM; Thu, 14 Aug 2025 13:47:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081748.1441758; Thu, 14 Aug 2025 13:47:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umYJ8-0003IN-Cn; Thu, 14 Aug 2025 13:47:54 +0000
Received: by outflank-mailman (input) for mailman id 1081748;
 Thu, 14 Aug 2025 13:47:53 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wqX6=22=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1umYJ7-0003IH-Cf
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 13:47:53 +0000
Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com
 [2a00:1450:4864:20::52f])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 4536c924-7915-11f0-b898-0df219b8e170;
 Thu, 14 Aug 2025 15:47:51 +0200 (CEST)
Received: by mail-ed1-x52f.google.com with SMTP id
 4fb4d7f45d1cf-6188b657bddso1808111a12.1
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 06:47:51 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6186bfee29csm3495323a12.15.2025.08.14.06.47.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 14 Aug 2025 06:47:49 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4536c924-7915-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755179270; x=1755784070; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=sgH2pLIUIUnIYchWCp2C8PJy0uugMqg/kJSeVSVZRUg=;
        b=HJ8Q/wCllxMePdI1v15Xo2vZVz15NWwl/VnuMqf8tTEbDYWWPma9TlEYPt+GZv8bkK
         LzdlIEaVeOzCJS+8zI9pTX0uuSf4uyvnEqg8uVwJFHgYdEbgjk2y/GI225PF81tOybzl
         /JtYa6a1wbz8W0bzSrI9tzvc6c4BtRHr6+Dls=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755179270; x=1755784070;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=sgH2pLIUIUnIYchWCp2C8PJy0uugMqg/kJSeVSVZRUg=;
        b=nN00XJbBRp1eyP9VF8H/X9c93fVQiJDBHwdMskfn6K3EsUL5UrEohsjooZLASa+H2Z
         KrEb+dSiAP6PSMBHGs5W8W7zpdkOiMUzEwSDAwI6Ak8HUumHW2M3LJ5Pb2IJng/7moyH
         Gog7fN7J2MnP6dodBoYisZxW7O+hjCB8F80N23880SijyCxNiMre4WY9RnuDIJHJIHes
         bMFMLuvLbA4C/5Jqq95RlXIBT+DWCFNAaNhpOGf8/ICtJq0mNEiDgNzZemw/SLzgZSJe
         Mhkqvr3+X6aRDMa9XPGVndMPqa3sRD765V2VQkYXjpixaiTSwJ4kvNRNs66FGtRn4iLF
         C6hQ==
X-Gm-Message-State: AOJu0YzfH1nYE6JntZMmAHk+VRf9GRQVtHPIAcjZGb+WjcD4vlcTXieC
	Y+AVfXDu3lz7NauiD2alT8tXm+yz2tp0fJx2ZsZJV7BHtQm0XcL4cc9XF+rL/xsuy5RCkrA90kc
	kkWs=
X-Gm-Gg: ASbGncsaSlTXpu62rN+lJoXnapBtvvYGxaDrKCk4C4oljha/oYQPIA3TcBAapQAvdda
	mu0+Og/f+y3CprFVkC5E0XGk1aM4cyEyWE/zLUuHJ+/zsH8HUC1p+B+UB4dHfvGZegZTIx0seOE
	QQmLKBIepYFX85a+yITGIt9/FYRgVpU++7fj5K+rIRsDK0424DxLAPh1QyybMnxOtCywrO6nChe
	luus+sZ4TlziZJBdmOCe5jk/jfVziddbCeJohKiCl2bztHhaAW3/xaTjXL5yJM0JWlovU2YX9PE
	vvmRv4wl7KW6v/pr/OzjwEpmR1wlUdZHbeQdFKwhiOl7UaaxDTFu0NXKA4xvWyq3wuqWqF0lCkz
	o7IpR3jNubks2kX2rKRWdBzubE5mcjDEPD4w6H241ZOGOEFbWKCZjLyQ=
X-Google-Smtp-Source: AGHT+IGmfcY5WGzzIkZ6ZssRbbKa+YePLJBcZYdPhqeyx8g3mTcMtNRpTUdAGNCqfZdQCUuhr6ES0Q==
X-Received: by 2002:a05:6402:248d:b0:615:5353:5e2c with SMTP id 4fb4d7f45d1cf-6188c1f9c4dmr3076816a12.19.1755179270074;
        Thu, 14 Aug 2025 06:47:50 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] SquashError when Directory returns empty list
Date: Thu, 14 Aug 2025 14:47:43 +0100
Message-ID: <20250814134743.1851-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Reduces log spam when running a listing of xenstore keys, where
empty values are expected.

STORE(Directory) will translate ENOENT to STATUS_OBJECT_NAME_NOT_FOUND
to indicate that the xenstore key does not exist, and return
STATUS_OBJECT_PATH_NOT_FOUND to indicate the key exists, but contains
no further data.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xeniface/ioctl_store.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xeniface/ioctl_store.c b/src/xeniface/ioctl_store.c
index 0fa850f..266eb73 100644
--- a/src/xeniface/ioctl_store.c
+++ b/src/xeniface/ioctl_store.c
@@ -231,7 +231,8 @@ IoctlStoreDirectory(
 
     status = XENBUS_STORE(Directory, &Fdo->StoreInterface, NULL, NULL, Buffer, &Value);
     if (!NT_SUCCESS(status)) {
-        if (status == STATUS_OBJECT_NAME_NOT_FOUND)
+        if (status == STATUS_OBJECT_NAME_NOT_FOUND ||
+            status == STATUS_OBJECT_PATH_NOT_FOUND)
             SquashError = TRUE;
         goto fail3;
     }
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 14 14:02:23 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Aug 2025 14:02:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1081751.1441763 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umYX7-0006jc-GG; Thu, 14 Aug 2025 14:02:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1081751.1441763; Thu, 14 Aug 2025 14:02:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1umYX7-0006jU-DZ; Thu, 14 Aug 2025 14:02:21 +0000
Received: by outflank-mailman (input) for mailman id 1081751;
 Thu, 14 Aug 2025 14:02:20 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hSZz=22=bounce.vates.tech=bounce-md_30504962.689dec68.v1-d3c0922d889f4fb5a9242b357a16cfcb@srs-se1.protection.inumbo.net>)
 id 1umYX6-0006jO-0H
 for win-pv-devel@lists.xenproject.org; Thu, 14 Aug 2025 14:02:20 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 493af3be-7917-11f0-a328-13f23c93f187;
 Thu, 14 Aug 2025 16:02:17 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c2n480XdGzK607R6
 for <win-pv-devel@lists.xenproject.org>; Thu, 14 Aug 2025 14:02:16 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d3c0922d889f4fb5a9242b357a16cfcb; Thu, 14 Aug 2025 14:02:16 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 493af3be-7917-11f0-a328-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755180136; x=1755450136;
	bh=5IHWmpX32wVd8bWb29fIxi3+RNLfZbxImp9ljA1FlzE=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=X1Rk0GeBLxsYMMjSybnCQrFc7jGncgfbPVGk5NWiRTW06uB0fBNQlVIC0q2NmECRc
	 O+XXdMCpejEz8rWd/GDLhmWEncmRSEOZmq61+60po7ZvQ3qzSV76P+CMEMFuyqmAfz
	 M1orcdnI3rOoVXDLJYAtH4tNeH5fmAFLm8xAYC3D0s3zjEtpHIM27IGdacsewN+anz
	 pNvmMoolthzUXwwlG7jc4g7GAgeioeefIW8LPVgRIzeG5+2Kv46odjWSABov5sSk9S
	 0KxD3yaIGHFmlE0CgF9KvTl6f2u63pAlzkbaFCpb07qsE4G3uElJzua7A/fvsr+an/
	 Ca+JDCZV1qYng==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755180136; x=1755440636; i=ngoc-tu.dinh@vates.tech;
	bh=5IHWmpX32wVd8bWb29fIxi3+RNLfZbxImp9ljA1FlzE=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=KKcmWOAhccyJIgGLKmJBxqjW1KtMs4hTusPvXyEwnM+/17YAXdx17UrgezDlePTi5
	 4htxvPD9bbVhp0mtqqid7hfVq3lvFUeCr6vlm831c8wjhykzQnjjBYjWDHpd3jDmC4
	 xVkpr/bUhQYs48yIFdXPRjigly9q06VleGesBh6M/LIFLYtL86V0/lc9v/YfFiECan
	 GA1rzimxqiRcrwhCzIkvrDjVpzBnbDl1X8wR84iM73YrB01er0ZMm4a+28A3yIjvgv
	 ZoxZFSs13xaWPvDqzGeFmIDyGw91Et4VRdhtot+TBrGrLOWbioW62fN5kwrX9ql0QE
	 jlONQivUZq6+Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20SquashError=20when=20Directory=20returns=20empty=20list?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755180135242
Message-Id: <9b8019a8-d0dd-4889-909c-1537ad185c75@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250814134743.1851-1-owen.smith@cloud.com>
In-Reply-To: <20250814134743.1851-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d3c0922d889f4fb5a9242b357a16cfcb?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250814:md
Date: Thu, 14 Aug 2025 14:02:16 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

IMO, returning STATUS_OBJECT_PATH_NOT_FOUND for empty keys in the first 
place sounds a bit odd.

Acked-by: Tu Dinh <ngoc-tu.dinh@vates.tech>

On 14/08/2025 15:48, Owen Smith wrote:
> Reduces log spam when running a listing of xenstore keys, where
> empty values are expected.
> 
> STORE(Directory) will translate ENOENT to STATUS_OBJECT_NAME_NOT_FOUND
> to indicate that the xenstore key does not exist, and return
> STATUS_OBJECT_PATH_NOT_FOUND to indicate the key exists, but contains
> no further data.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xeniface/ioctl_store.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/xeniface/ioctl_store.c b/src/xeniface/ioctl_store.c
> index 0fa850f..266eb73 100644
> --- a/src/xeniface/ioctl_store.c
> +++ b/src/xeniface/ioctl_store.c
> @@ -231,7 +231,8 @@ IoctlStoreDirectory(
>   
>       status = XENBUS_STORE(Directory, &Fdo->StoreInterface, NULL, NULL, Buffer, &Value);
>       if (!NT_SUCCESS(status)) {
> -        if (status == STATUS_OBJECT_NAME_NOT_FOUND)
> +        if (status == STATUS_OBJECT_NAME_NOT_FOUND ||
> +            status == STATUS_OBJECT_PATH_NOT_FOUND)
>               SquashError = TRUE;
>           goto fail3;
>       }



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 05:55:14 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 05:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085360.1443683 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unsps-0005Iv-BI; Mon, 18 Aug 2025 05:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085360.1443683; Mon, 18 Aug 2025 05:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unsps-0005Im-8J; Mon, 18 Aug 2025 05:55:12 +0000
Received: by outflank-mailman (input) for mailman id 1085360;
 Mon, 18 Aug 2025 05:55:11 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=aHmu=26=bounce.vates.tech=bounce-md_30504962.68a2c039.v1-530e6e22cd0849818bb183506414b30c@srs-se1.protection.inumbo.net>)
 id 1unspr-0005Ig-7b
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 05:55:11 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id e4142148-7bf7-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 07:55:08 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c52493hSvzRKLdpj
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 05:55:05 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 530e6e22cd0849818bb183506414b30c; Mon, 18 Aug 2025 05:55:05 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e4142148-7bf7-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755496505; x=1755766505;
	bh=hUJLo7ChiGRoNrHbT1M/DN0Gv1hNpV25Xssbd49JowU=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=FzkD8vaJKh8kEJ93cKbUPkhxFk9Xo5alBdSdVJ1t+Z+6FY4TpEghq9w4oc0AyVHy8
	 IMvmEPMEzKUsIYZ52d/fP4NOJqxNCNmhROFI/XN/bU2QzDJOCiZJVTgdRdjn1YAMDx
	 /b1L2FkNzYY15luP0f2zYo3tb4bBmypFTq6KRsLPI7ulag4eA7J3wt1eGUsz9EWXp8
	 Ui89bYXkUTzoFOrN0pTOV7of4HS93mwW4xI+jQ76rR6NSN/qKlLB6qIXGOWrY/78Ep
	 8AMFDxVUShrOkS/LYjlnJNm4sEU0bpe18Y+GejUPKTyh59M6mxEJa9a3bkyFakPsoh
	 Fa2YdnRjhEt/A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755496505; x=1755757005; i=ngoc-tu.dinh@vates.tech;
	bh=hUJLo7ChiGRoNrHbT1M/DN0Gv1hNpV25Xssbd49JowU=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=GePu4QzlAqYu6k6TUbxezaKUSfZSCwnMzBGuKuGyPOYW+aothO1w99iP+l5fY0Yju
	 8UBGSKT/i8Pz0fZJKm86yLT4HhVkf6uIjzTxdzF67dekxDf1npDhY8uQdZdWy4CEge
	 SA+ouoRnWyfdki2m7mcurUZzmK+xmfjjZFSBxlAAlUoEUHOkdENeHJLN5TLyKimrDJ
	 OrIAVo+sf3PL1Fpz3kQtu5mHeq8rpMx9RnkOpGzXsLpr4jQn02uNsELJTJgFjE3SfL
	 H7GZItwGJUvUC0xdY43W1SHvjfEitLAI32HpfDIxV33cXtH85irJ1kbZ5/gdQotwRE
	 pHbVUsFEbDMBw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v2=201/2]=20Add=20RegistryQueryQwordValue?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755496504576
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818055502.878-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.530e6e22cd0849818bb183506414b30c?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 05:55:05 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
Reviewed-by: Owen Smith <owen.smith@cloud.com>
---
 src/common/registry.c | 70 +++++++++++++++++++++++++++++++++++++++++++
 src/common/registry.h |  7 +++++
 2 files changed, 77 insertions(+)

diff --git a/src/common/registry.c b/src/common/registry.c
index 7965233..1f7a73c 100644
--- a/src/common/registry.c
+++ b/src/common/registry.c
@@ -853,6 +853,76 @@ fail1:
     return status;
 }
 
+NTSTATUS
+RegistryQueryQwordValue(
+    _In_ HANDLE                     Key,
+    _In_ PSTR                       Name,
+    _Out_ PULONGLONG                Value
+    )
+{
+    ANSI_STRING                     Ansi;
+    UNICODE_STRING                  Unicode;
+    PKEY_VALUE_PARTIAL_INFORMATION  Partial;
+    ULONG                           Size;
+    NTSTATUS                        status;
+
+    RtlInitAnsiString(&Ansi, Name);
+
+    status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = ZwQueryValueKey(Key,
+                             &Unicode,
+                             KeyValuePartialInformation,
+                             NULL,
+                             0,
+                             &Size);
+    if (!NT_SUCCESS(status) &&
+        status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
+        goto fail2;
+
+    Partial = __RegistryAllocate(Size);
+
+    status = STATUS_NO_MEMORY;
+    if (Partial == NULL)
+        goto fail3;
+
+    status = ZwQueryValueKey(Key,
+                             &Unicode,
+                             KeyValuePartialInformation,
+                             Partial,
+                             Size,
+                             &Size);
+    if (!NT_SUCCESS(status))
+        goto fail4;
+
+    status = STATUS_INVALID_PARAMETER;
+    if (Partial->Type != REG_QWORD ||
+        Partial->DataLength != sizeof (ULONGLONG))
+        goto fail5;
+
+    *Value = *(PULONGLONG)Partial->Data;
+
+    __RegistryFree(Partial);
+
+    RtlFreeUnicodeString(&Unicode);
+
+    return STATUS_SUCCESS;
+
+fail5:
+fail4:
+    __RegistryFree(Partial);
+
+fail3:
+fail2:
+    RtlFreeUnicodeString(&Unicode);
+
+fail1:
+    return status;
+}
+
 NTSTATUS
 RegistryUpdateDwordValue(
     _In_ HANDLE                     Key,
diff --git a/src/common/registry.h b/src/common/registry.h
index e70a6ed..26bc0c6 100644
--- a/src/common/registry.h
+++ b/src/common/registry.h
@@ -142,6 +142,13 @@ RegistryQueryDwordValue(
     _Out_ PULONG        Value
     );
 
+extern NTSTATUS
+RegistryQueryQwordValue(
+    _In_ HANDLE         Key,
+    _In_ PSTR           Name,
+    _Out_ PULONGLONG    Value
+    );
+
 extern NTSTATUS
 RegistryUpdateDwordValue(
     _In_ HANDLE         Key,
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 05:55:14 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 05:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085361.1443686 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unspu-0005KC-C9; Mon, 18 Aug 2025 05:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085361.1443686; Mon, 18 Aug 2025 05:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unspu-0005K5-9d; Mon, 18 Aug 2025 05:55:14 +0000
Received: by outflank-mailman (input) for mailman id 1085361;
 Mon, 18 Aug 2025 05:55:13 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ID3p=26=bounce.vates.tech=bounce-md_30504962.68a2c039.v1-de05983d4e664914adc24e408ba3a4eb@srs-se1.protection.inumbo.net>)
 id 1unspt-0005Jz-GL
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 05:55:13 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id e40e1c0b-7bf7-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 07:55:08 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c52493m27zK5vl0l
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 05:55:05 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 de05983d4e664914adc24e408ba3a4eb; Mon, 18 Aug 2025 05:55:05 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e40e1c0b-7bf7-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755496505; x=1755766505;
	bh=cKhCYkr/zkedwBnX1W9GzUO0/IVU6CmVupYzq026B6M=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=AJ9x6L1gcl43nXFssLUSZKyE5b/vt0huQxjDdclqEC2d7k2IYw565JF0LwAANW9e9
	 uCZcB4OiXEGEv4++SxiuQ6Ab6yjgPRsNjif099CfR2LqAujigddzJrN2q4z6mvn3zw
	 hUnS4WIeVumk+PZx5kszvBCwVFzacEPYnibrb94yHOZjDydRrbqArIn5v/cYtf5ReB
	 3+pIhuzij3xaVixOm2pS1Eexg190gQbANmjaC0QpCPC7z7bgUQO5I9Qm7BOZrN/KIx
	 ez++YIOHNHA7QitJ133NpoZtDkmLd1upM4Vx+hK8+Bpnfi7PuUgqU5Fd34tcTnNVCh
	 yLxS8iFT/BPRw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755496505; x=1755757005; i=ngoc-tu.dinh@vates.tech;
	bh=cKhCYkr/zkedwBnX1W9GzUO0/IVU6CmVupYzq026B6M=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=yDk4QRaYqZ7cY2I85pKA93HVgLqbYlrFoewEHkIdrNEvtdtahbbtSoPngUYdbfzGT
	 lMOuaKYDLW6SXYBZi9yU1XdbiFPsYDvlEgeP39xOJV40j472GuvBSUL3/tbU20EjU5
	 r5cPyJ7sf8+BNE7lQ8mMGbcmZkxsB9hRON96lQt0/AE8EkJ+dzI9DEkDBQNWiflnT5
	 Z0PZ8trupWspskvvCXJVzCu0pUWywQHJgwwyjLAJHiI10nCkXReZTHDKFbUQLOqG52
	 8Er7gjju3Ez/Vn5Smt3wZxD0fG7r/TC6vDX7YcbKLcoPg7P1zc+xAeVWNTBbXX72bB
	 YTwp//MykQJPw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v2=202/2]=20Be=20more=20tolerant=20of=20RealTimeIsUniversal=20values?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755496504901
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818055502.878-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818055502.878-1-ngoc-tu.dinh@vates.tech>
References: <20250818055502.878-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.de05983d4e664914adc24e408ba3a4eb?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 05:55:05 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Tolerate RealTimeIsUniversal having the REG_QWORD value type.

In addition, don't fail SystemInitialize when SystemGetTimeInformation
fails to read RealTimeIsUniversal as critical boot drivers (e.g. xenvbd)
may fail to load otherwise.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
v2: Log error code from SystemGetTimeInformation
---
 src/xen/system.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/xen/system.c b/src/xen/system.c
index 48f9af0..991ce4b 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -1183,7 +1183,8 @@ SystemGetTimeInformation(
     PSYSTEM_CONTEXT Context = &SystemContext;
     UNICODE_STRING  Unicode;
     HANDLE          Key;
-    ULONG           RealTimeIsUniversal;
+    ULONG           ValueDword;
+    ULONGLONG       ValueQword;
     NTSTATUS        status;
 
     RtlInitUnicodeString(&Unicode, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation");
@@ -1192,27 +1193,30 @@ SystemGetTimeInformation(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
-                                     &RealTimeIsUniversal);
-    if (!NT_SUCCESS(status)) {
-        if (status != STATUS_OBJECT_NAME_NOT_FOUND)
-            goto fail2;
+    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal", &ValueDword);
+    if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+        Context->RealTimeIsUniversal = FALSE;
+        goto done;
+    } else if (NT_SUCCESS(status)) {
+        Context->RealTimeIsUniversal = !!ValueDword;
+        goto done;
+    }
 
-        RealTimeIsUniversal = 0;
+    status = RegistryQueryQwordValue(Key, "RealTimeIsUniversal", &ValueQword);
+    if (NT_SUCCESS(status)) {
+        Context->RealTimeIsUniversal = !!ValueQword;
+        goto done;
     }
 
-    Context->RealTimeIsUniversal = RealTimeIsUniversal ? TRUE : FALSE;
+    status = STATUS_UNSUCCESSFUL;
+    Context->RealTimeIsUniversal = FALSE;
 
+done:
     Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
 
     RegistryCloseKey(Key);
 
-    return STATUS_SUCCESS;
-
-fail2:
-    Error("fail2\n");
-
-    RegistryCloseKey(Key);
+    return status;
 
 fail1:
     Error("fail1 (%08x)\n", status);
@@ -1318,19 +1322,16 @@ SystemInitialize(
     if (!NT_SUCCESS(status))
         goto fail8;
 
-    status = SystemGetTimeInformation();
+    status = SystemCheckProcessors();
     if (!NT_SUCCESS(status))
         goto fail9;
 
-    status = SystemCheckProcessors();
+    status = SystemGetTimeInformation();
     if (!NT_SUCCESS(status))
-        goto fail10;
+        Error("Cannot read RealTimeIsUniversal (%08x)\n", status);
 
     return STATUS_SUCCESS;
 
-fail10:
-    Error("fail10\n");
-
 fail9:
     Error("fail9\n");
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:40:58 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:40:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085441.1443721 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUD-0003EH-1K; Mon, 18 Aug 2025 07:40:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085441.1443721; Mon, 18 Aug 2025 07:40:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUC-0003E9-Ul; Mon, 18 Aug 2025 07:40:56 +0000
Received: by outflank-mailman (input) for mailman id 1085441;
 Mon, 18 Aug 2025 07:40:56 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=W4io=26=bounce.vates.tech=bounce-md_30504962.68a2d901.v1-1d79744980764d50aecc4b02439623c6@srs-se1.protection.inumbo.net>)
 id 1unuUC-0003E3-Cb
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:40:56 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id a958da5c-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:40:50 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Q93g6LzRKNjFd
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:40:49 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 1d79744980764d50aecc4b02439623c6; Mon, 18 Aug 2025 07:40:49 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a958da5c-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502849; x=1755772849;
	bh=Cmxe8AaRSMKcx/8y39RGNfs57/5z8JUKfEM1aCqed8o=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=qSGg8eyOKgogw5KMP/0XszhgD+talQjVIIrT0tN3Ycj4R0hIuflgW5nUER5d3I+Hi
	 Mw4EJevYsS02OB8fIpRtBwQrTLKziUhgKadJHI3JwE+ETTcTa4HEPSv5aOVnxY/EVb
	 zZ0/RL8yL+0jzou/SwTeBvAZVXN493KPMhGkOqlT7aLJ68Zb1OwMs6ftjFi9HiLs+u
	 qlsEhrh/bdiM5KZxCBmg4AbvobsFS5W39Z42KB97SFX0mO8TspyBYJR/8CyfikGxCW
	 Ta4zpYhfdsM50OPfGQtRiBkHFdy4ftu2NcmHB5b19SB6An95BVqN41j88XTWOsBepg
	 ao7a7iyIHOT3A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502849; x=1755763349; i=ngoc-tu.dinh@vates.tech;
	bh=Cmxe8AaRSMKcx/8y39RGNfs57/5z8JUKfEM1aCqed8o=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=lUBB8/mG23cLk9KwKACOBImrOZb+gGpyy2MKSDCHmWfVmayVRuvb+6okVHZkFuQ/F
	 hN5o+BFD1NzyxUk8HgJQO++HnyJDw2PrQKSr+NYP5GjFPzVxB/Upt570n75CppHHMx
	 qf5wHq2L2Z/aI5PiIBfOK6gEpsnLNBVSBxgJBNmOUXGb9WM8Ss3LDN81C+oeNKN3SE
	 C9ofkpsHC47aOAm3QgQnL83nuVRvFK0nxx+lWBQsIUkFKdrY7IXTAbTLe767a3FP8I
	 chafICKB9MuowN7Gjuxov+3Na7gL6IGegpVgXPUBmZVtQfxG0b2/sgZfe3yGuufNfP
	 hCtzkbGsChqqg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v6=2000/11]=20Implement=20forced=20unplug=20and=20forced=20activation?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502848621
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.1d79744980764d50aecc4b02439623c6?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:40:49 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The goal of these two features is to simplify driver servicing and avoid
requiring storing driver state in Registry.

Forced unplug, as name implies, forcefully unplugs emulated devices when
a driver is present, rather than when it's active. It defines a Registry
key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced
unplug by creating an appropriate value (DISKS/NICS) in this key.

Note that since it's no longer possible to guarantee removal of Registry
values during driver uninstallation by Windows, driver uninstallers are
expected to remove these values themselves.

Forced activation is the companion to forced unplug. It aims to make
activation of Xenbus FDOs deterministic and stateless, using a
precedence mapping based on device IDs, prioritizing the vendor device
over the generic ones. This avoids situations where the wrong FDO is
activated, which will prevent Windows Update from working.

Like forced unplug, the precedence mapping of forced activation is also
expected to be removed by driver uninstallers.

With forced activation, Xenfilt is now installed via INF on top of the
current installation routines. This means PV drivers can be injected
offline without needing another reboot to be reconfigured.

Care is taken to keep compatibility with older drivers. The two features
are also conditioned behind new build environment variables FORCE_UNPLUG
and FORCE_ACTIVATE.

Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.
Deprecate PDO revisions 0x09000007 and earlier to make room for the new
revision.
Xenvif 0x09000000 is also removed due to the deprecation of CACHE v1.

With forced unplug/activation, the whole boot chain of boot-critical
drivers must be available in the driver store to avoid
INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware
IDs into one INF Models entry.

Finally, since forced activation can cause the active device to change
without prior notice, such a change will cause old drivers to lose their
bindings due to a change in the device instance path. Drop the vendor
device ID from DeviceID to make sure that device instance paths remain
stable across vendor device changes.

The following scenarios have been successfully tested, requiring only
one reboot each:
* Offline driver installation via DISM
* Fresh install, followed by switching from device 0001 to 0002
* Fresh install, followed by toggling vendor device
* Xenbus/Xenvbd update

Other tested scenarios:
* Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling
  device ID (v4)
* Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2)

Commit notes:
* Patch 1 "Collapse skipped template lines" is for all repos.
* These forced-activation commits are linked and cannot be separated:
  * xenfilt: Add Xenbus device precedence mechanism
  * Add EMULATED v3
  * Use EMULATED v3 to force activate Xenbus FDOs

Changes in v6:
* Fixed logic in "Collapse skipped template lines"
* Moved precedence values to their own key xenfilt\Parameters\Precedence
* Changed INFs to promote 0002 device to hardware ID in Models entry if
  vendor device support is not present to avoid Inf2Cat 22.9.3 warning
* Fixed emulated.h still using LONG ForceActivate

v5: Ad-hoc patches to v4, see v6

Changes in v4:
* Restored interfaces deprecated in v3 to allow old drivers to work with
  existing binding, while still removing old PDO revisions
* Converted IsForceActivated LONG value to a proper enum
* Stripped vendor device ID from device ID strings
  * The same was done for Xencons, Xenvif and Xenvkbd
* Fixed mistakenly-left-in DEV_C000 in forced-activation Xenbus.inf
* Moved PdoGetPrecedence to driver.c and merged into DriverGetPrecedence
* Refactored EmulatedIsDevicePresent condition checking
* Removed Xenvif revision 0x09000000 due to the deprecation of CACHE v1

v3: https://lists.xenproject.org/archives/html/win-pv-devel/2025-08/msg00002.html
* Deprecated PDO revisions 0x09000007 and earlier to make room for
  0x0900000C
* Merged all hardware IDs into one INF Models entry to avoid BSODs when
  changing platform device IDs and toggling vendor device
* Added a note mentioning the role of driver uninstallers in cleanup of
  forced unplug/activation drivers.

v2: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.html
* Added forced activation

v1: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.html

Tu Dinh (11):
  Collapse skipped template lines
  Merge all hardware IDs into one Models entry
  Remove vendor device ID from DeviceID
  Deprecate PDO revisions 0x09000007 and earlier
  xenbus: Use nonpaged pool in FdoQueryId
  Add forced unplug support
  xenfilt: Add Xenbus device precedence mechanism
  Add EMULATED v3
  Use EMULATED v3 to force activate Xenbus FDOs
  Enable Xenbus precedence
  Install Xenfilt with INF AddReg

 include/emulated_interface.h |  61 +++++++++++++---
 include/revision.h           |  11 +--
 scripts/genfiles.ps1         |  15 ++--
 src/xen/driver.c             |  79 ++++++++++++++++-----
 src/xen/driver.h             |   5 ++
 src/xen/unplug.c             |  13 +++-
 src/xenbus.inf               |  25 ++++---
 src/xenbus/fdo.c             | 134 ++++++++++++++++++++++++-----------
 src/xenbus/pdo.c             |   3 +-
 src/xenfilt/driver.c         |  93 ++++++++++++++++++++++--
 src/xenfilt/driver.h         |   7 ++
 src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++------
 src/xenfilt/emulated.h       |  13 ++--
 src/xenfilt/fdo.c            |  30 +++++++-
 src/xenfilt/pdo.c            |  63 ++++++++--------
 src/xenfilt/pdo.h            |   7 +-
 16 files changed, 514 insertions(+), 160 deletions(-)

--
2.50.1.windows.1


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:00 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085442.1443725 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUG-0003IT-2d; Mon, 18 Aug 2025 07:41:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085442.1443725; Mon, 18 Aug 2025 07:41:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUF-0003IM-W0; Mon, 18 Aug 2025 07:40:59 +0000
Received: by outflank-mailman (input) for mailman id 1085442;
 Mon, 18 Aug 2025 07:40:58 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=14wE=26=bounce.vates.tech=bounce-md_30504962.68a2d907.v1-c743e6e5fdd0405f8c538d6ea7fc8b65@srs-se1.protection.inumbo.net>)
 id 1unuUE-0003FM-Sj
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:40:58 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id ad29024f-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:40:57 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54QH5R1yzK5vpXC
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:40:55 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c743e6e5fdd0405f8c538d6ea7fc8b65; Mon, 18 Aug 2025 07:40:55 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ad29024f-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502855; x=1755772855;
	bh=Dx6kcGk1WccYLmTbbLqt3Tl3T4J4wgaI+3tWyAZcLgM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=wXKEVOvjbzqCNpcmY2wmjiGtyEuwaWqZCAMNy8iPH8Im2aLwAuL9ebG6DdJ74jdNO
	 Y/qdibTkU0fEt3kha6rbU7QwF7cCvy3vYHdqHQ6F1lA5DFvuiHQHKc2WVGLKY+DLsI
	 Qn1QiIzpH+IKG3IWyHoTK2adRBImRQ4P7RhD0kjMf+79s3RFypOnpXNgacaqW5xdVA
	 SjlnDiefoVGpk5YBhyDRKJWpHAaBVLCMqx03SLiZW/Nc8uZqW6RPDJ0YnkZPfGAyNY
	 mi2YsKAGnIoDnyxUsHueZiFLDHC6pEGnm6rhc9Ps/zrbgIyFcLT/agaSuDW2o308gO
	 XCFtvRt/H9XVA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502855; x=1755763355; i=ngoc-tu.dinh@vates.tech;
	bh=Dx6kcGk1WccYLmTbbLqt3Tl3T4J4wgaI+3tWyAZcLgM=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=c+vGmlmpaTFiDTKLTIGu5uakctgq5MkvOVmmAkdijIuY/AjBEmGgTMeWdlh+t7wEo
	 Ly4qbJrOow32IGtKrhWQ0UW5lKSb9AOGfosWsVyQp8OM8qrncBVp7PwuTEH/MRrtQ8
	 vIbO37sCuMzNbikm/NOaikONnc/JPN1aLJ8P8r/9/gEho+hB6e/eOmYiKkaAyh5ogW
	 Gfop+eNKjuwfH4DHYxnIiYI5IuIW40u4r4/U4Uc0DRpkrRdu+KCXI0Qv5bZfZoDtwg
	 tVf79CZyQOIinDZY5IW59xef7uHL4bLMwxsTzi2/B+bsMpkSVnSAP1AVviOwW9ARpF
	 ACsHfH0zNt55w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[PATCH=20v6=2001/11]=20Collapse=20skipped=20template=20lines?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502855150
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c743e6e5fdd0405f8c538d6ea7fc8b65?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:40:55 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 4c58f03..be12087 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -27,12 +27,15 @@ Function Copy-FileWithReplacements {
 	ForEach-Object {
 		$line = $_
 		$Replacements.GetEnumerator() | ForEach-Object {
-			$key = [string]::Format("{0}{1}{2}", $Token, $_.Name, $Token)
-			if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Contains($key))) {
-				Write-Host "Skipping Line Containing " $_.Name
-				$line = $null
+			if ($null -ne $line) {
+				$key = [string]::Format("{0}{1}{2}", $Token, $_.Name, $Token)
+				if (([string]::IsNullOrEmpty($_.Value)) -and ($line.Contains($key))) {
+					Write-Host "Skipping Line Containing " $_.Name
+					$line = $null
+				} else {
+					$line = $line -replace $key, $_.Value
+				}
 			}
-			$line = $line -replace $key, $_.Value
 		}
 		$line
 	} |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:01 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085443.1443730 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUH-0003Ls-4X; Mon, 18 Aug 2025 07:41:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085443.1443730; Mon, 18 Aug 2025 07:41:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUH-0003L9-12; Mon, 18 Aug 2025 07:41:01 +0000
Received: by outflank-mailman (input) for mailman id 1085443;
 Mon, 18 Aug 2025 07:40:59 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=fqtb=26=bounce.vates.tech=bounce-md_30504962.68a2d90a.v1-35fc319154934217be628c272445e31c@srs-se1.protection.inumbo.net>)
 id 1unuUF-0003FM-Ss
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:40:59 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id ae593176-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:40:59 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54QL28PtzK5vpw4
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:40:58 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 35fc319154934217be628c272445e31c; Mon, 18 Aug 2025 07:40:58 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ae593176-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502858; x=1755772858;
	bh=GDIaYXb96X1s4qebI8QGsxDN+QsoPTpCy+73APNDPHo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=GJRDNcloyfY4TXaLRU0Xgz9bIrwI6lNjzlcjnD0iLYaSPzsq0/RbIq40ICTeDyfRm
	 KkUXZKSTsYh+xBESKij69G922VLPJjiuyYYkz8IDYqOibpYEXWDVn8J2FhnyXJreTm
	 fY3Np4gbXTgceEoD7UE9SguzuuCuDUD8FaDV6p6+dbD5c84dyqiK7J0lJEEirHkcRh
	 xcijbbDnl30uQP8bKE3vs4Gn5vlvq9Xkhmb9tyEexC4VfM4+N4cPKYwoyIyN8Jd6ve
	 FcDe3dS4lpUgot2YK+fgb6g24b4tOR6CGXHznaNxjZPiP5s+KdwlJEVkO3x3aI9X30
	 jv4ZMnGaonELg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502858; x=1755763358; i=ngoc-tu.dinh@vates.tech;
	bh=GDIaYXb96X1s4qebI8QGsxDN+QsoPTpCy+73APNDPHo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Z64cLyPhDeSBoQm+d6XIPdool2UGNdd0wgX3Q292K54cfPSJmwCcpdd2ndz+vLjnn
	 s2UGfBZ98U5zH7vtcveHSX0VsURS4H9i9wmVUnAM8lRIEx4mkT8U2UatjHJKKu9vKo
	 qPHiYxoT1rO+QOYOnIceSsYIS9iIO6X7a9Tuq5YhxJIvW7dAMB4hDpLFbxXMDpNV98
	 0/25NltFCcuHaIY5MS+XIiJrn7q3Yr0nZcbhFfvgJVsgNf2d7EDY5F77ECsdpPE1e5
	 6vpjacKnFHLVfcp/AjgzDTUptnnNM2yCBRQ8UnA0PLnA+GzlhwSjyDqrn/v3i8XMBT
	 Qvi9zF3lWz0VA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2002/11]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502857536
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.35fc319154934217be628c272445e31c?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:40:58 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Note that if the vendor device is disabled, merging hardware IDs will
cause the 0002 device to have a higher identifier score than 0001.
Still, omitting the hardware ID in the Models entry as documented in MS
docs will cause an Inf2Cat warning "22.9.3: Missing hardware ID (cannot
have just compatible ID)", so we just have to deal with the score
promotion in this case.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index 7cc9ac2..7956af7 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -66,16 +66,15 @@ xenbus_monitor_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dl
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenBusName_VEND%	=XenBus_Inst,	PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01
-%XenBusName_0002%	=XenBus_Inst,	PCI\VEN_5853&DEV_0002
-%XenBusName_0001%	=XenBus_Inst,	PCI\VEN_5853&DEV_0001
+%XenBusName%=XenBus_Inst,\
+PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@&SUBSYS_@VENDOR_DEVICE_ID@5853&REV_01,\
+PCI\VEN_5853&DEV_0002,\
+PCI\VEN_5853&DEV_0001
 
 [XenBus_Inst] 
 CopyFiles=XenBus_CopyFiles
 CopyFiles=Monitor_CopyFiles
+FeatureScore=0xFE
 
 [XenBus_Inst.Services]
 AddService=xenbus_monitor,%SPSVCSINST_STARTSERVICE%,Monitor_Service,Monitor_EventLog
@@ -149,9 +148,6 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@" 
 DiskDesc="@PRODUCT_NAME@ PV Bus Package" 
 XenBusName="@PRODUCT_NAME@ PV Bus"
-XenBusName_VEND="@PRODUCT_NAME@ PV Bus (@VENDOR_DEVICE_ID@)"
-XenBusName_0002="@PRODUCT_NAME@ PV Bus (0002)"
-XenBusName_0001="@PRODUCT_NAME@ PV Bus (0001)"
 XenFiltName="@PRODUCT_NAME@ Generic Bus Filter"
 MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:02 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085444.1443732 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUI-0003OK-5V; Mon, 18 Aug 2025 07:41:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085444.1443732; Mon, 18 Aug 2025 07:41:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUI-0003O6-2v; Mon, 18 Aug 2025 07:41:02 +0000
Received: by outflank-mailman (input) for mailman id 1085444;
 Mon, 18 Aug 2025 07:41:01 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=nL53=26=bounce.vates.tech=bounce-md_30504962.68a2d90b.v1-85f75c99adbb47a496bcd820b6860d15@srs-se1.protection.inumbo.net>)
 id 1unuUH-0003FM-68
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:01 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id af2224da-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:41:00 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54QM4Q9lzK5vpXC
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:40:59 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 85f75c99adbb47a496bcd820b6860d15; Mon, 18 Aug 2025 07:40:59 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: af2224da-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502859; x=1755772859;
	bh=//tVa+UVEKgLwta7EEX0SSnDY1OYu1qGMAqDq4EXEdU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=V01dE2UCiPfiK0KNCQjz1eO0ji8zbkR2GbcPvZN8zr9lfKyQJ37Xy2yj3+ofamagQ
	 zAHMnmBaCyinR1TFI7WYc/3fh2xMKGLM5uuWjJdSUJllCBV8JjPuGpoPrjWL3S56b5
	 Bh6CTyzXOILvjDrWPZZDXMiBzRD9OR+mE0BhKDVBJ60B3dWT85lcvoVQWozQRD8U8q
	 hkpjjmJO4Cv1lscXD6+WAlkO6sjrkZJNiADZ8n8YrAWMCUkAO4xBmF3utmTnS5rb2H
	 XX0d0xLyRftjgr5p6xAWyeAVEpd8AzLjaREUjTnDEdl+VYo8EuOFmv5nXZJ913AUNP
	 ocLKHWvPOAVsA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502859; x=1755763359; i=ngoc-tu.dinh@vates.tech;
	bh=//tVa+UVEKgLwta7EEX0SSnDY1OYu1qGMAqDq4EXEdU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Mj7Lnn5jPEoV88CO5n97s1hmIf5xt6YY3Tmu06fVuPZvoCJhJHVEYKA9IVUn+7ozE
	 NMpOVak8CQO3iFTcbx+ZkAdQ4LMYuLuN0yc7XmQ5rdwID49IiIiCIICyxQzaDX73Mi
	 PgPWIqelpkJ9om0TVvSwm+jhgJa8EwzV1nmb0jDfD89kjrVZsvfFEO3IZIVBPe+mPJ
	 uIea/UJjx8HGo52kXmKazkXbILZrLLAhVckHq4/+xq/5ItTJnUZb/hzaBnkMj0wr1K
	 3NPX+3F1m7Yd12g9q55xdzLcDfvM1cRH1485W261U4+iah6CyRJKgKyUcmsL2FZAL9
	 1p0mag+YpnJsA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2003/11]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502858944
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.85f75c99adbb47a496bcd820b6860d15?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:40:59 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenbus/pdo.c b/src/xenbus/pdo.c
index ec2fb5e..d23af50 100644
--- a/src/xenbus/pdo.c
+++ b/src/xenbus/pdo.c
@@ -1420,8 +1420,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENBUS\\VEN_%hs&DEV_%hs",
-                                    __PdoGetVendorName(Pdo),
+                                    L"XENBUS\\VEN_" VENDOR_PREFIX_STR "&DEV_%hs",
                                     __PdoGetName(Pdo));
         ASSERT(NT_SUCCESS(status));
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:03 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085445.1443737 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUJ-0003RK-6s; Mon, 18 Aug 2025 07:41:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085445.1443737; Mon, 18 Aug 2025 07:41:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUJ-0003RF-4C; Mon, 18 Aug 2025 07:41:03 +0000
Received: by outflank-mailman (input) for mailman id 1085445;
 Mon, 18 Aug 2025 07:41:02 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Bzc3=26=bounce.vates.tech=bounce-md_30504962.68a2d90d.v1-e94c52502b4549b0af6d7958cd143060@srs-se1.protection.inumbo.net>)
 id 1unuUI-0003FM-M5
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:02 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id affe5476-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:41:02 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54QP0SDwzRKLdnL
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:01 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 e94c52502b4549b0af6d7958cd143060; Mon, 18 Aug 2025 07:41:01 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: affe5476-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502861; x=1755772861;
	bh=pVfQ6/yUldW6t+mvk/cJksdV+O7sGd4mJMKFvlChY+Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=N9iDO0/KFMJDwk+nvZ66J0g5pKBtFeYGi/MUjlXq1km2rihLLAil6bpFsBCT/5d7A
	 4PmIM+Cp7Nw5sawQIj+f6MDU+kFPAOMLpYuiFoe3kkXPk8tFybzdOH2fSTU0OdAd8O
	 5dqc5dA2ceYWoo1PRkEsk25beVMY/r+bWzxj5djy1sfdBl56yW4T0dqS3+8zsu8q9J
	 3eZlTm3HJwwCX3lyRwnLMz3oJc7/ZT+SusrGyYdZVRYRUELCXAoASz1vnCZSwzVdUL
	 tiDBSKy7VMVkQNh94MBW7KALYhnORz4Zx2a5hsPUn9NZ/RrMYuA76hpxH7lBtZPind
	 gwVuPMWsLevLg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502861; x=1755763361; i=ngoc-tu.dinh@vates.tech;
	bh=pVfQ6/yUldW6t+mvk/cJksdV+O7sGd4mJMKFvlChY+Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=x3pu+50iOkjPbA/RBNgq9W3KApbCjICY1b0hzbTlmYd4AdSXGu8vW/8Zso9n5dEPC
	 0I3k1G6QcVXConBdsEJRw+gB0aHj9qwoBpxlp5lpdtxzKACfYVdUPlkDVhQQ+mxFYa
	 hsceD6Y+FGl5Eq+ufU+c7ehmWJ3EHmaHnW+528Ix4VFs/ARpIk7sWFyf6Y7SU5/lpv
	 0Z2uMcrwdy/59uqmC50X0aLGFYl9XlKBC6hZ30vEkqcxCBVwmed2wmAtOk0nHRYur6
	 H18sXKHGTa2Hqsl6xcN+pJ5i73EB2E5qO+S3D0yfzEHUnrRof5KrLACwKyI05FXyWr
	 5ObymVe4V5Sfw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2004/11]=20Deprecate=20PDO=20revisions=200x09000007=20and=20earlier?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502860459
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.e94c52502b4549b0af6d7958cd143060?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:01 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

0x09000008 has been available since 2021.

Deprecate the old PDO revisions to make space for new revisions.

Due to b0b9cc139600 removing REV from DeviceID, it's no longer safe to
remove interfaces even if they're not exposed by the revision list, as
old drivers could have bound to older revisions and not aware of updated
Xenbus.

The following interface versions are deprecated but not removed:
* SHARED_INFO v2
* EVTCHN v5-v8
* CACHE v1
* GNTTAB v2-v3
* EMULATED v1

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/revision.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/include/revision.h b/include/revision.h
index 4c5607a..e9e62e6 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -48,14 +48,6 @@
 
 //                    REVISION   S  SI   E   D  ST   R   C   G   U  CO  EM
 #define DEFINE_REVISION_TABLE                                                \
-    DEFINE_REVISION(0x09000000,  1,  2,  5,  1,  2,  1,  1,  2,  1,  0,  1), \
-    DEFINE_REVISION(0x09000001,  1,  2,  6,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000002,  1,  2,  7,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000003,  1,  2,  8,  1,  2,  1,  1,  2,  1,  1,  1), \
-    DEFINE_REVISION(0x09000004,  1,  2,  8,  1,  2,  1,  1,  3,  1,  1,  1), \
-    DEFINE_REVISION(0x09000005,  1,  2,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000006,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  1), \
-    DEFINE_REVISION(0x09000007,  1,  3,  8,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:06 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085446.1443741 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUM-0003UC-8O; Mon, 18 Aug 2025 07:41:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085446.1443741; Mon, 18 Aug 2025 07:41:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUM-0003U4-5R; Mon, 18 Aug 2025 07:41:06 +0000
Received: by outflank-mailman (input) for mailman id 1085446;
 Mon, 18 Aug 2025 07:41:05 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=avEl=26=bounce.vates.tech=bounce-md_30504962.68a2d90e.v1-6d718b03f33547c2b2681d0e9a584362@srs-se1.protection.inumbo.net>)
 id 1unuUK-0003E3-Vw
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:04 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b0d9853d-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:03 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54QQ3ZfGzRKNjFd
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:02 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 6d718b03f33547c2b2681d0e9a584362; Mon, 18 Aug 2025 07:41:02 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b0d9853d-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502862; x=1755772862;
	bh=IuBz5q7HxfgorLEMmbqjSD3M8/W04jZ+QAIa0NStoCw=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=s4G9feqG5oZQNnl3gRa/svou3MtKMBAHNDFTxq9Om0ddY1cmlD7pjnZ7Z1bqjTnb8
	 79Gyiy0Tk8jrIbyZS0e5isix95qdO9O1+U7RED7dhkd55zbdSXA658PCP08A+m6GiG
	 w/JiaD8AZfCwQnJ7riGrOufaLzwMgqsz6HnGQvGrJ1tulb57Sif6u7yLR8tFU+NTTU
	 4ywqiW6p8xnxMVyx78Io0M3Ibg+AUBFc12vUK+UdUzQSsb4gTkrsul2jkBXO+a7HHD
	 lutscfyw42JZYOGgq2JxemDakxKzOZQN7F9nl/D5qEVXUfxbdXcnoq90vOYypv7QkF
	 6RSz5Jz0VmPRA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502862; x=1755763362; i=ngoc-tu.dinh@vates.tech;
	bh=IuBz5q7HxfgorLEMmbqjSD3M8/W04jZ+QAIa0NStoCw=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=BiB23FQXkMwoMRZCTyp4eC+n1Eei3EqbX+UdVx6y89f6HlebMBplvufreeB5Mrgfi
	 hhi04l18MjJKEMnL8cNgM3hqY2cnYf1hukUYN0JE/2kMb2c75vyCLArIOm+aS19WEC
	 c4/GHJDVb/6n3DEweOFWxBzuvMq0OH6SFjJdvGJJLCnnlObfAGIRfpF2MX7IGBvSRW
	 9p+Rg2hhdO9ZeTUQ/3i/is9dAq4d9Ru+mmDVE6eLRPnqD4nhHmWKhyy/9bG3r8ARk9
	 qPO5X8CCNhOCO0+eT+sUe2XJGU+Pl6+bNvtTC63ny2bJ62xRxykt3zVT//kB4PtCYA
	 pzo9BfxdGlg3A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2005/11]=20xenbus:=20Use=20nonpaged=20pool=20in=20FdoQueryId?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502861878
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.6d718b03f33547c2b2681d0e9a584362?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:02 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow the DeviceID result to eventually be accessed from DISPATCH_LEVEL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index b844f36..7ee44a6 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -627,7 +627,7 @@ FdoQueryId(
     Buffer = (PWSTR)StatusBlock.Information;
     Length = (ULONG)(wcslen(Buffer) + 1) * sizeof (CHAR);
 
-    *Id = __AllocatePoolWithTag(PagedPool, Length, 'SUB');
+    *Id = __AllocatePoolWithTag(NonPagedPool, Length, 'SUB');
 
     status = STATUS_NO_MEMORY;
     if (*Id == NULL)
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:12 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085449.1443745 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUS-0003Yx-9q; Mon, 18 Aug 2025 07:41:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085449.1443745; Mon, 18 Aug 2025 07:41:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUS-0003Yq-6x; Mon, 18 Aug 2025 07:41:12 +0000
Received: by outflank-mailman (input) for mailman id 1085449;
 Mon, 18 Aug 2025 07:41:11 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=AMy0=26=bounce.vates.tech=bounce-md_30504962.68a2d914.v1-03f925e841364415b6b0c0625beafeaa@srs-se1.protection.inumbo.net>)
 id 1unuUR-0003E3-Bt
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:11 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b48b3c3b-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:09 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54QX4z5BzK5vnLF
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:08 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 03f925e841364415b6b0c0625beafeaa; Mon, 18 Aug 2025 07:41:08 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b48b3c3b-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502868; x=1755772868;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=fdVtPHLptxm+NhveQTMeTc4tSTYCmal9RPAh2LmJ+itiYgZTiQcq3w8/PXZtQl3hy
	 LmnwjJyEXMUCsPoM/eqgMXrjPJ6K4O/CJwGBzBQYve5kCwV767vm7XROoBVQhZzIee
	 A/IdQBJf7jyaMEpyebBaLuzZqC1wBU8FVBwmZ/XsiiNTI/boT6cRn0nRSuuCpbS2Fv
	 rWwSz05yn7iWbV4MOo7+9+/iXg5z/SmPzM1C2K4pWqnyhrCQ7+NapzYMdravnNmMUD
	 ttWeSjfXSpRedqCBMDSdOcyJfVmK2Rg/IM3/2Fa3WyD/FPjsHm3mdMNXtFF1Z2mhkP
	 ciEtD3+rEoTLA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502868; x=1755763368; i=ngoc-tu.dinh@vates.tech;
	bh=J31XAE8PUM1N/83rSCQrCH9GxF0pxK3IoFrOWST93Dk=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=aSoACAZTtWv5VrlC+noLMTqXwIqGuvwPwP6jbnKv34s31dakwSegD5d3FN5KS48dx
	 lox84L9/bIoAvMPxXdtKKgZ7Szw0YFlldCTqGw9aNUd3EKX+Zn+PIWjwQKYZOP3wAd
	 9I5kkiaxQDUeLnOrFXElmIXhOT0+vCW4nrSoVhPytSsB2SKmLzE+OAqU1lGT1QWYxh
	 x9nYmRvoeJjMP5fY8tbY7D4fkouvFZoVoVnp2KTF3Qb4vOOvskpjX0AfRBU/256k97
	 YmqWUo1fevJqzZb2ArriE7xyG++UYGwUaUi4ILAhCqWqOvL6m2cViyyPTHklnG8MXg
	 47rs/EkUoQsZw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2006/11]=20Add=20forced=20unplug=20support?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502868000
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-7-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.03f925e841364415b6b0c0625beafeaa?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:08 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Forced unplug aims to simplify driver servicing by, as its name implies,
forcefully unplugging emulated devices when a driver is present, rather
than when it's active.

Create a Registry key at CurrentControlSet\XEN\ForceUnplug. Drivers can
opt into forced unplug by creating an appropriate value (DISKS/NICS)
in this key.

Older drivers are not affected.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xen/driver.c | 79 ++++++++++++++++++++++++++++++++++++++----------
 src/xen/driver.h |  5 +++
 src/xen/unplug.c | 13 ++++++--
 3 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/src/xen/driver.c b/src/xen/driver.c
index b44753c..7b2621b 100644
--- a/src/xen/driver.c
+++ b/src/xen/driver.c
@@ -63,6 +63,7 @@ typedef struct _XEN_DRIVER {
     PLOG_DISPOSITION    QemuDisposition;
     HANDLE              ParametersKey;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     HANDLE              MemoryKey;
 } XEN_DRIVER, *PXEN_DRIVER;
 
@@ -144,6 +145,30 @@ DriverGetUnplugKey(
     return __DriverGetUnplugKey();
 }
 
+static FORCEINLINE VOID
+__DriverSetForceUnplugKey(
+    _In_opt_ HANDLE Key
+    )
+{
+    Driver.ForceUnplugKey = Key;
+}
+
+static FORCEINLINE HANDLE
+__DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return Driver.ForceUnplugKey;
+}
+
+HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    )
+{
+    return __DriverGetForceUnplugKey();
+}
+
 static FORCEINLINE VOID
 __DriverSetMemoryKey(
     _In_opt_ HANDLE Key
@@ -500,6 +525,7 @@ DllInitialize(
     HANDLE                  ServiceKey;
     HANDLE                  ParametersKey;
     HANDLE                  UnplugKey;
+    HANDLE                  ForceUnplugKey;
     HANDLE                  MemoryKey;
     LOG_LEVEL               LogLevel;
     NTSTATUS                status;
@@ -577,12 +603,21 @@ DllInitialize(
 
     __DriverSetUnplugKey(UnplugKey);
 
+    status = RegistryCreateSubKey(ServiceKey,
+                                  "ForceUnplug",
+                                  REG_OPTION_NON_VOLATILE,
+                                  &ForceUnplugKey);
+    if (!NT_SUCCESS(status))
+        goto fail6;
+
+    __DriverSetForceUnplugKey(ForceUnplugKey);
+
     status = RegistryCreateSubKey(ServiceKey,
                                   "Memory",
                                   REG_OPTION_VOLATILE,
                                   &MemoryKey);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     __DriverSetMemoryKey(MemoryKey);
 
@@ -590,27 +625,27 @@ DllInitialize(
 
     status = AcpiInitialize();
     if (!NT_SUCCESS(status))
-        goto fail7;
+        goto fail8;
 
     status = SystemInitialize();
     if (!NT_SUCCESS(status))
-        goto fail8;
+        goto fail9;
 
     status = BugCheckInitialize();
     if (!NT_SUCCESS(status))
-        goto fail9;
+        goto fail10;
 
     status = ModuleInitialize();
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = ProcessInitialize();
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = UnplugInitialize();
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     RegistryCloseKey(ServiceKey);
 
@@ -618,39 +653,45 @@ DllInitialize(
 
     return STATUS_SUCCESS;
 
+fail13:
+    Error("fail13\n");
+
+    ProcessTeardown();
+
 fail12:
     Error("fail12\n");
 
-    ProcessTeardown();
+    ModuleTeardown();
 
 fail11:
     Error("fail11\n");
 
-    ModuleTeardown();
+    BugCheckTeardown();
 
 fail10:
     Error("fail10\n");
 
-    BugCheckTeardown();
+    SystemTeardown();
 
 fail9:
     Error("fail9\n");
 
-    SystemTeardown();
+    AcpiTeardown();
 
 fail8:
     Error("fail8\n");
 
-    AcpiTeardown();
-
-fail7:
-    Error("fail7\n");
-
     HypercallTeardown();
 
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+fail7:
+    Error("fail7\n");
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
 fail6:
     Error("fail6\n");
 
@@ -698,6 +739,7 @@ DllUnload(
     )
 {
     HANDLE  MemoryKey;
+    HANDLE  ForceUnplugKey;
     HANDLE  UnplugKey;
     HANDLE  ParametersKey;
 
@@ -722,6 +764,11 @@ DllUnload(
     RegistryCloseKey(MemoryKey);
     __DriverSetMemoryKey(NULL);
 
+    ForceUnplugKey = __DriverGetForceUnplugKey();
+
+    RegistryCloseKey(ForceUnplugKey);
+    __DriverSetForceUnplugKey(NULL);
+
     UnplugKey = __DriverGetUnplugKey();
 
     RegistryCloseKey(UnplugKey);
diff --git a/src/xen/driver.h b/src/xen/driver.h
index 21df779..6851e01 100644
--- a/src/xen/driver.h
+++ b/src/xen/driver.h
@@ -43,6 +43,11 @@ DriverGetUnplugKey(
     VOID
     );
 
+extern HANDLE
+DriverGetForceUnplugKey(
+    VOID
+    );
+
 extern PMDL
 DriverGetNamedPages(
     _In_ PSTR   Name,
diff --git a/src/xen/unplug.c b/src/xen/unplug.c
index dbd9a2e..282ed93 100644
--- a/src/xen/unplug.c
+++ b/src/xen/unplug.c
@@ -266,6 +266,7 @@ UnplugSetRequest(
 {
     PUNPLUG_CONTEXT     Context = &UnplugContext;
     HANDLE              UnplugKey;
+    HANDLE              ForceUnplugKey;
     PSTR                ValueName;
     PSTR                EnumName;
     ULONG               Value;
@@ -277,6 +278,7 @@ UnplugSetRequest(
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
     UnplugKey = DriverGetUnplugKey();
+    ForceUnplugKey = DriverGetForceUnplugKey();
 
     switch (Type) {
     case UNPLUG_DISKS:
@@ -293,17 +295,24 @@ UnplugSetRequest(
         ASSERT(FALSE);
     }
 
+    status = RegistryQueryDwordValue(ForceUnplugKey,
+                                     ValueName,
+                                     &Value);
+    if (NT_SUCCESS(status) && Value)
+        goto unplug;
+
     status = RegistryQueryDwordValue(UnplugKey,
                                      ValueName,
                                      &Value);
     if (!NT_SUCCESS(status))
         goto done;
 
-    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
-
     if (Value != 0)
         (VOID) UnplugCheckEnumKey(EnumName, &Value);
 
+unplug:
+    (VOID) RegistryDeleteValue(UnplugKey, ValueName);
+
     Info("%s (%u)\n", ValueName, Value);
 
     AcquireHighLock(&Context->Lock, &Irql);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:13 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085450.1443749 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUT-0003bR-Bi; Mon, 18 Aug 2025 07:41:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085450.1443749; Mon, 18 Aug 2025 07:41:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUT-0003b6-8S; Mon, 18 Aug 2025 07:41:13 +0000
Received: by outflank-mailman (input) for mailman id 1085450;
 Mon, 18 Aug 2025 07:41:12 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=mC7B=26=bounce.vates.tech=bounce-md_30504962.68a2d915.v1-0376b332442646978996a9710e9393ec@srs-se1.protection.inumbo.net>)
 id 1unuUS-0003E3-Kd
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:12 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b54f4010-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:10 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54QY70cfzK5vlNs
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:09 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0376b332442646978996a9710e9393ec; Mon, 18 Aug 2025 07:41:09 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b54f4010-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502870; x=1755772870;
	bh=z0FSaPTx5xr2kQ/tXoDP/T/oQIDHvzjIKjVCAiB2Daw=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=zwJjYgHZI6lVLvdliHX+0GA1Z1YZsY73DZCxEBiaC6eJsRXcvk1EUpkU5n0MztvOy
	 sfvy7j9SjVPZrxhX3w63Et+bJYgjnVjLlWMvPkZNPuqmzJ1tNepVfTaozMCPU6Btvm
	 eACGiCdLMxK3PEkCzERwULpew57v/NAeMuIBxjJ/X1IJ3rJoVErvANbRWX+EfKrNLV
	 MW+5CYuh+kuXhDr+GLtR25gnkqcObt4IUQEaH9AA5rpdf59z5YTcFeoA4jmwt/ofP3
	 cF8YVTvBb3G7i+z7Og98Bu2gZ6OrwUfv6BWAlMfpXmAYjOreBlB5jJCZwRXYtNw/U2
	 Iikgwq7BDT4pA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502870; x=1755763370; i=ngoc-tu.dinh@vates.tech;
	bh=z0FSaPTx5xr2kQ/tXoDP/T/oQIDHvzjIKjVCAiB2Daw=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=s4oWEhnIeFq5G8HtwCKWxH1u/bOd7ADbgJf9D51dRBkacLeqHJ+J5wy8HDYkHqIjB
	 mRRBRj8IV3m1msHQGWaYxEURgXIAVbsAZnnLS609FOW4qbC9AweJPfCV3r/YSACihH
	 jBAyMJ1ZkXBUhXxgPsLVf2Sy83eGNLyJcwt6qnd9xzrExRIsr8kbko4PIM9uwg/s65
	 4DTMRdLpUPf2uK0Pw/+thMTB1efO+g/RbJK80Gtk1UvIrwEtrqKqupCkSc0+o1GRRu
	 gCXRk6a9OHAQcIL/Ova2Kee96h2VcLmkpXcTrw3E8UkKHPL3L+BIn9qRVEHSJ5uEHO
	 c4+mbsVwfmnlg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2007/11]=20xenfilt:=20Add=20Xenbus=20device=20precedence=20mechanism?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502869355
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-8-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0376b332442646978996a9710e9393ec?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:09 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define registry values in xenfilt\Parameters with the names being
compatible IDs and values being numeric precedences.

The Xenbus device with the highest precedence should always be activated
over devices with lower precedence, ignoring Active* values.

If a device is force-activated, get its IDs directly instead of via
Active* values.

Define XENBUS_EMULATED_ACTIVATION_STATUS in emulated_interface.h for
latter use.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h | 10 +++++
 src/xenfilt/driver.c         | 71 ++++++++++++++++++++++++++++++++++++
 src/xenfilt/driver.h         |  7 ++++
 src/xenfilt/fdo.c            | 28 +++++++++++++-
 src/xenfilt/pdo.c            | 62 +++++++++++++++++--------------
 src/xenfilt/pdo.h            |  7 ++--
 6 files changed, 153 insertions(+), 32 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index ead9c14..86a9e06 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -42,6 +42,16 @@
 
 #ifndef _WINDLL
 
+/*! \typedef XENBUS_EMULATED_ACTIVATION_STATUS
+    \brief If the device was force-activated, force-deactivated or
+           otherwise.
+*/
+typedef enum _XENBUS_EMULATED_ACTIVATION_STATUS {
+    XENBUS_EMULATED_ACTIVATE_NEUTRAL = 0,
+    XENBUS_EMULATED_FORCE_ACTIVATED = 1,
+    XENBUS_EMULATED_FORCE_DEACTIVATED = 2,
+} XENBUS_EMULATED_ACTIVATION_STATUS, *PXENBUS_EMULATED_ACTIVATION_STATUS;
+
 /*! \typedef XENFILT_EMULATED_ACQUIRE
     \brief Acquire a reference to the EMULATED interface
 
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 16e4deb..67287d7 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -279,6 +279,77 @@ DriverGetActive(
     return __DriverGetActive(Key, Value);
 }
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+NTSTATUS
+DriverGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    )
+{
+    HANDLE              ParametersKey;
+    HANDLE              PrecedenceKey;
+    PSTR                CompatibleIDs;
+    ULONG               Index;
+    NTSTATUS            status;
+
+    status = RegistryOpenParametersKey(KEY_READ, &ParametersKey);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
+    status = RegistryOpenSubKey(ParametersKey,
+                                "Precedence",
+                                KEY_READ,
+                                &PrecedenceKey);
+    if (!NT_SUCCESS(status))
+        goto fail2;
+
+    status = DriverQueryId(PhysicalDeviceObject,
+                           BusQueryCompatibleIDs,
+                           &CompatibleIDs);
+    if (!NT_SUCCESS(status))
+        goto fail3;
+
+    Index = 0;
+
+    do {
+        ULONG   Length = (ULONG)strlen(&CompatibleIDs[Index]);
+
+        if (Length == 0)
+            break;
+
+        status = RegistryQueryDwordValue(PrecedenceKey,
+                                         &CompatibleIDs[Index],
+                                         Precedence);
+        if (NT_SUCCESS(status))
+            goto done;
+
+        Index += Length + 1;
+    } while (1);
+
+    *Precedence = 0;
+
+done:
+    if (*Precedence)
+        Info("%s found precedence %lX\n", CompatibleIDs, *Precedence);
+
+    ExFreePool(CompatibleIDs);
+    RegistryCloseKey(PrecedenceKey);
+    RegistryCloseKey(ParametersKey);
+
+    return STATUS_SUCCESS;
+
+fail3:
+    RegistryCloseKey(PrecedenceKey);
+
+fail2:
+    RegistryCloseKey(ParametersKey);
+
+fail1:
+    *Precedence = 0;
+
+    return status;
+}
+
 static BOOLEAN
 DriverIsActivePresent(
     VOID
diff --git a/src/xenfilt/driver.h b/src/xenfilt/driver.h
index 9c703c1..cf6a2d6 100644
--- a/src/xenfilt/driver.h
+++ b/src/xenfilt/driver.h
@@ -54,6 +54,13 @@ DriverGetActive(
     _Outptr_result_z_ PSTR  *Value
     );
 
+_On_failure_(_Post_satisfies_(*Precedence == 0))
+extern NTSTATUS
+DriverGetPrecedence(
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject,
+    _Out_ PULONG        Precedence
+    );
+
 typedef enum _XENFILT_FILTER_STATE {
     XENFILT_FILTER_ENABLED = 0,
     XENFILT_FILTER_PENDING,
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 594da4a..87302bb 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -404,6 +404,8 @@ FdoEnumerate(
     ULONG                   Count;
     PLIST_ENTRY             ListEntry;
     ULONG                   Index;
+    ULONG                   ActiveIndex;
+    ULONG                   Precedence;
     NTSTATUS                status;
 
     Count = Relations->Count;
@@ -458,11 +460,35 @@ FdoEnumerate(
         ListEntry = Next;
     }
 
+    ActiveIndex = Precedence = 0;
+    for (Index = 0; Index < Count; Index++) {
+        ULONG   ThisPrecedence;
+
+        if (PhysicalDeviceObject[Index] != NULL) {
+            status = DriverGetPrecedence(PhysicalDeviceObject[Index],
+                                         &ThisPrecedence);
+            if (ThisPrecedence > Precedence) {
+                ActiveIndex = Index;
+                Precedence = ThisPrecedence;
+            }
+        }
+    }
+
     // Walk the list and create PDO filters for any new devices
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            (VOID) PdoCreate(Fdo, PhysicalDeviceObject[Index], Fdo->Type);
+            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate =
+                                                XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
+            if (Precedence > 0)
+                ForceActivate = Index == ActiveIndex ?
+                                XENBUS_EMULATED_FORCE_ACTIVATED :
+                                XENBUS_EMULATED_FORCE_DEACTIVATED;
+            (VOID) PdoCreate(Fdo,
+                             PhysicalDeviceObject[Index],
+                             Fdo->Type,
+                             ForceActivate);
             ObDereferenceObject(PhysicalDeviceObject[Index]);
         }
     }
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 4f40c4f..58c9ef0 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -249,15 +249,16 @@ __PdoGetFdo(
 
 static NTSTATUS
 PdoSetDeviceInformation(
-    _In_ PXENFILT_PDO   Pdo
+    _In_ PXENFILT_PDO                       Pdo,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     )
 {
-    PXENFILT_DX         Dx = Pdo->Dx;
-    PSTR                DeviceID;
-    PSTR                ActiveDeviceID;
-    PSTR                InstanceID;
-    PSTR                LocationInformation;
-    NTSTATUS            status;
+    PXENFILT_DX                             Dx = Pdo->Dx;
+    PSTR                                    DeviceID;
+    PSTR                                    ActiveDeviceID;
+    PSTR                                    InstanceID;
+    PSTR                                    LocationInformation;
+    NTSTATUS                                status;
 
     status = DriverQueryId(Pdo->LowerDeviceObject,
                            BusQueryDeviceID,
@@ -265,19 +266,23 @@ PdoSetDeviceInformation(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    status = DriverGetActive("DeviceID",
-                             &ActiveDeviceID);
-    if (NT_SUCCESS(status)) {
-        Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
-                      TRUE :
-                      FALSE;
-
-        ExFreePool(ActiveDeviceID);
+    if (ForceActivate != XENBUS_EMULATED_ACTIVATE_NEUTRAL) {
+        Pdo->Active = ForceActivate == XENBUS_EMULATED_FORCE_ACTIVATED;
     } else {
-        Pdo->Active = FALSE;
+        status = DriverGetActive("DeviceID",
+                                &ActiveDeviceID);
+        if (NT_SUCCESS(status)) {
+            Pdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ?
+                        TRUE :
+                        FALSE;
+
+            ExFreePool(ActiveDeviceID);
+        } else {
+            Pdo->Active = FALSE;
+        }
     }
 
-    if (Pdo->Active) {
+    if (Pdo->Active && ForceActivate == XENBUS_EMULATED_ACTIVATE_NEUTRAL) {
         status = DriverGetActive("InstanceID",
                                  &InstanceID);
         if (!NT_SUCCESS(status))
@@ -1620,18 +1625,19 @@ PdoSuspend(
 
 NTSTATUS
 PdoCreate(
-    _In_ PXENFILT_FDO                   Fdo,
-    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ PXENFILT_FDO                       Fdo,
+    _In_ PDEVICE_OBJECT                     PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     )
 {
-    PDEVICE_OBJECT                      LowerDeviceObject;
-    ULONG                               DeviceType;
-    PDEVICE_OBJECT                      FilterDeviceObject;
-    PXENFILT_DX                         Dx;
-    PXENFILT_PDO                        Pdo;
-    PSTR                                CompatibleIDs;
-    NTSTATUS                            status;
+    PDEVICE_OBJECT                          LowerDeviceObject;
+    ULONG                                   DeviceType;
+    PDEVICE_OBJECT                          FilterDeviceObject;
+    PXENFILT_DX                             Dx;
+    PXENFILT_PDO                            Pdo;
+    PSTR                                    CompatibleIDs;
+    NTSTATUS                                status;
 
     ASSERT(Type != XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN);
 
@@ -1680,7 +1686,7 @@ PdoCreate(
     Pdo->LowerDeviceObject = LowerDeviceObject;
     Pdo->Type = Type;
 
-    status = PdoSetDeviceInformation(Pdo);
+    status = PdoSetDeviceInformation(Pdo, ForceActivate);
     if (!NT_SUCCESS(status))
         goto fail4;
 
diff --git a/src/xenfilt/pdo.h b/src/xenfilt/pdo.h
index 85bc07f..c0c06a4 100644
--- a/src/xenfilt/pdo.h
+++ b/src/xenfilt/pdo.h
@@ -80,9 +80,10 @@ PdoGetDeviceObject(
 
 extern NTSTATUS
 PdoCreate(
-    _In_ PXENFILT_FDO                   Fdo,
-    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
+    _In_ PXENFILT_FDO                       Fdo,
+    _In_ PDEVICE_OBJECT                     PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate
     );
 
 extern VOID
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:15 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085454.1443753 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUV-0003fd-Dx; Mon, 18 Aug 2025 07:41:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085454.1443753; Mon, 18 Aug 2025 07:41:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUV-0003fV-AT; Mon, 18 Aug 2025 07:41:15 +0000
Received: by outflank-mailman (input) for mailman id 1085454;
 Mon, 18 Aug 2025 07:41:14 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=acSS=26=bounce.vates.tech=bounce-md_30504962.68a2d917.v1-24009be569bd4cc1a36af670bfb34df3@srs-se1.protection.inumbo.net>)
 id 1unuUT-0003E3-Tl
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:14 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b60b6532-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:12 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Qb0p62zK5vrtm
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:11 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 24009be569bd4cc1a36af670bfb34df3; Mon, 18 Aug 2025 07:41:11 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b60b6532-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502871; x=1755772871;
	bh=2+Ma7HerTQ4tDqdUzwS1UNB2f3TSAn7Iu+lG8k6yyCg=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=MI8QsAJOzEx7vFhqglr+hyC1YLXMPcCJh1rPvQGSEbwWY8lT2aGXRiRwC+WMXdzs/
	 vm5JColqGm+r/SBTHisF8nWjTO32AZhrhv5tUmpWNDVVw76V2BWoxvKOgmCb0tF8RL
	 TohWHrFRV/FENsXMvUeHX4CAQugaHX4g4FJoKIAKY4Xn+LQHhJVoyJyXs8OSPEjahb
	 g6LJVuLh6pA2H5XZZVFGtZP+RLdlDeKyHpxmRpi3W1N9qRWadWpjLmmKPCbhIxT0AH
	 9bHSuTMikrGccmYpp1sveHA7L/sHaWum4sw44tWDucTt4HqAsOGVh/UVqvcUEC+JKD
	 RD+GOrTzZW2pA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502871; x=1755763371; i=ngoc-tu.dinh@vates.tech;
	bh=2+Ma7HerTQ4tDqdUzwS1UNB2f3TSAn7Iu+lG8k6yyCg=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=iwSNONzaFoCWmL/dpgCl9k4KCx2C/46sd1Hav4qqgyuf3cxz5DeGLAqBFXZZfZeWg
	 lNB9nEaXORmuI12L8JX8ojSce81JlsY1Pw6JwW6g6aEeIcVkv0w8aiiT7gIotovQP0
	 NIJH3RUOcB6elEW/3u+k3G82s/St++WKewU16IQ+7DuY3Dc7RwqFuauKsYzTutz4hN
	 nYHqgApxwKRbdhXQ6OK3eP1UE/by4fMTGeh6dc7sULtWets9ttjQOl2hHUk9dDGt5e
	 X0Yl5HJRC8aBZgrHQC1Yqg3DT/fHMF/47MxKeO5S4rn+EFvyIn17+gbSxW69T32QR+
	 bR1+J2NFjLwbA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2008/11]=20Add=20EMULATED=20v3?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502870472
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-9-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.24009be569bd4cc1a36af670bfb34df3?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:11 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Allow querying the current active device's forced-activation status by
calling EmulatedIsDevicePresent with DeviceID=NULL.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/emulated_interface.h |  51 +++++++++++++---
 include/revision.h           |   3 +-
 src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++++++-------
 src/xenfilt/emulated.h       |  13 ++--
 src/xenfilt/fdo.c            |   6 +-
 src/xenfilt/pdo.c            |   1 +
 6 files changed, 148 insertions(+), 41 deletions(-)

diff --git a/include/emulated_interface.h b/include/emulated_interface.h
index 86a9e06..7d47707 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_interface.h
@@ -72,7 +72,7 @@ typedef VOID
     _In_ PINTERFACE Interface
     );
 
-/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT_V1
     \brief Determine whether a given device is present in the VM
 
     \param Interface The interface header
@@ -83,12 +83,33 @@ typedef VOID
     FALSE if it is not
 */
 typedef BOOLEAN
-(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT_V1)(
     _In_ PVOID      Context,
     _In_ PSTR       DeviceID,
     _In_opt_ PSTR   InstanceID
     );
 
+/*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
+    \brief Determine whether a given device is present in the VM
+
+    \param Interface The interface header
+    \param DeviceID The DeviceID of the device, or NULL to query the force-
+           activated device
+    \param InstanceID The (un-prefixed) InstanceID of the device or
+           NULL to match any device instance
+    \param IsForceActivated If the device was force-activated, force-deactivated
+           or otherwise.
+    \return TRUE if the specified device is present in the system or
+            FALSE if it is not
+*/
+typedef BOOLEAN
+(*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
+    _In_ PVOID                                      Context,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
+    );
+
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DISK_PRESENT_V1)(
     _In_ PVOID  Context,
@@ -120,11 +141,11 @@ DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V1 {
-    INTERFACE                           Interface;
-    XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
-    XENFILT_EMULATED_RELEASE            EmulatedRelease;
-    XENFILT_EMULATED_IS_DEVICE_PRESENT  EmulatedIsDevicePresent;
-    XENFILT_EMULATED_IS_DISK_PRESENT_V1 EmulatedIsDiskPresentVersion1;
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT_V1     EmulatedIsDiskPresentVersion1;
 };
 
 /*! \struct _XENFILT_EMULATED_INTERFACE_V2
@@ -132,6 +153,18 @@ struct _XENFILT_EMULATED_INTERFACE_V1 {
     \ingroup interfaces
 */
 struct _XENFILT_EMULATED_INTERFACE_V2 {
+    INTERFACE                               Interface;
+    XENFILT_EMULATED_ACQUIRE                EmulatedAcquire;
+    XENFILT_EMULATED_RELEASE                EmulatedRelease;
+    XENFILT_EMULATED_IS_DEVICE_PRESENT_V1   EmulatedIsDevicePresentVersion1;
+    XENFILT_EMULATED_IS_DISK_PRESENT        EmulatedIsDiskPresent;
+};
+
+/*! \struct _XENFILT_EMULATED_INTERFACE_V3
+    \brief EMULATED interface version 3
+    \ingroup interfaces
+*/
+struct _XENFILT_EMULATED_INTERFACE_V3 {
     INTERFACE                           Interface;
     XENFILT_EMULATED_ACQUIRE            EmulatedAcquire;
     XENFILT_EMULATED_RELEASE            EmulatedRelease;
@@ -139,7 +172,7 @@ struct _XENFILT_EMULATED_INTERFACE_V2 {
     XENFILT_EMULATED_IS_DISK_PRESENT    EmulatedIsDiskPresent;
 };
 
-typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
+typedef struct _XENFILT_EMULATED_INTERFACE_V3 XENFILT_EMULATED_INTERFACE, *PXENFILT_EMULATED_INTERFACE;
 
 /*! \def XENFILT_EMULATED
     \brief Macro at assist in method invocation
@@ -150,6 +183,6 @@ typedef struct _XENFILT_EMULATED_INTERFACE_V2 XENFILT_EMULATED_INTERFACE, *PXENF
 #endif  // _WINDLL
 
 #define XENFILT_EMULATED_INTERFACE_VERSION_MIN  1
-#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  2
+#define XENFILT_EMULATED_INTERFACE_VERSION_MAX  3
 
 #endif  // _XENFILT_EMULATED_INTERFACE_H
diff --git a/include/revision.h b/include/revision.h
index e9e62e6..a63e550 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -51,6 +51,7 @@
     DEFINE_REVISION(0x09000008,  1,  3,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x09000009,  1,  4,  9,  1,  2,  1,  2,  4,  1,  1,  2), \
     DEFINE_REVISION(0x0900000A,  1,  4,  9,  1,  2,  1,  2,  4,  2,  1,  2), \
-    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2)
+    DEFINE_REVISION(0x0900000B,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  2), \
+    DEFINE_REVISION(0x0900000C,  1,  4,  9,  1,  2,  1,  2,  4,  3,  1,  3)
 
 #endif  // _REVISION_H
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index 9065364..4205cc5 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -45,9 +45,10 @@
 #define MAXNAMELEN  128
 
 typedef struct _XENFILT_EMULATED_DEVICE_DATA {
-    CHAR    DeviceID[MAXNAMELEN];
-    CHAR    InstanceID[MAXNAMELEN];
-    CHAR    CompatibleID[MAXNAMELEN];
+    CHAR                                DeviceID[MAXNAMELEN];
+    CHAR                                InstanceID[MAXNAMELEN];
+    CHAR                                CompatibleID[MAXNAMELEN];
+    XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 } XENFILT_EMULATED_DEVICE_DATA, *PXENFILT_EMULATED_DEVICE_DATA;
 
 typedef struct _XENFILT_EMULATED_DISK_DATA {
@@ -222,16 +223,17 @@ fail1:
 
 NTSTATUS
 EmulatedAddObject(
-    _In_ PXENFILT_EMULATED_CONTEXT      Context,
-    _In_ PSTR                           DeviceID,
-    _In_ PSTR                           InstanceID,
-    _In_opt_ PSTR                       CompatibleIDs,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
-    _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT          Context,
+    _In_ PSTR                               DeviceID,
+    _In_ PSTR                               InstanceID,
+    _In_opt_ PSTR                           CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate,
+    _Outptr_ PXENFILT_EMULATED_OBJECT       *EmulatedObject
     )
 {
-    KIRQL                               Irql;
-    NTSTATUS                            status;
+    KIRQL                                   Irql;
+    NTSTATUS                                status;
 
     Trace("====>\n");
 
@@ -267,6 +269,8 @@ EmulatedAddObject(
         goto fail2;
 
     (*EmulatedObject)->Type = Type;
+    if (Type == XENFILT_EMULATED_OBJECT_TYPE_PCI)
+        (*EmulatedObject)->Data.Device.ForceActivate = ForceActivate;
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
     InsertTailList(&Context->List, &(*EmulatedObject)->ListEntry);
@@ -302,36 +306,66 @@ EmulatedRemoveObject(
     __EmulatedFree(EmulatedObject);
 }
 
+static inline BOOLEAN
+EmulatedDeviceMatchesDeviceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       DeviceID
+    )
+{
+    // EmulatedIsDevicePresent: DeviceID == NULL matches the force-activated device
+    if (DeviceID)
+        return _stricmp(DeviceID, Device->DeviceID) == 0;
+    else
+        return Device->ForceActivate == XENBUS_EMULATED_FORCE_ACTIVATED;
+}
+
+static inline BOOLEAN
+EmulatedDeviceMatchesInstanceID(
+    _In_ PXENFILT_EMULATED_DEVICE_DATA  Device,
+    _In_opt_ PSTR                       InstanceID
+    )
+{
+    // EmulatedIsDevicePresent: InstanceID == NULL matches any device instance
+    return InstanceID == NULL || _stricmp(InstanceID, Device->InstanceID) == 0;
+}
+
 static BOOLEAN
 EmulatedIsDevicePresent(
-    _In_ PINTERFACE             Interface,
-    _In_ PSTR                   DeviceID,
-    _In_opt_ PSTR               InstanceID
+    _In_ PINTERFACE                                 Interface,
+    _In_opt_ PSTR                                   DeviceID,
+    _In_opt_ PSTR                                   InstanceID,
+    _Out_opt_ PXENBUS_EMULATED_ACTIVATION_STATUS    IsForceActivated
     )
 {
-    PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
-    KIRQL                       Irql;
-    PLIST_ENTRY                 ListEntry;
+    PXENFILT_EMULATED_CONTEXT                       Context = Interface->Context;
+    KIRQL                                           Irql;
+    PLIST_ENTRY                                     ListEntry;
 
     Trace("====> (%s %s)\n",
-          DeviceID,
+          (DeviceID != NULL) ? DeviceID : "ACTIVE",
           (InstanceID != NULL) ? InstanceID : "ANY");
 
+    if (IsForceActivated)
+        *IsForceActivated = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
     KeAcquireSpinLock(&Context->Lock, &Irql);
 
     ListEntry = Context->List.Flink;
     while (ListEntry != &Context->List) {
-        PXENFILT_EMULATED_OBJECT    EmulatedObject;
+        PXENFILT_EMULATED_OBJECT        EmulatedObject;
+        PXENFILT_EMULATED_DEVICE_DATA   Device;
 
         EmulatedObject = CONTAINING_RECORD(ListEntry,
                                            XENFILT_EMULATED_OBJECT,
                                            ListEntry);
+        Device = &EmulatedObject->Data.Device;
 
         if (EmulatedObject->Type == XENFILT_EMULATED_OBJECT_TYPE_PCI &&
-            _stricmp(DeviceID, EmulatedObject->Data.Device.DeviceID) == 0 &&
-            (InstanceID == NULL ||
-             _stricmp(InstanceID, EmulatedObject->Data.Device.InstanceID) == 0)) {
+            EmulatedDeviceMatchesDeviceID(Device, DeviceID) &&
+            EmulatedDeviceMatchesInstanceID(Device, InstanceID)) {
             Trace("FOUND\n");
+            if (IsForceActivated)
+                *IsForceActivated = Device->ForceActivate;
             break;
         }
 
@@ -345,6 +379,16 @@ EmulatedIsDevicePresent(
     return (ListEntry != &Context->List) ? TRUE : FALSE;
 }
 
+static BOOLEAN
+EmulatedIsDevicePresentVersion1(
+    _In_ PINTERFACE             Interface,
+    _In_ PSTR                   DeviceID,
+    _In_opt_ PSTR               InstanceID
+    )
+{
+    return EmulatedIsDevicePresent(Interface, DeviceID, InstanceID, NULL);
+}
+
 static BOOLEAN
 EmulatedIsDiskPresent(
     _In_ PINTERFACE             Interface,
@@ -454,7 +498,7 @@ static struct _XENFILT_EMULATED_INTERFACE_V1 EmulatedInterfaceVersion1 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V1), 1, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
-    EmulatedIsDevicePresent,
+    EmulatedIsDevicePresentVersion1,
     EmulatedIsDiskPresentVersion1
 };
 
@@ -462,6 +506,14 @@ static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
     EmulatedRelease,
+    EmulatedIsDevicePresentVersion1,
+    EmulatedIsDiskPresent
+};
+
+static struct _XENFILT_EMULATED_INTERFACE_V3 EmulatedInterfaceVersion3 = {
+    { sizeof (struct _XENFILT_EMULATED_INTERFACE_V3), 3, NULL, NULL, NULL },
+    EmulatedAcquire,
+    EmulatedRelease,
     EmulatedIsDevicePresent,
     EmulatedIsDiskPresent
 };
@@ -541,6 +593,23 @@ EmulatedGetInterface(
         status = STATUS_SUCCESS;
         break;
     }
+    case 3: {
+        struct _XENFILT_EMULATED_INTERFACE_V3   *EmulatedInterface;
+
+        EmulatedInterface = (struct _XENFILT_EMULATED_INTERFACE_V3 *)Interface;
+
+        status = STATUS_BUFFER_OVERFLOW;
+        if (Size < sizeof (struct _XENFILT_EMULATED_INTERFACE_V3))
+            break;
+
+        *EmulatedInterface = EmulatedInterfaceVersion3;
+
+        ASSERT3U(Interface->Version, ==, Version);
+        Interface->Context = Context;
+
+        status = STATUS_SUCCESS;
+        break;
+    }
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
index 9b02268..c60020f 100644
--- a/src/xenfilt/emulated.h
+++ b/src/xenfilt/emulated.h
@@ -67,12 +67,13 @@ EmulatedTeardown(
 
 extern NTSTATUS
 EmulatedAddObject(
-    _In_ PXENFILT_EMULATED_CONTEXT      Context,
-    _In_ PSTR                           DeviceID,
-    _In_ PSTR                           InstanceID,
-    _In_opt_ PSTR                       CompatibleIDs,
-    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
-    _Outptr_ PXENFILT_EMULATED_OBJECT   *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT          Context,
+    _In_ PSTR                               DeviceID,
+    _In_ PSTR                               InstanceID,
+    _In_opt_ PSTR                           CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE       Type,
+    _In_ XENBUS_EMULATED_ACTIVATION_STATUS  ForceActivate,
+    _Outptr_ PXENFILT_EMULATED_OBJECT       *EmulatedObject
     );
 
 extern VOID
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 87302bb..ad57c95 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -478,13 +478,15 @@ FdoEnumerate(
     for (Index = 0; Index < Count; Index++) {
 #pragma warning(suppress:6385)  // Reading invalid data from 'PhysicalDeviceObject'
         if (PhysicalDeviceObject[Index] != NULL) {
-            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate =
-                                                XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+            XENBUS_EMULATED_ACTIVATION_STATUS   ForceActivate;
 
             if (Precedence > 0)
                 ForceActivate = Index == ActiveIndex ?
                                 XENBUS_EMULATED_FORCE_ACTIVATED :
                                 XENBUS_EMULATED_FORCE_DEACTIVATED;
+            else
+                ForceActivate = XENBUS_EMULATED_ACTIVATE_NEUTRAL;
+
             (VOID) PdoCreate(Fdo,
                              PhysicalDeviceObject[Index],
                              Fdo->Type,
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 58c9ef0..5327230 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -1701,6 +1701,7 @@ PdoCreate(
                                __PdoGetInstanceID(Pdo),
                                CompatibleIDs,
                                __PdoGetType(Pdo),
+                               ForceActivate,
                                &Pdo->EmulatedObject);
     if (!NT_SUCCESS(status))
         goto fail5;
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:15 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085455.1443756 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUV-0003fv-GA; Mon, 18 Aug 2025 07:41:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085455.1443756; Mon, 18 Aug 2025 07:41:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUV-0003fj-C5; Mon, 18 Aug 2025 07:41:15 +0000
Received: by outflank-mailman (input) for mailman id 1085455;
 Mon, 18 Aug 2025 07:41:14 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NTlX=26=bounce.vates.tech=bounce-md_30504962.68a2d918.v1-fced03e2e7794dec9323490092d2367f@srs-se1.protection.inumbo.net>)
 id 1unuUU-0003FM-2J
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:14 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id b6c1af1a-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:41:13 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Qc2w8NzRKNjFW
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:12 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 fced03e2e7794dec9323490092d2367f; Mon, 18 Aug 2025 07:41:12 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b6c1af1a-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502872; x=1755772872;
	bh=6YP9b44ErCAJSju0Hf9D0GDTO0z8m3ks314QZQl7MJ4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=haXODdJevRbd89aroODFLWem14tjjJYd4zYRWRemXkCvd58nQ8ny+SG0j1Ll2jrz0
	 hhxfauwHhyaG57GzFYqU3B4XCcFmp3dSv0dgnVNsziokps1pXJaPbTG2m7L9emWL57
	 x+LZ67X9Gl9ZTx8J2yHtdXgO9z26SmL8OgYRlaV/8DJReXXVnNuIvZnWuNos8BjvEx
	 NUUFdP4Oqtj1mthPRoiVEgkKKBO/wp2FiQeqfwTLpuzLWb8AyetIcHxSC+NGQOKu6V
	 Du3P4iZAYJbIY7x9rQ+SddcHFxFdHSpiJixfjnT8qOmHLhVJkbAfAnA9lqV1lwOhUX
	 lZz5s9Y9yApAQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502872; x=1755763372; i=ngoc-tu.dinh@vates.tech;
	bh=6YP9b44ErCAJSju0Hf9D0GDTO0z8m3ks314QZQl7MJ4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=ytph/xyn8de+QX58H/cPs6uGsM8AyHMXvww3d+IQoQrxKOj1qmdxkLNj1l2pGcNBJ
	 UJYeW3aJQ8EQG2ouBIS8jK+xwuPb4NV5GYPQIEJYqffvynvjTG+FdQzMJ9RaZiwrTS
	 uTs1k0hpHSrMYMbcM5DIcW6y9m/sRrdhDUYdWOiLM6yOz7B+vnWkn2oPCUUzTHFLCt
	 H3K9DG57RFe7KQ1LY9EoAkEr0S4pJ+1f3kxxzmt4FTw6LOu7AR6uzpF1UqNeV/JSr8
	 xK8hRWsx+CDREMXXV4Zg8YIcuvaZ1nSSfwE5ZCFOU9pe+sU7l3QcOCAvlCR8oVr4sW
	 W+AJIxQ30Tm4Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2009/11]=20Use=20EMULATED=20v3=20to=20force=20activate=20Xenbus=20FDOs?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502871798
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-10-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.fced03e2e7794dec9323490092d2367f?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:12 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Use EmulatedIsDevicePresent in FdoSetActive to determine FDO forced-
activation status and set Fdo->Active + call ConfigSetActive as
appropriate.

Also use EmulatedIsDevicePresent in xenfilt!DriverIsActivePresent.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/fdo.c     | 132 ++++++++++++++++++++++++++++++-------------
 src/xenfilt/driver.c |  22 ++++++--
 2 files changed, 108 insertions(+), 46 deletions(-)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 7ee44a6..4e87727 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -48,6 +48,7 @@
 #include "thread.h"
 #include "high.h"
 #include "mutex.h"
+#include "emulated_interface.h"
 #include "shared_info.h"
 #include "evtchn.h"
 #include "debug.h"
@@ -134,6 +135,8 @@ struct _XENBUS_FDO {
     PCM_PARTIAL_RESOURCE_LIST       RawResourceList;
     PCM_PARTIAL_RESOURCE_LIST       TranslatedResourceList;
 
+    XENFILT_EMULATED_INTERFACE      EmulatedInterface;
+
     BOOLEAN                         Active;
 
     PXENBUS_SUSPEND_CONTEXT         SuspendContext;
@@ -739,14 +742,16 @@ fail1:
 
 static NTSTATUS
 FdoSetActive(
-    _In_ PXENBUS_FDO    Fdo
+    _In_ PXENBUS_FDO                    Fdo
     )
 {
-    PSTR                DeviceID;
-    PSTR                InstanceID;
-    PSTR                ActiveDeviceID;
-    PSTR                LocationInformation;
-    NTSTATUS            status;
+    PSTR                                DeviceID;
+    PSTR                                InstanceID;
+    PSTR                                ActiveDeviceID;
+    PSTR                                LocationInformation;
+    BOOLEAN                             Present;
+    XENBUS_EMULATED_ACTIVATION_STATUS   IsForceActivated;
+    NTSTATUS                            status;
 
     status = FdoQueryId(Fdo,
                         BusQueryDeviceID,
@@ -766,6 +771,34 @@ FdoSetActive(
     if (!NT_SUCCESS(status))
         goto fail3;
 
+    if (Fdo->EmulatedInterface.Interface.Context == NULL)
+        goto fallback;
+
+    status = XENFILT_EMULATED(Acquire, &Fdo->EmulatedInterface);
+    if (!NT_SUCCESS(status))
+        goto fallback;
+
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Fdo->EmulatedInterface,
+                               DeviceID,
+                               NULL,
+                               &IsForceActivated);
+    BUG_ON(!Present);
+
+    XENFILT_EMULATED(Release, &Fdo->EmulatedInterface);
+
+    if (IsForceActivated == XENBUS_EMULATED_ACTIVATE_NEUTRAL)
+        goto fallback;
+
+    Fdo->Active = IsForceActivated == XENBUS_EMULATED_FORCE_ACTIVATED;
+    Info("FDO %s force %sactivated\n", DeviceID, Fdo->Active ? "" : "de");
+
+    if (Fdo->Active)
+        (VOID) ConfigSetActive(DeviceID, InstanceID, LocationInformation);
+
+    goto done;
+
+fallback:
     status = ConfigGetActive("DeviceID", &ActiveDeviceID);
     if (NT_SUCCESS(status)) {
         Fdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ? TRUE : FALSE;
@@ -780,6 +813,7 @@ FdoSetActive(
             Fdo->Active = TRUE;
     }
 
+done:
     ExFreePool(LocationInformation);
     ExFreePool(InstanceID);
     ExFreePool(DeviceID);
@@ -5838,10 +5872,19 @@ FdoCreate(
 
     __FdoSetName(Fdo);
 
-    status = FdoSetActive(Fdo);
+    status = FDO_QUERY_INTERFACE(Fdo,
+                                 XENFILT,
+                                 EMULATED,
+                                 (PINTERFACE)&Fdo->EmulatedInterface,
+                                 sizeof (Fdo->EmulatedInterface),
+                                 TRUE);
     if (!NT_SUCCESS(status))
         goto fail9;
 
+    status = FdoSetActive(Fdo);
+    if (!NT_SUCCESS(status))
+        goto fail10;
+
     if (!__FdoIsActive(Fdo))
         goto done;
 
@@ -5857,47 +5900,47 @@ FdoCreate(
 
     status = DebugInitialize(Fdo, &Fdo->DebugContext);
     if (!NT_SUCCESS(status))
-        goto fail10;
+        goto fail11;
 
     status = SuspendInitialize(Fdo, &Fdo->SuspendContext);
     if (!NT_SUCCESS(status))
-        goto fail11;
+        goto fail12;
 
     status = SharedInfoInitialize(Fdo, &Fdo->SharedInfoContext);
     if (!NT_SUCCESS(status))
-        goto fail12;
+        goto fail13;
 
     status = EvtchnInitialize(Fdo, &Fdo->EvtchnContext);
     if (!NT_SUCCESS(status))
-        goto fail13;
+        goto fail14;
 
     status = RangeSetInitialize(Fdo, &Fdo->RangeSetContext);
     if (!NT_SUCCESS(status))
-        goto fail14;
+        goto fail15;
 
     status = CacheInitialize(Fdo, &Fdo->CacheContext);
     if (!NT_SUCCESS(status))
-        goto fail15;
+        goto fail16;
 
     status = GnttabInitialize(Fdo, &Fdo->GnttabContext);
     if (!NT_SUCCESS(status))
-        goto fail16;
+        goto fail17;
 
     status = StoreInitialize(Fdo, &Fdo->StoreContext);
     if (!NT_SUCCESS(status))
-        goto fail17;
+        goto fail18;
 
     status = ConsoleInitialize(Fdo, &Fdo->ConsoleContext);
     if (!NT_SUCCESS(status))
-        goto fail18;
+        goto fail19;
 
     status = UnplugInitialize(Fdo, &Fdo->UnplugContext);
     if (!NT_SUCCESS(status))
-        goto fail19;
+        goto fail20;
 
     status = FdoBalloonInitialize(Fdo);
     if (!NT_SUCCESS(status))
-        goto fail20;
+        goto fail21;
 
     status = DebugGetInterface(__FdoGetDebugContext(Fdo),
                                XENBUS_DEBUG_INTERFACE_VERSION_MAX,
@@ -5966,68 +6009,68 @@ done:
 
     return STATUS_SUCCESS;
 
-fail20:
-    Error("fail20\n");
+fail21:
+    Error("fail21\n");
 
     UnplugTeardown(Fdo->UnplugContext);
     Fdo->UnplugContext = NULL;
 
-fail19:
-    Error("fail19\n");
+fail20:
+    Error("fail20\n");
 
     ConsoleTeardown(Fdo->ConsoleContext);
     Fdo->ConsoleContext = NULL;
 
-fail18:
-    Error("fail18\n");
+fail19:
+    Error("fail19\n");
 
     StoreTeardown(Fdo->StoreContext);
     Fdo->StoreContext = NULL;
 
-fail17:
-    Error("fail17\n");
+fail18:
+    Error("fail18\n");
 
     GnttabTeardown(Fdo->GnttabContext);
     Fdo->GnttabContext = NULL;
 
-fail16:
-    Error("fail16\n");
+fail17:
+    Error("fail17\n");
 
     CacheTeardown(Fdo->CacheContext);
     Fdo->CacheContext = NULL;
 
-fail15:
-    Error("fail15\n");
+fail16:
+    Error("fail16\n");
 
     RangeSetTeardown(Fdo->RangeSetContext);
     Fdo->RangeSetContext = NULL;
 
-fail14:
-    Error("fail14\n");
+fail15:
+    Error("fail15\n");
 
     EvtchnTeardown(Fdo->EvtchnContext);
     Fdo->EvtchnContext = NULL;
 
-fail13:
-    Error("fail13\n");
+fail14:
+    Error("fail14\n");
 
     SharedInfoTeardown(Fdo->SharedInfoContext);
     Fdo->SharedInfoContext = NULL;
 
-fail12:
-    Error("fail12\n");
+fail13:
+    Error("fail13\n");
 
     SuspendTeardown(Fdo->SuspendContext);
     Fdo->SuspendContext = NULL;
 
-fail11:
-    Error("fail11\n");
+fail12:
+    Error("fail12\n");
 
     DebugTeardown(Fdo->DebugContext);
     Fdo->DebugContext = NULL;
 
-fail10:
-    Error("fail10\n");
+fail11:
+    Error("fail11\n");
 
     Fdo->UseMemoryHole = 0;
 
@@ -6037,6 +6080,12 @@ fail10:
     //
     Fdo->Active = FALSE;
 
+fail10:
+    Error("fail10\n");
+
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
 fail9:
     Error("fail9\n");
 
@@ -6175,6 +6224,9 @@ FdoDestroy(
         FdoClearActive(Fdo);
     }
 
+    RtlZeroMemory(&Fdo->EmulatedInterface,
+                  sizeof (Fdo->EmulatedInterface));
+
     RtlZeroMemory(Fdo->VendorName, MAXNAMELEN);
 
     FdoReleaseLowerBusInterface(Fdo);
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index 67287d7..2535ce4 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -355,15 +355,22 @@ DriverIsActivePresent(
     VOID
     )
 {
-    PSTR        ActiveDeviceID;
-    BOOLEAN     Present;
-    NTSTATUS    status;
+    PSTR                                ActiveDeviceID;
+    BOOLEAN                             Present;
+    XENBUS_EMULATED_ACTIVATION_STATUS   IsForceActivated;
+    NTSTATUS                            status;
 
     status = XENFILT_EMULATED(Acquire, &Driver.EmulatedInterface);
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    Present = FALSE;
+    Present = XENFILT_EMULATED(IsDevicePresent,
+                               &Driver.EmulatedInterface,
+                               NULL,
+                               NULL,
+                               &IsForceActivated);
+    if (NT_SUCCESS(status) && Present)
+        goto done;
 
     status = __DriverGetActive("DeviceID",
                                &ActiveDeviceID);
@@ -373,14 +380,17 @@ DriverIsActivePresent(
     Present = XENFILT_EMULATED(IsDevicePresent,
                                &Driver.EmulatedInterface,
                                ActiveDeviceID,
-                               NULL);
+                               NULL,
+                               &IsForceActivated);
 
     ExFreePool(ActiveDeviceID);
 
 done:
     XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
 
-    Info("ACTIVE DEVICE %sPRESENT\n", (!Present) ? "NOT " : "");
+    Info("ACTIVE DEVICE %sPRESENT%s\n",
+         (!Present) ? "NOT " : "",
+         IsForceActivated == XENBUS_EMULATED_FORCE_ACTIVATED ? " (FORCED)" : "");
 
     return Present;
 
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:17 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085456.1443761 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUX-0003kL-HD; Mon, 18 Aug 2025 07:41:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085456.1443761; Mon, 18 Aug 2025 07:41:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUX-0003kE-ED; Mon, 18 Aug 2025 07:41:17 +0000
Received: by outflank-mailman (input) for mailman id 1085456;
 Mon, 18 Aug 2025 07:41:16 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8JxN=26=bounce.vates.tech=bounce-md_30504962.68a2d919.v1-115c4dc24b154787a9ed162bd103c4a5@srs-se1.protection.inumbo.net>)
 id 1unuUW-0003E3-4t
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:16 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b775b5b8-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:14 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Qd4CjYzRKLf53
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 115c4dc24b154787a9ed162bd103c4a5; Mon, 18 Aug 2025 07:41:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b775b5b8-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502873; x=1755772873;
	bh=WVzugGNvv9ryvvN8x1rZuc6d379iIaXq02YGy7brtL4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=KGV0HW1XPwMWd6k2Q095Iy87T2L0eVSVvka3yEiGxBGMne4i6WkvncI85IQuWogRl
	 US3EEOWdVI53xjaaP1PbtwRP+1AvPqFnEmAXyCUe8r9HRBzuXTZxNe3hQZO3j5+Ete
	 C2Dt4Rs2kByX/+cmLXR/OluMj5SLwH3zN2+qXjONQlJGWt5Wx/5I0u+A8H7fnMvlrj
	 0OkOfK4dayMQqDwoMfgSzZIX88QJ7lvD9qi16GZszQbNFeBw9OJVnVOxIqCMfxE1Cb
	 oel3+vLCgIZ3QdyuMQwasB6BQcvbXMFjJgk6Ne15MhfJCS6Ov0EmLPky5Pjt9ZH8dC
	 Col8vKBkjmEFg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502873; x=1755763373; i=ngoc-tu.dinh@vates.tech;
	bh=WVzugGNvv9ryvvN8x1rZuc6d379iIaXq02YGy7brtL4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=AM2dy1HgUxvCpWeY1nFmuHsQBV7ze8TM1vIJJin7Fr+wLdU1tZ1xFCvX/Ab7fb6Py
	 SXsOvf7Yo/tNyeh+tyKL0GsQLtpCkvAcjNw2twkculuZNZ4HhPlWD/FW5xtFh1MW4K
	 0LD3n4HzahOaKYNK/uykskOCu6cKqnaVOyD6Y88lYSBXyz6c5DcSGdi/R+bs4sPyng
	 67H4op+QXtue5SFUgR878T9zU3/uSQ55SIiD/N2VH7oq57q5tw04ZFyKgWoHcpikh9
	 mDJbxGGZoVl1uo8oJyF/h2/qXO7Rns8JwK5UnytnZ89DFIIKLYf3nX6RemVDCVJ+UH
	 jT4U3AJM65A0A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2010/11]=20Enable=20Xenbus=20precedence?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502872914
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-11-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.115c4dc24b154787a9ed162bd103c4a5?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Define precedence values based on each device's numeric device ID.

This ensures that vendor devices always get activated instead of the
generic ones.

Condition the precedence on the FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenbus.inf       | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index be12087..69beacd 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -71,6 +71,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_ACTIVATE' = $Env:FORCE_ACTIVATE;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenbus.inf b/src/xenbus.inf
index 7956af7..58cfff1 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -119,6 +119,9 @@ AddReg = XenFilt_Parameters
 HKR,"Parameters",,0x00000010
 HKR,"Parameters","*PNP0A03",0x00000000,"PCI"
 HKR,"Parameters","Internal_IDE_Channel",0x00000000,"IDE"
+HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_ACTIVATE@
+HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
+HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
 [Monitor_Service]
 DisplayName=%MonitorName%
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:18 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085457.1443764 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUY-0003mT-Id; Mon, 18 Aug 2025 07:41:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085457.1443764; Mon, 18 Aug 2025 07:41:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUY-0003mI-Fp; Mon, 18 Aug 2025 07:41:18 +0000
Received: by outflank-mailman (input) for mailman id 1085457;
 Mon, 18 Aug 2025 07:41:17 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=jGRW=26=bounce.vates.tech=bounce-md_30504962.68a2d91a.v1-6df6ed44d4ab4d5694cb21ad57b37c52@srs-se1.protection.inumbo.net>)
 id 1unuUX-0003E3-4S
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:17 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b80b2d68-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Qf44RFzRKNjFY
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:14 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 6df6ed44d4ab4d5694cb21ad57b37c52; Mon, 18 Aug 2025 07:41:14 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b80b2d68-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502874; x=1755772874;
	bh=NwIljUOQ2irpT5Twljz7HgbkdtFbmAbD/Remh+dRYd0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=HKEmY4o2Smh4x1eaNcIQTgvFMYLbJPYPJy4t3LbwfkGSKrYcSkccYusHBWDQ3bmAX
	 PjIt92JONtjK9dV7zxvt1Ix8Uv9JXQ9FGky2fydAJG01H6e2OpyJZcDyQEvKUXXlcP
	 R9Nbx8RhcTaZm5oyIsGr/ekSHptUxCj1rcDOjnkzik2QbeYUCaD8YFNopS/CC8gWly
	 eqOAYZwWwJAAWpdgggIL5hE7SXKeFhQoSCN9DJM7WewHVv520r+YeS4rAK6IxqmhND
	 PRefMREoIp0DO+g/wVPSX0b9Mfr8Fdum5MFtxtnx9n1nsKpMuSU4LvdDyb4o2sqSTA
	 H+62Df/ofnVGg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502874; x=1755763374; i=ngoc-tu.dinh@vates.tech;
	bh=NwIljUOQ2irpT5Twljz7HgbkdtFbmAbD/Remh+dRYd0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=tSzJx64tdONm1c1VTu7liktQKzWN5AoKIJ9iB2FZbAiWwvLA9BIGllXyn9mDcPJ+w
	 K9C4DXK+THUcFLkeaJp+An1srIFvPLs5rYKOZ4xbjyEV6KHdpUv2JwnUUsBKi5xaKz
	 3aOe21IL9tD6kAmoX5GeX8OJKh0EN3BjFiDvzOWo4r485Xe5nXMFKVRgToy3aI/xDR
	 toqKWfAYdJ2X93E6zWP5Q2CBA8qlt7OuITZhqUDzj4sX+xRE2q8PhH6uQOacu1/2GB
	 ZeJIi+ZHKdpOYbbraKF5tUTod843gjNHeGky1+fjIuz/lNNFWFzqPMI4dSWSe5pDUq
	 +3EISqmlM2WCw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENBUS=20PATCH=20v6=2011/11]=20Install=20Xenfilt=20with=20INF=20AddReg?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502873959
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-12-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.6df6ed44d4ab4d5694cb21ad57b37c52?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:14 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

With forced-activation Xenbus, there's little reason not to install
Xenfilt.

Add a new INF section to this effect, also conditioned on the
FORCE_ACTIVATE environment variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus.inf | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xenbus.inf b/src/xenbus.inf
index 58cfff1..10774b0 100644
--- a/src/xenbus.inf
+++ b/src/xenbus.inf
@@ -114,6 +114,8 @@ ErrorControl=%SERVICE_ERROR_NORMAL%
 ServiceBinary=%12%\xenfilt.sys 
 LoadOrderGroup="Boot Bus Extender"
 AddReg = XenFilt_Parameters
+; Attention: XenFilt_Filters should only be used with forced-activation Xenbus
+AddReg = XenFilt_Filters  ; @FORCE_ACTIVATE@
 
 [XenFilt_Parameters]
 HKR,"Parameters",,0x00000010
@@ -123,6 +125,10 @@ HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_0001",0x00010001,0x0001  ; @FORCE_
 HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_0002",0x00010001,0x0002  ; @FORCE_ACTIVATE@
 HKR,"Parameters\Precedence","PCI\VEN_5853&DEV_@VENDOR_DEVICE_ID@",0x00010001,0x@VENDOR_DEVICE_ID@  ; @FORCE_ACTIVATE@
 
+[XenFilt_Filters]  ; @FORCE_ACTIVATE@
+HKLM,%SystemClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+HKLM,%HDCClassKey%,"UpperFilters",0x00010008,"XENFILT"  ; @FORCE_ACTIVATE@
+
 [Monitor_Service]
 DisplayName=%MonitorName%
 Description=%MonitorDesc%
@@ -156,6 +162,8 @@ MonitorName="@PRODUCT_NAME@ PV Driver Monitor"
 MonitorDesc="Provides support for @PRODUCT_NAME@ PV drivers"
 RequestKey="SYSTEM\CurrentControlSet\Services\xenbus_monitor\Request"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+SystemClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e97d-e325-11ce-bfc1-08002be10318}"
+HDCClassKey="SYSTEM\CurrentControlSet\Control\Class\{4d36e96a-e325-11ce-bfc1-08002be10318}"
 DialogTitle="@PRODUCT_NAME@"
 DialogText="needs to restart the system to complete installation."
 DialogQuestion="Press 'Yes' to restart the system now or 'No' if you plan to restart the system later."
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:18 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085458.1443769 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUY-0003mp-N7; Mon, 18 Aug 2025 07:41:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085458.1443769; Mon, 18 Aug 2025 07:41:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUY-0003mY-HG; Mon, 18 Aug 2025 07:41:18 +0000
Received: by outflank-mailman (input) for mailman id 1085458;
 Mon, 18 Aug 2025 07:41:17 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xPIb=26=bounce.vates.tech=bounce-md_30504962.68a2d91b.v1-f99d61f7b5a04d37bd8c3bc74a68dbc6@srs-se1.protection.inumbo.net>)
 id 1unuUX-0003E3-IC
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:17 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id b8b0c9c5-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Qg5RFTzK5vpXC
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:15 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 f99d61f7b5a04d37bd8c3bc74a68dbc6; Mon, 18 Aug 2025 07:41:15 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b8b0c9c5-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502875; x=1755772875;
	bh=yezSdmrrQTjKPu9BNqcoVf9LgT+mxmBHkelNFwUSkak=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=koj2fm5Ozy9gaXhBLLFT0sitJ3bVH35kT4c/q2m1tILRjrwBHe7GpyPtF2zEnGW5P
	 4np9iAU3SocDaHgp8qwykPmZ08jSXlaKacEynFJr0C6FETngr9jgUiv6UB/RR2JIs1
	 MibDi/HlraNG8soAQKr6j5ROYNUGCaIZowz+8fnt6vJiS/O3VM6FySqgyulTVH3jx0
	 Kt5iySJUI2J6D20L8pGgXDBaYllH6BhVO4adBuopHi+nelWhq5y7YpbdMTM855NcO6
	 dhwLZxu7wUr0w5UeXH8IlkHF2du7jgEmRD0uEpMqhGRqtZiHCW1FtachFHKt3IOBds
	 i0qVruSZyFHvw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502875; x=1755763375; i=ngoc-tu.dinh@vates.tech;
	bh=yezSdmrrQTjKPu9BNqcoVf9LgT+mxmBHkelNFwUSkak=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=BtNoL6tr7OAx2FcEPx9rdjUd9h1LF25D6F3LluDCV0OgCLsOQW9a8YU3II2Km/per
	 uE7iZzSII6I1Y4YPUjOu1ULju+8ja5Na6/K+gG/t2/3bWmOcotE2raJ/XcsmvhjT7b
	 i8IsPQbQFpkwJI367VJGu0tDOCIp/gVQL0kV3wA2h1Xh9dLXI6xV2GK4McZSSpsXu5
	 VAUSa7FZTNLkRKDMk9ebMBxRbj53NztlF2NJCmdfcmUXS8pEzA7bfd/EkAGpV8ttCg
	 +WiXaipM/ciVJs4VqWCbHRQLw0P2zj+RrOygbg0HvQA+WUH47lIm/PSq7SKu24axBp
	 lNu3smNzyx/Lg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENCONS=20PATCH=20v6=2012/12]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502875150
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-13-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f99d61f7b5a04d37bd8c3bc74a68dbc6?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:15 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xencons/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c
index 8726f7d..388eabb 100644
--- a/src/xencons/pdo.c
+++ b/src/xencons/pdo.c
@@ -1087,8 +1087,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENCONS\\VEN_%hs&DEV_CONSOLE",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENCONS\\VEN_" VENDOR_PREFIX_STR "&DEV_CONSOLE");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:20 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085460.1443772 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUa-0003rH-LA; Mon, 18 Aug 2025 07:41:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085460.1443772; Mon, 18 Aug 2025 07:41:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUa-0003r6-IX; Mon, 18 Aug 2025 07:41:20 +0000
Received: by outflank-mailman (input) for mailman id 1085460;
 Mon, 18 Aug 2025 07:41:19 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=G9Yd=26=bounce.vates.tech=bounce-md_30504962.68a2d91d.v1-e6933a97e6c14248b614cfff802dcd58@srs-se1.protection.inumbo.net>)
 id 1unuUZ-0003E3-RM
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:19 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id ba0bec63-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:18 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Qk0H4tzK5vlNs
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:18 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 e6933a97e6c14248b614cfff802dcd58; Mon, 18 Aug 2025 07:41:18 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ba0bec63-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502878; x=1755772878;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=VGia01qauWeCmxo4E2W54bgxZ606nflmvSGOX1k5rKBYL4B8E2j5P7VhMsSpgstgt
	 K6iANchZ9mfVKMEJJYKD/lzbGkPNrImyCdaWq8wEzar4iBhHklc6+84en2eWUke72p
	 osPqCxE3ybaq6GvArYYrZbWf6lZUM/h2vDi3GX9BAdkhzDArVpHkin2XifMc9YP3mh
	 slQ5/SYFj0bo5PiNTzzbSvSbEMLn0+AO66WijHH2jPy2Cerywv2bsIUY4Zggv/MLRM
	 s0Z0RiCvzOqIKB0Dq7vTb4zXoejLp7SGnvdM/1Ip31UJO0RgA0iF6Fgf4CuUO2tkbl
	 pFqPvLw2hHPkQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502878; x=1755763378; i=ngoc-tu.dinh@vates.tech;
	bh=R6xpPzUlifi4cdIs0/+ZHjll/k+6CYo0HWw1WC2wsqc=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=d5WZ5yIEvKdWLA+UAxbKcNaE+WqRk0KGAUIGH4/Ow5cazANTsy3NYlK8k/ZepZjNf
	 6Nr6wGScrL/72K2O88nMjm1t1yLLJWWn+rNQAe/Y5AZgVGZ4sATHEvL6se7tS49e3B
	 kAcyS2AJ2KEcp537z++B6gdltjmiWlbnEK+PmqkjrwEhLs5Q4Wg6ZLLpn7C3vMexyt
	 REwYVFXxCUterUNk6dD2vo3LwWdLoJGJYBNM17CPLwmDowTuy/kI+sHLyDvhbxnXcC
	 Qsn0tcaNzPnfvn1qtZ9CTNiuI0khvmumwle079sr1ihhRoU/cYmX6LMVQ5d6tYnOl9
	 QAf32n2UDDmkA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENNET=20PATCH=20v6=2013/13]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502877355
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-14-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.e6933a97e6c14248b614cfff802dcd58?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:18 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xennet.inf       | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 6991440..a0faed5 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -68,6 +68,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xennet.inf b/src/xennet.inf
index 4923388..b684219 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -179,11 +179,14 @@ StartType=%SERVICE_DEMAND_START%
 ErrorControl=%SERVICE_ERROR_NORMAL% 
 ServiceBinary=%12%\xennet.sys 
 LoadOrderGroup="NDIS"
-AddReg = XenNet_BootFlags
+AddReg = XenNet_BootFlags,XenNet_Unplug
 
 [XenNet_BootFlags]
 HKR,,"BootFlags",0x00010003,0x81
 
+[XenNet_Unplug]
+HKLM,%ForceUnplugKey%,"NICS",0x00010001,1  ; @FORCE_UNPLUG@
+
 [XenNet_EventLog]
 AddReg=XenNet_EventLog_AddReg
 
@@ -196,6 +199,7 @@ HKR,,TypesSupported,0x00010001,7
 Vendor="@VENDOR_NAME@"
 DiskDesc="@PRODUCT_NAME@ PV Network Device Package" 
 XenNetName="@PRODUCT_NAME@ PV Network Device"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 IPChecksumOffloadIPv4="IPv4 Checksum Offload"
 TCPChecksumOffloadIPv4="TCP Checksum Offload (IPv4)"
 UDPChecksumOffloadIPv4="UDP Checksum Offload (IPv4)"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:21 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085461.1443778 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUb-0003tV-Nh; Mon, 18 Aug 2025 07:41:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085461.1443778; Mon, 18 Aug 2025 07:41:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUb-0003tJ-Jz; Mon, 18 Aug 2025 07:41:21 +0000
Received: by outflank-mailman (input) for mailman id 1085461;
 Mon, 18 Aug 2025 07:41:20 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=YqQ+=26=bounce.vates.tech=bounce-md_30504962.68a2d91f.v1-980078128a6d41c89037dc52268f1aec@srs-se1.protection.inumbo.net>)
 id 1unuUa-0003FM-US
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:20 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id bae72073-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:41:20 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Ql2bkgzK5vgLY
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:19 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 980078128a6d41c89037dc52268f1aec; Mon, 18 Aug 2025 07:41:19 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bae72073-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502879; x=1755772879;
	bh=tWGE+N0r35IoummVKSHmbGmYl8j7j5I9PcmlJpa86x0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=AQmoak6Astwdi6kqT1qpVXIyXFxoVuVWJ25khlCXrI9M2fpeclelSNmsj+wOSsoC9
	 E/30uh7tLPnvw+rS98REqx4TCLLxVGBjj2Ll4EvQtFqRJiWp4i5L5wu5H8blWlm6MW
	 7RIsu0AN3+W4d7ccmv6ulzJzc9oC5zfAOpsRJG4T9goAZIjSVq3DjSc96J6vZkJQSx
	 KEN3SmAVGjtbZXsMmm1MUkVBzXwwBcDzF+lEJ1t5mlwDq/3mB1C1cTe4ZfYJ44lfCQ
	 fFl+7dyCuU596TiIImqRFcHfAUIDMqf7O+Rq1qtbAwVQsmaesh/o4HociYmpfWNcFX
	 ImqRne9fkDKrA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502879; x=1755763379; i=ngoc-tu.dinh@vates.tech;
	bh=tWGE+N0r35IoummVKSHmbGmYl8j7j5I9PcmlJpa86x0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=tWdJ5d4fpQVhmMi8/f3BgTkmaV1G1a06bxq/oNM7K94qi8mFr2AweOUe3NgXVZ89V
	 RokeVjmU78TDX1D7gX16hbNxGEkoD23Tdtz3ISOrsrRPy1SCUzEoRksKgpasnVeIAV
	 8IYd8U74RQxwaqqgBu5dhdgI5ZeA42cP3hvarkP/FujtCKNaHVdCoJtZ083M50cpOP
	 nU39Jguz60TeSSRPb0ufV/Lf1D0P7s0sYFl/EQ5GUXszw7FyhQeVecYN0+Kee2OoaK
	 1srV2ubFPmPoiJMolMZWkrCsrxJ2u6g2aR1d7sxkT+YOzEyMsFSSV/m9C13v7OQRxq
	 +d1cZ6zg+EIug==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v6=2014/15]=20Opt=20into=20forced=20unplug?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502878749
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-15-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.980078128a6d41c89037dc52268f1aec?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:19 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Condition the opt-in to the FORCE_UNPLUG build variable.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 scripts/genfiles.ps1 | 2 ++
 src/xenvbd.inf       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 85754c0..a7d13ae 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -70,6 +70,8 @@ $Replacements = [ordered]@{
 	'MICRO_VERSION' = $Env:MICRO_VERSION;
 	'BUILD_NUMBER' = $Env:BUILD_NUMBER;
 
+	'FORCE_UNPLUG' = $Env:FORCE_UNPLUG;
+
 	# generated values
 	'GIT_REVISION' = $GitRevision;
 
diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index dfde613..0de71d1 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -106,6 +106,7 @@ HKR,"Parameters","multi-queue-max-queues",0x00010001,0x00000002
 
 [XenVbd_Unplug]
 HKLM,%UnplugKey%,"DISKS",0x00010001,0
+HKLM,%ForceUnplugKey%,"DISKS",0x00010001,1  ; @FORCE_UNPLUG@
 
 [XenVbd_Extras]
 HKLM,%PnpKey%,"DisableCDDB",0x00010001,0
@@ -120,6 +121,7 @@ DiskDesc = "@PRODUCT_NAME@ PV Storage Host Adapter Package"
 XenVbdName= "@PRODUCT_NAME@ PV Storage Host Adapter"
 XenDiskName= "@PRODUCT_NAME@ PV Storage Filter"
 UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+ForceUnplugKey="SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
 PnpKey="SYSTEM\CurrentControlSet\Control\Pnp"
 PartMgrKey="SYSTEM\CurrentControlSet\Services\PartMgr\Parameters"
 DiskKey="SYSTEM\CurrentControlSet\Services\Disk"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:23 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085462.1443780 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUd-0003we-Oc; Mon, 18 Aug 2025 07:41:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085462.1443780; Mon, 18 Aug 2025 07:41:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUd-0003wV-LN; Mon, 18 Aug 2025 07:41:23 +0000
Received: by outflank-mailman (input) for mailman id 1085462;
 Mon, 18 Aug 2025 07:41:22 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=sP6m=26=bounce.vates.tech=bounce-md_30504962.68a2d920.v1-d493a97d96504ed28303582a99b794cc@srs-se1.protection.inumbo.net>)
 id 1unuUc-0003FM-F5
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:22 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id bbd124bf-7c06-11f0-a329-13f23c93f187;
 Mon, 18 Aug 2025 09:41:21 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Qm6PgjzRKLdnL
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:20 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d493a97d96504ed28303582a99b794cc; Mon, 18 Aug 2025 07:41:20 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bbd124bf-7c06-11f0-a329-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502880; x=1755772880;
	bh=ftFOkFnSwQ2AQKjm0eV83bSSIpOPMdMAA4g9043RWbo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=i6D+a5NyVo/oCYBRSJT7mFcuzydGboH9MEyvhVy6lIFulHTKWD5ta+uoMJKksOkGb
	 E1FdulZmfDx6GIXbDnNwmEbX9uRr/BYggKaEuLnAlwrZRTz7i8FFcwkNAUE02Bwf2h
	 h1DAiSEtPUP3m/SgLTtYbo7yZA2YPJDZRP/fCv/mMjv4zhDVjZKWXfnWCeiJ3zOQDf
	 JpWMNfxJ5RzWZVRcQDh6VxlJd6qKMMQKcivz7ga8JkHnt8DC3lVPOeQvQxzW36H3YG
	 MVNgLBzBsuI8LhFJ98EMlriQT8qGhSkbn1xuSs5mQuyhf6Ow5+JxEldublXMLz7X4C
	 FlIOYqRWmCBSQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502880; x=1755763380; i=ngoc-tu.dinh@vates.tech;
	bh=ftFOkFnSwQ2AQKjm0eV83bSSIpOPMdMAA4g9043RWbo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=JzlygV/NwMRxNWBe8ha4Mv5FIvIuRN08nl725ywDfrCtQTiIuBbldWwo8iLSitoSQ
	 YblRh2soiBZEq9zcRoqTwp17sMM2U828/kNWcDUTwbXbSWdjhHlqM0IL1asnCBL+U6
	 q/PhrmBBfQqKjJRn06HBGYiGa9W4NcIPOoMpLW+VR6lTItVJ2mPcN5qeTd5hb0WQpS
	 xIqUsZHpRcGjTbxlImWi9Af8FgIoZrsqruua4n38aD9hQ+ILSymwqq5C6F+8G4aGV0
	 bFhOhj5U+PYqUUnxJwRFjM00MrtGqtODbuBwWAELKft6YJ+vThUAohvQOVoRjRtJoS
	 7Aa/glZF8AN8A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVBD=20PATCH=20v6=2015/15]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502880117
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-16-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d493a97d96504ed28303582a99b794cc?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:20 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched without causing boot installation issues.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvbd.inf | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xenvbd.inf b/src/xenvbd.inf
index 0de71d1..19e92c9 100644
--- a/src/xenvbd.inf
+++ b/src/xenvbd.inf
@@ -54,12 +54,15 @@ xendisk.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
+%XenVbdName%=XenVbd_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000B
 
 [XenVbd_Inst] 
 CopyFiles=XenVbd_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenVbd_Copyfiles]
 xenvbd.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:41:25 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:41:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085464.1443785 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUf-00040w-Qz; Mon, 18 Aug 2025 07:41:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085464.1443785; Mon, 18 Aug 2025 07:41:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unuUf-00040o-OR; Mon, 18 Aug 2025 07:41:25 +0000
Received: by outflank-mailman (input) for mailman id 1085464;
 Mon, 18 Aug 2025 07:41:24 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xMw7=26=bounce.vates.tech=bounce-md_30504962.68a2d922.v1-4ae3ed269ff24af995c002872c50c1d5@srs-se1.protection.inumbo.net>)
 id 1unuUe-0003E3-MY
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:24 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id bc8a5b76-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:23 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c54Qp0qJZzRKLfvp
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:22 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 4ae3ed269ff24af995c002872c50c1d5; Mon, 18 Aug 2025 07:41:22 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bc8a5b76-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502882; x=1755772882;
	bh=yM2qmQLG4ZCX4mwQa0ABsCteAJ/JVFbqWEyHJ1jI+V0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=ZpuLtZW09TasrLZX1yJ3DwhdgjspiHey1JOJ8MHZxjxf94PEc+Ts4yF4t/qWPS0Gk
	 ZBjQOlpSlIFQ3O63CHTiQ379GzSPuqylVivawUMP9EKV3wQXM9AFQP5trYP6ZmC8Yz
	 0tT3X7uItslFLbk8ahbAz47N13YjKpnLqvwyK904I4zF0Uj5Y7QQjVeikQTbilwsXb
	 ZcflNIo0mM4lO3+aDLgK7/SIl8ZYUo1J1gzyN6JH9ztjXeOV1qnXADUDSdLfH/Dn1s
	 NmCKEQbbdslt8xEUhVj+pWa9/q0E0P+UGSU/uaVsu+713tVufHjdF0+Qi+mRthRZxI
	 xODd+j3JRosBA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502882; x=1755763382; i=ngoc-tu.dinh@vates.tech;
	bh=yM2qmQLG4ZCX4mwQa0ABsCteAJ/JVFbqWEyHJ1jI+V0=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=UCD8LedgzKGaGSWmeP4OcI7jTxW/oQP7ayLnWq2hyO+kpaRxf0d0oH/as/rVJcdEX
	 XelnFLqWDz2Rr8OjceGvchfS9Jf4qEe3Hb6myu/GDB0DJHTS8aJ6CdaXeNkrsAgqlF
	 ldh89Q0BiJkIHFys35pdMpAhZjeP23NTaZjoR6LljK+b7Sqo5OkhWVyjT+Abb0g4OY
	 /q8PS6OuRtQUG0/AyLSrMOcCQCzzN+wTZ/vx1rsep8ZUPzZUeCK+5Y/D6/BxeWs0iM
	 eCyww/0jvS804EiiljsK9b5ZRZx0lNiGHVPIzpnKasMQ5aJyOXA8ddPyTAThzIGAhK
	 IEq74wJGm2O8Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH=20v6=2016/17]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502881499
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-17-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.4ae3ed269ff24af995c002872c50c1d5?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:22 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 28121ac..405506e 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -2117,8 +2117,7 @@ PdoQueryId(
         Type = REG_SZ;
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENVIF\\VEN_%hs&DEV_NET",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENVIF\\VEN_" VENDOR_PREFIX_STR "&DEV_NET");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:47:05 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:47:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085496.1443810 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unua8-0005G8-Nz; Mon, 18 Aug 2025 07:47:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085496.1443810; Mon, 18 Aug 2025 07:47:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unua8-0005G1-KW; Mon, 18 Aug 2025 07:47:04 +0000
Received: by outflank-mailman (input) for mailman id 1085496;
 Mon, 18 Aug 2025 07:47:04 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9xq6=26=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1unua8-0005Fu-1i
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:47:04 +0000
Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com
 [2607:f8b0:4864:20::529])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 84873cbe-7c07-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:46:58 +0200 (CEST)
Received: by mail-pg1-x529.google.com with SMTP id
 41be03b00d2f7-b471756592cso2570890a12.3
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 00:46:58 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 84873cbe-7c07-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755503217; x=1756108017; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=onl5PCTyKJT+Nj/t54H9D2hyT3Zer4e7YlaK6p0hNuA=;
        b=G+L8tvFremj8Sq7AMbCTI+/x1ulP6STelRXGZgM153rSQ3Q7x79Qhmm2ml9mNbs+AH
         bkhyPYtm3DMtRhtKYxjO5d/bcQIQr4IThPrv9WTK44FaE+Et/ezNeefmOZ4ImvbTf5Cl
         o1sObhsrRvb7B3RgmE250I0TcFUlNht5t3m2M=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755503217; x=1756108017;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=onl5PCTyKJT+Nj/t54H9D2hyT3Zer4e7YlaK6p0hNuA=;
        b=ef2HJXVazALAE7fg6wY/0btbSKlpMYoClLxq7i5kxzfmOSr9DgpLvTyro33YfBI+gA
         x3x14EcmrWpFh+X1pCKC4ZO47M/2gAavwM7swTyBSnivgupSCUGwZVLSryNH67Jedc6i
         v1szMWz3nVl0hdaJZS0gcqCrebXYhrfxYNGMx9DKFCBWNLX/+0yj/9a2dAzhxNakSq4V
         JwuH6sQ0dx4yJQxPR9yj+0l0HznIikynpaZCYXxxn44td+WI8+pn4tBktgm3pPavAq3V
         fb1s1Pn/Q2FiBqlr0GyBRASwsHvM+sOfl6Urudx/msKmYMr2HgpxxqqibqS+ssLKcsHW
         K/8A==
X-Gm-Message-State: AOJu0Yw1r+iyrsTJa1vSj87eSoIdF7ex5IkbzM6l5VnCBaLLC7bQTy2T
	uQCutzjgmoTwolcEIALHZ8lYuptxkmaIwh0F03/nfbxX/g2/n2XgGQOkondky3/Ri4i1BSHiKSx
	V4G8DNLW8ObbJTJ0QysWUrVyabGce/cTz4Z26UepHjaeFlLBfSoU=
X-Gm-Gg: ASbGncvdXTly1OVbPTpHwE3Q/avIiF3nYSDsDjWnBA0J7PF1oAK2Nuy4gyrobi2X1LC
	7GoV1lErZSlZJmRRX6TKQHseiGVVE5POqYKLg9xvkg6v8ajQzY3b+BfOzmua4+H8iBqB30Ns7GZ
	NjH2exW+8D6XFjwcZK2doV+CVXrVhtTLAFqMmjNuuAXOjF/K1999FEHTTeI1Rf1B/FJ8AvW2hU8
	Ce7bj8=
X-Google-Smtp-Source: AGHT+IG3gu3qepM5r2ziU376kMo1ZA5rLQCA2DXhK5qV8HdDdTZroTDWVqjx4e8UlbTgwW9ZkNNGyuhItKKfRUhKrgw=
X-Received: by 2002:a17:902:f78a:b0:240:8fef:a3bd with SMTP id
 d9443c01a7336-2446d7514e9mr156734505ad.25.1755503216419; Mon, 18 Aug 2025
 00:46:56 -0700 (PDT)
MIME-Version: 1.0
References: <20250818055502.878-1-ngoc-tu.dinh@vates.tech> <20250818055502.878-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818055502.878-2-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Mon, 18 Aug 2025 08:46:44 +0100
X-Gm-Features: Ac12FXyUp2Yg0YGJcBJUikukYZK60M8QdiFo3Q8D5d5sNk9hMi73jzQlHK_FN_E
Message-ID: <CAC_UY8948gwe95esmi--fXR4OnzBqGXbMqGQQhPSPBdZbf8qOA@mail.gmail.com>
Subject: Re: [XENBUS PATCH v2 2/2] Be more tolerant of RealTimeIsUniversal values
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="0000000000009e0c76063c9ef159"

--0000000000009e0c76063c9ef159
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Mon, Aug 18, 2025 at 6:55=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> Tolerate RealTimeIsUniversal having the REG_QWORD value type.
>
> In addition, don't fail SystemInitialize when SystemGetTimeInformation
> fails to read RealTimeIsUniversal as critical boot drivers (e.g. xenvbd)
> may fail to load otherwise.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
> v2: Log error code from SystemGetTimeInformation
> ---
>  src/xen/system.c | 41 +++++++++++++++++++++--------------------
>  1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/src/xen/system.c b/src/xen/system.c
> index 48f9af0..991ce4b 100644
> --- a/src/xen/system.c
> +++ b/src/xen/system.c
> @@ -1183,7 +1183,8 @@ SystemGetTimeInformation(
>      PSYSTEM_CONTEXT Context =3D &SystemContext;
>      UNICODE_STRING  Unicode;
>      HANDLE          Key;
> -    ULONG           RealTimeIsUniversal;
> +    ULONG           ValueDword;
> +    ULONGLONG       ValueQword;
>      NTSTATUS        status;
>
>      RtlInitUnicodeString(&Unicode,
> L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInform=
ation");
> @@ -1192,27 +1193,30 @@ SystemGetTimeInformation(
>      if (!NT_SUCCESS(status))
>          goto fail1;
>
> -    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> -                                     &RealTimeIsUniversal);
> -    if (!NT_SUCCESS(status)) {
> -        if (status !=3D STATUS_OBJECT_NAME_NOT_FOUND)
> -            goto fail2;
> +    status =3D RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
> &ValueDword);
> +    if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {
> +        Context->RealTimeIsUniversal =3D FALSE;
> +        goto done;
> +    } else if (NT_SUCCESS(status)) {
> +        Context->RealTimeIsUniversal =3D !!ValueDword;
> +        goto done;
> +    }
>
> -        RealTimeIsUniversal =3D 0;
> +    status =3D RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
> &ValueQword);
> +    if (NT_SUCCESS(status)) {
> +        Context->RealTimeIsUniversal =3D !!ValueQword;
> +        goto done;
>      }
>
> -    Context->RealTimeIsUniversal =3D RealTimeIsUniversal ? TRUE : FALSE;
> +    status =3D STATUS_UNSUCCESSFUL;
> +    Context->RealTimeIsUniversal =3D FALSE;
>
> +done:
>      Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
>
>      RegistryCloseKey(Key);
>
> -    return STATUS_SUCCESS;
> -
> -fail2:
> -    Error("fail2\n");
> -
> -    RegistryCloseKey(Key);
> +    return status;
>
>  fail1:
>      Error("fail1 (%08x)\n", status);
> @@ -1318,19 +1322,16 @@ SystemInitialize(
>      if (!NT_SUCCESS(status))
>          goto fail8;
>
> -    status =3D SystemGetTimeInformation();
> +    status =3D SystemCheckProcessors();
>      if (!NT_SUCCESS(status))
>          goto fail9;
>
> -    status =3D SystemCheckProcessors();
> +    status =3D SystemGetTimeInformation();
>      if (!NT_SUCCESS(status))
> -        goto fail10;
> +        Error("Cannot read RealTimeIsUniversal (%08x)\n", status);
>
>      return STATUS_SUCCESS;
>
> -fail10:
> -    Error("fail10\n");
> -
>  fail9:
>      Error("fail9\n");
>
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--0000000000009e0c76063c9ef159
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen=
.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 18, 2025 at=
 6:55=E2=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">Tolerate RealTimeIsUniversa=
l having the REG_QWORD value type.<br>
<br>
In addition, don&#39;t fail SystemInitialize when SystemGetTimeInformation<=
br>
fails to read RealTimeIsUniversal as critical boot drivers (e.g. xenvbd)<br=
>
may fail to load otherwise.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
v2: Log error code from SystemGetTimeInformation<br>
---<br>
=C2=A0src/xen/system.c | 41 +++++++++++++++++++++--------------------<br>
=C2=A01 file changed, 21 insertions(+), 20 deletions(-)<br>
<br>
diff --git a/src/xen/system.c b/src/xen/system.c<br>
index 48f9af0..991ce4b 100644<br>
--- a/src/xen/system.c<br>
+++ b/src/xen/system.c<br>
@@ -1183,7 +1183,8 @@ SystemGetTimeInformation(<br>
=C2=A0 =C2=A0 =C2=A0PSYSTEM_CONTEXT Context =3D &amp;SystemContext;<br>
=C2=A0 =C2=A0 =C2=A0UNICODE_STRING=C2=A0 Unicode;<br>
=C2=A0 =C2=A0 =C2=A0HANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Key;<br>
-=C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RealTimeIsUniv=
ersal;<br>
+=C2=A0 =C2=A0 ULONG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ValueDword;<br=
>
+=C2=A0 =C2=A0 ULONGLONG=C2=A0 =C2=A0 =C2=A0 =C2=A0ValueQword;<br>
=C2=A0 =C2=A0 =C2=A0NTSTATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 status;<br>
<br>
=C2=A0 =C2=A0 =C2=A0RtlInitUnicodeString(&amp;Unicode, L&quot;\\Registry\\M=
achine\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation&quot;);<br>
@@ -1192,27 +1193,30 @@ SystemGetTimeInformation(<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail1;<br>
<br>
-=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;RealTimeIsU=
niversal);<br>
-=C2=A0 =C2=A0 if (!NT_SUCCESS(status)) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (status !=3D STATUS_OBJECT_NAME_NOT_FOUND)<=
br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail2;<br>
+=C2=A0 =C2=A0 status =3D RegistryQueryDwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;, &amp;ValueDword);<br>
+=C2=A0 =C2=A0 if (status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D FALSE;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
+=C2=A0 =C2=A0 } else if (NT_SUCCESS(status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueDwo=
rd;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
+=C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 RealTimeIsUniversal =3D 0;<br>
+=C2=A0 =C2=A0 status =3D RegistryQueryQwordValue(Key, &quot;RealTimeIsUniv=
ersal&quot;, &amp;ValueQword);<br>
+=C2=A0 =C2=A0 if (NT_SUCCESS(status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D !!ValueQwo=
rd;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto done;<br>
=C2=A0 =C2=A0 =C2=A0}<br>
<br>
-=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D RealTimeIsUniversal ? TR=
UE : FALSE;<br>
+=C2=A0 =C2=A0 status =3D STATUS_UNSUCCESSFUL;<br>
+=C2=A0 =C2=A0 Context-&gt;RealTimeIsUniversal =3D FALSE;<br>
<br>
+done:<br>
=C2=A0 =C2=A0 =C2=A0Info(&quot;%s\n&quot;, Context-&gt;RealTimeIsUniversal =
? &quot;TRUE&quot; : &quot;FALSE&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0RegistryCloseKey(Key);<br>
<br>
-=C2=A0 =C2=A0 return STATUS_SUCCESS;<br>
-<br>
-fail2:<br>
-=C2=A0 =C2=A0 Error(&quot;fail2\n&quot;);<br>
-<br>
-=C2=A0 =C2=A0 RegistryCloseKey(Key);<br>
+=C2=A0 =C2=A0 return status;<br>
<br>
=C2=A0fail1:<br>
=C2=A0 =C2=A0 =C2=A0Error(&quot;fail1 (%08x)\n&quot;, status);<br>
@@ -1318,19 +1322,16 @@ SystemInitialize(<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail8;<br>
<br>
-=C2=A0 =C2=A0 status =3D SystemGetTimeInformation();<br>
+=C2=A0 =C2=A0 status =3D SystemCheckProcessors();<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail9;<br>
<br>
-=C2=A0 =C2=A0 status =3D SystemCheckProcessors();<br>
+=C2=A0 =C2=A0 status =3D SystemGetTimeInformation();<br>
=C2=A0 =C2=A0 =C2=A0if (!NT_SUCCESS(status))<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fail10;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Error(&quot;Cannot read RealTimeIsUniversal (%=
08x)\n&quot;, status);<br>
<br>
=C2=A0 =C2=A0 =C2=A0return STATUS_SUCCESS;<br>
<br>
-fail10:<br>
-=C2=A0 =C2=A0 Error(&quot;fail10\n&quot;);<br>
-<br>
=C2=A0fail9:<br>
=C2=A0 =C2=A0 =C2=A0Error(&quot;fail9\n&quot;);<br>
<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--0000000000009e0c76063c9ef159--


From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:51:03 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:51:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085512.1443822 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unudz-00074o-BB; Mon, 18 Aug 2025 07:51:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085512.1443822; Mon, 18 Aug 2025 07:51:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unudz-00074h-8i; Mon, 18 Aug 2025 07:51:03 +0000
Received: by outflank-mailman (input) for mailman id 1085512;
 Mon, 18 Aug 2025 07:51:01 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oZ4g=26=bounce.vates.tech=bounce-md_30504962.68a2d923.v1-e0c1631fb2c24e3792155c5162304c9f@srs-se1.protection.inumbo.net>)
 id 1unuUf-0003E3-Mn
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:25 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id bd2184b9-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:24 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Qq0m1dzK5vgLY
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:23 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 e0c1631fb2c24e3792155c5162304c9f; Mon, 18 Aug 2025 07:41:23 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bd2184b9-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502883; x=1755772883;
	bh=DkghtosW0POqimHuhIf/fYSuFU9xUaKD9vYoTLPFcP4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=h3/2JkgLpsBCohcXZTlD5DmyrTVoWAxSlfZU5K9F72ft0bxApDKN0RJGvDtix9Bm4
	 lmPxivfKT1rEilJtMr99lf8OFtxIhbVHjkb9CMLeasLSWmz8obDlNgkbuUIrIR7347
	 5bUVUM3PWZUMFXjodoYYwRNdeZqjyuUvLpS/sBFelflQRS0s784m8hwjCfzU9t33JV
	 CUKQeWI9XEf8LPWYPdWDWFXkKmqFoNPD1fA0O6uftL60BOY4Sv2RtDTZwX8LOHBhLe
	 64Tsoa0tuzOQpHsIJVO/p5xnt8HbD8IlEmQkFaOmT0vfiuE7/I5ej28AMWkPdgEgvu
	 mnDEuWnQrGN4Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502883; x=1755763383; i=ngoc-tu.dinh@vates.tech;
	bh=DkghtosW0POqimHuhIf/fYSuFU9xUaKD9vYoTLPFcP4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=kcjau1tYty3Nc/sKKr+QiLIBjAHqLOxZ0bT8vg8vW6dyJ1fAoOiCpmvTHH59MgiPf
	 IIsBkjkdr2/sEq5DZD1SFaFeIRkkFd5KNnzNBOQW6fp+4PlQ+sD16LcDqXXQivLD1U
	 fhiHjwleG7IbETsfLAVQzmVq1LIjgzryR31BFCmjOCvw8veRyCvnxPpjtssShrfDYc
	 jK0HuMDAMBaLIzV1I8lvMa19tE2yXZEutS0ImpaSNYFnJ2mqjBhf5HSih04mQdEoI8
	 LMSZBuch2gAHA4it1yypuJjHZREDOfg+bhZ4BohS0R+ZGBDV6WwpK9WU5orsZJfJja
	 1ZgagcC9M1f1Q==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH=20v6=2017/17]=20Deprecate=20PDO=20revisions=200x09000000?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502882501
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-18-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.e0c1631fb2c24e3792155c5162304c9f?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

CACHE v1 has been deprecated by the removal of Xenbus 0x09000007.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 include/revision.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/revision.h b/include/revision.h
index 656f171..d23639f 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -42,7 +42,6 @@
 
 //                    REVISION   C   V    ST  SU   U
 #define DEFINE_REVISION_TABLE                           \
-    DEFINE_REVISION(0x09000000,  1,  8,   2,  1,   1),  \
     DEFINE_REVISION(0x09000001,  2,  8,   2,  1,   1),  \
     DEFINE_REVISION(0x09000002,  2,  9,   2,  1,   1),  \
     DEFINE_REVISION(0x09000003,  2,  10,  2,  1,   1),  \
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Mon Aug 18 07:51:09 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 18 Aug 2025 07:51:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1085513.1443827 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unue5-0007CQ-Cq; Mon, 18 Aug 2025 07:51:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1085513.1443827; Mon, 18 Aug 2025 07:51:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1unue5-0007CJ-A4; Mon, 18 Aug 2025 07:51:09 +0000
Received: by outflank-mailman (input) for mailman id 1085513;
 Mon, 18 Aug 2025 07:51:08 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=v0rm=26=bounce.vates.tech=bounce-md_30504962.68a2d924.v1-8052126f0b834db58360ab20c16e48fa@srs-se1.protection.inumbo.net>)
 id 1unuUg-0003E3-Mr
 for win-pv-devel@lists.xenproject.org; Mon, 18 Aug 2025 07:41:26 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id bdbd26fa-7c06-11f0-b898-0df219b8e170;
 Mon, 18 Aug 2025 09:41:25 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c54Qr0vTfzK5vnLF
 for <win-pv-devel@lists.xenproject.org>; Mon, 18 Aug 2025 07:41:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 8052126f0b834db58360ab20c16e48fa; Mon, 18 Aug 2025 07:41:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bdbd26fa-7c06-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755502884; x=1755772884;
	bh=si6Rcpi0+Uz0DUcam+qWEAI0Yhk1kH870v9tmh4JfqU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=fyTO+ul0qVu9EFJmzvdjSgpOsYz6Gaz20j6nyacQmrfpUL1aRoimvxAwm0T8Nyj3j
	 6gPcHxFwp4/QXJ+acUEZYjYMD2cdUeKuKcsHUMOtLHXVHxuJrb9hdD/qDfWZboqIuk
	 AnttlJB+qTfCGG957v0BYGNxNc22G6oZEddv7df2/ZbjetaJ7d1pvA8ekvfJAyE1xQ
	 ITHUTuesDfDEnLb/zKh6PxRJUkAGFfs1bYJ1Cj+v51AX2MklQo1fyJ6q6b9CzzLOQz
	 eFChZjFCj9wKdBEQlqS6GXIxrsjDQukr7Qy3QHg01QCl0tph5RQI9Sr6sAw9aGcB1B
	 sy4b8wHIe0+Ow==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755502884; x=1755763384; i=ngoc-tu.dinh@vates.tech;
	bh=si6Rcpi0+Uz0DUcam+qWEAI0Yhk1kH870v9tmh4JfqU=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=Q1ZKsurgKJIrKduWtV3V5J3YAkFay5u46H13lnLZO61daNV/IGn6kXuM2sVpoxPPL
	 6NWhzgUfmEuOBRoKlgKiGIMr0ueXw4K0JImMIfcdHj2RkZE+kBjCrigok51SI5IVLZ
	 a1sS3Wjq4DVaRBwgznwpViez4aTPX2T7Mc0bsjb0IIp/LwJVGUj+r/OylkmRetfoe9
	 7jEVaps4gKfumhGDGfSU774tYv4T+Cwz+urxP14Z2szkeG9zUtJBxcWBYfgCBCtrm1
	 unJMqyrwrNmfuwWmNzrLscC9AVLxFgzwRhjXkd9XKNhT2D+dl9ZUM77bFY/tUlmPEp
	 2sKfPGdBjnSkw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVKBD=20PATCH=20v6=2018/18]=20Remove=20vendor=20device=20ID=20from=20DeviceID?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755502883517
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250818074038.1728-19-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.8052126f0b834db58360ab20c16e48fa?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250818:md
Date: Mon, 18 Aug 2025 07:41:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The presence of vendor device ID in DeviceID causes the device instance
path to change if the active device changes.

If forced activation is enabled, the active device will immediately
change when the platform device ID changes or if the vendor device is
toggled. Child drivers will fail to work if they can't cope with the
resulting device instance path change.

Remove the vendor device ID from DeviceID to ensure the device instance
path remains stable across vendor device config changes.

Ported from Xenbus.

Suggested-by: Owen Smith <owen.smith@cloud.com>
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvkbd/pdo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenvkbd/pdo.c b/src/xenvkbd/pdo.c
index f10aca0..adb8353 100644
--- a/src/xenvkbd/pdo.c
+++ b/src/xenvkbd/pdo.c
@@ -1318,8 +1318,7 @@ PdoQueryId(
 
         status = RtlStringCbPrintfW(Buffer,
                                     Id.MaximumLength,
-                                    L"XENVKBD\\VEN_%hs&DEV_HID",
-                                    __PdoGetVendorName(Pdo));
+                                    L"XENVKBD\\VEN_" VENDOR_PREFIX_STR "&DEV_HID");
         ASSERT(NT_SUCCESS(status));
 
         Buffer += wcslen(Buffer);
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Tue Aug 19 08:38:36 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Aug 2025 08:38:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1086376.1444541 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoHrW-000383-6t; Tue, 19 Aug 2025 08:38:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1086376.1444541; Tue, 19 Aug 2025 08:38:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoHrW-00037w-3y; Tue, 19 Aug 2025 08:38:34 +0000
Received: by outflank-mailman (input) for mailman id 1086376;
 Tue, 19 Aug 2025 08:38:32 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=alJ0=27=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1uoHrU-00037q-Bb
 for win-pv-devel@lists.xenproject.org; Tue, 19 Aug 2025 08:38:32 +0000
Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com
 [2607:f8b0:4864:20::52c])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id deaa4d92-7cd7-11f0-b898-0df219b8e170;
 Tue, 19 Aug 2025 10:38:26 +0200 (CEST)
Received: by mail-pg1-x52c.google.com with SMTP id
 41be03b00d2f7-b475dfb4f42so102906a12.0
 for <win-pv-devel@lists.xenproject.org>; Tue, 19 Aug 2025 01:38:25 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: deaa4d92-7cd7-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755592704; x=1756197504; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=U5DJ4T08uHHaoH/srz1/RKr35C8DlgvM43vthHn25jI=;
        b=A13wcN4Qzna3pZMs62UelCFHbeT0qlI0ng8KB5dRgMX/P1QiDeBze7IBePUxmfxjNK
         W1nW7qHpJYBxqeBc6PQUmAILppK/ls886GkNnH0G0GbH3VQSDfR2AXmv6D5jWDnDo/1X
         pmCLm5Z8ACQGx8kzv9SNfF1BeAgUN0nkO9tdI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755592704; x=1756197504;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=U5DJ4T08uHHaoH/srz1/RKr35C8DlgvM43vthHn25jI=;
        b=Rbm2rfWuXRJS4fjOHYaDqdzye1hoqv+wF9tusFnq2p4uy0/pegbGQLhIsKnhb28gDG
         fHXeoEXScDUnOMbLpkyODtfZaohtx0GIrY6VR178kV5f1iyN1GYDcsHGfWb7VRLeCQ4H
         kuwD0sZczssG933sEsalrBJAyzue8FP/GpZ385qJZDfqtzLSaXrqcHHyTMWEcxxXPdWL
         Aj+eCjqJ+aTMMFKX8pFQCuoNYlsNDXRYpxmBbXxcN5N4gL+QyDFqapompNoC51SW2UVj
         3ENhCnNCmn8tUw53F3i2RIJcK92rcgQXh7nP950L2l32o+aP+1gimNlXaqeJsFZrHtel
         CVmg==
X-Gm-Message-State: AOJu0Yw4OPkMJosJBSBLwpZ6PjVAK/1UuNEsJhr9l4bm8F1KGnDvXIR2
	whg0Ak510TjDsS0gU12oq0Mic24ziu14LN0aDiIXZLtXUU5xlQuK4DSHf/WnmJh2VfrZHwKvdwQ
	XeU7SZckYqlK/+PfbWBkKVyC0UqLmlEY0xJ61iAL21+MSYItf7mw=
X-Gm-Gg: ASbGnctcd1kBzSF+gxEicfVqD63XOEZ5ZhnB2hhm896g1x5pzmW77Cqb/lgit46Z6zb
	TqpK3FSPP6SdlJ/Vw5y6eSyFs/QS5HU3gNN5AOMGYCaqPuqYiH0fB3BET8OM02t1kVqn3qWhM5h
	27QZysFqRM+TtDGNWlsLWTSX8t/ZKPtTk0svQF4w4A7a55z5bsh0klc+0cvawgcIFC5E7eNSXaX
	Z4IZhM=
X-Google-Smtp-Source: AGHT+IFdeyVBrMmTO3KIxHSdOeTP51QpG/AMndeEkU9ffvHQ6DqWT0OwaTJ7Ewh9omX04mAk8tZdVqCEzV3DuGSDOuM=
X-Received: by 2002:a17:902:f683:b0:242:461b:7d4 with SMTP id
 d9443c01a7336-245e02d8957mr22911645ad.15.1755592703446; Tue, 19 Aug 2025
 01:38:23 -0700 (PDT)
MIME-Version: 1.0
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Tue, 19 Aug 2025 09:38:12 +0100
X-Gm-Features: Ac12FXzY8vJ13abyZWKV1M2YSWmemXNrjJKZPXo9oRkj4Icl281ON5j0o99345I
Message-ID: <CAC_UY886cEhZVVFmeyE6A0avVxL0x7mDiAiZK08=A7c52C0ANw@mail.gmail.com>
Subject: Re: [PATCH v6 00/11] Implement forced unplug and forced activation
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="00000000000075b19e063cb3c7f3"

--00000000000075b19e063cb3c7f3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It appears force unplug isn't required in normal usage - but as its opt-in,
this shouldn't cause issues.

Adding my Reviewed-by tag to all these xenbus patches, the genfiles.ps1
patch will need applying to all repos.
It would be good to bump the revision binding in the child inf files, and
update xenvbd's emulated_interface.h - but these can be applied later.

Applying these patches now

Reviewed-by: Owen Smith <owen.smith@cloud.com>

Owen

On Mon, Aug 18, 2025 at 8:40=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> The goal of these two features is to simplify driver servicing and avoid
> requiring storing driver state in Registry.
>
> Forced unplug, as name implies, forcefully unplugs emulated devices when
> a driver is present, rather than when it's active. It defines a Registry
> key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced
> unplug by creating an appropriate value (DISKS/NICS) in this key.
>
> Note that since it's no longer possible to guarantee removal of Registry
> values during driver uninstallation by Windows, driver uninstallers are
> expected to remove these values themselves.
>
> Forced activation is the companion to forced unplug. It aims to make
> activation of Xenbus FDOs deterministic and stateless, using a
> precedence mapping based on device IDs, prioritizing the vendor device
> over the generic ones. This avoids situations where the wrong FDO is
> activated, which will prevent Windows Update from working.
>
> Like forced unplug, the precedence mapping of forced activation is also
> expected to be removed by driver uninstallers.
>
> With forced activation, Xenfilt is now installed via INF on top of the
> current installation routines. This means PV drivers can be injected
> offline without needing another reboot to be reconfigured.
>
> Care is taken to keep compatibility with older drivers. The two features
> are also conditioned behind new build environment variables FORCE_UNPLUG
> and FORCE_ACTIVATE.
>
> Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.
> Deprecate PDO revisions 0x09000007 and earlier to make room for the new
> revision.
> Xenvif 0x09000000 is also removed due to the deprecation of CACHE v1.
>
> With forced unplug/activation, the whole boot chain of boot-critical
> drivers must be available in the driver store to avoid
> INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware
> IDs into one INF Models entry.
>
> Finally, since forced activation can cause the active device to change
> without prior notice, such a change will cause old drivers to lose their
> bindings due to a change in the device instance path. Drop the vendor
> device ID from DeviceID to make sure that device instance paths remain
> stable across vendor device changes.
>
> The following scenarios have been successfully tested, requiring only
> one reboot each:
> * Offline driver installation via DISM
> * Fresh install, followed by switching from device 0001 to 0002
> * Fresh install, followed by toggling vendor device
> * Xenbus/Xenvbd update
>
> Other tested scenarios:
> * Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling
>   device ID (v4)
> * Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2)
>
> Commit notes:
> * Patch 1 "Collapse skipped template lines" is for all repos.
> * These forced-activation commits are linked and cannot be separated:
>   * xenfilt: Add Xenbus device precedence mechanism
>   * Add EMULATED v3
>   * Use EMULATED v3 to force activate Xenbus FDOs
>
> Changes in v6:
> * Fixed logic in "Collapse skipped template lines"
> * Moved precedence values to their own key xenfilt\Parameters\Precedence
> * Changed INFs to promote 0002 device to hardware ID in Models entry if
>   vendor device support is not present to avoid Inf2Cat 22.9.3 warning
> * Fixed emulated.h still using LONG ForceActivate
>
> v5: Ad-hoc patches to v4, see v6
>
> Changes in v4:
> * Restored interfaces deprecated in v3 to allow old drivers to work with
>   existing binding, while still removing old PDO revisions
> * Converted IsForceActivated LONG value to a proper enum
> * Stripped vendor device ID from device ID strings
>   * The same was done for Xencons, Xenvif and Xenvkbd
> * Fixed mistakenly-left-in DEV_C000 in forced-activation Xenbus.inf
> * Moved PdoGetPrecedence to driver.c and merged into DriverGetPrecedence
> * Refactored EmulatedIsDevicePresent condition checking
> * Removed Xenvif revision 0x09000000 due to the deprecation of CACHE v1
>
> v3:
> https://lists.xenproject.org/archives/html/win-pv-devel/2025-08/msg00002.=
html
> * Deprecated PDO revisions 0x09000007 and earlier to make room for
>   0x0900000C
> * Merged all hardware IDs into one INF Models entry to avoid BSODs when
>   changing platform device IDs and toggling vendor device
> * Added a note mentioning the role of driver uninstallers in cleanup of
>   forced unplug/activation drivers.
>
> v2:
> https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.=
html
> * Added forced activation
>
> v1:
> https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.=
html
>
> Tu Dinh (11):
>   Collapse skipped template lines
>   Merge all hardware IDs into one Models entry
>   Remove vendor device ID from DeviceID
>   Deprecate PDO revisions 0x09000007 and earlier
>   xenbus: Use nonpaged pool in FdoQueryId
>   Add forced unplug support
>   xenfilt: Add Xenbus device precedence mechanism
>   Add EMULATED v3
>   Use EMULATED v3 to force activate Xenbus FDOs
>   Enable Xenbus precedence
>   Install Xenfilt with INF AddReg
>
>  include/emulated_interface.h |  61 +++++++++++++---
>  include/revision.h           |  11 +--
>  scripts/genfiles.ps1         |  15 ++--
>  src/xen/driver.c             |  79 ++++++++++++++++-----
>  src/xen/driver.h             |   5 ++
>  src/xen/unplug.c             |  13 +++-
>  src/xenbus.inf               |  25 ++++---
>  src/xenbus/fdo.c             | 134 ++++++++++++++++++++++++-----------
>  src/xenbus/pdo.c             |   3 +-
>  src/xenfilt/driver.c         |  93 ++++++++++++++++++++++--
>  src/xenfilt/driver.h         |   7 ++
>  src/xenfilt/emulated.c       | 115 ++++++++++++++++++++++++------
>  src/xenfilt/emulated.h       |  13 ++--
>  src/xenfilt/fdo.c            |  30 +++++++-
>  src/xenfilt/pdo.c            |  63 ++++++++--------
>  src/xenfilt/pdo.h            |   7 +-
>  16 files changed, 514 insertions(+), 160 deletions(-)
>
> --
> 2.50.1.windows.1
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>

--00000000000075b19e063cb3c7f3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">It appears force unplug isn&#39;t=C2=A0required in normal usage - but as=
 its opt-in, this shouldn&#39;t cause issues.<br><br>Adding my Reviewed-by =
tag to all these xenbus patches, the genfiles.ps1 patch will need applying =
to all repos.<br>It would be good to bump the revision binding in the child=
 inf files, and update xenvbd&#39;s=C2=A0emulated_interface.h - but these c=
an be applied later.</div><div class=3D"gmail_default" style=3D"font-family=
:monospace"><br></div><div class=3D"gmail_default" style=3D"font-family:mon=
ospace">Applying these patches now</div><div class=3D"gmail_default" style=
=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=3D"=
font-family:monospace">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.s=
mith@cloud.com">owen.smith@cloud.com</a>&gt;</div><div class=3D"gmail_defau=
lt" style=3D"font-family:monospace"><br></div><div class=3D"gmail_default" =
style=3D"font-family:monospace">Owen</div></div><br><div class=3D"gmail_quo=
te"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 18, 2025 at 8:40=E2=
=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex">The goal of these two features is t=
o simplify driver servicing and avoid<br>
requiring storing driver state in Registry.<br>
<br>
Forced unplug, as name implies, forcefully unplugs emulated devices when<br=
>
a driver is present, rather than when it&#39;s active. It defines a Registr=
y<br>
key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced<br>
unplug by creating an appropriate value (DISKS/NICS) in this key.<br>
<br>
Note that since it&#39;s no longer possible to guarantee removal of Registr=
y<br>
values during driver uninstallation by Windows, driver uninstallers are<br>
expected to remove these values themselves.<br>
<br>
Forced activation is the companion to forced unplug. It aims to make<br>
activation of Xenbus FDOs deterministic and stateless, using a<br>
precedence mapping based on device IDs, prioritizing the vendor device<br>
over the generic ones. This avoids situations where the wrong FDO is<br>
activated, which will prevent Windows Update from working.<br>
<br>
Like forced unplug, the precedence mapping of forced activation is also<br>
expected to be removed by driver uninstallers.<br>
<br>
With forced activation, Xenfilt is now installed via INF on top of the<br>
current installation routines. This means PV drivers can be injected<br>
offline without needing another reboot to be reconfigured.<br>
<br>
Care is taken to keep compatibility with older drivers. The two features<br=
>
are also conditioned behind new build environment variables FORCE_UNPLUG<br=
>
and FORCE_ACTIVATE.<br>
<br>
Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.<br>
Deprecate PDO revisions 0x09000007 and earlier to make room for the new<br>
revision.<br>
Xenvif 0x09000000 is also removed due to the deprecation of CACHE v1.<br>
<br>
With forced unplug/activation, the whole boot chain of boot-critical<br>
drivers must be available in the driver store to avoid<br>
INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware<br>
IDs into one INF Models entry.<br>
<br>
Finally, since forced activation can cause the active device to change<br>
without prior notice, such a change will cause old drivers to lose their<br=
>
bindings due to a change in the device instance path. Drop the vendor<br>
device ID from DeviceID to make sure that device instance paths remain<br>
stable across vendor device changes.<br>
<br>
The following scenarios have been successfully tested, requiring only<br>
one reboot each:<br>
* Offline driver installation via DISM<br>
* Fresh install, followed by switching from device 0001 to 0002<br>
* Fresh install, followed by toggling vendor device<br>
* Xenbus/Xenvbd update<br>
<br>
Other tested scenarios:<br>
* Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling<br>
=C2=A0 device ID (v4)<br>
* Major OS upgrade (Windows 10 22H2 -&gt; Windows 11 24H2)<br>
<br>
Commit notes:<br>
* Patch 1 &quot;Collapse skipped template lines&quot; is for all repos.<br>
* These forced-activation commits are linked and cannot be separated:<br>
=C2=A0 * xenfilt: Add Xenbus device precedence mechanism<br>
=C2=A0 * Add EMULATED v3<br>
=C2=A0 * Use EMULATED v3 to force activate Xenbus FDOs<br>
<br>
Changes in v6:<br>
* Fixed logic in &quot;Collapse skipped template lines&quot;<br>
* Moved precedence values to their own key xenfilt\Parameters\Precedence<br=
>
* Changed INFs to promote 0002 device to hardware ID in Models entry if<br>
=C2=A0 vendor device support is not present to avoid Inf2Cat 22.9.3 warning=
<br>
* Fixed emulated.h still using LONG ForceActivate<br>
<br>
v5: Ad-hoc patches to v4, see v6<br>
<br>
Changes in v4:<br>
* Restored interfaces deprecated in v3 to allow old drivers to work with<br=
>
=C2=A0 existing binding, while still removing old PDO revisions<br>
* Converted IsForceActivated LONG value to a proper enum<br>
* Stripped vendor device ID from device ID strings<br>
=C2=A0 * The same was done for Xencons, Xenvif and Xenvkbd<br>
* Fixed mistakenly-left-in DEV_C000 in forced-activation Xenbus.inf<br>
* Moved PdoGetPrecedence to driver.c and merged into DriverGetPrecedence<br=
>
* Refactored EmulatedIsDevicePresent condition checking<br>
* Removed Xenvif revision 0x09000000 due to the deprecation of CACHE v1<br>
<br>
v3: <a href=3D"https://lists.xenproject.org/archives/html/win-pv-devel/2025=
-08/msg00002.html" rel=3D"noreferrer" target=3D"_blank">https://lists.xenpr=
oject.org/archives/html/win-pv-devel/2025-08/msg00002.html</a><br>
* Deprecated PDO revisions 0x09000007 and earlier to make room for<br>
=C2=A0 0x0900000C<br>
* Merged all hardware IDs into one INF Models entry to avoid BSODs when<br>
=C2=A0 changing platform device IDs and toggling vendor device<br>
* Added a note mentioning the role of driver uninstallers in cleanup of<br>
=C2=A0 forced unplug/activation drivers.<br>
<br>
v2: <a href=3D"https://lists.xenproject.org/archives/html/win-pv-devel/2025=
-07/msg00053.html" rel=3D"noreferrer" target=3D"_blank">https://lists.xenpr=
oject.org/archives/html/win-pv-devel/2025-07/msg00053.html</a><br>
* Added forced activation<br>
<br>
v1: <a href=3D"https://lists.xenproject.org/archives/html/win-pv-devel/2025=
-07/msg00012.html" rel=3D"noreferrer" target=3D"_blank">https://lists.xenpr=
oject.org/archives/html/win-pv-devel/2025-07/msg00012.html</a><br>
<br>
Tu Dinh (11):<br>
=C2=A0 Collapse skipped template lines<br>
=C2=A0 Merge all hardware IDs into one Models entry<br>
=C2=A0 Remove vendor device ID from DeviceID<br>
=C2=A0 Deprecate PDO revisions 0x09000007 and earlier<br>
=C2=A0 xenbus: Use nonpaged pool in FdoQueryId<br>
=C2=A0 Add forced unplug support<br>
=C2=A0 xenfilt: Add Xenbus device precedence mechanism<br>
=C2=A0 Add EMULATED v3<br>
=C2=A0 Use EMULATED v3 to force activate Xenbus FDOs<br>
=C2=A0 Enable Xenbus precedence<br>
=C2=A0 Install Xenfilt with INF AddReg<br>
<br>
=C2=A0include/emulated_interface.h |=C2=A0 61 +++++++++++++---<br>
=C2=A0include/revision.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 11=
 +--<br>
=C2=A0scripts/genfiles.ps1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 15 ++--=
<br>
=C2=A0src/xen/driver.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 79 ++++++++++++++++-----<br>
=C2=A0src/xen/driver.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 =C2=A05 ++<br>
=C2=A0src/xen/unplug.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 13 +++-<br>
=C2=A0src/xenbus.inf=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
|=C2=A0 25 ++++---<br>
=C2=A0src/xenbus/fdo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 134=
 ++++++++++++++++++++++++-----------<br>
=C2=A0src/xenbus/pdo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 =C2=A03 +-<br>
=C2=A0src/xenfilt/driver.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 93 ++++=
++++++++++++++++++--<br>
=C2=A0src/xenfilt/driver.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A07=
 ++<br>
=C2=A0src/xenfilt/emulated.c=C2=A0 =C2=A0 =C2=A0 =C2=A0| 115 ++++++++++++++=
++++++++++------<br>
=C2=A0src/xenfilt/emulated.h=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 13 ++--<br>
=C2=A0src/xenfilt/fdo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 30=
 +++++++-<br>
=C2=A0src/xenfilt/pdo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 63=
 ++++++++--------<br>
=C2=A0src/xenfilt/pdo.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =
=C2=A07 +-<br>
=C2=A016 files changed, 514 insertions(+), 160 deletions(-)<br>
<br>
--<br>
2.50.1.windows.1<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
</blockquote></div>

--00000000000075b19e063cb3c7f3--


From win-pv-devel-bounces@lists.xenproject.org Tue Aug 19 08:54:02 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Aug 2025 08:54:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1086381.1444545 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoI6T-0005J9-89; Tue, 19 Aug 2025 08:54:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1086381.1444545; Tue, 19 Aug 2025 08:54:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoI6T-0005J2-5L; Tue, 19 Aug 2025 08:54:01 +0000
Received: by outflank-mailman (input) for mailman id 1086381;
 Tue, 19 Aug 2025 08:54:00 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NkFK=27=bounce.vates.tech=bounce-md_30504962.68a43ba2.v1-88099c0dc26f47e4aabbb7b996f76ae7@srs-se1.protection.inumbo.net>)
 id 1uoI6R-0005Iw-Ro
 for win-pv-devel@lists.xenproject.org; Tue, 19 Aug 2025 08:54:00 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 098c2215-7cda-11f0-a32a-13f23c93f187;
 Tue, 19 Aug 2025 10:53:57 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c5k0253tyzRKLdw1
 for <win-pv-devel@lists.xenproject.org>; Tue, 19 Aug 2025 08:53:54 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 88099c0dc26f47e4aabbb7b996f76ae7; Tue, 19 Aug 2025 08:53:54 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 098c2215-7cda-11f0-a32a-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755593634; x=1755863634;
	bh=oJjJr8E+ZeeSN+docF98i5WGushDZHmKsuztSYl/aww=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=s7W4xCH3hlljn9aP9oAvKJvAAxzUtVAr6pr5CAb/PcgHUxG3coHNMEc0xZReiY5q4
	 Tk6wLtF4NNvZreC2jPtrLeGpQIQSax6FJ5MLqibGvcsb4WEKy01tVjGaMt6zsFtLpe
	 s92dtYOjDKyEMoAPo5V7yXmHCmqpCh5/m0+96NQI2dJAgScvPQXg/osO3xbNgqrSFR
	 wIzSRK9qSgzU2OxCseOIwWf5GI2mnBSkJNJ0oGCVepQWekkzu57SBqIQ2iUnejUMF3
	 9xGf0eWoK0ldz3X5AIxDsvjEQaehkWxRtseJ8MsHKyREm8ZZZ8RNwThN0b1u7eEI6b
	 S0xuQj6nIz9mQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755593634; x=1755854134; i=ngoc-tu.dinh@vates.tech;
	bh=oJjJr8E+ZeeSN+docF98i5WGushDZHmKsuztSYl/aww=;
	h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=hnxO+4UEntdJyzMkJIuHuJdpodR+DGDXikCAVSKmoFRIeCyClu2nWC8+9fqKrD9IQ
	 Fd7kppSqomXbI99sJe8ZGVAzSpAqVNfLLCnXErgAabmLHvgIG6mfTzLC4TgIh4/uSZ
	 UeUEUO0tpsJ/BX8AfKKAPGDGiUDfOQarDIhCUqOjYFaqgZdD/HKLsDna4zCox3ibhK
	 /X4VrVxyGvU0GksLIhDPWsDZoG0WDJpnKYEBFoS16PNct1jN0dVm9LSaq5uCRKaUok
	 q3ksjxOeMu/fSgzYFzE3gmDmSmhDavZG+Zdst2tXHO78i8d+6WP30Q2f4xurwadrpD
	 N/IFcFLObtKDw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH=20v6=2000/11]=20Implement=20forced=20unplug=20and=20forced=20activation?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755593633918
Message-Id: <8a792998-f89b-4d8e-9c62-9d48853a233c@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>
Cc: win-pv-devel@lists.xenproject.org
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech> <CAC_UY886cEhZVVFmeyE6A0avVxL0x7mDiAiZK08=A7c52C0ANw@mail.gmail.com>
In-Reply-To: <CAC_UY886cEhZVVFmeyE6A0avVxL0x7mDiAiZK08=A7c52C0ANw@mail.gmail.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.88099c0dc26f47e4aabbb7b996f76ae7?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250819:md
Date: Tue, 19 Aug 2025 08:53:54 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 19/08/2025 10:38, Owen Smith wrote:
> It appears force unplug isn't=C2=A0required in normal usage - but as its =
opt- 
> in, this shouldn't cause issues.
> 
> Adding my Reviewed-by tag to all these xenbus patches, the genfiles.ps1 
> patch will need applying to all repos.
> It would be good to bump the revision binding in the child inf files, 
> and update xenvbd's=C2=A0emulated_interface.h - but these can be applied =
later.
> 
> Applying these patches now
> 
> Reviewed-by: Owen Smith <owen.smith@cloud.com <mailto:owen.smith@cloud.co=
m>>
> 
> Owen
Thanks,

I'll try to work on syncing the headers along with the SAL annotations.


Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




From win-pv-devel-bounces@lists.xenproject.org Tue Aug 19 09:14:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Aug 2025 09:14:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1086388.1444549 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoIQF-0007aj-MA; Tue, 19 Aug 2025 09:14:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1086388.1444549; Tue, 19 Aug 2025 09:14:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoIQF-0007ac-JL; Tue, 19 Aug 2025 09:14:27 +0000
Received: by outflank-mailman (input) for mailman id 1086388;
 Tue, 19 Aug 2025 09:14:26 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=alJ0=27=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1uoIQD-0007aT-TJ
 for win-pv-devel@lists.xenproject.org; Tue, 19 Aug 2025 09:14:25 +0000
Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com
 [2607:f8b0:4864:20::631])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id e5a31da6-7cdc-11f0-a32a-13f23c93f187;
 Tue, 19 Aug 2025 11:14:24 +0200 (CEST)
Received: by mail-pl1-x631.google.com with SMTP id
 d9443c01a7336-24458263458so40116165ad.3
 for <win-pv-devel@lists.xenproject.org>; Tue, 19 Aug 2025 02:14:24 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e5a31da6-7cdc-11f0-a32a-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755594863; x=1756199663; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=xl3LlCZ+TDnYEE/KwupqL6zQp1ponk04eOGYuAx/UVk=;
        b=bZdyXnzNRCfnFpU8zNIn2kjqVwUvBJy1qNVhwL7d6pQqSf5ZgWcwWCe5mxfT7amzJe
         P+CfJzxBBKAqP5bzz5pxx7IGbPp6duDBoUfEzmqEHo7i64A9K43o3nJBczqbzrAbQMcY
         dydg5hUSlZSPvIbXwsL5dnxx7AijIMMTm7Mss=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755594863; x=1756199663;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=xl3LlCZ+TDnYEE/KwupqL6zQp1ponk04eOGYuAx/UVk=;
        b=SQRMizoGg/eOHGwXV3GKxcXBvvlKXN8GkPHJLpQ3Lez6WKat5tVo4alJp2NeKzgN0t
         Sp4RWlk3tyRw6zpocRPa+rdHD7HHbwx6jIQSoi6Ybilx66SlEuD9/ojOmaDMTuaXqHR/
         Rp9ABsDjWILyAkT2YAoc3e+wYuyDGpb+R/2N/QgZ1lU2zHtlJMBjpnsoky0Tim9Unxa2
         gmXP2Pza9TEbyb3iXZfQI7OQqKMR1NYQwuw3f98dHLRRtonVaSXNcNhSjgXnwrCHZ+6D
         up9hpGTsMXLj5wvQwQ/nbgvBojiZx2EwfjxJxdFwfZ2DuAFQIh7aBqQ+beRKVqg8xKZC
         1gtQ==
X-Gm-Message-State: AOJu0YxV4Vi/iggUnI0NDfjOVEgir2Im+3bWypd2ywOHVpFcj97R2ujm
	3EjRRUzuj+ikniHKP3EGnDoRSRcoyXpdmO6jdKRx5/OUdfbnnaMsuI0UnZAtaqi99Q69wTxetcz
	AobjQpphNFdZU+SW5Pf4+D+E86wJA00bmwWa7zKRJj3Tk6zINLrI=
X-Gm-Gg: ASbGnctZdthsXggPUIhgdILUKzgx3xSL7a9IGhbJVJWc2igHeYlgi1qQjDbQTnQSS9K
	POnYBlc3TkCZFvYVG5oxfNvRcI7ZmeWGY2W+e8GWOI1ofmlRQ3jUWVGZc575mNmT4Csct152jvf
	XT9oOc7CePnCqQu50SrwxDM8stycOXUMYL3EvRMu5mj0ky60n+tJVTCcN7r7Ept0xuOu3Iqch8c
	wgphYY=
X-Google-Smtp-Source: AGHT+IGWVslw57BxKVzvvIjlBIDbA9LgU9cuBkCZF5rXzRbK8U9hQiOhtKyOu+Gbdv6uOg98VArMGDKNyhLmxYCawVY=
X-Received: by 2002:a17:903:32cb:b0:240:8f4:b36e with SMTP id
 d9443c01a7336-245e04832ccmr26423305ad.34.1755594862686; Tue, 19 Aug 2025
 02:14:22 -0700 (PDT)
MIME-Version: 1.0
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech> <20250818074038.1728-18-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-18-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Tue, 19 Aug 2025 10:14:11 +0100
X-Gm-Features: Ac12FXwAaWXylaeleFa1L_kmeqTeKC75Vedyq2Vlow88iHAM-Qv--6bTTMdcmLY
Message-ID: <CAC_UY89jZBGhOcD0up7wL5KRZbe=wXrQkt+fW8Nb7UnAJrbcBQ@mail.gmail.com>
Subject: Re: [XENVIF PATCH v6 17/17] Deprecate PDO revisions 0x09000000
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000290dbe063cb4484c"

--000000000000290dbe063cb4484c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Mon, Aug 18, 2025 at 8:51=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> CACHE v1 has been deprecated by the removal of Xenbus 0x09000007.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  include/revision.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/include/revision.h b/include/revision.h
> index 656f171..d23639f 100644
> --- a/include/revision.h
> +++ b/include/revision.h
> @@ -42,7 +42,6 @@
>
>  //                    REVISION   C   V    ST  SU   U
>  #define DEFINE_REVISION_TABLE                           \
> -    DEFINE_REVISION(0x09000000,  1,  8,   2,  1,   1),  \
>      DEFINE_REVISION(0x09000001,  2,  8,   2,  1,   1),  \
>      DEFINE_REVISION(0x09000002,  2,  9,   2,  1,   1),  \
>      DEFINE_REVISION(0x09000003,  2,  10,  2,  1,   1),  \
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--000000000000290dbe063cb4484c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">owen=
.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 18, 2025 at=
 8:51=E2=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">CACHE v1 has been deprecate=
d by the removal of Xenbus 0x09000007.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0include/revision.h | 1 -<br>
=C2=A01 file changed, 1 deletion(-)<br>
<br>
diff --git a/include/revision.h b/include/revision.h<br>
index 656f171..d23639f 100644<br>
--- a/include/revision.h<br>
+++ b/include/revision.h<br>
@@ -42,7 +42,6 @@<br>
<br>
=C2=A0//=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 REVISION=C2=A0 =C2=A0C=C2=A0 =C2=A0V=C2=A0 =C2=A0 ST=C2=A0 SU=C2=A0 =C2=
=A0U<br>
=C2=A0#define DEFINE_REVISION_TABLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
-=C2=A0 =C2=A0 DEFINE_REVISION(0x09000000,=C2=A0 1,=C2=A0 8,=C2=A0 =C2=A02,=
=C2=A0 1,=C2=A0 =C2=A01),=C2=A0 \<br>
=C2=A0 =C2=A0 =C2=A0DEFINE_REVISION(0x09000001,=C2=A0 2,=C2=A0 8,=C2=A0 =C2=
=A02,=C2=A0 1,=C2=A0 =C2=A01),=C2=A0 \<br>
=C2=A0 =C2=A0 =C2=A0DEFINE_REVISION(0x09000002,=C2=A0 2,=C2=A0 9,=C2=A0 =C2=
=A02,=C2=A0 1,=C2=A0 =C2=A01),=C2=A0 \<br>
=C2=A0 =C2=A0 =C2=A0DEFINE_REVISION(0x09000003,=C2=A0 2,=C2=A0 10,=C2=A0 2,=
=C2=A0 1,=C2=A0 =C2=A01),=C2=A0 \<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
<br>
</blockquote></div>

--000000000000290dbe063cb4484c--


From win-pv-devel-bounces@lists.xenproject.org Tue Aug 19 10:52:24 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Aug 2025 10:52:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1086456.1444642 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoJx0-0005PT-Hr; Tue, 19 Aug 2025 10:52:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1086456.1444642; Tue, 19 Aug 2025 10:52:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoJx0-0005PM-FK; Tue, 19 Aug 2025 10:52:22 +0000
Received: by outflank-mailman (input) for mailman id 1086456;
 Tue, 19 Aug 2025 10:52:21 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=alJ0=27=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1uoJwz-0005PG-3R
 for win-pv-devel@lists.xenproject.org; Tue, 19 Aug 2025 10:52:21 +0000
Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com
 [2a00:1450:4864:20::52e])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 917dae72-7cea-11f0-b898-0df219b8e170;
 Tue, 19 Aug 2025 12:52:15 +0200 (CEST)
Received: by mail-ed1-x52e.google.com with SMTP id
 4fb4d7f45d1cf-618896b3ff9so10039752a12.1
 for <win-pv-devel@lists.xenproject.org>; Tue, 19 Aug 2025 03:52:15 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-61a88ac8e75sm477392a12.30.2025.08.19.03.52.13
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 19 Aug 2025 03:52:13 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 917dae72-7cea-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755600734; x=1756205534; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=6iztuglztIafjuWLfBv3L+LeTnABa3IlWbtN1konpwA=;
        b=R8+Hx3+Igua8WkxVEoTXl5kbPJhEVu4Set7gK7ax/Y6fBKxXGsATeI6h37d3U0d+7G
         kbTb3kiLXsBD32HfQ5Jr6pZ3IGg/QYPTR5ke54VRac/7fOIANAl8p5DV1hE6wXa4+cbm
         ZN8wagyBtJfI6z9OJ09EEkHPRlLg+O2O2wPVc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755600734; x=1756205534;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=6iztuglztIafjuWLfBv3L+LeTnABa3IlWbtN1konpwA=;
        b=o2MPuL6IsWDgrW1fhU79DAZXLegJyTeyXgPsfKZRKMSiHVnrsUCUyZfgkS0AGj6xCX
         /fDo/rpftK0X+Hq7palJiDzJxtQ9vFC8VI8yQhHXGfYbIsU7GWCIHWp9CdpenE4D18K/
         Ai2v+XUKRa9MsLx0EE7jrG2kN3UAIX6xcexSPb7ycM6wDEhkdZ/pnM1vKTl4EcLH8NUl
         kvcrvwCcRBbT9epQoKJofBwvtV2uMD4cqYBxhhXKmMjHcX0yxwbk2k62myz3jZ/BtGgW
         Ze12xHemdI368SaydxP1GhQD7r96Rn357cuJhD3HIil8OsRGCH0ncPnErWkfcpRaKqIl
         RcAw==
X-Gm-Message-State: AOJu0YxeEhhLGRsMIi4xbCcUmWRGx4jfIpm2xam28Irm4tA0HQ9jVfiV
	p44KUT6IaK3JI/Q1PqUmgpeUGg2cjBRmxfBjY9583NWME0il0PaXA3UVnjoBs2EmAGQWeybHqYM
	IbpGWbQ==
X-Gm-Gg: ASbGncsa5m8+ZdAWe+3v2oysPyq/Qe9Oqn/YUQwuN43RFjG4xnudYdCf4MhD1vOHzY5
	qur8giWaIizSogmBq9KhKCLOp4dtGdBHdqifpfyhyvxvHWIUpM/IEENxTDNcueswA2qn4kbjvhl
	QgF/5e8MQYzE3nt1tJUzFuH9MA56YRnYvHkF6N37CueOiPtY2DQ4IjgetmJItEM5ylPkh1Qru7k
	2xG0oeAYg4sW9C3OSFuqShL5dGHpzfVIZP5u8Fo74XnbD+PaadHSEw+VbPi8/WprxhDV8i1HhNf
	ca4Abg1JnmNP0qhEFI91Qya2azb16+vTfbwXn/ud2zfHsuQMVnBW3cG3yL4K7GCO9wPLtoH7+/R
	c4Dy5XzpDbLsEuxbvqx8KkXVpJqKzdyvm6f/Cy3IB7IAvLEl+uudd2w==
X-Google-Smtp-Source: AGHT+IHXiSc1qDp5oiCKmyuYi1zlqbm2dbgs7hT28ikWS8OvO478dFkC9Rgo8K9W6e1Peh+Gmu2Uyw==
X-Received: by 2002:a05:6402:c95:b0:618:65d2:c037 with SMTP id 4fb4d7f45d1cf-61a7e7942f7mr1072738a12.2.1755600734362;
        Tue, 19 Aug 2025 03:52:14 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] Add check for maximum xenstore key lengths
Date: Tue, 19 Aug 2025 11:52:08 +0100
Message-ID: <20250819105208.275-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Fail any xenstore call that exceeds the maximum lengths, as defined
in xs_wire.h

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xenbus/store.c | 159 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 114 insertions(+), 45 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index afb1954..1ce77ed 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -1099,6 +1099,34 @@ RtlCaptureStackBackTrace(
     __out_opt   PULONG  BackTraceHash
     );
 
+static NTSTATUS
+StoreCheckPathLength(
+    __in_opt PSTR           Prefix,
+    __in     PSTR           Node
+    )
+{
+    ULONG                   Length;
+    ULONG                   MaximumLength;
+
+    if (Prefix != NULL) {
+        MaximumLength = Prefix[0] == '/' ?
+                        XENSTORE_ABS_PATH_MAX :
+                        XENSTORE_REL_PATH_MAX;
+        Length = (ULONG)strlen(Prefix) + 1;
+    } else {
+        MaximumLength = Node[0] == '/' ?
+                        XENSTORE_ABS_PATH_MAX :
+                        XENSTORE_REL_PATH_MAX;
+        Length = 0;
+    }
+
+    Length += (ULONG)strlen(Node) + 1;
+
+    return Length > MaximumLength ?
+            STATUS_INVALID_BUFFER_SIZE :
+            STATUS_SUCCESS;
+}
+
 static NTSTATUS
 StoreRead(
     _In_ PINTERFACE                     Interface,
@@ -1116,6 +1144,10 @@ StoreRead(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1145,23 +1177,23 @@ StoreRead(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1170,14 +1202,15 @@ StoreRead(
 
     return STATUS_SUCCESS;
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1195,6 +1228,10 @@ StoreWrite(
     PXENBUS_STORE_RESPONSE              Response;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
@@ -1224,30 +1261,31 @@ StoreWrite(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail3:
+fail4:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1326,6 +1364,10 @@ StorePrintf(
     va_list                             Arguments;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     va_start(Arguments, Format);
     status = StoreVPrintf(Interface,
                             Transaction,
@@ -1336,6 +1378,9 @@ StorePrintf(
     va_end(Arguments);
 
     return status;
+
+fail1:
+    return status;
 }
 
 static NTSTATUS
@@ -1352,6 +1397,10 @@ StoreRemove(
     PXENBUS_STORE_RESPONSE              Response;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
@@ -1379,30 +1428,31 @@ StoreRemove(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail3:
+fail4:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1423,6 +1473,10 @@ StoreDirectory(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1452,27 +1506,27 @@ StoreDirectory(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     status = STATUS_OBJECT_PATH_NOT_FOUND;
     if (Buffer->Length == 0)
-        goto fail5;
+        goto fail6;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1481,17 +1535,18 @@ StoreDirectory(
 
     return STATUS_SUCCESS;
 
-fail5:
+fail6:
     StoreFreePayload(Context, Buffer);
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1672,11 +1727,15 @@ StoreWatchAdd(
     KIRQL                           Irql;
     NTSTATUS                        status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
 
     status = STATUS_NO_MEMORY;
     if (*Watch == NULL)
-        goto fail1;
+        goto fail2;
 
     (*Watch)->Magic = STORE_WATCH_MAGIC;
     (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
@@ -1690,7 +1749,7 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -1736,24 +1795,24 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail3;
+        goto fail4;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail4:
-    Error("fail4\n");
+fail5:
+    Error("fail5\n");
 
     StoreFreeResponse(Response);
 
-fail3:
-    Error("fail3\n");
+fail4:
+    Error("fail4\n");
 
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
@@ -1770,8 +1829,8 @@ fail3:
 
     __StoreFree(Path);
 
-fail2:
-    Error("fail2\n");
+fail3:
+    Error("fail3\n");
 
     (*Watch)->Caller = NULL;
     (*Watch)->Magic = 0;
@@ -1779,6 +1838,9 @@ fail2:
     ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
     __StoreFree(*Watch);
 
+fail2:
+    Error("fail2\n");
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
@@ -2057,11 +2119,15 @@ StorePermissionsSet(
     PSTR                                PermissionString;
     PSTR                                Segment;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
 
     status = STATUS_NO_MEMORY;
     if (PermissionString == NULL)
-        goto fail1;
+        goto fail2;
 
     if (Prefix == NULL)
         Length = (ULONG)strlen(Node) + sizeof (CHAR);
@@ -2071,7 +2137,7 @@ StorePermissionsSet(
     Path = __StoreAllocate(Length);
 
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -2088,7 +2154,7 @@ StorePermissionsSet(
                                          Length,
                                          &Used);
         if (!NT_SUCCESS(status))
-            goto fail3;
+            goto fail4;
 
         Segment += Used;
         Length -= Used;
@@ -2108,17 +2174,17 @@ StorePermissionsSet(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail5;
+        goto fail6;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -2128,9 +2194,12 @@ StorePermissionsSet(
 
     return STATUS_SUCCESS;
 
+fail7:
+    Error("fail7\n");
+    StoreFreeResponse(Response);
+
 fail6:
     Error("fail6\n");
-    StoreFreeResponse(Response);
 
 fail5:
     Error("fail5\n");
@@ -2138,17 +2207,17 @@ fail5:
 fail4:
     Error("fail4\n");
 
+    __StoreFree(Path);
+    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+
 fail3:
     Error("fail3\n");
 
-    __StoreFree(Path);
-    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+    __StoreFree(PermissionString);
 
 fail2:
     Error("fail2\n");
 
-    __StoreFree(PermissionString);
-
 fail1:
     Error("fail1 (%08x)\n", status);
 
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Tue Aug 19 12:00:32 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Aug 2025 12:00:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1086508.1444717 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoL0w-0007Qn-Av; Tue, 19 Aug 2025 12:00:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1086508.1444717; Tue, 19 Aug 2025 12:00:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoL0w-0007Qg-8N; Tue, 19 Aug 2025 12:00:30 +0000
Received: by outflank-mailman (input) for mailman id 1086508;
 Tue, 19 Aug 2025 12:00:28 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=eTwi=27=bounce.vates.tech=bounce-md_30504962.68a46758.v1-81e33afe66484446a04c2d56ce54773a@srs-se1.protection.inumbo.net>)
 id 1uoL0u-0007Qa-3S
 for win-pv-devel@lists.xenproject.org; Tue, 19 Aug 2025 12:00:28 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 1746a8c4-7cf4-11f0-a32a-13f23c93f187;
 Tue, 19 Aug 2025 14:00:26 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c5p7D4l4MzK5vrV7
 for <win-pv-devel@lists.xenproject.org>; Tue, 19 Aug 2025 12:00:24 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 81e33afe66484446a04c2d56ce54773a; Tue, 19 Aug 2025 12:00:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1746a8c4-7cf4-11f0-a32a-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755604824; x=1755874824;
	bh=ELvyNYRED/WESseymjO3yqm6g0RNw3kGD19lCQKf8y0=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=J8kVLXJ99SNC6Dg25/DDdW2wpuuYe3mjZWVt9v0mkaKXJ9MwUPqAH8mpQYnGQmuPS
	 DP8Kk8W8qXFmuvwgCDjDlPq3TkksbnQb8LODQeQMxyaL82asre9OtQEY4X8MRUvAAF
	 kZyRO9Czihqff6D1p7WV9UFvvgJjt/T8xXY3Y/gcqf2IOOJrCdYr2yIwr7gzjdFB2b
	 xEjE7pEEpLrsQQg9cx2kBQDwbCckIdeAGRE3Tst67kXONJ12/Gy9IDJEvXRgQtkq0h
	 AK4sPLoTktIOriJIs51jesCqDHeSzV06jYlglWwtRG0pbbe2uQaoTGX9KjV3omjsB2
	 fGMg4/vK78cIA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755604824; x=1755865324; i=ngoc-tu.dinh@vates.tech;
	bh=ELvyNYRED/WESseymjO3yqm6g0RNw3kGD19lCQKf8y0=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=MIUIu4we66NiZ/0BbZS5rgKQlL7LsZp+0pDoTSJvTNnD8ebEdDuhH6IlqLSHrFtnY
	 pFg7u4Fw8RWFEg58OYdmg5aEPzYnlgR0n6QokU6E8kh7fqEj1La9TRnHLrRmWmibUy
	 VLscoFdvhlroggc1Dkr+rqqOlqOCZovsNx55Ji4UoOS5GuQ7oWHu2dF2zcwmbmLF1t
	 27dcf0VwJROyZ1RMletJFBHI9+EUBOMqjIvHBFvBHyF9PB/MLeHOX1QJ7UFEskfNqi
	 iW5xqyaM7OX1HPEyJw6buF0MrFszDP3V64FR8ZI9GSJdn+9XLc0p90R+PiuRGXlNWf
	 Ngaao27VEZOPA==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Add=20check=20for=20maximum=20xenstore=20key=20lengths?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755604823364
Message-Id: <c69053e9-2cd3-45f2-90e9-ace08f94f49f@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250819105208.275-1-owen.smith@cloud.com>
In-Reply-To: <20250819105208.275-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.81e33afe66484446a04c2d56ce54773a?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250819:md
Date: Tue, 19 Aug 2025 12:00:24 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi,

On 19/08/2025 12:52, Owen Smith wrote:
> Fail any xenstore call that exceeds the maximum lengths, as defined
> in xs_wire.h
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xenbus/store.c | 159 ++++++++++++++++++++++++++++++++-------------
>   1 file changed, 114 insertions(+), 45 deletions(-)
> 
> diff --git a/src/xenbus/store.c b/src/xenbus/store.c
> index afb1954..1ce77ed 100644
> --- a/src/xenbus/store.c
> +++ b/src/xenbus/store.c
> @@ -1099,6 +1099,34 @@ RtlCaptureStackBackTrace(
>       __out_opt   PULONG  BackTraceHash
>       );
>   
> +static NTSTATUS
> +StoreCheckPathLength(
> +    __in_opt PSTR           Prefix,
> +    __in     PSTR           Node
> +    )

Could you replace the annotations with SAL2 ones (_In_, _In_opt_)?

> +{
> +    ULONG                   Length;
> +    ULONG                   MaximumLength;
> +
> +    if (Prefix != NULL) {
> +        MaximumLength = Prefix[0] == '/' ?

If Prefix is an empty string, the resulting path will be of the form 
"/Node". This check should take this case into account and use 
XENSTORE_ABS_PATH_MAX instead.

> +                        XENSTORE_ABS_PATH_MAX :
> +                        XENSTORE_REL_PATH_MAX;
> +        Length = (ULONG)strlen(Prefix) + 1;
> +    } else {
> +        MaximumLength = Node[0] == '/' ?
> +                        XENSTORE_ABS_PATH_MAX :
> +                        XENSTORE_REL_PATH_MAX;
> +        Length = 0;
> +    }
> +
> +    Length += (ULONG)strlen(Node) + 1;

I think you should check for overflow of Length, both due to the 
downcast to ULONG and the addition.

Also, is the +1 necessary here? I don't know if XENSTORE_*_PATH_MAX 
counts the null terminator.

> +
> +    return Length > MaximumLength ?
> +            STATUS_INVALID_BUFFER_SIZE :
> +            STATUS_SUCCESS;
> +}
> +
>   static NTSTATUS
>   StoreRead(
>       _In_ PINTERFACE                     Interface,
> @@ -1116,6 +1144,10 @@ StoreRead(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1145,23 +1177,23 @@ StoreRead(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1170,14 +1202,15 @@ StoreRead(
>   
>       return STATUS_SUCCESS;
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1195,6 +1228,10 @@ StoreWrite(
>       PXENBUS_STORE_RESPONSE              Response;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +

StoreWrite is indirectly called by StoreVPrintf, and eventually 
StorePrintf which already checks for this, so another check here 
shouldn't be necessary. I think checking at the interface boundaries 
should be enough unless the path is further transformed.

>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>   
>       KeAcquireSpinLock(&Context->Lock, &Irql);
> @@ -1224,30 +1261,31 @@ StoreWrite(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail3:
> +fail4:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1326,6 +1364,10 @@ StorePrintf(
>       va_list                             Arguments;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       va_start(Arguments, Format);
>       status = StoreVPrintf(Interface,
>                               Transaction,
> @@ -1336,6 +1378,9 @@ StorePrintf(
>       va_end(Arguments);
>   
>       return status;
> +
> +fail1:
> +    return status;
>   }
>   
>   static NTSTATUS
> @@ -1352,6 +1397,10 @@ StoreRemove(
>       PXENBUS_STORE_RESPONSE              Response;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>   
>       KeAcquireSpinLock(&Context->Lock, &Irql);
> @@ -1379,30 +1428,31 @@ StoreRemove(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail3:
> +fail4:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1423,6 +1473,10 @@ StoreDirectory(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1452,27 +1506,27 @@ StoreDirectory(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       status = STATUS_OBJECT_PATH_NOT_FOUND;
>       if (Buffer->Length == 0)
> -        goto fail5;
> +        goto fail6;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1481,17 +1535,18 @@ StoreDirectory(
>   
>       return STATUS_SUCCESS;
>   
> -fail5:
> +fail6:
>       StoreFreePayload(Context, Buffer);
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1672,11 +1727,15 @@ StoreWatchAdd(
>       KIRQL                           Irql;
>       NTSTATUS                        status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
>   
>       status = STATUS_NO_MEMORY;
>       if (*Watch == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       (*Watch)->Magic = STORE_WATCH_MAGIC;
>       (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
> @@ -1690,7 +1749,7 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -1736,24 +1795,24 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail3;
> +        goto fail4;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail4:
> -    Error("fail4\n");
> +fail5:
> +    Error("fail5\n");
>   
>       StoreFreeResponse(Response);
>   
> -fail3:
> -    Error("fail3\n");
> +fail4:
> +    Error("fail4\n");
>   
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> @@ -1770,8 +1829,8 @@ fail3:
>   
>       __StoreFree(Path);
>   
> -fail2:
> -    Error("fail2\n");
> +fail3:
> +    Error("fail3\n");
>   
>       (*Watch)->Caller = NULL;
>       (*Watch)->Magic = 0;
> @@ -1779,6 +1838,9 @@ fail2:
>       ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
>       __StoreFree(*Watch);
>   
> +fail2:
> +    Error("fail2\n");
> +
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   
> @@ -2057,11 +2119,15 @@ StorePermissionsSet(
>       PSTR                                PermissionString;
>       PSTR                                Segment;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
>   
>       status = STATUS_NO_MEMORY;
>       if (PermissionString == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       if (Prefix == NULL)
>           Length = (ULONG)strlen(Node) + sizeof (CHAR);
> @@ -2071,7 +2137,7 @@ StorePermissionsSet(
>       Path = __StoreAllocate(Length);
>   
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -2088,7 +2154,7 @@ StorePermissionsSet(
>                                            Length,
>                                            &Used);
>           if (!NT_SUCCESS(status))
> -            goto fail3;
> +            goto fail4;
>   
>           Segment += Used;
>           Length -= Used;
> @@ -2108,17 +2174,17 @@ StorePermissionsSet(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail5;
> +        goto fail6;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail6;
> +        goto fail7;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -2128,9 +2194,12 @@ StorePermissionsSet(
>   
>       return STATUS_SUCCESS;
>   
> +fail7:
> +    Error("fail7\n");
> +    StoreFreeResponse(Response);
> +
>   fail6:
>       Error("fail6\n");
> -    StoreFreeResponse(Response);
>   
>   fail5:
>       Error("fail5\n");
> @@ -2138,17 +2207,17 @@ fail5:
>   fail4:
>       Error("fail4\n");
>   
> +    __StoreFree(Path);
> +    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +
>   fail3:
>       Error("fail3\n");
>   
> -    __StoreFree(Path);
> -    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +    __StoreFree(PermissionString);
>   
>   fail2:
>       Error("fail2\n");
>   
> -    __StoreFree(PermissionString);
> -
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:22 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087250.1445331 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevc-0001GT-5e; Wed, 20 Aug 2025 09:16:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087250.1445331; Wed, 20 Aug 2025 09:16:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevc-0001GK-2c; Wed, 20 Aug 2025 09:16:20 +0000
Received: by outflank-mailman (input) for mailman id 1087250;
 Wed, 20 Aug 2025 09:16:18 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=17Z8=3A=bounce.vates.tech=bounce-md_30504962.68a5925d.v1-fe6ccd920dd64adc9bf6ddc5b18f6d39@srs-se1.protection.inumbo.net>)
 id 1uoeva-0001GE-Iq
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:18 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 51f9f129-7da6-11f0-a32a-13f23c93f187;
 Wed, 20 Aug 2025 11:16:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c6LRK3ZT2zK5vshG
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 fe6ccd920dd64adc9bf6ddc5b18f6d39; Wed, 20 Aug 2025 09:16:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 51f9f129-7da6-11f0-a32a-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681373; x=1755951373;
	bh=yCjlJdLxiVD7RIxRkAr55Bajr2J25f8kdEiKy9lUfo4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=s3fBE16ey3JNpZ7S65EdUejIW15PLlA1PK64H7czFhxz219OuDbJhkx43PaLPbKW8
	 Xes4OcG9XcfNl5NTAycCB0xNz9FujmEe3MP2Vx9w2zlPEkoENsfgeJJq1dFVwYMoOQ
	 h4iELWOkzbWIYpKC8YqDDuN7Gh7ZZRvLWA+ix5/iRLjh2P3UpjTDvK5SF/h6lVN0uS
	 2zakt8tqOlU6cklP3lB614+riJRn5EDhjeyLc+Q2qgUHiofE2PSE3DCI55Fcn0z3kO
	 bszmoI3pxnCT6ptHxmgILGFCQgRhkOHqpjNa0h35as6LOML43tC0tk/JqheekMfM+w
	 TiFm4y0GHM0nw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681373; x=1755941873; i=ngoc-tu.dinh@vates.tech;
	bh=yCjlJdLxiVD7RIxRkAr55Bajr2J25f8kdEiKy9lUfo4=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=YDcXqpm+6IYasZMbnz9tpbynp525HSavPeF8iB8+SAKstcirpY+WpbKpUW2iwD6K4
	 Vp0k2ZvvnhhI2hvgHbbwwu+iMg2/zXpbRBGIeiKJIMYErvSwaa9RBx9gTN+ifl16Sw
	 UcJpOElu9wnhdTv8HmLzDUjyHcPyd/3IPW+SZctfxN/jWJ77pi81MxpQSgnv4zx/aX
	 41UAWjpDDkdKVMwgixBXTYgTdSIal79NWetvlea3JWuBNL/tXlTz2LN8L9pNpe1Q8R
	 7KBPzyEDwKgAGLpXoWblSTA8xfriuM6qfhsysSt5PnurYUnDLsrg5fHMhzRz/oONLv
	 GvOk4br79wjhg==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENHID=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681372881
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-3-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.fe6ccd920dd64adc9bf6ddc5b18f6d39?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenhid.inf | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/xenhid.inf b/src/xenhid.inf
index 90efc9a..ee3ced4 100644
--- a/src/xenhid.inf
+++ b/src/xenhid.inf
@@ -53,15 +53,15 @@ xenhid.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenHidName%		=XenHid_Inst,	XENVKBD\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_HID&REV_09000002
-%XenHidName%		=XenHid_Inst,	XENVKBD\VEN_@VENDOR_PREFIX@0001&DEV_HID&REV_09000002
-%XenHidName%		=XenHid_Inst,	XENVKBD\VEN_@VENDOR_PREFIX@0002&DEV_HID&REV_09000002
+%XenHidName%=XenHid_Inst,\
+XENVKBD\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_HID&REV_09000002,\
+XENVKBD\VEN_@VENDOR_PREFIX@0001&DEV_HID&REV_09000002,\
+XENVKBD\VEN_@VENDOR_PREFIX@0002&DEV_HID&REV_09000002
 
 [XenHid_Inst] 
 CopyFiles=XenHid_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenHid_Copyfiles]
 xenhid.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:23 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087251.1445335 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevf-0001I5-7L; Wed, 20 Aug 2025 09:16:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087251.1445335; Wed, 20 Aug 2025 09:16:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevf-0001Hy-3y; Wed, 20 Aug 2025 09:16:23 +0000
Received: by outflank-mailman (input) for mailman id 1087251;
 Wed, 20 Aug 2025 09:16:21 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WsCZ=3A=bounce.vates.tech=bounce-md_30504962.68a5925d.v1-f514159505d043c2b03df33ef796645a@srs-se1.protection.inumbo.net>)
 id 1uoevd-0001HW-Rn
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:21 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 51e61703-7da6-11f0-b898-0df219b8e170;
 Wed, 20 Aug 2025 11:16:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c6LRK2mNvzRKLf23
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 f514159505d043c2b03df33ef796645a; Wed, 20 Aug 2025 09:16:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 51e61703-7da6-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681373; x=1755951373;
	bh=9aJedYHe4Dx/QE/0Nj2nhk3d1KcBs4yU6E5QbC7S57o=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=y6lQh3q1FJbFdaL5mykduEvWAKhViwIPboi6JQd5IRocEc1XxbblXqHh/mOsRLPYS
	 DxYwm88K96YUha+nQtaRPf19gu9wpQFX8K0zYlVVmYAqHEcOrTWwr0+HfPHD/syOIS
	 LpZFTTK24DCSHde8IRHLichbsH9MVI7K+9RRPPnBuOrS6vD6cKckhjAMS1qPZEBU/a
	 8nMVGMn1Oly/Sk6nC6Hs/VYlfHPdzCvG3n1fXPw2lusDfPfZeudXAdu+XhI2LjOzZz
	 CTRtRcnrtTstO248GRjOjkS7sIGVbhHEgJsBoa7yH7vhei1UuSFqlCgp9H33wXSazi
	 BzgOE2Nrjw3Sg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681373; x=1755941873; i=ngoc-tu.dinh@vates.tech;
	bh=9aJedYHe4Dx/QE/0Nj2nhk3d1KcBs4yU6E5QbC7S57o=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=PRWnN2VaPBqk70CR8zS0QjSvVRK7BwsAk+7UqUckuK/8p6kQU20cXe/UDZhYe6Xza
	 NZn1lWcYtKPXxLBGQEIAiUtJIOYUnaa/N26f76liO4MO8XGpY0r48QD+Zk9ECOsLK5
	 51hDNHGH7iMmK7YYhqEMgeSSFj7PRwCZ6IdhI+Ey4AGobbPw9JY+twJuAhK2E+3rn6
	 fs8Fza753KgXEKJArvCbXfy8MEtAAyaTKrChPiG4fSJof1VdnOyLPIzLtjsK0H5rFm
	 TfBBAfV24IA+c29YfgGiGqlkLkoGrFyoaUkbg/r9dGXvogg03Fsj+tfWH7uKHdFwE9
	 on2ZnWDs6qy0w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENCONS=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681372691
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-2-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f514159505d043c2b03df33ef796645a?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xencons.inf | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/xencons.inf b/src/xencons.inf
index 4b0dbde..bae7624 100644
--- a/src/xencons.inf
+++ b/src/xencons.inf
@@ -65,17 +65,17 @@ xencons_tty_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.exe,x
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenConsName%		=XenCons_Inst,	XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_CONS&REV_0900000A
-%XenConsName%		=XenCons_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_CONS&REV_0900000A
-%XenConsName%		=XenCons_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_CONS&REV_0900000A
+%XenConsName%=XenCons_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_CONS&REV_0900000A,\
+XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_CONS&REV_0900000A,\
+XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_CONS&REV_0900000A
 
 [XenCons_Inst]
 CopyFiles=XenCons_Copyfiles
 CopyFiles=Monitor_Copyfiles
 CopyFiles=Tty_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenCons_Copyfiles]
 xencons.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:23 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087252.1445340 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevf-0001IP-BY; Wed, 20 Aug 2025 09:16:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087252.1445340; Wed, 20 Aug 2025 09:16:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevf-0001I9-5K; Wed, 20 Aug 2025 09:16:23 +0000
Received: by outflank-mailman (input) for mailman id 1087252;
 Wed, 20 Aug 2025 09:16:22 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=uWw7=3A=bounce.vates.tech=bounce-md_30504962.68a5925d.v1-47a99a67a02f44e59e6ef08ce4a1b51d@srs-se1.protection.inumbo.net>)
 id 1uoeve-0001HW-2U
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:22 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 545f2285-7da6-11f0-b898-0df219b8e170;
 Wed, 20 Aug 2025 11:16:18 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c6LRK5zhfzK5w3l0
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 47a99a67a02f44e59e6ef08ce4a1b51d; Wed, 20 Aug 2025 09:16:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 545f2285-7da6-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681373; x=1755951373;
	bh=zyhiFUVMejG2gh90qMv1zxPIy40FRg7u669GlYlKRNo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=gv7+URbdPcIIffXZKDIWgZhR9sOflCjrrXtMht8qrGPcMMJgPVKHlLQD9KCy1jchG
	 VgvCV54p1638LVM4NGOQomKQpe9kYGcDcL9DfL47t4N7ZMPB4Sjr1NXwzKt5LFqy/g
	 1EsVGCvkJ+PIdyFPgXx/nPjwU2/sFATKn0qzgNT4IrxIrrb0mFTbQFQsmrmY1JUaBU
	 0nrX2A807Yj3rC1D+++tJJ54I5AYab/d3KPKGZL9GhfIZ6yhzKw/H/0N0ypx9XvsbA
	 474XQRZFIFmbPx2Kmwr12gY8xIMHVyKcYIpHgC8A/IMSyjCIgPO9zzVFi3ka0Je4i4
	 eYhEBCj8FUV1Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681373; x=1755941873; i=ngoc-tu.dinh@vates.tech;
	bh=zyhiFUVMejG2gh90qMv1zxPIy40FRg7u669GlYlKRNo=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=gURugretIdwg9S2MCgr7k/q6X9rpXB+GYdSS7Lfs+L4fcOZMlf8AvVpIfZElQqH8i
	 DWUjn9g7W8s1T/iE/ZELOwT1DxZ8FILQbum0OHN0ScgoT3wZx9rZixIAwI8th7Tyw+
	 cuuhENea0RutMztHsiBTQDW8M2t4fNxc8/Bvtj2V55Vd3TRZVe5/52ewJk4kUIX8Sj
	 krixXCU8rd9WaHeShiMAc2Zxxorn7oQ6Zi/0DTl4B3/pkB6teLH8i7ri/+80UosaXG
	 BSc1/Zd2rDiU0aTQHMt811GLrJmrRmT2rqf5s6aiC8VDF/ib830sZxuzwBmmcZ1Dc5
	 /pZ3L4EN7/JGw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENNET=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681373076
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-4-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.47a99a67a02f44e59e6ef08ce4a1b51d?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xennet.inf | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/xennet.inf b/src/xennet.inf
index b684219..1f6f182 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -55,12 +55,10 @@ xennet.sys
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenNetName%		=XenNet_Inst,	XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_09000005
-%XenNetName%		=XenNet_Inst,	XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_09000005
-%XenNetName%		=XenNet_Inst,	XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_09000005
+%XenNetName%=XenNet_Inst,\
+XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_09000005,\
+XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_09000005,\
+XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_09000005
 
 [XenNet_Inst] 
 Characteristics=0x84
@@ -70,6 +68,8 @@ BusType=1
 *PhysicalMediaType=14	; NdisPhysicalMedium802_3
 CopyFiles=XenNet_Copyfiles
 AddReg=Xennet_Inst_AddReg
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenNet_Inst_AddReg] 
 HKR, Ndi, Service, 0, "xennet"
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:24 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087253.1445342 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevg-0001L2-AU; Wed, 20 Aug 2025 09:16:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087253.1445342; Wed, 20 Aug 2025 09:16:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevg-0001Kv-7t; Wed, 20 Aug 2025 09:16:24 +0000
Received: by outflank-mailman (input) for mailman id 1087253;
 Wed, 20 Aug 2025 09:16:22 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rPiI=3A=bounce.vates.tech=bounce-md_30504962.68a5925e.v1-66b45204d7a04663a617a52c48d5ce25@srs-se1.protection.inumbo.net>)
 id 1uoeve-0001HW-SE
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:22 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 55cfbeae-7da6-11f0-b898-0df219b8e170;
 Wed, 20 Aug 2025 11:16:20 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c6LRL0YG9zK5vsHB
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:14 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 66b45204d7a04663a617a52c48d5ce25; Wed, 20 Aug 2025 09:16:14 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 55cfbeae-7da6-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681374; x=1755951374;
	bh=Gxm2kO82oEO+wd1U2wMTefwQif3bo+K7UA1h0zs0pIQ=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=E/jpt0w/nLEk0a0BKI31L+hcox/MkOLaP/Xx5+NVz5rmnIumUENEhFYwzlzLTwddg
	 kq0oPIR5oxfdHBnPYnAjIBalxZ/l0knyQdjwinE3MHqjHWH88rDDsun73OyvgFRA6C
	 LDH1myjbIL+3TD8LPEmXt1omfYdJB6gUOIpM1KT1uaWlk+bE/Se0kn8nh/+TAgOnie
	 1HdH7OGYUgzWkP3Y7Vl6zGoOsECNpOjW3NwFd+o1oBRnm2bAH3eJfO6znC0l0pjuX7
	 l3hKyw2Uvv7CNwcRormZv35FOu8YKfYKHJvIfXmkTaudxhRYZOtjCAjR9+SNT3b9l/
	 0vCgW6Lgqvuaw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681374; x=1755941874; i=ngoc-tu.dinh@vates.tech;
	bh=Gxm2kO82oEO+wd1U2wMTefwQif3bo+K7UA1h0zs0pIQ=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=o+slLg+uQ5dn/EskmvzZ1B/zcVFe7PEWD0eYRhSIjIroblr2mvo2b7PISdhpZXkeR
	 caNVvXTJvTIqO05EQ4NBckWajeUAwkY8w2JwTgbzEle9VrwEJYH4W9BNRBrN/kZs6d
	 ronE2w7K/LllK5Sfa1TPNdWXmkuy3QnZYvYpjA/raVNZgRODqtejIUK+K0cDjGOiqd
	 aBNKKD+88A75s1jcPSQTuIsg+vQIGxLGUlnax/17IUoYXXJRXW6Ywp5wGCSzl9aQqm
	 7n/uURCY2VTqQEQgm/xg3OS8ebzLBTMNwgEg/SZ9mnU78JtK5CXRZYdC+OiOHvGW41
	 lqzxSZqAHMZeQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVKBD=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681373463
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.66b45204d7a04663a617a52c48d5ce25?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:14 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvkbd.inf | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/xenvkbd.inf b/src/xenvkbd.inf
index f7d3b18..33caa5f 100644
--- a/src/xenvkbd.inf
+++ b/src/xenvkbd.inf
@@ -53,15 +53,15 @@ xenvkbd.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenVkbdName%		=XenVkbd_Inst,	XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VKBD&REV_0900000A
-%XenVkbdName%		=XenVkbd_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VKBD&REV_0900000A
-%XenVkbdName%		=XenVkbd_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VKBD&REV_0900000A
+%XenVkbdName%=XenVkbd_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VKBD&REV_0900000A,\
+XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VKBD&REV_0900000A,\
+XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VKBD&REV_0900000A
 
 [XenVkbd_Inst] 
 CopyFiles=XenVkbd_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenVkbd_Copyfiles]
 xenvkbd.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087254.1445347 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevl-0001Nx-CY; Wed, 20 Aug 2025 09:16:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087254.1445347; Wed, 20 Aug 2025 09:16:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevl-0001Nq-9L; Wed, 20 Aug 2025 09:16:29 +0000
Received: by outflank-mailman (input) for mailman id 1087254;
 Wed, 20 Aug 2025 09:16:27 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iYCM=3A=bounce.vates.tech=bounce-md_30504962.68a5925d.v1-737455eaafe745288226ed6c7935c2b1@srs-se1.protection.inumbo.net>)
 id 1uoevj-0001HW-MU
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:27 +0000
Received: from mail180-17.suw31.mandrillapp.com
 (mail180-17.suw31.mandrillapp.com [198.2.180.17])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 51f594d6-7da6-11f0-b898-0df219b8e170;
 Wed, 20 Aug 2025 11:16:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-17.suw31.mandrillapp.com (Mailchimp) with ESMTP id
 4c6LRK6phfzRKLdv8
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 737455eaafe745288226ed6c7935c2b1; Wed, 20 Aug 2025 09:16:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 51f594d6-7da6-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681374; x=1755951374;
	bh=LJINW1txXSbajF1cEYVZuP+/NwHiC/qV8pKHVmPaL4Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=oWy3ooy3T+eVrPtWVHBq0PTLNz6aR5c0FmTsNPIwdD0uik3MoQSyblHhxoALwu9f9
	 sTeNjcLUcGJAeh1LsvYc1hghsDDC/qiKnCHyHv4oPPoR65zDcxgwo1g2sAjFhLa9iN
	 CFFhXnHmD1M4t4+Hg7hXpqeRPN/quWFKgc0J7t3+KFPG3D9ckzdHNGNynWSpCIG1jl
	 t8tXsUddkIkgwPl07hjyH8iKaE+CKO1I/nl6z60Whmspt8C2yvaDDJFJt1aFgWR3En
	 oSwKjwKC9uKp8HP8+2pPGLZKbH1EhxFQX/YoEJQpPss2ezUaOBsZ7kEsJZI8baPiet
	 KgjKLQaNGvVCw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681373; x=1755941873; i=ngoc-tu.dinh@vates.tech;
	bh=LJINW1txXSbajF1cEYVZuP+/NwHiC/qV8pKHVmPaL4Y=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=jalCMBxQCWPoMj86EXLmqi65+ZBayrvfywct4HKFWiNqRJX5f3irr1hcauer8Tmzw
	 JL3NYnbP8aoG+xKwHnE98T82K/M7xOnvzHyGUNaq9GCanLPyVPBrOY2LKfcgMeG38e
	 VTdn4hzDsHhV1YmdT8vSJ0EBleQclbzvKN/TaobJvvhjbJuvPCN0UZxbgxjhdLAYuK
	 U5D6Asl0WOEWg6ItbKvAQl7QhzkO9WumRUjPWS6wpP4vzeenJc76cQFnO0pshM/ioq
	 YZywEawJ80aHK8Ry+K2BesAUyeLndv3qp/UMd6ZooEHAZEw6ChMEd/2OyDWx3BX9iZ
	 yUGtHkkE+CpAQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681373277
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-5-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.737455eaafe745288226ed6c7935c2b1?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif.inf | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/xenvif.inf b/src/xenvif.inf
index 0430f04..a5abe4e 100644
--- a/src/xenvif.inf
+++ b/src/xenvif.inf
@@ -53,15 +53,15 @@ xenvif.sys=0,,
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName		Section		DeviceID
-; -----------		-------		--------
-
-%XenVifName%		=XenVif_Inst,	XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_0900000B
-%XenVifName%		=XenVif_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_0900000B
-%XenVifName%		=XenVif_Inst,	XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_0900000B
+%XenVifName%=XenVif_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_0900000B
 
 [XenVif_Inst] 
 CopyFiles=XenVif_Copyfiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenVif_Copyfiles]
 xenvif.sys
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 09:16:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 09:16:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087255.1445353 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevl-0001OF-Gj; Wed, 20 Aug 2025 09:16:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087255.1445353; Wed, 20 Aug 2025 09:16:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uoevl-0001O3-AU; Wed, 20 Aug 2025 09:16:29 +0000
Received: by outflank-mailman (input) for mailman id 1087255;
 Wed, 20 Aug 2025 09:16:28 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UG1p=3A=bounce.vates.tech=bounce-md_30504962.68a5925d.v1-d99c4ad109cc422caeea4f525d5f4c37@srs-se1.protection.inumbo.net>)
 id 1uoevk-0001GE-NB
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 09:16:28 +0000
Received: from mail180-9.suw31.mandrillapp.com
 (mail180-9.suw31.mandrillapp.com [198.2.180.9])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 51e41a03-7da6-11f0-a32a-13f23c93f187;
 Wed, 20 Aug 2025 11:16:15 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-9.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4c6LRK1VPszK5xtSl
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 09:16:13 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d99c4ad109cc422caeea4f525d5f4c37; Wed, 20 Aug 2025 09:16:13 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 51e41a03-7da6-11f0-a32a-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755681373; x=1755951373;
	bh=mfxtkVL1vzmoCkwcAzdOLNUUYhQvl18vYNZyNIPY4uU=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=kgSZVzHMHm4VwoUbXTzheGcwQqprg1rFvcUSCwYzJz5cW0X0ipS2MUGyS1AJC1s/I
	 4bxiCgqpAatwIj6JBMKJ8abCG/e41wKvkv1KcjcWgygVqyhA2pPOTIM/R+qBEi2dVm
	 OZgnzLd29haWAxODAu5EDDHKKnwof4noRLcPzU5XhLEytW9H18Eu/Dn0nVePOlNHXd
	 /cJ/ZAZKoiAZw5+tEOHt+AYsApgSRav9VCRkjoT5uak4GYLZodwS4C9xaE0ApcENni
	 ts5HZIFtlQKucfuFhVHEaSImWLU/qU/mDHlSfpDqlbEme2ij8TqX+a5pAV2ufyrIL+
	 ulpxtsurmkq3Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755681373; x=1755941873; i=ngoc-tu.dinh@vates.tech;
	bh=mfxtkVL1vzmoCkwcAzdOLNUUYhQvl18vYNZyNIPY4uU=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=hqYeS1cXCeQzDIhJ08z6brjFuStZ6Euy797EZ0vMtfYx6Rruj1LZqSGiCbWwzdXes
	 +VDN4yGNPEyUCkN2KmuBERAZdf8Ofau0luqkukpsGefHoc26WWB0yS3P1kyHap0cfm
	 xstO2ctmgITMasZYSoVeBH8cc1UQCSBvL7evHmEN9gtTvUGLclFGgU8datJd9PDWJD
	 Qyv6O9GEaOdWQTXFECVnjgPvl9tzdBil6ygaL/pHiAhpH6pPNw1/IvaUs+Q9PBXL/O
	 SHYQumzOjMzsgNa3z6aZRJRV6jZqHk4AmRYaLGiTnLlB+jUPbYpXESrZZrrs5jRovS
	 gjIcSrpUlPh+A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENIFACE=20PATCH]=20Merge=20all=20hardware=20IDs=20into=20one=20Models=20entry?=
X-Mailer: git-send-email 2.50.1.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755681372241
To: win-pv-devel@lists.xenproject.org
Cc: "Owen Smith" <owen.smith@cloud.com>, "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Message-Id: <20250820091559.95-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d99c4ad109cc422caeea4f525d5f4c37?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250820:md
Date: Wed, 20 Aug 2025 09:16:13 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This makes sure that on driver installation, all supported hardware IDs
will be populated into the driver database, thus allowing the device ID
to be freely switched.

Bump the feature score to compensate for the resulting degradation of
identifier-match-type score.

Unlike Xenbus, the feature score bump can be reverted on next PDO
revision bump.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xeniface.inf | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/xeniface.inf b/src/xeniface.inf
index 07e2a91..142f5a5 100644
--- a/src/xeniface.inf
+++ b/src/xeniface.inf
@@ -62,15 +62,16 @@ xenagent_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll,xena
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-; DisplayName       Section        DeviceID
-; -----------       -------        --------
-%XenIfaceName% =    XenIface_Inst, XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_IFACE&REV_0900000B
-%XenIfaceName% =    XenIface_Inst, XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_IFACE&REV_0900000B
-%XenIfaceName% =    XenIface_Inst, XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_IFACE&REV_0900000B
+%XenIfaceName%=XenIface_Inst,\
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_IFACE&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_IFACE&REV_0900000B,\
+XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_IFACE&REV_0900000B
 
 [XenIface_Inst]
 CopyFiles=XenIface_CopyFiles
 CopyFiles=XenAgent_CopyFiles
+; TODO: Remove during next PDO version bump
+FeatureScore=0xFE
 
 [XenIface_Inst.WMI]
 WMIInterface={1D80EB99-A1D6-4492-B62F-8B4549FF0B5E},,XenIface_Inst.WMI.Security
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 20 15:04:02 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 20 Aug 2025 15:04:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1087511.1445534 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uokM4-0002QN-88; Wed, 20 Aug 2025 15:04:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1087511.1445534; Wed, 20 Aug 2025 15:04:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1uokM4-0002QF-5U; Wed, 20 Aug 2025 15:04:00 +0000
Received: by outflank-mailman (input) for mailman id 1087511;
 Wed, 20 Aug 2025 15:03:59 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PJ8M=3A=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1uokM3-0002Q7-2Y
 for win-pv-devel@lists.xenproject.org; Wed, 20 Aug 2025 15:03:59 +0000
Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com
 [2607:f8b0:4864:20::530])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id e21105fd-7dd6-11f0-b898-0df219b8e170;
 Wed, 20 Aug 2025 17:03:52 +0200 (CEST)
Received: by mail-pg1-x530.google.com with SMTP id
 41be03b00d2f7-b47475cf8ecso2285304a12.0
 for <win-pv-devel@lists.xenproject.org>; Wed, 20 Aug 2025 08:03:52 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e21105fd-7dd6-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755702231; x=1756307031; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=HM9YqvY3urywHk2J0/l7MI9H/jgI27fMH9e3AL3Qru4=;
        b=NKc0spMoQDeI5rnqhXKxXDONfK6T0h38DQUkOP0K0adsbIHgTFoxR7wI5BOYJhQBQT
         U2XQGZiayVgwAc4fHQ55a61NB8vlUh3OqdJVMsMraSwIbhkw7Up7iCcKY5tg6uKlvWzQ
         5nOxekmK6y7wZ6pCOfm5ESx4tg2QlpEpHq8es=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755702231; x=1756307031;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=HM9YqvY3urywHk2J0/l7MI9H/jgI27fMH9e3AL3Qru4=;
        b=QJZB9zkzBMR9EMb+1DC96CvfbIRd1+bBSyXpH9t6wRQwCiqzpJEcojtZeX4F9E5Fmr
         byNCF3K44lNE6qUdIGvAlbeLNRYp/z2ON5Z4SHY3nCTx9ON5QhH3OfZRp8FpSOOJuZ/I
         LFl5wD2Vi9Cww3pB8iMostbckUmEJE1km+JPc4DW3xmmg7lUvrZ0vL/UcgvLHY4IO4eT
         hha8zlSy+NVyy9tcvC33FboIlYUoMYjwJ1Ma/KmkQbsj+o/8LD00Bjb6z6k/FjZ84CDv
         2LRb0QUrsP8UYklFEkiertJAtfRa/vdpHMLX5+IEMm/34yiQXyk6uT6TaJ51ZE12l8vC
         zk8g==
X-Gm-Message-State: AOJu0YxoAGUTnmrQX4hYWauMkD3IqQJDXgxUHyIoyrUxyd5Twx9P38/e
	ZkhcvHD1NghOWmOzwO029cmGgspUTi3uEQ2RuH/YZ9GHZ6ETiKWwy7/m8i4OHm3o6TNjU+dgD0p
	0EVqYbSHUv7noydX7W0EMTmmyg/SUTAWj64bt54VNlDVrlHhtUDE=
X-Gm-Gg: ASbGncsGFNNY4UwNZvwi5qhD84bTMkieCUU9AlcB+aJKuMr0rgHbuSnEb402e8IcD9N
	VHKeMfDx3f948ozMGCeZqvbGiKXt3HPXsVPnUWpfJwWan06AhfojrI7Q42kotaCYqonH5vIEGKc
	+pShilCGMSrzSCZYQjP823503haQ1WZVNFJW267+mj3jvrfQ+Y9zQov0iLjndQ6mV63I8VSqNPP
	qb4/Nk=
X-Google-Smtp-Source: AGHT+IEZsN6uMyejdeIuSybsedKgkk+XPwiIyiXSc9xHU0hxe3xnNBO0viVRUr8PLCEiiWGO6HtAW89H+wJQK7M1kvY=
X-Received: by 2002:a17:902:da88:b0:240:99f7:6c10 with SMTP id
 d9443c01a7336-245ef0c99a2mr47799475ad.1.1755702229505; Wed, 20 Aug 2025
 08:03:49 -0700 (PDT)
MIME-Version: 1.0
References: <20250820091559.95-1-ngoc-tu.dinh@vates.tech> <20250820091559.95-6-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250820091559.95-6-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Wed, 20 Aug 2025 16:03:38 +0100
X-Gm-Features: Ac12FXyJ_czZAiloaoEzrphvCSYY2UprB9D95IJJcigvrh-Xj8lkiKegM-f3NcI
Message-ID: <CAC_UY8_GOEGt=fEaD8_rBHp8jxxNBK=PyzLm-LQ5Y00SO3gV2g@mail.gmail.com>
Subject: Re: [XENVKBD PATCH] Merge all hardware IDs into one Models entry
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000b8bf59063ccd471f"

--000000000000b8bf59063ccd471f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

All patches in this series
Reviewed-by: Owen Smith <owen.smith@cloud.com>


On Wed, Aug 20, 2025 at 10:16=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> =
wrote:

> This makes sure that on driver installation, all supported hardware IDs
> will be populated into the driver database, thus allowing the device ID
> to be freely switched.
>
> Bump the feature score to compensate for the resulting degradation of
> identifier-match-type score.
>
> Unlike Xenbus, the feature score bump can be reverted on next PDO
> revision bump.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  src/xenvkbd.inf | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/xenvkbd.inf b/src/xenvkbd.inf
> index f7d3b18..33caa5f 100644
> --- a/src/xenvkbd.inf
> +++ b/src/xenvkbd.inf
> @@ -53,15 +53,15 @@ xenvkbd.sys=3D0,,
>  %Vendor%=3DInst,NT@INF_ARCH@
>
>  [Inst.NT@INF_ARCH@]
> -; DisplayName          Section         DeviceID
> -; -----------          -------         --------
> -
> -%XenVkbdName%          =3DXenVkbd_Inst,  XENBUS\VEN_@VENDOR_PREFIX
> @@VENDOR_DEVICE_ID@&DEV_VKBD&REV_0900000A
> -%XenVkbdName%          =3DXenVkbd_Inst,  XENBUS\VEN_@VENDOR_PREFIX
> @0001&DEV_VKBD&REV_0900000A
> -%XenVkbdName%          =3DXenVkbd_Inst,  XENBUS\VEN_@VENDOR_PREFIX
> @0002&DEV_VKBD&REV_0900000A
> +%XenVkbdName%=3DXenVkbd_Inst,\
> +XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VKBD&REV_0900000A,\
> +XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VKBD&REV_0900000A,\
> +XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VKBD&REV_0900000A
>
>  [XenVkbd_Inst]
>  CopyFiles=3DXenVkbd_Copyfiles
> +; TODO: Remove during next PDO version bump
> +FeatureScore=3D0xFE
>
>  [XenVkbd_Copyfiles]
>  xenvkbd.sys
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--000000000000b8bf59063ccd471f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">All patches in this series</div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smi=
th@cloud.com">owen.smith@cloud.com</a>&gt;</div><div class=3D"gmail_default=
" style=3D"font-family:monospace"><br></div></div><br><div class=3D"gmail_q=
uote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, A=
ug 20, 2025 at 10:16=E2=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This makes s=
ure that on driver installation, all supported hardware IDs<br>
will be populated into the driver database, thus allowing the device ID<br>
to be freely switched.<br>
<br>
Bump the feature score to compensate for the resulting degradation of<br>
identifier-match-type score.<br>
<br>
Unlike Xenbus, the feature score bump can be reverted on next PDO<br>
revision bump.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0src/xenvkbd.inf | 12 ++++++------<br>
=C2=A01 file changed, 6 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/xenvkbd.inf b/src/xenvkbd.inf<br>
index f7d3b18..33caa5f 100644<br>
--- a/src/xenvkbd.inf<br>
+++ b/src/xenvkbd.inf<br>
@@ -53,15 +53,15 @@ xenvkbd.sys=3D0,,<br>
=C2=A0%Vendor%=3DInst,NT@INF_ARCH@<br>
<br>
=C2=A0[Inst.NT@INF_ARCH@]<br>
-; DisplayName=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Section=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0DeviceID<br>
-; -----------=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -------=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0--------<br>
-<br>
-%XenVkbdName%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3DXenVkbd_Inst,=C2=A0 XEN=
BUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&amp;DEV_VKBD&amp;REV_0900000A<br>
-%XenVkbdName%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3DXenVkbd_Inst,=C2=A0 XEN=
BUS\VEN_@VENDOR_PREFIX@0001&amp;DEV_VKBD&amp;REV_0900000A<br>
-%XenVkbdName%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3DXenVkbd_Inst,=C2=A0 XEN=
BUS\VEN_@VENDOR_PREFIX@0002&amp;DEV_VKBD&amp;REV_0900000A<br>
+%XenVkbdName%=3DXenVkbd_Inst,\<br>
+XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&amp;DEV_VKBD&amp;REV_0900000A=
,\<br>
+XENBUS\VEN_@VENDOR_PREFIX@0001&amp;DEV_VKBD&amp;REV_0900000A,\<br>
+XENBUS\VEN_@VENDOR_PREFIX@0002&amp;DEV_VKBD&amp;REV_0900000A<br>
<br>
=C2=A0[XenVkbd_Inst] <br>
=C2=A0CopyFiles=3DXenVkbd_Copyfiles<br>
+; TODO: Remove during next PDO version bump<br>
+FeatureScore=3D0xFE<br>
<br>
=C2=A0[XenVkbd_Copyfiles]<br>
=C2=A0xenvkbd.sys<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
<br>
</blockquote></div>

--000000000000b8bf59063ccd471f--


From win-pv-devel-bounces@lists.xenproject.org Thu Aug 21 09:59:49 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 21 Aug 2025 09:59:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1088337.1446090 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1up25D-0006XQ-Oq; Thu, 21 Aug 2025 09:59:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1088337.1446090; Thu, 21 Aug 2025 09:59:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1up25D-0006XJ-MI; Thu, 21 Aug 2025 09:59:47 +0000
Received: by outflank-mailman (input) for mailman id 1088337;
 Thu, 21 Aug 2025 09:59:47 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1Hha=3B=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1up25D-0006XD-31
 for win-pv-devel@lists.xenproject.org; Thu, 21 Aug 2025 09:59:47 +0000
Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com
 [2a00:1450:4864:20::532])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 8fe9d525-7e75-11f0-b898-0df219b8e170;
 Thu, 21 Aug 2025 11:59:44 +0200 (CEST)
Received: by mail-ed1-x532.google.com with SMTP id
 4fb4d7f45d1cf-61a2a5b0689so1397287a12.1
 for <win-pv-devel@lists.xenproject.org>; Thu, 21 Aug 2025 02:59:44 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-afded30bee8sm357954066b.33.2025.08.21.02.59.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 21 Aug 2025 02:59:42 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8fe9d525-7e75-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755770383; x=1756375183; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=E+o/JtBNX0OVCI9GE0AeFcfHDGBqSPxhutAv+d8HYdU=;
        b=cL5GiAXE+6al5hjX2Kit1bhahTq9lWEjJKKZT0LDkoRsHzgqG/o3Gvf8J6MkwXlyHK
         LPqAYYmCuQw6LqS+vFd2dALmPHnCW3Gs2CNPG5ieRmq9N8Se82rnI/Oc9C7Vmp1GWjXm
         5Lbv9JFYh0GSjtt17dw/XEjNRVGg4MXU33WJE=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755770383; x=1756375183;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=E+o/JtBNX0OVCI9GE0AeFcfHDGBqSPxhutAv+d8HYdU=;
        b=DMLY9jl17/rtkIxRyAV1QoK8bcQubbl2DOhBXuG6pCQPC6eWns+SY3YA33c6Ufyz3c
         iDBWG1yP0TsyMetsfQNKi/q+Skyc29D0soPUxrYL3yPiJNH216HlwqY995FEOyFq4DkL
         Odg4ATS5c+g5Ic6i48+0zbPU/xGRuzqG8ZF0iogmhdC9uVScpgU+KtXrkPGWVoYPKmvb
         rV5lDc77tvmP980nbi1DyjknWj2SRg4jH1zLn8sbFiQZRISQFNaC99V1cmptwn69wlcq
         Z8ahJogAcvc77cwEhPAI4DMgTeL8/YMAP/84gepeZXZVJLDFLf3WoJOAJN4voMVV+qhs
         0pfQ==
X-Gm-Message-State: AOJu0YzmEe4G8IMm4FqeAG7hYeBjooVPoeN8pM/PyT1a9KhvGrocWNvI
	iOzws0v7uYD91TJTDarEhbhW+xBOYOMT507X9v50+C2R/KlXv/OFn+Ywbcit3dLMZsKxuM0vSVC
	WNN0=
X-Gm-Gg: ASbGncuVcKe4hiGZJnI8Nj3Nir4vwU8cbKQpiHy0TEDGP4QOT9T5Sya716lLdO8d8ij
	U2uAcQLtqk0zztjK6BK5k4D1riiTkl+9SjJ4DS2ITsIxPKUyH4v8kMVK0+Mv3cfpDqFaF/FCnns
	O0RN/CWU5f7QNbOo/vi7D3NuYGbnan5RLc5sBcQWGlSwZRBwp8ZZmDlira1FdlRUMV9HSxUmXqH
	LKFjJEiNEq7VY8Tdsh1bWpp8zzvVSK4c6ORCooDzjvcwTReLV5TaDZ6NMuzR21rcso8vP2Ee8mx
	lolIk7XCJo41ueTpeluAz4LabltCOwJVAGaDIwLQqwQzUAkrceu8GB349ICbCjMYdSN2yBqGyzc
	/PHU906FojovFEj/tHAfenxjzb/Pb751zRtE1CpjvBROE4O4SQa2hWug=
X-Google-Smtp-Source: AGHT+IHfmhkwR+JISAl2OPKwcYJBeaWFs/aFWKR1JIH3pnZvhZh4d2DqI28b71RKc7xeJMMpXqx2Gg==
X-Received: by 2002:a17:907:3d90:b0:af2:4769:8917 with SMTP id a640c23a62f3a-afe07b3671emr186244466b.37.1755770382833;
        Thu, 21 Aug 2025 02:59:42 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] Add check for maximum xenstore key lengths
Date: Thu, 21 Aug 2025 10:59:36 +0100
Message-ID: <20250821095936.803-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Check any xenstore path lengths before calling into xenstore, in order
to fail without passing control to xenstored, which should fail any request
with paths exceeding the defined maximum length.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xenbus/store.c | 149 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 108 insertions(+), 41 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index afb1954..0c00d23 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -1099,6 +1099,37 @@ RtlCaptureStackBackTrace(
     __out_opt   PULONG  BackTraceHash
     );
 
+static NTSTATUS
+StoreCheckPathLength(
+    _In_opt_ PSTR   Prefix,
+    _In_ PSTR       Node
+    )
+{
+    size_t          Length;
+    size_t          MaximumLength;
+
+    Length = Prefix == NULL ? 0 : strlen(Prefix);
+
+    if (Length == 0) {
+        // Prefix is NULL or empty
+        MaximumLength = Node[0] == '/' ?
+                            XENSTORE_ABS_PATH_MAX :
+                            XENSTORE_REL_PATH_MAX;
+
+        Length = strlen(Node) + 1;
+    } else {
+        MaximumLength = Prefix[0] == '/' ?
+                            XENSTORE_ABS_PATH_MAX :
+                            XENSTORE_REL_PATH_MAX;
+
+        Length += 1 + strlen(Node) + 1;
+    }
+
+    return Length > MaximumLength ?
+                STATUS_INVALID_BUFFER_SIZE :
+                STATUS_SUCCESS;
+}
+
 static NTSTATUS
 StoreRead(
     _In_ PINTERFACE                     Interface,
@@ -1116,6 +1147,10 @@ StoreRead(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1145,23 +1180,23 @@ StoreRead(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1170,14 +1205,15 @@ StoreRead(
 
     return STATUS_SUCCESS;
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1245,9 +1281,9 @@ fail3:
     StoreFreeResponse(Response);
 
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1326,6 +1362,10 @@ StorePrintf(
     va_list                             Arguments;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     va_start(Arguments, Format);
     status = StoreVPrintf(Interface,
                             Transaction,
@@ -1336,6 +1376,9 @@ StorePrintf(
     va_end(Arguments);
 
     return status;
+
+fail1:
+    return status;
 }
 
 static NTSTATUS
@@ -1352,6 +1395,10 @@ StoreRemove(
     PXENBUS_STORE_RESPONSE              Response;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
@@ -1379,30 +1426,31 @@ StoreRemove(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail3:
+fail4:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1423,6 +1471,10 @@ StoreDirectory(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1452,27 +1504,27 @@ StoreDirectory(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     status = STATUS_OBJECT_PATH_NOT_FOUND;
     if (Buffer->Length == 0)
-        goto fail5;
+        goto fail6;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1481,17 +1533,18 @@ StoreDirectory(
 
     return STATUS_SUCCESS;
 
-fail5:
+fail6:
     StoreFreePayload(Context, Buffer);
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1672,11 +1725,15 @@ StoreWatchAdd(
     KIRQL                           Irql;
     NTSTATUS                        status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
 
     status = STATUS_NO_MEMORY;
     if (*Watch == NULL)
-        goto fail1;
+        goto fail2;
 
     (*Watch)->Magic = STORE_WATCH_MAGIC;
     (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
@@ -1690,7 +1747,7 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -1736,24 +1793,24 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail3;
+        goto fail4;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail4:
-    Error("fail4\n");
+fail5:
+    Error("fail5\n");
 
     StoreFreeResponse(Response);
 
-fail3:
-    Error("fail3\n");
+fail4:
+    Error("fail4\n");
 
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
@@ -1770,8 +1827,8 @@ fail3:
 
     __StoreFree(Path);
 
-fail2:
-    Error("fail2\n");
+fail3:
+    Error("fail3\n");
 
     (*Watch)->Caller = NULL;
     (*Watch)->Magic = 0;
@@ -1779,6 +1836,9 @@ fail2:
     ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
     __StoreFree(*Watch);
 
+fail2:
+    Error("fail2\n");
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
@@ -2057,11 +2117,15 @@ StorePermissionsSet(
     PSTR                                PermissionString;
     PSTR                                Segment;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
 
     status = STATUS_NO_MEMORY;
     if (PermissionString == NULL)
-        goto fail1;
+        goto fail2;
 
     if (Prefix == NULL)
         Length = (ULONG)strlen(Node) + sizeof (CHAR);
@@ -2071,7 +2135,7 @@ StorePermissionsSet(
     Path = __StoreAllocate(Length);
 
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -2088,7 +2152,7 @@ StorePermissionsSet(
                                          Length,
                                          &Used);
         if (!NT_SUCCESS(status))
-            goto fail3;
+            goto fail4;
 
         Segment += Used;
         Length -= Used;
@@ -2108,17 +2172,17 @@ StorePermissionsSet(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail5;
+        goto fail6;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -2128,9 +2192,12 @@ StorePermissionsSet(
 
     return STATUS_SUCCESS;
 
+fail7:
+    Error("fail7\n");
+    StoreFreeResponse(Response);
+
 fail6:
     Error("fail6\n");
-    StoreFreeResponse(Response);
 
 fail5:
     Error("fail5\n");
@@ -2138,17 +2205,17 @@ fail5:
 fail4:
     Error("fail4\n");
 
+    __StoreFree(Path);
+    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+
 fail3:
     Error("fail3\n");
 
-    __StoreFree(Path);
-    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+    __StoreFree(PermissionString);
 
 fail2:
     Error("fail2\n");
 
-    __StoreFree(PermissionString);
-
 fail1:
     Error("fail1 (%08x)\n", status);
 
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 21 19:56:51 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 21 Aug 2025 19:56:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1089239.1446881 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upBOz-00063z-9V; Thu, 21 Aug 2025 19:56:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1089239.1446881; Thu, 21 Aug 2025 19:56:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upBOz-00063q-6W; Thu, 21 Aug 2025 19:56:49 +0000
Received: by outflank-mailman (input) for mailman id 1089239;
 Thu, 21 Aug 2025 19:56:48 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tvGU=3B=bounce.vates.tech=bounce-md_30504962.68a779fa.v1-c78c4d1682e34dceb11b8dbf28ceb0d2@srs-se1.protection.inumbo.net>)
 id 1upBOx-00063k-TV
 for win-pv-devel@lists.xenproject.org; Thu, 21 Aug 2025 19:56:48 +0000
Received: from mail137-3.atl71.mandrillapp.com
 (mail137-3.atl71.mandrillapp.com [198.2.137.3])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id f63ff70d-7ec8-11f0-a32b-13f23c93f187;
 Thu, 21 Aug 2025 21:56:46 +0200 (CEST)
Received: from pmta07.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail137-3.atl71.mandrillapp.com (Mailchimp) with ESMTP id 4c7Dbt5zC1zBsV0hg
 for <win-pv-devel@lists.xenproject.org>; Thu, 21 Aug 2025 19:56:42 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c78c4d1682e34dceb11b8dbf28ceb0d2; Thu, 21 Aug 2025 19:56:42 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f63ff70d-7ec8-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755806202; x=1756076202;
	bh=Z+W6Ds+VSMZq9GlBDPdcq3PfJSbT5P6HVZiBJO0Sajo=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=gOqBY1XUCvI74Iqubu06n7z5jGFXastVPxF31G/5XJF/K9nBhIvq/VwjF2Sq1XzeZ
	 dOBCv69yGflOYcblMPopAGMT8boM7G0WdLjqJoQd6sffwzfnd41L4vChBv/HrqLiS2
	 pu77qbUFC09DRCWGx/TgCmTaWEAcKijyAEjbjHMQ/9aT5hun//sX/N4XF0+PYKNK3u
	 grhpAI8ZcoUOs5QOCS8r6ynhajzEelroyOZdSyw1RqafsM7te21T2C5NETKZU1gVZR
	 KQJ93wHF8MWECZpHg7TFLdnJ1oFMK4GMKzCKLOXsq1ewNCvFv7frhS8OQvAnNWfV29
	 3zuMFNLAzsV3Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755806202; x=1756066702; i=ngoc-tu.dinh@vates.tech;
	bh=Z+W6Ds+VSMZq9GlBDPdcq3PfJSbT5P6HVZiBJO0Sajo=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=wg6oYQ1am00QCvERQ0qtZx54csH7ULHHsPWoHfKRxBwIeNVhN17aFoD4O2F6GJjd0
	 AJd2q9zD6diNuZqyoVbT5K7dBGpIFZGk2J4JGP0fx/iA5n6dEawktlJM2IViV2T+NA
	 Bf6QWYLePruwJinC/M7MmKaUdejdiL0MEyaQ+TZHMn2nhsca61nPpEORN0VelWYTD6
	 LZLJMt1fBVAv0gPLE+MvXAIM8LOjQZkqzUIKPEqwEqtaZ5TMOSVkyzNEUTEW3NeIZz
	 XXXBVjN5Pkyx93vz12EpKSY98vKxWVEIRvw1gKYmexoCbB+69HKYmr5qiYG8N+zs+E
	 jOXLDujYNf90A==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Add=20check=20for=20maximum=20xenstore=20key=20lengths?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755806201550
Message-Id: <85a8eaa9-e90d-487c-a52b-fd19c51dc44c@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250821095936.803-1-owen.smith@cloud.com>
In-Reply-To: <20250821095936.803-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c78c4d1682e34dceb11b8dbf28ceb0d2?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250821:md
Date: Thu, 21 Aug 2025 19:56:42 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 21/08/2025 12:00, Owen Smith wrote:
> Check any xenstore path lengths before calling into xenstore, in order
> to fail without passing control to xenstored, which should fail any request
> with paths exceeding the defined maximum length.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xenbus/store.c | 149 ++++++++++++++++++++++++++++++++-------------
>   1 file changed, 108 insertions(+), 41 deletions(-)
> 
> diff --git a/src/xenbus/store.c b/src/xenbus/store.c
> index afb1954..0c00d23 100644
> --- a/src/xenbus/store.c
> +++ b/src/xenbus/store.c
> @@ -1099,6 +1099,37 @@ RtlCaptureStackBackTrace(
>       __out_opt   PULONG  BackTraceHash
>       );
>   
> +static NTSTATUS
> +StoreCheckPathLength(
> +    _In_opt_ PSTR   Prefix,
> +    _In_ PSTR       Node
> +    )
> +{
> +    size_t          Length;
> +    size_t          MaximumLength;
> +
> +    Length = Prefix == NULL ? 0 : strlen(Prefix);
> +
> +    if (Length == 0) {
> +        // Prefix is NULL or empty

Prefix==NULL and Prefix=="" are treated differently, if Prefix=="" then 
"/" is prefixed unconditionally (and therefore MaximumLength should be 
XENSTORE_ABS_PATH_MAX) whereas in the Prefix==NULL case Node[0] still 
needs to be checked.

> +        MaximumLength = Node[0] == '/' ?
> +                            XENSTORE_ABS_PATH_MAX :
> +                            XENSTORE_REL_PATH_MAX;
> +
> +        Length = strlen(Node) + 1;
> +    } else {
> +        MaximumLength = Prefix[0] == '/' ?
> +                            XENSTORE_ABS_PATH_MAX :
> +                            XENSTORE_REL_PATH_MAX;
> +
> +        Length += 1 + strlen(Node) + 1;
> +    }
> +
> +    return Length > MaximumLength ?
> +                STATUS_INVALID_BUFFER_SIZE :
> +                STATUS_SUCCESS;
> +}
> +
>   static NTSTATUS
>   StoreRead(
>       _In_ PINTERFACE                     Interface,
> @@ -1116,6 +1147,10 @@ StoreRead(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1145,23 +1180,23 @@ StoreRead(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1170,14 +1205,15 @@ StoreRead(
>   
>       return STATUS_SUCCESS;
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1245,9 +1281,9 @@ fail3:
>       StoreFreeResponse(Response);
>   
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1326,6 +1362,10 @@ StorePrintf(
>       va_list                             Arguments;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       va_start(Arguments, Format);
>       status = StoreVPrintf(Interface,
>                               Transaction,
> @@ -1336,6 +1376,9 @@ StorePrintf(
>       va_end(Arguments);
>   
>       return status;
> +
> +fail1:
> +    return status;
>   }
>   
>   static NTSTATUS
> @@ -1352,6 +1395,10 @@ StoreRemove(
>       PXENBUS_STORE_RESPONSE              Response;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>   
>       KeAcquireSpinLock(&Context->Lock, &Irql);
> @@ -1379,30 +1426,31 @@ StoreRemove(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail3:
> +fail4:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1423,6 +1471,10 @@ StoreDirectory(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1452,27 +1504,27 @@ StoreDirectory(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       status = STATUS_OBJECT_PATH_NOT_FOUND;
>       if (Buffer->Length == 0)
> -        goto fail5;
> +        goto fail6;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1481,17 +1533,18 @@ StoreDirectory(
>   
>       return STATUS_SUCCESS;
>   
> -fail5:
> +fail6:
>       StoreFreePayload(Context, Buffer);
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1672,11 +1725,15 @@ StoreWatchAdd(
>       KIRQL                           Irql;
>       NTSTATUS                        status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
>   
>       status = STATUS_NO_MEMORY;
>       if (*Watch == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       (*Watch)->Magic = STORE_WATCH_MAGIC;
>       (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
> @@ -1690,7 +1747,7 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -1736,24 +1793,24 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail3;
> +        goto fail4;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail4:
> -    Error("fail4\n");
> +fail5:
> +    Error("fail5\n");
>   
>       StoreFreeResponse(Response);
>   
> -fail3:
> -    Error("fail3\n");
> +fail4:
> +    Error("fail4\n");
>   
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> @@ -1770,8 +1827,8 @@ fail3:
>   
>       __StoreFree(Path);
>   
> -fail2:
> -    Error("fail2\n");
> +fail3:
> +    Error("fail3\n");
>   
>       (*Watch)->Caller = NULL;
>       (*Watch)->Magic = 0;
> @@ -1779,6 +1836,9 @@ fail2:
>       ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
>       __StoreFree(*Watch);
>   
> +fail2:
> +    Error("fail2\n");
> +
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   
> @@ -2057,11 +2117,15 @@ StorePermissionsSet(
>       PSTR                                PermissionString;
>       PSTR                                Segment;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
>   
>       status = STATUS_NO_MEMORY;
>       if (PermissionString == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       if (Prefix == NULL)
>           Length = (ULONG)strlen(Node) + sizeof (CHAR);
> @@ -2071,7 +2135,7 @@ StorePermissionsSet(
>       Path = __StoreAllocate(Length);
>   
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -2088,7 +2152,7 @@ StorePermissionsSet(
>                                            Length,
>                                            &Used);
>           if (!NT_SUCCESS(status))
> -            goto fail3;
> +            goto fail4;
>   
>           Segment += Used;
>           Length -= Used;
> @@ -2108,17 +2172,17 @@ StorePermissionsSet(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail5;
> +        goto fail6;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail6;
> +        goto fail7;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -2128,9 +2192,12 @@ StorePermissionsSet(
>   
>       return STATUS_SUCCESS;
>   
> +fail7:
> +    Error("fail7\n");
> +    StoreFreeResponse(Response);
> +
>   fail6:
>       Error("fail6\n");
> -    StoreFreeResponse(Response);
>   
>   fail5:
>       Error("fail5\n");
> @@ -2138,17 +2205,17 @@ fail5:
>   fail4:
>       Error("fail4\n");
>   
> +    __StoreFree(Path);
> +    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +
>   fail3:
>       Error("fail3\n");
>   
> -    __StoreFree(Path);
> -    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +    __StoreFree(PermissionString);
>   
>   fail2:
>       Error("fail2\n");
>   
> -    __StoreFree(PermissionString);
> -
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   



 | Vates

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 21 19:59:36 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 21 Aug 2025 19:59:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1089241.1446884 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upBRg-00067u-GQ; Thu, 21 Aug 2025 19:59:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1089241.1446884; Thu, 21 Aug 2025 19:59:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upBRg-00067n-Dq; Thu, 21 Aug 2025 19:59:36 +0000
Received: by outflank-mailman (input) for mailman id 1089241;
 Thu, 21 Aug 2025 19:59:35 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=YI4N=3B=bounce.vates.tech=bounce-md_30504962.68a77aa4.v1-7fddd8cdb47a418baf2fccad5dc55a5d@srs-se1.protection.inumbo.net>)
 id 1upBRf-00067R-2V
 for win-pv-devel@lists.xenproject.org; Thu, 21 Aug 2025 19:59:35 +0000
Received: from mail179-29.suw41.mandrillapp.com
 (mail179-29.suw41.mandrillapp.com [198.2.179.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 5b2bc92b-7ec9-11f0-a32b-13f23c93f187;
 Thu, 21 Aug 2025 21:59:33 +0200 (CEST)
Received: from pmta12.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail179-29.suw41.mandrillapp.com (Mailchimp) with ESMTP id
 4c7Dg83wDQz7lmKpJ
 for <win-pv-devel@lists.xenproject.org>; Thu, 21 Aug 2025 19:59:32 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 7fddd8cdb47a418baf2fccad5dc55a5d; Thu, 21 Aug 2025 19:59:32 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5b2bc92b-7ec9-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755806372; x=1756076372;
	bh=kiqR9qoZA5lXt1vZoAlqe+D+bEU6qTDqicBGzO12xCw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=wna1MTCZlQkDMw1JxnpKrHUoSOKPSESK4ONroIVQrpC5pcPtznIXo5yI4kpcMyO7S
	 ww3pZn1/Mgpb1Y7MkQEC5v8PxWFRpFiCprwvyJAg+nVs44CAfAxg95DbkcQa4UfR73
	 aHmrMyT1fsOVVvtcnVTmAqJbjNAOM4viN1T2rLHcRf/zcx73SHIWAqybZsbj+SDwM+
	 ee9ojlfSt9vYXay/6Y896YUF2e86vPXm3sAg7/w5R4SouEJ560GsBFw8qfYr0jAuQg
	 yILMISzDp5tXR+CSkRzKmeTHdP1kHhpFKdEf+2f5WaLvl5CaZsOWIQaNQZuoIJF05K
	 qbK7O5gWniI3Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755806372; x=1756066872; i=ngoc-tu.dinh@vates.tech;
	bh=kiqR9qoZA5lXt1vZoAlqe+D+bEU6qTDqicBGzO12xCw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=lvnc4CUninAlldJU9H1iHybv3J1F1SgYcWSHVI25TLFgWbuBnxNABYrzK18o6EeJB
	 j2uRkOPS7KO4a0ZywMqsOXv9MP853OZ7B/CKz+ju3Wk2LcHjldceyofYJiHPQzRPtO
	 bxQJmS+ruqAgOxc+m3sM6g5MgzUZdhJWXVdf8MH1h9ap94Ova29QMqw/GbTfXgZr46
	 +ZeB0Va68gPyXkNphOBl1tiJocnXTzUfNWKgrHZ1SH05UksXEu4Ti/gXH+rjqiUvCz
	 vddNhcFq7NOSfqDEepdrO6MM8m8+5Z2DA1alCo1VFqE6VT8lZyPCC6siisJkWsmJzu
	 aKiGs8eib59Uw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Add=20check=20for=20maximum=20xenstore=20key=20lengths?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755806371823
Message-Id: <0dae98f4-60df-49cd-8d5a-2c3db49b2ab9@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250821095936.803-1-owen.smith@cloud.com>
In-Reply-To: <20250821095936.803-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.7fddd8cdb47a418baf2fccad5dc55a5d?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250821:md
Date: Thu, 21 Aug 2025 19:59:32 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 21/08/2025 12:00, Owen Smith wrote:
> Check any xenstore path lengths before calling into xenstore, in order
> to fail without passing control to xenstored, which should fail any request
> with paths exceeding the defined maximum length.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>
> ---
>   src/xenbus/store.c | 149 ++++++++++++++++++++++++++++++++-------------
>   1 file changed, 108 insertions(+), 41 deletions(-)
> 
> diff --git a/src/xenbus/store.c b/src/xenbus/store.c
> index afb1954..0c00d23 100644
> --- a/src/xenbus/store.c
> +++ b/src/xenbus/store.c
> @@ -1099,6 +1099,37 @@ RtlCaptureStackBackTrace(
>       __out_opt   PULONG  BackTraceHash
>       );
>   
> +static NTSTATUS
> +StoreCheckPathLength(
> +    _In_opt_ PSTR   Prefix,
> +    _In_ PSTR       Node
> +    )
> +{
> +    size_t          Length;
> +    size_t          MaximumLength;

size_t will still overflow on 32-bit systems. I think you can keep 
things as ULONG and just have a preliminary check for 
XENSTORE_PAYLOAD_MAX on both strlen(Prefix) and strlen(Node), which will 
also take care of the overflow checking.

> +
> +    Length = Prefix == NULL ? 0 : strlen(Prefix);
> +
> +    if (Length == 0) {
> +        // Prefix is NULL or empty
> +        MaximumLength = Node[0] == '/' ?
> +                            XENSTORE_ABS_PATH_MAX :
> +                            XENSTORE_REL_PATH_MAX;
> +
> +        Length = strlen(Node) + 1;
> +    } else {
> +        MaximumLength = Prefix[0] == '/' ?
> +                            XENSTORE_ABS_PATH_MAX :
> +                            XENSTORE_REL_PATH_MAX;
> +
> +        Length += 1 + strlen(Node) + 1;
> +    }
> +
> +    return Length > MaximumLength ?
> +                STATUS_INVALID_BUFFER_SIZE :
> +                STATUS_SUCCESS;
> +}
> +
>   static NTSTATUS
>   StoreRead(
>       _In_ PINTERFACE                     Interface,
> @@ -1116,6 +1147,10 @@ StoreRead(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1145,23 +1180,23 @@ StoreRead(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1170,14 +1205,15 @@ StoreRead(
>   
>       return STATUS_SUCCESS;
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1245,9 +1281,9 @@ fail3:
>       StoreFreeResponse(Response);
>   
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1326,6 +1362,10 @@ StorePrintf(
>       va_list                             Arguments;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       va_start(Arguments, Format);
>       status = StoreVPrintf(Interface,
>                               Transaction,
> @@ -1336,6 +1376,9 @@ StorePrintf(
>       va_end(Arguments);
>   
>       return status;
> +
> +fail1:
> +    return status;
>   }
>   
>   static NTSTATUS
> @@ -1352,6 +1395,10 @@ StoreRemove(
>       PXENBUS_STORE_RESPONSE              Response;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>   
>       KeAcquireSpinLock(&Context->Lock, &Irql);
> @@ -1379,30 +1426,31 @@ StoreRemove(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail3:
> +fail4:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1423,6 +1471,10 @@ StoreDirectory(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1452,27 +1504,27 @@ StoreDirectory(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       status = STATUS_OBJECT_PATH_NOT_FOUND;
>       if (Buffer->Length == 0)
> -        goto fail5;
> +        goto fail6;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1481,17 +1533,18 @@ StoreDirectory(
>   
>       return STATUS_SUCCESS;
>   
> -fail5:
> +fail6:
>       StoreFreePayload(Context, Buffer);
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1672,11 +1725,15 @@ StoreWatchAdd(
>       KIRQL                           Irql;
>       NTSTATUS                        status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
>   
>       status = STATUS_NO_MEMORY;
>       if (*Watch == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       (*Watch)->Magic = STORE_WATCH_MAGIC;
>       (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
> @@ -1690,7 +1747,7 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -1736,24 +1793,24 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail3;
> +        goto fail4;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail4:
> -    Error("fail4\n");
> +fail5:
> +    Error("fail5\n");
>   
>       StoreFreeResponse(Response);
>   
> -fail3:
> -    Error("fail3\n");
> +fail4:
> +    Error("fail4\n");
>   
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> @@ -1770,8 +1827,8 @@ fail3:
>   
>       __StoreFree(Path);
>   
> -fail2:
> -    Error("fail2\n");
> +fail3:
> +    Error("fail3\n");
>   
>       (*Watch)->Caller = NULL;
>       (*Watch)->Magic = 0;
> @@ -1779,6 +1836,9 @@ fail2:
>       ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
>       __StoreFree(*Watch);
>   
> +fail2:
> +    Error("fail2\n");
> +
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   
> @@ -2057,11 +2117,15 @@ StorePermissionsSet(
>       PSTR                                PermissionString;
>       PSTR                                Segment;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
>   
>       status = STATUS_NO_MEMORY;
>       if (PermissionString == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       if (Prefix == NULL)
>           Length = (ULONG)strlen(Node) + sizeof (CHAR);
> @@ -2071,7 +2135,7 @@ StorePermissionsSet(
>       Path = __StoreAllocate(Length);
>   
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -2088,7 +2152,7 @@ StorePermissionsSet(
>                                            Length,
>                                            &Used);
>           if (!NT_SUCCESS(status))
> -            goto fail3;
> +            goto fail4;
>   
>           Segment += Used;
>           Length -= Used;
> @@ -2108,17 +2172,17 @@ StorePermissionsSet(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail5;
> +        goto fail6;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail6;
> +        goto fail7;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -2128,9 +2192,12 @@ StorePermissionsSet(
>   
>       return STATUS_SUCCESS;
>   
> +fail7:
> +    Error("fail7\n");
> +    StoreFreeResponse(Response);
> +
>   fail6:
>       Error("fail6\n");
> -    StoreFreeResponse(Response);
>   
>   fail5:
>       Error("fail5\n");
> @@ -2138,17 +2205,17 @@ fail5:
>   fail4:
>       Error("fail4\n");
>   
> +    __StoreFree(Path);
> +    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +
>   fail3:
>       Error("fail3\n");
>   
> -    __StoreFree(Path);
> -    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +    __StoreFree(PermissionString);
>   
>   fail2:
>       Error("fail2\n");
>   
> -    __StoreFree(PermissionString);
> -
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 21 21:56:02 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 21 Aug 2025 21:56:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1089343.1446963 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upDGL-00006E-1m; Thu, 21 Aug 2025 21:56:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1089343.1446963; Thu, 21 Aug 2025 21:56:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upDGK-000067-VS; Thu, 21 Aug 2025 21:56:00 +0000
Received: by outflank-mailman (input) for mailman id 1089343;
 Thu, 21 Aug 2025 21:55:59 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZkPP=3B=bounce.vates.tech=bounce-md_30504962.68a795ec.v1-4f118447b56b475db294f3ee49543f28@srs-se1.protection.inumbo.net>)
 id 1upDGJ-000061-CT
 for win-pv-devel@lists.xenproject.org; Thu, 21 Aug 2025 21:55:59 +0000
Received: from mail137-3.atl71.mandrillapp.com
 (mail137-3.atl71.mandrillapp.com [198.2.137.3])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 9de23a30-7ed9-11f0-a32b-13f23c93f187;
 Thu, 21 Aug 2025 23:55:57 +0200 (CEST)
Received: from pmta07.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1])
 by mail137-3.atl71.mandrillapp.com (Mailchimp) with ESMTP id 4c7HFS2Tk3zBsYSwQ
 for <win-pv-devel@lists.xenproject.org>; Thu, 21 Aug 2025 21:55:56 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 4f118447b56b475db294f3ee49543f28; Thu, 21 Aug 2025 21:55:56 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9de23a30-7ed9-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755813356; x=1756083356;
	bh=3rMQZLM/d8M4bAoh9dnR2AU0tbfwg6aLpr2LNNPV+e4=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=tix0lBDIwI/+BdKgJGnKM9wnzmbCQFyEfI70JUmouMHqGZyIylcm2czmDLnNd2WD+
	 sCNxSB5usvyPKe/XVAe+6IfbnjY62wh22kfITlwDzRCzFRtGX+A/qxADfc9NHfAglJ
	 PrUC/oCj9Cm+bZ+esDnc0gtsiDj9CE5+Ohag0gbKIMXNu9xqkqBzHCfQPQQFjCsvX7
	 kYrZzprE1/j5+h07ZxDv9osbIak4uPp76z40bZwvvIPnmMG9FDX/29xZBhPownrN4u
	 UiP3mklsfnexwIgvM8EF+0kM5823lP7j3iOvlGR9vEGnYRwcxzrIfhE7k31f/B2DsS
	 dmQwsP5qmlO4w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755813356; x=1756073856; i=ngoc-tu.dinh@vates.tech;
	bh=3rMQZLM/d8M4bAoh9dnR2AU0tbfwg6aLpr2LNNPV+e4=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=uz2HWUuuLl0qEZUHublCIE1QRbon6nteZ/kDUdRcH4MzhS/KZdLTLNgWm6YKIvu4l
	 9BLSVFz1r3fBMZBvm+CC/dJ1pwHEzgVsztxWqpqe06wjoZepzCpgOX3YRORXN2NTq5
	 NWC2OkvqTt6MziXZLKk4s0zRC2ZyOx/DhWnSoO5c2rq91zAaeW1TL+r3konTWwH9FJ
	 hKlntB1a87KOi+ydmw1icCyg2DXAh7pSG0N888TkO/Gya7tBuq4SrlFCuW6ZoKYGyY
	 J084hMQJaDDGFy4bzSerQwlW6s3kDpJzuotTcLa/UglKZLzu7LQOO7kUDYfe3gbQ1d
	 9MrZyLvjh+47g==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Add=20check=20for=20maximum=20xenstore=20key=20lengths?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755813355482
Message-Id: <19aadc1d-2e04-4c53-80aa-804d26d98f6a@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250821095936.803-1-owen.smith@cloud.com> <0dae98f4-60df-49cd-8d5a-2c3db49b2ab9@vates.tech>
In-Reply-To: <0dae98f4-60df-49cd-8d5a-2c3db49b2ab9@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.4f118447b56b475db294f3ee49543f28?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250821:md
Date: Thu, 21 Aug 2025 21:55:56 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 21/08/2025 21:59, Tu Dinh wrote:
> On 21/08/2025 12:00, Owen Smith wrote:
>> Check any xenstore path lengths before calling into xenstore, in order
>> to fail without passing control to xenstored, which should fail any request
>> with paths exceeding the defined maximum length.
>>
>> Signed-off-by: Owen Smith <owen.smith@cloud.com>
>> ---
>>    src/xenbus/store.c | 149 ++++++++++++++++++++++++++++++++-------------
>>    1 file changed, 108 insertions(+), 41 deletions(-)
>>
>> diff --git a/src/xenbus/store.c b/src/xenbus/store.c
>> index afb1954..0c00d23 100644
>> --- a/src/xenbus/store.c
>> +++ b/src/xenbus/store.c
>> @@ -1099,6 +1099,37 @@ RtlCaptureStackBackTrace(
>>        __out_opt   PULONG  BackTraceHash
>>        );
>>    
>> +static NTSTATUS
>> +StoreCheckPathLength(
>> +    _In_opt_ PSTR   Prefix,
>> +    _In_ PSTR       Node
>> +    )
>> +{
>> +    size_t          Length;
>> +    size_t          MaximumLength;
> 
> size_t will still overflow on 32-bit systems. I think you can keep
> things as ULONG and just have a preliminary check for
> XENSTORE_PAYLOAD_MAX on both strlen(Prefix) and strlen(Node), which will
> also take care of the overflow checking.
> 

My bad, the lengths can't be ULONG but must remain size_t.

>> +
>> +    Length = Prefix == NULL ? 0 : strlen(Prefix);
>> +
>> +    if (Length == 0) {
>> +        // Prefix is NULL or empty
>> +        MaximumLength = Node[0] == '/' ?
>> +                            XENSTORE_ABS_PATH_MAX :
>> +                            XENSTORE_REL_PATH_MAX;
>> +
>> +        Length = strlen(Node) + 1;
>> +    } else {
>> +        MaximumLength = Prefix[0] == '/' ?
>> +                            XENSTORE_ABS_PATH_MAX :
>> +                            XENSTORE_REL_PATH_MAX;
>> +
>> +        Length += 1 + strlen(Node) + 1;
>> +    }
>> +
>> +    return Length > MaximumLength ?
>> +                STATUS_INVALID_BUFFER_SIZE :
>> +                STATUS_SUCCESS;
>> +}
>> +
>>    static NTSTATUS
>>    StoreRead(
>>        _In_ PINTERFACE                     Interface,
>> @@ -1116,6 +1147,10 @@ StoreRead(
>>        PXENBUS_STORE_BUFFER                Buffer;
>>        NTSTATUS                            status;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>>    
>>        RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>> @@ -1145,23 +1180,23 @@ StoreRead(
>>        KeReleaseSpinLock(&Context->Lock, Irql);
>>    
>>        if (!NT_SUCCESS(status))
>> -        goto fail1;
>> +        goto fail2;
>>    
>>        Response = StoreSubmitRequest(Context, &Request);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Response == NULL)
>> -        goto fail2;
>> +        goto fail3;
>>    
>>        status = StoreCheckResponse(Response);
>>        if (!NT_SUCCESS(status))
>> -        goto fail3;
>> +        goto fail4;
>>    
>>        Buffer = StoreCopyPayload(Context, Response, Caller);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Buffer == NULL)
>> -        goto fail4;
>> +        goto fail5;
>>    
>>        StoreFreeResponse(Response);
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>> @@ -1170,14 +1205,15 @@ StoreRead(
>>    
>>        return STATUS_SUCCESS;
>>    
>> +fail5:
>>    fail4:
>> -fail3:
>>        StoreFreeResponse(Response);
>>    
>> +fail3:
>>    fail2:
>> -fail1:
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>> +fail1:
>>        return status;
>>    }
>>    
>> @@ -1245,9 +1281,9 @@ fail3:
>>        StoreFreeResponse(Response);
>>    
>>    fail2:
>> -fail1:
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>> +fail1:
>>        return status;
>>    }
>>    
>> @@ -1326,6 +1362,10 @@ StorePrintf(
>>        va_list                             Arguments;
>>        NTSTATUS                            status;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        va_start(Arguments, Format);
>>        status = StoreVPrintf(Interface,
>>                                Transaction,
>> @@ -1336,6 +1376,9 @@ StorePrintf(
>>        va_end(Arguments);
>>    
>>        return status;
>> +
>> +fail1:
>> +    return status;
>>    }
>>    
>>    static NTSTATUS
>> @@ -1352,6 +1395,10 @@ StoreRemove(
>>        PXENBUS_STORE_RESPONSE              Response;
>>        NTSTATUS                            status;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>>    
>>        KeAcquireSpinLock(&Context->Lock, &Irql);
>> @@ -1379,30 +1426,31 @@ StoreRemove(
>>        KeReleaseSpinLock(&Context->Lock, Irql);
>>    
>>        if (!NT_SUCCESS(status))
>> -        goto fail1;
>> +        goto fail2;
>>    
>>        Response = StoreSubmitRequest(Context, &Request);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Response == NULL)
>> -        goto fail2;
>> +        goto fail3;
>>    
>>        status = StoreCheckResponse(Response);
>>        if (!NT_SUCCESS(status))
>> -        goto fail3;
>> +        goto fail4;
>>    
>>        StoreFreeResponse(Response);
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>>        return STATUS_SUCCESS;
>>    
>> -fail3:
>> +fail4:
>>        StoreFreeResponse(Response);
>>    
>> +fail3:
>>    fail2:
>> -fail1:
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>> +fail1:
>>        return status;
>>    }
>>    
>> @@ -1423,6 +1471,10 @@ StoreDirectory(
>>        PXENBUS_STORE_BUFFER                Buffer;
>>        NTSTATUS                            status;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>>    
>>        RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>> @@ -1452,27 +1504,27 @@ StoreDirectory(
>>        KeReleaseSpinLock(&Context->Lock, Irql);
>>    
>>        if (!NT_SUCCESS(status))
>> -        goto fail1;
>> +        goto fail2;
>>    
>>        Response = StoreSubmitRequest(Context, &Request);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Response == NULL)
>> -        goto fail2;
>> +        goto fail3;
>>    
>>        status = StoreCheckResponse(Response);
>>        if (!NT_SUCCESS(status))
>> -        goto fail3;
>> +        goto fail4;
>>    
>>        Buffer = StoreCopyPayload(Context, Response, Caller);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Buffer == NULL)
>> -        goto fail4;
>> +        goto fail5;
>>    
>>        status = STATUS_OBJECT_PATH_NOT_FOUND;
>>        if (Buffer->Length == 0)
>> -        goto fail5;
>> +        goto fail6;
>>    
>>        StoreFreeResponse(Response);
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>> @@ -1481,17 +1533,18 @@ StoreDirectory(
>>    
>>        return STATUS_SUCCESS;
>>    
>> -fail5:
>> +fail6:
>>        StoreFreePayload(Context, Buffer);
>>    
>> +fail5:
>>    fail4:
>> -fail3:
>>        StoreFreeResponse(Response);
>>    
>> +fail3:
>>    fail2:
>> -fail1:
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>> +fail1:
>>        return status;
>>    }
>>    
>> @@ -1672,11 +1725,15 @@ StoreWatchAdd(
>>        KIRQL                           Irql;
>>        NTSTATUS                        status;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (*Watch == NULL)
>> -        goto fail1;
>> +        goto fail2;
>>    
>>        (*Watch)->Magic = STORE_WATCH_MAGIC;
>>        (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
>> @@ -1690,7 +1747,7 @@ StoreWatchAdd(
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Path == NULL)
>> -        goto fail2;
>> +        goto fail3;
>>    
>>        status = (Prefix == NULL) ?
>>                 RtlStringCbPrintfA(Path, Length, "%s", Node) :
>> @@ -1736,24 +1793,24 @@ StoreWatchAdd(
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Response == NULL)
>> -        goto fail3;
>> +        goto fail4;
>>    
>>        status = StoreCheckResponse(Response);
>>        if (!NT_SUCCESS(status))
>> -        goto fail4;
>> +        goto fail5;
>>    
>>        StoreFreeResponse(Response);
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>>        return STATUS_SUCCESS;
>>    
>> -fail4:
>> -    Error("fail4\n");
>> +fail5:
>> +    Error("fail5\n");
>>    
>>        StoreFreeResponse(Response);
>>    
>> -fail3:
>> -    Error("fail3\n");
>> +fail4:
>> +    Error("fail4\n");
>>    
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>>    
>> @@ -1770,8 +1827,8 @@ fail3:
>>    
>>        __StoreFree(Path);
>>    
>> -fail2:
>> -    Error("fail2\n");
>> +fail3:
>> +    Error("fail3\n");
>>    
>>        (*Watch)->Caller = NULL;
>>        (*Watch)->Magic = 0;
>> @@ -1779,6 +1836,9 @@ fail2:
>>        ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
>>        __StoreFree(*Watch);
>>    
>> +fail2:
>> +    Error("fail2\n");
>> +
>>    fail1:
>>        Error("fail1 (%08x)\n", status);
>>    
>> @@ -2057,11 +2117,15 @@ StorePermissionsSet(
>>        PSTR                                PermissionString;
>>        PSTR                                Segment;
>>    
>> +    status = StoreCheckPathLength(Prefix, Node);
>> +    if (!NT_SUCCESS(status))
>> +        goto fail1;
>> +
>>        PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (PermissionString == NULL)
>> -        goto fail1;
>> +        goto fail2;
>>    
>>        if (Prefix == NULL)
>>            Length = (ULONG)strlen(Node) + sizeof (CHAR);
>> @@ -2071,7 +2135,7 @@ StorePermissionsSet(
>>        Path = __StoreAllocate(Length);
>>    
>>        if (Path == NULL)
>> -        goto fail2;
>> +        goto fail3;
>>    
>>        status = (Prefix == NULL) ?
>>                 RtlStringCbPrintfA(Path, Length, "%s", Node) :
>> @@ -2088,7 +2152,7 @@ StorePermissionsSet(
>>                                             Length,
>>                                             &Used);
>>            if (!NT_SUCCESS(status))
>> -            goto fail3;
>> +            goto fail4;
>>    
>>            Segment += Used;
>>            Length -= Used;
>> @@ -2108,17 +2172,17 @@ StorePermissionsSet(
>>        KeReleaseSpinLock(&Context->Lock, Irql);
>>    
>>        if (!NT_SUCCESS(status))
>> -        goto fail4;
>> +        goto fail5;
>>    
>>        Response = StoreSubmitRequest(Context, &Request);
>>    
>>        status = STATUS_NO_MEMORY;
>>        if (Response == NULL)
>> -        goto fail5;
>> +        goto fail6;
>>    
>>        status = StoreCheckResponse(Response);
>>        if (!NT_SUCCESS(status))
>> -        goto fail6;
>> +        goto fail7;
>>    
>>        StoreFreeResponse(Response);
>>        ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>> @@ -2128,9 +2192,12 @@ StorePermissionsSet(
>>    
>>        return STATUS_SUCCESS;
>>    
>> +fail7:
>> +    Error("fail7\n");
>> +    StoreFreeResponse(Response);
>> +
>>    fail6:
>>        Error("fail6\n");
>> -    StoreFreeResponse(Response);
>>    
>>    fail5:
>>        Error("fail5\n");
>> @@ -2138,17 +2205,17 @@ fail5:
>>    fail4:
>>        Error("fail4\n");
>>    
>> +    __StoreFree(Path);
>> +    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>> +
>>    fail3:
>>        Error("fail3\n");
>>    
>> -    __StoreFree(Path);
>> -    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>> +    __StoreFree(PermissionString);
>>    
>>    fail2:
>>        Error("fail2\n");
>>    
>> -    __StoreFree(PermissionString);
>> -
>>    fail1:
>>        Error("fail1 (%08x)\n", status);
>>    
> 
> 
> 
> Ngoc Tu Dinh | Vates XCP-ng Developer
> 
> XCP-ng & Xen Orchestra - Vates solutions
> 
> web: https://vates.tech
> 
> 



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 22 13:08:55 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 22 Aug 2025 13:08:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1090136.1447505 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upRVk-00027L-Vk; Fri, 22 Aug 2025 13:08:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1090136.1447505; Fri, 22 Aug 2025 13:08:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upRVk-00027E-St; Fri, 22 Aug 2025 13:08:52 +0000
Received: by outflank-mailman (input) for mailman id 1090136;
 Fri, 22 Aug 2025 13:08:51 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=l4Iz=3C=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1upRVj-00026P-3S
 for win-pv-devel@lists.xenproject.org; Fri, 22 Aug 2025 13:08:51 +0000
Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com
 [2607:f8b0:4864:20::62d])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 23f7b5e4-7f59-11f0-b898-0df219b8e170;
 Fri, 22 Aug 2025 15:08:49 +0200 (CEST)
Received: by mail-pl1-x62d.google.com with SMTP id
 d9443c01a7336-2445826fd9dso23595765ad.3
 for <win-pv-devel@lists.xenproject.org>; Fri, 22 Aug 2025 06:08:48 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 23f7b5e4-7f59-11f0-b898-0df219b8e170
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755868127; x=1756472927; darn=lists.xenproject.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=4tWoXFFW1lloiaEbNJcQCi53UKkdjv97+YJX9cnHA3k=;
        b=Nw+/CyrCGIWNs81Ms5g2AbgzsXgB+HK2JZkmDh3u+5f4m3JQgLW9X0uNMBNuFA91Xd
         ZGpCqB8gbUp2AbggzILDIDFCH++8i1SW1pWSp6m+Bmb6WV+VNszD1+ypbsaF5QTV5CSb
         s+Zq2TX9z/JRgrSxRNwUTiSxwsF5sysIxnFxM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755868127; x=1756472927;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=4tWoXFFW1lloiaEbNJcQCi53UKkdjv97+YJX9cnHA3k=;
        b=DwIGWjTQKYD0bbGXDucWumUz8BYmCjXMI75pxmZaQBFtcEj8wBXSM8plgr6PEdQFJa
         ksinFPGwwYTzVsWO8bmRpqCOONiTf1bxuUAFCqjYRmxZd6cnPv8AuffB1pT+kkXZ8TnS
         lfo8mRcf9HbUkqfRe+ivj7uxzcl9UM2W5ERUaf7huklU0SqCEvCGKHj/hzxWjJWynFlC
         7i5sUTcd1LKGxDOs9vFWJOTf8K648Qihw2Sxych4wmJVzaM7iG/yPwoe+RbabSID65NF
         Rwy+ybnP5TWL62Io1lK9YyaLly5GQV0meupjRwL2fwekA6F0NJPPwEeb3Jzoi1aNXLSk
         4O/w==
X-Gm-Message-State: AOJu0YweU70QBoxMuk+HIB+56OJAfwMqq1PtyP07CX3Avb4ubQyMtiPd
	mPQKnu1366RQ+i9LlmX88ahs3xLSkhwNhBxyk66gR63dZichwkHvgZKWpgYsyo6GdWX9w51TuJR
	32DYnXNfbEHDs6ekaS5zSdNpq/cLqz2Y3ZcMhdcZPQgj1AOBb08o=
X-Gm-Gg: ASbGncv+6LbC6ToYqms7ZoPh9dZeGIbhtxhTi3xgQ5xwJcI27IKTR7cPh3IcF1Lzfpd
	BXvBLUmH9bgT/khiujRw7uxGMWEK/0OyfSaAZAISdS7vxmw2YH6ZHtz9UD5WWWqWtCKSKPenwFY
	ij/motCqSJsYPPcZhYb+KNVMS4KZaYHcLBTn2SUhdF4w4HKHSQNN4+woTNlf7mdv8wDkmC5cY9o
	7QSY0c=
X-Google-Smtp-Source: AGHT+IHE9yST3SiGzA4QcwNVr87gMcxCZLgMj8Z7PaSFGVpvFXKi5jLY6x4CDmILxWiaW7GqU76hx6jLN0IXUgxCfn4=
X-Received: by 2002:a17:902:ebc5:b0:23f:c760:fdf0 with SMTP id
 d9443c01a7336-2462ef6a897mr40292415ad.45.1755868126817; Fri, 22 Aug 2025
 06:08:46 -0700 (PDT)
MIME-Version: 1.0
References: <20250818074038.1728-1-ngoc-tu.dinh@vates.tech> <20250818074038.1728-15-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250818074038.1728-15-ngoc-tu.dinh@vates.tech>
From: Owen Smith <owen.smith@cloud.com>
Date: Fri, 22 Aug 2025 14:08:34 +0100
X-Gm-Features: Ac12FXx8dCPMN1fhmnhQboNNvimm9gIBL_pkW7-jPBG34ZFM-n2L6SaL9YlV90Q
Message-ID: <CAC_UY88jQBA4QNSAX5ebF26aTj4EThjUsHoE1ZJ4OuCtd0MDCQ@mail.gmail.com>
Subject: Re: [XENVBD PATCH v6 14/15] Opt into forced unplug
To: Tu Dinh <ngoc-tu.dinh@vates.tech>
Cc: win-pv-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="000000000000f8e38a063cf3e7ca"

--000000000000f8e38a063cf3e7ca
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Both patches
Reviewed-by: Owen Smith <owen.smith@cloud.com>

On Mon, Aug 18, 2025 at 8:41=E2=80=AFAM Tu Dinh <ngoc-tu.dinh@vates.tech> w=
rote:

> Condition the opt-in to the FORCE_UNPLUG build variable.
>
> Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
> ---
>  scripts/genfiles.ps1 | 2 ++
>  src/xenvbd.inf       | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
> index 85754c0..a7d13ae 100644
> --- a/scripts/genfiles.ps1
> +++ b/scripts/genfiles.ps1
> @@ -70,6 +70,8 @@ $Replacements =3D [ordered]@{
>         'MICRO_VERSION' =3D $Env:MICRO_VERSION;
>         'BUILD_NUMBER' =3D $Env:BUILD_NUMBER;
>
> +       'FORCE_UNPLUG' =3D $Env:FORCE_UNPLUG;
> +
>         # generated values
>         'GIT_REVISION' =3D $GitRevision;
>
> diff --git a/src/xenvbd.inf b/src/xenvbd.inf
> index dfde613..0de71d1 100644
> --- a/src/xenvbd.inf
> +++ b/src/xenvbd.inf
> @@ -106,6 +106,7 @@
> HKR,"Parameters","multi-queue-max-queues",0x00010001,0x00000002
>
>  [XenVbd_Unplug]
>  HKLM,%UnplugKey%,"DISKS",0x00010001,0
> +HKLM,%ForceUnplugKey%,"DISKS",0x00010001,1  ; @FORCE_UNPLUG@
>
>  [XenVbd_Extras]
>  HKLM,%PnpKey%,"DisableCDDB",0x00010001,0
> @@ -120,6 +121,7 @@ DiskDesc =3D "@PRODUCT_NAME@ PV Storage Host Adapter
> Package"
>  XenVbdName=3D "@PRODUCT_NAME@ PV Storage Host Adapter"
>  XenDiskName=3D "@PRODUCT_NAME@ PV Storage Filter"
>  UnplugKey=3D"SYSTEM\CurrentControlSet\Services\XEN\Unplug"
> +ForceUnplugKey=3D"SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug"
>  PnpKey=3D"SYSTEM\CurrentControlSet\Control\Pnp"
>  PartMgrKey=3D"SYSTEM\CurrentControlSet\Services\PartMgr\Parameters"
>  DiskKey=3D"SYSTEM\CurrentControlSet\Services\Disk"
> --
> 2.50.1.windows.1
>
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>
>

--000000000000f8e38a063cf3e7ca
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Both patches</div><div class=3D"gmail_default" style=3D"font-family:mono=
space">Reviewed-by: Owen Smith &lt;<a href=3D"mailto:owen.smith@cloud.com">=
owen.smith@cloud.com</a>&gt;</div></div><br><div class=3D"gmail_quote gmail=
_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 18, 202=
5 at 8:41=E2=80=AFAM Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt; wrote:<br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);padding-left:1ex">Condition the opt-in to=
 the FORCE_UNPLUG build variable.<br>
<br>
Signed-off-by: Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
---<br>
=C2=A0scripts/genfiles.ps1 | 2 ++<br>
=C2=A0src/xenvbd.inf=C2=A0 =C2=A0 =C2=A0 =C2=A0| 2 ++<br>
=C2=A02 files changed, 4 insertions(+)<br>
<br>
diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1<br>
index 85754c0..a7d13ae 100644<br>
--- a/scripts/genfiles.ps1<br>
+++ b/scripts/genfiles.ps1<br>
@@ -70,6 +70,8 @@ $Replacements =3D [ordered]@{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;MICRO_VERSION&#39; =3D $Env:MICRO_VERSION;=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;BUILD_NUMBER&#39; =3D $Env:BUILD_NUMBER;<b=
r>
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;FORCE_UNPLUG&#39; =3D $Env:FORCE_UNPLUG;<b=
r>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 # generated values<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;GIT_REVISION&#39; =3D $GitRevision;<br>
<br>
diff --git a/src/xenvbd.inf b/src/xenvbd.inf<br>
index dfde613..0de71d1 100644<br>
--- a/src/xenvbd.inf<br>
+++ b/src/xenvbd.inf<br>
@@ -106,6 +106,7 @@ HKR,&quot;Parameters&quot;,&quot;multi-queue-max-queues=
&quot;,0x00010001,0x00000002<br>
<br>
=C2=A0[XenVbd_Unplug]<br>
=C2=A0HKLM,%UnplugKey%,&quot;DISKS&quot;,0x00010001,0<br>
+HKLM,%ForceUnplugKey%,&quot;DISKS&quot;,0x00010001,1=C2=A0 ; @FORCE_UNPLUG=
@<br>
<br>
=C2=A0[XenVbd_Extras]<br>
=C2=A0HKLM,%PnpKey%,&quot;DisableCDDB&quot;,0x00010001,0<br>
@@ -120,6 +121,7 @@ DiskDesc =3D &quot;@PRODUCT_NAME@ PV Storage Host Adapt=
er Package&quot;<br>
=C2=A0XenVbdName=3D &quot;@PRODUCT_NAME@ PV Storage Host Adapter&quot;<br>
=C2=A0XenDiskName=3D &quot;@PRODUCT_NAME@ PV Storage Filter&quot;<br>
=C2=A0UnplugKey=3D&quot;SYSTEM\CurrentControlSet\Services\XEN\Unplug&quot;<=
br>
+ForceUnplugKey=3D&quot;SYSTEM\CurrentControlSet\Services\XEN\ForceUnplug&q=
uot;<br>
=C2=A0PnpKey=3D&quot;SYSTEM\CurrentControlSet\Control\Pnp&quot;<br>
=C2=A0PartMgrKey=3D&quot;SYSTEM\CurrentControlSet\Services\PartMgr\Paramete=
rs&quot;<br>
=C2=A0DiskKey=3D&quot;SYSTEM\CurrentControlSet\Services\Disk&quot;<br>
-- <br>
2.50.1.windows.1<br>
<br>
<br>
<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" rel=3D"noreferrer" target=3D"_blank">ht=
tps://vates.tech</a><br>
<br>
<br>
</blockquote></div>

--000000000000f8e38a063cf3e7ca--


From win-pv-devel-bounces@lists.xenproject.org Fri Aug 22 14:40:29 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 22 Aug 2025 14:40:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1090233.1447578 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upSwN-0000PB-Rj; Fri, 22 Aug 2025 14:40:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1090233.1447578; Fri, 22 Aug 2025 14:40:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upSwN-0000P7-Ox; Fri, 22 Aug 2025 14:40:27 +0000
Received: by outflank-mailman (input) for mailman id 1090233;
 Fri, 22 Aug 2025 14:40:26 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=l4Iz=3C=cloud.com=owen.smith@srs-se1.protection.inumbo.net>)
 id 1upSwM-0006yQ-Nf
 for win-pv-devel@lists.xenproject.org; Fri, 22 Aug 2025 14:40:26 +0000
Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com
 [2a00:1450:4864:20::62d])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id f082dc42-7f65-11f0-a32b-13f23c93f187;
 Fri, 22 Aug 2025 16:40:25 +0200 (CEST)
Received: by mail-ej1-x62d.google.com with SMTP id
 a640c23a62f3a-afcb78d5e74so366484866b.1
 for <win-pv-devel@lists.xenproject.org>; Fri, 22 Aug 2025 07:40:25 -0700 (PDT)
Received: from mewpvdipd1026.corp.cloud.com ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-61c31703d8esm2793a12.26.2025.08.22.07.40.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 22 Aug 2025 07:40:23 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f082dc42-7f65-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755873624; x=1756478424; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=I/LWdA/5vqOQsA05RIFHvv0ifreUon075MKHFikLB8o=;
        b=hcB87eiDIIGaplYNT8gjVH0yLppBNGkj1UuJY95n8zNdirNPDNiAEG4u6Xw+9y7m9A
         6vBYnqZiExupUzmvse7GatUnLUgORJaMMro4hvJO1MFvhk5tV2jWHWmM5Xqrz+J5+h2j
         K2xHSEL/p2Ei1NZHvYsKJ7plpPy8v336bJ7t4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755873624; x=1756478424;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=I/LWdA/5vqOQsA05RIFHvv0ifreUon075MKHFikLB8o=;
        b=e7tf2vXZsTlTpJ0IF+MTzhvFFZYeOFjviGB6jCODhYaCCHVBd1hAukfoBztEcbphWV
         WqNDQdL7T15wN2n809t5oEjD9RP/2sSsbwjbicYBqJvDZDrpftkGU9XRYKecbyWeLrWW
         nZbSoFmY6OPka2LH2/ByNwQEbDBZCQp2hyRHzXzKIfTEG5hOR1vKXewW1++x3TRdB3nU
         4V8Zileh0wRxy4qWxAX1F0F0uLP3LSzG+E00YiLmEJXjyNgoJ0VEp9jcHfKyodVi6KKq
         c6EuewKmpyGfQohc2ry7JofwddgZpWEN3XZfC7O46WneHaNUaptUbt2qRrQYjxYpb4DQ
         wDZg==
X-Gm-Message-State: AOJu0Yy8S5UMXaEv/kHWBm126H/HaFwY2d3IVGWRZS+EgTvsOzccSe+u
	5KIpqsOz3XDXRI3XKT8EtcyUAs0dfSi9NbZf43GX6XfuDpY8YIXPCUiVm6FyyPL03CK3B+Obpn0
	d95o=
X-Gm-Gg: ASbGncvew2GMuYhFcHmLOZvpGmMTqwH7lJmVVMisCsVvdPzdXocngTe1XHZDc/Xb1BS
	pQ5n6oPJlfUQWtQw+rkhih5Jg11w9wZemwZY/dri8dgor6ICCTpXfCGbfUbNr9aQsystv2/haxt
	3HpZdPkwiMa5kRvltz8p9TrmAAMeaumFra+E2mj/iFnDUaB05Yuts5LGbNxDNCSs+nQF8tBHWwF
	IY59V3SQrid1tYib08mYv4eQcxGOppEZE3Kr6fbpJQTqQcOM0Hy1kKt8fTUeUuzuQRhrfpKwVoJ
	PNpagCzUy9Kr4GHvo9VrLrDP5FEee0+R/jXaAm8CIR/CpcI3VLZw8QagNhxYzCfsCAvLjyneJYO
	OJgxRNsJk3yFBXUUL0vaWF3Gb2iOXcYPAFzi//GF/nV6BHftU3hXY9E196ITqmaCy
X-Google-Smtp-Source: AGHT+IHjyE0LTbzqTPfRUtX4glC8UQnCYzbPmvtd60k9+OrU7/YS9jxuw/GNeIVy1j+FsiUZmPKCBg==
X-Received: by 2002:a17:907:7e9c:b0:af9:d863:5ce4 with SMTP id a640c23a62f3a-afe28fc281emr316594166b.15.1755873624240;
        Fri, 22 Aug 2025 07:40:24 -0700 (PDT)
From: Owen Smith <owen.smith@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@cloud.com>
Subject: [PATCH] Add check for maximum xenstore key lengths
Date: Fri, 22 Aug 2025 15:39:44 +0100
Message-ID: <20250822143945.1426-1-owen.smith@cloud.com>
X-Mailer: git-send-email 2.50.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Check any xenstore path lengths before calling into xenstore, in order
to fail without passing control to xenstored, which should fail any request
with paths exceeding the defined maximum length.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
---
 src/xenbus/store.c | 163 +++++++++++++++++++++++++++++++++------------
 1 file changed, 122 insertions(+), 41 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index afb1954..27e0706 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -1099,6 +1099,51 @@ RtlCaptureStackBackTrace(
     __out_opt   PULONG  BackTraceHash
     );
 
+static NTSTATUS
+StoreCheckPathLength(
+    _In_opt_ PSTR   Prefix,
+    _In_ PSTR       Node
+    )
+{
+    size_t          MaximumLength;
+    size_t          Length;
+
+    if (Prefix != NULL) {
+        MaximumLength = (Prefix[0] == '/' || Prefix[0] == '\0') ?
+                    XENSTORE_ABS_PATH_MAX :
+                    XENSTORE_REL_PATH_MAX;
+
+        Length = strlen(Prefix);
+        if (Length > MaximumLength)
+            goto fail1;
+        MaximumLength -= Length;
+
+        if (MaximumLength < 1)
+            goto fail2;
+        MaximumLength -= 1;
+    } else {
+        MaximumLength = Node[0] == '/' ?
+                            XENSTORE_ABS_PATH_MAX :
+                            XENSTORE_REL_PATH_MAX;
+    }
+
+    Length = strlen(Node);
+    if (Length > MaximumLength)
+        goto fail3;
+    MaximumLength -= Length;
+
+    if (MaximumLength < 1)
+        goto fail4;
+
+    return STATUS_SUCCESS;
+
+fail4:
+fail3:
+fail2:
+fail1:
+    return STATUS_INVALID_BUFFER_SIZE;
+}
+
 static NTSTATUS
 StoreRead(
     _In_ PINTERFACE                     Interface,
@@ -1116,6 +1161,10 @@ StoreRead(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1145,23 +1194,23 @@ StoreRead(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1170,14 +1219,15 @@ StoreRead(
 
     return STATUS_SUCCESS;
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1245,9 +1295,9 @@ fail3:
     StoreFreeResponse(Response);
 
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1326,6 +1376,10 @@ StorePrintf(
     va_list                             Arguments;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     va_start(Arguments, Format);
     status = StoreVPrintf(Interface,
                             Transaction,
@@ -1336,6 +1390,9 @@ StorePrintf(
     va_end(Arguments);
 
     return status;
+
+fail1:
+    return status;
 }
 
 static NTSTATUS
@@ -1352,6 +1409,10 @@ StoreRemove(
     PXENBUS_STORE_RESPONSE              Response;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
@@ -1379,30 +1440,31 @@ StoreRemove(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail3:
+fail4:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1423,6 +1485,10 @@ StoreDirectory(
     PXENBUS_STORE_BUFFER                Buffer;
     NTSTATUS                            status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
@@ -1452,27 +1518,27 @@ StoreDirectory(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail1;
+        goto fail2;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail2;
+        goto fail3;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail3;
+        goto fail4;
 
     Buffer = StoreCopyPayload(Context, Response, Caller);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-        goto fail4;
+        goto fail5;
 
     status = STATUS_OBJECT_PATH_NOT_FOUND;
     if (Buffer->Length == 0)
-        goto fail5;
+        goto fail6;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -1481,17 +1547,18 @@ StoreDirectory(
 
     return STATUS_SUCCESS;
 
-fail5:
+fail6:
     StoreFreePayload(Context, Buffer);
 
+fail5:
 fail4:
-fail3:
     StoreFreeResponse(Response);
 
+fail3:
 fail2:
-fail1:
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail1:
     return status;
 }
 
@@ -1672,11 +1739,15 @@ StoreWatchAdd(
     KIRQL                           Irql;
     NTSTATUS                        status;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
 
     status = STATUS_NO_MEMORY;
     if (*Watch == NULL)
-        goto fail1;
+        goto fail2;
 
     (*Watch)->Magic = STORE_WATCH_MAGIC;
     (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
@@ -1690,7 +1761,7 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -1736,24 +1807,24 @@ StoreWatchAdd(
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail3;
+        goto fail4;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
     return STATUS_SUCCESS;
 
-fail4:
-    Error("fail4\n");
+fail5:
+    Error("fail5\n");
 
     StoreFreeResponse(Response);
 
-fail3:
-    Error("fail3\n");
+fail4:
+    Error("fail4\n");
 
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
@@ -1770,8 +1841,8 @@ fail3:
 
     __StoreFree(Path);
 
-fail2:
-    Error("fail2\n");
+fail3:
+    Error("fail3\n");
 
     (*Watch)->Caller = NULL;
     (*Watch)->Magic = 0;
@@ -1779,6 +1850,9 @@ fail2:
     ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
     __StoreFree(*Watch);
 
+fail2:
+    Error("fail2\n");
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
@@ -2057,11 +2131,15 @@ StorePermissionsSet(
     PSTR                                PermissionString;
     PSTR                                Segment;
 
+    status = StoreCheckPathLength(Prefix, Node);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
 
     status = STATUS_NO_MEMORY;
     if (PermissionString == NULL)
-        goto fail1;
+        goto fail2;
 
     if (Prefix == NULL)
         Length = (ULONG)strlen(Node) + sizeof (CHAR);
@@ -2071,7 +2149,7 @@ StorePermissionsSet(
     Path = __StoreAllocate(Length);
 
     if (Path == NULL)
-        goto fail2;
+        goto fail3;
 
     status = (Prefix == NULL) ?
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
@@ -2088,7 +2166,7 @@ StorePermissionsSet(
                                          Length,
                                          &Used);
         if (!NT_SUCCESS(status))
-            goto fail3;
+            goto fail4;
 
         Segment += Used;
         Length -= Used;
@@ -2108,17 +2186,17 @@ StorePermissionsSet(
     KeReleaseSpinLock(&Context->Lock, Irql);
 
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     Response = StoreSubmitRequest(Context, &Request);
 
     status = STATUS_NO_MEMORY;
     if (Response == NULL)
-        goto fail5;
+        goto fail6;
 
     status = StoreCheckResponse(Response);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
@@ -2128,9 +2206,12 @@ StorePermissionsSet(
 
     return STATUS_SUCCESS;
 
+fail7:
+    Error("fail7\n");
+    StoreFreeResponse(Response);
+
 fail6:
     Error("fail6\n");
-    StoreFreeResponse(Response);
 
 fail5:
     Error("fail5\n");
@@ -2138,17 +2219,17 @@ fail5:
 fail4:
     Error("fail4\n");
 
+    __StoreFree(Path);
+    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+
 fail3:
     Error("fail3\n");
 
-    __StoreFree(Path);
-    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
+    __StoreFree(PermissionString);
 
 fail2:
     Error("fail2\n");
 
-    __StoreFree(PermissionString);
-
 fail1:
     Error("fail1 (%08x)\n", status);
 
-- 
2.50.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 22 16:04:40 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 22 Aug 2025 16:04:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1090352.1447643 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upUFq-0006Bc-1V; Fri, 22 Aug 2025 16:04:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1090352.1447643; Fri, 22 Aug 2025 16:04:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1upUFp-0006BU-Ur; Fri, 22 Aug 2025 16:04:37 +0000
Received: by outflank-mailman (input) for mailman id 1090352;
 Fri, 22 Aug 2025 16:04:37 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=USvA=3C=bounce.vates.tech=bounce-md_30504962.68a89511.v1-f484fa50100247a39fa5da0e460d8df3@srs-se1.protection.inumbo.net>)
 id 1upUFo-0006BO-V9
 for win-pv-devel@lists.xenproject.org; Fri, 22 Aug 2025 16:04:37 +0000
Received: from mail179-29.suw41.mandrillapp.com
 (mail179-29.suw41.mandrillapp.com [198.2.179.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id b20344fd-7f71-11f0-a32b-13f23c93f187;
 Fri, 22 Aug 2025 18:04:35 +0200 (CEST)
Received: from pmta12.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail179-29.suw41.mandrillapp.com (Mailchimp) with ESMTP id
 4c7lPY4yPkz7lmQWj
 for <win-pv-devel@lists.xenproject.org>; Fri, 22 Aug 2025 16:04:33 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 f484fa50100247a39fa5da0e460d8df3; Fri, 22 Aug 2025 16:04:33 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b20344fd-7f71-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1755878673; x=1756148673;
	bh=o+GflKFMRCE0+hj3XWIxAwPemFm+LCxpL/vtqqoOuzI=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=a5m4hHrOpChEvxlwU2m1lEkeKl/wudbUIvBiunru9qspW4IpWu8MLnV3msSbg01TW
	 573ILRttmgZjO8zwNCDNiyCj1d7xeIVfJ6OlZkgG3+5G/iAOA/ac83+EY3p1ZNeP5C
	 ARZimweb603YY6IBZjSzyfU+DTr8cRyyX0s5kBfoXU1agXGyK6ME62c29b1YrGg0WS
	 Jsj4pyW+BvL+zvnZSaZUPXmEwSnDR4rwBsKK4pL6invQWtbwWiAKH6ZobTVndin6Rt
	 dDA0kcgJx4HBAP4fXsLi5AvpIGKFMMExnSLCTmZY6PStw4STyDxtKywI9+bdSIZd+6
	 TUcTadwxUb6Cg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1755878673; x=1756139173; i=ngoc-tu.dinh@vates.tech;
	bh=o+GflKFMRCE0+hj3XWIxAwPemFm+LCxpL/vtqqoOuzI=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=pMQlAcGS3p8Oxhrji8uHPAle1Yeh4UpiqdinlD/dpLwfSdMvPO+QkkwcMANXveMiX
	 kwE4xldYE1ZIG6PF6hiUp3wBEl+cRR3LW4tyE5C09O7+4K7v0Tpt0dzXOh+nmLCGAL
	 ivl2je7H69p+ZgjJ26TUJlc39FvLYHGjtRkSHW/xQ4WGe65K7HC+bP756ZSsT+P5z4
	 lX2shqzzOBPNnMnPJVONqndWfCA4Fza1rlkjled5IABL6G0gMLUevVdF+2gVT2/Lf0
	 vC1dyIzBeChD4l37GWGJfSqR5fyggairAPQj9gdwC4np9qv2d8HVCh6xGZdGrl74ah
	 UdA2mO1fvIYsw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20Add=20check=20for=20maximum=20xenstore=20key=20lengths?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1755878672878
Message-Id: <8b8e2832-2403-4657-a2bd-e7a785be6e36@vates.tech>
To: "Owen Smith" <owen.smith@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250822143945.1426-1-owen.smith@cloud.com>
In-Reply-To: <20250822143945.1426-1-owen.smith@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f484fa50100247a39fa5da0e460d8df3?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250822:md
Date: Fri, 22 Aug 2025 16:04:33 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 22/08/2025 16:40, Owen Smith wrote:
> Check any xenstore path lengths before calling into xenstore, in order
> to fail without passing control to xenstored, which should fail any request
> with paths exceeding the defined maximum length.
> 
> Signed-off-by: Owen Smith <owen.smith@cloud.com>

Reviewed-by: Tu Dinh <ngoc-tu.dinh@vates.tech>

> ---
>   src/xenbus/store.c | 163 +++++++++++++++++++++++++++++++++------------
>   1 file changed, 122 insertions(+), 41 deletions(-)
> 
> diff --git a/src/xenbus/store.c b/src/xenbus/store.c
> index afb1954..27e0706 100644
> --- a/src/xenbus/store.c
> +++ b/src/xenbus/store.c
> @@ -1099,6 +1099,51 @@ RtlCaptureStackBackTrace(
>       __out_opt   PULONG  BackTraceHash
>       );
>   
> +static NTSTATUS
> +StoreCheckPathLength(
> +    _In_opt_ PSTR   Prefix,
> +    _In_ PSTR       Node
> +    )
> +{
> +    size_t          MaximumLength;
> +    size_t          Length;
> +
> +    if (Prefix != NULL) {
> +        MaximumLength = (Prefix[0] == '/' || Prefix[0] == '\0') ?
> +                    XENSTORE_ABS_PATH_MAX :
> +                    XENSTORE_REL_PATH_MAX;
> +
> +        Length = strlen(Prefix);
> +        if (Length > MaximumLength)
> +            goto fail1;
> +        MaximumLength -= Length;
> +
> +        if (MaximumLength < 1)
> +            goto fail2;
> +        MaximumLength -= 1;
> +    } else {
> +        MaximumLength = Node[0] == '/' ?
> +                            XENSTORE_ABS_PATH_MAX :
> +                            XENSTORE_REL_PATH_MAX;
> +    }
> +
> +    Length = strlen(Node);
> +    if (Length > MaximumLength)
> +        goto fail3;
> +    MaximumLength -= Length;
> +
> +    if (MaximumLength < 1)
> +        goto fail4;
> +
> +    return STATUS_SUCCESS;
> +
> +fail4:
> +fail3:
> +fail2:
> +fail1:
> +    return STATUS_INVALID_BUFFER_SIZE;
> +}
> +
>   static NTSTATUS
>   StoreRead(
>       _In_ PINTERFACE                     Interface,
> @@ -1116,6 +1161,10 @@ StoreRead(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1145,23 +1194,23 @@ StoreRead(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1170,14 +1219,15 @@ StoreRead(
>   
>       return STATUS_SUCCESS;
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1245,9 +1295,9 @@ fail3:
>       StoreFreeResponse(Response);
>   
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1326,6 +1376,10 @@ StorePrintf(
>       va_list                             Arguments;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       va_start(Arguments, Format);
>       status = StoreVPrintf(Interface,
>                               Transaction,
> @@ -1336,6 +1390,9 @@ StorePrintf(
>       va_end(Arguments);
>   
>       return status;
> +
> +fail1:
> +    return status;
>   }
>   
>   static NTSTATUS
> @@ -1352,6 +1409,10 @@ StoreRemove(
>       PXENBUS_STORE_RESPONSE              Response;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
>   
>       KeAcquireSpinLock(&Context->Lock, &Irql);
> @@ -1379,30 +1440,31 @@ StoreRemove(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail3:
> +fail4:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1423,6 +1485,10 @@ StoreDirectory(
>       PXENBUS_STORE_BUFFER                Buffer;
>       NTSTATUS                            status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
>   
>       RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
> @@ -1452,27 +1518,27 @@ StoreDirectory(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail1;
> +        goto fail2;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail3;
> +        goto fail4;
>   
>       Buffer = StoreCopyPayload(Context, Response, Caller);
>   
>       status = STATUS_NO_MEMORY;
>       if (Buffer == NULL)
> -        goto fail4;
> +        goto fail5;
>   
>       status = STATUS_OBJECT_PATH_NOT_FOUND;
>       if (Buffer->Length == 0)
> -        goto fail5;
> +        goto fail6;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -1481,17 +1547,18 @@ StoreDirectory(
>   
>       return STATUS_SUCCESS;
>   
> -fail5:
> +fail6:
>       StoreFreePayload(Context, Buffer);
>   
> +fail5:
>   fail4:
> -fail3:
>       StoreFreeResponse(Response);
>   
> +fail3:
>   fail2:
> -fail1:
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> +fail1:
>       return status;
>   }
>   
> @@ -1672,11 +1739,15 @@ StoreWatchAdd(
>       KIRQL                           Irql;
>       NTSTATUS                        status;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       *Watch = __StoreAllocate(sizeof (XENBUS_STORE_WATCH));
>   
>       status = STATUS_NO_MEMORY;
>       if (*Watch == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       (*Watch)->Magic = STORE_WATCH_MAGIC;
>       (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
> @@ -1690,7 +1761,7 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -1736,24 +1807,24 @@ StoreWatchAdd(
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail3;
> +        goto fail4;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
>       return STATUS_SUCCESS;
>   
> -fail4:
> -    Error("fail4\n");
> +fail5:
> +    Error("fail5\n");
>   
>       StoreFreeResponse(Response);
>   
> -fail3:
> -    Error("fail3\n");
> +fail4:
> +    Error("fail4\n");
>   
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
>   
> @@ -1770,8 +1841,8 @@ fail3:
>   
>       __StoreFree(Path);
>   
> -fail2:
> -    Error("fail2\n");
> +fail3:
> +    Error("fail3\n");
>   
>       (*Watch)->Caller = NULL;
>       (*Watch)->Magic = 0;
> @@ -1779,6 +1850,9 @@ fail2:
>       ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
>       __StoreFree(*Watch);
>   
> +fail2:
> +    Error("fail2\n");
> +
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   
> @@ -2057,11 +2131,15 @@ StorePermissionsSet(
>       PSTR                                PermissionString;
>       PSTR                                Segment;
>   
> +    status = StoreCheckPathLength(Prefix, Node);
> +    if (!NT_SUCCESS(status))
> +        goto fail1;
> +
>       PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
>   
>       status = STATUS_NO_MEMORY;
>       if (PermissionString == NULL)
> -        goto fail1;
> +        goto fail2;
>   
>       if (Prefix == NULL)
>           Length = (ULONG)strlen(Node) + sizeof (CHAR);
> @@ -2071,7 +2149,7 @@ StorePermissionsSet(
>       Path = __StoreAllocate(Length);
>   
>       if (Path == NULL)
> -        goto fail2;
> +        goto fail3;
>   
>       status = (Prefix == NULL) ?
>                RtlStringCbPrintfA(Path, Length, "%s", Node) :
> @@ -2088,7 +2166,7 @@ StorePermissionsSet(
>                                            Length,
>                                            &Used);
>           if (!NT_SUCCESS(status))
> -            goto fail3;
> +            goto fail4;
>   
>           Segment += Used;
>           Length -= Used;
> @@ -2108,17 +2186,17 @@ StorePermissionsSet(
>       KeReleaseSpinLock(&Context->Lock, Irql);
>   
>       if (!NT_SUCCESS(status))
> -        goto fail4;
> +        goto fail5;
>   
>       Response = StoreSubmitRequest(Context, &Request);
>   
>       status = STATUS_NO_MEMORY;
>       if (Response == NULL)
> -        goto fail5;
> +        goto fail6;
>   
>       status = StoreCheckResponse(Response);
>       if (!NT_SUCCESS(status))
> -        goto fail6;
> +        goto fail7;
>   
>       StoreFreeResponse(Response);
>       ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> @@ -2128,9 +2206,12 @@ StorePermissionsSet(
>   
>       return STATUS_SUCCESS;
>   
> +fail7:
> +    Error("fail7\n");
> +    StoreFreeResponse(Response);
> +
>   fail6:
>       Error("fail6\n");
> -    StoreFreeResponse(Response);
>   
>   fail5:
>       Error("fail5\n");
> @@ -2138,17 +2219,17 @@ fail5:
>   fail4:
>       Error("fail4\n");
>   
> +    __StoreFree(Path);
> +    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +
>   fail3:
>       Error("fail3\n");
>   
> -    __StoreFree(Path);
> -    ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
> +    __StoreFree(PermissionString);
>   
>   fail2:
>       Error("fail2\n");
>   
> -    __StoreFree(PermissionString);
> -
>   fail1:
>       Error("fail1 (%08x)\n", status);
>   



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Wed Aug 27 09:22:00 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 27 Aug 2025 09:22:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1089474.1450671 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urCLt-0008NE-Pz; Wed, 27 Aug 2025 09:21:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1089474.1450671; Wed, 27 Aug 2025 09:21:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urCLt-0008N7-NH; Wed, 27 Aug 2025 09:21:57 +0000
Received: by outflank-mailman (input) for mailman id 1089474;
 Fri, 22 Aug 2025 04:34:51 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Gr2Q=3C=cloud.com=david.preetham@srs-se1.protection.inumbo.net>)
 id 1upJUJ-00052U-ME
 for win-pv-devel@lists.xenproject.org; Fri, 22 Aug 2025 04:34:51 +0000
Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com
 [2a00:1450:4864:20::529])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 575f6170-7f11-11f0-a32b-13f23c93f187;
 Fri, 22 Aug 2025 06:34:50 +0200 (CEST)
Received: by mail-ed1-x529.google.com with SMTP id
 4fb4d7f45d1cf-6188b5b11b2so2399104a12.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 21 Aug 2025 21:34:50 -0700 (PDT)
Received: from mewpvdipd1167.corp.cloud.com ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-61a75794cfcsm6115639a12.43.2025.08.21.21.34.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 21 Aug 2025 21:34:49 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 575f6170-7f11-11f0-a32b-13f23c93f187
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=cloud.com; s=cloud; t=1755837290; x=1756442090; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to;
        bh=EFB/5DRuqbz7GHezVCrn2LY00yZx03f6BfcEeHHW7Zw=;
        b=XHuv8uzYP/KcH/4NlBrDSza94nuQIWV/27Zsp3qJ6T2dlcchzlT2+8RNA4vvYr3KKv
         sc3RbkOvwAKPvJ/Vux4LCGpI5JKxFf4WJyqtMchfpaUwQyd3tvQxqStaMGAtOy9ypuqU
         Wcs6SxstV0P1cTpn+aZAsv4dKCrq6VO5mTBSY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1755837290; x=1756442090;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=EFB/5DRuqbz7GHezVCrn2LY00yZx03f6BfcEeHHW7Zw=;
        b=cFLqnptGVwCGawZrZ5JMFA29JpeVdh2mqYMIf6ZkOwpfVA5DmhOpN72DPwMJ1fkX6M
         xjgZL6YMp5NvFYw28ciVMSox7TJRuRfOsataICnHFri4QGLDLVUfOLm0zKO+amHzSXBW
         nZW3aygztbhMm4u8C2OBQvJH8iB3+oPt+We5hELsYCAtPJWnYy/UHDj4oSlajidQBAMl
         gCzGJAcjN3OanU0tGoFOCI0YxVtf4OQpJlS3ml30FroXBcXH6+n6Qn9C3W14Npf+s1eQ
         74YfkBHNSGF1QeLy7YAaIV0h8CzrzneIZWRlie/yCE2JdBy64cdY4zkVk+HdwXUYthPL
         S7Hw==
X-Gm-Message-State: AOJu0YxL0UMav+fUD9YFhNL+h0olvAxePR1Jxa2ANea0GR+8ozRxAv4U
	g/NNf3QqY8b112ugvgzm+/itXv/9vcVG0PFCfbJRY8C9WGHZ2rWFZ43e+3P7KuRzeidQLpCnCWU
	B3A6P+BY=
X-Gm-Gg: ASbGncv4AJaBSqJSFqXrEd8vh0GrHBZHqZ9SXPXpHiEeTUQWz0il0sgCCGGDA15AVmE
	gPj4owJ3pAGzoOAQhzI20YkFCEMAIgGdDnFV8ecnQqY1Otj/I9YE5h0VIOEpsXtxmjWp0FSERue
	4hp7IBYG68XSSv7XhUQnj4bcE04AiWlMC+WkXn+6ljIHmfK0ctM6lIUpDWjxIXDv6fDxOsg41U9
	yehSvYOjd5zvSV6HnWQjb6X2lJiwijTDlswfKQf9GO5jn7LNemf98yyGVwbUwA0JBO8F7qaQlqk
	Pt4hINkmDfhulFHAWG3JUzh6B7UIf5vwJ7vD+8Z6+Er1xiezprZB9A83OJqqEbn6HFCj8Kb33t4
	BNn1g9Y0ncwgL64RKPIUUnln05TpPOl5oQRI7QOys3dVEC8gOz7pNovt8A086qQ==
X-Google-Smtp-Source: AGHT+IFMM15LeqDt1sB7xzT9+khUqWpXOwjpMcD7WFDXab6yXbshUTkZ5aeOf45VPpptDCcYxge1dA==
X-Received: by 2002:a05:6402:21d6:b0:61a:7e43:65f7 with SMTP id 4fb4d7f45d1cf-61c1b6e4a0amr1228948a12.18.1755837289907;
        Thu, 21 Aug 2025 21:34:49 -0700 (PDT)
From: david ambu <david.preetham@cloud.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@cloud.com>
Subject: [PATCH] xenbus: fix memory leak in failure path by freeing context
Date: Fri, 22 Aug 2025 10:04:23 +0530
Message-ID: <20250822043423.668-1-david.preetham@cloud.com>
X-Mailer: git-send-email 2.46.1.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

In certain error paths, the context memory was not being released,
causing a potential memory leak. Ensure that __CacheFree() and
__GnttabFree() are called on failure to properly release resources
and reset the context.

Signed-off-by: david ambu <david.preetham@cloud.com>
---
 src/xenbus/cache.c  | 2 ++
 src/xenbus/gnttab.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index d60ae29..e34504b 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -1274,6 +1274,8 @@ fail2:
 
     RtlZeroMemory(&(*Context)->DebugInterface,
                   sizeof (XENBUS_DEBUG_INTERFACE));
+    __CacheFree(*Context);
+    *Context = NULL;
 
 fail1:
     Error("fail1 (%08x)\n", status);
diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 693e9b3..d3bd0ae 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -1138,6 +1138,8 @@ GnttabInitialize(
 
 fail2:
     Error("fail2\n");
+    __GnttabFree(*Context);
+    *Context = NULL;
 
 fail1:
     Error("fail1 (%08x)\n", status);
-- 
2.46.1.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 28 22:01:27 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Aug 2025 22:01:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1100081.1453659 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urkgO-0006Nw-Mo; Thu, 28 Aug 2025 22:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1100081.1453659; Thu, 28 Aug 2025 22:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urkgO-0006No-K8; Thu, 28 Aug 2025 22:01:24 +0000
Received: by outflank-mailman (input) for mailman id 1100081;
 Thu, 28 Aug 2025 22:01:23 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0K6e=3I=bounce.vates.tech=bounce-md_30504962.68b0d1ae.v1-c7c1968dbd494302a0c8b6e608fc9abf@srs-se1.protection.inumbo.net>)
 id 1urkgN-0006Ni-9I
 for win-pv-devel@lists.xenproject.org; Thu, 28 Aug 2025 22:01:23 +0000
Received: from mail187-26.suw11.mandrillapp.com
 (mail187-26.suw11.mandrillapp.com [198.2.187.26])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 86cdaaa1-845a-11f0-8dd7-1b34d833f44b;
 Fri, 29 Aug 2025 00:01:21 +0200 (CEST)
Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail187-26.suw11.mandrillapp.com (Mailchimp) with ESMTP id
 4cCb2Q3YnKzKsbJ8m
 for <win-pv-devel@lists.xenproject.org>; Thu, 28 Aug 2025 22:01:18 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 c7c1968dbd494302a0c8b6e608fc9abf; Thu, 28 Aug 2025 22:01:18 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 86cdaaa1-845a-11f0-8dd7-1b34d833f44b
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1756418478; x=1756688478;
	bh=Oi5wArG57LovJm8xwmZGI4ZGIxarj5aM2CXhcUaRoL8=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=rog7Xjmnyj5EOH/rAMjT9HQ7k2MkxoZq0WdfJp6aVPJCwhI18DFWljNo9A4DwB5Gu
	 ReAdfAQkhiWLjK9kZKJdWwYe8ifz2N37cSV26+T3LDtRlA+Qnr84aQV84ORjaUWj/c
	 fhqKmq5yckKDyOO+OMdlaFLm8f4n910KZo8r9EALr58A/AxYA44dCS9BKDIleYQsCN
	 tXUrHhCbi87oHWeXWy6s0MTVTfkEfpNZ3kBeyoAeAfBU7/Huzzgnz7BhHlcjrHgiLt
	 yVDL1lAoC6V4PHcbMHpJbEbMIETIrUuQNLR0IGL4Z9aEjLYusX5Eh5H3qAjDO2MeQv
	 h4BVgNGkSgMGQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1756418478; x=1756678978; i=ngoc-tu.dinh@vates.tech;
	bh=Oi5wArG57LovJm8xwmZGI4ZGIxarj5aM2CXhcUaRoL8=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=wNWe6XNB0WR1Fin8Z2ZX89JizbHgBksFj6ZMsRnBzuCUfC+oBGTmX3hEm9BUaaXlw
	 1Mb7F4Dz8F9MyYWckEuXvrMYo094H1fWOzVT/2jZTKGOuaJhL37tdENmpTcKDLCMfG
	 65v0nL9vMWUusAuJgBtWsfXprYCqiG+5Gs6XPFYTlfAc6i7ASvKYWbx6pHngjSfLOb
	 Tt9+tNo3X2WJNHMPSsmo03UZUVP1rxnC9lDBErPjDmwFW3jfzsr+DZUhZnpBpIXwdn
	 EFQeT/CjkZGuhJPbCYG5nx2w6Vn3IrirJPQRHIM6VjDqbHs1nHJAL6V1eEl1Ju+RHD
	 Jx5wTCRp/D44w==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH]=20Skip=20hash=20update=20if=20frontend=20is=20not=20enabled?=
X-Mailer: git-send-email 2.51.0.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1756418477482
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250828220113.1268-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c7c1968dbd494302a0c8b6e608fc9abf?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250828:md
Date: Thu, 28 Aug 2025 22:01:18 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

NDIS may set OID_GEN_RECEIVE_SCALE_PARAMETERS during an
IRP_MN_REMOVE_DEVICE, after the frontend has been torn down. This will
cause the ensuing control request to hang.

Skip __FrontendUpdateHash if the frontend is not enabled. The skip is
done here since we still need to update Frontend->Hash in case the
frontend is enabled again later.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif/frontend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 90ec2b1..c497f24 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -1889,6 +1889,9 @@ __FrontendUpdateHash(
     ULONG                   Flags;
     NTSTATUS                status;
 
+    if (Frontend->State != FRONTEND_ENABLED)
+        goto done;
+
     Controller = __FrontendGetController(Frontend);
 
     switch (Hash->Algorithm) {
-- 
2.51.0.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Thu Aug 28 22:08:13 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Aug 2025 22:08:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1100083.1453662 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urkmy-0006bB-6R; Thu, 28 Aug 2025 22:08:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1100083.1453662; Thu, 28 Aug 2025 22:08:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urkmy-0006b4-3v; Thu, 28 Aug 2025 22:08:12 +0000
Received: by outflank-mailman (input) for mailman id 1100083;
 Thu, 28 Aug 2025 22:08:10 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=P5OY=3I=bounce.vates.tech=bounce-md_30504962.68b0d345.v1-6afd01062cb64fd8961308f72ac187f2@srs-se1.protection.inumbo.net>)
 id 1urkmw-0006ay-4b
 for win-pv-devel@lists.xenproject.org; Thu, 28 Aug 2025 22:08:10 +0000
Received: from mail187-26.suw11.mandrillapp.com
 (mail187-26.suw11.mandrillapp.com [198.2.187.26])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 79634a89-845b-11f0-8adc-4578a1afcccb;
 Fri, 29 Aug 2025 00:08:08 +0200 (CEST)
Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail187-26.suw11.mandrillapp.com (Mailchimp) with ESMTP id
 4cCbBF4Mm0zKsbJ83
 for <win-pv-devel@lists.xenproject.org>; Thu, 28 Aug 2025 22:08:05 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 6afd01062cb64fd8961308f72ac187f2; Thu, 28 Aug 2025 22:08:05 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 79634a89-845b-11f0-8adc-4578a1afcccb
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1756418885; x=1756688885;
	bh=PCaKZUNSM4txwC26GGHa6Pn8f8R88UmgWE/wOYG/Quw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=VOFa0hybYmRcBjgqjmPTkiOhjARmjb0cir7b1z9eLI8kjDWTdw+YPrWxXVm4SvJk8
	 7UIgYt3d+fQC6xWydMtpieqdnEBF3gzo6BFCdQxqd2oEX5cMD4Hkmzu5RdLv3JWmov
	 lQNl5fkZWB1p+ysZeWCA7kMx1ltVBVgvc9t2kk7uSdVLJrPmU/fz5my3+Lv2Q2Ty8h
	 ADI0TEvgyNKNurMDmwsjyRmp/B7xA1GuA134YEVpDDA9xkCBbZjzfpvI3pXp0hFX1r
	 xxJW8WlPLLa6SygXzTTrNlx4vq0dTnCRdu+q+tQ7FYT3HvuxoIs13viJwhu2iIxvAA
	 V58FNozanyKGA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1756418885; x=1756679385; i=ngoc-tu.dinh@vates.tech;
	bh=PCaKZUNSM4txwC26GGHa6Pn8f8R88UmgWE/wOYG/Quw=;
	h=From:Subject:Message-Id:To:References:In-Reply-To:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=kZYUtUFuprON3hAQNYF3fsa6VdOtcsoO/zn5Te9BoQNpwWwAC7xfoU6/mCLSzCqdS
	 Ou15HSO5qJj9Xhf98OUH+nWH5P0UuTsAHSifZwxe/feF3jylkdHmFuq//q9cd4l9Os
	 GrJaadidnVXmhXCNeWYWl5jFnwCZfjhFRRHykYUSWtDFKGNf3T4HwEstuuZ7WZm8GN
	 /4nCZbPHu8rN85MN7eje7l7mRfb2bhJOlhPN6wMd72yNqMQAMIrhrmK1vCr4RYaLx7
	 o4EhVIqeh5NScBPbsKENetZ7D2SGJspOmdBzjtZwgOwpQMfeNNk+KHNEgk325D8Nt2
	 1ZLqedxqLhQZw==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?Re:=20[PATCH]=20xenbus:=20fix=20memory=20leak=20in=20failure=20path=20by=20freeing=20context?=
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1756418884636
Message-Id: <a080abea-42cd-4cbc-a6c8-5f670242ea27@vates.tech>
To: "david ambu" <david.preetham@cloud.com>, win-pv-devel@lists.xenproject.org
References: <20250822043423.668-1-david.preetham@cloud.com>
In-Reply-To: <20250822043423.668-1-david.preetham@cloud.com>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.6afd01062cb64fd8961308f72ac187f2?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250828:md
Date: Thu, 28 Aug 2025 22:08:05 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

On 27/08/2025 11:22, david ambu wrote:
> In certain error paths, the context memory was not being released,
> causing a potential memory leak. Ensure that __CacheFree() and
> __GnttabFree() are called on failure to properly release resources
> and reset the context.
> 
> Signed-off-by: david ambu <david.preetham@cloud.com>

The commit subject should be "Fix memory leak in failure path by freeing 
context" to follow the existing convention.

I'd also prefer seeing the patch split into 2 separate ones for cache 
and gnttab, in which case they can have the "cache: " and "gnttab: " 
prefixes to specify which component is being fixed.

> ---
>   src/xenbus/cache.c  | 2 ++
>   src/xenbus/gnttab.c | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
> index d60ae29..e34504b 100644
> --- a/src/xenbus/cache.c
> +++ b/src/xenbus/cache.c
> @@ -1274,6 +1274,8 @@ fail2:
>   
>       RtlZeroMemory(&(*Context)->DebugInterface,
>                     sizeof (XENBUS_DEBUG_INTERFACE));

Please add a blank line here.

> +    __CacheFree(*Context);
> +    *Context = NULL;
>   
>   fail1:
>       Error("fail1 (%08x)\n", status);
> diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
> index 693e9b3..d3bd0ae 100644
> --- a/src/xenbus/gnttab.c
> +++ b/src/xenbus/gnttab.c
> @@ -1138,6 +1138,8 @@ GnttabInitialize(
>   
>   fail2:
>       Error("fail2\n");

Same here.

> +    __GnttabFree(*Context);
> +    *Context = NULL;
>   
>   fail1:
>       Error("fail1 (%08x)\n", status);



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 29 09:34:38 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Aug 2025 09:34:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1100953.1454196 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urvVE-0002g0-P3; Fri, 29 Aug 2025 09:34:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1100953.1454196; Fri, 29 Aug 2025 09:34:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urvVE-0002fs-M9; Fri, 29 Aug 2025 09:34:36 +0000
Received: by outflank-mailman (input) for mailman id 1100953;
 Fri, 29 Aug 2025 09:34:35 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=pCkK=3J=bounce.vates.tech=bounce-md_30504962.68b17428.v1-0b76418f873b416db959dae851197303@srs-se1.protection.inumbo.net>)
 id 1urvVD-0002eL-EF
 for win-pv-devel@lists.xenproject.org; Fri, 29 Aug 2025 09:34:35 +0000
Received: from mail187-26.suw11.mandrillapp.com
 (mail187-26.suw11.mandrillapp.com [198.2.187.26])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 5ebf4bc4-84bb-11f0-8adc-4578a1afcccb;
 Fri, 29 Aug 2025 11:34:33 +0200 (CEST)
Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail187-26.suw11.mandrillapp.com (Mailchimp) with ESMTP id
 4cCtQJ3K3bzKsbHqB
 for <win-pv-devel@lists.xenproject.org>; Fri, 29 Aug 2025 09:34:32 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 0b76418f873b416db959dae851197303; Fri, 29 Aug 2025 09:34:32 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5ebf4bc4-84bb-11f0-8adc-4578a1afcccb
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1756460072; x=1756730072;
	bh=M04Jd463YDqxQLD5Jzi7O265d4dA8X3L7gOzUsIDD2k=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=iwrxRy5PTBtZOyZDUQ1Wf22CSLkt02MzF0BGMJtnRW7FkbYZMqSp7pDmjREQSHQtq
	 8PArz9Fq14yCsb6dF1gPWD8H15JvgRQ4ntcDOV/01oj+t9FLuFk181DPAHSbec2qeL
	 vnz55KS4tPborJ9s4EkdfbdM1ohxHTkhMyGyIqi1mWTfWCQTfk26D/7H6INz+5MVKg
	 pUwcoX4L9WWPY8xcqenoPde21lCF42oWUc9JevFIoPlkMJ92JutOGhYMqgPf9usXPa
	 MiCDDzj35mvF1UP0+1OCjLmSlwC/7VH5fdV4bW+PEfyyou8iF3G/0/oDrhFVHRuw3Q
	 GwJqdFvRTjk9Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1756460072; x=1756720572; i=ngoc-tu.dinh@vates.tech;
	bh=M04Jd463YDqxQLD5Jzi7O265d4dA8X3L7gOzUsIDD2k=;
	h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From;
	b=0TM8eF6wRHg4u8HVKtzs2nenEsLsJA66P7WtMc8eUVZF1HZkAyIv+fZy4KtvQ8YEZ
	 ezWW2t43dhjxoCDlJ9FVAyMArr2IAeY2iUxX7/jo3lnYDID/BbmEyZT9G6+x6mDQyi
	 0UICccpRnOUi5E9uCf+D+1lwZkywKQUKW/p2K8xd4aaFXMlh+jLccKesNp2XVHp37z
	 oxhQX8zvRDJPfcLZ+MowPTxBGItHS9f3J/akFjxQSiIqK0aT3ljQouhcGjWzMM9IrR
	 iNgE46XebXkNIS1YTChuXhgXw0A83g7ThJFC7OKZyUNx0lQbO4NNO6Mr2OQix5olKq
	 JoazGYa9UVSag==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVIF=20PATCH]=20Early-stop=20state=20wait=20when=20backend=20disappears?=
X-Mailer: git-send-email 2.51.0.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1756460071378
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250829093408.425-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.0b76418f873b416db959dae851197303?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250829:md
Date: Fri, 29 Aug 2025 09:34:32 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

During VIF unplug, if the backend disappears before FrontendWaitFor-
BackendXenbusStateChange is called, that function will block at
XenbusStateUnknown and cause the system to hang until the timeout
expires.

Break out of the watch loop as soon as this condition is detected to
avoid this hang.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif/frontend.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index c497f24..daeab9c 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -1404,7 +1404,12 @@ FrontendWaitForBackendXenbusStateChange(
                               __FrontendGetBackendPath(Frontend),
                               "state",
                               &Buffer);
-        if (!NT_SUCCESS(status)) {
+        if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+            *State = XenbusStateUnknown;
+            Trace("%s disappeared\n",
+                  __FrontendGetBackendPath(Frontend));
+            break;
+        } else if (!NT_SUCCESS(status)) {
             *State = XenbusStateUnknown;
         } else {
             *State = (XenbusState)strtol(Buffer, NULL, 10);
-- 
2.51.0.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



From win-pv-devel-bounces@lists.xenproject.org Fri Aug 29 09:40:45 2025
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Aug 2025 09:40:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1100959.1454202 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urvbA-0003q3-7B; Fri, 29 Aug 2025 09:40:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1100959.1454202; Fri, 29 Aug 2025 09:40:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1urvbA-0003pu-3z; Fri, 29 Aug 2025 09:40:44 +0000
Received: by outflank-mailman (input) for mailman id 1100959;
 Fri, 29 Aug 2025 09:40:43 +0000
Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254]
 helo=se1-gles-sth1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=RwcF=3J=bounce.vates.tech=bounce-md_30504962.68b17598.v1-d4d5811ac41845a6bcc7853abf7e86dd@srs-se1.protection.inumbo.net>)
 id 1urvb9-0003pl-9h
 for win-pv-devel@lists.xenproject.org; Fri, 29 Aug 2025 09:40:43 +0000
Received: from mail180-6.suw31.mandrillapp.com
 (mail180-6.suw31.mandrillapp.com [198.2.180.6])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 3a411385-84bc-11f0-8adc-4578a1afcccb;
 Fri, 29 Aug 2025 11:40:42 +0200 (CEST)
Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1])
 by mail180-6.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4cCtYN5tkqz2K1sDQ
 for <win-pv-devel@lists.xenproject.org>; Fri, 29 Aug 2025 09:40:40 +0000 (GMT)
Received: from [37.26.189.201] by mandrillapp.com id
 d4d5811ac41845a6bcc7853abf7e86dd; Fri, 29 Aug 2025 09:40:40 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3a411385-84bc-11f0-8adc-4578a1afcccb
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com;
	s=mte1; t=1756460440; x=1756730440;
	bh=Xx18awOFJ9+XoudkDI/X7rKnaSDq9AtaPxchM6hzDOI=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=WhWw0NIifmrASEb4N7g2qYQ8Pwc7eiIrrrLi3RuRgDsYCWuXK83BrW+wJdGYSkhbe
	 G/OeELB10xpGyD7ZAP8PUihn99MYZ7j6rdiPtaSaBR3BQATieX94GRTtLtdwfj1huL
	 KQj3B4S74/bAYeuYexYeev/amlkx14LcJLSMehjurHecnZeK3e1Zfqa347tt4VrITI
	 S5c71pqSyFgKMp4EgYllskV3vj7QohATYaOzJ1pynKjJ/1nOFSYaq7EOIwA1q04PJd
	 HfwhgRuZYoYLWRdYFOeAZM+vN9s5HTct5CQCxEIZB860FXHRobGarIEIvIbj/A449x
	 nQurCON0ewPgg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1;
	t=1756460440; x=1756720940; i=ngoc-tu.dinh@vates.tech;
	bh=Xx18awOFJ9+XoudkDI/X7rKnaSDq9AtaPxchM6hzDOI=;
	h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID:
	 Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date:
	 Subject:From;
	b=F2KTN9+opsF7HlSRsQ1liSbVE4PYnhnw1XBuvcAUG3k7ya6VjYCsEP0HQ7Bkeh7I1
	 enDIQ+S+0ASW0BWOSRYlsIL5Cl2C+yA1uyQbvCeJ+VD00Xr5hbD2mRDJFgbiZrY4CB
	 k/7yKZCrfCClV42Hfh+zuigcuhgdodXQZ25fYY6U4N7dO6dl10G1dDlI9KKt1wRutt
	 A4axiAiqA9terXwtyHpgWZ0ptxx1A9BxJuxWuk/HyarUoCmP5ocS9f20P1KbsxGq7H
	 /VyXmC9m2ZaH7YoJFnxpRa9GvvxDFzeY417bGmKwRldYXGfYbsoxPpyvzjVebJlrsY
	 8i94apIG5ZBAQ==
From: "Tu Dinh" <ngoc-tu.dinh@vates.tech>
Subject: =?utf-8?Q?[XENVKBD=20PATCH]=20Early-stop=20state=20wait=20when=20backend=20disappears?=
X-Mailer: git-send-email 2.51.0.windows.1
X-Bm-Disclaimer: Yes
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1756460440105
To: win-pv-devel@lists.xenproject.org
Cc: "Tu Dinh" <ngoc-tu.dinh@vates.tech>, "Owen Smith" <owen.smith@cloud.com>
Message-Id: <20250829094037.589-1-ngoc-tu.dinh@vates.tech>
In-Reply-To: <20250829093408.425-1-ngoc-tu.dinh@vates.tech>
References: <20250829093408.425-1-ngoc-tu.dinh@vates.tech>
X-Native-Encoded: 1
X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d4d5811ac41845a6bcc7853abf7e86dd?=
X-Mandrill-User: md_30504962
Feedback-ID: 30504962:30504962.20250829:md
Date: Fri, 29 Aug 2025 09:40:40 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

During unplug, if the backend disappears before FrontendWaitForBackend-
XenbusStateChange is called, that function will block at
XenbusStateUnknown and cause the system to hang until the timeout
expires.

Break out of the watch loop as soon as this condition is detected to
avoid this hang.

Ported from Xenvif.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvkbd/frontend.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xenvkbd/frontend.c b/src/xenvkbd/frontend.c
index 801ba35..a1f16f8 100644
--- a/src/xenvkbd/frontend.c
+++ b/src/xenvkbd/frontend.c
@@ -462,7 +462,12 @@ FrontendWaitForBackendXenbusStateChange(
                               __FrontendGetBackendPath(Frontend),
                               "state",
                               &Buffer);
-        if (!NT_SUCCESS(status)) {
+        if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
+            *State = XenbusStateUnknown;
+            Trace("%s disappeared\n",
+                  __FrontendGetBackendPath(Frontend));
+            break;
+        } else if (!NT_SUCCESS(status)) {
             *State = XenbusStateUnknown;
         } else {
             *State = (XenbusState)strtol(Buffer, NULL, 10);
-- 
2.51.0.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



