refactor: build option for interrupt ids
Make HF_NUM_INTIDS a build option for platform with large number of
interrupts. For large systems with GIC extensions that allow > 4K
interrupts, 64 interrupts is inadequate. An example partition that may
require more than 64 interrupts is a RAS SP that handles many interrupts
from many sources on a large server type SoC.
Note that the limit of max number of interrupt IDs is set to 5120 based
on the latest GIC specs for extended SPI range (not using ITS).
Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
Change-Id: Ic3b1741b61a4a796da36f505357af86949b249e6
diff --git a/build/BUILD.gn b/build/BUILD.gn
index 73a73e1..50e80f7 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -44,6 +44,11 @@
plat_partition_max_streams_per_device < 256,
"Maximum streams per device regions must be between 1 and 255: current = ${plat_partition_max_streams_per_device}")
+ assert(
+ plat_num_virtual_interrupts_ids > 0 &&
+ plat_num_virtual_interrupts_ids < 5120,
+ "Maximum virtual interrupt ids per vcpu must be between 1 and 5119: current = ${plat_num_virtual_interrupts_ids}")
+
include_dirs = [
"//inc",
"//inc/vmapi",
@@ -63,5 +68,6 @@
"PARTITION_MAX_DEVICE_REGIONS=${plat_partition_max_device_regions}",
"PARTITION_MAX_INTERRUPTS_PER_DEVICE=${plat_partition_max_intr_per_device}",
"PARTITION_MAX_STREAMS_PER_DEVICE=${plat_partition_max_streams_per_device}",
+ "HF_NUM_INTIDS=${plat_num_virtual_interrupts_ids}",
]
}
diff --git a/build/toolchain/platform.gni b/build/toolchain/platform.gni
index adcfb68..cfc06a0 100644
--- a/build/toolchain/platform.gni
+++ b/build/toolchain/platform.gni
@@ -44,4 +44,7 @@
# the maximum number of streams allowed per device, per partition, in the partition manifest
plat_partition_max_streams_per_device = 4
+
+ # The number of virtual interrupt IDs which are supported
+ plat_num_virtual_interrupts_ids = 64
}
diff --git a/inc/vmapi/hf/types.h b/inc/vmapi/hf/types.h
index ed992c7..843861b 100644
--- a/inc/vmapi/hf/types.h
+++ b/inc/vmapi/hf/types.h
@@ -39,9 +39,6 @@
/** The amount of data that can be sent to a mailbox. */
#define HF_MAILBOX_SIZE 4096
-/** The number of virtual interrupt IDs which are supported. */
-#define HF_NUM_INTIDS 64
-
/** Interrupt ID returned when there is no interrupt pending. */
#define HF_INVALID_INTID 0xffffffff
diff --git a/src/api.c b/src/api.c
index 20bdd17..ca39086 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1884,7 +1884,7 @@
*/
uint32_t api_interrupt_get(struct vcpu *current)
{
- uint8_t i;
+ uint32_t i;
uint32_t first_interrupt = HF_INVALID_INTID;
struct vcpu_locked current_locked;