-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qemu: fix USB redirect not working when -S is used
Fixes #4263
- Loading branch information
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -366,3 +366,103 @@ index 18cadc72bd..c39baf9a32 100644 | |
-- | ||
2.32.0 (Apple Git-132) | ||
|
||
From 51a16884c30459b8871e5783f2b879b8e52d3554 Mon Sep 17 00:00:00 2001 | ||
From: osy <[email protected]> | ||
Date: Mon, 8 Aug 2022 14:44:10 -0700 | ||
Subject: [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot | ||
restore" | ||
|
||
Run state is also in RUN_STATE_PRELAUNCH while "-S" is used. | ||
|
||
This reverts commit 12d182898a4866e4be418e2abac286b497cfa1b2. | ||
--- | ||
hw/usb/redirect.c | 3 +-- | ||
1 file changed, 1 insertion(+), 2 deletions(-) | ||
|
||
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c | ||
index d45165fe6b..8692ea2561 100644 | ||
--- a/hw/usb/redirect.c | ||
+++ b/hw/usb/redirect.c | ||
@@ -1280,8 +1280,7 @@ static void usbredir_create_parser(USBRedirDevice *dev) | ||
} | ||
#endif | ||
|
||
- if (runstate_check(RUN_STATE_INMIGRATE) || | ||
- runstate_check(RUN_STATE_PRELAUNCH)) { | ||
+ if (runstate_check(RUN_STATE_INMIGRATE)) { | ||
flags |= usbredirparser_fl_no_hello; | ||
} | ||
usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE, | ||
-- | ||
2.28.0 | ||
|
||
From 6e9f737fcc582d38037c08111d8e1913d418c0ca Mon Sep 17 00:00:00 2001 | ||
From: osy <[email protected]> | ||
Date: Mon, 8 Aug 2022 14:46:41 -0700 | ||
Subject: [PATCH 2/3] vl: on -loadvm set run state to "restore-vm" | ||
|
||
This allows us to differentiate between a fresh boot and a restore boot. | ||
--- | ||
softmmu/runstate.c | 1 + | ||
softmmu/vl.c | 3 +++ | ||
2 files changed, 4 insertions(+) | ||
|
||
diff --git a/softmmu/runstate.c b/softmmu/runstate.c | ||
index e0d869b21a..f7bb5ef1eb 100644 | ||
--- a/softmmu/runstate.c | ||
+++ b/softmmu/runstate.c | ||
@@ -77,6 +77,7 @@ typedef struct { | ||
|
||
static const RunStateTransition runstate_transitions_def[] = { | ||
{ RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, | ||
+ { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM }, | ||
|
||
{ RUN_STATE_DEBUG, RUN_STATE_RUNNING }, | ||
{ RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE }, | ||
diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
index dbcfef10fb..d779a1537e 100644 | ||
--- a/softmmu/vl.c | ||
+++ b/softmmu/vl.c | ||
@@ -3291,6 +3291,9 @@ void qemu_init(int argc, char **argv, char **envp) | ||
add_device_config(DEV_DEBUGCON, optarg); | ||
break; | ||
case QEMU_OPTION_loadvm: | ||
+ if (!loadvm) { | ||
+ runstate_set(RUN_STATE_RESTORE_VM); | ||
+ } | ||
loadvm = optarg; | ||
break; | ||
case QEMU_OPTION_full_screen: | ||
-- | ||
2.28.0 | ||
|
||
From f129a2b8db804d5792db351241820299a5717a65 Mon Sep 17 00:00:00 2001 | ||
From: osy <[email protected]> | ||
Date: Mon, 8 Aug 2022 16:13:20 -0700 | ||
Subject: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore | ||
|
||
When launching QEMU with "-loadvm", usbredir_create_parser() should avoid | ||
setting up the hello packet (just as with "-incoming". On the latest version | ||
of libusbredir, usbredirparser_unserialize() will return error if the parser | ||
is not "pristine." | ||
--- | ||
hw/usb/redirect.c | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c | ||
index 8692ea2561..5ee2cc88d5 100644 | ||
--- a/hw/usb/redirect.c | ||
+++ b/hw/usb/redirect.c | ||
@@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev) | ||
} | ||
#endif | ||
|
||
- if (runstate_check(RUN_STATE_INMIGRATE)) { | ||
+ if (runstate_check(RUN_STATE_INMIGRATE) || | ||
+ runstate_check(RUN_STATE_RESTORE_VM)) { | ||
flags |= usbredirparser_fl_no_hello; | ||
} | ||
usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE, | ||
-- | ||
2.28.0 | ||
|