Commit 3f70fa82 authored by Wei Liu's avatar Wei Liu Committed by Konrad Rzeszutek Wilk

xen/events: introduce test_and_set_mask()

In preparation for adding event channel port ops, add
test_and_set_mask().
Signed-off-by: default avatarWei Liu <wei.liu2@citrix.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
parent fc087e10
...@@ -352,6 +352,12 @@ static inline int test_evtchn(int port) ...@@ -352,6 +352,12 @@ static inline int test_evtchn(int port)
return sync_test_bit(port, BM(&s->evtchn_pending[0])); return sync_test_bit(port, BM(&s->evtchn_pending[0]));
} }
static inline int test_and_set_mask(int port)
{
struct shared_info *s = HYPERVISOR_shared_info;
return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0]));
}
/** /**
* notify_remote_via_irq - send event to remote end of event channel via irq * notify_remote_via_irq - send event to remote end of event channel via irq
...@@ -1493,7 +1499,6 @@ void rebind_evtchn_irq(int evtchn, int irq) ...@@ -1493,7 +1499,6 @@ void rebind_evtchn_irq(int evtchn, int irq)
/* Rebind an evtchn so that it gets delivered to a specific cpu */ /* Rebind an evtchn so that it gets delivered to a specific cpu */
static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
{ {
struct shared_info *s = HYPERVISOR_shared_info;
struct evtchn_bind_vcpu bind_vcpu; struct evtchn_bind_vcpu bind_vcpu;
int evtchn = evtchn_from_irq(irq); int evtchn = evtchn_from_irq(irq);
int masked; int masked;
...@@ -1516,7 +1521,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) ...@@ -1516,7 +1521,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
* Mask the event while changing the VCPU binding to prevent * Mask the event while changing the VCPU binding to prevent
* it being delivered on an unexpected VCPU. * it being delivered on an unexpected VCPU.
*/ */
masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask)); masked = test_and_set_mask(evtchn);
/* /*
* If this fails, it usually just indicates that we're dealing with a * If this fails, it usually just indicates that we're dealing with a
...@@ -1548,7 +1553,7 @@ static int retrigger_evtchn(int evtchn) ...@@ -1548,7 +1553,7 @@ static int retrigger_evtchn(int evtchn)
if (!VALID_EVTCHN(evtchn)) if (!VALID_EVTCHN(evtchn))
return 0; return 0;
masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask)); masked = test_and_set_mask(evtchn);
sync_set_bit(evtchn, BM(s->evtchn_pending)); sync_set_bit(evtchn, BM(s->evtchn_pending));
if (!masked) if (!masked)
unmask_evtchn(evtchn); unmask_evtchn(evtchn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment