xen:vtd: missing RMRR mapping while share EPT
PATCH 1/1 xen:vtd: missing RMRR mapping while share EPT
intel_iommu_map_page() does nothing if VT-d shares EPT page table. So rmrr_identity_mapping() never create RMRR mapping but in some cases like some GFX drivers it still need to access RMRR.
Here we will create those RMRR mappings even in shared EPT case.
--- xen/drivers/passthrough/vtd/iommu.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
xen/drivers/passthrough/vtd/iommu.c +15 -1
@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" struct mapped_rmrr {struct list_head list;
@@ -1842,6 +1843,7 @@ static int rmrr_identity_mapping(struct domain *d,unsigned long base_pfn, end_pfn;struct mapped_rmrr *mrmrr;struct hvm_iommu *hd =domain_hvm_iommu (d); +struct p2m_domain *p2m =p2m_get_hostp2m (d);ASSERT (spin_is_locked (&pcidevs_lock));ASSERT (rmrr->base_address < rmrr->end_address);
@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { -if (intel_iommu_map_page (d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn))); +p2m_lock (p2m); +if (p2m_set_entry (p2m, base_pfn,_mfn (base_pfn),PAGE_ORDER_4K , + p2m_mmio_direct, p2m_access_rw) ) { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )return -1 ; base_pfn++;
Signature · 1 line
1.9.1
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.07.14 at 11:35, <[email protected]> wrote:
intel_iommu_map_page()does nothing if VT-d shares EPT page table. Sormrr_identity_mapping()never create RMRR mapping but in some cases like some GFX drivers it still need to access RMRR.Here we will create those RMRR mappings even in shared EPT case.
Technically this is fine, but there are mechanical issues:
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 9 lines
xen/drivers/passthrough/vtd/iommu.c +4
-1@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn)));
Do we really need this message, even more so not at guest level? And if you're convinced we need it, please use %#lx instead of 0x%lx.
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1887
Quoted 12 lines
xen/drivers/passthrough/vtd/iommu.c +9
-0+p2m_lock (p2m); +if (p2m_set_entry (p2m, base_pfn,_mfn (base_pfn),PAGE_ORDER_4K , + p2m_mmio_direct, p2m_access_rw) ) { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )return -1 ; base_pfn++;
Apart from the above there are several coding style issues here.
Jan
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.07.14 at 11:35, <[email protected]> wrote:
intel_iommu_map_page()does nothing if VT-d shares EPT page table. Sormrr_identity_mapping()never create RMRR mapping but in some cases like some GFX drivers it still need to access RMRR.Here we will create those RMRR mappings even in shared EPT case.
Technically this is fine, but there are mechanical issues:
Quoted 2 lines
(quoted diff) +0
-0@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,
Quoted 9 lines
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 7 lines
xen/drivers/passthrough/vtd/iommu.c +4
-1while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn)));Do we really need this message, even more so not at guest level?
Its useful to debug as I think, but if you insist on this point, I'm fine to remove this as well.
Quoted 2 lines
And if you're convinced we need it, please use %#lx instead of 0x%lx.
Okay.
Quoted 14 lines
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1887
Quoted 13 lines
xen/drivers/passthrough/vtd/iommu.c +9
-0+p2m_lock (p2m); +if (p2m_set_entry (p2m, base_pfn,_mfn (base_pfn),PAGE_ORDER_4K , + p2m_mmio_direct, p2m_access_rw) ) { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )return -1 ; base_pfn++;
Quoted 1 line
Apart from the above there are several coding style issues here.
Are you saying this thing?
if ()
{
}
So what about this?
@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,
while ( base_pfn < end_pfn )
{
- if ( intel_iommu_map_page(d, base_pfn, base_pfn,
+ if ( iommu_use_hap_pt(d) )
+ {+ dprintk(XENLOG_DEBUG VTDPREFIX,
+ "Set RMRR mapping: pfn:%#lx mfn:%#lx.\n",
+ base_pfn, mfn_x(_mfn(base_pfn)));
+ p2m_lock(p2m);
+ if ( p2m_set_entry(p2m, base_pfn, _mfn(base_pfn), PAGE_ORDER_4K,
+ p2m_mmio_direct, p2m_access_rw) )
+ {
+ p2m_unlock(p2m);
+ return -1;
+ }
+ p2m_unlock(p2m);
+ }
+ else if ( intel_iommu_map_page(d, base_pfn, base_pfn,
IOMMUF_readable|IOMMUF_writable) )
return -1;
base_pfn++;Thanks
Tiejun
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 23.07.14 at 11:35, <[email protected]> wrote:
xen/drivers/passthrough/vtd/iommu.c +4
-1@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn)));Do we really need this message, even more so not at guest level?
Quoted 2 lines
Its useful to debug as I think, but if you insist on this point, I'm fine to remove this as well.
The main question is how frequently this may get printed vs how useful the message is.
Quoted 7 lines
Quoted 1 line
Apart from the above there are several coding style issues here.
Are you saying this thing?
if ()
{
}
Yes, among other things.
Quoted 1 line
So what about this?
Almost:
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 6 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) )
Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Review static int rmrr_identity_mapping(struct domain *d, · line 1874
Quoted 2 lines
(quoted diff) +2
-0+ { + dprintk(XENLOG_DEBUG VTDPREFIX,
This still (if you absolutely want to retain the message) needs changing to XENLOG_G_DEBUG, and you want to include the domain ID in what gets printed for the message to be of any practical use.
Review static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 1 line
(quoted diff) +1
-0+ "Set RMRR mapping: pfn:%#lx mfn:%#lx.\n",
Additionally please omit the stop at the end. Also, with VTDPREFIX not ending with a space, you want the message to be starting with one.
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d,
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +4
-0+ base_pfn, mfn_x(_mfn(base_pfn))); +p2m_lock (p2m); +if (p2m_set_entry (p2m, base_pfn,_mfn (base_pfn),PAGE_ORDER_4K , + p2m_mmio_direct, p2m_access_rw) )
Indentation.
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1885
Quoted 8 lines
xen/drivers/passthrough/vtd/iommu.c +7
-0+ { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )
Again (here you need you also adjust the second line for indentation to match up again).
Jan
Quoted 37 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 23.07.14 at 11:35, <[email protected]> wrote:
xen/drivers/passthrough/vtd/iommu.c +4
-1@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn)));Do we really need this message, even more so not at guest level?
Quoted 2 lines
Its useful to debug as I think, but if you insist on this point, I'm fine to remove this as well.
The main question is how frequently this may get printed vs how useful the message is.
Quoted 7 lines
Quoted 1 line
Apart from the above there are several Indentation issues here.
Are you saying this thing?
if ()
{
}Yes, among other things.
Quoted 1 line
So what about this?
Almost:
Quoted 2 lines
(quoted diff) +0
-0@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,
Quoted 7 lines
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d,
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Why do we need these checks here?
Current problem I met is issued when do GFX passthrough for Windows Guest.
Quoted 5 lines
Review static int rmrr_identity_mapping(struct domain *d, · line 1874
Quoted 3 lines
(quoted diff) +2
-0+ { + dprintk(XENLOG_DEBUG VTDPREFIX,This still (if you absolutely want to retain the message) needs
I will remove this simply since this is not a big deal :)
Quoted 25 lines
changing to
XENLOG_G_DEBUG, and you want to include the domain ID in what gets printed for the message to be of any practical use.Review static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 1 line
(quoted diff) +1
-0+ "Set RMRR mapping: pfn:%#lx mfn:%#lx.\n",Additionally please omit the stop at the end. Also, with VTDPREFIX not ending with a space, you want the message to be starting with one.
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d,
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +4
-0+ base_pfn, mfn_x(_mfn(base_pfn))); +p2m_lock (p2m); +if (p2m_set_entry (p2m, base_pfn,_mfn (base_pfn),PAGE_ORDER_4K , + p2m_mmio_direct, p2m_access_rw) )Indentation.
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1885
Quoted 8 lines
xen/drivers/passthrough/vtd/iommu.c +7
-0+ { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )
Quoted 2 lines
Again (here you need you also adjust the second line for indentation to match up again).
I'm not familiar with our xen coding style so I'm wondering if we have such a similar .pl like checkpatch.pl.
Thanks
Tiejun
Quoted 86 lines · Tiejun
Quoted 39 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 23.07.14 at 11:35, <[email protected]> wrote:
(quoted diff) +0
-0@@ -1867,7 +1869,19 @@ static int rmrr_identity_mapping(struct domain *d,Quoted 9 lines
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1875
Quoted 7 lines
xen/drivers/passthrough/vtd/iommu.c +4
-1while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) ) { + dprintk(XENLOG_DEBUG VTDPREFIX, +"Set RMRR mapping: pfn:0x%lx mfn:0x%lx.\n" , + base_pfn, mfn_x(_mfn(base_pfn)));Do we really need this message, even more so not at guest level?
Quoted 2 lines
Its useful to debug as I think, but if you insist on this point, I'm fine to remove this as well.
The main question is how frequently this may get printed vs how useful the message is.
Quoted 7 lines
Quoted 1 line
Apart from the above there are several Indentation issues here.
Are you saying this thing?
if ()
{
}Yes, among other things.
Quoted 1 line
So what about this?
Almost:
Quoted 3 lines
(quoted diff) +0
-0@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,Quoted 7 lines
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d,
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +1
-1while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Why do we need these checks here?
Current problem I met is issued when do GFX passthrough for Windows Guest.
Quoted 5 lines
Review static int rmrr_identity_mapping(struct domain · line 1875
Quoted 3 lines
(quoted diff) +2
-0+ { + dprintk(XENLOG_DEBUG VTDPREFIX,This still (if you absolutely want to retain the message) needs
I will remove this simply since this is not a big deal :)
Quoted 26 lines
changing to
XENLOG_G_DEBUG, and you want to include the domain ID in what gets printed for the message to be of any practical use.Review static int rmrr_identity_mapping(struct domain · line 1876
Quoted 1 line
(quoted diff) +1
-0+ "Set RMRR mapping: pfn:%#lx mfn:%#lx.\n",Additionally please omit the stop at the end. Also, with VTDPREFIX not ending with a space, you want the message to be starting with one.
Review static int rmrr_identity_mapping(struct domain · line 1881
Quoted 5 lines
(quoted diff) +4
-0+ base_pfn, mfn_x(_mfn(base_pfn))); + p2m_lock(p2m); + if ( p2m_set_entry(p2m, base_pfn, _mfn(base_pfn), PAGE_ORDER_4K, + p2m_mmio_direct, p2m_access_rw) )Indentation.
Quoted 8 lines
xen/drivers/passthrough/vtd/iommu.c +7
-0+ { +p2m_unlock (p2m); +return -1 ; + } +p2m_unlock (p2m); + } +else if (intel_iommu_map_page (d, base_pfn, base_pfn, IOMMUF_readable|IOMMUF_writable) )
Quoted 6 lines
Quoted 2 lines
Again (here you need you also adjust the second line for indentation to match up again).
I'm not familiar with our xen coding style so I'm wondering if we have such a similar .pl like checkpatch.pl.
Anyway, what about this?
@@ -1867,8 +1869,20 @@ static int rmrr_identity_mapping(struct domain *d,
while ( base_pfn < end_pfn )
{
- if ( intel_iommu_map_page(d, base_pfn, base_pfn,
- IOMMUF_readable|IOMMUF_writable) )
+ if ( iommu_use_hap_pt(d) && (!iommu_passthrough ||
+ !is_hardware_domain(d)) )
+ {
+ p2m_lock(p2m);
+ if ( p2m_set_entry(p2m, base_pfn, _mfn(base_pfn), PAGE_ORDER_4K,
+ p2m_mmio_direct, p2m_access_rw) )
+ {
+ p2m_unlock(p2m);
+ return -1;
+ }
+ p2m_unlock(p2m);
+ }
+ else if ( intel_iommu_map_page(d, base_pfn, base_pfn,
+ IOMMUF_readable|IOMMUF_writable) )
return -1;
base_pfn++;
}Thanks
Tiejun
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
xen/drivers/passthrough/vtd/iommu.c +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon iommu_use_hap_pt() implies the combined other condition, so an ASSERT() would presumably be fine as well (and get even closer to the intended documentation purpose).
Jan
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:15, <[email protected]> wrote:
Anyway, what about this?
Looks okay (apart from the question about the if() vs ASSERT() mentioned in the previous reply).
Jan
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
xen/drivers/passthrough/vtd/iommu.c static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
xen/drivers/passthrough/vtd/iommu.c +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d,while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, +if (iommu_use_hap_pt (d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 7 lines
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon
iommu_use_hap_pt()implies the combined other condition, so anASSERT()would presumably be fine as well (and get even closer to the intended documentation purpose).
I think if() should be reasonable here. Because
intel_iommu_map_page()
{
...
/* do nothing if dom0 and iommu supports pass thru */
if ( iommu_passthrough && is_hardware_domain(d) )
return 0;We just do nothing to return simply. But if ASSERT will cause abort.
Thanks
Tiejun
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 10:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Review static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
(quoted diff) +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d, while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, + if ( iommu_use_hap_pt(d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 7 lines
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon
iommu_use_hap_pt()implies the combined other condition, so anASSERT()would presumably be fine as well (and get even closer to the intended documentation purpose).I think
if()should be reasonable here. Because
Quoted 8 lines
intel_iommu_map_page(){ ... /* do nothing if dom0 and iommu supports pass thru */ if ( iommu_passthrough && is_hardware_domain(d) ) return 0;We just do nothing to return simply. But if ASSERT will cause abort.
Then tell me the scenario where iommu_use_hap_pt(d) is true and both iommu_passthrough and is_hardware_domain(d) are true too. Remember that for Dom0 iommu_use_hap_pt() can be true only for PVH, and PVH implies !iommu_passthrough.
Jan
Quoted 32 lines · Jan Beulich
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 10:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Review static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
(quoted diff) +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d, while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, + if ( iommu_use_hap_pt(d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 7 lines
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon
iommu_use_hap_pt()implies the combined other condition, so anASSERT()would presumably be fine as well (and get even closer to the intended documentation purpose).I think
if()should be reasonable here. Because
intel_iommu_map_page(){ ... /* do nothing if dom0 and iommu supports pass thru */ if ( iommu_passthrough && is_hardware_domain(d) ) return 0;
Quoted 4 lines
Quoted 1 line
We just do nothing to return simply. But if ASSERT will cause abort.
Then tell me the scenario where
iommu_use_hap_pt(d)is true and bothiommu_passthroughandis_hardware_domain(d)are true too.
Then HVM?
Anyway I did a test like this,
if (iommu_use_hap_pt(d))
{
ASSERT (iommu_passthrough && is_hardware_domain(d));Then Xen really reboot.
Thanks
Tiejun
Quoted 7 lines
Remember that for Dom0
iommu_use_hap_pt()can be true only for PVH, and PVH implies !iommu_passthrough.Jan
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:56, <[email protected]> wrote:
Quoted 32 lines · Jan Beulich
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 10:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Review static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
(quoted diff) +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d, while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, + if ( iommu_use_hap_pt(d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 7 lines
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon
iommu_use_hap_pt()implies the combined other condition, so anASSERT()would presumably be fine as well (and get even closer to the intended documentation purpose).I think
if()should be reasonable here. Because
intel_iommu_map_page(){ ... /* do nothing if dom0 and iommu supports pass thru */ if ( iommu_passthrough && is_hardware_domain(d) ) return 0;
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
We just do nothing to return simply. But if ASSERT will cause abort.
Then tell me the scenario where
iommu_use_hap_pt(d)is true and bothiommu_passthroughandis_hardware_domain(d)are true too.Then HVM?
If we will ever see a HVM Dom0 it'll clearly also require !iommu_passthrough, just like PVH does - this mode is solely for PV.
Quoted 7 lines
Anyway I did a test like this,
if (iommu_use_hap_pt(d)) { ASSERT (iommu_passthrough && is_hardware_domain(d));Then Xen really reboot.
Of course, because you inverted the condition. You want
ASSERT(!iommu_passthrough || !is_hardware_domain(d));
i.e. what I had previously suggested to add with && to the original condition.
Jan
Quoted 50 lines · Jan Beulich
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:56, <[email protected]> wrote:
Quoted 32 lines · Jan Beulich
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 10:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 09:00, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Review static int rmrr_identity_mapping(struct domain *d, · line 1872
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 03:23, <[email protected]> wrote:
(quoted diff) +1
-1@@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d, while ( base_pfn < end_pfn ) { - if ( intel_iommu_map_page(d, base_pfn, base_pfn, + if ( iommu_use_hap_pt(d) )Don't you, btw, need to extend this condition by && (!iommu_passthrough || !is_hardware_domain(d))?
Quoted 7 lines
Quoted 1 line
Why do we need these checks here?
At least for documentation purposes: It would be wrong to try to establish these mappings. I reckon
iommu_use_hap_pt()implies the combined other condition, so anASSERT()would presumably be fine as well (and get even closer to the intended documentation purpose).I think
if()should be reasonable here. Because
intel_iommu_map_page(){ ... /* do nothing if dom0 and iommu supports pass thru */ if ( iommu_passthrough && is_hardware_domain(d) ) return 0;Quoted 6 lines
Quoted 4 lines
Quoted 1 line
We just do nothing to return simply. But if ASSERT will cause abort.
Then tell me the scenario where
iommu_use_hap_pt(d)is true and bothiommu_passthroughandis_hardware_domain(d)are true too.Then HVM?
If we will ever see a HVM Dom0 it'll clearly also require !iommu_passthrough, just like PVH does - this mode is solely for PV.
Quoted 6 lines
Anyway I did a test like this,
if (iommu_use_hap_pt(d)) { ASSERT (iommu_passthrough && is_hardware_domain(d));
Quoted 5 lines
Quoted 1 line
Then Xen really reboot.
Of course, because you inverted the condition. You want
ASSERT(!iommu_passthrough || !is_hardware_domain(d));
You're right. Sorry I'm misunderstanding this point.
Tiejun
Quoted 7 lines
i.e. what I had previously suggested to add with && to the original condition.
Jan