intel_iommu: Expose SMPWC when SVM is enabled
PATCH 1/1 intel_iommu: Expose SMPWC when SVM is enabled
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.
--- hw/i386/intel_iommu.c | 3 ++- hw/i386/intel_iommu_internal.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
hw/i386/intel_iommu.c +2 -1
@@ -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);
hw/i386/intel_iommu_internal.h +1 -0
@@ -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 */
Signature · 1 line
2.54.0
Quoted 29 lines · Clément MATHIEU--DRIF
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(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +0
-0
hw/i386/intel_iommu_internal.h line 208
Quoted 7 lines
hw/i386/intel_iommu_internal.h +1
-0@@ -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?
Quoted 2 lines
Signature · 1 line
2.54.0
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Clément MATHIEU--DRIF
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(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-0@@ -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)
Quoted 4 lines
hw/i386/intel_iommu_internal.h line 208
Quoted 2 lines
hw/i386/intel_iommu_internal.h +0
-0/* 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),
Quoted 48 lines · Yi Liu
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 36 lines · Michael S. Tsirkin
Quoted 34 lines · Clément MATHIEU--DRIF
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.---
hw/i386/intel_iommu.c | 3 ++-
hw/i386/intel_iommu_internal.h| 1 +2 files changed, 3 insertions(+), 1 deletion(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-0@@ -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)Quoted 5 lines
hw/i386/intel_iommu_internal.h line 208
Quoted 2 lines
hw/i386/intel_iommu_internal.h +0
-0/* CAP_REG */ /* (offset >> 4) << 24 */Any cross version migration concerns with this one?
Quoted 3 lines
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?
I came to the same conclusion.
Thanks
Quoted 14 lines
952e1a6e90eb22a6deffa4e980277b135e9d077f(quoted diff) +1
-0@@ -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),
Quoted 1 line · Clément MATHIEU--DRIF
SVM in Linux requires SMPWC as of
780dfed68862.
And what is 780dfed68862?
Quoted 38 lines
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(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-0@@ -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 */ Signature · 1 line
2.54.0
Quoted 9 lines · Michael S. Tsirkin
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 1 line · Clément MATHIEU--DRIF
SVM in Linux requires SMPWC as of
780dfed68862.And what is
780dfed68862?
A commit in the linux tree, is there a dedicated tag for that?
Maybe "Link: link_to_github"?
Quoted 42 lines
Quoted 40 lines
This is free in the
current implementation as it is already in line with the expected behaviour.---
hw/i386/intel_iommu.c | 3 ++-
hw/i386/intel_iommu_internal.h | 1 +2 files changed, 3 insertions(+), 1 deletion(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-1@@ -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 */ --2.54.0
Quoted 8 lines · Clément MATHIEU--DRIF
Quoted 5 lines · Michael S. Tsirkin
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
On Sun, Aug 02, 2026 at 04:05:08PM +0000, Clément MATHIEU--DRIF wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
SVM in Linux requires SMPWC as of
780dfed68862.And what is
780dfed68862?A commit in the linux tree, is there a dedicated tag for that?
Maybe "Link:
link_to_github"?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=780dfed68862
Quoted 42 lines
Quoted 42 lines
Quoted 40 lines
This is free in the
current implementation as it is already in line with the expected behaviour.---
hw/i386/intel_iommu.c | 3 ++-
hw/i386/intel_iommu_internal.h | 1 +2 files changed, 3 insertions(+), 1 deletion(-)hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-1@@ -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 */ --2.54.0
Hi Clement,
Quoted 7 lines
-----Original Message-----
From: Clément MATHIEU--DRIF <[email protected]>
Subject: [PATCH v1]intel_iommu: Expose SMPWC when SVM is enabledSVM in Linux requires SMPWC as of
780dfed68862. This is free in the current implementation as it is already in line with the expected behaviour.
Not an issue in this patch, what about 'C: Page-walk Coherency' ecap bit, I think we can enable it too? Maybe in another patch?
Quoted 12 lines
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(-)hw/i386/intel_iommu.c +0
-0
hw/i386/intel_iommu.c static void vtd_init(IntelIOMMUState *s) · line 5112
Quoted 6 lines
hw/i386/intel_iommu.c +2
-1@@ -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 ;
I think we need a check for passthrough device to expose SMPWCS, something like below pseudo code:
@@ -37,6 +37,12 @@ bool vtd_check_hiod_accel(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hiod,
return false;
}+ if (VTD_ECAP_GET_SMPWCS(s->ecap) && !VTD_ECAP_GET_SMPWCS(vtd->cap_reg)) {
+ error_setg(errp,
+ " Scalable-Mode Page-walk Coherency is unsupported by host IOMMU");
+ return false;
+ }
+
if (s->fs1gp && !(vtd->cap_reg & VTD_CAP_FS1GP)) {
error_setg(errp,
"First stage 1GB large page is unsupported by host IOMMU");Quoted 17 lines
hw/i386/intel_iommu.c +0
-0}vtd_reset_caches (s);hw/i386/intel_iommu_internal.h +1
-1@@ -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 */ --2.54.0
Quoted 27 lines · Zhenzhong
Hi Clement,
Quoted 7 lines
-----Original Message-----
From: Clément MATHIEU--DRIF <[email protected]>
Subject: [PATCH v1]intel_iommu: Expose SMPWC when SVM is enabledSVM in Linux requires SMPWC as of
780dfed68862. This is free in the current implementation as it is already in line with the expected behaviour.Not an issue in this patch, what about 'C: Page-walk Coherency' ecap bit, I think we can enable it too? Maybe in another patch?
Quoted 14 lines
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(-)hw/i386/intel_iommu.c +0
-0@@ -5108,7 +5108,8 @@ static void vtd_init(IntelIOMMUState *s) }
Quoted 6 lines
hw/i386/intel_iommu.c static void vtd_init(IntelIOMMUState *s) · line 5112
Quoted 4 lines
hw/i386/intel_iommu.c +2
-1if (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 ;I think we need a check for passthrough device to expose SMPWCS, something like below pseudo code:
thumb up. yes. It's strange guest reports SMPWCS while host does not.
Quoted 31 lines
(quoted diff) +6
-0@@ -37,6 +37,12 @@ bool vtd_check_hiod_accel(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hiod, return false; } + if (VTD_ECAP_GET_SMPWCS(s->ecap) && !VTD_ECAP_GET_SMPWCS(vtd->cap_reg)) { + error_setg(errp, + " Scalable-Mode Page-walk Coherency is unsupported by host IOMMU"); + return false; + } + if (s->fs1gp && !(vtd->cap_reg & VTD_CAP_FS1GP)) { error_setg(errp, "First stage 1GB large page is unsupported by host IOMMU");Quoted 18 lines
hw/i386/intel_iommu.c +0
-0}vtd_reset_caches (s);hw/i386/intel_iommu_internal.h +1
-1@@ -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 */ --2.54.0
Quoted 44 lines · Yi Liu
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 30 lines · Zhenzhong
Hi Clement,
Quoted 7 lines
-----Original Message-----
From: Clément MATHIEU--DRIF <[[email protected]](mailto:[email protected])>
Subject: [PATCH v1]intel_iommu: Expose SMPWC when SVM is enabledSVM in Linux requires SMPWC as of
780dfed68862. This is free in the current implementation as it is already in line with the expected behaviour.Not an issue in this patch, what about 'C: Page-walk Coherency' ecap bit, I think we can enable it too? Maybe in another patch?
Quoted 14 lines
---
hw/i386/intel_iommu.c | 3 ++-hw/i386/intel_iommu_internal.h| 1 +2 files changed, 3 insertions(+), 1 deletion(-)hw/i386/intel_iommu.c +0
-0@@ -5108,7 +5108,8 @@ static void vtd_init(IntelIOMMUState *s) }Quoted 7 lines
hw/i386/intel_iommu.c static void vtd_init(IntelIOMMUState *s) · line 5112
Quoted 4 lines
hw/i386/intel_iommu.c +2
-1if (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;I think we need a check for passthrough device to expose SMPWCS, something like below pseudo code:
Quoted 1 line
thumb up. yes. It's strange guest reports SMPWCS while host does not.
Will do,
thanks
Quoted 37 lines
Quoted 35 lines
(quoted diff) +6
-0@@ -37,6 +37,12 @@ bool vtd_check_hiod_accel(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hiod, return false; } + if (VTD_ECAP_GET_SMPWCS(s->ecap) && !VTD_ECAP_GET_SMPWCS(vtd->cap_reg)) { + error_setg(errp, + " Scalable-Mode Page-walk Coherency is unsupported by host IOMMU"); + return false; + } + if (s->fs1gp && !(vtd->cap_reg & VTD_CAP_FS1GP)) { error_setg(errp, "First stage 1GB large page is unsupported by host IOMMU");Quoted 19 lines
hw/i386/intel_iommu.c +0
-0} vtd_reset_caches(s);hw/i386/intel_iommu_internal.h +1
-1@@ -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 */ --2.54.0
Quoted 9 lines · Clément MATHIEU--DRIF
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(-)
Is it a fix tag needed?
Quoted 26 lines
hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-0@@ -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 */
Quoted 9 lines · Yi Liu
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 4 lines · Clément MATHIEU--DRIF
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.
Quoted 8 lines
Quoted 5 lines
---
hw/i386/intel_iommu.c | 3 ++-
hw/i386/intel_iommu_internal.h| 1 +2 files changed, 3 insertions(+), 1 deletion(-)Is it a fix tag needed?
Not sure, but we can add one in order to be consistent with the kernel commit.
Quoted 30 lines
Quoted 28 lines
hw/i386/intel_iommu.c +2
-1@@ -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);hw/i386/intel_iommu_internal.h +1
-0@@ -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 */