mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/arm/smmuv3: IOTLB emulation
We emulate a TLB cache of size SMMU_IOTLB_MAX_SIZE=256. It is implemented as a hash table whose key is a combination of the 16b asid and 48b IOVA (Jenkins hash). Entries are invalidated on TLB invalidation commands, either globally, or per asid, or per asid/iova. Signed-off-by: Eric Auger <eric.auger@redhat.com> Message-id: 1529653501-15358-4-git-send-email-eric.auger@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
32cfd7f39e
commit
cc27ed81cf
4 changed files with 176 additions and 4 deletions
|
@ -67,6 +67,8 @@ typedef struct SMMUTransCfg {
|
|||
uint8_t tbi; /* Top Byte Ignore */
|
||||
uint16_t asid;
|
||||
SMMUTransTableInfo tt[2];
|
||||
uint32_t iotlb_hits; /* counts IOTLB hits for this asid */
|
||||
uint32_t iotlb_misses; /* counts IOTLB misses for this asid */
|
||||
} SMMUTransCfg;
|
||||
|
||||
typedef struct SMMUDevice {
|
||||
|
@ -89,6 +91,11 @@ typedef struct SMMUPciBus {
|
|||
SMMUDevice *pbdev[0]; /* Parent array is sparse, so dynamically alloc */
|
||||
} SMMUPciBus;
|
||||
|
||||
typedef struct SMMUIOTLBKey {
|
||||
uint64_t iova;
|
||||
uint16_t asid;
|
||||
} SMMUIOTLBKey;
|
||||
|
||||
typedef struct SMMUState {
|
||||
/* <private> */
|
||||
SysBusDevice dev;
|
||||
|
@ -147,4 +154,10 @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova);
|
|||
/* Return the iommu mr associated to @sid, or NULL if none */
|
||||
IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid);
|
||||
|
||||
#define SMMU_IOTLB_MAX_SIZE 256
|
||||
|
||||
void smmu_iotlb_inv_all(SMMUState *s);
|
||||
void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid);
|
||||
void smmu_iotlb_inv_iova(SMMUState *s, uint16_t asid, dma_addr_t iova);
|
||||
|
||||
#endif /* HW_ARM_SMMU_COMMON */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue