ia64/xen-unstable

changeset 16512:9ce9d43a76a2

tboot, xen: Update for Trusted Boot v20071128.

This patch updates the Xen to work with the latest version (20071128)
of Trusted Boot (tboot). This version of tboot now resides at 16MB
(instead of the previous <1MB), in addition to several other
enhancements. By residing at 16MB, this version of tboot will be
protected from access by dom0.

This patch allows Xen to correctly map the tboot shutdown code that it
must trampoline into for a clean shutdown (without this patch Xen will
fault on shutdown). This patch will also work with the previous
version of tboot.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Dec 04 10:47:10 2007 +0000 (2007-12-04)
parents d1e1db24bd5f
children b1da8762f853
files Makefile xen/arch/x86/tboot.c xen/include/asm-x86/tboot.h
line diff
     1.1 --- a/Makefile	Tue Dec 04 10:41:55 2007 +0000
     1.2 +++ b/Makefile	Tue Dec 04 10:47:10 2007 +0000
     1.3 @@ -211,7 +211,7 @@ linux26:
     1.4  # tboot targets
     1.5  #
     1.6  
     1.7 -TBOOT_TARFILE = tboot-20071029.tar.gz
     1.8 +TBOOT_TARFILE = tboot-20071128.tar.gz
     1.9  TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
    1.10  
    1.11  .PHONY: build-tboot
    1.12 @@ -222,6 +222,10 @@ build-tboot: download_tboot
    1.13  install-tboot: download_tboot
    1.14  	$(MAKE) -C tboot install
    1.15  
    1.16 +.PHONY: dist-tboot
    1.17 +dist-tboot: download_tboot
    1.18 +	$(MAKE) DESTDIR=$(DISTDIR)/install -C tboot dist
    1.19 +
    1.20  .PHONY: clean-tboot
    1.21  clean-tboot:
    1.22  	[ ! -d tboot ] || $(MAKE) -C tboot clean
     2.1 --- a/xen/arch/x86/tboot.c	Tue Dec 04 10:41:55 2007 +0000
     2.2 +++ b/xen/arch/x86/tboot.c	Tue Dec 04 10:47:10 2007 +0000
     2.3 @@ -43,16 +43,43 @@ void __init tboot_probe(void)
     2.4      printk("  s3_tb_wakeup_entry: 0x%08x\n", tboot_shared->s3_tb_wakeup_entry);
     2.5      printk("  s3_k_wakeup_entry: 0x%08x\n", tboot_shared->s3_k_wakeup_entry);
     2.6      printk("  &acpi_sinfo: 0x%p\n", &tboot_shared->acpi_sinfo);
     2.7 +    if ( tboot_shared->version >= 0x02 )
     2.8 +    {
     2.9 +        printk("  tboot_base: 0x%08x\n", tboot_shared->tboot_base);
    2.10 +        printk("  tboot_size: 0x%x\n", tboot_shared->tboot_size);
    2.11 +    }
    2.12  }
    2.13  
    2.14  void tboot_shutdown(uint32_t shutdown_type)
    2.15  {
    2.16 +    uint32_t map_base, map_size;
    2.17 +    int err;
    2.18 +
    2.19      g_tboot_shared->shutdown_type = shutdown_type;
    2.20  
    2.21      local_irq_disable();
    2.22  
    2.23 -    /* Create identity map for 0-640k to include tboot code. */
    2.24 -    map_pages_to_xen(0, 0, PFN_UP(0xa0000), __PAGE_HYPERVISOR);
    2.25 +    /* Create identity map for tboot shutdown code. */
    2.26 +    if ( g_tboot_shared->version >= 0x02 )
    2.27 +    {
    2.28 +        map_base = PFN_DOWN(g_tboot_shared->tboot_base);
    2.29 +        map_size = PFN_UP(g_tboot_shared->tboot_size);
    2.30 +    }
    2.31 +    else
    2.32 +    {
    2.33 +        map_base = 0;
    2.34 +        map_size = PFN_UP(0xa0000);
    2.35 +    }
    2.36 +
    2.37 +    err = map_pages_to_xen(map_base << PAGE_SHIFT, map_base, map_size,
    2.38 +                           __PAGE_HYPERVISOR);
    2.39 +    if ( err != 0 )
    2.40 +    {
    2.41 +        printk("error (0x%x) mapping tboot pages (mfns) @ 0x%x, 0x%x\n", err,
    2.42 +               map_base, map_size);
    2.43 +        return;
    2.44 +    }
    2.45 +
    2.46      write_ptbase(idle_vcpu[0]);
    2.47  
    2.48  #ifdef __x86_64__
    2.49 @@ -68,3 +95,13 @@ int tboot_in_measured_env(void)
    2.50  {
    2.51      return (g_tboot_shared != NULL);
    2.52  }
    2.53 +
    2.54 +/*
    2.55 + * Local variables:
    2.56 + * mode: C
    2.57 + * c-set-style: "BSD"
    2.58 + * c-basic-offset: 4
    2.59 + * tab-width: 4
    2.60 + * indent-tabs-mode: nil
    2.61 + * End:
    2.62 + */
     3.1 --- a/xen/include/asm-x86/tboot.h	Tue Dec 04 10:41:55 2007 +0000
     3.2 +++ b/xen/include/asm-x86/tboot.h	Tue Dec 04 10:47:10 2007 +0000
     3.3 @@ -49,8 +49,9 @@ typedef struct __attribute__ ((__packed_
     3.4  #define MAX_TB_ACPI_SINFO_SIZE   64
     3.5  
     3.6  typedef struct __attribute__ ((__packed__)) {
     3.7 +    /* version 0x01+ fields: */
     3.8      uuid_t    uuid;              /* {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} */
     3.9 -    uint32_t  version;           /* 0x01 */
    3.10 +    uint32_t  version;           /* Version number: 0x01, 0x02, ... */
    3.11      uint32_t  log_addr;          /* physical addr of tb_log_t log */
    3.12      uint32_t  shutdown_entry32;  /* entry point for tboot shutdown from 32b */
    3.13      uint32_t  shutdown_entry64;  /* entry point for tboot shutdown from 64b */
    3.14 @@ -59,6 +60,9 @@ typedef struct __attribute__ ((__packed_
    3.15      uint32_t  s3_k_wakeup_entry; /* entry point for xen s3 wake up */
    3.16      uint8_t   acpi_sinfo[MAX_TB_ACPI_SINFO_SIZE];
    3.17                                   /* where kernel put acpi sleep info in Sx */
    3.18 +    /* version 0x02+ fields: */
    3.19 +    uint32_t  tboot_base;        /* starting addr for tboot */
    3.20 +    uint32_t  tboot_size;        /* size of tboot */
    3.21  } tboot_shared_t;
    3.22  
    3.23  #define TB_SHUTDOWN_REBOOT      0