63
63
#include <xen/interface/physdev.h>
64
64
#include <xen/interface/sched.h>
65
65
#include <xen/interface/vcpu.h>
66
+ #include <xen/xenbus.h>
66
67
#include <asm/hw_irq.h>
67
68
68
69
#include "events_internal.h"
@@ -115,6 +116,7 @@ struct irq_info {
115
116
unsigned char flags ;
116
117
uint16_t domid ;
117
118
} pirq ;
119
+ struct xenbus_device * interdomain ;
118
120
} u ;
119
121
};
120
122
@@ -313,11 +315,16 @@ static int xen_irq_info_common_setup(struct irq_info *info,
313
315
}
314
316
315
317
static int xen_irq_info_evtchn_setup (unsigned irq ,
316
- evtchn_port_t evtchn )
318
+ evtchn_port_t evtchn ,
319
+ struct xenbus_device * dev )
317
320
{
318
321
struct irq_info * info = info_for_irq (irq );
322
+ int ret ;
319
323
320
- return xen_irq_info_common_setup (info , irq , IRQT_EVTCHN , evtchn , 0 );
324
+ ret = xen_irq_info_common_setup (info , irq , IRQT_EVTCHN , evtchn , 0 );
325
+ info -> u .interdomain = dev ;
326
+
327
+ return ret ;
321
328
}
322
329
323
330
static int xen_irq_info_ipi_setup (unsigned cpu ,
@@ -1116,7 +1123,8 @@ int xen_pirq_from_irq(unsigned irq)
1116
1123
}
1117
1124
EXPORT_SYMBOL_GPL (xen_pirq_from_irq );
1118
1125
1119
- static int bind_evtchn_to_irq_chip (evtchn_port_t evtchn , struct irq_chip * chip )
1126
+ static int bind_evtchn_to_irq_chip (evtchn_port_t evtchn , struct irq_chip * chip ,
1127
+ struct xenbus_device * dev )
1120
1128
{
1121
1129
int irq ;
1122
1130
int ret ;
@@ -1136,7 +1144,7 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip)
1136
1144
irq_set_chip_and_handler_name (irq , chip ,
1137
1145
handle_edge_irq , "event" );
1138
1146
1139
- ret = xen_irq_info_evtchn_setup (irq , evtchn );
1147
+ ret = xen_irq_info_evtchn_setup (irq , evtchn , dev );
1140
1148
if (ret < 0 ) {
1141
1149
__unbind_from_irq (irq );
1142
1150
irq = ret ;
@@ -1163,7 +1171,7 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip)
1163
1171
1164
1172
int bind_evtchn_to_irq (evtchn_port_t evtchn )
1165
1173
{
1166
- return bind_evtchn_to_irq_chip (evtchn , & xen_dynamic_chip );
1174
+ return bind_evtchn_to_irq_chip (evtchn , & xen_dynamic_chip , NULL );
1167
1175
}
1168
1176
EXPORT_SYMBOL_GPL (bind_evtchn_to_irq );
1169
1177
@@ -1212,27 +1220,27 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
1212
1220
return irq ;
1213
1221
}
1214
1222
1215
- static int bind_interdomain_evtchn_to_irq_chip (unsigned int remote_domain ,
1223
+ static int bind_interdomain_evtchn_to_irq_chip (struct xenbus_device * dev ,
1216
1224
evtchn_port_t remote_port ,
1217
1225
struct irq_chip * chip )
1218
1226
{
1219
1227
struct evtchn_bind_interdomain bind_interdomain ;
1220
1228
int err ;
1221
1229
1222
- bind_interdomain .remote_dom = remote_domain ;
1230
+ bind_interdomain .remote_dom = dev -> otherend_id ;
1223
1231
bind_interdomain .remote_port = remote_port ;
1224
1232
1225
1233
err = HYPERVISOR_event_channel_op (EVTCHNOP_bind_interdomain ,
1226
1234
& bind_interdomain );
1227
1235
1228
1236
return err ? : bind_evtchn_to_irq_chip (bind_interdomain .local_port ,
1229
- chip );
1237
+ chip , dev );
1230
1238
}
1231
1239
1232
- int bind_interdomain_evtchn_to_irq_lateeoi (unsigned int remote_domain ,
1240
+ int bind_interdomain_evtchn_to_irq_lateeoi (struct xenbus_device * dev ,
1233
1241
evtchn_port_t remote_port )
1234
1242
{
1235
- return bind_interdomain_evtchn_to_irq_chip (remote_domain , remote_port ,
1243
+ return bind_interdomain_evtchn_to_irq_chip (dev , remote_port ,
1236
1244
& xen_lateeoi_chip );
1237
1245
}
1238
1246
EXPORT_SYMBOL_GPL (bind_interdomain_evtchn_to_irq_lateeoi );
@@ -1345,7 +1353,7 @@ static int bind_evtchn_to_irqhandler_chip(evtchn_port_t evtchn,
1345
1353
{
1346
1354
int irq , retval ;
1347
1355
1348
- irq = bind_evtchn_to_irq_chip (evtchn , chip );
1356
+ irq = bind_evtchn_to_irq_chip (evtchn , chip , NULL );
1349
1357
if (irq < 0 )
1350
1358
return irq ;
1351
1359
retval = request_irq (irq , handler , irqflags , devname , dev_id );
@@ -1380,14 +1388,13 @@ int bind_evtchn_to_irqhandler_lateeoi(evtchn_port_t evtchn,
1380
1388
EXPORT_SYMBOL_GPL (bind_evtchn_to_irqhandler_lateeoi );
1381
1389
1382
1390
static int bind_interdomain_evtchn_to_irqhandler_chip (
1383
- unsigned int remote_domain , evtchn_port_t remote_port ,
1391
+ struct xenbus_device * dev , evtchn_port_t remote_port ,
1384
1392
irq_handler_t handler , unsigned long irqflags ,
1385
1393
const char * devname , void * dev_id , struct irq_chip * chip )
1386
1394
{
1387
1395
int irq , retval ;
1388
1396
1389
- irq = bind_interdomain_evtchn_to_irq_chip (remote_domain , remote_port ,
1390
- chip );
1397
+ irq = bind_interdomain_evtchn_to_irq_chip (dev , remote_port , chip );
1391
1398
if (irq < 0 )
1392
1399
return irq ;
1393
1400
@@ -1400,14 +1407,14 @@ static int bind_interdomain_evtchn_to_irqhandler_chip(
1400
1407
return irq ;
1401
1408
}
1402
1409
1403
- int bind_interdomain_evtchn_to_irqhandler_lateeoi (unsigned int remote_domain ,
1410
+ int bind_interdomain_evtchn_to_irqhandler_lateeoi (struct xenbus_device * dev ,
1404
1411
evtchn_port_t remote_port ,
1405
1412
irq_handler_t handler ,
1406
1413
unsigned long irqflags ,
1407
1414
const char * devname ,
1408
1415
void * dev_id )
1409
1416
{
1410
- return bind_interdomain_evtchn_to_irqhandler_chip (remote_domain ,
1417
+ return bind_interdomain_evtchn_to_irqhandler_chip (dev ,
1411
1418
remote_port , handler , irqflags , devname ,
1412
1419
dev_id , & xen_lateeoi_chip );
1413
1420
}
@@ -1679,7 +1686,7 @@ void rebind_evtchn_irq(evtchn_port_t evtchn, int irq)
1679
1686
so there should be a proper type */
1680
1687
BUG_ON (info -> type == IRQT_UNBOUND );
1681
1688
1682
- (void )xen_irq_info_evtchn_setup (irq , evtchn );
1689
+ (void )xen_irq_info_evtchn_setup (irq , evtchn , NULL );
1683
1690
1684
1691
mutex_unlock (& irq_mapping_update_lock );
1685
1692
0 commit comments