[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] Unplug: Set bit for NVME disk unplug



On 06/03/2026 17:08, Owen Smith wrote:
> When issuing a DISK unplug command, set the bits for emulated IDE/SCSI
> and emulated NVME devices.
> 
> Also defines and uses symbols to represent each bit in the unplug protocol.
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

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

I haven't ever tested the BootEmulated path, but it looks broken on VMs 
with NVMe anyway (can't unplug just the boot disk).

> ---
>   src/xen/unplug.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/xen/unplug.c b/src/xen/unplug.c
> index 282ed93..3b6593a 100644
> --- a/src/xen/unplug.c
> +++ b/src/xen/unplug.c
> @@ -49,6 +49,12 @@
>   
>   #define UNPLUG_TAG  'LPNU'
>   
> +#define UNPLUG_FLAGS_IDE_SCSI_DISKS   0x0001
> +#define UNPLUG_FLAGS_ALL_NICS         0x0002
> +#define UNPLUG_FLAGS_AUX_IDE_DISKS    0x0004  // ignored if 
> UNPLUG_FLAGS_IDE_SCSI_DISKS is set
> +#define UNPLUG_FLAGS_NVME_DISKS       0x0008
> +#define UNPLUG_FLAGS_ALL_DISKS        (UNPLUG_FLAGS_IDE_SCSI_DISKS | 
> UNPLUG_FLAGS_NVME_DISKS)
> +
>   typedef struct _UNPLUG_DATA {
>       PSTR        Name;
>       BOOLEAN     Found;
> @@ -116,19 +122,19 @@ UnplugDeviceType(
>       case UNPLUG_DISKS:
>           if (Context->BootEmulated) {
>   #pragma prefast(suppress:28138)
> -            WRITE_PORT_USHORT((PUSHORT)0x10, 0x0004);
> +            WRITE_PORT_USHORT((PUSHORT)0x10, UNPLUG_FLAGS_AUX_IDE_DISKS);
>   
>               LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: AUX DISKS\n");
>           } else {
>   #pragma prefast(suppress:28138)
> -            WRITE_PORT_USHORT((PUSHORT)0x10, 0x0001);
> +            WRITE_PORT_USHORT((PUSHORT)0x10, UNPLUG_FLAGS_ALL_DISKS);
>   
>               LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: DISKS\n");
>           }
>           break;
>       case UNPLUG_NICS:
>   #pragma prefast(suppress:28138)
> -        WRITE_PORT_USHORT((PUSHORT)0x10, 0x0002);
> +        WRITE_PORT_USHORT((PUSHORT)0x10, UNPLUG_FLAGS_ALL_NICS);
>   
>           LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: NICS\n");
>           break;



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.