As IOMMU UAPI gets extended, user data size may increase. To support backward compatibiliy, this patch introduces a size field to each UAPI data structures. It is *always* the responsibility for the user to fill in the correct size. Padding fields are adjusted to ensure 8 byte alignment. Specific scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented.
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -139,6 +139,7 @@ enum iommu_page_response_code { · 138 unmodified lines | |||
| 139 | 139 | ||
| 140 | /** | 140 | /** |
| 141 | * struct iommu_page_response - Generic page response information | 141 | * struct iommu_page_response - Generic page response information |
| 142 | * @argsz: User filled size of this data | ||
| 142 | * @version: API version of this structure | 143 | * @version: API version of this structure |
| 143 | * @flags: encodes whether the corresponding fields are valid | 144 | * @flags: encodes whether the corresponding fields are valid |
| 144 | * (IOMMU_FAULT_PAGE_RESPONSE_* values) | 145 | * (IOMMU_FAULT_PAGE_RESPONSE_* values) |
| @@ -147,6 +148,7 @@ enum iommu_page_response_code { · 2 unmodified lines | |||
| 147 | * @code: response code from &enum iommu_page_response_code | 148 | * @code: response code from &enum iommu_page_response_code |
| 148 | */ | 149 | */ |
| 149 | struct iommu_page_response { | 150 | struct iommu_page_response { |
| 151 | __u32 argsz; | ||
| 150 | #define IOMMU_PAGE_RESP_VERSION_1 1 | 152 | #define IOMMU_PAGE_RESP_VERSION_1 1 |
| 151 | __u32 version; | 153 | __u32 version; |
| 152 | #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) | 154 | #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) |
| @@ -222,6 +224,7 @@ struct iommu_inv_pasid_info { · 69 unmodified lines | |||
| 222 | /** | 224 | /** |
| 223 | * struct iommu_cache_invalidate_info - First level/stage invalidation | 225 | * struct iommu_cache_invalidate_info - First level/stage invalidation |
| 224 | * information | 226 | * information |
| 227 | * @argsz: User filled size of this data | ||
| 225 | * @version: API version of this structure | 228 | * @version: API version of this structure |
| 226 | * @cache: bitfield that allows to select which caches to invalidate | 229 | * @cache: bitfield that allows to select which caches to invalidate |
| 227 | * @granularity: defines the lowest granularity used for the invalidation: | 230 | * @granularity: defines the lowest granularity used for the invalidation: |
| @@ -250,6 +253,7 @@ struct iommu_inv_pasid_info { · 22 unmodified lines | |||
| 250 | * must support the used granularity. | 253 | * must support the used granularity. |
| 251 | */ | 254 | */ |
| 252 | struct iommu_cache_invalidate_info { | 255 | struct iommu_cache_invalidate_info { |
| 256 | __u32 argsz; | ||
| 253 | #define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1 | 257 | #define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1 |
| 254 | __u32 version; | 258 | __u32 version; |
| 255 | /* IOMMU paging structure cache */ | 259 | /* IOMMU paging structure cache */ |
| @@ -259,7 +263,7 @@ struct iommu_cache_invalidate_info { · 3 unmodified lines | |||
| 259 | #define IOMMU_CACHE_INV_TYPE_NR (3) | 263 | #define IOMMU_CACHE_INV_TYPE_NR (3) |
| 260 | __u8 cache; | 264 | __u8 cache; |
| 261 | __u8 granularity; | 265 | __u8 granularity; |
| 262 | __u8 padding[2]; | 266 | __u8 padding[6]; |
| 263 | union { | 267 | union { |
| 264 | struct iommu_inv_pasid_info pasid_info; | 268 | struct iommu_inv_pasid_info pasid_info; |
| 265 | struct iommu_inv_addr_info addr_info; | 269 | struct iommu_inv_addr_info addr_info; |
| @@ -296,6 +300,7 @@ struct iommu_gpasid_bind_data_vtd { · 30 unmodified lines | |||
| 296 | 300 | ||
| 297 | /** | 301 | /** |
| 298 | * struct iommu_gpasid_bind_data - Information about device and guest PASID binding | 302 | * struct iommu_gpasid_bind_data - Information about device and guest PASID binding |
| 303 | * @argsz: User filled size of this data | ||
| 299 | * @version: Version of this data structure | 304 | * @version: Version of this data structure |
| 300 | * @format: PASID table entry format | 305 | * @format: PASID table entry format |
| 301 | * @flags: Additional information on guest bind request | 306 | * @flags: Additional information on guest bind request |
| @@ -313,17 +318,18 @@ struct iommu_gpasid_bind_data_vtd { · 11 unmodified lines | |||
| 313 | * PASID to host PASID based on this bind data. | 318 | * PASID to host PASID based on this bind data. |
| 314 | */ | 319 | */ |
| 315 | struct iommu_gpasid_bind_data { | 320 | struct iommu_gpasid_bind_data { |
| 321 | __u32 argsz; | ||
| 316 | #define IOMMU_GPASID_BIND_VERSION_1 1 | 322 | #define IOMMU_GPASID_BIND_VERSION_1 1 |
| 317 | __u32 version; | 323 | __u32 version; |
| 318 | #define IOMMU_PASID_FORMAT_INTEL_VTD 1 | 324 | #define IOMMU_PASID_FORMAT_INTEL_VTD 1 |
| 319 | __u32 format; | 325 | __u32 format; |
| 326 | __u32 addr_width; | ||
| 320 | #define IOMMU_SVA_GPASID_VAL (1 << 0) /* guest PASID valid */ | 327 | #define IOMMU_SVA_GPASID_VAL (1 << 0) /* guest PASID valid */ |
| 321 | __u64 flags; | 328 | __u64 flags; |
| 322 | __u64 gpgd; | 329 | __u64 gpgd; |
| 323 | __u64 hpasid; | 330 | __u64 hpasid; |
| 324 | __u64 gpasid; | 331 | __u64 gpasid; |
| 325 | __u32 addr_width; | 332 | __u8 padding[8]; |
| 326 | __u8 padding[12]; | ||
| 327 | /* Vendor specific data */ | 333 | /* Vendor specific data */ |
| 328 | union { | 334 | union { |
| 329 | struct iommu_gpasid_bind_data_vtd vtd; | 335 | struct iommu_gpasid_bind_data_vtd vtd; |