Re: [PATCH 2/2] tpm: tpm_crb: enhance resource mapping mechanism for supporting AMD's fTPM

From: Seunghun Han
Date: Mon Sep 02 2019 - 18:42:19 EST

> On Fri, Aug 30, 2019 at 05:58:39PM +0000, Safford, David (GE Global Research, US) wrote:
> > > Thank you for your advice. We also discussed earlier and concluded that
> > > checking and raw remapping are enough to work around this. The link is
> > > here, .
> >
> > I don't see Matthew Garrett's agreement on that thread.
> No one has agreed on anything.
> /Jarkko

you gave me good advice related to the NVS area and mapping like below.

"A function that gets region and then checks if NVS driver has matching
one and returns true/false based on that should be good enough. Then
you raw ioremap() in the TPM driver."

So, I made a patch on your advice and test it. According to my test
result, command and response buffers were saved and restored while
hibernation. And, there was no side-effect because they were just
buffers and hibernation didn't affect the control area of TPM CRB
driver. So, I think that saving and restoring buffers during sleep is
no problem. I also think your advice and solution are clear and good
to work around AMD's fTPM. I will attach my detailed test result soon.

I have a question. Do you think this patch is not enough to handle
AMD's fTPM problem? If so, would you tell me about it? I will change
my patch.