On 5/6/26 05:26, Jamin Lin wrote:
Rename the 32-bit fetch address migration helper fields to make
their purpose clearer.
These fields are only used for migration compatibility with older
machine types that transfer 32-bit fetch addresses in the migration
stream. They are not runtime fetch address state.
Also add comments to clarify the relationship between the migration
compatibility fields and the runtime 64-bit fetch address fields.
No functional change.
Signed-off-by: Jamin Lin <[email protected]>
Thanks for the extra comments,
Reviewed-by: Cédric Le Goater <[email protected]>
C.
---
hw/usb/hcd-ehci.h | 17 ++++++++++++++---
hw/usb/hcd-ehci.c | 12 ++++++------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 3d57e1de5f..b5ac9c8670 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -262,6 +262,10 @@ struct EHCIState {
/* properties */
uint32_t maxframes;
+ /*
+ * Controls migration stream compatibility for old machine types.
+ * Old machine types only transfer 32-bit fetch addresses.
+ */
bool migrate_fetch_addr_64bit;
bool caps_64bit_addr;
uint32_t ctrldssegment_default;
@@ -302,9 +306,16 @@ struct EHCIState {
EHCIQueueHead aqueues;
EHCIQueueHead pqueues;
- /* which address to look at next */
- uint32_t a_fetch_addr_32;
- uint32_t p_fetch_addr_32;
+ /*
+ * which address to look at next
+ *
+ * Migration compatibility fields for old machine types that only
+ * support 32-bit fetch addresses in the migration stream.
+ *
+ * New machine types migrate the full 64-bit runtime fetch address.
+ */
+ uint32_t migrate_a_fetch_addr;
+ uint32_t migrate_p_fetch_addr;
uint64_t a_fetch_addr;
uint64_t p_fetch_addr;
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 62c3770ac5..56ac8f6ae5 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2482,8 +2482,8 @@ static int usb_ehci_pre_save(void *opaque)
ehci->frindex = new_frindex;
if (!ehci->migrate_fetch_addr_64bit) {
- ehci->a_fetch_addr_32 = ehci->a_fetch_addr;
- ehci->p_fetch_addr_32 = ehci->p_fetch_addr;
+ ehci->migrate_a_fetch_addr = ehci->a_fetch_addr;
+ ehci->migrate_p_fetch_addr = ehci->p_fetch_addr;
}
return 0;
@@ -2507,8 +2507,8 @@ static int usb_ehci_post_load(void *opaque, int
version_id)
}
if (!s->migrate_fetch_addr_64bit) {
- s->a_fetch_addr = s->a_fetch_addr_32;
- s->p_fetch_addr = s->p_fetch_addr_32;
+ s->a_fetch_addr = s->migrate_a_fetch_addr;
+ s->p_fetch_addr = s->migrate_p_fetch_addr;
}
return 0;
@@ -2571,9 +2571,9 @@ const VMStateDescription vmstate_ehci = {
/* schedule state */
VMSTATE_UINT32(astate, EHCIState),
VMSTATE_UINT32(pstate, EHCIState),
- VMSTATE_UINT32_TEST(a_fetch_addr_32, EHCIState,
+ VMSTATE_UINT32_TEST(migrate_a_fetch_addr, EHCIState,
ehci_fetch_addr_32_needed),
- VMSTATE_UINT32_TEST(p_fetch_addr_32, EHCIState,
+ VMSTATE_UINT32_TEST(migrate_p_fetch_addr, EHCIState,
ehci_fetch_addr_32_needed),
VMSTATE_UINT64_TEST(a_fetch_addr, EHCIState,
ehci_fetch_addr_64_needed),