On 30.06.2024 14:33, Jiqian Chen wrote: > Hypercall PHYSDEVOP_map_pirq support to map a gsi into a specific > pirq or a free pirq, it depends on the parameter pirq(>0 or <0). > But in current xc_physdev_map_pirq, it set *pirq=index when > parameter pirq is <0, it causes to force all cases to be mapped > to a specific pirq. That has some problems, one is caller can't > get a free pirq value, another is that once the pecific pirq was > already mapped to other gsi, then it will fail. > > So, change xc_physdev_map_pirq to allow to pass negative parameter > in and then get a free pirq. > > Signed-off-by: Jiqian Chen <jiqian.c...@amd.com> > Signed-off-by: Huang Rui <ray.hu...@amd.com> > Signed-off-by: Jiqian Chen <jiqian.c...@amd.com> > --- > tools/libs/ctrl/xc_physdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/libs/ctrl/xc_physdev.c b/tools/libs/ctrl/xc_physdev.c > index 460a8e779ce8..e9fcd755fa62 100644 > --- a/tools/libs/ctrl/xc_physdev.c > +++ b/tools/libs/ctrl/xc_physdev.c > @@ -50,7 +50,7 @@ int xc_physdev_map_pirq(xc_interface *xch, > map.domid = domid; > map.type = MAP_PIRQ_TYPE_GSI; > map.index = index; > - map.pirq = *pirq < 0 ? index : *pirq; > + map.pirq = *pirq; > > rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map)); >
This is a functional change to existing callers, without any kind of clarification whether this changed behavior is actually okay for them. Jan