Skip to content

Commit

Permalink
irqchip/gic-v3-its: Only emit VSYNC if targetting a valid collection
Browse files Browse the repository at this point in the history
Similarily to the SYNC operation, it must be verified that the VPE
targetted by a VLPI is backed by a valid collection in the GIC driver data
structures.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Cc: Sumit Garg <sumit.garg@linaro.org>
Link: https://lkml.kernel.org/r/20180622095254.5906-7-marc.zyngier@arm.com
  • Loading branch information
Marc Zyngier authored and Thomas Gleixner committed Jun 22, 2018
1 parent 83559b4 commit 205e065
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/irqchip/irq-gic-v3-its.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ static struct its_collection *valid_col(struct its_collection *col)
return col;
}

static struct its_vpe *valid_vpe(struct its_node *its, struct its_vpe *vpe)
{
if (valid_col(its->collections + vpe->col_idx))
return vpe;

return NULL;
}

/*
* ITS command descriptors - parameters to be encoded in a command
* block.
Expand Down Expand Up @@ -562,7 +570,7 @@ static struct its_vpe *its_build_vinvall_cmd(struct its_node *its,

its_fixup_cmd(cmd);

return desc->its_vinvall_cmd.vpe;
return valid_vpe(its, desc->its_vinvall_cmd.vpe);
}

static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
Expand All @@ -584,7 +592,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,

its_fixup_cmd(cmd);

return desc->its_vmapp_cmd.vpe;
return valid_vpe(its, desc->its_vmapp_cmd.vpe);
}

static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,
Expand All @@ -607,7 +615,7 @@ static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,

its_fixup_cmd(cmd);

return desc->its_vmapti_cmd.vpe;
return valid_vpe(its, desc->its_vmapti_cmd.vpe);
}

static struct its_vpe *its_build_vmovi_cmd(struct its_node *its,
Expand All @@ -630,7 +638,7 @@ static struct its_vpe *its_build_vmovi_cmd(struct its_node *its,

its_fixup_cmd(cmd);

return desc->its_vmovi_cmd.vpe;
return valid_vpe(its, desc->its_vmovi_cmd.vpe);
}

static struct its_vpe *its_build_vmovp_cmd(struct its_node *its,
Expand All @@ -648,7 +656,7 @@ static struct its_vpe *its_build_vmovp_cmd(struct its_node *its,

its_fixup_cmd(cmd);

return desc->its_vmovp_cmd.vpe;
return valid_vpe(its, desc->its_vmovp_cmd.vpe);
}

static u64 its_cmd_ptr_to_offset(struct its_node *its,
Expand Down

0 comments on commit 205e065

Please sign in to comment.