Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / arch / s390 / kernel / perf_cpum_sf.c
index 0292d68e7dded707496b7090c9b2d7377aab8b2b..cb198d4a6dca7566b0cfba4f34854f9b6074f972 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Performance event support for the System z CPU-measurement Sampling Facility
  *
- * Copyright IBM Corp. 2013
+ * Copyright IBM Corp. 2013, 2018
  * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
  */
 #define KMSG_COMPONENT "cpum_sf"
@@ -1587,6 +1587,17 @@ static void aux_buffer_free(void *data)
                            "%lu SDBTs\n", num_sdbt);
 }
 
+static void aux_sdb_init(unsigned long sdb)
+{
+       struct hws_trailer_entry *te;
+
+       te = (struct hws_trailer_entry *)trailer_entry_ptr(sdb);
+
+       /* Save clock base */
+       te->clock_base = 1;
+       memcpy(&te->progusage2, &tod_clock_base[1], 8);
+}
+
 /*
  * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling
  * @cpu:       On which to allocate, -1 means current
@@ -1666,6 +1677,7 @@ static void *aux_buffer_setup(int cpu, void **pages, int nr_pages,
                /* Tail is the entry in a SDBT */
                *tail = (unsigned long)pages[i];
                aux->sdb_index[i] = (unsigned long)pages[i];
+               aux_sdb_init((unsigned long)pages[i]);
        }
        sfb->num_sdb = nr_pages;