diff options
author | Wei Liu <wei.liu2@citrix.com> | 2013-03-07 10:50:27 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2014-01-06 10:07:35 -0500 |
commit | 3f70fa828249e3f37883be98f5b4d08e947f55b0 (patch) | |
tree | 2e4d738d40aea11c302b40a31e121a23c9f6bbcc /drivers/xen/events.c | |
parent | fc087e10734a4d3e40693fc099461ec1270b3fff (diff) |
xen/events: introduce test_and_set_mask()
In preparation for adding event channel port ops, add
test_and_set_mask().
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers/xen/events.c')
-rw-r--r-- | drivers/xen/events.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 1e2c74bcd0c8..359e983d97e4 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -352,6 +352,12 @@ static inline int test_evtchn(int port) | |||
352 | return sync_test_bit(port, BM(&s->evtchn_pending[0])); | 352 | return sync_test_bit(port, BM(&s->evtchn_pending[0])); |
353 | } | 353 | } |
354 | 354 | ||
355 | static inline int test_and_set_mask(int port) | ||
356 | { | ||
357 | struct shared_info *s = HYPERVISOR_shared_info; | ||
358 | return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0])); | ||
359 | } | ||
360 | |||
355 | 361 | ||
356 | /** | 362 | /** |
357 | * notify_remote_via_irq - send event to remote end of event channel via irq | 363 | * 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 | /* Rebind an evtchn so that it gets delivered to a specific cpu */ | 1499 | /* Rebind an evtchn so that it gets delivered to a specific cpu */ |
1494 | static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | 1500 | static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) |
1495 | { | 1501 | { |
1496 | struct shared_info *s = HYPERVISOR_shared_info; | ||
1497 | struct evtchn_bind_vcpu bind_vcpu; | 1502 | struct evtchn_bind_vcpu bind_vcpu; |
1498 | int evtchn = evtchn_from_irq(irq); | 1503 | int evtchn = evtchn_from_irq(irq); |
1499 | int masked; | 1504 | int masked; |
@@ -1516,7 +1521,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | |||
1516 | * Mask the event while changing the VCPU binding to prevent | 1521 | * Mask the event while changing the VCPU binding to prevent |
1517 | * it being delivered on an unexpected VCPU. | 1522 | * it being delivered on an unexpected VCPU. |
1518 | */ | 1523 | */ |
1519 | masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask)); | 1524 | masked = test_and_set_mask(evtchn); |
1520 | 1525 | ||
1521 | /* | 1526 | /* |
1522 | * If this fails, it usually just indicates that we're dealing with a | 1527 | * If this fails, it usually just indicates that we're dealing with a |
@@ -1548,7 +1553,7 @@ static int retrigger_evtchn(int evtchn) | |||
1548 | if (!VALID_EVTCHN(evtchn)) | 1553 | if (!VALID_EVTCHN(evtchn)) |
1549 | return 0; | 1554 | return 0; |
1550 | 1555 | ||
1551 | masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask)); | 1556 | masked = test_and_set_mask(evtchn); |
1552 | sync_set_bit(evtchn, BM(s->evtchn_pending)); | 1557 | sync_set_bit(evtchn, BM(s->evtchn_pending)); |
1553 | if (!masked) | 1558 | if (!masked) |
1554 | unmask_evtchn(evtchn); | 1559 | unmask_evtchn(evtchn); |