From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Marcel Selhorst <m.selhorst@sirrix.com>,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Debora Velarde <debora@linux.vnet.ibm.com>,
Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Subject: [44/93] tpm_infineon: fix suspend/resume handler for pnp_driver
Date: Fri, 19 Feb 2010 08:29:37 -0800 [thread overview]
Message-ID: <20100219163242.971094467@kvm.kroah.org> (raw)
In-Reply-To: <20100219165717.GA15002@kroah.com>
2.6.32-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcel Selhorst <m.selhorst@sirrix.com>
commit 93716b9470fbfd9efdc7d0f2445cb34635de3f6d upstream.
When suspending, tpm_infineon calls the generic suspend function of the
TPM framework. However, the TPM framework does not return and the system
hangs upon suspend. When sending the necessary command "TPM_SaveState"
directly within the driver, suspending and resuming works fine.
Signed-off-by: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/tpm/tpm_infineon.c | 79 ++++++++++++++++++++++++++++------------
1 file changed, 57 insertions(+), 22 deletions(-)
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -39,12 +39,12 @@
struct tpm_inf_dev {
int iotype;
- void __iomem *mem_base; /* MMIO ioremap'd addr */
- unsigned long map_base; /* phys MMIO base */
- unsigned long map_size; /* MMIO region size */
- unsigned int index_off; /* index register offset */
+ void __iomem *mem_base; /* MMIO ioremap'd addr */
+ unsigned long map_base; /* phys MMIO base */
+ unsigned long map_size; /* MMIO region size */
+ unsigned int index_off; /* index register offset */
- unsigned int data_regs; /* Data registers */
+ unsigned int data_regs; /* Data registers */
unsigned int data_size;
unsigned int config_port; /* IO Port config index reg */
@@ -406,14 +406,14 @@ static const struct tpm_vendor_specific
.miscdev = {.fops = &inf_ops,},
};
-static const struct pnp_device_id tpm_pnp_tbl[] = {
+static const struct pnp_device_id tpm_inf_pnp_tbl[] = {
/* Infineon TPMs */
{"IFX0101", 0},
{"IFX0102", 0},
{"", 0}
};
-MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl);
+MODULE_DEVICE_TABLE(pnp, tpm_inf_pnp_tbl);
static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *dev_id)
@@ -430,7 +430,7 @@ static int __devinit tpm_inf_pnp_probe(s
if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
!(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
- tpm_dev.iotype = TPM_INF_IO_PORT;
+ tpm_dev.iotype = TPM_INF_IO_PORT;
tpm_dev.config_port = pnp_port_start(dev, 0);
tpm_dev.config_size = pnp_port_len(dev, 0);
@@ -459,9 +459,9 @@ static int __devinit tpm_inf_pnp_probe(s
goto err_last;
}
} else if (pnp_mem_valid(dev, 0) &&
- !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
+ !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
- tpm_dev.iotype = TPM_INF_IO_MEM;
+ tpm_dev.iotype = TPM_INF_IO_MEM;
tpm_dev.map_base = pnp_mem_start(dev, 0);
tpm_dev.map_size = pnp_mem_len(dev, 0);
@@ -563,11 +563,11 @@ static int __devinit tpm_inf_pnp_probe(s
"product id 0x%02x%02x"
"%s\n",
tpm_dev.iotype == TPM_INF_IO_PORT ?
- tpm_dev.config_port :
- tpm_dev.map_base + tpm_dev.index_off,
+ tpm_dev.config_port :
+ tpm_dev.map_base + tpm_dev.index_off,
tpm_dev.iotype == TPM_INF_IO_PORT ?
- tpm_dev.data_regs :
- tpm_dev.map_base + tpm_dev.data_regs,
+ tpm_dev.data_regs :
+ tpm_dev.map_base + tpm_dev.data_regs,
version[0], version[1],
vendorid[0], vendorid[1],
productid[0], productid[1], chipname);
@@ -607,20 +607,55 @@ static __devexit void tpm_inf_pnp_remove
iounmap(tpm_dev.mem_base);
release_mem_region(tpm_dev.map_base, tpm_dev.map_size);
}
+ tpm_dev_vendor_release(chip);
tpm_remove_hardware(chip->dev);
}
}
+static int tpm_inf_pnp_suspend(struct pnp_dev *dev, pm_message_t pm_state)
+{
+ struct tpm_chip *chip = pnp_get_drvdata(dev);
+ int rc;
+ if (chip) {
+ u8 savestate[] = {
+ 0, 193, /* TPM_TAG_RQU_COMMAND */
+ 0, 0, 0, 10, /* blob length (in bytes) */
+ 0, 0, 0, 152 /* TPM_ORD_SaveState */
+ };
+ dev_info(&dev->dev, "saving TPM state\n");
+ rc = tpm_inf_send(chip, savestate, sizeof(savestate));
+ if (rc < 0) {
+ dev_err(&dev->dev, "error while saving TPM state\n");
+ return rc;
+ }
+ }
+ return 0;
+}
+
+static int tpm_inf_pnp_resume(struct pnp_dev *dev)
+{
+ /* Re-configure TPM after suspending */
+ tpm_config_out(ENABLE_REGISTER_PAIR, TPM_INF_ADDR);
+ tpm_config_out(IOLIMH, TPM_INF_ADDR);
+ tpm_config_out((tpm_dev.data_regs >> 8) & 0xff, TPM_INF_DATA);
+ tpm_config_out(IOLIML, TPM_INF_ADDR);
+ tpm_config_out((tpm_dev.data_regs & 0xff), TPM_INF_DATA);
+ /* activate register */
+ tpm_config_out(TPM_DAR, TPM_INF_ADDR);
+ tpm_config_out(0x01, TPM_INF_DATA);
+ tpm_config_out(DISABLE_REGISTER_PAIR, TPM_INF_ADDR);
+ /* disable RESET, LP and IRQC */
+ tpm_data_out(RESET_LP_IRQC_DISABLE, CMD);
+ return tpm_pm_resume(&dev->dev);
+}
+
static struct pnp_driver tpm_inf_pnp_driver = {
.name = "tpm_inf_pnp",
- .driver = {
- .owner = THIS_MODULE,
- .suspend = tpm_pm_suspend,
- .resume = tpm_pm_resume,
- },
- .id_table = tpm_pnp_tbl,
+ .id_table = tpm_inf_pnp_tbl,
.probe = tpm_inf_pnp_probe,
- .remove = __devexit_p(tpm_inf_pnp_remove),
+ .suspend = tpm_inf_pnp_suspend,
+ .resume = tpm_inf_pnp_resume,
+ .remove = __devexit_p(tpm_inf_pnp_remove)
};
static int __init init_inf(void)
@@ -638,5 +673,5 @@ module_exit(cleanup_inf);
MODULE_AUTHOR("Marcel Selhorst <m.selhorst@sirrix.com>");
MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
-MODULE_VERSION("1.9");
+MODULE_VERSION("1.9.2");
MODULE_LICENSE("GPL");
next prev parent reply other threads:[~2010-02-19 17:11 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 16:57 [00/93] 2.6.32.9-stable review Greg KH
2010-02-19 16:28 ` [01/93] Fix potential crash with sys_move_pages Greg KH
2010-02-19 16:28 ` [02/93] futex_lock_pi() key refcnt fix Greg KH
2010-02-19 16:28 ` [03/93] futex: Handle user space corruption gracefully Greg KH
2010-02-19 16:28 ` [04/93] futex: Handle futex value " Greg KH
2010-02-19 16:28 ` [05/93] Fix race in tty_fasync() properly Greg KH
2010-02-19 16:28 ` [06/93] hwmon: (w83781d) Request I/O ports individually for probing Greg KH
2010-02-19 16:29 ` [07/93] hwmon: (lm78) " Greg KH
2010-02-19 16:29 ` [08/93] hwmon: (adt7462) Wrong ADT7462_VOLT_COUNT Greg KH
2010-02-19 16:29 ` [09/93] ALSA: ctxfi - fix PTP address initialization Greg KH
2010-02-19 16:29 ` [10/93] drm/i915: disable hotplug detect before Ironlake CRT detect Greg KH
2010-02-19 16:29 ` [11/93] drm/i915: enable self-refresh on 965 Greg KH
2010-02-19 16:29 ` [12/93] drm/i915: Disable SR when more than one pipe is enabled Greg KH
2010-02-19 16:29 ` [13/93] drm/i915: Fix DDC on some systems by clearing BIOS GMBUS setup Greg KH
2010-02-19 16:29 ` [14/93] drm/i915: Add HP nx9020/SamsungSX20S to ACPI LID quirk list Greg KH
2010-02-19 16:29 ` [15/93] drm/i915: Fix the incorrect DMI string for Samsung SX20S laptop Greg KH
2010-02-19 16:29 ` [16/93] drm/i915: Add MALATA PC-81005 to ACPI LID quirk list Greg KH
2010-02-19 16:29 ` [17/93] usb: r8a66597-hcd: Flush the D-cache for the pipe-in transfer buffers Greg KH
2010-02-19 16:29 ` [18/93] i2c-tiny-usb: Fix on big-endian systems Greg KH
2010-02-19 16:29 ` [19/93] drm/i915: handle FBC and self-refresh better Greg KH
2010-02-19 16:29 ` [20/93] drm/i915: Increase fb alignment to 64k Greg KH
2010-02-19 16:29 ` [21/93] drm/i915: Update write_domains on active list after flush Greg KH
2010-02-19 16:29 ` [22/93] regulator: Fix display of null constraints for regulators Greg KH
2010-02-19 16:29 ` [23/93] ALSA: hda-intel: Avoid divide by zero crash Greg KH
2010-02-19 16:29 ` [24/93] CPUFREQ: Fix use after free of struct powernow_k8_data Greg KH
2010-02-19 16:29 ` [25/93] freeze_bdev: dont deactivate successfully frozen MS_RDONLY sb Greg KH
2010-02-19 16:29 ` [26/93] cciss: Make cciss_seq_show handle holes in the h->drv[] array Greg KH
2010-02-19 16:29 ` [27/93] ioat: fix infinite timeout checking in ioat2_quiesce Greg KH
2010-02-19 16:29 ` [28/93] resource: add helpers for fetching rlimits Greg KH
2010-02-19 16:29 ` [29/93] fs/exec.c: restrict initial stack space expansion to rlimit Greg KH
2010-02-21 6:42 ` Michael Neuling
2010-02-23 15:34 ` [stable] " Greg KH
2010-02-23 20:42 ` Michael Neuling
2010-02-19 16:29 ` [30/93] cifs: fix length calculation for converted unicode readdir names Greg KH
2010-02-19 16:29 ` [31/93] NFS: Fix a reference leak in nfs_wb_cancel_page() Greg KH
2010-02-19 16:29 ` [32/93] NFS: Try to commit unstable writes in nfs_release_page() Greg KH
2010-02-19 16:29 ` [33/93] NFSv4: Dont allow posix locking against servers that dont support it Greg KH
2010-02-19 16:29 ` [34/93] NFSv4: Ensure that the NFSv4 locking can recover from stateid errors Greg KH
2010-02-19 16:29 ` [35/93] NFS: Fix an Oops when truncating a file Greg KH
2010-02-19 16:29 ` [36/93] NFS: Fix a umount race Greg KH
2010-02-19 16:29 ` [37/93] NFS: Fix a bug in nfs_fscache_release_page() Greg KH
2010-02-19 16:29 ` [38/93] NFS: Fix the mapping of the NFSERR_SERVERFAULT error Greg KH
2010-02-19 16:29 ` [39/93] md: fix degraded calculation when starting a reshape Greg KH
2010-02-19 16:29 ` [40/93] V4L/DVB: dvb-core: fix initialization of feeds list in demux filter Greg KH
2010-02-19 16:29 ` [41/93] Export the symbol of getboottime and mmonotonic_to_bootbased Greg KH
2010-02-19 16:29 ` [42/93] kvmclock: count total_sleep_time when updating guest clock Greg KH
2010-02-19 16:29 ` [43/93] KVM: PIT: control word is write-only Greg KH
2010-02-19 16:29 ` Greg KH [this message]
2010-02-19 16:29 ` [45/93] amd64_edac: Do not falsely trigger kerneloops Greg KH
2010-02-19 16:29 ` [46/93] netfilter: nf_conntrack: fix memory corruption with multiple namespaces Greg KH
2010-02-19 16:29 ` [47/93] netfilter: nf_conntrack: per netns nf_conntrack_cachep Greg KH
2010-02-19 16:29 ` [48/93] netfilter: nf_conntrack: restrict runtime expect hashsize modifications Greg KH
2010-02-19 16:29 ` [49/93] netfilter: xtables: compat out of scope fix Greg KH
2010-02-19 16:29 ` [50/93] netfilter: nf_conntrack: fix hash resizing with namespaces Greg KH
2010-02-19 16:29 ` [51/93] drm/i915: remove full registers dump debug Greg KH
2010-02-19 16:29 ` [52/93] drm/i915: add i915_lp_ring_sync helper Greg KH
2010-02-19 16:29 ` [53/93] drm/i915: Dont wait interruptible for possible plane buffer flush Greg KH
2010-02-19 16:29 ` [54/93] [S390] dasd: remove strings from s390dbf Greg KH
2010-02-19 16:29 ` [55/93] crypto: padlock-sha - Add import/export support Greg KH
2010-02-19 16:29 ` [56/93] wmi: Free the allocated acpi objects through wmi_get_event_data Greg KH
2010-02-19 16:29 ` [57/93] dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value Greg KH
2010-02-19 16:29 ` [58/93] /dev/mem: introduce size_inside_page() Greg KH
2010-02-19 16:29 ` [59/93] devmem: check vmalloc address on kmem read/write Greg KH
2010-02-19 16:29 ` [60/93] devmem: fix kmem write bug on memory holes Greg KH
2010-02-19 16:29 ` [61/93] SCSI: mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0 Greg KH
2010-02-19 16:29 ` [62/93] sh: Couple kernel and user write page perm bits for CONFIG_X2TLB Greg KH
2010-02-19 16:29 ` [63/93] ALSA: hda - use WARN_ON_ONCE() for zero-division detection Greg KH
2010-02-19 16:29 ` [64/93] dst: call cond_resched() in dst_gc_task() Greg KH
2010-02-19 16:29 ` [65/93] ALSA: hda - Improved MacBook (Pro) 5,1 / 5,2 support Greg KH
2010-02-19 16:29 ` [66/93] befs: fix leak Greg KH
2010-02-19 16:30 ` [67/93] rtc-fm3130: add missing braces Greg KH
2010-02-19 16:30 ` [68/93] [libata] Call flush_dcache_page after PIO data transfers in libata-sff.c Greg KH
2010-02-19 16:30 ` [69/93] ahci: add Acer G725 to broken suspend list Greg KH
2010-02-19 16:30 ` [70/93] pktgen: Fix freezing problem Greg KH
2010-02-19 16:30 ` [71/93] x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt Greg KH
2010-02-19 16:30 ` [72/93] x86/amd-iommu: Fix deassignment of a device from the pt_domain Greg KH
2010-02-19 16:30 ` [73/93] x86: Re-get cfg_new in case reuse/move irq_desc Greg KH
2010-02-19 16:30 ` [74/93] Staging: fix rtl8187se compilation errors with mac80211 Greg KH
2010-02-19 16:30 ` [75/93] ALSA: usb-audio - Avoid Oops after disconnect Greg KH
2010-02-19 16:30 ` [76/93] serial: 8250: add serial transmitter fully empty test Greg KH
2010-02-19 16:30 ` [77/93] sysfs: sysfs_sd_setattr set iattrs unconditionally Greg KH
2010-02-19 16:30 ` [78/93] class: Free the class private data in class_release Greg KH
2010-02-19 16:30 ` [79/93] USB: usbfs: only copy the actual data received Greg KH
2010-02-19 16:30 ` [80/93] USB: usbfs: properly clean up the as structure on error paths Greg KH
2010-02-19 16:30 ` [81/93] rtl8187: Add new device ID Greg KH
2010-02-19 16:30 ` [82/93] ACPI: Add NULL pointer check in acpi_bus_start Greg KH
2010-02-19 16:30 ` [83/93] ACPI: fix High cpu temperature with 2.6.32 Greg KH
2010-02-19 16:30 ` [84/93] drm/radeon/kms: use udelay for short delays Greg KH
2010-02-19 16:30 ` [85/93] NFS: Too many GETATTR and ACCESS calls after direct I/O Greg KH
2010-02-19 16:30 ` [86/93] eCryptfs: Add getattr function Greg KH
2010-02-19 16:30 ` [87/93] b43: Fix throughput regression Greg KH
2010-02-19 16:30 ` [88/93] ath9k: Fix sequence numbers for PAE frames Greg KH
2010-02-19 16:30 ` [89/93] mac80211: Fix probe request filtering in IBSS mode Greg KH
2010-02-19 16:30 ` [90/93] iwlwifi: Fix to set correct ht configuration Greg KH
2010-02-19 16:30 ` [91/93] dm stripe: avoid divide by zero with invalid stripe count Greg KH
2010-02-19 16:30 ` [92/93] dm log: userspace fix overhead_size calcuations Greg KH
2010-02-19 16:30 ` [93/93] dm mpath: fix stall when requeueing io Greg KH
2010-02-21 16:07 ` [Stable-review] " Stefan Bader
2010-02-22 10:16 ` Kiyoshi Ueda
2010-02-23 18:12 ` Alasdair G Kergon
2010-02-24 1:12 ` Kiyoshi Ueda
2010-02-24 22:30 ` Mikulas Patocka
[not found] ` <20100223175331.GE560@agk-dp.fab.redhat.com>
[not found] ` <Pine.LNX.4.64.1002231429210.29863@hs20-bc2-1.build.redhat.com>
[not found] ` <4B84E05C.4070300@ct.jp.nec.com>
[not found] ` <Pine.LNX.4.64.1002241732300.2537@hs20-bc2-1.build.redhat.com>
[not found] ` <4B862103.1040802@ct.jp.nec.com>
2010-02-26 20:57 ` How to unload a module? (Was: [dm-devel] rqdm: bad usage of dm_get/dm_put) Mikulas Patocka
2010-02-23 15:33 ` [Stable-review] [93/93] dm mpath: fix stall when requeueing io Greg KH
2010-02-23 17:00 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100219163242.971094467@kvm.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=debora@linux.vnet.ibm.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=m.selhorst@sirrix.com \
--cc=srajiv@linux.vnet.ibm.com \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®