aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/events/intel/ds.c28
-rw-r--r--kernel/events/internal.h4
-rw-r--r--kernel/events/ring_buffer.c64
-rw-r--r--tools/arch/arm64/include/uapi/asm/kvm.h43
-rw-r--r--tools/arch/powerpc/include/uapi/asm/kvm.h46
-rw-r--r--tools/arch/s390/include/uapi/asm/kvm.h4
-rw-r--r--tools/arch/x86/include/asm/cpufeatures.h3
-rw-r--r--tools/include/uapi/asm-generic/unistd.h14
-rw-r--r--tools/include/uapi/drm/drm.h37
-rw-r--r--tools/include/uapi/drm/i915_drm.h254
-rw-r--r--tools/include/uapi/linux/fcntl.h2
-rw-r--r--tools/include/uapi/linux/fs.h3
-rw-r--r--tools/include/uapi/linux/kvm.h15
-rw-r--r--tools/include/uapi/linux/mount.h62
-rw-r--r--tools/include/uapi/linux/sched.h1
-rwxr-xr-xtools/perf/arch/arm64/entry/syscalls/mksyscalltbl2
-rw-r--r--tools/perf/arch/s390/util/machine.c9
-rw-r--r--tools/perf/arch/x86/entry/syscalls/syscall_64.tbl6
-rw-r--r--tools/perf/tests/vmlinux-kallsyms.c9
-rw-r--r--tools/perf/util/data-convert-bt.c2
-rw-r--r--tools/perf/util/machine.c27
-rw-r--r--tools/perf/util/session.c21
-rw-r--r--tools/perf/util/thread.c15
23 files changed, 547 insertions, 124 deletions
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 7a9f5dac5abe..7acc526b4ad2 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -684,7 +684,7 @@ struct event_constraint intel_core2_pebs_event_constraints[] = {
684 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */ 684 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */
685 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 685 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
686 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ 686 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
687 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01), 687 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x01),
688 EVENT_CONSTRAINT_END 688 EVENT_CONSTRAINT_END
689}; 689};
690 690
@@ -693,7 +693,7 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
693 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */ 693 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
694 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 694 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
695 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ 695 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
696 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01), 696 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x01),
697 /* Allow all events as PEBS with no flags */ 697 /* Allow all events as PEBS with no flags */
698 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), 698 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1),
699 EVENT_CONSTRAINT_END 699 EVENT_CONSTRAINT_END
@@ -701,7 +701,7 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
701 701
702struct event_constraint intel_slm_pebs_event_constraints[] = { 702struct event_constraint intel_slm_pebs_event_constraints[] = {
703 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ 703 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
704 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x1), 704 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x1),
705 /* Allow all events as PEBS with no flags */ 705 /* Allow all events as PEBS with no flags */
706 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), 706 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1),
707 EVENT_CONSTRAINT_END 707 EVENT_CONSTRAINT_END
@@ -726,7 +726,7 @@ struct event_constraint intel_nehalem_pebs_event_constraints[] = {
726 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ 726 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
727 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ 727 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
728 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ 728 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
729 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), 729 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f),
730 EVENT_CONSTRAINT_END 730 EVENT_CONSTRAINT_END
731}; 731};
732 732
@@ -743,7 +743,7 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = {
743 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ 743 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
744 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ 744 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
745 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ 745 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
746 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), 746 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f),
747 EVENT_CONSTRAINT_END 747 EVENT_CONSTRAINT_END
748}; 748};
749 749
@@ -752,7 +752,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = {
752 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ 752 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
753 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ 753 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
754 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 754 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
755 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 755 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf),
756 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ 756 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */
757 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 757 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */
758 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 758 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
@@ -767,9 +767,9 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = {
767 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ 767 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
768 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ 768 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
769 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 769 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
770 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 770 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf),
771 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ 771 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */
772 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), 772 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2),
773 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ 773 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */
774 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 774 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */
775 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 775 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
@@ -783,9 +783,9 @@ struct event_constraint intel_hsw_pebs_event_constraints[] = {
783 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 783 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
784 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */ 784 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */
785 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 785 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
786 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 786 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf),
787 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ 787 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */
788 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), 788 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2),
789 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ 789 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */
790 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */ 790 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */
791 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */ 791 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */
@@ -806,9 +806,9 @@ struct event_constraint intel_bdw_pebs_event_constraints[] = {
806 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 806 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
807 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */ 807 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */
808 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 808 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
809 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 809 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf),
810 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ 810 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */
811 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), 811 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2),
812 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ 812 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */
813 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */ 813 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */
814 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */ 814 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */
@@ -829,9 +829,9 @@ struct event_constraint intel_bdw_pebs_event_constraints[] = {
829struct event_constraint intel_skl_pebs_event_constraints[] = { 829struct event_constraint intel_skl_pebs_event_constraints[] = {
830 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1c0, 0x2), /* INST_RETIRED.PREC_DIST */ 830 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1c0, 0x2), /* INST_RETIRED.PREC_DIST */
831 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ 831 /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */
832 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), 832 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2),
833 /* INST_RETIRED.TOTAL_CYCLES_PS (inv=1, cmask=16) (cycles:p). */ 833 /* INST_RETIRED.TOTAL_CYCLES_PS (inv=1, cmask=16) (cycles:p). */
834 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), 834 INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f),
835 INTEL_PLD_CONSTRAINT(0x1cd, 0xf), /* MEM_TRANS_RETIRED.* */ 835 INTEL_PLD_CONSTRAINT(0x1cd, 0xf), /* MEM_TRANS_RETIRED.* */
836 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ 836 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */
837 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ 837 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */
diff --git a/kernel/events/internal.h b/kernel/events/internal.h
index 79c47076700a..3aef4191798c 100644
--- a/kernel/events/internal.h
+++ b/kernel/events/internal.h
@@ -24,7 +24,7 @@ struct ring_buffer {
24 atomic_t poll; /* POLL_ for wakeups */ 24 atomic_t poll; /* POLL_ for wakeups */
25 25
26 local_t head; /* write position */ 26 local_t head; /* write position */
27 local_t nest; /* nested writers */ 27 unsigned int nest; /* nested writers */
28 local_t events; /* event limit */ 28 local_t events; /* event limit */
29 local_t wakeup; /* wakeup stamp */ 29 local_t wakeup; /* wakeup stamp */
30 local_t lost; /* nr records lost */ 30 local_t lost; /* nr records lost */
@@ -41,7 +41,7 @@ struct ring_buffer {
41 41
42 /* AUX area */ 42 /* AUX area */
43 long aux_head; 43 long aux_head;
44 local_t aux_nest; 44 unsigned int aux_nest;
45 long aux_wakeup; /* last aux_watermark boundary crossed by aux_head */ 45 long aux_wakeup; /* last aux_watermark boundary crossed by aux_head */
46 unsigned long aux_pgoff; 46 unsigned long aux_pgoff;
47 int aux_nr_pages; 47 int aux_nr_pages;
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 674b35383491..ffb59a4ef4ff 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -38,7 +38,12 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
38 struct ring_buffer *rb = handle->rb; 38 struct ring_buffer *rb = handle->rb;
39 39
40 preempt_disable(); 40 preempt_disable();
41 local_inc(&rb->nest); 41
42 /*
43 * Avoid an explicit LOAD/STORE such that architectures with memops
44 * can use them.
45 */
46 (*(volatile unsigned int *)&rb->nest)++;
42 handle->wakeup = local_read(&rb->wakeup); 47 handle->wakeup = local_read(&rb->wakeup);
43} 48}
44 49
@@ -46,17 +51,35 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
46{ 51{
47 struct ring_buffer *rb = handle->rb; 52 struct ring_buffer *rb = handle->rb;
48 unsigned long head; 53 unsigned long head;
54 unsigned int nest;
55
56 /*
57 * If this isn't the outermost nesting, we don't have to update
58 * @rb->user_page->data_head.
59 */
60 nest = READ_ONCE(rb->nest);
61 if (nest > 1) {
62 WRITE_ONCE(rb->nest, nest - 1);
63 goto out;
64 }
49 65
50again: 66again:
67 /*
68 * In order to avoid publishing a head value that goes backwards,
69 * we must ensure the load of @rb->head happens after we've
70 * incremented @rb->nest.
71 *
72 * Otherwise we can observe a @rb->head value before one published
73 * by an IRQ/NMI happening between the load and the increment.
74 */
75 barrier();
51 head = local_read(&rb->head); 76 head = local_read(&rb->head);
52 77
53 /* 78 /*
54 * IRQ/NMI can happen here, which means we can miss a head update. 79 * IRQ/NMI can happen here and advance @rb->head, causing our
80 * load above to be stale.
55 */ 81 */
56 82
57 if (!local_dec_and_test(&rb->nest))
58 goto out;
59
60 /* 83 /*
61 * Since the mmap() consumer (userspace) can run on a different CPU: 84 * Since the mmap() consumer (userspace) can run on a different CPU:
62 * 85 *
@@ -84,14 +107,23 @@ again:
84 * See perf_output_begin(). 107 * See perf_output_begin().
85 */ 108 */
86 smp_wmb(); /* B, matches C */ 109 smp_wmb(); /* B, matches C */
87 rb->user_page->data_head = head; 110 WRITE_ONCE(rb->user_page->data_head, head);
88 111
89 /* 112 /*
90 * Now check if we missed an update -- rely on previous implied 113 * We must publish the head before decrementing the nest count,
91 * compiler barriers to force a re-read. 114 * otherwise an IRQ/NMI can publish a more recent head value and our
115 * write will (temporarily) publish a stale value.
92 */ 116 */
117 barrier();
118 WRITE_ONCE(rb->nest, 0);
119
120 /*
121 * Ensure we decrement @rb->nest before we validate the @rb->head.
122 * Otherwise we cannot be sure we caught the 'last' nested update.
123 */
124 barrier();
93 if (unlikely(head != local_read(&rb->head))) { 125 if (unlikely(head != local_read(&rb->head))) {
94 local_inc(&rb->nest); 126 WRITE_ONCE(rb->nest, 1);
95 goto again; 127 goto again;
96 } 128 }
97 129
@@ -330,6 +362,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
330 struct perf_event *output_event = event; 362 struct perf_event *output_event = event;
331 unsigned long aux_head, aux_tail; 363 unsigned long aux_head, aux_tail;
332 struct ring_buffer *rb; 364 struct ring_buffer *rb;
365 unsigned int nest;
333 366
334 if (output_event->parent) 367 if (output_event->parent)
335 output_event = output_event->parent; 368 output_event = output_event->parent;
@@ -360,13 +393,16 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
360 if (!refcount_inc_not_zero(&rb->aux_refcount)) 393 if (!refcount_inc_not_zero(&rb->aux_refcount))
361 goto err; 394 goto err;
362 395
396 nest = READ_ONCE(rb->aux_nest);
363 /* 397 /*
364 * Nesting is not supported for AUX area, make sure nested 398 * Nesting is not supported for AUX area, make sure nested
365 * writers are caught early 399 * writers are caught early
366 */ 400 */
367 if (WARN_ON_ONCE(local_xchg(&rb->aux_nest, 1))) 401 if (WARN_ON_ONCE(nest))
368 goto err_put; 402 goto err_put;
369 403
404 WRITE_ONCE(rb->aux_nest, nest + 1);
405
370 aux_head = rb->aux_head; 406 aux_head = rb->aux_head;
371 407
372 handle->rb = rb; 408 handle->rb = rb;
@@ -394,7 +430,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
394 if (!handle->size) { /* A, matches D */ 430 if (!handle->size) { /* A, matches D */
395 event->pending_disable = smp_processor_id(); 431 event->pending_disable = smp_processor_id();
396 perf_output_wakeup(handle); 432 perf_output_wakeup(handle);
397 local_set(&rb->aux_nest, 0); 433 WRITE_ONCE(rb->aux_nest, 0);
398 goto err_put; 434 goto err_put;
399 } 435 }
400 } 436 }
@@ -471,7 +507,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
471 perf_event_aux_event(handle->event, aux_head, size, 507 perf_event_aux_event(handle->event, aux_head, size,
472 handle->aux_flags); 508 handle->aux_flags);
473 509
474 rb->user_page->aux_head = rb->aux_head; 510 WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
475 if (rb_need_aux_wakeup(rb)) 511 if (rb_need_aux_wakeup(rb))
476 wakeup = true; 512 wakeup = true;
477 513
@@ -483,7 +519,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
483 519
484 handle->event = NULL; 520 handle->event = NULL;
485 521
486 local_set(&rb->aux_nest, 0); 522 WRITE_ONCE(rb->aux_nest, 0);
487 /* can't be last */ 523 /* can't be last */
488 rb_free_aux(rb); 524 rb_free_aux(rb);
489 ring_buffer_put(rb); 525 ring_buffer_put(rb);
@@ -503,7 +539,7 @@ int perf_aux_output_skip(struct perf_output_handle *handle, unsigned long size)
503 539
504 rb->aux_head += size; 540 rb->aux_head += size;
505 541
506 rb->user_page->aux_head = rb->aux_head; 542 WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
507 if (rb_need_aux_wakeup(rb)) { 543 if (rb_need_aux_wakeup(rb)) {
508 perf_output_wakeup(handle); 544 perf_output_wakeup(handle);
509 handle->wakeup = rb->aux_wakeup + rb->aux_watermark; 545 handle->wakeup = rb->aux_wakeup + rb->aux_watermark;
diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h
index 97c3478ee6e7..7b7ac0f6cec9 100644
--- a/tools/arch/arm64/include/uapi/asm/kvm.h
+++ b/tools/arch/arm64/include/uapi/asm/kvm.h
@@ -35,6 +35,7 @@
35#include <linux/psci.h> 35#include <linux/psci.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <asm/ptrace.h> 37#include <asm/ptrace.h>
38#include <asm/sve_context.h>
38 39
39#define __KVM_HAVE_GUEST_DEBUG 40#define __KVM_HAVE_GUEST_DEBUG
40#define __KVM_HAVE_IRQ_LINE 41#define __KVM_HAVE_IRQ_LINE
@@ -102,6 +103,9 @@ struct kvm_regs {
102#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */ 103#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */
103#define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */ 104#define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */
104#define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */ 105#define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */
106#define KVM_ARM_VCPU_SVE 4 /* enable SVE for this CPU */
107#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5 /* VCPU uses address authentication */
108#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication */
105 109
106struct kvm_vcpu_init { 110struct kvm_vcpu_init {
107 __u32 target; 111 __u32 target;
@@ -226,6 +230,45 @@ struct kvm_vcpu_events {
226 KVM_REG_ARM_FW | ((r) & 0xffff)) 230 KVM_REG_ARM_FW | ((r) & 0xffff))
227#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) 231#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
228 232
233/* SVE registers */
234#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
235
236/* Z- and P-regs occupy blocks at the following offsets within this range: */
237#define KVM_REG_ARM64_SVE_ZREG_BASE 0
238#define KVM_REG_ARM64_SVE_PREG_BASE 0x400
239#define KVM_REG_ARM64_SVE_FFR_BASE 0x600
240
241#define KVM_ARM64_SVE_NUM_ZREGS __SVE_NUM_ZREGS
242#define KVM_ARM64_SVE_NUM_PREGS __SVE_NUM_PREGS
243
244#define KVM_ARM64_SVE_MAX_SLICES 32
245
246#define KVM_REG_ARM64_SVE_ZREG(n, i) \
247 (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | \
248 KVM_REG_SIZE_U2048 | \
249 (((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) | \
250 ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
251
252#define KVM_REG_ARM64_SVE_PREG(n, i) \
253 (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | \
254 KVM_REG_SIZE_U256 | \
255 (((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) | \
256 ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
257
258#define KVM_REG_ARM64_SVE_FFR(i) \
259 (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | \
260 KVM_REG_SIZE_U256 | \
261 ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
262
263#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN
264#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
265
266/* Vector lengths pseudo-register: */
267#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | \
268 KVM_REG_SIZE_U512 | 0xffff)
269#define KVM_ARM64_SVE_VLS_WORDS \
270 ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
271
229/* Device Control API: ARM VGIC */ 272/* Device Control API: ARM VGIC */
230#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 273#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
231#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 274#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h
index 26ca425f4c2c..b0f72dea8b11 100644
--- a/tools/arch/powerpc/include/uapi/asm/kvm.h
+++ b/tools/arch/powerpc/include/uapi/asm/kvm.h
@@ -482,6 +482,8 @@ struct kvm_ppc_cpu_char {
482#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */ 482#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */
483#define KVM_REG_PPC_ICP_PPRI_MASK 0xff 483#define KVM_REG_PPC_ICP_PPRI_MASK 0xff
484 484
485#define KVM_REG_PPC_VP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d)
486
485/* Device control API: PPC-specific devices */ 487/* Device control API: PPC-specific devices */
486#define KVM_DEV_MPIC_GRP_MISC 1 488#define KVM_DEV_MPIC_GRP_MISC 1
487#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */ 489#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */
@@ -677,4 +679,48 @@ struct kvm_ppc_cpu_char {
677#define KVM_XICS_PRESENTED (1ULL << 43) 679#define KVM_XICS_PRESENTED (1ULL << 43)
678#define KVM_XICS_QUEUED (1ULL << 44) 680#define KVM_XICS_QUEUED (1ULL << 44)
679 681
682/* POWER9 XIVE Native Interrupt Controller */
683#define KVM_DEV_XIVE_GRP_CTRL 1
684#define KVM_DEV_XIVE_RESET 1
685#define KVM_DEV_XIVE_EQ_SYNC 2
686#define KVM_DEV_XIVE_GRP_SOURCE 2 /* 64-bit source identifier */
687#define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */
688#define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */
689#define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */
690
691/* Layout of 64-bit XIVE source attribute values */
692#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0)
693#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1)
694
695/* Layout of 64-bit XIVE source configuration attribute values */
696#define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0
697#define KVM_XIVE_SOURCE_PRIORITY_MASK 0x7
698#define KVM_XIVE_SOURCE_SERVER_SHIFT 3
699#define KVM_XIVE_SOURCE_SERVER_MASK 0xfffffff8ULL
700#define KVM_XIVE_SOURCE_MASKED_SHIFT 32
701#define KVM_XIVE_SOURCE_MASKED_MASK 0x100000000ULL
702#define KVM_XIVE_SOURCE_EISN_SHIFT 33
703#define KVM_XIVE_SOURCE_EISN_MASK 0xfffffffe00000000ULL
704
705/* Layout of 64-bit EQ identifier */
706#define KVM_XIVE_EQ_PRIORITY_SHIFT 0
707#define KVM_XIVE_EQ_PRIORITY_MASK 0x7
708#define KVM_XIVE_EQ_SERVER_SHIFT 3
709#define KVM_XIVE_EQ_SERVER_MASK 0xfffffff8ULL
710
711/* Layout of EQ configuration values (64 bytes) */
712struct kvm_ppc_xive_eq {
713 __u32 flags;
714 __u32 qshift;
715 __u64 qaddr;
716 __u32 qtoggle;
717 __u32 qindex;
718 __u8 pad[40];
719};
720
721#define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001
722
723#define KVM_XIVE_TIMA_PAGE_OFFSET 0
724#define KVM_XIVE_ESB_PAGE_OFFSET 4
725
680#endif /* __LINUX_KVM_POWERPC_H */ 726#endif /* __LINUX_KVM_POWERPC_H */
diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h
index 09652eabe769..47104e5b47fd 100644
--- a/tools/arch/s390/include/uapi/asm/kvm.h
+++ b/tools/arch/s390/include/uapi/asm/kvm.h
@@ -153,7 +153,9 @@ struct kvm_s390_vm_cpu_subfunc {
153 __u8 ppno[16]; /* with MSA5 */ 153 __u8 ppno[16]; /* with MSA5 */
154 __u8 kma[16]; /* with MSA8 */ 154 __u8 kma[16]; /* with MSA8 */
155 __u8 kdsa[16]; /* with MSA9 */ 155 __u8 kdsa[16]; /* with MSA9 */
156 __u8 reserved[1792]; 156 __u8 sortl[32]; /* with STFLE.150 */
157 __u8 dfltcc[32]; /* with STFLE.151 */
158 __u8 reserved[1728];
157}; 159};
158 160
159/* kvm attributes for crypto */ 161/* kvm attributes for crypto */
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index 981ff9479648..75f27ee2c263 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -344,6 +344,7 @@
344/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ 344/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
345#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ 345#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
346#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ 346#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
347#define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
347#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ 348#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
348#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ 349#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
349#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ 350#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
@@ -382,5 +383,7 @@
382#define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */ 383#define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */
383#define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17) /* CPU is affected by speculative store bypass attack */ 384#define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17) /* CPU is affected by speculative store bypass attack */
384#define X86_BUG_L1TF X86_BUG(18) /* CPU is affected by L1 Terminal Fault */ 385#define X86_BUG_L1TF X86_BUG(18) /* CPU is affected by L1 Terminal Fault */
386#define X86_BUG_MDS X86_BUG(19) /* CPU is affected by Microarchitectural data sampling */
387#define X86_BUG_MSBDS_ONLY X86_BUG(20) /* CPU is only affected by the MSDBS variant of BUG_MDS */
385 388
386#endif /* _ASM_X86_CPUFEATURES_H */ 389#endif /* _ASM_X86_CPUFEATURES_H */
diff --git a/tools/include/uapi/asm-generic/unistd.h b/tools/include/uapi/asm-generic/unistd.h
index dee7292e1df6..a87904daf103 100644
--- a/tools/include/uapi/asm-generic/unistd.h
+++ b/tools/include/uapi/asm-generic/unistd.h
@@ -832,9 +832,21 @@ __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
832__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter) 832__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
833#define __NR_io_uring_register 427 833#define __NR_io_uring_register 427
834__SYSCALL(__NR_io_uring_register, sys_io_uring_register) 834__SYSCALL(__NR_io_uring_register, sys_io_uring_register)
835#define __NR_open_tree 428
836__SYSCALL(__NR_open_tree, sys_open_tree)
837#define __NR_move_mount 429
838__SYSCALL(__NR_move_mount, sys_move_mount)
839#define __NR_fsopen 430
840__SYSCALL(__NR_fsopen, sys_fsopen)
841#define __NR_fsconfig 431
842__SYSCALL(__NR_fsconfig, sys_fsconfig)
843#define __NR_fsmount 432
844__SYSCALL(__NR_fsmount, sys_fsmount)
845#define __NR_fspick 433
846__SYSCALL(__NR_fspick, sys_fspick)
835 847
836#undef __NR_syscalls 848#undef __NR_syscalls
837#define __NR_syscalls 428 849#define __NR_syscalls 434
838 850
839/* 851/*
840 * 32 bit systems traditionally used different 852 * 32 bit systems traditionally used different
diff --git a/tools/include/uapi/drm/drm.h b/tools/include/uapi/drm/drm.h
index 300f336633f2..661d73f9a919 100644
--- a/tools/include/uapi/drm/drm.h
+++ b/tools/include/uapi/drm/drm.h
@@ -649,6 +649,7 @@ struct drm_gem_open {
649#define DRM_CAP_PAGE_FLIP_TARGET 0x11 649#define DRM_CAP_PAGE_FLIP_TARGET 0x11
650#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 650#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
651#define DRM_CAP_SYNCOBJ 0x13 651#define DRM_CAP_SYNCOBJ 0x13
652#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
652 653
653/** DRM_IOCTL_GET_CAP ioctl argument type */ 654/** DRM_IOCTL_GET_CAP ioctl argument type */
654struct drm_get_cap { 655struct drm_get_cap {
@@ -735,8 +736,18 @@ struct drm_syncobj_handle {
735 __u32 pad; 736 __u32 pad;
736}; 737};
737 738
739struct drm_syncobj_transfer {
740 __u32 src_handle;
741 __u32 dst_handle;
742 __u64 src_point;
743 __u64 dst_point;
744 __u32 flags;
745 __u32 pad;
746};
747
738#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 748#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
739#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 749#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
750#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
740struct drm_syncobj_wait { 751struct drm_syncobj_wait {
741 __u64 handles; 752 __u64 handles;
742 /* absolute timeout */ 753 /* absolute timeout */
@@ -747,12 +758,33 @@ struct drm_syncobj_wait {
747 __u32 pad; 758 __u32 pad;
748}; 759};
749 760
761struct drm_syncobj_timeline_wait {
762 __u64 handles;
763 /* wait on specific timeline point for every handles*/
764 __u64 points;
765 /* absolute timeout */
766 __s64 timeout_nsec;
767 __u32 count_handles;
768 __u32 flags;
769 __u32 first_signaled; /* only valid when not waiting all */
770 __u32 pad;
771};
772
773
750struct drm_syncobj_array { 774struct drm_syncobj_array {
751 __u64 handles; 775 __u64 handles;
752 __u32 count_handles; 776 __u32 count_handles;
753 __u32 pad; 777 __u32 pad;
754}; 778};
755 779
780struct drm_syncobj_timeline_array {
781 __u64 handles;
782 __u64 points;
783 __u32 count_handles;
784 __u32 pad;
785};
786
787
756/* Query current scanout sequence number */ 788/* Query current scanout sequence number */
757struct drm_crtc_get_sequence { 789struct drm_crtc_get_sequence {
758 __u32 crtc_id; /* requested crtc_id */ 790 __u32 crtc_id; /* requested crtc_id */
@@ -909,6 +941,11 @@ extern "C" {
909#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) 941#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)
910#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) 942#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
911 943
944#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
945#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
946#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
947#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
948
912/** 949/**
913 * Device specific ioctls should only be in their respective headers 950 * Device specific ioctls should only be in their respective headers
914 * The device specific ioctl range is from 0x40 to 0x9f. 951 * The device specific ioctl range is from 0x40 to 0x9f.
diff --git a/tools/include/uapi/drm/i915_drm.h b/tools/include/uapi/drm/i915_drm.h
index 397810fa2d33..3a73f5316766 100644
--- a/tools/include/uapi/drm/i915_drm.h
+++ b/tools/include/uapi/drm/i915_drm.h
@@ -63,6 +63,28 @@ extern "C" {
63#define I915_RESET_UEVENT "RESET" 63#define I915_RESET_UEVENT "RESET"
64 64
65/* 65/*
66 * i915_user_extension: Base class for defining a chain of extensions
67 *
68 * Many interfaces need to grow over time. In most cases we can simply
69 * extend the struct and have userspace pass in more data. Another option,
70 * as demonstrated by Vulkan's approach to providing extensions for forward
71 * and backward compatibility, is to use a list of optional structs to
72 * provide those extra details.
73 *
74 * The key advantage to using an extension chain is that it allows us to
75 * redefine the interface more easily than an ever growing struct of
76 * increasing complexity, and for large parts of that interface to be
77 * entirely optional. The downside is more pointer chasing; chasing across
78 * the __user boundary with pointers encapsulated inside u64.
79 */
80struct i915_user_extension {
81 __u64 next_extension;
82 __u32 name;
83 __u32 flags; /* All undefined bits must be zero. */
84 __u32 rsvd[4]; /* Reserved for future use; must be zero. */
85};
86
87/*
66 * MOCS indexes used for GPU surfaces, defining the cacheability of the 88 * MOCS indexes used for GPU surfaces, defining the cacheability of the
67 * surface data and the coherency for this data wrt. CPU vs. GPU accesses. 89 * surface data and the coherency for this data wrt. CPU vs. GPU accesses.
68 */ 90 */
@@ -99,9 +121,23 @@ enum drm_i915_gem_engine_class {
99 I915_ENGINE_CLASS_VIDEO = 2, 121 I915_ENGINE_CLASS_VIDEO = 2,
100 I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, 122 I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
101 123
124 /* should be kept compact */
125
102 I915_ENGINE_CLASS_INVALID = -1 126 I915_ENGINE_CLASS_INVALID = -1
103}; 127};
104 128
129/*
130 * There may be more than one engine fulfilling any role within the system.
131 * Each engine of a class is given a unique instance number and therefore
132 * any engine can be specified by its class:instance tuplet. APIs that allow
133 * access to any engine in the system will use struct i915_engine_class_instance
134 * for this identification.
135 */
136struct i915_engine_class_instance {
137 __u16 engine_class; /* see enum drm_i915_gem_engine_class */
138 __u16 engine_instance;
139};
140
105/** 141/**
106 * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915 142 * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915
107 * 143 *
@@ -319,6 +355,7 @@ typedef struct _drm_i915_sarea {
319#define DRM_I915_PERF_ADD_CONFIG 0x37 355#define DRM_I915_PERF_ADD_CONFIG 0x37
320#define DRM_I915_PERF_REMOVE_CONFIG 0x38 356#define DRM_I915_PERF_REMOVE_CONFIG 0x38
321#define DRM_I915_QUERY 0x39 357#define DRM_I915_QUERY 0x39
358/* Must be kept compact -- no holes */
322 359
323#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 360#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
324#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 361#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -367,6 +404,7 @@ typedef struct _drm_i915_sarea {
367#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 404#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
368#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) 405#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
369#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 406#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
407#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext)
370#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 408#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
371#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 409#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
372#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 410#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
@@ -476,6 +514,7 @@ typedef struct drm_i915_irq_wait {
476#define I915_SCHEDULER_CAP_ENABLED (1ul << 0) 514#define I915_SCHEDULER_CAP_ENABLED (1ul << 0)
477#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) 515#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
478#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) 516#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
517#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
479 518
480#define I915_PARAM_HUC_STATUS 42 519#define I915_PARAM_HUC_STATUS 42
481 520
@@ -559,6 +598,8 @@ typedef struct drm_i915_irq_wait {
559 */ 598 */
560#define I915_PARAM_MMAP_GTT_COHERENT 52 599#define I915_PARAM_MMAP_GTT_COHERENT 52
561 600
601/* Must be kept compact -- no holes and well documented */
602
562typedef struct drm_i915_getparam { 603typedef struct drm_i915_getparam {
563 __s32 param; 604 __s32 param;
564 /* 605 /*
@@ -574,6 +615,7 @@ typedef struct drm_i915_getparam {
574#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 615#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
575#define I915_SETPARAM_ALLOW_BATCHBUFFER 3 616#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
576#define I915_SETPARAM_NUM_USED_FENCES 4 617#define I915_SETPARAM_NUM_USED_FENCES 4
618/* Must be kept compact -- no holes */
577 619
578typedef struct drm_i915_setparam { 620typedef struct drm_i915_setparam {
579 int param; 621 int param;
@@ -972,7 +1014,7 @@ struct drm_i915_gem_execbuffer2 {
972 * struct drm_i915_gem_exec_fence *fences. 1014 * struct drm_i915_gem_exec_fence *fences.
973 */ 1015 */
974 __u64 cliprects_ptr; 1016 __u64 cliprects_ptr;
975#define I915_EXEC_RING_MASK (7<<0) 1017#define I915_EXEC_RING_MASK (0x3f)
976#define I915_EXEC_DEFAULT (0<<0) 1018#define I915_EXEC_DEFAULT (0<<0)
977#define I915_EXEC_RENDER (1<<0) 1019#define I915_EXEC_RENDER (1<<0)
978#define I915_EXEC_BSD (2<<0) 1020#define I915_EXEC_BSD (2<<0)
@@ -1120,32 +1162,34 @@ struct drm_i915_gem_busy {
1120 * as busy may become idle before the ioctl is completed. 1162 * as busy may become idle before the ioctl is completed.
1121 * 1163 *
1122 * Furthermore, if the object is busy, which engine is busy is only 1164 * Furthermore, if the object is busy, which engine is busy is only
1123 * provided as a guide. There are race conditions which prevent the 1165 * provided as a guide and only indirectly by reporting its class
1124 * report of which engines are busy from being always accurate. 1166 * (there may be more than one engine in each class). There are race
1125 * However, the converse is not true. If the object is idle, the 1167 * conditions which prevent the report of which engines are busy from
1126 * result of the ioctl, that all engines are idle, is accurate. 1168 * being always accurate. However, the converse is not true. If the
1169 * object is idle, the result of the ioctl, that all engines are idle,
1170 * is accurate.
1127 * 1171 *
1128 * The returned dword is split into two fields to indicate both 1172 * The returned dword is split into two fields to indicate both
1129 * the engines on which the object is being read, and the 1173 * the engine classess on which the object is being read, and the
1130 * engine on which it is currently being written (if any). 1174 * engine class on which it is currently being written (if any).
1131 * 1175 *
1132 * The low word (bits 0:15) indicate if the object is being written 1176 * The low word (bits 0:15) indicate if the object is being written
1133 * to by any engine (there can only be one, as the GEM implicit 1177 * to by any engine (there can only be one, as the GEM implicit
1134 * synchronisation rules force writes to be serialised). Only the 1178 * synchronisation rules force writes to be serialised). Only the
1135 * engine for the last write is reported. 1179 * engine class (offset by 1, I915_ENGINE_CLASS_RENDER is reported as
1180 * 1 not 0 etc) for the last write is reported.
1136 * 1181 *
1137 * The high word (bits 16:31) are a bitmask of which engines are 1182 * The high word (bits 16:31) are a bitmask of which engines classes
1138 * currently reading from the object. Multiple engines may be 1183 * are currently reading from the object. Multiple engines may be
1139 * reading from the object simultaneously. 1184 * reading from the object simultaneously.
1140 * 1185 *
1141 * The value of each engine is the same as specified in the 1186 * The value of each engine class is the same as specified in the
1142 * EXECBUFFER2 ioctl, i.e. I915_EXEC_RENDER, I915_EXEC_BSD etc. 1187 * I915_CONTEXT_SET_ENGINES parameter and via perf, i.e.
1143 * Note I915_EXEC_DEFAULT is a symbolic value and is mapped to 1188 * I915_ENGINE_CLASS_RENDER, I915_ENGINE_CLASS_COPY, etc.
1144 * the I915_EXEC_RENDER engine for execution, and so it is never
1145 * reported as active itself. Some hardware may have parallel 1189 * reported as active itself. Some hardware may have parallel
1146 * execution engines, e.g. multiple media engines, which are 1190 * execution engines, e.g. multiple media engines, which are
1147 * mapped to the same identifier in the EXECBUFFER2 ioctl and 1191 * mapped to the same class identifier and so are not separately
1148 * so are not separately reported for busyness. 1192 * reported for busyness.
1149 * 1193 *
1150 * Caveat emptor: 1194 * Caveat emptor:
1151 * Only the boolean result of this query is reliable; that is whether 1195 * Only the boolean result of this query is reliable; that is whether
@@ -1412,65 +1456,17 @@ struct drm_i915_gem_wait {
1412}; 1456};
1413 1457
1414struct drm_i915_gem_context_create { 1458struct drm_i915_gem_context_create {
1415 /* output: id of new context*/ 1459 __u32 ctx_id; /* output: id of new context*/
1416 __u32 ctx_id;
1417 __u32 pad;
1418};
1419
1420struct drm_i915_gem_context_destroy {
1421 __u32 ctx_id;
1422 __u32 pad; 1460 __u32 pad;
1423}; 1461};
1424 1462
1425struct drm_i915_reg_read { 1463struct drm_i915_gem_context_create_ext {
1426 /* 1464 __u32 ctx_id; /* output: id of new context*/
1427 * Register offset.
1428 * For 64bit wide registers where the upper 32bits don't immediately
1429 * follow the lower 32bits, the offset of the lower 32bits must
1430 * be specified
1431 */
1432 __u64 offset;
1433#define I915_REG_READ_8B_WA (1ul << 0)
1434
1435 __u64 val; /* Return value */
1436};
1437/* Known registers:
1438 *
1439 * Render engine timestamp - 0x2358 + 64bit - gen7+
1440 * - Note this register returns an invalid value if using the default
1441 * single instruction 8byte read, in order to workaround that pass
1442 * flag I915_REG_READ_8B_WA in offset field.
1443 *
1444 */
1445
1446struct drm_i915_reset_stats {
1447 __u32 ctx_id;
1448 __u32 flags;
1449
1450 /* All resets since boot/module reload, for all contexts */
1451 __u32 reset_count;
1452
1453 /* Number of batches lost when active in GPU, for this context */
1454 __u32 batch_active;
1455
1456 /* Number of batches lost pending for execution, for this context */
1457 __u32 batch_pending;
1458
1459 __u32 pad;
1460};
1461
1462struct drm_i915_gem_userptr {
1463 __u64 user_ptr;
1464 __u64 user_size;
1465 __u32 flags; 1465 __u32 flags;
1466#define I915_USERPTR_READ_ONLY 0x1 1466#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0)
1467#define I915_USERPTR_UNSYNCHRONIZED 0x80000000 1467#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \
1468 /** 1468 (-(I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS << 1))
1469 * Returned handle for the object. 1469 __u64 extensions;
1470 *
1471 * Object handles are nonzero.
1472 */
1473 __u32 handle;
1474}; 1470};
1475 1471
1476struct drm_i915_gem_context_param { 1472struct drm_i915_gem_context_param {
@@ -1491,6 +1487,28 @@ struct drm_i915_gem_context_param {
1491 * drm_i915_gem_context_param_sseu. 1487 * drm_i915_gem_context_param_sseu.
1492 */ 1488 */
1493#define I915_CONTEXT_PARAM_SSEU 0x7 1489#define I915_CONTEXT_PARAM_SSEU 0x7
1490
1491/*
1492 * Not all clients may want to attempt automatic recover of a context after
1493 * a hang (for example, some clients may only submit very small incremental
1494 * batches relying on known logical state of previous batches which will never
1495 * recover correctly and each attempt will hang), and so would prefer that
1496 * the context is forever banned instead.
1497 *
1498 * If set to false (0), after a reset, subsequent (and in flight) rendering
1499 * from this context is discarded, and the client will need to create a new
1500 * context to use instead.
1501 *
1502 * If set to true (1), the kernel will automatically attempt to recover the
1503 * context by skipping the hanging batch and executing the next batch starting
1504 * from the default context state (discarding the incomplete logical context
1505 * state lost due to the reset).
1506 *
1507 * On creation, all new contexts are marked as recoverable.
1508 */
1509#define I915_CONTEXT_PARAM_RECOVERABLE 0x8
1510/* Must be kept compact -- no holes and well documented */
1511
1494 __u64 value; 1512 __u64 value;
1495}; 1513};
1496 1514
@@ -1519,8 +1537,7 @@ struct drm_i915_gem_context_param_sseu {
1519 /* 1537 /*
1520 * Engine class & instance to be configured or queried. 1538 * Engine class & instance to be configured or queried.
1521 */ 1539 */
1522 __u16 engine_class; 1540 struct i915_engine_class_instance engine;
1523 __u16 engine_instance;
1524 1541
1525 /* 1542 /*
1526 * Unused for now. Must be cleared to zero. 1543 * Unused for now. Must be cleared to zero.
@@ -1553,6 +1570,96 @@ struct drm_i915_gem_context_param_sseu {
1553 __u32 rsvd; 1570 __u32 rsvd;
1554}; 1571};
1555 1572
1573struct drm_i915_gem_context_create_ext_setparam {
1574#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
1575 struct i915_user_extension base;
1576 struct drm_i915_gem_context_param param;
1577};
1578
1579struct drm_i915_gem_context_destroy {
1580 __u32 ctx_id;
1581 __u32 pad;
1582};
1583
1584/*
1585 * DRM_I915_GEM_VM_CREATE -
1586 *
1587 * Create a new virtual memory address space (ppGTT) for use within a context
1588 * on the same file. Extensions can be provided to configure exactly how the
1589 * address space is setup upon creation.
1590 *
1591 * The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is
1592 * returned in the outparam @id.
1593 *
1594 * No flags are defined, with all bits reserved and must be zero.
1595 *
1596 * An extension chain maybe provided, starting with @extensions, and terminated
1597 * by the @next_extension being 0. Currently, no extensions are defined.
1598 *
1599 * DRM_I915_GEM_VM_DESTROY -
1600 *
1601 * Destroys a previously created VM id, specified in @id.
1602 *
1603 * No extensions or flags are allowed currently, and so must be zero.
1604 */
1605struct drm_i915_gem_vm_control {
1606 __u64 extensions;
1607 __u32 flags;
1608 __u32 vm_id;
1609};
1610
1611struct drm_i915_reg_read {
1612 /*
1613 * Register offset.
1614 * For 64bit wide registers where the upper 32bits don't immediately
1615 * follow the lower 32bits, the offset of the lower 32bits must
1616 * be specified
1617 */
1618 __u64 offset;
1619#define I915_REG_READ_8B_WA (1ul << 0)
1620
1621 __u64 val; /* Return value */
1622};
1623
1624/* Known registers:
1625 *
1626 * Render engine timestamp - 0x2358 + 64bit - gen7+
1627 * - Note this register returns an invalid value if using the default
1628 * single instruction 8byte read, in order to workaround that pass
1629 * flag I915_REG_READ_8B_WA in offset field.
1630 *
1631 */
1632
1633struct drm_i915_reset_stats {
1634 __u32 ctx_id;
1635 __u32 flags;
1636
1637 /* All resets since boot/module reload, for all contexts */
1638 __u32 reset_count;
1639
1640 /* Number of batches lost when active in GPU, for this context */
1641 __u32 batch_active;
1642
1643 /* Number of batches lost pending for execution, for this context */
1644 __u32 batch_pending;
1645
1646 __u32 pad;
1647};
1648
1649struct drm_i915_gem_userptr {
1650 __u64 user_ptr;
1651 __u64 user_size;
1652 __u32 flags;
1653#define I915_USERPTR_READ_ONLY 0x1
1654#define I915_USERPTR_UNSYNCHRONIZED 0x80000000
1655 /**
1656 * Returned handle for the object.
1657 *
1658 * Object handles are nonzero.
1659 */
1660 __u32 handle;
1661};
1662
1556enum drm_i915_oa_format { 1663enum drm_i915_oa_format {
1557 I915_OA_FORMAT_A13 = 1, /* HSW only */ 1664 I915_OA_FORMAT_A13 = 1, /* HSW only */
1558 I915_OA_FORMAT_A29, /* HSW only */ 1665 I915_OA_FORMAT_A29, /* HSW only */
@@ -1714,6 +1821,7 @@ struct drm_i915_perf_oa_config {
1714struct drm_i915_query_item { 1821struct drm_i915_query_item {
1715 __u64 query_id; 1822 __u64 query_id;
1716#define DRM_I915_QUERY_TOPOLOGY_INFO 1 1823#define DRM_I915_QUERY_TOPOLOGY_INFO 1
1824/* Must be kept compact -- no holes and well documented */
1717 1825
1718 /* 1826 /*
1719 * When set to zero by userspace, this is filled with the size of the 1827 * When set to zero by userspace, this is filled with the size of the
diff --git a/tools/include/uapi/linux/fcntl.h b/tools/include/uapi/linux/fcntl.h
index a2f8658f1c55..1d338357df8a 100644
--- a/tools/include/uapi/linux/fcntl.h
+++ b/tools/include/uapi/linux/fcntl.h
@@ -91,5 +91,7 @@
91#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ 91#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */
92#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ 92#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */
93 93
94#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
95
94 96
95#endif /* _UAPI_LINUX_FCNTL_H */ 97#endif /* _UAPI_LINUX_FCNTL_H */
diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h
index 121e82ce296b..59c71fa8c553 100644
--- a/tools/include/uapi/linux/fs.h
+++ b/tools/include/uapi/linux/fs.h
@@ -320,6 +320,9 @@ struct fscrypt_key {
320#define SYNC_FILE_RANGE_WAIT_BEFORE 1 320#define SYNC_FILE_RANGE_WAIT_BEFORE 1
321#define SYNC_FILE_RANGE_WRITE 2 321#define SYNC_FILE_RANGE_WRITE 2
322#define SYNC_FILE_RANGE_WAIT_AFTER 4 322#define SYNC_FILE_RANGE_WAIT_AFTER 4
323#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \
324 SYNC_FILE_RANGE_WAIT_BEFORE | \
325 SYNC_FILE_RANGE_WAIT_AFTER)
323 326
324/* 327/*
325 * Flags for preadv2/pwritev2: 328 * Flags for preadv2/pwritev2:
diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h
index 6d4ea4b6c922..2fe12b40d503 100644
--- a/tools/include/uapi/linux/kvm.h
+++ b/tools/include/uapi/linux/kvm.h
@@ -986,8 +986,13 @@ struct kvm_ppc_resize_hpt {
986#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163 986#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
987#define KVM_CAP_EXCEPTION_PAYLOAD 164 987#define KVM_CAP_EXCEPTION_PAYLOAD 164
988#define KVM_CAP_ARM_VM_IPA_SIZE 165 988#define KVM_CAP_ARM_VM_IPA_SIZE 165
989#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 989#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 /* Obsolete */
990#define KVM_CAP_HYPERV_CPUID 167 990#define KVM_CAP_HYPERV_CPUID 167
991#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
992#define KVM_CAP_PPC_IRQ_XIVE 169
993#define KVM_CAP_ARM_SVE 170
994#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
995#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
991 996
992#ifdef KVM_CAP_IRQ_ROUTING 997#ifdef KVM_CAP_IRQ_ROUTING
993 998
@@ -1145,6 +1150,7 @@ struct kvm_dirty_tlb {
1145#define KVM_REG_SIZE_U256 0x0050000000000000ULL 1150#define KVM_REG_SIZE_U256 0x0050000000000000ULL
1146#define KVM_REG_SIZE_U512 0x0060000000000000ULL 1151#define KVM_REG_SIZE_U512 0x0060000000000000ULL
1147#define KVM_REG_SIZE_U1024 0x0070000000000000ULL 1152#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
1153#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
1148 1154
1149struct kvm_reg_list { 1155struct kvm_reg_list {
1150 __u64 n; /* number of regs */ 1156 __u64 n; /* number of regs */
@@ -1211,6 +1217,8 @@ enum kvm_device_type {
1211#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 1217#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
1212 KVM_DEV_TYPE_ARM_VGIC_ITS, 1218 KVM_DEV_TYPE_ARM_VGIC_ITS,
1213#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS 1219#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
1220 KVM_DEV_TYPE_XIVE,
1221#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
1214 KVM_DEV_TYPE_MAX, 1222 KVM_DEV_TYPE_MAX,
1215}; 1223};
1216 1224
@@ -1434,12 +1442,15 @@ struct kvm_enc_region {
1434#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state) 1442#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
1435#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) 1443#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
1436 1444
1437/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */ 1445/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */
1438#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log) 1446#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
1439 1447
1440/* Available with KVM_CAP_HYPERV_CPUID */ 1448/* Available with KVM_CAP_HYPERV_CPUID */
1441#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2) 1449#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
1442 1450
1451/* Available with KVM_CAP_ARM_SVE */
1452#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
1453
1443/* Secure Encrypted Virtualization command */ 1454/* Secure Encrypted Virtualization command */
1444enum sev_cmd_id { 1455enum sev_cmd_id {
1445 /* Guest initialization commands */ 1456 /* Guest initialization commands */
diff --git a/tools/include/uapi/linux/mount.h b/tools/include/uapi/linux/mount.h
index 3f9ec42510b0..96a0240f23fe 100644
--- a/tools/include/uapi/linux/mount.h
+++ b/tools/include/uapi/linux/mount.h
@@ -55,4 +55,66 @@
55#define MS_MGC_VAL 0xC0ED0000 55#define MS_MGC_VAL 0xC0ED0000
56#define MS_MGC_MSK 0xffff0000 56#define MS_MGC_MSK 0xffff0000
57 57
58/*
59 * open_tree() flags.
60 */
61#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
62#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
63
64/*
65 * move_mount() flags.
66 */
67#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
68#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
69#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
70#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
71#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
72#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
73#define MOVE_MOUNT__MASK 0x00000077
74
75/*
76 * fsopen() flags.
77 */
78#define FSOPEN_CLOEXEC 0x00000001
79
80/*
81 * fspick() flags.
82 */
83#define FSPICK_CLOEXEC 0x00000001
84#define FSPICK_SYMLINK_NOFOLLOW 0x00000002
85#define FSPICK_NO_AUTOMOUNT 0x00000004
86#define FSPICK_EMPTY_PATH 0x00000008
87
88/*
89 * The type of fsconfig() call made.
90 */
91enum fsconfig_command {
92 FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
93 FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
94 FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
95 FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
96 FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
97 FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
98 FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
99 FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
100};
101
102/*
103 * fsmount() flags.
104 */
105#define FSMOUNT_CLOEXEC 0x00000001
106
107/*
108 * Mount attributes.
109 */
110#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */
111#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */
112#define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */
113#define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */
114#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */
115#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */
116#define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */
117#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
118#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */
119
58#endif /* _UAPI_LINUX_MOUNT_H */ 120#endif /* _UAPI_LINUX_MOUNT_H */
diff --git a/tools/include/uapi/linux/sched.h b/tools/include/uapi/linux/sched.h
index 22627f80063e..ed4ee170bee2 100644
--- a/tools/include/uapi/linux/sched.h
+++ b/tools/include/uapi/linux/sched.h
@@ -10,6 +10,7 @@
10#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ 10#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
11#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ 11#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
12#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ 12#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
13#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */
13#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ 14#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
14#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ 15#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
15#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ 16#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c88fd32563eb..459469b7222c 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -56,7 +56,7 @@ create_table()
56 echo "};" 56 echo "};"
57} 57}
58 58
59$gcc -E -dM -x c $input \ 59$gcc -E -dM -x c -I $incpath/include/uapi $input \
60 |sed -ne 's/^#define __NR_//p' \ 60 |sed -ne 's/^#define __NR_//p' \
61 |sort -t' ' -k2 -nu \ 61 |sort -t' ' -k2 -nu \
62 |create_table 62 |create_table
diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c
index 0b2054007314..a19690a17291 100644
--- a/tools/perf/arch/s390/util/machine.c
+++ b/tools/perf/arch/s390/util/machine.c
@@ -5,16 +5,19 @@
5#include "util.h" 5#include "util.h"
6#include "machine.h" 6#include "machine.h"
7#include "api/fs/fs.h" 7#include "api/fs/fs.h"
8#include "debug.h"
8 9
9int arch__fix_module_text_start(u64 *start, const char *name) 10int arch__fix_module_text_start(u64 *start, const char *name)
10{ 11{
12 u64 m_start = *start;
11 char path[PATH_MAX]; 13 char path[PATH_MAX];
12 14
13 snprintf(path, PATH_MAX, "module/%.*s/sections/.text", 15 snprintf(path, PATH_MAX, "module/%.*s/sections/.text",
14 (int)strlen(name) - 2, name + 1); 16 (int)strlen(name) - 2, name + 1);
15 17 if (sysfs__read_ull(path, (unsigned long long *)start) < 0) {
16 if (sysfs__read_ull(path, (unsigned long long *)start) < 0) 18 pr_debug2("Using module %s start:%#lx\n", path, m_start);
17 return -1; 19 *start = m_start;
20 }
18 21
19 return 0; 22 return 0;
20} 23}
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
index 92ee0b4378d4..b4e6f9e6204a 100644
--- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
@@ -349,6 +349,12 @@
349425 common io_uring_setup __x64_sys_io_uring_setup 349425 common io_uring_setup __x64_sys_io_uring_setup
350426 common io_uring_enter __x64_sys_io_uring_enter 350426 common io_uring_enter __x64_sys_io_uring_enter
351427 common io_uring_register __x64_sys_io_uring_register 351427 common io_uring_register __x64_sys_io_uring_register
352428 common open_tree __x64_sys_open_tree
353429 common move_mount __x64_sys_move_mount
354430 common fsopen __x64_sys_fsopen
355431 common fsconfig __x64_sys_fsconfig
356432 common fsmount __x64_sys_fsmount
357433 common fspick __x64_sys_fspick
352 358
353# 359#
354# x32-specific system call numbers start at 512 to avoid cache impact 360# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c
index 7691980b7df1..f101576d1c72 100644
--- a/tools/perf/tests/vmlinux-kallsyms.c
+++ b/tools/perf/tests/vmlinux-kallsyms.c
@@ -161,9 +161,16 @@ next_pair:
161 161
162 continue; 162 continue;
163 } 163 }
164 } else 164 } else if (mem_start == kallsyms.vmlinux_map->end) {
165 /*
166 * Ignore aliases to _etext, i.e. to the end of the kernel text area,
167 * such as __indirect_thunk_end.
168 */
169 continue;
170 } else {
165 pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n", 171 pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n",
166 mem_start, sym->name); 172 mem_start, sym->name);
173 }
167 174
168 err = -1; 175 err = -1;
169 } 176 }
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index e0311c9750ad..9097543a818b 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -271,7 +271,7 @@ static int string_set_value(struct bt_ctf_field *field, const char *string)
271 if (i > 0) 271 if (i > 0)
272 strncpy(buffer, string, i); 272 strncpy(buffer, string, i);
273 } 273 }
274 strncat(buffer + p, numstr, 4); 274 memcpy(buffer + p, numstr, 4);
275 p += 3; 275 p += 3;
276 } 276 }
277 } 277 }
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 28a9541c4835..dc7aafe45a2b 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -924,7 +924,8 @@ const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL};
924 * symbol_name if it's not that important. 924 * symbol_name if it's not that important.
925 */ 925 */
926static int machine__get_running_kernel_start(struct machine *machine, 926static int machine__get_running_kernel_start(struct machine *machine,
927 const char **symbol_name, u64 *start) 927 const char **symbol_name,
928 u64 *start, u64 *end)
928{ 929{
929 char filename[PATH_MAX]; 930 char filename[PATH_MAX];
930 int i, err = -1; 931 int i, err = -1;
@@ -949,6 +950,11 @@ static int machine__get_running_kernel_start(struct machine *machine,
949 *symbol_name = name; 950 *symbol_name = name;
950 951
951 *start = addr; 952 *start = addr;
953
954 err = kallsyms__get_function_start(filename, "_etext", &addr);
955 if (!err)
956 *end = addr;
957
952 return 0; 958 return 0;
953} 959}
954 960
@@ -1441,7 +1447,7 @@ int machine__create_kernel_maps(struct machine *machine)
1441 struct dso *kernel = machine__get_kernel(machine); 1447 struct dso *kernel = machine__get_kernel(machine);
1442 const char *name = NULL; 1448 const char *name = NULL;
1443 struct map *map; 1449 struct map *map;
1444 u64 addr = 0; 1450 u64 start = 0, end = ~0ULL;
1445 int ret; 1451 int ret;
1446 1452
1447 if (kernel == NULL) 1453 if (kernel == NULL)
@@ -1460,9 +1466,9 @@ int machine__create_kernel_maps(struct machine *machine)
1460 "continuing anyway...\n", machine->pid); 1466 "continuing anyway...\n", machine->pid);
1461 } 1467 }
1462 1468
1463 if (!machine__get_running_kernel_start(machine, &name, &addr)) { 1469 if (!machine__get_running_kernel_start(machine, &name, &start, &end)) {
1464 if (name && 1470 if (name &&
1465 map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, name, addr)) { 1471 map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, name, start)) {
1466 machine__destroy_kernel_maps(machine); 1472 machine__destroy_kernel_maps(machine);
1467 ret = -1; 1473 ret = -1;
1468 goto out_put; 1474 goto out_put;
@@ -1472,16 +1478,19 @@ int machine__create_kernel_maps(struct machine *machine)
1472 * we have a real start address now, so re-order the kmaps 1478 * we have a real start address now, so re-order the kmaps
1473 * assume it's the last in the kmaps 1479 * assume it's the last in the kmaps
1474 */ 1480 */
1475 machine__update_kernel_mmap(machine, addr, ~0ULL); 1481 machine__update_kernel_mmap(machine, start, end);
1476 } 1482 }
1477 1483
1478 if (machine__create_extra_kernel_maps(machine, kernel)) 1484 if (machine__create_extra_kernel_maps(machine, kernel))
1479 pr_debug("Problems creating extra kernel maps, continuing anyway...\n"); 1485 pr_debug("Problems creating extra kernel maps, continuing anyway...\n");
1480 1486
1481 /* update end address of the kernel map using adjacent module address */ 1487 if (end == ~0ULL) {
1482 map = map__next(machine__kernel_map(machine)); 1488 /* update end address of the kernel map using adjacent module address */
1483 if (map) 1489 map = map__next(machine__kernel_map(machine));
1484 machine__set_kernel_mmap(machine, addr, map->start); 1490 if (map)
1491 machine__set_kernel_mmap(machine, start, map->start);
1492 }
1493
1485out_put: 1494out_put:
1486 dso__put(kernel); 1495 dso__put(kernel);
1487 return ret; 1496 return ret;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 2310a1752983..54cf163347f7 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -647,6 +647,26 @@ static void perf_event__throttle_swap(union perf_event *event,
647 swap_sample_id_all(event, &event->throttle + 1); 647 swap_sample_id_all(event, &event->throttle + 1);
648} 648}
649 649
650static void perf_event__namespaces_swap(union perf_event *event,
651 bool sample_id_all)
652{
653 u64 i;
654
655 event->namespaces.pid = bswap_32(event->namespaces.pid);
656 event->namespaces.tid = bswap_32(event->namespaces.tid);
657 event->namespaces.nr_namespaces = bswap_64(event->namespaces.nr_namespaces);
658
659 for (i = 0; i < event->namespaces.nr_namespaces; i++) {
660 struct perf_ns_link_info *ns = &event->namespaces.link_info[i];
661
662 ns->dev = bswap_64(ns->dev);
663 ns->ino = bswap_64(ns->ino);
664 }
665
666 if (sample_id_all)
667 swap_sample_id_all(event, &event->namespaces.link_info[i]);
668}
669
650static u8 revbyte(u8 b) 670static u8 revbyte(u8 b)
651{ 671{
652 int rev = (b >> 4) | ((b & 0xf) << 4); 672 int rev = (b >> 4) | ((b & 0xf) << 4);
@@ -887,6 +907,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
887 [PERF_RECORD_LOST_SAMPLES] = perf_event__all64_swap, 907 [PERF_RECORD_LOST_SAMPLES] = perf_event__all64_swap,
888 [PERF_RECORD_SWITCH] = perf_event__switch_swap, 908 [PERF_RECORD_SWITCH] = perf_event__switch_swap,
889 [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, 909 [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap,
910 [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap,
890 [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, 911 [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
891 [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, 912 [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,
892 [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap, 913 [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap,
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 403045a2bbea..b413ba5b9835 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -133,7 +133,7 @@ void thread__put(struct thread *thread)
133 } 133 }
134} 134}
135 135
136struct namespaces *thread__namespaces(const struct thread *thread) 136static struct namespaces *__thread__namespaces(const struct thread *thread)
137{ 137{
138 if (list_empty(&thread->namespaces_list)) 138 if (list_empty(&thread->namespaces_list))
139 return NULL; 139 return NULL;
@@ -141,10 +141,21 @@ struct namespaces *thread__namespaces(const struct thread *thread)
141 return list_first_entry(&thread->namespaces_list, struct namespaces, list); 141 return list_first_entry(&thread->namespaces_list, struct namespaces, list);
142} 142}
143 143
144struct namespaces *thread__namespaces(const struct thread *thread)
145{
146 struct namespaces *ns;
147
148 down_read((struct rw_semaphore *)&thread->namespaces_lock);
149 ns = __thread__namespaces(thread);
150 up_read((struct rw_semaphore *)&thread->namespaces_lock);
151
152 return ns;
153}
154
144static int __thread__set_namespaces(struct thread *thread, u64 timestamp, 155static int __thread__set_namespaces(struct thread *thread, u64 timestamp,
145 struct namespaces_event *event) 156 struct namespaces_event *event)
146{ 157{
147 struct namespaces *new, *curr = thread__namespaces(thread); 158 struct namespaces *new, *curr = __thread__namespaces(thread);
148 159
149 new = namespaces__new(event); 160 new = namespaces__new(event);
150 if (!new) 161 if (!new)