mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
xen: features and fixes for 4.10 rc2
- small fixes for xenbus driver - one fix for xen dom0 boot on huge system - small cleanups -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJYbgWzAAoJELDendYovxMvzqQH/iO+SKCrT39q6fCP+fyov7Hi J67XrHVT/AAPUXizWzKdtBE5EdI+WZXBkdsCEh3+3XPCeCRL/t9dRYEytle0Ioy9 hXC5otiJQ1hhm2N5dQKT5c0IMVh9mAjbeIqcG2dV1lSVaw0CYcJS4xh9eALxj7UY eXGpNMdNyeiEG2p5OgnDE5GqHavxPh+6ChNxmr8341T8E+C9U1BNtJeUiIQshKmC YAlt7YWoPzEJeLAYEiwrROYNyrLNd17IlYOeKXSwZUdkVtZahW+/jO+YYmhbx1C/ Yvt93r7ewUFKslRgpZQjjl8y9eynKg+j2BWx8WjAwpdHfCa1DFEOxiAOraLp7Cc= =ro0H -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
383378d115
@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
|
||||
size = PFN_PHYS(xen_start_info->nr_p2m_frames);
|
||||
}
|
||||
|
||||
if (!xen_is_e820_reserved(start, size)) {
|
||||
memblock_reserve(start, size);
|
||||
memblock_reserve(start, size);
|
||||
if (!xen_is_e820_reserved(start, size))
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
/*
|
||||
@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
|
||||
BUG();
|
||||
#else
|
||||
xen_relocate_p2m();
|
||||
memblock_free(start, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,
|
||||
xen_pfn_t *gpfns;
|
||||
xen_ulong_t *idxs;
|
||||
int *errs;
|
||||
struct xen_add_to_physmap_range xatp;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
struct xen_add_to_physmap_range xatp = {
|
||||
.domid = DOMID_SELF,
|
||||
.space = XENMAPSPACE_dev_mmio
|
||||
};
|
||||
|
||||
r = &resources[i];
|
||||
nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE);
|
||||
if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
|
||||
@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources,
|
||||
idxs[j] = XEN_PFN_DOWN(r->start) + j;
|
||||
}
|
||||
|
||||
xatp.domid = DOMID_SELF;
|
||||
xatp.size = nr;
|
||||
xatp.space = XENMAPSPACE_dev_mmio;
|
||||
|
||||
set_xen_guest_handle(xatp.gpfns, gpfns);
|
||||
set_xen_guest_handle(xatp.idxs, idxs);
|
||||
|
@ -369,8 +369,7 @@ static void evtchn_fifo_resume(void)
|
||||
}
|
||||
|
||||
ret = init_control_block(cpu, control_block);
|
||||
if (ret < 0)
|
||||
BUG();
|
||||
BUG_ON(ret < 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn)
|
||||
while (*new) {
|
||||
struct user_evtchn *this;
|
||||
|
||||
this = container_of(*new, struct user_evtchn, node);
|
||||
this = rb_entry(*new, struct user_evtchn, node);
|
||||
|
||||
parent = *new;
|
||||
if (this->port < evtchn->port)
|
||||
@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port)
|
||||
while (node) {
|
||||
struct user_evtchn *evtchn;
|
||||
|
||||
evtchn = container_of(node, struct user_evtchn, node);
|
||||
evtchn = rb_entry(node, struct user_evtchn, node);
|
||||
|
||||
if (evtchn->port < port)
|
||||
node = node->rb_left;
|
||||
|
@ -42,7 +42,6 @@ int xb_write(const void *data, unsigned len);
|
||||
int xb_read(void *data, unsigned len);
|
||||
int xb_data_to_read(void);
|
||||
int xb_wait_for_data_to_read(void);
|
||||
int xs_input_avail(void);
|
||||
extern struct xenstore_domain_interface *xen_store_interface;
|
||||
extern int xen_store_evtchn;
|
||||
extern enum xenstore_init xen_store_domain_type;
|
||||
|
@ -302,6 +302,29 @@ static void watch_fired(struct xenbus_watch *watch,
|
||||
mutex_unlock(&adap->dev_data->reply_mutex);
|
||||
}
|
||||
|
||||
static int xenbus_command_reply(struct xenbus_file_priv *u,
|
||||
unsigned int msg_type, const char *reply)
|
||||
{
|
||||
struct {
|
||||
struct xsd_sockmsg hdr;
|
||||
const char body[16];
|
||||
} msg;
|
||||
int rc;
|
||||
|
||||
msg.hdr = u->u.msg;
|
||||
msg.hdr.type = msg_type;
|
||||
msg.hdr.len = strlen(reply) + 1;
|
||||
if (msg.hdr.len > sizeof(msg.body))
|
||||
return -E2BIG;
|
||||
|
||||
mutex_lock(&u->reply_mutex);
|
||||
rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len);
|
||||
wake_up(&u->read_waitq);
|
||||
mutex_unlock(&u->reply_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int xenbus_write_transaction(unsigned msg_type,
|
||||
struct xenbus_file_priv *u)
|
||||
{
|
||||
@ -316,12 +339,12 @@ static int xenbus_write_transaction(unsigned msg_type,
|
||||
rc = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
} else if (msg_type == XS_TRANSACTION_END) {
|
||||
} else if (u->u.msg.tx_id != 0) {
|
||||
list_for_each_entry(trans, &u->transactions, list)
|
||||
if (trans->handle.id == u->u.msg.tx_id)
|
||||
break;
|
||||
if (&trans->list == &u->transactions)
|
||||
return -ESRCH;
|
||||
return xenbus_command_reply(u, XS_ERROR, "ENOENT");
|
||||
}
|
||||
|
||||
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)
|
||||
path = u->u.buffer + sizeof(u->u.msg);
|
||||
token = memchr(path, 0, u->u.msg.len);
|
||||
if (token == NULL) {
|
||||
rc = -EILSEQ;
|
||||
rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
|
||||
goto out;
|
||||
}
|
||||
token++;
|
||||
if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) {
|
||||
rc = -EILSEQ;
|
||||
rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -411,23 +434,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
|
||||
}
|
||||
|
||||
/* Success. Synthesize a reply to say all is OK. */
|
||||
{
|
||||
struct {
|
||||
struct xsd_sockmsg hdr;
|
||||
char body[3];
|
||||
} __packed reply = {
|
||||
{
|
||||
.type = msg_type,
|
||||
.len = sizeof(reply.body)
|
||||
},
|
||||
"OK"
|
||||
};
|
||||
|
||||
mutex_lock(&u->reply_mutex);
|
||||
rc = queue_reply(&u->read_buffers, &reply, sizeof(reply));
|
||||
wake_up(&u->read_waitq);
|
||||
mutex_unlock(&u->reply_mutex);
|
||||
}
|
||||
rc = xenbus_command_reply(u, msg_type, "OK");
|
||||
|
||||
out:
|
||||
return rc;
|
||||
|
Loading…
Reference in New Issue
Block a user