Add reserved fields to align SPCI structures to 16-byte boundaries.
Bug: 132429380
Change-Id: I12313a0bcbea1e27e3c1884a0336940ec9e76919
diff --git a/inc/vmapi/hf/spci.h b/inc/vmapi/hf/spci.h
index 977c4a4..da3ad48 100644
--- a/inc/vmapi/hf/spci.h
+++ b/inc/vmapi/hf/spci.h
@@ -233,6 +233,8 @@
uint32_t address_high;
/** The number of 4 kiB pages in the constituent memory region. */
uint32_t page_count;
+ /** Reserved field, must be 0. */
+ uint32_t reserved;
};
struct spci_memory_region_attributes {
@@ -243,6 +245,10 @@
* receiver's page table.
*/
uint16_t memory_attributes;
+ /** Reserved field, must be 0. */
+ uint32_t reserved_0;
+ /** Reserved field, must be 0. */
+ uint64_t reserved_1;
};
/** Flags to control the behaviour of a memory sharing transaction. */
@@ -265,7 +271,7 @@
/** Sender VM ID. */
spci_vm_id_t sender;
/** Reserved field, must be 0. */
- uint16_t reserved;
+ uint16_t reserved_0;
/**
* The total number of 4 kiB pages included in this memory region. This
* must be equal to the sum of page counts specified in each
@@ -288,6 +294,8 @@
* this memory region.
*/
uint32_t attribute_count;
+ /** Reserved field, must be 0. */
+ uint16_t reserved_1;
/**
* An array of `attribute_count` memory region attribute descriptors.
* Each one specifies an endpoint and the attributes with which this
diff --git a/vmlib/spci.c b/vmlib/spci.c
index 37447e4..e5fccba 100644
--- a/vmlib/spci.c
+++ b/vmlib/spci.c
@@ -56,12 +56,15 @@
memory_region->tag = tag;
memory_region->flags = flags;
memory_region->sender = sender;
- memory_region->reserved = 0;
+ memory_region->reserved_0 = 0;
+ memory_region->reserved_1 = 0;
memory_region->page_count = 0;
memory_region->constituent_count = constituent_count;
memory_region->attribute_count = 1;
memory_region->attributes[0].receiver = receiver;
memory_region->attributes[0].memory_attributes = attributes;
+ memory_region->attributes[0].reserved_0 = 0;
+ memory_region->attributes[0].reserved_1 = 0;
/*
* Constituent offset must be aligned to a 32-bit boundary so that