[Xen-ia64-devel] RE: [PATCH]ia64: Enhance vt-d support for ia64.
Keir Fraser wrote: On 17/02/2009 03:47, Zhang, Xiantao xiantao.zh...@intel.com wrote: This patch targets for enhancing vt-d support for ia64. 1. reserve enough memory for building dom0 vt-d page table. 2. build 1:1 vt-d page table according to system's mem map. 3. enable vt-d interrupt support for ia64. Signed-off-by: Xiantao Zhang xiantao.zh...@intel.com Acked-by: Isaku Yamahata yamah...@valinux.co.jp Applied, but it's actually broken the ia64 build due to missing asm-ia64/msi.h. Someone needs to fix that. I have sent the patch to Isaku, and he will fix it in xen-ia64-unstable.hg to later. Thanks! Xiantao missing_msi.patch Description: missing_msi.patch ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] Re: [PATCH]ia64: Enhance vt-d support for ia64.
On Wed, Feb 18, 2009 at 08:41:43AM +, Keir Fraser wrote: On 18/02/2009 08:31, Zhang, Xiantao xiantao.zh...@intel.com wrote: Signed-off-by: Xiantao Zhang xiantao.zh...@intel.com Acked-by: Isaku Yamahata yamah...@valinux.co.jp Applied, but it's actually broken the ia64 build due to missing asm-ia64/msi.h. Someone needs to fix that. I have sent the patch to Isaku, and he will fix it in xen-ia64-unstable.hg to later. Thanks! Isaku: please get me to pull from the ia64 tree again asap, as our automated tests depend on a successful ia64 build. Then, please commit the attached patch from Xiantao to xen-devel.hg directly which I suppose is faster than pulling from ia64. -- yamahata # HG changeset patch # User xiantao.zh...@intel.com # Date 1234925881 -28800 # Node ID 162a4dab79e4ba119faea63c41ec94978caccc6b # Parent 66b5e1edeec64b30f53ed8529d5ad7197e6a8a73 ia64: Fix the missing msi.h by accident, and enhance the check for one BUG_ON. Signed-off-by: Xiantao Zhang xiantao.zh...@intel.com diff -r 66b5e1edeec6 -r 162a4dab79e4 xen/drivers/passthrough/vtd/ia64/vtd.c --- a/xen/drivers/passthrough/vtd/ia64/vtd.c Wed Feb 18 10:44:46 2009 +0800 +++ b/xen/drivers/passthrough/vtd/ia64/vtd.c Wed Feb 18 10:58:01 2009 +0800 @@ -141,6 +141,7 @@ static int do_dom0_iommu_mapping(unsigne void iommu_set_dom0_mapping(struct domain *d) { - BUG_ON(d != dom0); + if (dom0) + BUG_ON(d != dom0); efi_memmap_walk(do_dom0_iommu_mapping, d); } diff -r 09a6fa059b37 -r 66b5e1edeec6 xen/include/asm-ia64/msi.h --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/xen/include/asm-ia64/msi.h Wed Feb 18 10:44:46 2009 +0800 @@ -0,0 +1,20 @@ +#ifndef __ASM_MSI_H +#define __ASM_MSI_H + +/* + * MSI Defined Data Structures + */ +#define MSI_ADDRESS_HEADER 0xfee +#define MSI_ADDRESS_HEADER_SHIFT 12 +#define MSI_ADDRESS_HEADER_MASK 0xfff000 +#define MSI_ADDRESS_DEST_ID_MASK 0xffff +#define MSI_TARGET_CPU_MASK 0xff +#define MSI_TARGET_CPU_SHIFT 4 +#define MSI_DELIVERY_MODE 0 +#define MSI_LEVEL_MODE 1 /* Edge always assert */ +#define MSI_TRIGGER_MODE 0 /* MSI is edge sensitive */ +#define MSI_PHYSICAL_MODE 0 +#define MSI_LOGICAL_MODE 1 +#define MSI_REDIRECTION_HINT_MODE 0 + +#endif /* __ASM_MSI_H */ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt
On Wed, Feb 18, 2009 at 11:20:03AM +0800, Zhang, Yang wrote: Fix the issue that guest cannot be launched by using balloon driver. - In current version, when using balloon driver to balloon memory,it did not balloon the memory for vhpt. vhpt needs the continuous memory.But it allocates the memory for vhpt after it finished allocating the memory for guest. So the vhpt usually can not get the continuous memory and guest cannot be launched. Now i change the sequence.Before it allocates the memory for guest, i save the continuous memory for vhpt.when boot the vcpu, it allocate the saved memory for vhpt. Hi. I agree that the possibility to allocate contiguous memory is much higher before populating memory of a domain than after the population. So it is a good idea to allocate vhpt early. However the patch is a poor hack. Please reconsider the implementation looking the whole picture. - It is a poor approach to introduce new HVM_PARAM_VHPT_SIZE. This is inconsistent with XEN_DOMCTL_arch_setup by which libxc tells VMM vhpt size of PV domain. So the first idea which came into my mind is to call XEN_DOMCTL_ARCH_setup before populating domain memory. I haven't checked if it's possible or not, though. Maybe we can introduce new XEN_DOMAINSETUP_xxx flag. - The same discussion applies to PV domain. So the approach should be applicable for both PV and HVM domain. thanks, Signed-off-by: Yang Zhang yang.zh...@intel.com diff -r b432c632ebe8 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Fri Feb 13 19:11:38 2009 +0900 +++ b/tools/python/xen/xend/image.py Tue Feb 17 20:36:43 2009 -0600 @@ -870,6 +870,9 @@ class IA64_HVM_ImageHandler(HVMImageHand extra_pages = 1024 + 5 mem_kb += extra_pages * page_kb mem_kb += self.vramsize +# per-vcpu need 16M for max vhpt size +vhpt_kb = 16 * 1024 +mem_kb += self.vm.getVCpuCount() * vhpt_kb return mem_kb def getRequiredInitialReservation(self): diff -r b432c632ebe8 xen/arch/ia64/vmx/vmmu.c --- a/xen/arch/ia64/vmx/vmmu.cFri Feb 13 19:11:38 2009 +0900 +++ b/xen/arch/ia64/vmx/vmmu.c Tue Feb 17 20:35:39 2009 -0600 @@ -62,7 +62,7 @@ static int init_domain_vhpt(struct vcpu else size = canonicalize_vhpt_size(size); -rc = thash_alloc((v-arch.vhpt), size, vhpt); +rc = thash_alloc(v, size, vhpt); v-arch.arch_vmx.mpta = v-arch.vhpt.pta.val; return rc; } @@ -70,8 +70,10 @@ static int init_domain_vhpt(struct vcpu static void free_domain_vhpt(struct vcpu *v) { -if (v-arch.vhpt.hash) +if (v-arch.vhpt.hash) { thash_free((v-arch.vhpt)); +v-domain-arch.hvm_domain.vhpt_page[v-vcpu_id] = NULL; +} } int init_domain_tlb(struct vcpu *v) @@ -82,7 +84,7 @@ int init_domain_tlb(struct vcpu *v) if (rc) return rc; -rc = thash_alloc((v-arch.vtlb), default_vtlb_sz, vtlb); +rc = thash_alloc(v, default_vtlb_sz, vtlb); if (rc) { free_domain_vhpt(v); return rc; diff -r b432c632ebe8 xen/arch/ia64/vmx/vmx_hypercall.c --- a/xen/arch/ia64/vmx/vmx_hypercall.c Fri Feb 13 19:11:38 2009 +0900 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c Tue Feb 17 20:35:39 2009 -0600 @@ -147,6 +147,9 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA a.value = current-domain-domain_id; rc = a.value ? -EINVAL : 0; /* no stub domain support */ break; +case HVM_PARAM_VHPT_SIZE: +rc = domain_pre_alloc_vhpt(d, a.value); +break; default: /* nothing */ break; diff -r b432c632ebe8 xen/arch/ia64/vmx/vmx_init.c --- a/xen/arch/ia64/vmx/vmx_init.cFri Feb 13 19:11:38 2009 +0900 +++ b/xen/arch/ia64/vmx/vmx_init.c Tue Feb 17 20:42:02 2009 -0600 @@ -541,6 +541,7 @@ vmx_relinquish_guest_resources(struct do for_each_vcpu(d, v) vmx_release_assist_channel(v); + domain_pre_free_vhpt(d); vacpi_relinquish_resources(d); vmx_destroy_ioreq_page(d, d-arch.vmx_platform.ioreq); diff -r b432c632ebe8 xen/arch/ia64/vmx/vtlb.c --- a/xen/arch/ia64/vmx/vtlb.cFri Feb 13 19:11:38 2009 +0900 +++ b/xen/arch/ia64/vmx/vtlb.c Tue Feb 17 20:38:23 2009 -0600 @@ -723,13 +723,30 @@ static void thash_init(thash_cb_t *hcb, hcb-cch_freelist = NULL; } -int thash_alloc(thash_cb_t *hcb, u64 sz_log2, char *what) +int thash_alloc(struct vcpu *v, u64 sz_log2, char *what) { struct page_info *page; void * vbase; +thash_cb_t *hcb; u64 sz = 1UL sz_log2; -page = alloc_domheap_pages(NULL, (sz_log2 + 1 - PAGE_SHIFT), 0); +if (!strcmp(what,
RE: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt
Hi From: Isaku Yamahata [mailto:yamah...@valinux.co.jp] Sent: 2009年2月19日 11:12 To: Zhang, Yang Cc: xen-ia64-devel@lists.xensource.com Subject: Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt - It is a poor approach to introduce new HVM_PARAM_VHPT_SIZE. This is inconsistent with XEN_DOMCTL_arch_setup by which libxc tells VMM vhpt size of PV domain. So the first idea which came into my mind is to call XEN_DOMCTL_ARCH_setup before populating domain memory. I haven't checked if it's possible or not, though. Maybe we can introduce new XEN_DOMAINSETUP_xxx flag. I doesn't introduce HVM_PARAM_VHPT_SIZE. The hvm needs it to save the vhpt'size for allocating vhpt's memory when vcpu boot. I just add some code to save memory for vhpt beforehand when libxc tells VMM vhpt size of hvm. And I don't think PV domain need to do this. ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt
On Thu, Feb 19, 2009 at 01:11:53PM +0800, Zhang, Yang wrote: Hi From: Isaku Yamahata [mailto:yamah...@valinux.co.jp] Sent: 2009年2月19日 11:12 To: Zhang, Yang Cc: xen-ia64-devel@lists.xensource.com Subject: Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt - It is a poor approach to introduce new HVM_PARAM_VHPT_SIZE. This is inconsistent with XEN_DOMCTL_arch_setup by which libxc tells VMM vhpt size of PV domain. So the first idea which came into my mind is to call XEN_DOMCTL_ARCH_setup before populating domain memory. I haven't checked if it's possible or not, though. Maybe we can introduce new XEN_DOMAINSETUP_xxx flag. I doesn't introduce HVM_PARAM_VHPT_SIZE. The hvm needs it to save the vhpt'size for allocating vhpt's memory when vcpu boot. I just add some code to save memory for vhpt beforehand when libxc tells VMM vhpt size of hvm. And I don't think PV domain need to do this. Oh, sorry. I misread it. Okay, so the approach looks sane. - The functions newly added in arch/ia64/xen/domain.c are hvm domain specific. So please move them under arch/ia64/xen/vmx/. - The pages for vhpt is allocated by alloc_domheap_pages(NULL, ...), Thus those memory doesn't accounted to the domain. So adjusting domain memory size doesn't make sense. Just drop it. - Is vhpt_page[] really necessary? How about setting hcb-hash directly instead of temporary keeping it in vhpt_page[]? Probably adjusting codes of resource allocating/freeing might be required, though. thanks, -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
RE: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt
Ok, I will modify it. Thanks Best Regards --yang -Original Message- From: Isaku Yamahata [mailto:yamah...@valinux.co.jp] Sent: 2009年2月19日 13:33 To: Zhang, Yang Cc: xen-ia64-devel@lists.xensource.com Subject: Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt On Thu, Feb 19, 2009 at 01:11:53PM +0800, Zhang, Yang wrote: Hi From: Isaku Yamahata [mailto:yamah...@valinux.co.jp] Sent: 2009年2月19日 11:12 To: Zhang, Yang Cc: xen-ia64-devel@lists.xensource.com Subject: Re: [Xen-ia64-devel] [PATCH] Fix that guest can not get continuous memory for vhpt - It is a poor approach to introduce new HVM_PARAM_VHPT_SIZE. This is inconsistent with XEN_DOMCTL_arch_setup by which libxc tells VMM vhpt size of PV domain. So the first idea which came into my mind is to call XEN_DOMCTL_ARCH_setup before populating domain memory. I haven't checked if it's possible or not, though. Maybe we can introduce new XEN_DOMAINSETUP_xxx flag. I doesn't introduce HVM_PARAM_VHPT_SIZE. The hvm needs it to save the vhpt'size for allocating vhpt's memory when vcpu boot. I just add some code to save memory for vhpt beforehand when libxc tells VMM vhpt size of hvm. And I don't think PV domain need to do this. Oh, sorry. I misread it. Okay, so the approach looks sane. - The functions newly added in arch/ia64/xen/domain.c are hvm domain specific. So please move them under arch/ia64/xen/vmx/. - The pages for vhpt is allocated by alloc_domheap_pages(NULL, ...), Thus those memory doesn't accounted to the domain. So adjusting domain memory size doesn't make sense. Just drop it. - Is vhpt_page[] really necessary? How about setting hcb-hash directly instead of temporary keeping it in vhpt_page[]? Probably adjusting codes of resource allocating/freeing might be required, though. thanks, -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel