ia64/xen-unstable

view tools/vtpm/tpm_emulator.patch @ 9488:0a6f5527ca4b

[IA64] set itv handoff as masked and enable reading irr[0-3]

Set initial vcpu itv handoff state to mask the timer vector.
This seems to match hardware and makes logical sense from a
spurious interrupt perspective. Enable vcpu_get_irr[0-3]
functions as they seem to work and have the proper backing.
This enables the check_sal_cache_flush() in arch/ia64/kernel.sal.c
to work unmodified, allowing us to remove the Xen changes from
the file (and thus the file from the sparse tree).

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Tue Apr 04 09:39:45 2006 -0600 (2006-04-04)
parents 201d48272a57
children 72ef14e79cc0
line source
1 diff -uprN orig/tpm_emulator-0.2-x86_64/AUTHORS tpm_emulator/AUTHORS
2 --- orig/tpm_emulator-0.2-x86_64/AUTHORS 2005-08-15 00:58:57.000000000 -0700
3 +++ tpm_emulator/AUTHORS 2005-09-14 20:27:22.000000000 -0700
4 @@ -1 +1,2 @@
5 Mario Strasser <mast@gmx.net>
6 +INTEL Corp <>
7 diff -uprN orig/tpm_emulator-0.2-x86_64/ChangeLog tpm_emulator/ChangeLog
8 --- orig/tpm_emulator-0.2-x86_64/ChangeLog 2005-08-15 00:58:57.000000000 -0700
9 +++ tpm_emulator/ChangeLog 2005-09-14 20:27:22.000000000 -0700
10 @@ -1,3 +1,7 @@
11 +2005-08-16: INTEL Corp
12 + * Set default permissions to PCRs
13 + * Changed device to /dev/tpm0
14 +
15 2005-08-15 Mario Strasser <mast@gmx.net>
16 * all: some typos corrected
17 * tpm_integrity.c: bug in TPM_Extend fixed
18 diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.h tpm_emulator/linux_module.h
19 --- orig/tpm_emulator-0.2-x86_64/linux_module.h 2005-09-15 19:21:14.844078720 -0700
20 +++ tpm_emulator/linux_module.h 2005-09-14 20:27:22.000000000 -0700
21 @@ -1,5 +1,6 @@
22 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
23 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
24 + * Copyright (C) 2005 INTEL Corp.
25 *
26 * This module is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License as published
28 @@ -35,7 +36,7 @@
29 #include "tpm_version.h"
31 #define TPM_DEVICE_MINOR 224
32 -#define TPM_DEVICE_NAME "tpm"
33 +#define TPM_DEVICE_NAME "tpm0"
34 #define TPM_MODULE_NAME "tpm_emulator"
36 /* debug and log output functions */
37 diff -uprN orig/tpm_emulator-0.2-x86_64/Makefile tpm_emulator/Makefile
38 --- orig/tpm_emulator-0.2-x86_64/Makefile 2005-09-15 19:21:14.845078568 -0700
39 +++ tpm_emulator/Makefile 2005-09-14 20:27:22.000000000 -0700
40 @@ -1,16 +1,22 @@
41 # Software-Based Trusted Platform Module (TPM) Emulator for Linux
42 # Copyright (C) 2004 Mario Strasser <mast@gmx.net>
43 +# Copyright (C) 2005 INTEL Corp.
44 #
45 # $Id: Makefile 10 2005-04-26 20:59:50Z mast $
47 +XEN_ROOT := ../../..
48 +EUID := $(shell id -u)
49 +
50 # kernel settings
51 KERNEL_RELEASE := $(shell uname -r)
52 -KERNEL_BUILD := /lib/modules/$(KERNEL_RELEASE)/build
53 +CUR_DIR := $(shell pwd)
54 +LINUX_VERSION := $(shell cat $(CUR_DIR)/$(XEN_ROOT)/buildconfigs/mk.linux-2.6-xen | grep "LINUX_VER" | grep "2.6" | gawk '{ print $$3 }' )
55 +KERNEL_BUILD := $(XEN_ROOT)/linux-$(LINUX_VERSION)-xen0
56 MOD_SUBDIR := misc
57 COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/)
59 # module settings
60 -MODULE_NAME := tpm_emulator
61 +BIN := tpm_emulator
62 VERSION_MAJOR := 0
63 VERSION_MINOR := 2
64 VERSION_BUILD := $(shell date +"%s")
65 @@ -34,11 +38,9 @@ DIRS := . crypto tpm
66 SRCS := $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.c))
67 OBJS := $(patsubst %.c, %.o, $(SRCS))
68 SRCS += $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.h))
69 -DISTSRC := ./README ./AUTHORS ./ChangeLog ./Makefile $(SRCS)
70 -DISTDIR := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)
72 -obj-m := $(MODULE_NAME).o
73 -$(MODULE_NAME)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
74 +obj-m := $(BIN).o
75 +$(BIN)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
77 EXTRA_CFLAGS += -I$(src) -I$(src)/crypto -I$(src)/tpm
79 @@ -49,23 +51,17 @@ all: $(src)/crypto/gmp.h $(src)/crypto/l
80 @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules
82 install:
83 - @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules_install
84 - test -d /var/tpm || mkdir /var/tpm
85 - test -c /dev/tpm || mknod /dev/tpm c 10 224
86 - chmod 666 /dev/tpm
87 - depmod -a
88 + @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) INSTALL_MOD_PATH=$(DESTDIR) modules_install
89 + test -d $(DESTDIR)/var/tpm || mkdir $(DESTDIR)/var/tpm
90 + test -d $(DESTDIR)/dev || mkdir $(DESTDIR)/dev
91 + test -c $(DESTDIR)/dev/tpm0 || [ $(EUID) -ne 0 ] || mknod $(DESTDIR)/dev/tpm0 c 10 224
92 + [ $(EUID) -ne 0 ] || chmod 666 $(DESTDIR)/dev/tpm0
94 clean:
95 @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) clean
96 rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a
98 -dist: $(DISTSRC)
99 - rm -rf $(DISTDIR)
100 - mkdir $(DISTDIR)
101 - cp --parents $(DISTSRC) $(DISTDIR)/
102 - rm -f $(DISTDIR)/crypto/gmp.h
103 - tar -chzf $(DISTDIR).tar.gz $(DISTDIR)
104 - rm -rf $(DISTDIR)
105 +mrproper: clean
107 $(src)/crypto/libgmp.a:
108 test -f $(src)/crypto/libgmp.a || ln -s $(GMP_LIB) $(src)/crypto/libgmp.a
109 diff -uprN orig/tpm_emulator-0.2-x86_64/README tpm_emulator/README
110 --- orig/tpm_emulator-0.2-x86_64/README 2005-08-15 00:58:57.000000000 -0700
111 +++ tpm_emulator/README 2005-09-14 20:27:22.000000000 -0700
112 @@ -13,7 +13,8 @@ $Id: README 8 2005-01-25 21:11:45Z jmoli
113 Copyright
114 --------------------------------------------------------------------------
115 Copyright (C) 2004 Mario Strasser <mast@gmx.net> and Swiss Federal
116 -Institute of Technology (ETH) Zurich.
117 + Institute of Technology (ETH) Zurich.
118 +Copyright (C) 2005
120 This program is free software; you can redistribute it and/or modify
121 it under the terms of the GNU General Public License as published by
122 diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c tpm_emulator/tpm/tpm_data.c
123 --- orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c 2005-09-15 19:21:14.847078264 -0700
124 +++ tpm_emulator/tpm/tpm_data.c 2005-09-14 20:27:22.000000000 -0700
125 @@ -1,6 +1,7 @@
126 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
127 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
128 * Swiss Federal Institute of Technology (ETH) Zurich
129 + * Copyright (C) 2005 INTEL Corp
130 *
131 * This module is free software; you can redistribute it and/or modify
132 * it under the terms of the GNU General Public License as published
133 @@ -85,6 +86,11 @@ void tpm_init_data(void)
134 tpmData.permanent.data.version.revMinor = VERSION_MINOR;
135 /* setup PCR attributes */
136 for (i = 0; i < TPM_NUM_PCR; i++) {
137 + int j;
138 + for (j=0; j < TPM_NUM_LOCALITY; j++) {
139 + tpmData.permanent.data.pcrAttrib[i].pcrExtendLocal[j] = TRUE;
140 + }
141 +
142 tpmData.permanent.data.pcrAttrib[i].pcrReset = TRUE;
143 }
144 /* set tick type */