ia64/xen-unstable

changeset 10154:c7e8d1673140

[IA64] acpi read-only mapping

implemented dom0 acpi read-only mapping

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Wed May 24 11:04:33 2006 -0600 (2006-05-24)
parents 5674e4fe8f02
children ceaae8fbe3f7
files xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/domain.c xen/include/asm-ia64/domain.h
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Wed May 24 10:59:28 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Wed May 24 11:04:33 2006 -0600
     1.3 @@ -697,6 +697,7 @@ dom_fw_fake_acpi(struct domain *d, struc
     1.4  struct dom0_passthrough_arg {
     1.5  #ifdef CONFIG_XEN_IA64_DOM0_VP
     1.6      struct domain*      d;
     1.7 +    int                 flags;
     1.8  #endif
     1.9      efi_memory_desc_t *md;
    1.10      int*                i;
    1.11 @@ -711,7 +712,7 @@ dom_fw_dom0_passthrough(efi_memory_desc_
    1.12  #ifdef CONFIG_XEN_IA64_DOM0_VP
    1.13      struct domain* d = arg->d;
    1.14      u64 start = md->phys_addr;
    1.15 -    u64 end = start + (md->num_pages << EFI_PAGE_SHIFT);
    1.16 +    u64 size = md->num_pages << EFI_PAGE_SHIFT;
    1.17  
    1.18      if (md->type == EFI_MEMORY_MAPPED_IO ||
    1.19          md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
    1.20 @@ -720,13 +721,12 @@ dom_fw_dom0_passthrough(efi_memory_desc_
    1.21          //    It requires impractical memory to map such a huge region
    1.22          //    to a domain.
    1.23          //    For now we don't map it, but later we must fix this.
    1.24 -        if (md->type == EFI_MEMORY_MAPPED_IO &&
    1.25 -            ((md->num_pages << EFI_PAGE_SHIFT) > 0x100000000UL))
    1.26 +        if (md->type == EFI_MEMORY_MAPPED_IO && (size > 0x100000000UL))
    1.27              return 0;
    1.28  
    1.29 -        paddr = assign_domain_mmio_page(d, start, end - start);
    1.30 +        paddr = assign_domain_mmio_page(d, start, size);
    1.31      } else
    1.32 -        paddr = assign_domain_mach_page(d, start, end - start);
    1.33 +        paddr = assign_domain_mach_page(d, start, size, arg->flags);
    1.34  #else
    1.35      paddr = md->phys_addr;
    1.36  #endif
    1.37 @@ -874,9 +874,10 @@ dom_fw_init (struct domain *d, const cha
    1.38  	}
    1.39  	if (d == dom0) {
    1.40  #ifdef CONFIG_XEN_IA64_DOM0_VP
    1.41 -# define ASSIGN_DOMAIN_MACH_PAGE(d, p) assign_domain_mach_page(d, p, PAGE_SIZE)
    1.42 +# define ASSIGN_DOMAIN_MACH_PAGE(d, p) \
    1.43 +        assign_domain_mach_page((d), (p), PAGE_SIZE, ASSIGN_readonly)
    1.44  #else
    1.45 -# define ASSIGN_DOMAIN_MACH_PAGE(d, p) ({p;})
    1.46 +# define ASSIGN_DOMAIN_MACH_PAGE(d, p) (p)
    1.47  #endif
    1.48  
    1.49  		printf("Domain0 EFI passthrough:");
    1.50 @@ -990,17 +991,24 @@ dom_fw_init (struct domain *d, const cha
    1.51  		/* pass through the I/O port space */
    1.52  		if (!running_on_sim) {
    1.53  			struct dom0_passthrough_arg arg;
    1.54 +			arg.md = &efi_memmap[i];
    1.55 +			arg.i = &i;
    1.56  #ifdef CONFIG_XEN_IA64_DOM0_VP
    1.57  			arg.d = d;
    1.58 +			arg.flags = ASSIGN_writable;
    1.59  #endif
    1.60 -			arg.md = &efi_memmap[i];
    1.61 -			arg.i = &i;
    1.62  			//XXX Is this needed?
    1.63  			efi_memmap_walk_type(EFI_RUNTIME_SERVICES_CODE,
    1.64  			                     dom_fw_dom0_passthrough, &arg);
    1.65  			// for ACPI table.
    1.66 +#ifdef CONFIG_XEN_IA64_DOM0_VP
    1.67 +			arg.flags = ASSIGN_readonly;
    1.68 +#endif
    1.69  			efi_memmap_walk_type(EFI_RUNTIME_SERVICES_DATA,
    1.70  			                     dom_fw_dom0_passthrough, &arg);
    1.71 +#ifdef CONFIG_XEN_IA64_DOM0_VP
    1.72 +			arg.flags = ASSIGN_writable;
    1.73 +#endif
    1.74  			efi_memmap_walk_type(EFI_ACPI_RECLAIM_MEMORY,
    1.75  			                     dom_fw_dom0_passthrough, &arg);
    1.76  			efi_memmap_walk_type(EFI_MEMORY_MAPPED_IO,
     2.1 --- a/xen/arch/ia64/xen/domain.c	Wed May 24 10:59:28 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Wed May 24 11:04:33 2006 -0600
     2.3 @@ -873,12 +873,13 @@ assign_domain_page(struct domain *d,
     2.4  #ifdef CONFIG_XEN_IA64_DOM0_VP
     2.5  static void
     2.6  assign_domain_same_page(struct domain *d,
     2.7 -                        unsigned long mpaddr, unsigned long size)
     2.8 +                        unsigned long mpaddr, unsigned long size,
     2.9 +                        unsigned long flags)
    2.10  {
    2.11      //XXX optimization
    2.12      unsigned long end = mpaddr + size;
    2.13      for (; mpaddr < end; mpaddr += PAGE_SIZE) {
    2.14 -        __assign_domain_page(d, mpaddr, mpaddr, ASSIGN_writable);
    2.15 +        __assign_domain_page(d, mpaddr, mpaddr, flags);
    2.16      }
    2.17  }
    2.18  
    2.19 @@ -945,15 +946,16 @@ assign_domain_mmio_page(struct domain *d
    2.20                  __func__, __LINE__, d, mpaddr, size);
    2.21          return -EINVAL;
    2.22      }
    2.23 -    assign_domain_same_page(d, mpaddr, size);
    2.24 +    assign_domain_same_page(d, mpaddr, size, ASSIGN_writable);
    2.25      return mpaddr;
    2.26  }
    2.27  
    2.28  unsigned long
    2.29  assign_domain_mach_page(struct domain *d,
    2.30 -                        unsigned long mpaddr, unsigned long size)
    2.31 +                        unsigned long mpaddr, unsigned long size,
    2.32 +                        unsigned long flags)
    2.33  {
    2.34 -    assign_domain_same_page(d, mpaddr, size);
    2.35 +    assign_domain_same_page(d, mpaddr, size, flags);
    2.36      return mpaddr;
    2.37  }
    2.38  
     3.1 --- a/xen/include/asm-ia64/domain.h	Wed May 24 10:59:28 2006 -0600
     3.2 +++ b/xen/include/asm-ia64/domain.h	Wed May 24 11:04:33 2006 -0600
     3.3 @@ -120,7 +120,7 @@ void assign_domain_io_page(struct domain
     3.4  #ifdef CONFIG_XEN_IA64_DOM0_VP
     3.5  void alloc_dom_xen_and_dom_io(void);
     3.6  unsigned long assign_domain_mmio_page(struct domain *d, unsigned long mpaddr, unsigned long size);
     3.7 -unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr, unsigned long size);
     3.8 +unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr, unsigned long size, unsigned long flags);
     3.9  unsigned long do_dom0vp_op(unsigned long cmd, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3);
    3.10  unsigned long dom0vp_zap_physmap(struct domain *d, unsigned long gpfn, unsigned int extent_order);
    3.11  unsigned long dom0vp_add_physmap(struct domain* d, unsigned long gpfn, unsigned long mfn, unsigned long flags, domid_t domid);