: PVH xen: elf changes to pref for dom0 PVH.
RFC PATCH 15/16 : PVH xen: elf changes to pref for dom0 PVH.
This patch prepares for dom0 PVH by chaging elf_load_binary() to add a new parameter to indicate PVH dom0. Add check in iommu.c to check for
iommu enabled for dom0 PVH.
Signed-off-by Mukesh Rathor <[email protected]>
xen/arch/x86/domain_build.c +1 -1
@@ -769,7 +769,7 @@ int __init construct_dom0(/* Copy the OS image and free temporary buffer. */ elf.dest = (void *)vkern_start; - rc =elf_load_binary (&elf); + rc =elf_load_binary (&elf,0 );if ( rc <0 ) {printk ("Failed to load the kernel binary\n" );
xen/common/libelf/libelf-loader.c +47 -4
91 lines not on this page · raw message
xen/drivers/passthrough/iommu.c +16 -2
@@ -120,15 +120,25 @@ int iommu_domain_init(struct domain *d)return hd->platform_ops->init (d); } +static inline void check_dom0_pvh_reqs (struct domain *d) +{ +if (!iommu_enabled || iommu_passthrough) +panic ("For pvh dom0, iommu must be enabled, dom0-passthrough must " +"not be enabled \n" ); +} +void __init iommu_dom0_init (struct domain *d) {struct hvm_iommu *hd =domain_hvm_iommu (d); +if (is_pvh_domain (d) ) +check_dom0_pvh_reqs (d); +if ( !iommu_enabled )return ;register_keyhandler ('o' , &iommu_p2m_table); - d->need_iommu = !!iommu_dom0_strict; + d->need_iommu =is_pvh_domain (d) || !!iommu_dom0_strict;if (need_iommu (d) ) {struct page_info *page;
@@ -141,7 +151,11 @@ void __init iommu_dom0_init(struct domai ((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page) ) mapping |= IOMMUF_writable; - hd->platform_ops->map_page (d, mfn, mfn, mapping); +if (is_pvh_domain (d) ) { +unsigned long gfn =mfn_to_gfn (d,_mfn (mfn)); + hd->platform_ops->map_page (d, gfn, mfn, mapping); + }else + hd->platform_ops->map_page (d, mfn, mfn, mapping);if ( !(i++ &0xfffff ) )process_pending_softirqs (); }
xen/include/xen/libelf.h +2 -1
@@ -192,13 +192,14 @@ int elf_phdr_is_loadable(struct elf_binaint elf_init (struct elf_binary *elf,const char *image,size_t size);#ifdef __XEN__void elf_set_verbose (struct elf_binary *elf); +int elf_load_binary (struct elf_binary *elf,int is_pvh_dom0);#else void elf_set_log (struct elf_binary *elf,elf_log_callback *,void *log_caller_pointer,int verbose); +int elf_load_binary (struct elf_binary *elf);#endif void elf_parse_binary (struct elf_binary *elf); -int elf_load_binary (struct elf_binary *elf);void *elf_get_ptr (struct elf_binary *elf,unsigned long addr);uint64_t elf_lookup_addr (struct elf_binary *elf,const char *symbol);