# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1178834122 21600
# Node ID 7d8acd319d5b5927ce40230d48132ba4301edf44
# Parent 31be207e005eaf178c87c047d8827998d6122282
[IA64] Implement XENMEM_machine_memory_map on ia64.
This is necessary for kexec/kdump for xen/ia64. kexec-tools needs to know
real machine's memory map.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c | 14 ++++++++++
linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c | 13 ++++++++++
xen/arch/ia64/xen/mm.c | 31 ++++++++++++++++++++++++
xen/include/public/arch-ia64.h | 15 +++++++++++
4 files changed, 73 insertions(+)
diff -r 31be207e005e -r 7d8acd319d5b
linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c Thu May 10 15:46:30
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c Thu May 10 15:55:22
2007 -0600
@@ -226,6 +226,8 @@ xencomm_hypercall_memory_op(unsigned int
{
XEN_GUEST_HANDLE(xen_pfn_t) extent_start_va[2];
xen_memory_reservation_t *xmr = NULL, *xme_in = NULL, *xme_out = NULL;
+ xen_memory_map_t *memmap = NULL;
+ XEN_GUEST_HANDLE(void) buffer;
int rc;
switch (cmd) {
@@ -254,6 +256,14 @@ xencomm_hypercall_memory_op(unsigned int
(&((xen_memory_exchange_t *)arg)->out);
break;
+ case XENMEM_machine_memory_map:
+ memmap = (xen_memory_map_t *)arg;
+ xen_guest_handle(buffer) = xen_guest_handle(memmap->buffer);
+ set_xen_guest_handle(memmap->buffer,
+ (void *)xencomm_create_inline(
+ xen_guest_handle(memmap->buffer)));
+ break;
+
default:
printk("%s: unknown memory op %d\n", __func__, cmd);
return -ENOSYS;
@@ -274,6 +284,10 @@ xencomm_hypercall_memory_op(unsigned int
xen_guest_handle(extent_start_va[0]);
xen_guest_handle(xme_out->extent_start) =
xen_guest_handle(extent_start_va[1]);
+ break;
+
+ case XENMEM_machine_memory_map:
+ xen_guest_handle(memmap->buffer) = xen_guest_handle(buffer);
break;
}
diff -r 31be207e005e -r 7d8acd319d5b
linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c Thu May 10 15:46:30
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c Thu May 10 15:55:22
2007 -0600
@@ -238,6 +238,19 @@ xencomm_mini_hypercall_memory_op(unsigne
argsize = sizeof (xen_add_to_physmap_t);
break;
+ case XENMEM_machine_memory_map:
+ {
+ xen_memory_map_t *memmap = (xen_memory_map_t *)arg;
+ argsize = sizeof(*memmap);
+ rc = xencomm_create_mini(xc_area, &nbr_area,
+ xen_guest_handle(memmap->buffer),
+ memmap->nr_entries, &desc);
+ if (rc)
+ return rc;
+ set_xen_guest_handle(memmap->buffer, (void *)desc);
+ break;
+ }
+
default:
printk("%s: unknown mini memory op %d\n", __func__, cmd);
return -ENOSYS;
diff -r 31be207e005e -r 7d8acd319d5b xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c Thu May 10 15:46:30 2007 -0600
+++ b/xen/arch/ia64/xen/mm.c Thu May 10 15:55:22 2007 -0600
@@ -2145,6 +2145,37 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
break;
}
+ case XENMEM_machine_memory_map:
+ {
+ struct xen_memory_map memmap;
+ struct xen_ia64_memmap_info memmap_info;
+ XEN_GUEST_HANDLE(char) buffer;
+
+ if (!IS_PRIV(current->domain))
+ return -EINVAL;
+ if (copy_from_guest(&memmap, arg, 1))
+ return -EFAULT;
+ if (memmap.nr_entries <
+ sizeof(memmap_info) + ia64_boot_param->efi_memmap_size)
+ return -EINVAL;
+
+ memmap.nr_entries =
+ sizeof(memmap_info) + ia64_boot_param->efi_memmap_size;
+ memset(&memmap_info, 0, sizeof(memmap_info));
+ memmap_info.efi_memmap_size = ia64_boot_param->efi_memmap_size;
+ memmap_info.efi_memdesc_size = ia64_boot_param->efi_memdesc_size;
+ memmap_info.efi_memdesc_version = ia64_boot_param->efi_memdesc_version;
+
+ buffer = guest_handle_cast(memmap.buffer, char);
+ if (copy_to_guest(buffer, (char*)&memmap_info, sizeof(memmap_info)) ||
+ copy_to_guest_offset(buffer, sizeof(memmap_info),
+ (char*)__va(ia64_boot_param->efi_memmap),
+ ia64_boot_param->efi_memmap_size) ||
+ copy_to_guest(arg, &memmap, 1))
+ return -EFAULT;
+ return 0;
+ }
+
default:
return -ENOSYS;
}
diff -r 31be207e005e -r 7d8acd319d5b xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Thu May 10 15:46:30 2007 -0600
+++ b/xen/include/public/arch-ia64.h Thu May 10 15:55:22 2007 -0600
@@ -317,6 +317,21 @@ struct arch_vcpu_info {
};
typedef struct arch_vcpu_info arch_vcpu_info_t;
+/*
+ * This structure is used for magic page in domain pseudo physical address
+ * space and the result of XENMEM_machine_memory_map.
+ * As the XENMEM_machine_memory_map result,
+ * xen_memory_map::nr_entries indicates the size in bytes
+ * including struct xen_ia64_memmap_info. Not the number of entries.
+ */
+struct xen_ia64_memmap_info {
+ uint64_t efi_memmap_size; /* size of EFI memory map */
+ uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */
+ uint32_t efi_memdesc_version; /* memory descriptor version */
+ void *memdesc[0]; /* array of efi_memory_desc_t */
+};
+typedef struct xen_ia64_memmap_info xen_ia64_memmap_info_t;
+
struct arch_shared_info {
/* PFN of the start_info page. */
unsigned long start_info_pfn;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|