diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-13 22:20:27 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-13 22:20:27 -0500 |
commit | 252ca494ac75f0dc47469f130d6dc67ed14081f4 (patch) | |
tree | 159e9931af199f8acf50f9982f281ee69ceb7cbf /tools | |
parent | 900937c0375efcbb2c9fb2eef50ccb5c98fc99ea (diff) | |
parent | 9f9499ae8e6415cefc4fe0a96ad0e27864353c89 (diff) |
Merge 4.4-rc5 into usb-next as we want those fixes here for testing
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 49 | ||||
-rw-r--r-- | tools/virtio/linux/kernel.h | 6 | ||||
-rw-r--r-- | tools/virtio/linux/virtio.h | 6 | ||||
-rw-r--r-- | tools/virtio/linux/virtio_config.h | 20 |
4 files changed, 34 insertions, 47 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 40ab4476c80a..51cf8256c6cd 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -420,8 +420,7 @@ static struct nfit_test_resource *nfit_test_lookup(resource_size_t addr) | |||
420 | 420 | ||
421 | static int nfit_test0_alloc(struct nfit_test *t) | 421 | static int nfit_test0_alloc(struct nfit_test *t) |
422 | { | 422 | { |
423 | size_t nfit_size = sizeof(struct acpi_table_nfit) | 423 | size_t nfit_size = sizeof(struct acpi_nfit_system_address) * NUM_SPA |
424 | + sizeof(struct acpi_nfit_system_address) * NUM_SPA | ||
425 | + sizeof(struct acpi_nfit_memory_map) * NUM_MEM | 424 | + sizeof(struct acpi_nfit_memory_map) * NUM_MEM |
426 | + sizeof(struct acpi_nfit_control_region) * NUM_DCR | 425 | + sizeof(struct acpi_nfit_control_region) * NUM_DCR |
427 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW | 426 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW |
@@ -471,8 +470,7 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
471 | 470 | ||
472 | static int nfit_test1_alloc(struct nfit_test *t) | 471 | static int nfit_test1_alloc(struct nfit_test *t) |
473 | { | 472 | { |
474 | size_t nfit_size = sizeof(struct acpi_table_nfit) | 473 | size_t nfit_size = sizeof(struct acpi_nfit_system_address) |
475 | + sizeof(struct acpi_nfit_system_address) | ||
476 | + sizeof(struct acpi_nfit_memory_map) | 474 | + sizeof(struct acpi_nfit_memory_map) |
477 | + sizeof(struct acpi_nfit_control_region); | 475 | + sizeof(struct acpi_nfit_control_region); |
478 | 476 | ||
@@ -488,39 +486,24 @@ static int nfit_test1_alloc(struct nfit_test *t) | |||
488 | return 0; | 486 | return 0; |
489 | } | 487 | } |
490 | 488 | ||
491 | static void nfit_test_init_header(struct acpi_table_nfit *nfit, size_t size) | ||
492 | { | ||
493 | memcpy(nfit->header.signature, ACPI_SIG_NFIT, 4); | ||
494 | nfit->header.length = size; | ||
495 | nfit->header.revision = 1; | ||
496 | memcpy(nfit->header.oem_id, "LIBND", 6); | ||
497 | memcpy(nfit->header.oem_table_id, "TEST", 5); | ||
498 | nfit->header.oem_revision = 1; | ||
499 | memcpy(nfit->header.asl_compiler_id, "TST", 4); | ||
500 | nfit->header.asl_compiler_revision = 1; | ||
501 | } | ||
502 | |||
503 | static void nfit_test0_setup(struct nfit_test *t) | 489 | static void nfit_test0_setup(struct nfit_test *t) |
504 | { | 490 | { |
505 | struct nvdimm_bus_descriptor *nd_desc; | 491 | struct nvdimm_bus_descriptor *nd_desc; |
506 | struct acpi_nfit_desc *acpi_desc; | 492 | struct acpi_nfit_desc *acpi_desc; |
507 | struct acpi_nfit_memory_map *memdev; | 493 | struct acpi_nfit_memory_map *memdev; |
508 | void *nfit_buf = t->nfit_buf; | 494 | void *nfit_buf = t->nfit_buf; |
509 | size_t size = t->nfit_size; | ||
510 | struct acpi_nfit_system_address *spa; | 495 | struct acpi_nfit_system_address *spa; |
511 | struct acpi_nfit_control_region *dcr; | 496 | struct acpi_nfit_control_region *dcr; |
512 | struct acpi_nfit_data_region *bdw; | 497 | struct acpi_nfit_data_region *bdw; |
513 | struct acpi_nfit_flush_address *flush; | 498 | struct acpi_nfit_flush_address *flush; |
514 | unsigned int offset; | 499 | unsigned int offset; |
515 | 500 | ||
516 | nfit_test_init_header(nfit_buf, size); | ||
517 | |||
518 | /* | 501 | /* |
519 | * spa0 (interleave first half of dimm0 and dimm1, note storage | 502 | * spa0 (interleave first half of dimm0 and dimm1, note storage |
520 | * does not actually alias the related block-data-window | 503 | * does not actually alias the related block-data-window |
521 | * regions) | 504 | * regions) |
522 | */ | 505 | */ |
523 | spa = nfit_buf + sizeof(struct acpi_table_nfit); | 506 | spa = nfit_buf; |
524 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 507 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
525 | spa->header.length = sizeof(*spa); | 508 | spa->header.length = sizeof(*spa); |
526 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_PM), 16); | 509 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_PM), 16); |
@@ -533,7 +516,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
533 | * does not actually alias the related block-data-window | 516 | * does not actually alias the related block-data-window |
534 | * regions) | 517 | * regions) |
535 | */ | 518 | */ |
536 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa); | 519 | spa = nfit_buf + sizeof(*spa); |
537 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 520 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
538 | spa->header.length = sizeof(*spa); | 521 | spa->header.length = sizeof(*spa); |
539 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_PM), 16); | 522 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_PM), 16); |
@@ -542,7 +525,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
542 | spa->length = SPA1_SIZE; | 525 | spa->length = SPA1_SIZE; |
543 | 526 | ||
544 | /* spa2 (dcr0) dimm0 */ | 527 | /* spa2 (dcr0) dimm0 */ |
545 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 2; | 528 | spa = nfit_buf + sizeof(*spa) * 2; |
546 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 529 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
547 | spa->header.length = sizeof(*spa); | 530 | spa->header.length = sizeof(*spa); |
548 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); | 531 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); |
@@ -551,7 +534,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
551 | spa->length = DCR_SIZE; | 534 | spa->length = DCR_SIZE; |
552 | 535 | ||
553 | /* spa3 (dcr1) dimm1 */ | 536 | /* spa3 (dcr1) dimm1 */ |
554 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 3; | 537 | spa = nfit_buf + sizeof(*spa) * 3; |
555 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 538 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
556 | spa->header.length = sizeof(*spa); | 539 | spa->header.length = sizeof(*spa); |
557 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); | 540 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); |
@@ -560,7 +543,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
560 | spa->length = DCR_SIZE; | 543 | spa->length = DCR_SIZE; |
561 | 544 | ||
562 | /* spa4 (dcr2) dimm2 */ | 545 | /* spa4 (dcr2) dimm2 */ |
563 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 4; | 546 | spa = nfit_buf + sizeof(*spa) * 4; |
564 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 547 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
565 | spa->header.length = sizeof(*spa); | 548 | spa->header.length = sizeof(*spa); |
566 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); | 549 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); |
@@ -569,7 +552,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
569 | spa->length = DCR_SIZE; | 552 | spa->length = DCR_SIZE; |
570 | 553 | ||
571 | /* spa5 (dcr3) dimm3 */ | 554 | /* spa5 (dcr3) dimm3 */ |
572 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 5; | 555 | spa = nfit_buf + sizeof(*spa) * 5; |
573 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 556 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
574 | spa->header.length = sizeof(*spa); | 557 | spa->header.length = sizeof(*spa); |
575 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); | 558 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16); |
@@ -578,7 +561,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
578 | spa->length = DCR_SIZE; | 561 | spa->length = DCR_SIZE; |
579 | 562 | ||
580 | /* spa6 (bdw for dcr0) dimm0 */ | 563 | /* spa6 (bdw for dcr0) dimm0 */ |
581 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 6; | 564 | spa = nfit_buf + sizeof(*spa) * 6; |
582 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 565 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
583 | spa->header.length = sizeof(*spa); | 566 | spa->header.length = sizeof(*spa); |
584 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); | 567 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); |
@@ -587,7 +570,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
587 | spa->length = DIMM_SIZE; | 570 | spa->length = DIMM_SIZE; |
588 | 571 | ||
589 | /* spa7 (bdw for dcr1) dimm1 */ | 572 | /* spa7 (bdw for dcr1) dimm1 */ |
590 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 7; | 573 | spa = nfit_buf + sizeof(*spa) * 7; |
591 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 574 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
592 | spa->header.length = sizeof(*spa); | 575 | spa->header.length = sizeof(*spa); |
593 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); | 576 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); |
@@ -596,7 +579,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
596 | spa->length = DIMM_SIZE; | 579 | spa->length = DIMM_SIZE; |
597 | 580 | ||
598 | /* spa8 (bdw for dcr2) dimm2 */ | 581 | /* spa8 (bdw for dcr2) dimm2 */ |
599 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 8; | 582 | spa = nfit_buf + sizeof(*spa) * 8; |
600 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 583 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
601 | spa->header.length = sizeof(*spa); | 584 | spa->header.length = sizeof(*spa); |
602 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); | 585 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); |
@@ -605,7 +588,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
605 | spa->length = DIMM_SIZE; | 588 | spa->length = DIMM_SIZE; |
606 | 589 | ||
607 | /* spa9 (bdw for dcr3) dimm3 */ | 590 | /* spa9 (bdw for dcr3) dimm3 */ |
608 | spa = nfit_buf + sizeof(struct acpi_table_nfit) + sizeof(*spa) * 9; | 591 | spa = nfit_buf + sizeof(*spa) * 9; |
609 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 592 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
610 | spa->header.length = sizeof(*spa); | 593 | spa->header.length = sizeof(*spa); |
611 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); | 594 | memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16); |
@@ -613,7 +596,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
613 | spa->address = t->dimm_dma[3]; | 596 | spa->address = t->dimm_dma[3]; |
614 | spa->length = DIMM_SIZE; | 597 | spa->length = DIMM_SIZE; |
615 | 598 | ||
616 | offset = sizeof(struct acpi_table_nfit) + sizeof(*spa) * 10; | 599 | offset = sizeof(*spa) * 10; |
617 | /* mem-region0 (spa0, dimm0) */ | 600 | /* mem-region0 (spa0, dimm0) */ |
618 | memdev = nfit_buf + offset; | 601 | memdev = nfit_buf + offset; |
619 | memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP; | 602 | memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP; |
@@ -1100,15 +1083,13 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
1100 | 1083 | ||
1101 | static void nfit_test1_setup(struct nfit_test *t) | 1084 | static void nfit_test1_setup(struct nfit_test *t) |
1102 | { | 1085 | { |
1103 | size_t size = t->nfit_size, offset; | 1086 | size_t offset; |
1104 | void *nfit_buf = t->nfit_buf; | 1087 | void *nfit_buf = t->nfit_buf; |
1105 | struct acpi_nfit_memory_map *memdev; | 1088 | struct acpi_nfit_memory_map *memdev; |
1106 | struct acpi_nfit_control_region *dcr; | 1089 | struct acpi_nfit_control_region *dcr; |
1107 | struct acpi_nfit_system_address *spa; | 1090 | struct acpi_nfit_system_address *spa; |
1108 | 1091 | ||
1109 | nfit_test_init_header(nfit_buf, size); | 1092 | offset = 0; |
1110 | |||
1111 | offset = sizeof(struct acpi_table_nfit); | ||
1112 | /* spa0 (flat range with no bdw aliasing) */ | 1093 | /* spa0 (flat range with no bdw aliasing) */ |
1113 | spa = nfit_buf + offset; | 1094 | spa = nfit_buf + offset; |
1114 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; | 1095 | spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS; |
diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h index 0a3da64638ce..4db7d5691ba7 100644 --- a/tools/virtio/linux/kernel.h +++ b/tools/virtio/linux/kernel.h | |||
@@ -110,4 +110,10 @@ static inline void free_page(unsigned long addr) | |||
110 | (void) (&_min1 == &_min2); \ | 110 | (void) (&_min1 == &_min2); \ |
111 | _min1 < _min2 ? _min1 : _min2; }) | 111 | _min1 < _min2 ? _min1 : _min2; }) |
112 | 112 | ||
113 | /* TODO: empty stubs for now. Broken but enough for virtio_ring.c */ | ||
114 | #define list_add_tail(a, b) do {} while (0) | ||
115 | #define list_del(a) do {} while (0) | ||
116 | #define list_for_each_entry(a, b, c) while (0) | ||
117 | /* end of stubs */ | ||
118 | |||
113 | #endif /* KERNEL_H */ | 119 | #endif /* KERNEL_H */ |
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h index a3e07016a440..ee125e714053 100644 --- a/tools/virtio/linux/virtio.h +++ b/tools/virtio/linux/virtio.h | |||
@@ -3,12 +3,6 @@ | |||
3 | #include <linux/scatterlist.h> | 3 | #include <linux/scatterlist.h> |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | 5 | ||
6 | /* TODO: empty stubs for now. Broken but enough for virtio_ring.c */ | ||
7 | #define list_add_tail(a, b) do {} while (0) | ||
8 | #define list_del(a) do {} while (0) | ||
9 | #define list_for_each_entry(a, b, c) while (0) | ||
10 | /* end of stubs */ | ||
11 | |||
12 | struct virtio_device { | 6 | struct virtio_device { |
13 | void *dev; | 7 | void *dev; |
14 | u64 features; | 8 | u64 features; |
diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h index 806d683ab107..57a6964a1e35 100644 --- a/tools/virtio/linux/virtio_config.h +++ b/tools/virtio/linux/virtio_config.h | |||
@@ -40,33 +40,39 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev, | |||
40 | #define virtio_has_feature(dev, feature) \ | 40 | #define virtio_has_feature(dev, feature) \ |
41 | (__virtio_test_bit((dev), feature)) | 41 | (__virtio_test_bit((dev), feature)) |
42 | 42 | ||
43 | static inline bool virtio_is_little_endian(struct virtio_device *vdev) | ||
44 | { | ||
45 | return virtio_has_feature(vdev, VIRTIO_F_VERSION_1) || | ||
46 | virtio_legacy_is_little_endian(); | ||
47 | } | ||
48 | |||
49 | /* Memory accessors */ | ||
43 | static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val) | 50 | static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val) |
44 | { | 51 | { |
45 | return __virtio16_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 52 | return __virtio16_to_cpu(virtio_is_little_endian(vdev), val); |
46 | } | 53 | } |
47 | 54 | ||
48 | static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val) | 55 | static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val) |
49 | { | 56 | { |
50 | return __cpu_to_virtio16(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 57 | return __cpu_to_virtio16(virtio_is_little_endian(vdev), val); |
51 | } | 58 | } |
52 | 59 | ||
53 | static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val) | 60 | static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val) |
54 | { | 61 | { |
55 | return __virtio32_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 62 | return __virtio32_to_cpu(virtio_is_little_endian(vdev), val); |
56 | } | 63 | } |
57 | 64 | ||
58 | static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val) | 65 | static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val) |
59 | { | 66 | { |
60 | return __cpu_to_virtio32(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 67 | return __cpu_to_virtio32(virtio_is_little_endian(vdev), val); |
61 | } | 68 | } |
62 | 69 | ||
63 | static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val) | 70 | static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val) |
64 | { | 71 | { |
65 | return __virtio64_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 72 | return __virtio64_to_cpu(virtio_is_little_endian(vdev), val); |
66 | } | 73 | } |
67 | 74 | ||
68 | static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val) | 75 | static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val) |
69 | { | 76 | { |
70 | return __cpu_to_virtio64(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 77 | return __cpu_to_virtio64(virtio_is_little_endian(vdev), val); |
71 | } | 78 | } |
72 | |||