Message ID | 1414018604.32120.14.camel@vserver |
---|---|
State | Accepted, archived |
Headers | show |
On Wed, 22 Oct 2014, Hon Ching (Vicky) Lo wrote: > > Signed-off-by: Hon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com> Looks good. Reviewed-by: Ashley Lai <ashley@ahsleylai.com> > --- > drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/char/tpm/tpm_ibmvtpm.c > b/drivers/char/tpm/tpm_ibmvtpm.c > index af74c57..bd7fc1b 100644 > --- a/drivers/char/tpm/tpm_ibmvtpm.c > +++ b/drivers/char/tpm/tpm_ibmvtpm.c > @@ -307,6 +307,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) > static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) > { > struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); > + > + /* ibmvtpm initializes at probe time, so the data we are > + * asking for may not be set yet. Estimate that 4K required > + * for TCE-mapped buffer in addition to CRQ. > + */ > + if (!ibmvtpm) > + return CRQ_RES_BUF_SIZE + PAGE_SIZE; > + > return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; > } > --- > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > tpmdd-devel mailing list > tpmdd-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tpmdd-devel > ------------------------------------------------------------------------------
Hi, Will this patch be accepted for the future kernel? Vicky On Wed, 2014-10-22 at 18:28 -0500, Ashley Lai wrote: > On Wed, 22 Oct 2014, Hon Ching (Vicky) Lo wrote: > > > > Signed-off-by: Hon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com> > > Looks good. > > Reviewed-by: Ashley Lai <ashley@ahsleylai.com> > > > --- > > drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/char/tpm/tpm_ibmvtpm.c > > b/drivers/char/tpm/tpm_ibmvtpm.c > > index af74c57..bd7fc1b 100644 > > --- a/drivers/char/tpm/tpm_ibmvtpm.c > > +++ b/drivers/char/tpm/tpm_ibmvtpm.c > > @@ -307,6 +307,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) > > static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) > > { > > struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); > > + > > + /* ibmvtpm initializes at probe time, so the data we are > > + * asking for may not be set yet. Estimate that 4K required > > + * for TCE-mapped buffer in addition to CRQ. > > + */ > > + if (!ibmvtpm) > > + return CRQ_RES_BUF_SIZE + PAGE_SIZE; > > + > > return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; > > } > > --- > > > > > > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > tpmdd-devel mailing list > > tpmdd-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/tpmdd-devel > > > ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
Am Dienstag, 25. November 2014, 22:09:32 schrieb Hon Ching (Vicky) Lo: > Hi, > > Will this patch be accepted for the future kernel? > > Applied to my tree: https://github.com/PeterHuewe/linux-tpmdd for-james Will be included in the next pull-request. Thanks, Peter ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c index af74c57..bd7fc1b 100644 --- a/drivers/char/tpm/tpm_ibmvtpm.c +++ b/drivers/char/tpm/tpm_ibmvtpm.c @@ -307,6 +307,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) { struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); + + /* ibmvtpm initializes at probe time, so the data we are + * asking for may not be set yet. Estimate that 4K required + * for TCE-mapped buffer in addition to CRQ. + */ + if (!ibmvtpm) + return CRQ_RES_BUF_SIZE + PAGE_SIZE; + return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; } ---
There was an oops in tpm_ibmvtpm_get_desired_dma, which caused kernel panic during boot when vTPM is enabled in Power partition configured in AMS mode. vio_bus_probe calls vio_cmo_bus_probe which calls tpm_ibmvtpm_get_desired_dma to get the size needed for DMA allocation. The problem is, vio_cmo_bus_probe is called before calling probe, which for vtpm is tpm_ibmvtpm_probe and it's this function that initializes and sets up vtpm's CRQ and gets required data values. Therefore, since this has not yet been done, NULL is returned in attempt to get the size for DMA allocation. We added a NULL check. In addition, a default buffer size will be set when NULL is returned. Signed-off-by: Hon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com> --- drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++++++ 1 file changed, 8 insertions(+) ------------------------------------------------------------------------------