mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 05:13:54 -06:00
intel-iommu: add IOTLB using hash table
Add IOTLB to cache information about the translation of input-addresses. IOTLB use a GHashTable as cache. The key of the hash table is the logical-OR of gfn and source id after left-shifting. Signed-off-by: Le Tan <tamlokveer@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
d92fa2dc6e
commit
b5a280c008
3 changed files with 251 additions and 7 deletions
|
@ -48,7 +48,7 @@ typedef struct VTDContextEntry VTDContextEntry;
|
|||
typedef struct VTDContextCacheEntry VTDContextCacheEntry;
|
||||
typedef struct IntelIOMMUState IntelIOMMUState;
|
||||
typedef struct VTDAddressSpace VTDAddressSpace;
|
||||
|
||||
typedef struct VTDIOTLBEntry VTDIOTLBEntry;
|
||||
|
||||
/* Context-Entry */
|
||||
struct VTDContextEntry {
|
||||
|
@ -73,6 +73,14 @@ struct VTDAddressSpace {
|
|||
VTDContextCacheEntry context_cache_entry;
|
||||
};
|
||||
|
||||
struct VTDIOTLBEntry {
|
||||
uint64_t gfn;
|
||||
uint16_t domain_id;
|
||||
uint64_t slpte;
|
||||
bool read_flags;
|
||||
bool write_flags;
|
||||
};
|
||||
|
||||
/* The iommu (DMAR) device state struct */
|
||||
struct IntelIOMMUState {
|
||||
SysBusDevice busdev;
|
||||
|
@ -103,6 +111,7 @@ struct IntelIOMMUState {
|
|||
uint64_t ecap; /* The value of extended capability reg */
|
||||
|
||||
uint32_t context_cache_gen; /* Should be in [1,MAX] */
|
||||
GHashTable *iotlb; /* IOTLB */
|
||||
|
||||
MemoryRegionIOMMUOps iommu_ops;
|
||||
VTDAddressSpace **address_spaces[VTD_PCI_BUS_MAX];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue