Re: [PATCH v3 02/18] nitro_enclaves: Define the PCI device interface
From: Paraschiv, Andra-Irina
Date: Mon Jun 01 2020 - 03:07:34 EST
On 01/06/2020 05:59, Benjamin Herrenschmidt wrote:
On Wed, 2020-05-27 at 00:21 +0200, Greg KH wrote:
There are a couple of data structures with more than one member and multiple
field sizes. And for the ones that are not, gathered as feedback from
previous rounds of review that should consider adding a "flags" field in
there for further extensibility.
Please do not do that in ioctls. Just create new calls instead of
trying to "extend" existing ones. It's always much easier.
I can modify to have "__packed" instead of the attribute callout.
Make sure you even need that, as I don't think you do for structures
like the above one, right?
Hrm, my impression (granted I only just started to look at this code)
is that these are protocol messages with the PCI devices, not strictly
just ioctl arguments (though they do get conveyed via such ioctls).
Andra-Irina, did I get that right ? :-)
Correct, these data structures having "__packed" attribute map the
messages (requests / replies) for the communication with the NE PCI device.
The data structures from the ioctl commands are not directly used as
part of the communication with the NE PCI device, but several fields of
them e.g. enclave start flags. Some of the fields from the NE PCI device
data structures e.g. the physical address of a memory region (gpa) are
set by the internal kernel logic.
That said, I still think that by carefully ordering the fields and
using explicit padding, we can avoid the need of the packed attributed.
Regarding your question in the previous mail from this thread and the
mention above on the same topic, that should be possible. IIRC, there
were 2 data structures remaining with "__packed" attribute.
Thank you, Ben.
Andra
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.