aboutsummaryrefslogtreecommitdiffstats
path: root/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
blob: 71c7dd3a00749ed4ec4b15fdd3827e1bc9d2b78f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
/*
 * Copyright (c) 2005, IBM Corporation
 *
 * Author: Stefan Berger, stefanb@us.ibm.com
 * Grant table support: Mahadevan Gomathisankaran
 *
 * This code has been derived from drivers/xen/netfront/netfront.c
 *
 * Copyright (c) 2002-2004, K A Fraser
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation; or, when distributed
 * separately from the Linux kernel or incorporated into other
 * software packages, subject to the following license:
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this source file (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#include <linux/errno.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <xen/evtchn.h>
#include <xen/interface/grant_table.h>
#include <xen/interface/io/tpmif.h>
#include <xen/xenbus.h>
#include "tpm.h"
#include "tpm_vtpm.h"

#undef DEBUG

/* local structures */
struct tpm_private {
	struct tpm_chip *chip;

	tpmif_tx_interface_t *tx;
	atomic_t refcnt;
	unsigned int evtchn;
	unsigned int irq;
	u8 is_connected;
	u8 is_suspended;

	spinlock_t tx_lock;

	struct tx_buffer *tx_buffers[TPMIF_TX_RING_SIZE];

	atomic_t tx_busy;
	void *tx_remember;

	domid_t backend_id;
	wait_queue_head_t wait_q;

	struct xenbus_device *dev;
	int ring_ref;
};

struct tx_buffer {
	unsigned int size;	// available space in data
	unsigned int len;	// used space in data
	unsigned char *data;	// pointer to a page
};


/* locally visible variables */
static grant_ref_t gref_head;
static struct tpm_private *my_priv;

/* local function prototypes */
static irqreturn_t tpmif_int(int irq,
                             void *tpm_priv,
                             struct pt_regs *ptregs);
static void tpmif_rx_action(unsigned long unused);
static int tpmif_connect(struct xenbus_device *dev,
                         struct tpm_private *tp,
                         domid_t domid);
static DECLARE_TASKLET(tpmif_rx_tasklet, tpmif_rx_action, 0);
static int tpmif_allocate_tx_buffers(struct tpm_private *tp);
static void tpmif_free_tx_buffers(struct tpm_private *tp);
static void tpmif_set_connected_state(struct tpm_private *tp,
                                      u8 newstate);
static int tpm_xmit(struct tpm_private *tp,
                    const u8 * buf, size_t count, int userbuffer,
                    void *remember);
static void destroy_tpmring(struct tpm_private *tp);
void __exit tpmif_exit(void);

