From: Kai Huang <kai.huang@intel.com>
To: Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: "H . Peter Anvin" <hpa@zytor.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Tony Luck <tony.luck@intel.com>, Andi Kleen <ak@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/3] x86/tdx: Add TDX Guest attestation interface driver
Date: Wed, 27 Apr 2022 17:15:41 +1200 [thread overview]
Message-ID: <a597c1fffab01e1048421887d5ef7aa2ac01c46e.camel@intel.com> (raw)
In-Reply-To: <1168a7cc-9e41-ee2d-8b3d-8dbd1ab85609@linux.intel.com>
On Tue, 2022-04-26 at 12:07 -0700, Sathyanarayanan Kuppuswamy wrote:
> > Is there any particular reason to use platform driver and support it as a
> > module?
> >
> > SGX driver uses misc_register() to register /dev/sgx_enclave during boot.
> > Looks
> > it would be simpler.
>
> Main reason is to use a proper device in dma_alloc* APIs.
>
> My initial version only used misc device as you have mentioned. But
> Hans raised a concern about using proper struct device in dma_alloc*
> APIs and suggested modifying the driver to use platform device
> model. You can find relevant discussion here.
>
> https://lore.kernel.org/all/47d06f45-c1b5-2c8f-d937-3abacbf10321@redhat.com/
Thanks for the info. Sorry I didn't dig review comments for previous version.
However, after digging more, I am wondering why do you need to use DMA API at
the first place.
Firstly, for this basic driver to report TDREPORT to userspace, there's no need
to use any DMA API, nor we need to use shared memory, as we just get the report
into some buffer (doesn't need to be shared) and copy the report back to
userspace. So it doesn't make a lot sense to use platform device here.
Secondly, in terms of GetQuote support, it seems Dave/Andi suggested you can use
vmalloc()/vmap() and just use set_memory_decrypted() to convert it to shared:
https://lore.kernel.org/all/ce0feeec-a949-35f8-3010-b0d69acbbc2e@linux.intel.com/
I don't see why it cannot work? Then wouldn't this approach be simpler than
using DMA API? Any reason to choose platform device?
Btw, a side topic:
Andy suggested we don't do memory allocation and private-shared conversion at
IOCTL time as the conversion is expensive:
https://lore.kernel.org/all/06c85c19-e16c-3121-ed47-075cfa779b67@kernel.org/
This is reasonable (and sorry I didn't see this when I commented in v3).
To avoid IOCTL time private-shared conversion, and yet support dynamic Quote
length, can we do following:
- Allocate a *default* size buffer at driver loading time (i.e. 4 pages), and
convert to shared. This default size should cover 99% cases as Intel QGS
currently generates Quote smaller than 8K, and Intel attestation agent hard-code
a 4 pages buffer for Quote.
- In GetQuote IOCTL, when the len is larger than default size, we discard the
original one and allocate a larger buffer.
How does this sound?
--
Thanks,
-Kai
next prev parent reply other threads:[~2022-04-27 5:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 23:34 [PATCH v4 0/3] Add TDX Guest Attestation support Kuppuswamy Sathyanarayanan
2022-04-22 23:34 ` [PATCH v4 1/3] x86/tdx: Add TDX Guest attestation interface driver Kuppuswamy Sathyanarayanan
2022-04-25 5:44 ` Kai Huang
2022-04-26 19:07 ` Sathyanarayanan Kuppuswamy
2022-04-27 5:15 ` Kai Huang [this message]
2022-04-27 21:45 ` Sathyanarayanan Kuppuswamy
2022-04-27 23:40 ` Kai Huang
2022-04-28 0:40 ` Sathyanarayanan Kuppuswamy
2022-04-27 4:05 ` Sathyanarayanan Kuppuswamy
2022-04-27 4:28 ` Kai Huang
2022-04-27 14:09 ` Sathyanarayanan Kuppuswamy
2022-04-27 5:45 ` Isaku Yamahata
2022-04-27 5:57 ` Kai Huang
2022-04-27 22:08 ` Sathyanarayanan Kuppuswamy
2022-04-28 17:45 ` Wander Lairson Costa
2022-04-28 17:56 ` Sathyanarayanan Kuppuswamy
2022-04-28 18:04 ` Dave Hansen
2022-04-28 18:18 ` Sathyanarayanan Kuppuswamy
2022-04-22 23:34 ` [PATCH v4 2/3] x86/tdx: Add TDX Guest event notify interrupt support Kuppuswamy Sathyanarayanan
2022-04-28 17:50 ` Wander Lairson Costa
2022-04-28 17:57 ` Sathyanarayanan Kuppuswamy
2022-04-22 23:34 ` [PATCH v4 3/3] x86/tdx: Add Quote generation support Kuppuswamy Sathyanarayanan
2022-04-26 9:47 ` Kai Huang
2022-05-01 0:52 ` Sathyanarayanan Kuppuswamy
2022-04-27 6:14 ` Isaku Yamahata
2022-05-01 1:02 ` Sathyanarayanan Kuppuswamy
2022-04-28 17:58 ` Wander Lairson Costa
2022-04-28 18:11 ` Sathyanarayanan Kuppuswamy
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=a597c1fffab01e1048421887d5ef7aa2ac01c46e.camel@intel.com \
--to=kai.huang@intel.com \
--cc=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@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
Powered by JetHome