direct-io.hg

changeset 15114:7d8acd319d5b

[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@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu May 10 15:55:22 2007 -0600 (2007-05-10)
parents 31be207e005e
children 7812598f65be
files linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c xen/arch/ia64/xen/mm.c xen/include/public/arch-ia64.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c	Thu May 10 15:46:30 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c	Thu May 10 15:55:22 2007 -0600
     1.3 @@ -226,6 +226,8 @@ xencomm_hypercall_memory_op(unsigned int
     1.4  {
     1.5  	XEN_GUEST_HANDLE(xen_pfn_t) extent_start_va[2];
     1.6  	xen_memory_reservation_t *xmr = NULL, *xme_in = NULL, *xme_out = NULL;
     1.7 +	xen_memory_map_t *memmap = NULL;
     1.8 +	XEN_GUEST_HANDLE(void) buffer;
     1.9  	int rc;
    1.10  
    1.11  	switch (cmd) {
    1.12 @@ -254,6 +256,14 @@ xencomm_hypercall_memory_op(unsigned int
    1.13  			(&((xen_memory_exchange_t *)arg)->out);
    1.14  		break;
    1.15  
    1.16 +	case XENMEM_machine_memory_map:
    1.17 +		memmap = (xen_memory_map_t *)arg;
    1.18 +		xen_guest_handle(buffer) = xen_guest_handle(memmap->buffer);
    1.19 +		set_xen_guest_handle(memmap->buffer,
    1.20 +			(void *)xencomm_create_inline(
    1.21 +				xen_guest_handle(memmap->buffer)));
    1.22 +		break;
    1.23 +
    1.24  	default:
    1.25  		printk("%s: unknown memory op %d\n", __func__, cmd);
    1.26  		return -ENOSYS;
    1.27 @@ -275,6 +285,10 @@ xencomm_hypercall_memory_op(unsigned int
    1.28  		xen_guest_handle(xme_out->extent_start) =
    1.29  			xen_guest_handle(extent_start_va[1]);
    1.30  		break;
    1.31 +
    1.32 +	case XENMEM_machine_memory_map:
    1.33 +		xen_guest_handle(memmap->buffer) = xen_guest_handle(buffer);
    1.34 +		break;
    1.35  	}
    1.36  
    1.37  	return rc;
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c	Thu May 10 15:46:30 2007 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c	Thu May 10 15:55:22 2007 -0600
     2.3 @@ -238,6 +238,19 @@ xencomm_mini_hypercall_memory_op(unsigne
     2.4  		argsize = sizeof (xen_add_to_physmap_t);
     2.5  		break;
     2.6  
     2.7 +	case XENMEM_machine_memory_map:
     2.8 +	{
     2.9 +		xen_memory_map_t *memmap = (xen_memory_map_t *)arg;
    2.10 +		argsize = sizeof(*memmap);
    2.11 +		rc = xencomm_create_mini(xc_area, &nbr_area,
    2.12 +					 xen_guest_handle(memmap->buffer),
    2.13 +					 memmap->nr_entries, &desc);
    2.14 +		if (rc)
    2.15 +			return rc;
    2.16 +		set_xen_guest_handle(memmap->buffer, (void *)desc);
    2.17 +		break;
    2.18 +	}
    2.19 +
    2.20  	default:
    2.21  		printk("%s: unknown mini memory op %d\n", __func__, cmd);
    2.22  		return -ENOSYS;
     3.1 --- a/xen/arch/ia64/xen/mm.c	Thu May 10 15:46:30 2007 -0600
     3.2 +++ b/xen/arch/ia64/xen/mm.c	Thu May 10 15:55:22 2007 -0600
     3.3 @@ -2145,6 +2145,37 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
     3.4          break;
     3.5      }
     3.6  
     3.7 +    case XENMEM_machine_memory_map:
     3.8 +    {
     3.9 +        struct xen_memory_map memmap;
    3.10 +        struct xen_ia64_memmap_info memmap_info;
    3.11 +        XEN_GUEST_HANDLE(char) buffer;
    3.12 +
    3.13 +        if (!IS_PRIV(current->domain))
    3.14 +            return -EINVAL;
    3.15 +        if (copy_from_guest(&memmap, arg, 1))
    3.16 +            return -EFAULT;
    3.17 +        if (memmap.nr_entries <
    3.18 +            sizeof(memmap_info) + ia64_boot_param->efi_memmap_size)
    3.19 +            return -EINVAL;
    3.20 +
    3.21 +        memmap.nr_entries =
    3.22 +            sizeof(memmap_info) + ia64_boot_param->efi_memmap_size;
    3.23 +        memset(&memmap_info, 0, sizeof(memmap_info));
    3.24 +        memmap_info.efi_memmap_size = ia64_boot_param->efi_memmap_size;
    3.25 +        memmap_info.efi_memdesc_size = ia64_boot_param->efi_memdesc_size;
    3.26 +        memmap_info.efi_memdesc_version = ia64_boot_param->efi_memdesc_version;
    3.27 +
    3.28 +        buffer = guest_handle_cast(memmap.buffer, char);
    3.29 +        if (copy_to_guest(buffer, (char*)&memmap_info, sizeof(memmap_info)) ||
    3.30 +            copy_to_guest_offset(buffer, sizeof(memmap_info),
    3.31 +                                 (char*)__va(ia64_boot_param->efi_memmap),
    3.32 +                                 ia64_boot_param->efi_memmap_size) ||
    3.33 +            copy_to_guest(arg, &memmap, 1))
    3.34 +            return -EFAULT;
    3.35 +        return 0;
    3.36 +    }
    3.37 +
    3.38      default:
    3.39          return -ENOSYS;
    3.40      }
     4.1 --- a/xen/include/public/arch-ia64.h	Thu May 10 15:46:30 2007 -0600
     4.2 +++ b/xen/include/public/arch-ia64.h	Thu May 10 15:55:22 2007 -0600
     4.3 @@ -317,6 +317,21 @@ struct arch_vcpu_info {
     4.4  };
     4.5  typedef struct arch_vcpu_info arch_vcpu_info_t;
     4.6  
     4.7 +/*
     4.8 + * This structure is used for magic page in domain pseudo physical address
     4.9 + * space and the result of XENMEM_machine_memory_map.
    4.10 + * As the XENMEM_machine_memory_map result,
    4.11 + * xen_memory_map::nr_entries indicates the size in bytes 
    4.12 + * including struct xen_ia64_memmap_info. Not the number of entries.
    4.13 + */
    4.14 +struct xen_ia64_memmap_info {
    4.15 +    uint64_t efi_memmap_size;       /* size of EFI memory map */
    4.16 +    uint64_t efi_memdesc_size;      /* size of an EFI memory map descriptor */
    4.17 +    uint32_t efi_memdesc_version;   /* memory descriptor version */
    4.18 +    void *memdesc[0];               /* array of efi_memory_desc_t */
    4.19 +};
    4.20 +typedef struct xen_ia64_memmap_info xen_ia64_memmap_info_t;
    4.21 +
    4.22  struct arch_shared_info {
    4.23      /* PFN of the start_info page.  */
    4.24      unsigned long start_info_pfn;