#define DPRINTK(fmt, args...) \
    pr_debug("xen_tpm_fr (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
#define IPRINTK(fmt, args...) \
    printk(KERN_INFO "xen_tpm_fr: " fmt, ##args)
#define WPRINTK(fmt, args...) \
    printk(KERN_WARNING "xen_tpm_fr: " fmt, ##args)

#define GRANT_INVALID_REF	0


static inline int
tx_buffer_copy(struct tx_buffer *txb, const u8 * src, int len,
               int isuserbuffer)
{
	int copied = len;

	if (len > txb->size) {
		copied = txb->size;
	}
	if (isuserbuffer) {
		if (copy_from_user(txb->data, src, copied))
			return -EFAULT;
	} else {
		memcpy(txb->data, src, copied);
	}
	txb->len = len;
	return copied;
}

static inline struct tx_buffer *tx_buffer_alloc(void)
{
	struct tx_buffer *txb = kzalloc(sizeof (struct tx_buffer),
					GFP_KERNEL);

	if (txb) {
		txb->len = 0;
		txb->size = PAGE_SIZE;
		txb->data = (unsigned char *)__get_free_page(GFP_KERNEL);
		if (txb->data == NULL) {
			kfree(txb);
			txb = NULL;
		}
	}
	return txb;
}


static inline void tx_buffer_free(struct tx_buffer *txb)
{
	if (txb) {
		free_page((long)txb->data);
		kfree(txb);
	}
}

/**************************************************************
 Utility function for the tpm_private structure
**************************************************************/
static inline void tpm_private_init(struct tpm_private *tp)
{
	spin_lock_init(&tp->tx_lock);
	init_waitqueue_head(&tp->wait_q);
	atomic_set(&tp->refcnt, 1);
}

static inline void tpm_private_put(void)
{
	if ( atomic_dec_and_test(&my_priv->refcnt)) {
		tpmif_free_tx_buffers(my_priv);
		kfree(my_priv);
		my_priv = NULL;
	}
}

static struct tpm_private *tpm_private_get(void)
{
	int err;
	if (!my_priv) {
		my_priv = kzalloc(sizeof(struct tpm_private), GFP_KERNEL);
		if (my_priv) {
			tpm_private_init(my_priv);
			err = tpmif_allocate_tx_buffers(my_priv);
			if (err < 0) {
				tpm_private_put();
			}
		}
	} else {
		atomic_inc(&my_priv->refcnt);
	}
	return my_priv;
}

/**************************************************************

 The interface to let the tpm plugin register its callback
 function and send data to another partition using this module

**************************************************************/

static DEFINE_MUTEX(suspend_lock);
/*
 * Send data via this module by calling this function
 */
int vtpm_vd_send(struct tpm_private *tp,
                 const u8 * buf, size_t count, void *ptr)
{
	int sent;

	mutex_lock(&suspend_lock);
	sent = tpm_xmit(tp, buf, count, 0, ptr);
	mutex_unlock(&suspend_lock);

	return sent;
}

/**************************************************************
 XENBUS support code
**************************************************************/

static int setup_tpmring(struct xenbus_device *dev,
                         struct tpm_private *tp)
{
	tpmif_tx_interface_t *sring;
	int err;

	tp->ring_ref = GRANT_INVALID_REF;

	sring = (void *)__get_free_page(GFP_KERNEL);
	if (!sring) {
		xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring");
		return -ENOMEM;
	}
	tp->tx = sring;

	err = xenbus_grant_ring(dev, virt_to_mfn(tp->tx));
	if (err < 0) {
		free_page((unsigned long)sring);
		tp->tx = NULL;
		xenbus_dev_fatal(dev, err, "allocating grant reference");
		goto fail;
	}
	tp->ring_ref = err;

	err = tpmif_connect(dev, tp, dev->otherend_id);
	if (err)
		goto fail;

	return 0;
fail:
	destroy_tpmring(tp);
	return err;
}


static void destroy_tpmring(struct tpm_private *tp)
{
	tpmif_set_connected_state(tp, 0);

	if (tp->ring_ref != GRANT_INVALID_REF) {
		gnttab_end_foreign_access(tp->ring_ref, 0,
					  (unsigned long)tp->tx);
		tp->ring_ref = GRANT_INVALID_REF;
		tp->tx = NULL;
	}

	if (tp->irq)
		unbind_from_irqhandler(tp->irq, tp);

	tp->evtchn = tp->irq = 0;
}


static int talk_to_backend(struct xenbus_device *dev,
                           struct tpm_private *tp)
{
	const char *message = NULL;
	int err;
	struct xenbus_transaction xbt;

	err = setup_tpmring(dev, tp);
	if (err) {
		xenbus_dev_fatal(dev, err, "setting up ring");
		goto out;
	}

again:
	err = xenbus_transaction_start(&xbt);
	if (err) {
		xenbus_dev_fatal(dev, err, "starting transaction");
		goto destroy_tpmring;
	}

	err = xenbus_printf(xbt, dev->nodename,
	                    "ring-ref","%u", tp->ring_ref);
	if (err) {
		message = "writing ring-ref";
		goto abort_transaction;
	}

	err = xenbus_printf(xbt, dev->nodename,
			    "event-channel", "%u", tp->evtchn);
	if (err) {
		message = "writing event-channel";
		goto abort_transaction;
	}

	err = xenbus_transaction_end(xbt, 0);
	if (err == -EAGAIN)
		goto again;
	if (err) {
		xenbus_dev_fatal(dev, err, "completing transaction");
		goto destroy_tpmring;
	}

	xenbus_switch_state(dev, XenbusStateConnected);

	return 0;

abort_transaction:
	xenbus_transaction_end(xbt, 1);
	if (message)
		xenbus_dev_error(dev, err, "%s", message);
destroy_tpmring:
	destroy_tpmring(tp);
out:
	return err;
}

/**
 * Callback received when the backend's state changes.
 */
static void backend_changed(struct xenbus_device *dev,
			    enum xenbus_state backend_state)
{
	struct tpm_private *tp = tpm_private_from_dev(&dev->dev);
	DPRINTK("\n");

	switch (backend_state) {
	case XenbusStateInitialising:
	case XenbusStateInitWait:
	case XenbusStateInitialised:
		break;

	case XenbusStateConnected:
		tpmif_set_connected_state(tp, 1);
		break;

	case XenbusStateClosing:
		tpmif_set_connected_state(tp, 0);
		break;

	case XenbusStateUnknown:
	case XenbusStateClosed:
		if (tp->is_suspended == 0)
			device_unregister(&dev->dev);
		xenbus_switch_state(dev, XenbusStateClosed);
		break;
	}
}

struct tpm_virtual_device tvd = {
	.max_tx_size = PAGE_SIZE * TPMIF_TX_RING_SIZE,
};

static int tpmfront_probe(struct xenbus_device *dev,
                          const struct xenbus_device_id *id)
{
	int err;
	int handle;
	struct tpm_private *tp = tpm_private_get();

	if (!tp)
		return -ENOMEM;

	tp->chip = init_vtpm(&dev->dev, &tvd, tp);

	if (IS_ERR(tp->chip)) {
		return PTR_ERR(tp->chip);
	}

	err = xenbus_scanf(XBT_NIL, dev->nodename,
	                   "handle", "%i", &handle);
	if (XENBUS_EXIST_ERR(err))
		return err;

	if (err < 0) {
		xenbus_dev_fatal(dev,err,"reading virtual-device");
		return err;
	}

	tp->dev = dev;

	err = talk_to_backend(dev, tp);
	if (err) {
		tpm_private_put();
		return err;
	}
	return 0;
}


static int tpmfront_remove(struct xenbus_device *dev)
{
	struct tpm_private *tp = tpm_private_from_dev(&dev->dev);
	destroy_tpmring(tp);
	cleanup_vtpm(&dev->dev);
	return 0;
}

static int tpmfront_suspend(struct xenbus_device *dev)
{
	struct tpm_private *tp = tpm_private_from_dev(&dev->dev);
	u32 ctr;
	/* lock, so no app can send */
	mutex_lock(&suspend_lock);
	tp->is_suspended = 1;

	for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {
		if ((ctr % 10) == 0)
			printk("TPM-FE [INFO]: Waiting for outstanding request.\n");
		/*
		 * Wait for a request to be responded to.
		 */
		interruptible_sleep_on_timeout(&tp->wait_q, 100);
	}
	xenbus_switch_state(dev, XenbusStateClosing);

	if (atomic_read(&tp->tx_busy)) {
		/*
		 * A temporary work-around.
		 */
		printk("TPM-FE [WARNING]: Resetting busy flag.");
		atomic_set(&tp->tx_busy, 0);
	}

	return 0;
}

static int tpmfront_resume(struct xenbus_device *dev)
{
	struct tpm_private *tp = tpm_private_from_dev(&dev->dev);
	destroy_tpmring(tp);
	return talk_to_backend(dev, tp);
}

static int tpmif_connect(struct xenbus_device *dev,
                         struct tpm_private *tp,
                         domid_t domid)
{
	int err;

	tp->backend_id = domid;

	err = xenbus_alloc_evtchn(dev, &tp->evtchn);
	if (err)
		return err;

	err = bind_evtchn_to_irqhandler(tp->evtchn,
					tpmif_int, SA_SAMPLE_RANDOM, "tpmif",
					tp);
	if (err <= 0) {
		WPRINTK("bind_evtchn_to_irqhandler failed (err=%d)\n", err);
		return err;
	}

	tp->irq = err;
	return 0;
}

static struct xenbus_device_id tpmfront_ids[] = {
	{ "vtpm" },
	{ "" }
};

static struct xenbus_driver tpmfront = {
	.name = "vtpm",
	.owner = THIS_MODULE,
	.ids = tpmfront_ids,
	.probe = tpmfront_probe,
	.remove =  tpmfront_remove,
	.resume = tpmfront_resume,
	.otherend_changed = backend_changed,
	.suspend = tpmfront_suspend,
};

static void __init init_tpm_xenbus(void)
{
	xenbus_register_frontend(&tpmfront);
}

static void __exit exit_tpm_xenbus(void)
{
	xenbus_unregister_driver(&tpmfront);
}

static int tpmif_allocate_tx_buffers(struct tpm_private *tp)
{
	unsigned int i;

	for (i = 0; i < TPMIF_TX_RING_SIZE; i++) {
		tp->tx_buffers[i] = tx_buffer_alloc();
		if (!tp->tx_buffers[i]) {
			tpmif_free_tx_buffers(tp);
			return -ENOMEM;
		}
	}
	return 0;
}

static void tpmif_free_tx_buffers(struct tpm_private *tp)
{
	unsigned int i;

	for (i = 0; i < TPMIF_TX_RING_SIZE; i++) {
		tx_buffer_free(tp->tx_buffers[i]);
	}
}

static void tpmif_rx_action(unsigned long priv)
{
	struct tpm_private *tp = (struct tpm_private *)priv;

	int i = 0;
	unsigned int received;
	unsigned int offset = 0;
	u8 *buffer;
	tpmif_tx_request_t *tx;
	tx = &tp->tx->ring[i].req;

	atomic_set(&tp->tx_busy, 0);
	wake_up_interruptible(&tp->wait_q);

	received = tx->size;

	buffer = kmalloc(received, GFP_ATOMIC);
	if (NULL == buffer) {
		goto exit;
	}

	for (i = 0; i < TPMIF_TX_RING_SIZE && offset < received; i++) {
		struct tx_buffer *txb = tp->tx_buffers[i];
		tpmif_tx_request_t *tx;
		unsigned int tocopy;

		tx = &tp->tx->ring[i].req;
		tocopy = tx->size;
		if (tocopy > PAGE_SIZE) {
			tocopy = PAGE_SIZE;
		}

		memcpy(&buffer[offset], txb->data, tocopy);

		gnttab_release_grant_reference(&gref_head, tx->ref);

		offset += tocopy;
	}

	vtpm_vd_recv(tp->chip, buffer, received, tp->tx_remember);
	kfree(buffer);

exit:

	return;
}


static irqreturn_t tpmif_int(int irq, void *tpm_priv, struct pt_regs *ptregs)
{
	struct tpm_private *tp = tpm_priv;
	unsigned long flags;

	spin_lock_irqsave(&tp->tx_lock, flags);
	tpmif_rx_tasklet.data = (unsigned long)tp;
	tasklet_schedule(&tpmif_rx_tasklet);
	spin_unlock_irqrestore(&tp->tx_lock, flags);

	return IRQ_HANDLED;
}


static int tpm_xmit(struct tpm_private *tp,
                    const u8 * buf, size_t count, int isuserbuffer,
                    void *remember)
{
	tpmif_tx_request_t *tx;
	TPMIF_RING_IDX i;
	unsigned int offset = 0;

	spin_lock_irq(&tp->tx_lock);

	if (unlikely(atomic_read(&tp->tx_busy))) {
		printk("tpm_xmit: There's an outstanding request/response "
		       "on the way!\n");
		spin_unlock_irq(&tp->tx_lock);
		return -EBUSY;
	}

	if (tp->is_connected != 1) {
		spin_unlock_irq(&tp->tx_lock);
		return -EIO;
	}

	for (i = 0; count > 0 && i < TPMIF_TX_RING_SIZE; i++) {
		struct tx_buffer *txb = tp->tx_buffers[i];
		int copied;

		if (NULL == txb) {
			DPRINTK("txb (i=%d) is NULL. buffers initilized?\n"
				"Not transmitting anything!\n", i);
			spin_unlock_irq(&tp->tx_lock);
			return -EFAULT;
		}
		copied = tx_buffer_copy(txb, &buf[offset], count,
		                        isuserbuffer);
		if (copied < 0) {
			/* An error occurred */
			spin_unlock_irq(&tp->tx_lock);
			return copied;
		}
		count -= copied;
		offset += copied;

		tx = &tp->tx->ring[i].req;

		tx->addr = virt_to_machine(txb->data);
		tx->size = txb->len;

		DPRINTK("First 4 characters sent by TPM-FE are 0x%02x 0x%02x 0x%02x 0x%02x\n",
		        txb->data[0],txb->data[1],txb->data[2],txb->data[3]);

		/* get the granttable reference for this page */
		tx->ref = gnttab_claim_grant_reference(&gref_head);

		if (-ENOSPC == tx->ref) {
			spin_unlock_irq(&tp->tx_lock);
			DPRINTK(" Grant table claim reference failed in func:%s line:%d file:%s\n", __FUNCTION__, __LINE__, __FILE__);
			return -ENOSPC;
		}
		gnttab_grant_foreign_access_ref( tx->ref,
		                                 tp->backend_id,
		                                 (tx->addr >> PAGE_SHIFT),
		                                 0 /*RW*/);
		wmb();
	}

	atomic_set(&tp->tx_busy, 1);
	tp->tx_remember = remember;

	mb();

	DPRINTK("Notifying backend via event channel %d\n",
	        tp->evtchn);

	notify_remote_via_irq(tp->irq);

	spin_unlock_irq(&tp->tx_lock);
	return offset;
}


static void tpmif_notify_upperlayer(struct tpm_private *tp)
{
	/*
	 * Notify upper layer about the state of the connection
	 * to the BE.
	 */
	if (tp->is_connected) {
		vtpm_vd_status(tp->chip, TPM_VD_STATUS_CONNECTED);
	} else {
		vtpm_vd_status(tp->chip, TPM_VD_STATUS_DISCONNECTED);
	}
}


static void tpmif_set_connected_state(struct tpm_private *tp, u8 is_connected)
{
	/*
	 * Don't notify upper layer if we are in suspend mode and
	 * should disconnect - assumption is that we will resume
	 * The mutex keeps apps from sending.
	 */
	if (is_connected == 0 && tp->is_suspended == 1) {
		return;
	}

	/*
	 * Unlock the mutex if we are connected again
	 * after being suspended - now resuming.
	 * This also removes the suspend state.
	 */
	if (is_connected == 1 && tp->is_suspended == 1) {
		tp->is_suspended = 0;
		/* unlock, so apps can resume sending */
		mutex_unlock(&suspend_lock);
	}

	if (is_connected != tp->is_connected) {
		tp->is_connected = is_connected;
		tpmif_notify_upperlayer(tp);
	}
}



/* =================================================================
 * Initialization function.
 * =================================================================
 */


static int __init tpmif_init(void)
{
	long rc = 0;
	struct tpm_private *tp;

	if (is_initial_xendomain())
		return -EPERM;

	tp = tpm_private_get();
	if (!tp) {
		rc = -ENOMEM;
		goto failexit;
	}

	IPRINTK("Initialising the vTPM driver.\n");
	if ( gnttab_alloc_grant_references ( TPMIF_TX_RING_SIZE,
	                                     &gref_head ) < 0) {
		rc = -EFAULT;
		goto gnttab_alloc_failed;
	}

	init_tpm_xenbus();
	return 0;

gnttab_alloc_failed:
	tpm_private_put();
failexit:

	return (int)rc;
}


void __exit tpmif_exit(void)
{
	exit_tpm_xenbus();
	tpm_private_put();
	gnttab_free_grant_references(gref_head);
}

module_init(tpmif_init);

MODULE_LICENSE("Dual BSD/GPL");