hw/arm/smmuv3: Add GBPA register
PATCH v2 1/1 hw/arm/smmuv3: Add GBPA register
GBPA register can be used to globally abort all
transactions.
It is described in the SMMU manual in "6.3.14 SMMU_GBPA". ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to be zero(Do not abort incoming transactions).
Other fields have default values of Use Incoming.
If UPDATE is not set, the write is ignored. This is the only permitted behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
As this patch adds a new state to the SMMU (GBPA), it is added in a new subsection for forward migration compatibility.
Property "migrate-gbpa" was added to support backward compatibility. However, if the GBPA.ABORT is set from SW at time of migration, the GBPA migration will be forced to avoid inconsistencies where a qemu instance is aborting transactions and it is migrated to another instance bypassing them.
Changes in v2:
- GBPA is effective only when SMMU is not enabled.
- Ignore GBPA write when UPDATE is not set.
- Default value for SHCFG is "Use Incoming".
- Support migration.
--- hw/arm/smmuv3-internal.h | 5 +++ hw/arm/smmuv3.c | 71 +++++++++++++++++++++++++++++++++++++++- include/hw/arm/smmuv3.h | 2 ++ 3 files changed, 77 insertions(+), 1 deletion(-)
hw/arm/smmuv3-internal.h +5 -0
@@ -79,6 +79,11 @@ REG32(CR0ACK, 0x24) REG32(CR1, 0x28) REG32(CR2, 0x2c) REG32(STATUSR, 0x40) +REG32(GBPA, 0x44) + FIELD(GBPA, SHCFG, 12, 2) + FIELD(GBPA, ABORT, 20, 1) + FIELD(GBPA, UPDATE, 31, 1) + REG32(IRQ_CTRL, 0x50) FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)FIELD (IRQ_CTRL ,PRI_IRQEN ,1 ,1 )
hw/arm/smmuv3.c +70 -1
119 lines not on this page · raw message
include/hw/arm/smmuv3.h +2 -0
@@ -46,6 +46,7 @@ struct SMMUv3State {uint32_t cr[3 ];uint32_t cr0ack;uint32_t statusr; +uint32_t gbpa;uint32_t irq_ctrl;uint32_t gerror;uint32_t gerrorn;
@@ -57,6 +58,7 @@ struct SMMUv3State {uint64_t eventq_irq_cfg0;uint32_t eventq_irq_cfg1;uint32_t eventq_irq_cfg2; +bool migrate_gbpa;SMMUQueue eventq, cmdq;
Signature · 1 line
2.39.1.456.gfc5497dd1b-goog
Quoted 13 lines · Mostafa Saleh
GBPA register can be used to globally abort all
transactions.It is described in the SMMU manual in "6.3.14
SMMU_GBPA". ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to be zero(Do not abort incoming transactions).Other fields have default values of Use Incoming.
If UPDATE is not set, the write is ignored. This is the only permitted behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
Quoted 8 lines
As this patch adds a new state to the SMMU (GBPA), it is added in a new subsection for forward migration compatibility.
Property "migrate-gbpa" was added to support backward compatibility. However, if the GBPA.ABORT is set from SW at time of migration, the GBPA migration will be forced to avoid inconsistencies where a qemu instance is aborting transactions and it is migrated to another instance bypassing them.
Nothing ever sets the migrate-gpba property to anything except its default 'true' value, so this (a) means that it breaks migration compat and (b) seems a bit unneccessary.
Can we say "migrate the field only if it is something other than its reset value", not have the property, and get migration compatibility that way ?
Otherwise the patch looks OK.
thanks
-- PMM
Hi Peter,
Quoted 27 lines · Peter Maydell
Quoted 13 lines · Mostafa Saleh
GBPA register can be used to globally abort all
transactions.It is described in the SMMU manual in "6.3.14
SMMU_GBPA". ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to be zero(Do not abort incoming transactions).Other fields have default values of Use Incoming.
If UPDATE is not set, the write is ignored. This is the only permitted behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
Quoted 8 lines
As this patch adds a new state to the SMMU (GBPA), it is added in a new subsection for forward migration compatibility.
Property "migrate-gbpa" was added to support backward compatibility. However, if the GBPA.ABORT is set from SW at time of migration, the GBPA migration will be forced to avoid inconsistencies where a qemu instance is aborting transactions and it is migrated to another instance bypassing them.
Nothing ever sets the migrate-gpba property to anything except its default 'true' value, so this (a) means that it breaks migration compat and (b) seems a bit unneccessary.
Quoted 8 lines
Can we say "migrate the field only if it is something other than its reset value", not have the property, and get migration compatibility that way ?
Otherwise the patch looks OK.
thanks
-- PMM
Thanks for reviewing the patch. I am not really familiar with migration, My understanding that this would be set from cmdline(that is how I tested it).
But yes, you are right, this is actually unnecessary, we can just migrate only if GBPA value is different from reset value.
I will send v3 with this change.
Thanks,
Mostafa