On 17.06.19 16:55, Ralf Ramsauer wrote:
On 6/17/19 4:51 PM, Jan Kiszka wrote:
On 17.06.19 15:13, Mario Mintel wrote:
See Intels VT-d Architectures Specification, chapter 5.1.3:
"Maximum number of IRTEs in an Interrupt Remapping Table is 64K."
Hence the max numbers of IRTEs is 65535 so we can limit the index to 16
bits.
Signed-off-by: Mario Mintel <[email protected]>
---
hypervisor/arch/x86/vtd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c
index 8e076b4b..d0dd4fd8 100644
--- a/hypervisor/arch/x86/vtd.c
+++ b/hypervisor/arch/x86/vtd.c
@@ -556,7 +556,7 @@ static void vtd_init_unit(void *reg_base, void
*inv_queue)
vtd_update_gcmd_reg(reg_base, VTD_GCMD_IRE, 1);
}
-static void vtd_update_irte(unsigned int index, union vtd_irte
content)
+static void vtd_update_irte(u16 index, union vtd_irte content)
{
const struct vtd_entry inv_int = {
.lo_word = VTD_REQ_INV_INT | VTD_INV_INT_INDEX |
I don't see the value of this change, though. Actually, doesn't the
compiler even bark at us then when passing in a wider type (which we do
so far)?
ATM, everything is fine with the code. But as soon as we would pass
anything wider than 16 bit, we would get a proper warning with this
patch. There's no reason why index should be 32 bit wide.
My point is that none of the current callers of vtd_update_irte allow the
compiler to detect such a case: both run on integer types, both have non-static
limits for their ranges.
If we want range checks, they likely need to be runtime. At least we need way
more type changes to give the compiler a realistic chance.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/b19a1a1a-c956-91de-03a8-03afe327389b%40siemens.com.
For more options, visit https://groups.google.com/d/optout.