diff options
| -rw-r--r-- | arch/x86/xen/setup.c | 6 | ||||
| -rw-r--r-- | drivers/xen/arm-device.c | 8 | ||||
| -rw-r--r-- | drivers/xen/events/events_fifo.c | 3 | ||||
| -rw-r--r-- | drivers/xen/evtchn.c | 4 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_comms.h | 1 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_dev_frontend.c | 49 |
6 files changed, 39 insertions, 32 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 8c394e30e5fe..f3f7b41116f7 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void) | |||
| 713 | size = PFN_PHYS(xen_start_info->nr_p2m_frames); | 713 | size = PFN_PHYS(xen_start_info->nr_p2m_frames); |
| 714 | } | 714 | } |
| 715 | 715 | ||
| 716 | if (!xen_is_e820_reserved(start, size)) { | 716 | memblock_reserve(start, size); |
| 717 | memblock_reserve(start, size); | 717 | if (!xen_is_e820_reserved(start, size)) |
| 718 | return; | 718 | return; |
| 719 | } | ||
| 720 | 719 | ||
| 721 | #ifdef CONFIG_X86_32 | 720 | #ifdef CONFIG_X86_32 |
| 722 | /* | 721 | /* |
| @@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void) | |||
| 727 | BUG(); | 726 | BUG(); |
| 728 | #else | 727 | #else |
| 729 | xen_relocate_p2m(); | 728 | xen_relocate_p2m(); |
| 729 | memblock_free(start, size); | ||
| 730 | #endif | 730 | #endif |
| 731 | } | 731 | } |
| 732 | 732 | ||
diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c index 778acf80aacb..85dd20e05726 100644 --- a/drivers/xen/arm-device.c +++ b/drivers/xen/arm-device.c | |||
| @@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources, | |||
| 58 | xen_pfn_t *gpfns; | 58 | xen_pfn_t *gpfns; |
| 59 | xen_ulong_t *idxs; | 59 | xen_ulong_t *idxs; |
| 60 | int *errs; | 60 | int *errs; |
| 61 | struct xen_add_to_physmap_range xatp; | ||
| 62 | 61 | ||
| 63 | for (i = 0; i < count; i++) { | 62 | for (i = 0; i < count; i++) { |
| 63 | struct xen_add_to_physmap_range xatp = { | ||
| 64 | .domid = DOMID_SELF, | ||
| 65 | .space = XENMAPSPACE_dev_mmio | ||
| 66 | }; | ||
| 67 | |||
| 64 | r = &resources[i]; | 68 | r = &resources[i]; |
| 65 | nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); | 69 | nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); |
| 66 | if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) | 70 | if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) |
| @@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources, | |||
| 87 | idxs[j] = XEN_PFN_DOWN(r->start) + j; | 91 | idxs[j] = XEN_PFN_DOWN(r->start) + j; |
| 88 | } | 92 | } |
| 89 | 93 | ||
| 90 | xatp.domid = DOMID_SELF; | ||
| 91 | xatp.size = nr; | 94 | xatp.size = nr; |
| 92 | xatp.space = XENMAPSPACE_dev_mmio; | ||
| 93 | 95 | ||
| 94 | set_xen_guest_handle(xatp.gpfns, gpfns); | 96 | set_xen_guest_handle(xatp.gpfns, gpfns); |
| 95 | set_xen_guest_handle(xatp.idxs, idxs); | 97 | set_xen_guest_handle(xatp.idxs, idxs); |
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c index c03f9c86c7e3..3c41470c7fc4 100644 --- a/drivers/xen/events/events_fifo.c +++ b/drivers/xen/events/events_fifo.c | |||
| @@ -369,8 +369,7 @@ static void evtchn_fifo_resume(void) | |||
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | ret = init_control_block(cpu, control_block); | 371 | ret = init_control_block(cpu, control_block); |
| 372 | if (ret < 0) | 372 | BUG_ON(ret < 0); |
| 373 | BUG(); | ||
| 374 | } | 373 | } |
| 375 | 374 | ||
| 376 | /* | 375 | /* |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index e8c7f09d01be..6890897a6f30 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
| @@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn) | |||
| 125 | while (*new) { | 125 | while (*new) { |
| 126 | struct user_evtchn *this; | 126 | struct user_evtchn *this; |
| 127 | 127 | ||
| 128 | this = container_of(*new, struct user_evtchn, node); | 128 | this = rb_entry(*new, struct user_evtchn, node); |
| 129 | 129 | ||
| 130 | parent = *new; | 130 | parent = *new; |
| 131 | if (this->port < evtchn->port) | 131 | if (this->port < evtchn->port) |
| @@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port) | |||
| 157 | while (node) { | 157 | while (node) { |
| 158 | struct user_evtchn *evtchn; | 158 | struct user_evtchn *evtchn; |
| 159 | 159 | ||
| 160 | evtchn = container_of(node, struct user_evtchn, node); | 160 | evtchn = rb_entry(node, struct user_evtchn, node); |
| 161 | 161 | ||
| 162 | if (evtchn->port < port) | 162 | if (evtchn->port < port) |
| 163 | node = node->rb_left; | 163 | node = node->rb_left; |
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h index e74f9c1fbd80..867a2e425208 100644 --- a/drivers/xen/xenbus/xenbus_comms.h +++ b/drivers/xen/xenbus/xenbus_comms.h | |||
| @@ -42,7 +42,6 @@ int xb_write(const void *data, unsigned len); | |||
| 42 | int xb_read(void *data, unsigned len); | 42 | int xb_read(void *data, unsigned len); |
| 43 | int xb_data_to_read(void); | 43 | int xb_data_to_read(void); |
| 44 | int xb_wait_for_data_to_read(void); | 44 | int xb_wait_for_data_to_read(void); |
| 45 | int xs_input_avail(void); | ||
| 46 | extern struct xenstore_domain_interface *xen_store_interface; | 45 | extern struct xenstore_domain_interface *xen_store_interface; |
| 47 | extern int xen_store_evtchn; | 46 | extern int xen_store_evtchn; |
| 48 | extern enum xenstore_init xen_store_domain_type; | 47 | extern enum xenstore_init xen_store_domain_type; |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 6c0ead4be784..79130b310247 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
| @@ -302,6 +302,29 @@ static void watch_fired(struct xenbus_watch *watch, | |||
| 302 | mutex_unlock(&adap->dev_data->reply_mutex); | 302 | mutex_unlock(&adap->dev_data->reply_mutex); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | static int xenbus_command_reply(struct xenbus_file_priv *u, | ||
| 306 | unsigned int msg_type, const char *reply) | ||
| 307 | { | ||
| 308 | struct { | ||
| 309 | struct xsd_sockmsg hdr; | ||
| 310 | const char body[16]; | ||
| 311 | } msg; | ||
| 312 | int rc; | ||
| 313 | |||
| 314 | msg.hdr = u->u.msg; | ||
| 315 | msg.hdr.type = msg_type; | ||
| 316 | msg.hdr.len = strlen(reply) + 1; | ||
| 317 | if (msg.hdr.len > sizeof(msg.body)) | ||
| 318 | return -E2BIG; | ||
| 319 | |||
| 320 | mutex_lock(&u->reply_mutex); | ||
| 321 | rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len); | ||
| 322 | wake_up(&u->read_waitq); | ||
| 323 | mutex_unlock(&u->reply_mutex); | ||
| 324 | |||
| 325 | return rc; | ||
| 326 | } | ||
| 327 | |||
| 305 | static int xenbus_write_transaction(unsigned msg_type, | 328 | static int xenbus_write_transaction(unsigned msg_type, |
| 306 | struct xenbus_file_priv *u) | 329 | struct xenbus_file_priv *u) |
| 307 | { | 330 | { |
| @@ -316,12 +339,12 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 316 | rc = -ENOMEM; | 339 | rc = -ENOMEM; |
| 317 | goto out; | 340 | goto out; |
| 318 | } | 341 | } |
| 319 | } else if (msg_type == XS_TRANSACTION_END) { | 342 | } else if (u->u.msg.tx_id != 0) { |
| 320 | list_for_each_entry(trans, &u->transactions, list) | 343 | list_for_each_entry(trans, &u->transactions, list) |
| 321 | if (trans->handle.id == u->u.msg.tx_id) | 344 | if (trans->handle.id == u->u.msg.tx_id) |
| 322 | break; | 345 | break; |
| 323 | if (&trans->list == &u->transactions) | 346 | if (&trans->list == &u->transactions) |
| 324 | return -ESRCH; | 347 | return xenbus_command_reply(u, XS_ERROR, "ENOENT"); |
| 325 | } | 348 | } |
| 326 | 349 | ||
| 327 | reply = xenbus_dev_request_and_reply(&u->u.msg); | 350 | reply = xenbus_dev_request_and_reply(&u->u.msg); |
| @@ -372,12 +395,12 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) | |||
| 372 | path = u->u.buffer + sizeof(u->u.msg); | 395 | path = u->u.buffer + sizeof(u->u.msg); |
| 373 | token = memchr(path, 0, u->u.msg.len); | 396 | token = memchr(path, 0, u->u.msg.len); |
| 374 | if (token == NULL) { | 397 | if (token == NULL) { |
| 375 | rc = -EILSEQ; | 398 | rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); |
| 376 | goto out; | 399 | goto out; |
| 377 | } | 400 | } |
| 378 | token++; | 401 | token++; |
| 379 | if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { | 402 | if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { |
| 380 | rc = -EILSEQ; | 403 | rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); |
| 381 | goto out; | 404 | goto out; |
| 382 | } | 405 | } |
| 383 | 406 | ||
| @@ -411,23 +434,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) | |||
| 411 | } | 434 | } |
| 412 | 435 | ||
| 413 | /* Success. Synthesize a reply to say all is OK. */ | 436 | /* Success. Synthesize a reply to say all is OK. */ |
| 414 | { | 437 | rc = xenbus_command_reply(u, msg_type, "OK"); |
| 415 | struct { | ||
| 416 | struct xsd_sockmsg hdr; | ||
| 417 | char body[3]; | ||
| 418 | } __packed reply = { | ||
| 419 | { | ||
| 420 | .type = msg_type, | ||
| 421 | .len = sizeof(reply.body) | ||
| 422 | }, | ||
| 423 | "OK" | ||
| 424 | }; | ||
| 425 | |||
| 426 | mutex_lock(&u->reply_mutex); | ||
| 427 | rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); | ||
| 428 | wake_up(&u->read_waitq); | ||
| 429 | mutex_unlock(&u->reply_mutex); | ||
| 430 | } | ||
| 431 | 438 | ||
| 432 | out: | 439 | out: |
| 433 | return rc; | 440 | return rc; |
