x86/vtd: fix iommu_share_p2m_table
PATCH 1/1 x86/vtd: fix iommu_share_p2m_table
Commit 2916951c1 changed the check in iommu_share_p2m_table to use need_iommu(d) instead of iommu_enabled, which broke the check because at the point in domain construction where iommu_share_p2m_table is called need_iommu(d) will always return false.
Fix this by reverting to the previous logic.
---
Cc: Jan Beulich <[email protected]>
Cc: Paul Durrant <[email protected]>
--- xen/drivers/passthrough/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/passthrough/iommu.c +1 -1
@@ -505,7 +505,7 @@ int iommu_do_domctl(void iommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )iommu_get_ops ()->share_p2m (d); }
Signature · 7 lines
2.19.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines
-----Original Message-----
From: Roger Pau Monne [mailto:[email protected]]
Sent: 08 October 2018 11:15
To: [email protected]
Cc: Roger Pau Monne <[email protected]>; Jan Beulich <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH] x86/vtd: fixiommu_share_p2m_table
Quoted 6 lines
Commit
2916951c1changed the check iniommu_share_p2m_tableto useneed_iommu(d)instead ofiommu_enabled, which broke the check because at the point in domain construction whereiommu_share_p2m_tableis calledneed_iommu(d)will always return false.Fix this by reverting to the previous logic.
Thanks for finding this.
Above, I think you need to include the title of commit 2916951c1 and also the text should say that the need_iommu() check became implicit in iommu_hap_pt_share() (otherwise folks looking at the patch may be bemused because need_iommu is not in the code).
The code looks fine though so...
Quoted 24 lines
Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Jan Beulich <[email protected]>
Cc: Paul Durrant <[email protected]>--- xen/drivers/passthrough/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/passthrough/iommu.c +1
-2@@ -505,7 +505,7 @@ int iommu_do_domctl(void iommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )iommu_get_ops ()->share_p2m (d); } --
Quoted 1 line
2.19.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines
Quoted 14 lines
Quoted 1 line · On 08.10.18 at 12:27, <[email protected]> wrote:
-----Original Message-----
From: Roger Pau Monne [mailto:[email protected]]
Sent: 08 October 2018 11:15
To: [email protected]
Cc: Roger Pau Monne <[email protected]>; Jan Beulich <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH] x86/vtd: fixiommu_share_p2m_tableCommit
2916951c1changed the check iniommu_share_p2m_tableto useneed_iommu(d)instead ofiommu_enabled, which broke the check because at the point in domain construction whereiommu_share_p2m_tableis calledneed_iommu(d)will always return false.
Quoted 8 lines
Quoted 1 line
Fix this by reverting to the previous logic.
Thanks for finding this.
Above, I think you need to include the title of commit
2916951c1and also the text should say that theneed_iommu()check became implicit iniommu_hap_pt_share()(otherwise folks looking at the patch may be bemused becauseneed_iommuis not in the code).
Indeed, it did take me more than just a moment to make the connection between description and code change (in this regard).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/drivers/passthrough/iommu.c int iommu_do_domctl( · line 508
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 08.10.18 at 12:14, <[email protected]> wrote:
xen/drivers/passthrough/iommu.c +1
-1@@ -505,7 +505,7 @@ int iommu_do_domctl(void iommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )
Considering the only caller, the hap_enabled() part is (and was) not needed here. I also would prefer to see a comment attached here, to (briefly) explain why this can't be iommu_use_hap_pt().
Is this what Wei also has found to break his PVH Dom0?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 08.10.18 at 12:14, <[email protected]> wrote:
xen/drivers/passthrough/iommu.c +0
-0@@ -505,7 +505,7 @@ int iommu_do_domctl(
Quoted 7 lines
xen/drivers/passthrough/iommu.c int iommu_do_domctl( · line 508
Quoted 4 lines
xen/drivers/passthrough/iommu.c +1
-1void iommu_share_p2m_tableiommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )Considering the only caller, the
hap_enabled()part is (and was) not needed here.
Would you like me to remove it in this patch?
I've merely changed iommu_share_p2m_table back to use the same logic as before 2916951c1.
Quoted 4 lines
I also would prefer to see a comment attached here, to (briefly) explain why this can't be
iommu_use_hap_pt().Is this what Wei also has found to break his PVH Dom0?
Yes, I think so.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Roger Pau Monné
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 08.10.18 at 12:14, <[email protected]> wrote:
xen/drivers/passthrough/iommu.c +0
-0@@ -505,7 +505,7 @@ int iommu_do_domctl(Quoted 7 lines
xen/drivers/passthrough/iommu.c int iommu_do_domctl( · line 508
Quoted 4 lines
xen/drivers/passthrough/iommu.c +1
-1void iommu_share_p2m_tableiommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )Considering the only caller, the
hap_enabled()part is (and was) not needed here.
Quoted 1 line
Would you like me to remove it in this patch?
I've converted it to an ASSERT instead of just removing it.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 08.10.18 at 12:50, <[email protected]> wrote:
Quoted 14 lines · Roger Pau Monné
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/iommu.c int iommu_do_domctl( · line 508
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 08.10.18 at 12:14, <[email protected]> wrote:
xen/drivers/passthrough/iommu.c +1
-1@@ -505,7 +505,7 @@ int iommu_do_domctl(void iommu_share_p2m_tableiommu_share_p2m_table (struct domain * d) { -if (iommu_use_hap_pt (d) ) +if ( iommu_enabled &&hap_enabled (d) && iommu_hap_pt_share )Considering the only caller, the
hap_enabled()part is (and was) not needed here.
Quoted 3 lines
Quoted 1 line
Would you like me to remove it in this patch?
I've converted it to an ASSERT instead of just removing it.
That's fine of course (and I was about to suggest this in reply to your earlier mail, but luckily have looked here first).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel