hw/arm/tegra241-cmdqv: Do not sync GERRORN on VCMDQ allocation
PATCH 1/1 hw/arm/tegra241-cmdqv: Do not sync GERRORN on VCMDQ allocation
When a guest hits a command error, the hardware sets GERROR and the guest acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes its cached GERRORN of zero, while the hardware may still have both GERROR and GERRORN set from an error the previous guest acknowledged. This makes them differ again, so the hardware sees a pending error and stall the VCMDQ, leading to CMD_SYNC timeouts.
Do not sync GERRORN when allocating a hardware VCMDQ.
--- hw/arm/tegra241-cmdqv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/arm/tegra241-cmdqv.c +3 -4
@@ -212,7 +212,9 @@ static inline uint32_t *tegra241_cmdqv_vintf_lvcmdq_ptr(Tegra241CMDQV *cmdqv,/* * Flush cached register writes into the mmap'd host VINTF page0 after a * successful HW_QUEUE_ALLOC, so the guest's earlier writes survive -* the cache-to-hardware transition. +* the cache-to-hardware transition. GERRORN is intentionally not synced, +* as overwriting it with the cached value could recreate a GERROR != GERRORN +* mismatch and stall the VCMDQ. */ static void tegra241_cmdqv_sync_vcmdq (Tegra241CMDQV *cmdqv,int index) {
@@ -229,9 +231,6 @@ static void tegra241_cmdqv_sync_vcmdq(Tegra241CMDQV *cmdqv, int index) ptr =tegra241_cmdqv_vintf_lvcmdq_ptr (cmdqv, index,A_VCMDQ0_CONFIG ); *ptr = cmdqv->vcmdq_config[index]; - - ptr =tegra241_cmdqv_vintf_lvcmdq_ptr (cmdqv, index,A_VCMDQ0_GERRORN ); - *ptr = cmdqv->vcmdq_gerrorn[index]; }/*
Signature · 1 line
2.43.0
Quoted 12 lines · Shameer Kolothum
When a guest hits a command error, the hardware sets GERROR and the guest acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes its cached GERRORN of zero, while the hardware may still have both GERROR and GERRORN set from an error the previous guest acknowledged. This makes them differ again, so the hardware sees a pending error and stall the VCMDQ, leading to
CMD_SYNCtimeouts.
Quoted 5 lines
Do not sync GERRORN when allocating a hardware VCMDQ.
Fixes 1d0f77535417 ("hw/arm/tegra241-cmdqv: Route allocated VCMDQ Page0 accesses to the mmap'd host VINTF page0")Suggested-by Nicolin Chen <[email protected]>Signed-off-by Shameer Kolothum <[email protected]>
Peter Maydell
AppliedQuoted 13 lines · Shameer Kolothum
When a guest hits a command error, the hardware sets GERROR and the guest acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes its cached GERRORN of zero, while the hardware may still have both GERROR and GERRORN set from an error the previous guest acknowledged. This makes them differ again, so the hardware sees a pending error and stall the VCMDQ, leading to
CMD_SYNCtimeouts.
Quoted 5 lines
Do not sync GERRORN when allocating a hardware VCMDQ.
Fixes 1d0f77535417 ("hw/arm/tegra241-cmdqv: Route allocated VCMDQ Page0 accesses to the mmap'd host VINTF page0")Suggested-by Nicolin Chen <[email protected]>Signed-off-by Shameer Kolothum <[email protected]>
Applied to target-arm.next, thanks.
-- PMM
Hi Shameer,
Quoted 6 lines · Shameer Kolothum
When a guest hits a command error, the hardware sets GERROR and the guest acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
Quoted 7 lines
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes its cached GERRORN of zero, while the hardware may still have both GERROR and GERRORN set from an error the previous guest acknowledged. This makes them differ again, so the hardware sees a pending error and stall the VCMDQ, leading to
CMD_SYNCtimeouts.Do not sync GERRORN when allocating a hardware VCMDQ.
One question: I see cmdqv->vcmdq_gerror[index] is likely to be set in tegra241_cmdqv_setup_vcmdq(). Don't we have a risk to silence one pre-existing error?
Thanks
Eric
Quoted 33 lines
Fixes 1d0f77535417 ("hw/arm/tegra241-cmdqv: Route allocated VCMDQ Page0 accesses to the mmap'd host VINTF page0")Suggested-by Nicolin Chen <[email protected]>Signed-off-by Shameer Kolothum <[email protected]>--- hw/arm/tegra241-cmdqv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/arm/tegra241-cmdqv.c +3
-4@@ -212,7 +212,9 @@ static inline uint32_t *tegra241_cmdqv_vintf_lvcmdq_ptr(Tegra241CMDQV *cmdqv,/* * Flush cached register writes into the mmap'd host VINTF page0 after a * successful HW_QUEUE_ALLOC, so the guest's earlier writes survive -* the cache-to-hardware transition. +* the cache-to-hardware transition. GERRORN is intentionally not synced, +* as overwriting it with the cached value could recreate a GERROR != GERRORN +* mismatch and stall the VCMDQ. */ static void tegra241_cmdqv_sync_vcmdq (Tegra241CMDQV *cmdqv,int index) {@@ -229,9 +231,6 @@ static void tegra241_cmdqv_sync_vcmdq(Tegra241CMDQV *cmdqv, int index) ptr =tegra241_cmdqv_vintf_lvcmdq_ptr (cmdqv, index,A_VCMDQ0_CONFIG ); *ptr = cmdqv->vcmdq_config[index]; - - ptr =tegra241_cmdqv_vintf_lvcmdq_ptr (cmdqv, index,A_VCMDQ0_GERRORN ); - *ptr = cmdqv->vcmdq_gerrorn[index]; }/*
Hi Eric,
Quoted 30 lines
-----Original Message-----
From: Eric Auger <[email protected]>
Sent: 09 July 2026 15:51
To: Shameer Kolothum Thodi <[email protected]>; qemu- [email protected]; [email protected]
Cc: [email protected]; Nicolin Chen <[email protected]>; Nathan Chen <[email protected]>; Matt Ochs <[email protected]>; Jiandi An <[email protected]>
Subject: Re: [PATCH] hw/arm/tegra241-cmdqv: Do not sync GERRORN on VCMDQ allocationExternal email: Use caution opening links or attachments
Hi Shameer,
Quoted 1 line · Shameer Kolothum
When a guest hits a command error, the hardware sets GERROR and the
guest
Quoted 6 lines
acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes
its
Quoted 1 line
cached GERRORN of zero, while the hardware may still have both GERROR
and
Quoted 1 line
GERRORN set from an error the previous guest acknowledged. This makes
them
Quoted 8 lines
Quoted 4 lines
differ again, so the hardware sees a pending error and stall the VCMDQ, leading to
CMD_SYNCtimeouts.Do not sync GERRORN when allocating a hardware VCMDQ.
One question: I see cmdqv->vcmdq_gerror[index] is likely to be set in
tegra241_cmdqv_setup_vcmdq(). Don't we have a risk to silence one pre-existing error?
Hmm..don't think so.
vcmdq_gerror[index] is set only to report CMDQ_INIT_ERR when hardware queue allocation fails, meaning no hardware VCMDQ exists at that point. It is intentionally cleared after a successful allocation because the allocation error no longer applies.
Once the hardware VCMDQ is allocated, GERROR and GERRORN accesses are backed directly by hardware. Since QEMU no longer overwrites GERRORN, any pending hardware error where GERROR and GERRORN differ remains visible to the guest.
I can’t think of any relevant corner case issue here, though I may be missing something.
Thanks,
Shameer
Eric Auger
Reviewed-byQuoted 39 lines · Shameer Kolothum Thodi
Hi Eric,
Quoted 29 lines
-----Original Message-----
From: Eric Auger <[email protected]>
Sent: 09 July 2026 15:51
To: Shameer Kolothum Thodi <[email protected]>; qemu- [email protected]; [email protected]
Cc: [email protected]; Nicolin Chen <[email protected]>; Nathan Chen <[email protected]>; Matt Ochs <[email protected]>; Jiandi An <[email protected]>
Subject: Re: [PATCH] hw/arm/tegra241-cmdqv: Do not sync GERRORN on VCMDQ allocationExternal email: Use caution opening links or attachments
Hi Shameer,
Quoted 1 line · Shameer Kolothum
When a guest hits a command error, the hardware sets GERROR and the
guest
Quoted 6 lines
acknowledges it by writing GERRORN to match. These registers use toggle semantics, and since GERROR is read-only, both GERROR and GERRORN may remain set after an error has been handled. As long as they stay equal there is no pending error, so a subsequent VM is unaffected.
When a new VM starts, QEMU allocates the hardware VCMDQ and flushes
its
Quoted 1 line
cached GERRORN of zero, while the hardware may still have both GERROR
and
Quoted 1 line
GERRORN set from an error the previous guest acknowledged. This makes
Quoted 8 lines
them
Quoted 4 lines
differ again, so the hardware sees a pending error and stall the VCMDQ, leading to
CMD_SYNCtimeouts.Do not sync GERRORN when allocating a hardware VCMDQ.
One question: I see cmdqv->vcmdq_gerror[index] is likely to be set in
tegra241_cmdqv_setup_vcmdq(). Don't we have a risk to silence one pre-existing error?
Quoted 6 lines
Hmm..don't think so.
vcmdq_gerror[index] is set only to report
CMDQ_INIT_ERRwhen hardware queue allocation fails, meaning no hardware VCMDQ exists at that point. It is intentionally cleared after a successful allocation because the allocation error no longer applies.
OK. thanks for checking. Effectively we return and do not sync in that case. there is no other cache sync call site so that's OK.
Thanks
Eric
Quoted 8 lines
Once the hardware VCMDQ is allocated, GERROR and GERRORN accesses are backed directly by hardware. Since QEMU no longer overwrites GERRORN, any pending hardware error where GERROR and GERRORN differ remains visible to the guest.
I can’t think of any relevant corner case issue here, though I may be missing something.
Sounds good.
Eric
Quoted 3 lines
Thanks,
Shameer