direct-io.hg

changeset 15117:4ca4374eabd5

[IA64] get guest os type

This patch is to use GFW ACPI_OSI to identify guest OS type.
When ACPI_OSI gets OS type, it writes to a reserved port a
special val. then XEN can know the guest OS type.

NB. Linux returns true both for _OSI(linux) and _OSI(windows)

Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author Alex Williamson <alex.williamson@hp.com>
date Fri May 11 13:15:53 2007 -0600 (2007-05-11)
parents d6309cfd1fdd
children c0de8feef4cd
files xen/arch/ia64/vmx/mmio.c xen/arch/ia64/vmx/vmx_init.c xen/include/asm-ia64/vmx_platform.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/mmio.c	Fri May 11 13:09:12 2007 -0600
     1.2 +++ b/xen/arch/ia64/vmx/mmio.c	Fri May 11 13:15:53 2007 -0600
     1.3 @@ -188,6 +188,21 @@ int vmx_ide_pio_intercept(ioreq_t *p, u6
     1.4  
     1.5  #define TO_LEGACY_IO(pa)  (((pa)>>12<<2)|((pa)&0x3))
     1.6  
     1.7 +const char * guest_os_name[] = {
     1.8 +    "Unknown",
     1.9 +    "Windows 2003 server",
    1.10 +    "Linux",
    1.11 +};
    1.12 +
    1.13 +static inline void set_os_type(VCPU *v, u64 type)
    1.14 +{
    1.15 +    if (type > OS_BASE && type < OS_END) {
    1.16 +        v->domain->arch.vmx_platform.gos_type = type;
    1.17 +        gdprintk(XENLOG_INFO, "Guest OS : %s\n", guest_os_name[type - OS_BASE]);
    1.18 +    }
    1.19 +}
    1.20 +
    1.21 +
    1.22  static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
    1.23  {
    1.24      struct vcpu *v = current;
    1.25 @@ -210,6 +225,11 @@ static void legacy_io_access(VCPU *vcpu,
    1.26      p->df = 0;
    1.27  
    1.28      p->io_count++;
    1.29 +    
    1.30 +    if (dir == IOREQ_WRITE && p->addr == OS_TYPE_PORT) {
    1.31 +        set_os_type(v, *val);
    1.32 +        return;
    1.33 +    }
    1.34  
    1.35      if (vmx_ide_pio_intercept(p, val))
    1.36          return;
     2.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Fri May 11 13:09:12 2007 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Fri May 11 13:15:53 2007 -0600
     2.3 @@ -305,7 +305,8 @@ vmx_final_setup_guest(struct vcpu *v)
     2.4  	v->arch.privregs = (mapped_regs_t *)vpd;
     2.5  	vcpu_share_privregs_with_guest(v);
     2.6  	vpd->vpd_low.virt_env_vaddr = vm_buffer;
     2.7 -
     2.8 +    
     2.9 +	v->domain->arch.vmx_platform.gos_type = OS_UNKNOWN;
    2.10  	/* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
    2.11  	 * to this solution. Maybe it can be deferred until we know created
    2.12  	 * one as vmx domain */
     3.1 --- a/xen/include/asm-ia64/vmx_platform.h	Fri May 11 13:09:12 2007 -0600
     3.2 +++ b/xen/include/asm-ia64/vmx_platform.h	Fri May 11 13:15:53 2007 -0600
     3.3 @@ -22,8 +22,23 @@
     3.4  #include <public/xen.h>
     3.5  #include <public/hvm/params.h>
     3.6  #include <asm/viosapic.h>
     3.7 +
     3.8 +
     3.9 +/* Value of guest os type */
    3.10 +#define OS_BASE     0xB0
    3.11 +#define OS_UNKNOWN  0xB0
    3.12 +#define OS_WINDOWS  0xB1
    3.13 +#define OS_LINUX    0xB2
    3.14 +#define OS_END      0xB3
    3.15 +
    3.16 +/* port guest Firmware use to indicate os type 
    3.17 + * this port is used to trigger SMI on x86,
    3.18 + * it is not used on ia64 */
    3.19 +#define OS_TYPE_PORT    0xB2
    3.20 +
    3.21  struct mmio_list;
    3.22  typedef struct virtual_platform_def {
    3.23 +    unsigned long       gos_type;
    3.24      unsigned long       buffered_io_va;
    3.25      spinlock_t          buffered_io_lock;
    3.26      unsigned long       buffered_pio_va;