Condividi tramite


IOCTL_SRIOV_ATTACH IOCTL (pcivirt.h)

La richiesta indica che lo stack di virtualizzazione vuole registrarsi per gli eventi Plug and Play ricevuti dal dispositivo SR-IOV.

Codice principale

IRP_MJ_DEVICE_CONTROL

Blocco di stato

Irp-> IoStatus.Status è impostato su STATUS_SUCCESS se la richiesta ha esito positivo. In caso contrario, stato alla condizione di errore appropriata come codice NTSTATUS.

Osservazioni

Questa richiesta IOCTL viene inviata dallo stack di virtualizzazione al driver PCI Express SR-IOV Physical Function (PF) che espone GUID_DEVINTERFACE_VIRTUALIZABLE_DEVICE.

Questa richiesta non è sicura se il dispositivo PF è attualmente arrestato o arrestato per il bilanciamento delle risorse. Un dispositivo viene considerato arrestato dopo aver ricevuto IRP_MN_QUERY_STOP_DEVICE e riavviato quando riceve IRP_MN_CANCEL_STOP_DEVICE o quando IRP_MN_START_DEVICE viene completato dai dispositivi inferiori nello stack. In questo caso, il driver deve ritardare il completamento di questa richiesta fino al riavvio del dispositivo.

Non è necessario mantenere l'IRP in sospeso perché la richiesta viene sempre inviata come IRP in modalità kernel sincrona che impedisce al chiamante di bloccare il thread in qualsiasi caso.

Al termine di questa richiesta, il provider di servizi virtuali può successivamente inviare richieste di IOCTL_SRIOV_NOTIFICATION e IOCTL_SRIOV_EVENT_COMPLETE.

Per annullare la registrazione per gli eventi Plug and Play, il provider di servizi virtuali invia la richiesta di IOCTL_SRIOV_DETACH.

Questi eventi (definiti in SRIOV_PF_EVENT) causano il completamento di IOCTL_SRIOV_NOTIFICATION e un'attesa di IOCTL_SRIOV_EVENT_COMPLETE:

In questo esempio la gestione della richiesta di IOCTL_SRIOV_ATTACH, il driver PF mantiene gli stati PnP nel contesto di dispositivo. DeviceContext->PnpRebalancing è impostato su TRUE, quando il driver riceve IRP_MN_QUERY_STOP_DEVICE e impostato su FALSE quando riceve IRP_MN_START_DEVICE.
    case IOCTL_SRIOV_ATTACH:
        TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "IOCTL_SRIOV_ATTACH:\n");

        WdfWaitLockAcquire(fdoContext->PnpStateLock, NULL);

        //
        // Block until it is safe for the VSP to attach.  Don't
        // bother with pending this IRP since this is always a sent as
        // a synchronous kernel-mode IRP and the caller would block
        // the thread anyway.  May need to repeat the wait since
        // waiting for the safe-to-attach event must not be done while
        // holding the state lock.
        //
        while (fdoContext->PnpSafeToAttach == FALSE)
        {
            WdfWaitLockRelease(fdoContext->PnpStateLock);

            KeWaitForSingleObject(&fdoContext->PnpSafeEvent,
                                  Executive,
                                  KernelMode,
                                  FALSE,
                                  NULL);

            WdfWaitLockAcquire(fdoContext->PnpStateLock, NULL);
        }

        //
        // Allow only a single attach at any time.
        //
        if (fdoContext->PnpVspAttached == FALSE)
        {
            fdoContext->PnpVspAttached = TRUE;
            status = STATUS_SUCCESS;
        }
        else
        {
            status = STATUS_SHARING_VIOLATION;
        }
        WdfWaitLockRelease(fdoContext->PnpStateLock);

        break;

Fabbisogno

Requisito Valore
intestazione pcivirt.h
IRQL PASSIVE_LEVEL

Vedere anche

WdfIoTargetSendInternalIoctlSynchronously

WdfIoTargetSendInternalIoctlOthersSynchronously

creazione di richieste IOCTL nei driver

IOCTL_SRIOV_DETACH

WdfIoTargetSendIoctlSynchronously