From: Grygorii Strashko <[email protected]>
Enable build time optimization for evtchn_move_pirqs()/send_guest_pirq() on
platforms without PIRQ support by adding compile time check for
!IS_ENABLED(CONFIG_HAS_PIRQ) at the beginning of functions.
This will shrink them to (on Arm64 with -O1):
000000000000264c <send_guest_pirq>:
264c: d65f03c0 ret
0000000000004644 <evtchn_move_pirqs>:
4644: d65f03c0 ret
Signed-off-by: Grygorii Strashko <[email protected]>
---
xen/common/event_channel.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c8c1bfa615df..ccecdd682dd4 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -975,6 +975,9 @@ void send_guest_pirq(struct domain *d, const struct pirq
*pirq)
int port;
struct evtchn *chn;
+ if (!IS_ENABLED(CONFIG_HAS_PIRQ))
+ return;
+
/*
* PV guests: It should not be possible to race with __evtchn_close(). The
* caller of this function must synchronise with pirq_guest_unbind().
@@ -1710,10 +1713,15 @@ void evtchn_destroy_final(struct domain *d)
void evtchn_move_pirqs(struct vcpu *v)
{
struct domain *d = v->domain;
- const cpumask_t *mask = cpumask_of(v->processor);
+ const cpumask_t *mask;
unsigned int port;
struct evtchn *chn;
+ if (!IS_ENABLED(CONFIG_HAS_PIRQ))
+ return;
+
+ mask = cpumask_of(v->processor);
+
read_lock(&d->event_lock);
for ( port = v->pirq_evtchn_head; port; port = chn->u.pirq.next_port )
{
--
2.34.1