Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@amd.com>
To: linux-coco@lists.linux.dev
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: TDISP enablement
Date: Wed, 1 Nov 2023 09:56:11 +1100	[thread overview]
Message-ID: <e05eafd8-04b3-4953-8bca-dc321c1a60b9@amd.com> (raw)

Hi everyone,

Here is followup after the Dan's community call we had weeks ago.

Our (AMD) goal at the moment is TDISP to pass through SRIOV VFs to 
confidential VMs without trusting the HV and with enabled IDE 
(encryption) and IOMMU (performance, compared to current SWIOTLB). I am 
aware of other uses and vendors and I spend hours unsuccessfully trying 
to generalize all this in a meaningful way.

The AMD SEV TIO verbs can be simplified as:

- device_connect - starts CMA/SPDM session, returns measurements/certs, 
runs IDE_KM to program the keys;
- device_reclaim - undo the connect;
- tdi_bind - transition the TDI to TDISP's LOCKED and RUN states, 
generates interface report;
- tdi_unbind - undo the bind;
- tdi_info - read measurements/certs/interface report;
- tdi_validate - unlock TDI's MMIO and IOMMU (or invalidate, depends on 
the parameters).

The first 4 called by the host OS, the last two by the TVM ("Trusted 
VM"). These are implemented in the AMD PSP (platform processor).
There are CMA/SPDM, IDE_KV, TDISP in use.

Now, my strawman code does this on the host (I simplified a bit):
- after PCI discovery but before probing: walk through all TDISP-capable 
(TEE-IO in PCIe caps) endpoint devices and call device_connect;
- when drivers probe - it is all set up and the device measurements are 
visible to the driver;
- when constructing a TVM, tdi_bind is called;

and then in the TVM:
- after PCI discovery but before probing: walk through all TDIs (which 
will have TEE IO bit set) and call tdi_info, verify the report, if ok - 
call tdi_validate;
- when drivers probe - it is all set up and the driver decides if/which 
DMA mode to use (SWIOTLB or direct), or panic().


Uff. Too long already. Sorry. Now, go to the problems:

If the user wants only CMA/SPDM, the Lukas'es patched will do that 
without the PSP. This may co-exist with the AMD PSP (if the endpoint 
allows multiple sessions).

If the user wants only IDE, the AMD PSP's device_connect needs to be 
called and the host OS does not get to know the IDE keys. Other vendors 
allow programming IDE keys to the RC on the baremetal, and this also may 
co-exist with a TSM running outside of Linux - the host still manages 
trafic classes and streams.

If the user wants TDISP for VMs, this assumes the user does not trust 
the host OS and therefore the TSM (which is trusted) has to do CMA/SPDM 
and IDE.

The TSM code is not Linux and not shared among vendors. CMA/SPDM and IDE 
seem capable of co-existing, TDISP does not.

However there are common bits.
- certificates/measurements/reports blobs: storing, presenting to the 
userspace (results of device_connect and tdi_bind);
- place where we want to authenticate the device and enable IDE 
(device_connect);
- place where we want to bind TDI to a TVM (tdi_bind).

I've tried to address this with my (poorly named) 
drivers/pci/pcie/tdisp.ko and a hack for VFIO PCI device to call tdi_bind.

The next steps:
- expose blobs via configfs (like Dan did configfs-tsm);
- s/tdisp.ko/coco.ko/;
- ask the audience - what is missing to make it reusable for other 
vendors and uses?

Thanks,
-- 
Alexey



             reply	other threads:[~2023-10-31 22:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 22:56 Alexey Kardashevskiy [this message]
2023-10-31 23:40 ` TDISP enablement Dionna Amalie Glaze
2023-11-01  7:38   ` Lukas Wunner
2023-11-01  7:27 ` Lukas Wunner
2023-11-01 11:05   ` Jonathan Cameron
2023-11-02  2:28     ` Alexey Kardashevskiy
2023-11-03 16:44       ` Jonathan Cameron
2023-11-11 22:45         ` Dan Williams
2023-11-24 14:52           ` Jonathan Cameron
2023-11-10 23:38       ` Dan Williams
2023-11-10 23:30     ` Dan Williams
2023-11-24 16:25       ` Jonathan Cameron
2023-11-13  6:04     ` Samuel Ortiz
2023-11-01 11:43   ` Alexey Kardashevskiy
2023-11-13  5:43 ` Samuel Ortiz
2023-11-13  6:46   ` Alexey Kardashevskiy
2023-11-13 15:10     ` Samuel Ortiz
2023-11-14  0:57       ` Alexey Kardashevskiy
2023-11-14 15:35         ` Samuel Ortiz
2023-12-06  4:43           ` Dan Williams

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=e05eafd8-04b3-4953-8bca-dc321c1a60b9@amd.com \
    --to=aik@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-pci@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).