|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH] Handle ActiveLocationInformation value not found
> -----Original Message-----
> From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Owen Smith
> Sent: 19 August 2019 15:26
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH] Handle ActiveLocationInformation value not
> found
>
> v8.2 drivers do not set ActiveLocationInformation, so when upgrading
> xenbus to v9.0, xenfilt fails during PdoSetDeviceInformation.
>
> Allow xenfilt to handle missing ActiveLocationInformation, and make
> xenbus add ActiveLocationInformation and ActiveInstanceID, if missing,
> for the active device.
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> ---
> src/xenbus/driver.c | 84
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
> src/xenbus/driver.h | 7 +++++
> src/xenbus/fdo.c | 4 +++
> src/xenfilt/pdo.c | 15 +++++-----
> 4 files changed, 102 insertions(+), 8 deletions(-)
>
> diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
> index c49a7de..a1c7b56 100644
> --- a/src/xenbus/driver.c
> +++ b/src/xenbus/driver.c
> @@ -532,6 +532,90 @@ fail1:
> return status;
> }
>
> +NTSTATUS
> +DriverUpdateActive(
> + IN PCHAR DeviceID,
> + IN PCHAR InstanceID,
> + IN PCHAR LocationInformation
> + )
> +{
> + HANDLE ActiveKey;
> + ANSI_STRING Ansi[2];
> + PCHAR ActiveInstanceID;
> + PCHAR ActiveLocationInformation;
> + NTSTATUS status;
> +
> + Trace("====>\n");
> +
> + ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
> +
> + status = RegistryOpenSubKey(NULL,
> + ACTIVE_PATH,
> + KEY_ALL_ACCESS,
> + &ActiveKey);
> + if (!NT_SUCCESS(status))
> + goto fail1;
> +
> + status = STATUS_UNSUCCESSFUL;
> + if (__DriverIsDeviceLegacy(DeviceID) &&
> + __DriverIsVendorDevicePresent())
> + goto fail2;
> +
> + RtlZeroMemory(Ansi, sizeof (ANSI_STRING) * 2);
> +
> + status = DriverGetActive("InstanceID", &ActiveInstanceID);
> + if (NT_SUCCESS(status)) {
> + ExFreePool(ActiveInstanceID);
> + } else {
> + RtlInitAnsiString(&Ansi[0], InstanceID);
> +
> + status = RegistryUpdateSzValue(ActiveKey,
> + "ActiveInstanceID",
> + REG_SZ,
> + Ansi);
> + if (!NT_SUCCESS(status))
> + goto fail3;
> + }
> +
> + status = DriverGetActive("LocationInformation",
> &ActiveLocationInformation);
> + if (NT_SUCCESS(status)) {
> + ExFreePool(ActiveLocationInformation);
> + } else {
> + RtlInitAnsiString(&Ansi[0], LocationInformation);
> +
> + status = RegistryUpdateSzValue(ActiveKey,
> + "ActiveLocationInformation",
> + REG_SZ,
> + Ansi);
> + if (!NT_SUCCESS(status))
> + goto fail4;
> + }
> +
> + Info("%s\\%s: %s\n", DeviceID, InstanceID, LocationInformation);
> +
> + RegistryCloseKey(ActiveKey);
> +
> + Trace("<====\n");
> +
> + return STATUS_SUCCESS;
> +
> +fail4:
> + Error("fail4\n");
> +
> +fail3:
> + Error("fail3\n");
> +
> +fail2:
> + Error("fail2\n");
> +
> + RegistryCloseKey(ActiveKey);
> +
> +fail1:
> + Error("fail1 (%08x)\n", status);
> +
> + return status;
> +}
> +
> NTSTATUS
> DriverClearActive(
> VOID
> diff --git a/src/xenbus/driver.h b/src/xenbus/driver.h
> index 3875b42..55ec97b 100644
> --- a/src/xenbus/driver.h
> +++ b/src/xenbus/driver.h
> @@ -77,6 +77,13 @@ DriverSetActive(
> IN PCHAR LocationInformation
> );
>
> +NTSTATUS
> +DriverUpdateActive(
> + IN PCHAR DeviceID,
> + IN PCHAR InstanceID,
> + IN PCHAR LocationInformation
> + );
> +
> NTSTATUS
> DriverClearActive(
> VOID
> diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
> index 60201fc..7047f6a 100644
> --- a/src/xenbus/fdo.c
> +++ b/src/xenbus/fdo.c
> @@ -745,6 +745,10 @@ FdoSetActive(
> status = DriverGetActive("DeviceID", &ActiveDeviceID);
> if (NT_SUCCESS(status)) {
> Fdo->Active = (_stricmp(DeviceID, ActiveDeviceID) == 0) ? TRUE :
> FALSE;
> +
> + if (Fdo->Active)
> + (VOID) DriverUpdateActive(DeviceID, InstanceID,
> LocationInformation);
> +
> ExFreePool(ActiveDeviceID);
> } else {
> status = DriverSetActive(DeviceID, InstanceID, LocationInformation);
> diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
> index 9fba36c..37b4a45 100644
> --- a/src/xenfilt/pdo.c
> +++ b/src/xenfilt/pdo.c
> @@ -289,8 +289,13 @@ PdoSetDeviceInformation(
>
> status = DriverGetActive("LocationInformation",
> &LocationInformation);
> - if (!NT_SUCCESS(status))
> - goto fail3;
> + if (!NT_SUCCESS(status)) {
> + status = DriverQueryDeviceText(Pdo->LowerDeviceObject,
> + DeviceTextLocationInformation,
> + &LocationInformation);
> + if (!NT_SUCCESS(status))
> + LocationInformation = NULL;
> + }
> } else {
> status = DriverQueryId(Pdo->LowerDeviceObject,
> BusQueryInstanceID,
> @@ -311,12 +316,6 @@ PdoSetDeviceInformation(
>
> return STATUS_SUCCESS;
>
> -fail3:
> - Error("fail3\n");
> -
> - ASSERT(Pdo->Active);
> - ExFreePool(InstanceID);
> -
> fail2:
> Error("fail2\n");
>
> --
> 2.16.2.windows.1
>
>
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/win-pv-devel
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |