Re: [PATCH 3/3] x86/sev: add a SVSM vTPM platform device

Jason Gunthorpe
2025-01-14T17:33:39Z

On Tue, Jan 14, 2025 at 05:51:33PM +0100, Stefano Garzarella wrote:
> Otherwise we need an intermediate module in drivers/char/tpm. Here we
> have 2 options:
> 1. continue as James did by creating a platform_device.
> 2. or we could avoid this by just exposing a registration API invoked by
> sev to specify the send_recv() callback to use. I mean something like
> renaming tpm_platform_probe() in tpm_platform_register(), and call it in
> snp_init_platform_device().

You should not layer things on top of things. If you have a clearly
defined driver write it in the natural logical way and export the
symbols you need.

Either export TPM stuff to arch code, or export arch code to
TPM. Don't make crazy boutique shims to avoid simple exports.

> > Meaning that you'd export some of your arch stuff for the tpm driver
> > to live in its natural home
>
> @Tom do you think we can eventually expose sev API like
> svsm_perform_call_protocol(), svsm_get_caa(), etc.?

We have lots of ways to make restricted exports now, you can use them
and export those symbols. There shouldn't be resistance to this.

Jason