diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-08 12:12:41 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-08 12:12:41 -0400 |
| commit | cfae7e3eb1334ff8035bb66f307f3d4010e65646 (patch) | |
| tree | f02e6d4503387d9becb523740398553e6aa06743 | |
| parent | 267ba96492c897970471cbe64f748e3f46ae71cf (diff) | |
| parent | 6f2d9d99213514360034c6d52d2c3919290b3504 (diff) | |
Merge tag 'for-linus-4.7b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen bug fixes from David Vrabel:
- Fix two bugs in the handling of xenbus transactions.
- Make the xen acpi driver compatible with Xen 4.7.
* tag 'for-linus-4.7b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7
xenbus: simplify xenbus_dev_request_and_reply()
xenbus: don't bail early from xenbus_dev_request_and_reply()
xenbus: don't BUG() on user mode induced condition
| -rw-r--r-- | drivers/xen/xen-acpi-processor.c | 35 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_dev_frontend.c | 14 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 10 |
3 files changed, 14 insertions, 45 deletions
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 076970a54f89..4ce10bcca18b 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
| @@ -423,36 +423,7 @@ upload: | |||
| 423 | 423 | ||
| 424 | return 0; | 424 | return 0; |
| 425 | } | 425 | } |
| 426 | static int __init check_prereq(void) | ||
| 427 | { | ||
| 428 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 429 | |||
| 430 | if (!xen_initial_domain()) | ||
| 431 | return -ENODEV; | ||
| 432 | |||
| 433 | if (!acpi_gbl_FADT.smi_command) | ||
| 434 | return -ENODEV; | ||
| 435 | |||
| 436 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
| 437 | if (!cpu_has(c, X86_FEATURE_EST)) | ||
| 438 | return -ENODEV; | ||
| 439 | 426 | ||
| 440 | return 0; | ||
| 441 | } | ||
| 442 | if (c->x86_vendor == X86_VENDOR_AMD) { | ||
| 443 | /* Copied from powernow-k8.h, can't include ../cpufreq/powernow | ||
| 444 | * as we get compile warnings for the static functions. | ||
| 445 | */ | ||
| 446 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | ||
| 447 | #define USE_HW_PSTATE 0x00000080 | ||
| 448 | u32 eax, ebx, ecx, edx; | ||
| 449 | cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); | ||
| 450 | if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE) | ||
| 451 | return -ENODEV; | ||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | return -ENODEV; | ||
| 455 | } | ||
| 456 | /* acpi_perf_data is a pointer to percpu data. */ | 427 | /* acpi_perf_data is a pointer to percpu data. */ |
| 457 | static struct acpi_processor_performance __percpu *acpi_perf_data; | 428 | static struct acpi_processor_performance __percpu *acpi_perf_data; |
| 458 | 429 | ||
| @@ -509,10 +480,10 @@ struct notifier_block xen_acpi_processor_resume_nb = { | |||
| 509 | static int __init xen_acpi_processor_init(void) | 480 | static int __init xen_acpi_processor_init(void) |
| 510 | { | 481 | { |
| 511 | unsigned int i; | 482 | unsigned int i; |
| 512 | int rc = check_prereq(); | 483 | int rc; |
| 513 | 484 | ||
| 514 | if (rc) | 485 | if (!xen_initial_domain()) |
| 515 | return rc; | 486 | return -ENODEV; |
| 516 | 487 | ||
| 517 | nr_acpi_bits = get_max_acpi_id() + 1; | 488 | nr_acpi_bits = get_max_acpi_id() + 1; |
| 518 | acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); | 489 | acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index cacf30d14747..7487971f9f78 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
| @@ -316,11 +316,18 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 316 | rc = -ENOMEM; | 316 | rc = -ENOMEM; |
| 317 | goto out; | 317 | goto out; |
| 318 | } | 318 | } |
| 319 | } else { | ||
| 320 | list_for_each_entry(trans, &u->transactions, list) | ||
| 321 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 322 | break; | ||
| 323 | if (&trans->list == &u->transactions) | ||
| 324 | return -ESRCH; | ||
| 319 | } | 325 | } |
| 320 | 326 | ||
| 321 | reply = xenbus_dev_request_and_reply(&u->u.msg); | 327 | reply = xenbus_dev_request_and_reply(&u->u.msg); |
| 322 | if (IS_ERR(reply)) { | 328 | if (IS_ERR(reply)) { |
| 323 | kfree(trans); | 329 | if (msg_type == XS_TRANSACTION_START) |
| 330 | kfree(trans); | ||
| 324 | rc = PTR_ERR(reply); | 331 | rc = PTR_ERR(reply); |
| 325 | goto out; | 332 | goto out; |
| 326 | } | 333 | } |
| @@ -333,12 +340,7 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 333 | list_add(&trans->list, &u->transactions); | 340 | list_add(&trans->list, &u->transactions); |
| 334 | } | 341 | } |
| 335 | } else if (u->u.msg.type == XS_TRANSACTION_END) { | 342 | } else if (u->u.msg.type == XS_TRANSACTION_END) { |
| 336 | list_for_each_entry(trans, &u->transactions, list) | ||
| 337 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 338 | break; | ||
| 339 | BUG_ON(&trans->list == &u->transactions); | ||
| 340 | list_del(&trans->list); | 343 | list_del(&trans->list); |
| 341 | |||
| 342 | kfree(trans); | 344 | kfree(trans); |
| 343 | } | 345 | } |
| 344 | 346 | ||
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 374b12af8812..22f7cd711c57 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
| @@ -232,10 +232,10 @@ static void transaction_resume(void) | |||
| 232 | void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | 232 | void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) |
| 233 | { | 233 | { |
| 234 | void *ret; | 234 | void *ret; |
| 235 | struct xsd_sockmsg req_msg = *msg; | 235 | enum xsd_sockmsg_type type = msg->type; |
| 236 | int err; | 236 | int err; |
| 237 | 237 | ||
| 238 | if (req_msg.type == XS_TRANSACTION_START) | 238 | if (type == XS_TRANSACTION_START) |
| 239 | transaction_start(); | 239 | transaction_start(); |
| 240 | 240 | ||
| 241 | mutex_lock(&xs_state.request_mutex); | 241 | mutex_lock(&xs_state.request_mutex); |
| @@ -249,12 +249,8 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | |||
| 249 | 249 | ||
| 250 | mutex_unlock(&xs_state.request_mutex); | 250 | mutex_unlock(&xs_state.request_mutex); |
| 251 | 251 | ||
| 252 | if (IS_ERR(ret)) | ||
| 253 | return ret; | ||
| 254 | |||
| 255 | if ((msg->type == XS_TRANSACTION_END) || | 252 | if ((msg->type == XS_TRANSACTION_END) || |
| 256 | ((req_msg.type == XS_TRANSACTION_START) && | 253 | ((type == XS_TRANSACTION_START) && (msg->type == XS_ERROR))) |
| 257 | (msg->type == XS_ERROR))) | ||
| 258 | transaction_end(); | 254 | transaction_end(); |
| 259 | 255 | ||
| 260 | return ret; | 256 | return ret; |
