tpm: have event log use the tpm_chip
Move the backing memory for the event log into tpm_chip and push the tpm_chip into read_log. This optimizes read_log processing by only doing it once and prepares things for the next patches in the series which require the tpm_chip to locate the event log via ACPI and OF handles instead of searching. This is straightfoward except for the issue of passing a kref through i_private with securityfs. Since securityfs_remove does not have any removal fencing like sysfs we use the inode lock to safely get a kref on the tpm_chip. Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Jarkko Sakkinen

vecāks
7518a21a9d
revīzija
748935eeb7
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* Maintained by: <tpmdd-devel@lists.sourceforge.net>
|
||||
*
|
||||
* Access to the eventlog extended by the TCG BIOS of PC platform
|
||||
* Access to the event log extended by the TCG BIOS of PC platform
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -45,13 +45,15 @@ struct acpi_tcpa {
|
||||
};
|
||||
|
||||
/* read binary bios log */
|
||||
int read_log(struct tpm_bios_log *log)
|
||||
int read_log(struct tpm_chip *chip)
|
||||
{
|
||||
struct acpi_tcpa *buff;
|
||||
acpi_status status;
|
||||
void __iomem *virt;
|
||||
u64 len, start;
|
||||
struct tpm_bios_log *log;
|
||||
|
||||
log = &chip->log;
|
||||
if (log->bios_event_log != NULL) {
|
||||
printk(KERN_ERR
|
||||
"%s: ERROR - Eventlog already initialized\n",
|
||||
@@ -97,13 +99,18 @@ int read_log(struct tpm_bios_log *log)
|
||||
|
||||
virt = acpi_os_map_iomem(start, len);
|
||||
if (!virt) {
|
||||
kfree(log->bios_event_log);
|
||||
printk("%s: ERROR - Unable to map memory\n", __func__);
|
||||
return -EIO;
|
||||
goto err;
|
||||
}
|
||||
|
||||
memcpy_fromio(log->bios_event_log, virt, len);
|
||||
|
||||
acpi_os_unmap_iomem(virt, len);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
kfree(log->bios_event_log);
|
||||
log->bios_event_log = NULL;
|
||||
return -EIO;
|
||||
|
||||
}
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user