linux/drivers/platform/x86/intel/ifs/runtest.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2022 Intel Corporation. */

#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/nmi.h>
#include <linux/slab.h>
#include <linux/stop_machine.h>

#include "ifs.h"

/*
 * Note all code and data in this file is protected by
 * ifs_sem. On HT systems all threads on a core will
 * execute together, but only the first thread on the
 * core will update results of the test.
 */

#define CREATE_TRACE_POINTS
#include <trace/events/intel_ifs.h>

/* Max retries on the same chunk */
#define MAX_IFS_RETRIES

struct run_params {};

/*
 * Number of TSC cycles that a logical CPU will wait for the other
 * logical CPU on the core in the WRMSR(ACTIVATE_SCAN).
 */
#define IFS_THREAD_WAIT

enum ifs_status_err_code {};

static const char * const scan_test_status[] =;

static void message_not_tested(struct device *dev, int cpu, union ifs_status status)
{}

static void message_fail(struct device *dev, int cpu, union ifs_status status)
{}

static bool can_restart(union ifs_status status)
{}

#define SPINUNIT
static atomic_t array_cpus_in;
static atomic_t scan_cpus_in;

/*
 * Simplified cpu sibling rendezvous loop based on microcode loader __wait_for_cpus()
 */
static void wait_for_sibling_cpu(atomic_t *t, long long timeout)
{}

/*
 * Execute the scan. Called "simultaneously" on all threads of a core
 * at high priority using the stop_cpus mechanism.
 */
static int doscan(void *data)
{}

/*
 * Use stop_core_cpuslocked() to synchronize writing to MSR_ACTIVATE_SCAN
 * on all threads of the core to be tested. Loop if necessary to complete
 * run of all chunks. Include some defensive tests to make sure forward
 * progress is made, and that the whole test completes in a reasonable time.
 */
static void ifs_test_core(int cpu, struct device *dev)
{}

static int do_array_test(void *data)
{}

static void ifs_array_test_core(int cpu, struct device *dev)
{}

#define ARRAY_GEN1_TEST_ALL_ARRAYS
#define ARRAY_GEN1_STATUS_FAIL

static int do_array_test_gen1(void *status)
{}

static void ifs_array_test_gen1(int cpu, struct device *dev)
{}

/*
 * Initiate per core test. It wakes up work queue threads on the target cpu and
 * its sibling cpu. Once all sibling threads wake up, the scan test gets executed and
 * wait for all sibling threads to finish the scan test.
 */
int do_core_test(int cpu, struct device *dev)
{}