Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-4.10-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes and cleanups from Juergen Gross:

- small fixes for xenbus driver

- one fix for xen dom0 boot on huge system

- small cleanups

* tag 'for-linus-4.10-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
Xen: ARM: Zero reserved fields of xatp before making hypervisor call
xen: events: Replace BUG() with BUG_ON()
xen: remove stale xs_input_avail() from header
xen: return xenstore command failures via response instead of rc
xen: xenbus driver must not accept invalid transaction ids
xen/evtchn: use rb_entry()
xen/setup: Don't relocate p2m over existing one

+39 -32
+3 -3
arch/x86/xen/setup.c
··· 713 713 size = PFN_PHYS(xen_start_info->nr_p2m_frames); 714 714 } 715 715 716 - if (!xen_is_e820_reserved(start, size)) { 717 - memblock_reserve(start, size); 716 + memblock_reserve(start, size); 717 + if (!xen_is_e820_reserved(start, size)) 718 718 return; 719 - } 720 719 721 720 #ifdef CONFIG_X86_32 722 721 /* ··· 726 727 BUG(); 727 728 #else 728 729 xen_relocate_p2m(); 730 + memblock_free(start, size); 729 731 #endif 730 732 } 731 733
+5 -3
drivers/xen/arm-device.c
··· 58 58 xen_pfn_t *gpfns; 59 59 xen_ulong_t *idxs; 60 60 int *errs; 61 - struct xen_add_to_physmap_range xatp; 62 61 63 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 68 r = &resources[i]; 65 69 nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); 66 70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) ··· 91 87 idxs[j] = XEN_PFN_DOWN(r->start) + j; 92 88 } 93 89 94 - xatp.domid = DOMID_SELF; 95 90 xatp.size = nr; 96 - xatp.space = XENMAPSPACE_dev_mmio; 97 91 98 92 set_xen_guest_handle(xatp.gpfns, gpfns); 99 93 set_xen_guest_handle(xatp.idxs, idxs);
+1 -2
drivers/xen/events/events_fifo.c
··· 369 369 } 370 370 371 371 ret = init_control_block(cpu, control_block); 372 - if (ret < 0) 373 - BUG(); 372 + BUG_ON(ret < 0); 374 373 } 375 374 376 375 /*
+2 -2
drivers/xen/evtchn.c
··· 125 125 while (*new) { 126 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 130 parent = *new; 131 131 if (this->port < evtchn->port) ··· 157 157 while (node) { 158 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 162 if (evtchn->port < port) 163 163 node = node->rb_left;
-1
drivers/xen/xenbus/xenbus_comms.h
··· 42 42 int xb_read(void *data, unsigned len); 43 43 int xb_data_to_read(void); 44 44 int xb_wait_for_data_to_read(void); 45 - int xs_input_avail(void); 46 45 extern struct xenstore_domain_interface *xen_store_interface; 47 46 extern int xen_store_evtchn; 48 47 extern enum xenstore_init xen_store_domain_type;
+28 -21
drivers/xen/xenbus/xenbus_dev_frontend.c
··· 302 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 328 static int xenbus_write_transaction(unsigned msg_type, 306 329 struct xenbus_file_priv *u) 307 330 { ··· 339 316 rc = -ENOMEM; 340 317 goto out; 341 318 } 342 - } else if (msg_type == XS_TRANSACTION_END) { 319 + } else if (u->u.msg.tx_id != 0) { 343 320 list_for_each_entry(trans, &u->transactions, list) 344 321 if (trans->handle.id == u->u.msg.tx_id) 345 322 break; 346 323 if (&trans->list == &u->transactions) 347 - return -ESRCH; 324 + return xenbus_command_reply(u, XS_ERROR, "ENOENT"); 348 325 } 349 326 350 327 reply = xenbus_dev_request_and_reply(&u->u.msg); ··· 395 372 path = u->u.buffer + sizeof(u->u.msg); 396 373 token = memchr(path, 0, u->u.msg.len); 397 374 if (token == NULL) { 398 - rc = -EILSEQ; 375 + rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); 399 376 goto out; 400 377 } 401 378 token++; 402 379 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { 403 - rc = -EILSEQ; 380 + rc = xenbus_command_reply(u, XS_ERROR, "EINVAL"); 404 381 goto out; 405 382 } 406 383 ··· 434 411 } 435 412 436 413 /* Success. Synthesize a reply to say all is OK. */ 437 - { 438 - struct { 439 - struct xsd_sockmsg hdr; 440 - char body[3]; 441 - } __packed reply = { 442 - { 443 - .type = msg_type, 444 - .len = sizeof(reply.body) 445 - }, 446 - "OK" 447 - }; 448 - 449 - mutex_lock(&u->reply_mutex); 450 - rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); 451 - wake_up(&u->read_waitq); 452 - mutex_unlock(&u->reply_mutex); 453 - } 414 + rc = xenbus_command_reply(u, msg_type, "OK"); 454 415 455 416 out: 456 417 return rc;