Re: [PATCH v1] intel_iommu: Expose SMPWC when SVM is enabled

Yi Liu <[email protected]> Tue, 4 Aug 2026 16:51:17 +0800
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 8/3/26 00:47, Michael S. Tsirkin wrote:
> On Sun, Aug 02, 2026 at 04:05:08PM +0000, Clément MATHIEU--DRIF wrote:
>> SVM in Linux requires SMPWC as of 780dfed68862. This is free in the
>> current implementation as it is already in line with the expected
>> behaviour.
>>
>> Signed-off-by: Clement Mathieu--Drif <[email protected]>
>> ---
>>   hw/i386/intel_iommu.c          | 3 ++-
>>   hw/i386/intel_iommu_internal.h | 1 +
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
>> index 8245452d89..9f21622a4f 100644
>> --- a/hw/i386/intel_iommu.c
>> +++ b/hw/i386/intel_iommu.c
>> @@ -5108,7 +5108,8 @@ static void vtd_init(IntelIOMMUState *s)
>>       }
>>   
>>       if (s->svm) {
>> -        s->ecap |= VTD_ECAP_PRS | VTD_ECAP_PDS | VTD_ECAP_NWFS;
>> +        s->ecap |= VTD_ECAP_PRS | VTD_ECAP_PDS | VTD_ECAP_NWFS |
>> +                   VTD_ECAP_SMPWCS;
>>       }
>>   
>>       vtd_reset_caches(s);
>> diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
>> index 924e91cb8a..df7a0efa6e 100644
>> --- a/hw/i386/intel_iommu_internal.h
>> +++ b/hw/i386/intel_iommu_internal.h
>> @@ -202,6 +202,7 @@
>>   #define VTD_ECAP_SMTS               (1ULL << 43)
>>   #define VTD_ECAP_SSTS               (1ULL << 46)
>>   #define VTD_ECAP_FSTS               (1ULL << 47)
>> +#define VTD_ECAP_SMPWCS             (1ULL << 48)
>>   
>>   /* CAP_REG */
>>   /* (offset >> 4) << 24 */
> 
> Any cross version migration concerns with this one?

this bit is exposed when the svm flag is set. This flag was introduced
by the below commit and controlled by a 'svm' option. So looks like this
change is ok from the migration perspective?


952e1a6e90eb22a6deffa4e980277b135e9d077f

@@ -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),