Message ID | 4f8f5abdb7d9dfb241794375d3705524b5b53490.1662023183.git.rahul.singh@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/evtchn: implement static event channel signaling | expand |
Hi Rahul, On 01/09/2022 10:13, Rahul Singh wrote: > In a follow-up patch we will want to either reserve or allocate a port > for various event channel helpers. > > A new wrapper is introduced to either reserve a given port or allocate > a fresh one if zero. > > Take the opportunity to replace the open-coded version in > evtchn_bind_virq(). > > Signed-off-by: Stanislav Kinsburskii <staskins@amazon.com> Usually, the "From:" match the first signed-off-by. This is not the case here. Can you clarify whether you effectively rewrite the patch or simply took it? If the former, then I would suggest to write: "Based on ..." If the latter, then please update the "From:". Cheers,
Hi Julien, > On 1 Sep 2022, at 10:27 am, Julien Grall <julien@xen.org> wrote: > > Hi Rahul, > > On 01/09/2022 10:13, Rahul Singh wrote: >> In a follow-up patch we will want to either reserve or allocate a port >> for various event channel helpers. >> A new wrapper is introduced to either reserve a given port or allocate >> a fresh one if zero. >> Take the opportunity to replace the open-coded version in >> evtchn_bind_virq(). >> Signed-off-by: Stanislav Kinsburskii <staskins@amazon.com> > > Usually, the "From:" match the first signed-off-by. This is not the case here. Can you clarify whether you effectively rewrite the patch or simply took it? I just took the patch with small changes. > > If the former, then I would suggest to write: "Based on ..." > If the latter, then please update the "From:". Ok. I will update the “From:” Regards, Rahul
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 80b06d9743..ef4da0781d 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -305,6 +305,18 @@ void evtchn_free(struct domain *d, struct evtchn *chn) xsm_evtchn_close_post(chn); } +static int evtchn_get_port(struct domain *d, evtchn_port_t port) +{ + int rc; + + if ( port != 0 ) + rc = evtchn_allocate_port(d, port); + else + rc = get_free_port(d); + + return rc ?: port; +} + int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc) { struct evtchn *chn; @@ -462,19 +474,10 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port) if ( read_atomic(&v->virq_to_evtchn[virq]) ) ERROR_EXIT(-EEXIST); - if ( port != 0 ) - { - if ( (rc = evtchn_allocate_port(d, port)) != 0 ) - ERROR_EXIT(rc); - } - else - { - int alloc_port = get_free_port(d); - - if ( alloc_port < 0 ) - ERROR_EXIT(alloc_port); - port = alloc_port; - } + port = rc = evtchn_get_port(d, port); + if ( rc < 0 ) + ERROR_EXIT(rc); + rc = 0; chn = evtchn_from_port(d, port);