@ -2862,8 +2862,10 @@ static bool vtd_inv_desc_reserved_check(IntelIOMMUState *s,
static bool vtd_process_wait_desc ( IntelIOMMUState * s , VTDInvDesc * inv_desc )
{
uint64_t mask [ 4 ] = { VTD_INV_DESC_WAIT_RSVD_LO , VTD_INV_DESC_WAIT_RSVD_HI ,
VTD_INV_DESC_ALL_ONE , VTD_INV_DESC_ALL_ONE } ;
uint64_t mask [ 4 ] = {
VTD_INV_DESC_WAIT_RSVD_LO ( s - > ecap ) , VTD_INV_DESC_WAIT_RSVD_HI ,
VTD_INV_DESC_ALL_ONE , VTD_INV_DESC_ALL_ONE
} ;
bool ret = true ;
if ( ! vtd_inv_desc_reserved_check ( s , inv_desc , mask , false ,
@ -4186,6 +4188,7 @@ static const Property vtd_properties[] = {
DEFINE_PROP_BOOL ( " x-flts " , IntelIOMMUState , fsts , FALSE ) ,
DEFINE_PROP_BOOL ( " snoop-control " , IntelIOMMUState , snoop_control , false ) ,
DEFINE_PROP_BOOL ( " x-pasid-mode " , IntelIOMMUState , pasid , false ) ,
DEFINE_PROP_BOOL ( " svm " , IntelIOMMUState , svm , false ) ,
DEFINE_PROP_BOOL ( " dma-drain " , IntelIOMMUState , dma_drain , true ) ,
DEFINE_PROP_BOOL ( " stale-tm " , IntelIOMMUState , stale_tm , false ) ,
DEFINE_PROP_BOOL ( " fs1gp " , IntelIOMMUState , fs1gp , true ) ,
@ -5096,6 +5099,10 @@ static void vtd_init(IntelIOMMUState *s)
vtd_spte_rsvd_large [ 3 ] & = ~ VTD_SPTE_SNP ;
}
if ( s - > svm ) {
s - > ecap | = VTD_ECAP_PRS | VTD_ECAP_PDS | VTD_ECAP_NWFS ;
}
vtd_reset_caches ( s ) ;
/* Define registers with default values and bit semantics */
@ -5573,6 +5580,29 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp)
return false ;
}
if ( s - > svm ) {
if ( ! x86_iommu - > dt_supported ) {
error_setg ( errp , " Need to set device IOTLB for svm " ) ;
return false ;
}
if ( ! s - > fsts ) {
error_setg ( errp , " Need to set flts for svm " ) ;
return false ;
}
if ( ! x86_iommu - > dma_translation ) {
error_setg ( errp , " Need to set dma-translation for svm " ) ;
return false ;
}
if ( ! s - > pasid ) {
error_setg ( errp , " Need to set PASID support for svm " ) ;
return false ;
}
}
return true ;
}
@ -5583,17 +5613,6 @@ static void vtd_realize(DeviceState *dev, Error **errp)
X86MachineState * x86ms = X86_MACHINE ( ms ) ;
PCIBus * bus = pcms - > pcibus ;
IntelIOMMUState * s = INTEL_IOMMU_DEVICE ( dev ) ;
X86IOMMUState * x86_iommu = X86_IOMMU_DEVICE ( s ) ;
if ( s - > pasid & & x86_iommu - > dt_supported ) {
/*
* PASID - based - Device - TLB Invalidate Descriptor is not
* implemented and it requires support from vhost layer which
* needs to be implemented in the future .
*/
error_setg ( errp , " PASID based device IOTLB is not supported " ) ;
return ;
}
if ( ! vtd_decide_config ( s , errp ) ) {
return ;