Skip to content

Commit

Permalink
iommu: Add padding to struct iommu_fault
Browse files Browse the repository at this point in the history
Ease future extensions of struct iommu_fault_page_request and struct
iommu_fault_unrecoverable by adding a few bytes of padding. That way, a
new field can be added to either of these structures by simply introducing
a new flag. To extend it after the size limit is reached, a new fault
reporting structure will have to be negotiated with userspace.

With 56 bytes of padding, the total size of iommu_fault is 64 bytes and
fits in a cache line on a lot of contemporary machines, while providing 16
and 24 bytes of extension to structures iommu_fault_page_request and
iommu_fault_unrecoverable respectively.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Jean-Philippe Brucker authored and Joerg Roedel committed Jun 18, 2019
1 parent bf3255b commit 58b55c8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/uapi/linux/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ struct iommu_fault_page_request {
* @padding: reserved for future use (should be zero)
* @event: fault event, when @type is %IOMMU_FAULT_DMA_UNRECOV
* @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ
* @padding2: sets the fault size to allow for future extensions
*/
struct iommu_fault {
__u32 type;
__u32 padding;
union {
struct iommu_fault_unrecoverable event;
struct iommu_fault_page_request prm;
__u8 padding2[56];
};
};

Expand Down

0 comments on commit 58b55c8

Please sign in to comment.