xen:vtd: missing RMRR mapping while share EPT
PATCH v2 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 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
v2:
* Fix coding style.
* Still need to abide intel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.
xen/drivers/passthrough/vtd/iommu.c +16 -2
@@ -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,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++; }
Signature · 1 line
1.9.1
Quoted 22 lines · Tiejun Chen
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.
Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)v2:
* Fix coding style.
* Still need to abideintel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.xen/drivers/passthrough/vtd/iommu.c +0
-0
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 4 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h"
<asm/mm/mm-locks.h>
~Andrew
Quoted 34 lines
xen/drivers/passthrough/vtd/iommu.c +15
-2struct 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,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++; }
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Tiejun Chen
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.
Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)v2:
* Fix coding style.
* Still need to abideintel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.
Quoted 11 lines
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 9 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>
iommu.c:38:29: fatal error: asm/mm/mm-locks.h: No such file or directory
#include <asm/mm/mm-locks.h>
^compilation terminated.
Tiejun
Quoted 40 lines
~Andrew
Quoted 34 lines
xen/drivers/passthrough/vtd/iommu.c +15
-2struct 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,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++; }
Quoted 32 lines · Tiejun
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Tiejun Chen
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.
Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)v2:
* Fix coding style.
* Still need to abideintel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.Quoted 12 lines
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 10 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>
Quoted 6 lines
iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to arch/x86/mm, and there are indeed no current users outside of that part of the tree.
Would it not be better have some public p2m_set_identity() function in p2m.c ?
~Andrew
Quoted 45 lines
Quoted 45 lines
~Andrew
Quoted 38 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0struct 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);xen/drivers/passthrough/vtd/iommu.c +14
-2@@ -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++; }
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:11, <[email protected]> wrote:
Quoted 17 lines · Tiejun
Quoted 10 lines · Andrew Cooper
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 7 lines · Tiejun Chen
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 8 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.Would it not be better have some public
p2m_set_identity()function inp2m.c?
Actually I think this should be using set_mmio_p2m_entry(), which in turn points out another problem: What is happening with the GFN that gets replaced here? How will the guest know this is not RAM? I pointed out on an earlier occasion that passing through devices with associated RMRR is problematic/dangerous - this is another proof. Perhaps this should be disallowed, at least when sharing page tables.
Jan
Quoted 38 lines · Andrew Cooper
Quoted 37 lines · Tiejun
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Tiejun Chen
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.
Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)v2:
* Fix coding style.
* Still need to abideintel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.Quoted 12 lines
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 10 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 9 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.Would it not be better have some public
p2m_set_identity()function inp2m.c?
Sounds good so what about this?
Subject: [PATCH 1/2] xen:p2m: introduce a public p2m_set_identity
Often p2m_set_entry() always needs to hold p2m_lock but p2m_lock() is not easy included for some common occasions.
So here introduce an new public p2m_set_identity holding this lock.
--- xen/arch/x86/mm/p2m.c | 13 +++++++++++++ xen/include/asm-x86/p2m.h | 3 +++ 2 files changed, 16 insertions(+)
xen/arch/x86/mm/p2m.c +13 -0
@@ -385,6 +385,19 @@ int p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,return rc; } +/* Just hold p2m_lock then public. */ +int p2m_set_identity (struct p2m_domain *p2m,unsigned long gfn,mfn_t mfn, +unsigned int page_order,p2m_type_t p2mt,p2m_access_t p2ma) +{ +int rc =0 ; + +p2m_lock (p2m); + rc =p2m_set_entry (p2m, gfn, mfn, page_order, p2mt, p2ma); +p2m_unlock (p2m); + +return rc; +} + struct page_info *p2m_alloc_ptp(struct p2m_domain *p2m, unsigned long
type)
{
struct page_info *pg;xen/include/asm-x86/p2m.h +0 -0
@@ -625,6 +625,9 @@ void p2m_free_ptp(struct p2m_domain *p2m, struct page_info *pg); int p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, unsigned int page_order, p2m_type_t p2mt,
p2m_access_t p2ma);
+int p2m_set_identity(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
+ unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma);
+
/* Set up function pointers for PT implementation: only for use by p2m
code */
extern void p2m_pt_init(struct p2m_domain *p2m);
Signature · 4 lines
1.9.1 Thanks Tiejun
Quoted 38 lines · Andrew Cooper
Quoted 37 lines · Tiejun
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Tiejun Chen
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.
Signed-off-by Tiejun Chen <[email protected]>--- xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)v2:
* Fix coding style.
* Still need to abideintel_iommu_map_page(), so we should do nothing if dom0 and iommu supports pass thru.Quoted 12 lines
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 10 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 5 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.
Indeed -- outside code should not be touching the mm locks, and furthermore the declaration of p2m_set_entry() has a comment right beside it that says "only for use by p2m code".
I suppose you can't use the usual add-to-physmap operations because they would try to call back into iommu code to keep the vtd tables in sync? In that case you will need some sort of new API to the p2m code to handle this case, as Andrew suggested. But OTOH from the commit message it looks like this path only ever needed when vtd is using the p2m table directly? In which case, maybe set_mmio_p2m_entry() already does what you need.
I'm a bit surprised that there's no check for an existing mapping here, btw -- what if the guest already has memory mapped at that address? That's going to go badly when it tries to use that memory (either from the CPU or DMA).
Cheers,
Tim.
Quoted 53 lines
~Andrew
Quoted 37 lines
Quoted 37 lines
~Andrew
Quoted 33 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0struct 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);xen/drivers/passthrough/vtd/iommu.c +13
-2@@ -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,Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
xen/drivers/passthrough/vtd/iommu.c +1
-0+ IOMMUF_readable|IOMMUF_writable) )return -1; base_pfn++; }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hi,
xen/arch/x86/mm/p2m.c int p2m_set_entry(struct p2m_domain *p2m, unsigned · line 389
Quoted 10 lines · Tiejun
xen/arch/x86/mm/p2m.c +1
-0@@ -385,6 +385,19 @@ int p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, return rc; } +/* Just hold p2m_lock then public. */
I can't understand this comment at all. If you need to add a new function, it should have a comment describing _what it does_.
xen/arch/x86/mm/p2m.c int p2m_set_entry(struct p2m_domain *p2m, unsigned · line 392
Quoted 3 lines
xen/arch/x86/mm/p2m.c +2
-0+int p2m_set_identity (struct p2m_domain *p2m,unsigned long gfn,mfn_t mfn, +unsigned int page_order,p2m_type_t p2mt,p2m_access_t p2ma)
Also it shouldn't just allow the caller to set anything in a p2m entry; that will cause endless trouble down the line as code outside x86/mm breaks invariants that the p2m code is maintaining.
AFAICT a function to set an identity map should only need two arguments, the domain and the mfn; it should then internally DTRT with the other arguments.
But as mentioned in a few other emails, you might be able to use set_mmio_p2m_entry() instead of adding new code.
Cheers,
Tim.
Quoted 31 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, July 24, 2014 2:32 AMQuoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:11, <[email protected]> wrote:
Quoted 17 lines · Tiejun
Quoted 10 lines · Andrew Cooper
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 7 lines · Tiejun Chen
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 8 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.Would it not be better have some public
p2m_set_identity()function inp2m.c?
Quoted 7 lines
Actually I think this should be using
set_mmio_p2m_entry(), which in turn points out another problem: What is happening with the GFN that gets replaced here? How will the guest know this is not RAM? I pointed out on an earlier occasion that passing through devices with associated RMRR is problematic/dangerous - this is another proof. Perhaps this should be disallowed, at least when sharing page tables.
yes, that's a problem. we need some way (possibly a new hypercall) to tell user space reserving a list of GFN holes in guest e820. I'm not sure the sequence of current e820 construction and device pass-through. A simpler policy may be always reserve those holes even when no device is assigned.
Thanks
Kevin
Quoted 39 lines
Quoted 32 lines
Quoted 1 line · On 24.07.14 at 18:56, <[email protected]> wrote:
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, July 24, 2014 2:32 AMQuoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:11, <[email protected]> wrote:
Quoted 17 lines · Tiejun
Quoted 10 lines · Andrew Cooper
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 7 lines · Tiejun Chen
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file or directory#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 8 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.Would it not be better have some public
p2m_set_identity()function inp2m.c?Quoted 6 lines
Actually I think this should be using
set_mmio_p2m_entry(), which in turn points out another problem: What is happening with the GFN that gets replaced here? How will the guest know this is not RAM? I pointed out on an earlier occasion that passing through devices with associated RMRR is problematic/dangerous - this is another proof. Perhaps this should be disallowed, at least when sharing page tables.
Quoted 5 lines
yes, that's a problem. we need some way (possibly a new hypercall) to tell user space reserving a list of GFN holes in guest e820. I'm not sure the sequence of current e820 construction and device pass-through. A simpler policy may be always reserve those holes even when no device is assigned.
Yes, that would be desirable, but not necessarily possible: On the one system entertaining RMRRs that I have here, these regions are in the range E9000...EEFFF, i.e. are - with a BIOS image of more than 64k size - overlapping the base BIOS, at least until the resident size of the BIOS has been determined. I'm not sure about the consequences of this overlap.
Jan
Quoted 49 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, July 24, 2014 11:58 PMQuoted 18 lines
Quoted 18 lines
Quoted 1 line · On 24.07.14 at 18:56, <[email protected]> wrote:
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, July 24, 2014 2:32 AMQuoted 14 lines
Quoted 1 line
Quoted 1 line · On 24.07.14 at 11:11, <[email protected]> wrote:
Quoted 12 lines · Tiejun
Quoted 10 lines · Andrew Cooper
xen/drivers/passthrough/vtd/iommu.c line 44
Quoted 7 lines · Tiejun Chen
xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -41,6 +41,7 @@#include "extern.h" #include "vtd.h" #include "../ats.h" +#include "../../../arch/x86/mm/mm-locks.h" <
asm/mm/mm-locks.h>Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
iommu.c:38:29: fatal error:
asm/mm/mm-locks.h: No such file ordirectory
Quoted 20 lines
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
#include <asm/mm/mm-locks.h> ^compilation terminated.
Quoted 8 lines
Quoted 1 line
Tiejun
Hmm - my mistake. The lack of easy access to this header file goes to emphasise that it is private to
arch/x86/mm, and there are indeed no current users outside of that part of the tree.Would it not be better have some public
p2m_set_identity()function inp2m.c?Quoted 6 lines
Actually I think this should be using
set_mmio_p2m_entry(), which in turn points out another problem: What is happening with the GFN that gets replaced here? How will the guest know this is not RAM? I pointed out on an earlier occasion that passing through devices with associated RMRR is problematic/dangerous - this is another proof. Perhaps this should be disallowed, at least when sharing page tables.Quoted 5 lines
yes, that's a problem. we need some way (possibly a new hypercall) to tell user space reserving a list of GFN holes in guest e820. I'm not sure the sequence of current e820 construction and device pass-through. A simpler policy may be always reserve those holes even when no device is assigned.
Quoted 7 lines
Yes, that would be desirable, but not necessarily possible: On the one system entertaining RMRRs that I have here, these regions are in the range E9000...EEFFF, i.e. are - with a BIOS image of more than 64k size - overlapping the base BIOS, at least until the resident size of the BIOS has been determined. I'm not sure about the consequences of this overlap.
hypervisor provided list can be a reference, not a must. User space can detect the confliction e.g. with large BIOS size and then reject assignment of devices associated with conflicting region. but that also means exposing not just the hole, but also the exact RMRR knowledge to user space...
Thanks
Kevin